yanyan 2 years ago
parent
commit
a300df43ca
  1. 18
      lib/EmergencyBaseLib/EmergencyCommon/src/main/java/com/zdxt/common/util/DateUtils.java
  2. 28
      lib/EmergencyService/zdxtEmergencyAppService/src/main/java/com/zdxt/app/controller/AppLawEnforcementWarningListController.java
  3. 1
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/domain/LawEnforcementWarningList.java
  4. 2
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/mapper/LawEnforcementWarningListMapper.java
  5. 7
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/ILawEnforcementWarningListService.java
  6. 114
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/LawEnforcementWarningListServiceImpl.java
  7. 3
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/EnforcementRegistrationMapper.xml
  8. 59
      lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/LawEnforcementWarningListMapper.xml

18
lib/EmergencyBaseLib/EmergencyCommon/src/main/java/com/zdxt/common/util/DateUtils.java

@ -113,6 +113,24 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
return DateFormatUtils.format(now, "yyyyMMdd");
}
public static Date dateTransMonth(Date date)
{
Calendar cal=Calendar.getInstance();
cal.setTime(date);
cal.set(Calendar.DAY_OF_MONTH,1);
// 时
cal.set(Calendar.HOUR_OF_DAY, 0);
// 分
cal.set(Calendar.MINUTE, 0);
// 秒
cal.set(Calendar.SECOND, 0);
// 毫秒
cal.set(Calendar.MILLISECOND, 0);
return cal.getTime();
}
/**
* 日期型字符串转化为日期 格式
*/

28
lib/EmergencyService/zdxtEmergencyAppService/src/main/java/com/zdxt/app/controller/AppLawEnforcementWarningListController.java

@ -4,6 +4,8 @@ import com.zdxt.code.domain.LawEnforcementWarningList;
import com.zdxt.code.service.ILawEnforcementWarningListService;
import com.zdxt.common.ZDResponse;
import com.zdxt.common.controller.BaseController;
import com.zdxt.common.util.Constants;
import com.zdxt.common.util.ServletUtils;
import com.zdxt.common.util.TableDataInfo;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
@ -12,6 +14,7 @@ import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.stream.Collectors;
/**
@ -62,6 +65,31 @@ public class AppLawEnforcementWarningListController extends BaseController
List<LawEnforcementWarningList> list = lawEnforcementWarningListService.selectLawEnforcementWarningListList(lawEnforcementWarningList);
return getDataTable(list);
}
/**
* 查询执法预警列表列表-改造
*/
@GetMapping("/queryListNew")
@ResponseBody
public TableDataInfo queryListNew(LawEnforcementWarningList lawEnforcementWarningList)
{
List<LawEnforcementWarningList> list = lawEnforcementWarningListService.selectLawEnforcementWarningListNew(lawEnforcementWarningList);
TableDataInfo dataTable = getDataTable(list);
//手动分页
dataTable.setRows(list.stream()
.skip(ServletUtils.getParameterToInt(Constants.PAGE_NUM))
.limit(ServletUtils.getParameterToInt(Constants.PAGE_SIZE))
.collect(Collectors.toList()));
return dataTable;
}
@GetMapping("/queryListByEnterpriseNumberNew")
@ResponseBody
public ZDResponse queryListByEnterpriseNumberNew(LawEnforcementWarningList lawEnforcementWarningList)
{
List<LawEnforcementWarningList> list = lawEnforcementWarningListService.selectLawEnforcementWarningByEnterpriseNumberNew(lawEnforcementWarningList);
return ZDResponse.success("获取当前企业本月预警信息",list);
}
@GetMapping("/queryListByEnterpriseNumber")
@ResponseBody
public ZDResponse queryListByEnterpriseNumber(LawEnforcementWarningList lawEnforcementWarningList)

1
lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/domain/LawEnforcementWarningList.java

@ -72,6 +72,7 @@ public class LawEnforcementWarningList extends BaseDomain
private Boolean show = false;
/**
* 快捷搜索 日期类型
* 1:本月 2:本季 3:本年
*/
private Integer dateType;

