Browse Source

企业的所属组织,可以是网格,可以是社区,可以是街道....

master
yinzuomei 2 years ago
parent
commit
0f72b76376
  1. 18
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcDangerousChemicalsDTO.java
  2. 12
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcDangerousChemicalsAddEditFormDTO.java
  3. 21
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcDangerousChemicalsListResultDTO.java
  4. 20
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/IcDangerousChemicalsEntity.java
  5. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/IcDangerousChemicalsExcel.java
  6. 54
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcDangerousChemicalsServiceImpl.java
  7. BIN
      epmet-module/gov-org/gov-org-server/src/main/resources/excel/lingshan_dangerous_chemicals_template.xlsx
  8. 17
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcDangerousChemicalsDao.xml

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

@ -23,9 +23,18 @@ public class IcDangerousChemicalsDTO implements Serializable {
private String id;
/**
* 灵山所属网格
* 灵山企业所属组织/网格
*/
private String gridId;
private String orgId;
/**
* 灵山组织agency网格grid
*/
private String orgType;
/**
* 灵山ORG_ID的全路径包含ORG_ID
*/
private String orgIdPath;
/**
* 客户Id
@ -42,11 +51,6 @@ public class IcDangerousChemicalsDTO implements Serializable {
*/
private String agencyIdPath;
/**
* 灵山GRID_ID的全路径包含grid_id
*/
private String orgIdPath;
/**
* 来源新增:add 导入:import
*/

12
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcDangerousChemicalsAddEditFormDTO.java

@ -27,10 +27,16 @@ public class IcDangerousChemicalsAddEditFormDTO implements Serializable {
}
/**
* 灵山所属网格
* 灵山企业所属组织/网格
*/
@NotBlank(message = "所属网格不能为空", groups = {LingShanAddGroup.class, LingShanEditGroup.class})
private String gridId;
@NotBlank(message = "所属组织不能为空", groups = {LingShanAddGroup.class, LingShanEditGroup.class})
private String orgId;
/**
* 灵山组织agency网格grid
*/
@NotBlank(message = "所属组织类型不能为空", groups = {LingShanAddGroup.class, LingShanEditGroup.class})
private String orgType;
/**
* 场所Id

21
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcDangerousChemicalsListResultDTO.java

@ -17,15 +17,26 @@ public class IcDangerousChemicalsListResultDTO implements Serializable {
*/
private String icDangerousChemicalsId;
/**
* 灵山所属网格
* 灵山企业所属组织/网格
*/
private String gridId;
private String orgId;
/**
* xxx社区-网格名称
* 灵山组织agency网格grid
*/
private String gridName;
private String orgType;
/**
* 灵山ORG_ID的全路径包含ORG_ID
*/
private String orgIdPath;
/**
* 所属组织可能是网格名也可能是组织名
*/
private String orgName;
/**
* 组织Id
* 所属组织机构Id灵山工作人员所属组织id
*/
private String agencyId;
/**

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

@ -25,24 +25,28 @@ public class IcDangerousChemicalsEntity extends BaseEpmetEntity {
private String customerId;
/**
* 灵山所属网格
* 灵山企业所属组织/网格
*/
private String gridId;
private String orgId;
/**
* 灵山组织agency网格grid
*/
private String orgType;
/**
* 所属组织机构Id
* 灵山ORG_ID的全路径包含ORG_ID
*/
private String agencyId;
private String orgIdPath;
/**
* agencyId的所有上级包含自己
* 所属组织机构Id灵山工作人员所属组织id
*/
private String agencyIdPath;
private String agencyId;
/**
* 灵山GRID_ID的全路径包含grid_id
* agencyId的所有上级包含自己
*/
private String orgIdPath;
private String agencyIdPath;
/**
* 来源新增:add 导入:import

2
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/IcDangerousChemicalsExcel.java

@ -15,7 +15,7 @@ public class IcDangerousChemicalsExcel {
@ExcelProperty(value = "所属组织")
@ColumnWidth(25)
private String gridName;
private String orgName;
@ExcelProperty(value = "企业名称")
@ColumnWidth(25)

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

@ -2,9 +2,7 @@ package com.epmet.service.impl;
import com.alibaba.excel.EasyExcel;
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;
@ -129,14 +127,6 @@ public class IcDangerousChemicalsServiceImpl extends BaseServiceImpl<IcDangerous
return new PageData<>(list, pageInfo.getTotal());
}
private QueryWrapper<IcDangerousChemicalsEntity> getWrapper(Map<String, Object> params) {
String id = (String) params.get(FieldConstant.ID_HUMP);
QueryWrapper<IcDangerousChemicalsEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public IcDangerousChemicalsDTO get(String id) {
@ -147,32 +137,38 @@ public class IcDangerousChemicalsServiceImpl extends BaseServiceImpl<IcDangerous
@Override
@Transactional(rollbackFor = Exception.class)
public void save(IcDangerousChemicalsAddEditFormDTO formDTO) {
//1.获取网格信息
CustomerGridDTO customerGridDTO=SpringContextUtils.getBean(CustomerGridService.class).get(formDTO.getGridId());
// 2.同一网格下,企业名称唯一
checkNameUnqiue(formDTO.getGridId(),formDTO.getName(), StrConstant.EPMETY_STR,customerGridDTO.getGridName());
//3.新增服务组织数据
//同一网格下,企业名称唯一
checkNameUnqiue(formDTO.getOrgId(),formDTO.getName(), StrConstant.EPMETY_STR);
//新增服务组织数据
IcDangerousChemicalsEntity entity = ConvertUtils.sourceToTarget(formDTO, IcDangerousChemicalsEntity.class);
entity.setSourceType("add");
entity.setAgencyId(customerGridDTO.getPid());
entity.setAgencyIdPath(customerGridDTO.getPids());
CustomerStaffInfoCacheResult staffInfoCacheResult=CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(),formDTO.getUserId());
entity.setAgencyId(staffInfoCacheResult.getAgencyId());
entity.setAgencyIdPath(StringUtils.isNotBlank(staffInfoCacheResult.getAgencyPIds()) ? staffInfoCacheResult.getAgencyPIds().concat(StrConstant.COLON).concat(staffInfoCacheResult.getAgencyId()) : staffInfoCacheResult.getAgencyId());
if(OrgTypeEnum.GRID.equals(formDTO.getOrgType())){
// 获取网格信息
CustomerGridDTO customerGridDTO=SpringContextUtils.getBean(CustomerGridService.class).get(formDTO.getOrgId());
entity.setOrgIdPath(PidUtils.convertPid2OrgIdPath(customerGridDTO.getId(),customerGridDTO.getPids()));
}else if(OrgTypeEnum.AGENCY.equals(formDTO.getOrgType())){
CustomerAgencyDTO customerAgencyDTO=SpringContextUtils.getBean(CustomerAgencyService.class).get(formDTO.getOrgId());
entity.setOrgIdPath(PidUtils.convertPid2OrgIdPath(customerAgencyDTO.getId(),customerAgencyDTO.getPids()));
}
insert(entity);
}
/**
* 同一网格下企业名称唯一
* @param gridId
* @param orgId
* @param name
* @param icDangerousChemicalsId
*/
private void checkNameUnqiue(String gridId, String name, String icDangerousChemicalsId,String gridName) {
private void checkNameUnqiue(String orgId, String name, String icDangerousChemicalsId) {
LambdaQueryWrapper<IcDangerousChemicalsEntity> tWrapper = new LambdaQueryWrapper<>();
tWrapper.eq(IcDangerousChemicalsEntity::getGridId, gridId);
tWrapper.eq(IcDangerousChemicalsEntity::getOrgId, orgId);
tWrapper.eq(IcDangerousChemicalsEntity::getName, name)
.ne(StringUtils.isNotBlank(icDangerousChemicalsId),IcDangerousChemicalsEntity::getId,icDangerousChemicalsId);
if (baseDao.selectCount(tWrapper) > NumConstant.ZERO) {
String msg = String.format("%下已存在%s", gridName, name);
String msg = String.format("所属组织下已存在%s", name);
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), msg, msg);
}
}
@ -180,16 +176,22 @@ public class IcDangerousChemicalsServiceImpl extends BaseServiceImpl<IcDangerous
@Override
@Transactional(rollbackFor = Exception.class)
public void update(IcDangerousChemicalsAddEditFormDTO formDTO) {
//1.获取网格信息
CustomerGridDTO customerGridDTO=SpringContextUtils.getBean(CustomerGridService.class).get(formDTO.getGridId());
// 2.同一网格下,企业名称唯一
checkNameUnqiue(formDTO.getGridId(),formDTO.getName(), formDTO.getIcDangerousChemicalsId(),customerGridDTO.getGridName());
checkNameUnqiue(formDTO.getOrgId(),formDTO.getName(), formDTO.getIcDangerousChemicalsId());
//3.更新服务组织数据
IcDangerousChemicalsEntity entity = ConvertUtils.sourceToTarget(formDTO, IcDangerousChemicalsEntity.class);
entity.setId(formDTO.getIcDangerousChemicalsId());
entity.setAgencyId(customerGridDTO.getPid());
entity.setAgencyIdPath(customerGridDTO.getPids());
CustomerStaffInfoCacheResult staffInfoCacheResult=CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(),formDTO.getUserId());
entity.setAgencyId(staffInfoCacheResult.getAgencyId());
entity.setAgencyIdPath(StringUtils.isNotBlank(staffInfoCacheResult.getAgencyPIds()) ? staffInfoCacheResult.getAgencyPIds().concat(StrConstant.COLON).concat(staffInfoCacheResult.getAgencyId()) : staffInfoCacheResult.getAgencyId());
if(OrgTypeEnum.GRID.equals(formDTO.getOrgType())){
// 获取网格信息
CustomerGridDTO customerGridDTO=SpringContextUtils.getBean(CustomerGridService.class).get(formDTO.getOrgId());
entity.setOrgIdPath(PidUtils.convertPid2OrgIdPath(customerGridDTO.getId(),customerGridDTO.getPids()));
}else if(OrgTypeEnum.AGENCY.equals(formDTO.getOrgType())){
CustomerAgencyDTO customerAgencyDTO=SpringContextUtils.getBean(CustomerAgencyService.class).get(formDTO.getOrgId());
entity.setOrgIdPath(PidUtils.convertPid2OrgIdPath(customerAgencyDTO.getId(),customerAgencyDTO.getPids()));
}
updateById(entity);
}

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

