add 标准预警
This commit is contained in:
@@ -5,7 +5,11 @@ import com.jero.common.exception.JeroBootException;
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: liao
|
||||
@@ -17,6 +21,11 @@ public class DateUtil {
|
||||
public static DateFormat DATE_FORMAT_DAY = new SimpleDateFormat("yyyy-MM-dd");
|
||||
public static DateFormat DATE_FORMAT_SECOND = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
/**
|
||||
* @Author: liao
|
||||
* @Date: 2023/10/31 10:39
|
||||
* @Description: 字符串转日期(yyyy-MM-dd)
|
||||
**/
|
||||
public static Date getDateDay(String dateStr) {
|
||||
try {
|
||||
return DATE_FORMAT_DAY.parse(dateStr);
|
||||
@@ -26,6 +35,11 @@ public class DateUtil {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @Author: liao
|
||||
* @Date: 2023/10/31 10:40
|
||||
* @Description: 字符串转日期(yyyy-MM-dd HH:mm:ss)
|
||||
**/
|
||||
public static Date getDateSecond(String dateStr) {
|
||||
try {
|
||||
return DATE_FORMAT_SECOND.parse(dateStr);
|
||||
@@ -34,4 +48,24 @@ public class DateUtil {
|
||||
throw new JeroBootException("时间格式错误,正确格式yyyy-MM-dd HH:mm:ss");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @Author: liao
|
||||
* @Date: 2023/10/31 10:42
|
||||
* @Description: 获取当前一周的时间集合(字符串)
|
||||
**/
|
||||
public static List<String> getLastWeekDateAsString() {
|
||||
LocalDate today = LocalDate.now();
|
||||
LocalDate lastWeek = today.minusWeeks(1);
|
||||
|
||||
List<String> dayStrings = new ArrayList<>();
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
|
||||
while (!lastWeek.isAfter(today)) {
|
||||
dayStrings.add(lastWeek.format(formatter));
|
||||
lastWeek = lastWeek.plusDays(1);
|
||||
}
|
||||
|
||||
return dayStrings;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -45,8 +45,8 @@ public class LawsDataCenterFile implements Serializable {
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private java.lang.String createBy;
|
||||
/**创建时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private java.util.Date createTime;
|
||||
/**更新人*/
|
||||
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
package com.jero.modules.laws.localTool.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.modules.laws.localTool.entity.StandardEarlyWarning;
|
||||
import com.jero.modules.laws.localTool.service.ILawsStandardEarlyWarningService;
|
||||
import com.jero.modules.laws.standard.entity.LawsNewsFeed;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @Author: liao
|
||||
* @Date: 2023/10/31 9:46
|
||||
* @Description: 标准预警
|
||||
*/
|
||||
@Api(tags="标准预警")
|
||||
@RestController
|
||||
@RequestMapping("/laws/localTool/standardEarlyWarning")
|
||||
public class LawsStandardEarlyWarningController {
|
||||
|
||||
@Autowired
|
||||
private ILawsStandardEarlyWarningService lawsStandardEarlyWarningService;
|
||||
|
||||
@AutoLog(value = "标准预警-新车型实施预警")
|
||||
@ApiOperation(value = "标准预警-新车型实施预警", notes = "标准预警-新车型实施预警")
|
||||
@GetMapping(value = "/newModelImplementation")
|
||||
public Result<IPage<StandardEarlyWarning>> newModelImplementation(StandardEarlyWarning standardEarlyWarning,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
IPage<StandardEarlyWarning> pageList = lawsStandardEarlyWarningService.newModelImplementation(standardEarlyWarning, pageNo, pageSize);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
@AutoLog(value = "标准预警-在产车实施预警")
|
||||
@ApiOperation(value = "标准预警-在产车实施预警", notes = "标准预警-在产车实施预警")
|
||||
@GetMapping(value = "/onTheProduction")
|
||||
public Result<IPage<StandardEarlyWarning>> onTheProduction(StandardEarlyWarning standardEarlyWarning,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
IPage<StandardEarlyWarning> pageList = lawsStandardEarlyWarningService.onTheProduction(standardEarlyWarning, pageNo, pageSize);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
package com.jero.modules.laws.localTool.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: liao
|
||||
* @Date: 2023/10/31 10:11
|
||||
* @Description: 标准预警
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="标准预警", description="标准预警")
|
||||
public class StandardEarlyWarning {
|
||||
|
||||
/**来源(国内/海外)*/
|
||||
@Excel(name = "来源(国内/海外)", width = 15)
|
||||
@ApiModelProperty(value = "来源(国内/海外)")
|
||||
private java.lang.String source;
|
||||
|
||||
/**标准号/标准名称*/
|
||||
@Excel(name = "标准号/标准名称", width = 15)
|
||||
@ApiModelProperty(value = "标准号/标准名称")
|
||||
private java.lang.String standardNumberOrName;
|
||||
|
||||
/**责任部门*/
|
||||
@Excel(name = "责任部门", width = 15)
|
||||
@ApiModelProperty(value = "责任部门")
|
||||
private java.lang.String responsibleDepartment;
|
||||
|
||||
/**标准编号*/
|
||||
@Excel(name = "标准编号", width = 15)
|
||||
@ApiModelProperty(value = "标准编号")
|
||||
private java.lang.String standardNumber;
|
||||
|
||||
/**标准名称*/
|
||||
@Excel(name = "标准名称", width = 15)
|
||||
@ApiModelProperty(value = "标准名称")
|
||||
private java.lang.String standardName;
|
||||
|
||||
/**在产车实施日期*/
|
||||
@Excel(name = "在产车实施日期", width = 15)
|
||||
@ApiModelProperty(value = "在产车实施日期")
|
||||
private java.lang.String onTheProductionDate;
|
||||
/**新车型实施日期*/
|
||||
@Excel(name = "新车型实施日期", width = 15)
|
||||
@ApiModelProperty(value = "新车型实施日期")
|
||||
private java.lang.String newModelImplementationDate;
|
||||
|
||||
/**当前天前一周*/
|
||||
private List<String> dayStrings;
|
||||
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.jero.modules.laws.localTool.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.jero.modules.laws.localTool.entity.StandardEarlyWarning;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* @Author: liao
|
||||
* @Date: 2023/10/31 10:56
|
||||
* @Description: 标准预警
|
||||
*/
|
||||
@Mapper
|
||||
public interface LawsStandardEarlyWarningMapper {
|
||||
|
||||
IPage<StandardEarlyWarning> pageList(Page<StandardEarlyWarning> page, @Param("param") StandardEarlyWarning standardEarlyWarning);
|
||||
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.jero.modules.laws.localTool.mapper.LawsStandardEarlyWarningMapper">
|
||||
|
||||
<select id="pageList" resultType="com.jero.modules.laws.localTool.entity.StandardEarlyWarning">
|
||||
SELECT
|
||||
standard.source,
|
||||
standard.standard_number,
|
||||
standard.standard_name,
|
||||
standard.responsible_department,
|
||||
standard.on_the_production_date,
|
||||
standard.new_model_implementation_date
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
'国内' AS source,
|
||||
lds.standard_number,
|
||||
lds.standard_name,
|
||||
lds.responsible_department,
|
||||
lds.on_the_production_date,
|
||||
lds.new_model_implementation_date,
|
||||
lds.implementation_date
|
||||
FROM
|
||||
laws_domestic_standard lds
|
||||
WHERE
|
||||
lds.del_flag = 0 UNION
|
||||
SELECT
|
||||
'海外' AS source,
|
||||
los.standard_number,
|
||||
los.standard_name,
|
||||
los.responsible_department,
|
||||
los.on_the_production_date,
|
||||
los.new_model_implementation_date,
|
||||
los.implementation_date
|
||||
FROM
|
||||
laws_overseas_standard los
|
||||
WHERE
|
||||
los.del_flag = 0
|
||||
) AS standard
|
||||
WHERE
|
||||
<if test="param.newModelImplementationDate != null and param.newModelImplementationDate != ''">
|
||||
<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 != ''">
|
||||
<foreach collection="param.dayStrings" separator=" or " open="(" close=")" item="item">
|
||||
standard.on_the_production_date LIKE CONCAT('%', #{item}, '%')
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="param.source != null and param.source != ''">
|
||||
AND standard.source = #{param.source}
|
||||
</if>
|
||||
<if test="param.responsibleDepartment != null and param.responsibleDepartment != ''">
|
||||
AND standard.responsible_department = #{param.responsibleDepartment}
|
||||
</if>
|
||||
<if test="param.standardNumberOrName != null and param.standardNumberOrName != ''">
|
||||
AND (standard.standard_number LIKE CONCAT('%', #{param.standardNumberOrName}, '%')
|
||||
OR
|
||||
standard.standard_name LIKE CONCAT('%', #{param.standardNumberOrName}, '%'))
|
||||
</if>
|
||||
ORDER BY
|
||||
standard.implementation_date DESC
|
||||
</select>
|
||||
</mapper>
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package com.jero.modules.laws.localTool.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.jero.modules.laws.localTool.entity.StandardEarlyWarning;
|
||||
|
||||
/**
|
||||
* @Author: liao
|
||||
* @Date: 2023/10/31 10:19
|
||||
* @Description: 标准预警
|
||||
*/
|
||||
public interface ILawsStandardEarlyWarningService {
|
||||
|
||||
/**
|
||||
* @Author: liao
|
||||
* @Date: 2023/10/31 10:30
|
||||
* @Description: 新车型实施预警
|
||||
**/
|
||||
IPage<StandardEarlyWarning> newModelImplementation(StandardEarlyWarning standardEarlyWarning, Integer pageNo, Integer pageSize);
|
||||
|
||||
/**
|
||||
* @Author: liao
|
||||
* @Date: 2023/10/31 13:32
|
||||
* @Description: 在产车实施预警
|
||||
**/
|
||||
IPage<StandardEarlyWarning> onTheProduction(StandardEarlyWarning standardEarlyWarning, Integer pageNo, Integer pageSize);
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
package com.jero.modules.laws.localTool.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
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 org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: liao
|
||||
* @Date: 2023/10/31 10:20
|
||||
* @Description: 标准预警
|
||||
*/
|
||||
@Service
|
||||
public class LawsStandardEarlyWarningServiceImpl implements ILawsStandardEarlyWarningService {
|
||||
|
||||
@Autowired
|
||||
private LawsStandardEarlyWarningMapper lawsStandardEarlyWarningMapper;
|
||||
|
||||
/**
|
||||
* @Author: liao
|
||||
* @Date: 2023/10/31 10:30
|
||||
* @Description: 新车型实施预警
|
||||
**/
|
||||
@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);
|
||||
return pageList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Author: liao
|
||||
* @Date: 2023/10/31 13:32
|
||||
* @Description: 在产车实施预警
|
||||
**/
|
||||
@Override
|
||||
public IPage<StandardEarlyWarning> onTheProduction(StandardEarlyWarning standardEarlyWarning, Integer pageNo, Integer pageSize) {
|
||||
// 获取当前日前一周的日期字符串集合
|
||||
List<String> dayStrings = DateUtil.getLastWeekDateAsString();
|
||||
standardEarlyWarning.setDayStrings(dayStrings);
|
||||
standardEarlyWarning.setOnTheProductionDate("A");
|
||||
Page<StandardEarlyWarning> page = new Page<>(pageNo, pageSize);
|
||||
IPage<StandardEarlyWarning> pageList = lawsStandardEarlyWarningMapper.pageList(page, standardEarlyWarning);
|
||||
return pageList;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user