Commit ba20d12a authored by lanbaoming's avatar lanbaoming

2024-07-03-4提交

parent 1ca70cc0
...@@ -24,6 +24,15 @@ import java.util.List; ...@@ -24,6 +24,15 @@ import java.util.List;
@Mapper @Mapper
public interface CustomerMapper extends BaseMapperX<CustomerDO> { public interface CustomerMapper extends BaseMapperX<CustomerDO> {
//合并操作日志
void doMergeCustomerOperateLog(long customer_id1,long customer_id2);
//合并客户信用日志
void doMergeCustomerCreditLog(long customer_id1,long customer_id2);
//合并客户登记日志
void doMergeCustomerLevelLog(long customer_id1,long customer_id2);
IPage<CustomerDO> getPage(IPage<CustomerDO> page, IPage<CustomerDO> getPage(IPage<CustomerDO> page,
@Param(Constants.WRAPPER) Wrapper<CustomerDO> queryWrapper); @Param(Constants.WRAPPER) Wrapper<CustomerDO> queryWrapper);
......
...@@ -26,6 +26,13 @@ import java.util.List; ...@@ -26,6 +26,13 @@ import java.util.List;
*/ */
public interface CustomerService extends IService<CustomerDO> { public interface CustomerService extends IService<CustomerDO> {
//合并操作日志
void doMergeCustomerOperateLog(long customer_id1,long customer_id2);
//合并客户信用日志
void doMergeCustomerCreditLog(long customer_id1,long customer_id2);
void doMergeCustomerLevelLog(long customer_id1,long customer_id2);
/** /**
* 新建订单,收货人同步到后台,如果手机号不存在新增一个客户档案,进入待分配客户 * 新建订单,收货人同步到后台,如果手机号不存在新增一个客户档案,进入待分配客户
......
...@@ -174,6 +174,22 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, ...@@ -174,6 +174,22 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper,
public static final String logFormat = "[%d]联系人:%s 区号:%s 电话:%s 默认:(%s)"; public static final String logFormat = "[%d]联系人:%s 区号:%s 电话:%s 默认:(%s)";
//合并操作日志
public void doMergeCustomerOperateLog(long customer_id1, long customer_id2) {
customerMapper.doMergeCustomerOperateLog(customer_id1, customer_id2);
}
//合并客户信用日志
public void doMergeCustomerCreditLog(long customer_id1, long customer_id2) {
customerMapper.doMergeCustomerCreditLog(customer_id1, customer_id2);
}
//合并客户登记日志
public void doMergeCustomerLevelLog(long customer_id1, long customer_id2) {
customerMapper.doMergeCustomerLevelLog(customer_id1, customer_id2);
}
/* /*
发货人带来的收货人, 发货人带来的收货人,
...@@ -1148,8 +1164,8 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, ...@@ -1148,8 +1164,8 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper,
log.warn(I18nMessage.getLang().toString()); log.warn(I18nMessage.getLang().toString());
int start = (page.getPage() - 1) * page.getRows(); int start = (page.getPage() - 1) * page.getRows();
int size = page.getRows(); int size = page.getRows();
List<CustomerDO> list = customerMapper.getMyPage(start,size,pageReqVO); List<CustomerDO> list = customerMapper.getMyPage(start, size, pageReqVO);
long total = customerMapper.getMyPageCount(pageReqVO) ; long total = customerMapper.getMyPageCount(pageReqVO);
return new PageResult<>(list, total, return new PageResult<>(list, total,
mpPage.getSize(), page.getPage(), mpPage.getSize(), page.getPage(),
(total + mpPage.getSize() - 1) / mpPage.getSize()); (total + mpPage.getSize() - 1) / mpPage.getSize());
...@@ -1209,7 +1225,7 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, ...@@ -1209,7 +1225,7 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper,
} }
@Override @Override
public PageResult<CustomerDO> getDeptCustomerPageReq(CustomerPageReqDTO pageReqVO,PageVO page){ public PageResult<CustomerDO> getDeptCustomerPageReq(CustomerPageReqDTO pageReqVO, PageVO page) {
IPage<CustomerDO> mpPage = MyBatisUtils.buildPage(page); IPage<CustomerDO> mpPage = MyBatisUtils.buildPage(page);
log.warn(I18nMessage.getLang().toString()); log.warn(I18nMessage.getLang().toString());
...@@ -1220,25 +1236,25 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, ...@@ -1220,25 +1236,25 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper,
int start = (page.getPage() - 1) * page.getRows(); int start = (page.getPage() - 1) * page.getRows();
int size = page.getRows(); int size = page.getRows();
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
Long deptId =null; Long deptId = null;
if (null != loginUser && null != loginUser.getDeptId()) { if (null != loginUser && null != loginUser.getDeptId()) {
deptId = loginUser.getDeptId() ; deptId = loginUser.getDeptId();
} }
List<CustomerDO> list = List<CustomerDO> list =
customerMapper.getDeptCustomerPageReq(start,size,pageReqVO,deptId); customerMapper.getDeptCustomerPageReq(start, size, pageReqVO, deptId);
long total = customerMapper.getDeptCustomerPageReqCount(pageReqVO,deptId) ; long total = customerMapper.getDeptCustomerPageReqCount(pageReqVO, deptId);
return new PageResult<>(list, total, mpPage.getSize(), page.getPage(), (total + mpPage.getSize() - 1) / mpPage.getSize()); return new PageResult<>(list, total, mpPage.getSize(), page.getPage(), (total + mpPage.getSize() - 1) / mpPage.getSize());
} }
@Override @Override
public List<CustomerDO> getDeptCustomerExcelVoListReq(CustomerExportReqDTO exportReqVO) { public List<CustomerDO> getDeptCustomerExcelVoListReq(CustomerExportReqDTO exportReqVO) {
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
Long deptId =null; Long deptId = null;
if (null != loginUser && loginUser.getDeptId()>0) { if (null != loginUser && loginUser.getDeptId() > 0) {
deptId = loginUser.getDeptId() ; deptId = loginUser.getDeptId();
} }
return customerMapper.getDeptCustomerExcelVoListReq(exportReqVO,deptId) ; return customerMapper.getDeptCustomerExcelVoListReq(exportReqVO, deptId);
} }
@Override @Override
...@@ -1348,15 +1364,16 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, ...@@ -1348,15 +1364,16 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper,
/** /**
* 获得待分配客户列表 支持多个筛选 * 获得待分配客户列表 支持多个筛选
*
* @param pageReqVO * @param pageReqVO
* @param page * @param page
* @return * @return
*/ */
@Override @Override
public PageResult<CustomerDO> getWaitToAssignedCustomerPageReq(CustomerPageReqDTO pageReqVO,PageVO page) { public PageResult<CustomerDO> getWaitToAssignedCustomerPageReq(CustomerPageReqDTO pageReqVO, PageVO page) {
pageReqVO.setIsInOpenSea(false) ; pageReqVO.setIsInOpenSea(false);
pageReqVO.setIsCustomerServiceConfirmed(false) ; pageReqVO.setIsCustomerServiceConfirmed(false);
pageReqVO.setCustomerService(null) ; pageReqVO.setCustomerService(null);
IPage<CustomerDO> mpPage = MyBatisUtils.buildPage(page); IPage<CustomerDO> mpPage = MyBatisUtils.buildPage(page);
log.warn(I18nMessage.getLang().toString()); log.warn(I18nMessage.getLang().toString());
...@@ -1366,8 +1383,8 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, ...@@ -1366,8 +1383,8 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper,
int start = (page.getPage() - 1) * page.getRows(); int start = (page.getPage() - 1) * page.getRows();
int size = page.getRows(); int size = page.getRows();
List<CustomerDO> list = List<CustomerDO> list =
customerMapper.getWaitToAssignedCustomerPageReq(start,size,pageReqVO); customerMapper.getWaitToAssignedCustomerPageReq(start, size, pageReqVO);
long total = customerMapper.getWaitToAssignedCustomerPageReqCount(pageReqVO) ; long total = customerMapper.getWaitToAssignedCustomerPageReqCount(pageReqVO);
return new PageResult<>(list, total, mpPage.getSize(), page.getPage(), (total + mpPage.getSize() - 1) / mpPage.getSize()); return new PageResult<>(list, total, mpPage.getSize(), page.getPage(), (total + mpPage.getSize() - 1) / mpPage.getSize());
} }
...@@ -1420,8 +1437,9 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, ...@@ -1420,8 +1437,9 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper,
@Override @Override
public List<CustomerDO> getWaitToAssignedCustomerExcelVoListReq(CustomerExportReqDTO exportReqVO) { public List<CustomerDO> getWaitToAssignedCustomerExcelVoListReq(CustomerExportReqDTO exportReqVO) {
return customerMapper.getWaitToAssignedCustomerListReq(exportReqVO) ; return customerMapper.getWaitToAssignedCustomerListReq(exportReqVO);
} }
@Override @Override
public PageResult<CustomerDO> getWaitToConfirmCustomerPage(CustomerPageReqVO pageReqVO) { public PageResult<CustomerDO> getWaitToConfirmCustomerPage(CustomerPageReqVO pageReqVO) {
...@@ -1478,9 +1496,9 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, ...@@ -1478,9 +1496,9 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper,
} }
@Override @Override
public PageResult<CustomerDO> getWaitToConfirmCustomerPageReq(CustomerPageReqDTO pageReqVO, PageVO page){ public PageResult<CustomerDO> getWaitToConfirmCustomerPageReq(CustomerPageReqDTO pageReqVO, PageVO page) {
pageReqVO.setIsCustomerServiceConfirmed(false) ; pageReqVO.setIsCustomerServiceConfirmed(false);
pageReqVO.setIsInOpenSea(false) ; pageReqVO.setIsInOpenSea(false);
IPage<CustomerDO> mpPage = MyBatisUtils.buildPage(page); IPage<CustomerDO> mpPage = MyBatisUtils.buildPage(page);
log.warn(I18nMessage.getLang().toString()); log.warn(I18nMessage.getLang().toString());
...@@ -1490,8 +1508,8 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, ...@@ -1490,8 +1508,8 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper,
int start = (page.getPage() - 1) * page.getRows(); int start = (page.getPage() - 1) * page.getRows();
int size = page.getRows(); int size = page.getRows();
List<CustomerDO> list = List<CustomerDO> list =
customerMapper.getWaitToConfirmCustomerPageReq(start,size,pageReqVO); customerMapper.getWaitToConfirmCustomerPageReq(start, size, pageReqVO);
long total = customerMapper.getWaitToConfirmCustomerPageReqCount(pageReqVO) ; long total = customerMapper.getWaitToConfirmCustomerPageReqCount(pageReqVO);
return new PageResult<>(list, total, mpPage.getSize(), page.getPage(), (total + mpPage.getSize() - 1) / mpPage.getSize()); return new PageResult<>(list, total, mpPage.getSize(), page.getPage(), (total + mpPage.getSize() - 1) / mpPage.getSize());
} }
...@@ -1544,23 +1562,26 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, ...@@ -1544,23 +1562,26 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper,
return customerMapper.getCustomerExcelVoList(customerDOLambdaQueryWrapperX); return customerMapper.getCustomerExcelVoList(customerDOLambdaQueryWrapperX);
} }
/** /**
* 我的待接收客户列表, 用于 Excel 导出 ,支持多选 * 我的待接收客户列表, 用于 Excel 导出 ,支持多选
*
* @param reqVO * @param reqVO
* @return * @return
*/ */
@Override @Override
public List<CustomerDO> getWaitToConfirmCustomerExcelVoListReq(CustomerExportReqDTO reqVO){ public List<CustomerDO> getWaitToConfirmCustomerExcelVoListReq(CustomerExportReqDTO reqVO) {
reqVO.setIsCustomerServiceConfirmed(false) ; reqVO.setIsCustomerServiceConfirmed(false);
reqVO.setIsInOpenSea(false) ; reqVO.setIsInOpenSea(false);
List<Long> setCustomerService = new ArrayList<Long>(); List<Long> setCustomerService = new ArrayList<Long>();
if(getLoginUserId()!=null){ if (getLoginUserId() != null) {
setCustomerService.add(getLoginUserId()) ; setCustomerService.add(getLoginUserId());
reqVO.setCustomerService(setCustomerService) ; reqVO.setCustomerService(setCustomerService);
} }
return customerMapper.getWaitToConfirmCustomerExcelVoListReq(reqVO) ; return customerMapper.getWaitToConfirmCustomerExcelVoListReq(reqVO);
} }
@Override @Override
public PageResult<CustomerDO> getOpenSeaCustomerPage(CustomerPageReqVO reqVO) { public PageResult<CustomerDO> getOpenSeaCustomerPage(CustomerPageReqVO reqVO) {
...@@ -1614,7 +1635,7 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, ...@@ -1614,7 +1635,7 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper,
} }
@Override @Override
public PageResult<CustomerDO> getOpenSeaCustomerPageReq(CustomerPageReqDTO pageReqVO,PageVO page){ public PageResult<CustomerDO> getOpenSeaCustomerPageReq(CustomerPageReqDTO pageReqVO, PageVO page) {
pageReqVO.setIsInOpenSea(true); pageReqVO.setIsInOpenSea(true);
IPage<CustomerDO> mpPage = MyBatisUtils.buildPage(page); IPage<CustomerDO> mpPage = MyBatisUtils.buildPage(page);
...@@ -1626,8 +1647,8 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, ...@@ -1626,8 +1647,8 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper,
int start = (page.getPage() - 1) * page.getRows(); int start = (page.getPage() - 1) * page.getRows();
int size = page.getRows(); int size = page.getRows();
List<CustomerDO> list = List<CustomerDO> list =
customerMapper.getOpenSeaCustomerPageReq(start,size,pageReqVO); customerMapper.getOpenSeaCustomerPageReq(start, size, pageReqVO);
long total = customerMapper.getOpenSeaCustomerPageReqCount(pageReqVO) ; long total = customerMapper.getOpenSeaCustomerPageReqCount(pageReqVO);
return new PageResult<>(list, total, mpPage.getSize(), page.getPage(), (total + mpPage.getSize() - 1) / mpPage.getSize()); return new PageResult<>(list, total, mpPage.getSize(), page.getPage(), (total + mpPage.getSize() - 1) / mpPage.getSize());
} }
...@@ -1679,9 +1700,9 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, ...@@ -1679,9 +1700,9 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper,
} }
@Override @Override
public List<CustomerDO> getPublicCustomerExcelVoReqList(@Param("query") CustomerExportReqDTO reqVO){ public List<CustomerDO> getPublicCustomerExcelVoReqList(@Param("query") CustomerExportReqDTO reqVO) {
reqVO.setIsInOpenSea(true) ; reqVO.setIsInOpenSea(true);
return customerMapper.getPublicCustomerExcelVoReqList(reqVO) ; return customerMapper.getPublicCustomerExcelVoReqList(reqVO);
} }
@Override @Override
......
...@@ -60,7 +60,8 @@ public interface CustomerComplaintService extends IService<CustomerComplaintDO> ...@@ -60,7 +60,8 @@ public interface CustomerComplaintService extends IService<CustomerComplaintDO>
* @param pageReqVO 分页查询 * @param pageReqVO 分页查询
* @return 客户投诉分页 * @return 客户投诉分页
*/ */
PageResult<CustomerComplaintRespVO> getCustomerComplaintPage(CustomerComplaintPageReqVO pageReqVO); PageResult<CustomerComplaintRespVO> getCustomerComplaintPage(
CustomerComplaintPageReqVO pageReqVO);
/** /**
* 获得客户投诉列表, 用于 Excel 导出 * 获得客户投诉列表, 用于 Excel 导出
...@@ -68,6 +69,7 @@ public interface CustomerComplaintService extends IService<CustomerComplaintDO> ...@@ -68,6 +69,7 @@ public interface CustomerComplaintService extends IService<CustomerComplaintDO>
* @param exportReqVO 查询条件 * @param exportReqVO 查询条件
* @return 客户投诉列表 * @return 客户投诉列表
*/ */
List<CustomerComplaintExcelVO> getCustomerComplaintList(CustomerComplaintExportReqVO exportReqVO); List<CustomerComplaintExcelVO> getCustomerComplaintList(
CustomerComplaintExportReqVO exportReqVO);
} }
...@@ -81,7 +81,8 @@ public class CustomerOperateLogServiceImpl extends AbstractService<CustomerOpera ...@@ -81,7 +81,8 @@ public class CustomerOperateLogServiceImpl extends AbstractService<CustomerOpera
} }
@Override @Override
public PageResult<CustomerOperateLogDO> getOperateLogPage(CustomerOperateLogQueryVO query, PageVO page) { public PageResult<CustomerOperateLogDO> getOperateLogPage(
CustomerOperateLogQueryVO query, PageVO page) {
return customerOperateLogMapper.selectPage(page, query); return customerOperateLogMapper.selectPage(page, query);
} }
......
...@@ -41,8 +41,6 @@ ...@@ -41,8 +41,6 @@
</select> </select>
<select id="getList" resultType="cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO"> <select id="getList" resultType="cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO">
select * from ( select * from (
<include refid="queryTable"/> <include refid="queryTable"/>
...@@ -50,7 +48,6 @@ ...@@ -50,7 +48,6 @@
${ew.customSqlSegment} ${ew.customSqlSegment}
</select> </select>
<select id="getMyCustomerList" <select id="getMyCustomerList"
resultType="cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO"> resultType="cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO">
<include refid="queryTable"/> <include refid="queryTable"/>
...@@ -1703,4 +1700,24 @@ ...@@ -1703,4 +1700,24 @@
</select> </select>
<update id="doMergeCustomerLevelLog">
<!--合并客户登记日志-->
update ecw_customer_level_log set customer_id=#{customer_id1},update_time=now()
where customer_id=#{customer_id2}
</update>
<update id="doMergeCustomerCreditLog">
<!--合并信用日志-->
update ecw_customer_credit_log set customer_id=#{customer_id1},update_time=now()
where customer_id=#{customer_id2}
</update>
<update id="doMergeCustomerOperateLog">
<!--合并操作日志-->
update ecw_customer_operate_log set customer_id=#{customer_id1},update_time=now()
where customer_id=#{customer_id2}
</update>
</mapper> </mapper>
...@@ -263,7 +263,8 @@ public class CustomerController { ...@@ -263,7 +263,8 @@ public class CustomerController {
for (CustomerContactsUpdateReqVO customerContact : customerContacts) { for (CustomerContactsUpdateReqVO customerContact : customerContacts) {
Long userid = customerContact.getUserid(); Long userid = customerContact.getUserid();
if (userid != null && userid != 0) { //老数据导入过来后部分userid=0 if (userid != null && userid != 0) { //老数据导入过来后部分userid=0
count = customerContactsService.count(new LambdaQueryWrapperX<CustomerContactsDO>().eq(CustomerContactsDO::getUserid, userid) count = customerContactsService.count(
new LambdaQueryWrapperX<CustomerContactsDO>().eq(CustomerContactsDO::getUserid, userid)
.ne(CustomerContactsDO::getCustomerId, updateReqVO.getId()).eq(BaseDO::getDeleted, 0)); .ne(CustomerContactsDO::getCustomerId, updateReqVO.getId()).eq(BaseDO::getDeleted, 0));
if (count > 0) { if (count > 0) {
UserRespDTO user = memberUserApi.getUser(userid); UserRespDTO user = memberUserApi.getUser(userid);
...@@ -363,6 +364,7 @@ public class CustomerController { ...@@ -363,6 +364,7 @@ public class CustomerController {
//3. 合并后,非主客户的联系人,跟进记录,报价单,订单, //3. 合并后,非主客户的联系人,跟进记录,报价单,订单,
// 客户投诉,品牌授权都迁移到保留客户中,其他信息不会迁移, // 客户投诉,品牌授权都迁移到保留客户中,其他信息不会迁移,
// 如需要维护非主客户的客户档案信息到保留客户中,请先维护好再操作 // 如需要维护非主客户的客户档案信息到保留客户中,请先维护好再操作
if (par.getId1() == null) { if (par.getId1() == null) {
return success(false); return success(false);
} }
...@@ -400,7 +402,9 @@ public class CustomerController { ...@@ -400,7 +402,9 @@ public class CustomerController {
} }
private boolean doMergeCus(CustomerDO customerDO1, private boolean doMergeCus(CustomerDO customerDO1,
CustomerDO customerDO2, long loginUserId) { CustomerDO customerDO2,
long loginUserId) {
/* /*
提交验证: 提交验证:
当保留客户和非主客户的客户经理均不为空且不是同一个用户(允许客户在公海), 当保留客户和非主客户的客户经理均不为空且不是同一个用户(允许客户在公海),
...@@ -422,22 +426,27 @@ public class CustomerController { ...@@ -422,22 +426,27 @@ public class CustomerController {
非主客户关联的订单/收款单/佣金情况单,佣金付款单有在途流程, 非主客户关联的订单/收款单/佣金情况单,佣金付款单有在途流程,
需要测试这种情况是否影响合并 需要测试这种情况是否影响合并
*/ */
//把客户2的联系方式合并到客户1 //把客户2的联系方式合并到客户1 1
doMogeContact(customerDO1, customerDO2, loginUserId); doMogeContact(customerDO1, customerDO2, loginUserId);
//合并报价单 //合并报价单 2
doMogeOffer(customerDO1, customerDO2, loginUserId); doMogeOffer(customerDO1, customerDO2, loginUserId);
//合并跟进记录 //合并跟进记录 3
doMergeCustomerFollow(customerDO1, customerDO2, loginUserId); doMergeCustomerFollow(customerDO1, customerDO2, loginUserId);
//合并客户投诉 //合并客户投诉 4
doMergeCustomerComplaint(customerDO1, customerDO2, loginUserId); doMergeCustomerComplaint(customerDO1, customerDO2, loginUserId);
//合并收款单信息 //合并收款单信息 5
doMergeeReceipt(customerDO1, customerDO2, loginUserId); doMergeeReceipt(customerDO1, customerDO2, loginUserId);
//合并产品品牌授权 6
//合并产品品牌授权
doMergeProductBrandEmpower(customerDO1,customerDO2,loginUserId); doMergeProductBrandEmpower(customerDO1,customerDO2,loginUserId);
//合并客户登记日志 7
//合并客户信用日志
doMergeCustomerLevelLog(customerDO1,customerDO2,loginUserId); doMergeCustomerLevelLog(customerDO1,customerDO2,loginUserId);
//合并信用日志 8
customerService.doMergeCustomerCreditLog(customerDO1.getId(),
customerDO2.getId());
//合并操作日志 9
customerService.doMergeCustomerOperateLog(customerDO1.getId(),
customerDO2.getId());
return true; return true;
} }
...@@ -446,30 +455,16 @@ public class CustomerController { ...@@ -446,30 +455,16 @@ public class CustomerController {
CustomerDO customerDO2, CustomerDO customerDO2,
long loginUserId) long loginUserId)
{ {
/* customerService.doMergeCustomerLevelLog(customerDO1.getId(),
LambdaQueryWrapperX q2 = customerDO2.getId());
new LambdaQueryWrapperX<>().
eq(CustomerLevelLogDO::getCustomerId,
customerDO2.getId());
List<CustomerLevelLogDO> list =
customerLevelLogService.selectList(q2);
if (CollectionUtil.isEmpty(list)) return;
for (CustomerLevelLogDO d : list
) {
d.setCustomerId(customerDO1.getId());
customerLevelLogService.updateById(d);
}*/
} }
//合并产品品牌授权 //合并产品品牌授权
private void doMergeProductBrandEmpower(CustomerDO customerDO1, private void doMergeProductBrandEmpower(CustomerDO customerDO1,
CustomerDO customerDO2, CustomerDO customerDO2,
long loginUserId) long loginUserId)
{ {
LambdaQueryWrapperX q2 = LambdaQueryWrapperX q2 =
new LambdaQueryWrapperX<ProductBrandEmpowerDO>(). new LambdaQueryWrapperX<ProductBrandEmpowerDO>().
eq(ProductBrandEmpowerDO::getCustomerId, eq(ProductBrandEmpowerDO::getCustomerId,
...@@ -490,8 +485,11 @@ public class CustomerController { ...@@ -490,8 +485,11 @@ public class CustomerController {
long loginUserId) { long loginUserId) {
LambdaQueryWrapperX q2 = LambdaQueryWrapperX q2 =
new LambdaQueryWrapperX<CustomerComplaintDO>(). new LambdaQueryWrapperX<CustomerComplaintDO>().
eq(CustomerComplaintDO::getCustomerId, customerDO2.getId()); eq(CustomerComplaintDO::getCustomerId,
List<CustomerComplaintDO> list = customerComplaintService.selectList(q2); customerDO2.getId());
List<CustomerComplaintDO> list =
customerComplaintService.selectList(q2);
if (CollectionUtil.isEmpty(list)) return; if (CollectionUtil.isEmpty(list)) return;
for (CustomerComplaintDO d : list for (CustomerComplaintDO d : list
......
...@@ -126,7 +126,8 @@ public class CustomerDetailController { ...@@ -126,7 +126,8 @@ public class CustomerDetailController {
@GetMapping("/creditLogPage") @GetMapping("/creditLogPage")
@ApiOperation("获得客户信用日志分页") @ApiOperation("获得客户信用日志分页")
public CommonResult<PageResult<CustomerCreditLogBackVO>> getCreditLogPage(@RequestParam("customerId") Long customerId, PageParam page) { public CommonResult<PageResult<CustomerCreditLogBackVO>> getCreditLogPage(
@RequestParam("customerId") Long customerId, PageParam page) {
return success(customerCreditLogService.getCreditLogPage(customerId, page)); return success(customerCreditLogService.getCreditLogPage(customerId, page));
} }
} }
...@@ -77,7 +77,8 @@ public class CustomerOperateLogController { ...@@ -77,7 +77,8 @@ public class CustomerOperateLogController {
@ApiOperation("获得客户操作日志分页") @ApiOperation("获得客户操作日志分页")
@PreAuthorize("@ss.hasPermission('customer:operate-log:query')") @PreAuthorize("@ss.hasPermission('customer:operate-log:query')")
public CommonResult<PageResult<CustomerOperateLogBackVO>> getOperateLogPage(@Valid CustomerOperateLogQueryVO query, PageVO page) { public CommonResult<PageResult<CustomerOperateLogBackVO>> getOperateLogPage(@Valid CustomerOperateLogQueryVO query, PageVO page) {
PageResult<CustomerOperateLogDO> pageResult = operateLogService.getOperateLogPage(query, page); PageResult<CustomerOperateLogDO> pageResult =
operateLogService.getOperateLogPage(query, page);
return success(CustomerOperateLogConvert.INSTANCE.convertPage(pageResult)); return success(CustomerOperateLogConvert.INSTANCE.convertPage(pageResult));
} }
......
...@@ -6016,6 +6016,10 @@ public interface OrderMapper extends AbstractMapper<OrderDO> { ...@@ -6016,6 +6016,10 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
@Param("calVvalue") BigDecimal calVvalue, @Param("calVvalue") BigDecimal calVvalue,
@Param("yejiCreateDate") Date yejiCreateDate); @Param("yejiCreateDate") Date yejiCreateDate);
@Update("update ecw_order set salesman_id=#{salesman_id} where order_id = #{orderId}")
void updateOrderSalesmanId(@Param("orderId") Long orderId,
@Param("salesman_id") Long salesman_id);
/** /**
* 报价结果赢单时,同步业绩归属 * 报价结果赢单时,同步业绩归属
* @param customerId * @param customerId
......
...@@ -78,4 +78,14 @@ public interface TargetLogMapper extends AbstractMapper<TargetLogDO> { ...@@ -78,4 +78,14 @@ public interface TargetLogMapper extends AbstractMapper<TargetLogDO> {
}) })
List<TargetLogDO> selectList2(String sDate); List<TargetLogDO> selectList2(String sDate);
/*
@Select({
"<script>",
"select * from ecw_target_log where deleted=0 and (DATE_FORMAT(create_time,'%Y-%m')=#{sDate} OR DATE_FORMAT(achievement_time,'%Y-%m')=#{sDate})",
"</script>"
})
List<TargetLogDO> selectList2(String sDate);
*/
} }
...@@ -29,6 +29,7 @@ import java.util.List; ...@@ -29,6 +29,7 @@ import java.util.List;
*/ */
public interface OrderService extends IService<OrderDO> { public interface OrderService extends IService<OrderDO> {
void updateOrderSalesmanId(Long orderId,Long salesman_id);
/** /**
* 创建订单 * 创建订单
* *
......
...@@ -162,16 +162,25 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -162,16 +162,25 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
return; return;
} }
// 判断该订单、该客户是否有未分配客户异常,如果有,则这个订单不计算业绩 // 判断该订单、该客户是否有未分配客户异常,如果有,则这个订单不计算业绩
List<OrderExceptionDO> orderExceptionDOList = orderExceptionService.getOrderExceptionByCustomerId(order.getCustomerId()); List<OrderExceptionDO> orderExceptionDOList =
orderExceptionService.getOrderExceptionByCustomerId(
order.getCustomerId());
// 获取当前订单的异常 // 获取当前订单的异常
OrderExceptionDO currentOrderException = orderExceptionDOList.stream() OrderExceptionDO currentOrderException = orderExceptionDOList.stream()
.filter(orderExceptionDO -> Objects.equals(orderExceptionDO.getOrderId(), order.getOrderId())).findFirst().orElse(null); .filter(orderExceptionDO -> Objects.equals(orderExceptionDO.getOrderId(), order.getOrderId())).findFirst().orElse(null);
CustomerDO customerDO = customerService.getById(order.getCustomerId()); CustomerDO customerDO = customerService.getById(order.getCustomerId());
Long oldCustomerService = null; // 老客户经理默认为null Long oldCustomerService = null; // 老客户经理默认为null
if (Objects.nonNull(customerDO) && Objects.nonNull(customerDO.getCustomerService()) && customerDO.getCustomerService() != 0L && Objects.nonNull(customerDO.getCustomerServiceAssignedTime()) if (Objects.nonNull(customerDO) &&
&& !customerDO.getIsCustomerServiceConfirmed() && !customerDO.getIsInOpenSea()) { Objects.nonNull(customerDO.getCustomerService())
// 如果客户存在,客户经理已分配,有分配时间,但是待确认接收,也不是公海捞取,那么需要判断该客户之前是否有客户经理,没有则业绩属于公司客户,有则业绩归属于上个客户经理 && customerDO.getCustomerService() != 0L
CustomerOperateLogDO customerOperateLogDO = customerOperateLogService.getOne(new LambdaQueryWrapper<CustomerOperateLogDO>() && Objects.nonNull(customerDO.getCustomerServiceAssignedTime())
&& !customerDO.getIsCustomerServiceConfirmed()
&& !customerDO.getIsInOpenSea()) {
// 如果客户存在,客户经理已分配,有分配时间,但是待确认接收,
// 也不是公海捞取,那么需要判断该客户之前是否有客户经理,
// 没有则业绩属于公司客户,有则业绩归属于上个客户经理
CustomerOperateLogDO customerOperateLogDO =
customerOperateLogService.getOne(new LambdaQueryWrapper<CustomerOperateLogDO>()
.eq(CustomerOperateLogDO::getCustomerId, customerDO.getId()) .eq(CustomerOperateLogDO::getCustomerId, customerDO.getId())
.eq(CustomerOperateLogDO::getOperateType, 4) // TODO 暂定操作类型4为分配操作,有遗漏后面补充操作类型即可 .eq(CustomerOperateLogDO::getOperateType, 4) // TODO 暂定操作类型4为分配操作,有遗漏后面补充操作类型即可
.orderByDesc(CustomerOperateLogDO::getId).last("limit 1")); .orderByDesc(CustomerOperateLogDO::getId).last("limit 1"));
...@@ -192,8 +201,12 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -192,8 +201,12 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
if (Objects.nonNull(adminUserRespDTO)) { if (Objects.nonNull(adminUserRespDTO)) {
order.setDeptId(adminUserRespDTO.getDeptId()); order.setDeptId(adminUserRespDTO.getDeptId());
} }
} else if (CollectionUtil.isEmpty(orderExceptionDOList) && Objects.nonNull(customerDO) } else if (CollectionUtil.isEmpty(orderExceptionDOList) &&
&& (Objects.isNull(customerDO.getCustomerService()) || (!customerDO.getIsCustomerServiceConfirmed() && Objects.isNull(oldCustomerService)))) { Objects.nonNull(customerDO)
&& (Objects.isNull(customerDO.getCustomerService()) ||
(!customerDO.getIsCustomerServiceConfirmed()
&& Objects.isNull(oldCustomerService)))) {
// 如果客户正在移交新客户经理,但是未接收,并且老客户经理不为null,则不创建客户经理未分配异常 // 如果客户正在移交新客户经理,但是未接收,并且老客户经理不为null,则不创建客户经理未分配异常
//web下单,业绩为收货人,不产生未分配客户经理异常 //web下单,业绩为收货人,不产生未分配客户经理异常
if (order.getUserId() != null && order.getUserId() > 0 && customerType == 2) { if (order.getUserId() != null && order.getUserId() > 0 && customerType == 2) {
...@@ -219,7 +232,8 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -219,7 +232,8 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
orderExceptionService.createOrderException(orderExceptionCreateReqVO); orderExceptionService.createOrderException(orderExceptionCreateReqVO);
} }
} else { } else {
// 该订单存在该客户未分配客户经理异常,或者该客户的客户经理待接收,则不再生成未分配客户经理异常,且该订单不产生业绩归属 // 该订单存在该客户未分配客户经理异常,
// 或者该客户的客户经理待接收,则不再生成未分配客户经理异常,且该订单不产生业绩归属
order.setSalesmanId(0L); order.setSalesmanId(0L);
order.setDeptId(0L); order.setDeptId(0L);
} }
......
...@@ -379,7 +379,9 @@ public class OrderController { ...@@ -379,7 +379,9 @@ public class OrderController {
} }
private static void addDataScopeQuery(OrderQueryVO query, LoginUser loginUser, List<RoleRespDTO> roleRespDTOS) { private static void addDataScopeQuery(OrderQueryVO query,
LoginUser loginUser,
List<RoleRespDTO> roleRespDTOS) {
List<Long> deptIdList = new ArrayList<>(); List<Long> deptIdList = new ArrayList<>();
boolean isAll = Boolean.FALSE; boolean isAll = Boolean.FALSE;
for (RoleRespDTO roleRespDTO : roleRespDTOS) { for (RoleRespDTO roleRespDTO : roleRespDTOS) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment