From a32fe1cd8a02debbc0aa6ed61a02f3769e102fd3 Mon Sep 17 00:00:00 2001
From: 101captain <237651143@qq.com>
Date: 星期一, 15 八月 2022 13:36:31 +0800
Subject: [PATCH] bug修改
---
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActAcidRecordServiceImpl.java | 139 ++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 126 insertions(+), 13 deletions(-)
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActAcidRecordServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActAcidRecordServiceImpl.java
index 5176897..4a2e461 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActAcidRecordServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActAcidRecordServiceImpl.java
@@ -15,9 +15,9 @@
import com.panzhihua.common.utlis.DateUtils;
import com.panzhihua.common.utlis.StringUtils;
import com.panzhihua.service_community.dao.*;
-import com.panzhihua.service_community.entity.ComActAcidDangerMember;
-import com.panzhihua.service_community.entity.ComActAcidRecord;
-import com.panzhihua.service_community.entity.ComActAcidUpdateRecord;
+import com.panzhihua.service_community.entity.*;
+import com.panzhihua.service_community.model.dos.ComActDO;
+import com.panzhihua.service_community.model.dos.ComStreetDO;
import com.panzhihua.service_community.service.ComActAcidRecordService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
@@ -60,15 +60,31 @@
private ComActAcidUpdateRecordDao comActAcidUpdateRecordDao;
@Resource
private ComAreaTownCommunityDao comAreaTownCommunityDao;
+ @Resource
+ private ComCunDao comCunDao;
+ @Resource
+ private ComStreetDAO comStreetDAO;
+ @Resource
+ private SysUserDao sysUserDao;
@Override
public R pageList(ComActAcidRecordDTO comActAcidRecordDTO) {
+ //是否需要筛选
+ comActAcidRecordDTO.setType(isVilliage(comActAcidRecordDTO.getLoginAccount()));
+ log.info("搜索条件=========="+comActAcidRecordDTO);
+ //获取当前登录账号的社区名
return R.ok(this.baseMapper.pageList(new Page<>(comActAcidRecordDTO.getPage(), comActAcidRecordDTO.getSize()),comActAcidRecordDTO));
}
@Override
public R export(ComActAcidRecordDTO comActAcidRecordDTO) {
- List<ComActAcidRecordExcelReturn> comActAcidRecordExcelVOS=this.baseMapper.export(comActAcidRecordDTO);
+ List<ComActAcidRecordExcelReturn> comActAcidRecordExcelVOS=new ArrayList<>();
+ if(StringUtils.isNotEmpty(comActAcidRecordDTO.getIds())){
+ comActAcidRecordExcelVOS=this.baseMapper.selectByIds(comActAcidRecordDTO.getIds());
+ }
+ else {
+ comActAcidRecordExcelVOS=this.baseMapper.export(comActAcidRecordDTO);
+ }
comActAcidRecordExcelVOS.forEach(comActAcidRecordExcelVO -> {
if(StringUtils.isNotEmpty(comActAcidRecordExcelVO.getTouristCity())&&comActAcidRecordExcelVO.getTouristCity().contains("[")){
JSONArray jsonArray = JSON.parseArray(comActAcidRecordExcelVO.getTouristCity());
@@ -142,6 +158,12 @@
String dangerArea = comActAcidRecordVO.getDangerArea();
String outsideCity = comActAcidRecordVO.getOutsideCity();
String acidTest = comActAcidRecordVO.getAcidTest();
+ if(StringUtils.isEmpty(acidTest)){
+ acidTest="阴性";
+ }
+ if(StringUtils.isEmpty(travelCard)){
+ travelCard="否";
+ }
if (StringUtils.inStringIgnoreCase(colorMark, "红码", "黄码") || travelCard.equals("是")
|| dangerArea.equals("是") || outsideCity.equals("是") || acidTest.equals("阳性")) {
//风险人员
@@ -202,7 +224,7 @@
}
}
ComActAcidDangerMember dangerMember = comActAcidDangerMemberDao.selectOne(new LambdaQueryWrapper<ComActAcidDangerMember>()
- .eq(ComActAcidDangerMember::getIdCard, comActAcidRecordVO.getIdCard()).eq(ComActAcidDangerMember::getRecordId, recordId));
+ .eq(ComActAcidDangerMember::getIdCard, comActAcidRecordVO.getIdCard()).eq(ComActAcidDangerMember::getRecordId, recordId).orderByDesc(ComActAcidDangerMember::getCreateTime).last("limit 1"));
if (isNull(dangerMember)) {
dangerMember = new ComActAcidDangerMember();
dangerMember.setName(comActAcidRecordVO.getName());
@@ -241,8 +263,12 @@
return R.ok(this.baseMapper.fiveCount(localCity));
}
@Override
- public R fiveCountPlus(String date,String localCity) {
- return R.ok(this.baseMapper.fiveCountPlus(date,localCity));
+ public R fiveCountPlus(String date,String localCity,String loginAccount) {
+ Integer type=3;
+ if (StringUtils.isNotEmpty(loginAccount)){
+ type = isVilliage(loginAccount);
+ }
+ return R.ok(this.baseMapper.fiveCountPlus(date,localCity,type));
}
@Override
@@ -257,14 +283,14 @@
for(String areaValue:area){
ComActAcidChartsVO acid=new ComActAcidChartsVO();
acid.setName(areaValue);
- ComActAcidChartsVO acidCount =this.baseMapper.selectAcidCount(date,localCity);
+ ComActAcidChartsVO acidCount =this.baseMapper.selectAcidCount(date,areaValue);
if(acidCount!=null){
acid.setNumOne(acidCount.getNumOne());
}
acidList.add(acid);
ComActAcidChartsVO danger=new ComActAcidChartsVO();
danger.setName(areaValue);
- ComActAcidChartsVO dangerCount =this.baseMapper.selectDangerCount(date,localCity);
+ ComActAcidChartsVO dangerCount =this.baseMapper.selectDangerCount(date,areaValue);
if(dangerCount!=null){
danger.setNumOne(dangerCount.getNumOne());
danger.setNumTwo(dangerCount.getNumTwo());
@@ -345,9 +371,10 @@
ComActAcidRecord comActAcidRecord = new ComActAcidRecord();
BeanUtils.copyProperties(comActAcidRecordVO, comActAcidRecord);
String idCard = comActAcidRecordVO.getIdCard();
+ ComActAcidRecord comActAcidRecord1 = this.baseMapper.selectById(comActAcidRecordVO.getId());
+ comActAcidRecord.setUserId(comActAcidRecord1.getUserId());
if (isBlank(idCard)) {
- //只修改地址,其他信息需要查询
- ComActAcidRecord comActAcidRecord1 = this.baseMapper.selectById(comActAcidRecordVO.getId());
+ //只修改地址
if (isNull(comActAcidRecord1)) {
return R.fail("填报纪录不存在");
}
@@ -378,6 +405,12 @@
String dangerArea = comActAcidRecordVO.getDangerArea();
String outsideCity = comActAcidRecordVO.getOutsideCity();
String acidTest = comActAcidRecordVO.getAcidTest();
+ if(StringUtils.isEmpty(acidTest)){
+ acidTest="阴性";
+ }
+ if(StringUtils.isEmpty(travelCard)){
+ travelCard="否";
+ }
if (StringUtils.inStringIgnoreCase(colorMark, "红码", "黄码") || travelCard.equals("是") || dangerArea.equals("是")
|| outsideCity.equals("是") || acidTest.equals("阳性")) {
// 风险人员
@@ -403,9 +436,10 @@
ComActAcidRecord comActAcidRecord = new ComActAcidRecord();
BeanUtils.copyProperties(comActAcidRecordVO, comActAcidRecord);
String idCard = comActAcidRecordVO.getIdCard();
+ ComActAcidRecord comActAcidRecord1 = this.baseMapper.selectById(comActAcidRecordVO.getId());
+ comActAcidRecord.setUserId(comActAcidRecord1.getUserId());
if (isBlank(idCard)) {
- //只修改核对状态,其他信息需要查询
- ComActAcidRecord comActAcidRecord1 = this.baseMapper.selectById(comActAcidRecordVO.getId());
+ //只修改核对状态
if (isNull(comActAcidRecord1)) {
return R.fail("填报纪录不存在");
}
@@ -428,6 +462,12 @@
String dangerArea = comActAcidRecordVO.getDangerArea();
String outsideCity = comActAcidRecordVO.getOutsideCity();
String acidTest = comActAcidRecordVO.getAcidTest();
+ if(StringUtils.isEmpty(acidTest)){
+ acidTest="阴性";
+ }
+ if(StringUtils.isEmpty(travelCard)){
+ travelCard="否";
+ }
if (StringUtils.inStringIgnoreCase(colorMark, "红码", "黄码") || travelCard.equals("是") || dangerArea.equals("是")
|| outsideCity.equals("是") || acidTest.equals("阳性")) {
// 风险人员
@@ -475,4 +515,77 @@
}
return R.ok(comActAcidRecordVO);
}
+
+ @Override
+ public R test() {
+ List<ComCun> comCuns=comCunDao.selectList(new QueryWrapper<ComCun>());
+ comCuns.forEach(comCun->{
+ ComActDO comActDO= comActDAO.selectOne(new QueryWrapper<ComActDO>().lambda().eq(ComActDO::getName,comCun.getCommunity()));
+ if(comActDO==null){
+ ComStreetDO comStreetDO = comStreetDAO.selectOne(new QueryWrapper<ComStreetDO>().lambda().eq(ComStreetDO::getName,comCun.getTown()));
+ if(comStreetDO==null){
+ comStreetDO=new ComStreetDO();
+ comStreetDO.setName(comCun.getTown());
+ areaCheck(comCun,comStreetDO);
+ comStreetDO.setAccount(comCun.getAccount());
+ comStreetDAO.insert(comStreetDO);
+ }
+ comActDO=new ComActDO();
+ comActDO.setStreetId(comStreetDO.getStreetId());
+ comActDO.setAreaCode(comStreetDO.getAreaCode().toString());
+ comActDO.setName(comCun.getCommunity());
+ comActDO.setContacts(comCun.getName());
+ comActDO.setContactsPhone(comCun.getPhone());
+ comActDAO.insert(comActDO);
+ }
+ ComAreaTownCommunity community=comAreaTownCommunityDao.selectOne(new QueryWrapper<ComAreaTownCommunity>().lambda().eq(ComAreaTownCommunity::getArea,comCun.getArea()).eq(ComAreaTownCommunity::getTown,comCun.getTown()).eq(ComAreaTownCommunity::getCommunity,comCun.getCommunity()));
+ if(community==null){
+ community=new ComAreaTownCommunity();
+ community.setArea(comCun.getArea());
+ community.setTown(comCun.getTown());
+ community.setCommunity(comCun.getCommunity());
+ comAreaTownCommunityDao.insert(community);
+ }else {
+ community.setCommunityId(comActDO.getCommunityId());
+ comAreaTownCommunityDao.updateById(community);
+ }
+ SysUser sysUser=sysUserDao.selectOne(new QueryWrapper<SysUser>().lambda().eq(SysUser::getAccount,comCun.getAccount()));
+ if(sysUser!=null){
+ System.out.println(comCun.getAccount()+","+comCun.getCommunity());
+ }
+ else {
+ sysUser=new SysUser();
+ sysUser.setAccount(comCun.getAccount());
+ sysUser.setPassword("$2a$10$F/2lE2NMhKNHJfi5.FLmfu7jIr7ImRWgCTTeO6m3IRNR2V4sv8YR.");
+ sysUser.setName(comCun.getCommunity());
+ sysUser.setType(9);
+ sysUserDao.insert(sysUser);
+ }
+ });
+ return null;
+ }
+
+ public static void areaCheck(ComCun area,ComStreetDO comStreetDO){
+ switch (area.getArea()){
+ case "西区": comStreetDO.setAreaCode(510423); break;
+ case "东区": comStreetDO.setAreaCode(510402); break;
+ case "仁和区": comStreetDO.setAreaCode(510411); break;
+ case "米易县": comStreetDO.setAreaCode(510421); break;
+ case "盐边县": comStreetDO.setAreaCode(510422); break;
+ }
+ }
+
+ /**
+ * 是否需要区分村落/社区
+ * */
+ private Integer isVilliage(String name){
+ if ("fangyipingtai".equals(name)){
+ return 3;
+ }else if ("pandashujuzhongxin".equals(name)){
+ return 1;
+ }else if ("pannongyenongcunju".equals(name)){
+ return 2;
+ }
+ return 3;
+ }
}
--
Gitblit v1.7.1