Browse Source

灵山企业档案=原产品重点危化品企业

master
yinzuomei 2 years ago
parent
commit
7ddf1d66ac
  1. 55
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcDangerousChemicalsDTO.java
  2. 75
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcDangerousChemicalsAddEditFormDTO.java
  3. 52
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcDangerousChemicalsListFormDTO.java
  4. 45
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcDangerousChemicalsListResultDTO.java
  5. 50
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcDangerousChemicalsController.java
  6. 3
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcDangerousChemicalsDao.java
  7. 58
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/IcDangerousChemicalsEntity.java
  8. 98
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcDangerousChemicalsServiceImpl.java
  9. 88
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcDangerousChemicalsDao.xml

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

@ -1,8 +1,9 @@
package com.epmet.dto; package com.epmet.dto;
import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import lombok.Data;
/** /**
@ -21,6 +22,11 @@ public class IcDangerousChemicalsDTO implements Serializable {
*/ */
private String id; private String id;
/**
* 灵山所属网格
*/
private String gridId;
/** /**
* 客户Id * 客户Id
*/ */
@ -36,6 +42,11 @@ public class IcDangerousChemicalsDTO implements Serializable {
*/ */
private String agencyIdPath; private String agencyIdPath;
/**
* 灵山GRID_ID的全路径包含grid_id
*/
private String orgIdPath;
/** /**
* 来源新增:add 导入:import * 来源新增:add 导入:import
*/ */
@ -62,19 +73,19 @@ public class IcDangerousChemicalsDTO implements Serializable {
private String dangerType; private String dangerType;
/** /**
* 负责人姓名 * 负责人姓名灵山项目中此列叫联系人
*/ */
private String principalName; private String principalName;
/** /**
* 负责人电话 * 负责人电话灵山项目中此列叫联系电话
*/ */
private String principalMobile; private String principalMobile;
/** /**
* 经营地址 * 经营地址灵山项目中此列叫企业地址
*/ */
private String address; private String address;
/** /**
* 经度 * 经度
@ -91,6 +102,36 @@ public class IcDangerousChemicalsDTO implements Serializable {
*/ */
private String remark; private String remark;
/**
* 灵山是否重点安全企业1是0不是必填
*/
private Boolean securityFlag;
/**
* 灵山安全负责人姓名
*/
private String securityPrincipalName;
/**
* 灵山手机号
*/
private String securityPrincipalMobile;
/**
* 灵山包企领导
*/
private String bqLd;
/**
* 灵山包企干部
*/
private String bqGb;
/**
* 灵山企业介绍
*/
private String companyProfile;
/** /**
* 删除标识 * 删除标识
*/ */

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

@ -1,12 +1,11 @@
package com.epmet.dto.form; package com.epmet.dto.form;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import lombok.Data; import lombok.Data;
import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable; import java.io.Serializable;
/** /**
@ -21,22 +20,36 @@ public class IcDangerousChemicalsAddEditFormDTO implements Serializable {
public interface Del extends CustomerClientShowGroup { public interface Del extends CustomerClientShowGroup {
} }
public interface LingShanAddGroup extends CustomerClientShowGroup {
}
public interface LingShanEditGroup extends CustomerClientShowGroup {
}
/**
* 灵山所属网格
*/
@NotBlank(message = "所属网格不能为空", groups = {LingShanAddGroup.class, LingShanEditGroup.class})
private String gridId;
/** /**
* 场所Id * 场所Id
*/ */
@NotBlank(message = "场所Id不能为空", groups = {UpdateGroup.class, Del.class}) @NotBlank(message = "企业Id不能为空", groups = {LingShanEditGroup.class, Del.class})
private String icDangerousChemicalsId; private String icDangerousChemicalsId;
/** /**
* 企业名称 * 企业名称
*/ */
@NotBlank(message = "企业名称不能为空", groups = {AddGroup.class}) @NotBlank(message = "企业名称不能为空", groups = {LingShanAddGroup.class, LingShanEditGroup.class})
@Length(max = 50, message = "场所名称不能超过50位", groups = AddGroup.class) @Length(max = 35, message = "企业名称最多输入35字", groups = LingShanAddGroup.class)
private String name; private String name;
/** /**
* 企业类型值 * 企业类型值
*/ */
@NotBlank(message = "企业类型不能为空", groups = {AddGroup.class}) @NotBlank(message = "企业类型不能为空", groups = {LingShanAddGroup.class, LingShanEditGroup.class})
private String category; private String category;
/** /**
* 周边安全距离 * 周边安全距离
*/ */
@ -46,36 +59,70 @@ public class IcDangerousChemicalsAddEditFormDTO implements Serializable {
*/ */
private String dangerType; private String dangerType;
/** /**
* 负责人 * 负责人姓名灵山项目中此列叫联系人
*/ */
private String principalName; private String principalName;
/** /**
* 联系电话 * 负责人电话灵山项目中此列叫联系电话
*/ */
private String principalMobile; private String principalMobile;
/** /**
* 经度 * 经度
*/ */
@NotBlank(message = "经度不能为空", groups = {AddGroup.class}) @NotBlank(message = "请完善经度信息", groups = {LingShanAddGroup.class, LingShanEditGroup.class})
private String longitude; private String longitude;
/** /**
* 维度 * 维度
*/ */
@NotBlank(message = "维度不能为空", groups = {AddGroup.class}) @NotBlank(message = "请完善纬度信息", groups = {LingShanAddGroup.class, LingShanEditGroup.class})
private String latitude; private String latitude;
/** /**
* 地址 * 经营地址灵山项目中此列叫企业地址
*/ */
@NotBlank(message = "地址不能为空", groups = {AddGroup.class}) @NotBlank(message = "企业地址不能为空", groups = {LingShanAddGroup.class, LingShanEditGroup.class})
@Length(max = 50, message = "地址不能超过50位", groups = AddGroup.class) @Length(max = 200, message = "企业地址最多输入200字", groups = {LingShanAddGroup.class, LingShanEditGroup.class})
private String address; private String address;
/** /**
* 备注 * 备注
*/ */
private String remark; private String remark;
/**
* 灵山是否重点安全企业1是0不是必填
*/
@NotNull(message = "是否重点安全企业不能为空", groups = {LingShanAddGroup.class, LingShanEditGroup.class})
private Boolean securityFlag;
/**
* 灵山安全负责人姓名
*/
private String securityPrincipalName;
/**
* 灵山手机号
*/
private String securityPrincipalMobile;
/**
* 灵山包企领导
*/
private String bqLd;
/**
* 灵山包企干部
*/
private String bqGb;
/**
* 灵山企业介绍
*/
private String companyProfile;
private String customerId; private String customerId;
private String userId; private String userId;
} }

52
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcDangerousChemicalsListFormDTO.java

@ -1,5 +1,6 @@
package com.epmet.dto.form; package com.epmet.dto.form;
import com.epmet.commons.tools.dto.form.PageFormDTO;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
@ -9,34 +10,67 @@ import java.io.Serializable;
* @Author sun * @Author sun
*/ */
@Data @Data
public class IcDangerousChemicalsListFormDTO implements Serializable { public class IcDangerousChemicalsListFormDTO extends PageFormDTO implements Serializable {
private static final long serialVersionUID = 9156247659994638103L; private static final long serialVersionUID = 9156247659994638103L;
/** /**
* 场所名称 * 组织或者网格id
*/
private String orgId;
/**
* 组织agency
* 网格grid
*/
private String orgType;
/**
* 灵山GRID_ID的全路径包含grid_id
* 接口内部赋值用于sql
*/
private String orgIdPath;
/**
* 企业名称
*/ */
private String name; private String name;
/** /**
* 场所分类字典表值 * 企业类型字典表值
*/ */
private String category; private String category;
/** /**
* 危化品种类字典值 * 危化品种类字典值
* 灵山界面暂无此列
*/ */
private String dangerType; private String dangerType;
/** /**
* 页码 * 企业地址
* 经营地址灵山项目中此列叫企业地址
*/ */
private Integer pageNo = 1; private String address;
/**
* 联系人
* 负责人姓名灵山项目中此列叫联系人
*/
private String principalName;
/** /**
* 每页显示数量 * 灵山安全负责人姓名
*/ */
private Integer pageSize = 20; private String securityPrincipalName;
private Boolean isPage = true;
private String icDangerousChemicalsId; private String icDangerousChemicalsId;
/**
* tokenDto.customerId
*/
private String customerId; private String customerId;
/**
* tokenDto.userId
*/
private String staffId; private String staffId;
private String agencyId;
} }

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

@ -16,6 +16,14 @@ public class IcDangerousChemicalsListResultDTO implements Serializable {
* 企业Id * 企业Id
*/ */
private String icDangerousChemicalsId; private String icDangerousChemicalsId;
/**
* 灵山所属网格
*/
private String gridId;
/**
* xxx社区-网格名称
*/
private String gridName;
/** /**
* 组织Id * 组织Id
*/ */
@ -53,13 +61,15 @@ public class IcDangerousChemicalsListResultDTO implements Serializable {
*/ */
private String dangerTypeName; private String dangerTypeName;
/** /**
* 负责人 * 负责人姓名灵山项目中此列叫联系人
*/ */
private String principalName; private String principalName;
/** /**
* 联系电话 * 负责人电话灵山项目中此列叫联系电话
*/ */
private String principalMobile; private String principalMobile;
/** /**
* 经度 * 经度
*/ */
@ -69,7 +79,7 @@ public class IcDangerousChemicalsListResultDTO implements Serializable {
*/ */
private String latitude; private String latitude;
/** /**
* 地址 * 经营地址灵山项目中此列叫企业地址
*/ */
private String address; private String address;
/** /**
@ -77,4 +87,33 @@ public class IcDangerousChemicalsListResultDTO implements Serializable {
*/ */
private String remark; private String remark;
/**
* 灵山是否重点安全企业1是0不是必填
*/
private Boolean securityFlag;
/**
* 灵山安全负责人姓名
*/
private String securityPrincipalName;
/**
* 灵山手机号
*/
private String securityPrincipalMobile;
/**
* 灵山包企领导
*/
private String bqLd;
/**
* 灵山包企干部
*/
private String bqGb;
/**
* 灵山企业介绍
*/
private String companyProfile;
} }

50
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcDangerousChemicalsController.java

@ -10,7 +10,6 @@ import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.aop.NoRepeatSubmit; import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.ServiceConstant;
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;
@ -19,9 +18,6 @@ import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.*; import com.epmet.commons.tools.utils.*;
import com.epmet.commons.tools.utils.poi.excel.handler.FreezeAndFilter; import com.epmet.commons.tools.utils.poi.excel.handler.FreezeAndFilter;
import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.constants.ImportTaskConstants; import com.epmet.constants.ImportTaskConstants;
import com.epmet.dto.IcDangerousChemicalsDTO; import com.epmet.dto.IcDangerousChemicalsDTO;
import com.epmet.dto.form.IcDangerousChemicalsAddEditFormDTO; import com.epmet.dto.form.IcDangerousChemicalsAddEditFormDTO;
@ -32,7 +28,6 @@ import com.epmet.dto.result.ImportTaskCommonResultDTO;
import com.epmet.excel.IcDangerousChemicalsExcel; import com.epmet.excel.IcDangerousChemicalsExcel;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient; import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import com.epmet.service.IcDangerousChemicalsService; import com.epmet.service.IcDangerousChemicalsService;
import com.epmet.utils.ImportTaskUtils;
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.io.IOUtils; import org.apache.commons.io.IOUtils;
@ -72,6 +67,12 @@ public class IcDangerousChemicalsController {
@Autowired @Autowired
private EpmetCommonServiceOpenFeignClient epmetCommonServiceOpenFeignClient; private EpmetCommonServiceOpenFeignClient epmetCommonServiceOpenFeignClient;
/**
* 重点危化品企业 列表分页
* @param tokenDto
* @param formDTO
* @return
*/
@RequestMapping("list") @RequestMapping("list")
public Result<PageData<IcDangerousChemicalsListResultDTO>> list(@LoginUser TokenDto tokenDto, @RequestBody IcDangerousChemicalsListFormDTO formDTO) { public Result<PageData<IcDangerousChemicalsListResultDTO>> list(@LoginUser TokenDto tokenDto, @RequestBody IcDangerousChemicalsListFormDTO formDTO) {
formDTO.setCustomerId(tokenDto.getCustomerId()); formDTO.setCustomerId(tokenDto.getCustomerId());
@ -85,26 +86,44 @@ public class IcDangerousChemicalsController {
return new Result<IcDangerousChemicalsDTO>().ok(data); return new Result<IcDangerousChemicalsDTO>().ok(data);
} }
/**
* 重点危化品企业 新增
* @param tokenDto
* @param dto
* @return
*/
@NoRepeatSubmit @NoRepeatSubmit
@PostMapping("add") @PostMapping("add")
public Result save(@LoginUser TokenDto tokenDto, @RequestBody IcDangerousChemicalsAddEditFormDTO dto) { public Result save(@LoginUser TokenDto tokenDto, @RequestBody IcDangerousChemicalsAddEditFormDTO dto) {
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); ValidatorUtils.validateEntity(dto, IcDangerousChemicalsAddEditFormDTO.LingShanAddGroup.class);
dto.setCustomerId(tokenDto.getCustomerId()); dto.setCustomerId(tokenDto.getCustomerId());
dto.setUserId(tokenDto.getUserId()); dto.setUserId(tokenDto.getUserId());
icDangerousChemicalsService.save(dto); icDangerousChemicalsService.save(dto);
return new Result(); return new Result();
} }
/**
* 重点危化品企业 编辑
* @param tokenDto
* @param formDTO
* @return
*/
@NoRepeatSubmit @NoRepeatSubmit
@PostMapping("edit") @PostMapping("edit")
public Result update(@LoginUser TokenDto tokenDto, @RequestBody IcDangerousChemicalsAddEditFormDTO formDTO) { public Result update(@LoginUser TokenDto tokenDto, @RequestBody IcDangerousChemicalsAddEditFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, UpdateGroup.class, DefaultGroup.class); ValidatorUtils.validateEntity(formDTO, IcDangerousChemicalsAddEditFormDTO.LingShanEditGroup.class);
formDTO.setCustomerId(tokenDto.getCustomerId()); formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setUserId(tokenDto.getUserId()); formDTO.setUserId(tokenDto.getUserId());
icDangerousChemicalsService.update(formDTO); icDangerousChemicalsService.update(formDTO);
return new Result(); return new Result();
} }
/**
* 重点危化品企业 删除
* @param tokenDto
* @param formDTO
* @return
*/
@PostMapping("del") @PostMapping("del")
public Result delete(@LoginUser TokenDto tokenDto, @RequestBody IcDangerousChemicalsAddEditFormDTO formDTO) { public Result delete(@LoginUser TokenDto tokenDto, @RequestBody IcDangerousChemicalsAddEditFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, IcDangerousChemicalsAddEditFormDTO.Del.class); ValidatorUtils.validateEntity(formDTO, IcDangerousChemicalsAddEditFormDTO.Del.class);
@ -114,11 +133,21 @@ public class IcDangerousChemicalsController {
return new Result(); return new Result();
} }
/**
* 重点危化品企业 查看详情
* @param formDTO
* @return
*/
@RequestMapping("detail") @RequestMapping("detail")
public Result<IcDangerousChemicalsListResultDTO> detail(@RequestBody IcDangerousChemicalsListFormDTO formDTO) { public Result<IcDangerousChemicalsListResultDTO> detail(@RequestBody IcDangerousChemicalsListFormDTO formDTO) {
return new Result<IcDangerousChemicalsListResultDTO>().ok(icDangerousChemicalsService.detail(formDTO)); return new Result<IcDangerousChemicalsListResultDTO>().ok(icDangerousChemicalsService.detail(formDTO));
} }
/**
* 重点危化品企业 下载导入模板
* @param response
* @throws IOException
*/
@RequestMapping(value = "download", method = {RequestMethod.GET, RequestMethod.POST}) @RequestMapping(value = "download", method = {RequestMethod.GET, RequestMethod.POST})
public void downloadTemplate(HttpServletResponse response) throws IOException { public void downloadTemplate(HttpServletResponse response) throws IOException {
response.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8");
@ -137,6 +166,13 @@ public class IcDangerousChemicalsController {
} }
} }
/**
* 重点危化品企业 导出
* @param tokenDto
* @param formDTO
* @param response
* @throws IOException
*/
@PostMapping("export") @PostMapping("export")
public void export(@LoginUser TokenDto tokenDto, @RequestBody IcDangerousChemicalsListFormDTO formDTO, HttpServletResponse response) throws IOException { public void export(@LoginUser TokenDto tokenDto, @RequestBody IcDangerousChemicalsListFormDTO formDTO, HttpServletResponse response) throws IOException {
formDTO.setCustomerId(tokenDto.getCustomerId()); formDTO.setCustomerId(tokenDto.getCustomerId());

3
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcDangerousChemicalsDao.java

@ -20,9 +20,8 @@ public interface IcDangerousChemicalsDao extends BaseDao<IcDangerousChemicalsEnt
List<IcDangerousChemicalsListResultDTO> selectDangerousChemicalsList(IcDangerousChemicalsListFormDTO formDTO); List<IcDangerousChemicalsListResultDTO> selectDangerousChemicalsList(IcDangerousChemicalsListFormDTO formDTO);
void del(IcDangerousChemicalsEntity entity); void del(@Param("id") String id,@Param("updatedBy") String updatedBy);
void importInsert(@Param("entityList") List<IcDangerousChemicalsEntity> entityList); void importInsert(@Param("entityList") List<IcDangerousChemicalsEntity> entityList);
void delByAgencyAndName(IcDangerousChemicalsEntity entity);
} }

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

@ -24,6 +24,11 @@ public class IcDangerousChemicalsEntity extends BaseEpmetEntity {
*/ */
private String customerId; private String customerId;
/**
* 灵山所属网格
*/
private String gridId;
/** /**
* 所属组织机构Id * 所属组织机构Id
*/ */
@ -34,6 +39,11 @@ public class IcDangerousChemicalsEntity extends BaseEpmetEntity {
*/ */
private String agencyIdPath; private String agencyIdPath;
/**
* 灵山GRID_ID的全路径包含grid_id
*/
private String orgIdPath;
/** /**
* 来源新增:add 导入:import * 来源新增:add 导入:import
*/ */
@ -59,19 +69,19 @@ public class IcDangerousChemicalsEntity extends BaseEpmetEntity {
*/ */
private String dangerType; private String dangerType;
/** /**
* 负责人姓名 * 负责人姓名灵山项目中此列叫联系人
*/ */
private String principalName; private String principalName;
/** /**
* 负责人电话 * 负责人电话灵山项目中此列叫联系电话
*/ */
private String principalMobile; private String principalMobile;
/** /**
* 经营地址 * 经营地址灵山项目中此列叫企业地址
*/ */
private String address; private String address;
/** /**
@ -89,6 +99,36 @@ public class IcDangerousChemicalsEntity extends BaseEpmetEntity {
*/ */
private String remark; private String remark;
/**
* 灵山是否重点安全企业1是0不是必填
*/
private Boolean securityFlag;
/**
* 灵山安全负责人姓名
*/
private String securityPrincipalName;
/**
* 灵山手机号
*/
private String securityPrincipalMobile;
/**
* 灵山包企领导
*/
private String bqLd;
/**
* 灵山包企干部
*/
private String bqGb;
/**
* 灵山企业介绍
*/
private String companyProfile;
@TableField(exist = false) @TableField(exist = false)
private String dangerTypeName; private String dangerTypeName;

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

@ -6,8 +6,10 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant; 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.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.enums.DictTypeEnum; import com.epmet.commons.tools.enums.DictTypeEnum;
import com.epmet.commons.tools.enums.OrgTypeEnum;
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;
@ -16,27 +18,27 @@ import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; 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.AgencyInfoCache;
import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.*;
import com.epmet.commons.tools.utils.FileUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constants.ImportTaskConstants; import com.epmet.constants.ImportTaskConstants;
import com.epmet.dao.IcDangerousChemicalsDao; import com.epmet.dao.IcDangerousChemicalsDao;
import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.IcDangerousChemicalsDTO; import com.epmet.dto.IcDangerousChemicalsDTO;
import com.epmet.dto.form.IcDangerousChemicalsAddEditFormDTO; import com.epmet.dto.form.IcDangerousChemicalsAddEditFormDTO;
import com.epmet.dto.form.IcDangerousChemicalsListFormDTO; import com.epmet.dto.form.IcDangerousChemicalsListFormDTO;
import com.epmet.dto.form.ImportTaskCommonFormDTO; import com.epmet.dto.form.ImportTaskCommonFormDTO;
import com.epmet.dto.result.IcCityManagementListResultDTO;
import com.epmet.dto.result.IcCoverageCategoryDictListResultDTO; import com.epmet.dto.result.IcCoverageCategoryDictListResultDTO;
import com.epmet.dto.result.IcDangerousChemicalsListResultDTO; import com.epmet.dto.result.IcDangerousChemicalsListResultDTO;
import com.epmet.dto.result.UploadImgResultDTO; import com.epmet.dto.result.UploadImgResultDTO;
import com.epmet.entity.IcDangerousChemicalsEntity; import com.epmet.entity.IcDangerousChemicalsEntity;
import com.epmet.entity.IcSuperiorResourceEntity;
import com.epmet.feign.EpmetAdminOpenFeignClient; 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.model.DangerousChemicalsImportListener; import com.epmet.model.DangerousChemicalsImportListener;
import com.epmet.model.DangerousChemicalsModel; import com.epmet.model.DangerousChemicalsModel;
import com.epmet.service.CoverageService; import com.epmet.service.CoverageService;
import com.epmet.service.CustomerAgencyService;
import com.epmet.service.CustomerGridService;
import com.epmet.service.IcDangerousChemicalsService; import com.epmet.service.IcDangerousChemicalsService;
import com.epmet.utils.ImportTaskUtils; import com.epmet.utils.ImportTaskUtils;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
@ -88,12 +90,20 @@ public class IcDangerousChemicalsServiceImpl extends BaseServiceImpl<IcDangerous
@Override @Override
public PageData<IcDangerousChemicalsListResultDTO> list(IcDangerousChemicalsListFormDTO formDTO) { public PageData<IcDangerousChemicalsListResultDTO> list(IcDangerousChemicalsListFormDTO formDTO) {
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId()); if(StringUtils.isBlank(formDTO.getOrgId())||StringUtils.isBlank(formDTO.getOrgType())){
if (null == staffInfo) { CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId());
throw new EpmetException("获取工作人员信息失败"); if (null == staffInfo) {
throw new EpmetException("获取工作人员信息失败");
}
//查询当前组织及下级数据
formDTO.setOrgId(staffInfo.getAgencyId());
formDTO.setOrgType(OrgTypeEnum.AGENCY.getCode());
}
if(OrgTypeEnum.AGENCY.getCode().equals(formDTO.getOrgType())){
CustomerAgencyDTO agencyDTO=SpringContextUtils.getBean(CustomerAgencyService.class).get(formDTO.getOrgId());
formDTO.setOrgIdPath(PidUtils.convertPid2OrgIdPath(agencyDTO.getId(),agencyDTO.getPids()));
} }
//查询当前组织及下级数据
formDTO.setAgencyId(staffInfo.getAgencyId());
//列表/导出查询 //列表/导出查询
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()); PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage());
List<IcDangerousChemicalsListResultDTO> list = baseDao.selectDangerousChemicalsList(formDTO); List<IcDangerousChemicalsListResultDTO> list = baseDao.selectDangerousChemicalsList(formDTO);
@ -138,60 +148,56 @@ public class IcDangerousChemicalsServiceImpl extends BaseServiceImpl<IcDangerous
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void save(IcDangerousChemicalsAddEditFormDTO formDTO) { public void save(IcDangerousChemicalsAddEditFormDTO formDTO) {
//1.获取当前工作人员缓存信息 //1.获取网格信息
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId()); CustomerGridDTO customerGridDTO=SpringContextUtils.getBean(CustomerGridService.class).get(formDTO.getGridId());
if (null == staffInfo) { // 2.同一网格下,企业名称唯一
throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", formDTO.getUserId())); checkNameUnqiue(formDTO.getGridId(),formDTO.getName(), StrConstant.EPMETY_STR,customerGridDTO.getGridName());
}
//2.校验同组织下服务组织名称不能重复
LambdaQueryWrapper<IcDangerousChemicalsEntity> tWrapper = new LambdaQueryWrapper<>();
tWrapper.eq(IcDangerousChemicalsEntity::getAgencyId, staffInfo.getAgencyId());
tWrapper.eq(IcDangerousChemicalsEntity::getName, formDTO.getName());
List<IcDangerousChemicalsEntity> entityList = baseDao.selectList(tWrapper);
if (!CollectionUtils.isEmpty(entityList)) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "当前组织下已存在相同名称的场所");
}
//3.新增服务组织数据 //3.新增服务组织数据
IcDangerousChemicalsEntity entity = ConvertUtils.sourceToTarget(formDTO, IcDangerousChemicalsEntity.class); IcDangerousChemicalsEntity entity = ConvertUtils.sourceToTarget(formDTO, IcDangerousChemicalsEntity.class);
entity.setSourceType("add"); entity.setSourceType("add");
entity.setAgencyId(staffInfo.getAgencyId()); entity.setAgencyId(customerGridDTO.getPid());
entity.setAgencyIdPath(StringUtils.isEmpty(staffInfo.getAgencyPIds()) ? staffInfo.getAgencyId() : staffInfo.getAgencyPIds() + ":" + staffInfo.getAgencyId()); entity.setAgencyIdPath(customerGridDTO.getPids());
entity.setOrgIdPath(PidUtils.convertPid2OrgIdPath(customerGridDTO.getId(),customerGridDTO.getPids()));
insert(entity); insert(entity);
} }
/**
* 同一网格下企业名称唯一
* @param gridId
* @param name
* @param icDangerousChemicalsId
*/
private void checkNameUnqiue(String gridId, String name, String icDangerousChemicalsId,String gridName) {
LambdaQueryWrapper<IcDangerousChemicalsEntity> tWrapper = new LambdaQueryWrapper<>();
tWrapper.eq(IcDangerousChemicalsEntity::getGridId, gridId);
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);
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), msg, msg);
}
}
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void update(IcDangerousChemicalsAddEditFormDTO formDTO) { public void update(IcDangerousChemicalsAddEditFormDTO formDTO) {
//1.获取当前工作人员缓存信息 //1.获取网格信息
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId()); CustomerGridDTO customerGridDTO=SpringContextUtils.getBean(CustomerGridService.class).get(formDTO.getGridId());
if (null == staffInfo) { // 2.同一网格下,企业名称唯一
throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", formDTO.getUserId())); checkNameUnqiue(formDTO.getGridId(),formDTO.getName(), formDTO.getIcDangerousChemicalsId(),customerGridDTO.getGridName());
}
//2.校验同组织下服务组织名称不能重复
LambdaQueryWrapper<IcDangerousChemicalsEntity> tWrapper = new LambdaQueryWrapper<>();
tWrapper.eq(IcDangerousChemicalsEntity::getAgencyId, staffInfo.getAgencyId());
tWrapper.ne(IcDangerousChemicalsEntity::getId, formDTO.getIcDangerousChemicalsId());
tWrapper.eq(IcDangerousChemicalsEntity::getName, formDTO.getName());
List<IcDangerousChemicalsEntity> entityList = baseDao.selectList(tWrapper);
if (!CollectionUtils.isEmpty(entityList)) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "当前组织下已存在相同名称的服务组织");
}
//3.更新服务组织数据 //3.更新服务组织数据
IcDangerousChemicalsEntity entity = ConvertUtils.sourceToTarget(formDTO, IcDangerousChemicalsEntity.class); IcDangerousChemicalsEntity entity = ConvertUtils.sourceToTarget(formDTO, IcDangerousChemicalsEntity.class);
entity.setId(formDTO.getIcDangerousChemicalsId()); entity.setId(formDTO.getIcDangerousChemicalsId());
entity.setAgencyId(customerGridDTO.getPid());
entity.setAgencyIdPath(customerGridDTO.getPids());
entity.setOrgIdPath(PidUtils.convertPid2OrgIdPath(customerGridDTO.getId(),customerGridDTO.getPids()));
updateById(entity); updateById(entity);
} }
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void delete(IcDangerousChemicalsAddEditFormDTO formDTO) { public void delete(IcDangerousChemicalsAddEditFormDTO formDTO) {
IcDangerousChemicalsEntity entity = baseDao.selectById(formDTO.getIcDangerousChemicalsId()); baseDao.del(formDTO.getIcDangerousChemicalsId(),formDTO.getUserId());
//先删除本组织先可能存在的名称相同的已经是无效的历史数据,为了表中的唯一索引不失效
baseDao.delByAgencyAndName(entity);
//再把当前数据置为无效数据
entity.setId(formDTO.getIcDangerousChemicalsId());
entity.setUpdatedBy(formDTO.getUserId());
baseDao.del(entity);
} }
@Override @Override

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