2
lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/mapper/LawEnforcementWarningListMapper.java

@ -28,6 +28,8 @@ public interface LawEnforcementWarningListMapper
List<LawEnforcementWarningList> selectLawEnforcementWarningListList(LawEnforcementWarningList lawEnforcementWarningList);
List<LawEnforcementWarningList> selectLawEnforcementWarningListList1(LawEnforcementWarningList lawEnforcementWarningList);
List<LawEnforcementWarningList> selectLawEnforcementWarningListList2(LawEnforcementWarningList lawEnforcementWarningList);
List<LawEnforcementWarningList> selectLawEnforcementWarningListList3(LawEnforcementWarningList lawEnforcementWarningList);
List<LawEnforcementWarningList> selectLawEnforcementWarningListListTypeIs1(LawEnforcementWarningList lawEnforcementWarningList);
/**

7
lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/ILawEnforcementWarningListService.java

@ -1,6 +1,8 @@
package com.zdxt.code.service;
import com.zdxt.code.domain.LawEnforcementWarningList;
import com.zdxt.common.util.TableDataInfo;
import java.util.List;
/**
@ -27,6 +29,8 @@ public interface ILawEnforcementWarningListService
*/
List<LawEnforcementWarningList> selectLawEnforcementWarningListList(LawEnforcementWarningList lawEnforcementWarningList);
List<LawEnforcementWarningList> selectLawEnforcementWarningListNew(LawEnforcementWarningList lawEnforcementWarningList);
List<LawEnforcementWarningList> selectLawEnforcementWarningListListOrderByNumber(LawEnforcementWarningList lawEnforcementWarningList);
List<LawEnforcementWarningList> selectLawEnforcementWarningListList1(LawEnforcementWarningList lawEnforcementWarningList);
@ -42,6 +46,9 @@ public interface ILawEnforcementWarningListService
*/
List<LawEnforcementWarningList> selectLawEnforcementWarningByEnterpriseNumber(LawEnforcementWarningList lawEnforcementWarningList);
List<LawEnforcementWarningList> selectLawEnforcementWarningByEnterpriseNumberNew(LawEnforcementWarningList lawEnforcementWarningList);
/**
* 新增执法预警列表
*

114
lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/LawEnforcementWarningListServiceImpl.java

@ -1,9 +1,15 @@
package com.zdxt.code.service.impl;
import java.util.List;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import cn.hutool.core.convert.Convert;
import com.zdxt.common.util.DateUtils;
import com.sun.jna.platform.win32.ObjBase;
import com.zdxt.code.domain.EnforcementRegistration;
import com.zdxt.common.util.*;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zdxt.code.mapper.LawEnforcementWarningListMapper;
@ -12,113 +18,159 @@ import com.zdxt.code.service.ILawEnforcementWarningListService;
/**
* 执法预警列表Service业务层处理
*
*
* @author chenrui
* @date 2024-03-22
*/
@Service
public class LawEnforcementWarningListServiceImpl implements ILawEnforcementWarningListService
{
public class LawEnforcementWarningListServiceImpl implements ILawEnforcementWarningListService {
@Autowired
private LawEnforcementWarningListMapper lawEnforcementWarningListMapper;
/**
* 查询执法预警列表
*
*
* @param id 执法预警列表ID
* @return 执法预警列表
*/
@Override
public LawEnforcementWarningList selectLawEnforcementWarningListById(String id)
{
public LawEnforcementWarningList selectLawEnforcementWarningListById(String id) {
return lawEnforcementWarningListMapper.selectLawEnforcementWarningListById(id);
}
/**
* 查询执法预警列表列表
*
*
* @param lawEnforcementWarningList 执法预警列表
* @return 执法预警列表
*/
@Override
public List<LawEnforcementWarningList> selectLawEnforcementWarningListList(LawEnforcementWarningList lawEnforcementWarningList)
{
public List<LawEnforcementWarningList> selectLawEnforcementWarningListList(LawEnforcementWarningList lawEnforcementWarningList) {
return lawEnforcementWarningListMapper.selectLawEnforcementWarningListList(lawEnforcementWarningList);
}
@Override
public List<LawEnforcementWarningList> selectLawEnforcementWarningListNew(LawEnforcementWarningList lawEnforcementWarningList) {
//dateType null:全部 1:本月 2:本季 3:本年
List<LawEnforcementWarningList> list = new ArrayList<>();
List<LawEnforcementWarningList> lawEnforcementWarningLists =
lawEnforcementWarningListMapper.selectLawEnforcementWarningListList3(lawEnforcementWarningList);
if (CollectionUtils.isNotEmpty(lawEnforcementWarningLists)) {
//如果展示本年 则筛选出每个月最高级别次数 分组累加得到全部检查次数
Map<String, List<LawEnforcementWarningList>> collect = lawEnforcementWarningLists.stream()
.filter(i -> StringUtils.isNotEmpty(i.getEnterpriseNumber()))
.filter(i -> Objects.nonNull(i.getWarningTime()))
.peek(i -> i.setWarningTime(DateUtils.dateTransMonth(i.getWarningTime())))
.collect(Collectors.groupingBy(LawEnforcementWarningList::getEnterpriseNumber)).entrySet().stream()
.collect(Collectors.toMap(Map.Entry::getKey, entry -> entry.getValue().stream()
.sorted(Comparator.comparing(LawEnforcementWarningList::getCreateTime).reversed())
.collect(Collectors.toList())
));
List<LawEnforcementWarningList> finalList = list;
collect.forEach((id, values) -> {
LawEnforcementWarningList warningList = new LawEnforcementWarningList();
BeanUtils.copyProperties(values.get(0), warningList);
//此时取每个公司每个月级别最高的一条预警累加 循环得到全部预警条数
Collection<LawEnforcementWarningList> values1 = values.stream().collect(
Collectors.toMap(LawEnforcementWarningList::getWarningTime,
Function.identity(), (t1, t2) -> t1.getEnforcementNumber() > t2.getEnforcementNumber() ? t1 : t2)
).values();
warningList.setEnforcementNumber(values1.stream()
.map(LawEnforcementWarningList::getEnforcementNumber).reduce(Integer::sum).get());
warningList.setWarningCause("对该企业已检查" + warningList.getEnforcementNumber() + "次");
finalList.add(warningList);
});
}
return list;
}
@Override
public List<LawEnforcementWarningList> selectLawEnforcementWarningListListOrderByNumber(LawEnforcementWarningList lawEnforcementWarningList)
{
public List<LawEnforcementWarningList> selectLawEnforcementWarningListListOrderByNumber(LawEnforcementWarningList lawEnforcementWarningList) {
return lawEnforcementWarningListMapper.selectLawEnforcementWarningListListOrderByNumber(lawEnforcementWarningList);
}
@Override
public List<LawEnforcementWarningList> selectLawEnforcementWarningListList1(LawEnforcementWarningList lawEnforcementWarningList)
{
public List<LawEnforcementWarningList> selectLawEnforcementWarningListList1(LawEnforcementWarningList lawEnforcementWarningList) {
return lawEnforcementWarningListMapper.selectLawEnforcementWarningListList1(lawEnforcementWarningList);
}
@Override
public List<LawEnforcementWarningList> selectLawEnforcementWarningListList2(LawEnforcementWarningList lawEnforcementWarningList)
{
public List<LawEnforcementWarningList> selectLawEnforcementWarningListList2(LawEnforcementWarningList lawEnforcementWarningList) {
return lawEnforcementWarningListMapper.selectLawEnforcementWarningListList2(lawEnforcementWarningList);
}
@Override
public List<LawEnforcementWarningList> selectLawEnforcementWarningListListTypeIs1(LawEnforcementWarningList lawEnforcementWarningList)
{
public List<LawEnforcementWarningList> selectLawEnforcementWarningListListTypeIs1(LawEnforcementWarningList lawEnforcementWarningList) {
return lawEnforcementWarningListMapper.selectLawEnforcementWarningListListTypeIs1(lawEnforcementWarningList);
}
@Override
public List<LawEnforcementWarningList> selectLawEnforcementWarningByEnterpriseNumber(LawEnforcementWarningList lawEnforcementWarningList) {
return lawEnforcementWarningListMapper.selectLawEnforcementWarningByEnterpriseNumber(lawEnforcementWarningList);
}
@Override
public List<LawEnforcementWarningList> selectLawEnforcementWarningByEnterpriseNumberNew(LawEnforcementWarningList lawEnforcementWarningList) {
List<LawEnforcementWarningList> list =
lawEnforcementWarningListMapper.selectLawEnforcementWarningListList3(lawEnforcementWarningList);
if (CollectionUtils.isNotEmpty(list)) {
list = list.stream().sorted(
Comparator.comparing(
LawEnforcementWarningList::getCreateTime).reversed())
.collect(Collectors.toList());
}
return list;
}
/**
* 新增执法预警列表
*
*
* @param lawEnforcementWarningList 执法预警列表
* @return 结果
*/
@Override
public int insertLawEnforcementWarningList(LawEnforcementWarningList lawEnforcementWarningList)
{
public int insertLawEnforcementWarningList(LawEnforcementWarningList lawEnforcementWarningList) {
lawEnforcementWarningList.setCreateTime(DateUtils.getNowDate());
return lawEnforcementWarningListMapper.insertLawEnforcementWarningList(lawEnforcementWarningList);
}
/**
* 修改执法预警列表
*
*
* @param lawEnforcementWarningList 执法预警列表
* @return 结果
*/
@Override
public int updateLawEnforcementWarningList(LawEnforcementWarningList lawEnforcementWarningList)
{
public int updateLawEnforcementWarningList(LawEnforcementWarningList lawEnforcementWarningList) {
lawEnforcementWarningList.setUpdateTime(DateUtils.getNowDate());
return lawEnforcementWarningListMapper.updateLawEnforcementWarningList(lawEnforcementWarningList);
}
/**
* 删除执法预警列表对象
*
*
* @param ids 需要删除的数据ID
* @return 结果
*/
@Override
public int deleteLawEnforcementWarningListByIds(String ids)
{
public int deleteLawEnforcementWarningListByIds(String ids) {
return lawEnforcementWarningListMapper.deleteLawEnforcementWarningListByIds(Convert.toStrArray(ids));
}
/**
* 删除执法预警列表信息
*
*
* @param id 执法预警列表ID
* @return 结果
*/
@Override
public int deleteLawEnforcementWarningListById(String id)
{
public int deleteLawEnforcementWarningListById(String id) {
return lawEnforcementWarningListMapper.deleteLawEnforcementWarningListById(id);
}
}

3
lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/EnforcementRegistrationMapper.xml

@ -557,7 +557,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM
( SELECT enterprise_name, enterprise_number, bureau_dept_id,bureau_dept_name, unite_check, create_time ,
count( enterprise_number ) AS total FROM enforcement_registration
WHERE <![CDATA[ create_time >= #{beginTime} AND create_time <= #{endTime} ]]> AND bureau_dept_id IS NOT NULL
WHERE <![CDATA[ create_time >= #{beginTime} AND create_time <= #{endTime} ]]>
GROUP BY IFNULL(unite_check, RAND()) ,bureau_dept_id ) AS t1
GROUP BY t1.bureau_dept_id,t1.enterprise_number
</select>
@ -572,7 +572,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
( SELECT enterprise_name, enterprise_number, bureau_dept_id, unite_check, create_time ,
count( enterprise_number ) AS total FROM enforcement_registration
WHERE <![CDATA[ create_time >= #{beginTime} AND create_time <= #{endTime} ]]>
AND bureau_dept_id IS NOT NULL
GROUP BY IFNULL(unite_check, RAND()) ,bureau_dept_id ) AS t1
GROUP BY t1.enterprise_number
</select>

59
lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/LawEnforcementWarningListMapper.xml

@ -59,6 +59,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="dateType != null and dateType == 1">
and DATE_FORMAT(warning_time, '%Y-%m') = DATE_FORMAT(CURDATE(), '%Y-%m')
</if>
<if test="dateType != null and dateType == 0">
and DATE_FORMAT(create_time, '%Y-%m') = DATE_FORMAT(CURDATE(), '%Y-%m')
</if>
<if test="dateType != null and dateType == 2">
AND DATE_FORMAT(warning_time, '%Y-%m') &gt;= CONCAT(YEAR(CURDATE()), '-',
CASE WHEN QUARTER(CURDATE()) IN (1) THEN '01'
@ -80,6 +83,62 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ORDER BY enforcement_number DESC,create_time DESC LIMIT 1000000000
) t GROUP BY t.enterprise_number order by t.create_time desc
</select>
<select id="selectLawEnforcementWarningListList3" parameterType="LawEnforcementWarningList" resultMap="LawEnforcementWarningListResult">
SELECT
id,
warning_time, warning_cause, warning_level ,
create_time, enterprise_name, enterprise_number,
enforcement_number,warn_type,enforcement_department,
enforcement_department_id,begin_time,end_time
FROM law_enforcement_warning_list
<where>
<if test="warningTime != null "> and warning_time = #{warningTime}</if>
<if test="warningLevel != null "> and warning_level = #{warningLevel}</if>
<if test="enterpriseName != null and enterpriseName != ''"> and enterprise_name like concat('%', #{enterpriseName}, '%')</if>
<if test="enterpriseNumber != null and enterpriseNumber != ''"> and enterprise_number like concat('%', #{enterpriseNumber}, '%')</if>
<if test="searchValue != null and searchValue != ''"> and (
enterprise_name like concat('%',#{searchValue},'%')
)</if>
<if test="searchDate != null and searchDate != ''">
and DATE_FORMAT(warning_time, '%Y-%m') = #{searchDate}
</if>
<if test="params.beginWarningTime != null and params.beginWarningTime != ''">
and warning_time <![CDATA[ >= ]]> #{params.beginWarningTime}
</if>
<if test="params.endWarningTime != null and params.endWarningTime != ''">
and warning_time <![CDATA[ <= ]]> #{params.endWarningTime}
</if>
<if test="warnType != null">AND warn_type = #{warnType}</if>
<if test=" enforcementDepartmentId != null and enforcementDepartmentId != ''">
enforcement_department_id = #{enforcementDepartmentId},
</if>
<if test="dateType != null and dateType == 1">
and DATE_FORMAT(warning_time, '%Y-%m') = DATE_FORMAT(CURDATE(), '%Y-%m')
</if>
<if test="dateType != null and dateType == 0">
and DATE_FORMAT(create_time, '%Y-%m') = DATE_FORMAT(CURDATE(), '%Y-%m')
</if>
<if test="dateType != null and dateType == 2">
AND DATE_FORMAT(warning_time, '%Y-%m') &gt;= CONCAT(YEAR(CURDATE()), '-',
CASE WHEN QUARTER(CURDATE()) IN (1) THEN '01'
WHEN QUARTER(CURDATE()) IN (2) THEN '04'
WHEN QUARTER(CURDATE()) IN (3) THEN '07'
ELSE '10' END)
and DATE_FORMAT(warning_time, '%Y-%m') &lt;= CONCAT(YEAR(CURDATE()), '-',
CASE
WHEN QUARTER(CURDATE()) IN (1) THEN '03'
WHEN QUARTER(CURDATE()) IN (2) THEN '06'
WHEN QUARTER(CURDATE()) IN (3) THEN '09'
ELSE '12'
END)
</if>
<if test="dateType != null and dateType == 3">
and DATE_FORMAT(warning_time, '%Y') = DATE_FORMAT(CURDATE(), '%Y')
</if>
</where>
ORDER BY enforcement_number DESC,create_time DESC
</select>
<select id="selectLawEnforcementWarningListListOrderByNumber" parameterType="LawEnforcementWarningList" resultMap="LawEnforcementWarningListResult">
select *
from (SELECT *

Loading…
Cancel
Save