From e554f39c5cac88caf00144ecdd2166e32e32e12f Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Mon, 21 Feb 2022 13:41:56 +0800 Subject: [PATCH 1/9] =?UTF-8?q?/gov/org/grid/addgrid=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E7=BD=91=E6=A0=BC=EF=BC=8C=E5=A2=9E=E5=8A=A0=E4=B8=AD=E5=BF=83?= =?UTF-8?q?=E7=82=B9=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/dto/form/AddGridFormDTO.java | 13 +++++++++++++ .../epmet/service/impl/CustomerGridServiceImpl.java | 4 +++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddGridFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddGridFormDTO.java index 965f8b5fc6..cfe4ee00e3 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddGridFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddGridFormDTO.java @@ -51,4 +51,17 @@ public class AddGridFormDTO implements Serializable { */ private String mobile; + //02.21新增需求:小程序工作端添加组织增加中心点位置入口,点击进入地图选择点位,可以搜索,中心点为必填 + //该接口为通用接口,后端暂时先不限制必填。由前端控制 + /** + * 中心位置经度 + */ + // @NotBlank(message = "请选择网格中心点位", groups = AddGridFormDTO.AddGrid.class) + private String longitude; + + /** + * 中心位置纬度 + */ + // @NotBlank(message = "请选择网格中心点位", groups = AddGridFormDTO.AddGrid.class) + private String latitude; } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java index 57fc7340fb..d9f604bb7d 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java @@ -272,7 +272,9 @@ public class CustomerGridServiceImpl extends BaseServiceImpl Date: Mon, 21 Feb 2022 13:51:05 +0800 Subject: [PATCH 2/9] =?UTF-8?q?/gov/org/grid/editgrid=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E7=BD=91=E6=A0=BC=EF=BC=8C=E5=A2=9E=E5=8A=A0=E4=B8=AD=E5=BF=83?= =?UTF-8?q?=E7=82=B9=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/dto/form/EditGridFormDTO.java | 13 +++++++++++++ .../epmet/service/impl/CustomerGridServiceImpl.java | 6 ++++++ .../src/main/resources/mapper/CustomerGridDao.xml | 6 ++++++ 3 files changed, 25 insertions(+) diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditGridFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditGridFormDTO.java index 1c42608fd8..a10eef56a3 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditGridFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditGridFormDTO.java @@ -59,4 +59,17 @@ public class EditGridFormDTO implements Serializable { */ private String mobile; + //02.21新增需求:小程序工作端添加组织增加中心点位置入口,点击进入地图选择点位,可以搜索,中心点为必填 + //该接口为通用接口,后端暂时先不限制必填。由前端控制 + /** + * 中心位置经度 + */ + // @NotBlank(message = "请选择网格中心点位", groups = AddGridFormDTO.AddGrid.class) + private String longitude; + + /** + * 中心位置纬度 + */ + // @NotBlank(message = "请选择网格中心点位", groups = AddGridFormDTO.AddGrid.class) + private String latitude; } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java index d9f604bb7d..79559818db 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java @@ -316,6 +316,12 @@ public class CustomerGridServiceImpl extends BaseServiceImpl + LONGITUDE= #{longitude}, + + + LATITUDE= #{latitude}, + UPDATED_TIME=NOW() where id = #{id} From de74af16c57961f01272dc595637e42f9a26405f Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Mon, 21 Feb 2022 14:10:55 +0800 Subject: [PATCH 3/9] =?UTF-8?q?/gov/org/agency/editagency=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E7=BB=84=E7=BB=87=EF=BC=8C=E5=A2=9E=E5=8A=A0=E4=B8=AD?= =?UTF-8?q?=E5=BF=83=E7=82=B9=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/dto/form/EditAgencyFormDTO.java | 14 ++++++++++++++ .../com/epmet/service/impl/AgencyServiceImpl.java | 7 ++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditAgencyFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditAgencyFormDTO.java index 7b3ff97ed8..7d7b6c70b5 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditAgencyFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditAgencyFormDTO.java @@ -89,4 +89,18 @@ public class EditAgencyFormDTO implements Serializable { @NotBlank(message = "组织级别不能为空;社区级:community,乡(镇、街道)级:street,区县级: district,市级: city省级:province", groups = AddAgencyV2FormDTO.AddUserInternalGroup.class) private String level; + + //02.21新增需求:小程序工作端添加组织增加中心点位置入口,点击进入地图选择点位,可以搜索,中心点为必填 + //该接口为通用接口,后端暂时先不限制必填。由前端控制 + /** + * 中心位置经度 + */ + // @NotBlank(message = "请选择网格中心点位", groups = AddGridFormDTO.AddGrid.class) + private String longitude; + + /** + * 中心位置纬度 + */ + // @NotBlank(message = "请选择网格中心点位", groups = AddGridFormDTO.AddGrid.class) + private String latitude; } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java index 535d411b79..5c4e3f6727 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java @@ -158,7 +158,12 @@ public class AgencyServiceImpl implements AgencyService { originalEntity.setCode(formDTO.getCode()); originalEntity.setContacts(formDTO.getContacts()); originalEntity.setMobile(formDTO.getMobile()); - + if(StringUtils.isNotBlank(formDTO.getLatitude())){ + originalEntity.setLatitude(formDTO.getLatitude()); + } + if(StringUtils.isNotBlank(formDTO.getLongitude())){ + originalEntity.setLongitude(formDTO.getLongitude()); + } //当前客户开启了area_code_switch参数:open: 选择地区编码必填;closed: 无需选择地区编码 if (CustomerAgencyConstant.AREA_CODE_SWITCH_OPEN.equals(formDTO.getAreaCodeSwitch())) { CustomerAgencyEntity parent = customerAgencyDao.selectById(originalEntity.getPid()); From 462cbfe6b7e7b9e032d2341c3ce1b742006aeb8a Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Mon, 21 Feb 2022 14:15:19 +0800 Subject: [PATCH 4/9] =?UTF-8?q?/gov/org/agency/addagency-v2=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E7=BB=84=E7=BB=87=EF=BC=8C=E5=A2=9E=E5=8A=A0=E4=B8=AD?= =?UTF-8?q?=E5=BF=83=E7=82=B9=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/dto/form/AddAgencyFormDTO.java | 13 +++++++++++++ .../com/epmet/dto/form/AddAgencyV2FormDTO.java | 14 ++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyFormDTO.java index 7a5e6b5537..a535bab867 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyFormDTO.java @@ -85,4 +85,17 @@ public class AddAgencyFormDTO implements Serializable { @Length(max=30,message = "区县级机关名称不能超过30个字") private String district; + //02.21新增需求:小程序工作端添加组织增加中心点位置入口,点击进入地图选择点位,可以搜索,中心点为必填 + //该接口为通用接口,后端暂时先不限制必填。由前端控制 + /** + * 中心位置经度 + */ + // @NotBlank(message = "请选择网格中心点位", groups = AddGridFormDTO.AddGrid.class) + private String longitude; + + /** + * 中心位置纬度 + */ + // @NotBlank(message = "请选择网格中心点位", groups = AddGridFormDTO.AddGrid.class) + private String latitude; } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyV2FormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyV2FormDTO.java index 50ee7a010c..83d904cb07 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyV2FormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyV2FormDTO.java @@ -99,4 +99,18 @@ public class AddAgencyV2FormDTO implements Serializable { * 联系电话 */ private String mobile; + + //02.21新增需求:小程序工作端添加组织增加中心点位置入口,点击进入地图选择点位,可以搜索,中心点为必填 + //该接口为通用接口,后端暂时先不限制必填。由前端控制 + /** + * 中心位置经度 + */ + // @NotBlank(message = "请选择网格中心点位", groups = AddGridFormDTO.AddGrid.class) + private String longitude; + + /** + * 中心位置纬度 + */ + // @NotBlank(message = "请选择网格中心点位", groups = AddGridFormDTO.AddGrid.class) + private String latitude; } From b5d6ec8bd4d130074a7faef82c21658a330cdfe9 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Mon, 21 Feb 2022 14:35:08 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E7=BB=84=E7=BB=87=E7=BD=91=E6=A0=BC?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0centerAddress=E4=B8=AD=E5=BF=83=E7=82=B9?= =?UTF-8?q?=E4=BD=8D=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/dto/CustomerGridDTO.java | 5 +++++ .../java/com/epmet/dto/form/AddAgencyFormDTO.java | 5 +++++ .../com/epmet/dto/form/AddAgencyV2FormDTO.java | 5 +++++ .../java/com/epmet/dto/form/AddGridFormDTO.java | 5 +++++ .../com/epmet/dto/form/EditAgencyFormDTO.java | 5 +++++ .../java/com/epmet/dto/form/EditGridFormDTO.java | 5 +++++ .../com/epmet/dto/result/AgencysResultDTO.java | 15 +++++++++++++++ .../com/epmet/dto/result/GridDetailResultDTO.java | 5 +++++ .../com/epmet/entity/CustomerAgencyEntity.java | 5 +++++ .../java/com/epmet/entity/CustomerGridEntity.java | 5 +++++ .../com/epmet/service/impl/AgencyServiceImpl.java | 1 + .../service/impl/CustomerGridServiceImpl.java | 2 ++ .../migration/V0.0.12__addagency_grid_address.sql | 2 ++ .../src/main/resources/mapper/CustomerGridDao.xml | 4 ++++ 14 files changed, 69 insertions(+) create mode 100644 epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.12__addagency_grid_address.sql diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerGridDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerGridDTO.java index a3600b2e0e..7acfd64627 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerGridDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerGridDTO.java @@ -62,6 +62,11 @@ public class CustomerGridDTO implements Serializable { */ private String latitude; + /** + * 中心点位位置 + */ + private String centerAddress; + /** * 所属地区码(所属组织地区码) */ diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyFormDTO.java index a535bab867..575a498d57 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyFormDTO.java @@ -98,4 +98,9 @@ public class AddAgencyFormDTO implements Serializable { */ // @NotBlank(message = "请选择网格中心点位", groups = AddGridFormDTO.AddGrid.class) private String latitude; + + /** + * 中心点位位置 + */ + private String centerAddress; } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyV2FormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyV2FormDTO.java index 83d904cb07..0cbb5c1ab5 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyV2FormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyV2FormDTO.java @@ -113,4 +113,9 @@ public class AddAgencyV2FormDTO implements Serializable { */ // @NotBlank(message = "请选择网格中心点位", groups = AddGridFormDTO.AddGrid.class) private String latitude; + + /** + * 中心点位位置 + */ + private String centerAddress; } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddGridFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddGridFormDTO.java index cfe4ee00e3..9eab6ce157 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddGridFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddGridFormDTO.java @@ -64,4 +64,9 @@ public class AddGridFormDTO implements Serializable { */ // @NotBlank(message = "请选择网格中心点位", groups = AddGridFormDTO.AddGrid.class) private String latitude; + + /** + * 中心点位位置 + */ + private String centerAddress; } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditAgencyFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditAgencyFormDTO.java index 7d7b6c70b5..7473027fde 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditAgencyFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditAgencyFormDTO.java @@ -103,4 +103,9 @@ public class EditAgencyFormDTO implements Serializable { */ // @NotBlank(message = "请选择网格中心点位", groups = AddGridFormDTO.AddGrid.class) private String latitude; + + /** + * 中心点位位置 + */ + private String centerAddress; } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditGridFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditGridFormDTO.java index a10eef56a3..8774da4f99 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditGridFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditGridFormDTO.java @@ -72,4 +72,9 @@ public class EditGridFormDTO implements Serializable { */ // @NotBlank(message = "请选择网格中心点位", groups = AddGridFormDTO.AddGrid.class) private String latitude; + + /** + * 中心点位位置 + */ + private String centerAddress; } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencysResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencysResultDTO.java index cace2a4c84..99028d23bb 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencysResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencysResultDTO.java @@ -118,4 +118,19 @@ public class AgencysResultDTO implements Serializable { * 联系电话 */ private String mobile; + + /** + * 中心位置经度 + */ + private String longitude; + + /** + * 中心位置纬度 + */ + private String latitude; + + /** + * 中心点位位置 + */ + private String centerAddress; } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridDetailResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridDetailResultDTO.java index f9a2726a1a..cae98d8bc4 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridDetailResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridDetailResultDTO.java @@ -35,6 +35,11 @@ public class GridDetailResultDTO implements Serializable { */ private String latitude; + /** + * 中心点位位置 + */ + private String centerAddress; + /** * 所属地区码(所属组织地区码) */ diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerAgencyEntity.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerAgencyEntity.java index cde41fbecc..fda8070609 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerAgencyEntity.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerAgencyEntity.java @@ -124,6 +124,11 @@ public class CustomerAgencyEntity extends BaseEpmetEntity { */ private String latitude; + /** + * 中心点位位置 + */ + private String centerAddress; + /** * 组织编码 */ diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerGridEntity.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerGridEntity.java index 49fe1b4bdb..d6018c2a29 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerGridEntity.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerGridEntity.java @@ -55,6 +55,11 @@ public class CustomerGridEntity extends BaseEpmetEntity { */ private String latitude; + /** + * 中心点位位置 + */ + private String centerAddress; + /** * 所属地区码(所属组织地区码) */ diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java index 5c4e3f6727..c20fd83965 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java @@ -164,6 +164,7 @@ public class AgencyServiceImpl implements AgencyService { if(StringUtils.isNotBlank(formDTO.getLongitude())){ originalEntity.setLongitude(formDTO.getLongitude()); } + originalEntity.setCenterAddress(formDTO.getCenterAddress()); //当前客户开启了area_code_switch参数:open: 选择地区编码必填;closed: 无需选择地区编码 if (CustomerAgencyConstant.AREA_CODE_SWITCH_OPEN.equals(formDTO.getAreaCodeSwitch())) { CustomerAgencyEntity parent = customerAgencyDao.selectById(originalEntity.getPid()); diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java index 79559818db..cd0080f548 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java @@ -275,6 +275,7 @@ public class CustomerGridServiceImpl extends BaseServiceImpl LATITUDE= #{latitude}, + + CENTER_ADDRESS= #{centerAddress}, + UPDATED_TIME=NOW() where id = #{id} From 75467a89d8eace950dcadf9ca772c283d05b3e53 Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Mon, 21 Feb 2022 16:32:53 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9A=201.commonservi?= =?UTF-8?q?ce=E4=B8=AD=E5=AF=BC=E5=85=A5=E4=BB=BB=E5=8A=A1=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E7=9A=84=E6=8E=A5=E5=8F=A3=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=EF=BC=9A=201.=E5=B1=85=E6=B0=91=E4=BF=A1=E6=81=AF=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=E4=B8=AD=E8=B0=83=E7=94=A8commonservice=E4=B8=AD?= =?UTF-8?q?=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/constants}/ImportTaskConstants.java | 4 +- .../dto/form/ImportTaskCommonFormDTO.java | 47 +++++++++ .../dto/result/ImportTaskCommonResultDTO.java | 14 +++ .../EpmetCommonServiceOpenFeignClient.java | 18 +++- ...tCommonServiceOpenFeignClientFallback.java | 10 ++ .../controller/ImportTaskController.java | 57 +++++++++++ .../java/com/epmet/dao/ImportTaskDao.java | 0 .../com/epmet/entity/ImportTaskEntity.java | 47 +++++++++ .../com/epmet/service/ImportTaskService.java | 14 +-- .../service/impl/ImportTaskServiceImpl.java | 33 ++++++- .../main/resources/mapper/ImportTaskDao.xml | 0 epmet-user/epmet-user-server/pom.xml | 5 + .../controller/IcResiUserController.java | 24 ++--- .../service/IcResiUserImportService.java | 18 ++++ .../impl/IcResiUserImportServiceImpl.java | 96 +++++++++---------- 15 files changed, 305 insertions(+), 82 deletions(-) rename {epmet-user/epmet-user-client/src/main/java/com/epmet/constant => epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/constants}/ImportTaskConstants.java (89%) create mode 100644 epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/ImportTaskCommonFormDTO.java create mode 100644 epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/result/ImportTaskCommonResultDTO.java create mode 100644 epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/ImportTaskController.java rename {epmet-user/epmet-user-server => epmet-module/epmet-common-service/common-service-server}/src/main/java/com/epmet/dao/ImportTaskDao.java (100%) create mode 100644 epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/entity/ImportTaskEntity.java rename {epmet-user/epmet-user-server => epmet-module/epmet-common-service/common-service-server}/src/main/java/com/epmet/service/ImportTaskService.java (69%) rename {epmet-user/epmet-user-server => epmet-module/epmet-common-service/common-service-server}/src/main/java/com/epmet/service/impl/ImportTaskServiceImpl.java (58%) rename {epmet-user/epmet-user-server => epmet-module/epmet-common-service/common-service-server}/src/main/resources/mapper/ImportTaskDao.xml (100%) diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/ImportTaskConstants.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/constants/ImportTaskConstants.java similarity index 89% rename from epmet-user/epmet-user-client/src/main/java/com/epmet/constant/ImportTaskConstants.java rename to epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/constants/ImportTaskConstants.java index 685e80a39a..ed16f5473c 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/ImportTaskConstants.java +++ b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/constants/ImportTaskConstants.java @@ -1,11 +1,11 @@ -package com.epmet.constant; +package com.epmet.constants; /** * 导入任务的业务类型常量 */ public interface ImportTaskConstants { /** - * 居民 + * 业务类型:居民 */ String BIZ_TYPE_RESI = "resi"; diff --git a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/ImportTaskCommonFormDTO.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/ImportTaskCommonFormDTO.java new file mode 100644 index 0000000000..07a6137ca4 --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/ImportTaskCommonFormDTO.java @@ -0,0 +1,47 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +@Data +public class ImportTaskCommonFormDTO { + + public interface Create {} + public interface Finish {} + + /** + * 操作者ID + */ + @NotBlank(message = "操作者ID必填", groups = { Create.class, Finish.class }) + private String operatorId; + + /** + * 业务类型 + */ + @NotBlank(message = "业务类型必填", groups = { Create.class }) + private String bizType; + + /** + * 任务ID + */ + @NotBlank(message = "任务ID必填", groups = { Finish.class }) + private String taskId; + + /** + * 处理状态 + */ + @NotBlank(message = "处理状态必填", groups = { Finish.class }) + private String processStatus; + + /** + * 结果文件 url + */ + private String resultDescFilePath; + + /** + * 结果描述文本 + */ + private String resultDesc; + +} diff --git a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/result/ImportTaskCommonResultDTO.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/result/ImportTaskCommonResultDTO.java new file mode 100644 index 0000000000..9fd7c0760c --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/result/ImportTaskCommonResultDTO.java @@ -0,0 +1,14 @@ +package com.epmet.dto.result; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class ImportTaskCommonResultDTO { + + private String taskId; + +} diff --git a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/EpmetCommonServiceOpenFeignClient.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/EpmetCommonServiceOpenFeignClient.java index 1fe124a14f..9ddd2d710d 100644 --- a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/EpmetCommonServiceOpenFeignClient.java +++ b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/EpmetCommonServiceOpenFeignClient.java @@ -4,12 +4,12 @@ import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.*; import com.epmet.dto.result.*; -import com.epmet.feign.fallback.EpmetCommonServiceOpenFeignClientFallback; import com.epmet.feign.fallback.EpmetCommonServiceOpenFeignClientFallbackFactory; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; import java.util.List; import java.util.Map; @@ -124,4 +124,20 @@ public interface EpmetCommonServiceOpenFeignClient { **/ @PostMapping(value = "commonservice/areacode/addareacode", consumes = MediaType.APPLICATION_JSON_VALUE) Result addAreaCode(AddAreaCodeFormDTO formDTO); + + /** + * 创建导入任务 + * @param input + * @return + */ + @RequestMapping("/commonservice/import-task/create") + Result createImportTask(@RequestBody ImportTaskCommonFormDTO input); + + /** + * 结束导入任务 + * @param input + * @return + */ + @RequestMapping("/commonservice/import-task/finish") + Result finishImportTask(@RequestBody ImportTaskCommonFormDTO input); } diff --git a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/fallback/EpmetCommonServiceOpenFeignClientFallback.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/fallback/EpmetCommonServiceOpenFeignClientFallback.java index 4afee3fa08..c3c62d64da 100644 --- a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/fallback/EpmetCommonServiceOpenFeignClientFallback.java +++ b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/feign/fallback/EpmetCommonServiceOpenFeignClientFallback.java @@ -111,4 +111,14 @@ public class EpmetCommonServiceOpenFeignClientFallback implements EpmetCommonSer public Result addAreaCode(AddAreaCodeFormDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_COMMON_SERVICE, "addAreaCode", formDTO); } + + @Override + public Result createImportTask(ImportTaskCommonFormDTO input) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_COMMON_SERVICE, "createImportTask", input); + } + + @Override + public Result finishImportTask(ImportTaskCommonFormDTO input) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_COMMON_SERVICE, "finishImportTask", input); + } } diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/ImportTaskController.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/ImportTaskController.java new file mode 100644 index 0000000000..d6ce2f4be8 --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/ImportTaskController.java @@ -0,0 +1,57 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.form.ImportTaskCommonFormDTO; +import com.epmet.dto.result.ImportTaskCommonResultDTO; +import com.epmet.service.ImportTaskService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.HashMap; + +@RestController +@RequestMapping("import-task") +public class ImportTaskController { + + @Autowired + private ImportTaskService importTaskService; + + /** + * 创建导入任务 + * @param input + * @return + */ + @RequestMapping("create") + public Result createTask(@RequestBody ImportTaskCommonFormDTO input) { + ValidatorUtils.validateEntity(input, ImportTaskCommonFormDTO.Create.class); + String operatorId = input.getOperatorId(); + String bizType = input.getBizType(); + + String taskId = importTaskService.createProcessTask(operatorId, bizType); + ImportTaskCommonResultDTO ro = new ImportTaskCommonResultDTO(taskId); + return new Result().ok(ro); + } + + /** + * 结束任务 + * @param input + * @return + */ + @RequestMapping("finish") + public Result finishTask(@RequestBody ImportTaskCommonFormDTO input) { + ValidatorUtils.validateEntity(input, ImportTaskCommonFormDTO.Finish.class); + Boolean finished = importTaskService.finish(input.getTaskId(), input.getProcessStatus(), input.getOperatorId(), input.getResultDescFilePath(), input.getResultDesc()); + if (!finished) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), + "失败,请确认任务是否存在,以及是否已完成", + "失败,请确认任务是否存在,以及是否已完成"); + } + return new Result(); + } + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/ImportTaskDao.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/dao/ImportTaskDao.java similarity index 100% rename from epmet-user/epmet-user-server/src/main/java/com/epmet/dao/ImportTaskDao.java rename to epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/dao/ImportTaskDao.java diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/entity/ImportTaskEntity.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/entity/ImportTaskEntity.java new file mode 100644 index 0000000000..8473ef1d3a --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/entity/ImportTaskEntity.java @@ -0,0 +1,47 @@ +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-02-15 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("import_task") +public class ImportTaskEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 业务类型。resi:居民;楼栋:building;房屋:house。依次补充 + */ + private String bizType; + + /** + * 处理状态。processing:处理中;finished:完成; + */ + private String processStatus; + + /** + * 谁导入的 + */ + private String operatorId; + + /** + * 开始导入的时间 + */ + private Date startTime; + + private String resultDescFile; + + private String resultDesc; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/ImportTaskService.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ImportTaskService.java similarity index 69% rename from epmet-user/epmet-user-server/src/main/java/com/epmet/service/ImportTaskService.java rename to epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ImportTaskService.java index 65245abd98..dee9e7984c 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/ImportTaskService.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ImportTaskService.java @@ -9,13 +9,13 @@ package com.epmet.service; */ public interface ImportTaskService { - /** - * 检查指定类型该用户是否存在处理中的导入任务 - * @param operatorId 操作者ID - * @param bizType 业务类型。resi:居民 - * @return - */ - boolean existsProcessingTask(String operatorId, String bizType); +// /** +// * 检查指定类型该用户是否存在处理中的导入任务 +// * @param operatorId 操作者ID +// * @param bizType 业务类型。resi:居民 +// * @return +// */ +// boolean existsProcessingTask(String operatorId, String bizType); /** * 创建处理任务 diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/ImportTaskServiceImpl.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ImportTaskServiceImpl.java similarity index 58% rename from epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/ImportTaskServiceImpl.java rename to epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ImportTaskServiceImpl.java index d80ee5d9a6..987fe3a0ae 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/ImportTaskServiceImpl.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ImportTaskServiceImpl.java @@ -1,7 +1,9 @@ package com.epmet.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.epmet.constant.ImportTaskConstants; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.constants.ImportTaskConstants; import com.epmet.dao.ImportTaskDao; import com.epmet.entity.ImportTaskEntity; import com.epmet.service.ImportTaskService; @@ -22,13 +24,28 @@ public class ImportTaskServiceImpl implements ImportTaskService { @Autowired private ImportTaskDao importRecordDao; +// /** +// * 该用户,该业务类型,是否有正在处理的导入任务 +// * @param operatorId 操作者ID +// * @param bizType 业务类型。resi:居民 +// * @return +// */ +// @Override +// public boolean existsProcessingTask(String operatorId, String bizType) { +// LambdaQueryWrapper query = new LambdaQueryWrapper<>(); +// query.eq(ImportTaskEntity::getOperatorId, operatorId); +// query.eq(ImportTaskEntity::getBizType, bizType); +// query.eq(ImportTaskEntity::getProcessStatus, ImportTaskConstants.PROCESS_STATUS_PROCESSING); +// +// return importRecordDao.selectCount(query) > 0; +// } + /** - * 该用户,该业务类型,是否有正在处理的导入任务 - * @param operatorId 操作者ID - * @param bizType 业务类型。resi:居民 + * 检查是否有正在执行的任务 + * @param operatorId + * @param bizType * @return */ - @Override public boolean existsProcessingTask(String operatorId, String bizType) { LambdaQueryWrapper query = new LambdaQueryWrapper<>(); query.eq(ImportTaskEntity::getOperatorId, operatorId); @@ -40,6 +57,12 @@ public class ImportTaskServiceImpl implements ImportTaskService { @Override public String createProcessTask(String operatorId, String bizType) { + if (existsProcessingTask(operatorId, bizType)) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), + "已存在执行中的导入任务,请等待执行完成。", + "已存在执行中的导入任务,请等待执行完成。"); + } + ImportTaskEntity importRecord = new ImportTaskEntity(); importRecord.setProcessStatus(ImportTaskConstants.PROCESS_STATUS_PROCESSING); importRecord.setOperatorId(operatorId); diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/ImportTaskDao.xml b/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/ImportTaskDao.xml similarity index 100% rename from epmet-user/epmet-user-server/src/main/resources/mapper/ImportTaskDao.xml rename to epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/ImportTaskDao.xml diff --git a/epmet-user/epmet-user-server/pom.xml b/epmet-user/epmet-user-server/pom.xml index 8d021ca7a8..c84c758120 100644 --- a/epmet-user/epmet-user-server/pom.xml +++ b/epmet-user/epmet-user-server/pom.xml @@ -154,6 +154,11 @@ 2.0.0 compile + + com.epmet + common-service-client + 2.0.0 + diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java index 7624198dfb..defa71958e 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java @@ -33,6 +33,7 @@ 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.RenException; +import com.epmet.commons.tools.feign.ResultDataResolver; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.redis.RedisKeys; import com.epmet.commons.tools.redis.RedisUtils; @@ -44,19 +45,19 @@ import com.epmet.commons.tools.utils.HttpClientManager; import com.epmet.commons.tools.utils.IpUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; -import com.epmet.constant.ImportTaskConstants; import com.epmet.constant.SystemMessageType; +import com.epmet.constants.ImportTaskConstants; import com.epmet.dto.IcResiUserDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.enums.IcResiUserTableEnum; import com.epmet.excel.support.ExportResiUserItemDTO; +import com.epmet.feign.EpmetCommonServiceOpenFeignClient; import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.feign.OperCustomizeOpenFeignClient; import com.epmet.feign.OssFeignClient; import com.epmet.service.IcResiUserImportService; import com.epmet.service.IcResiUserService; -import com.epmet.service.ImportTaskService; import jodd.io.FileUtil; import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.FileUtils; @@ -93,7 +94,7 @@ import java.util.stream.Collectors; @Slf4j @RestController @RequestMapping("icresiuser") -public class IcResiUserController { +public class IcResiUserController implements ResultDataResolver { /** * 居民上传临时目录 @@ -123,9 +124,6 @@ public class IcResiUserController { private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; @Autowired private LoginUserUtil loginUserUtil; - @Autowired - private ImportTaskService importTaskService; - /** * 模板枚举 @@ -443,14 +441,9 @@ public class IcResiUserController { String importTaskId; // 记录导入任务 - if (importTaskService.existsProcessingTask(operatorId, ImportTaskConstants.BIZ_TYPE_RESI)) { - throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), - "已存在执行中的导入任务,请等待执行完成。", - "已存在执行中的导入任务,请等待执行完成。"); - } else { - importTaskId = importTaskService.createProcessTask(operatorId, ImportTaskConstants.BIZ_TYPE_RESI); - } + importTaskId = icResiUserImportService.createImportTaskRecord(operatorId, ImportTaskConstants.BIZ_TYPE_RESI); + // 开始执行导入 Path savePath = null; try { String fileName = UUID.randomUUID().toString().concat(".").concat(extension); @@ -464,9 +457,8 @@ public class IcResiUserController { String errorMsg = ExceptionUtils.getThrowableErrorStackTrace(e); log.error("【导入居民信息失败】导入失败:{}", errorMsg); - // 要将导入任务状态设置为结束但不成功 - importTaskService.finish(importTaskId, ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL, operatorId, null, e.getMessage()); - throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + // 要将导入任务状态设置为结束但不成功。不报错即成功,没有返回值 TODO 此处要改,将oss返回的路径存储到resultDescPath中 + icResiUserImportService.finishImportTask(importTaskId, operatorId, ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL, null, null); } finally { try { if (savePath != null){ diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserImportService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserImportService.java index 35748c9ddc..8cdd76d3ab 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserImportService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserImportService.java @@ -13,4 +13,22 @@ import java.util.List; public interface IcResiUserImportService { void importIcResiInfoFromExcel(String importTaskId, List formItemList, String excelPathName, HttpServletResponse response); + + /** + * 创建导入任务 + * @param operatorId + * @param bizType + * @return + */ + String createImportTaskRecord(String operatorId, String bizType); + + /** + * 完成导入任务 + * @param importTaskId 任务ID + * @param operatorId 操作者ID + * @param processStatus 处理状态,见 ImportTaskConstants.PROCESS_STATUS_* + * @param resultDesc 结果描述,非必填 + * @param resultDescPath 结果描述文件,excel等文件,有错误的话需要传入,成功则不需要 + */ + void finishImportTask(String importTaskId, String operatorId, String processStatus, String resultDesc, String resultDescPath); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java index 18cd3cd6ec..981db445f2 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java @@ -24,7 +24,7 @@ import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.security.user.LoginUserUtil; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; -import com.epmet.constant.ImportTaskConstants; +import com.epmet.constants.ImportTaskConstants; import com.epmet.dao.IcResiUserDao; import com.epmet.dao.IcUserChangeDetailedDao; import com.epmet.dao.IcUserChangeRecordDao; @@ -38,10 +38,7 @@ import com.epmet.entity.IcUserChangeRecordEntity; import com.epmet.entity.IcUserTransferRecordEntity; import com.epmet.enums.IcResiUserTableEnum; import com.epmet.excel.handler.IcResiImportDynamicExcelListener; -import com.epmet.feign.EpmetAdminOpenFeignClient; -import com.epmet.feign.EpmetUserOpenFeignClient; -import com.epmet.feign.GovOrgOpenFeignClient; -import com.epmet.feign.OperCustomizeOpenFeignClient; +import com.epmet.feign.*; import com.epmet.service.*; import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; @@ -127,8 +124,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res private RedisUtils redisUtils; @Autowired - private ImportTaskService importTaskService; - + private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient; /** * 字表中不需要的列 @@ -291,11 +287,9 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res // 更新上传记录 if (hasErrorRows) { - importTaskService.finish(importTaskId, ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL, loginUserId, - null, null); + finishImportTask(importTaskId, loginUserId, ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL,null, null); } else { - importTaskService.finish(importTaskId, ImportTaskConstants.PROCESS_STATUS_FINISHED_SUCCESS, loginUserId, - null, null); + finishImportTask(importTaskId, loginUserId, ImportTaskConstants.PROCESS_STATUS_FINISHED_SUCCESS,null, null); } } catch (Exception e) { @@ -1755,45 +1749,45 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res return recordEntity; } + /** + * 创建导入任务 + * @param operatorId + * @param bizType + * @return + */ + public String createImportTaskRecord(String operatorId, String bizType) { + ImportTaskCommonFormDTO importTaskForm = new ImportTaskCommonFormDTO(); + importTaskForm.setOperatorId(operatorId); + importTaskForm.setBizType(bizType); + ImportTaskCommonResultDTO resultDTO = getResultDataOrThrowsException(commonServiceOpenFeignClient.createImportTask(importTaskForm), + ServiceConstant.EPMET_COMMON_SERVICE, + EpmetErrorCode.SERVER_ERROR.getCode(), + "【居民信息导入】创建导入任务记录失败", + "【居民信息导入】创建导入任务记录失败"); + + return resultDTO.getTaskId(); + } - - - //private IcUserTransferRecordEntity fillTransferRecord(String resiId, String resiName, String operatorId, String operatorName, String oldCustomerId, - // String oldAgencyId, String oldAgencyName, String oldGridId, String oldGridName, String neighborhoodId, - // String neighborhoodName, String oldBuildingId, String oldBuildingName, ) { - - //IcUserTransferRecordEntity recordEntity = new IcUserTransferRecordEntity(); - //recordEntity.setIcUserId(); - //recordEntity.setOperatorId(); - //recordEntity.setIcUserName(); - //recordEntity.setOperatorName(); - //recordEntity.setOldCustomerId(); - //recordEntity.setOldAgencyId(); - //recordEntity.setOldAgencyName(); - //recordEntity.setOldGridId(); - //recordEntity.setOldGridName(); - //recordEntity.setOldNeighborHoodId(); - //recordEntity.setOldNeighborHoodName(); - //recordEntity.setOldBuildingId(); - //recordEntity.setOldBuildingName(); - //recordEntity.setOldBuildingUnitId(); - //recordEntity.setOldBuildingUnitName(); - //recordEntity.setOldHouseId(); - //recordEntity.setOldHouseName(); - //recordEntity.setTransferTime(); - //recordEntity.setRemark(); - //recordEntity.setNewCustomerId(); - //recordEntity.setNewAgencyId(); - //recordEntity.setNewAgencyName(); - //recordEntity.setNewGridId(); - //recordEntity.setNewGridName(); - //recordEntity.setNewNeighborHoodId(); - //recordEntity.setNewNeighborHoodName(); - //recordEntity.setNewBuildingId(); - //recordEntity.setNewBuildingName(); - //recordEntity.setNewBuildingUnitId(); - //recordEntity.setNewBuildingUnitName(); - //recordEntity.setNewHouseId(); - //recordEntity.setNewHouseName(); - //} + /** + * 完成导入任务 + * @param importTaskId 任务ID + * @param operatorId 操作者ID + * @param processStatus 处理状态,见 ImportTaskConstants.PROCESS_STATUS_* + * @param resultDesc 结果描述,非必填 + * @param resultDescPath 结果描述文件,excel等文件,有错误的话需要传入,成功则不需要 + */ + public void finishImportTask(String importTaskId, String operatorId, String processStatus, String resultDesc, String resultDescPath) { + ImportTaskCommonFormDTO importFinishTaskForm = new ImportTaskCommonFormDTO(); + importFinishTaskForm.setTaskId(importTaskId); + importFinishTaskForm.setProcessStatus(processStatus); + importFinishTaskForm.setOperatorId(operatorId); + importFinishTaskForm.setResultDesc(resultDesc); + importFinishTaskForm.setResultDescFilePath(resultDescPath); + + Result result = commonServiceOpenFeignClient.finishImportTask(importFinishTaskForm); + if (result == null || !result.success()) { + log.error("【居民信息导入】结束导入任务失败:taskId:{}, processStatus:{}, operatorId:{}, resultDesc:{}, resultDescPath:{}", + importTaskId, processStatus, operatorId, resultDesc, resultDescPath); + } + } } From 3d13549a8a34aebeb4c446699cf8df222f2d0907 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Mon, 21 Feb 2022 16:46:46 +0800 Subject: [PATCH 7/9] errInfos --- .../constant/ImportErrorMsgConstants.java | 12 ++++++++ .../epmet/model/BuildingErrorInfoModel.java | 23 ++++++++++++++ .../com/epmet/model/HouseErrorInfoModel.java | 30 +++++++++++++++++++ .../model/ImportBuildingInfoListener.java | 19 ++++++++++++ .../epmet/model/ImportHouseInfoListener.java | 27 ++++++++++++++--- .../model/ImportNeighborHoodInfoListener.java | 17 +++++++++++ .../model/NeighborHoodErrorInfoModel.java | 20 +++++++++++++ 7 files changed, 144 insertions(+), 4 deletions(-) create mode 100644 epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/ImportErrorMsgConstants.java create mode 100644 epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/BuildingErrorInfoModel.java create mode 100644 epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/HouseErrorInfoModel.java create mode 100644 epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/NeighborHoodErrorInfoModel.java diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/ImportErrorMsgConstants.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/ImportErrorMsgConstants.java new file mode 100644 index 0000000000..d49715e330 --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/ImportErrorMsgConstants.java @@ -0,0 +1,12 @@ +package com.epmet.constant; + +/** + * @Author zxc + * @DateTime 2022/2/21 4:25 下午 + * @DESC + */ +public interface ImportErrorMsgConstants { + + + +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/BuildingErrorInfoModel.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/BuildingErrorInfoModel.java new file mode 100644 index 0000000000..e7db295a7e --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/BuildingErrorInfoModel.java @@ -0,0 +1,23 @@ +package com.epmet.model; + +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + +/** + * @Author zxc + * @DateTime 2022/2/15 10:07 上午 + * @DESC + */ +@Data +public class BuildingErrorInfoModel { + + @ExcelProperty(value = "小区名称") + private String neighborHoodName; + + @ExcelProperty(value = "楼栋名称") + private String buildingName; + + @ExcelProperty(value = "错误信息") + private String errorMsg; + +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/HouseErrorInfoModel.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/HouseErrorInfoModel.java new file mode 100644 index 0000000000..9cb84948c5 --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/HouseErrorInfoModel.java @@ -0,0 +1,30 @@ +package com.epmet.model; + +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +/** + * @Author zxc + * @DateTime 2022/2/13 1:26 下午 + * @DESC + */ +@Data +public class HouseErrorInfoModel { + + @ExcelProperty(value = "所属小区") + private String neighborHoodName; + + @ExcelProperty(value = "所属楼栋") + private String buildingName; + + @ExcelProperty(value = "单元号") + private Integer buildingUnit; + + @ExcelProperty(value = "门牌号") + private String doorName; + + @ExcelProperty(value = "错误信息") + private String errorMsg; + +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportBuildingInfoListener.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportBuildingInfoListener.java index 808a69f810..63e5f39000 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportBuildingInfoListener.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportBuildingInfoListener.java @@ -34,6 +34,8 @@ public class ImportBuildingInfoListener extends AnalysisEventListener nums = new ArrayList<>(); Integer num = NumConstant.ZERO; + List errorInfos = new ArrayList<>(); + BuildingInfoModel info = null; List needDisposeList = new ArrayList<>(); List needInsertList = new ArrayList<>(); @@ -67,6 +69,7 @@ public class ImportBuildingInfoListener extends AnalysisEventListener { nums.add(e.getNum()); + disposeErrorMsg(info,""); }); } } @@ -157,6 +163,7 @@ public class ImportBuildingInfoListener extends AnalysisEventListener nums = new ArrayList<>(); Integer num = NumConstant.ZERO; + List errorInfos = new ArrayList<>(); + HouseInfoModel info = null; List needDisposeList = new ArrayList<>(); List needInsertList = new ArrayList<>(); @@ -73,6 +75,7 @@ public class ImportHouseInfoListener extends AnalysisEventListener importInfo = neighborHoodService.getImportInfo(formDTO, needDisposeList); @@ -132,10 +144,8 @@ public class ImportHouseInfoListener extends AnalysisEventListener nums = new ArrayList<>(); Integer num = NumConstant.ZERO; + List errorInfos = new ArrayList<>(); + NeighborHoodInfoModel info = null; List needDisposeList = new ArrayList<>(); List needInsertList = new ArrayList<>(); @@ -70,9 +72,11 @@ public class ImportNeighborHoodInfoListener extends AnalysisEventListener { nums.add(e.getNum()); + disposeErrorMsg(info,""); }); } List notExistList = groupByBuildingExistStatus.get(false); @@ -172,6 +178,7 @@ public class ImportNeighborHoodInfoListener extends AnalysisEventListener Date: Mon, 21 Feb 2022 16:57:08 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E5=B8=B8=E9=87=8F=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/constants/ImportTaskConstants.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/constants/ImportTaskConstants.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/constants/ImportTaskConstants.java index ed16f5473c..c67ddbb549 100644 --- a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/constants/ImportTaskConstants.java +++ b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/constants/ImportTaskConstants.java @@ -8,6 +8,9 @@ public interface ImportTaskConstants { * 业务类型:居民 */ String BIZ_TYPE_RESI = "resi"; + String BIZ_TYPE_NEIGHBOR_HOOD = "neighborHood"; + String BIZ_TYPE_BUILDING = "building"; + String BIZ_TYPE_HOUSE = "house"; /** * 处理状态:处理中 From 2888475ff76a847a26b988e95ba5e53df2df7fe1 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Mon, 21 Feb 2022 17:54:52 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E8=81=94=E5=BB=BA=E6=B4=BB=E5=8A=A8?= =?UTF-8?q?=E5=85=B3=E8=81=94=E5=A4=9A=E4=B8=AA=E5=8D=95=E4=BD=8D=E5=92=8C?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E4=BA=8B=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/IcActivityServiceRelationDTO.java | 85 ++++++++ .../epmet/dto/IcActivityUnitRelationDTO.java | 89 ++++++++ .../com/epmet/dto/IcPartyActivityDTO.java | 31 ++- .../dto/LatestActServiceRelationDTO.java | 79 +++++++ .../epmet/dto/LatestActUnitRelationDTO.java | 84 ++++++++ .../dao/IcActivityServiceRelationDao.java | 25 +++ .../epmet/dao/IcActivityUnitRelationDao.java | 25 +++ .../com/epmet/dao/IcPartyActivityDao.java | 15 +- .../dao/LatestActServiceRelationDao.java | 25 +++ .../epmet/dao/LatestActUnitRelationDao.java | 25 +++ .../IcActivityServiceRelationEntity.java | 56 +++++ .../entity/IcActivityUnitRelationEntity.java | 56 +++++ .../LatestActServiceRelationEntity.java | 51 +++++ .../entity/LatestActUnitRelationEntity.java | 51 +++++ .../IcActivityServiceRelationService.java | 34 +++ .../IcActivityUnitRelationService.java | 34 +++ .../LatestActServiceRelationService.java | 14 ++ .../service/LatestActUnitRelationService.java | 14 ++ .../IcActivityServiceRelationServiceImpl.java | 61 ++++++ .../IcActivityUnitRelationServiceImpl.java | 60 ++++++ .../impl/IcPartyActivityServiceImpl.java | 199 ++++++++++++------ .../LatestActServiceRelationServiceImpl.java | 33 +++ .../LatestActUnitRelationServiceImpl.java | 19 ++ .../mapper/IcActivityServiceRelationDao.xml | 26 +++ .../mapper/IcActivityUnitRelationDao.xml | 26 +++ .../resources/mapper/IcPartyActivityDao.xml | 128 ++++++++++- .../mapper/LatestActServiceRelationDao.xml | 24 +++ .../mapper/LatestActUnitRelationDao.xml | 24 +++ 28 files changed, 1312 insertions(+), 81 deletions(-) create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcActivityServiceRelationDTO.java create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcActivityUnitRelationDTO.java create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/LatestActServiceRelationDTO.java create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/LatestActUnitRelationDTO.java create mode 100644 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcActivityServiceRelationDao.java create mode 100644 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcActivityUnitRelationDao.java create mode 100644 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/LatestActServiceRelationDao.java create mode 100644 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/LatestActUnitRelationDao.java create mode 100644 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcActivityServiceRelationEntity.java create mode 100644 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcActivityUnitRelationEntity.java create mode 100644 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/LatestActServiceRelationEntity.java create mode 100644 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/LatestActUnitRelationEntity.java create mode 100644 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcActivityServiceRelationService.java create mode 100644 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcActivityUnitRelationService.java create mode 100644 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/LatestActServiceRelationService.java create mode 100644 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/LatestActUnitRelationService.java create mode 100644 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcActivityServiceRelationServiceImpl.java create mode 100644 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcActivityUnitRelationServiceImpl.java create mode 100644 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LatestActServiceRelationServiceImpl.java create mode 100644 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LatestActUnitRelationServiceImpl.java create mode 100644 epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcActivityServiceRelationDao.xml create mode 100644 epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcActivityUnitRelationDao.xml create mode 100644 epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActServiceRelationDao.xml create mode 100644 epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActUnitRelationDao.xml diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcActivityServiceRelationDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcActivityServiceRelationDTO.java new file mode 100644 index 0000000000..c5f7f33641 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcActivityServiceRelationDTO.java @@ -0,0 +1,85 @@ +package com.epmet.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 联建活动与服务事项关联表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-02-21 + */ +@Data +public class IcActivityServiceRelationDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户id + */ + private String customerId; + + /** + * 组织ID + */ + private String agencyId; + + /** + * 组织的所有上级 + */ + private String pids; + + /** + * 活动ID + */ + private String activityId; + + /** + * act_info表ID + */ + private String actId; + + /** + * 服务事项 + */ + private String serviceMatter; + + /** + * 删除标识 0未删除、1已删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcActivityUnitRelationDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcActivityUnitRelationDTO.java new file mode 100644 index 0000000000..8af5942af0 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcActivityUnitRelationDTO.java @@ -0,0 +1,89 @@ +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 联建活动与单位关联表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-02-21 + */ +@Data +public class IcActivityUnitRelationDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户id + */ + private String customerId; + + /** + * 组织ID + */ + private String agencyId; + + /** + * 组织的所有上级 + */ + private String pids; + + /** + * 活动ID + */ + private String activityId; + + /** + * act_info表ID + */ + private String actId; + + /** + * 单位ID + */ + private String unitId; + + /** + * 服务事项 + */ + private String serviceMatter; + + /** + * 删除标识 0未删除、1已删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPartyActivityDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPartyActivityDTO.java index 81edd97c20..07ec52a21f 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPartyActivityDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPartyActivityDTO.java @@ -19,12 +19,15 @@ package com.epmet.dto; import com.epmet.commons.tools.validator.group.AddGroup; import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; import java.io.Serializable; import java.util.Date; +import java.util.List; /** @@ -46,35 +49,45 @@ public class IcPartyActivityDTO implements Serializable { /** * 客户id */ + @JsonIgnore private String customerId; /** * 组织ID */ + @JsonIgnore + @NotEmpty(message = "组织ID不能为空",groups = AddGroup.class) private String agencyId; /** * 组织的所有上级 */ + @JsonIgnore private String pids; /** * act_info表ID */ + @JsonIgnore private String actId; + private String unitId; + private String unitName; /** * 单位ID */ - @NotBlank(message = "单位不能为空",groups = AddGroup.class) - private String unitId; - private String unitName; + @NotEmpty(message = "单位不能为空",groups = AddGroup.class) + private List unitIdList; + private List unitNameList; + + private String serviceMatter; + private String serviceMatterName; /** * 服务事项 */ - @NotBlank(message = "服务事项不能为空",groups = AddGroup.class) - private String serviceMatter; - private String serviceMatterName; + @NotEmpty(message = "服务事项不能为空",groups = AddGroup.class) + private List serviceMatterList; + private List serviceMatterNameList; /** * 活动标题 */ @@ -131,31 +144,37 @@ public class IcPartyActivityDTO implements Serializable { /** * 删除标识 0未删除、1已删除 */ + @JsonIgnore private String delFlag; /** * 乐观锁 */ + @JsonIgnore private Integer revision; /** * 创建人 */ + @JsonIgnore private String createdBy; /** * 创建时间 */ + @JsonIgnore private Date createdTime; /** * 更新人 */ + @JsonIgnore private String updatedBy; /** * 更新时间 */ + @JsonIgnore private Date updatedTime; } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/LatestActServiceRelationDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/LatestActServiceRelationDTO.java new file mode 100644 index 0000000000..b25b10f432 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/LatestActServiceRelationDTO.java @@ -0,0 +1,79 @@ +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 联建活动与服务事项关联表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-02-21 + */ +@Data +public class LatestActServiceRelationDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户id + */ + private String customerId; + + /** + * 组织ID + */ + private String agencyId; + + /** + * 组织的所有上级 + */ + private String pids; + + /** + * latest_act_info表ID + */ + private String actId; + + /** + * 服务事项 + */ + private String serviceMatter; + + /** + * 删除标识 0未删除、1已删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/LatestActUnitRelationDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/LatestActUnitRelationDTO.java new file mode 100644 index 0000000000..534053660d --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/LatestActUnitRelationDTO.java @@ -0,0 +1,84 @@ +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 联建活动与单位关联表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-02-21 + */ +@Data +public class LatestActUnitRelationDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户id + */ + private String customerId; + + /** + * 组织ID + */ + private String agencyId; + + /** + * 组织的所有上级 + */ + private String pids; + + /** + * latest_act_info表ID + */ + private String actId; + + /** + * 单位ID + */ + private String unitId; + + /** + * 服务事项 + */ + private String serviceMatter; + + /** + * 删除标识 0未删除、1已删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcActivityServiceRelationDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcActivityServiceRelationDao.java new file mode 100644 index 0000000000..46cfe4eb3e --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcActivityServiceRelationDao.java @@ -0,0 +1,25 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.IcActivityServiceRelationEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * 联建活动与服务事项关联表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-02-21 + */ +@Mapper +public interface IcActivityServiceRelationDao extends BaseDao { + /** + * 删除活动所属服务 + * + * @Param activityId + * @Return + * @Author zhaoqifeng + * @Date 2022/2/21 16:19 + */ + void deleteByActivity(@Param("activityId") String activityId); +} \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcActivityUnitRelationDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcActivityUnitRelationDao.java new file mode 100644 index 0000000000..be27ce119b --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcActivityUnitRelationDao.java @@ -0,0 +1,25 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.IcActivityUnitRelationEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * 联建活动与单位关联表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-02-21 + */ +@Mapper +public interface IcActivityUnitRelationDao extends BaseDao { + /** + * 删除活动所属单位 + * + * @Param activityId + * @Return + * @Author zhaoqifeng + * @Date 2022/2/21 16:19 + */ + void deleteByActivity(@Param("activityId") String activityId); +} \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcPartyActivityDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcPartyActivityDao.java index bb7e41c2ed..c8fba2ffed 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcPartyActivityDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcPartyActivityDao.java @@ -23,6 +23,8 @@ import com.epmet.dto.result.ActivityStatisticsDTO; import com.epmet.entity.IcPartyActivityEntity; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** * 联建活动 * @@ -40,5 +42,16 @@ public interface IcPartyActivityDao extends BaseDao { * @Date 2021/12/9 16:06 */ ActivityStatisticsDTO getStatistics(PartyActivityFormDTO formDTO); - + + /** + * 活动列表查询 + * @Param formDTO + * @Return {@link java.util.List} + * @Author zhaoqifeng + * @Date 2022/2/21 14:50 + */ + List selectActivityList(PartyActivityFormDTO formDTO); + + + List getActivityList(PartyActivityFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/LatestActServiceRelationDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/LatestActServiceRelationDao.java new file mode 100644 index 0000000000..6a46bf5031 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/LatestActServiceRelationDao.java @@ -0,0 +1,25 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.LatestActServiceRelationEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * 联建活动与服务事项关联表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-02-21 + */ +@Mapper +public interface LatestActServiceRelationDao extends BaseDao { + /** + * 删除活动所属服务 + * + * @Param activityId + * @Return + * @Author zhaoqifeng + * @Date 2022/2/21 16:19 + */ + void deleteByActivity(@Param("activityId") String activityId); +} \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/LatestActUnitRelationDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/LatestActUnitRelationDao.java new file mode 100644 index 0000000000..19e8d48e57 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/LatestActUnitRelationDao.java @@ -0,0 +1,25 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.LatestActUnitRelationEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * 联建活动与单位关联表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-02-21 + */ +@Mapper +public interface LatestActUnitRelationDao extends BaseDao { + /** + * 删除活动所属服务 + * + * @Param activityId + * @Return + * @Author zhaoqifeng + * @Date 2022/2/21 16:19 + */ + void deleteByActivity(@Param("activityId") String activityId); +} \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcActivityServiceRelationEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcActivityServiceRelationEntity.java new file mode 100644 index 0000000000..31790b660f --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcActivityServiceRelationEntity.java @@ -0,0 +1,56 @@ +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 联建活动与服务事项关联表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-02-21 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("ic_activity_service_relation") +public class IcActivityServiceRelationEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 组织ID + */ + private String agencyId; + + /** + * 组织的所有上级 + */ + private String pids; + + /** + * 活动ID + */ + private String activityId; + + /** + * act_info表ID + */ + private String actId; + + /** + * 服务事项 + */ + private String serviceMatter; + + /** + * 排序 + */ + private Integer sort; + +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcActivityUnitRelationEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcActivityUnitRelationEntity.java new file mode 100644 index 0000000000..d7983ff41c --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcActivityUnitRelationEntity.java @@ -0,0 +1,56 @@ +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 联建活动与单位关联表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-02-21 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("ic_activity_unit_relation") +public class IcActivityUnitRelationEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 组织ID + */ + private String agencyId; + + /** + * 组织的所有上级 + */ + private String pids; + + /** + * 活动ID + */ + private String activityId; + + /** + * act_info表ID + */ + private String actId; + + /** + * 单位ID + */ + private String unitId; + + /** + * 排序 + */ + private Integer sort; + +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/LatestActServiceRelationEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/LatestActServiceRelationEntity.java new file mode 100644 index 0000000000..a7d81ad2c1 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/LatestActServiceRelationEntity.java @@ -0,0 +1,51 @@ +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 联建活动与服务事项关联表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-02-21 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("latest_act_service_relation") +public class LatestActServiceRelationEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 组织ID + */ + private String agencyId; + + /** + * 组织的所有上级 + */ + private String pids; + + /** + * latest_act_info表ID + */ + private String actId; + + /** + * 服务事项 + */ + private String serviceMatter; + + /** + * 排序 + */ + private Integer sort; + +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/LatestActUnitRelationEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/LatestActUnitRelationEntity.java new file mode 100644 index 0000000000..4940c49cd3 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/LatestActUnitRelationEntity.java @@ -0,0 +1,51 @@ +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 联建活动与单位关联表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-02-21 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("latest_act_unit_relation") +public class LatestActUnitRelationEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 组织ID + */ + private String agencyId; + + /** + * 组织的所有上级 + */ + private String pids; + + /** + * latest_act_info表ID + */ + private String actId; + + /** + * 单位ID + */ + private String unitId; + + /** + * 排序 + */ + private Integer sort; + +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcActivityServiceRelationService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcActivityServiceRelationService.java new file mode 100644 index 0000000000..b2cd111205 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcActivityServiceRelationService.java @@ -0,0 +1,34 @@ +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.entity.IcActivityServiceRelationEntity; + +import java.util.List; + +/** + * 联建活动与服务事项关联表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-02-21 + */ +public interface IcActivityServiceRelationService extends BaseService { + /** + * 获取活动所属服务事项 + * + * @Param activityId 活动ID + * @Return {@link List } + * @Author zhaoqifeng + * @Date 2022/2/21 14:36 + */ + List getServiceList(String activityId); + + /** + * 删除活动所属服务事项 + * + * @Param activityId + * @Return + * @Author zhaoqifeng + * @Date 2022/2/21 16:10 + */ + void deleteByActivity(String activityId); +} \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcActivityUnitRelationService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcActivityUnitRelationService.java new file mode 100644 index 0000000000..41e51a1c31 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcActivityUnitRelationService.java @@ -0,0 +1,34 @@ +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.entity.IcActivityUnitRelationEntity; + +import java.util.List; + +/** + * 联建活动与单位关联表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-02-21 + */ +public interface IcActivityUnitRelationService extends BaseService { + /** + * 获取活动所属党建单位 + * + * @Param activityId 活动ID + * @Return {@link List} + * @Author zhaoqifeng + * @Date 2022/2/21 14:36 + */ + List getUnitList(String activityId); + + /** + * 删除活动所属单位 + * + * @Param activityId + * @Return + * @Author zhaoqifeng + * @Date 2022/2/21 16:10 + */ + void deleteByActivity(String activityId); +} \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/LatestActServiceRelationService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/LatestActServiceRelationService.java new file mode 100644 index 0000000000..e400a6d1ab --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/LatestActServiceRelationService.java @@ -0,0 +1,14 @@ +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.entity.LatestActServiceRelationEntity; + +/** + * 联建活动与服务事项关联表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-02-21 + */ +public interface LatestActServiceRelationService extends BaseService { + +} \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/LatestActUnitRelationService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/LatestActUnitRelationService.java new file mode 100644 index 0000000000..5da8fb584b --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/LatestActUnitRelationService.java @@ -0,0 +1,14 @@ +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.entity.LatestActUnitRelationEntity; + +/** + * 联建活动与单位关联表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-02-21 + */ +public interface LatestActUnitRelationService extends BaseService { + +} \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcActivityServiceRelationServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcActivityServiceRelationServiceImpl.java new file mode 100644 index 0000000000..d52ec53145 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcActivityServiceRelationServiceImpl.java @@ -0,0 +1,61 @@ +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.dao.IcActivityServiceRelationDao; +import com.epmet.entity.IcActivityServiceRelationEntity; +import com.epmet.service.IcActivityServiceRelationService; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 联建活动与服务事项关联表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-02-21 + */ +@Service +public class IcActivityServiceRelationServiceImpl extends BaseServiceImpl implements IcActivityServiceRelationService { + + + /** + * 获取活动所属服务事项 + * + * @param activityId + * @Param activityId 活动ID + * @Return {@link List } + * @Author zhaoqifeng + * @Date 2022/2/21 14:36 + */ + @Override + public List getServiceList(String activityId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(IcActivityServiceRelationEntity::getActivityId, activityId); + wrapper.orderByAsc(IcActivityServiceRelationEntity::getSort); + List list = baseDao.selectList(wrapper); + if (CollectionUtils.isEmpty(list)) { + return Collections.emptyList(); + } + return list.stream().map(IcActivityServiceRelationEntity::getServiceMatter).collect(Collectors.toList()); + } + + /** + * 删除活动所属服务事项 + * + * @param activityId + * @Param activityId + * @Return + * @Author zhaoqifeng + * @Date 2022/2/21 16:10 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteByActivity(String activityId) { + baseDao.deleteByActivity(activityId); + } +} \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcActivityUnitRelationServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcActivityUnitRelationServiceImpl.java new file mode 100644 index 0000000000..eca268f436 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcActivityUnitRelationServiceImpl.java @@ -0,0 +1,60 @@ +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.dao.IcActivityUnitRelationDao; +import com.epmet.entity.IcActivityUnitRelationEntity; +import com.epmet.service.IcActivityUnitRelationService; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 联建活动与单位关联表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-02-21 + */ +@Service +public class IcActivityUnitRelationServiceImpl extends BaseServiceImpl implements IcActivityUnitRelationService { + + /** + * 获取活动所属党建单位 + * + * @param activityId + * @Param activityId 活动ID + * @Return {@link List } + * @Author zhaoqifeng + * @Date 2022/2/21 14:36 + */ + @Override + public List getUnitList(String activityId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(IcActivityUnitRelationEntity::getActivityId, activityId); + wrapper.orderByAsc(IcActivityUnitRelationEntity::getSort); + List list = baseDao.selectList(wrapper); + if (CollectionUtils.isEmpty(list)) { + return Collections.emptyList(); + } + return list.stream().map(IcActivityUnitRelationEntity::getUnitId).collect(Collectors.toList()); + } + + /** + * 删除活动所属单位 + * + * @param activityId + * @Param activityId + * @Return + * @Author zhaoqifeng + * @Date 2022/2/21 16:10 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteByActivity(String activityId) { + baseDao.deleteByActivity(activityId); + } +} \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java index 4cea3f9136..d275504fb4 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyActivityServiceImpl.java @@ -19,10 +19,9 @@ package com.epmet.service.impl; import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult; 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; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.page.PageData; @@ -38,11 +37,11 @@ import com.epmet.dto.IcPartyUnitDTO; import com.epmet.dto.form.PartyActivityFormDTO; import com.epmet.dto.result.ActivityStatisticsDTO; import com.epmet.dto.result.demand.OptionDTO; +import com.epmet.entity.IcActivityServiceRelationEntity; +import com.epmet.entity.IcActivityUnitRelationEntity; import com.epmet.entity.IcPartyActivityEntity; import com.epmet.excel.IcPartyActivityImportExcel; -import com.epmet.service.IcPartyActivityService; -import com.epmet.service.IcPartyUnitService; -import com.epmet.service.IcServiceItemDictService; +import com.epmet.service.*; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import lombok.extern.slf4j.Slf4j; @@ -56,6 +55,7 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.*; +import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; /** @@ -72,6 +72,11 @@ public class IcPartyActivityServiceImpl extends BaseServiceImpl wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(IcPartyActivityEntity::getAgencyId, formDTO.getAgencyId()); - wrapper.eq(StringUtils.isNotBlank(formDTO.getUnitId()), IcPartyActivityEntity::getUnitId, formDTO.getUnitId()); - wrapper.eq(StringUtils.isNotBlank(formDTO.getServiceMatter()), IcPartyActivityEntity::getServiceMatter, formDTO.getServiceMatter()); - wrapper.like(StringUtils.isNotBlank(formDTO.getTitle()), IcPartyActivityEntity::getTitle, formDTO.getTitle()); - wrapper.between(IcPartyActivityEntity::getActivityTime, formDTO.getStartTime(), formDTO.getEndTime()); - wrapper.orderByDesc(IcPartyActivityEntity::getUpdatedTime); - List list = baseDao.selectList(wrapper); + List list = baseDao.selectActivityList(formDTO); PageInfo pageInfo = new PageInfo<>(list); List dtoList = ConvertUtils.sourceToTarget(list, IcPartyActivityDTO.class); - IcPartyUnitDTO unitDTO = new IcPartyUnitDTO(); - unitDTO.setAgencyId(formDTO.getAgencyId()); if (CollectionUtils.isNotEmpty(dtoList)) { + //获取组织下联建单位 + IcPartyUnitDTO unitDTO = new IcPartyUnitDTO(); + unitDTO.setAgencyId(formDTO.getAgencyId()); Map option = icPartyUnitService.option(unitDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel)); dtoList.forEach(dto -> { - dto.setUnitName(option.get(dto.getUnitId())); + //联建单位ID与单位名匹配 + List unitIds = Arrays.asList(dto.getUnitId().split(StrConstant.COMMA)); + List unitNames = unitIds.stream().map(option::get).collect(Collectors.toList()); + dto.setUnitName(StringUtils.join(unitNames, StrConstant.COMMA)); }); } @@ -118,54 +120,49 @@ public class IcPartyActivityServiceImpl extends BaseServiceImpl wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(IcPartyActivityEntity::getAgencyId, formDTO.getAgencyId()); - wrapper.eq(StringUtils.isNotBlank(formDTO.getUnitId()), IcPartyActivityEntity::getUnitId, formDTO.getUnitId()); - wrapper.eq(StringUtils.isNotBlank(formDTO.getServiceMatter()), IcPartyActivityEntity::getServiceMatter, formDTO.getServiceMatter()); - wrapper.like(StringUtils.isNotBlank(formDTO.getTitle()), IcPartyActivityEntity::getTitle, formDTO.getTitle()); - wrapper.between(IcPartyActivityEntity::getActivityTime, formDTO.getStartTime(), formDTO.getEndTime()); - wrapper.orderByDesc(IcPartyActivityEntity::getUpdatedTime); - List list = baseDao.selectList(wrapper); + List list = baseDao.selectActivityList(formDTO); List dtoList = ConvertUtils.sourceToTarget(list, IcPartyActivityDTO.class); - IcPartyUnitDTO unitDTO = new IcPartyUnitDTO(); - unitDTO.setAgencyId(formDTO.getAgencyId()); if (CollectionUtils.isNotEmpty(dtoList)) { + IcPartyUnitDTO unitDTO = new IcPartyUnitDTO(); + unitDTO.setAgencyId(formDTO.getAgencyId()); Map option = icPartyUnitService.option(unitDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel)); dtoList.forEach(dto -> { - dto.setUnitName(option.get(dto.getUnitId())); + List unitIds = Arrays.asList(dto.getUnitId().split(StrConstant.COMMA)); + List unitNames = unitIds.stream().map(option::get).collect(Collectors.toList()); + dto.setUnitName(StringUtils.join(unitNames, StrConstant.COMMA)); }); } return dtoList; } - private QueryWrapper getWrapper(Map params){ - String id = (String)params.get(FieldConstant.ID_HUMP); - - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); - - return wrapper; - } - @Override public IcPartyActivityDTO get(String id) { IcPartyActivityEntity entity = baseDao.selectById(id); if (null == entity) { return null; } - //获取服务事项名称 + IcPartyActivityDTO dto = ConvertUtils.sourceToTarget(entity, IcPartyActivityDTO.class); + + //获取服务事项 List serviceItemList=icServiceItemDictService.queryDictList(entity.getCustomerId()); Map categoryMap=serviceItemList.stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel)); + List services = icActivityServiceRelationService.getServiceList(id); + List serviceNames = services.stream().map(categoryMap::get).collect(Collectors.toList()); + dto.setServiceMatterList(services); + dto.setServiceMatterNameList(serviceNames); + + //获取单位 + //获取组织下联建单位 + IcPartyUnitDTO unitDTO = new IcPartyUnitDTO(); + unitDTO.setAgencyId(entity.getAgencyId()); + Map option = icPartyUnitService.option(unitDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel)); + List unitIds = icActivityUnitRelationService.getUnitList(id); + List unitNames = unitIds.stream().map(option::get).collect(Collectors.toList()); + dto.setUnitIdList(unitIds); + dto.setUnitNameList(unitNames); - IcPartyActivityDTO dto = ConvertUtils.sourceToTarget(entity, IcPartyActivityDTO.class); - dto.setServiceMatterName(categoryMap.get(dto.getServiceMatter())); - //获取单位名称 - IcPartyUnitDTO unitDTO = icPartyUnitService.get(dto.getUnitId()); - if (null != unitDTO) { - dto.setUnitName(unitDTO.getUnitName()); - } return dto; } @@ -182,6 +179,35 @@ public class IcPartyActivityServiceImpl extends BaseServiceImpl unitRelationList = dto.getUnitIdList().stream().map(unitId -> { + IcActivityUnitRelationEntity relation = new IcActivityUnitRelationEntity(); + relation.setCustomerId(entity.getCustomerId()); + relation.setAgencyId(entity.getAgencyId()); + relation.setPids(entity.getPids()); + relation.setActivityId(entity.getId()); + relation.setUnitId(unitId); + relation.setSort(i.getAndIncrement()); + return relation; + }).collect(Collectors.toList()); + icActivityUnitRelationService.insertBatch(unitRelationList); + + //保存活动与服务关系 + icActivityServiceRelationService.deleteByActivity(entity.getId()); + AtomicInteger j = new AtomicInteger(NumConstant.ONE); + List serviceRelationList = dto.getServiceMatterList().stream().map(service -> { + IcActivityServiceRelationEntity relation = new IcActivityServiceRelationEntity(); + relation.setCustomerId(entity.getCustomerId()); + relation.setAgencyId(entity.getAgencyId()); + relation.setPids(entity.getPids()); + relation.setActivityId(entity.getId()); + relation.setServiceMatter(service); + relation.setSort(j.getAndIncrement()); + return relation; + }).collect(Collectors.toList()); + icActivityServiceRelationService.insertBatch(serviceRelationList); } @Override @@ -237,20 +263,31 @@ public class IcPartyActivityServiceImpl extends BaseServiceImpl%s", obj.getRowNum())); iterator.remove(); - } else if (null == option.get(obj.getUnitName())){ - numList.add(obj.getRowNum()); - log.warn(String.format("单位名称不存在,行号->%s", obj.getRowNum())); - iterator.remove(); + } else { + List unitList = Arrays.asList(obj.getUnitName().split(StrConstant.COMMA)); + unitList.forEach(unit -> { + if (null == option.get(unit)) { + numList.add(obj.getRowNum()); + log.warn(String.format("单位名称不存在,行号->%s", obj.getRowNum())); + iterator.remove(); + } + }); } //服务事项校验 if (StringUtils.isBlank(obj.getServiceMatter())) { numList.add(obj.getRowNum()); log.warn(String.format("服务事项为空,行号->%s", obj.getRowNum())); iterator.remove(); - } else if (null == categoryMap.get(obj.getServiceMatter())){ - numList.add(obj.getRowNum()); - log.warn(String.format("服务事项不存在,行号->%s", obj.getRowNum())); - iterator.remove(); + } else { + List serviceList = Arrays.asList(obj.getServiceMatter().split(StrConstant.SEMICOLON)); + serviceList.forEach(service -> { + if (null == categoryMap.get(service)) { + numList.add(obj.getRowNum()); + log.warn(String.format("服务事项不存在,行号->%s", obj.getRowNum())); + iterator.remove(); + } + }); + } //活动标题 活动目标 活动内容 活动时间 活动地址 活动地址经度 活动地址纬度 活动结果 if(StringUtils.isBlank(obj.getTitle()) || StringUtils.isBlank(obj.getTarget()) || @@ -271,7 +308,7 @@ public class IcPartyActivityServiceImpl extends BaseServiceImpl list = result.stream().map(item -> { + result.forEach(item -> { IcPartyActivityEntity entity = new IcPartyActivityEntity(); entity.setCustomerId(tokenDto.getCustomerId()); entity.setAgencyId(staffInfoCache.getAgencyId()); @@ -279,18 +316,44 @@ public class IcPartyActivityServiceImpl extends BaseServiceImpl unitRelationList = Arrays.stream(item.getUnitName().split(StrConstant.COMMA)).map(unit -> { + IcActivityUnitRelationEntity relation = new IcActivityUnitRelationEntity(); + relation.setCustomerId(entity.getCustomerId()); + relation.setAgencyId(entity.getAgencyId()); + relation.setPids(entity.getPids()); + relation.setActivityId(entity.getId()); + relation.setUnitId(option.get(unit)); + relation.setSort(i.getAndIncrement()); + return relation; + }).collect(Collectors.toList()); + icActivityUnitRelationService.insertBatch(unitRelationList); + + //保存活动与服务关系 + icActivityServiceRelationService.deleteByActivity(entity.getId()); + AtomicInteger j = new AtomicInteger(NumConstant.ONE); + List serviceRelationList = Arrays.stream(item.getServiceMatter().split(StrConstant.SEMICOLON)).map(service -> { + IcActivityServiceRelationEntity relation = new IcActivityServiceRelationEntity(); + relation.setCustomerId(entity.getCustomerId()); + relation.setAgencyId(entity.getAgencyId()); + relation.setPids(entity.getPids()); + relation.setActivityId(entity.getId()); + relation.setServiceMatter(categoryMap.get(service)); + relation.setSort(j.getAndIncrement()); + return relation; + }).collect(Collectors.toList()); + icActivityServiceRelationService.insertBatch(serviceRelationList); + }); String str = String.format("共%s条,成功导入%s条。", numList.size() + result.size(), numList.size() + result.size() - numList.size()); if (numList.size() > NumConstant.ZERO) { @@ -347,14 +410,7 @@ public class IcPartyActivityServiceImpl extends BaseServiceImpl wrapper = new LambdaQueryWrapper<>(); - wrapper.and(wp -> wp.eq(IcPartyActivityEntity::getAgencyId, formDTO.getAgencyId()).or(). - like(IcPartyActivityEntity::getPids, formDTO.getAgencyId())); - wrapper.eq(StringUtils.isNotBlank(formDTO.getServiceMatter()), IcPartyActivityEntity::getServiceMatter, formDTO.getServiceMatter()); - wrapper.ge(null != formDTO.getStartTime(),IcPartyActivityEntity::getActivityTime, formDTO.getStartTime()); - wrapper.le(null != formDTO.getEndTime(), IcPartyActivityEntity::getActivityTime, formDTO.getEndTime()); - wrapper.orderByDesc(IcPartyActivityEntity::getActivityTime); - List list = baseDao.selectList(wrapper); + List list = baseDao.getActivityList(formDTO); List dtoList = ConvertUtils.sourceToTarget(list, IcPartyActivityDTO.class); IcPartyUnitDTO unitDTO = new IcPartyUnitDTO(); @@ -367,8 +423,15 @@ public class IcPartyActivityServiceImpl extends BaseServiceImpl categoryMap=serviceItemList.stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel)); //数据组装 dtoList.forEach(dto -> { - dto.setServiceMatterName(categoryMap.get(dto.getServiceMatter())); - dto.setUnitName(option.get(dto.getUnitId())); + //联建单位ID与单位名匹配 + List unitIds = Arrays.asList(dto.getUnitId().split(StrConstant.COMMA)); + List unitNames = unitIds.stream().map(option::get).collect(Collectors.toList()); + dto.setUnitName(StringUtils.join(unitNames, StrConstant.COMMA)); + + //服务事项与服务事项名匹配 + List services = Arrays.asList(dto.getServiceMatter().split(StrConstant.COMMA)); + List serviceNames = services.stream().map(categoryMap::get).collect(Collectors.toList()); + dto.setServiceMatterName(StringUtils.join(serviceNames, StrConstant.SEMICOLON)); }); } PageInfo pageInfo = new PageInfo<>(dtoList); diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LatestActServiceRelationServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LatestActServiceRelationServiceImpl.java new file mode 100644 index 0000000000..f94e54a486 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LatestActServiceRelationServiceImpl.java @@ -0,0 +1,33 @@ +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.LatestActServiceRelationDao; +import com.epmet.dto.LatestActServiceRelationDTO; +import com.epmet.entity.LatestActServiceRelationEntity; +import com.epmet.redis.LatestActServiceRelationRedis; +import com.epmet.service.LatestActServiceRelationService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 联建活动与服务事项关联表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-02-21 + */ +@Service +public class LatestActServiceRelationServiceImpl extends BaseServiceImpl implements LatestActServiceRelationService { + + +} \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LatestActUnitRelationServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LatestActUnitRelationServiceImpl.java new file mode 100644 index 0000000000..aee966d2ea --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LatestActUnitRelationServiceImpl.java @@ -0,0 +1,19 @@ +package com.epmet.service.impl; + +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.dao.LatestActUnitRelationDao; +import com.epmet.entity.LatestActUnitRelationEntity; +import com.epmet.service.LatestActUnitRelationService; +import org.springframework.stereotype.Service; + +/** + * 联建活动与单位关联表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-02-21 + */ +@Service +public class LatestActUnitRelationServiceImpl extends BaseServiceImpl implements LatestActUnitRelationService { + + +} \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcActivityServiceRelationDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcActivityServiceRelationDao.xml new file mode 100644 index 0000000000..dabb923f67 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcActivityServiceRelationDao.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + DELETE FROM ic_activity_service_relation WHERE ACTIVITY_ID = #{activityId} + + + + \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcActivityUnitRelationDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcActivityUnitRelationDao.xml new file mode 100644 index 0000000000..f8947c98e4 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcActivityUnitRelationDao.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + DELETE FROM ic_activity_unit_relation WHERE ACTIVITY_ID = #{activityId} + + + + \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPartyActivityDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPartyActivityDao.xml index ede5b4c0e1..fb7912f42d 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPartyActivityDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPartyActivityDao.xml @@ -28,14 +28,16 @@ + + + \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActServiceRelationDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActServiceRelationDao.xml new file mode 100644 index 0000000000..abc0deda55 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActServiceRelationDao.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + DELETE FROM latest_act_service_relation WHERE ACT_ID = #{activityId} + + + \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActUnitRelationDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActUnitRelationDao.xml new file mode 100644 index 0000000000..e679b5dc53 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActUnitRelationDao.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + DELETE FROM latest_act_unit_relation WHERE ACT_ID = #{activityId} + + + \ No newline at end of file