diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java index c665eed455..72b254a180 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java @@ -42,7 +42,6 @@ import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; -import sun.jvm.hotspot.memory.ContiguousSpace; import java.math.BigDecimal; import java.util.ArrayList; diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcUserDemandServiceDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcUserDemandServiceDTO.java index aa2218a8af..956ee1065e 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcUserDemandServiceDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcUserDemandServiceDTO.java @@ -59,6 +59,11 @@ public class IcUserDemandServiceDTO implements Serializable { */ private String serverId; + /** + * 服务方姓名 + */ + private String serverName; + /** * 实际服务开始时间 */ diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcUserDemandServiceEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcUserDemandServiceEntity.java index 2dd6b4ca04..8091aff8fc 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcUserDemandServiceEntity.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcUserDemandServiceEntity.java @@ -58,6 +58,11 @@ public class IcUserDemandServiceEntity extends BaseEpmetEntity { */ private String serverId; + /** + * 服务方姓名 + */ + private String serverName; + /** * 实际服务开始时间 */ diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcSocietyOrgService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcSocietyOrgService.java index 0147c948f1..747ff6f14b 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcSocietyOrgService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcSocietyOrgService.java @@ -18,6 +18,7 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.dto.IcSocietyOrgDTO; import com.epmet.dto.form.AddSocietyOrgFormDTO; import com.epmet.dto.form.EditSocietyOrgFormDTO; import com.epmet.dto.form.GetListSocietyOrgFormDTO; @@ -76,4 +77,6 @@ public interface IcSocietyOrgService extends BaseService { List importExcel(String customerId, List list, String staffId, List numList) throws ParseException; List queryListById(List socialOrgIds); + + IcSocietyOrgDTO get(String id); } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcSocietyOrgServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcSocietyOrgServiceImpl.java index 8c4768b2bc..5d2a554c60 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcSocietyOrgServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcSocietyOrgServiceImpl.java @@ -278,4 +278,10 @@ public class IcSocietyOrgServiceImpl extends BaseServiceImpl> userInfoRes = epmetUserOpenFeignClient.queryUserBaseInfo(Arrays.asList(serverId)); + if (!userInfoRes.success() || CollectionUtils.isEmpty(userInfoRes.getData())) { + throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "查询志愿者信息异常","志愿者信息查询异常"); + } + serviceName=userInfoRes.getData().get(NumConstant.ZERO).getRealName(); + break; + default: + log.warn("serviceType 错误"); + break; + } + return serviceName; + } + /** * 完成并评价 * @@ -1031,6 +1070,10 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl getIcNeighbordhoodById(@PathVariable("id") String id); + + + /** + * 运营端-客户管理,修改客户信息,调用gov-org服务,修改组织区划开关,修改根组织areaCode入参。 + * @param formDTO + * @return + */ + @PostMapping("/gov/org/customeragency/configcustomerareacode") + Result configCustomerAreaCode(@RequestBody CustomerAreaCodeFormDTO formDTO); } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java index 52e0a615ee..c3ddd39202 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java @@ -358,4 +358,15 @@ public class GovOrgOpenFeignClientFallback implements GovOrgOpenFeignClient { public Result getIcNeighbordhoodById(String id) { return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getIcNeighbordhoodById", id); } + + /** + * 运营端-客户管理,修改客户信息,调用gov-org服务,修改组织区划开关,修改根组织areaCode入参。 + * + * @param areaCodeFormDTO + * @return + */ + @Override + public Result configCustomerAreaCode(CustomerAreaCodeFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "configCustomerAreaCode", formDTO); + } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java index 434a305c90..d826060c2d 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java @@ -28,6 +28,7 @@ import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.constant.CustomerAgencyConstant; import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.*; @@ -380,4 +381,18 @@ public class CustomerAgencyController { return new Result().ok(customerAgencyService.orgMobile(formDTO.getGridId())); } + /** + * 运营端-客户管理,修改客户信息,调用gov-org服务,修改组织区划开关,修改根组织areaCode入参。 + * @param formDTO + * @return + */ + @PostMapping("configcustomerareacode") + Result configCustomerAreaCode(@RequestBody CustomerAreaCodeFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, CustomerAreaCodeFormDTO.AddUserInternalGroup.class, CustomerAreaCodeFormDTO.ShowGroup.class); + if (CustomerAgencyConstant.AREA_CODE_SWITCH_OPEN.equals(formDTO.getAreaCodeSwitch())) { + ValidatorUtils.validateEntity(formDTO, CustomerAreaCodeFormDTO.OpenAreaCodeSwitchGroup.class); + } + customerAgencyService.configCustomerAreaCode(formDTO); + return new Result(); + } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java index 5604b2d06f..3e7406594e 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java @@ -269,4 +269,11 @@ public interface CustomerAgencyService extends BaseService * @author sun **/ OrgMobileResultDTO orgMobile(String gridId); + + /** + * 运营端-客户管理,修改客户信息,调用gov-org服务,修改组织区划开关,修改根组织areaCode入参。 + * @param formDTO + * @return + */ + void configCustomerAreaCode(CustomerAreaCodeFormDTO formDTO); } 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 ac4e5a87ae..535d411b79 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 @@ -498,7 +498,11 @@ public class AgencyServiceImpl implements AgencyService { @Override public CustomerAgencyDTO getCustomerRootAgency(String customerId) { - return customerAgencyDao.getCustomerRootAgency(customerId); + CustomerAgencyDTO root=customerAgencyDao.getCustomerRootAgency(customerId); + if (null != root) { + root.setAreaCodeSwitch(customerOrgParameterService.getAreaCodeSwitch(customerId)); + } + return root; } @Override diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java index b9d49f7235..0cb99364a8 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java @@ -18,11 +18,14 @@ package com.epmet.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.redis.RedisKeys; @@ -36,13 +39,17 @@ import com.epmet.dto.*; import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.entity.CustomerAgencyEntity; +import com.epmet.entity.CustomerDepartmentEntity; import com.epmet.entity.CustomerGridEntity; +import com.epmet.entity.CustomerOrgParameterEntity; +import com.epmet.feign.EpmetCommonServiceOpenFeignClient; import com.epmet.feign.EpmetUserFeignClient; import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.OperCrmFeignClient; import com.epmet.redis.CustomerAgencyRedis; import com.epmet.service.CustomerAgencyService; import com.epmet.util.ModuleConstant; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; @@ -62,6 +69,7 @@ import java.util.stream.Collectors; * @author generator generator@elink-cn.com * @since v1.0.0 2020-04-20 */ +@Slf4j @Service public class CustomerAgencyServiceImpl extends BaseServiceImpl implements CustomerAgencyService { @@ -86,6 +94,11 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl page(Map params) { @@ -1220,4 +1233,140 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl updateAgencyWrapper = new LambdaUpdateWrapper<>(); + updateAgencyWrapper.eq(CustomerAgencyEntity::getPid,root.getId()) + .set(CustomerAgencyEntity::getParentAreaCode,newAreaCode) + .set(CustomerAgencyEntity::getAreaCode, StrConstant.EPMETY_STR) + .set(CustomerAgencyEntity::getUpdatedBy,formDTO.getUserId()) + .set(CustomerAgencyEntity::getUpdatedTime,new Date()); + Integer rows = baseDao.update(null, updateAgencyWrapper); + log.info(String.format("更新了%s个下级组织的parent_area_code",rows)); + + // 3、直属网格 + LambdaUpdateWrapper updateGridWrapper = new LambdaUpdateWrapper<>(); + updateGridWrapper.eq(CustomerGridEntity::getPid,root.getId()) + .set(CustomerGridEntity::getAreaCode, newAreaCode) + .set(CustomerGridEntity::getUpdatedBy,formDTO.getUserId()) + .set(CustomerGridEntity::getUpdatedTime,new Date()); + int subGridRows=customerGridDao.update(null,updateGridWrapper); + log.info(String.format("更新了%s个直属网格的area_code",subGridRows)); + + // 4、直属部门 + LambdaUpdateWrapper updateDeptWrapper = new LambdaUpdateWrapper<>(); + updateDeptWrapper.eq(CustomerDepartmentEntity::getAgencyId,root.getId()) + .set(CustomerDepartmentEntity::getAreaCode, newAreaCode) + .set(CustomerDepartmentEntity::getUpdatedBy,formDTO.getUserId()) + .set(CustomerDepartmentEntity::getUpdatedTime,new Date()); + int gridRows=customerDepartmentDao.update(null,updateDeptWrapper); + log.info(String.format("更新了%s个直属部门的area_code",gridRows)); + + //5、非直属下级组织,统一置为空 + LambdaUpdateWrapper agencyWrapper = new LambdaUpdateWrapper<>(); + agencyWrapper.ne(CustomerAgencyEntity::getPid,root.getId()) + .like(CustomerAgencyEntity::getPids,root.getId()) + .set(CustomerAgencyEntity::getParentAreaCode,StrConstant.EPMETY_STR) + .set(CustomerAgencyEntity::getAreaCode, StrConstant.EPMETY_STR) + .set(CustomerAgencyEntity::getUpdatedBy,formDTO.getUserId()) + .set(CustomerAgencyEntity::getUpdatedTime,new Date()); + baseDao.update(null, agencyWrapper); + + //6、非直属网格 + LambdaUpdateWrapper gridWrapper = new LambdaUpdateWrapper<>(); + gridWrapper.ne(CustomerGridEntity::getPid,root.getId()) + .like(CustomerGridEntity::getPids,root.getId()) + .set(CustomerGridEntity::getAreaCode, StrConstant.EPMETY_STR) + .set(CustomerGridEntity::getUpdatedBy,formDTO.getUserId()) + .set(CustomerGridEntity::getUpdatedTime,new Date()); + customerGridDao.update(null,gridWrapper); + + //7、非直属部门的 + LambdaUpdateWrapper deptWrapper = new LambdaUpdateWrapper<>(); + deptWrapper.ne(CustomerDepartmentEntity::getAgencyId,root.getId()) + .like(CustomerDepartmentEntity::getAreaCode,originalAreaCode) + .set(CustomerDepartmentEntity::getAreaCode, StrConstant.EPMETY_STR) + .set(CustomerDepartmentEntity::getUpdatedBy,formDTO.getUserId()) + .set(CustomerDepartmentEntity::getUpdatedTime,new Date()); + customerDepartmentDao.update(null,deptWrapper); + + } + + } + } + + /** + * + * @param agencyId + * @param agencyName + * @param level 社区级:community,乡(镇、街道)级:street,区县级: district,市级: city省级:province + * @param areaCode + * @param parentArenCode + * @return 返回组织区划编码 + */ + + private String getAgencyNewAreaCode(String agencyId, String agencyName, String level,String areaCode, String parentArenCode) { + String newAreaCode=""; + if (!"other".equals(areaCode)) { + //校验除了当前组织外,areaCode是否被使用过 + List agencyIds = baseDao.selectAgencyIdsByAreaCode(areaCode, agencyId); + if (CollectionUtils.isNotEmpty(agencyIds)) { + //已经被占用,提示 + throw new RenException(EpmetErrorCode.AREA_CODE_ALREADY_EXISTS.getCode(), EpmetErrorCode.AREA_CODE_ALREADY_EXISTS.getMsg()); + } + newAreaCode=areaCode; + } else { + //如果选择的是other,需要自定义一个编码 + AddAreaCodeFormDTO addAreaCodeFormDTO = new AddAreaCodeFormDTO(); + addAreaCodeFormDTO.setCurrentAreaLevel(level); + addAreaCodeFormDTO.setParentAreaCode(parentArenCode); + addAreaCodeFormDTO.setName(agencyName); + Result addAreaCodeResult = epmetCommonServiceOpenFeignClient.addAreaCode(addAreaCodeFormDTO); + if (!addAreaCodeResult.success() || StringUtils.isBlank(addAreaCodeResult.getData())) { + if (addAreaCodeResult.getCode() > 8000) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "自定义area_code异常" + addAreaCodeResult.getInternalMsg(), addAreaCodeResult.getMsg()); + } else { + throw new RenException("自定义area_code异常" + addAreaCodeResult.getInternalMsg()); + } + } + newAreaCode=addAreaCodeResult.getData(); + } + return newAreaCode; + } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/logback-spring.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/logback-spring.xml index 24d44d88f9..c768b78ed0 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/logback-spring.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/logback-spring.xml @@ -139,7 +139,7 @@ - + diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/UpdateCustomerFormDTO.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/UpdateCustomerFormDTO.java index 6186d67bfb..b2f2cb20c8 100644 --- a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/UpdateCustomerFormDTO.java +++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/UpdateCustomerFormDTO.java @@ -1,8 +1,11 @@ package com.epmet.dto.form; +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; import lombok.Data; import lombok.NoArgsConstructor; +import org.hibernate.validator.constraints.Length; +import javax.validation.constraints.NotBlank; import java.io.Serializable; /** @@ -15,17 +18,26 @@ import java.io.Serializable; public class UpdateCustomerFormDTO implements Serializable { private static final long serialVersionUID = 1296290251616658023L; + + public interface ShowGroup extends CustomerClientShowGroup {} + public interface AddUserInternalGroup { + } + public interface OpenAreaCodeSwitchGroup extends CustomerClientShowGroup {} /** * 客户ID */ + @NotBlank(message = "customerId不能为空",groups = AddUserInternalGroup.class) private String customerId; /** * 客户名 */ + @NotBlank(message = "客户名称不能为空",groups = ShowGroup.class) + @Length(max = 20, message = "客户名称最多输入20个字", groups = ShowGroup.class) private String customerName; /** * logo */ + @NotBlank(message = "logo不能为空",groups = ShowGroup.class) private String logo; // /** // * 根管理员姓名 @@ -35,4 +47,23 @@ public class UpdateCustomerFormDTO implements Serializable { // * 根管理员电话 // */ // private String rootManagePhone; + + //修改客户信息,可设置组织区划开关,修改根组织组织区划,故新增以下参数 + @NotBlank(message = "tokenDto获取userId不能为空",groups = AddUserInternalGroup.class) + private String userId; + + @NotBlank(message = "根组织不能为空",groups = AddUserInternalGroup.class) + private String rootAgencyId; + + /** + * open:当前客户新增组织需要选择areaCode;closed: 无需选择区域编码 + */ + @NotBlank(message = "组织区划开关不能为空,开启:open;关闭:closed",groups = ShowGroup.class) + private String areaCodeSwitch; + + @NotBlank(message = "rootAgencyAreaCode不能为空",groups = OpenAreaCodeSwitchGroup.class) + private String rootAgencyAreaCode; + + @NotBlank(message = "rootAgencyParentCode不能为空",groups = OpenAreaCodeSwitchGroup.class) + private String rootAgencyParentCode; } diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/CustomerListResultDTO.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/CustomerListResultDTO.java index e55e97197a..486648ce32 100644 --- a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/CustomerListResultDTO.java +++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/CustomerListResultDTO.java @@ -63,4 +63,17 @@ public class CustomerListResultDTO implements Serializable { * 区县 */ private String county; + + /** + * 需求:修改客户信息时,可以社区组织区划开关,可修改根组织的areaCode + * 故新增以下参数 + */ + private String rootAgencyId; + private String rootAgencyAreaCode; + private String rootAgencyParentCode; + private String rootAgencyLevel; + /** + * open:当前客户新增组织需要选择areaCode;closed: 无需选择区域编码 + */ + private String areaCodeSwitch; } diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java index ab4987388f..907ffbc967 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java @@ -314,7 +314,14 @@ public class CustomerController { * @return com.epmet.commons.tools.utils.Result */ @PostMapping("updatecustomer") - public Result updateCustomer(@RequestBody UpdateCustomerFormDTO formDTO) { + public Result updateCustomer(@LoginUser TokenDto tokenDto,@RequestBody UpdateCustomerFormDTO formDTO) { + formDTO.setUserId(tokenDto.getUserId()); + //确定好需求,再放开 + /*ValidatorUtils.validateEntity(formDTO,UpdateCustomerFormDTO.ShowGroup.class,UpdateCustomerFormDTO.AddUserInternalGroup.class); + //如果开启了组织区划开关,根组织的组织区划变态男 + if("open".equals(formDTO.getAreaCodeSwitch())){ + ValidatorUtils.validateEntity(formDTO,UpdateCustomerFormDTO.OpenAreaCodeSwitchGroup.class); + }*/ customerService.updateCustomer(formDTO); return new Result(); } diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java index b35a29c1d5..ddd811450f 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java @@ -1,10 +1,6 @@ package com.epmet.feign; -import com.epmet.commons.tools.annotation.LoginUser; -import com.epmet.commons.tools.annotation.RequirePermission; import com.epmet.commons.tools.constant.ServiceConstant; -import com.epmet.commons.tools.enums.RequirePermissionEnum; -import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.form.AddAgencyFormDTO; @@ -12,7 +8,6 @@ import com.epmet.dto.form.AddRootAgencyFormDTO; import com.epmet.dto.form.StaffSubmitFromDTO; import com.epmet.dto.result.AddAgencyResultDTO; import com.epmet.feign.fallback.GovOrgFeignClientFallBack; -import oracle.jdbc.proxy.annotation.Post; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java index 39fb19c3d8..856a72c96d 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java @@ -19,6 +19,7 @@ package com.epmet.service.impl; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; @@ -26,16 +27,13 @@ import com.epmet.commons.rocketmq.messages.InitCustomerMQMsg; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.HttpClientManager; import com.epmet.commons.tools.utils.Result; -import com.epmet.constant.ModuleConstant; -import com.epmet.constant.RoleKeyConstants; -import com.epmet.constant.ThirdConstant; -import com.epmet.constant.SystemMessageType; -import com.epmet.constant.UserWorkType; +import com.epmet.constant.*; import com.epmet.dao.CustomerDao; import com.epmet.dto.*; import com.epmet.dto.form.*; @@ -84,8 +82,6 @@ public class CustomerServiceImpl extends BaseServiceImpl queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(CustomerEntity::getCustomerName, formDTO.getCustomerName()); + queryWrapper.ne(CustomerEntity::getId, formDTO.getCustomerId()); + Integer roleOperationCount = baseDao.selectCount(queryWrapper); + if (null != roleOperationCount && roleOperationCount > NumConstant.ZERO) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "客户名称已存在:" + formDTO.getCustomerName(), "客户名称已存在"); + } + + //2、设置组织区划开关、根组织的组织区划 调用gov-org服务 + //确定好需求再放开 + /*CustomerAreaCodeFormDTO areaCodeFormDTO = ConvertUtils.sourceToTarget(formDTO, CustomerAreaCodeFormDTO.class); + Result govOrgresult = govOrgOpenFeignClient.configCustomerAreaCode(areaCodeFormDTO); + if (!govOrgresult.success()) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "gov-org服务异常:" + govOrgresult.getInternalMsg(), "设置组织区划接口返回异常:" + govOrgresult.getMsg()); + }*/ + + //3、修改客户名称 CustomerEntity entity = new CustomerEntity(); entity.setId(formDTO.getCustomerId()); - if (StringUtils.isNotBlank(formDTO.getCustomerName())){ + if (StringUtils.isNotBlank(formDTO.getCustomerName())) { entity.setCustomerName(formDTO.getCustomerName()); } - if (StringUtils.isNotBlank(formDTO.getLogo())){ + if (StringUtils.isNotBlank(formDTO.getLogo())) { entity.setLogo(formDTO.getLogo()); } entity.setLogo(formDTO.getLogo());