Browse Source

Merge remote-tracking branch 'origin_elink/yantai_zhengwu_master'

dev
yinzuomei 2 years ago
parent
commit
1cf4e43ee5
  1. 2
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceRecordV2Dao.xml
  2. 7
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/EnterpriseImportExcelDTO.java
  3. 15
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/handler/IcEnterpriseExcelImportListener.java
  4. 47
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcEnterpriseServiceImpl.java
  5. BIN
      epmet-module/gov-org/gov-org-server/src/main/resources/excel/enterprise_patrol_import_tem.xlsx
  6. 2
      epmet-module/gov-project/gov-project-server/src/main/resources/mapper/IcEventDao.xml
  7. 4
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcResiUserEntity.java
  8. 16
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiCollectServiceImpl.java

2
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceRecordV2Dao.xml

@ -40,7 +40,7 @@
<if test='serviceTimeEnd != null and serviceTimeEnd != ""'> <if test='serviceTimeEnd != null and serviceTimeEnd != ""'>
AND sr.SERVICE_TIME_END <![CDATA[ <= ]]> #{serviceTimeEnd} AND sr.SERVICE_TIME_END <![CDATA[ <= ]]> #{serviceTimeEnd}
</if> </if>
ORDER BY sr.CREATED_TIME DESC ORDER BY sr.SERVICE_TIME_START DESC,sr.SERVICE_TIME_END DESC
</select> </select>

7
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/EnterpriseImportExcelDTO.java

