Browse Source

Merge remote-tracking branch 'origin/dev_ic_mp' into dev

dev
yinzuomei 4 years ago
parent
commit
41b5936dfe
  1. 1
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java
  2. 5
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcUserDemandServiceDTO.java
  3. 5
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcUserDemandServiceEntity.java
  4. 3
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcSocietyOrgService.java
  5. 6
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcSocietyOrgServiceImpl.java
  6. 53
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java
  7. 1
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/V0.0.7__service_name.sql
  8. 7
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerAgencyDTO.java
  9. 47
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CustomerAreaCodeFormDTO.java
  10. 9
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java
  11. 11
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java
  12. 15
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java
  13. 7
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java
  14. 6
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
  15. 149
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java
  16. 2
      epmet-module/gov-org/gov-org-server/src/main/resources/logback-spring.xml
  17. 31
      epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/UpdateCustomerFormDTO.java
  18. 13
      epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/CustomerListResultDTO.java
  19. 9
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java
  20. 5
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java
  21. 34
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java

1
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.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import sun.jvm.hotspot.memory.ContiguousSpace;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;

5
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 serverId;
/**
* 服务方姓名
*/
private String serverName;
/** /**
* 实际服务开始时间 * 实际服务开始时间
*/ */

5
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 serverId;
/**
* 服务方姓名
*/
private String serverName;
/** /**
* 实际服务开始时间 * 实际服务开始时间
*/ */

3
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcSocietyOrgService.java

@ -18,6 +18,7 @@
package com.epmet.service; package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.dto.IcSocietyOrgDTO;
import com.epmet.dto.form.AddSocietyOrgFormDTO; import com.epmet.dto.form.AddSocietyOrgFormDTO;
import com.epmet.dto.form.EditSocietyOrgFormDTO; import com.epmet.dto.form.EditSocietyOrgFormDTO;
import com.epmet.dto.form.GetListSocietyOrgFormDTO; import com.epmet.dto.form.GetListSocietyOrgFormDTO;
@ -76,4 +77,6 @@ public interface IcSocietyOrgService extends BaseService<IcSocietyOrgEntity> {
List<Integer> importExcel(String customerId, List<IcSocietyOrgExcel> list, String staffId, List<Integer> numList) throws ParseException; List<Integer> importExcel(String customerId, List<IcSocietyOrgExcel> list, String staffId, List<Integer> numList) throws ParseException;
List<IcSocietyOrgEntity> queryListById(List<String> socialOrgIds); List<IcSocietyOrgEntity> queryListById(List<String> socialOrgIds);
IcSocietyOrgDTO get(String id);
} }

6
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<IcSocietyOrgDao, Ic
return Collections.EMPTY_LIST; return Collections.EMPTY_LIST;
} }
@Override
public IcSocietyOrgDTO get(String id) {
IcSocietyOrgEntity entity=baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity,IcSocietyOrgDTO.class);
}
} }

53
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java

