|
|
|
@ -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); |
|
|
|
} |
|
|
|
} |
|
|
|
|