Browse Source

客户列表,修改

dev_shibei_match
zhaoqifeng 5 years ago
parent
commit
2d62693687
  1. 38
      epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/UpdateCustomerFormDTO.java
  2. 66
      epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/CustomerListResultDTO.java
  3. 31
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java
  4. 14
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerDao.java
  5. 23
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java
  6. 70
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java
  7. 17
      epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerDao.xml
  8. 31
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UpdateRootManageFormDTO.java
  9. 10
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java
  10. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java
  11. 13
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java
  12. 10
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java
  13. 9
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java
  14. 11
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java
  15. 14
      epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml

38
epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/UpdateCustomerFormDTO.java

@ -0,0 +1,38 @@
package com.epmet.dto.form;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/8/19 10:53
*/
@NoArgsConstructor
@Data
public class UpdateCustomerFormDTO implements Serializable {
private static final long serialVersionUID = 1296290251616658023L;
/**
* 客户ID
*/
private String customerId;
/**
* 客户名
*/
private String customerName;
/**
* logo
*/
private String logo;
/**
* 根管理员姓名
*/
private String rootManageName;
/**
* 根管理员电话
*/
private String rootManagePhone;
}

66
epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/CustomerListResultDTO.java

@ -0,0 +1,66 @@
package com.epmet.dto.result;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/8/19 9:53
*/
@NoArgsConstructor
@Data
public class CustomerListResultDTO implements Serializable {
private static final long serialVersionUID = -2167406082548134982L;
/**
* 客户id
*/
private String customerId;
/**
* 客户名称
*/
private String customerName;
/**
* 产品标题 显示在产品顶端的标题
*/
private String title;
/**
* 有效期
*/
private String validityTime;
/**
* 客户组织级别0.省级1市级2.区县级3.乡镇街道级 字典表keyorganizationlevel
*/
private String organizationLevels;
/**
* 客户logo
*/
private String logo;
/**
* 客户允许创建的网格数
*/
private Integer gridNumber;
/**
* 跟管理员姓名
*/
private String rootManageName;
/**
* 跟管理员电话
*/
private String rootManagePhone;
/**
* 省份
*/
private String province;
/**
* 城市
*/
private String city;
/**
* 区县
*/
private String county;
}

31
epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java

@ -31,10 +31,7 @@ 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.dto.CustomerDTO; import com.epmet.dto.CustomerDTO;
import com.epmet.dto.form.*; import com.epmet.dto.form.*;
import com.epmet.dto.result.CustomerDetailResultDTO; import com.epmet.dto.result.*;
import com.epmet.dto.result.CustomerInfoResultDTO;
import com.epmet.dto.result.GridCountResultDTO;
import com.epmet.dto.result.ValidCustomerResultDTO;
import com.epmet.excel.CustomerExcel; import com.epmet.excel.CustomerExcel;
import com.epmet.feign.GovOrgFeignClient; import com.epmet.feign.GovOrgFeignClient;
import com.epmet.service.CustomerService; import com.epmet.service.CustomerService;
@ -279,4 +276,30 @@ public class CustomerController {
ValidatorUtils.validateEntity(formDTO, CustomerIdFormDTO.Customer.class); ValidatorUtils.validateEntity(formDTO, CustomerIdFormDTO.Customer.class);
return new Result<CustomerInfoResultDTO>().ok(customerService.getCustomer(formDTO)); return new Result<CustomerInfoResultDTO>().ok(customerService.getCustomer(formDTO));
} }
/**
* 获取crm客户列表
* @author zhaoqifeng
* @date 2020/8/19 10:46
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.result.CustomerListResultDTO>>
*/
@PostMapping("customerlist")
public Result<List<CustomerListResultDTO>> customerList(@RequestBody PageQueryFormDTO formDTO) {
List<CustomerListResultDTO> result = customerService.customerList(formDTO);
return new Result<List<CustomerListResultDTO>>().ok(result);
}
/**
* 修改客户信息
* @author zhaoqifeng
* @date 2020/8/19 15:23
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
*/
@PostMapping("updatecustomer")
public Result updateCustomer(@RequestBody UpdateCustomerFormDTO formDTO) {
customerService.updateCustomer(formDTO);
return new Result();
}
} }

14
epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerDao.java