@ -5,7 +5,6 @@ import com.alibaba.excel.annotation.write.style.ColumnWidth;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/** /**
@ -59,9 +58,9 @@ public class EnterpriseImportExcelDTO {
* 4:100人以上 * 4:100人以上
* 改为手输数字了 * 改为手输数字了
*/ */
@NotNull(message = "规模不能为空") @NotBlank(message = "规模不能为空")
@ExcelProperty(value = "规模") @ExcelProperty(value = "规模")
private Integer scaleTotal; private String scaleTotal;
/** /**
* 场所负责人 * 场所负责人
@ -110,7 +109,7 @@ public class EnterpriseImportExcelDTO {
@ColumnWidth(20) @ColumnWidth(20)
@ExcelProperty(value = "规模") @ExcelProperty(value = "规模")
private Integer scaleTotal; private String scaleTotal;
@ColumnWidth(20) @ColumnWidth(20)
@ExcelProperty(value = "负责人") @ExcelProperty(value = "负责人")

15
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/handler/IcEnterpriseExcelImportListener.java

@ -5,6 +5,8 @@ import com.alibaba.excel.read.listener.ReadListener;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.exception.ExceptionUtils;
import com.epmet.commons.tools.exception.ValidateException; import com.epmet.commons.tools.exception.ValidateException;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
@ -67,11 +69,16 @@ public class IcEnterpriseExcelImportListener implements ReadListener<EnterpriseI
// log.warn("有数据吗?"+JSON.toJSONString(data)); // log.warn("有数据吗?"+JSON.toJSONString(data));
// 不能为空先校验数据 // 不能为空先校验数据
ValidatorUtils.validateEntity(data); ValidatorUtils.validateEntity(data);
try {
Integer.parseInt(data.getScaleTotal());
} catch (NumberFormatException e) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "", "规模请正确填写场所人数");
}
// 去除空格 // 去除空格
ObjectUtil.objectToTrim(data); ObjectUtil.objectToTrim(data);
// 根据网格名是否能找到网格id // 根据网格名是否能找到网格id
if (!gridMap.containsKey(data.getGridName())) { if (!gridMap.containsKey(data.getGridName())) {
throw new ValidateException(String.format("您所在的组织,不存在【%s】", data.getGridName())); throw new ValidateException(String.format("场所区域为网格名称,您所在的组织,不存在【%s】", data.getGridName()));
} }
if(!placeTypeMap.containsKey(data.getPlaceTypeName())){ if(!placeTypeMap.containsKey(data.getPlaceTypeName())){
throw new ValidateException(String.format("【%s】场所类型不存在",data.getPlaceTypeName())); throw new ValidateException(String.format("【%s】场所类型不存在",data.getPlaceTypeName()));
@ -92,7 +99,7 @@ public class IcEnterpriseExcelImportListener implements ReadListener<EnterpriseI
enterpriseEntity.setLatitude(StrConstant.EPMETY_STR); enterpriseEntity.setLatitude(StrConstant.EPMETY_STR);
//规模 //规模
// enterpriseEntity.setScale(scaleMap.get(data.getScaleName())); // enterpriseEntity.setScale(scaleMap.get(data.getScaleName()));
enterpriseEntity.setScaleTotal(data.getScaleTotal()); enterpriseEntity.setScaleTotal(Integer.valueOf(data.getScaleTotal()));
enterpriseEntity.setPlaceCategory("九小场所".equals(data.getPlaceCategoryName()) ? "0" : "1"); enterpriseEntity.setPlaceCategory("九小场所".equals(data.getPlaceCategoryName()) ? "0" : "1");
//网格id+场所名称 //网格id+场所名称
@ -118,7 +125,9 @@ public class IcEnterpriseExcelImportListener implements ReadListener<EnterpriseI
String errorMsg = null; String errorMsg = null;
if (e instanceof ValidateException) { if (e instanceof ValidateException) {
errorMsg = ((ValidateException) e).getMsg(); errorMsg = ((ValidateException) e).getMsg();
} else { }else if(e instanceof EpmetException){
errorMsg=((EpmetException) e).getMsg();
}else {
errorMsg = "未知错误"; errorMsg = "未知错误";
log.error("【企事业单位导入】出错:{}", ExceptionUtils.getErrorStackTrace(e)); log.error("【企事业单位导入】出错:{}", ExceptionUtils.getErrorStackTrace(e));
} }

47
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcEnterpriseServiceImpl.java

@ -3,6 +3,7 @@ package com.epmet.service.impl;
import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcel;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.aop.NoRepeatSubmit; import com.epmet.commons.tools.aop.NoRepeatSubmit;
@ -167,7 +168,16 @@ public class IcEnterpriseServiceImpl extends BaseServiceImpl<IcEnterpriseDao, Ic
enterprisePatrolRecordDao.insert(patrolRecordEntity); enterprisePatrolRecordDao.insert(patrolRecordEntity);
} else { } else {
patrolRecordEntity.setId(formDTO.getPatrolId()); patrolRecordEntity.setId(formDTO.getPatrolId());
enterprisePatrolRecordDao.updateById(patrolRecordEntity); LambdaUpdateWrapper<IcEnterprisePatrolRecordEntity> update=new LambdaUpdateWrapper<>();
update.eq(IcEnterprisePatrolRecordEntity::getId, formDTO.getPatrolId())
.set(IcEnterprisePatrolRecordEntity::getPatrolTime, formDTO.getPatrolTime())
.set(IcEnterprisePatrolRecordEntity::getStaffId, formDTO.getStaffId())
.set(IcEnterprisePatrolRecordEntity::getStaffName, formDTO.getStaffName())
.set(IcEnterprisePatrolRecordEntity::getMobile, formDTO.getMobile())
.set(IcEnterprisePatrolRecordEntity::getResult, formDTO.getResult())
.set(IcEnterprisePatrolRecordEntity::getDetailed, formDTO.getDetailed())
.set(IcEnterprisePatrolRecordEntity::getReviewTime, formDTO.getReviewTime());
enterprisePatrolRecordDao.update(null,update);
//删除之前的图片 //删除之前的图片
enterprisePatrolAttachmentDao.deleteByPatrolId(formDTO.getPatrolId(), formDTO.getUserId()); enterprisePatrolAttachmentDao.deleteByPatrolId(formDTO.getPatrolId(), formDTO.getUserId());
} }
@ -184,7 +194,19 @@ public class IcEnterpriseServiceImpl extends BaseServiceImpl<IcEnterpriseDao, Ic
sort++; sort++;
} }
// 更新主表的最新结果和最新检查时间 // 更新主表的最新结果和最新检查时间
baseDao.updateLatestPatrol(formDTO.getEnterpriseId(), patrolRecordEntity.getPatrolTime(), patrolRecordEntity.getResult(), formDTO.getUserId()); // 获取一下最新的巡检时间和巡检结果
LambdaQueryWrapper<IcEnterprisePatrolRecordEntity> queryWrapper = new LambdaQueryWrapper();
queryWrapper.eq(IcEnterprisePatrolRecordEntity::getEnterpriseId, formDTO.getEnterpriseId())
.orderByDesc(IcEnterprisePatrolRecordEntity::getPatrolTime)
.orderByDesc(IcEnterprisePatrolRecordEntity::getCreatedTime)
.last("limit 1");
IcEnterprisePatrolRecordEntity latestPatrol = enterprisePatrolRecordDao.selectOne(queryWrapper);
if (null != latestPatrol) {
// 更新主表的最新结果和最新检查时间
baseDao.updateLatestPatrol(formDTO.getEnterpriseId(), latestPatrol.getPatrolTime(), latestPatrol.getResult(), formDTO.getUserId());
}else{
baseDao.updateLatestPatrol(formDTO.getEnterpriseId(), null, StrConstant.EPMETY_STR, formDTO.getUserId());
}
return patrolRecordEntity.getId(); return patrolRecordEntity.getId();
} }
@ -200,14 +222,27 @@ public class IcEnterpriseServiceImpl extends BaseServiceImpl<IcEnterpriseDao, Ic
if (null == origin) { if (null == origin) {
return; return;
} }
Date nowTime=new Date();
//1、删除巡查记录 //1、删除巡查记录
enterprisePatrolRecordDao.deleteById(patrolId); LambdaUpdateWrapper<IcEnterprisePatrolRecordEntity> patrolUpdate = new LambdaUpdateWrapper<>();
patrolUpdate.eq(IcEnterprisePatrolRecordEntity::getId, patrolId)
.set(IcEnterprisePatrolRecordEntity::getUpdatedBy, currentUserId)
.set(IcEnterprisePatrolRecordEntity::getUpdatedTime, nowTime)
.set(IcEnterprisePatrolRecordEntity::getDelFlag, NumConstant.ONE_STR);
enterprisePatrolRecordDao.update(null, patrolUpdate);
//2、删除之前的图片 //2、删除之前的图片
enterprisePatrolAttachmentDao.deleteByPatrolId(patrolId, currentUserId); enterprisePatrolAttachmentDao.deleteByPatrolId(patrolId, currentUserId);
//3、如果是记录清空,那主表的最近一次巡查时间和最新结果也置空 // 3、如果是记录清空,那主表的最近一次巡查时间和最新结果也置空
LambdaQueryWrapper<IcEnterprisePatrolRecordEntity> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<IcEnterprisePatrolRecordEntity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(IcEnterprisePatrolRecordEntity::getEnterpriseId, origin.getEnterpriseId()); queryWrapper.eq(IcEnterprisePatrolRecordEntity::getEnterpriseId, origin.getEnterpriseId())
if (NumConstant.ZERO == enterprisePatrolRecordDao.selectCount(queryWrapper)) { .orderByDesc(IcEnterprisePatrolRecordEntity::getPatrolTime)
.orderByDesc(IcEnterprisePatrolRecordEntity::getCreatedTime)
.last("limit 1");
IcEnterprisePatrolRecordEntity latestPatrol = enterprisePatrolRecordDao.selectOne(queryWrapper);
if (null != latestPatrol) {
// 更新主表的最新结果和最新检查时间
baseDao.updateLatestPatrol(origin.getEnterpriseId(), latestPatrol.getPatrolTime(), latestPatrol.getResult(), currentUserId);
} else {
baseDao.updateLatestPatrol(origin.getEnterpriseId(), null, StrConstant.EPMETY_STR, currentUserId); baseDao.updateLatestPatrol(origin.getEnterpriseId(), null, StrConstant.EPMETY_STR, currentUserId);
} }
} }

BIN
epmet-module/gov-org/gov-org-server/src/main/resources/excel/enterprise_patrol_import_tem.xlsx

Binary file not shown.

2
epmet-module/gov-project/gov-project-server/src/main/resources/mapper/IcEventDao.xml

@ -247,7 +247,7 @@
#{secondId} #{secondId}
</foreach> </foreach>
</if> </if>
order by ie.created_time desc, ie.latest_operated_time desc order by ie.happen_time desc, ie.latest_operated_time desc
</select> </select>
<select id="listEventsByPCategoryInOrg" resultType="com.epmet.dto.result.IcEventResultDTO"> <select id="listEventsByPCategoryInOrg" resultType="com.epmet.dto.result.IcEventResultDTO">

4
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcResiUserEntity.java

@ -42,12 +42,12 @@ public class IcResiUserEntity extends BaseEpmetEntity {
private String customerId; private String customerId;
/** /**
* * 组织Id
*/ */
private String agencyId; private String agencyId;
/** /**
* * 组织的pids 含agencyId本身
*/ */
private String pids; private String pids;

