Browse Source

Merge remote-tracking branch 'origin/dev_5big_coverage' into dev_5big_coverage

feature/teamB_zz_wgh
wangxianzhang 3 years ago
parent
commit
b339e434fc
  1. 2
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/OptionResultDTO.java
  2. 1
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/SelfOrgCategoryEnum.java
  3. 7
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/CoverageController.java
  4. 5
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcCommunitySelfOrganizationPersonnelDTO.java
  5. 5
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/CommunitySelfOrganizationListDTO.java
  6. 5
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcCommunitySelfOrganizationPersonnelEntity.java
  7. 1
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcCommunitySelfOrganizationServiceImpl.java
  8. 1
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/V0.0.20__selforg_icresiuserid.sql
  9. 6
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcCommunitySelfOrganizationDao.xml
  10. 3
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditPlaceOrgFormDTO.java
  11. 2
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EnterpriseFormDTO.java
  12. 64
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EnterprisePageFormDTO.java
  13. 4
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/GetListPlaceOrgFormDTO.java
  14. 9
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/EnterpriseDetailDTO.java
  15. 2
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/PlaceOrgDetailResultDTO.java
  16. 97
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcEnterpriseController.java
  17. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcPlaceOrgController.java
  18. 19
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcEnterpriseDao.java
  19. 6
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/IcDangerousChemicalsEntity.java
  20. 7
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/IcEnterpriseEntity.java
  21. 94
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/EnterpriseExportExcelDTO.java
  22. 127
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/DangerousChemicalsImportListener.java
  23. 9
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/DangerousChemicalsModel.java
  24. 14
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcEnterpriseService.java
  25. 1
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java
  26. 4
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcDangerousChemicalsServiceImpl.java
  27. 69
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcEnterpriseServiceImpl.java
  28. 13
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPlaceOrgServiceImpl.java
  29. 3
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml
  30. 57
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcEnterpriseDao.xml
  31. 11
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcEnterprisePatrolAttachmentDao.xml
  32. 7
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPlaceOrgDao.xml
  33. 30
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/ResiVolunteerSelectDTO.java
  34. 15
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java
  35. 9
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java
  36. 42
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java

2
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/OptionResultDTO.java

