Browse Source

社区自组织添加分类,导入导出新增修改列表已添加

dev
yinzuomei 3 years ago
parent
commit
225d1fe5bb
  1. 1
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/DictTypeEnum.java
  2. 3
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/AddCommunitySelfOrganizationFormDTO.java
  3. 6
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/EditCommunitySelfOrganizationFormDTO.java
  4. 9
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/CommunitySelfOrganizationListDTO.java
  5. 5
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcCommunitySelfOrganizationEntity.java
  6. 3
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/ExportCommunitySelfOrganizationExcel.java
  7. 4
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/ImportCommunitySelfOrganization.java
  8. 21
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcCommunitySelfOrganizationServiceImpl.java
  9. 1
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcCommunitySelfOrganizationDao.xml
  10. BIN
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/templates/self_org_import_template.xlsx

1
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/DictTypeEnum.java

@ -23,6 +23,7 @@ public enum DictTypeEnum {
PATROL_WORK_TYPE("patrol_work_type", "例行工作分类", 13), PATROL_WORK_TYPE("patrol_work_type", "例行工作分类", 13),
GRID_TYPE("grid_type", "网格类型", 12), GRID_TYPE("grid_type", "网格类型", 12),
ITEM_TYPE_QUERY("item_type_query","居民信息组件查询方式",14), ITEM_TYPE_QUERY("item_type_query","居民信息组件查询方式",14),
SELF_ORG_CATEGORY("self_org_category","社区自组织分类",15),
; ;
private final String code; private final String code;

3
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/AddCommunitySelfOrganizationFormDTO.java

@ -26,6 +26,9 @@ public class AddCommunitySelfOrganizationFormDTO implements Serializable {
@NotBlank(message = "organizationName不能为空",groups = AddCommunitySelfOrganizationForm.class) @NotBlank(message = "organizationName不能为空",groups = AddCommunitySelfOrganizationForm.class)
private String organizationName; private String organizationName;
@NotBlank(message = "分类不能为空", groups = AddCommunitySelfOrganizationForm.class)
private String categoryCode;
/** /**
* 组织人数 * 组织人数
*/ */

6
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/EditCommunitySelfOrganizationFormDTO.java

@ -26,6 +26,12 @@ public class EditCommunitySelfOrganizationFormDTO implements Serializable {
@NotBlank(message = "organizationName不能为空",groups = EditCommunitySelfOrganizationForm.class) @NotBlank(message = "organizationName不能为空",groups = EditCommunitySelfOrganizationForm.class)
private String organizationName; private String organizationName;
/**
* 分类编码
*/
@NotBlank(message = "categoryCode不能为空",groups = EditCommunitySelfOrganizationForm.class)
private String categoryCode;
/** /**
* 组织人数 * 组织人数
*/ */

9
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/CommunitySelfOrganizationListDTO.java

@ -33,6 +33,15 @@ public class CommunitySelfOrganizationListDTO implements Serializable {
*/ */
private String organizationName; private String organizationName;
/**
* 分类来源于字典表dictType=self_org_category;
*/
private String categoryCode;
/**
* 分类名称
*/
private String categoryName;
/** /**
* 服务事项 * 服务事项
*/ */

5
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcCommunitySelfOrganizationEntity.java

@ -67,6 +67,11 @@ public class IcCommunitySelfOrganizationEntity extends BaseEpmetEntity {
*/ */
private String organizationName; private String organizationName;
/**
* 分类来源于字典表dictType=self_org_category;
*/
private String categoryCode;
/** /**
* 组织人数 * 组织人数
*/ */

3
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/ExportCommunitySelfOrganizationExcel.java

@ -15,6 +15,9 @@ public class ExportCommunitySelfOrganizationExcel {
@Excel(name = "组织名称", width = 40, needMerge = true) @Excel(name = "组织名称", width = 40, needMerge = true)
private String organizationName; private String organizationName;
@Excel(name = "分类", width = 40, needMerge = true)
private String categoryName;
@Excel(name = "组织人数", width = 20, needMerge = true) @Excel(name = "组织人数", width = 20, needMerge = true)
private Integer organizationPersonCount; private Integer organizationPersonCount;

4
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/excel/ImportCommunitySelfOrganization.java

@ -20,6 +20,10 @@ public class ImportCommunitySelfOrganization extends ExcelVerifyInfo {
@NotBlank(message = "不能为空") @NotBlank(message = "不能为空")
private String organizationName; private String organizationName;
@Excel(name = "分类", needMerge = true)
@NotBlank(message = "不能为空")
private String categoryCode;
@Excel(name = "组织人数", needMerge = true) @Excel(name = "组织人数", needMerge = true)
//@NotNull(message = "不能为空") //@NotNull(message = "不能为空")
private Integer organizationPersonCount; private Integer organizationPersonCount;

21
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcCommunitySelfOrganizationServiceImpl.java

@ -12,6 +12,7 @@ import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.enums.DictTypeEnum;
import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.exception.ExceptionUtils;
@ -43,6 +44,7 @@ import com.epmet.entity.IcCommunitySelfOrganizationEntity;
import com.epmet.entity.IcCommunitySelfOrganizationPersonnelEntity; import com.epmet.entity.IcCommunitySelfOrganizationPersonnelEntity;
import com.epmet.excel.CommunitySelfOrgImportExcel; import com.epmet.excel.CommunitySelfOrgImportExcel;
import com.epmet.excel.ImportCommunitySelfOrganization; import com.epmet.excel.ImportCommunitySelfOrganization;
import com.epmet.feign.EpmetAdminOpenFeignClient;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient; import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import com.epmet.feign.OssFeignClient; import com.epmet.feign.OssFeignClient;
import com.epmet.service.IcCommunitySelfOrganizationPersonnelService; import com.epmet.service.IcCommunitySelfOrganizationPersonnelService;
@ -51,6 +53,7 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileItemFactory; import org.apache.commons.fileupload.FileItemFactory;
import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.fileupload.disk.DiskFileItemFactory;
@ -93,6 +96,8 @@ public class IcCommunitySelfOrganizationServiceImpl extends BaseServiceImpl<IcCo
private OssFeignClient ossFeignClient; private OssFeignClient ossFeignClient;
@Autowired @Autowired
private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient; private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient;
@Autowired
private EpmetAdminOpenFeignClient adminOpenFeignClient;
@Override @Override
public PageData<IcCommunitySelfOrganizationDTO> page(Map<String, Object> params) { public PageData<IcCommunitySelfOrganizationDTO> page(Map<String, Object> params) {
@ -328,11 +333,16 @@ public class IcCommunitySelfOrganizationServiceImpl extends BaseServiceImpl<IcCo
} }
List<CommunitySelfOrganizationListDTO> resultDTOs = baseDao.selectCommunitySelfOrganizationList(formDTO); List<CommunitySelfOrganizationListDTO> resultDTOs = baseDao.selectCommunitySelfOrganizationList(formDTO);
if (CollectionUtils.isNotEmpty(resultDTOs)){ if (CollectionUtils.isNotEmpty(resultDTOs)){
//获取分类名称字典
Result<Map<String, String>> dictMapRes=adminOpenFeignClient.dictMap(DictTypeEnum.SELF_ORG_CATEGORY.getCode());
Map<String, String> dictMap = dictMapRes.success() && MapUtils.isNotEmpty(dictMapRes.getData()) ? dictMapRes.getData() : new HashMap<>();
result.setTotal(resultDTOs.size()); result.setTotal(resultDTOs.size());
AtomicReference<Integer> sort = new AtomicReference<>(NumConstant.ONE); AtomicReference<Integer> sort = new AtomicReference<>(NumConstant.ONE);
for (CommunitySelfOrganizationListDTO r : resultDTOs) { for (CommunitySelfOrganizationListDTO r : resultDTOs) {
r.setSort(sort.getAndSet(sort.get() + NumConstant.ONE)); r.setSort(sort.getAndSet(sort.get() + NumConstant.ONE));
r.setScore(null == pointMap.get(r.getOrgId()) ? NumConstant.ZERO : pointMap.get(r.getOrgId())); r.setScore(null == pointMap.get(r.getOrgId()) ? NumConstant.ZERO : pointMap.get(r.getOrgId()));
//赋值分类名称
r.setCategoryName(dictMap.get(r.getCategoryCode()));
} }
result.setList(resultDTOs); result.setList(resultDTOs);
} }
@ -538,7 +548,8 @@ public class IcCommunitySelfOrganizationServiceImpl extends BaseServiceImpl<IcCo
iterator.remove(); iterator.remove();
} }
} }
Result<Map<String, String>> dictMapRes = adminOpenFeignClient.dictMap(DictTypeEnum.SELF_ORG_CATEGORY.getCode());
Map<String, String> categoryMap = dictMapRes.success() && MapUtils.isNotEmpty(dictMapRes.getData()) ? dictMapRes.getData() : new HashMap<>();
list.forEach(l -> { list.forEach(l -> {
IcCommunitySelfOrganizationEntity e = ConvertUtils.sourceToTarget(l, IcCommunitySelfOrganizationEntity.class); IcCommunitySelfOrganizationEntity e = ConvertUtils.sourceToTarget(l, IcCommunitySelfOrganizationEntity.class);
e.setCustomerId(tokenDto.getCustomerId()); e.setCustomerId(tokenDto.getCustomerId());
@ -547,7 +558,13 @@ public class IcCommunitySelfOrganizationServiceImpl extends BaseServiceImpl<IcCo
e.setPid(agencyInfo.getPid()); e.setPid(agencyInfo.getPid());
e.setPids(agencyInfo.getPids()); e.setPids(agencyInfo.getPids());
e.setOrganizationCreatedTime(DateUtils.parse(l.getOrganizationCreatedTime(), DATE_PATTERN)); e.setOrganizationCreatedTime(DateUtils.parse(l.getOrganizationCreatedTime(), DATE_PATTERN));
//赋值分类编码,excel输入的是分类名称,需要找到admin字典库中的key
for (String key : categoryMap.keySet()) {
if (StringUtils.isNotBlank(categoryMap.get(key)) && categoryMap.get(key).equals(e.getCategoryCode())) {
e.setCategoryCode(categoryMap.get(key));
break;
}
}
List<IcCommunitySelfOrganizationPersonnelEntity> persons = new ArrayList<>(); List<IcCommunitySelfOrganizationPersonnelEntity> persons = new ArrayList<>();
AtomicReference<Boolean> bl = new AtomicReference<>(false); AtomicReference<Boolean> bl = new AtomicReference<>(false);
StringBuffer msg = new StringBuffer(""); StringBuffer msg = new StringBuffer("");

1
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcCommunitySelfOrganizationDao.xml

@ -46,6 +46,7 @@
<select id="selectCommunitySelfOrganizationList" resultMap="selectCommunitySelfOrganizationListMap" parameterType="com.epmet.dto.form.CommunitySelfOrganizationListFormDTO"> <select id="selectCommunitySelfOrganizationList" resultMap="selectCommunitySelfOrganizationListMap" parameterType="com.epmet.dto.form.CommunitySelfOrganizationListFormDTO">
SELECT SELECT
so.ORGANIZATION_NAME AS organizationName, so.ORGANIZATION_NAME AS organizationName,
so.CATEGORY_CODE AS categoryCode,
so.ORGANIZATION_PERSON_COUNT AS organizationPersonCount, so.ORGANIZATION_PERSON_COUNT AS organizationPersonCount,
IFNULL(DATE_FORMAT(so.ORGANIZATION_CREATED_TIME,'%Y-%m-%d'),DATE_FORMAT(so.CREATED_TIME,'%Y-%m-%d')) AS organizationCreatedTime, IFNULL(DATE_FORMAT(so.ORGANIZATION_CREATED_TIME,'%Y-%m-%d'),DATE_FORMAT(so.CREATED_TIME,'%Y-%m-%d')) AS organizationCreatedTime,
so.PRINCIPAL_NAME AS principalName, so.PRINCIPAL_NAME AS principalName,

BIN
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/templates/self_org_import_template.xlsx

Binary file not shown.
Loading…
Cancel
Save