Browse Source

Merge branch 'dev_import' of http://git.elinkit.com.cn:7070/r/epmet-cloud into release_temp

dev
wangxianzhang 4 years ago
parent
commit
0b64a18648
  1. 7
      epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/constants/ImportTaskConstants.java
  2. 47
      epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/ImportTaskCommonFormDTO.java
  3. 14
      epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/result/ImportTaskCommonResultDTO.java
  4. 18
      epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/EpmetCommonServiceOpenFeignClient.java
  5. 10
      epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/fallback/EpmetCommonServiceOpenFeignClientFallback.java
  6. 57
      epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/ImportTaskController.java
  7. 0
      epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/dao/ImportTaskDao.java
  8. 47
      epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/entity/ImportTaskEntity.java
  9. 14
      epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ImportTaskService.java
  10. 33
      epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ImportTaskServiceImpl.java
  11. 0
      epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/ImportTaskDao.xml
  12. 85
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcActivityServiceRelationDTO.java
  13. 89
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcActivityUnitRelationDTO.java
  14. 31
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPartyActivityDTO.java
  15. 79
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/LatestActServiceRelationDTO.java
  16. 84
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/LatestActUnitRelationDTO.java
  17. 25
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcActivityServiceRelationDao.java
  18. 25
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcActivityUnitRelationDao.java
  19. 15
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcPartyActivityDao.java
  20. 25
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/LatestActServiceRelationDao.java
  21. 25
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/LatestActUnitRelationDao.java
  22. 56
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcActivityServiceRelationEntity.java
  23. 56
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcActivityUnitRelationEntity.java
  24. 51
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/LatestActServiceRelationEntity.java
  25. 51
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/LatestActUnitRelationEntity.java
  26. 34
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcActivityServiceRelationService.java
  27. 34
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcActivityUnitRelationService.java
  28. 14
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/LatestActServiceRelationService.java
  29. 14
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/LatestActUnitRelationService.java
  30. 61
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcActivityServiceRelationServiceImpl.java
  31. 60
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcActivityUnitRelationServiceImpl.java
  32. 199
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java
  33. 33
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LatestActServiceRelationServiceImpl.java
  34. 19
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LatestActUnitRelationServiceImpl.java
  35. 26
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcActivityServiceRelationDao.xml
  36. 26
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcActivityUnitRelationDao.xml
  37. 128
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPartyActivityDao.xml
  38. 24
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActServiceRelationDao.xml
  39. 24
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActUnitRelationDao.xml
  40. 5
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerGridDTO.java
  41. 18
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyFormDTO.java
  42. 19
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyV2FormDTO.java
  43. 18
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddGridFormDTO.java
  44. 19
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditAgencyFormDTO.java
  45. 18
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditGridFormDTO.java
  46. 15
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencysResultDTO.java
  47. 5
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridDetailResultDTO.java
  48. 12
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/ImportErrorMsgConstants.java
  49. 5
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerAgencyEntity.java
  50. 5
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerGridEntity.java
  51. 23
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/BuildingErrorInfoModel.java
  52. 30
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/HouseErrorInfoModel.java
  53. 19
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportBuildingInfoListener.java
  54. 27
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportHouseInfoListener.java
  55. 17
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportNeighborHoodInfoListener.java
  56. 20
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/NeighborHoodErrorInfoModel.java
  57. 8
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
  58. 12
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java
  59. 2
      epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.12__addagency_grid_address.sql
  60. 10
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml
  61. 5
      epmet-user/epmet-user-server/pom.xml
  62. 24
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java
  63. 18
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserImportService.java
  64. 96
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java

7
epmet-user/epmet-user-client/src/main/java/com/epmet/constant/ImportTaskConstants.java → epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/constants/ImportTaskConstants.java

@ -1,13 +1,16 @@
package com.epmet.constant;
package com.epmet.constants;
/**
* 导入任务的业务类型常量
*/
public interface ImportTaskConstants {
/**
* 居民
* 业务类型居民
*/
String BIZ_TYPE_RESI = "resi";
String BIZ_TYPE_NEIGHBOR_HOOD = "neighborHood";
String BIZ_TYPE_BUILDING = "building";
String BIZ_TYPE_HOUSE = "house";
/**
* 处理状态处理中

47
epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/ImportTaskCommonFormDTO.java

@ -0,0 +1,47 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
@Data
public class ImportTaskCommonFormDTO {
public interface Create {}
public interface Finish {}
/**
* 操作者ID
*/
@NotBlank(message = "操作者ID必填", groups = { Create.class, Finish.class })
private String operatorId;
/**
* 业务类型
*/
@NotBlank(message = "业务类型必填", groups = { Create.class })
private String bizType;
/**
* 任务ID
*/
@NotBlank(message = "任务ID必填", groups = { Finish.class })
private String taskId;
/**
* 处理状态
*/
@NotBlank(message = "处理状态必填", groups = { Finish.class })
private String processStatus;
/**
* 结果文件 url
*/
private String resultDescFilePath;
/**
* 结果描述文本
*/
private String resultDesc;
}

14
epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/result/ImportTaskCommonResultDTO.java

@ -0,0 +1,14 @@
package com.epmet.dto.result;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ImportTaskCommonResultDTO {
private String taskId;
}

18
epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/EpmetCommonServiceOpenFeignClient.java

@ -4,12 +4,12 @@ import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.feign.fallback.EpmetCommonServiceOpenFeignClientFallback;
import com.epmet.feign.fallback.EpmetCommonServiceOpenFeignClientFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.List;
import java.util.Map;
@ -124,4 +124,20 @@ public interface EpmetCommonServiceOpenFeignClient {
**/
@PostMapping(value = "commonservice/areacode/addareacode", consumes = MediaType.APPLICATION_JSON_VALUE)
Result<String> addAreaCode(AddAreaCodeFormDTO formDTO);
/**
* 创建导入任务
* @param input
* @return
*/
@RequestMapping("/commonservice/import-task/create")
Result<ImportTaskCommonResultDTO> createImportTask(@RequestBody ImportTaskCommonFormDTO input);
/**
* 结束导入任务
* @param input
* @return
*/
@RequestMapping("/commonservice/import-task/finish")
Result finishImportTask(@RequestBody ImportTaskCommonFormDTO input);
}

10
epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/fallback/EpmetCommonServiceOpenFeignClientFallback.java

@ -111,4 +111,14 @@ public class EpmetCommonServiceOpenFeignClientFallback implements EpmetCommonSer
public Result<String> addAreaCode(AddAreaCodeFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_COMMON_SERVICE, "addAreaCode", formDTO);
}
@Override
public Result createImportTask(ImportTaskCommonFormDTO input) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_COMMON_SERVICE, "createImportTask", input);
}
@Override
public Result finishImportTask(ImportTaskCommonFormDTO input) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_COMMON_SERVICE, "finishImportTask", input);
}
}

57
epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/ImportTaskController.java

@ -0,0 +1,57 @@
package com.epmet.controller;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.ImportTaskCommonFormDTO;
import com.epmet.dto.result.ImportTaskCommonResultDTO;
import com.epmet.service.ImportTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
@RestController
@RequestMapping("import-task")
public class ImportTaskController {
@Autowired
private ImportTaskService importTaskService;
/**
* 创建导入任务
* @param input
* @return
*/
@RequestMapping("create")
public Result<ImportTaskCommonResultDTO> createTask(@RequestBody ImportTaskCommonFormDTO input) {
ValidatorUtils.validateEntity(input, ImportTaskCommonFormDTO.Create.class);
String operatorId = input.getOperatorId();
String bizType = input.getBizType();
String taskId = importTaskService.createProcessTask(operatorId, bizType);
ImportTaskCommonResultDTO ro = new ImportTaskCommonResultDTO(taskId);
return new Result().ok(ro);
}
/**
* 结束任务
* @param input
* @return
*/
@RequestMapping("finish")
public Result finishTask(@RequestBody ImportTaskCommonFormDTO input) {
ValidatorUtils.validateEntity(input, ImportTaskCommonFormDTO.Finish.class);
Boolean finished = importTaskService.finish(input.getTaskId(), input.getProcessStatus(), input.getOperatorId(), input.getResultDescFilePath(), input.getResultDesc());
if (!finished) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),
"失败,请确认任务是否存在,以及是否已完成",
"失败,请确认任务是否存在,以及是否已完成");
}
return new Result();
}
}

0
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/ImportTaskDao.java → epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/dao/ImportTaskDao.java

47
epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/entity/ImportTaskEntity.java

@ -0,0 +1,47 @@
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
*
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-02-15
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("import_task")
public class ImportTaskEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 业务类型resi:居民楼栋:building房屋:house依次补充
*/
private String bizType;
/**
* 处理状态processing:处理中finished:完成
*/
private String processStatus;
/**
* 谁导入的
*/
private String operatorId;
/**
* 开始导入的时间
*/
private Date startTime;
private String resultDescFile;
private String resultDesc;
}

14
epmet-user/epmet-user-server/src/main/java/com/epmet/service/ImportTaskService.java → epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ImportTaskService.java

