From aa8bc1e667f2f6ffce93d99b9d9995d6688e7536 Mon Sep 17 00:00:00 2001 From: wu Date: Fri, 25 Oct 2024 17:53:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BC=81=E4=B8=9A=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/mudu/mapper/ASafeQyjcxxMapper.java | 7 ++++ .../com/mudu/quartz/AcheckTaskQuartz.java | 6 --- src/main/java/com/mudu/quartz/EntQuartz.java | 39 ++++++++++++++++++- .../com/mudu/service/ASafeQyjcxxService.java | 7 ++++ .../service/impl/ASafeQyjcxxServiceImpl.java | 10 +++++ src/main/resources/application-dev.yml | 10 ++++- src/main/resources/application-prod.yml | 10 ++++- src/main/resources/application-test.yml | 5 +++ .../mapper/mudu/ASafeQyjcxxMapper.xml | 8 +++- 9 files changed, 91 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/mudu/mapper/ASafeQyjcxxMapper.java b/src/main/java/com/mudu/mapper/ASafeQyjcxxMapper.java index 81922b4..809c5f3 100644 --- a/src/main/java/com/mudu/mapper/ASafeQyjcxxMapper.java +++ b/src/main/java/com/mudu/mapper/ASafeQyjcxxMapper.java @@ -47,5 +47,12 @@ public interface ASafeQyjcxxMapper extends BaseMapper { * @param xxbh 信息编号 */ void updateJlztById(String xxbh); + + /** + * 查询所有企业信用代码 + * + * @return 所有企业信用代码 + */ + List findCode(); } diff --git a/src/main/java/com/mudu/quartz/AcheckTaskQuartz.java b/src/main/java/com/mudu/quartz/AcheckTaskQuartz.java index c9b6338..74a7344 100644 --- a/src/main/java/com/mudu/quartz/AcheckTaskQuartz.java +++ b/src/main/java/com/mudu/quartz/AcheckTaskQuartz.java @@ -45,8 +45,6 @@ import com.mudu.service.ASafeZcrwjlService; import com.mudu.service.ASafeZcrwwzService; import com.mudu.service.SzsASafeZcyhxxService; import com.mudu.service.impl.LoginService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; @@ -54,9 +52,6 @@ import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import java.text.ParseException; @@ -175,7 +170,6 @@ public class AcheckTaskQuartz { * @Param qymc 企业名称 */ @Scheduled(cron = "0 0 4 * * ? ") -// @Scheduled(cron = "0 0/5 * * * ?") // @PostMapping("/insert") // @ApiOperation(value = "新增创建时间为昨天且处于审批通过的工单数据") public void selectAll() throws ParseException { diff --git a/src/main/java/com/mudu/quartz/EntQuartz.java b/src/main/java/com/mudu/quartz/EntQuartz.java index f4f4e39..73cd5db 100644 --- a/src/main/java/com/mudu/quartz/EntQuartz.java +++ b/src/main/java/com/mudu/quartz/EntQuartz.java @@ -20,6 +20,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.util.List; +import java.util.stream.Collectors; /** * 获取木渎新增企业定时任务 @@ -30,6 +31,9 @@ import java.util.List; @Transactional(rollbackFor = Exception.class) @Configuration @EnableScheduling +//@RestController +//@RequestMapping("pharmaceuticals/ent") +//@Api(tags = "新增") public class EntQuartz { @Resource @@ -50,6 +54,12 @@ public class EntQuartz { @Value("${findEntDelUrl}") private String findEntDelUrl; + @Value("${findAddEntByDate}") + private String findAddEntByDate; + + @Value("${findCode}") + private String findCode; + private String getToken() { return "Bearer " + loginService.getToken(); @@ -87,7 +97,7 @@ public class EntQuartz { qyjcxxService.save(x); // 添加新增日志 ASafeQyjcxxMdLog qyjcxxMdLog = BeanUtil.copyProperties(x, ASafeQyjcxxMdLog.class); - qyjcxxMdLog.setGxorxz(0); + qyjcxxMdLog.setGxorxz(1); qyjcxxMdLogService.save(qyjcxxMdLog); } } @@ -118,4 +128,31 @@ public class EntQuartz { qyjcxxService.updateByTyshxybm(tyshxybmList); } } + + /** + * 删除不存在于木渎的吴中企业 + */ + @Scheduled(cron = "0 40 00 * * ? ") +// @GetMapping("findCode") + public void findCode() { + // 获取token + String token = getToken(); + // 获取所有信息 + String res = HttpRequest.get(findCode) + .contentType("application/x-www-form-urlencoded;charset=UTF-8") + .header("Authorization", token) + .execute().body(); + JSONObject resObj = JSON.parseObject(res); + String dataList = resObj.getString("data"); + if (StrUtil.isEmpty(dataList)) { + return; + } + List muDuCodeList = JSON.parseArray(dataList, String.class); + List wuZhongCodeList = qyjcxxService.findCode(); + List notInMuDuCodeList = wuZhongCodeList.stream() + .filter(code -> !muDuCodeList.contains(code)) + .collect(Collectors.toList()); + qyjcxxService.updateByTyshxybm(notInMuDuCodeList); + } + } diff --git a/src/main/java/com/mudu/service/ASafeQyjcxxService.java b/src/main/java/com/mudu/service/ASafeQyjcxxService.java index c5bbbb8..7ef9bfd 100644 --- a/src/main/java/com/mudu/service/ASafeQyjcxxService.java +++ b/src/main/java/com/mudu/service/ASafeQyjcxxService.java @@ -50,5 +50,12 @@ public interface ASafeQyjcxxService extends IService { * @param xxbh 信息编号 */ void updateJlztById(String xxbh); + + /** + * 查询所有企业信用代码 + * + * @return 所有企业信用代码 + */ + List findCode(); } diff --git a/src/main/java/com/mudu/service/impl/ASafeQyjcxxServiceImpl.java b/src/main/java/com/mudu/service/impl/ASafeQyjcxxServiceImpl.java index 66933b0..ce11da5 100644 --- a/src/main/java/com/mudu/service/impl/ASafeQyjcxxServiceImpl.java +++ b/src/main/java/com/mudu/service/impl/ASafeQyjcxxServiceImpl.java @@ -111,5 +111,15 @@ public class ASafeQyjcxxServiceImpl extends ServiceImpl findCode() { + return baseMapper.findCode(); + } } diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index f26b2e7..53b9dbc 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -105,4 +105,12 @@ addEntUrl: http://localhost:9028/mudu/enterprise/findAddEnt # 获取删除企业信息 #findEntDelUrl: https://www.jichuanglanhai.com:88/csapi/mudu/enterprise/findEntDel -findEntDelUrl: http://localhost:9028/mudu/enterprise/findEntDel \ No newline at end of file +findEntDelUrl: http://localhost:9028/mudu/enterprise/findEntDel + +# 根据时间获取企业信息 +#findAddEntByDate: https://www.jichuanglanhai.com:88/csapi/mudu/enterprise/findAddEntByDate +findAddEntByDate: http://localhost:9028/mudu/enterprise/findAddEntByDate + +# 查询所有企业信用代码 +#findCode: https://www.jichuanglanhai.com:88/csapi/mudu/enterprise/findCode +findCode: http://localhost:9028/mudu/enterprise/findCode \ No newline at end of file diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml index bb7892b..a991768 100644 --- a/src/main/resources/application-prod.yml +++ b/src/main/resources/application-prod.yml @@ -12,7 +12,7 @@ spring: logging: level: com.mudu: debug - org.springframework: debug + org.springframework: error # MyBatis配置 mybatis-plus: @@ -67,4 +67,10 @@ addEntUrl: https://www.jichuanglanhai.com:88/csapi/mudu/enterprise/findAddEnt findEntDelUrl: https://www.jichuanglanhai.com:88/csapi/mudu/enterprise/findEntDel #获取token -getToken: https://www.jichuanglanhai.com:88/loginnocaptcha \ No newline at end of file +getToken: https://www.jichuanglanhai.com:88/loginnocaptcha + +# 根据时间获取企业信息 +findAddEntByDate: https://www.jichuanglanhai.com:88/csapi/mudu/enterprise/findAddEntByDate + +# 查询所有企业信用代码 +findCode: https://www.jichuanglanhai.com:88/csapi/mudu/enterprise/findCode diff --git a/src/main/resources/application-test.yml b/src/main/resources/application-test.yml index 0a5431b..2ff1f76 100644 --- a/src/main/resources/application-test.yml +++ b/src/main/resources/application-test.yml @@ -69,4 +69,9 @@ addEntUrl: https://www.jichuanglanhai.com:88/csapi/mudu/enterprise/findAddEnt # 获取删除企业信息 findEntDelUrl: https://www.jichuanglanhai.com:88/csapi/mudu/enterprise/findEntDel +# 根据时间获取企业信息 +findAddEntByDate: https://www.jichuanglanhai.com:88/csapi/mudu/enterprise/findAddEntByDate + +# 查询所有企业信用代码 +findCode: https://www.jichuanglanhai.com:88/csapi/mudu/enterprise/findCode diff --git a/src/main/resources/mapper/mudu/ASafeQyjcxxMapper.xml b/src/main/resources/mapper/mudu/ASafeQyjcxxMapper.xml index 7fd078e..a99de7d 100644 --- a/src/main/resources/mapper/mudu/ASafeQyjcxxMapper.xml +++ b/src/main/resources/mapper/mudu/ASafeQyjcxxMapper.xml @@ -4,7 +4,7 @@ "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - update a_safe_qyjcxx set jlzt = 0 , GXSJ =CURDATE() where + update a_safe_qyjcxx_md set jlzt = 0 , GXSJ =CURDATE() where tyshxybm in @@ -53,4 +53,10 @@ and a.QYBH = #{enterPriseId} limit 1 + + \ No newline at end of file