From 817812dd40df6c17add809225c8e77c5b579241b Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Fri, 3 Feb 2023 17:39:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=AC=E5=85=B1=E6=9C=8D=E5=8A=A1=E7=BB=84?= =?UTF-8?q?=E7=BB=87=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dto/IcPublicServiceOrgDTO.java | 110 +++++++++++ .../IcPublicServiceOrgServiceMatterDTO.java | 90 +++++++++ .../dto/form/IcPublicServiceOrgFormDTO.java | 132 ++++++++++++++ .../form/IcPublicServiceOrgPageFormDTO.java | 28 +++ .../IcPublicServiceOrgDetailResDTO.java | 87 +++++++++ .../IcPublicServiceOrgController.java | 101 +++++++++++ .../com/epmet/dao/IcPublicServiceOrgDao.java | 21 +++ .../IcPublicServiceOrgServiceMatterDao.java | 20 ++ .../entity/IcPublicServiceOrgEntity.java | 76 ++++++++ ...IcPublicServiceOrgServiceMatterEntity.java | 44 +++++ .../service/IcPublicServiceOrgService.java | 34 ++++ .../impl/IcPublicServiceOrgServiceImpl.java | 171 ++++++++++++++++++ .../mapper/IcPublicServiceOrgDao.xml | 86 +++++++++ .../IcPublicServiceOrgServiceMatterDao.xml | 30 +++ 14 files changed, 1030 insertions(+) create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPublicServiceOrgDTO.java create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPublicServiceOrgServiceMatterDTO.java create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/IcPublicServiceOrgFormDTO.java create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/IcPublicServiceOrgPageFormDTO.java create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/IcPublicServiceOrgDetailResDTO.java create mode 100644 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPublicServiceOrgController.java create mode 100644 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcPublicServiceOrgDao.java create mode 100644 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcPublicServiceOrgServiceMatterDao.java create mode 100644 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcPublicServiceOrgEntity.java create mode 100644 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcPublicServiceOrgServiceMatterEntity.java create mode 100644 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPublicServiceOrgService.java create mode 100644 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPublicServiceOrgServiceImpl.java create mode 100644 epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPublicServiceOrgDao.xml create mode 100644 epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPublicServiceOrgServiceMatterDao.xml diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPublicServiceOrgDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPublicServiceOrgDTO.java new file mode 100644 index 0000000000..255d395e0a --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPublicServiceOrgDTO.java @@ -0,0 +1,110 @@ +package com.epmet.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + + +/** + * 公共服务组织管理(烟台需求) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-02-03 + */ +@Data +public class IcPublicServiceOrgDTO implements Serializable { + + private static final long serialVersionUID = 1L; + /** + * 主键 + */ + private String id; + + /** + * 客户id + */ + private String customerId; + + /** + * 组织ID + */ + private String agencyId; + + /** + * AGENCY_ID的pids + */ + private String pids; + + /** + * 名称 + */ + private String name; + + /** + * 1:实有单位;2:社会服务组织3:志愿团队 + */ + private String type; + + /** + * 联系人 + */ + private String contact; + + /** + * 联系电话 + */ + private String contactMobile; + + /** + * 地址 + */ + private String address; + + /** + * 中心位置经度 + */ + private String longitude; + + /** + * 中心位置纬度 + */ + private String latitude; + + /** + * 备注 + */ + private String remark; + + /** + * 删除标识 0未删除、1已删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + private List serviceMatterList; +} \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPublicServiceOrgServiceMatterDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPublicServiceOrgServiceMatterDTO.java new file mode 100644 index 0000000000..64a993efa9 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPublicServiceOrgServiceMatterDTO.java @@ -0,0 +1,90 @@ +package com.epmet.dto; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 公共服务组织服务事项(烟台需求) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-02-03 + */ +@Data +public class IcPublicServiceOrgServiceMatterDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @JsonIgnore + private String id; + + /** + * 客户id + */ + @JsonIgnore + private String customerId; + + /** + * ic_public_service_org.ID + */ + @JsonIgnore + private String orgId; + + /** + * ic_service_item_dict.ID + */ + private String categoryId; + + /** + * 服务事项编码ic_service_item_dict.CATEGORY_CODE + */ + private String categoryCode; + + /** + * 删除标识 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; + + /** + * 详情页面显示 + */ + private String categoryName; + +} \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/IcPublicServiceOrgFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/IcPublicServiceOrgFormDTO.java new file mode 100644 index 0000000000..1937aa7a4f --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/IcPublicServiceOrgFormDTO.java @@ -0,0 +1,132 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import com.epmet.dto.IcPublicServiceOrgServiceMatterDTO; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotBlank; +import java.util.Date; +import java.util.List; + +/** + * @Description + * @Author yzm + * @Date 2023/2/3 15:04 + */ +@Data +public class IcPublicServiceOrgFormDTO { + public interface AddUserInternalGroup { + } + + public interface AddUserShowGroup extends CustomerClientShowGroup { + } + + public interface UpdateUserInternalGroup { + } + + public interface UpdateUserShowGroup extends CustomerClientShowGroup { + } + + /** + * 主键 + */ + @NotBlank(message = "id为空", groups = UpdateUserInternalGroup.class) + private String id; + + /** + * 客户id + */ + @NotBlank(message = "customerId不能为空", groups = {AddUserInternalGroup.class, UpdateUserInternalGroup.class}) + private String customerId; + + /** + * 组织ID + */ + @NotBlank(message = "agencyId不能为空",groups =UpdateUserInternalGroup.class ) + private String agencyId; + + /** + * AGENCY_ID的pids + */ + private String pids; + + /** + * 名称 + */ + @Length(max = 100, groups = AddUserShowGroup.class, message = "最多输入100字") + @NotBlank(message = "名称不能为空", groups = {UpdateUserShowGroup.class, AddUserShowGroup.class}) + private String name; + + /** + * 1:实有单位;2:社会服务组织3:志愿团队 + */ + @NotBlank(message = "类别不能为空", groups = {UpdateUserShowGroup.class, AddUserShowGroup.class}) + private String type; + + /** + * 联系人 + */ + @NotBlank(message = "联系人不能为空", groups = {UpdateUserShowGroup.class, AddUserShowGroup.class}) + private String contact; + + /** + * 联系电话 + */ + @NotBlank(message = "联系电话不能为空", groups = {UpdateUserShowGroup.class, AddUserShowGroup.class}) + private String contactMobile; + + /** + * 地址 + */ + @NotBlank(message = "地址不能为空", groups = {UpdateUserShowGroup.class, AddUserShowGroup.class}) + private String address; + + /** + * 中心位置经度 + */ + private String longitude; + + /** + * 中心位置纬度 + */ + private String latitude; + + /** + * 备注 + */ + private String remark; + + /** + * 删除标识 0未删除、1已删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + + private List serviceMatterList; +} + diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/IcPublicServiceOrgPageFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/IcPublicServiceOrgPageFormDTO.java new file mode 100644 index 0000000000..d056c4af1d --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/IcPublicServiceOrgPageFormDTO.java @@ -0,0 +1,28 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.dto.form.PageFormDTO; +import lombok.Data; + +import java.util.List; + +/** + * @Description + * @Author yzm + * @Date 2023/2/3 16:02 + */ +@Data +public class IcPublicServiceOrgPageFormDTO extends PageFormDTO { + private String customerId; + private String agencyId; + private String name; + private List categoryIds; + private String type; + private String contact; + private String contactMobile; + + /** + * 工作端当前登录人员 + */ + private String currentStaffId; +} + diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/IcPublicServiceOrgDetailResDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/IcPublicServiceOrgDetailResDTO.java new file mode 100644 index 0000000000..a596953035 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/IcPublicServiceOrgDetailResDTO.java @@ -0,0 +1,87 @@ +package com.epmet.dto.result; + +import com.epmet.dto.IcPublicServiceOrgServiceMatterDTO; +import lombok.Data; + +import java.util.List; + +/** + * @Description + * @Author yzm + * @Date 2023/2/3 15:52 + */ +@Data +public class IcPublicServiceOrgDetailResDTO { + /** + * 主键 + */ + private String id; + + /** + * 客户id + */ + private String customerId; + + /** + * 组织ID + */ + private String agencyId; + + + private String agencyName; + + /** + * AGENCY_ID的pids + */ + private String pids; + + /** + * 名称 + */ + private String name; + + /** + * 1:实有单位;2:社会服务组织3:志愿团队 + */ + private String type; + + private String typeName; + + /** + * 联系人 + */ + private String contact; + + /** + * 联系电话 + */ + private String contactMobile; + + /** + * 地址 + */ + private String address; + + /** + * 中心位置经度 + */ + private String longitude; + + /** + * 中心位置纬度 + */ + private String latitude; + + /** + * 备注 + */ + private String remark; + /** + * 服务事项名称 + * 多个,按照英文逗号隔开 + */ + private String serviceMatterName; + + private List serviceMatterList; +} + diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPublicServiceOrgController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPublicServiceOrgController.java new file mode 100644 index 0000000000..ddfd674cfd --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPublicServiceOrgController.java @@ -0,0 +1,101 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.aop.NoRepeatSubmit; +import com.epmet.commons.tools.constant.AppClientConstant; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.form.IcPublicServiceOrgFormDTO; +import com.epmet.dto.form.IcPublicServiceOrgPageFormDTO; +import com.epmet.dto.result.IcPublicServiceOrgDetailResDTO; +import com.epmet.service.IcPublicServiceOrgService; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + + +/** + * 公共服务组织管理(烟台需求) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-02-03 + */ +@RestController +@RequestMapping("icPublicServiceOrg") +public class IcPublicServiceOrgController { + + @Autowired + private IcPublicServiceOrgService icPublicServiceOrgService; + + /** + * + * @param tokenDto + * @param formDTO + * @return + */ + @RequestMapping("page") + public Result> page(@LoginUser TokenDto tokenDto, @RequestBody IcPublicServiceOrgPageFormDTO formDTO) { + formDTO.setCustomerId(tokenDto.getCustomerId()); + //工作端调用的话,赋值当前登录用户id + if(AppClientConstant.APP_GOV.equals(tokenDto.getApp())){ + formDTO.setCurrentStaffId(tokenDto.getUserId()); + } + PageData page = icPublicServiceOrgService.page(formDTO); + return new Result>().ok(page); + } + + @PostMapping("detail/{id}") + public Result get(@PathVariable("id") String id){ + IcPublicServiceOrgDetailResDTO data = icPublicServiceOrgService.get(id); + return new Result().ok(data); + } + + /** + * 新增;名称组织下唯一 + * @param formDTO + * @return + */ + @NoRepeatSubmit + @PostMapping("save") + public Result save(@LoginUser TokenDto tokenDto, @RequestBody IcPublicServiceOrgFormDTO formDTO){ + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setCreatedBy(tokenDto.getUserId()); + ValidatorUtils.validateEntity(formDTO, IcPublicServiceOrgFormDTO.AddUserShowGroup.class, IcPublicServiceOrgFormDTO.AddUserInternalGroup.class); + icPublicServiceOrgService.save(formDTO); + return new Result(); + } + + /** + * + * @param tokenDto + * @param formDTO + * @return + */ + @NoRepeatSubmit + @PostMapping("update") + public Result update(@LoginUser TokenDto tokenDto,@RequestBody IcPublicServiceOrgFormDTO formDTO){ + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setCreatedBy(tokenDto.getUserId()); + ValidatorUtils.validateEntity(formDTO, IcPublicServiceOrgFormDTO.UpdateUserShowGroup.class, IcPublicServiceOrgFormDTO.UpdateUserInternalGroup.class); + icPublicServiceOrgService.update(formDTO); + return new Result(); + } + + /** + * 同时删除服务事项表 + * @param ids + * @return + */ + @PostMapping("delete") + public Result delete(@RequestBody List ids){ + if(CollectionUtils.isNotEmpty(ids)){ + icPublicServiceOrgService.delete(ids); + } + return new Result(); + } + +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcPublicServiceOrgDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcPublicServiceOrgDao.java new file mode 100644 index 0000000000..227091f5cc --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcPublicServiceOrgDao.java @@ -0,0 +1,21 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.form.IcPublicServiceOrgPageFormDTO; +import com.epmet.dto.result.IcPublicServiceOrgDetailResDTO; +import com.epmet.entity.IcPublicServiceOrgEntity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 公共服务组织管理(烟台需求) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-02-03 + */ +@Mapper +public interface IcPublicServiceOrgDao extends BaseDao { + + List pageList(IcPublicServiceOrgPageFormDTO formDTO); +} \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcPublicServiceOrgServiceMatterDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcPublicServiceOrgServiceMatterDao.java new file mode 100644 index 0000000000..3994195445 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcPublicServiceOrgServiceMatterDao.java @@ -0,0 +1,20 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.IcPublicServiceOrgServiceMatterDTO; +import com.epmet.entity.IcPublicServiceOrgServiceMatterEntity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 公共服务组织服务事项(烟台需求) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-02-03 + */ +@Mapper +public interface IcPublicServiceOrgServiceMatterDao extends BaseDao { + + List selectServiceMatter(String orgId); +} \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcPublicServiceOrgEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcPublicServiceOrgEntity.java new file mode 100644 index 0000000000..4c044abd5b --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcPublicServiceOrgEntity.java @@ -0,0 +1,76 @@ +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 2023-02-03 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("ic_public_service_org") +public class IcPublicServiceOrgEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 组织ID + */ + private String agencyId; + + /** + * AGENCY_ID的pids + */ + private String pids; + + /** + * 名称 + */ + private String name; + + /** + * 1:实有单位;2:社会服务组织3:志愿团队 + */ + private String type; + + /** + * 联系人 + */ + private String contact; + + /** + * 联系电话 + */ + private String contactMobile; + + /** + * 地址 + */ + private String address; + + /** + * 中心位置经度 + */ + private String longitude; + + /** + * 中心位置纬度 + */ + private String latitude; + + /** + * 备注 + */ + private String remark; + +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcPublicServiceOrgServiceMatterEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcPublicServiceOrgServiceMatterEntity.java new file mode 100644 index 0000000000..98dd6ebc71 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcPublicServiceOrgServiceMatterEntity.java @@ -0,0 +1,44 @@ +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 2023-02-03 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("ic_public_service_org_service_matter") +public class IcPublicServiceOrgServiceMatterEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * ic_public_service_org.ID + */ + private String orgId; + + /** + * ic_service_item_dict.ID + */ + private String categoryId; + + /** + * 服务事项编码ic_service_item_dict.CATEGORY_CODE + */ + private String categoryCode; + +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPublicServiceOrgService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPublicServiceOrgService.java new file mode 100644 index 0000000000..79bf76d182 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPublicServiceOrgService.java @@ -0,0 +1,34 @@ +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.form.IcPublicServiceOrgFormDTO; +import com.epmet.dto.form.IcPublicServiceOrgPageFormDTO; +import com.epmet.dto.result.IcPublicServiceOrgDetailResDTO; +import com.epmet.entity.IcPublicServiceOrgEntity; + +import java.util.List; + +/** + * 公共服务组织管理(烟台需求) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-02-03 + */ +public interface IcPublicServiceOrgService extends BaseService { + + /** + * 公共服务组织 + * @param dto + * @return + */ + String save(IcPublicServiceOrgFormDTO dto); + + String update(IcPublicServiceOrgFormDTO formDTO); + + void delete(List orgIds); + + IcPublicServiceOrgDetailResDTO get(String id); + + PageData page(IcPublicServiceOrgPageFormDTO formDTO); +} \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPublicServiceOrgServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPublicServiceOrgServiceImpl.java new file mode 100644 index 0000000000..f82dd48c81 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPublicServiceOrgServiceImpl.java @@ -0,0 +1,171 @@ +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.constant.StrConstant; +import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.redis.common.CustomerOrgRedis; +import com.epmet.commons.tools.redis.common.CustomerStaffRedis; +import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.dao.IcPublicServiceOrgDao; +import com.epmet.dao.IcPublicServiceOrgServiceMatterDao; +import com.epmet.dto.form.IcPublicServiceOrgFormDTO; +import com.epmet.dto.form.IcPublicServiceOrgPageFormDTO; +import com.epmet.dto.result.IcPublicServiceOrgDetailResDTO; +import com.epmet.entity.IcPublicServiceOrgEntity; +import com.epmet.entity.IcPublicServiceOrgServiceMatterEntity; +import com.epmet.service.IcPublicServiceOrgService; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import org.apache.commons.collections4.CollectionUtils; +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.List; +import java.util.stream.Collectors; + +/** + * 公共服务组织管理(烟台需求) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-02-03 + */ +@Service +public class IcPublicServiceOrgServiceImpl extends BaseServiceImpl implements IcPublicServiceOrgService { + @Autowired + private IcPublicServiceOrgServiceMatterDao icPublicServiceOrgServiceMatterDao; + + + @Transactional(rollbackFor = EpmetException.class) + @Override + public String save(IcPublicServiceOrgFormDTO formDto) { + CustomerStaffInfoCacheResult staffInfo= CustomerStaffRedis.getStaffInfo(formDto.getCustomerId(),formDto.getCreatedBy()); + if(null==staffInfo|| StringUtils.isBlank(staffInfo.getAgencyId())){ + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode()); + } + checkUnqiueName(formDto.getName(),formDto.getAgencyId(),null); + formDto.setAgencyId(staffInfo.getAgencyId()); + formDto.setPids(staffInfo.getAgencyPIds()); + IcPublicServiceOrgEntity entity=ConvertUtils.sourceToTarget(formDto,IcPublicServiceOrgEntity.class); + baseDao.insert(entity); + if(CollectionUtils.isNotEmpty(formDto.getServiceMatterList())){ + formDto.getServiceMatterList().forEach(dto->{ + IcPublicServiceOrgServiceMatterEntity serviceOrgServiceMatterEntity=ConvertUtils.sourceToTarget(dto,IcPublicServiceOrgServiceMatterEntity.class); + serviceOrgServiceMatterEntity.setOrgId(entity.getId()); + serviceOrgServiceMatterEntity.setCustomerId(formDto.getCustomerId()); + icPublicServiceOrgServiceMatterDao.insert(serviceOrgServiceMatterEntity); + }); + } + return entity.getId(); + } + + /** + * + * @param name + * @param agencyId + * @param id + */ + private void checkUnqiueName(String name, String agencyId, String id) { + LambdaQueryWrapper queryWrapper=new LambdaQueryWrapper<>(); + queryWrapper.eq(IcPublicServiceOrgEntity::getName,name) + .eq(IcPublicServiceOrgEntity::getAgencyId,agencyId) + .ne(StringUtils.isNotBlank(id),IcPublicServiceOrgEntity::getId,id); + int count=baseDao.selectCount(queryWrapper); + if(count>1){ + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"名称已存在","名称已存在"); + } + } + + @Transactional(rollbackFor = EpmetException.class) + @Override + public String update(IcPublicServiceOrgFormDTO formDTO) { + checkUnqiueName(formDTO.getName(),formDTO.getAgencyId(),formDTO.getId()); + IcPublicServiceOrgEntity entity=ConvertUtils.sourceToTarget(formDTO,IcPublicServiceOrgEntity.class); + baseDao.updateById(entity); + if(CollectionUtils.isNotEmpty(formDTO.getServiceMatterList())){ + //先删除 + LambdaQueryWrapper deleteWrapper=new LambdaQueryWrapper<>(); + deleteWrapper.eq(IcPublicServiceOrgServiceMatterEntity::getOrgId,formDTO.getId()); + icPublicServiceOrgServiceMatterDao.delete(deleteWrapper); + formDTO.getServiceMatterList().forEach(dto->{ + IcPublicServiceOrgServiceMatterEntity serviceOrgServiceMatterEntity=ConvertUtils.sourceToTarget(dto,IcPublicServiceOrgServiceMatterEntity.class); + serviceOrgServiceMatterEntity.setOrgId(entity.getId()); + serviceOrgServiceMatterEntity.setCustomerId(formDTO.getCustomerId()); + icPublicServiceOrgServiceMatterDao.insert(serviceOrgServiceMatterEntity); + }); + } + return entity.getId(); + } + + @Transactional(rollbackFor = EpmetException.class) + @Override + public void delete(List orgIds) { + orgIds.forEach(orgId->{ + baseDao.deleteById(orgId); + //先删除 + LambdaQueryWrapper deleteWrapper=new LambdaQueryWrapper<>(); + deleteWrapper.eq(IcPublicServiceOrgServiceMatterEntity::getOrgId,orgId); + icPublicServiceOrgServiceMatterDao.delete(deleteWrapper); + }); + } + + + @Override + public IcPublicServiceOrgDetailResDTO get(String id) { + IcPublicServiceOrgEntity entity = baseDao.selectById(id); + if (null == entity) { + return null; + } + IcPublicServiceOrgDetailResDTO result = ConvertUtils.sourceToTarget(entity, IcPublicServiceOrgDetailResDTO.class); + // 1:实有单位;2:社会服务组织3:志愿团队 + if(NumConstant.ONE_STR.equals(result.getType())){ + result.setTypeName("实有单位"); + }else if(NumConstant.TWO_STR.equals(result.getType())){ + result.setTypeName("社会服务组织"); + }else if(NumConstant.THREE_STR.equals(result.getType())){ + result.setTypeName("志愿团队"); + } + AgencyInfoCache agencyInfoCache = CustomerOrgRedis.getAgencyInfo(result.getAgencyId()); + if (null != agencyInfoCache) { + result.setAgencyName(agencyInfoCache.getOrganizationName()); + } + result.setServiceMatterList(icPublicServiceOrgServiceMatterDao.selectServiceMatter(id)); + List nameList=result.getServiceMatterList().stream().map(m->m.getCategoryName()).collect(Collectors.toList()); + if(CollectionUtils.isNotEmpty(nameList)){ + result.setServiceMatterName(StringUtils.joinWith(StrConstant.SEMICOLON,nameList.toArray())); + } + return result; + } + + + + @Override + public PageData page(IcPublicServiceOrgPageFormDTO formDTO) { + if (StringUtils.isNotBlank(formDTO.getCurrentStaffId()) && StringUtils.isBlank(formDTO.getAgencyId())) { + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getCurrentStaffId()); + formDTO.setAgencyId(staffInfo.getAgencyId()); + } + PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); + List list = baseDao.pageList(formDTO); + PageInfo pageInfo = new PageInfo<>(list); + list.forEach(item -> { + AgencyInfoCache agencyInfoCache = CustomerOrgRedis.getAgencyInfo(item.getAgencyId()); + item.setAgencyName(null != agencyInfoCache ? agencyInfoCache.getOrganizationName() : StrConstant.EPMETY_STR); + List nameList=item.getServiceMatterList().stream().map(m->m.getCategoryName()).collect(Collectors.toList()); + if(CollectionUtils.isNotEmpty(nameList)){ + item.setServiceMatterName(StringUtils.joinWith(StrConstant.SEMICOLON,nameList.toArray())); + } + }); + return new PageData<>(list, pageInfo.getTotal()); + } + + + +} \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPublicServiceOrgDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPublicServiceOrgDao.xml new file mode 100644 index 0000000000..708f29f760 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPublicServiceOrgDao.xml @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPublicServiceOrgServiceMatterDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPublicServiceOrgServiceMatterDao.xml new file mode 100644 index 0000000000..9603aab514 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcPublicServiceOrgServiceMatterDao.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file