@ -9,13 +9,13 @@ package com.epmet.service;
*/
public interface ImportTaskService {
/**
* 检查指定类型该用户是否存在处理中的导入任务
* @param operatorId 操作者ID
* @param bizType 业务类型resi居民
* @return
*/
boolean existsProcessingTask(String operatorId, String bizType);
// /**
// * 检查指定类型该用户是否存在处理中的导入任务
// * @param operatorId 操作者ID
// * @param bizType 业务类型。resi:居民
// * @return
// */
// boolean existsProcessingTask(String operatorId, String bizType);
/**
* 创建处理任务

33
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/ImportTaskServiceImpl.java → epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ImportTaskServiceImpl.java

@ -1,7 +1,9 @@
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.epmet.constant.ImportTaskConstants;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.constants.ImportTaskConstants;
import com.epmet.dao.ImportTaskDao;
import com.epmet.entity.ImportTaskEntity;
import com.epmet.service.ImportTaskService;
@ -22,13 +24,28 @@ public class ImportTaskServiceImpl implements ImportTaskService {
@Autowired
private ImportTaskDao importRecordDao;
// /**
// * 该用户,该业务类型,是否有正在处理的导入任务
// * @param operatorId 操作者ID
// * @param bizType 业务类型。resi:居民
// * @return
// */
// @Override
// public boolean existsProcessingTask(String operatorId, String bizType) {
// LambdaQueryWrapper<ImportTaskEntity> query = new LambdaQueryWrapper<>();
// query.eq(ImportTaskEntity::getOperatorId, operatorId);
// query.eq(ImportTaskEntity::getBizType, bizType);
// query.eq(ImportTaskEntity::getProcessStatus, ImportTaskConstants.PROCESS_STATUS_PROCESSING);
//
// return importRecordDao.selectCount(query) > 0;
// }
/**
* 该用户该业务类型是否有正在处理的导入任务
* @param operatorId 操作者ID
* @param bizType 业务类型resi居民
* 检查是否有正在执行的任务
* @param operatorId
* @param bizType
* @return
*/
@Override
public boolean existsProcessingTask(String operatorId, String bizType) {
LambdaQueryWrapper<ImportTaskEntity> query = new LambdaQueryWrapper<>();
query.eq(ImportTaskEntity::getOperatorId, operatorId);
@ -40,6 +57,12 @@ public class ImportTaskServiceImpl implements ImportTaskService {
@Override
public String createProcessTask(String operatorId, String bizType) {
if (existsProcessingTask(operatorId, bizType)) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),
"已存在执行中的导入任务,请等待执行完成。",
"已存在执行中的导入任务,请等待执行完成。");
}
ImportTaskEntity importRecord = new ImportTaskEntity();
importRecord.setProcessStatus(ImportTaskConstants.PROCESS_STATUS_PROCESSING);
importRecord.setOperatorId(operatorId);

0
epmet-user/epmet-user-server/src/main/resources/mapper/ImportTaskDao.xml → epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/ImportTaskDao.xml

85
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcActivityServiceRelationDTO.java

@ -0,0 +1,85 @@
package com.epmet.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 联建活动与服务事项关联表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-02-21
*/
@Data
public class IcActivityServiceRelationDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 客户id
*/
private String customerId;
/**
* 组织ID
*/
private String agencyId;
/**
* 组织的所有上级
*/
private String pids;
/**
* 活动ID
*/
private String activityId;
/**
* act_info表ID
*/
private String actId;
/**
* 服务事项
*/
private String serviceMatter;
/**
* 删除标识 0未删除1已删除
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

89
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcActivityUnitRelationDTO.java

@ -0,0 +1,89 @@
package com.epmet.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 联建活动与单位关联表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-02-21
*/
@Data
public class IcActivityUnitRelationDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 客户id
*/
private String customerId;
/**
* 组织ID
*/
private String agencyId;
/**
* 组织的所有上级
*/
private String pids;
/**
* 活动ID
*/
private String activityId;
/**
* act_info表ID
*/
private String actId;
/**
* 单位ID
*/
private String unitId;
/**
* 服务事项
*/
private String serviceMatter;
/**
* 删除标识 0未删除1已删除
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

31
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPartyActivityDTO.java

@ -19,12 +19,15 @@ package com.epmet.dto;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
@ -46,35 +49,45 @@ public class IcPartyActivityDTO implements Serializable {
/**
* 客户id
*/
@JsonIgnore
private String customerId;
/**
* 组织ID
*/
@JsonIgnore
@NotEmpty(message = "组织ID不能为空",groups = AddGroup.class)
private String agencyId;
/**
* 组织的所有上级
*/
@JsonIgnore
private String pids;
/**
* act_info表ID
*/
@JsonIgnore
private String actId;
private String unitId;
private String unitName;
/**
* 单位ID
*/
@NotBlank(message = "单位不能为空",groups = AddGroup.class)
private String unitId;
private String unitName;
@NotEmpty(message = "单位不能为空",groups = AddGroup.class)
private List<String> unitIdList;
private List<String> unitNameList;
private String serviceMatter;
private String serviceMatterName;
/**
* 服务事项
*/
@NotBlank(message = "服务事项不能为空",groups = AddGroup.class)
private String serviceMatter;
private String serviceMatterName;
@NotEmpty(message = "服务事项不能为空",groups = AddGroup.class)
private List<String> serviceMatterList;
private List<String> serviceMatterNameList;
/**
* 活动标题
*/
@ -131,31 +144,37 @@ public class IcPartyActivityDTO implements Serializable {
/**
* 删除标识 0未删除1已删除
*/
@JsonIgnore
private String delFlag;
/**
* 乐观锁
*/
@JsonIgnore
private Integer revision;
/**
* 创建人
*/
@JsonIgnore
private String createdBy;
/**
* 创建时间
*/
@JsonIgnore
private Date createdTime;
/**
* 更新人
*/
@JsonIgnore
private String updatedBy;
/**
* 更新时间
*/
@JsonIgnore
private Date updatedTime;
}

79
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/LatestActServiceRelationDTO.java

@ -0,0 +1,79 @@
package com.epmet.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 联建活动与服务事项关联表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-02-21
*/
@Data
public class LatestActServiceRelationDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 客户id
*/
private String customerId;
/**
* 组织ID
*/
private String agencyId;
/**
* 组织的所有上级
*/
private String pids;
/**
* latest_act_info表ID
*/
private String actId;
/**
* 服务事项
*/
private String serviceMatter;
/**
* 删除标识 0未删除1已删除
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

84
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/LatestActUnitRelationDTO.java

@ -0,0 +1,84 @@
package com.epmet.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 联建活动与单位关联表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-02-21
*/
@Data
public class LatestActUnitRelationDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 客户id
*/
private String customerId;
/**
* 组织ID
*/
private String agencyId;
/**
* 组织的所有上级
*/
private String pids;
/**
* latest_act_info表ID
*/
private String actId;
/**
* 单位ID
*/
private String unitId;
/**
* 服务事项
*/
private String serviceMatter;
/**
* 删除标识 0未删除1已删除
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

25
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcActivityServiceRelationDao.java

@ -0,0 +1,25 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.IcActivityServiceRelationEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 联建活动与服务事项关联表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-02-21
*/
@Mapper
public interface IcActivityServiceRelationDao extends BaseDao<IcActivityServiceRelationEntity> {
/**
* 删除活动所属服务
*
* @Param activityId
* @Return
* @Author zhaoqifeng
* @Date 2022/2/21 16:19
*/
void deleteByActivity(@Param("activityId") String activityId);
}

25
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcActivityUnitRelationDao.java

@ -0,0 +1,25 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.IcActivityUnitRelationEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 联建活动与单位关联表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-02-21
*/
@Mapper
public interface IcActivityUnitRelationDao extends BaseDao<IcActivityUnitRelationEntity> {
/**
* 删除活动所属单位
*
* @Param activityId
* @Return
* @Author zhaoqifeng
* @Date 2022/2/21 16:19
*/
void deleteByActivity(@Param("activityId") String activityId);
}

15
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcPartyActivityDao.java

@ -23,6 +23,8 @@ import com.epmet.dto.result.ActivityStatisticsDTO;
import com.epmet.entity.IcPartyActivityEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 联建活动
*
@ -40,5 +42,16 @@ public interface IcPartyActivityDao extends BaseDao<IcPartyActivityEntity> {
* @Date 2021/12/9 16:06
*/
ActivityStatisticsDTO getStatistics(PartyActivityFormDTO formDTO);
/**
* 活动列表查询
* @Param formDTO
* @Return {@link java.util.List<com.epmet.entity.IcPartyActivityEntity>}
* @Author zhaoqifeng
* @Date 2022/2/21 14:50
*/
List<IcPartyActivityEntity> selectActivityList(PartyActivityFormDTO formDTO);
List<IcPartyActivityEntity> getActivityList(PartyActivityFormDTO formDTO);
}

25
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/LatestActServiceRelationDao.java

@ -0,0 +1,25 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.LatestActServiceRelationEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 联建活动与服务事项关联表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-02-21
*/
@Mapper
public interface LatestActServiceRelationDao extends BaseDao<LatestActServiceRelationEntity> {
/**
* 删除活动所属服务
*
* @Param activityId
* @Return
* @Author zhaoqifeng
* @Date 2022/2/21 16:19
*/
void deleteByActivity(@Param("activityId") String activityId);
}

25
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/LatestActUnitRelationDao.java

@ -0,0 +1,25 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.LatestActUnitRelationEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 联建活动与单位关联表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-02-21
*/
@Mapper
public interface LatestActUnitRelationDao extends BaseDao<LatestActUnitRelationEntity> {
/**
* 删除活动所属服务
*
* @Param activityId
* @Return
* @Author zhaoqifeng
* @Date 2022/2/21 16:19
*/
void deleteByActivity(@Param("activityId") String activityId);
}

56
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcActivityServiceRelationEntity.java

@ -0,0 +1,56 @@
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 联建活动与服务事项关联表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-02-21
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("ic_activity_service_relation")
public class IcActivityServiceRelationEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户id
*/
private String customerId;
/**
* 组织ID
*/
private String agencyId;
/**
* 组织的所有上级
*/
private String pids;
/**
* 活动ID
*/
private String activityId;
/**
* act_info表ID
*/
private String actId;
/**
* 服务事项
*/
private String serviceMatter;
/**
* 排序
*/
private Integer sort;
}

56
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcActivityUnitRelationEntity.java

@ -0,0 +1,56 @@
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 联建活动与单位关联表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-02-21
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("ic_activity_unit_relation")
public class IcActivityUnitRelationEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户id
*/
private String customerId;
/**
* 组织ID
*/
private String agencyId;
/**
* 组织的所有上级
*/
private String pids;
/**
* 活动ID
*/
private String activityId;
/**
* act_info表ID
*/
private String actId;
/**
* 单位ID
*/
private String unitId;
/**
* 排序
*/
private Integer sort;
}

51
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/LatestActServiceRelationEntity.java

@ -0,0 +1,51 @@
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 联建活动与服务事项关联表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-02-21
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("latest_act_service_relation")
public class LatestActServiceRelationEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户id
*/
private String customerId;
/**
* 组织ID
*/
private String agencyId;
/**
* 组织的所有上级
*/
private String pids;
/**
* latest_act_info表ID
*/
private String actId;
/**
* 服务事项
*/
private String serviceMatter;
/**
* 排序
*/
private Integer sort;
}

51
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/LatestActUnitRelationEntity.java

@ -0,0 +1,51 @@
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 联建活动与单位关联表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-02-21
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("latest_act_unit_relation")
public class LatestActUnitRelationEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户id
*/
private String customerId;
/**
* 组织ID
*/
private String agencyId;
/**
* 组织的所有上级
*/
private String pids;
/**
* latest_act_info表ID
*/
private String actId;
/**
* 单位ID
*/
private String unitId;
/**
* 排序
*/
private Integer sort;
}

34
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcActivityServiceRelationService.java

@ -0,0 +1,34 @@
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.entity.IcActivityServiceRelationEntity;
import java.util.List;
/**
* 联建活动与服务事项关联表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-02-21
*/
public interface IcActivityServiceRelationService extends BaseService<IcActivityServiceRelationEntity> {
/**
* 获取活动所属服务事项
*
* @Param activityId 活动ID
* @Return {@link List <String>}
* @Author zhaoqifeng
* @Date 2022/2/21 14:36
*/
List<String> getServiceList(String activityId);
/**
* 删除活动所属服务事项
*
* @Param activityId
* @Return
* @Author zhaoqifeng
* @Date 2022/2/21 16:10
*/
void deleteByActivity(String activityId);
}