@ -106,10 +106,6 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
private String scanApiUrl; private String scanApiUrl;
@Value("${openapi.scan.method.textSyncScan}") @Value("${openapi.scan.method.textSyncScan}")
private String textSyncScanMethod; private String textSyncScanMethod;
@Autowired
private IcUserDemandSatisfactionService icUserDemandSatisfactionService;
@Autowired
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient;
@Override @Override
@ -389,6 +385,13 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
operateLogDao.insert(logEntity); operateLogDao.insert(logEntity);
//3、插入或更新服务记录 //3、插入或更新服务记录
IcUserDemandServiceEntity serviceEntity=ConvertUtils.sourceToTarget(formDTO,IcUserDemandServiceEntity.class); IcUserDemandServiceEntity serviceEntity=ConvertUtils.sourceToTarget(formDTO,IcUserDemandServiceEntity.class);
//4、设置服务方名称
String serviceName = queryServiceName(serviceEntity.getServerId(), serviceEntity.getServiceType());
if (StringUtils.isBlank(serviceName)) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "服务方名称获取异常", "服务方名称异常");
}
serviceEntity.setServerName(serviceName);
IcUserDemandServiceEntity origin=demandServiceDao.selectByRecId(formDTO.getDemandRecId()); IcUserDemandServiceEntity origin=demandServiceDao.selectByRecId(formDTO.getDemandRecId());
if (null == origin) { if (null == origin) {
demandServiceDao.insert(serviceEntity); demandServiceDao.insert(serviceEntity);
@ -401,6 +404,42 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
sendDemandUserHaveOrgService(entity,formDTO.getServerId(),formDTO.getServiceType()); sendDemandUserHaveOrgService(entity,formDTO.getServerId(),formDTO.getServiceType());
} }
/**
* 获取服务方姓名
* @param serverId
* @param serviceType
* @return
*/
private String queryServiceName(String serverId, String serviceType) {
String serviceName="";
switch (serviceType)
{
case UserDemandConstant.PARTY_UNIT:
IcPartyUnitDTO partyUnitDTO=partyUnitService.get(serverId);
serviceName=null != partyUnitDTO ? partyUnitDTO.getUnitName() : StrConstant.EPMETY_STR;
break;
case UserDemandConstant.SOCIAL_ORG:
IcSocietyOrgDTO societyOrgDTO=societyOrgService.get(serverId);
serviceName=null != societyOrgDTO ? societyOrgDTO.getSocietyName() : StrConstant.EPMETY_STR;
break;
case UserDemandConstant.COMMUNITY_ORG:
IcCommunitySelfOrganizationDTO dto=communitySelfOrganizationService.get(serverId);
serviceName=null != dto ? dto.getOrganizationName() : StrConstant.EPMETY_STR;
break;
case UserDemandConstant.VOLUNTEER:
Result<List<UserBaseInfoResultDTO>> 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<IcUserDemandRecD
operateLogDao.insert(logEntity); operateLogDao.insert(logEntity);
//3、插入或更新服务记录 //3、插入或更新服务记录
IcUserDemandServiceEntity origin=demandServiceDao.selectByRecId(formDTO.getDemandRecId()); IcUserDemandServiceEntity origin=demandServiceDao.selectByRecId(formDTO.getDemandRecId());
String serviceName=queryServiceName(formDTO.getUserId(),UserDemandConstant.VOLUNTEER);
if (StringUtils.isBlank(serviceName)) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "服务方名称获取异常", "服务方名称异常");
}
String serviceId=""; String serviceId="";
if (null == origin) { if (null == origin) {
IcUserDemandServiceEntity serviceEntity=new IcUserDemandServiceEntity(); IcUserDemandServiceEntity serviceEntity=new IcUserDemandServiceEntity();
@ -1038,12 +1081,14 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
serviceEntity.setDemandRecId(entity.getId()); serviceEntity.setDemandRecId(entity.getId());
serviceEntity.setServiceType(UserDemandConstant.VOLUNTEER); serviceEntity.setServiceType(UserDemandConstant.VOLUNTEER);
serviceEntity.setServerId(formDTO.getUserId()); serviceEntity.setServerId(formDTO.getUserId());
serviceEntity.setServerName(serviceName);
demandServiceDao.insert(serviceEntity); demandServiceDao.insert(serviceEntity);
serviceId=serviceEntity.getId(); serviceId=serviceEntity.getId();
}else{ }else{
origin.setServiceType(UserDemandConstant.VOLUNTEER); origin.setServiceType(UserDemandConstant.VOLUNTEER);
origin.setServerId(formDTO.getUserId()); origin.setServerId(formDTO.getUserId());
origin.setUpdatedBy(formDTO.getUserId()); origin.setUpdatedBy(formDTO.getUserId());
origin.setServerName(serviceName);
demandServiceDao.updateById(origin); demandServiceDao.updateById(origin);
serviceId=origin.getId(); serviceId=origin.getId();
} }

