Commit 6a28c7c6 authored by lanbaoming's avatar lanbaoming

2024-07-06提交

parent d5bdd968
package cn.iocoder.yudao.module.customer.vo.customer.vo;
import cn.iocoder.yudao.module.customer.vo.customerBank.CustomerBankBackVO;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -12,7 +13,7 @@ import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.*;
@ApiModel("管理后台 - 客户详情 Response VO")
@Data
......@@ -93,7 +94,10 @@ public class CustomerDetailRespVO extends CustomerBaseVO {
@ApiModelProperty(value = "创建人id")
private Long founder;
@ApiModelProperty(value = "创建时间", example = "1652017501000")
//客户创建日期格式化
//@JsonFormat(value = "创建时间", example = "1652017501000")
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY,
timezone = TIME_ZONE_DEFAULT)
private Date createTime;
......@@ -203,4 +207,7 @@ public class CustomerDetailRespVO extends CustomerBaseVO {
@ApiModelProperty(value = "付款人姓名")
private String payerName;
//联系人信息
private String contactstr;
}
......@@ -18,6 +18,7 @@ import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils;
import cn.iocoder.yudao.module.customer.convert.customer.CustomerConvert;
import cn.iocoder.yudao.module.customer.convert.customerBank.CustomerBankConvert;
import cn.iocoder.yudao.module.customer.convert.customerContacts.CustomerContactsConvert;
import cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO;
import cn.iocoder.yudao.module.customer.dal.dataobject.customer.commission.CustomerCommissionDO;
import cn.iocoder.yudao.module.customer.dal.dataobject.customer.complaint.CustomerComplaintDO;
......@@ -42,6 +43,7 @@ import cn.iocoder.yudao.module.customer.service.customerLevelLog.CustomerLevelLo
import cn.iocoder.yudao.module.customer.service.customerPublicCatchLog.CustomerPublicCatchLogService;
import cn.iocoder.yudao.module.customer.service.zhongPao.ZhongPaoService;
import cn.iocoder.yudao.module.customer.vo.customer.customerContacts.CustomerContactsCreateReqVO;
import cn.iocoder.yudao.module.customer.vo.customer.customerContacts.CustomerContactsRespVO;
import cn.iocoder.yudao.module.customer.vo.customer.customerContacts.CustomerContactsUpdateReqVO;
import cn.iocoder.yudao.module.customer.vo.customer.vo.*;
import cn.iocoder.yudao.module.customer.vo.customerBank.CustomerBankBackVO;
......@@ -201,7 +203,8 @@ public class CustomerController {
@NotNull
private CommonResult<Long> createCustomerPrivate(CustomerCreateReqVO createReqVO) {
List<CustomerContactsCreateReqVO> customerContacts = createReqVO.getCustomerContacts();
List<CustomerContactsCreateReqVO> customerContacts =
createReqVO.getCustomerContacts();
if (!CollectionUtils.isEmpty(customerContacts)) {
long count = customerContacts.stream().filter(t -> CustomerContactsDefaultEnum.IS_DEFAULT.getValue().equals(t.getIsDefault())).count();
if (count <= 0) {
......@@ -614,6 +617,72 @@ public class CustomerController {
return success(respVO);
}
private String getContactStr(Long customerId) {
List<CustomerContactsDO> list =
customerContactsService.getCustomerContactsListByCustomerId(customerId);
List<CustomerContactsRespVO> respVOList =
CustomerContactsConvert.INSTANCE.convertList(list);
String sResult = "";
if (CollectionUtil.isEmpty(respVOList)) {
return sResult;
}
for (CustomerContactsRespVO m : respVOList
) {
sResult += m.getName() + "," + m.getPhoneNew() + "\r\n";
}
//sResult = sResult.substring(sResult.length() - 4);
return sResult;
}
@GetMapping("/get2")
@ApiOperation("获得客户详情")
@ApiImplicitParam(name = "id", value = "id", required = true, example = "1024", dataTypeClass = Long.class)
//@PreAuthorize("@ss.hasPermission('ecw:customer:query')")
public CommonResult<CustomerDetailRespVO> getCustomer2(
@RequestParam("id") Long id) {
CustomerDetailRespVO respVO = customerService.getCustomerDetailRespVO(id);
if (Objects.isNull(respVO)) {
throw exception(CUSTOMER_NOT_EXISTS);
}
Long founder = respVO.getFounder();
if (founder != null) {
if (Boolean.TRUE.equals(respVO.getIsWebOrderConsigneeSync())) {
UserRespDTO user = memberUserApi.getUser(founder);
if (user != null) {
respVO.setFounderName(user.getNickname() + "(会员)");
}
} else {
AdminUserRespDTO user = adminUserApi.getUser(founder);
if (user != null) {
respVO.setFounderName(user.getNickname());
}
}
}
if (null != respVO.getPromoter()) {
CustomerDO customer1 = customerService.getCustomer(respVO.getPromoter());
if (null != customer1) {
respVO.setPromoterName(customer1.getName());
}
}
//设置银行账号
CustomerBankQueryVO customerBankQueryVO = new CustomerBankQueryVO();
customerBankQueryVO.setCustomerId(id);
List<CustomerBankDO> bankList = customerBankService.getBankList(customerBankQueryVO);
List<CustomerBankBackVO> customerBankBackVOS = CustomerBankConvert.INSTANCE.convertList(bankList)
.stream().sorted(Comparator.comparing(CustomerBankBackVO::getId)).collect(Collectors.toList());
respVO.setCustomerBankBackVOList(customerBankBackVOS);
String sR=getContactStr(id);
respVO.setContactstr(sR);
return success(respVO);
}
@GetMapping("/list")
@ApiOperation("根据客户id集合获得客户详情列表")
@ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)
......
......@@ -98,9 +98,12 @@ public class CustomerContactsController {
@ApiOperation("根据客户ID获得联系人列表")
@ApiImplicitParam(name = "customerId", value = "客户主键ID", required = true, example = "1024", dataTypeClass = Long.class)
// @PreAuthorize("@ss.hasPermission('ecw:customer-contacts:query')")
public CommonResult<List<CustomerContactsRespVO>> getCustomerContactsListByCustomerId(@RequestParam("customerId") Long customerId) {
List<CustomerContactsDO> list = customerContactsService.getCustomerContactsListByCustomerId(customerId);
List<CustomerContactsRespVO> respVOList = CustomerContactsConvert.INSTANCE.convertList(list);
public CommonResult<List<CustomerContactsRespVO>>
getCustomerContactsListByCustomerId(@RequestParam("customerId") Long customerId) {
List<CustomerContactsDO> list =
customerContactsService.getCustomerContactsListByCustomerId(customerId);
List<CustomerContactsRespVO> respVOList =
CustomerContactsConvert.INSTANCE.convertList(list);
if (CollectionUtil.isNotEmpty(respVOList)) {
CustomerDO customer = customerService.getById(customerId);
if (customer != null) {
......@@ -112,6 +115,28 @@ public class CustomerContactsController {
return success(respVOList);
}
//获取客户联系人信息
@GetMapping("/getContactsString")
@ApiOperation("根据客户ID获得联系人列表")
public CommonResult getCustomerContactsListByCustomerIdString(
@RequestParam("customerId") Long customerId) {
List<CustomerContactsDO> list =
customerContactsService.getCustomerContactsListByCustomerId(customerId);
List<CustomerContactsRespVO> respVOList =
CustomerContactsConvert.INSTANCE.convertList(list);
String sResult = "";
if (CollectionUtil.isEmpty(respVOList)) {
return success(sResult);
}
for (CustomerContactsRespVO m : respVOList
) {
sResult += m.getName() + "," + m.getPhoneNew()+"\r\n";
}
//sResult = sResult.substring(sResult.length() - 4);
return success(sResult);
}
@GetMapping("/page")
@ApiOperation("获得客户联系人分页")
// @PreAuthorize("@ss.hasPermission('ecw:customer-contacts:query')")
......@@ -179,7 +204,7 @@ public class CustomerContactsController {
//当前用户ID
Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
return success(customerContactsService.selectBySearchKey2(searchKey,
type, ids, customerId, page,loginUserId));
type, ids, customerId, page, loginUserId));
}
}
......@@ -73,7 +73,7 @@ public interface TargetLogMapper extends AbstractMapper<TargetLogDO> {
@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})",
"select * from ecw_target_log where deleted=0 and DATE_FORMAT(achievement_time,'%Y-%m')=#{sDate}",
"</script>"
})
List<TargetLogDO> selectList2(String sDate);
......
......@@ -394,30 +394,6 @@ public class TargetLogServiceImpl extends
0L);
loglev = 11;
s_gsf += ",客户经理为空,不算奖金。";
} else {
Date d1 = orderTimeService.getCustomerOperateDate(customerId,
consignorDO.getCustomerService());
if (d0 != null && d1 != null) {
if (d1.compareTo(d0) > 0) {
s_gsf += ",入仓后归属客户经理,不算奖金。"+
String.valueOf(d0)+","+
String.valueOf(d1);
saleManid = 0L;
orderService.updateOrderSalesmanId(info.getOrderId(),
0L);
TargetLogDO targetLogDO = targetLogMapper.selectById(targetId);
//客户ID
targetLogDO.setCustomerId(customerId);
//客户经理ID
targetLogDO.setUserId(saleManid);
targetLogDO.setLoglev(loglev);
targetLogDO.setGsf(s_gsf);
targetLogDO.setGstype(n_gstype);
targetLogDO.setUpdateTime(new Date());
targetLogMapper.updateById(targetLogDO);
return;
}
}
}
if (consignorDO.getIsInOpenSea() == true) {
......@@ -427,8 +403,8 @@ public class TargetLogServiceImpl extends
loglev = 11;
s_gsf += ",客户在公海池,不算奖金。";
}
TargetLogDO targetLogDO = targetLogMapper.selectById(targetId);
TargetLogDO targetLogDO =
targetLogMapper.selectById(targetId);
//客户ID
targetLogDO.setCustomerId(customerId);
//客户经理ID
......@@ -474,30 +450,6 @@ public class TargetLogServiceImpl extends
0L);
loglev = 21;
s_gsf += ",客户经理为空,不算奖金。";
} else {
Date d1 = orderTimeService.getCustomerOperateDate(customerId,
consignorDO.getCustomerService());
if (d0 != null && d1 != null) {
if (d1.compareTo(d0) > 0) {
s_gsf += ",入仓后归属客户经理,不算奖金。"+
String.valueOf(d0)+","+
String.valueOf(d1);
saleManid = 0L;
orderService.updateOrderSalesmanId(info.getOrderId(),
0L);
TargetLogDO targetLogDO = targetLogMapper.selectById(targetId);
//客户ID
targetLogDO.setCustomerId(customerId);
//客户经理ID
targetLogDO.setUserId(saleManid);
targetLogDO.setLoglev(loglev);
targetLogDO.setGsf(s_gsf);
targetLogDO.setGstype(n_gstype);
targetLogDO.setUpdateTime(new Date());
targetLogMapper.updateById(targetLogDO);
return;
}
}
}
if (consignorDO.getIsInOpenSea() == true) {
......@@ -507,7 +459,8 @@ public class TargetLogServiceImpl extends
loglev = 21;
s_gsf += ",客户在公海池,不算奖金。";
}
TargetLogDO targetLogDO = targetLogMapper.selectById(targetId);
TargetLogDO targetLogDO =
targetLogMapper.selectById(targetId);
//客户ID
targetLogDO.setCustomerId(customerId);
//客户经理ID
......@@ -523,7 +476,6 @@ public class TargetLogServiceImpl extends
List<TargetOfferBackVO> offerBackVOList =
targetLogMapper.getTargetOfferBackByOrerId(orderId);
if (info.getDrawee() == 1) {
if (CollectionUtil.isNotEmpty(offerBackVOList)) {
//如果是发货人付款且关联报价单,业绩归属发货人 --层级3 第一个
......@@ -539,17 +491,6 @@ public class TargetLogServiceImpl extends
0L);
loglev = 31;
s_gsf += ",客户经理为空,不算奖金。";
} else {
Date d1 = orderTimeService.getCustomerOperateDate(customerId,
consignorDO.getCustomerService());
if (d0 != null && d1 != null) {
if (d1.compareTo(d0) > 0) {
s_gsf += ",入参后归属客户经理,不算奖金。";
saleManid = 0L;
orderService.updateOrderSalesmanId(info.getOrderId(),
0L);
}
}
}
if (consignorDO.getIsInOpenSea() == true) {
......@@ -559,7 +500,8 @@ public class TargetLogServiceImpl extends
loglev = 31;
s_gsf += ",客户在公海池,不算奖金。";
}
TargetLogDO targetLogDO = targetLogMapper.selectById(targetId);
TargetLogDO targetLogDO =
targetLogMapper.selectById(targetId);
//客户ID
targetLogDO.setCustomerId(customerId);
//客户经理ID
......@@ -586,30 +528,6 @@ public class TargetLogServiceImpl extends
0L);
loglev = 41;
s_gsf += ",客户经理为空,不算奖金。";
} else {
Date d1 = orderTimeService.getCustomerOperateDate(customerId,
consignorDO.getCustomerService());
if (d0 != null && d1 != null) {
if (d1.compareTo(d0) > 0) {
s_gsf += ",入仓后归属客户经理,不算奖金。"+
String.valueOf(d0)+","+
String.valueOf(d1);
saleManid = 0L;
orderService.updateOrderSalesmanId(info.getOrderId(),
0L);
TargetLogDO targetLogDO = targetLogMapper.selectById(targetId);
//客户ID
targetLogDO.setCustomerId(customerId);
//客户经理ID
targetLogDO.setUserId(saleManid);
targetLogDO.setLoglev(loglev);
targetLogDO.setGsf(s_gsf);
targetLogDO.setGstype(n_gstype);
targetLogDO.setUpdateTime(new Date());
targetLogMapper.updateById(targetLogDO);
return;
}
}
}
if (consignorDO.getIsInOpenSea() == true) {
......@@ -645,19 +563,6 @@ public class TargetLogServiceImpl extends
0L);
loglev = 51;
s_gsf += ",客户经理为空,不算奖金。";
} else {
Date d1 = orderTimeService.getCustomerOperateDate(customerId,
consigneeDO.getCustomerService());
if (d0 != null && d1 != null) {
if (d1.compareTo(d0) > 0) {
s_gsf += ",入仓后归属客户经理,不算奖金。"+
String.valueOf(d0)+","+
String.valueOf(d1);
saleManid = 0L;
orderService.updateOrderSalesmanId(info.getOrderId(),
0L);
}
}
}
if (consigneeDO.getIsInOpenSea() == true) {
......@@ -728,30 +633,6 @@ public class TargetLogServiceImpl extends
targetLogDO.setUpdateTime(new Date());
targetLogMapper.updateById(targetLogDO);
return;
} else {
Date d1 = orderTimeService.getCustomerOperateDate(customerId,
consigneeDO.getCustomerService());
if (d0 != null && d1 != null) {
if (d1.compareTo(d0) > 0) {
s_gsf += ",入仓后归属客户经理,不算奖金。"+
String.valueOf(d0)+","+
String.valueOf(d1);
saleManid = 0L;
orderService.updateOrderSalesmanId(info.getOrderId(),
0L);
TargetLogDO targetLogDO = targetLogMapper.selectById(targetId);
//客户ID
targetLogDO.setCustomerId(customerId);
//客户经理ID
targetLogDO.setUserId(saleManid);
targetLogDO.setLoglev(loglev);
targetLogDO.setGsf(s_gsf);
targetLogDO.setGstype(n_gstype);
targetLogDO.setUpdateTime(new Date());
targetLogMapper.updateById(targetLogDO);
return;
}
}
}
s_gsf += ",发货人带来的收货人,有客户经理,归收货人客户经理。";
......@@ -798,19 +679,6 @@ public class TargetLogServiceImpl extends
0L);
loglev = 31;
s_gsf += ",客户经理为空,不算奖金。";
} else {
Date d1 = orderTimeService.getCustomerOperateDate(customerId,
consignorDO.getCustomerService());
if (d0 != null && d1 != null) {
if (d1.compareTo(d0) > 0) {
s_gsf += ",入参后归属客户经理,不算奖金。"+
String.valueOf(d0)+","+
String.valueOf(d1);
saleManid = 0L;
orderService.updateOrderSalesmanId(info.getOrderId(),
0L);
}
}
}
if (consignorDO.getIsInOpenSea() == true) {
......@@ -831,8 +699,6 @@ public class TargetLogServiceImpl extends
targetLogDO.setUpdateTime(new Date());
targetLogMapper.updateById(targetLogDO);
return;
} else if (CollectionUtil.isNotEmpty(offerBackVOList)
&& (info.getDrawee() == 3 && clearanceFee == 1)) {
//层级3 第三个 订单关联报价单 && 自定义付款 且发货人付清关费
......@@ -851,19 +717,6 @@ public class TargetLogServiceImpl extends
s_gsf += ",客户经理为空,或客户在公海池,不算奖金。";
}
Date d1 = orderTimeService.getCustomerOperateDate(customerId,
consignorDO.getCustomerService());
if (d0 != null && d1 != null) {
if (d1.compareTo(d0) > 0) {
s_gsf += ",入仓后归属客户经理,不算奖金。"+
String.valueOf(d0)+","+
String.valueOf(d1);;
saleManid = 0L;
orderService.updateOrderSalesmanId(info.getOrderId(),
0L);
}
}
TargetLogDO targetLogDO = targetLogMapper.selectById(targetId);
//客户ID
targetLogDO.setCustomerId(customerId);
......@@ -894,20 +747,6 @@ public class TargetLogServiceImpl extends
s_gsf += ",客户经理为空,或客户在公海池,不算奖金。";
}
Date d1 = orderTimeService.getCustomerOperateDate(customerId,
consignorDO.getCustomerService());
if (d0 != null && d1 != null) {
if (d1.compareTo(d0) > 0) {
s_gsf += ",入仓后归属客户经理,不算奖金。"+
String.valueOf(d0)+","+
String.valueOf(d1);
saleManid = 0L;
orderService.updateOrderSalesmanId(info.getOrderId(),
0L);
}
}
TargetLogDO targetLogDO = targetLogMapper.selectById(targetId);
//客户ID
targetLogDO.setCustomerId(customerId);
......@@ -922,7 +761,6 @@ public class TargetLogServiceImpl extends
} else if (consignorDO.getDefaultPay() &&
(info.getDrawee() == 3 && clearanceFee == 1)) {
//层级4 第三个 发货人档案设置默认付运费 且发货人付清关费 业绩归属发货人
loglev = 4;
customerId = orderConsignorDO.getCustomerId();
......@@ -939,20 +777,6 @@ public class TargetLogServiceImpl extends
s_gsf += ",客户经理为空,客户在公海池,不算奖金。";
}
Date d1 = orderTimeService.getCustomerOperateDate(customerId,
consignorDO.getCustomerService());
if (d0 != null && d1 != null) {
if (d1.compareTo(d0) > 0) {
s_gsf += ",入参后归属客户经理,不算奖金。"+
String.valueOf(d0)+","+
String.valueOf(d1);
saleManid = 0L;
orderService.updateOrderSalesmanId(info.getOrderId(),
0L);
}
}
TargetLogDO targetLogDO =
targetLogMapper.selectById(targetId);
//客户ID
......@@ -982,19 +806,6 @@ public class TargetLogServiceImpl extends
s_gsf += ",客户经理为空,客户在公海池,不算奖金。";
}
Date d1 = orderTimeService.getCustomerOperateDate(customerId,
consigneeDO.getCustomerService());
if (d0 != null && d1 != null) {
if (d1.compareTo(d0) > 0) {
s_gsf += ",入仓后归属客户经理,不算奖金。"+
String.valueOf(d0)+","+
String.valueOf(d1);
saleManid = 0L;
orderService.updateOrderSalesmanId(info.getOrderId(),
0L);
}
}
TargetLogDO targetLogDO =
targetLogMapper.selectById(targetId);
//客户ID
......@@ -1056,20 +867,6 @@ public class TargetLogServiceImpl extends
return;
}
Date d1 = orderTimeService.getCustomerOperateDate(customerId,
consigneeDO.getCustomerService());
if (d0 != null && d1 != null) {
if (d1.compareTo(d0) > 0) {
s_gsf += ",入仓后归属客户经理,不算奖金。"+
String.valueOf(d0)+","+
String.valueOf(d1);
saleManid = 0L;
orderService.updateOrderSalesmanId(info.getOrderId(),
0L);
}
}
if (consigneeDO.getIsInOpenSea() == true) {
saleManid = 0L;
s_gsf += ",收货人客户在公海池,不算奖金。";
......@@ -1089,7 +886,6 @@ public class TargetLogServiceImpl extends
targetLogMapper.updateById(targetLogDO);
return;
}
} catch (Exception e) {
zTest m2 = new zTest();
m2.setTestname(e.getMessage() + "发生异常," + info.getOrderNo());
......@@ -1098,6 +894,4 @@ public class TargetLogServiceImpl extends
}
}
}
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