34
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcActivityUnitRelationService.java

@ -0,0 +1,34 @@
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.entity.IcActivityUnitRelationEntity;
import java.util.List;
/**
* 联建活动与单位关联表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-02-21
*/
public interface IcActivityUnitRelationService extends BaseService<IcActivityUnitRelationEntity> {
/**
* 获取活动所属党建单位
*
* @Param activityId 活动ID
* @Return {@link List<String>}
* @Author zhaoqifeng
* @Date 2022/2/21 14:36
*/
List<String> getUnitList(String activityId);
/**
* 删除活动所属单位
*
* @Param activityId
* @Return
* @Author zhaoqifeng
* @Date 2022/2/21 16:10
*/
void deleteByActivity(String activityId);
}

14
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/LatestActServiceRelationService.java

@ -0,0 +1,14 @@
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.entity.LatestActServiceRelationEntity;
/**
* 联建活动与服务事项关联表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-02-21
*/
public interface LatestActServiceRelationService extends BaseService<LatestActServiceRelationEntity> {
}

14
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/LatestActUnitRelationService.java

@ -0,0 +1,14 @@
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.entity.LatestActUnitRelationEntity;
/**
* 联建活动与单位关联表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-02-21
*/
public interface LatestActUnitRelationService extends BaseService<LatestActUnitRelationEntity> {
}

61
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcActivityServiceRelationServiceImpl.java

@ -0,0 +1,61 @@
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.dao.IcActivityServiceRelationDao;
import com.epmet.entity.IcActivityServiceRelationEntity;
import com.epmet.service.IcActivityServiceRelationService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
/**
* 联建活动与服务事项关联表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-02-21
*/
@Service
public class IcActivityServiceRelationServiceImpl extends BaseServiceImpl<IcActivityServiceRelationDao, IcActivityServiceRelationEntity> implements IcActivityServiceRelationService {
/**
* 获取活动所属服务事项
*
* @param activityId
* @Param activityId 活动ID
* @Return {@link List <String>}
* @Author zhaoqifeng
* @Date 2022/2/21 14:36
*/
@Override
public List<String> getServiceList(String activityId) {
LambdaQueryWrapper<IcActivityServiceRelationEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IcActivityServiceRelationEntity::getActivityId, activityId);
wrapper.orderByAsc(IcActivityServiceRelationEntity::getSort);
List<IcActivityServiceRelationEntity> list = baseDao.selectList(wrapper);
if (CollectionUtils.isEmpty(list)) {
return Collections.emptyList();
}
return list.stream().map(IcActivityServiceRelationEntity::getServiceMatter).collect(Collectors.toList());
}
/**
* 删除活动所属服务事项
*
* @param activityId
* @Param activityId
* @Return
* @Author zhaoqifeng
* @Date 2022/2/21 16:10
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteByActivity(String activityId) {
baseDao.deleteByActivity(activityId);
}
}

60
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcActivityUnitRelationServiceImpl.java

@ -0,0 +1,60 @@
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.dao.IcActivityUnitRelationDao;
import com.epmet.entity.IcActivityUnitRelationEntity;
import com.epmet.service.IcActivityUnitRelationService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
/**
* 联建活动与单位关联表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-02-21
*/
@Service
public class IcActivityUnitRelationServiceImpl extends BaseServiceImpl<IcActivityUnitRelationDao, IcActivityUnitRelationEntity> implements IcActivityUnitRelationService {
/**
* 获取活动所属党建单位
*
* @param activityId
* @Param activityId 活动ID
* @Return {@link List <String>}
* @Author zhaoqifeng
* @Date 2022/2/21 14:36
*/
@Override
public List<String> getUnitList(String activityId) {
LambdaQueryWrapper<IcActivityUnitRelationEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IcActivityUnitRelationEntity::getActivityId, activityId);
wrapper.orderByAsc(IcActivityUnitRelationEntity::getSort);
List<IcActivityUnitRelationEntity> list = baseDao.selectList(wrapper);
if (CollectionUtils.isEmpty(list)) {
return Collections.emptyList();
}
return list.stream().map(IcActivityUnitRelationEntity::getUnitId).collect(Collectors.toList());
}
/**
* 删除活动所属单位
*
* @param activityId
* @Param activityId
* @Return
* @Author zhaoqifeng
* @Date 2022/2/21 16:10
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteByActivity(String activityId) {
baseDao.deleteByActivity(activityId);
}
}

199
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java

@ -19,10 +19,9 @@ package com.epmet.service.impl;
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.page.PageData;
@ -38,11 +37,11 @@ import com.epmet.dto.IcPartyUnitDTO;
import com.epmet.dto.form.PartyActivityFormDTO;
import com.epmet.dto.result.ActivityStatisticsDTO;
import com.epmet.dto.result.demand.OptionDTO;
import com.epmet.entity.IcActivityServiceRelationEntity;
import com.epmet.entity.IcActivityUnitRelationEntity;
import com.epmet.entity.IcPartyActivityEntity;
import com.epmet.excel.IcPartyActivityImportExcel;
import com.epmet.service.IcPartyActivityService;
import com.epmet.service.IcPartyUnitService;
import com.epmet.service.IcServiceItemDictService;
import com.epmet.service.*;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
@ -56,6 +55,7 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
/**
@ -72,6 +72,11 @@ public class IcPartyActivityServiceImpl extends BaseServiceImpl<IcPartyActivityD
private IcPartyUnitService icPartyUnitService;
@Resource
private IcServiceItemDictService icServiceItemDictService;
@Resource
private IcActivityUnitRelationService icActivityUnitRelationService;
@Resource
private IcActivityServiceRelationService icActivityServiceRelationService;
@Override
@ -85,23 +90,20 @@ public class IcPartyActivityServiceImpl extends BaseServiceImpl<IcPartyActivityD
formDTO.setEndTime(endDate);
}
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize());
LambdaQueryWrapper<IcPartyActivityEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IcPartyActivityEntity::getAgencyId, formDTO.getAgencyId());
wrapper.eq(StringUtils.isNotBlank(formDTO.getUnitId()), IcPartyActivityEntity::getUnitId, formDTO.getUnitId());
wrapper.eq(StringUtils.isNotBlank(formDTO.getServiceMatter()), IcPartyActivityEntity::getServiceMatter, formDTO.getServiceMatter());
wrapper.like(StringUtils.isNotBlank(formDTO.getTitle()), IcPartyActivityEntity::getTitle, formDTO.getTitle());
wrapper.between(IcPartyActivityEntity::getActivityTime, formDTO.getStartTime(), formDTO.getEndTime());
wrapper.orderByDesc(IcPartyActivityEntity::getUpdatedTime);
List<IcPartyActivityEntity> list = baseDao.selectList(wrapper);
List<IcPartyActivityEntity> list = baseDao.selectActivityList(formDTO);
PageInfo<IcPartyActivityEntity> pageInfo = new PageInfo<>(list);
List<IcPartyActivityDTO> dtoList = ConvertUtils.sourceToTarget(list, IcPartyActivityDTO.class);
IcPartyUnitDTO unitDTO = new IcPartyUnitDTO();
unitDTO.setAgencyId(formDTO.getAgencyId());
if (CollectionUtils.isNotEmpty(dtoList)) {
//获取组织下联建单位
IcPartyUnitDTO unitDTO = new IcPartyUnitDTO();
unitDTO.setAgencyId(formDTO.getAgencyId());
Map<String, String> option = icPartyUnitService.option(unitDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel));
dtoList.forEach(dto -> {
dto.setUnitName(option.get(dto.getUnitId()));
//联建单位ID与单位名匹配
List<String> unitIds = Arrays.asList(dto.getUnitId().split(StrConstant.COMMA));
List<String> unitNames = unitIds.stream().map(option::get).collect(Collectors.toList());
dto.setUnitName(StringUtils.join(unitNames, StrConstant.COMMA));
});
}
@ -118,54 +120,49 @@ public class IcPartyActivityServiceImpl extends BaseServiceImpl<IcPartyActivityD
Date endDate = DateUtils.parse("2099-12-31 00:00:00", DateUtils.DATE_TIME_PATTERN);
formDTO.setEndTime(endDate);
}
LambdaQueryWrapper<IcPartyActivityEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IcPartyActivityEntity::getAgencyId, formDTO.getAgencyId());
wrapper.eq(StringUtils.isNotBlank(formDTO.getUnitId()), IcPartyActivityEntity::getUnitId, formDTO.getUnitId());
wrapper.eq(StringUtils.isNotBlank(formDTO.getServiceMatter()), IcPartyActivityEntity::getServiceMatter, formDTO.getServiceMatter());
wrapper.like(StringUtils.isNotBlank(formDTO.getTitle()), IcPartyActivityEntity::getTitle, formDTO.getTitle());
wrapper.between(IcPartyActivityEntity::getActivityTime, formDTO.getStartTime(), formDTO.getEndTime());
wrapper.orderByDesc(IcPartyActivityEntity::getUpdatedTime);
List<IcPartyActivityEntity> list = baseDao.selectList(wrapper);
List<IcPartyActivityEntity> list = baseDao.selectActivityList(formDTO);
List<IcPartyActivityDTO> dtoList = ConvertUtils.sourceToTarget(list, IcPartyActivityDTO.class);
IcPartyUnitDTO unitDTO = new IcPartyUnitDTO();
unitDTO.setAgencyId(formDTO.getAgencyId());
if (CollectionUtils.isNotEmpty(dtoList)) {
IcPartyUnitDTO unitDTO = new IcPartyUnitDTO();
unitDTO.setAgencyId(formDTO.getAgencyId());
Map<String, String> option = icPartyUnitService.option(unitDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel));
dtoList.forEach(dto -> {
dto.setUnitName(option.get(dto.getUnitId()));
List<String> unitIds = Arrays.asList(dto.getUnitId().split(StrConstant.COMMA));
List<String> unitNames = unitIds.stream().map(option::get).collect(Collectors.toList());
dto.setUnitName(StringUtils.join(unitNames, StrConstant.COMMA));
});
}
return dtoList;
}
private QueryWrapper<IcPartyActivityEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<IcPartyActivityEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public IcPartyActivityDTO get(String id) {
IcPartyActivityEntity entity = baseDao.selectById(id);
if (null == entity) {
return null;
}
//获取服务事项名称
IcPartyActivityDTO dto = ConvertUtils.sourceToTarget(entity, IcPartyActivityDTO.class);
//获取服务事项
List<OptionDTO> serviceItemList=icServiceItemDictService.queryDictList(entity.getCustomerId());
Map<String, String> categoryMap=serviceItemList.stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel));
List<String> services = icActivityServiceRelationService.getServiceList(id);
List<String> serviceNames = services.stream().map(categoryMap::get).collect(Collectors.toList());
dto.setServiceMatterList(services);
dto.setServiceMatterNameList(serviceNames);
//获取单位
//获取组织下联建单位
IcPartyUnitDTO unitDTO = new IcPartyUnitDTO();
unitDTO.setAgencyId(entity.getAgencyId());
Map<String, String> option = icPartyUnitService.option(unitDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel));
List<String> unitIds = icActivityUnitRelationService.getUnitList(id);
List<String> unitNames = unitIds.stream().map(option::get).collect(Collectors.toList());
dto.setUnitIdList(unitIds);
dto.setUnitNameList(unitNames);
IcPartyActivityDTO dto = ConvertUtils.sourceToTarget(entity, IcPartyActivityDTO.class);
dto.setServiceMatterName(categoryMap.get(dto.getServiceMatter()));
//获取单位名称
IcPartyUnitDTO unitDTO = icPartyUnitService.get(dto.getUnitId());
if (null != unitDTO) {
dto.setUnitName(unitDTO.getUnitName());
}
return dto;
}
@ -182,6 +179,35 @@ public class IcPartyActivityServiceImpl extends BaseServiceImpl<IcPartyActivityD
} else {
updateById(entity);
}
//保存活动与单位关系
icActivityUnitRelationService.deleteByActivity(entity.getId());
AtomicInteger i = new AtomicInteger(NumConstant.ONE);
List<IcActivityUnitRelationEntity> unitRelationList = dto.getUnitIdList().stream().map(unitId -> {
IcActivityUnitRelationEntity relation = new IcActivityUnitRelationEntity();
relation.setCustomerId(entity.getCustomerId());
relation.setAgencyId(entity.getAgencyId());
relation.setPids(entity.getPids());
relation.setActivityId(entity.getId());
relation.setUnitId(unitId);
relation.setSort(i.getAndIncrement());
return relation;
}).collect(Collectors.toList());
icActivityUnitRelationService.insertBatch(unitRelationList);
//保存活动与服务关系
icActivityServiceRelationService.deleteByActivity(entity.getId());
AtomicInteger j = new AtomicInteger(NumConstant.ONE);
List<IcActivityServiceRelationEntity> serviceRelationList = dto.getServiceMatterList().stream().map(service -> {
IcActivityServiceRelationEntity relation = new IcActivityServiceRelationEntity();
relation.setCustomerId(entity.getCustomerId());
relation.setAgencyId(entity.getAgencyId());
relation.setPids(entity.getPids());
relation.setActivityId(entity.getId());
relation.setServiceMatter(service);
relation.setSort(j.getAndIncrement());
return relation;
}).collect(Collectors.toList());
icActivityServiceRelationService.insertBatch(serviceRelationList);
}
@Override
@ -237,20 +263,31 @@ public class IcPartyActivityServiceImpl extends BaseServiceImpl<IcPartyActivityD
numList.add(obj.getRowNum());
log.warn(String.format("单位名称为空,行号->%s", obj.getRowNum()));
iterator.remove();
} else if (null == option.get(obj.getUnitName())){
numList.add(obj.getRowNum());
log.warn(String.format("单位名称不存在,行号->%s", obj.getRowNum()));
iterator.remove();
} else {
List<String> unitList = Arrays.asList(obj.getUnitName().split(StrConstant.COMMA));
unitList.forEach(unit -> {
if (null == option.get(unit)) {
numList.add(obj.getRowNum());
log.warn(String.format("单位名称不存在,行号->%s", obj.getRowNum()));
iterator.remove();
}
});
}
//服务事项校验
if (StringUtils.isBlank(obj.getServiceMatter())) {
numList.add(obj.getRowNum());
log.warn(String.format("服务事项为空,行号->%s", obj.getRowNum()));
iterator.remove();
} else if (null == categoryMap.get(obj.getServiceMatter())){
numList.add(obj.getRowNum());
log.warn(String.format("服务事项不存在,行号->%s", obj.getRowNum()));
iterator.remove();
} else {
List<String> serviceList = Arrays.asList(obj.getServiceMatter().split(StrConstant.SEMICOLON));
serviceList.forEach(service -> {
if (null == categoryMap.get(service)) {
numList.add(obj.getRowNum());
log.warn(String.format("服务事项不存在,行号->%s", obj.getRowNum()));
iterator.remove();
}
});
}
//活动标题 活动目标 活动内容 活动时间 活动地址 活动地址经度 活动地址纬度 活动结果
if(StringUtils.isBlank(obj.getTitle()) || StringUtils.isBlank(obj.getTarget()) ||
@ -271,7 +308,7 @@ public class IcPartyActivityServiceImpl extends BaseServiceImpl<IcPartyActivityD
return new Result().error(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "第" + subList + "行未成功!");
}
List<IcPartyActivityEntity> list = result.stream().map(item -> {
result.forEach(item -> {
IcPartyActivityEntity entity = new IcPartyActivityEntity();
entity.setCustomerId(tokenDto.getCustomerId());
entity.setAgencyId(staffInfoCache.getAgencyId());
@ -279,18 +316,44 @@ public class IcPartyActivityServiceImpl extends BaseServiceImpl<IcPartyActivityD
entity.setTitle(item.getTitle());
entity.setTarget(item.getTarget());
entity.setContent(item.getContent());
entity.setUnitId(option.get(item.getUnitName()));
entity.setServiceMatter(categoryMap.get(item.getServiceMatter()));
entity.setPeopleCount(item.getPeopleCount());
entity.setActivityTime(DateUtils.parse(item.getActivityTime(), DateUtils.DATE_TIME_PATTERN));
entity.setAddress(item.getAddress());
entity.setLatitude(item.getLatitude());
entity.setLongitude(item.getLongitude());
entity.setResult(item.getResult());
return entity;
}).collect(Collectors.toList());
insert(entity);
insertBatch(list);
//保存活动与单位关系
icActivityUnitRelationService.deleteByActivity(entity.getId());
AtomicInteger i = new AtomicInteger(NumConstant.ONE);
List<IcActivityUnitRelationEntity> unitRelationList = Arrays.stream(item.getUnitName().split(StrConstant.COMMA)).map(unit -> {
IcActivityUnitRelationEntity relation = new IcActivityUnitRelationEntity();
relation.setCustomerId(entity.getCustomerId());
relation.setAgencyId(entity.getAgencyId());
relation.setPids(entity.getPids());
relation.setActivityId(entity.getId());
relation.setUnitId(option.get(unit));
relation.setSort(i.getAndIncrement());
return relation;
}).collect(Collectors.toList());
icActivityUnitRelationService.insertBatch(unitRelationList);
//保存活动与服务关系
icActivityServiceRelationService.deleteByActivity(entity.getId());
AtomicInteger j = new AtomicInteger(NumConstant.ONE);
List<IcActivityServiceRelationEntity> serviceRelationList = Arrays.stream(item.getServiceMatter().split(StrConstant.SEMICOLON)).map(service -> {
IcActivityServiceRelationEntity relation = new IcActivityServiceRelationEntity();
relation.setCustomerId(entity.getCustomerId());
relation.setAgencyId(entity.getAgencyId());
relation.setPids(entity.getPids());
relation.setActivityId(entity.getId());
relation.setServiceMatter(categoryMap.get(service));
relation.setSort(j.getAndIncrement());
return relation;
}).collect(Collectors.toList());
icActivityServiceRelationService.insertBatch(serviceRelationList);
});
String str = String.format("共%s条,成功导入%s条。", numList.size() + result.size(), numList.size() + result.size() - numList.size());
if (numList.size() > NumConstant.ZERO) {
@ -347,14 +410,7 @@ public class IcPartyActivityServiceImpl extends BaseServiceImpl<IcPartyActivityD
}
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize());
//获取活动列表
LambdaQueryWrapper<IcPartyActivityEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.and(wp -> wp.eq(IcPartyActivityEntity::getAgencyId, formDTO.getAgencyId()).or().
like(IcPartyActivityEntity::getPids, formDTO.getAgencyId()));
wrapper.eq(StringUtils.isNotBlank(formDTO.getServiceMatter()), IcPartyActivityEntity::getServiceMatter, formDTO.getServiceMatter());
wrapper.ge(null != formDTO.getStartTime(),IcPartyActivityEntity::getActivityTime, formDTO.getStartTime());
wrapper.le(null != formDTO.getEndTime(), IcPartyActivityEntity::getActivityTime, formDTO.getEndTime());
wrapper.orderByDesc(IcPartyActivityEntity::getActivityTime);
List<IcPartyActivityEntity> list = baseDao.selectList(wrapper);
List<IcPartyActivityEntity> list = baseDao.getActivityList(formDTO);
List<IcPartyActivityDTO> dtoList = ConvertUtils.sourceToTarget(list, IcPartyActivityDTO.class);
IcPartyUnitDTO unitDTO = new IcPartyUnitDTO();
@ -367,8 +423,15 @@ public class IcPartyActivityServiceImpl extends BaseServiceImpl<IcPartyActivityD
Map<String, String> categoryMap=serviceItemList.stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel));
//数据组装
dtoList.forEach(dto -> {
dto.setServiceMatterName(categoryMap.get(dto.getServiceMatter()));
dto.setUnitName(option.get(dto.getUnitId()));
//联建单位ID与单位名匹配
List<String> unitIds = Arrays.asList(dto.getUnitId().split(StrConstant.COMMA));
List<String> unitNames = unitIds.stream().map(option::get).collect(Collectors.toList());
dto.setUnitName(StringUtils.join(unitNames, StrConstant.COMMA));
//服务事项与服务事项名匹配
List<String> services = Arrays.asList(dto.getServiceMatter().split(StrConstant.COMMA));
List<String> serviceNames = services.stream().map(categoryMap::get).collect(Collectors.toList());
dto.setServiceMatterName(StringUtils.join(serviceNames, StrConstant.SEMICOLON));
});
}
PageInfo<IcPartyActivityDTO> pageInfo = new PageInfo<>(dtoList);

33
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LatestActServiceRelationServiceImpl.java

@ -0,0 +1,33 @@
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.dao.LatestActServiceRelationDao;
import com.epmet.dto.LatestActServiceRelationDTO;
import com.epmet.entity.LatestActServiceRelationEntity;
import com.epmet.redis.LatestActServiceRelationRedis;
import com.epmet.service.LatestActServiceRelationService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 联建活动与服务事项关联表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-02-21
*/
@Service
public class LatestActServiceRelationServiceImpl extends BaseServiceImpl<LatestActServiceRelationDao, LatestActServiceRelationEntity> implements LatestActServiceRelationService {
}

19
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LatestActUnitRelationServiceImpl.java