1
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/V0.0.7__service_name.sql

@ -0,0 +1 @@
alter table ic_user_demand_service add COLUMN SERVER_NAME varchar(64) comment '服务方名称' after SERVER_ID;

7
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerAgencyDTO.java

@ -172,4 +172,11 @@ public class CustomerAgencyDTO implements Serializable {
* 联系电话 * 联系电话
*/ */
private String mobile; private String mobile;
//内部接口使用
/**
* open:当前客户新增组织需要选择areaCodeclosed: 无需选择区域编码
*/
private String areaCodeSwitch;
} }

47
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CustomerAreaCodeFormDTO.java

@ -0,0 +1,47 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 运营端-客户管理修改客户信息调用gov-org服务修改组织区划开关修改根组织areaCode入参
*/
@Data
public class CustomerAreaCodeFormDTO implements Serializable {
public interface ShowGroup extends CustomerClientShowGroup {}
public interface AddUserInternalGroup {
}
public interface OpenAreaCodeSwitchGroup extends CustomerClientShowGroup {}
/**
* 客户ID
*/
@NotBlank(message = "customerId不能为空",groups = AddUserInternalGroup.class)
private String customerId;
/**
* open:当前客户新增组织需要选择areaCodeclosed: 无需选择区域编码
*/
@NotBlank(message = "组织区划开关不能为空,开启:open;关闭:closed",groups = ShowGroup.class)
private String areaCodeSwitch;
@NotBlank(message = "根组织不能为空",groups = AddUserInternalGroup.class)
private String rootAgencyId;
@NotBlank(message = "rootAgencyAreaCode不能为空",groups = OpenAreaCodeSwitchGroup.class)
private String rootAgencyAreaCode;
@NotBlank(message = "rootAgencyParentCode不能为空",groups = OpenAreaCodeSwitchGroup.class)
private String rootAgencyParentCode;
/**
* token获取userId
*/
@NotBlank(message = "当前操作用户id不能为空",groups = AddUserInternalGroup.class)
private String userId;
}

9
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java

@ -567,4 +567,13 @@ public interface GovOrgOpenFeignClient {
*/ */
@GetMapping("/gov/org/icneighborhood/{id}") @GetMapping("/gov/org/icneighborhood/{id}")
Result<IcNeighborHoodDTO> getIcNeighbordhoodById(@PathVariable("id") String id); Result<IcNeighborHoodDTO> getIcNeighbordhoodById(@PathVariable("id") String id);
/**
* 运营端-客户管理修改客户信息调用gov-org服务修改组织区划开关修改根组织areaCode入参
* @param formDTO
* @return
*/
@PostMapping("/gov/org/customeragency/configcustomerareacode")
Result configCustomerAreaCode(@RequestBody CustomerAreaCodeFormDTO formDTO);
} }

11
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<IcNeighborHoodDTO> getIcNeighbordhoodById(String id) { public Result<IcNeighborHoodDTO> getIcNeighbordhoodById(String id) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getIcNeighbordhoodById", 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);
}
} }

15
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.AddGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.constant.CustomerAgencyConstant;
import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.form.*; import com.epmet.dto.form.*;
import com.epmet.dto.result.*; import com.epmet.dto.result.*;
@ -380,4 +381,18 @@ public class CustomerAgencyController {
return new Result<OrgMobileResultDTO>().ok(customerAgencyService.orgMobile(formDTO.getGridId())); return new Result<OrgMobileResultDTO>().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();
}
} }

7
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java

@ -269,4 +269,11 @@ public interface CustomerAgencyService extends BaseService<CustomerAgencyEntity>
* @author sun * @author sun
**/ **/
OrgMobileResultDTO orgMobile(String gridId); OrgMobileResultDTO orgMobile(String gridId);
/**
* 运营端-客户管理修改客户信息调用gov-org服务修改组织区划开关修改根组织areaCode入参
* @param formDTO
* @return
*/
void configCustomerAreaCode(CustomerAreaCodeFormDTO formDTO);
} }