@ -67,48 +67,75 @@
updated_time = NOW() updated_time = NOW()
</insert> </insert>
<select id="selectDangerousChemicalsList" resultType="com.epmet.dto.result.IcDangerousChemicalsListResultDTO"> <select id="selectDangerousChemicalsList" parameterType="com.epmet.dto.form.IcDangerousChemicalsListFormDTO" resultType="com.epmet.dto.result.IcDangerousChemicalsListResultDTO">
SELECT SELECT
id icDangerousChemicalsId, dc.id icDangerousChemicalsId,
agency_id agencyId, dc.grid_id gridId,
source_type sourceType, concat(ORGANIZATION_NAME,'-',cg.GRID_NAME)as gridName,
`name` name, dc.agency_id agencyId,
category category, dc.source_type sourceType,
safe_distance safeDistance, dc.`name` name,
CONCAT(safe_distance,'公里') safeDistanceName, dc.category category,
danger_type dangerType, dc.safe_distance safeDistance,
principal_name principalName, CONCAT(dc.safe_distance,'公里') safeDistanceName,
principal_mobile principalMobile, dc.danger_type dangerType,
address address, dc.principal_name principalName,
longitude longitude, dc.principal_mobile principalMobile,
latitude latitude, dc.address address,
remark remark dc.longitude longitude,
dc.latitude latitude,
dc.remark remark,
dc.SECURITY_FLAG securityFlag,
dc.SECURITY_PRINCIPAL_NAME securityPrincipalName,
dc.BQ_LD bqLd,
dc.BQ_GB bqGb,
dc.COMPANY_PROFILE companyProfile
FROM FROM
ic_dangerous_chemicals 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 WHERE
del_flag = '0' dc.del_flag = '0'
<if test="icDangerousChemicalsId != null and icDangerousChemicalsId != '' "> <if test="icDangerousChemicalsId != null and icDangerousChemicalsId != '' ">
AND id = #{icDangerousChemicalsId} AND dc.id = #{icDangerousChemicalsId}
</if> </if>
<if test="customerId != null and customerId != '' "> <if test="customerId != null and customerId != '' ">
AND customer_id = #{customerId} AND dc.customer_id = #{customerId}
</if> </if>
<if test="agencyId != null and agencyId != '' "> <if test='orgType == "agency"'>
AND agency_id_path LIKE CONCAT('%',#{agencyId},'%') <if test="orgIdPath != null and orgIdPath != '' ">
AND dc.org_id_path like concat(#{orgIdPath},'%')
</if>
</if>
<if test='orgType == "grid"'>
<if test="orgId != null and orgId != '' ">
AND dc.grid_id=#{orgId}
</if>
</if> </if>
<if test="name != null and name != '' "> <if test="name != null and name != '' ">
AND name LIKE CONCAT('%', #{name}, '%') AND dc.name LIKE CONCAT('%', #{name}, '%')
</if> </if>
<if test="category != null and category != '' "> <if test="category != null and category != '' ">
AND category = #{category} AND dc.category = #{category}
</if> </if>
<if test="dangerType != null and dangerType != '' "> <if test="dangerType != null and dangerType != '' ">
AND danger_type = #{dangerType} AND dc.danger_type = #{dangerType}
</if>
<if test="address != null and address != '' ">
AND dc.ADDRESS LIKE CONCAT('%',#{address},'%')
</if>
<if test="principalName != null and principalName != '' ">
AND dc.PRINCIPAL_NAME LIKE CONCAT('%',#{principalName},'%')
</if>
<if test="securityPrincipalName != null and securityPrincipalName != '' ">
AND dc.SECURITY_PRINCIPAL_NAME LIKE CONCAT('%',#{securityPrincipalName},'%')
</if> </if>
ORDER BY created_time DESC ORDER BY dc.created_time DESC
</select> </select>
<delete id="del"> <delete id="del" parameterType="map">
UPDATE ic_dangerous_chemicals UPDATE ic_dangerous_chemicals
SET del_flag = '1', SET del_flag = '1',
updated_by = #{updatedBy}, updated_by = #{updatedBy},
@ -118,14 +145,5 @@
AND del_flag = '0' AND del_flag = '0'
</delete> </delete>
<delete id="delByAgencyAndName">
DELETE
FROM
ic_dangerous_chemicals
WHERE
del_flag != '0'
AND agency_id = #{agencyId}
AND `name` = #{name}
</delete>
</mapper> </mapper>
Loading…
Cancel
Save