修改企业更新定时任务;

main
吴顺杰 3 weeks ago
parent 07ff2ad9f4
commit aa8bc1e667

@ -47,5 +47,12 @@ public interface ASafeQyjcxxMapper extends BaseMapper<ASafeQyjcxx> {
* @param xxbh * @param xxbh
*/ */
void updateJlztById(String xxbh); void updateJlztById(String xxbh);
/**
*
*
* @return
*/
List<String> findCode();
} }

@ -45,8 +45,6 @@ import com.mudu.service.ASafeZcrwjlService;
import com.mudu.service.ASafeZcrwwzService; import com.mudu.service.ASafeZcrwwzService;
import com.mudu.service.SzsASafeZcyhxxService; import com.mudu.service.SzsASafeZcyhxxService;
import com.mudu.service.impl.LoginService; import com.mudu.service.impl.LoginService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value; 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.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.transaction.annotation.Transactional; 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 javax.annotation.Resource;
import java.text.ParseException; import java.text.ParseException;
@ -175,7 +170,6 @@ public class AcheckTaskQuartz {
* @Param qymc * @Param qymc
*/ */
@Scheduled(cron = "0 0 4 * * ? ") @Scheduled(cron = "0 0 4 * * ? ")
// @Scheduled(cron = "0 0/5 * * * ?")
// @PostMapping("/insert") // @PostMapping("/insert")
// @ApiOperation(value = "新增创建时间为昨天且处于审批通过的工单数据") // @ApiOperation(value = "新增创建时间为昨天且处于审批通过的工单数据")
public void selectAll() throws ParseException { public void selectAll() throws ParseException {

@ -20,6 +20,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* *
@ -30,6 +31,9 @@ import java.util.List;
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Configuration @Configuration
@EnableScheduling @EnableScheduling
//@RestController
//@RequestMapping("pharmaceuticals/ent")
//@Api(tags = "新增")
public class EntQuartz { public class EntQuartz {
@Resource @Resource
@ -50,6 +54,12 @@ public class EntQuartz {
@Value("${findEntDelUrl}") @Value("${findEntDelUrl}")
private String findEntDelUrl; private String findEntDelUrl;
@Value("${findAddEntByDate}")
private String findAddEntByDate;
@Value("${findCode}")
private String findCode;
private String getToken() { private String getToken() {
return "Bearer " + loginService.getToken(); return "Bearer " + loginService.getToken();
@ -87,7 +97,7 @@ public class EntQuartz {
qyjcxxService.save(x); qyjcxxService.save(x);
// 添加新增日志 // 添加新增日志
ASafeQyjcxxMdLog qyjcxxMdLog = BeanUtil.copyProperties(x, ASafeQyjcxxMdLog.class); ASafeQyjcxxMdLog qyjcxxMdLog = BeanUtil.copyProperties(x, ASafeQyjcxxMdLog.class);
qyjcxxMdLog.setGxorxz(0); qyjcxxMdLog.setGxorxz(1);
qyjcxxMdLogService.save(qyjcxxMdLog); qyjcxxMdLogService.save(qyjcxxMdLog);
} }
} }
@ -118,4 +128,31 @@ public class EntQuartz {
qyjcxxService.updateByTyshxybm(tyshxybmList); 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<String> muDuCodeList = JSON.parseArray(dataList, String.class);
List<String> wuZhongCodeList = qyjcxxService.findCode();
List<String> notInMuDuCodeList = wuZhongCodeList.stream()
.filter(code -> !muDuCodeList.contains(code))
.collect(Collectors.toList());
qyjcxxService.updateByTyshxybm(notInMuDuCodeList);
}
} }

@ -50,5 +50,12 @@ public interface ASafeQyjcxxService extends IService<ASafeQyjcxx> {
* @param xxbh * @param xxbh
*/ */
void updateJlztById(String xxbh); void updateJlztById(String xxbh);
/**
*
*
* @return
*/
List<String> findCode();
} }

@ -111,5 +111,15 @@ public class ASafeQyjcxxServiceImpl extends ServiceImpl<ASafeQyjcxxMapper, ASafe
public void updateJlztById(String xxbh) { public void updateJlztById(String xxbh) {
baseMapper.updateJlztById(xxbh); baseMapper.updateJlztById(xxbh);
} }
/**
*
*
* @return
*/
@Override
public List<String> findCode() {
return baseMapper.findCode();
}
} }

@ -105,4 +105,12 @@ addEntUrl: http://localhost:9028/mudu/enterprise/findAddEnt
# 获取删除企业信息 # 获取删除企业信息
#findEntDelUrl: https://www.jichuanglanhai.com:88/csapi/mudu/enterprise/findEntDel #findEntDelUrl: https://www.jichuanglanhai.com:88/csapi/mudu/enterprise/findEntDel
findEntDelUrl: http://localhost:9028/mudu/enterprise/findEntDel 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

@ -12,7 +12,7 @@ spring:
logging: logging:
level: level:
com.mudu: debug com.mudu: debug
org.springframework: debug org.springframework: error
# MyBatis配置 # MyBatis配置
mybatis-plus: 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 findEntDelUrl: https://www.jichuanglanhai.com:88/csapi/mudu/enterprise/findEntDel
#获取token #获取token
getToken: https://www.jichuanglanhai.com:88/loginnocaptcha 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

@ -69,4 +69,9 @@ addEntUrl: https://www.jichuanglanhai.com:88/csapi/mudu/enterprise/findAddEnt
# 获取删除企业信息 # 获取删除企业信息
findEntDelUrl: https://www.jichuanglanhai.com:88/csapi/mudu/enterprise/findEntDel 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

@ -4,7 +4,7 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.mudu.mapper.ASafeQyjcxxMapper"> <mapper namespace="com.mudu.mapper.ASafeQyjcxxMapper">
<update id="updateByTyshxybm"> <update id="updateByTyshxybm">
update a_safe_qyjcxx set jlzt = 0 , GXSJ =CURDATE() where update a_safe_qyjcxx_md set jlzt = 0 , GXSJ =CURDATE() where
tyshxybm in tyshxybm in
<foreach item="item" index="index" collection="list" <foreach item="item" index="index" collection="list"
open="(" separator="," close=")"> open="(" separator="," close=")">
@ -53,4 +53,10 @@
and a.QYBH = #{enterPriseId} and a.QYBH = #{enterPriseId}
limit 1 limit 1
</select> </select>
<select id="findCode" resultType="java.lang.String">
SELECT asq.TYSHXYBM
FROM a_safe_qyjcxx_md asq
where JLZT = 1
</select>
</mapper> </mapper>
Loading…
Cancel
Save