Commit 5643d79b authored by liuzeheng's avatar liuzeheng

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

parents 3e71c660 68813a00
...@@ -11,8 +11,12 @@ import lombok.SneakyThrows; ...@@ -11,8 +11,12 @@ import lombok.SneakyThrows;
import lombok.experimental.UtilityClass; import lombok.experimental.UtilityClass;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
...@@ -69,7 +73,7 @@ public class JsonUtils { ...@@ -69,7 +73,7 @@ public class JsonUtils {
* 使用 {@link #parseObject(String, Class)} 时,在@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS) 的场景下, * 使用 {@link #parseObject(String, Class)} 时,在@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS) 的场景下,
* 如果 text 没有 class 属性,则会报错。此时,使用这个方法,可以解决。 * 如果 text 没有 class 属性,则会报错。此时,使用这个方法,可以解决。
* *
* @param text 字符串 * @param text 字符串
* @param clazz 类型 * @param clazz 类型
* @return 对象 * @return 对象
*/ */
...@@ -132,4 +136,32 @@ public class JsonUtils { ...@@ -132,4 +136,32 @@ public class JsonUtils {
} }
} }
/*
lanbm 2024-04-12 add
保存指定的测试信息
*/
public static void SaveLog(String content) {
FileOutputStream outputStream = null;
try {
File file = new File("D:\\ProjectLog\\TestLog.txt");
outputStream = new FileOutputStream(file, true);
Date day = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String s = sdf.format(day);
content = s+":" + content;
byte[] bytes = content.getBytes();
outputStream.write(bytes);
} catch (IOException e) {
e.printStackTrace();
} finally {
if (outputStream != null) {
try {
outputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
} }
package cn.iocoder.yudao.framework.apollo.core.event.Customer;
import lombok.AllArgsConstructor;
import lombok.Data;
/*
lanbm 2024-05-07 添加公海捞取是计算客户类型
*/
@Data
public class CalculateCustomerTypeEvent {
/**
* 客户编码
*/
private String customerNumber;
/*
客户ID
*/
private Long customerId;
/*
新客户经理
*/
private Long oldCustomerService;
/*
老客户经理
*/
private Long newCustomerService;
/*
客户状态:1.线索2.意向3.成交
通过客户状态来判断客户是否是已成交客户
*/
private Integer status;
}
package cn.iocoder.yudao.framework.apollo.core.event.Order;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/*
lanbm 2024-05-13 add
计算订单V值
*/
@Data
public class CalculateOrderVValueEvent {
/*
订单id
*/
private Long orderId;
/*
根据体积或重量计算出的V值
*/
private BigDecimal calVvalue;
/*
业绩产生时间
*/
private Date yejiCreateDate;
}
package cn.iocoder.yudao.framework.apollo.core.event.Order;
import lombok.Data;
/*
lanbm 2024-05-13 add
在创建订单或修改订单时计算客户业绩类型
*/
@Data
public class CalculateOrderYeJiTypeEvent {
/*
业绩归属方ID
*/
private long customerId;
/*
订单id
*/
private Long orderId;
}
...@@ -21,6 +21,9 @@ public class BmpFinanceCommissionPaymentApproveListener extends BpmProcessInstan ...@@ -21,6 +21,9 @@ public class BmpFinanceCommissionPaymentApproveListener extends BpmProcessInstan
@Override @Override
protected void onEvent(BpmProcessInstanceResultEvent event) { protected void onEvent(BpmProcessInstanceResultEvent event) {
//lanbm 2024-05-13 添加注释
//ecw_payment 付款单审批回调函数
//ecw_payment_approval 付款单审核表
log.info("--------------------------------------------{},{}", event.getBusinessKey(), event.getResult()); log.info("--------------------------------------------{},{}", event.getBusinessKey(), event.getResult());
financePaymentApproveService.financeApproveCallBack(WorkFlowEmus.FINANCE_COMMISSION_PAYMENT_APPROVE.getKey(), event.getBusinessKey(), event.getResult()); financePaymentApproveService.financeApproveCallBack(WorkFlowEmus.FINANCE_COMMISSION_PAYMENT_APPROVE.getKey(), event.getBusinessKey(), event.getResult());
} }
......
...@@ -24,6 +24,9 @@ public class BmpFinanceReceiptApproveListener extends BpmProcessInstanceResultEv ...@@ -24,6 +24,9 @@ public class BmpFinanceReceiptApproveListener extends BpmProcessInstanceResultEv
@Override @Override
protected void onEvent(BpmProcessInstanceResultEvent event) { protected void onEvent(BpmProcessInstanceResultEvent event) {
//lanbm 2024-05-13添加注释
//财务收款单 ecw_receipt
//收款单或者收款明细审核表 ecw_receipt_approval
log.info("--------------------------------------------{},{}", event.getBusinessKey(), event.getResult()); log.info("--------------------------------------------{},{}", event.getBusinessKey(), event.getResult());
financeReceiptApproveService.financeApproveCallBack(WorkFlowEmus.FINANCE_RECEIPT_APPROVE.getKey(), event.getBusinessKey(), event.getResult()); financeReceiptApproveService.financeApproveCallBack(WorkFlowEmus.FINANCE_RECEIPT_APPROVE.getKey(), event.getBusinessKey(), event.getResult());
} }
......
...@@ -8,8 +8,11 @@ import cn.hutool.core.util.BooleanUtil; ...@@ -8,8 +8,11 @@ import cn.hutool.core.util.BooleanUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.apollo.core.event.AssignConfirmedCustomerEvent; import cn.iocoder.yudao.framework.apollo.core.event.AssignConfirmedCustomerEvent;
import cn.iocoder.yudao.framework.apollo.core.event.Customer.ReceiveCustomerCalTypeEvent;
import cn.iocoder.yudao.framework.apollo.core.event.AutoProcessNotCustomerServiceExceptionEvent; import cn.iocoder.yudao.framework.apollo.core.event.AutoProcessNotCustomerServiceExceptionEvent;
import cn.iocoder.yudao.framework.apollo.core.event.Customer.ReceiveCustomerCalTypeEvent;
import cn.iocoder.yudao.framework.apollo.core.event.QueryEstimateEnterOpenSeaTimeEvent; import cn.iocoder.yudao.framework.apollo.core.event.QueryEstimateEnterOpenSeaTimeEvent;
import cn.iocoder.yudao.framework.apollo.core.event.Customer.CalculateCustomerTypeEvent;
import cn.iocoder.yudao.framework.apollo.core.vo.ApplyInfoVO; import cn.iocoder.yudao.framework.apollo.core.vo.ApplyInfoVO;
import cn.iocoder.yudao.framework.common.exception.ServiceException; import cn.iocoder.yudao.framework.common.exception.ServiceException;
import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil; import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;
...@@ -517,6 +520,19 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome ...@@ -517,6 +520,19 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome
//分配确认接收回调 //分配确认接收回调
applicationContext.publishEvent(new AssignConfirmedCustomerEvent(customerId,customerNew.getCustomerService())); applicationContext.publishEvent(new AssignConfirmedCustomerEvent(customerId,customerNew.getCustomerService()));
//完善客户信息顺便确认接收,对客户类型做逻辑运算
//lanbm 2024-05-08 添加接收确认后判断客户是新客户还是老客户逻辑
//前面的逻辑有可能改了客户的业绩类型,需要再次获取客户信息
CustomerDO customer2 = customerMapper.selectById(customerId);
ReceiveCustomerCalTypeEvent event=new ReceiveCustomerCalTypeEvent();
event.setCustomerId(customerId);
event.setCustomerNumber(customer2.getNumber());
event.setIsNew(customer2.getIsNew());
applicationContext.publishEvent(event);
//end lanbm 2024-05-08 添加接收确认后判断客户是新客户还是老客户逻辑
} else { } else {
//纪录编辑日志 //纪录编辑日志
customerOperateLogCreateReqVO.setOperateType(CustomerOperateTypeEnum.UPDATE.getValue()) customerOperateLogCreateReqVO.setOperateType(CustomerOperateTypeEnum.UPDATE.getValue())
...@@ -2391,6 +2407,8 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome ...@@ -2391,6 +2407,8 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome
// 当新客户(已有已装柜订单)分配给其他客户经理,客户经理接收后,业绩类型变成老客户 // 当新客户(已有已装柜订单)分配给其他客户经理,客户经理接收后,业绩类型变成老客户
// 其他情况不需更新注:业绩类型只会从新客户更新到老客户,不反向更新 // 其他情况不需更新注:业绩类型只会从新客户更新到老客户,不反向更新
if (Boolean.TRUE.equals(customer.getIsNew())) { if (Boolean.TRUE.equals(customer.getIsNew())) {
//根据部门业绩日志表中的信息把新客户变为老客户 lanbm 2024-05-08 添加注释
//ecw_target_log 部门业绩日志表
customerMapper.updateCustomerIsNewToOldByTargetLog(customerId); customerMapper.updateCustomerIsNewToOldByTargetLog(customerId);
} }
...@@ -2412,6 +2430,15 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome ...@@ -2412,6 +2430,15 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome
//分配确认接收回调 //分配确认接收回调
applicationContext.publishEvent(new AssignConfirmedCustomerEvent(customerId,customerService)); applicationContext.publishEvent(new AssignConfirmedCustomerEvent(customerId,customerService));
//lanbm 2024-05-08 添加接收确认后判断客户是新客户还是老客户逻辑
//前面的逻辑有可能改了客户的业绩类型,需要再次获取客户信息
CustomerDO customer2 = customerMapper.selectById(customerId);
ReceiveCustomerCalTypeEvent event=new ReceiveCustomerCalTypeEvent();
event.setCustomerId(customerId);
event.setCustomerNumber(customer2.getNumber());
event.setIsNew(customer2.getIsNew());
applicationContext.publishEvent(event);
//end lanbm 2024-05-08 添加接收确认后判断客户是新客户还是老客户逻辑
} }
private Date getEstimateTimeByCustomerStatus(CustomerDO customer, Date now) { private Date getEstimateTimeByCustomerStatus(CustomerDO customer, Date now) {
...@@ -2435,7 +2462,7 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome ...@@ -2435,7 +2462,7 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void catchCustomer(Long customerId) { public void catchCustomer(Long customerId) {
//lanbm 2024-05-07 添加客户业绩类型逻辑
//捞取公海池客户 //捞取公海池客户
CustomerDO customer = customerMapper.selectById(customerId); CustomerDO customer = customerMapper.selectById(customerId);
if (customer == null) { if (customer == null) {
...@@ -2455,6 +2482,7 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome ...@@ -2455,6 +2482,7 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome
throw exception(ErrorCodeConstants.CUSTOMER_CATCH_ERROR); throw exception(ErrorCodeConstants.CUSTOMER_CATCH_ERROR);
} }
// if (!user.getPostIds().contains(adminUserApi.getActiveCustomerServicePostId())) { // if (!user.getPostIds().contains(adminUserApi.getActiveCustomerServicePostId())) {
//判断当前用户的角色 lanbm 2024-05-07 添加注释
if (!user.getPostIds().contains(2L) && !user.getPostIds().contains(19L)) { if (!user.getPostIds().contains(2L) && !user.getPostIds().contains(19L)) {
throw exception(ErrorCodeConstants.CUSTOMER_CATCH_ERROR); throw exception(ErrorCodeConstants.CUSTOMER_CATCH_ERROR);
} }
...@@ -2530,6 +2558,7 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome ...@@ -2530,6 +2558,7 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome
Long newCustomerService = loginUserId; Long newCustomerService = loginUserId;
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
//保存客户捞取记录 lanbm 2024-05-07 添加注释
CustomerOperateLogCreateReqVO customerOperateLogCreateReqVO = new CustomerOperateLogCreateReqVO() CustomerOperateLogCreateReqVO customerOperateLogCreateReqVO = new CustomerOperateLogCreateReqVO()
.setOperator(loginUser == null ? null : loginUser.getId()) .setOperator(loginUser == null ? null : loginUser.getId())
.setOperatorName(loginUser == null ? null : loginUser.getNickname()) .setOperatorName(loginUser == null ? null : loginUser.getNickname())
...@@ -2549,15 +2578,29 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome ...@@ -2549,15 +2578,29 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome
log.info("公海池捞取客户[{}]包含海运整柜,设置不掉入公海", customer.getId()); log.info("公海池捞取客户[{}]包含海运整柜,设置不掉入公海", customer.getId());
} }
// 记录catch时间 //记录catch时间
//对应的数据库表为 ecw_customer_public_catch_log
customerPublicCatchLogMapper.insert(new CustomerPublicCatchLogDO(null, customer.getId(), loginUserId)); customerPublicCatchLogMapper.insert(new CustomerPublicCatchLogDO(null, customer.getId(), loginUserId));
//捞取完后 自动处理未分配客户经理异常 //捞取完后 自动处理未分配客户经理异常
applicationContext.publishEvent(new AutoProcessNotCustomerServiceExceptionEvent(customer.getNumber())); applicationContext.publishEvent(new AutoProcessNotCustomerServiceExceptionEvent(customer.getNumber()));
//lanbm 2024-05-07 添加捞取后修改客户是否为新客户的相关逻辑
CalculateCustomerTypeEvent cevent=new CalculateCustomerTypeEvent();
cevent.setCustomerNumber(customer.getNumber());
cevent.setStatus(customer.getStatus());
cevent.setOldCustomerService(newCustomerService);
cevent.setOldCustomerService(oldCustomerService);
cevent.setCustomerId(customer.getId());
applicationContext.publishEvent(cevent);
//end lanbm 2024-05-07 添加捞取后修改客户是否为新客户的相关逻辑
} }
/*
接收客户,lanbm 2024-05-08 添加客户业绩类型逻辑运算
*/
public void receiveCustomer(Long customerId, Long customerServiceId) { public void receiveCustomer(Long customerId, Long customerServiceId) {
CustomerDO customerDO = customerMapper.selectById(customerId); CustomerDO customerDO = customerMapper.selectById(customerId);
if (customerDO != null) { if (customerDO != null) {
...@@ -2611,6 +2654,18 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome ...@@ -2611,6 +2654,18 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome
//分配确认接收回调 //分配确认接收回调
applicationContext.publishEvent(new AssignConfirmedCustomerEvent(customerId,customerDO.getCustomerService())); applicationContext.publishEvent(new AssignConfirmedCustomerEvent(customerId,customerDO.getCustomerService()));
//报价成功后就会确认接收客户,所以在此做客户类型逻辑运算
//lanbm 2024-05-08 add
//lanbm 2024-05-08 添加接收确认后判断客户是新客户还是老客户逻辑
//前面的逻辑有可能改了客户的业绩类型,需要再次获取客户信息
CustomerDO customer2 = customerMapper.selectById(customerId);
ReceiveCustomerCalTypeEvent event=new ReceiveCustomerCalTypeEvent();
event.setCustomerId(customerId);
event.setCustomerNumber(customer2.getNumber());
event.setIsNew(customer2.getIsNew());
applicationContext.publishEvent(event);
//end lanbm 2024-05-08 添加接收确认后判断客户是新客户还是老客户逻辑
} }
} }
} }
......
...@@ -129,6 +129,7 @@ public class CustomerController { ...@@ -129,6 +129,7 @@ public class CustomerController {
@Resource @Resource
private FileMakeApi fileMakeApi; private FileMakeApi fileMakeApi;
public CustomerController() { public CustomerController() {
} }
...@@ -291,6 +292,7 @@ public class CustomerController { ...@@ -291,6 +292,7 @@ public class CustomerController {
//完善信息要确认接收 //完善信息要确认接收
updateReqVO.setIsCustomerServiceConfirmed(true); updateReqVO.setIsCustomerServiceConfirmed(true);
//lanbm 2024-05-08 完善客户信息确认接收时要计算客户的业绩类型
return this.updateCustomer(updateReqVO); return this.updateCustomer(updateReqVO);
} }
...@@ -448,8 +450,6 @@ public class CustomerController { ...@@ -448,8 +450,6 @@ public class CustomerController {
} }
// @GetMapping("/handover/approval/info") // @GetMapping("/handover/approval/info")
// @ApiOperation("获取客户移交的审批详情") // @ApiOperation("获取客户移交的审批详情")
// // @PreAuthorize("@ss.hasPermission('ecw:customer:query')") // // @PreAuthorize("@ss.hasPermission('ecw:customer:query')")
...@@ -510,12 +510,11 @@ public class CustomerController { ...@@ -510,12 +510,11 @@ public class CustomerController {
@ApiOperation("跟进客户确认接收") @ApiOperation("跟进客户确认接收")
@PreAuthorize("@ss.hasPermission('ecw:customer:treat-accept')") @PreAuthorize("@ss.hasPermission('ecw:customer:treat-accept')")
@Idempotent(timeout = 5) @Idempotent(timeout = 5)
public CommonResult<Boolean> confirm(@Valid @RequestBody CustomerConfirmReqVO customerConfirmReqVO) { public CommonResult<Boolean> confirm(
@Valid @RequestBody CustomerConfirmReqVO customerConfirmReqVO) {
//lanbm 2024-05-08 添加接收确认后判断客户是新客户还是老客户逻辑
Long id = customerConfirmReqVO.getCustomerId(); Long id = customerConfirmReqVO.getCustomerId();
customerService.confirmCustomer(id); customerService.confirmCustomer(id);
return success(true); return success(true);
} }
...@@ -565,7 +564,8 @@ public class CustomerController { ...@@ -565,7 +564,8 @@ public class CustomerController {
@PreAuthorize("@ss.hasPermission('ecw:customer:sea-gain')") @PreAuthorize("@ss.hasPermission('ecw:customer:sea-gain')")
@Idempotent(timeout = 5) @Idempotent(timeout = 5)
public CommonResult<Boolean> catchCustomer(@RequestParam("id") Long id) { public CommonResult<Boolean> catchCustomer(@RequestParam("id") Long id) {
//公海池捞取客户,修改客户业绩类型需要调整此处的逻辑
//lanbm 2024-05-07 处理
customerService.catchCustomer(id); customerService.catchCustomer(id);
return success(true); return success(true);
...@@ -618,7 +618,7 @@ public class CustomerController { ...@@ -618,7 +618,7 @@ public class CustomerController {
@ApiOperation("全部客户导出") @ApiOperation("全部客户导出")
@OperateLog(type = EXPORT) @OperateLog(type = EXPORT)
public CommonResult<Boolean> exportCustomerExcel(@Valid CustomerExportReqVO exportReqVO, public CommonResult<Boolean> exportCustomerExcel(@Valid CustomerExportReqVO exportReqVO,
HttpServletResponse response) throws IOException { HttpServletResponse response) throws IOException {
sendFileMake(exportReqVO, DownloadTypeEnum.CUSTOMER_EXCEL_EXPORT, "客户导出Excel"); sendFileMake(exportReqVO, DownloadTypeEnum.CUSTOMER_EXCEL_EXPORT, "客户导出Excel");
return success(true); return success(true);
} }
...@@ -627,7 +627,7 @@ public class CustomerController { ...@@ -627,7 +627,7 @@ public class CustomerController {
@ApiOperation("我的客户列表导出") @ApiOperation("我的客户列表导出")
@OperateLog(type = EXPORT) @OperateLog(type = EXPORT)
public CommonResult<Boolean> exportMyCustomerExcel(@Valid CustomerExportReqVO exportReqVO, public CommonResult<Boolean> exportMyCustomerExcel(@Valid CustomerExportReqVO exportReqVO,
HttpServletResponse response) throws IOException { HttpServletResponse response) throws IOException {
exportReqVO.setCustomerService(WebFrameworkUtils.getLoginUserId()); exportReqVO.setCustomerService(WebFrameworkUtils.getLoginUserId());
//未被接收 //未被接收
...@@ -643,7 +643,7 @@ public class CustomerController { ...@@ -643,7 +643,7 @@ public class CustomerController {
@ApiOperation("我的待接收客户列表导出") @ApiOperation("我的待接收客户列表导出")
@OperateLog(type = EXPORT) @OperateLog(type = EXPORT)
public CommonResult<Boolean> exportWaiteConfirmCustomerExcel(@Valid CustomerExportReqVO exportReqVO, public CommonResult<Boolean> exportWaiteConfirmCustomerExcel(@Valid CustomerExportReqVO exportReqVO,
HttpServletResponse response) throws IOException { HttpServletResponse response) throws IOException {
sendFileMake(exportReqVO, DownloadTypeEnum.CUSTOMER_WAIT_CONFIRM_PUBLIC_EXCEL_EXPORT, "我的待接收客户导出Excel"); sendFileMake(exportReqVO, DownloadTypeEnum.CUSTOMER_WAIT_CONFIRM_PUBLIC_EXCEL_EXPORT, "我的待接收客户导出Excel");
return success(true); return success(true);
} }
...@@ -652,7 +652,7 @@ public class CustomerController { ...@@ -652,7 +652,7 @@ public class CustomerController {
@ApiOperation("公海池客户列表导出") @ApiOperation("公海池客户列表导出")
@OperateLog(type = EXPORT) @OperateLog(type = EXPORT)
public CommonResult<Boolean> exportPublicCustomerExcel(@Valid CustomerExportReqVO exportReqVO, public CommonResult<Boolean> exportPublicCustomerExcel(@Valid CustomerExportReqVO exportReqVO,
HttpServletResponse response) throws IOException { HttpServletResponse response) throws IOException {
sendFileMake(exportReqVO, DownloadTypeEnum.CUSTOMER_PUBLIC_EXCEL_EXPORT, "公海池客户导出Excel"); sendFileMake(exportReqVO, DownloadTypeEnum.CUSTOMER_PUBLIC_EXCEL_EXPORT, "公海池客户导出Excel");
return success(true); return success(true);
...@@ -662,7 +662,7 @@ public class CustomerController { ...@@ -662,7 +662,7 @@ public class CustomerController {
@ApiOperation("待分配客户列表导出") @ApiOperation("待分配客户列表导出")
@OperateLog(type = EXPORT) @OperateLog(type = EXPORT)
public CommonResult<Boolean> exportWaitDistributionCustomerExcel(@Valid CustomerExportReqVO exportReqVO, public CommonResult<Boolean> exportWaitDistributionCustomerExcel(@Valid CustomerExportReqVO exportReqVO,
HttpServletResponse response) throws IOException { HttpServletResponse response) throws IOException {
sendFileMake(exportReqVO, DownloadTypeEnum.CUSTOMER_WAIT_DISTRIBUTION_PUBLIC_EXCEL_EXPORT, "待分配客户导出Excel"); sendFileMake(exportReqVO, DownloadTypeEnum.CUSTOMER_WAIT_DISTRIBUTION_PUBLIC_EXCEL_EXPORT, "待分配客户导出Excel");
return success(true); return success(true);
} }
...@@ -671,7 +671,7 @@ public class CustomerController { ...@@ -671,7 +671,7 @@ public class CustomerController {
@ApiOperation("潜在客户列表导出") @ApiOperation("潜在客户列表导出")
@OperateLog(type = EXPORT) @OperateLog(type = EXPORT)
public CommonResult<Boolean> exportPotentialCustomerExcel(@Valid CustomerExportReqVO exportReqVO, public CommonResult<Boolean> exportPotentialCustomerExcel(@Valid CustomerExportReqVO exportReqVO,
HttpServletResponse response) throws IOException { HttpServletResponse response) throws IOException {
if (exportReqVO.getCustomerService() != null) { if (exportReqVO.getCustomerService() != null) {
exportReqVO.setIsInOpenSea(false); exportReqVO.setIsInOpenSea(false);
} }
...@@ -686,7 +686,7 @@ public class CustomerController { ...@@ -686,7 +686,7 @@ public class CustomerController {
@ApiOperation("部门客户列表导出") @ApiOperation("部门客户列表导出")
@OperateLog(type = EXPORT) @OperateLog(type = EXPORT)
public CommonResult<Boolean> exportDeptCustomerExcel(@Valid CustomerExportReqVO exportReqVO, public CommonResult<Boolean> exportDeptCustomerExcel(@Valid CustomerExportReqVO exportReqVO,
HttpServletResponse response) throws IOException { HttpServletResponse response) throws IOException {
sendFileMake(exportReqVO, DownloadTypeEnum.CUSTOMER_DEPT_EXCEL_EXPORT, "部门客户导出Excel"); sendFileMake(exportReqVO, DownloadTypeEnum.CUSTOMER_DEPT_EXCEL_EXPORT, "部门客户导出Excel");
return success(true); return success(true);
} }
...@@ -731,7 +731,6 @@ public class CustomerController { ...@@ -731,7 +731,6 @@ public class CustomerController {
} }
@PutMapping("/change-customer-fcl") @PutMapping("/change-customer-fcl")
@ApiOperation("设置客户为海运整柜客户/非海运整柜客户") @ApiOperation("设置客户为海运整柜客户/非海运整柜客户")
@PreAuthorize("@ss.hasPermission('ecw:customer:fcl')") @PreAuthorize("@ss.hasPermission('ecw:customer:fcl')")
...@@ -756,7 +755,6 @@ public class CustomerController { ...@@ -756,7 +755,6 @@ public class CustomerController {
} }
@PutMapping("/update-customer-to-old") @PutMapping("/update-customer-to-old")
@ApiOperation("根据客户经理id更新成交状态的新客户为老客户") @ApiOperation("根据客户经理id更新成交状态的新客户为老客户")
@ApiImplicitParam(name = "customerServiceId", value = "客户经理id", required = true, example = "1024", dataTypeClass = Long.class) @ApiImplicitParam(name = "customerServiceId", value = "客户经理id", required = true, example = "1024", dataTypeClass = Long.class)
......
...@@ -63,8 +63,6 @@ public class CustomerAnalysisControl { ...@@ -63,8 +63,6 @@ public class CustomerAnalysisControl {
@Autowired @Autowired
private CustomerAnalysisService customerAnalysisService; private CustomerAnalysisService customerAnalysisService;
@Resource
private CustomerAnalysisService2 customerAnalysisService2;
//报表权限信息 //报表权限信息
@Resource @Resource
...@@ -73,8 +71,7 @@ public class CustomerAnalysisControl { ...@@ -73,8 +71,7 @@ public class CustomerAnalysisControl {
@Resource @Resource
private RedisHelper redisHelper; private RedisHelper redisHelper;
@Resource
private view_order_businesstimeService vieworderbusinesstimeService;
private List<view_order_businesstime> listBData = null; private List<view_order_businesstime> listBData = null;
private List<CustomerAnalysisResp> objListResult = null; private List<CustomerAnalysisResp> objListResult = null;
......
...@@ -3,9 +3,11 @@ package cn.iocoder.yudao.module.delivery.controller.admin; ...@@ -3,9 +3,11 @@ package cn.iocoder.yudao.module.delivery.controller.admin;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.delivery.entity.EcwVz; import cn.iocoder.yudao.module.delivery.entity.EcwVz;
import cn.iocoder.yudao.module.delivery.entity.EcwVzPageReq; import cn.iocoder.yudao.module.delivery.entity.EcwVzPageReq;
import cn.iocoder.yudao.module.delivery.listener.TestEvent;
import cn.iocoder.yudao.module.delivery.service.EcwVzService; import cn.iocoder.yudao.module.delivery.service.EcwVzService;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import org.springframework.context.ApplicationContext;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -28,6 +30,10 @@ public class EcwVzController { ...@@ -28,6 +30,10 @@ public class EcwVzController {
@Resource @Resource
private EcwVzService ecwVzService; private EcwVzService ecwVzService;
@Resource
private ApplicationContext applicationContext;
private final String HYPG = "海运拼柜"; private final String HYPG = "海运拼柜";
private final String ZXKY = "专线空运"; private final String ZXKY = "专线空运";
...@@ -114,5 +120,15 @@ public class EcwVzController { ...@@ -114,5 +120,15 @@ public class EcwVzController {
return success(this.ecwVzService.selectPage(PageReq)); return success(this.ecwVzService.selectPage(PageReq));
} }
@GetMapping("/Test")
@Operation(summary = "测试功能")
public CommonResult<Boolean> Test() {
TestEvent even=new TestEvent();
even.setName("测试事件监听");
applicationContext.publishEvent(even);
return success(true);
}
} }
package cn.iocoder.yudao.module.delivery.entity.orderdata;
import lombok.Data;
/*
订单业务逻辑的相关判断 lanbm 2024-05-07 add
此参数暂时未使用
*/
@Data
public class OrderExt {
}
...@@ -6,4 +6,11 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode; ...@@ -6,4 +6,11 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode;
public interface ErrorCodeConstants { public interface ErrorCodeConstants {
ErrorCode TEST_NOT_EXISTS = new ErrorCode(2004020001, "单号配置不存在"); ErrorCode TEST_NOT_EXISTS = new ErrorCode(2004020001, "单号配置不存在");
}
\ No newline at end of file //ErrorCode ORDER_NOT_EXISTS = new ErrorCode(2004020002, "订单不存在");
//lanbm 2024-05-13 add
ErrorCode CUSTOMER_NOT_EXISTS = new ErrorCode(2004020003, "客户不存在");
ErrorCode VCONFIG_NOT_EXISTS = new ErrorCode(2004020004, "V值配置参数不存在");
}
package cn.iocoder.yudao.module.delivery.listener;
import cn.iocoder.yudao.framework.apollo.core.event.Customer.CalculateCustomerTypeEvent;
import cn.iocoder.yudao.module.customer.service.customer.CustomerService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/*
lanbm 2024-05-07 add
*/
@Component("CalculateCustomerType")
@AllArgsConstructor
@Slf4j
public class CalculateCustomerType {
//监听公海捞取事件,计算客户是新客户类型还是老客户类型,此字段用户计算订单业绩类型
@Resource
private CustomerService customerService;
/**
* 客户捞取监听事件 lanbm 2024-05-07 add
* @param event
*/
@EventListener(CalculateCustomerTypeEvent.class)
public void CalculateCustomerTypePushEvent(
CalculateCustomerTypeEvent event) {
if (event.getNewCustomerService() == event.getOldCustomerService()) {
//新客户经理和老客户经理是同一客户经理
//继续判断有无成交记录
//有成交记录 客户业绩类型=老客户
//没成交记录 客户业绩类型=新客户
boolean bR = isHaving_TransactionRecords(event);
if (bR == true) {
//有成交记录
customerService.updateCustomerNewOrOld(event.getCustomerId(),
false);
} else {
//无成交记录
customerService.updateCustomerNewOrOld(event.getCustomerId(),
true);
}
} else {
//新客户经理和老客户经理不是同一客户经理
//客户业绩类型=新客户
customerService.updateCustomerNewOrOld(event.getCustomerId(), true);
}
}
/*
通过客户状态来判断有无成交记录
1.线索2.意向3.成交
*/
private boolean isHaving_TransactionRecords(CalculateCustomerTypeEvent event) {
if (event.getStatus() == 3)
return true;
else
return false;
}
}
package cn.iocoder.yudao.module.delivery.listener;
import cn.iocoder.yudao.framework.apollo.core.event.Order.CalculateOrderVValueEvent;
import cn.iocoder.yudao.framework.apollo.core.event.Order.CalculateOrderYeJiTypeEvent;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO;
import cn.iocoder.yudao.module.customer.service.customer.CustomerService;
import cn.iocoder.yudao.module.delivery.entity.EcwVz;
import cn.iocoder.yudao.module.delivery.service.EcwVzService;
import cn.iocoder.yudao.module.order.dal.dataobject.order.OrderDO;
import cn.iocoder.yudao.module.order.service.order.OrderService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.util.Date;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.module.order.enums.ErrorCodeConstants.ORDER_EXPRESS_NUMBER_TOO_LONG;
import static cn.iocoder.yudao.module.order.enums.ErrorCodeConstants.ORDER_NOT_EXISTS;
import static cn.iocoder.yudao.module.delivery.enums.ErrorCodeConstants.VCONFIG_NOT_EXISTS;
/*
计算订单V值计算 海运已装柜,空运已入仓 计算V值
lanbm 2024-05-13 add
*/
@Component("CalculateOrderVValueListener")
@AllArgsConstructor
@Slf4j
public class CalculateOrderVValueListener {
@Autowired
private OrderService orderService;
@Autowired
private EcwVzService ecwVzService;
@EventListener(CalculateOrderVValueEvent.class)
public void CalculateOrderVValuePushEvent(
CalculateOrderVValueEvent event) {
OrderDO orderDO = orderService.getById(event.getOrderId());
if (orderDO == null) {
throw exception(ORDER_NOT_EXISTS);
}
//订单状态为已入仓之后的状态,其他状态是否排除,后续和客户确认,先按此逻辑处理
int nS = orderDO.getStatus();
if (nS >= 5) {
//查询配置参数信息
EcwVz temp = null;
BigDecimal CalVvalue = new BigDecimal(0);
if (orderDO.getTransportId() == 1) {
//海运计算V值
temp = ecwVzService.getOne(new LambdaQueryWrapperX<EcwVz>()
.eqIfPresent(EcwVz::getTitleZh, "M3"));
if (temp == null) {
throw exception(VCONFIG_NOT_EXISTS);
}
CalVvalue = new BigDecimal(temp.getVz()).divide(orderDO.getSumVolume());
} else if (orderDO.getTransportId() == 3) {
//空运计算V值
temp = ecwVzService.getOne(new LambdaQueryWrapperX<EcwVz>()
.eqIfPresent(EcwVz::getTitleZh, "KG"));
if (temp == null) {
throw exception(VCONFIG_NOT_EXISTS);
}
CalVvalue = new BigDecimal(temp.getVz()).divide(orderDO.getSumWeight());
}
//计算业绩产生时间
if (orderDO.getRucangTime() == null) {
event.setYejiCreateDate(new Date());
} else {
event.setYejiCreateDate(orderDO.getRucangTime());
}
orderService.UpdateOrderVValue(event.getOrderId(), CalVvalue,
event.getYejiCreateDate());
}
}
}
package cn.iocoder.yudao.module.delivery.listener;
import cn.iocoder.yudao.framework.apollo.core.event.Customer.CalculateCustomerTypeEvent;
import cn.iocoder.yudao.framework.apollo.core.event.Order.CalculateOrderYeJiTypeEvent;
import cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO;
import cn.iocoder.yudao.module.customer.service.customer.CustomerService;
import cn.iocoder.yudao.module.order.dal.dataobject.order.OrderDO;
import cn.iocoder.yudao.module.order.service.order.OrderService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.delivery.enums.ErrorCodeConstants.CUSTOMER_NOT_EXISTS;
import static cn.iocoder.yudao.module.order.enums.ErrorCodeConstants.ORDER_NOT_EXISTS;
/*
计算订单业绩类型监听
lanbm 2024-05-13 add
*/
@Component("CalculateOrderYeJiTypeListener")
@AllArgsConstructor
@Slf4j
public class CalculateOrderYeJiTypeListener {
@Autowired
private OrderService orderService;
@Autowired
private CustomerService customerService;
@EventListener(CalculateOrderYeJiTypeEvent.class)
public void CalculateOrderYeJiTypePushEvent(
CalculateOrderYeJiTypeEvent event) {
OrderDO orderDO = orderService.getById(event.getOrderId());
if (orderDO == null) {
throw exception(ORDER_NOT_EXISTS);
}
//获取订单中计算号的业绩归属客户ID
event.setCustomerId(orderDO.getCustomerId());
CustomerDO customerDO = customerService.getById(event.getCustomerId());
if (customerDO == null) {
throw exception(CUSTOMER_NOT_EXISTS);
}
int isNew = 0;
if (customerDO.getIsNew() == true)
isNew = 1;//新客户业绩类型
else
isNew = 0;//老客户业绩类型
orderService.UpdateOrderYeJiType(event.getOrderId(), isNew);
}
}
...@@ -76,17 +76,14 @@ public class CustomerAnalysisExcelExportListener { ...@@ -76,17 +76,14 @@ public class CustomerAnalysisExcelExportListener {
concat("客户分析报表.xlsx"); concat("客户分析报表.xlsx");
List<CustomerAnalysisResp> list = List<CustomerAnalysisResp> list =
customerAnalysisService.getList(query); customerAnalysisService.GetDataListResult(query);
//把查询列表转换位Excel对象
List<CustomerAnalysisExcelResp> listExel = List<CustomerAnalysisExcelResp> listExel =
CustomerAnalysis.INSTANCE.convertList(list); CustomerAnalysis.INSTANCE.convertList(list);
String path = ExcelUtils.write(dir, fileName, String path = ExcelUtils.write(dir, fileName,
"客户分析报表", "客户分析报表",
CustomerAnalysisExcelResp.class, CustomerAnalysisExcelResp.class,
listExel); listExel);
// 获取到临时文件 // 获取到临时文件
File file = new File(path); File file = new File(path);
// 创建FileInputStream对象 // 创建FileInputStream对象
......
package cn.iocoder.yudao.module.delivery.mapper;
import cn.iocoder.yudao.framework.apollo.core.event.Customer.ReceiveCustomerCalTypeEvent;
import cn.iocoder.yudao.module.delivery.entity.orderdata.OrderExt;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface OrderExtMapper {
/*
客户为发货方是否有订单
*/
int IsHavingOrderConsignor(ReceiveCustomerCalTypeEvent event);
/*
客户为收货方是否有订单
*/
int IsHavingOrderConsignee(ReceiveCustomerCalTypeEvent event);
/*
上面2个函数废弃不用了,用此函数来判断客户是否已经产生了订单
*/
int IsHavingOrder(ReceiveCustomerCalTypeEvent event);
}
...@@ -10,6 +10,8 @@ import java.util.List; ...@@ -10,6 +10,8 @@ import java.util.List;
public interface CustomerAnalysisService { public interface CustomerAnalysisService {
PageResult<CustomerAnalysisResp> getListPage(CustomerAnalysisReq req) PageResult<CustomerAnalysisResp> getListPage(CustomerAnalysisReq req)
throws JsonProcessingException; throws JsonProcessingException;
......
...@@ -10,6 +10,7 @@ import cn.iocoder.yudao.module.delivery.service.EcwVzService; ...@@ -10,6 +10,7 @@ import cn.iocoder.yudao.module.delivery.service.EcwVzService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.*; import java.util.*;
import javax.validation.Valid; import javax.validation.Valid;
...@@ -20,82 +21,80 @@ import javax.validation.Valid; ...@@ -20,82 +21,80 @@ import javax.validation.Valid;
* @since 2024-04-02 22:38:22 * @since 2024-04-02 22:38:22
*/ */
@Service("ecwVzService") @Service("ecwVzService")
public class EcwVzServiceImpl extends ServiceImpl<EcwVzMapper,EcwVz> implements EcwVzService { public class EcwVzServiceImpl extends ServiceImpl<EcwVzMapper, EcwVz> implements EcwVzService {
@Autowired @Autowired
private EcwVzMapper ecwVzMapper; private EcwVzMapper ecwVzMapper;
/** /**
* 创建测试 * 创建测试
*
* @param createReq 创建信息 * @param createReq 创建信息
* @return 编号 * @return 编号
*/ */
public Long create(@Valid EcwVz createReq) public Long create(@Valid EcwVz createReq) {
{ ecwVzMapper.insert(createReq);
ecwVzMapper.insert(createReq); return createReq.getId();
return createReq.getId(); }
}
/** /**
* 更新测试 * 更新测试
*
* @param updateReq 更新信息 * @param updateReq 更新信息
*/ */
public void update(@Valid EcwVz updateReq) public void update(@Valid EcwVz updateReq) {
{ ecwVzMapper.updateById(updateReq);
ecwVzMapper.updateById(updateReq); }
}
/** /**
* 删除测试 * 删除测试
*
* @param id 编号 * @param id 编号
*/ */
public void delete(Long id) public void delete(Long id) {
{ ecwVzMapper.deleteById2(id);
ecwVzMapper.deleteById2(id); }
}
/** /**
* 获得测试 * 获得测试
*
* @param id 编号 * @param id 编号
* @return 测试 * @return 测试
*/ */
public EcwVz getModel(Long id) public EcwVz getModel(Long id) {
{ return ecwVzMapper.selectById(id);
return ecwVzMapper.selectById(id); }
}
/** /**
* 获得测试列表 * 获得测试列表
*
* @param ids 编号 * @param ids 编号
* @return 测试列表 * @return 测试列表
*/ */
public List<EcwVz> getQueryList(Collection<Long> ids) public List<EcwVz> getQueryList(Collection<Long> ids) {
{ return ecwVzMapper.selectBatchIds(ids);
return ecwVzMapper. selectBatchIds(ids); }
}
/** /**
* 获得测试列表, 用于 Excel 导出 * 获得测试列表, 用于 Excel 导出
*
* @param query 查询 * @param query 查询
* @return 列表 * @return 列表
*/ */
public List<EcwVz> getQueryList(EcwVz query) public List<EcwVz> getQueryList(EcwVz query) {
{ return ecwVzMapper.selectList(query);
return ecwVzMapper. selectList(query); }
}
/** /**
* 获得测试分页 * 获得测试分页
*
* @param page 分页查询 * @param page 分页查询
* @param page 查询 * @param page 查询
* @return 分页列表 * @return 分页列表
*/ */
public PageResult<EcwVz> selectPage(EcwVzPageReq page) public PageResult<EcwVz> selectPage(EcwVzPageReq page) {
{ return ecwVzMapper.selectPage(page);
return ecwVzMapper.selectPage(page); }
}
} }
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.delivery.mapper.OrderExtMapper">
<!--发货方,客户是否有订单判断-->
<select id="IsHavingOrderConsignor" resultType="java.lang.Integer">
SELECT count(*)
FROM ecw_order o
LEFT JOIN ecw_order_consignor r ON o.order_id = r.order_id
and r.deleted = 0
where o.deleted = 0
and r.customer_id = #{customerId}
and o.status >= 5
<!--订单已取消88,有可能包含在类,暂时未做处理-->
</select>
<!--收货方客户,是否有已入仓订单-->
<select id="IsHavingOrderConsignee" resultType="java.lang.Integer">
SELECT count(*)
FROM ecw_order o
LEFT JOIN ecw_order_consignee r ON o.order_id = r.order_id
and r.deleted = 0
where o.deleted = 0
and r.customer_id = #{customerId}
and o.status >= 5
</select>
<select id="IsHavingOrder" resultType="java.lang.Integer">
select COUNT(id)
from ecw_target_log
where deleted = 0
and customer_id = #{customerId}
</select>
</mapper>
...@@ -12,6 +12,7 @@ import lombok.*; ...@@ -12,6 +12,7 @@ import lombok.*;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.*;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
...@@ -232,10 +233,10 @@ public class OrderDO extends BaseDO { ...@@ -232,10 +233,10 @@ public class OrderDO extends BaseDO {
private BigDecimal minMeteringWeight = BigDecimal.ZERO; private BigDecimal minMeteringWeight = BigDecimal.ZERO;
@ApiModelProperty(value = "最小计量体积") @ApiModelProperty(value = "最小计量体积")
private BigDecimal minMeteringVolume = BigDecimal.ZERO; private BigDecimal minMeteringVolume = BigDecimal.ZERO;
@ApiModelProperty(value = "最小计量个数") @ApiModelProperty(value = "最小计量个数")
private BigDecimal minMeteringQuantity = BigDecimal.ZERO; private BigDecimal minMeteringQuantity = BigDecimal.ZERO;
/** /**
* 重货标准基数 * 重货标准基数
*/ */
...@@ -569,10 +570,10 @@ public class OrderDO extends BaseDO { ...@@ -569,10 +570,10 @@ public class OrderDO extends BaseDO {
@TableField(exist = false) @TableField(exist = false)
@ApiModelProperty(value = "入仓状态变更前缀(例如:理货移除、预装移除、撤销拆单、装柜移除)") @ApiModelProperty(value = "入仓状态变更前缀(例如:理货移除、预装移除、撤销拆单、装柜移除)")
private String prefixStatusZh=""; private String prefixStatusZh = "";
@TableField(exist = false) @TableField(exist = false)
@ApiModelProperty(value = "入仓状态变更前缀(例如:理货移除、预装移除、撤销拆单、装柜移除)") @ApiModelProperty(value = "入仓状态变更前缀(例如:理货移除、预装移除、撤销拆单、装柜移除)")
private String prefixStatusEn=""; private String prefixStatusEn = "";
@TableField(exist = false) @TableField(exist = false)
@ApiModelProperty(value = "是否主拆单") @ApiModelProperty(value = "是否主拆单")
...@@ -603,4 +604,24 @@ public class OrderDO extends BaseDO { ...@@ -603,4 +604,24 @@ public class OrderDO extends BaseDO {
// @TableField(exist = false) // @TableField(exist = false)
// @ApiModelProperty(value = "是否重置订单编号") // @ApiModelProperty(value = "是否重置订单编号")
// private Boolean resetOrderNo; // private Boolean resetOrderNo;
/*
lanbm 2024-05-13 add
*/
@ApiModelProperty(value = "客户业绩类型:1 新客户业绩 0老客户业绩")
private Integer yejiType;
/*
业绩产生时间 lanbm 2024-05-13 add
*/
private Date yejiCreateDate;
/*
海运根据体积计算出的V值,空运根据重量计算出的V值
lanbm 2024-05-13 add
*/
private BigDecimal calVValue;
} }
...@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil; ...@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.io.file.FileNameUtil; import cn.hutool.core.io.file.FileNameUtil;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.apollo.core.event.Order.CalculateOrderYeJiTypeEvent;
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
import cn.iocoder.yudao.framework.common.exception.ErrorCode; import cn.iocoder.yudao.framework.common.exception.ErrorCode;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
...@@ -62,6 +63,7 @@ import org.apache.commons.io.FileUtils; ...@@ -62,6 +63,7 @@ import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationContext;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
...@@ -120,6 +122,10 @@ public class OrderController { ...@@ -120,6 +122,10 @@ public class OrderController {
@Resource @Resource
private RedisHelper redisHelper; private RedisHelper redisHelper;
//lanbm 2024-05-13 add
@Resource
private ApplicationContext applicationContext;
/** /**
* 订单修改操作的防重复提交缓存key * 订单修改操作的防重复提交缓存key
...@@ -144,7 +150,10 @@ public class OrderController { ...@@ -144,7 +150,10 @@ public class OrderController {
throw exception(ORDER_EXPRESS_NUMBER_TOO_LONG); throw exception(ORDER_EXPRESS_NUMBER_TOO_LONG);
} }
} }
return success(orderService.createOrder(createReqVO, null).getOrderId());
//lanbm 2024-05-13 添加注释
Long orderId = orderService.createOrder(createReqVO, null).getOrderId();
return success(orderId);
} }
...@@ -165,12 +174,13 @@ public class OrderController { ...@@ -165,12 +174,13 @@ public class OrderController {
} }
String redisKey = MessageFormat.format(ORDER_UPDATE_KEY, updateReqVO.getOrderId().toString()); String redisKey = MessageFormat.format(ORDER_UPDATE_KEY, updateReqVO.getOrderId().toString());
Long count = redisHelper.incrBy(redisKey, 1); Long count = redisHelper.incrBy(redisKey, 1);
if (count > 1){ if (count > 1) {
return error(ORDER_UPDATE_REPEAT_COMMIT); return error(ORDER_UPDATE_REPEAT_COMMIT);
} }
redisHelper.expire(redisKey, 1, TimeUnit.MINUTES); redisHelper.expire(redisKey, 1, TimeUnit.MINUTES);
orderService.updateOrder(updateReqVO, null); orderService.updateOrder(updateReqVO, null);
redisHelper.delete(redisKey); redisHelper.delete(redisKey);
return success(true); return success(true);
} }
...@@ -181,7 +191,7 @@ public class OrderController { ...@@ -181,7 +191,7 @@ public class OrderController {
public CommonResult<Boolean> deleteOrder(@RequestParam("orderId") Long orderId) { public CommonResult<Boolean> deleteOrder(@RequestParam("orderId") Long orderId) {
String redisKey = MessageFormat.format(ORDER_UPDATE_KEY, orderId.toString()); String redisKey = MessageFormat.format(ORDER_UPDATE_KEY, orderId.toString());
Long count = redisHelper.incrBy(redisKey, 1); Long count = redisHelper.incrBy(redisKey, 1);
if (count > 1){ if (count > 1) {
return error(ORDER_UPDATE_REPEAT_COMMIT); return error(ORDER_UPDATE_REPEAT_COMMIT);
} }
redisHelper.expire(redisKey, 1, TimeUnit.MINUTES); redisHelper.expire(redisKey, 1, TimeUnit.MINUTES);
...@@ -197,7 +207,7 @@ public class OrderController { ...@@ -197,7 +207,7 @@ public class OrderController {
public CommonResult<Boolean> recoveryOrder(@PathVariable("orderId") Long orderId) { public CommonResult<Boolean> recoveryOrder(@PathVariable("orderId") Long orderId) {
String redisKey = MessageFormat.format(ORDER_UPDATE_KEY, orderId.toString()); String redisKey = MessageFormat.format(ORDER_UPDATE_KEY, orderId.toString());
Long count = redisHelper.incrBy(redisKey, 1); Long count = redisHelper.incrBy(redisKey, 1);
if (count > 1){ if (count > 1) {
return error(ORDER_UPDATE_REPEAT_COMMIT); return error(ORDER_UPDATE_REPEAT_COMMIT);
} }
redisHelper.expire(redisKey, 1, TimeUnit.MINUTES); redisHelper.expire(redisKey, 1, TimeUnit.MINUTES);
...@@ -213,7 +223,7 @@ public class OrderController { ...@@ -213,7 +223,7 @@ public class OrderController {
public CommonResult<Boolean> cancelOrder(@PathVariable("orderId") Long orderId) { public CommonResult<Boolean> cancelOrder(@PathVariable("orderId") Long orderId) {
String redisKey = MessageFormat.format(ORDER_UPDATE_KEY, orderId.toString()); String redisKey = MessageFormat.format(ORDER_UPDATE_KEY, orderId.toString());
Long count = redisHelper.incrBy(redisKey, 1); Long count = redisHelper.incrBy(redisKey, 1);
if (count > 1){ if (count > 1) {
return error(ORDER_UPDATE_REPEAT_COMMIT); return error(ORDER_UPDATE_REPEAT_COMMIT);
} }
redisHelper.expire(redisKey, 1, TimeUnit.MINUTES); redisHelper.expire(redisKey, 1, TimeUnit.MINUTES);
...@@ -253,7 +263,7 @@ public class OrderController { ...@@ -253,7 +263,7 @@ public class OrderController {
} }
String redisKey = MessageFormat.format(ORDER_UPDATE_KEY, updateReqVO.getOrderId().toString()); String redisKey = MessageFormat.format(ORDER_UPDATE_KEY, updateReqVO.getOrderId().toString());
Long count = redisHelper.incrBy(redisKey, 1); Long count = redisHelper.incrBy(redisKey, 1);
if (count > 1){ if (count > 1) {
return error(ORDER_UPDATE_REPEAT_COMMIT); return error(ORDER_UPDATE_REPEAT_COMMIT);
} }
redisHelper.expire(redisKey, 1, TimeUnit.MINUTES); redisHelper.expire(redisKey, 1, TimeUnit.MINUTES);
...@@ -352,11 +362,11 @@ public class OrderController { ...@@ -352,11 +362,11 @@ public class OrderController {
} }
query.setUserType(UserTypeEnum.ADMIN.getValue()); query.setUserType(UserTypeEnum.ADMIN.getValue());
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
if (Objects.isNull(loginUser)){ if (Objects.isNull(loginUser)) {
return error(ErrorCodeConstants.USER_NOT_EXISTS); return error(ErrorCodeConstants.USER_NOT_EXISTS);
} }
List<RoleRespDTO> roleRespDTOS = roleApi.getRoles(loginUser.getRoleIds()); List<RoleRespDTO> roleRespDTOS = roleApi.getRoles(loginUser.getRoleIds());
if (Objects.isNull(roleRespDTOS)){ if (Objects.isNull(roleRespDTOS)) {
return error(ROLE_NOT_EXISTS); return error(ROLE_NOT_EXISTS);
} }
addDataScopeQuery(query, loginUser, roleRespDTOS); addDataScopeQuery(query, loginUser, roleRespDTOS);
...@@ -370,7 +380,7 @@ public class OrderController { ...@@ -370,7 +380,7 @@ public class OrderController {
boolean isAll = Boolean.FALSE; boolean isAll = Boolean.FALSE;
for (RoleRespDTO roleRespDTO : roleRespDTOS) { for (RoleRespDTO roleRespDTO : roleRespDTOS) {
DataScopeEnum dataScopeEnum = DataScopeEnum.valueOf(roleRespDTO.getDataScope()); DataScopeEnum dataScopeEnum = DataScopeEnum.valueOf(roleRespDTO.getDataScope());
switch (dataScopeEnum){ switch (dataScopeEnum) {
case ALL: case ALL:
// 全部数据权限,不限制 // 全部数据权限,不限制
isAll = Boolean.TRUE; isAll = Boolean.TRUE;
...@@ -393,12 +403,12 @@ public class OrderController { ...@@ -393,12 +403,12 @@ public class OrderController {
break; break;
} }
} }
if (!isAll){ if (!isAll) {
// 非全部数据权限时查询限制条件 // 非全部数据权限时查询限制条件
if (CollectionUtil.isEmpty(deptIdList) || deptIdList.size() == 0){ if (CollectionUtil.isEmpty(deptIdList) || deptIdList.size() == 0) {
// 没有部门限制条件时,只查询当前用户自己的 // 没有部门限制条件时,只查询当前用户自己的
query.setCreator(String.valueOf(loginUser.getId())); query.setCreator(String.valueOf(loginUser.getId()));
}else { } else {
// 查询限定部门的数据 // 查询限定部门的数据
query.setDeptIdList(deptIdList); query.setDeptIdList(deptIdList);
} }
...@@ -667,11 +677,11 @@ public class OrderController { ...@@ -667,11 +677,11 @@ public class OrderController {
@ApiImplicitParam(value = "是否重新定价", name = "isResetPrice", required = true, example = "是否重新定价-true/false", dataTypeClass = Boolean.class) @ApiImplicitParam(value = "是否重新定价", name = "isResetPrice", required = true, example = "是否重新定价-true/false", dataTypeClass = Boolean.class)
}) })
public CommonResult<Boolean> updateOrderPrice(@RequestParam(value = "orderNumbers", required = false) String orderNumbers, public CommonResult<Boolean> updateOrderPrice(@RequestParam(value = "orderNumbers", required = false) String orderNumbers,
@RequestParam(value = "isAllPrice", defaultValue = "false") Boolean isAllPrice, @RequestParam(value = "isAllPrice", defaultValue = "false") Boolean isAllPrice,
@RequestParam(value = "isResetPrice") Boolean isResetPrice) { @RequestParam(value = "isResetPrice") Boolean isResetPrice) {
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
if (StringUtils.isBlank(orderNumbers) && (Objects.isNull(isAllPrice) || !isAllPrice)){ if (StringUtils.isBlank(orderNumbers) && (Objects.isNull(isAllPrice) || !isAllPrice)) {
return error(new ErrorCode(11110000,"请确认是否全部重置")); return error(new ErrorCode(11110000, "请确认是否全部重置"));
} }
if (StringUtils.isNotBlank(orderNumbers)) { if (StringUtils.isNotBlank(orderNumbers)) {
list.addAll(Arrays.asList(orderNumbers.split(StrUtil.COMMA))); list.addAll(Arrays.asList(orderNumbers.split(StrUtil.COMMA)));
...@@ -683,7 +693,7 @@ public class OrderController { ...@@ -683,7 +693,7 @@ public class OrderController {
@PutMapping("/create-order-receivable") @PutMapping("/create-order-receivable")
@ApiOperation(value = "手动创建订单的运费与清关费应收单", notes = "当运费与清关费应收单因为bug而没生成时,才能执行") @ApiOperation(value = "手动创建订单的运费与清关费应收单", notes = "当运费与清关费应收单因为bug而没生成时,才能执行")
@ApiImplicitParam(value = "订单编号", name = "orderNo", required = true, example = "示例:NG2300208L", dataTypeClass = String.class) @ApiImplicitParam(value = "订单编号", name = "orderNo", required = true, example = "示例:NG2300208L", dataTypeClass = String.class)
public CommonResult<Boolean> createOrderReceivable(@RequestParam(value = "orderNo") String orderNo) { public CommonResult<Boolean> createOrderReceivable(@RequestParam(value = "orderNo") String orderNo) {
orderBusinessService.updateReceivable(orderNo); orderBusinessService.updateReceivable(orderNo);
return success(true); return success(true);
...@@ -729,11 +739,11 @@ public class OrderController { ...@@ -729,11 +739,11 @@ public class OrderController {
} }
query.setUserType(UserTypeEnum.ADMIN.getValue()); query.setUserType(UserTypeEnum.ADMIN.getValue());
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
if (Objects.isNull(loginUser)){ if (Objects.isNull(loginUser)) {
return error(ErrorCodeConstants.USER_NOT_EXISTS); return error(ErrorCodeConstants.USER_NOT_EXISTS);
} }
List<RoleRespDTO> roleRespDTOS = roleApi.getRoles(loginUser.getRoleIds()); List<RoleRespDTO> roleRespDTOS = roleApi.getRoles(loginUser.getRoleIds());
if (Objects.isNull(roleRespDTOS)){ if (Objects.isNull(roleRespDTOS)) {
return error(ROLE_NOT_EXISTS); return error(ROLE_NOT_EXISTS);
} }
addDataScopeQuery(query, loginUser, roleRespDTOS); addDataScopeQuery(query, loginUser, roleRespDTOS);
...@@ -790,8 +800,4 @@ public class OrderController { ...@@ -790,8 +800,4 @@ public class OrderController {
} }
} }
...@@ -1527,10 +1527,12 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements ...@@ -1527,10 +1527,12 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
List<Long> warehouseIdList; List<Long> warehouseIdList;
if (countryId != null) { if (countryId != null) {
List<WarehouseDO> warehouseList = warehouseService.findByCountryIdList(Collections.singletonList(countryId)); List<WarehouseDO> warehouseList =
warehouseService.findByCountryIdList(Collections.singletonList(countryId));
warehouseIdList = warehouseList.stream().map(WarehouseDO::getId).collect(Collectors.toList()); warehouseIdList = warehouseList.stream().map(WarehouseDO::getId).collect(Collectors.toList());
query.setWarehouseIdList(warehouseIdList); query.setWarehouseIdList(warehouseIdList);
} }
//上面都是处理查询条件相关逻辑
return boxInfoQuery1(boxMapper.selectPage2(page, query), false); return boxInfoQuery1(boxMapper.selectPage2(page, query), false);
} }
...@@ -2292,7 +2294,9 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements ...@@ -2292,7 +2294,9 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
.map(BoxBaseBackVO::getId) .map(BoxBaseBackVO::getId)
.collect(Collectors.toList()); .collect(Collectors.toList());
Map<Long, BoxGoodsStatistics> shipmentStatisticsMap = boxPreloadGoodsService.getBoxStatistics(idList); //ecw_box_preload_goods 预装货物 lanbm 2024-05-13 添加注释
Map<Long, BoxGoodsStatistics> shipmentStatisticsMap =
boxPreloadGoodsService.getBoxStatistics(idList);
List<Long> cabinetIdList = boxBackList.stream() List<Long> cabinetIdList = boxBackList.stream()
.map(BoxBaseBackVO::getCabinetId) .map(BoxBaseBackVO::getCabinetId)
...@@ -2301,6 +2305,7 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements ...@@ -2301,6 +2305,7 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
Map<Long, CabinetDO> cabinetMap = new HashMap<>(); Map<Long, CabinetDO> cabinetMap = new HashMap<>();
//ecw_cabinet 柜型配置 lanbm 2024-05-13 添加注释
if (CollectionUtils.isNotEmpty(cabinetIdList)) { if (CollectionUtils.isNotEmpty(cabinetIdList)) {
List<CabinetDO> cabinetDOList = cabinetService.getCabinetList(cabinetIdList); List<CabinetDO> cabinetDOList = cabinetService.getCabinetList(cabinetIdList);
cabinetMap = cabinetDOList.stream() cabinetMap = cabinetDOList.stream()
...@@ -2310,7 +2315,9 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements ...@@ -2310,7 +2315,9 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
Set<Long> destWarehouseIdList = boxBackList.stream() Set<Long> destWarehouseIdList = boxBackList.stream()
.map(BoxBaseBackVO::getDestWarehouseId) .map(BoxBaseBackVO::getDestWarehouseId)
.collect(Collectors.toSet()); .collect(Collectors.toSet());
List<WarehouseDO> warehouseDOList = warehouseService.getByIdList(new ArrayList<>(destWarehouseIdList)); //ecw_warehouse 仓库相关信息
List<WarehouseDO> warehouseDOList =
warehouseService.getByIdList(new ArrayList<>(destWarehouseIdList));
Map<Long, WarehouseDO> warehouseDOMap = warehouseDOList.stream() Map<Long, WarehouseDO> warehouseDOMap = warehouseDOList.stream()
.collect(Collectors.toMap(WarehouseDO::getId, v -> v)); .collect(Collectors.toMap(WarehouseDO::getId, v -> v));
...@@ -2340,22 +2347,28 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements ...@@ -2340,22 +2347,28 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
} }
//设置目的地 //设置目的地
WarehouseDO destWarehouse = warehouseDOMap.get(boxBackVO.getDestWarehouseId()); WarehouseDO destWarehouse =
WarehouseRespVO destWarehouseResp = WarehouseConvert.INSTANCE.convert(destWarehouse); warehouseDOMap.get(boxBackVO.getDestWarehouseId());
WarehouseRespVO destWarehouseResp =
WarehouseConvert.INSTANCE.convert(destWarehouse);
boxBackVO.setDestWarehouseResp(destWarehouseResp); boxBackVO.setDestWarehouseResp(destWarehouseResp);
Long channelId = boxBackVO.getShippingChannelId(); Long channelId = boxBackVO.getShippingChannelId();
if (channelId != null && channelId != 0) { if (channelId != null && channelId != 0) {
ChannelDO channelDO = channelMap.get(channelId); ChannelDO channelDO = channelMap.get(channelId);
boxBackVO.setChannelRespVO(ChannelConvert.INSTANCE.convert(channelDO)); boxBackVO.setChannelRespVO(ChannelConvert.INSTANCE.convert(
channelDO));
} }
//统计信息 //统计信息 lanbm2024-05-13 添加注释
BoxGoodsStatistics boxStatistics = shipmentStatisticsMap.get(shipmentId); BoxGoodsStatistics boxStatistics =
shipmentStatisticsMap.get(shipmentId);
boxBackVO.setBoxStatistics(boxStatistics); boxBackVO.setBoxStatistics(boxStatistics);
if (searchDcDate) { if (searchDcDate) {
BoxCabinetUnloadDO boxCabinetUnloadDO = boxCabinetUnloadService.getOne(new LambdaQueryWrapperX<BoxCabinetUnloadDO>() BoxCabinetUnloadDO boxCabinetUnloadDO =
boxCabinetUnloadService.getOne(
new LambdaQueryWrapperX<BoxCabinetUnloadDO>()
.eq(BoxCabinetUnloadDO::getShipmentId, shipmentId) .eq(BoxCabinetUnloadDO::getShipmentId, shipmentId)
.last("limit 1") .last("limit 1")
); );
......
...@@ -184,6 +184,7 @@ public class BoxController { ...@@ -184,6 +184,7 @@ public class BoxController {
@ApiOperation("获得出货分页, use this") @ApiOperation("获得出货分页, use this")
// @PreAuthorize("@ss.hasPermission({'shipment:box:query', 'shipment:box:query:air'})") // @PreAuthorize("@ss.hasPermission({'shipment:box:query', 'shipment:box:query:air'})")
public CommonResult<PageResult<BoxBackVO>> getBoxPage(@Valid BoxQueryVO query, PageVO page) { public CommonResult<PageResult<BoxBackVO>> getBoxPage(@Valid BoxQueryVO query, PageVO page) {
//lanbm 2024-05-13 处理问题添加注释
return success(boxService.getBoxPage(query, page)); return success(boxService.getBoxPage(query, page));
} }
......
...@@ -214,6 +214,9 @@ public class MakeBillOfLadingController { ...@@ -214,6 +214,9 @@ public class MakeBillOfLadingController {
return success(true); return success(true);
} }
/*
lanbm 2024-05-07 修改报关价显示单位问题
*/
@GetMapping("/make") @GetMapping("/make")
@ApiOperation("制作提货单") @ApiOperation("制作提货单")
@ApiImplicitParams({ @ApiImplicitParams({
......
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