CommonController.java 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579
  1. package com.fs.app.controller;
  2. import cn.hutool.core.net.URLDecoder;
  3. import cn.hutool.json.JSONUtil;
  4. import com.fs.app.param.ExcelParam;
  5. import com.fs.app.utils.JwtUtils;
  6. import com.fs.common.config.FSSysConfig;
  7. import com.fs.common.core.domain.R;
  8. import com.fs.common.utils.StringUtils;
  9. import com.fs.common.utils.poi.ExcelUtil;
  10. import com.fs.company.domain.CompanySmsLogs;
  11. import com.fs.company.domain.CompanyUser;
  12. import com.fs.company.service.ICompanySmsLogsService;
  13. import com.fs.company.service.ICompanyUserService;
  14. import com.fs.company.service.ICompanyVoiceLogsService;
  15. import com.fs.core.config.ServerConfig;
  16. import com.fs.crm.domain.CrmCustomer;
  17. import com.fs.crm.domain.CrmCustomerContacts;
  18. import com.fs.crm.domain.CrmCustomerHisOrder;
  19. import com.fs.crm.dto.CrmCustomerHisOrderDTO;
  20. import com.fs.crm.dto.CrmCustomerHisOrderItemDTO;
  21. import com.fs.crm.param.CrmCustomeReceiveParam;
  22. import com.fs.crm.service.*;
  23. import com.fs.jpush.service.JpushService;
  24. import com.fs.store.dto.ExpressNotifyDTO;
  25. import com.fs.store.dto.ExpressResultDTO;
  26. import com.fs.store.service.IFsAppVersionService;
  27. import com.fs.store.service.IFsCityService;
  28. import com.fs.store.service.IFsStoreOrderService;
  29. import com.fs.store.service.IPrescribeService;
  30. import com.fs.system.service.ISysConfigService;
  31. import com.fs.system.service.ISysDictDataService;
  32. import com.fs.system.vo.DictVO;
  33. import com.fs.voice.service.IVoiceService;
  34. import io.swagger.annotations.Api;
  35. import io.swagger.annotations.ApiOperation;
  36. import org.slf4j.Logger;
  37. import org.slf4j.LoggerFactory;
  38. import org.springframework.beans.factory.annotation.Autowired;
  39. import org.springframework.scheduling.annotation.Async;
  40. import org.springframework.web.bind.annotation.*;
  41. import org.springframework.web.multipart.MultipartFile;
  42. import java.math.BigDecimal;
  43. import java.nio.charset.Charset;
  44. import java.sql.*;
  45. import java.time.LocalDateTime;
  46. import java.time.format.DateTimeFormatter;
  47. import java.util.ArrayList;
  48. import java.util.HashMap;
  49. import java.util.List;
  50. import java.util.Map;
  51. @Api("公共接口")
  52. @RestController
  53. @RequestMapping(value="/app/common")
  54. public class CommonController extends AppBaseController {
  55. Logger logger = LoggerFactory.getLogger(CommonController.class);
  56. @Autowired
  57. JwtUtils jwtUtils;
  58. @Autowired
  59. private ServerConfig serverConfig;
  60. @Autowired
  61. private ISysDictDataService dictDataService;
  62. @Autowired
  63. ICrmCustomerUserService crmCustomerUserService;
  64. @Autowired
  65. ICrmCustomerService crmCustomerService;
  66. @Autowired
  67. private ICrmMsgService msgService;
  68. @Autowired
  69. private ISysConfigService configService;
  70. @Autowired
  71. private ICrmEventService eventService;
  72. @Autowired
  73. private IVoiceService voiceService;
  74. @Autowired
  75. ICompanyUserService userService;
  76. @Autowired
  77. IPrescribeService prescribeService;
  78. @Autowired
  79. FSSysConfig fsSysConfig;
  80. @Autowired
  81. private IFsAppVersionService fsAppVersionService;
  82. @Autowired
  83. private IFsCityService fsCityService;
  84. @Autowired
  85. private JpushService jpushService;
  86. @Autowired
  87. private ICrmCustomerHisOrderService crmCustomerHisOrderService;
  88. @Autowired
  89. IFsStoreOrderService orderService;
  90. @Autowired
  91. private ICompanySmsLogsService smsLogsService;
  92. @Autowired
  93. private ICompanyVoiceLogsService voiceLogsService;
  94. @Autowired
  95. private ICompanyUserService companyUserService;
  96. @Autowired
  97. private ICrmCustomerContactsService crmCustomerContactsService;
  98. public static final Logger LOGGER = LoggerFactory.getLogger(CommonController.class);
  99. @ApiOperation("导入EXCEL")
  100. @PostMapping(value = "/importExcel")
  101. public R importExcel(MultipartFile file)
  102. {
  103. ExcelUtil<ExcelParam> util = new ExcelUtil<ExcelParam>(ExcelParam.class);
  104. try {
  105. List<ExcelParam> list = util.importExcel(file.getInputStream());
  106. Connection connection= DriverManager.getConnection("jdbc:mysql://localhost:3307/test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8","root","root");
  107. PreparedStatement ps=null;
  108. for(ExcelParam param:list){
  109. String sql="insert into pay_scriptdkl_fszh (nickname,short_id) values(?,?)";
  110. ps=connection.prepareStatement(sql);
  111. ps.setString(1, param.getNickname());
  112. ps.setString(2, param.getId());
  113. //4.excuteUpdate
  114. int resultSet=ps.executeUpdate();
  115. if(resultSet>0){
  116. //如果插入成功,则打印success
  117. System.out.println("Sucess");
  118. }else{
  119. //如果插入失败,则打印Failure
  120. System.out.println("Failure");
  121. }
  122. }
  123. } catch (Exception e) {
  124. e.printStackTrace();
  125. }
  126. return R.ok();
  127. }
  128. @ApiOperation("客户数据导入")
  129. @GetMapping(value = "/importCustomer")
  130. public R importCustomer(@RequestParam("id")Long id)
  131. {
  132. importCustomers(id);
  133. return R.ok();
  134. }
  135. @Async
  136. public void importCustomers(Long cid){
  137. List<DictVO> dict=dictDataService.selectDictDataListByType("crm_customer_source");
  138. Connection connection=null;
  139. try {
  140. connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/t9-1?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8","root","19860213");
  141. Integer count=0;
  142. Integer pageIndex=0;
  143. while (true) {
  144. try {
  145. String sql="select * from jt_cs_entity where code_>"+cid+" order by code_ asc limit "+pageIndex+", 10";
  146. PreparedStatement preparedStatement = connection.prepareStatement(sql);
  147. ResultSet resultSet = preparedStatement.executeQuery();
  148. if(!resultSet.next()){
  149. break;
  150. }
  151. while (resultSet.next()) {
  152. CrmCustomer customer=new CrmCustomer();
  153. try {
  154. String id=resultSet.getString("id_");
  155. String code=resultSet.getString("code_");
  156. String name_=resultSet.getString("name_");
  157. String srcs_name_=resultSet.getString("srcs_name_");//渠道名
  158. String employee_id_=resultSet.getString("employee_id_");//员工ID
  159. //String weixin_=resultSet.getString("weixin_");
  160. String so_total_=resultSet.getString("so_total_");//消费总金额
  161. String so_count_=resultSet.getString("so_count_");//购物 - 订单数量
  162. Date last_follow_time_=resultSet.getDate("last_follow_time_");//最后跟进时间
  163. String gender_=resultSet.getString("gender_");//性别 男 女
  164. String desc_=resultSet.getString("desc_");//备注
  165. String entry_=resultSet.getString("entry_");//进线方式
  166. String pr_name_=resultSet.getString("pr_name_");
  167. String ci_name_=resultSet.getString("ci_name_");
  168. String ar_name_=resultSet.getString("ar_name_");
  169. String address_=resultSet.getString("decrypt_address_");
  170. String create_by_=resultSet.getString("create_by_");//创建者ID 1343427544115974144
  171. Timestamp create_time_=resultSet.getTimestamp("create_time_");
  172. customer.setCustomerCode(code);
  173. customer.setIsLine(0);
  174. for(DictVO dictVO:dict){
  175. if(dictVO.getDictLabel().trim().equals(srcs_name_.trim())){
  176. customer.setSource(Integer.parseInt(dictVO.getDictValue()));
  177. }
  178. }
  179. customer.setSourceCode(srcs_name_);
  180. customer.setRegisterType(entry_);
  181. if(StringUtils.isNotEmpty(so_count_)){
  182. customer.setBuyCount(Integer.parseInt(so_count_));
  183. }
  184. if(StringUtils.isNotEmpty(so_total_)){
  185. customer.setPayMoney(BigDecimal.valueOf(Float.parseFloat(so_total_)));
  186. }
  187. //标签处理
  188. String tagSql="select group_concat(co.name_ separator ',') as name from jt_cs_entity e INNER JOIN jt_gl_tag t on t.entity_id_=e.id_ INNER join jt_gl_cate_opt co on co.id_=t.opt_id_ where e.id_='"+id+"' ";
  189. PreparedStatement preparedStatementTag = connection.prepareStatement(tagSql);
  190. ResultSet resultSetTag = preparedStatementTag.executeQuery();
  191. while (resultSetTag.next()) {
  192. String tag=resultSetTag.getString("name");
  193. if(StringUtils.isNotEmpty(tag)){
  194. customer.setTags(tag);
  195. }
  196. }
  197. preparedStatementTag.close();
  198. resultSetTag.close();
  199. customer.setCustomerName(name_);
  200. if(StringUtils.isNotEmpty(gender_)){
  201. if(gender_.equals("男")){
  202. customer.setSex(1);
  203. }
  204. else if(gender_.equals("女")){
  205. customer.setSex(2);
  206. }
  207. }
  208. //customer.setWeixin(weixin_);
  209. customer.setRemark(desc_);
  210. StringBuilder address=new StringBuilder();
  211. if(StringUtils.isNotEmpty(pr_name_)){
  212. address.append(pr_name_+"-");
  213. }
  214. if(StringUtils.isNotEmpty(ci_name_)){
  215. address.append(ci_name_+"-");
  216. }
  217. if(StringUtils.isNotEmpty(ar_name_)){
  218. address.append(ar_name_+"-");
  219. }
  220. customer.setAddress(address.toString());
  221. customer.setDetailAddress(address_);
  222. customer.setStatus(1);
  223. customer.setIsReceive(0);
  224. customer.setIsPool(1);
  225. if(create_time_!=null){
  226. Date date = new Date(create_time_.getTime());
  227. customer.setCreateTime(date);
  228. }
  229. else{
  230. customer.setCreateTime(new java.util.Date());
  231. }
  232. if(last_follow_time_!=null){
  233. customer.setVisitTime(last_follow_time_);
  234. }
  235. //查员工表
  236. String userSql="select * from jt_ou_employee where id_ = '"+employee_id_+"' ";
  237. PreparedStatement preparedStatementUser = connection.prepareStatement(userSql);
  238. ResultSet resultSetUser = preparedStatementUser.executeQuery();
  239. CompanyUser user=null;
  240. while (resultSetUser.next()) {
  241. String user_name_=resultSetUser.getString("name_");//CQ纪文正001(已删除)
  242. //匹配员工 及 公司
  243. if(user_name_.substring(0,2).equals("CQ")){
  244. //重庆分公司
  245. customer.setCompanyId(12l);
  246. //查本公司下的员工
  247. user_name_=user_name_.replace("(已删除)","");
  248. user_name_ = user_name_.replaceAll("[0-9]","");
  249. user_name_=user_name_.substring(2);
  250. user=companyUserService.selectCompanyUserByCompanyIdAndNickName(12l,user_name_);
  251. if(user!=null){
  252. customer.setCreateUserId(user.getUserId());
  253. customer.setDeptId(user.getDeptId());
  254. }
  255. }
  256. else if(user_name_.substring(0,2).equals("SD")){
  257. //山东分公司
  258. customer.setCompanyId(16l);
  259. user_name_=user_name_.replace("(已删除)","");
  260. user_name_ = user_name_.replaceAll("[0-9]","");
  261. user_name_=user_name_.substring(2);
  262. user=companyUserService.selectCompanyUserByCompanyIdAndNickName(16l,user_name_);
  263. if(user!=null){
  264. customer.setCreateUserId(user.getUserId());
  265. customer.setDeptId(user.getDeptId());
  266. }
  267. }
  268. else if(user_name_.substring(0,2).equals("RY")){
  269. //山东分公司
  270. customer.setCompanyId(16l);
  271. user_name_=user_name_.replace("(已删除)","");
  272. user_name_ = user_name_.replaceAll("[0-9]","");
  273. user_name_=user_name_.substring(2);
  274. user=companyUserService.selectCompanyUserByCompanyIdAndNickName(16l,user_name_);
  275. if(user!=null){
  276. customer.setCreateUserId(user.getUserId());
  277. customer.setDeptId(user.getDeptId());
  278. }
  279. }
  280. else{
  281. //湖南润天嘉合医药科技有限公司
  282. user_name_=user_name_.replace("HN","");
  283. user_name_=user_name_.replace("(已删除)","");
  284. user_name_ = user_name_.replaceAll("[0-9]","");
  285. user=companyUserService.selectCompanyUserByCompanyIdAndNickName(55l,user_name_);
  286. if(user!=null){
  287. customer.setCompanyId(55l);
  288. customer.setCreateUserId(user.getUserId());
  289. customer.setDeptId(user.getDeptId());
  290. }
  291. else{
  292. //湖南润天悦派医药科技有限公司
  293. user=companyUserService.selectCompanyUserByCompanyIdAndNickName(58l,user_name_);
  294. if(user!=null){
  295. customer.setCompanyId(58l);
  296. customer.setCreateUserId(user.getUserId());
  297. customer.setDeptId(user.getDeptId());
  298. }
  299. else {
  300. customer.setCompanyId(37l);
  301. customer.setIsLine(0);
  302. customer.setIsPool(1);
  303. }
  304. }
  305. }
  306. }
  307. preparedStatementUser.close();
  308. resultSetUser.close();
  309. //处理进线
  310. String sqlResiter="select * from jt_cs_extend where id_='"+id+"' ";
  311. PreparedStatement preparedStatementReg = connection.prepareStatement(sqlResiter);
  312. ResultSet resultSetReg = preparedStatementReg.executeQuery();
  313. while (resultSetReg.next()) {
  314. String column2_=resultSetReg.getString("column2_");//客户填写时间
  315. customer.setRegisterSubmitTime(column2_);
  316. // if(StringUtils.isNotEmpty(column2_)){
  317. // try {
  318. // String strDateFormat = "yyyy-MM-dd HH:mm:ss";
  319. // SimpleDateFormat f = new SimpleDateFormat(strDateFormat);
  320. //
  321. // }
  322. // catch (Exception e){
  323. // LOGGER.info("导入ERROR:"+e.getMessage());
  324. // }
  325. //
  326. // }
  327. String column9_=resultSetReg.getString("column9_");//客户详情
  328. if(StringUtils.isNotEmpty(column9_)){
  329. customer.setRegisterDesc(column9_);
  330. }
  331. String column8_=resultSetReg.getString("column8_");//广告连接
  332. if(StringUtils.isNotEmpty(column8_)){
  333. customer.setRegisterLinkUrl(column8_);
  334. }
  335. String column6_=resultSetReg.getString("column6_");//推线时间
  336. if(StringUtils.isNotEmpty(column6_)){
  337. customer.setPushTime(column6_);
  338. customer.setRegisterDate(column6_);
  339. // try {
  340. // String strDateFormat = "yyyyMMdd";
  341. // SimpleDateFormat f = new SimpleDateFormat(strDateFormat);
  342. //
  343. // }
  344. // catch (Exception e){
  345. // LOGGER.info("导入ERROR:"+e.getMessage());
  346. // }
  347. }
  348. String column5_=resultSetReg.getString("column5_");//来源渠道编码
  349. if(StringUtils.isNotEmpty(column5_)){
  350. customer.setSourceCode(column5_);
  351. }
  352. String column4_=resultSetReg.getString("column4_");//推线编码
  353. if(StringUtils.isNotEmpty(column4_)){
  354. customer.setPushCode(column4_);
  355. }
  356. }
  357. preparedStatementReg.close();
  358. resultSetReg.close();
  359. //如果已存在,跳过
  360. // if(crmCustomerService.check(customer.getCustomerCode())>0){
  361. // continue;
  362. // }
  363. crmCustomerService.insertCrmCustomer(customer);
  364. //如果归属员工 自动认领
  365. if(customer.getCreateUserId()!=null&&customer.getCreateUserId()>0){
  366. CrmCustomeReceiveParam param=new CrmCustomeReceiveParam();
  367. param.setCompanyUserId(customer.getCreateUserId());
  368. param.setCustomerId(customer.getCustomerId());
  369. param.setCompanyId(customer.getCompanyId());
  370. param.setDeptId(customer.getDeptId());
  371. crmCustomerService.receive(param,user.getNickName());
  372. }
  373. //手机号
  374. String sqlPhone="select * from jt_cs_phone where cs_id_='"+id+"' ";
  375. PreparedStatement preparedStatementPhone = connection.prepareStatement(sqlPhone);
  376. ResultSet resultSetPhone = preparedStatementPhone.executeQuery();
  377. while (resultSetPhone.next()) {
  378. String phoneId=resultSetPhone.getString("id_");
  379. String mobile=resultSetPhone.getString("decrypt_mobile_");
  380. Timestamp phone_create_time_=resultSetPhone.getTimestamp("create_time_");
  381. CrmCustomerContacts contacts=new CrmCustomerContacts();
  382. contacts.setCustomerId(customer.getCustomerId());
  383. contacts.setName(customer.getCustomerName());
  384. contacts.setMobile(mobile);
  385. contacts.setIsDel(0);
  386. if(phone_create_time_!=null){
  387. Date date=new Date(phone_create_time_.getTime());
  388. contacts.setCreateTime(date);
  389. }
  390. else{
  391. contacts.setCreateTime(new java.util.Date());
  392. }
  393. crmCustomerContactsService.insertCrmCustomerContacts(contacts);
  394. customer.setMobile(contacts.getMobile());
  395. }
  396. preparedStatementPhone.close();
  397. resultSetPhone.close();
  398. //短信记录
  399. String sqlSms="select * from jt_sms_record where cs_id_='"+id+"' ";
  400. PreparedStatement preparedStatementSms = connection.prepareStatement(sqlSms);
  401. ResultSet resultSetSms = preparedStatementSms.executeQuery();
  402. while (resultSetSms.next()) {
  403. String content_=resultSetSms.getString("content_");
  404. String decrypt_mobile_=resultSetSms.getString("decrypt_mobile_");
  405. String result_=resultSetSms.getString("result_");//SUCCESS
  406. Timestamp sms_create_time_=resultSetSms.getTimestamp("create_time_");
  407. String sms_create_by_name_=resultSetSms.getString("create_by_name_");//发送者
  408. CompanySmsLogs logs=new CompanySmsLogs();
  409. logs.setCustomerId(customer.getCustomerId());
  410. if(result_.equals("SUCCESS")){
  411. logs.setStatus(1);
  412. }
  413. else{
  414. logs.setStatus(-1);
  415. }
  416. logs.setContent(content_);
  417. logs.setCompanyId(customer.getCompanyId());
  418. if(sms_create_time_!=null){
  419. Date date=new Date(sms_create_time_.getTime());
  420. logs.setSendTime(date);
  421. logs.setCreateTime(date);
  422. }
  423. else{
  424. logs.setSendTime(new java.util.Date());
  425. logs.setCreateTime(new java.util.Date());
  426. }
  427. logs.setPhone(decrypt_mobile_);
  428. smsLogsService.insertCompanySmsLogs(logs);
  429. }
  430. preparedStatementSms.close();
  431. resultSetSms.close();
  432. //订单表
  433. String orderSql="select * from jt_so_entity where cs_id_='"+id+"' ";
  434. PreparedStatement preparedStatementOrder = connection.prepareStatement(orderSql);
  435. ResultSet resultSetOrder = preparedStatementOrder.executeQuery();
  436. while (resultSetOrder.next()) {
  437. String id_=resultSetOrder.getString("id_");
  438. String so_no_=resultSetOrder.getString("so_no_");
  439. Integer prod_qty_=resultSetOrder.getInt("prod_qty_");
  440. BigDecimal prod_amount_=resultSetOrder.getBigDecimal("prod_amount_");//订单金额
  441. BigDecimal shipping_amount_=resultSetOrder.getBigDecimal("shipping_amount_");//运费
  442. BigDecimal sub_amount_=resultSetOrder.getBigDecimal("sub_amount_");//订金
  443. BigDecimal payed_amount_=resultSetOrder.getBigDecimal("payed_amount_");//支付金额
  444. String status_=resultSetOrder.getString("status_");
  445. String pay_status_=resultSetOrder.getString("pay_status_");
  446. String cs_id_=resultSetOrder.getString("cs_id_");
  447. String sc_tracking_no_=resultSetOrder.getString("sc_tracking_no_");//运单号
  448. Timestamp order_create_time_ = resultSet.getTimestamp("create_time_");
  449. CrmCustomerHisOrder order=new CrmCustomerHisOrder();
  450. CrmCustomerHisOrderDTO dto =new CrmCustomerHisOrderDTO();
  451. dto.setCount(prod_qty_);
  452. dto.setOrderCode(so_no_);
  453. dto.setOrderPrice(prod_amount_);
  454. dto.setDjPrice(sub_amount_);
  455. dto.setShippingNo(sc_tracking_no_);
  456. dto.setPayPrice(payed_amount_);
  457. dto.setShippingPrice(shipping_amount_);
  458. if (order_create_time_ != null){
  459. dto.setCreateTime(new java.util.Date(order_create_time_.getTime()));
  460. order.setCreateTime(new java.util.Date());
  461. }
  462. List<CrmCustomerHisOrderItemDTO> items=new ArrayList<>();
  463. String orderItemSql="select * from jt_so_item where so_id_ = '"+id_+"' ";
  464. PreparedStatement preparedStatementOrderItem = connection.prepareStatement(orderItemSql);
  465. ResultSet resultSetOrderItem = preparedStatementOrderItem.executeQuery();
  466. while (resultSetOrderItem.next()) {
  467. Integer count_=resultSetOrderItem.getInt("count_");
  468. String prod_name_=resultSetOrderItem.getString("prod_name_");
  469. CrmCustomerHisOrderItemDTO itemDTO=new CrmCustomerHisOrderItemDTO();
  470. itemDTO.setCount(count_);
  471. itemDTO.setProductName(prod_name_);
  472. items.add(itemDTO);
  473. }
  474. order.setCustomerCode(customer.getCustomerCode());
  475. order.setCustomerId(customer.getCustomerId());
  476. order.setOrderJson(JSONUtil.toJsonStr(dto));
  477. order.setItemJson(JSONUtil.toJsonStr(items));
  478. crmCustomerHisOrderService.insertCrmCustomerHisOrder(order);
  479. }
  480. preparedStatementOrder.close();
  481. resultSetOrder.close();
  482. crmCustomerService.updateCrmCustomer(customer);
  483. count++;
  484. LOGGER.info("导入NUMBER:"+count+"成功");
  485. LOGGER.info("导入ID:"+customer.getCustomerCode()+"成功");
  486. }
  487. catch (Exception e){
  488. count++;
  489. LOGGER.info("导入NUMBER:"+count+"失败"+e.getMessage());
  490. LOGGER.error("导入ERROR"+e.getMessage());
  491. continue;
  492. }
  493. }
  494. preparedStatement.close();
  495. resultSet.close();
  496. pageIndex=pageIndex+10;
  497. }
  498. catch (Exception e){
  499. LOGGER.error("导入ERROR"+e.getMessage());
  500. continue;
  501. }
  502. }
  503. LOGGER.info("导入已完成"+count+"个");
  504. } catch (Exception e) {
  505. e.printStackTrace();
  506. }
  507. finally {
  508. try {
  509. connection.close();
  510. } catch (SQLException e) {
  511. e.printStackTrace();
  512. }
  513. }
  514. }
  515. @ApiOperation("查询运单信息")
  516. @PostMapping(path = "/expressNotify" )
  517. public ExpressResultDTO expressNotify(@RequestBody ExpressNotifyDTO notifyDTO) throws Exception
  518. {
  519. logger.info("查询运单信息 {}",notifyDTO);
  520. //RequestData={"PushTime":"2022-09-06 09:59:26","EBusinessID":"1762981","Data":[{"StateEx":"0","LogisticCode":"SF1650775430012","ShipperCode":"SF","State":"0","OrderCode":"XCRTZH22090500435","EBusinessID":"1762981","Success":false}],"Count":"1"}&DataSign=YTEwMzAxMTAzNGI4ZjQ0OTU5MWE1Y2U0NzMzYTczNWM=&RequestType=102
  521. //RequestData={"PushTime":"2022-09-06 10:28:41","EBusinessID":"1762981","Data":[{"StateEx":"301","LogisticCode":"SF1372196615474","ShipperCode":"SF","Traces":[{"Action":"1","AcceptStation":"顺丰速运 已收取快件","AcceptTime":"2022-09-04 15:27:25","Remark":"","Location":"重庆"},{"Action":"1","AcceptStation":"顺丰速运 已收取快件","AcceptTime":"2022-09-04 15:34:27","Remark":"","Location":"重庆市"},{"Action":"2","AcceptStation":"快件在【重庆南岸区时代都汇营业点】完成分拣,准备发往 【重庆渝北中转场】","AcceptTime":"2022-09-04 17:17:16","Remark":"","Location":"重庆市"},{"Action":"2","AcceptStation":"快件已发车","AcceptTime":"2022-09-04 17:44:37","Remark":"","Location":"重庆市"},{"Action":"2","AcceptStation":"快件到达 【重庆渝北中转场】","AcceptTime":"2022-09-04 22:13:11","Remark":"","Location":"重庆市"},{"Action":"2","AcceptStation":"快件在【重庆渝北中转场】完成分拣,准备发往 【郑州港区中转场】","AcceptTime":"2022-09-05 00:04:51","Remark":"","Location":"重庆市"},{"Action":"2","AcceptStation":"快件已发车","AcceptTime":"2022-09-05 04:45:47","Remark":"","Location":"重庆市"},{"Action":"2","AcceptStation":"车辆当前所在位置道路管控,等待通行中,请您耐心等待\n","AcceptTime":"2022-09-05 19:35:55","Remark":"","Location":"重庆市"},{"Action":"2","AcceptStation":"快件到达 【郑州港区中转场】","AcceptTime":"2022-09-05 22:43:06","Remark":"","Location":"郑州市"},{"Action":"2","AcceptStation":"快件在【郑州港区中转场】完成分拣,准备发往 【焦作丰收集散点】","AcceptTime":"2022-09-05 23:16:24","Remark":"","Location":"郑州市"},{"Action":"2","AcceptStation":"快件已发车","AcceptTime":"2022-09-06 00:43:25","Remark":"","Location":"郑州市"},{"Action":"2","AcceptStation":"车辆当前所在位置道路管控,等待通行中,请您耐心等待\n","AcceptTime":"2022-09-06 01:03:39","Remark":"","Location":"郑州市"},{"Action":"2","AcceptStation":"快件到达 【焦作丰收集散点】","AcceptTime":"2022-09-06 03:03:35","Remark":"","Location":"焦作市"},{"Action":"2","AcceptStation":"快件在【焦作丰收集散点】完成分拣,准备发往 【济源市济源市汤帝路营业点】","AcceptTime":"2022-09-06 06:41:58","Remark":"","Location":"焦作市"},{"Action":"2","AcceptStation":"快件已发车","AcceptTime":"2022-09-06 06:42:17","Remark":"","Location":"焦作市"},{"Action":"2","AcceptStation":"车辆当前所在位置道路管控,等待通行中,请您耐心等待\n","AcceptTime":"2022-09-06 07:58:17","Remark":"","Location":"济源市"},{"Action":"2","AcceptStation":"快件到达 【济源市济源市汤帝路营业点】","AcceptTime":"2022-09-06 08:27:59","Remark":"","Location":"济源市"},{"Action":"202","AcceptStation":"正在派送途中,请您准备签收(派件人:刘亚飞,电话:18439188789)","AcceptTime":"2022-09-06 08:28:00","Remark":"","Location":"济源市"},{"Action":"202","AcceptStation":"快件交给刘亚飞,正在派送途中(联系电话:18439188789,顺丰已开启“安全呼叫”保护您的电话隐私,请放心接听!)(主单总件数:1件)","AcceptTime":"2022-09-06 08:38:03","Remark":"","Location":"济源市"},{"Action":"301","AcceptStation":"您的快件已签收,如有疑问请电联快递员【刘亚飞,电话:18439188789】。疫情期间顺丰每日对网点消毒、快递员每日测温、配戴口罩,感谢您使用顺丰,期待再次为您服务。(主单总件数:1件)","AcceptTime":"2022-09-06 08:54:05","Remark":"","Location":"济源市"}],"State":"3","OrderCode":"SKP012000681762","EBusinessID":"1762981","Success":true,"Location":"济源市"}],"Count":"1"}&DataSign=MTNlYTA5OTJmMjgxYjhiY2FjMTZjNTYyOGYxYjVhODA=&RequestType=102
  522. //https://api.hospital.ifeiyu100.com/app/common/expressNotify
  523. return orderService.updateDeliveryItem(notifyDTO);
  524. }
  525. }