diff --git a/src/main/java/com/mudu/mapper/ASafeXcrwMapper.java b/src/main/java/com/mudu/mapper/ASafeXcrwMapper.java index b0aec4c..8b4489b 100644 --- a/src/main/java/com/mudu/mapper/ASafeXcrwMapper.java +++ b/src/main/java/com/mudu/mapper/ASafeXcrwMapper.java @@ -16,8 +16,8 @@ public interface ASafeXcrwMapper extends BaseMapper { /** * 查询巡查任务主表2个月内是否有记录就不推 */ - @Select("select count(*) from a_safe_xcrw where rksj BETWEEN DATE_SUB( CURDATE(), INTERVAL 2 MONTH ) AND CURDATE()") - Integer xcrwNum(); + @Select("select count(*) from a_safe_xcrw where rksj BETWEEN DATE_SUB( CURDATE(), INTERVAL 2 MONTH ) AND CURDATE() and qybh=#{enterPriseId} ") + Integer xcrwNum(String enterPriseId); } diff --git a/src/main/java/com/mudu/mapper/ASafeZcrwMapper.java b/src/main/java/com/mudu/mapper/ASafeZcrwMapper.java index 32d671e..3326659 100644 --- a/src/main/java/com/mudu/mapper/ASafeZcrwMapper.java +++ b/src/main/java/com/mudu/mapper/ASafeZcrwMapper.java @@ -17,8 +17,8 @@ public interface ASafeZcrwMapper extends BaseMapper { * 查询自查任务主表1个月内是否有记录就不推 */ - @Select("select count(*) from a_safe_zcrw where rksj BETWEEN DATE_SUB( CURDATE(), INTERVAL 1 MONTH ) AND CURDATE() ") - Integer zcrwNum(); + @Select("select count(*) from a_safe_zcrw where rksj BETWEEN DATE_SUB( CURDATE(), INTERVAL 1 MONTH ) AND CURDATE() and qybh =#{enterPriseId} ") + Integer zcrwNum(String enterPriseId); } diff --git a/src/main/java/com/mudu/quartz/AcheckTaskQuartz.java b/src/main/java/com/mudu/quartz/AcheckTaskQuartz.java index 7cec138..d67c155 100644 --- a/src/main/java/com/mudu/quartz/AcheckTaskQuartz.java +++ b/src/main/java/com/mudu/quartz/AcheckTaskQuartz.java @@ -11,11 +11,16 @@ import com.mudu.entity.dto.request.ACheckQuatzZichaRequest; import com.mudu.entity.dto.response.ACheckXcTpResponse; import com.mudu.entity.dto.response.RwzqUuidResponse; import com.mudu.service.*; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Value; 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; @@ -28,12 +33,12 @@ import java.util.UUID; * @author dong * @since 2024/3/12 16:37 */ -//@RestController -//@RequestMapping("pharmaceuticals/aCheck") -//@Api(tags = "新增") -@Transactional(rollbackFor = Exception.class) -@Configuration -@EnableScheduling +@RestController +@RequestMapping("pharmaceuticals/aCheck") +@Api(tags = "新增") +//@Transactional(rollbackFor = Exception.class) +//@Configuration +//@EnableScheduling public class AcheckTaskQuartz { /** @@ -121,16 +126,12 @@ public class AcheckTaskQuartz { * * @Param qymc 企业名称 */ - @Scheduled(cron = "0 0 4 * * ? ") +// @Scheduled(cron = "0 0 4 * * ? ") // @Scheduled(cron = "0 0/5 * * * ?") -// @PostMapping("/insert") -// @ApiOperation(value = "新增创建时间为昨天且处于审批通过的工单数据") + @PostMapping("/insert") + @ApiOperation(value = "新增创建时间为昨天且处于审批通过的工单数据") public void selectAll() throws ParseException { - // todo 查询巡查任务主表2月是否有记录就不推 - Integer xcrwNum = aSafeXcrwService.xcrwNum(); - if (xcrwNum > 0) { - return; - } + //巡查任务周期id RwzqUuidResponse rwzqUuidResponse = aSafeRwzqService.getXcUuid(); String rwzqUuid = rwzqUuidResponse.getXxbh(); @@ -148,6 +149,11 @@ public class AcheckTaskQuartz { //获取企业编号 ASafeQyjcxx aSafeQyjcxx = aSafeQyjcxxService.findOneByqymcOrXybm(a.getName(), a.getEntCode()); String enterPriseId = aSafeQyjcxx.getXxbh(); + // todo 查询巡查任务主表2月是否有记录就不推 + Integer xcrwNum = aSafeXcrwService.xcrwNum(enterPriseId); + if (xcrwNum > 0) { + return; + } // todo 来自新表查询 根据企业xxbh 以及周期编号 JSONObject xcjsonObject = new JSONObject(); xcjsonObject.put("qybh", aSafeQyjcxx.getXxbh()); @@ -589,17 +595,13 @@ public class AcheckTaskQuartz { } - @Scheduled(cron = "0 0 4 * * ? ") +// @Scheduled(cron = "0 0 4 * * ? ") // @Scheduled(cron = "0 0/5 * * * ?") //@Scheduled(cron = "0 58 18 * * ?") -// @PostMapping("/zicha") -// @ApiOperation(value = "自查") + @PostMapping("/zicha") + @ApiOperation(value = "自查") public void zicha() throws ParseException { - // todo 查询自查任务主表本月是否有记录 有就不推 - Integer zcrwNum = aSafeZcrwService.zcrwNum(); - if (zcrwNum > 0) { - return; - } + //自己查任务周期id RwzqUuidResponse rwzqUuidResponse = aSafeRwzqService.getZcUuid(); String rwzqUuid = rwzqUuidResponse.getXxbh(); @@ -614,6 +616,11 @@ public class AcheckTaskQuartz { return; } for (ACheckQuatzZichaRequest a : list) { + // todo 查询自查任务主表本月是否有记录 有就不推 + Integer zcrwNum = aSafeZcrwService.zcrwNum(a.getEnterpriseID()); + if (zcrwNum > 0) { + return; + } JSONObject zcjsonObject = new JSONObject(); zcjsonObject.put("qybh", a.getEnterpriseID()); zcjsonObject.put("zqbh", rwzqUuid); diff --git a/src/main/java/com/mudu/service/ASafeXcrwService.java b/src/main/java/com/mudu/service/ASafeXcrwService.java index f796dbe..0c58d01 100644 --- a/src/main/java/com/mudu/service/ASafeXcrwService.java +++ b/src/main/java/com/mudu/service/ASafeXcrwService.java @@ -16,7 +16,7 @@ public interface ASafeXcrwService extends IService { * 查询巡查任务主表2个月内是否有记录就不推 */ - Integer xcrwNum(); + Integer xcrwNum(String enterPriseId); } diff --git a/src/main/java/com/mudu/service/ASafeZcrwService.java b/src/main/java/com/mudu/service/ASafeZcrwService.java index 2c456c5..b5624bd 100644 --- a/src/main/java/com/mudu/service/ASafeZcrwService.java +++ b/src/main/java/com/mudu/service/ASafeZcrwService.java @@ -15,7 +15,7 @@ public interface ASafeZcrwService extends IService { * 查询自查任务主表1个月内是否有记录就不推 */ - Integer zcrwNum(); + Integer zcrwNum(String enterPriseId); } diff --git a/src/main/java/com/mudu/service/impl/ASafeXcrwServiceImpl.java b/src/main/java/com/mudu/service/impl/ASafeXcrwServiceImpl.java index fd115ab..769c44d 100644 --- a/src/main/java/com/mudu/service/impl/ASafeXcrwServiceImpl.java +++ b/src/main/java/com/mudu/service/impl/ASafeXcrwServiceImpl.java @@ -19,9 +19,10 @@ public class ASafeXcrwServiceImpl extends ServiceImpl