@ -19,10 +19,7 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.CustomerDTO; import com.epmet.dto.CustomerDTO;
import com.epmet.dto.result.CustomerInfoResultDTO; import com.epmet.dto.result.*;
import com.epmet.dto.result.CustomerResultDTO;
import com.epmet.dto.result.GridCountResultDTO;
import com.epmet.dto.result.ValidCustomerResultDTO;
import com.epmet.entity.CustomerEntity; import com.epmet.entity.CustomerEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -92,4 +89,13 @@ public interface CustomerDao extends BaseDao<CustomerEntity> {
*/ */
CustomerInfoResultDTO selectCustomerBasicInfo(@Param("customerId")String customerId); CustomerInfoResultDTO selectCustomerBasicInfo(@Param("customerId")String customerId);
/**
* 获取crm客户列表
* @author zhaoqifeng
* @date 2020/8/19 10:17
* @param customerName
* @return java.util.List<com.epmet.dto.result.CustomerListResultDTO>
*/
List<CustomerListResultDTO> selectAllCustomerList(@Param("customerName") String customerName);
} }

23
epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java

@ -22,10 +22,7 @@ import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerDTO; import com.epmet.dto.CustomerDTO;
import com.epmet.dto.form.*; import com.epmet.dto.form.*;
import com.epmet.dto.result.CustomerDetailResultDTO; import com.epmet.dto.result.*;
import com.epmet.dto.result.CustomerInfoResultDTO;
import com.epmet.dto.result.GridCountResultDTO;
import com.epmet.dto.result.ValidCustomerResultDTO;
import com.epmet.entity.CustomerEntity; import com.epmet.entity.CustomerEntity;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
@ -189,4 +186,22 @@ public interface CustomerService extends BaseService<CustomerEntity> {
* @date 2020/8/14 9:08 上午 * @date 2020/8/14 9:08 上午
*/ */
CustomerInfoResultDTO getCustomer( CustomerIdFormDTO formDTO); CustomerInfoResultDTO getCustomer( CustomerIdFormDTO formDTO);
/**
* 获取crm客户列表
* @author zhaoqifeng
* @date 2020/8/19 10:12
* @param formDTO
* @return com.epmet.dto.result.CustomerListResultDTO
*/
List<CustomerListResultDTO> customerList(PageQueryFormDTO formDTO);
/**
* 客户基本信息修改
* @author zhaoqifeng
* @date 2020/8/19 10:58
* @param formDTO
* @return void
*/
void updateCustomer(UpdateCustomerFormDTO formDTO);
} }

70
epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java