6
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 @Override
public CustomerAgencyDTO getCustomerRootAgency(String customerId) { 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 @Override

149
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; package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 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.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant; 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.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.RedisKeys; import com.epmet.commons.tools.redis.RedisKeys;
@ -36,13 +39,17 @@ import com.epmet.dto.*;
import com.epmet.dto.form.*; import com.epmet.dto.form.*;
import com.epmet.dto.result.*; import com.epmet.dto.result.*;
import com.epmet.entity.CustomerAgencyEntity; import com.epmet.entity.CustomerAgencyEntity;
import com.epmet.entity.CustomerDepartmentEntity;
import com.epmet.entity.CustomerGridEntity; import com.epmet.entity.CustomerGridEntity;
import com.epmet.entity.CustomerOrgParameterEntity;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import com.epmet.feign.EpmetUserFeignClient; import com.epmet.feign.EpmetUserFeignClient;
import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.OperCrmFeignClient; import com.epmet.feign.OperCrmFeignClient;
import com.epmet.redis.CustomerAgencyRedis; import com.epmet.redis.CustomerAgencyRedis;
import com.epmet.service.CustomerAgencyService; import com.epmet.service.CustomerAgencyService;
import com.epmet.util.ModuleConstant; import com.epmet.util.ModuleConstant;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -62,6 +69,7 @@ import java.util.stream.Collectors;
* @author generator generator@elink-cn.com * @author generator generator@elink-cn.com
* @since v1.0.0 2020-04-20 * @since v1.0.0 2020-04-20
*/ */
@Slf4j
@Service @Service
public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao, CustomerAgencyEntity> implements CustomerAgencyService { public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao, CustomerAgencyEntity> implements CustomerAgencyService {
@ -86,6 +94,11 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao
private EpmetUserOpenFeignClient epmetUserOpenFeignClient; private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Autowired @Autowired
private RedisUtils redisUtils; private RedisUtils redisUtils;
@Autowired
private CustomerOrgParameterDao customerOrgParameterDao;
@Autowired
private EpmetCommonServiceOpenFeignClient epmetCommonServiceOpenFeignClient;
@Override @Override
public PageData<CustomerAgencyDTO> page(Map<String, Object> params) { public PageData<CustomerAgencyDTO> page(Map<String, Object> params) {
@ -1220,4 +1233,140 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao
return baseDao.getAgencyMobile(gridId); return baseDao.getAgencyMobile(gridId);
} }
/**
* 运营端-客户管理修改客户信息调用gov-org服务修改组织区划开关修改根组织areaCode入参
*
* @param formDTO
* @return
*/
@Transactional(rollbackFor = Exception.class)
@Override
public void configCustomerAreaCode(CustomerAreaCodeFormDTO formDTO) {
//1、设置开关
CustomerOrgParameterEntity switchEntity = customerOrgParameterDao.selectByCustomerId(formDTO.getCustomerId(), CustomerAgencyConstant.AREA_CODE_SWITCH);
if (null != switchEntity) {
switchEntity.setParameterValue(formDTO.getAreaCodeSwitch());
customerOrgParameterDao.updateById(switchEntity);
} else {
CustomerOrgParameterEntity insert=new CustomerOrgParameterEntity();
insert.setCustomerId(formDTO.getCustomerId());
insert.setParameterKey(CustomerAgencyConstant.AREA_CODE_SWITCH);
insert.setParameterValue(formDTO.getAreaCodeSwitch());
insert.setParameterName("是否开启区域编码");
insert.setDescription("open:当前客户新增组织需要选择areaCode;closed: 无需选择区域编码");
customerOrgParameterDao.insert(insert);
}
if(CustomerAgencyConstant.AREA_CODE_SWITCH_OPEN.equals(formDTO.getAreaCodeSwitch())){
//开关开启,并且修改了组织区划才会调用
CustomerAgencyEntity root=baseDao.selectById(formDTO.getRootAgencyId());
String originalAreaCode=root.getAreaCode();
//areaCode做了修改
if(!formDTO.getRootAgencyAreaCode().equals(originalAreaCode)){
log.warn("组织区划开关打开, 并且当前传入的areaCode与之前的不一致,所以要进行update操作");
String newAreaCode=getAgencyNewAreaCode(root.getId(),root.getOrganizationName(),root.getLevel(),formDTO.getRootAgencyAreaCode(),formDTO.getRootAgencyParentCode());
//1、更新根组织的area_code、
root.setAreaCode(newAreaCode);
root.setParentAreaCode(formDTO.getRootAgencyParentCode());
baseDao.updateById(root);
//2、直属下级的parent_areaCode赋值、areaCode(置空)
LambdaUpdateWrapper<CustomerAgencyEntity> 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<CustomerGridEntity> 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<CustomerDepartmentEntity> 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<CustomerAgencyEntity> 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<CustomerGridEntity> 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<CustomerDepartmentEntity> 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<String> 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<String> 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;
}
} }

2
epmet-module/gov-org/gov-org-server/src/main/resources/logback-spring.xml

@ -139,7 +139,7 @@
</appender> </appender>
<!-- 开发、测试环境 --> <!-- 开发、测试环境 -->
<springProfile name="dev,test"> <springProfile name="dev,test,local">
<logger name="org.springframework.web" level="INFO"/> <logger name="org.springframework.web" level="INFO"/>
<logger name="org.springboot.sample" level="INFO"/> <logger name="org.springboot.sample" level="INFO"/>
<logger name="com.epmet.dao" level="INFO"/> <logger name="com.epmet.dao" level="INFO"/>

31
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; package com.epmet.dto.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import java.io.Serializable; import java.io.Serializable;
/** /**
@ -15,17 +18,26 @@ import java.io.Serializable;
public class UpdateCustomerFormDTO implements Serializable { public class UpdateCustomerFormDTO implements Serializable {
private static final long serialVersionUID = 1296290251616658023L; private static final long serialVersionUID = 1296290251616658023L;
public interface ShowGroup extends CustomerClientShowGroup {}
public interface AddUserInternalGroup {
}
public interface OpenAreaCodeSwitchGroup extends CustomerClientShowGroup {}
/** /**
* 客户ID * 客户ID
*/ */
@NotBlank(message = "customerId不能为空",groups = AddUserInternalGroup.class)
private String customerId; private String customerId;
/** /**
* 客户名 * 客户名
*/ */
@NotBlank(message = "客户名称不能为空",groups = ShowGroup.class)
@Length(max = 20, message = "客户名称最多输入20个字", groups = ShowGroup.class)
private String customerName; private String customerName;
/** /**
* logo * logo
*/ */
@NotBlank(message = "logo不能为空",groups = ShowGroup.class)
private String logo; private String logo;
// /** // /**
// * 根管理员姓名 // * 根管理员姓名
@ -35,4 +47,23 @@ public class UpdateCustomerFormDTO implements Serializable {
// * 根管理员电话 // * 根管理员电话
// */ // */
// private String rootManagePhone; // private String rootManagePhone;
//修改客户信息,可设置组织区划开关,修改根组织组织区划,故新增以下参数
@NotBlank(message = "tokenDto获取userId不能为空",groups = AddUserInternalGroup.class)
private String userId;
@NotBlank(message = "根组织不能为空",groups = AddUserInternalGroup.class)
private String rootAgencyId;
/**
* open:当前客户新增组织需要选择areaCodeclosed: 无需选择区域编码
*/
@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;
} }

13
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; private String county;
/**
* 需求修改客户信息时可以社区组织区划开关可修改根组织的areaCode
* 故新增以下参数
*/
private String rootAgencyId;
private String rootAgencyAreaCode;
private String rootAgencyParentCode;
private String rootAgencyLevel;
/**
* open:当前客户新增组织需要选择areaCodeclosed: 无需选择区域编码
*/
private String areaCodeSwitch;
} }

