update 标准预警

This commit is contained in:
liao
2023-10-31 14:39:15 +08:00
parent 61f5e31d18
commit 4f360092f4
5 changed files with 36 additions and 23 deletions
@@ -75,6 +75,7 @@ public class LawsDataCenterFile implements Serializable {
@Excel(name = "上传资料(文件id", width = 15)
@ApiModelProperty(value = "上传资料(文件id,上传时多个用逗号分隔)")
@NotBlank(message = "上传资料不能为空")
@Dict(dictTable = "oss_file", dicCode = "id", dicText = "file_name")
private java.lang.String fileId;
/**推送范围(用户id逗号拼接)*/
@Excel(name = "推送范围(用户id逗号拼接)", width = 15)
@@ -156,24 +156,8 @@ public class LawsDataCenterFileServiceImpl extends ServiceImpl<LawsDataCenterFil
if (StringUtils.isBlank(lawsDataCenterFile.getFileId())) {
throw new JeroBootException(ResultCommon.EMPTY_COMMON, "fileId");
}
List<String> fileIds = Arrays.asList(lawsDataCenterFile.getFileId().split(","));
if (1 == fileIds.size()) {
updateById(lawsDataCenterFile);
return;
}
// 删除原来存储的
removeById(lawsDataCenterFile.getId());
List<LawsDataCenterFile> fileList = new ArrayList();
fileIds.forEach(fileId -> {
LawsDataCenterFile file = new LawsDataCenterFile();
BeanUtils.copyProperties(lawsDataCenterFile, file);
file.setFileId(fileId);
file.setId(null);
fileList.add(file);
});
saveBatch(fileList);
updateById(lawsDataCenterFile);
}
/**
@@ -1,6 +1,7 @@
package com.jero.modules.laws.localTool.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.jero.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -39,11 +39,13 @@
) AS standard
WHERE
<if test="param.newModelImplementationDate != null and param.newModelImplementationDate != ''">
standard.new_model_implementation_date IS NOT NULL AND
<foreach collection="param.dayStrings" separator=" or " open="(" close=")" item="item">
standard.new_model_implementation_date LIKE CONCAT('%', #{item}, '%')
</foreach>
</if>
<if test="param.onTheProductionDate != null and param.onTheProductionDate != ''">
standard.on_the_production_date IS NOT NULL AND
<foreach collection="param.dayStrings" separator=" or " open="(" close=")" item="item">
standard.on_the_production_date LIKE CONCAT('%', #{item}, '%')
</foreach>
@@ -6,9 +6,12 @@ import com.jero.modules.laws.common.util.DateUtil;
import com.jero.modules.laws.localTool.entity.StandardEarlyWarning;
import com.jero.modules.laws.localTool.mapper.LawsStandardEarlyWarningMapper;
import com.jero.modules.laws.localTool.service.ILawsStandardEarlyWarningService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.List;
/**
@@ -17,6 +20,7 @@ import java.util.List;
* @Description: 标准预警
*/
@Service
@Slf4j
public class LawsStandardEarlyWarningServiceImpl implements ILawsStandardEarlyWarningService {
@Autowired
@@ -29,12 +33,8 @@ public class LawsStandardEarlyWarningServiceImpl implements ILawsStandardEarlyWa
**/
@Override
public IPage<StandardEarlyWarning> newModelImplementation(StandardEarlyWarning standardEarlyWarning, Integer pageNo, Integer pageSize) {
// 获取当前日前一周的日期字符串集合
List<String> dayStrings = DateUtil.getLastWeekDateAsString();
standardEarlyWarning.setDayStrings(dayStrings);
standardEarlyWarning.setNewModelImplementationDate("A");
Page<StandardEarlyWarning> page = new Page<>(pageNo, pageSize);
IPage<StandardEarlyWarning> pageList = lawsStandardEarlyWarningMapper.pageList(page, standardEarlyWarning);
IPage<StandardEarlyWarning> pageList = pageList(standardEarlyWarning, pageNo, pageSize);
return pageList;
}
@@ -45,12 +45,37 @@ public class LawsStandardEarlyWarningServiceImpl implements ILawsStandardEarlyWa
**/
@Override
public IPage<StandardEarlyWarning> onTheProduction(StandardEarlyWarning standardEarlyWarning, Integer pageNo, Integer pageSize) {
standardEarlyWarning.setOnTheProductionDate("A");
IPage<StandardEarlyWarning> pageList = pageList(standardEarlyWarning, pageNo, pageSize);
return pageList;
}
/**
* @Author: liao
* @Date: 2023/10/31 14:08
* @Description: 标准预警通用分页查询
**/
private IPage<StandardEarlyWarning> pageList(StandardEarlyWarning standardEarlyWarning, Integer pageNo, Integer pageSize) {
// 获取当前日前一周的日期字符串集合
List<String> dayStrings = DateUtil.getLastWeekDateAsString();
log.info("标准预警:当前一周的日期为{}", StringUtils.join(dayStrings, ","));
standardEarlyWarning.setDayStrings(dayStrings);
standardEarlyWarning.setOnTheProductionDate("A");
Page<StandardEarlyWarning> page = new Page<>(pageNo, pageSize);
IPage<StandardEarlyWarning> pageList = lawsStandardEarlyWarningMapper.pageList(page, standardEarlyWarning);
pageList.getRecords().forEach(warning -> {
// 新车型实施日期
if (StringUtils.isNotBlank(standardEarlyWarning.getNewModelImplementationDate())) {
List<String> eStrings = Arrays.asList(warning.getNewModelImplementationDate().split(","));
eStrings.retainAll(dayStrings); // 删除eStrings中与dayStrings不相同的元素
warning.setNewModelImplementationDate(eStrings.get(0));
}
// 在产车实施日期
if (StringUtils.isNotBlank(standardEarlyWarning.getOnTheProductionDate())) {
List<String> eStrings = Arrays.asList(warning.getOnTheProductionDate().split(","));
eStrings.retainAll(dayStrings); // 删除eStrings中与dayStrings不相同的元素
warning.setOnTheProductionDate(eStrings.get(0));
}
});
return pageList;
}