Binary file not shown.

17
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcDangerousChemicalsDao.xml

@ -70,8 +70,15 @@
<select id="selectDangerousChemicalsList" parameterType="com.epmet.dto.form.IcDangerousChemicalsListFormDTO" resultType="com.epmet.dto.result.IcDangerousChemicalsListResultDTO">
SELECT
dc.id icDangerousChemicalsId,
dc.grid_id gridId,
concat(ORGANIZATION_NAME,'-',cg.GRID_NAME)as gridName,
dc.ORG_ID orgId,
dc.org_type orgType,
dc.org_id_path as orgIdPath,
(
case when dc.org_type='grid'then select concat(a.ORGANIZATION_NAME,'-',cg.GRID_NAME) from customer_grid cg inner join customer_agency a on(cg.pid=a.id) where cg.id=dc.org_id
when dc.org_type='agency' then select dc.ORGANIZATION_NAME from customer_agency ca where ca.id=dc.org_id
else ''
end
) as orgName,
dc.agency_id agencyId,
dc.source_type sourceType,
dc.`name` name,
@ -92,10 +99,6 @@
dc.COMPANY_PROFILE companyProfile
FROM
ic_dangerous_chemicals dc
left join customer_grid cg
on(dc.grid_id=cg.id)
left join customer_agency ca
on(cg.pid=ca.id)
WHERE
dc.del_flag = '0'
<if test="icDangerousChemicalsId != null and icDangerousChemicalsId != '' ">
@ -111,7 +114,7 @@
</if>
<if test='orgType == "grid"'>
<if test="orgId != null and orgId != '' ">
AND dc.grid_id=#{orgId}
AND dc.ORG_ID=#{orgId}
</if>
</if>
<if test="name != null and name != '' ">

Loading…
Cancel
Save