9
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 * @return com.epmet.commons.tools.utils.Result
*/ */
@PostMapping("updatecustomer") @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); customerService.updateCustomer(formDTO);
return new Result(); return new Result();
} }

5
epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java

@ -1,10 +1,6 @@
package com.epmet.feign; 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.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.commons.tools.utils.Result;
import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.form.AddAgencyFormDTO; 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.form.StaffSubmitFromDTO;
import com.epmet.dto.result.AddAgencyResultDTO; import com.epmet.dto.result.AddAgencyResultDTO;
import com.epmet.feign.fallback.GovOrgFeignClientFallBack; import com.epmet.feign.fallback.GovOrgFeignClientFallBack;
import oracle.jdbc.proxy.annotation.Post;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;

34
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.JSON;
import com.alibaba.fastjson.JSONObject; 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.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; 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.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode; 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.exception.RenException;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.HttpClientManager; import com.epmet.commons.tools.utils.HttpClientManager;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.ModuleConstant; import com.epmet.constant.*;
import com.epmet.constant.RoleKeyConstants;
import com.epmet.constant.ThirdConstant;
import com.epmet.constant.SystemMessageType;
import com.epmet.constant.UserWorkType;
import com.epmet.dao.CustomerDao; import com.epmet.dao.CustomerDao;
import com.epmet.dto.*; import com.epmet.dto.*;
import com.epmet.dto.form.*; import com.epmet.dto.form.*;
@ -84,8 +82,6 @@ public class CustomerServiceImpl extends BaseServiceImpl<CustomerDao, CustomerEn
@Autowired @Autowired
private CustomerDao customerDao; private CustomerDao customerDao;
@Autowired @Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Autowired
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient;
@Autowired @Autowired
private EpmetPointOpenFeignClient epmetPointOpenFeignClient; private EpmetPointOpenFeignClient epmetPointOpenFeignClient;
@ -661,6 +657,12 @@ public class CustomerServiceImpl extends BaseServiceImpl<CustomerDao, CustomerEn
// 管理员 // 管理员
if (agency != null) { if (agency != null) {
dto.setRootAgencyId(agency.getId());
dto.setRootAgencyAreaCode(agency.getAreaCode());
dto.setRootAgencyParentCode(agency.getParentAreaCode());
dto.setRootAgencyLevel(agency.getLevel());
dto.setAreaCodeSwitch(agency.getAreaCodeSwitch());
StaffRoleFormDTO staffsInRoleForm = new StaffRoleFormDTO(); StaffRoleFormDTO staffsInRoleForm = new StaffRoleFormDTO();
staffsInRoleForm.setOrgId(agency.getId()); staffsInRoleForm.setOrgId(agency.getId());
staffsInRoleForm.setRoleKey(RoleKeyConstants.ROLE_KEY_ROOT_MANAGER); staffsInRoleForm.setRoleKey(RoleKeyConstants.ROLE_KEY_ROOT_MANAGER);
@ -688,6 +690,24 @@ public class CustomerServiceImpl extends BaseServiceImpl<CustomerDao, CustomerEn
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void updateCustomer(UpdateCustomerFormDTO formDTO) { public void updateCustomer(UpdateCustomerFormDTO formDTO) {
//客户名称校验是否唯一
LambdaQueryWrapper<CustomerEntity> 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(); CustomerEntity entity = new CustomerEntity();
entity.setId(formDTO.getCustomerId()); entity.setId(formDTO.getCustomerId());
if (StringUtils.isNotBlank(formDTO.getCustomerName())) { if (StringUtils.isNotBlank(formDTO.getCustomerName())) {

Loading…
Cancel
Save