@ -0,0 +1,19 @@
package com.epmet.service.impl;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.dao.LatestActUnitRelationDao;
import com.epmet.entity.LatestActUnitRelationEntity;
import com.epmet.service.LatestActUnitRelationService;
import org.springframework.stereotype.Service;
/**
* 联建活动与单位关联表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-02-21
*/
@Service
public class LatestActUnitRelationServiceImpl extends BaseServiceImpl<LatestActUnitRelationDao, LatestActUnitRelationEntity> implements LatestActUnitRelationService {
}

26
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcActivityServiceRelationDao.xml

@ -0,0 +1,26 @@
<?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.epmet.dao.IcActivityServiceRelationDao">
<resultMap type="com.epmet.entity.IcActivityServiceRelationEntity" id="icActivityServiceRelationMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="agencyId" column="AGENCY_ID"/>
<result property="pids" column="PIDS"/>
<result property="activityId" column="ACTIVITY_ID"/>
<result property="actId" column="ACT_ID"/>
<result property="serviceMatter" column="SERVICE_MATTER"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<delete id="deleteByActivity">
DELETE FROM ic_activity_service_relation WHERE ACTIVITY_ID = #{activityId}
</delete>
</mapper>

26
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcActivityUnitRelationDao.xml

@ -0,0 +1,26 @@
<?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.epmet.dao.IcActivityUnitRelationDao">
<resultMap type="com.epmet.entity.IcActivityUnitRelationEntity" id="icActivityUnitRelationMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="agencyId" column="AGENCY_ID"/>
<result property="pids" column="PIDS"/>
<result property="activityId" column="ACTIVITY_ID"/>
<result property="actId" column="ACT_ID"/>
<result property="unitId" column="UNIT_ID"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<delete id="deleteByActivity">
DELETE FROM ic_activity_unit_relation WHERE ACTIVITY_ID = #{activityId}
</delete>
</mapper>

128
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPartyActivityDao.xml

