Merge branch 'develop_3' into 'develop_master'
Develop 3 See merge request !143
This commit is contained in:
@@ -7,6 +7,7 @@ import com.adc.da.scheduled.entity.DataDTO;
|
||||
import com.adc.da.scheduled.entity.WarningEO;
|
||||
import com.adc.da.slrs.sarStandAttrInfo.dao.SarStandAttrInfoDao;
|
||||
import com.adc.da.slrs.sarStandAttrInfo.entity.SarStandAttrInfo;
|
||||
import com.adc.da.slrs.sarStandWarning.entity.EarlyWarningEO;
|
||||
import com.adc.da.slrs.sarStandardsInfo.dao.SarStandardsInfoDao;
|
||||
import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo;
|
||||
import com.adc.da.util.UUIDUtils;
|
||||
@@ -76,6 +77,14 @@ public class ScheduledJob {
|
||||
1:新车条款预警
|
||||
2:在产车条款预警
|
||||
*/
|
||||
|
||||
//删除不在预警范围的标准
|
||||
QueryWrapper<EarlyWarningEO> earlyWarningEOQW = new QueryWrapper<>();
|
||||
earlyWarningEOQW.lt("PUT_TIME",LocalDate.now());
|
||||
int remove = sarStandardWarningDao.delete(earlyWarningEOQW);
|
||||
System.out.println(remove);
|
||||
|
||||
|
||||
System.out.println("开始执行预警!!!");
|
||||
|
||||
DataDTO term = new DataDTO(); //预警期限(当前日期至3个月后)
|
||||
@@ -98,6 +107,7 @@ public class ScheduledJob {
|
||||
.setPower("1")
|
||||
.setMark("2")
|
||||
.setPutTime(warningEO.getZCCSSRQ());
|
||||
|
||||
}
|
||||
warningList.addAll(itemForZCCSSRQ);
|
||||
|
||||
@@ -105,10 +115,21 @@ public class ScheduledJob {
|
||||
List<WarningEO> standInfoXCXSSRQ = sarStandardInfoDao.selectWithinTerm(term, "XCXSSRQ");
|
||||
for (WarningEO warningEO : standInfoXCXSSRQ) {
|
||||
warningEO.setId(UUIDUtils.randomUUID20())
|
||||
/**
|
||||
* //如果插入的值均为NULL,则根据索引的原理,
|
||||
* 全NULL值不被记录在索引上,所以插入全NULL值时,可以有重复的
|
||||
* 则此处设为 '-1'
|
||||
*/
|
||||
.setItemsId("-1")
|
||||
.setPower("1")
|
||||
.setMark("3")
|
||||
.setPutTime(warningEO.getXCXSSRQ())
|
||||
.setStandCode(warningEO.getStandSort()+" "+ warningEO.getStandNum()+"-"+ warningEO.getStandYear());
|
||||
|
||||
//实施日期达到预警时间,但新车型实施日期不在时间内
|
||||
if (term.isTerm(warningEO.getXCXSSRQ())){
|
||||
warningEO.setPutTime(warningEO.getXCXSSRQ());
|
||||
}
|
||||
|
||||
}
|
||||
warningList.addAll(standInfoXCXSSRQ);
|
||||
|
||||
@@ -117,16 +138,23 @@ public class ScheduledJob {
|
||||
List<WarningEO> standInfoZCCSSRQ = sarStandardInfoDao.selectWithinTerm(term, "ZCCSSRQ");
|
||||
for (WarningEO warningEO : standInfoZCCSSRQ) {
|
||||
warningEO.setId(UUIDUtils.randomUUID20())
|
||||
/**
|
||||
* 同上
|
||||
*/
|
||||
.setItemsId("-1")
|
||||
.setPower("1")
|
||||
.setMark("4")
|
||||
.setPutTime(warningEO.getZCCSSRQ())
|
||||
.setStandCode(warningEO.getStandSort()+" "+ warningEO.getStandNum()+"-"+ warningEO.getStandYear());
|
||||
//实施日期达到预警时间,但在产车实施日期不在时间内
|
||||
if (term.isTerm(warningEO.getZCCSSRQ())){
|
||||
warningEO.setPutTime(warningEO.getZCCSSRQ());
|
||||
}
|
||||
}
|
||||
warningList.addAll(standInfoZCCSSRQ);
|
||||
|
||||
//持久化至预警表 忽略标准id和标志位都一样的数据
|
||||
if (warningList.size()!=0){
|
||||
//此表的STAND_ID和MARK字段以及ITEMS_ID和MARK字段需两个建立唯一性约束
|
||||
//此表的STAND_ID和MARK字段以及ITEMS_ID字段需个建立唯一性约束
|
||||
int count = sarStandardWarningDao.ignoreInsert(warningList);
|
||||
System.out.println("已预警 " + count + " 条标准或条款!!");
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.adc.da.scheduled.dao;
|
||||
|
||||
import com.adc.da.scheduled.entity.WarningEO;
|
||||
import com.adc.da.slrs.sarStandWarning.entity.EarlyWarningEO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@@ -9,7 +11,7 @@ import org.springframework.stereotype.Repository;
|
||||
import java.util.LinkedList;
|
||||
|
||||
@Repository
|
||||
public interface SarStandardWarningDao extends IService<WarningEO> {
|
||||
public interface SarStandardWarningDao extends BaseMapper<EarlyWarningEO> {
|
||||
|
||||
public int ignoreInsert(@Param(value = "warningEOS") LinkedList<WarningEO> warningEOS);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,18 @@
|
||||
package com.adc.da.scheduled.entity;
|
||||
|
||||
import com.alibaba.druid.sql.visitor.functions.Char;
|
||||
import com.sun.org.apache.bcel.internal.generic.NEW;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@@ -13,21 +21,56 @@ public class DataDTO {
|
||||
* 预警的期限为系统日期的次日至3个月后
|
||||
*/
|
||||
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
private LocalDate startDate;
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
private LocalDate endDate;
|
||||
|
||||
private String startDate;
|
||||
|
||||
private String endDate;
|
||||
|
||||
// private String str;
|
||||
|
||||
public DataDTO() {
|
||||
this.startDate =LocalDate.now().plusDays(1); //系统当前日期
|
||||
this.endDate = LocalDate.now().plusMonths(3);//系统当前日期3个月后
|
||||
LocalDate starDate = LocalDate.now();//系统当前日期
|
||||
LocalDate endDate = LocalDate.now().plusMonths(3);//系统当前日期3个月后
|
||||
|
||||
convertToStr(starDate,endDate);
|
||||
}
|
||||
|
||||
public DataDTO(LocalDate startDate,LocalDate endDate){
|
||||
this.startDate=startDate;
|
||||
this.endDate=endDate;
|
||||
convertToStr(startDate,endDate);
|
||||
}
|
||||
|
||||
//判断日期是否在期限内
|
||||
public boolean isTerm(Date date) {
|
||||
|
||||
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String dateString = formatter.format(date);
|
||||
int compareStart = dateString.compareTo(startDate);
|
||||
int compareEnd = dateString.compareTo(startDate);
|
||||
if (compareStart >= 0 && compareEnd <=0) {
|
||||
return true;
|
||||
} else return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 此时的mybatis-plus对localDate类型没有完全支持,则转换为字符串使用
|
||||
* @param startDate
|
||||
* @param endDate
|
||||
*/
|
||||
public void convertToStr(LocalDate startDate,LocalDate endDate){
|
||||
|
||||
/**
|
||||
* 使用DateTimeFormatter线程安全,但不晓得怎么支持Date类型转换为字符串 ¯\_(ツ)_/¯
|
||||
*/
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
|
||||
// SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");//线程不安全且不支持LocalDate
|
||||
|
||||
this.startDate =formatter.format(startDate);
|
||||
this.endDate=formatter.format(endDate);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,9 @@ public class WarningEO extends EarlyWarningEO {
|
||||
@DateTimeFormat(pattern = "YYYY-MM-dd")
|
||||
private Date ZCCSSRQ;
|
||||
|
||||
@DateTimeFormat(pattern = "YYYY-MM-dd")
|
||||
private Date SSRQ;
|
||||
|
||||
private String standNum;
|
||||
|
||||
private String standSort;
|
||||
|
||||
@@ -10,6 +10,7 @@ import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
|
||||
+1
-3
@@ -108,9 +108,7 @@ public class EarlyWarningEOServiceImpl extends ServiceImpl<EarlyWarningEODao, Ea
|
||||
return "更改成功";
|
||||
}
|
||||
private IPage<EarlyWarningEO> getEarlyWarningEOIPage(int current,int pageSize, QueryWrapper<EarlyWarningEO> wrapper) {
|
||||
DataDTO dataDTO = new DataDTO();
|
||||
wrapper.eq("power",1)
|
||||
.between("PUT_TIME",dataDTO.getStartDate(),dataDTO.getEndDate());
|
||||
wrapper.eq("power",1);
|
||||
Page<EarlyWarningEO> page = new Page<>(current, pageSize);
|
||||
IPage<EarlyWarningEO> userIPage = earlyWarningEODao.selectPage(page, wrapper);
|
||||
System.out.println("总条数"+userIPage.getTotal());
|
||||
|
||||
+9
@@ -135,4 +135,13 @@ public class SarStandFileEOController extends BaseController<SarStandFileEO> {
|
||||
return Result.success(getPageInfo(page.getPager(), rows));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "查询文本信息")
|
||||
@GetMapping("/queryFileInfo")
|
||||
public ResponseMessage<List<SarStandFileEO>> queryFileInfo(String standId){
|
||||
|
||||
List<SarStandFileEO> sarStandFileEOS = sarStandFileEOService.selectFileByStandId(standId);
|
||||
return Result.success(sarStandFileEOS);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
package com.adc.da.slrs.standardSplit.entity;
|
||||
|
||||
import com.adc.da.base.entity.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
@@ -12,14 +17,22 @@ import java.util.List;
|
||||
* <b>日期:</b> 2018-09-03 <br>
|
||||
* <b>版权所有:<b>版权归北京卡达克数据技术中心所有。<br>
|
||||
*/
|
||||
@Data
|
||||
@TableName("sar_stand_file")
|
||||
public class SarStandFileEO extends BaseEntity {
|
||||
|
||||
@TableField(exist = false)
|
||||
@org.springframework.format.annotation.DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date modifyTime;
|
||||
@TableField(exist = false)
|
||||
@org.springframework.format.annotation.DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date creationTime;
|
||||
@TableLogic(value = "0",delval = "1")
|
||||
private String validFlag;
|
||||
|
||||
@TableField("USE_MODEL")
|
||||
private String useModel;
|
||||
@TableField("ATT_ID")
|
||||
private String attId;
|
||||
|
||||
public String getAttId1() {
|
||||
@@ -29,23 +42,39 @@ public class SarStandFileEO extends BaseEntity {
|
||||
public void setAttId1(String attId1) {
|
||||
this.attId1 = attId1;
|
||||
}
|
||||
|
||||
@TableField(exist = false)
|
||||
private String attId1;
|
||||
@TableField(exist = false)
|
||||
private String resId;
|
||||
@TableField("STAND_ID")
|
||||
private String standId;
|
||||
@TableId("id")
|
||||
private String id;
|
||||
@TableField(exist = false)
|
||||
private Integer pageCount;
|
||||
@TableField(exist = false)
|
||||
private String fileOldName;
|
||||
@TableField(exist = false)
|
||||
private List<String> idlist = new ArrayList<>();
|
||||
@TableField("STAND_FILE_CLASSIFY")
|
||||
private String standFileClassify;
|
||||
@TableField(exist = false)
|
||||
private String standFileClassifyShow;
|
||||
@TableField(exist = false)
|
||||
private String fileSuffix;
|
||||
@TableField("FILE_NAME")
|
||||
private String fileName;
|
||||
@TableField(exist = false)
|
||||
private String password;
|
||||
@TableField(exist = false)
|
||||
private String creationUser;
|
||||
@TableField(exist = false)
|
||||
private String standNumber;
|
||||
@TableField(exist = false)
|
||||
private String standName;
|
||||
@TableField(exist = false)
|
||||
private String sarType;
|
||||
@TableField("ORI_ATT_ID")
|
||||
private String oriAttId;
|
||||
|
||||
/**
|
||||
@@ -103,7 +132,7 @@ public class SarStandFileEO extends BaseEntity {
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** **/
|
||||
public Date getModifyTime() {
|
||||
return this.modifyTime;
|
||||
|
||||
+3
@@ -22,4 +22,7 @@ public interface SarStandFileEOService {
|
||||
int deleteByPrimaryKey(String id) throws Exception;
|
||||
|
||||
List<SarStandFileEO> selectFileByAttId(String attId) throws Exception;
|
||||
|
||||
List<SarStandFileEO> selectFileByStandId(String standId);
|
||||
|
||||
}
|
||||
|
||||
+9
@@ -5,6 +5,7 @@ import com.adc.da.slrs.standardSplit.dao.SarStandFileEODao;
|
||||
import com.adc.da.slrs.standardSplit.entity.SarStandFileEO;
|
||||
import com.adc.da.slrs.standardSplit.entity.SarStandFileEOPage;
|
||||
import com.adc.da.slrs.standardSplit.service.SarStandFileEOService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -63,4 +64,12 @@ public class SarStandFileEOServiceImpl implements SarStandFileEOService {
|
||||
return sarStandFileEODao.selectFileByAttId(attId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SarStandFileEO> selectFileByStandId(String standId) {
|
||||
QueryWrapper<SarStandFileEO> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("STAND_ID",standId).groupBy("ORI_ATT_ID");
|
||||
return sarStandFileEODao.selectList(queryWrapper);
|
||||
// return sarStandFileEODao.selectFileByStandId(standId);r
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
<result column="STAND_YEAR" property="standYear"/>
|
||||
<result column="XCXSSRQ" property="XCXSSRQ"/>
|
||||
<result column="ZCCSSRQ" property="ZCCSSRQ"/>
|
||||
<result column="SSRQ" property="SSRQ"/>
|
||||
<result column="CLLX" property="applyType" />
|
||||
<result column="STAND_TYPE" property="standType" />
|
||||
<result column="ZRGCS" property="dutyEngineer" />
|
||||
@@ -27,6 +28,7 @@
|
||||
info.STAND_TYPE,
|
||||
attrInfo.CLLX,
|
||||
attrInfo.ZRGCS,
|
||||
attrInfo.SSRQ,
|
||||
attrInfo.${str}
|
||||
FROM
|
||||
sar_standards_info AS info
|
||||
@@ -35,9 +37,11 @@
|
||||
1=1
|
||||
<if test="date!=null">
|
||||
and
|
||||
attrInfo.SSRQ
|
||||
BETWEEN #{date.startDate} and #{date.endDate}
|
||||
or
|
||||
attrInfo.${str}
|
||||
BETWEEN DATE_FORMAT( #{date.startDate},'%Y-%m-%d %H:%i:%s')
|
||||
and DATE_FORMAT( #{date.endDate},'%Y-%m-%d %H:%i:%s')
|
||||
BETWEEN #{date.startDate} and #{date.endDate}
|
||||
</if>
|
||||
</where>
|
||||
|
||||
|
||||
@@ -20,22 +20,24 @@
|
||||
<select id="selectWithinTerm" resultMap="resultMap" parameterType="com.adc.da.scheduled.entity.DataDTO">
|
||||
SELECT
|
||||
items.ID,
|
||||
STAND_ID,
|
||||
ITEMS_NUM,
|
||||
ITEMS_NAME,
|
||||
TERMS_CONDITIONS,
|
||||
DUTY_ENGINEER,
|
||||
APPLY_ARCTIC,
|
||||
items.ITEMS_NUM,
|
||||
items.ITEMS_NAME,
|
||||
items.TERMS_CONDITIONS,
|
||||
items.DUTY_ENGINEER,
|
||||
items.STAND_ID,
|
||||
info.STAND_NAME,
|
||||
info.STAND_TYPE,
|
||||
info.STAND_NUMBER,
|
||||
|
||||
${str}
|
||||
attrInfo.CLLX,
|
||||
attrInfo.ZRGCS,
|
||||
items.${str}
|
||||
FROM
|
||||
sar_stand_items AS items
|
||||
JOIN sar_standards_info AS info ON items.STAND_ID=info.ID
|
||||
JOIN sar_stand_attr_info AS attrInfo ON info.id = attrinfo.stand_id
|
||||
|
||||
WHERE
|
||||
${str} BETWEEN #{date.startDate} and #{date.endDate}
|
||||
items.${str} BETWEEN #{date.startDate} and #{date.endDate}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
|
||||
<insert id="ignoreInsert" parameterType="java.util.LinkedList">
|
||||
|
||||
INSERT IGNORE 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, STAND_TYPE, STAND_CODE,STAND_NAME,PUT_TIME,APPLY_TYPE,DUTY_ENGINEER,ITEMS_ID,ITEMS_NUM,ITEMS_NAME,POLICY_ID,POLICY_NAME,MARK,POWER)
|
||||
VALUES
|
||||
<if test="warningEOS !=null and warningEOS.size()!=0">
|
||||
<foreach collection="warningEOS" item="item" index="index" separator=",">
|
||||
|
||||
Reference in New Issue
Block a user