@ -23,7 +23,7 @@ public class OptionResultDTO implements Serializable {
private List<OptionResultDTO> children;
private Boolean usableFlag;
private String type;
private String pid;
/**
* desc:递归获取当前节点的 所有子节点

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

@ -19,6 +19,7 @@ public enum SelfOrgCategoryEnum {
LYJLB("lyjlb", "老友俱乐部", "#8fc41e", 3),
ZAXLD("zaxld", "治安巡逻队", "#00a1be", 4),
OTHER("other", "其他", "#0067b6", 5),
YJDW("yjdw","应急队伍","#e5007f",6)
;
private final String code;

7
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/CoverageController.java

@ -1,9 +1,11 @@
package com.epmet.dataaggre.controller;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dataaggre.dto.govorg.form.CoverageAnalisisDataListFormDTO;
import com.epmet.dataaggre.dto.govorg.result.CoverageAnalisisDataListResultDTO;
import com.epmet.dataaggre.service.CoverageService;
import com.github.pagehelper.PageInfo;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
@ -28,7 +30,7 @@ public class CoverageController {
* @return
*/
@RequestMapping("dataList")
public Result<List<CoverageAnalisisDataListResultDTO>> dataList(@RequestBody CoverageAnalisisDataListFormDTO input) {
public Result<PageData<CoverageAnalisisDataListResultDTO>> dataList(@RequestBody CoverageAnalisisDataListFormDTO input) {
List<String> coverageTypes = input.getCoverageTypes();
List<String> categoryKeys = input.getCategoryKeys();
if (CollectionUtils.isEmpty(coverageTypes)) {
@ -37,7 +39,8 @@ public class CoverageController {
List<CoverageAnalisisDataListResultDTO> l = coverageService.analysisDataList(coverageTypes, categoryKeys,
input.getSearch(), input.getPageNo(), input.getPageSize(), input.getIsPage());
return new Result<List<CoverageAnalisisDataListResultDTO>>().ok(l);
PageInfo<CoverageAnalisisDataListResultDTO> pageInfo = new PageInfo<>(l);
return new Result<PageData<CoverageAnalisisDataListResultDTO>>().ok(new PageData<>(l, pageInfo.getTotal()));
}
}

5
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcCommunitySelfOrganizationPersonnelDTO.java

@ -51,6 +51,11 @@ public class IcCommunitySelfOrganizationPersonnelDTO implements Serializable {
*/
private String orgId;
/**
* 居民信息当中的志愿者ic_resi_user.id
*/
private String icResiUserId;
/**
* 人员姓名
*/

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

@ -18,6 +18,11 @@ public class CommunitySelfOrganizationListDTO implements Serializable {
private static final long serialVersionUID = 3208034033470533749L;
/**
* 本条记录所属组织id
*/
private String agencyId;
/**
* 排序
*/

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

@ -45,6 +45,11 @@ public class IcCommunitySelfOrganizationPersonnelEntity extends BaseEpmetEntity
*/
private String orgId;
/**
* 居民信息当中的志愿者ic_resi_user.id
*/
private String icResiUserId;
/**
* 人员姓名
*/

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

@ -320,6 +320,7 @@ public class IcCommunitySelfOrganizationServiceImpl extends BaseServiceImpl<IcCo
if (CollectionUtils.isNotEmpty(servicePointList)){
pointMap = servicePointList.stream().collect(Collectors.toMap(ServicePointDTO::getServerId, ServicePointDTO::getPoint));
}
//当前工作人员所属的组织id
formDTO.setAgencyId(staffInfo.getAgencyId());
formDTO.setCustomerId(tokenDto.getCustomerId());
final int[] i = {(formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize() + NumConstant.ONE};

1
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/V0.0.20__selforg_icresiuserid.sql

@ -0,0 +1 @@
alter table ic_community_self_organization_personnel add COLUMN IC_RESI_USER_ID VARCHAR(64) DEFAULT '' COMMENT '居民信息当中的志愿者ic_resi_user.id'AFTER ORG_ID;

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

@ -42,13 +42,15 @@
person_phone as personPhone,
ID,
CUSTOMER_ID,
ORG_ID
ORG_ID,
IC_RESI_USER_ID
from ic_community_self_organization_personnel
where org_id = #{orgId}
and del_flag = 0
</select>
<select id="selectCommunitySelfOrganizationList" resultMap="selectCommunitySelfOrganizationListMap" parameterType="com.epmet.dto.form.CommunitySelfOrganizationListFormDTO">
SELECT
so.ORG_ID as agencyId,
so.ORGANIZATION_NAME AS organizationName,
so.CATEGORY_CODE AS categoryCode,
so.ORGANIZATION_PERSON_COUNT AS organizationPersonCount,
@ -63,7 +65,7 @@
FROM ic_community_self_organization so
WHERE so.DEL_FLAG = 0
<if test="null != agencyId and agencyId != '' ">
AND so.ORG_ID = #{agencyId}
AND (so.ORG_ID = #{agencyId} or so.PIDS like concat('%',#{agencyId},'%') )
</if>
AND so.CUSTOMER_ID = #{customerId}
<if test="null != organizationName and organizationName != '' ">

3
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditPlaceOrgFormDTO.java

@ -79,6 +79,7 @@ public class EditPlaceOrgFormDTO implements Serializable {
public interface Del { }
public interface Detail { }
private String currentStaffId;
private String customerId;
}

2
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EnterpriseFormDTO.java

@ -17,6 +17,8 @@ public class EnterpriseFormDTO implements Serializable {
* token赋值
*/
private String customerId;
private String currentStaffId;
/**
* 网格Id场所区域

64
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EnterprisePageFormDTO.java

@ -0,0 +1,64 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
/**
* 企事业单位
*/
@Data
public class EnterprisePageFormDTO implements Serializable {
/**
* 场所区域
*/
private String gridId;
/**
* 场所类型
*/
private String placeType;
/**
* 场所名称
*/
private String placeOrgName;
/**
* 规模
*/
private String scale;
/**
* 联系电话
*/
private String mobile;
/**
* 巡查结果0:合格 1:不合格
*/
private String result;
/**
* 隐患明细
*/
private String detailed;
private Integer pageNo = 1;
private Integer pageSize = 20;
/**
* 列表查询默认分页
* 导出不分页
*/
private Boolean pageFlag;
//tokenDto.customerId
private String customerId;
//tokenDto.userId
private String currentStaffId;
/**
* 当前登录用户的所属组织id
*/
private String staffAgencyId;
}

4
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/GetListPlaceOrgFormDTO.java

@ -54,7 +54,7 @@ public class GetListPlaceOrgFormDTO implements Serializable {
private String placeOrgId;
//token中userId
private String staffId;
//token中userId所属组织的pid
private String pids;
//token中userId所属组织
private String agencyId;
}

9
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/EnterpriseDetailDTO.java

@ -1,15 +1,19 @@
package com.epmet.dto.result;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 场所详情
*/
@Data
public class EnterpriseDetailDTO implements Serializable {
private String enterpriseId;
/**
* 网格Id场所区域
*/
@ -95,4 +99,9 @@ public class EnterpriseDetailDTO implements Serializable {
*/
private String latestResult;
/**
* 最新检查时间
*/
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date latestPatrolTime;
}

2
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/PlaceOrgDetailResultDTO.java

@ -18,6 +18,8 @@ public class PlaceOrgDetailResultDTO implements Serializable {
private String gridId;
//场所区域名称
private String gridName;
private String agencyId;
//场所地址
private String address;
//场所类型名称[九小场所Value值]

97
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcEnterpriseController.java

@ -1,15 +1,30 @@
package com.epmet.controller;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.poi.excel.handler.FreezeAndFilter;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.EnterpriseFormDTO;
import com.epmet.dto.form.EnterprisePageFormDTO;
import com.epmet.dto.form.EnterprisePatrolFormDTO;
import com.epmet.dto.result.EnterpriseDetailDTO;
import com.epmet.dto.result.EnterprisePatrolResultDTO;
import com.epmet.excel.EnterpriseExportExcelDTO;
import com.epmet.service.IcEnterpriseService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
@ -19,8 +34,11 @@ import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.net.URLEncoder;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -30,6 +48,7 @@ import java.util.Map;
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-06-17
*/
@Slf4j
@RestController
@RequestMapping("enterprise")
public class IcEnterpriseController {
@ -47,12 +66,74 @@ public class IcEnterpriseController {
@PostMapping("addOrUpdate")
public Result addOrUpdate(@LoginUser TokenDto tokenDto, @RequestBody EnterpriseFormDTO formDTO) {
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setCurrentStaffId(tokenDto.getUserId());
ValidatorUtils.validateEntity(EnterpriseFormDTO.AddShow.class);
Map<String, String> map = new HashMap<>();
map.put("enterpriseId", icEnterpriseService.addOrUpdate(formDTO));
return new Result().ok(map);
}
/**
* 企事业单位列表查询
* @param tokenDto
* @param formDTO
* @return
*/
@PostMapping("list")
public Result<PageData<EnterpriseDetailDTO>> list(@LoginUser TokenDto tokenDto, @RequestBody EnterprisePageFormDTO formDTO){
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setCurrentStaffId(tokenDto.getUserId());
formDTO.setPageFlag(true);
return new Result<PageData<EnterpriseDetailDTO>>().ok(icEnterpriseService.list(formDTO));
}
/**
* 企事业单位列表导出
* @param tokenDto
* @param formDTO
* @param response
* @return
* @throws IOException
*/
@PostMapping("export")
public void exportEnterprise(@LoginUser TokenDto tokenDto, @RequestBody EnterprisePageFormDTO formDTO, HttpServletResponse response) throws IOException {
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setCurrentStaffId(tokenDto.getUserId());
formDTO.setPageFlag(false);
ExcelWriter excelWriter = null;
formDTO.setPageNo(NumConstant.ONE);
formDTO.setPageSize(NumConstant.TEN_THOUSAND);
try {
String fileName = "企事业单位" + DateUtils.format(new Date()) + ".xlsx";
excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), EnterpriseExportExcelDTO.class).build();
WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").registerWriteHandler(new FreezeAndFilter()).build();
PageData<EnterpriseDetailDTO> data = null;
List<EnterpriseExportExcelDTO> list = null;
do {
data = icEnterpriseService.list(formDTO);
list = ConvertUtils.sourceToTarget(data.getList(), EnterpriseExportExcelDTO.class);
formDTO.setPageNo(formDTO.getPageNo() + NumConstant.ONE);
excelWriter.write(list, writeSheet);
} while (CollectionUtils.isNotEmpty(list) && list.size() == formDTO.getPageSize());
} catch (EpmetException e) {
response.reset();
response.setCharacterEncoding("UTF-8");
response.setHeader("content-type", "application/json; charset=UTF-8");
PrintWriter printWriter = response.getWriter();
Result<Object> result = new Result<>().error(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), e.getMsg());
printWriter.write(JSON.toJSONString(result));
printWriter.close();
} catch (Exception e) {
log.error("企事业单位导出异常export exception", e);
} finally {
if (excelWriter != null) {
excelWriter.finish();
}
}
}
/**
* 场所详情
*
@ -65,10 +146,20 @@ public class IcEnterpriseController {
return new Result<EnterpriseDetailDTO>().ok(icEnterpriseService.queryEnterpriseDetail(tokenDto.getCustomerId(), enterpriseId));
}
/**
* 下载社区自组织导入模板
* 企事业单位-删除场所
*
* @param enterpriseId
* @return
*/
@PostMapping("delete/{enterpriseId}")
public Result delete(@PathVariable("enterpriseId") String enterpriseId) {
icEnterpriseService.delete(enterpriseId);
return new Result();
}
/**
* 企事业单位导入模板
* @param response
* @throws IOException
*/
@ -80,7 +171,7 @@ public class IcEnterpriseController {
response.setHeader(HttpHeaders.CONTENT_TYPE, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + URLEncoder.encode("企事业单位导入模板", "UTF-8") + ".xlsx");
InputStream is = this.getClass().getClassLoader().getResourceAsStream("templates/enterprise_patrol.xlsx");
InputStream is = this.getClass().getClassLoader().getResourceAsStream("excel/enterprise_patrol_import_tem.xlsx");
try {
ServletOutputStream os = response.getOutputStream();
IOUtils.copy(is, os);

2
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcPlaceOrgController.java

@ -66,6 +66,8 @@ public class IcPlaceOrgController {
**/
@PostMapping("edit")
public Result edit(@LoginUser TokenDto tokenDto, @RequestBody EditPlaceOrgFormDTO formDTO) {
formDTO.setCurrentStaffId(tokenDto.getUserId());
formDTO.setCustomerId(tokenDto.getCustomerId());
ValidatorUtils.validateEntity(formDTO, EditPlaceOrgFormDTO.Edit.class);
placeOrgService.edit(formDTO);
return new Result();

19
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcEnterpriseDao.java

@ -1,8 +1,14 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.EnterprisePageFormDTO;
import com.epmet.dto.result.EnterpriseDetailDTO;
import com.epmet.entity.IcEnterpriseEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
/**
* 企事业单位表
@ -12,5 +18,16 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface IcEnterpriseDao extends BaseDao<IcEnterpriseEntity> {
int updateLatestPatrol(@Param("enterpriseId") String enterpriseId,
@Param("updatedTime")Date updatedTime,
@Param("result")String result,
@Param("userId")String userId);
/**
* 企事业单位列表
* @param formDTO
* @return
*/
List<EnterpriseDetailDTO> selectList(EnterprisePageFormDTO formDTO);
}

6
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/IcDangerousChemicalsEntity.java

@ -95,4 +95,10 @@ public class IcDangerousChemicalsEntity extends BaseEpmetEntity {
@TableField(exist = false)
private String categoryName;
@TableField(exist = false)
private Integer rowNum;
@TableField(exist = false)
private Boolean existStatus = false;
}

7
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/IcEnterpriseEntity.java

@ -5,6 +5,8 @@ import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 企事业单位表
*
@ -92,4 +94,9 @@ public class IcEnterpriseEntity extends BaseEpmetEntity {
* 最新巡查结果0:合格 1:不合格
*/
private String latestResult;
/**
* 最新检查时间
*/
private Date latestPatrolTime;
}

94
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/EnterpriseExportExcelDTO.java

@ -0,0 +1,94 @@
package com.epmet.excel;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import lombok.Data;
/**
* 企事业单位导出excel
*/
@Data
public class EnterpriseExportExcelDTO {
/**
* 场所类型来源于ic_coverage_category_dict
*/
@ExcelIgnore
private String placeType;
/**
* 场所类型名称
*/
@ExcelProperty(value = "场所类型")
@ColumnWidth(25)
private String placeTypeName;
/**
* 网格所属的组织Id
*/
@ExcelIgnore
private String agencyId;
@ExcelProperty(value = "所属组织")
@ColumnWidth(25)
private String agencyName;
/**
* 网格Id场所区域
*/
@ExcelIgnore
private String gridId;
@ExcelProperty(value = "场所区域")
@ColumnWidth(25)
private String gridName;
/**
* 场所名称
*/
@ExcelProperty(value = "场所名称")
@ColumnWidth(25)
private String placeOrgName;
/**
* 场所地址
*/
@ExcelProperty(value = "场所地址")
@ColumnWidth(30)
private String address;
/**
* 字典value,场所规模
* 0:10人以下
* 1:10-20人
* 2:21-40人
* 3:41-100人
* 4:100人以上
*/
@ExcelIgnore
private String scale;
/**
* 规模名称
*/
@ExcelProperty(value = "规模")
@ColumnWidth(15)
private String scaleName;
/**
* 场所负责人
*/
@ExcelProperty(value = "负责人")
@ColumnWidth(20)
private String personInCharge;
/**
* 负责人电话
*/
@ExcelProperty(value = "联系电话")
@ColumnWidth(20)
private String mobile;
}

127
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/DangerousChemicalsImportListener.java

@ -2,15 +2,21 @@ package com.epmet.model;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.enums.CoveragePlaceTypeEnum;
import com.epmet.commons.tools.enums.DictTypeEnum;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.ExceptionUtils;
import com.epmet.commons.tools.exception.ValidateException;
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dao.IcDangerousChemicalsDao;
import com.epmet.dto.result.IcCoverageCategoryDictListResultDTO;
import com.epmet.entity.IcDangerousChemicalsEntity;
import com.epmet.excel.IcCityManagementExcel;
import com.epmet.feign.EpmetAdminOpenFeignClient;
import com.epmet.service.CoverageService;
import com.epmet.service.IcDangerousChemicalsService;
@ -39,73 +45,55 @@ public class DangerousChemicalsImportListener extends AnalysisEventListener<Dang
private EpmetAdminOpenFeignClient adminOpenFeignClient;
private CoverageService coverageService;
private AgencyInfoCache agencyInfo;
private IcDangerousChemicalsDao icDangerousChemicalsDao;
private List<DangerousChemicalsModel.RowRemarkMessage> errorRows = new ArrayList<>();
private List<DangerousChemicalsModel.RowRemarkMessage> otherRows = new ArrayList<>();
private List<IcDangerousChemicalsEntity> insertList = new ArrayList<>();
private Map<String,String> existMap = null;
public DangerousChemicalsImportListener(AgencyInfoCache agencyInfo, IcDangerousChemicalsService icDangerousChemicalsService, CoverageService coverageService,EpmetAdminOpenFeignClient adminOpenFeignClient){
public DangerousChemicalsImportListener(AgencyInfoCache agencyInfo, IcDangerousChemicalsService icDangerousChemicalsService, CoverageService coverageService, EpmetAdminOpenFeignClient adminOpenFeignClient, IcDangerousChemicalsDao icDangerousChemicalsDao){
this.agencyInfo = agencyInfo;
this.icDangerousChemicalsService = icDangerousChemicalsService;
this.coverageService = coverageService;
this.adminOpenFeignClient = adminOpenFeignClient;
this.icDangerousChemicalsDao = icDangerousChemicalsDao;
}
@Override
public void invoke(DangerousChemicalsModel data, AnalysisContext context) {
Integer rowNum = context.readRowHolder().getRowIndex() + NumConstant.ONE;
if (StringUtils.isBlank(data.getName())){
DangerousChemicalsModel.RowRemarkMessage row = ConvertUtils.sourceToTarget(data, DangerousChemicalsModel.RowRemarkMessage.class);
row.setRowNum(rowNum);
row.setErrorInfo("企业名称不能为空");
errorRows.add(row);
return;
}
if (StringUtils.isBlank(data.getCategoryName())){
DangerousChemicalsModel.RowRemarkMessage row = ConvertUtils.sourceToTarget(data, DangerousChemicalsModel.RowRemarkMessage.class);
row.setRowNum(rowNum);
row.setErrorInfo("企业类型不能为空");
errorRows.add(row);
return;
}
if (StringUtils.isBlank(data.getAddress())){
DangerousChemicalsModel.RowRemarkMessage row = ConvertUtils.sourceToTarget(data, DangerousChemicalsModel.RowRemarkMessage.class);
row.setRowNum(rowNum);
row.setErrorInfo("经营地址不能为空");
errorRows.add(row);
return;
}
if (data.getName().trim().length() > NumConstant.FIFTY){
DangerousChemicalsModel.RowRemarkMessage row = ConvertUtils.sourceToTarget(data, DangerousChemicalsModel.RowRemarkMessage.class);
row.setRowNum(rowNum);
row.setErrorInfo("企业名称长度超出50字限制");
errorRows.add(row);
return;
}
if (data.getPrincipalMobile().trim().length() > NumConstant.FIFTY){
DangerousChemicalsModel.RowRemarkMessage row = ConvertUtils.sourceToTarget(data, DangerousChemicalsModel.RowRemarkMessage.class);
row.setRowNum(rowNum);
row.setErrorInfo("联系电话长度超出50字限制");
errorRows.add(row);
return;
}
if (data.getAddress().trim().length() > NumConstant.FIFTY){
DangerousChemicalsModel.RowRemarkMessage row = ConvertUtils.sourceToTarget(data, DangerousChemicalsModel.RowRemarkMessage.class);
row.setRowNum(rowNum);
row.setErrorInfo("经营地址长度超出50字限制");
errorRows.add(row);
return;
}
IcDangerousChemicalsEntity e = ConvertUtils.sourceToTarget(data, IcDangerousChemicalsEntity.class);
e.setSourceType("import");
e.setAgencyId(agencyInfo.getId());
e.setCustomerId(agencyInfo.getCustomerId());
e.setAgencyIdPath(agencyInfo.getPids().equals(NumConstant.ZERO_STR) || agencyInfo.getPids().equals("") ? agencyInfo.getId() : agencyInfo.getPids().concat(":").concat(agencyInfo.getId()));
insertList.add(e);
if (insertList.size() == NumConstant.ONE_HUNDRED){
execPersist();
data.setRowNum(rowNum);
try {
existMap = null == existMap ? getExistMap(agencyInfo.getId()) : existMap;
ValidatorUtils.validateEntity(data);
if (StringUtils.isNotBlank(existMap.get(data.getName()))){
DangerousChemicalsModel.RowRemarkMessage errorRow = ConvertUtils.sourceToTarget(data, DangerousChemicalsModel.RowRemarkMessage.class);
errorRow.setErrorInfo("数据库存在该条数据");
errorRows.add(errorRow);
return;
}
IcDangerousChemicalsEntity e = ConvertUtils.sourceToTarget(data, IcDangerousChemicalsEntity.class);
e.setSourceType("import");
e.setAgencyId(agencyInfo.getId());
e.setCustomerId(agencyInfo.getCustomerId());
e.setAgencyIdPath(agencyInfo.getPids().equals(NumConstant.ZERO_STR) || agencyInfo.getPids().equals("") ? agencyInfo.getId() : agencyInfo.getPids().concat(":").concat(agencyInfo.getId()));
insertList.add(e);
if (insertList.size() == NumConstant.ONE_HUNDRED){
execPersist();
}
}catch (Exception e){
String errorMsg = null;
if (e instanceof ValidateException) {
errorMsg = ((ValidateException) e).getMsg();
} else {
errorMsg = "未知错误";
log.error("【重点危化品企业导入】出错:{}", ExceptionUtils.getErrorStackTrace(e));
}
DangerousChemicalsModel.RowRemarkMessage errorRow = ConvertUtils.sourceToTarget(data, DangerousChemicalsModel.RowRemarkMessage.class);
errorRow.setErrorInfo(errorMsg);
errorRows.add(errorRow);
}
}
@Override
@ -113,6 +101,16 @@ public class DangerousChemicalsImportListener extends AnalysisEventListener<Dang
execPersist();
}
public Map<String,String> getExistMap(String agencyId){
LambdaQueryWrapper<IcDangerousChemicalsEntity> tWrapper = new LambdaQueryWrapper<>();
tWrapper.eq(IcDangerousChemicalsEntity::getAgencyId, agencyId);
List<IcDangerousChemicalsEntity> entityList = icDangerousChemicalsDao.selectList(tWrapper);
Map<String,String> existMap = new HashMap<>(16);
if (CollectionUtils.isNotEmpty(entityList)){
existMap = entityList.stream().collect(Collectors.toMap(IcDangerousChemicalsEntity::getName,IcDangerousChemicalsEntity::getId,(v1,v2) -> v1));
}
return existMap;
}
/**
* Desc: 数据库插入
*/
@ -126,7 +124,7 @@ public class DangerousChemicalsImportListener extends AnalysisEventListener<Dang
}
Map<String, String> statusMap = statusRes.success() && MapUtils.isNotEmpty(statusRes.getData()) ? statusRes.getData() : new HashMap<>(16);
//企业类别字典数据
List<IcCoverageCategoryDictListResultDTO> dictList = coverageService.dictMap(agencyInfo.getCustomerId(), "dangerous_chemicals");
List<IcCoverageCategoryDictListResultDTO> dictList = coverageService.dictMap(agencyInfo.getCustomerId(), CoveragePlaceTypeEnum.DANGEROUS_CHEMICALS.getCode());
Map<String, String> dictMap = dictList.stream().collect(Collectors.toMap(IcCoverageCategoryDictListResultDTO::getValue, IcCoverageCategoryDictListResultDTO::getLabel));
insertList.forEach(i -> {
statusMap.forEach((k,v) -> {
@ -140,10 +138,31 @@ public class DangerousChemicalsImportListener extends AnalysisEventListener<Dang
}
});
});
icDangerousChemicalsService.insertBatch(insertList);
Map<String, Long> groupByName = insertList.stream().collect(Collectors.groupingBy(IcDangerousChemicalsEntity::getName, Collectors.counting()));
groupByName.forEach((k,v) -> {
if (v.compareTo(NumConstant.ONE_L) != NumConstant.ZERO){
insertList.forEach(i -> {
if (i.getName().equals(k)){
i.setExistStatus(true);
}
});
}
});
Map<Boolean, List<IcDangerousChemicalsEntity>> groupByStatus = insertList.stream().collect(Collectors.groupingBy(IcDangerousChemicalsEntity::getExistStatus));
if (CollectionUtils.isNotEmpty(groupByStatus.get(true))){
groupByStatus.get(true).forEach(t -> {
DangerousChemicalsModel.RowRemarkMessage errorRow = ConvertUtils.sourceToTarget(t, DangerousChemicalsModel.RowRemarkMessage.class);
errorRow.setErrorInfo("表格中存在重复数据");
errorRows.add(errorRow);
});
}
if (CollectionUtils.isNotEmpty(groupByStatus.get(false))){
icDangerousChemicalsService.insertBatch(groupByStatus.get(false));
}
}
} finally {
insertList.clear();
existMap = null;
}
}

9
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/DangerousChemicalsModel.java

@ -1,5 +1,6 @@
package com.epmet.model;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.epmet.commons.tools.constant.NumConstant;
@ -16,12 +17,12 @@ import javax.validation.constraints.NotBlank;
@Data
public class DangerousChemicalsModel {
@NotBlank(message = "企业名称为必填项")
@NotBlank(message = "企业名称不能为空")
@Length(max = 50,message = "企业名称长度超出50字限制")
@ExcelProperty(value = "企业名称")
private String name;
@NotBlank(message = "企业类型为必填项")
@NotBlank(message = "企业类型不能为空")
@ExcelProperty(value = "企业类型")
private String categoryName;
@ -38,6 +39,7 @@ public class DangerousChemicalsModel {
@ExcelProperty(value = "联系电话")
private String principalMobile;
@NotBlank(message = "经营地址不能为空")
@Length(max = 50,message = "经营地址长度超出50字限制")
@ExcelProperty(value = "经营地址")
private String address;
@ -45,6 +47,9 @@ public class DangerousChemicalsModel {
@ExcelProperty(value = "备注")
private String remark;
@ExcelIgnore
private Integer rowNum;
@Data
public static class RowRemarkMessage {

14
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcEnterpriseService.java

@ -3,6 +3,7 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.form.EnterpriseFormDTO;
import com.epmet.dto.form.EnterprisePageFormDTO;
import com.epmet.dto.form.EnterprisePatrolFormDTO;
import com.epmet.dto.result.EnterpriseDetailDTO;
import com.epmet.dto.result.EnterprisePatrolResultDTO;
@ -50,4 +51,17 @@ public interface IcEnterpriseService extends BaseService<IcEnterpriseEntity> {
*/
EnterpriseDetailDTO queryEnterpriseDetail(String customerId, String enterpriseId);
/**
* 企事业单位-删除
* @param enterpriseId
* @return
*/
void delete(String enterpriseId);
/**
* 企事业单位列表
* @param formDTO
* @return
*/
PageData<EnterpriseDetailDTO> list(EnterprisePageFormDTO formDTO);
}

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

@ -922,6 +922,7 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu
OptionResultDTO dto = new OptionResultDTO();
dto.setLabel(item.getGridName());
dto.setValue(item.getId());
dto.setPid(item.getPid());
return dto;
}).collect(Collectors.toList());
}

4
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcDangerousChemicalsServiceImpl.java

@ -82,6 +82,8 @@ public class IcDangerousChemicalsServiceImpl extends BaseServiceImpl<IcDangerous
private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient;
@Autowired
private OssFeignClient ossFeignClient;
@Autowired
private IcDangerousChemicalsDao icDangerousChemicalsDao;
@Override
public PageData<IcDangerousChemicalsListResultDTO> list(IcDangerousChemicalsListFormDTO formDTO) {
@ -233,7 +235,7 @@ public class IcDangerousChemicalsServiceImpl extends BaseServiceImpl<IcDangerous
if (null == agencyInfo){
throw new EpmetException("查询所属组织失败:"+staffInfo.getAgencyId());
}
DangerousChemicalsImportListener listener = new DangerousChemicalsImportListener(agencyInfo,this,coverageService,adminOpenFeignClient);
DangerousChemicalsImportListener listener = new DangerousChemicalsImportListener(agencyInfo,this,coverageService,adminOpenFeignClient,icDangerousChemicalsDao);
EasyExcel.read(filePath.toFile(), DangerousChemicalsModel.class, listener).headRowNumber(1).sheet(0).doRead();
String errorDesFileUrl = null;
List<DangerousChemicalsModel.RowRemarkMessage> errorRows = listener.getErrorRows();

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

@ -3,6 +3,7 @@ package com.epmet.service.impl;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
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.enums.CommonOperateTypeEnum;
import com.epmet.commons.tools.enums.CoveragePlaceTypeEnum;
import com.epmet.commons.tools.enums.DictTypeEnum;
@ -10,6 +11,7 @@ import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.utils.ConvertUtils;
@ -19,6 +21,7 @@ import com.epmet.dao.IcEnterpriseDao;
import com.epmet.dao.IcEnterprisePatrolAttachmentDao;
import com.epmet.dao.IcEnterprisePatrolRecordDao;
import com.epmet.dto.form.EnterpriseFormDTO;
import com.epmet.dto.form.EnterprisePageFormDTO;
import com.epmet.dto.form.EnterprisePatrolFormDTO;
import com.epmet.dto.result.EnterpriseDetailDTO;
import com.epmet.dto.result.EnterprisePatrolResultDTO;
@ -27,6 +30,8 @@ import com.epmet.entity.IcEnterprisePatrolAttachmentEntity;
import com.epmet.entity.IcEnterprisePatrolRecordEntity;
import com.epmet.feign.EpmetAdminOpenFeignClient;
import com.epmet.service.IcEnterpriseService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
@ -74,6 +79,14 @@ public class IcEnterpriseServiceImpl extends BaseServiceImpl<IcEnterpriseDao, Ic
enterpriseEntity.setSourceType(CommonOperateTypeEnum.ADD.getCode());
baseDao.insert(enterpriseEntity);
}else{
//如果是编辑判断下权限
IcEnterpriseEntity origin=baseDao.selectById(formDTO.getEnterpriseId());
CustomerStaffInfoCacheResult staffInfo=CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(),formDTO.getCurrentStaffId());
if (!staffInfo.getAgencyId().equals(origin.getAgencyId())) {
AgencyInfoCache orginAgencyInfo = CustomerOrgRedis.getAgencyInfo(origin.getAgencyId());
String agencyName = null != orginAgencyInfo ? orginAgencyInfo.getOrganizationName() : StrConstant.EPMETY_STR;
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "", String.format("当前场所属于%s,您无权编辑", agencyName));
}
enterpriseEntity.setId(formDTO.getEnterpriseId());
baseDao.updateById(enterpriseEntity);
}
@ -90,7 +103,9 @@ public class IcEnterpriseServiceImpl extends BaseServiceImpl<IcEnterpriseDao, Ic
@Override
public String addOrUpdatePatrol(EnterprisePatrolFormDTO formDTO) {
IcEnterprisePatrolRecordEntity patrolRecordEntity=ConvertUtils.sourceToTarget(formDTO,IcEnterprisePatrolRecordEntity.class);
if(StringUtils.isBlank(formDTO.getEnterpriseId())){
//校验名称唯一
// todo
if(StringUtils.isBlank(formDTO.getPatrolId())){
enterprisePatrolRecordDao.insert(patrolRecordEntity);
}else{
patrolRecordEntity.setId(formDTO.getPatrolId());
@ -110,6 +125,8 @@ public class IcEnterpriseServiceImpl extends BaseServiceImpl<IcEnterpriseDao, Ic
enterprisePatrolAttachmentDao.insert(att);
sort++;
}
// 更新主表的最新结果和最新检查时间
baseDao.updateLatestPatrol(formDTO.getEnterpriseId(),patrolRecordEntity.getUpdatedTime(),patrolRecordEntity.getResult(),formDTO.getUserId());
return patrolRecordEntity.getId();
}
@ -169,5 +186,55 @@ public class IcEnterpriseServiceImpl extends BaseServiceImpl<IcEnterpriseDao, Ic
return resultDto;
}
/**
* 企事业单位-删除
*
* @param enterpriseId
* @return
*/
@Transactional(rollbackFor = Exception.class)
@Override
public void delete(String enterpriseId) {
//要删除的记录的agencyId要与当前登录用户的agencyId一致
//ToDo
baseDao.deleteById(enterpriseId);
}
/**
* 企事业单位列表
*
* @param formDTO
* @return
*/
@Override
public PageData<EnterpriseDetailDTO> list(EnterprisePageFormDTO formDTO) {
//查询当前登录用的所属组织
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getCurrentStaffId());
if (null == staffInfo || StringUtils.isBlank(staffInfo.getAgencyId())) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询工作人员信息异常", "查询工作人员信息异常");
}
//本组织及下级
formDTO.setStaffAgencyId(staffInfo.getAgencyId());
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getPageFlag());
List<EnterpriseDetailDTO> list = baseDao.selectList(formDTO);
PageInfo<EnterpriseDetailDTO> pageInfo = new PageInfo<>(list);
if (!org.springframework.util.CollectionUtils.isEmpty(list)) {
//规模名称
Result<Map<String, String>> dictMapRes = adminOpenFeignClient.dictMap(DictTypeEnum.SCALE.getCode());
Map<String, String> dictMap = dictMapRes.success() && MapUtils.isNotEmpty(dictMapRes.getData()) ? dictMapRes.getData() : new HashMap<>();
for (EnterpriseDetailDTO detailDTO : list) {
GridInfoCache gridInfoCache = CustomerOrgRedis.getGridInfo(detailDTO.getGridId());
if (null != gridInfoCache) {
detailDTO.setGridName(gridInfoCache.getGridName());
detailDTO.setAgencyName(gridInfoCache.getAgencyName());
}
String placeTypeName = coverageCategoryDictDao.selectCategoryName(formDTO.getCustomerId(), CoveragePlaceTypeEnum.ENTERPRISE_PATROL.getCode(), detailDTO.getPlaceType());
detailDTO.setPlaceTypeName(placeTypeName);
detailDTO.setScaleName(dictMap.containsKey(detailDTO.getScale()) ? dictMap.get(detailDTO.getScale()) : StrConstant.EPMETY_STR);
}
}
return new PageData<>(list, pageInfo.getTotal());
}
}

13
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPlaceOrgServiceImpl.java

@ -19,11 +19,16 @@ package com.epmet.service.impl;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
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.dto.result.OptionResultDTO;
import com.epmet.commons.tools.enums.DictTypeEnum;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.IcPlaceOrgDao;
@ -80,10 +85,16 @@ public class IcPlaceOrgServiceImpl extends BaseServiceImpl<IcPlaceOrgDao, IcPlac
@Override
@Transactional(rollbackFor = Exception.class)
public void edit(EditPlaceOrgFormDTO formDTO) {
CustomerStaffInfoCacheResult staffInfo=CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(),formDTO.getCurrentStaffId());
IcPlaceOrgEntity entity = baseDao.selectById(formDTO.getPlaceOrgId());
if (null == entity) {
throw new RenException(String.format("修改九小场所下场所信息失败,场所不存在,场所Id->%s", formDTO.getPlaceOrgId()));
}
if (!staffInfo.getAgencyId().equals(entity.getAgencyId())) {
AgencyInfoCache agencyInfoCache = CustomerOrgRedis.getAgencyInfo(entity.getAgencyId());
String agencyName = null != agencyInfoCache ? agencyInfoCache.getOrganizationName() : StrConstant.EPMETY_STR;
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "", String.format("当前九小场所属于%s,您无权编辑", agencyName));
}
entity = ConvertUtils.sourceToTarget(formDTO, IcPlaceOrgEntity.class);
entity.setId(formDTO.getPlaceOrgId());
baseDao.updateById(entity);
@ -143,7 +154,7 @@ public class IcPlaceOrgServiceImpl extends BaseServiceImpl<IcPlaceOrgDao, IcPlac
public GetListPlaceOrgResultDTO getList(GetListPlaceOrgFormDTO formDTO) {
GetListPlaceOrgResultDTO resultDTO = new GetListPlaceOrgResultDTO();
CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId());
formDTO.setPids(staffInfoCache.getAgencyPIds());
formDTO.setAgencyId(staffInfoCache.getAgencyId());
//1.根据查询条件分页查询场所数据
PageInfo<PlaceOrgDetailResultDTO> result =
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()).doSelectPageInfo(() -> baseDao.getList(formDTO));

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

@ -733,7 +733,8 @@
case when ca.ORGANIZATION_NAME is null or ca.ORGANIZATION_NAME='' then cg.GRID_NAME
else concat(ca.ORGANIZATION_NAME,'-',cg.GRID_NAME)
end
)as label
)as label,
cg.PID
from customer_grid cg
left join customer_agency ca
on(cg.PID=ca.id and ca.DEL_FLAG='0')