16
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiCollectServiceImpl.java

@ -15,6 +15,7 @@ import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache; import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.PidUtils;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.IcResiCollectDao; import com.epmet.dao.IcResiCollectDao;
import com.epmet.dao.IcResiMemberDao; import com.epmet.dao.IcResiMemberDao;
@ -491,8 +492,12 @@ public class IcResiCollectServiceImpl extends BaseServiceImpl<IcResiCollectDao,
throw new EpmetException(EpmetErrorCode.ORG_ADD_FAILED.getCode(), errorMsg, errorMsg); throw new EpmetException(EpmetErrorCode.ORG_ADD_FAILED.getCode(), errorMsg, errorMsg);
} }
} }
AgencyInfoCache agencyInfoCache = CustomerOrgRedis.getAgencyInfo(icResiCollectEntity.getAgencyId());
userEntity.setPids(icResiCollectEntity.getPids() + ":" + icResiCollectEntity.getAgencyId()); // ic_resi_user表的组织的pids 含agencyId本身 if (null == agencyInfoCache) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "所属组织查询异常,agencyId:" + icResiCollectEntity.getAgencyId(), "所属组织查询异常");
}
// userEntity.setPids(icResiCollectEntity.getPids() + ":" + icResiCollectEntity.getAgencyId()); // ic_resi_user表的组织的pids 含agencyId本身
userEntity.setPids(PidUtils.convertPid2OrgIdPath(icResiCollectEntity.getAgencyId(), agencyInfoCache.getPids()));
userEntity.setAgencyId(icResiCollectEntity.getAgencyId()); userEntity.setAgencyId(icResiCollectEntity.getAgencyId());
userEntity.setGridId(icResiCollectEntity.getGridId()); userEntity.setGridId(icResiCollectEntity.getGridId());
userEntity.setVillageId(icResiCollectEntity.getVillageId()); userEntity.setVillageId(icResiCollectEntity.getVillageId());
@ -547,7 +552,12 @@ public class IcResiCollectServiceImpl extends BaseServiceImpl<IcResiCollectDao,
// 新增人员 // 新增人员
IcResiUserEntity userEntity = new IcResiUserEntity(); IcResiUserEntity userEntity = new IcResiUserEntity();
userEntity.setPids(icResiCollectEntity.getPids() + ":" + icResiCollectEntity.getAgencyId()); // ic_resi_user表的组织的pids 含agencyId本身 AgencyInfoCache agencyInfoCache = CustomerOrgRedis.getAgencyInfo(icResiCollectEntity.getAgencyId());
if (null == agencyInfoCache) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "所属组织查询异常,agencyId:" + icResiCollectEntity.getAgencyId(), "所属组织查询异常");
}
// userEntity.setPids(icResiCollectEntity.getPids() + ":" + icResiCollectEntity.getAgencyId()); // ic_resi_user表的组织的pids 含agencyId本身 !!!
userEntity.setPids(PidUtils.convertPid2OrgIdPath(icResiCollectEntity.getAgencyId(), agencyInfoCache.getPids()));
userEntity.setAgencyId(icResiCollectEntity.getAgencyId()); userEntity.setAgencyId(icResiCollectEntity.getAgencyId());
userEntity.setGridId(icResiCollectEntity.getGridId()); userEntity.setGridId(icResiCollectEntity.getGridId());
userEntity.setVillageId(icResiCollectEntity.getVillageId()); userEntity.setVillageId(icResiCollectEntity.getVillageId());

Loading…
Cancel
Save