@ -38,10 +38,7 @@ 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.CustomerEntity; import com.epmet.entity.CustomerEntity;
import com.epmet.feign.EpmetUserFeignClient; import com.epmet.feign.*;
import com.epmet.feign.GovOrgFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.feign.OperCustomizeFeignClient;
import com.epmet.redis.CustomerRedis; import com.epmet.redis.CustomerRedis;
import com.epmet.service.CustomerService; import com.epmet.service.CustomerService;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
@ -79,6 +76,8 @@ public class CustomerServiceImpl extends BaseServiceImpl<CustomerDao, CustomerEn
private GovOrgOpenFeignClient govOrgOpenFeignClient; private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Autowired @Autowired
private CustomerDao customerDao; private CustomerDao customerDao;
@Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Override @Override
public PageData<CustomerDTO> page(Map<String, Object> params) { public PageData<CustomerDTO> page(Map<String, Object> params) {
@ -576,4 +575,67 @@ public class CustomerServiceImpl extends BaseServiceImpl<CustomerDao, CustomerEn
return customerInfoResultDTO; return customerInfoResultDTO;
} }
@Override
public List<CustomerListResultDTO> customerList(PageQueryFormDTO formDTO) {
PageInfo<CustomerListResultDTO> pageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize())
.doSelectPageInfo(() -> baseDao.selectAllCustomerList(formDTO.getCustomerName()));
List<CustomerListResultDTO> list = pageInfo.getList();
if(null != list) {
list.forEach(dto -> {
// 根级组织
Result<CustomerAgencyDTO> customerRootAgencyRst = govOrgFeignClient.getCustomerRootAgency(dto.getCustomerId());
if (!customerRootAgencyRst.success()) {
throw new RenException("查询客户详情:查询客户根级组织失败:".concat(customerRootAgencyRst.toString()));
}
CustomerAgencyDTO agency = customerRootAgencyRst.getData();
// 管理员
GovStaffRoleResultDTO manager = new GovStaffRoleResultDTO();
if (agency != null) {
StaffRoleFormDTO staffsInRoleForm = new StaffRoleFormDTO();
staffsInRoleForm.setOrgId(agency.getId());
staffsInRoleForm.setRoleKey(RoleKeyConstants.ROLE_KEY_ROOT_MANAGER);
Result<List<GovStaffRoleResultDTO>> managersResult = epmetUserFeignClient.getStaffsInRole(staffsInRoleForm);
if (!managersResult.success() || null == managersResult.getData() || managersResult.getData().size() == NumConstant.ZERO) {
throw new RenException("查询客户详情:查询客户管理员失败:".concat(managersResult.toString()));
}
manager = managersResult.getData().get(NumConstant.ZERO);
dto.setProvince(agency.getProvince());
dto.setCity(agency.getCity());
dto.setCounty(agency.getDistrict());
dto.setRootManageName(manager.getRealName());
dto.setRootManagePhone(manager.getMobile());
}
});
}
return list;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateCustomer(UpdateCustomerFormDTO formDTO) {
CustomerEntity entity = new CustomerEntity();
entity.setId(formDTO.getCustomerId());
entity.setCustomerName(formDTO.getCustomerName());
entity.setLogo(formDTO.getLogo());
baseDao.updateById(entity);
if (StringUtils.isNotBlank(formDTO.getRootManageName()) || StringUtils.isNotBlank(formDTO.getRootManagePhone())) {
// 根级组织
Result<CustomerAgencyDTO> customerRootAgencyRst = govOrgFeignClient.getCustomerRootAgency(formDTO.getCustomerId());
if (!customerRootAgencyRst.success() || null == customerRootAgencyRst.getData()) {
throw new RenException("客户基本信息修改:查询客户根级组织失败:".concat(customerRootAgencyRst.toString()));
}
CustomerAgencyDTO agency = customerRootAgencyRst.getData();
UpdateRootManageFormDTO updateRootManageFormDTO = new UpdateRootManageFormDTO();
updateRootManageFormDTO.setOrgId(agency.getId());
updateRootManageFormDTO.setRoleKey(RoleKeyConstants.ROLE_KEY_ROOT_MANAGER);
updateRootManageFormDTO.setRootManageName(formDTO.getRootManageName());
updateRootManageFormDTO.setRootManagePhone(formDTO.getRootManagePhone());
Result rootManageResult = epmetUserOpenFeignClient.updateRootManage(updateRootManageFormDTO);
if (!rootManageResult.success()) {
throw new RenException("客户基本信息修改:修改根管理员信息失败:".concat(rootManageResult.toString()));
}
}
}
} }

17
epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerDao.xml

@ -102,4 +102,21 @@
del_flag = 0 del_flag = 0
AND id = #{customerId} AND id = #{customerId}
</select> </select>
<select id="selectAllCustomerList" resultType="com.epmet.dto.result.CustomerListResultDTO">
SELECT
ID AS "customerId",
CUSTOMER_NAME,
TITLE,
VALIDITY_TIME,
ORGANIZATION_LEVELS,
LOGO,
GRID_NUMBER
FROM customer
WHERE
DEL_FLAG = '0'
<if test='customerName != "" and customerName != null'>
AND customer_name LIKE concat('%', trim(#{customerName}), '%')
</if>
</select>
</mapper> </mapper>

31
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UpdateRootManageFormDTO.java

@ -0,0 +1,31 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/8/19 14:20
*/
@Data
public class UpdateRootManageFormDTO implements Serializable {
private static final long serialVersionUID = 3954225931981940018L;
/**
* 根组织ID
*/
private String orgId;
/**
* 角色key
*/
private String roleKey;
/**
* 根管理员姓名
*/
private String rootManageName;
/**
* 根管理员电话
*/
private String rootManagePhone;
}

10
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java

@ -278,4 +278,14 @@ public interface EpmetUserOpenFeignClient {
**/ **/
@GetMapping("/epmet/staffagencyvisited/latestagency/{staffId}") @GetMapping("/epmet/staffagencyvisited/latestagency/{staffId}")
Result<String> latestAgency(@PathVariable("staffId") String staffId); Result<String> latestAgency(@PathVariable("staffId") String staffId);
/**
* 修改根管理员信息
* @author zhaoqifeng
* @date 2020/8/19 14:31
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
*/
@PostMapping("epmetuser/customerstaff/updaterootmanage")
Result updateRootManage(@RequestBody UpdateRootManageFormDTO formDTO);
} }

5
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java

@ -193,4 +193,9 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien
public Result<String> latestAgency(String staffId) { public Result<String> latestAgency(String staffId) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "latestAgency", staffId); return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "latestAgency", staffId);
} }
@Override
public Result updateRootManage(UpdateRootManageFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "updateRootManage", formDTO);
}
} }

13
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java

@ -346,4 +346,17 @@ public class CustomerStaffController {
ValidatorUtils.validateEntity(staffParam, CommonStaffIdFormDTO.StaffIdGroup.class); ValidatorUtils.validateEntity(staffParam, CommonStaffIdFormDTO.StaffIdGroup.class);
return new Result<ExtStaffInfoResultDTO>().ok(customerStaffService.extStaffInfo(staffParam)); return new Result<ExtStaffInfoResultDTO>().ok(customerStaffService.extStaffInfo(staffParam));
} }
/**
* 修改根管理员信息
* @author zhaoqifeng
* @date 2020/8/19 14:31
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
*/
@PostMapping("updaterootmanage")
public Result updateRootManage(@RequestBody UpdateRootManageFormDTO formDTO) {
customerStaffService.updateRootManage(formDTO);
return new Result();
}
} }

10
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java

@ -162,4 +162,14 @@ public interface CustomerStaffDao extends BaseDao<CustomerStaffEntity> {
* @date 2020.08.17 13:26 * @date 2020.08.17 13:26
**/ **/
ExtStaffInfoResultDTO selectStaffInfoExt(@Param("staffId") String staffId); ExtStaffInfoResultDTO selectStaffInfoExt(@Param("staffId") String staffId);
/**
* 获取根管理员信息
* @author zhaoqifeng
* @date 2020/8/19 14:14
* @param orgId
* @param roleKey
* @return com.epmet.dto.CustomerStaffDTO
*/
CustomerStaffDTO selectRootManage(@Param("orgId") String orgId, @Param("roleKey") String roleKey);
} }

9
epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java

@ -275,4 +275,13 @@ public interface CustomerStaffService extends BaseService<CustomerStaffEntity> {
* @date 2020.08.17 10:30 * @date 2020.08.17 10:30
**/ **/
ExtStaffInfoResultDTO extStaffInfo(CommonStaffIdFormDTO staffParam); ExtStaffInfoResultDTO extStaffInfo(CommonStaffIdFormDTO staffParam);
/**
* 修改根管理员信息
* @author zhaoqifeng
* @date 2020/8/19 14:11
* @param formDTO
* @return com.epmet.dto.CustomerStaffDTO
*/
void updateRootManage(UpdateRootManageFormDTO formDTO);
} }

11
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java

@ -599,4 +599,15 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao,
return null; return null;
} }
@Override
public void updateRootManage(UpdateRootManageFormDTO formDTO) {
CustomerStaffDTO dto = baseDao.selectRootManage(formDTO.getOrgId(), formDTO.getRoleKey());
if (null == dto) {
throw new RenException("查询客户管理员失败");
}
dto.setRealName(formDTO.getRootManageName());
dto.setMobile(formDTO.getRootManagePhone());
update(dto);
}
} }

14
epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml

@ -281,4 +281,18 @@
DEL_FLAG = '0' DEL_FLAG = '0'
AND USER_ID = #{staffId} AND USER_ID = #{staffId}
</select> </select>
<select id="selectRootManage" resultType="com.epmet.dto.CustomerStaffDTO">
SELECT s.ID
FROM
staff_role sr
INNER JOIN gov_staff_role r ON ( sr.ROLE_ID = r.ID )
INNER JOIN customer_staff s ON (sr.STAFF_ID = s.USER_ID)
WHERE
r.ROLE_KEY = #{roleKey}
AND sr.ORG_ID = #{orgId}
AND sr.DEL_FLAG = '0'
AND r.DEL_FLAG = '0'
AND S.DEL_FLAG = '0'
</select>
</mapper> </mapper>
Loading…
Cancel
Save