57
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcEnterpriseDao.xml

@ -27,5 +27,62 @@
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<update id="updateLatestPatrol" parameterType="map" >
update ic_enterprise
set LATEST_RESULT = #{result},
UPDATED_BY = #{userId},
UPDATED_TIME=NOW(),
LATEST_PATROL_TIME = #{updatedTime}
WHERE ID = #{enterpriseId}
</update>
<select id="selectList" parameterType="com.epmet.dto.form.EnterprisePageFormDTO" resultType="com.epmet.dto.result.EnterpriseDetailDTO">
SELECT DISTINCT
ie.ID as enterpriseId,
ie.GRID_ID,
ie.AGENCY_ID,
ie.AGENCY_PIDS,
ie.PLACE_TYPE,
ie.PLACE_ORG_NAME,
ie.ADDRESS,
ie.LONGITUDE,
ie.LATITUDE,
ie.SCALE,
ie.PERSON_IN_CHARGE,
ie.MOBILE,
ie.SOURCE_TYPE,
ie.LATEST_RESULT,
ie.LATEST_PATROL_TIME
FROM
ic_enterprise ie
LEFT JOIN ic_enterprise_patrol_record r ON ( ie.id = r.ENTERPRISE_ID AND r.DEL_FLAG = '0' )
WHERE
ie.DEL_FLAG = '0'
AND (
ie.AGENCY_ID = #{staffAgencyId}
OR ie.AGENCY_PIDS LIKE concat( '%', #{staffAgencyId}, '%' )
)
<if test='null != gridId and "" != gridId'>
AND ie.GRID_ID = #{gridId}
</if>
<if test='null != placeType and "" != placeType'>
AND ie.PLACE_TYPE = #{placeType}
</if>
<if test='null != placeOrgName and "" != placeOrgName'>
AND ie.PLACE_ORG_NAME LIKE concat( '%', #{placeOrgName}, '%' )
</if>
<if test='null != scale and "" != scale'>
AND ie.SCALE = #{scale}
</if>
<if test='null != mobile and "" != mobile'>
AND ie.MOBILE LIKE concat( '%', #{mobile}, '%' )
</if>
<if test='null != result and "" != result'>
AND ie.LATEST_RESULT = #{result}
</if>
<if test='null != detailed and "" != detailed'>
AND r.DETAILED LIKE concat( '%', #{detailed}, '%' )
</if>
order by ie.CREATED_TIME desc
</select>
</mapper>

11
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcEnterprisePatrolAttachmentDao.xml

@ -23,13 +23,10 @@
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<update id="deleteByPatrolId" parameterType="java.lang.String">
update ic_enterprise_patrol_attachment
set del_flag='1',
UPDATED_TIME=now(),
UPDATED_BY={staffId}
where PATROL_ID=#{patrolId}
</update>
<delete id="deleteByPatrolId" parameterType="java.lang.String">
delete from ic_enterprise_patrol_attachment
where PATROL_ID = #{patrolId}
</delete>
<select id="selectAtt" parameterType="java.lang.String" resultType="java.lang.String">
select a.ATTACHMENT_URL from ic_enterprise_patrol_attachment a

7
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPlaceOrgDao.xml

@ -13,7 +13,8 @@
a.address address,
a.scale scale,
a.person_in_charge personInCharge,
a.mobile mobile
a.mobile mobile,
a.AGENCY_ID as agencyId
FROM
ic_place_org a
LEFT JOIN customer_grid b ON a.GRID_ID = b.ID
@ -25,8 +26,8 @@
<if test="customerId != null and customerId.trim() != ''">
AND a.customer_id = #{customerId}
</if>
<if test="pids != null and pids.trim() != ''">
AND a.pids LIKE CONCAT('%', #{pids}, '%')
<if test="agencyId != null and agencyId.trim() != ''">
AND (a.AGENCY_ID =#{agencyId} or a.PIDS LIKE CONCAT('%', #{agencyId}, '%') )
</if>
<if test="gridId != null and gridId.trim() != ''">
AND a.grid_id = #{gridId}

30
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/ResiVolunteerSelectDTO.java

@ -0,0 +1,30 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* 当前组织下居民信息里的志愿者列表
* 下拉框可用
*/
@Data
public class ResiVolunteerSelectDTO implements Serializable {
/**
* 下拉框显示值
* 尹作梅(15764229697)
*/
private String label;
private String value;
private String icResiUserId;
/**
* 姓名
*/
private String name;
/**
* 手机号
*/
private String mobile;
}

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

@ -1165,7 +1165,7 @@ public class IcResiUserController implements ResultDataResolver {
/**
* 获取组织下的志愿者
*
* 居民信息里的志愿者
* @Param formDTO
* @Return {@link Result<List<OptionDTO>>}
* @Author zhaoqifeng
@ -1188,4 +1188,17 @@ public class IcResiUserController implements ResultDataResolver {
public Result<List<String>> getUserId(@PathVariable("icUserId") String icUserId) {
return new Result<List<String>>().ok(icResiUserService.getUserId(icUserId));
}
/**
* 居民信息里的志愿者
* 社区自组织-添加成员可用
* @Param formDTO
* @Return {@link Result<List<OptionDTO>>}
* @Author zhaoqifeng
* @Date 2022/6/16 15:22
*/
@PostMapping("volunteer-list")
public Result<List<ResiVolunteerSelectDTO>> queryVolunteerList(@LoginUser TokenDto tokenDto) {
return new Result<List<ResiVolunteerSelectDTO>>().ok(icResiUserService.queryVolunteerList(tokenDto.getCustomerId(), tokenDto.getUserId()));
}
}

9
epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java

@ -436,4 +436,13 @@ public interface IcResiUserService extends BaseService<IcResiUserEntity> {
* @Date 2022/6/16 15:30
*/
List<String> getUserId(String icResiUserId);
/**
* 居民信息里的志愿者
* 社区自组织-添加成员可用
* @param customerId
* @param userId
* @return
*/
List<ResiVolunteerSelectDTO> queryVolunteerList(String customerId, String userId);
}

42
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java

@ -2478,7 +2478,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
/**
* 获取组织下志愿者列表
*
* 居民信息里的志愿者
* @param customerId
* @param agencyId
* @Param customerId
@ -2536,6 +2536,46 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
return baseInfoList.stream().map(UserBaseInfoEntity::getUserId).collect(Collectors.toList());
}
/**
* 居民信息里的志愿者
* 社区自组织-添加成员可用
*
* @param customerId
* @param userId
* @return
*/
@Override
public List<ResiVolunteerSelectDTO> queryVolunteerList(String customerId, String userId) {
CustomerStaffInfoCacheResult staffInfo=CustomerStaffRedis.getStaffInfo(customerId,userId);
if (null == staffInfo || StringUtils.isBlank(staffInfo.getAgencyId())) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"查询当前登录用户信息异常");
}
LambdaQueryWrapper<IcResiUserEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IcResiUserEntity::getCustomerId, customerId);
wrapper.and(wq -> wq.eq(IcResiUserEntity::getAgencyId, staffInfo.getAgencyId()).or().like(IcResiUserEntity::getPids, staffInfo.getAgencyId()));
wrapper.eq(IcResiUserEntity::getIsVolunteer, NumConstant.ONE_STR);
wrapper.eq(IcResiUserEntity::getStatus, NumConstant.ZERO_STR);
//只查这几列吧
wrapper.select(IcResiUserEntity::getId, IcResiUserEntity::getName, IcResiUserEntity::getMobile);
List<IcResiUserEntity> list = baseDao.selectList(wrapper);
if (CollectionUtils.isEmpty(list)) {
return Collections.emptyList();
}
return list.stream().map(item -> {
ResiVolunteerSelectDTO dto = new ResiVolunteerSelectDTO();
dto.setValue(item.getId());
dto.setIcResiUserId(item.getId());
dto.setMobile(item.getMobile());
dto.setName(item.getName());
if (StringUtils.isNotBlank(item.getMobile())) {
dto.setLabel(item.getName().concat("(").concat(item.getMobile().concat(")")));
} else {
dto.setLabel(item.getName());
}
return dto;
}).collect(Collectors.toList());
}
/**
* 根据身份证获取居民角色目前只有是否是志愿者
*

Loading…
Cancel
Save