@ -28,14 +28,16 @@
</resultMap>
<select id="getStatistics" resultType="com.epmet.dto.result.ActivityStatisticsDTO" parameterType="com.epmet.dto.form.PartyActivityFormDTO">
SELECT
count( ID ) AS "activityCount",
COUNT( DISTINCT UNIT_ID ) AS "unitCount"
COUNT( DISTINCT a.ID ) AS "activityCount",
COUNT( DISTINCT b.UNIT_ID ) AS "unitCount"
FROM
ic_party_activity
WHERE DEL_FLAG = '0'
AND (AGENCY_ID = #{agencyId} OR PIDS LIKE concat( '%', #{agencyId}, '%' ))
ic_party_activity a
INNER JOIN ic_activity_unit_relation b ON a.ID = b.ACTIVITY_ID
INNER JOIN ic_activity_service_relation c ON a.ID = c.ACTIVITY_ID
WHERE a.DEL_FLAG = '0'
AND (a.AGENCY_ID = #{agencyId} OR a.PIDS LIKE concat( '%', #{agencyId}, '%' ))
<if test='null != serviceMatter'>
AND SERVICE_MATTER = #{serviceMatter}
AND c.SERVICE_MATTER = #{serviceMatter}
</if>
<if test='null != startTime'>
AND ACTIVITY_TIME &gt;= #{startTime}
@ -44,6 +46,120 @@
AND ACTIVITY_TIME &lt;= #{endTime}
</if>
</select>
<select id="selectActivityList" resultType="com.epmet.entity.IcPartyActivityEntity" parameterType = "com.epmet.dto.form.PartyActivityFormDTO">
SELECT
a.ID,
b.unitId,
c.serviceMatter,
TITLE,
TARGET,
CONTENT,
PEOPLE_COUNT,
ACTIVITY_TIME,
ADDRESS,
LONGITUDE,
LATITUDE,
RESULT
FROM
ic_party_activity a
INNER JOIN (
SELECT
ACTIVITY_ID,
GROUP_CONCAT( UNIT_ID ) AS unitId
FROM
ic_activity_unit_relation
WHERE
DEL_FLAG = '0'
AND AGENCY_ID = #{agencyId}
<if test='null != unitId'>
AND UNIT_ID = #{unitId}
</if>
GROUP BY
ACTIVITY_ID
) b ON a.ID = b.ACTIVITY_ID
INNER JOIN (
SELECT
ACTIVITY_ID,
GROUP_CONCAT( SERVICE_MATTER ) AS serviceMatter
FROM
ic_activity_service_relation
WHERE
DEL_FLAG = '0'
AND AGENCY_ID = #{agencyId}
<if test='null != serviceMatter'>
AND SERVICE_MATTER = #{serviceMatter}
</if>
GROUP BY
ACTIVITY_ID
) c ON a.ID = c.ACTIVITY_ID
WHERE
a.DEL_FLAG = '0'
AND a.AGENCY_ID = #{agencyId}
<if test='null != serviceMatter'>
AND TITLE LIKE concat('%', #{title}, '%')
</if>
AND ACTIVITY_TIME BETWEEN #{startTime} AND #{endTime}
</select>
<select id="getActivityList" resultType="com.epmet.entity.IcPartyActivityEntity" parameterType = "com.epmet.dto.form.PartyActivityFormDTO">
SELECT
a.ID,
b.unitId,
c.serviceMatter,
TITLE,
TARGET,
CONTENT,
PEOPLE_COUNT,
ACTIVITY_TIME,
ADDRESS,
LONGITUDE,
LATITUDE,
RESULT
FROM
ic_party_activity a
INNER JOIN (
SELECT
ACTIVITY_ID,
GROUP_CONCAT( UNIT_ID ) AS unitId
FROM
ic_activity_unit_relation
WHERE
DEL_FLAG = '0'
AND (AGENCY_ID = #{agencyId} OR PIDS LIKE concat( '%', #{agencyId}, '%' ))
<if test='null != unitId'>
AND UNIT_ID = #{unitId}
</if>
GROUP BY
ACTIVITY_ID
) b ON a.ID = b.ACTIVITY_ID
INNER JOIN (
SELECT
ACTIVITY_ID,
GROUP_CONCAT( SERVICE_MATTER ) AS serviceMatter
FROM
ic_activity_service_relation
WHERE
DEL_FLAG = '0'
AND (AGENCY_ID = #{agencyId} OR PIDS LIKE concat( '%', #{agencyId}, '%' ))
<if test='null != serviceMatter'>
AND SERVICE_MATTER = #{serviceMatter}
</if>
GROUP BY
ACTIVITY_ID
) c ON a.ID = c.ACTIVITY_ID
WHERE
a.DEL_FLAG = '0'
AND (a.AGENCY_ID = #{agencyId} OR a.PIDS LIKE concat( '%', #{agencyId}, '%' ))
<if test='null != startTime'>
AND ACTIVITY_TIME &gt;= #{startTime}
</if>
<if test='null != endTime'>
AND ACTIVITY_TIME &lt;= #{endTime}
</if>
AND ACTIVITY_TIME BETWEEN #{startTime} AND #{endTime}
</select>
</mapper>

24
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActServiceRelationDao.xml

@ -0,0 +1,24 @@
<?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.epmet.dao.LatestActServiceRelationDao">
<resultMap type="com.epmet.entity.LatestActServiceRelationEntity" id="latestActServiceRelationMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="agencyId" column="AGENCY_ID"/>
<result property="pids" column="PIDS"/>
<result property="actId" column="ACT_ID"/>
<result property="serviceMatter" column="SERVICE_MATTER"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<delete id="deleteByActivity">
DELETE FROM latest_act_service_relation WHERE ACT_ID = #{activityId}
</delete>
</mapper>

24
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActUnitRelationDao.xml

@ -0,0 +1,24 @@
<?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.epmet.dao.LatestActUnitRelationDao">
<resultMap type="com.epmet.entity.LatestActUnitRelationEntity" id="latestActUnitRelationMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="agencyId" column="AGENCY_ID"/>
<result property="pids" column="PIDS"/>
<result property="actId" column="ACT_ID"/>
<result property="unitId" column="UNIT_ID"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<delete id="deleteByActivity">
DELETE FROM latest_act_unit_relation WHERE ACT_ID = #{activityId}
</delete>
</mapper>

5
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerGridDTO.java

@ -62,6 +62,11 @@ public class CustomerGridDTO implements Serializable {
*/
private String latitude;
/**
* 中心点位位置
*/
private String centerAddress;
/**
* 所属地区码所属组织地区码
*/

18
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyFormDTO.java

@ -85,4 +85,22 @@ public class AddAgencyFormDTO implements Serializable {
@Length(max=30,message = "区县级机关名称不能超过30个字")
private String district;
//02.21新增需求:小程序工作端添加组织增加中心点位置入口,点击进入地图选择点位,可以搜索,中心点为必填
//该接口为通用接口,后端暂时先不限制必填。由前端控制
/**
* 中心位置经度
*/
// @NotBlank(message = "请选择网格中心点位", groups = AddGridFormDTO.AddGrid.class)
private String longitude;
/**
* 中心位置纬度
*/
// @NotBlank(message = "请选择网格中心点位", groups = AddGridFormDTO.AddGrid.class)
private String latitude;
/**
* 中心点位位置
*/
private String centerAddress;
}

19
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyV2FormDTO.java

@ -99,4 +99,23 @@ public class AddAgencyV2FormDTO implements Serializable {
* 联系电话
*/
private String mobile;
//02.21新增需求:小程序工作端添加组织增加中心点位置入口,点击进入地图选择点位,可以搜索,中心点为必填
//该接口为通用接口,后端暂时先不限制必填。由前端控制
/**
* 中心位置经度
*/
// @NotBlank(message = "请选择网格中心点位", groups = AddGridFormDTO.AddGrid.class)
private String longitude;
/**
* 中心位置纬度
*/
// @NotBlank(message = "请选择网格中心点位", groups = AddGridFormDTO.AddGrid.class)
private String latitude;
/**
* 中心点位位置
*/
private String centerAddress;
}

18
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddGridFormDTO.java

@ -51,4 +51,22 @@ public class AddGridFormDTO implements Serializable {
*/
private String mobile;
//02.21新增需求:小程序工作端添加组织增加中心点位置入口,点击进入地图选择点位,可以搜索,中心点为必填
//该接口为通用接口,后端暂时先不限制必填。由前端控制
/**
* 中心位置经度
*/
// @NotBlank(message = "请选择网格中心点位", groups = AddGridFormDTO.AddGrid.class)
private String longitude;
/**
* 中心位置纬度
*/
// @NotBlank(message = "请选择网格中心点位", groups = AddGridFormDTO.AddGrid.class)
private String latitude;
/**
* 中心点位位置
*/
private String centerAddress;
}

19
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditAgencyFormDTO.java

@ -89,4 +89,23 @@ public class EditAgencyFormDTO implements Serializable {
@NotBlank(message = "组织级别不能为空;社区级:community,乡(镇、街道)级:street,区县级: district,市级: city省级:province", groups = AddAgencyV2FormDTO.AddUserInternalGroup.class)
private String level;
//02.21新增需求:小程序工作端添加组织增加中心点位置入口,点击进入地图选择点位,可以搜索,中心点为必填
//该接口为通用接口,后端暂时先不限制必填。由前端控制
/**
* 中心位置经度
*/
// @NotBlank(message = "请选择网格中心点位", groups = AddGridFormDTO.AddGrid.class)
private String longitude;
/**
* 中心位置纬度
*/
// @NotBlank(message = "请选择网格中心点位", groups = AddGridFormDTO.AddGrid.class)
private String latitude;
/**
* 中心点位位置
*/
private String centerAddress;
}

18
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditGridFormDTO.java

@ -59,4 +59,22 @@ public class EditGridFormDTO implements Serializable {
*/
private String mobile;
//02.21新增需求:小程序工作端添加组织增加中心点位置入口,点击进入地图选择点位,可以搜索,中心点为必填
//该接口为通用接口,后端暂时先不限制必填。由前端控制
/**
* 中心位置经度
*/
// @NotBlank(message = "请选择网格中心点位", groups = AddGridFormDTO.AddGrid.class)
private String longitude;
/**
* 中心位置纬度
*/
// @NotBlank(message = "请选择网格中心点位", groups = AddGridFormDTO.AddGrid.class)
private String latitude;
/**
* 中心点位位置
*/
private String centerAddress;
}

15
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencysResultDTO.java

@ -118,4 +118,19 @@ public class AgencysResultDTO implements Serializable {
* 联系电话
*/
private String mobile;
/**
* 中心位置经度
*/
private String longitude;
/**
* 中心位置纬度
*/
private String latitude;
/**
* 中心点位位置
*/
private String centerAddress;
}

5
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridDetailResultDTO.java

@ -35,6 +35,11 @@ public class GridDetailResultDTO implements Serializable {
*/
private String latitude;
/**
* 中心点位位置
*/
private String centerAddress;
/**
* 所属地区码所属组织地区码
*/

12
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/ImportErrorMsgConstants.java

@ -0,0 +1,12 @@
package com.epmet.constant;
/**
* @Author zxc
* @DateTime 2022/2/21 4:25 下午
* @DESC
*/
public interface ImportErrorMsgConstants {
}

5
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerAgencyEntity.java

@ -124,6 +124,11 @@ public class CustomerAgencyEntity extends BaseEpmetEntity {
*/
private String latitude;
/**
* 中心点位位置
*/
private String centerAddress;
/**
* 组织编码
*/

5
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerGridEntity.java

@ -55,6 +55,11 @@ public class CustomerGridEntity extends BaseEpmetEntity {
*/
private String latitude;
/**
* 中心点位位置
*/
private String centerAddress;
/**
* 所属地区码所属组织地区码
*/

23
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/BuildingErrorInfoModel.java

@ -0,0 +1,23 @@
package com.epmet.model;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
/**
* @Author zxc
* @DateTime 2022/2/15 10:07 上午
* @DESC
*/
@Data
public class BuildingErrorInfoModel {
@ExcelProperty(value = "小区名称")
private String neighborHoodName;
@ExcelProperty(value = "楼栋名称")
private String buildingName;
@ExcelProperty(value = "错误信息")
private String errorMsg;
}

30
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/HouseErrorInfoModel.java

@ -0,0 +1,30 @@
package com.epmet.model;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
/**
* @Author zxc
* @DateTime 2022/2/13 1:26 下午
* @DESC
*/
@Data
public class HouseErrorInfoModel {
@ExcelProperty(value = "所属小区")
private String neighborHoodName;
@ExcelProperty(value = "所属楼栋")
private String buildingName;
@ExcelProperty(value = "单元号")
private Integer buildingUnit;
@ExcelProperty(value = "门牌号")
private String doorName;
@ExcelProperty(value = "错误信息")
private String errorMsg;
}

19
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportBuildingInfoListener.java

@ -34,6 +34,8 @@ public class ImportBuildingInfoListener extends AnalysisEventListener<BuildingIn
List<Integer> nums = new ArrayList<>();
Integer num = NumConstant.ZERO;
List<BuildingErrorInfoModel> errorInfos = new ArrayList<>();
BuildingInfoModel info = null;
List<ImportGeneralDTO> needDisposeList = new ArrayList<>();
List<ImportGeneralDTO> needInsertList = new ArrayList<>();
@ -67,6 +69,7 @@ public class ImportBuildingInfoListener extends AnalysisEventListener<BuildingIn
if (null == data){
return;
}
info = data;
num = num + NumConstant.ONE;
ImportGeneralDTO dto = ConvertUtils.sourceToTarget(data, ImportGeneralDTO.class);
dto.setNum(num);
@ -74,6 +77,7 @@ public class ImportBuildingInfoListener extends AnalysisEventListener<BuildingIn
// 应产品要求添加
if (StringUtils.isNotBlank(dto.getType()) && (!dto.getType().equals("商品房") && !dto.getType().equals("自建房")) && !dto.getType().equals("别墅")){
nums.add(num);
disposeErrorMsg(info,"");
return;
}
dto.setType(BuildingTypeEnums.getKeyByValue(dto.getType()));
@ -104,6 +108,7 @@ public class ImportBuildingInfoListener extends AnalysisEventListener<BuildingIn
r.getNeighborHoodName() + "_" + r.getBuildingName())){
// 集合里重复的
nums.add(r.getNum());
disposeErrorMsg(info,"");
r.setExistStatus(true);
}
}
@ -118,6 +123,7 @@ public class ImportBuildingInfoListener extends AnalysisEventListener<BuildingIn
if (!CollectionUtils.isEmpty(existList)){
existList.forEach(e -> {
nums.add(e.getNum());
disposeErrorMsg(info,"");
});
}
}
@ -157,6 +163,7 @@ public class ImportBuildingInfoListener extends AnalysisEventListener<BuildingIn
if (StringUtils.isNotBlank(dto.getBuildingId())){
// 说明数据库已存在此楼栋,不需添加
nums.add(num);
disposeErrorMsg(info,"");
}else {
needDisposeList.add(dto);
}
@ -176,6 +183,7 @@ public class ImportBuildingInfoListener extends AnalysisEventListener<BuildingIn
//排除不是本小区的
if (!dto.getNeighborHoodName().equals(neighborHoodGeneralDTO.getNeighborHoodName())){
nums.add(num);
disposeErrorMsg(info,"");
}else {
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(neighborHoodGeneralDTO.getGridId());
if (null == gridInfo){
@ -185,6 +193,7 @@ public class ImportBuildingInfoListener extends AnalysisEventListener<BuildingIn
if ((!gridInfo.getGridName().equals(dto.getGridName()) && neighborHoodGeneralDTO.getNeighborHoodName().equals(dto.getNeighborHoodName())) ||
(!gridInfo.getAgencyName().equals(dto.getAgencyName()) && gridInfo.getGridName().equals(dto.getGridName()) && neighborHoodGeneralDTO.getNeighborHoodName().equals(dto.getNeighborHoodName()))){
nums.add(num);
disposeErrorMsg(info,"");
return;
}
dto.setNeighborHoodId(formDTO.getOrgId());
@ -216,6 +225,7 @@ public class ImportBuildingInfoListener extends AnalysisEventListener<BuildingIn
//排除不是本网格的 gridName不一样排除,gridName一样但是agencyName不一样也得排除
if (dto.getGridName().compareTo(gridName) != 0 || (!dto.getAgencyName().equals(gridInfo.getAgencyName()) && dto.getGridName().equals(gridName))){
nums.add(num);
disposeErrorMsg(info,"");
}else {
//
dto.setGridId(formDTO.getOrgId());
@ -242,18 +252,21 @@ public class ImportBuildingInfoListener extends AnalysisEventListener<BuildingIn
//排除不是本组织的
if (!dto.getAgencyName().equals(agencyName)){
nums.add(num);
disposeErrorMsg(info,"");
}else {
// 根据组织查询出所有网格,甩出不是本组织下的网格
gridInfos = null == gridInfos ? getGridInfos(formDTO.getOrgId()) : gridInfos;
if (null == gridInfos){
// 组织下确实不存在网格
nums.add(num);
disposeErrorMsg(info,"");
return;
}
// 根据网格名对比,没有找到的就把行号加入到未执行成功队列中
Object cacheGridName = icHouseRedis.getTemporaryCacheGrid(formDTO.getCustomerId(), formDTO.getUserId(), dto.getGridName());
if (null == cacheGridName){
nums.add(num);
disposeErrorMsg(info,"");
return;
}
dto.setGridId(cacheGridName.toString());
@ -308,6 +321,12 @@ public class ImportBuildingInfoListener extends AnalysisEventListener<BuildingIn
return buildingInfos;
}
public void disposeErrorMsg(BuildingInfoModel data,String msg){
BuildingErrorInfoModel err = ConvertUtils.sourceToTarget(data, BuildingErrorInfoModel.class);
err.setErrorMsg(msg);
errorInfos.add(err);
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
finalDispose();

27
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportHouseInfoListener.java

@ -36,6 +36,8 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode
List<Integer> nums = new ArrayList<>();
Integer num = NumConstant.ZERO;
List<HouseErrorInfoModel> errorInfos = new ArrayList<>();
HouseInfoModel info = null;
List<ImportGeneralDTO> needDisposeList = new ArrayList<>();
List<ImportGeneralDTO> needInsertList = new ArrayList<>();
@ -73,6 +75,7 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode
if (null == data){
return;
}
info = data;
num = num + NumConstant.ONE;
ImportGeneralDTO dto = ConvertUtils.sourceToTarget(data, ImportGeneralDTO.class);
dto.setNum(num);
@ -81,6 +84,7 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode
if (StringUtils.isNotBlank(dto.getHouseType()) ){
if( !"楼房".equals(dto.getHouseType()) && !dto.getHouseType().equals("平房") && !dto.getHouseType().equals("别墅") ){
nums.add(num);
disposeErrorMsg(info,"");
return;
}
}
@ -94,11 +98,13 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode
!dto.getPurpose().equals("商住混用") &&
!dto.getPurpose().equals("其他")) ){
nums.add(num);
disposeErrorMsg(info,"");
return;
}
dto.setPurpose(HousePurposeEnums.getKeyByValue(dto.getPurpose()));
if (StringUtils.isNotBlank(dto.getRentFlagString()) && (!dto.getRentFlagString().equals("是") && !dto.getRentFlagString().equals("否"))){
nums.add(num);
disposeErrorMsg(info,"");
return;
}
dto.setRentFlag(HouseRentFlagEnums.getCodeByName(dto.getRentFlagString()));
@ -118,6 +124,12 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode
}
}
public void disposeErrorMsg(HouseInfoModel data,String msg){
HouseErrorInfoModel err = ConvertUtils.sourceToTarget(data, HouseErrorInfoModel.class);
err.setErrorMsg(msg);
errorInfos.add(err);
}
public void finalDispose(){
if (!CollectionUtils.isEmpty(needDisposeList)){
List<ImportGeneralDTO> importInfo = neighborHoodService.getImportInfo(formDTO, needDisposeList);
@ -132,10 +144,8 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode
for (ImportGeneralDTO r : needInsertList) {
if (k.equals(r.getBuildingUnitId()+"_"+r.getDoorName())){
// 集合里重复的
if (r.getExistStatus()){
}
nums.add(r.getNum());
disposeErrorMsg(info,"");
r.setExistStatus(true);
}
}
@ -149,6 +159,7 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode
if ((n.getBuildingUnitId()+"_"+n.getDoorName()).equals(e)){
// 库里存在的
nums.add(n.getNum());
disposeErrorMsg(info,"");
n.setExistStatus(true);
}
}
@ -185,6 +196,7 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode
// 排除不是本楼的
if (!dto.getBuildingName().equals(buildingGeneralDTO.getBuildingName())){
nums.add(num);
disposeErrorMsg(info,"");
}else {
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(buildingGeneralDTO.getGridId());
if (null == gridInfo){
@ -195,6 +207,7 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode
|| (!gridInfo.getGridName().equals(dto.getGridName())&&buildingGeneralDTO.getNeighborHoodName().equals(dto.getNeighborHoodName()) && buildingGeneralDTO.getBuildingName().equals(dto.getBuildingName()))
|| (!gridInfo.getAgencyName().equals(dto.getAgencyName())&&gridInfo.getGridName().equals(dto.getGridName())&&buildingGeneralDTO.getNeighborHoodName().equals(dto.getNeighborHoodName()) && buildingGeneralDTO.getBuildingName().equals(dto.getBuildingName()))){
nums.add(num);
disposeErrorMsg(info,"");
return;
}
dto.setBuildingId(formDTO.getOrgId());
@ -235,6 +248,7 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode
//排除不是本小区的
if (!dto.getNeighborHoodName().equals(neighborHoodGeneralDTO.getNeighborHoodName())){
nums.add(num);
disposeErrorMsg(info,"");
}else {
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(neighborHoodGeneralDTO.getGridId());
if (null == gridInfo){
@ -244,6 +258,7 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode
if ((!gridInfo.getGridName().equals(dto.getGridName()) && neighborHoodGeneralDTO.getNeighborHoodName().equals(dto.getNeighborHoodName())) ||
(!gridInfo.getAgencyName().equals(dto.getAgencyName()) && gridInfo.getGridName().equals(dto.getGridName()) && neighborHoodGeneralDTO.getNeighborHoodName().equals(dto.getNeighborHoodName()))){
nums.add(num);
disposeErrorMsg(info,"");
return;
}
dto.setNeighborHoodId(formDTO.getOrgId());
@ -275,6 +290,7 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode
//排除不是本网格的 gridName不一样排除,gridName一样但是agencyName不一样也得排除
if (dto.getGridName().compareTo(gridName) != 0 || (!dto.getAgencyName().equals(gridInfo.getAgencyName()) && dto.getGridName().equals(gridName))){
nums.add(num);
disposeErrorMsg(info,"");
}else {
//
dto.setGridId(formDTO.getOrgId());
@ -301,18 +317,21 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode
//排除不是本组织的
if (!dto.getAgencyName().equals(agencyName)){
nums.add(num);
disposeErrorMsg(info,"");
}else {
// 根据组织查询出所有网格,甩出不是本组织下的网格
gridInfos = null == gridInfos ? getGridInfos(formDTO.getOrgId()) : gridInfos;
if (null == gridInfos){
// 组织下确实不存在网格
nums.add(num);
disposeErrorMsg(info,"");
return;
}
// 根据网格名对比,没有找到的就把行号加入到未执行成功队列中
Object cacheGridName = icHouseRedis.getTemporaryCacheGrid(formDTO.getCustomerId(), formDTO.getUserId(), dto.getGridName());
if (null == cacheGridName){
nums.add(num);
disposeErrorMsg(info,"");
return;
}
dto.setGridId(cacheGridName.toString());
@ -393,7 +412,7 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode
/**
* @Description 获取小区下的楼栋
* @param neighborHoodId
* @param orgId
* @author zxc
* @date 2022/2/14 1:32 下午
*/

17
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportNeighborHoodInfoListener.java

@ -37,6 +37,8 @@ public class ImportNeighborHoodInfoListener extends AnalysisEventListener<Neighb
List<Integer> nums = new ArrayList<>();
Integer num = NumConstant.ZERO;
List<NeighborHoodErrorInfoModel> errorInfos = new ArrayList<>();
NeighborHoodInfoModel info = null;
List<ImportGeneralDTO> needDisposeList = new ArrayList<>();
List<ImportGeneralDTO> needInsertList = new ArrayList<>();
@ -70,9 +72,11 @@ public class ImportNeighborHoodInfoListener extends AnalysisEventListener<Neighb
if (null == data){
return;
}
info = data;
num = num + NumConstant.ONE;
ImportGeneralDTO dto = ConvertUtils.sourceToTarget(data, ImportGeneralDTO.class);
dto.setNum(num);
disposeErrorMsg(info,"");
dto.setCustomerId(formDTO.getCustomerId());
if (formDTO.getOrgType().equals(CustomerGridConstant.GRID)){
disposeGridNeighborHood(dto);
@ -97,6 +101,7 @@ public class ImportNeighborHoodInfoListener extends AnalysisEventListener<Neighb
if (k.equals(r.getAgencyName() + "_" + r.getGridName() + "_" + r.getNeighborHoodName())){
// 集合里重复的
nums.add(r.getNum());
disposeErrorMsg(info,"");
r.setExistStatus(true);
}
}
@ -111,6 +116,7 @@ public class ImportNeighborHoodInfoListener extends AnalysisEventListener<Neighb
if (!CollectionUtils.isEmpty(existList)){
existList.forEach(e -> {
nums.add(e.getNum());
disposeErrorMsg(info,"");
});
}
List<ImportGeneralDTO> notExistList = groupByBuildingExistStatus.get(false);
@ -172,6 +178,7 @@ public class ImportNeighborHoodInfoListener extends AnalysisEventListener<Neighb
//排除不是本网格的 gridName不一样排除,gridName一样但是agencyName不一样也得排除
if (dto.getGridName().compareTo(gridName) != 0 || (!dto.getAgencyName().equals(gridInfo.getAgencyName()) && dto.getGridName().equals(gridName))){
nums.add(num);
disposeErrorMsg(info,"");
}else {
//
dto.setGridId(formDTO.getOrgId());
@ -197,18 +204,21 @@ public class ImportNeighborHoodInfoListener extends AnalysisEventListener<Neighb
//排除不是本组织的
if (!dto.getAgencyName().equals(agencyName)){
nums.add(num);
disposeErrorMsg(info,"");
}else {
// 根据组织查询出所有网格,甩出不是本组织下的网格
gridInfos = null == gridInfos ? getGridInfos(formDTO.getOrgId()) : gridInfos;
if (null == gridInfos){
// 组织下确实不存在网格
nums.add(num);
disposeErrorMsg(info,"");
return;
}
// 根据网格名对比,没有找到的就把行号加入到未执行成功队列中
Object cacheGridName = icHouseRedis.getTemporaryCacheGrid(formDTO.getCustomerId(), formDTO.getUserId(), dto.getGridName());
if (null == cacheGridName){
nums.add(num);
disposeErrorMsg(info,"");
return;
}
dto.setGridId(cacheGridName.toString());
@ -237,6 +247,7 @@ public class ImportNeighborHoodInfoListener extends AnalysisEventListener<Neighb
if (StringUtils.isNotBlank(dto.getNeighborHoodId())){
// 小区已存在
nums.add(dto.getNum());
disposeErrorMsg(info,"");
}else {
needDisposeList.add(dto);
}
@ -268,6 +279,12 @@ public class ImportNeighborHoodInfoListener extends AnalysisEventListener<Neighb
return neighborHoodInfos;
}
public void disposeErrorMsg(NeighborHoodInfoModel data,String msg){
NeighborHoodErrorInfoModel err = ConvertUtils.sourceToTarget(data, NeighborHoodErrorInfoModel.class);
err.setErrorMsg(msg);
errorInfos.add(err);
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
finalDispose();

20
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/NeighborHoodErrorInfoModel.java

@ -0,0 +1,20 @@
package com.epmet.model;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
/**
* @Author zxc
* @DateTime 2022/2/15 2:15 下午
* @DESC
*/
@Data
public class NeighborHoodErrorInfoModel {
@ExcelProperty(value = "小区名称")
private String neighborHoodName;
@ExcelProperty(value = "错误信息")
private String errorMsg;
}

8
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java

@ -158,7 +158,13 @@ public class AgencyServiceImpl implements AgencyService {
originalEntity.setCode(formDTO.getCode());
originalEntity.setContacts(formDTO.getContacts());
originalEntity.setMobile(formDTO.getMobile());
if(StringUtils.isNotBlank(formDTO.getLatitude())){
originalEntity.setLatitude(formDTO.getLatitude());
}
if(StringUtils.isNotBlank(formDTO.getLongitude())){
originalEntity.setLongitude(formDTO.getLongitude());
}
originalEntity.setCenterAddress(formDTO.getCenterAddress());
//当前客户开启了area_code_switch参数:open: 选择地区编码必填;closed: 无需选择地区编码
if (CustomerAgencyConstant.AREA_CODE_SWITCH_OPEN.equals(formDTO.getAreaCodeSwitch())) {
CustomerAgencyEntity parent = customerAgencyDao.selectById(originalEntity.getPid());

12
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java

@ -272,7 +272,10 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu
customerGridEntity.setGridType(addGridFormDTO.getGridType());
customerGridEntity.setContacts(addGridFormDTO.getContacts());
customerGridEntity.setMobile(addGridFormDTO.getMobile());
//新增网格增加中心点位必填
customerGridEntity.setLatitude(addGridFormDTO.getLatitude());
customerGridEntity.setLongitude(addGridFormDTO.getLongitude());
customerGridEntity.setCenterAddress(addGridFormDTO.getCenterAddress());
//新增area_code,部门的area_code=所属组织的area_code
customerGridEntity.setAreaCode(null != customerAgencyDTO && StringUtils.isNotBlank(customerAgencyDTO.getAreaCode()) ? customerAgencyDTO.getAreaCode() : StrConstant.EPMETY_STR);
@ -314,6 +317,13 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu
customerGridDTO.setGridType(editGridFormDTO.getGridType());
customerGridDTO.setContacts(editGridFormDTO.getContacts());
customerGridDTO.setMobile(editGridFormDTO.getMobile());
if(StringUtils.isNotBlank(editGridFormDTO.getLongitude())){
customerGridDTO.setLongitude(editGridFormDTO.getLongitude());
}
if(StringUtils.isNotBlank(editGridFormDTO.getLatitude())){
customerGridDTO.setLatitude(editGridFormDTO.getLatitude());
}
customerGridDTO.setCenterAddress(editGridFormDTO.getCenterAddress());
baseDao.editGrid(customerGridDTO);
return new Result();

2
epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.12__addagency_grid_address.sql

@ -0,0 +1,2 @@
alter table customer_agency add COLUMN CENTER_ADDRESS VARCHAR(128) comment '中心点位地址' AFTER LATITUDE;
alter table customer_grid add COLUMN CENTER_ADDRESS VARCHAR(128) comment '中心点位地址' AFTER LATITUDE;

10
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml

@ -185,6 +185,7 @@
grid_name AS gridName,
longitude AS longitude,
latitude AS latitude,
CENTER_ADDRESS AS centerAddress,
area_code AS areaCode,
manage_district AS manageDistrict,
total_user AS totalUser,
@ -242,6 +243,15 @@
contacts = #{contacts},
mobile = #{mobile},
updated_by = #{updatedBy},
<if test="longitude != null and longitude !=''">
LONGITUDE= #{longitude},
</if>
<if test="latitude != null and latitude !=''">
LATITUDE= #{latitude},
</if>
<if test="centerAddress != null and centerAddress !=''">
CENTER_ADDRESS= #{centerAddress},
</if>
UPDATED_TIME=NOW()
where
id = #{id}

5
epmet-user/epmet-user-server/pom.xml

@ -154,6 +154,11 @@
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>common-service-client</artifactId>
<version>2.0.0</version>
</dependency>
</dependencies>
<build>

24
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java

@ -34,6 +34,7 @@ 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.RenException;
import com.epmet.commons.tools.feign.ResultDataResolver;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
@ -45,19 +46,19 @@ import com.epmet.commons.tools.utils.HttpClientManager;
import com.epmet.commons.tools.utils.IpUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.constant.ImportTaskConstants;
import com.epmet.constant.SystemMessageType;
import com.epmet.constants.ImportTaskConstants;
import com.epmet.dto.IcResiUserDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.enums.IcResiUserTableEnum;
import com.epmet.excel.support.ExportResiUserItemDTO;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import com.epmet.feign.EpmetMessageOpenFeignClient;
import com.epmet.feign.OperCustomizeOpenFeignClient;
import com.epmet.feign.OssFeignClient;
import com.epmet.service.IcResiUserImportService;
import com.epmet.service.IcResiUserService;
import com.epmet.service.ImportTaskService;
import jodd.io.FileUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils;
@ -94,7 +95,7 @@ import java.util.stream.Collectors;
@Slf4j
@RestController
@RequestMapping("icresiuser")
public class IcResiUserController {
public class IcResiUserController implements ResultDataResolver {
/**
* 居民上传临时目录
@ -124,9 +125,6 @@ public class IcResiUserController {
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient;
@Autowired
private LoginUserUtil loginUserUtil;
@Autowired
private ImportTaskService importTaskService;
/**
* 模板枚举
@ -446,14 +444,9 @@ public class IcResiUserController {
String importTaskId;
// 记录导入任务
if (importTaskService.existsProcessingTask(operatorId, ImportTaskConstants.BIZ_TYPE_RESI)) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),
"已存在执行中的导入任务,请等待执行完成。",
"已存在执行中的导入任务,请等待执行完成。");
} else {
importTaskId = importTaskService.createProcessTask(operatorId, ImportTaskConstants.BIZ_TYPE_RESI);
}
importTaskId = icResiUserImportService.createImportTaskRecord(operatorId, ImportTaskConstants.BIZ_TYPE_RESI);
// 开始执行导入
Path savePath = null;
try {
String fileName = UUID.randomUUID().toString().concat(".").concat(extension);
@ -467,9 +460,8 @@ public class IcResiUserController {
String errorMsg = ExceptionUtils.getThrowableErrorStackTrace(e);
log.error("【导入居民信息失败】导入失败:{}", errorMsg);
// 要将导入任务状态设置为结束但不成功
importTaskService.finish(importTaskId, ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL, operatorId, null, e.getMessage());
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
// 要将导入任务状态设置为结束但不成功。不报错即成功,没有返回值 TODO 此处要改,将oss返回的路径存储到resultDescPath中
icResiUserImportService.finishImportTask(importTaskId, operatorId, ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL, null, null);
} finally {
try {
if (savePath != null){

18
epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserImportService.java

@ -13,4 +13,22 @@ import java.util.List;
public interface IcResiUserImportService {
void importIcResiInfoFromExcel(String importTaskId, List<FormItemResult> formItemList, String excelPathName, HttpServletResponse response);
/**
* 创建导入任务
* @param operatorId
* @param bizType
* @return
*/
String createImportTaskRecord(String operatorId, String bizType);
/**
* 完成导入任务
* @param importTaskId 任务ID
* @param operatorId 操作者ID
* @param processStatus 处理状态, ImportTaskConstants.PROCESS_STATUS_*
* @param resultDesc 结果描述非必填
* @param resultDescPath 结果描述文件excel等文件有错误的话需要传入成功则不需要
*/
void finishImportTask(String importTaskId, String operatorId, String processStatus, String resultDesc, String resultDescPath);
}

96
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java

@ -25,7 +25,7 @@ import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.security.user.LoginUserUtil;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.ImportTaskConstants;
import com.epmet.constants.ImportTaskConstants;
import com.epmet.dao.IcResiUserDao;
import com.epmet.dao.IcUserChangeDetailedDao;
import com.epmet.dao.IcUserChangeRecordDao;
@ -39,10 +39,7 @@ import com.epmet.entity.IcUserChangeRecordEntity;
import com.epmet.entity.IcUserTransferRecordEntity;
import com.epmet.enums.IcResiUserTableEnum;
import com.epmet.excel.handler.IcResiImportDynamicExcelListener;
import com.epmet.feign.EpmetAdminOpenFeignClient;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.feign.OperCustomizeOpenFeignClient;
import com.epmet.feign.*;
import com.epmet.service.*;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
@ -130,8 +127,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
private RedisUtils redisUtils;
@Autowired
private ImportTaskService importTaskService;
private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient;
/**
* 字表中不需要的列
@ -294,11 +290,9 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
// 更新上传记录
if (hasErrorRows) {
importTaskService.finish(importTaskId, ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL, loginUserId,
null, null);
finishImportTask(importTaskId, loginUserId, ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL,null, null);
} else {
importTaskService.finish(importTaskId, ImportTaskConstants.PROCESS_STATUS_FINISHED_SUCCESS, loginUserId,
null, null);
finishImportTask(importTaskId, loginUserId, ImportTaskConstants.PROCESS_STATUS_FINISHED_SUCCESS,null, null);
}
} catch (Exception e) {
@ -1793,45 +1787,45 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
return recordEntity;
}
/**
* 创建导入任务
* @param operatorId
* @param bizType
* @return
*/
public String createImportTaskRecord(String operatorId, String bizType) {
ImportTaskCommonFormDTO importTaskForm = new ImportTaskCommonFormDTO();
importTaskForm.setOperatorId(operatorId);
importTaskForm.setBizType(bizType);
ImportTaskCommonResultDTO resultDTO = getResultDataOrThrowsException(commonServiceOpenFeignClient.createImportTask(importTaskForm),
ServiceConstant.EPMET_COMMON_SERVICE,
EpmetErrorCode.SERVER_ERROR.getCode(),
"【居民信息导入】创建导入任务记录失败",
"【居民信息导入】创建导入任务记录失败");
return resultDTO.getTaskId();
}
//private IcUserTransferRecordEntity fillTransferRecord(String resiId, String resiName, String operatorId, String operatorName, String oldCustomerId,
// String oldAgencyId, String oldAgencyName, String oldGridId, String oldGridName, String neighborhoodId,
// String neighborhoodName, String oldBuildingId, String oldBuildingName, ) {
//IcUserTransferRecordEntity recordEntity = new IcUserTransferRecordEntity();
//recordEntity.setIcUserId();
//recordEntity.setOperatorId();
//recordEntity.setIcUserName();
//recordEntity.setOperatorName();
//recordEntity.setOldCustomerId();
//recordEntity.setOldAgencyId();
//recordEntity.setOldAgencyName();
//recordEntity.setOldGridId();
//recordEntity.setOldGridName();
//recordEntity.setOldNeighborHoodId();
//recordEntity.setOldNeighborHoodName();
//recordEntity.setOldBuildingId();
//recordEntity.setOldBuildingName();
//recordEntity.setOldBuildingUnitId();
//recordEntity.setOldBuildingUnitName();
//recordEntity.setOldHouseId();
//recordEntity.setOldHouseName();
//recordEntity.setTransferTime();
//recordEntity.setRemark();
//recordEntity.setNewCustomerId();
//recordEntity.setNewAgencyId();
//recordEntity.setNewAgencyName();
//recordEntity.setNewGridId();
//recordEntity.setNewGridName();
//recordEntity.setNewNeighborHoodId();
//recordEntity.setNewNeighborHoodName();
//recordEntity.setNewBuildingId();
//recordEntity.setNewBuildingName();
//recordEntity.setNewBuildingUnitId();
//recordEntity.setNewBuildingUnitName();
//recordEntity.setNewHouseId();
//recordEntity.setNewHouseName();
//}
/**
* 完成导入任务
* @param importTaskId 任务ID
* @param operatorId 操作者ID
* @param processStatus 处理状态, ImportTaskConstants.PROCESS_STATUS_*
* @param resultDesc 结果描述非必填
* @param resultDescPath 结果描述文件excel等文件有错误的话需要传入成功则不需要
*/
public void finishImportTask(String importTaskId, String operatorId, String processStatus, String resultDesc, String resultDescPath) {
ImportTaskCommonFormDTO importFinishTaskForm = new ImportTaskCommonFormDTO();
importFinishTaskForm.setTaskId(importTaskId);
importFinishTaskForm.setProcessStatus(processStatus);
importFinishTaskForm.setOperatorId(operatorId);
importFinishTaskForm.setResultDesc(resultDesc);
importFinishTaskForm.setResultDescFilePath(resultDescPath);
Result result = commonServiceOpenFeignClient.finishImportTask(importFinishTaskForm);
if (result == null || !result.success()) {
log.error("【居民信息导入】结束导入任务失败:taskId:{}, processStatus:{}, operatorId:{}, resultDesc:{}, resultDescPath:{}",
importTaskId, processStatus, operatorId, resultDesc, resultDescPath);
}
}
}

Loading…
Cancel
Save