Merge branch 'develop_3' into 'develop_master'
Develop 3 See merge request !139
This commit is contained in:
@@ -5,8 +5,12 @@ import com.adc.da.scheduled.dao.SarStandardItemDao;
|
||||
import com.adc.da.scheduled.dao.SarStandardWarningDao;
|
||||
import com.adc.da.scheduled.entity.DataDTO;
|
||||
import com.adc.da.scheduled.entity.WarningEO;
|
||||
import com.adc.da.slrs.sarStandWarning.entity.EarlyWarningEO;
|
||||
import com.adc.da.slrs.sarStandAttrInfo.dao.SarStandAttrInfoDao;
|
||||
import com.adc.da.slrs.sarStandAttrInfo.entity.SarStandAttrInfo;
|
||||
import com.adc.da.slrs.sarStandardsInfo.dao.SarStandardsInfoDao;
|
||||
import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo;
|
||||
import com.adc.da.util.UUIDUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@@ -18,6 +22,7 @@ import org.springframework.stereotype.Component;
|
||||
import java.time.LocalDate;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@EnableScheduling
|
||||
@Component
|
||||
@@ -31,35 +36,28 @@ public class ScheduledJob {
|
||||
@Value("${isNotScheduled}")
|
||||
private boolean isNotScheduled; //是否开启定时器
|
||||
|
||||
//
|
||||
// @Scheduled(cron="*/5 * * * * ?")
|
||||
// @Async
|
||||
// public void StandScheduledJob(){
|
||||
// System.out.println("hello");
|
||||
//// if(isNotScheduled){
|
||||
//// System.out.println(Thread.currentThread().getName() + " cron=0 0 1 1 * ? --- " + new Date()+"---START-01");
|
||||
//// System.out.println(Thread.currentThread().getName() + " cron=0 0 1 1 * ? --- " + new Date()+"---End-01");
|
||||
//// try{
|
||||
//// Thread.sleep(2000);
|
||||
//// }catch(Exception e){
|
||||
//// }
|
||||
//// }
|
||||
// }
|
||||
|
||||
|
||||
@Autowired
|
||||
private SarStandardWarningDao sarStandardWarningDao;
|
||||
private SarStandardInfoDao sarStandardInfoDao; //标准信息表
|
||||
|
||||
@Autowired
|
||||
private SarStandardItemDao sarStandardItemDao;
|
||||
private SarStandardsInfoDao sarStandardsInfoDao;//标准信息表
|
||||
|
||||
@Autowired
|
||||
private SarStandardInfoDao sarStandardInfoDao;
|
||||
private SarStandardWarningDao sarStandardWarningDao;//预警表
|
||||
|
||||
@Autowired
|
||||
private SarStandardItemDao sarStandardItemDao; //分解单表
|
||||
|
||||
@Autowired
|
||||
private SarStandAttrInfoDao sarStandAttrInfoDao; //属性字段表
|
||||
|
||||
|
||||
|
||||
@Scheduled(cron = "0 0 0 * * ?") //每天的凌晨0点执行
|
||||
// @Scheduled(cron="*/5 * * * * ?")
|
||||
@Async
|
||||
public void schedulingTasks() {
|
||||
public void WarningSchedulingTasks() {
|
||||
|
||||
|
||||
/**
|
||||
@@ -79,12 +77,12 @@ public class ScheduledJob {
|
||||
2:在产车条款预警
|
||||
*/
|
||||
System.out.println("开始执行预警!!!");
|
||||
//预警期限
|
||||
DataDTO term = new DataDTO();
|
||||
LinkedList<WarningEO> warningList = new LinkedList<>();
|
||||
|
||||
DataDTO term = new DataDTO(); //预警期限(当前日期至3个月后)
|
||||
|
||||
LinkedList<WarningEO> warningList = new LinkedList<>();//需预警的标准和条款列表集合
|
||||
//分解单(条款) 新车型 mark=1
|
||||
List<WarningEO> itemForXCXSSRQ = sarStandardItemDao.select(term, "XCXSSRQ");
|
||||
List<WarningEO> itemForXCXSSRQ = sarStandardItemDao.selectWithinTerm(term, "XCXSSRQ");
|
||||
for (WarningEO warningEO : itemForXCXSSRQ) {
|
||||
warningEO.setId(UUIDUtils.randomUUID20())
|
||||
.setPower("1")
|
||||
@@ -94,7 +92,7 @@ public class ScheduledJob {
|
||||
warningList.addAll(itemForXCXSSRQ);
|
||||
|
||||
//分解单(条款) 在产车型 mark=2
|
||||
List<WarningEO> itemForZCCSSRQ = sarStandardItemDao.select(term, "ZCCSSRQ");
|
||||
List<WarningEO> itemForZCCSSRQ = sarStandardItemDao.selectWithinTerm(term, "ZCCSSRQ");
|
||||
for (WarningEO warningEO : itemForZCCSSRQ) {
|
||||
warningEO.setId(UUIDUtils.randomUUID20())
|
||||
.setPower("1")
|
||||
@@ -104,33 +102,110 @@ public class ScheduledJob {
|
||||
warningList.addAll(itemForZCCSSRQ);
|
||||
|
||||
//标准 新车型 预警 mark=3
|
||||
List<WarningEO> standInfoXCXSSRQ = sarStandardInfoDao.select(term, "XCXSSRQ");
|
||||
List<WarningEO> standInfoXCXSSRQ = sarStandardInfoDao.selectWithinTerm(term, "XCXSSRQ");
|
||||
for (WarningEO warningEO : standInfoXCXSSRQ) {
|
||||
warningEO.setId(UUIDUtils.randomUUID20())
|
||||
.setPower("1")
|
||||
.setMark("3")
|
||||
.setPutTime(warningEO.getXCXSSRQ())
|
||||
.setStandCode(warningEO.getStandSort()+" "+warningEO.getStandNum()+"-"+warningEO.getStandYear());
|
||||
.setStandCode(warningEO.getStandSort()+" "+ warningEO.getStandNum()+"-"+ warningEO.getStandYear());
|
||||
}
|
||||
warningList.addAll(standInfoXCXSSRQ);
|
||||
|
||||
|
||||
//标准 在产车型 mark=4
|
||||
List<WarningEO> standInfoZCCSSRQ = sarStandardInfoDao.select(term, "ZCCSSRQ");
|
||||
List<WarningEO> standInfoZCCSSRQ = sarStandardInfoDao.selectWithinTerm(term, "ZCCSSRQ");
|
||||
for (WarningEO warningEO : standInfoZCCSSRQ) {
|
||||
warningEO.setId(UUIDUtils.randomUUID20())
|
||||
.setPower("1")
|
||||
.setMark("4")
|
||||
.setPutTime(warningEO.getZCCSSRQ())
|
||||
.setStandCode(warningEO.getStandSort()+" "+warningEO.getStandNum()+"-"+warningEO.getStandYear());
|
||||
.setStandCode(warningEO.getStandSort()+" "+ warningEO.getStandNum()+"-"+ warningEO.getStandYear());
|
||||
}
|
||||
warningList.addAll(standInfoZCCSSRQ);
|
||||
|
||||
//持久化至预警表 忽略标准id和标志位都一样的数据
|
||||
if (warningList.size()!=0){
|
||||
//此表的STAND_CODE和MARK字段需建立唯一性约束
|
||||
//此表的STAND_ID和MARK字段以及ITEMS_ID和MARK字段需两个建立唯一性约束
|
||||
int count = sarStandardWarningDao.ignoreInsert(warningList);
|
||||
System.out.println("已预警 " + count + " 条标准或条款!!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// @Scheduled(cron = "0 0 0 * * ?") //每天的凌晨0点执行
|
||||
@Scheduled(cron="*/5 * * * * ?")
|
||||
@Async
|
||||
public void TextStatusSchedulingTasks() {
|
||||
QueryWrapper<SarStandardsInfo> wrapper = new QueryWrapper<>();
|
||||
|
||||
DataDTO data = new DataDTO(LocalDate.now(), LocalDate.now());
|
||||
|
||||
/**
|
||||
*实施日期是当前系统时间的标准文本状态变为'现行有效'
|
||||
*/
|
||||
QueryWrapper<SarStandAttrInfo> columnsAndCondition = new QueryWrapper<>();
|
||||
columnsAndCondition.select("STAND_ID").like("SSRQ",LocalDate.now());
|
||||
List<Map<String, Object>> effectiveList=sarStandAttrInfoDao.selectMaps(columnsAndCondition);
|
||||
// List<ScheduledDTO> effectiveList = sarStandardInfoDao.selectWithinTerm(data, "SSRQ");
|
||||
|
||||
effectiveList.forEach(item->{
|
||||
try {
|
||||
SarStandardsInfo sarStandardsInfo = new SarStandardsInfo();
|
||||
sarStandardsInfo.setId(item.get("STAND_ID").toString());
|
||||
sarStandardsInfo.setTextStatus("vsaga7nwub");
|
||||
|
||||
sarStandardsInfoDao.updateById(sarStandardsInfo);
|
||||
// sarStandardInfoDao.updateStandardInfo(item.getStandId(),"vsaga7nwub");
|
||||
|
||||
}catch (Exception e){
|
||||
System.out.println("标准id为=="+item.get("STAND_ID").toString()+"==文本状态更新失败");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* 被多个标准代替的标准变为“被代替”,只有一个被代替的自动变为“废止”
|
||||
*/
|
||||
QueryWrapper<SarStandAttrInfo> columns = new QueryWrapper<>();
|
||||
columns.select("DTBJH","STAND_ID");
|
||||
List<Map<String, Object>> mapsDTBZH = sarStandAttrInfoDao.selectMaps(columns);
|
||||
|
||||
mapsDTBZH.forEach(item->{
|
||||
if (item.get("DTBJH")!=null && !item.get("DTBJH").toString().equals("")){
|
||||
String dtbzh = item.get("DTBJH").toString();
|
||||
String[] split = dtbzh.split(",");
|
||||
SarStandardsInfo sarStandardsInfo = new SarStandardsInfo();
|
||||
sarStandardsInfo.setId(item.get("STAND_ID").toString());
|
||||
|
||||
//一个被代替标准号时,文本状态更新为废止状态,两个及以上时更新为被代替状态
|
||||
switch (split.length){
|
||||
case 0 :
|
||||
break;
|
||||
case 1 :
|
||||
sarStandardsInfo.setTextStatus("chblaarg77");//废止状态
|
||||
break;
|
||||
default:
|
||||
sarStandardsInfo.setTextStatus("qke0ckro2p");//被代替状态
|
||||
}
|
||||
try {
|
||||
sarStandardsInfoDao.updateById(sarStandardsInfo);
|
||||
}catch (Exception e){
|
||||
System.out.println("代替标准状态更新:id为"+item.get("STAND_ID").toString()+"文本状态更新失败");
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ package com.adc.da.scheduled.dao;
|
||||
|
||||
import com.adc.da.scheduled.entity.DataDTO;
|
||||
import com.adc.da.scheduled.entity.WarningEO;
|
||||
import com.adc.da.slrs.sarStandWarning.entity.EarlyWarningEO;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
@@ -12,6 +12,8 @@ import java.util.List;
|
||||
@Repository
|
||||
public interface SarStandardInfoDao{
|
||||
|
||||
public List<WarningEO> select(DataDTO date, String str);
|
||||
public List<WarningEO> selectWithinTerm(DataDTO date, String str);
|
||||
|
||||
public int updateStandardInfo(@Param("id")String id, @Param("textStatus") String textStatus);
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.adc.da.scheduled.dao;
|
||||
|
||||
import com.adc.da.scheduled.entity.DataDTO;
|
||||
import com.adc.da.scheduled.entity.WarningEO;
|
||||
import com.adc.da.slrs.sarStandWarning.entity.EarlyWarningEO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
@@ -12,6 +11,6 @@ import java.util.List;
|
||||
@Repository
|
||||
public interface SarStandardItemDao extends BaseMapper{
|
||||
|
||||
public List<WarningEO> select(DataDTO date, String str);
|
||||
public List<WarningEO> selectWithinTerm(DataDTO date, String str);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.adc.da.scheduled.entity;
|
||||
|
||||
import com.adc.da.base.entity.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@@ -13,15 +13,21 @@ public class DataDTO {
|
||||
* 预警的期限为系统日期的次日至3个月后
|
||||
*/
|
||||
|
||||
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
private LocalDate startDate;
|
||||
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
private LocalDate endDate;
|
||||
|
||||
// private String str;
|
||||
|
||||
public DataDTO() {
|
||||
this.startDate =LocalDate.now().plusDays(1); //系统日期的下一天
|
||||
this.endDate = LocalDate.now().plusMonths(3).plusDays(1);//系统日期3个月后
|
||||
this.startDate =LocalDate.now().plusDays(1); //系统当前日期
|
||||
this.endDate = LocalDate.now().plusMonths(3);//系统当前日期3个月后
|
||||
}
|
||||
|
||||
public DataDTO(LocalDate startDate,LocalDate endDate){
|
||||
this.startDate=startDate;
|
||||
this.endDate=endDate;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@@ -15,8 +16,10 @@ import java.util.Date;
|
||||
public class WarningEO extends EarlyWarningEO {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@DateTimeFormat(pattern = "YYYY-MM-dd")
|
||||
private Date XCXSSRQ;
|
||||
|
||||
@DateTimeFormat(pattern = "YYYY-MM-dd")
|
||||
private Date ZCCSSRQ;
|
||||
|
||||
private String standNum;
|
||||
@@ -24,4 +27,6 @@ public class WarningEO extends EarlyWarningEO {
|
||||
private String standSort;
|
||||
|
||||
private String standYear;
|
||||
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -24,11 +24,11 @@ public class FindSarItemsPageReqDTO extends BasePage {
|
||||
private String itemsName;
|
||||
|
||||
@ApiModelProperty(value = "新车型实施日期")
|
||||
@DateTimeFormat(pattern = "yyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date XCXSSRQ;
|
||||
|
||||
@ApiModelProperty(value = "在产车实施日期")
|
||||
@DateTimeFormat(pattern = "yyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date ZCCSSRQ;
|
||||
|
||||
@ApiModelProperty(value = "文件类型")
|
||||
|
||||
@@ -387,12 +387,12 @@
|
||||
</if>
|
||||
|
||||
<if test="itemsName != null and itemsName!=''">
|
||||
and ITEMS_NAME=#{itemsName}
|
||||
and ITEMS_NAME like CONCAT('%', #{itemsName},'%')
|
||||
</if>
|
||||
<if test="XCXSSRQ !=null and XCXSSRQ!=''">
|
||||
<if test="XCXSSRQ !=null">
|
||||
and XCXSSRQ=#{XCXSSRQ}
|
||||
</if>
|
||||
<if test="ZCCSSRQ !=null and ZCCSSRQ != ''">
|
||||
<if test="ZCCSSRQ !=null">
|
||||
and ZCCSSRQ=#{ZCCSSRQ}
|
||||
</if>
|
||||
</where>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
</resultMap>
|
||||
|
||||
<!-- 查询条件 -->
|
||||
<select id="select" resultMap="resultMap" parameterType="com.adc.da.scheduled.entity.DataDTO">
|
||||
<select id="selectWithinTerm" resultMap="resultMap" parameterType="com.adc.da.scheduled.entity.DataDTO">
|
||||
SELECT
|
||||
info.ID,
|
||||
info.STAND_SORT,
|
||||
@@ -31,12 +31,27 @@
|
||||
FROM
|
||||
sar_standards_info AS info
|
||||
JOIN sar_stand_attr_info AS attrInfo ON info.id = attrinfo.stand_id
|
||||
WHERE
|
||||
attrInfo.${str} BETWEEN #{date.startDate} and #{date.endDate}
|
||||
<where>
|
||||
1=1
|
||||
<if test="date!=null">
|
||||
and
|
||||
attrInfo.${str}
|
||||
BETWEEN DATE_FORMAT( #{date.startDate},'%Y-%m-%d %H:%i:%s')
|
||||
and DATE_FORMAT( #{date.endDate},'%Y-%m-%d %H:%i:%s')
|
||||
</if>
|
||||
</where>
|
||||
|
||||
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
<update id="updateStandardInfo">
|
||||
update sar_standards_info
|
||||
set TEXT_STATUS=#{textStatus}
|
||||
where ID=#{id}
|
||||
</update>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<result column="ZRGCS" property="dutyEngineer"/>
|
||||
</resultMap>
|
||||
<!-- 查询条件 -->
|
||||
<select id="select" resultMap="resultMap" parameterType="com.adc.da.scheduled.entity.DataDTO">
|
||||
<select id="selectWithinTerm" resultMap="resultMap" parameterType="com.adc.da.scheduled.entity.DataDTO">
|
||||
SELECT
|
||||
items.ID,
|
||||
STAND_ID,
|
||||
|
||||
Reference in New Issue
Block a user