From 45e6c4722306927149cc6cc000273fc115cd6b6d Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Mon, 30 May 2022 13:31:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E9=A1=B9=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/form/IcServiceOrgListFormDTO.java | 2 +- .../dto/result/IcServiceOrgListResultDTO.java | 2 +- .../IcServiceOrgSelectListResultDTO.java | 24 +++++++++ .../controller/IcServiceOrgController.java | 25 +++++++-- .../java/com/epmet/dao/IcServiceOrgDao.java | 9 ++++ .../epmet/service/IcServiceOrgService.java | 18 +++---- .../service/impl/IcServiceOrgServiceImpl.java | 51 +++++++++++++++++-- .../main/resources/mapper/IcServiceOrgDao.xml | 41 +++++++++++++-- 8 files changed, 149 insertions(+), 23 deletions(-) create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/IcServiceOrgSelectListResultDTO.java diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/IcServiceOrgListFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/IcServiceOrgListFormDTO.java index f5eb0e8d1c..b0cceaeb79 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/IcServiceOrgListFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/IcServiceOrgListFormDTO.java @@ -27,7 +27,7 @@ public class IcServiceOrgListFormDTO implements Serializable { /** * 备注信息 */ - private String remarks; + private String remark; /** * 页码 */ diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/IcServiceOrgListResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/IcServiceOrgListResultDTO.java index 46d4d21f1b..94de3be56c 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/IcServiceOrgListResultDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/IcServiceOrgListResultDTO.java @@ -60,7 +60,7 @@ public class IcServiceOrgListResultDTO implements Serializable { /** * 备注 */ - private String remarks; + private String remark; @Data public static class ServiceType { diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/IcServiceOrgSelectListResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/IcServiceOrgSelectListResultDTO.java new file mode 100644 index 0000000000..30f5ef457b --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/IcServiceOrgSelectListResultDTO.java @@ -0,0 +1,24 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 【组织】服务组织列表_下拉框使用--接口返参 + * @Author sun + */ +@Data +public class IcServiceOrgSelectListResultDTO implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 服务组织Id + */ + private String icServiceOrgId; + /** + * 服务组织名称 + */ + private String orgName; + +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcServiceOrgController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcServiceOrgController.java index 95fc3fcded..2232830346 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcServiceOrgController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcServiceOrgController.java @@ -13,10 +13,13 @@ import com.epmet.dto.IcServiceOrgDTO; import com.epmet.dto.form.IcServiceOrgAddEditFormDTO; import com.epmet.dto.form.IcServiceOrgListFormDTO; import com.epmet.dto.result.IcServiceOrgListResultDTO; +import com.epmet.dto.result.IcServiceOrgSelectListResultDTO; import com.epmet.service.IcServiceOrgService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import java.util.List; + /** * 服务组织表 @@ -56,19 +59,33 @@ public class IcServiceOrgController { @NoRepeatSubmit @PostMapping("edit") - public Result edit(@RequestBody IcServiceOrgAddEditFormDTO dto){ - //效验数据 + public Result edit(@LoginUser TokenDto tokenDto, @RequestBody IcServiceOrgAddEditFormDTO dto){ ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + dto.setCustomerId(tokenDto.getCustomerId()); + dto.setUserId(tokenDto.getUserId()); icServiceOrgService.update(dto); return new Result(); } @PostMapping("del") - public Result delete(@RequestBody IcServiceOrgAddEditFormDTO formDTO){ + public Result delete(@LoginUser TokenDto tokenDto, @RequestBody IcServiceOrgAddEditFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO, IcServiceOrgAddEditFormDTO.Del.class); - icServiceOrgService.delete(formDTO.getIcServiceOrgId()); + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + icServiceOrgService.delete(formDTO); return new Result(); } + @RequestMapping("detail") + public Result detail(@RequestBody IcServiceOrgListFormDTO formDTO) { + return new Result().ok(icServiceOrgService.detail(formDTO)); + } + + @RequestMapping("selectlist") + public Result> selectList(@LoginUser TokenDto tokenDto, @RequestBody IcServiceOrgListFormDTO formDTO){ + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setStaffId(tokenDto.getUserId()); + return new Result>().ok(icServiceOrgService.selectList(formDTO)); + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcServiceOrgDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcServiceOrgDao.java index 04472f9c0d..5407d8f10b 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcServiceOrgDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcServiceOrgDao.java @@ -3,6 +3,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.form.IcServiceOrgListFormDTO; import com.epmet.dto.result.IcServiceOrgListResultDTO; +import com.epmet.dto.result.IcServiceOrgSelectListResultDTO; import com.epmet.entity.IcServiceOrgEntity; import org.apache.ibatis.annotations.Mapper; @@ -22,4 +23,12 @@ public interface IcServiceOrgDao extends BaseDao { * @Description 服务组织-列表查询 **/ List selectServiceOrgList(IcServiceOrgListFormDTO formDTO); + + /** + * @Author sun + * @Description 服务组织列表_下拉框 + **/ + List selectServiceOrgSelectList(IcServiceOrgListFormDTO formDTO); + + void del(IcServiceOrgEntity entity); } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcServiceOrgService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcServiceOrgService.java index 716c00188d..3115e08d8a 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcServiceOrgService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcServiceOrgService.java @@ -6,8 +6,11 @@ import com.epmet.dto.IcServiceOrgDTO; import com.epmet.dto.form.IcServiceOrgAddEditFormDTO; import com.epmet.dto.form.IcServiceOrgListFormDTO; import com.epmet.dto.result.IcServiceOrgListResultDTO; +import com.epmet.dto.result.IcServiceOrgSelectListResultDTO; import com.epmet.entity.IcServiceOrgEntity; +import java.util.List; + /** * 服务组织表 * @@ -56,13 +59,10 @@ public interface IcServiceOrgService extends BaseService { */ void update(IcServiceOrgAddEditFormDTO dto); - /** - * 批量删除 - * - * @param icServiceOrgId - * @return void - * @author generator - * @date 2022-05-27 - */ - void delete(String icServiceOrgId); + void delete(IcServiceOrgAddEditFormDTO formDTO); + + IcServiceOrgListResultDTO detail(IcServiceOrgListFormDTO formDTO); + + List selectList(IcServiceOrgListFormDTO formDTO); + } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcServiceOrgServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcServiceOrgServiceImpl.java index 8444957e8c..eacf96586e 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcServiceOrgServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcServiceOrgServiceImpl.java @@ -4,6 +4,7 @@ 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.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.enums.DictTypeEnum; import com.epmet.commons.tools.exception.EpmetErrorCode; @@ -17,6 +18,7 @@ import com.epmet.dto.IcServiceOrgDTO; import com.epmet.dto.form.IcServiceOrgAddEditFormDTO; import com.epmet.dto.form.IcServiceOrgListFormDTO; import com.epmet.dto.result.IcServiceOrgListResultDTO; +import com.epmet.dto.result.IcServiceOrgSelectListResultDTO; import com.epmet.entity.IcServiceOrgEntity; import com.epmet.feign.EpmetAdminOpenFeignClient; import com.epmet.service.IcServiceOrgService; @@ -115,7 +117,7 @@ public class IcServiceOrgServiceImpl extends BaseServiceImpl list = baseDao.selectServiceOrgList(formDTO); + + //封装服务类别数据 + if (!CollectionUtils.isEmpty(list)) { + resultDTO = list.get(NumConstant.ZERO); + //服务类别字典表数据 + Result> statusRes = epmetAdminOpenFeignClient.dictMap(DictTypeEnum.IC_SERVICE_TYPE.getCode()); + Map statusMap = statusRes.success() && MapUtils.isNotEmpty(statusRes.getData()) ? statusRes.getData() : new HashMap<>(); + List stList = new ArrayList<>(); + IcServiceOrgListResultDTO.ServiceType st = null; + for (String str : resultDTO.getServiceType().split(",")) { + st = new IcServiceOrgListResultDTO.ServiceType(); + st.setValue(str); + st.setName(null != statusMap.get(str) ? statusMap.get(str) : ""); + stList.add(st); + } + resultDTO.setServiceTypeList(stList); + } + + return resultDTO; + } + + @Override + public List selectList(IcServiceOrgListFormDTO formDTO) { + //1.获取当前工作人员缓存信息 + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId()); + if (null == staffInfo) { + throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", formDTO.getStaffId())); + } + //2.按条件查询当前组织及下级服务组织数据 + List resultList = baseDao.selectServiceOrgSelectList(formDTO); + + return resultList; } } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceOrgDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceOrgDao.xml index fb9d2679ab..18c6dbe981 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceOrgDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceOrgDao.xml @@ -15,7 +15,7 @@ longitude longitude, latitude latitude, address address, - remarks remarks + remark remark FROM ic_service_org WHERE @@ -27,7 +27,10 @@ AND customer_id = #{customerId} - AND pids LIKE CONCAT('%',#{agencyId},'%') + AND agency_id_path LIKE CONCAT('%',#{agencyId},'%') + + + AND service_type LIKE CONCAT('%', #{serviceType}, '%') AND org_name LIKE CONCAT('%', #{orgName}, '%') @@ -35,11 +38,41 @@ AND address LIKE CONCAT('%', #{address}, '%') - - AND remarks LIKE CONCAT('%', #{remarks}, '%') + + AND remark LIKE CONCAT('%', #{remark}, '%') + + ORDER BY created_time DESC + + + + + UPDATE ic_service_org + SET del_flag = '1', + updated_by = #{updatedBy}, + updated_time = NOW() + WHERE + id = #{id} + AND del_flag = '0' + + \ No newline at end of file