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);
} }
......
...@@ -199,7 +199,10 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -199,7 +199,10 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
List<DictDataRespDTO> dictList = List<DictDataRespDTO> dictList =
dictDataApi.getDictDatas("part_function_switch"); dictDataApi.getDictDatas("part_function_switch");
//智慧预装功能开关 //智慧预装功能开关
DictDataRespDTO dictDataRespDTO = dictList.stream().filter(dto -> "create_order_phone_limit".equals(dto.getLabel())).findFirst().orElse(null); DictDataRespDTO dictDataRespDTO = dictList.stream().filter(
dto -> "create_order_phone_limit".equals(dto.getLabel())).findFirst().
orElse(null);
if ((Objects.isNull(createReqVO.getIsCargoControl()) || if ((Objects.isNull(createReqVO.getIsCargoControl()) ||
!createReqVO.getIsCargoControl()) && !createReqVO.getIsCargoControl()) &&
Objects.nonNull(dictDataRespDTO) && Objects.nonNull(dictDataRespDTO) &&
...@@ -217,7 +220,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -217,7 +220,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
} }
if (!Objects.equals(logisticsInfoDto.getStartCityId(), if (!Objects.equals(logisticsInfoDto.getStartCityId(),
createReqVO.getDepartureId()) || !Objects.equals( createReqVO.getDepartureId()) || !Objects.equals(
logisticsInfoDto.getDestCityId(), createReqVO.getObjectiveId())) { logisticsInfoDto.getDestCityId(), createReqVO.getObjectiveId())) {
throw exception(ORDER_DEPARTURE_OBJECTIVE_AND_LINE_NOT_AGREEMENT); throw exception(ORDER_DEPARTURE_OBJECTIVE_AND_LINE_NOT_AGREEMENT);
} }
if (createReqVO.getIsExternalWarehouse() != null && if (createReqVO.getIsExternalWarehouse() != null &&
...@@ -285,7 +288,8 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -285,7 +288,8 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
// 查询始发地与目的地信息 // 查询始发地与目的地信息
RegionDO departure = regionService.getRegion(createReqVO.getDepartureId()); RegionDO departure = regionService.getRegion(createReqVO.getDepartureId());
if (Objects.isNull(departure) || (!StrUtil.equals(departure.getType(), "2") && !StrUtil.equals(departure.getType(), "3"))) { if (Objects.isNull(departure) || (!StrUtil.equals(departure.getType(), "2")
&& !StrUtil.equals(departure.getType(), "3"))) {
throw exception(DEPARTURE_NOT_EXISTS); throw exception(DEPARTURE_NOT_EXISTS);
} }
RegionDO objective = regionService.getRegion(createReqVO.getObjectiveId()); RegionDO objective = regionService.getRegion(createReqVO.getObjectiveId());
...@@ -294,7 +298,9 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -294,7 +298,9 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
if (Objects.equals(createReqVO.getStatus(), OrderStatusEnum.DRAFT.getValue())) { if (Objects.equals(createReqVO.getStatus(), OrderStatusEnum.DRAFT.getValue())) {
newOrderNo = "DRAFT-" + System.currentTimeMillis(); newOrderNo = "DRAFT-" + System.currentTimeMillis();
} else { } else {
newOrderNo = orderBusinessService.saveOrUpdateOrderNo(objective, createReqVO.getTransportId(), createReqVO.getIsExternalWarehouse(), newOrderNo = orderBusinessService.saveOrUpdateOrderNo(objective,
createReqVO.getTransportId(),
createReqVO.getIsExternalWarehouse(),
StringUtils.isNotBlank(createReqVO.getType()) && createReqVO.getType().contains("1")); StringUtils.isNotBlank(createReqVO.getType()) && createReqVO.getType().contains("1"));
} }
order.setOrderNo(newOrderNo); order.setOrderNo(newOrderNo);
...@@ -847,8 +853,12 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -847,8 +853,12 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
if (StringUtils.isNotBlank(orderConsignorDO.getPhone())) { if (StringUtils.isNotBlank(orderConsignorDO.getPhone())) {
orderConsignorService.save(orderConsignorDO); orderConsignorService.save(orderConsignorDO);
} }
if (order.getIsCargoControl() && !Objects.equals(createReqVO.getStatus(), OrderStatusEnum.DRAFT.getValue())) { if (order.getIsCargoControl() &&
// 控货订单 添加控货人信息 (当放货人为空时不添加 注:当报价单赢单创建的草稿订单可能发货人为空) !Objects.equals(createReqVO.getStatus(),
OrderStatusEnum.DRAFT.getValue())) {
// 控货订单 添加控货人信息 (当放货人为空时不添加 注:
// 当报价单赢单创建的草稿订单可能发货人为空)
OrderCargoControlDO orderCargoControlDO = new OrderCargoControlDO(); OrderCargoControlDO orderCargoControlDO = new OrderCargoControlDO();
BeanUtils.copyProperties(orderConsignorDO, orderCargoControlDO); BeanUtils.copyProperties(orderConsignorDO, orderCargoControlDO);
orderCargoControlDO.setId(null); // 置空主键ID orderCargoControlDO.setId(null); // 置空主键ID
...@@ -860,7 +870,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -860,7 +870,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
orderCargoControlDO.setCreateTime(now); orderCargoControlDO.setCreateTime(now);
orderCargoControlDO.setIsActual(Boolean.TRUE); orderCargoControlDO.setIsActual(Boolean.TRUE);
orderCargoControlMapper.insert(orderCargoControlDO); orderCargoControlMapper.insert(orderCargoControlDO);
// TODO 订单控货信息日志补充 //TODO 订单控货信息日志补充
String msg = String.format("订单创建默认发货人控货信息,姓名%s,电话+%s", orderConsignorDO.getName() + "/" + (StringUtils.isNotBlank(orderConsignorDO.getNameEn()) ? orderConsignorDO.getNameEn() : "空"), String msg = String.format("订单创建默认发货人控货信息,姓名%s,电话+%s", orderConsignorDO.getName() + "/" + (StringUtils.isNotBlank(orderConsignorDO.getNameEn()) ? orderConsignorDO.getNameEn() : "空"),
orderConsignorDO.getCountryCode() + orderConsignorDO.getPhone()); orderConsignorDO.getCountryCode() + orderConsignorDO.getPhone());
orderBusinessService.createOrderControlLog(orderCargoControlDO.getOrderId(), 1, "创建控货信息", msg, 0L); orderBusinessService.createOrderControlLog(orderCargoControlDO.getOrderId(), 1, "创建控货信息", msg, 0L);
...@@ -978,7 +988,6 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -978,7 +988,6 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
} }
if (!Objects.equals(createReqVO.getStatus(), if (!Objects.equals(createReqVO.getStatus(),
OrderStatusEnum.DRAFT.getValue())) { OrderStatusEnum.DRAFT.getValue())) {
// 发货人 1 收货人 2 // 发货人 1 收货人 2
int customerType = this.checkOrderSalesman(order, int customerType = this.checkOrderSalesman(order,
createReqVO.getOfferId(), createReqVO.getOfferId(),
...@@ -986,7 +995,6 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -986,7 +995,6 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
null, null,
orderConsignorDO, orderConsignorDO,
orderConsigneeDO); orderConsigneeDO);
// 更新所属客户经理(业务员) // 更新所属客户经理(业务员)
if (Objects.nonNull(order.getCustomerId()) && order.getCustomerId() > 0) { if (Objects.nonNull(order.getCustomerId()) && order.getCustomerId() > 0) {
//addOrderCustomerService(order, customerType); //addOrderCustomerService(order, customerType);
...@@ -1405,46 +1413,81 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -1405,46 +1413,81 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
} }
} }
private void addOrderCustomerService(OrderDO order, int customerType) { private void addOrderCustomerService(OrderDO order,
if (Objects.nonNull(order.getParentOrderId()) && order.getParentOrderId() > 0 && !order.getSplitSeparateOrder()) { int customerType) {
if (Objects.nonNull(order.getParentOrderId()) &&
order.getParentOrderId() > 0 &&
!order.getSplitSeparateOrder()) {
// 拆单子订单,并且未标记为独立订单,则不执行客户经理分配规则,以原单为主 // 拆单子订单,并且未标记为独立订单,则不执行客户经理分配规则,以原单为主
return; return;
} }
// 判断该订单、该客户是否有未分配客户异常,如果有,则这个订单不计算业绩 // 判断该订单、该客户是否有未分配客户异常,如果有,则这个订单不计算业绩
List<OrderExceptionDO> orderExceptionDOList = orderExceptionService.getOrderExceptionByCustomerId(order.getCustomerId()); List<OrderExceptionDO> orderExceptionDOList =
orderExceptionService.getOrderExceptionByCustomerId(
order.getCustomerId());
// 获取当前订单的异常 // 获取当前订单的异常
OrderExceptionDO currentOrderException = orderExceptionDOList.stream() OrderExceptionDO currentOrderException =
.filter(orderExceptionDO -> Objects.equals(orderExceptionDO.getOrderId(), order.getOrderId())).findFirst().orElse(null); orderExceptionDOList.stream()
.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;
if (Objects.nonNull(customerDO) && Objects.nonNull(customerDO.getCustomerService()) && customerDO.getCustomerService() != 0L && Objects.nonNull(customerDO.getCustomerServiceAssignedTime()) // 老客户经理默认为null
&& !customerDO.getIsCustomerServiceConfirmed() && !customerDO.getIsInOpenSea()) { if (Objects.nonNull(customerDO) &&
// 如果客户存在,客户经理已分配,有分配时间,但是待确认接收,也不是公海捞取,那么需要判断该客户之前是否有客户经理,没有则业绩属于公司客户,有则业绩归属于上个客户经理 Objects.nonNull(customerDO.getCustomerService())
CustomerOperateLogDO customerOperateLogDO = customerOperateLogService.getOne(new LambdaQueryWrapper<CustomerOperateLogDO>() && customerDO.getCustomerService() != 0L
.eq(CustomerOperateLogDO::getCustomerId, customerDO.getId()) && Objects.nonNull(customerDO.getCustomerServiceAssignedTime())
.eq(CustomerOperateLogDO::getOperateType, 4) // TODO 暂定操作类型4为分配操作,有遗漏后面补充操作类型即可 && !customerDO.getIsCustomerServiceConfirmed()
.orderByDesc(CustomerOperateLogDO::getId).last("limit 1")); && !customerDO.getIsInOpenSea()) {
if (Objects.nonNull(customerOperateLogDO) && Objects.nonNull(customerOperateLogDO.getOldCustomerService()) && customerOperateLogDO.getOldCustomerService() != 0L) { // 如果客户存在,客户经理已分配,有分配时间,但是待确认接收,
// 也不是公海捞取,那么需要判断该客户之前是否有客户经理,没有则业绩属于公司客户,有则业绩归属于上个客户经理
CustomerOperateLogDO customerOperateLogDO =
customerOperateLogService.getOne(
new LambdaQueryWrapper<CustomerOperateLogDO>()
.eq(CustomerOperateLogDO::getCustomerId, customerDO.getId())
.eq(CustomerOperateLogDO::getOperateType, 4) // TODO 暂定操作类型4为分配操作,有遗漏后面补充操作类型即可
.orderByDesc(CustomerOperateLogDO::getId).last("limit 1"));
if (Objects.nonNull(customerOperateLogDO) &&
Objects.nonNull(customerOperateLogDO.getOldCustomerService())
&& customerOperateLogDO.getOldCustomerService() != 0L) {
oldCustomerService = customerOperateLogDO.getOldCustomerService(); oldCustomerService = customerOperateLogDO.getOldCustomerService();
} }
} }
// 没有该订单,该客户的未分配客户经理异常 // 没有该订单,该客户的未分配客户经理异常
if (Objects.isNull(currentOrderException) && Objects.nonNull(customerDO) && Objects.nonNull(customerDO.getCustomerService()) && customerDO.getCustomerService() != 0L if (Objects.isNull(currentOrderException)
&& (customerDO.getIsCustomerServiceConfirmed() || (!customerDO.getIsCustomerServiceConfirmed() && Objects.nonNull(oldCustomerService)))) { && Objects.nonNull(customerDO)
&& Objects.nonNull(customerDO.getCustomerService())
&& customerDO.getCustomerService() != 0L
&& (customerDO.getIsCustomerServiceConfirmed() ||
(!customerDO.getIsCustomerServiceConfirmed()
&& Objects.nonNull(oldCustomerService)))) {
if (Objects.nonNull(oldCustomerService)) { if (Objects.nonNull(oldCustomerService)) {
// 如果这里的旧客户经理id不为null,说明此客户属于移交新客户经理,但是新客户经理还未接收,业绩算老客户经理的 // 如果这里的旧客户经理id不为null,说明此客户属于移交新客户经理,
// 但是新客户经理还未接收,业绩算老客户经理的
order.setSalesmanId(oldCustomerService); order.setSalesmanId(oldCustomerService);
} else { } else {
//order.setSalesmanId(customerDO.getCustomerService()); //order.setSalesmanId(customerDO.getCustomerService());
addOrderSalesmanCustomerService(order); addOrderSalesmanCustomerService(order);
} }
AdminUserRespDTO adminUserRespDTO = adminUserApi.getUser(order.getSalesmanId()); AdminUserRespDTO adminUserRespDTO =
adminUserApi.getUser(order.getSalesmanId());
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)
// 如果客户正在移交新客户经理,但是未接收,并且老客户经理不为null,则不创建客户经理未分配异常 && (Objects.isNull(customerDO.getCustomerService()) ||
(!customerDO.getIsCustomerServiceConfirmed() &&
Objects.isNull(oldCustomerService)))) {
// 如果客户正在移交新客户经理,但是未接收,并且老客户经理不为null,
// 则不创建客户经理未分配异常
//web下单,业绩为收货人,不产生未分配客户经理异常 //web下单,业绩为收货人,不产生未分配客户经理异常
if (order.getUserId() != null && order.getUserId() > 0 && if (order.getUserId() != null && order.getUserId() > 0 &&
customerType == 2) { customerType == 2) {
...@@ -1466,12 +1509,20 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -1466,12 +1509,20 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
descZh = String.format(descZh, "收货人", customerDO.getNumber()); descZh = String.format(descZh, "收货人", customerDO.getNumber());
descEn = String.format(descEn, "consignee", customerDO.getNumber()); descEn = String.format(descEn, "consignee", customerDO.getNumber());
} }
OrderExceptionCreateReqVO orderExceptionCreateReqVO = this.genOrderException(order.getOrderId(), order, null, order.getCustomerId(), OrderExceptionEnum.NOT_CUSTOMER_SERVICE_EXCEPTION, OrderExceptionCreateReqVO orderExceptionCreateReqVO =
descZh, descEn); this.genOrderException(order.getOrderId(),
orderExceptionService.createOrderException(orderExceptionCreateReqVO); order, null,
order.getCustomerId(),
OrderExceptionEnum.NOT_CUSTOMER_SERVICE_EXCEPTION,
descZh,
descEn);
orderExceptionService.createOrderException(
orderExceptionCreateReqVO);
} }
} else { } else {
// 该订单存在该客户未分配客户经理异常,或者该客户的客户经理待接收,则不再生成未分配客户经理异常,且该订单不产生业绩归属 // 该订单存在该客户未分配客户经理异常,或者该客户的客户经理待接收,
// 则不再生成未分配客户经理异常,且该订单不产生业绩归属
order.setSalesmanId(0L); order.setSalesmanId(0L);
order.setDeptId(0L); order.setDeptId(0L);
} }
...@@ -1902,7 +1953,8 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -1902,7 +1953,8 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void updateOrder(OrderUpdateReqVO updateReqVO, MemberUserDO memberUserDO) { public void updateOrder(OrderUpdateReqVO updateReqVO,
MemberUserDO memberUserDO) {
int type = 2; int type = 2;
if (Objects.equals(TransportTypeShortEnum.SEA_CONTAINER.getValue(), updateReqVO.getTransportId()) || Objects.equals(TransportTypeShortEnum.MARINE_CONTAINER.getValue(), updateReqVO.getTransportId())) { if (Objects.equals(TransportTypeShortEnum.SEA_CONTAINER.getValue(), updateReqVO.getTransportId()) || Objects.equals(TransportTypeShortEnum.MARINE_CONTAINER.getValue(), updateReqVO.getTransportId())) {
...@@ -3303,8 +3355,12 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -3303,8 +3355,12 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
} }
} }
private void appUpdateConsignorAndConsignee(OrderUpdateReqVO updateReqVO, OrderDO updateObj, String private void appUpdateConsignorAndConsignee(OrderUpdateReqVO updateReqVO,
updater, Date now, MemberUserDO memberUserDO, DictDataRespDTO dictDataRespDTO) { OrderDO updateObj,
String updater,
Date now,
MemberUserDO memberUserDO,
DictDataRespDTO dictDataRespDTO) {
// 根据会员ID获取客户联系人ID与客户ID // 根据会员ID获取客户联系人ID与客户ID
CustomerContactsDO customerContacts = customerContactsService.getOne(new LambdaQueryWrapper<CustomerContactsDO>() CustomerContactsDO customerContacts = customerContactsService.getOne(new LambdaQueryWrapper<CustomerContactsDO>()
.and(we -> we.eq(CustomerContactsDO::getUserid, memberUserDO.getId()) .and(we -> we.eq(CustomerContactsDO::getUserid, memberUserDO.getId())
...@@ -3478,9 +3534,17 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -3478,9 +3534,17 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
} }
} }
orderConsigneeService.saveOrUpdate(orderConsigneeDO); orderConsigneeService.saveOrUpdate(orderConsigneeDO);
if (!Objects.equals(updateReqVO.getStatus(), OrderStatusEnum.DRAFT.getValue())) { if (!Objects.equals(updateReqVO.getStatus(),
OrderStatusEnum.DRAFT.getValue())) {
//customerType 发货人 1 收货人 2 //customerType 发货人 1 收货人 2
int customerType = this.checkOrderSalesman(updateObj, updateReqVO.getOfferId(), consignorCustomerDO, null, orderConsignorDO, orderConsigneeDO); int customerType =
this.checkOrderSalesman(updateObj,
updateReqVO.getOfferId(),
consignorCustomerDO,
null,
orderConsignorDO,
orderConsigneeDO);
// if (Objects.nonNull(updateObj.getType()) && updateObj.getType().contains("2")) { // if (Objects.nonNull(updateObj.getType()) && updateObj.getType().contains("2")) {
// // 海外仓归属发货人 // // 海外仓归属发货人
// updateObj.setCustomerId(orderConsignorDO.getCustomerId()); // updateObj.setCustomerId(orderConsignorDO.getCustomerId());
...@@ -3560,13 +3624,18 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -3560,13 +3624,18 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
if (!OrderStatusEnum.DRAFT.getValue().equals(updateObj.getStatus()) if (!OrderStatusEnum.DRAFT.getValue().equals(updateObj.getStatus())
&& Objects.nonNull(updateObj.getCustomerId()) && && Objects.nonNull(updateObj.getCustomerId()) &&
updateObj.getCustomerId() > 0) { updateObj.getCustomerId() > 0) {
addOrderCustomerService(updateObj, customerType); addOrderCustomerService(updateObj, customerType);
} }
} }
} }
private void adminUpdateConsignorAndConsignee(OrderUpdateReqVO updateReqVO, OrderDO updateObj, String updater, private void adminUpdateConsignorAndConsignee(OrderUpdateReqVO updateReqVO,
Date now, DictDataRespDTO dictDataRespDTO) { OrderDO updateObj,
String updater,
Date now,
DictDataRespDTO dictDataRespDTO) {
CustomerDO consignorDO = customerService.getCustomer(updateReqVO.getConsignorId()); CustomerDO consignorDO = customerService.getCustomer(updateReqVO.getConsignorId());
CustomerContactsDO consignorContactsDO = customerContactsService.getCustomerContacts(updateReqVO.getConsignorContactsId()); CustomerContactsDO consignorContactsDO = customerContactsService.getCustomerContacts(updateReqVO.getConsignorContactsId());
...@@ -3780,12 +3849,20 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -3780,12 +3849,20 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
if (StringUtils.isNotBlank(orderConsigneeDO.getPhone())) { if (StringUtils.isNotBlank(orderConsigneeDO.getPhone())) {
orderConsigneeService.saveOrUpdate(orderConsigneeDO); orderConsigneeService.saveOrUpdate(orderConsigneeDO);
} }
if (!Objects.equals(updateReqVO.getStatus(), OrderStatusEnum.DRAFT.getValue())) { if (!Objects.equals(updateReqVO.getStatus(),
OrderStatusEnum.DRAFT.getValue())) {
//customerType 发货人 1 收货人 2 //customerType 发货人 1 收货人 2
int customerType = this.checkOrderSalesman(updateObj, updateReqVO.getOfferId(), consignorDO, consigneeDO, orderConsignorDO, orderConsigneeDO); int customerType = this.checkOrderSalesman(updateObj,
updateReqVO.getOfferId(),
consignorDO,
consigneeDO,
orderConsignorDO,
orderConsigneeDO);
// 更新所属客户经理(业务员) // 更新所属客户经理(业务员)
if (!OrderStatusEnum.DRAFT.getValue().equals(updateObj.getStatus()) && Objects.nonNull(updateObj.getCustomerId()) && updateObj.getCustomerId() > 0) { if (!OrderStatusEnum.DRAFT.getValue().equals(updateObj.getStatus())
&& Objects.nonNull(updateObj.getCustomerId())
&& updateObj.getCustomerId() > 0) {
addOrderCustomerService(updateObj, customerType); addOrderCustomerService(updateObj, customerType);
//setUpdateOrderCustomerServiceCustomerId(updateReqVO, updateObj,consignorDO,consigneeDO,orderConsignorDO,orderConsigneeDO); //setUpdateOrderCustomerServiceCustomerId(updateReqVO, updateObj,consignorDO,consigneeDO,orderConsignorDO,orderConsigneeDO);
} }
...@@ -6357,13 +6434,16 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -6357,13 +6434,16 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
OrderConsignorDO orderConsignorDO = OrderConsignorDO orderConsignorDO =
orderConsignorService.getOne(new LambdaQueryWrapper<OrderConsignorDO>().eq(OrderConsignorDO::getOrderId, orderDO.getOrderId()).orderByDesc(OrderConsignorDO::getId).last("limit 1")); orderConsignorService.getOne(new LambdaQueryWrapper<OrderConsignorDO>().eq(OrderConsignorDO::getOrderId, orderDO.getOrderId()).orderByDesc(OrderConsignorDO::getId).last("limit 1"));
OrderConsigneeDO orderConsigneeDO = OrderConsigneeDO orderConsigneeDO =
orderConsigneeService.getOne(new LambdaQueryWrapper<OrderConsigneeDO>().eq(OrderConsigneeDO::getOrderId, orderDO.getOrderId()).orderByDesc(OrderConsigneeDO::getId).last("limit 1")); orderConsigneeService.getOne(
new LambdaQueryWrapper<OrderConsigneeDO>().eq(OrderConsigneeDO::getOrderId, orderDO.getOrderId()).orderByDesc(OrderConsigneeDO::getId).last("limit 1"));
// 更新所属客户经理(业务员) // 更新所属客户经理(业务员)
if (Objects.isNull(orderDO.getParentOrderId()) || if (Objects.isNull(orderDO.getParentOrderId()) ||
orderDO.getParentOrderId() == 0 || orderDO.getParentOrderId() == 0 ||
orderDO.getSplitSeparateOrder()) { orderDO.getSplitSeparateOrder()) {
// 拆单子订单不执行客户经理分配规则,以原单为主 // 拆单子订单不执行客户经理分配规则,以原单为主
if (Objects.nonNull(orderDO.getCustomerId()) && orderDO.getCustomerId() > 0) { if (Objects.nonNull(orderDO.getCustomerId()) &&
orderDO.getCustomerId() > 0) {
addOrderCustomerService(orderDO, addOrderCustomerService(orderDO,
Objects.equals(orderConsignorDO.getCustomerId(), Objects.equals(orderConsignorDO.getCustomerId(),
orderDO.getCustomerId()) ? 1 : 2); orderDO.getCustomerId()) ? 1 : 2);
...@@ -6562,6 +6642,11 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -6562,6 +6642,11 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
orderMapper.UpdateOrderVValue(orderId, calVvalue, yejiCreateDate); orderMapper.UpdateOrderVValue(orderId, calVvalue, yejiCreateDate);
} }
//修改订单的客户经理
public void updateOrderSalesmanId(Long orderId, Long salesman_id) {
orderMapper.updateOrderSalesmanId(orderId, salesman_id);
}
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void updateOrderCustomerAndSalesmanId(Long customerId, Long salesmanId, Long orderId) { public void updateOrderCustomerAndSalesmanId(Long customerId, Long salesmanId, Long orderId) {
orderMapper.updateOrderCustomerAndSalesmanId(customerId, salesmanId, orderId); orderMapper.updateOrderCustomerAndSalesmanId(customerId, salesmanId, orderId);
......
...@@ -1092,8 +1092,8 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI ...@@ -1092,8 +1092,8 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
orderQueryService.isSplitOrderChildren(orderDO); orderQueryService.isSplitOrderChildren(orderDO);
// 没有入仓数据则提示 // 没有入仓数据则提示
Long inCount = orderWarehouseInMapper.selectCount(OrderWarehouseInDO::getOrderId, Long inCount = orderWarehouseInMapper.selectCount(
orderId); OrderWarehouseInDO::getOrderId, orderId);
if (inCount == 0) { if (inCount == 0) {
throw ServiceExceptionUtil.exception( throw ServiceExceptionUtil.exception(
ErrorCodeConstants.ORDER_WAREHOUSE_IN_NOT_EXISTS); ErrorCodeConstants.ORDER_WAREHOUSE_IN_NOT_EXISTS);
...@@ -1135,8 +1135,12 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI ...@@ -1135,8 +1135,12 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
orderWarehousePictureService.createWarehousePictureBatch( orderWarehousePictureService.createWarehousePictureBatch(
finishReqVO.getExceptionUrls(), 4, orderId); finishReqVO.getExceptionUrls(), 4, orderId);
// 异常 // 异常
String descZh = getOrderOtherExceptionDesc(manualExceptionType, 0, finishReqVO.getDescZh(), finishReqVO.getDescEn()); String descZh = getOrderOtherExceptionDesc(manualExceptionType,
String descEn = getOrderOtherExceptionDesc(manualExceptionType, 1, finishReqVO.getDescZh(), finishReqVO.getDescEn()); 0, finishReqVO.getDescZh(),
finishReqVO.getDescEn());
String descEn = getOrderOtherExceptionDesc(manualExceptionType,
1, finishReqVO.getDescZh(),
finishReqVO.getDescEn());
OrderExceptionCreateReqVO orderExceptionCreateReqVO = OrderExceptionCreateReqVO orderExceptionCreateReqVO =
genOrderException(orderId, genOrderException(orderId,
...@@ -1182,9 +1186,7 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI ...@@ -1182,9 +1186,7 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
// 更新 // 更新
orderSpecialNeedService.updateBatchById(orderSpecialNeedList); orderSpecialNeedService.updateBatchById(orderSpecialNeedList);
} } else {
else
{
} }
...@@ -1248,8 +1250,10 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI ...@@ -1248,8 +1250,10 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
// orderWarehouseInDOList.stream().map(OrderWarehouseInDO::getWeight).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add); // orderWarehouseInDOList.stream().map(OrderWarehouseInDO::getWeight).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
// BigDecimal volumeSum = finishReqVO.getSumVolume() != null ? finishReqVO.getSumVolume() : // BigDecimal volumeSum = finishReqVO.getSumVolume() != null ? finishReqVO.getSumVolume() :
// orderWarehouseInDOList.stream().map(OrderWarehouseInDO::getVolume).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add); // orderWarehouseInDOList.stream().map(OrderWarehouseInDO::getVolume).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal weightSum = orderWarehouseInDOList.stream().map(OrderWarehouseInDO::getWeight).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add); BigDecimal weightSum =
BigDecimal volumeSum = orderWarehouseInDOList.stream().map(OrderWarehouseInDO::getVolume).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add); orderWarehouseInDOList.stream().map(OrderWarehouseInDO::getWeight).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal volumeSum =
orderWarehouseInDOList.stream().map(OrderWarehouseInDO::getVolume).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
orderDO.setSumQuantity(quantitySum); orderDO.setSumQuantity(quantitySum);
orderDO.setSumWeight(weightSum); orderDO.setSumWeight(weightSum);
orderDO.setSumVolume(volumeSum); orderDO.setSumVolume(volumeSum);
...@@ -1373,7 +1377,8 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI ...@@ -1373,7 +1377,8 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
// 1、非拆单子订单 2、未发送短信 3、非退场入仓 // 1、非拆单子订单 2、未发送短信 3、非退场入仓
if (!isSplitOrderChildren && finishReqVO.getSendMsg() && isNotRollbackIn) { if (!isSplitOrderChildren && finishReqVO.getSendMsg() && isNotRollbackIn) {
// 当没有异常时,才直接发送入仓短信。 有异常时需要在异常处理完后发送入仓短信。且入仓短信发送后不再次发送 // 当没有异常时,才直接发送入仓短信。 有异常时需要在异常处理完后发送入仓短信。且入仓短信发送后不再次发送
OrderConsignorDO orderConsignorDO2 = orderConsignorService.getOne(new LambdaQueryWrapper<OrderConsignorDO>().eq(OrderConsignorDO::getOrderId, orderDO.getOrderId()) OrderConsignorDO orderConsignorDO2 =
orderConsignorService.getOne(new LambdaQueryWrapper<OrderConsignorDO>().eq(OrderConsignorDO::getOrderId, orderDO.getOrderId())
.orderByDesc(OrderConsignorDO::getId) .orderByDesc(OrderConsignorDO::getId)
.last("limit 1")); .last("limit 1"));
orderDO = orderService.getById(orderId); orderDO = orderService.getById(orderId);
...@@ -1381,7 +1386,8 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI ...@@ -1381,7 +1386,8 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
if (exceptionNum == 0) { if (exceptionNum == 0) {
Date appendInTime = new Date(); Date appendInTime = new Date();
if (CollectionUtil.isNotEmpty(orderWarehouseInDOList)) { if (CollectionUtil.isNotEmpty(orderWarehouseInDOList)) {
OrderWarehouseInDO orderWarehouseInDO = orderWarehouseInDOList.stream().max(Comparator.comparing(OrderWarehouseInDO::getId)).get(); OrderWarehouseInDO orderWarehouseInDO =
orderWarehouseInDOList.stream().max(Comparator.comparing(OrderWarehouseInDO::getId)).get();
if (orderWarehouseInDO != null) { if (orderWarehouseInDO != null) {
appendInTime = orderWarehouseInDO.getInTime(); appendInTime = orderWarehouseInDO.getInTime();
} }
...@@ -1427,10 +1433,12 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI ...@@ -1427,10 +1433,12 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
Objects.nonNull(consigneeCustomer.getCustomerService()) && Objects.nonNull(consigneeCustomer.getCustomerService()) &&
(consignorCustomer.getCustomerService().equals(consigneeCustomer.getCustomerService()) || consignorCustomer.getCustomerService() == consigneeCustomer.getCustomerService())) { (consignorCustomer.getCustomerService().equals(consigneeCustomer.getCustomerService()) || consignorCustomer.getCustomerService() == consigneeCustomer.getCustomerService())) {
if (orderConsignorDO2 != null && orderConsignorDO2.getCustomerId() != null) { if (orderConsignorDO2 != null &&
orderConsignorDO2.getCustomerId() != null) {
idSet.add(orderConsignorDO2.getCustomerId()); idSet.add(orderConsignorDO2.getCustomerId());
} }
if (orderConsigneeDO2 != null && orderConsigneeDO2.getCustomerId() != null) { if (orderConsigneeDO2 != null &&
orderConsigneeDO2.getCustomerId() != null) {
idSet.add(orderConsigneeDO2.getCustomerId()); idSet.add(orderConsigneeDO2.getCustomerId());
} }
} }
...@@ -1839,9 +1847,9 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI ...@@ -1839,9 +1847,9 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
// 生成多箱异常 // 生成多箱异常
OrderExceptionCreateReqVO orderExceptionCreateReqVO = OrderExceptionCreateReqVO orderExceptionCreateReqVO =
genOrderException(orderId, null, orderDO, genOrderException(orderId, null, orderDO,
OrderExceptionEnum.ORDER_SUPERFLUOUS_BOX_EXCEPTION, OrderExceptionEnum.ORDER_SUPERFLUOUS_BOX_EXCEPTION,
String.format("超出%d%s", cartonsNumDiff, label), String.format("超出%d%s", cartonsNumDiff, label),
String.format("more than %d %s", cartonsNumDiff, labelEn), String.format("more than %d %s", cartonsNumDiff, labelEn),
null); null);
orderExceptionService.createOrderException(orderExceptionCreateReqVO); orderExceptionService.createOrderException(orderExceptionCreateReqVO);
...@@ -3039,7 +3047,7 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI ...@@ -3039,7 +3047,7 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
//删除储位 //删除储位
orderLocationService.deleteIfPresent(old.getOrderId(), orderLocationService.deleteIfPresent(old.getOrderId(),
old.getOrderItemId(),old.getId()); old.getOrderItemId(), old.getId());
} }
} }
...@@ -3182,7 +3190,7 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI ...@@ -3182,7 +3190,7 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
//删除储位 //删除储位
orderLocationService.deleteIfPresent(old.getOrderId(), orderLocationService.deleteIfPresent(old.getOrderId(),
old.getOrderItemId(),old.getId()); old.getOrderItemId(), old.getId());
} }
} }
...@@ -3421,8 +3429,8 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI ...@@ -3421,8 +3429,8 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
// 通过orderItemId查询db中的 orderWarehouseInDO // 通过orderItemId查询db中的 orderWarehouseInDO
List<OrderWarehouseInDO> orderWarehouseInListOld = List<OrderWarehouseInDO> orderWarehouseInListOld =
orderWarehouseInMapper orderWarehouseInMapper
.selectList(new LambdaQueryWrapperX<OrderWarehouseInDO>().eq(OrderWarehouseInDO::getOrderId, orderId) .selectList(new LambdaQueryWrapperX<OrderWarehouseInDO>().eq(OrderWarehouseInDO::getOrderId, orderId)
.eq(OrderWarehouseInDO::getOrderItemId, orderItemId)); .eq(OrderWarehouseInDO::getOrderItemId, orderItemId));
String details = orderWarehouseApprovalDO.getDetails(); String details = orderWarehouseApprovalDO.getDetails();
if (StringUtils.isNotEmpty(details)) { if (StringUtils.isNotEmpty(details)) {
...@@ -3471,7 +3479,7 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI ...@@ -3471,7 +3479,7 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
//更新的 //更新的
List<OrderWarehouseInItemDto> orderWarehouseInItemDtoListUpdate = List<OrderWarehouseInItemDto> orderWarehouseInItemDtoListUpdate =
orderWarehouseInItemDtoListNew.stream().filter(t -> t.getId() != null orderWarehouseInItemDtoListNew.stream().filter(t -> t.getId() != null
&& orderWarehouseInListOld.stream().anyMatch(old -> old.getId().equals(t.getId()))).collect(Collectors.toList()); && orderWarehouseInListOld.stream().anyMatch(old -> old.getId().equals(t.getId()))).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(orderWarehouseInItemDtoListUpdate)) { if (CollectionUtil.isNotEmpty(orderWarehouseInItemDtoListUpdate)) {
...@@ -3518,7 +3526,7 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI ...@@ -3518,7 +3526,7 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
orderWarehouseInMapper.deleteBatchIds(deleteIds); orderWarehouseInMapper.deleteBatchIds(deleteIds);
//根据订单ID删除储位 //根据订单ID删除储位
orderLocationService.deleteIfPresent(orderId,null,null); orderLocationService.deleteIfPresent(orderId, null, null);
} }
orderItemDO.setNum(updateReqVO.getNum()); orderItemDO.setNum(updateReqVO.getNum());
...@@ -3922,12 +3930,12 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI ...@@ -3922,12 +3930,12 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
List<OrderItemDO> orderItemDOList = List<OrderItemDO> orderItemDOList =
orderItemService.list(new LambdaQueryWrapper<OrderItemDO>() orderItemService.list(new LambdaQueryWrapper<OrderItemDO>()
.eq(OrderItemDO::getOrderId, orderId).orderByAsc(OrderItemDO::getOrderItemId)); .eq(OrderItemDO::getOrderId, orderId).orderByAsc(OrderItemDO::getOrderItemId));
List<OrderWarehouseInDO> orderWarehouseInDOList = List<OrderWarehouseInDO> orderWarehouseInDOList =
orderWarehouseInMapper.selectList( orderWarehouseInMapper.selectList(
new LambdaQueryWrapper<OrderWarehouseInDO>() new LambdaQueryWrapper<OrderWarehouseInDO>()
.eq(OrderWarehouseInDO::getOrderId, .eq(OrderWarehouseInDO::getOrderId,
orderId).orderByAsc(OrderWarehouseInDO::getId)); orderId).orderByAsc(OrderWarehouseInDO::getId));
//订单仓位 //订单仓位
List<OrderLocationDO> orderLocationListByOrderId = List<OrderLocationDO> orderLocationListByOrderId =
...@@ -4961,12 +4969,12 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI ...@@ -4961,12 +4969,12 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
//订单明细 //订单明细
List<OrderItemDO> orderItemDOList = List<OrderItemDO> orderItemDOList =
orderItemService.list(new LambdaQueryWrapper<OrderItemDO>() orderItemService.list(new LambdaQueryWrapper<OrderItemDO>()
.eq(OrderItemDO::getOrderId, orderId).orderByAsc(OrderItemDO::getOrderItemId)); .eq(OrderItemDO::getOrderId, orderId).orderByAsc(OrderItemDO::getOrderItemId));
//ecw_order_warehouse_in 入仓货物详情表 //ecw_order_warehouse_in 入仓货物详情表
List<OrderWarehouseInDO> orderWarehouseInDOList = List<OrderWarehouseInDO> orderWarehouseInDOList =
orderWarehouseInMapper.selectList( orderWarehouseInMapper.selectList(
new LambdaQueryWrapper<OrderWarehouseInDO>() new LambdaQueryWrapper<OrderWarehouseInDO>()
.eq(OrderWarehouseInDO::getOrderId, orderId).orderByAsc(OrderWarehouseInDO::getId)); .eq(OrderWarehouseInDO::getOrderId, orderId).orderByAsc(OrderWarehouseInDO::getId));
if (excludeOrderWarehouseInId != null) { if (excludeOrderWarehouseInId != null) {
orderWarehouseInDOList = orderWarehouseInDOList =
......
...@@ -331,6 +331,8 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe ...@@ -331,6 +331,8 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe
//客户经理 //客户经理
Long customerId = 0L; Long customerId = 0L;
Long saleManid = info.getSalesmanId();
CustomerDO consignorDO = CustomerDO consignorDO =
customerService.getCustomer(info.getConsignorVO().getCustomerId()); customerService.getCustomer(info.getConsignorVO().getCustomerId());
//收货人 //收货人
...@@ -344,6 +346,15 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe ...@@ -344,6 +346,15 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe
//customerId = info.getConsignorVO().getCustomerId(); //customerId = info.getConsignorVO().getCustomerId();
//二期需求修改 //二期需求修改
customerId = consignorDO.getId(); customerId = consignorDO.getId();
//客户的客户经理为空,就把业绩归属设为0
if (consignorDO.getCustomerService() == null ||
consignorDO.getCustomerService() == 0||
consignorDO.getIsInOpenSea()==true) {
saleManid = 0L;
orderService.updateOrderSalesmanId(info.getOrderId(),
0L);
}
} else { } else {
OrderConsigneeDO orderConsigneeDO = OrderConsigneeDO orderConsigneeDO =
orderConsigneeService.getOne( orderConsigneeService.getOne(
...@@ -365,6 +376,14 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe ...@@ -365,6 +376,14 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe
//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2 //发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
if (consignorDO != null) { if (consignorDO != null) {
customerId = consignorDO.getId(); customerId = consignorDO.getId();
//校验客户的客户经理
if (consignorDO.getCustomerService() == null ||
consignorDO.getCustomerService() == 0||
consignorDO.getIsInOpenSea()==true) {
saleManid = 0L;
orderService.updateOrderSalesmanId(info.getOrderId(),
0L);
}
} }
} else { } else {
...@@ -388,13 +407,37 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe ...@@ -388,13 +407,37 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe
if (CollectionUtil.isNotEmpty(offerBackVOList)) { if (CollectionUtil.isNotEmpty(offerBackVOList)) {
//如果是发货人付款且关联报价单,业绩归属发货人 --层级3 第一个 //如果是发货人付款且关联报价单,业绩归属发货人 --层级3 第一个
customerId = consignorDO.getId(); customerId = consignorDO.getId();
//校验客户的客户经理
if (consignorDO.getCustomerService() == null ||
consignorDO.getCustomerService() == 0||
consignorDO.getIsInOpenSea()==true) {
saleManid = 0L;
orderService.updateOrderSalesmanId(info.getOrderId(),
0L);
}
} else { } else {
if (consignorDO.getDefaultPay()) { if (consignorDO.getDefaultPay()) {
//如果是发货人付款且档案设置默认付运费 --层级4 第一个 //如果是发货人付款且档案设置默认付运费 --层级4 第一个
customerId = consignorDO.getId(); customerId = consignorDO.getId();
//校验客户的客户经理
if (consignorDO.getCustomerService() == null ||
consignorDO.getCustomerService() == 0||
consignorDO.getIsInOpenSea()==true) {
saleManid = 0L;
orderService.updateOrderSalesmanId(info.getOrderId(),
0L);
}
} else { } else {
//业绩归属方是收货人 //业绩归属方是收货人
customerId = orderConsigneeDO.getCustomerId(); customerId = orderConsigneeDO.getCustomerId();
//校验客户的客户经理
if (consigneeDO.getCustomerService() == null ||
consigneeDO.getCustomerService() == 0||
consigneeDO.getIsInOpenSea()==true) {
saleManid = 0L;
orderService.updateOrderSalesmanId(info.getOrderId(),
0L);
}
} }
} }
...@@ -402,6 +445,17 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe ...@@ -402,6 +445,17 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe
//收货人付款 层级5 第一个 //收货人付款 层级5 第一个
customerId = orderConsigneeDO.getCustomerId() != null ? customerId = orderConsigneeDO.getCustomerId() != null ?
orderConsigneeDO.getCustomerId() : consigneeDO.getId(); orderConsigneeDO.getCustomerId() : consigneeDO.getId();
if (consigneeDO != null) {
//客户来源是发货人推荐,不保留业绩记录 customer_source
//2024-06-03 添加的逻辑
if (consigneeDO.getSource() == 12) {
//删除业绩记录
targetLogMapper.deleteById(targetId);
orderService.updateOrderSalesmanId(info.getOrderId(),
0L);
return;
}
}
} else if (info.getDrawee() == 3) { } else if (info.getDrawee() == 3) {
//自定义付款 //自定义付款
...@@ -422,23 +476,66 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe ...@@ -422,23 +476,66 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe
(info.getDrawee() == 3 && freight == 1)) { (info.getDrawee() == 3 && freight == 1)) {
//层级3 第二个 订单关联报价单 && 自定义付款 且发货人付运费 //层级3 第二个 订单关联报价单 && 自定义付款 且发货人付运费
customerId = orderConsignorDO.getCustomerId(); customerId = orderConsignorDO.getCustomerId();
//校验客户的客户经理
if (consignorDO.getCustomerService() == null ||
consignorDO.getCustomerService() == 0||
consignorDO.getIsInOpenSea()==true) {
saleManid = 0L;
orderService.updateOrderSalesmanId(info.getOrderId(),
0L);
}
} else if (CollectionUtil.isNotEmpty(offerBackVOList) } else if (CollectionUtil.isNotEmpty(offerBackVOList)
&& (info.getDrawee() == 3 && clearanceFee == 1)) { && (info.getDrawee() == 3 && clearanceFee == 1)) {
//层级3 第三个 订单关联报价单 && 自定义付款 且发货人付清关费 //层级3 第三个 订单关联报价单 && 自定义付款 且发货人付清关费
customerId = orderConsignorDO.getCustomerId(); customerId = orderConsignorDO.getCustomerId();
//校验客户的客户经理
if (consignorDO.getCustomerService() == null ||
consignorDO.getCustomerService() == 0||
consignorDO.getIsInOpenSea()==true) {
saleManid = 0L;
orderService.updateOrderSalesmanId(info.getOrderId(),
0L);
}
} else if (consignorDO.getDefaultPay() && } else if (consignorDO.getDefaultPay() &&
(info.getDrawee() == 3 && freight == 1)) { (info.getDrawee() == 3 && freight == 1)) {
//层级4 第二个 发货人档案设置默认付运费 且发货人付运费 业绩归属 发货人 //层级4 第二个 发货人档案设置默认付运费 且发货人付运费 业绩归属 发货人
customerId = orderConsignorDO.getCustomerId(); customerId = orderConsignorDO.getCustomerId();
//校验客户的客户经理
if (consignorDO.getCustomerService() == null ||
consignorDO.getCustomerService() == 0||
consignorDO.getIsInOpenSea()==true) {
saleManid = 0L;
orderService.updateOrderSalesmanId(info.getOrderId(),
0L);
}
} else if (consignorDO.getDefaultPay() && } else if (consignorDO.getDefaultPay() &&
(info.getDrawee() == 3 (info.getDrawee() == 3
&& clearanceFee == 1)) { && clearanceFee == 1)) {
// 层级4 第三个 发货人档案设置默认付运费 且发货人付清关费 业绩归属发货人 // 层级4 第三个 发货人档案设置默认付运费 且发货人付清关费 业绩归属发货人
customerId = orderConsignorDO.getCustomerId(); customerId = orderConsignorDO.getCustomerId();
//校验客户的客户经理
if (consignorDO.getCustomerService() == null ||
consignorDO.getCustomerService() == 0||
consignorDO.getIsInOpenSea()==true) {
saleManid = 0L;
orderService.updateOrderSalesmanId(info.getOrderId(),
0L);
}
} else { } else {
customerId = orderConsigneeDO.getCustomerId(); customerId = orderConsigneeDO.getCustomerId();
//校验客户的客户经理
if (consigneeDO.getCustomerService() == null ||
consigneeDO.getCustomerService() == 0||
consigneeDO.getIsInOpenSea()==true) {
saleManid = 0L;
orderService.updateOrderSalesmanId(info.getOrderId(),
0L);
}
} }
// if(!consignorDO.getDefaultPay() && (info.getDrawee()==3 && freight==2 ) || (info.getDrawee()==3 && clearanceFee==2)){//层级5 第二、第三点 自定义付款且收款人付运费 或自定义付款且收款人付清关费 ,业绩归属收货人 // if(!consignorDO.getDefaultPay() && (info.getDrawee()==3 && freight==2 ) || (info.getDrawee()==3 && clearanceFee==2)){//层级5 第二、第三点 自定义付款且收款人付运费 或自定义付款且收款人付清关费 ,业绩归属收货人
// customerId = orderConsigneeDO.getCustomerId() ; // customerId = orderConsigneeDO.getCustomerId() ;
...@@ -453,6 +550,17 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe ...@@ -453,6 +550,17 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe
customerId = customerId =
orderConsigneeDO.getCustomerId() != null ? orderConsigneeDO.getCustomerId() != null ?
orderConsigneeDO.getCustomerId() : 0; orderConsigneeDO.getCustomerId() : 0;
//校验客户的客户经理
if (consigneeDO != null) {
if (consigneeDO.getCustomerService() == null ||
consigneeDO.getCustomerService() == 0||
consigneeDO.getIsInOpenSea()==true) {
saleManid = 0L;
orderService.updateOrderSalesmanId(info.getOrderId(),
0L);
}
}
} }
} }
...@@ -462,7 +570,7 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe ...@@ -462,7 +570,7 @@ public class TargetLogServiceImpl extends AbstractService<TargetLogMapper, Targe
//客户ID //客户ID
targetLogDO.setCustomerId(customerId); targetLogDO.setCustomerId(customerId);
//客户经理ID //客户经理ID
targetLogDO.setUserId(info.getSalesmanId()); targetLogDO.setUserId(saleManid);
targetLogDO.setUpdateTime(new Date()); targetLogDO.setUpdateTime(new Date());
targetLogMapper.updateById(targetLogDO); targetLogMapper.updateById(targetLogDO);
......
...@@ -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