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);
......
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