Merge branch 'develop_3' into 'develop_master'

Develop 3

See merge request LiuChao/foton-slrs-system-rest!263
This commit is contained in:
王夏晖
2021-12-01 20:54:21 +08:00
15 changed files with 193 additions and 209 deletions
@@ -3,7 +3,7 @@ package com.adc.da.scheduled;
import com.adc.da.scheduled.dao.SarStandardInfoDao; import com.adc.da.scheduled.dao.SarStandardInfoDao;
import com.adc.da.scheduled.dao.SarStandardItemDao; import com.adc.da.scheduled.dao.SarStandardItemDao;
import com.adc.da.scheduled.dao.SarStandardWarningDao; import com.adc.da.scheduled.dao.SarStandardWarningDao;
import com.adc.da.scheduled.entity.DataDTO; import com.adc.da.scheduled.entity.TermDTO;
import com.adc.da.slrs.sarStandAttrInfo.dao.SarStandAttrInfoDao; import com.adc.da.slrs.sarStandAttrInfo.dao.SarStandAttrInfoDao;
import com.adc.da.slrs.sarStandAttrInfo.entity.SarStandAttrInfo; import com.adc.da.slrs.sarStandAttrInfo.entity.SarStandAttrInfo;
@@ -23,6 +23,7 @@ import org.springframework.scheduling.annotation.Async;
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.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.*; import java.util.*;
@@ -60,130 +61,61 @@ public class ScheduledJob {
// @Scheduled(cron = "0 0 0 * * ?") //每天的凌晨0点执行 @Scheduled(cron = "0 0 0 * * ?") //每天的凌晨0点执行
//// @Scheduled(cron="*/5 * * * * ?") // @Scheduled(cron="*/5 * * * * ?")
// @Async @Async
// public void WarningSchedulingTasks() { public void WarningSchedulingTasks() {
// Logger logger = LoggerFactory.getLogger(ScheduledJob.class); Logger logger = LoggerFactory.getLogger(ScheduledJob.class);
//
// /** /**
// * 1.查询标准属性字段表(sar_stand_attr_info) XCXSSEQ ZCCSSRQ ZRGCS * 1.查询标准属性字段表(sar_stand_attr_info) XCXSSEQ ZCCSSRQ ZRGCS
// * 联接标准信息表sar_standards_info表的STAND_NAME * 联接标准信息表sar_standards_info表的STAND_NAME
// * 2.查询分解单(条款表) * 2.查询分解单(条款表)
// * 3.查询预警表 * 3.查询预警表
// * 4.去掉预警表中已存在的的数据 * 4.去掉预警表中已存在的的数据
// * 5.插入预警表 * 5.插入预警表
// */ */
//
// /** /**
// mark:标识预警的种类 mark:标识预警的种类
// 3:新车标准预警 3:新车标准预警
// 4:在产车标准预警 4:在产车标准预警
// 1:新车条款预警 1:新车条款预警
// 2:在产车条款预警 2:在产车条款预警
// */
// 2021/12/1 日需求修改
// //删除不在预警范围的标准 分为标准预警与条款预警
// QueryWrapper<EarlyWarningEO> earlyWarningEOQW = new QueryWrapper<>(); mark:标识预警的种类 stand 标准 item 条款
// earlyWarningEOQW.lt("PUT_TIME",LocalDate.now()); */
// int remove = sarStandardWarningDao.delete(earlyWarningEOQW);
// System.out.println(remove); //删除不在预警范围的标准
// int remove = sarStandardWarningDao.autoCancelWarning();
//
// System.out.println("开始执行预警!!!"); logger.info("==========================================================================");
// logger.info("取消"+remove+"条预警");
// DataDTO term = new DataDTO(); //预警期限(当前日期至3个月后) logger.info("开始执行预警!!!");
// logger.info("==========================================================================");
// LinkedList<EarlyWarningEO> warningList = new LinkedList<>();//需预警的标准和条款列表集合
// //分解单(条款) 新车型 mark=1 TermDTO term = new TermDTO(); //预警期限(当前日期至3个月后)
// List<EarlyWarningEO> itemForXCXSSRQ = sarStandardItemDao.selectWithinTerm(term, "XCXSSRQ");
// for (EarlyWarningEO warningEO : itemForXCXSSRQ) {
// warningEO.setId(UUIDUtils.randomUUID20()) List<EarlyWarningEO> warningList = sarStandardWarningDao.getWarningId(term);
// .setPower("1")
// .setMark("1"); warningList.forEach(item->{
//// .setPutTime(warningEO.getXCXSSRQ()); item.setId(UUIDUtils.randomUUID20());
//// .setStandCode(warningEO.getStandSort()+" "+ warningEO.getStandNum()+"-"+ warningEO.getStandYear()); });
// } //持久化至预警表 忽略标准id和标志位都一样的数据
// warningList.addAll(itemForXCXSSRQ); if (warningList.size()!=0){
// //此表的STAND_ID和MARK字段以及ITEMS_ID字段需个建立唯一性约束
// //分解单(条款) 在产车型 mark=2 int count = sarStandardWarningDao.ignoreInsert(warningList);
// List<EarlyWarningEO> itemForZCCSSRQ = sarStandardItemDao.selectWithinTerm(term, "ZCCSSRQ"); logger.info("==================================预警结束======================================");
// for (EarlyWarningEO warningEO : itemForZCCSSRQ) { logger.info("==================================预警结束======================================");
// warningEO.setId(UUIDUtils.randomUUID20()) logger.info("已预警"+ count+"条标准或条款!!");
// .setPower("1") logger.info("==================================预警结束======================================");
// .setMark("2"); logger.info("==================================预警结束======================================");
//// .setPutTime(warningEO.getZCCSSRQ());
//// .setStandCode(warningEO.getStandSort()+" "+ warningEO.getStandNum()+"-"+ warningEO.getStandYear()); }
// }
// }
// warningList.addAll(itemForZCCSSRQ);
//
// //标准 新车型 预警 mark=3
// List<String> standInfoXCXSSRQ = sarStandardInfoDao.selectWithinTerm(term, "XCXSSRQ");
// for (EarlyWarningEO warningEO : standInfoXCXSSRQ) {
// warningEO.setId(UUIDUtils.randomUUID20())
// /**
// * //如果插入的值均为NULL,则根据索引的原理,
// * 全NULL值不被记录在索引上,所以插入全NULL值时,可以有重复的
// * 则此处设为 '-1'
// */
// .setItemsId("-1")
// .setPower("1")
// .setMark("3");
//// .setStandCode(warningEO.getStandSort()+" "+ warningEO.getStandNum()+"-"+ warningEO.getStandYear());
//
//
// //实施日期达到预警时间,但在产车实施日期不在时间内
// /**
// * 2021/9/9取消限制
// */
//// if (term.isTerm(warningEO.getXCXSSRQ())){
//// warningEO.setPutTime(warningEO.getXCXSSRQ());
//// }
//// warningEO.setPutTime(warningEO.getXCXSSRQ());
//
// }
// warningList.addAll(standInfoXCXSSRQ);
//
//
// //标准 在产车型 mark=4
// List<String> standIdZCCSSRQ = sarStandardInfoDao.selectWithinTerm(term, "ZCCSSRQ");
//
// List<EarlyWarningEO> standInfoZCCSSRQ = standIdZCCSSRQ.stream()
// .map(id -> {
// EarlyWarningEO earlyWarningEO = new EarlyWarningEO();
// earlyWarningEO.setStandId(id)
// .setItemsId("-1")
// .setPower("1")
// .setMark("4");
// return earlyWarningEO;
// }).collect(Collectors.toList());
// warningList.addAll(standInfoZCCSSRQ);
//
//
//// .setStandCode(warningEO.getStandSort()+" "+ warningEO.getStandNum()+"-"+ warningEO.getStandYear());
// //实施日期达到预警时间,但在产车实施日期不在时间内
// /**
// * 2021/9/9取消限制
// */
//// if (term.isTerm(warningEO.getZCCSSRQ())){
//// warningEO.setPutTime(warningEO.getZCCSSRQ());
//// }
//// warningEO.setPutTime(warningEO.getZCCSSRQ());
//
//
// //持久化至预警表 忽略标准id和标志位都一样的数据
// if (warningList.size()!=0){
// //此表的STAND_ID和MARK字段以及ITEMS_ID字段需个建立唯一性约束
// int count = sarStandardWarningDao.ignoreInsert(warningList);
// logger.info("==================================预警结束======================================");
// logger.info("==================================预警结束======================================");
// logger.info("已预警"+ count+"条标准或条款!!");
// logger.info("==================================预警结束======================================");
// logger.info("==================================预警结束======================================");
//
// }
// }
@@ -202,7 +134,7 @@ public class ScheduledJob {
public void TextStatusSchedulingTasks() { public void TextStatusSchedulingTasks() {
QueryWrapper<SarStandardsInfo> wrapper = new QueryWrapper<>(); QueryWrapper<SarStandardsInfo> wrapper = new QueryWrapper<>();
DataDTO data = new DataDTO(LocalDate.now(), LocalDate.now()); TermDTO data = new TermDTO(LocalDate.now(), LocalDate.now());
/** /**
*实施日期是当前系统时间的标准文本状态变为'现行有效' *实施日期是当前系统时间的标准文本状态变为'现行有效'
@@ -1,10 +1,8 @@
package com.adc.da.scheduled.dao; package com.adc.da.scheduled.dao;
import com.adc.da.scheduled.entity.DataDTO; import com.adc.da.scheduled.entity.TermDTO;
import com.adc.da.scheduled.entity.WarningEO;
import com.adc.da.slrs.sarStandWarning.entity.EarlyWarningEO;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@@ -13,7 +11,7 @@ import java.util.List;
@Repository @Repository
public interface SarStandardInfoDao{ public interface SarStandardInfoDao{
public List<String> selectWithinTerm(DataDTO date, String str); public List<String> selectWithinTerm(TermDTO date, String str);
public int updateStandardInfo(@Param("id")String id, @Param("textStatus") String textStatus); public int updateStandardInfo(@Param("id")String id, @Param("textStatus") String textStatus);
@@ -1,6 +1,6 @@
package com.adc.da.scheduled.dao; package com.adc.da.scheduled.dao;
import com.adc.da.scheduled.entity.DataDTO; import com.adc.da.scheduled.entity.TermDTO;
import com.adc.da.scheduled.entity.WarningEO; import com.adc.da.scheduled.entity.WarningEO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@@ -11,6 +11,6 @@ import java.util.List;
@Repository @Repository
public interface SarStandardItemDao extends BaseMapper{ public interface SarStandardItemDao extends BaseMapper{
public List<WarningEO> selectWithinTerm(DataDTO date, String str); public List<WarningEO> selectWithinTerm(TermDTO date, String str);
} }
@@ -1,17 +1,22 @@
package com.adc.da.scheduled.dao; package com.adc.da.scheduled.dao;
import com.adc.da.scheduled.entity.WarningEO; import com.adc.da.scheduled.entity.TermDTO;
import com.adc.da.slrs.sarStandWarning.entity.EarlyWarningEO; import com.adc.da.slrs.sarStandWarning.entity.EarlyWarningEO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.service.IService;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List;
@Repository @Repository
public interface SarStandardWarningDao extends BaseMapper<EarlyWarningEO> { public interface SarStandardWarningDao extends BaseMapper<EarlyWarningEO> {
public int ignoreInsert(@Param(value = "warningEOS") LinkedList<EarlyWarningEO> warningEOS); public int ignoreInsert(@Param(value = "warningEOS") List<EarlyWarningEO> warningEOS);
public int autoCancelWarning();
public List<EarlyWarningEO> getWarningId(TermDTO term);
} }
@@ -16,7 +16,7 @@ import java.util.Date;
@Data @Data
@Accessors(chain = true) @Accessors(chain = true)
public class DataDTO { public class TermDTO {
/** /**
* 预警的期限为系统日期的次日至3个月后 * 预警的期限为系统日期的次日至3个月后
*/ */
@@ -28,14 +28,14 @@ public class DataDTO {
// private String str; // private String str;
public DataDTO() { public TermDTO() {
LocalDate starDate = LocalDate.now();//系统当前日期 LocalDate starDate = LocalDate.now();//系统当前日期
LocalDate endDate = LocalDate.now().plusMonths(3);//系统当前日期3个月后 LocalDate endDate = LocalDate.now().plusMonths(3);//系统当前日期3个月后
convertToStr(starDate,endDate); convertToStr(starDate,endDate);
} }
public DataDTO(LocalDate startDate,LocalDate endDate){ public TermDTO(LocalDate startDate, LocalDate endDate){
convertToStr(startDate,endDate); convertToStr(startDate,endDate);
} }
@@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/** /**
* <p> * <p>
@@ -62,8 +64,11 @@ public class SarModelTreeServiceImpl extends ServiceImpl<SarModelTreeDao, SarMod
// sarMenu.setChildren(recursionGetChildren((sarMenu))); // sarMenu.setChildren(recursionGetChildren((sarMenu)));
// } // }
children.forEach(item->{ List<SarModelTree> collect = children.stream()
switch (item.getHasChildren()){ .filter(item -> !parent.getModel().equals(item.getModel())).collect(Collectors.toList());
collect.forEach(item-> {
switch (item.getHasChildren()) {
case "0": case "0":
item.setLeaf(true); item.setLeaf(true);
break; break;
@@ -73,6 +78,8 @@ public class SarModelTreeServiceImpl extends ServiceImpl<SarModelTreeDao, SarMod
} }
item.setId(item.getName()); item.setId(item.getName());
}); });
return children;
return collect;
} }
} }
@@ -34,19 +34,19 @@ public class EarlyWarningEO extends BaseEntity {
private String standId; private String standId;
@ApiModelProperty("标准类别") @ApiModelProperty("标准类别")
@TableField("STAND_TYPE") @TableField(exist = false)
private String standType; private String standType;
@ApiModelProperty("标准号") @ApiModelProperty("标准号")
@TableField("STAND_CODE") @TableField(exist = false)
private String standCode; private String standCode;
@ApiModelProperty("标准名称") @ApiModelProperty("标准名称")
@TableField("STAND_NAME") @TableField(exist = false)
private String standName; private String standName;
@ApiModelProperty("发布日期") @ApiModelProperty("发布日期")
@TableField("PUT_TIME") @TableField(exist = false)
@DateTimeFormat(pattern="yyyy-MM-dd") @DateTimeFormat(pattern="yyyy-MM-dd")
private Date putTime; private Date putTime;
@@ -54,31 +54,32 @@ public class EarlyWarningEO extends BaseEntity {
private Date lastTime; private Date lastTime;
@ApiModelProperty("适用车型") @ApiModelProperty("适用车型")
@TableField("APPLY_TYPE") @TableField(exist = false)
private String applyType; private String applyType;
@ApiModelProperty("责任工程师") @ApiModelProperty("责任工程师")
@TableField("DUTY_ENGINEER") @TableField(exist = false)
private String dutyEngineer; private String dutyEngineer;
@ApiModelProperty("条款(分解单)id") @ApiModelProperty("条款(分解单)id")
@TableField("ITEMS_ID") @TableField(exist = false)
private String itemsId; private String itemsId;
@ApiModelProperty("条款(分解单)编号") @ApiModelProperty("条款(分解单)编号")
@TableField("ITEMS_NUM") @TableField(exist = false)
private String itemsNum; private String itemsNum;
@ApiModelProperty("条款(分解单)名称") @ApiModelProperty("条款(分解单)名称")
@TableField("ITEMS_NAME") @TableField(exist = false)
private String itemsName; private String itemsName;
@TableField("POLICY_ID") @TableField("POLICY_ID")
private String policyId; private String policyId;
@TableField("POLICY_NAME") @TableField(exist = false)
private String policyName; private String policyName;
@TableField("MARK") @TableField("MARK")
private String mark; private String mark;
@@ -0,0 +1,8 @@
package com.adc.da.slrs.sarStandWarning.service;
import com.adc.da.slrs.sarStandWarning.entity.WarningDate;
import com.baomidou.mybatisplus.extension.service.IService;
public interface IWarningDateService extends IService<WarningDate> {
}
@@ -1,12 +1,10 @@
package com.adc.da.slrs.sarStandWarning.service.Impl; package com.adc.da.slrs.sarStandWarning.service.Impl;
import com.adc.da.scheduled.entity.DataDTO;
import com.adc.da.slrs.sarStandWarning.dao.EarlyWarningEODao; import com.adc.da.slrs.sarStandWarning.dao.EarlyWarningEODao;
import com.adc.da.slrs.sarStandWarning.entity.EarlyWarningEO; import com.adc.da.slrs.sarStandWarning.entity.EarlyWarningEO;
import com.adc.da.slrs.sarStandWarning.entity.StandWarningEO; import com.adc.da.slrs.sarStandWarning.entity.StandWarningEO;
import com.adc.da.slrs.sarStandWarning.service.EarlyWarningEOService; import com.adc.da.slrs.sarStandWarning.service.EarlyWarningEOService;
import com.adc.da.sys.util.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -16,9 +14,7 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List; import java.util.List;
@Service("EarlyWarningEOService") @Service("EarlyWarningEOService")
@@ -0,0 +1,11 @@
package com.adc.da.slrs.sarStandWarning.service.Impl;
import com.adc.da.slrs.sarStandWarning.dao.WarningDateDao;
import com.adc.da.slrs.sarStandWarning.entity.WarningDate;
import com.adc.da.slrs.sarStandWarning.service.IWarningDateService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
@Service
public class WarningDateServiceImpl extends ServiceImpl<WarningDateDao, WarningDate> implements IWarningDateService {
}
@@ -5,6 +5,7 @@ import com.adc.da.slrs.sarPosition.entity.TsPosition;
import com.adc.da.slrs.sarPosition.service.ITsPositionService; import com.adc.da.slrs.sarPosition.service.ITsPositionService;
import com.adc.da.slrs.sarStandWarning.dao.WarningDateDao; import com.adc.da.slrs.sarStandWarning.dao.WarningDateDao;
import com.adc.da.slrs.sarStandWarning.entity.WarningDate; import com.adc.da.slrs.sarStandWarning.entity.WarningDate;
import com.adc.da.slrs.sarStandWarning.service.Impl.WarningDateServiceImpl;
import com.adc.da.slrs.sarUser.entity.TsUser; import com.adc.da.slrs.sarUser.entity.TsUser;
import com.adc.da.att.service.IAttFileEOService; import com.adc.da.att.service.IAttFileEOService;
import com.adc.da.att.vo.AttFileVo; import com.adc.da.att.vo.AttFileVo;
@@ -125,6 +126,9 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
@Value("${file.path}") @Value("${file.path}")
private String filePath;//文件存储路径 private String filePath;//文件存储路径
@Autowired
WarningDateServiceImpl warningDateService;
@Autowired @Autowired
private ITsPositionService iTsPositionService; private ITsPositionService iTsPositionService;
@@ -1003,8 +1007,6 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
return Pattern.matches(verifyType,str); return Pattern.matches(verifyType,str);
} }
@Autowired
WarningDateDao warningDateDao;
public void createStandPutTime(String standId, Map<String, String> multiTimeMap) throws Exception { public void createStandPutTime(String standId, Map<String, String> multiTimeMap) throws Exception {
@@ -1052,8 +1054,10 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
} }
if (warningDateList != null && warningDateList.size()>0){ if (warningDateList != null && warningDateList.size()>0){
warningDateDao.deleteById(standId); QueryWrapper<WarningDate> wrapper = new QueryWrapper<>();
//TODO 实施日期存表 wrapper.eq("law_id",standId);
warningDateService.remove(wrapper);
warningDateService.saveBatch(warningDateList);
} }
} }
} }
@@ -47,11 +47,11 @@
),' ','')) LIKE trim(replace(CONCAT('%',#{waringEO.standCode},'%'),' ','')) ),' ','')) LIKE trim(replace(CONCAT('%',#{waringEO.standCode},'%'),' ',''))
</if> </if>
<if test="waringEO.standName != null and waringEO.standName != ''"> <if test="waringEO.standName != null and waringEO.standName != ''">
AND sarInfo.STAND_NAME = #{waringEO.standName} AND sarInfo.STAND_NAME like concat('%', #{waringEO.standName},'%')
</if> </if>
<if test="waringEO.startPutTime != null and waringEO.startPutTime != '' and waringEO.endPutTime != null and waringEO.endPutTime != '' "> <if test="waringEO.startPutTime != null and waringEO.startPutTime != '' and waringEO.endPutTime != null and waringEO.endPutTime != '' ">
AND ( AND (
DATE_FORMAT( sarInfo.PUT_TIME, '%Y-%m-%d') &gt;= DATE_FORMAT( DATE_FORMAT(sarInfo.PUT_TIME, '%Y-%m-%d') &gt;= DATE_FORMAT(
#{waringEO.endPutTime}, #{waringEO.endPutTime},
'%Y-%m-%d' '%Y-%m-%d'
) )
@@ -65,16 +65,10 @@
</if> </if>
<if test="waringEO.startSSRQ != null and waringEO.startSSRQ != '' and waringEO.endSSRQ != null and waringEO.endSSRQ != ''"> <if test="waringEO.startSSRQ != null and waringEO.startSSRQ != '' and waringEO.endSSRQ != null and waringEO.endSSRQ != ''">
AND ( AND (
DATE_FORMAT( attr.SSRQ, '%Y-%m-%d') &gt;= DATE_FORMAT( sarInfo.ID IN (SELECT DISTINCT law_id FROM warning_date as t WHERE
#{waringEO.startSSRQ}, DATE_FORMAT(t.SSRQ, '%Y-%m-%d') &gt;= DATE_FORMAT(#{waringEO.startSSRQ}, '%Y-%m-%d')
'%Y-%m-%d'
)
AND AND
DATE_FORMAT( attr.SSRQ, '%Y-%m-%d') &lt;= DATE_FORMAT( DATE_FORMAT(t.SSRQ, '%Y-%m-%d') &lt;= DATE_FORMAT(#{waringEO.endSSRQ}, '%Y-%m-%d') AND t.time_name = 'SSRQ' )
#{waringEO.endSSRQ},
'%Y-%m-%d'
)
) )
</if> </if>
</sql> </sql>
@@ -98,37 +92,23 @@
LEFT JOIN sar_stand_attr_info AS attr on attr.STAND_ID=warning.STAND_ID LEFT JOIN sar_stand_attr_info AS attr on attr.STAND_ID=warning.STAND_ID
<where> <where>
POWER = '1' POWER = '1'
AND (MARK = 'stand')
<include refid="stand_where"/> <include refid="stand_where"/>
<if test="waringEO.applyType != null and waringEO.applyType != ''"> <if test="waringEO.applyType != null and waringEO.applyType != ''">
AND attr.CLLX LIKE CONCAT('%', #{waringEO.applyType},'%') AND attr.CLLX LIKE CONCAT('%', #{waringEO.applyType},'%')
</if> </if>
<if test="waringEO.startXCXSSRQ != null and waringEO.startXCXSSRQ != '' and waringEO.endXCXSSRQ != null and waringEO.endXCXSSRQ != ''"> <if test="waringEO.startXCXSSRQ != null and waringEO.startXCXSSRQ != '' and waringEO.endXCXSSRQ != null and waringEO.endXCXSSRQ != ''">
AND ( AND (
DATE_FORMAT( attr.XCXSSRQ, '%Y-%m-%d') &gt;= DATE_FORMAT( sarInfo.ID IN (SELECT DISTINCT law_id FROM warning_date as t WHERE
#{waringEO.startXCXSSRQ}, DATE_FORMAT(t.SSRQ, '%Y-%m-%d') between DATE_FORMAT(#{waringEO.startXCXSSRQ}, '%Y-%m-%d') AND DATE_FORMAT(#{waringEO.endXCXSSRQ}, '%Y-%m-%d')
'%Y-%m-%d' AND t.time_name = 'XCXSSRQ' )
)
AND
DATE_FORMAT( attr.XCXSSRQ, '%Y-%m-%d') &lt;= DATE_FORMAT(
#{waringEO.endXCXSSRQ},
'%Y-%m-%d'
)
) )
</if> </if>
<if test="waringEO.startZCCSSRQ != null and waringEO.startZCCSSRQ != '' and waringEO.endZCCSSRQ != null and waringEO.endZCCSSRQ != ''"> <if test="waringEO.startZCCSSRQ != null and waringEO.startZCCSSRQ != '' and waringEO.endZCCSSRQ != null and waringEO.endZCCSSRQ != ''">
AND ( AND (
DATE_FORMAT( attr.ZCCSSRQ, '%Y-%m-%d') &gt;= DATE_FORMAT( sarInfo.ID IN (SELECT DISTINCT law_id FROM warning_date as t WHERE
#{waringEO.startZCCSSRQ}, DATE_FORMAT(t.SSRQ, '%Y-%m-%d') between DATE_FORMAT(#{waringEO.startZCCSSRQ}, '%Y-%m-%d') AND DATE_FORMAT(#{waringEO.startZCCSSRQ}, '%Y-%m-%d')
'%Y-%m-%d' AND t.time_name = 'ZCCSSRQ' )
)
AND
DATE_FORMAT( attr.ZCCSSRQ, '%Y-%m-%d') &lt;= DATE_FORMAT(
#{waringEO.endZCCSSRQ},
'%Y-%m-%d'
)
) )
</if> </if>
</where> </where>
@@ -156,7 +136,7 @@
LEFT JOIN sar_stand_attr_info AS attr ON attr.STAND_ID = warning.STAND_ID LEFT JOIN sar_stand_attr_info AS attr ON attr.STAND_ID = warning.STAND_ID
<where> <where>
POWER = '1' POWER = '1'
AND (MARK = 'item')
<include refid="stand_where"/> <include refid="stand_where"/>
<if test="waringEO.applyType != null and waringEO.applyType != ''"> <if test="waringEO.applyType != null and waringEO.applyType != ''">
AND items.APPLY_ARCTIC LIKE CONCAT('%', #{waringEO.applyType},'%') AND items.APPLY_ARCTIC LIKE CONCAT('%', #{waringEO.applyType},'%')
@@ -164,17 +144,15 @@
<if test="waringEO.startXCXSSRQ != null and waringEO.startXCXSSRQ != '' and waringEO.endXCXSSRQ != null and waringEO.endXCXSSRQ != ''"> <if test="waringEO.startXCXSSRQ != null and waringEO.startXCXSSRQ != '' and waringEO.endXCXSSRQ != null and waringEO.endXCXSSRQ != ''">
AND ( AND (
DATE_FORMAT( items.XCXSSRQ, '%Y-%m-%d') &gt;= DATE_FORMAT(#{waringEO.startXCXSSRQ},'%Y-%m-%d') DATE_FORMAT( items.XCXSSRQ, '%Y-%m-%d') between DATE_FORMAT(#{waringEO.startXCXSSRQ},'%Y-%m-%d')
AND AND
DATE_FORMAT( items.XCXSSRQ, '%Y-%m-%d') &lt;= DATE_FORMAT(#{waringEO.endXCXSSRQ},'%Y-%m-%d') DATE_FORMAT(#{waringEO.endXCXSSRQ},'%Y-%m-%d')
) )
</if> </if>
<if test="waringEO.startZCCSSRQ != null and waringEO.startZCCSSRQ != '' and waringEO.endZCCSSRQ != null and waringEO.endZCCSSRQ != ''"> <if test="waringEO.startZCCSSRQ != null and waringEO.startZCCSSRQ != '' and waringEO.endZCCSSRQ != null and waringEO.endZCCSSRQ != ''">
AND( AND(
DATE_FORMAT( items.ZCCSSRQ, '%Y-%m-%d') &gt;= DATE_FORMAT(#{waringEO.startZCCSSRQ},'%Y-%m-%d') DATE_FORMAT( items.ZCCSSRQ, '%Y-%m-%d') between DATE_FORMAT(#{waringEO.startZCCSSRQ},'%Y-%m-%d') AND DATE_FORMAT(#{waringEO.endZCCSSRQ},'%Y-%m-%d' )
AND
DATE_FORMAT( items.ZCCSSRQ, '%Y-%m-%d') &lt;= DATE_FORMAT(#{waringEO.endZCCSSRQ},'%Y-%m-%d' )
) )
</if> </if>
@@ -18,7 +18,7 @@
<!-- </resultMap>--> <!-- </resultMap>-->
<!-- 查询条件 --> <!-- 查询条件 -->
<select id="selectWithinTerm" resultType="java.lang.String" parameterType="com.adc.da.scheduled.entity.DataDTO"> <select id="selectWithinTerm" resultType="java.lang.String" parameterType="com.adc.da.scheduled.entity.TermDTO">
SELECT SELECT
info.ID info.ID
FROM FROM
@@ -19,7 +19,7 @@
<result column="STAND_YEAR" property="standYear"/> <result column="STAND_YEAR" property="standYear"/>
</resultMap> </resultMap>
<!-- 查询条件 --> <!-- 查询条件 -->
<select id="selectWithinTerm" resultMap="resultMap" parameterType="com.adc.da.scheduled.entity.DataDTO"> <select id="selectWithinTerm" resultMap="resultMap" parameterType="com.adc.da.scheduled.entity.TermDTO">
SELECT SELECT
items.ID, items.ID,
items.ITEMS_NUM, items.ITEMS_NUM,
@@ -4,30 +4,74 @@
<insert id="ignoreInsert" parameterType="java.util.LinkedList"> <insert id="ignoreInsert" parameterType="java.util.LinkedList">
REPLACE INTO sar_stand_warning (ID,STAND_ID, STAND_TYPE, STAND_CODE,STAND_NAME,PUT_TIME,APPLY_TYPE,DUTY_ENGINEER,ITEMS_ID,ITEMS_NUM,ITEMS_NAME,POLICY_ID,POLICY_NAME,MARK,POWER) REPLACE INTO sar_stand_warning (ID,STAND_ID,ITEMS_ID,POLICY_ID,MARK,POWER)
VALUES VALUES
<if test="warningEOS !=null and warningEOS.size()!=0"> <if test="warningEOS !=null and warningEOS.size()!=0">
<foreach collection="warningEOS" item="item" index="index" separator=","> <foreach collection="warningEOS" item="item" index="index" separator=",">
( (
#{item.id} #{item.id}
,#{item.standId} ,#{item.standId}
,#{item.standType}
,#{item.standCode}
,#{item.standName}
,#{item.putTime}
,#{item.applyType}
,#{item.dutyEngineer}
,#{item.itemsId} ,#{item.itemsId}
,#{item.itemsNum}
,#{item.itemsName}
,#{item.policyId} ,#{item.policyId}
,#{item.policyName}
,#{item.mark} ,#{item.mark}
,#{item.power} ,#{item.power}
) )
</foreach> </foreach>
</if> </if>
</insert> </insert>
<delete id="autoCancelWarning">
UPDATE sar_stand_warning
SET POWER ='0'
WHERE
STAND_ID IN (
SELECT
law_id
FROM
warning_date
WHERE
DATE_FORMAT(SSRQ, '%Y-%m-%d') &lt; DATE_FORMAT(now(), '%Y-%m-%d')
UNION
SELECT
ID
FROM
sar_standards_info
WHERE
DATE_FORMAT(PUT_TIME, '%Y-%m-%d') &lt; DATE_FORMAT(now(), '%Y-%m-%d')
UNION
SELECT
STAND_ID
FROM
sar_stand_items
WHERE
DATE_FORMAT(XCXSSRQ, '%Y-%m-%d') &lt; DATE_FORMAT(now(), '%Y-%m-%d')
OR DATE_FORMAT(ZCCSSRQ, '%Y-%m-%d') &lt; DATE_FORMAT(now(), '%Y-%m-%d')
)
</delete>
<select id="getWarningId" resultType="com.adc.da.slrs.sarStandWarning.entity.EarlyWarningEO">
SELECT
law_id as STAND_ID,
'-1' AS itemsId,
'stand' AS mark,
'1' as power
FROM
warning_date AS warning
WHERE
DATE_FORMAT(warning.SSRQ,'%Y-%m-%d') BETWEEN DATE_FORMAT(#{startDate}, '%Y-%m-%d') AND DATE_FORMAT(#{endDate}, '%Y-%m-%d')
UNION
SELECT
STAND_ID,
ID AS itemsId,
'item' AS mark,
'1' as power
FROM
sar_stand_items AS item
WHERE
DATE_FORMAT(item.XCXSSRQ,'%Y-%m-%d') BETWEEN DATE_FORMAT(#{startDate}, '%Y-%m-%d') AND DATE_FORMAT(#{endDate}, '%Y-%m-%d')
OR
DATE_FORMAT(item.ZCCSSRQ,'%Y-%m-%d') BETWEEN DATE_FORMAT(#{startDate}, '%Y-%m-%d') AND DATE_FORMAT(#{endDate}, '%Y-%m-%d')
</select>
</mapper> </mapper>