diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceRecordV2Dao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceRecordV2Dao.xml
index 89f8764a30..05bcf1ad4b 100644
--- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceRecordV2Dao.xml
+++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceRecordV2Dao.xml
@@ -40,7 +40,7 @@
AND sr.SERVICE_TIME_END #{serviceTimeEnd}
- ORDER BY sr.CREATED_TIME DESC
+ ORDER BY sr.SERVICE_TIME_START DESC,sr.SERVICE_TIME_END DESC
diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcDangerousChemicalsDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcDangerousChemicalsDTO.java
index 8afffa5726..92e3ecf439 100644
--- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcDangerousChemicalsDTO.java
+++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcDangerousChemicalsDTO.java
@@ -1,8 +1,9 @@
package com.epmet.dto;
+import lombok.Data;
+
import java.io.Serializable;
import java.util.Date;
-import lombok.Data;
/**
@@ -21,6 +22,11 @@ public class IcDangerousChemicalsDTO implements Serializable {
*/
private String id;
+ /**
+ * 灵山:所属网格
+ */
+ private String gridId;
+
/**
* 客户Id
*/
@@ -36,6 +42,11 @@ public class IcDangerousChemicalsDTO implements Serializable {
*/
private String agencyIdPath;
+ /**
+ * 灵山:GRID_ID的全路径;包含grid_id
+ */
+ private String orgIdPath;
+
/**
* 来源【新增:add 导入:import 】
*/
@@ -62,19 +73,19 @@ public class IcDangerousChemicalsDTO implements Serializable {
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;
+ /**
+ * 灵山:是否重点安全企业;1是;0不是;必填
+ */
+ private Boolean securityFlag;
+
+ /**
+ * 灵山:安全负责人姓名
+ */
+ private String securityPrincipalName;
+
+ /**
+ * 灵山:手机号
+ */
+ private String securityPrincipalMobile;
+
+ /**
+ * 灵山:包企领导
+ */
+ private String bqLd;
+
+ /**
+ * 灵山:包企干部
+ */
+ private String bqGb;
+
+ /**
+ * 灵山:企业介绍
+ */
+ private String companyProfile;
+
/**
* 删除标识
*/
diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcDangerousChemicalsAddEditFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcDangerousChemicalsAddEditFormDTO.java
index c67cb48fb2..8a0747d5f1 100644
--- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcDangerousChemicalsAddEditFormDTO.java
+++ b/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;
-import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
-import com.epmet.commons.tools.validator.group.UpdateGroup;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
@@ -21,22 +20,36 @@ public class IcDangerousChemicalsAddEditFormDTO implements Serializable {
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
*/
- @NotBlank(message = "场所Id不能为空", groups = {UpdateGroup.class, Del.class})
+ @NotBlank(message = "企业Id不能为空", groups = {LingShanEditGroup.class, Del.class})
private String icDangerousChemicalsId;
/**
* 企业名称
*/
- @NotBlank(message = "企业名称不能为空", groups = {AddGroup.class})
- @Length(max = 50, message = "场所名称不能超过50位", groups = AddGroup.class)
+ @NotBlank(message = "企业名称不能为空", groups = {LingShanAddGroup.class, LingShanEditGroup.class})
+ @Length(max = 35, message = "企业名称最多输入35字", groups = LingShanAddGroup.class)
private String name;
+
/**
* 企业类型值
*/
- @NotBlank(message = "企业类型不能为空", groups = {AddGroup.class})
+ @NotBlank(message = "企业类型不能为空", groups = {LingShanAddGroup.class, LingShanEditGroup.class})
private String category;
+
/**
* 周边安全距离
*/
@@ -46,36 +59,70 @@ public class IcDangerousChemicalsAddEditFormDTO implements Serializable {
*/
private String dangerType;
/**
- * 负责人
+ * 负责人姓名;灵山项目中此列叫联系人
*/
private String principalName;
+
/**
- * 联系电话
+ * 负责人电话;灵山项目中此列叫联系电话
*/
private String principalMobile;
+
/**
* 经度
*/
- @NotBlank(message = "经度不能为空", groups = {AddGroup.class})
+ @NotBlank(message = "请完善经度信息", groups = {LingShanAddGroup.class, LingShanEditGroup.class})
private String longitude;
/**
* 维度
*/
- @NotBlank(message = "维度不能为空", groups = {AddGroup.class})
+ @NotBlank(message = "请完善纬度信息", groups = {LingShanAddGroup.class, LingShanEditGroup.class})
private String latitude;
+
/**
- * 地址
+ * 经营地址;灵山项目中此列叫企业地址
*/
- @NotBlank(message = "地址不能为空", groups = {AddGroup.class})
- @Length(max = 50, message = "地址不能超过50位", groups = AddGroup.class)
+ @NotBlank(message = "企业地址不能为空", groups = {LingShanAddGroup.class, LingShanEditGroup.class})
+ @Length(max = 200, message = "企业地址最多输入200字", groups = {LingShanAddGroup.class, LingShanEditGroup.class})
private String address;
+
/**
* 备注
*/
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 userId;
-
}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcDangerousChemicalsListFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcDangerousChemicalsListFormDTO.java
index b0b7e589f4..3c03625cd8 100644
--- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcDangerousChemicalsListFormDTO.java
+++ b/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;
+import com.epmet.commons.tools.dto.form.PageFormDTO;
import lombok.Data;
import java.io.Serializable;
@@ -9,34 +10,67 @@ import java.io.Serializable;
* @Author sun
*/
@Data
-public class IcDangerousChemicalsListFormDTO implements Serializable {
+public class IcDangerousChemicalsListFormDTO extends PageFormDTO implements Serializable {
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 category;
+
/**
* 危化品种类字典值
+ * 灵山界面暂无此列
*/
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;
+
+ /**
+ * tokenDto.customerId
+ */
private String customerId;
+ /**
+ * tokenDto.userId
+ */
private String staffId;
- private String agencyId;
}
diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcDangerousChemicalsListResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcDangerousChemicalsListResultDTO.java
index bf00d9205e..5d11141ab9 100644
--- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcDangerousChemicalsListResultDTO.java
+++ b/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
*/
private String icDangerousChemicalsId;
+ /**
+ * 灵山:所属网格
+ */
+ private String gridId;
+ /**
+ * xxx社区-网格名称
+ */
+ private String gridName;
/**
* 组织Id
*/
@@ -53,13 +61,15 @@ public class IcDangerousChemicalsListResultDTO implements Serializable {
*/
private String dangerTypeName;
/**
- * 负责人
+ * 负责人姓名;灵山项目中此列叫联系人
*/
private String principalName;
+
/**
- * 联系电话
+ * 负责人电话;灵山项目中此列叫联系电话
*/
private String principalMobile;
+
/**
* 经度
*/
@@ -69,7 +79,7 @@ public class IcDangerousChemicalsListResultDTO implements Serializable {
*/
private String latitude;
/**
- * 地址
+ * 经营地址;灵山项目中此列叫企业地址
*/
private String address;
/**
@@ -77,4 +87,33 @@ public class IcDangerousChemicalsListResultDTO implements Serializable {
*/
private String remark;
+ /**
+ * 灵山:是否重点安全企业;1是;0不是;必填
+ */
+ private Boolean securityFlag;
+
+ /**
+ * 灵山:安全负责人姓名
+ */
+ private String securityPrincipalName;
+
+ /**
+ * 灵山:手机号
+ */
+ private String securityPrincipalMobile;
+
+ /**
+ * 灵山:包企领导
+ */
+ private String bqLd;
+
+ /**
+ * 灵山:包企干部
+ */
+ private String bqGb;
+
+ /**
+ * 灵山:企业介绍
+ */
+ private String companyProfile;
}
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcDangerousChemicalsController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcDangerousChemicalsController.java
index d69c856fb1..522bd55c3a 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcDangerousChemicalsController.java
+++ b/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.aop.NoRepeatSubmit;
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.EpmetException;
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.poi.excel.handler.FreezeAndFilter;
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.dto.IcDangerousChemicalsDTO;
import com.epmet.dto.form.IcDangerousChemicalsAddEditFormDTO;
@@ -32,7 +28,6 @@ import com.epmet.dto.result.ImportTaskCommonResultDTO;
import com.epmet.excel.IcDangerousChemicalsExcel;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import com.epmet.service.IcDangerousChemicalsService;
-import com.epmet.utils.ImportTaskUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.io.IOUtils;
@@ -72,6 +67,12 @@ public class IcDangerousChemicalsController {
@Autowired
private EpmetCommonServiceOpenFeignClient epmetCommonServiceOpenFeignClient;
+ /**
+ * 重点危化品企业 列表分页
+ * @param tokenDto
+ * @param formDTO
+ * @return
+ */
@RequestMapping("list")
public Result> list(@LoginUser TokenDto tokenDto, @RequestBody IcDangerousChemicalsListFormDTO formDTO) {
formDTO.setCustomerId(tokenDto.getCustomerId());
@@ -85,26 +86,44 @@ public class IcDangerousChemicalsController {
return new Result().ok(data);
}
+ /**
+ * 重点危化品企业 新增
+ * @param tokenDto
+ * @param dto
+ * @return
+ */
@NoRepeatSubmit
@PostMapping("add")
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.setUserId(tokenDto.getUserId());
icDangerousChemicalsService.save(dto);
return new Result();
}
+ /**
+ * 重点危化品企业 编辑
+ * @param tokenDto
+ * @param formDTO
+ * @return
+ */
@NoRepeatSubmit
@PostMapping("edit")
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.setUserId(tokenDto.getUserId());
icDangerousChemicalsService.update(formDTO);
return new Result();
}
+ /**
+ * 重点危化品企业 删除
+ * @param tokenDto
+ * @param formDTO
+ * @return
+ */
@PostMapping("del")
public Result delete(@LoginUser TokenDto tokenDto, @RequestBody IcDangerousChemicalsAddEditFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, IcDangerousChemicalsAddEditFormDTO.Del.class);
@@ -114,11 +133,21 @@ public class IcDangerousChemicalsController {
return new Result();
}
+ /**
+ * 重点危化品企业 查看详情
+ * @param formDTO
+ * @return
+ */
@RequestMapping("detail")
public Result detail(@RequestBody IcDangerousChemicalsListFormDTO formDTO) {
return new Result().ok(icDangerousChemicalsService.detail(formDTO));
}
+ /**
+ * 重点危化品企业 下载导入模板
+ * @param response
+ * @throws IOException
+ */
@RequestMapping(value = "download", method = {RequestMethod.GET, RequestMethod.POST})
public void downloadTemplate(HttpServletResponse response) throws IOException {
response.setCharacterEncoding("UTF-8");
@@ -137,6 +166,13 @@ public class IcDangerousChemicalsController {
}
}
+ /**
+ * 重点危化品企业 导出
+ * @param tokenDto
+ * @param formDTO
+ * @param response
+ * @throws IOException
+ */
@PostMapping("export")
public void export(@LoginUser TokenDto tokenDto, @RequestBody IcDangerousChemicalsListFormDTO formDTO, HttpServletResponse response) throws IOException {
formDTO.setCustomerId(tokenDto.getCustomerId());
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcDangerousChemicalsDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcDangerousChemicalsDao.java
index 83adfa87b8..1cc152c5f5 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcDangerousChemicalsDao.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcDangerousChemicalsDao.java
@@ -20,9 +20,8 @@ public interface IcDangerousChemicalsDao extends BaseDao selectDangerousChemicalsList(IcDangerousChemicalsListFormDTO formDTO);
- void del(IcDangerousChemicalsEntity entity);
+ void del(@Param("id") String id,@Param("updatedBy") String updatedBy);
void importInsert(@Param("entityList") List entityList);
- void delByAgencyAndName(IcDangerousChemicalsEntity entity);
}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/IcDangerousChemicalsEntity.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/IcDangerousChemicalsEntity.java
index 413cba21d6..edf0054d58 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/IcDangerousChemicalsEntity.java
+++ b/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 gridId;
+
/**
* 所属组织机构Id
*/
@@ -34,6 +39,11 @@ public class IcDangerousChemicalsEntity extends BaseEpmetEntity {
*/
private String agencyIdPath;
+ /**
+ * 灵山:GRID_ID的全路径;包含grid_id
+ */
+ private String orgIdPath;
+
/**
* 来源【新增:add 导入:import 】
*/
@@ -59,19 +69,19 @@ public class IcDangerousChemicalsEntity extends BaseEpmetEntity {
*/
private String dangerType;
- /**
- * 负责人姓名
- */
+ /**
+ * 负责人姓名;灵山项目中此列叫联系人
+ */
private String principalName;
- /**
- * 负责人电话
- */
+ /**
+ * 负责人电话;灵山项目中此列叫联系电话
+ */
private String principalMobile;
- /**
- * 经营地址
- */
+ /**
+ * 经营地址;灵山项目中此列叫企业地址
+ */
private String address;
/**
@@ -89,6 +99,36 @@ public class IcDangerousChemicalsEntity extends BaseEpmetEntity {
*/
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)
private String dangerTypeName;
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/EnterpriseImportExcelDTO.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/EnterpriseImportExcelDTO.java
index becc763ba3..55bbb1d60f 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/EnterpriseImportExcelDTO.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/EnterpriseImportExcelDTO.java
@@ -5,7 +5,6 @@ import com.alibaba.excel.annotation.write.style.ColumnWidth;
import lombok.Data;
import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotNull;
/**
@@ -59,9 +58,9 @@ public class EnterpriseImportExcelDTO {
* 4:100人以上】
* 改为手输数字了
*/
- @NotNull(message = "规模不能为空")
+ @NotBlank(message = "规模不能为空")
@ExcelProperty(value = "规模")
- private Integer scaleTotal;
+ private String scaleTotal;
/**
* 场所负责人
@@ -110,7 +109,7 @@ public class EnterpriseImportExcelDTO {
@ColumnWidth(20)
@ExcelProperty(value = "规模")
- private Integer scaleTotal;
+ private String scaleTotal;
@ColumnWidth(20)
@ExcelProperty(value = "负责人")
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/handler/IcEnterpriseExcelImportListener.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/handler/IcEnterpriseExcelImportListener.java
index 5495dd6ff6..99a76ad94e 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/handler/IcEnterpriseExcelImportListener.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/handler/IcEnterpriseExcelImportListener.java
@@ -5,6 +5,8 @@ import com.alibaba.excel.read.listener.ReadListener;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
+import com.epmet.commons.tools.exception.EpmetErrorCode;
+import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.ExceptionUtils;
import com.epmet.commons.tools.exception.ValidateException;
import com.epmet.commons.tools.utils.ConvertUtils;
@@ -67,11 +69,16 @@ public class IcEnterpriseExcelImportListener implements ReadListener list(IcDangerousChemicalsListFormDTO formDTO) {
- CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId());
- if (null == staffInfo) {
- throw new EpmetException("获取工作人员信息失败");
+ if(StringUtils.isBlank(formDTO.getOrgId())||StringUtils.isBlank(formDTO.getOrgType())){
+ CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId());
+ 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());
List list = baseDao.selectDangerousChemicalsList(formDTO);
@@ -138,60 +148,56 @@ public class IcDangerousChemicalsServiceImpl extends BaseServiceImpl tWrapper = new LambdaQueryWrapper<>();
- tWrapper.eq(IcDangerousChemicalsEntity::getAgencyId, staffInfo.getAgencyId());
- tWrapper.eq(IcDangerousChemicalsEntity::getName, formDTO.getName());
- List entityList = baseDao.selectList(tWrapper);
- if (!CollectionUtils.isEmpty(entityList)) {
- throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "当前组织下已存在相同名称的场所");
- }
+ //1.获取网格信息
+ CustomerGridDTO customerGridDTO=SpringContextUtils.getBean(CustomerGridService.class).get(formDTO.getGridId());
+ // 2.同一网格下,企业名称唯一
+ checkNameUnqiue(formDTO.getGridId(),formDTO.getName(), StrConstant.EPMETY_STR,customerGridDTO.getGridName());
//3.新增服务组织数据
IcDangerousChemicalsEntity entity = ConvertUtils.sourceToTarget(formDTO, IcDangerousChemicalsEntity.class);
entity.setSourceType("add");
- entity.setAgencyId(staffInfo.getAgencyId());
- entity.setAgencyIdPath(StringUtils.isEmpty(staffInfo.getAgencyPIds()) ? staffInfo.getAgencyId() : staffInfo.getAgencyPIds() + ":" + staffInfo.getAgencyId());
+ entity.setAgencyId(customerGridDTO.getPid());
+ entity.setAgencyIdPath(customerGridDTO.getPids());
+ entity.setOrgIdPath(PidUtils.convertPid2OrgIdPath(customerGridDTO.getId(),customerGridDTO.getPids()));
insert(entity);
}
+ /**
+ * 同一网格下,企业名称唯一
+ * @param gridId
+ * @param name
+ * @param icDangerousChemicalsId
+ */
+ private void checkNameUnqiue(String gridId, String name, String icDangerousChemicalsId,String gridName) {
+ LambdaQueryWrapper 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
@Transactional(rollbackFor = Exception.class)
public void update(IcDangerousChemicalsAddEditFormDTO formDTO) {
- //1.获取当前工作人员缓存信息
- CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId());
- if (null == staffInfo) {
- throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", formDTO.getUserId()));
- }
- //2.校验同组织下服务组织名称不能重复
- LambdaQueryWrapper tWrapper = new LambdaQueryWrapper<>();
- tWrapper.eq(IcDangerousChemicalsEntity::getAgencyId, staffInfo.getAgencyId());
- tWrapper.ne(IcDangerousChemicalsEntity::getId, formDTO.getIcDangerousChemicalsId());
- tWrapper.eq(IcDangerousChemicalsEntity::getName, formDTO.getName());
- List entityList = baseDao.selectList(tWrapper);
- if (!CollectionUtils.isEmpty(entityList)) {
- throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "当前组织下已存在相同名称的服务组织");
- }
+ //1.获取网格信息
+ CustomerGridDTO customerGridDTO=SpringContextUtils.getBean(CustomerGridService.class).get(formDTO.getGridId());
+ // 2.同一网格下,企业名称唯一
+ checkNameUnqiue(formDTO.getGridId(),formDTO.getName(), formDTO.getIcDangerousChemicalsId(),customerGridDTO.getGridName());
//3.更新服务组织数据
IcDangerousChemicalsEntity entity = ConvertUtils.sourceToTarget(formDTO, IcDangerousChemicalsEntity.class);
entity.setId(formDTO.getIcDangerousChemicalsId());
+ entity.setAgencyId(customerGridDTO.getPid());
+ entity.setAgencyIdPath(customerGridDTO.getPids());
+ entity.setOrgIdPath(PidUtils.convertPid2OrgIdPath(customerGridDTO.getId(),customerGridDTO.getPids()));
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(IcDangerousChemicalsAddEditFormDTO formDTO) {
- IcDangerousChemicalsEntity entity = baseDao.selectById(formDTO.getIcDangerousChemicalsId());
- //先删除本组织先可能存在的名称相同的已经是无效的历史数据,为了表中的唯一索引不失效
- baseDao.delByAgencyAndName(entity);
- //再把当前数据置为无效数据
- entity.setId(formDTO.getIcDangerousChemicalsId());
- entity.setUpdatedBy(formDTO.getUserId());
- baseDao.del(entity);
+ baseDao.del(formDTO.getIcDangerousChemicalsId(),formDTO.getUserId());
}
@Override
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcEnterpriseServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcEnterpriseServiceImpl.java
index f5da256144..399c2df6b0 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcEnterpriseServiceImpl.java
+++ b/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.alibaba.excel.EasyExcel;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.aop.NoRepeatSubmit;
@@ -167,7 +168,16 @@ public class IcEnterpriseServiceImpl extends BaseServiceImpl update=new LambdaUpdateWrapper<>();
+ update.eq(IcEnterprisePatrolRecordEntity::getId, formDTO.getPatrolId())
+ .set(IcEnterprisePatrolRecordEntity::getPatrolTime, formDTO.getPatrolTime())
+ .set(IcEnterprisePatrolRecordEntity::getStaffId, formDTO.getStaffId())
+ .set(IcEnterprisePatrolRecordEntity::getStaffName, formDTO.getStaffName())
+ .set(IcEnterprisePatrolRecordEntity::getMobile, formDTO.getMobile())
+ .set(IcEnterprisePatrolRecordEntity::getResult, formDTO.getResult())
+ .set(IcEnterprisePatrolRecordEntity::getDetailed, formDTO.getDetailed())
+ .set(IcEnterprisePatrolRecordEntity::getReviewTime, formDTO.getReviewTime());
+ enterprisePatrolRecordDao.update(null,update);
//删除之前的图片
enterprisePatrolAttachmentDao.deleteByPatrolId(formDTO.getPatrolId(), formDTO.getUserId());
}
@@ -184,7 +194,19 @@ public class IcEnterpriseServiceImpl extends BaseServiceImpl queryWrapper = new LambdaQueryWrapper();
+ queryWrapper.eq(IcEnterprisePatrolRecordEntity::getEnterpriseId, formDTO.getEnterpriseId())
+ .orderByDesc(IcEnterprisePatrolRecordEntity::getPatrolTime)
+ .orderByDesc(IcEnterprisePatrolRecordEntity::getCreatedTime)
+ .last("limit 1");
+ IcEnterprisePatrolRecordEntity latestPatrol = enterprisePatrolRecordDao.selectOne(queryWrapper);
+ if (null != latestPatrol) {
+ // 更新主表的最新结果和最新检查时间
+ baseDao.updateLatestPatrol(formDTO.getEnterpriseId(), latestPatrol.getPatrolTime(), latestPatrol.getResult(), formDTO.getUserId());
+ }else{
+ baseDao.updateLatestPatrol(formDTO.getEnterpriseId(), null, StrConstant.EPMETY_STR, formDTO.getUserId());
+ }
return patrolRecordEntity.getId();
}
@@ -200,14 +222,27 @@ public class IcEnterpriseServiceImpl extends BaseServiceImpl patrolUpdate = new LambdaUpdateWrapper<>();
+ patrolUpdate.eq(IcEnterprisePatrolRecordEntity::getId, patrolId)
+ .set(IcEnterprisePatrolRecordEntity::getUpdatedBy, currentUserId)
+ .set(IcEnterprisePatrolRecordEntity::getUpdatedTime, nowTime)
+ .set(IcEnterprisePatrolRecordEntity::getDelFlag, NumConstant.ONE_STR);
+ enterprisePatrolRecordDao.update(null, patrolUpdate);
//2、删除之前的图片
enterprisePatrolAttachmentDao.deleteByPatrolId(patrolId, currentUserId);
- //3、如果是记录清空,那主表的最近一次巡查时间和最新结果也置空
+ // 3、如果是记录清空,那主表的最近一次巡查时间和最新结果也置空
LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>();
- queryWrapper.eq(IcEnterprisePatrolRecordEntity::getEnterpriseId, origin.getEnterpriseId());
- if (NumConstant.ZERO == enterprisePatrolRecordDao.selectCount(queryWrapper)) {
+ queryWrapper.eq(IcEnterprisePatrolRecordEntity::getEnterpriseId, origin.getEnterpriseId())
+ .orderByDesc(IcEnterprisePatrolRecordEntity::getPatrolTime)
+ .orderByDesc(IcEnterprisePatrolRecordEntity::getCreatedTime)
+ .last("limit 1");
+ IcEnterprisePatrolRecordEntity latestPatrol = enterprisePatrolRecordDao.selectOne(queryWrapper);
+ if (null != latestPatrol) {
+ // 更新主表的最新结果和最新检查时间
+ baseDao.updateLatestPatrol(origin.getEnterpriseId(), latestPatrol.getPatrolTime(), latestPatrol.getResult(), currentUserId);
+ } else {
baseDao.updateLatestPatrol(origin.getEnterpriseId(), null, StrConstant.EPMETY_STR, currentUserId);
}
}
diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/excel/enterprise_patrol_import_tem.xlsx b/epmet-module/gov-org/gov-org-server/src/main/resources/excel/enterprise_patrol_import_tem.xlsx
index 6981727e9b..7b748c289e 100644
Binary files a/epmet-module/gov-org/gov-org-server/src/main/resources/excel/enterprise_patrol_import_tem.xlsx and b/epmet-module/gov-org/gov-org-server/src/main/resources/excel/enterprise_patrol_import_tem.xlsx differ
diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcDangerousChemicalsDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcDangerousChemicalsDao.xml
index 99d3138558..4a37272196 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcDangerousChemicalsDao.xml
+++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcDangerousChemicalsDao.xml
@@ -67,48 +67,75 @@
updated_time = NOW()
-
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcResiUserEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcResiUserEntity.java
index 7611a80a9f..a78fae885d 100644
--- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcResiUserEntity.java
+++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcResiUserEntity.java
@@ -42,12 +42,12 @@ public class IcResiUserEntity extends BaseEpmetEntity {
private String customerId;
/**
- *
+ * 组织Id
*/
private String agencyId;
/**
- *
+ * 组织的pids 含agencyId本身
*/
private String pids;
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiCollectServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiCollectServiceImpl.java
index c519210d7b..bfecfa4671 100644
--- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiCollectServiceImpl.java
+++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiCollectServiceImpl.java
@@ -15,6 +15,7 @@ import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
+import com.epmet.commons.tools.utils.PidUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.IcResiCollectDao;
import com.epmet.dao.IcResiMemberDao;
@@ -491,8 +492,12 @@ public class IcResiCollectServiceImpl extends BaseServiceImpl