Commit 32457a81 authored by zhangfeng's avatar zhangfeng

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

parents 2923ea58 dc5d6b48
-- ----------------------------
-- Table structure for ecw_customer_competitor
-- ----------------------------
DROP TABLE IF EXISTS `ecw_customer_competitor`;
CREATE TABLE `ecw_customer_competitor` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`name` varchar(512) NOT NULL COMMENT '名称',
`creator` varchar(32) NOT NULL DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL COMMENT '创建时间',
`updater` varchar(32) DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL COMMENT '更新时间',
`deleted` bit DEFAULT false COMMENT '是否删除',
PRIMARY KEY (`id`),
KEY (`create_time`)
) COMMENT='客户竞争对手表';
-- 添加新字段
alter table `ecw_customer` add column `first_deal_time` datetime default null COMMENT '首次成交时间';
alter table `ecw_customer` add column `get_method` Integer default null COMMENT '获取方式';
alter table `ecw_customer` add column `create_from` Integer default null COMMENT '创建入口';
alter table `ecw_customer` add column `customer_service_confirmed_time` datetime default null COMMENT '确认接收时间';
alter table `ecw_customer` add column `busi_country_ids` varchar(100) default null COMMENT '业务国家ids';
alter table `ecw_customer` add column `roles` varchar(100) default null COMMENT '客户角色';
alter table `ecw_customer` add column `competitor_ids` varchar(100) default null COMMENT '竞争对手ids';
alter table `ecw_customer` add column `weight_yearly` decimal(15, 2) DEFAULT 0 COMMENT '年度发货量';
alter table `ecw_customer` add column `num_yearly` int DEFAULT 0 COMMENT '年度发货次数';
alter table `ecw_customer` add column `default_billing` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否默认开票';
-- 更新表
alter table `ecw_customer`
change column `pickup_point` `pickup_points` varchar(100) DEFAULT NULL COMMENT '常用提货网点ids';
alter table `ecw_customer`
change column `product_id` `product_ids` varchar(300) DEFAULT NULL COMMENT '主营产品ids';
-- 更新客户角色
update ecw_customer set roles = '2' where FIND_IN_SET(2, type) != 0 or FIND_IN_SET(3, type) != 0;
package cn.iocoder.yudao.module.customer.convert.customerCompetitor;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import cn.iocoder.yudao.module.customer.vo.customerCompetitor.*;
import cn.iocoder.yudao.module.customer.dal.dataobject.customerCompetitor.CustomerCompetitorDO;
/**
* 客户竞争对手 Convert
* @author yanghao
*/
@Mapper
public interface CustomerCompetitorConvert {
/*****转换MapStruct*****/
CustomerCompetitorConvert INSTANCE = Mappers.getMapper(CustomerCompetitorConvert.class);
/***
* 创建VO转实体
* @param bean
* @return
*/
CustomerCompetitorDO convert(CustomerCompetitorCreateReqVO bean);
/***
* 修改VO转实体
* @param bean
* @return
*/
CustomerCompetitorDO convert(CustomerCompetitorUpdateReqVO bean);
/***
* 实体转返回VO
* @param bean
* @return
*/
CustomerCompetitorBackVO convert(CustomerCompetitorDO bean);
/***
* 实体列表转返回VO列表
* @param list
* @return
*/
List<CustomerCompetitorBackVO> convertList(List<CustomerCompetitorDO> list);
/***
* 实体分页转返回分页
* @param page
* @return
*/
PageResult<CustomerCompetitorBackVO> convertPage(PageResult<CustomerCompetitorDO> page);
}
......@@ -109,11 +109,11 @@ public class CustomerDO extends BaseDO {
/**
* 产品id
*/
private Long productId;
private String productIds;
/**
* 常用提货网点
*/
private Long pickupPoint;
private String pickupPoints;
/**
* 关联会员账号
*/
......@@ -366,6 +366,69 @@ public class CustomerDO extends BaseDO {
@ApiModelProperty("延期申请次数")
private int delayApprovalNum ;
// ======== 20240821 add start
/**
* 首次成交时间
*/
private Date firstDealTime;
/**
* 获取方式
* <p>
* 枚举 {@link TODO customer_get_method 字典}
*/
private Integer getMethod;
/**
* 创建入口
* <p>
* 枚举 {@link TODO customer_create_from 字典}
*/
private Integer createFrom;
/**
* 归属时间
*/
private Date customerServiceConfirmedTime;
/**
* 客户角色
* <p>
* 枚举 {@link TODO customer_role 字典}
*/
private String roles;
/**
* 业务国家 逗号分隔
*/
private String busiCountryIds;
/**
* 竞争对手ID, 关联 customer_competitor 表主键
*/
private String competitorIds;
/**
* 年度发货量
*/
private BigDecimal weightYearly;
/**
* 年度发货次数
*/
private Integer numYearly;
/**
* 默认开票,1-是,0-否
*/
private Boolean defaultBilling;
// ======== 20240821 add end
/**
* vip等级-中文
*/
......
package cn.iocoder.yudao.module.customer.dal.dataobject.customerCompetitor;
import lombok.*;
import java.util.*;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
/**
* 客户竞争对手 DO
*
* @author yanghao
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("ecw_customer_competitor")
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class CustomerCompetitorDO extends BaseDO {
/**
* 主键ID
*/
@TableId
private Long id;
/**
* 名称
*/
private String name;
}
......@@ -75,10 +75,19 @@ public interface CustomerMapper extends BaseMapperX<CustomerDO> {
"",
"pt.title_zh as product_type_name_zh, pt.title_en as product_type_name_en,",
"",
"p.title_zh as product_name_zh, p.title_en as product_name_en,",
"(SELECT GROUP_CONCAT(title_zh) FROM ecw_product p WHERE FIND_IN_SET(p.id,(SELECT product_ids FROM ecw_customer WHERE id=c.id))) AS product_name_zh, ",
"(SELECT GROUP_CONCAT(title_en) FROM ecw_product p WHERE FIND_IN_SET(p.id,(SELECT product_ids FROM ecw_customer WHERE id=c.id))) AS product_name_en, ",
"",
"c.pickup_point,",
"n.title_zh as pickup_point_name_zh, n.title_en as pickup_point_name_en,",
"(SELECT GROUP_CONCAT(title_zh) FROM ecw_node n WHERE FIND_IN_SET(n.id,(SELECT pickup_points FROM ecw_customer WHERE id=c.id))) AS pickup_point_name_zh,",
"(SELECT GROUP_CONCAT(title_en) FROM ecw_node n WHERE FIND_IN_SET(n.id,(SELECT pickup_points FROM ecw_customer WHERE id=c.id))) AS pickup_point_name_en,",
"",
"(SELECT GROUP_CONCAT(name_zh) FROM ecw_country ct WHERE FIND_IN_SET(ct.id,(SELECT busi_country_ids FROM ecw_customer WHERE id=c.id))) AS busi_country_name_zh,",
"(SELECT GROUP_CONCAT(name_en) FROM ecw_country ct WHERE FIND_IN_SET(ct.id,(SELECT busi_country_ids FROM ecw_customer WHERE id=c.id))) AS busi_country_name_en,",
"",
"(SELECT GROUP_CONCAT(name) FROM ecw_customer_competitor ccp WHERE FIND_IN_SET(ccp.id,(SELECT competitor_ids FROM ecw_customer WHERE id=c.id))) AS competitor_names,",
"",
"uc.nickname as creator_name,",
"uu.nickname as updater_name,",
"",
"c.customer_service,",
"u.nickname as customer_service_name",
......@@ -88,9 +97,9 @@ public interface CustomerMapper extends BaseMapperX<CustomerDO> {
"left join ecw_customer_credit cc on c.credit_level = cc.id",
"left join ecw_country country on c.country = country.id",
"left join ecw_product_type pt on c.product_type = pt.id",
"left join ecw_product p on c.product_id = p.id",
"left join ecw_node n on c.pickup_point = n.id",
"left join system_user u on c.customer_service = u.id",
"left join system_user uc on c.creator = u.id",
"left join system_user uu on c.updater = u.id",
"where c.id = #{id}",
"</script>"
})
......
package cn.iocoder.yudao.module.customer.dal.mysql.customerCompetitor;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQuery;
import cn.iocoder.yudao.framework.mybatis.core.mapper.AbstractMapper;
import cn.iocoder.yudao.module.customer.dal.dataobject.customerCompetitor.CustomerCompetitorDO;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.customer.vo.customerCompetitor.*;
/**
* 客户竞争对手 Mapper
* @author yanghao
*/
@Mapper
public interface CustomerCompetitorMapper extends AbstractMapper<CustomerCompetitorDO> {
@Override
default PageResult<CustomerCompetitorDO> selectPage(PageVO page, Object object) {
if (object instanceof CustomerCompetitorQueryVO) {
CustomerCompetitorQueryVO vo = (CustomerCompetitorQueryVO)object;
return selectPage(page, new LambdaQuery<CustomerCompetitorDO>()
.likeIfPresent(CustomerCompetitorDO::getName, vo.getName())
.betweenIfPresent(CustomerCompetitorDO::getCreateTime, vo.getBeginCreateTime(), vo.getEndCreateTime())
.orderByDesc(CustomerCompetitorDO::getId));
}
return null;
}
@Override
default List<CustomerCompetitorDO> selectList(Object object) {
if (object instanceof CustomerCompetitorQueryVO) {
CustomerCompetitorQueryVO vo = (CustomerCompetitorQueryVO)object;
return selectList(new LambdaQuery<CustomerCompetitorDO>()
.likeIfPresent(CustomerCompetitorDO::getName, vo.getName())
.betweenIfPresent(CustomerCompetitorDO::getCreateTime, vo.getBeginCreateTime(), vo.getEndCreateTime())
.orderByDesc(CustomerCompetitorDO::getId));
}
return null;
}
}
......@@ -29,4 +29,8 @@ public interface ErrorCodeConstants {
ErrorCode BANK_NOT_EXISTS = new ErrorCode(1005001010, "客户银行账户不存在");
ErrorCode COMPETITOR_NOT_EXISTS = new ErrorCode(1005001011, "客户竞争对手不存在");
ErrorCode COMPETITOR_EXISTS = new ErrorCode(1005001012, "竞争对手名称已存在");
}
package cn.iocoder.yudao.module.customer.service.api;
import cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO;
import cn.iocoder.yudao.module.customer.dal.dataobject.customerContacts.CustomerContactsDO;
import cn.iocoder.yudao.module.customer.service.customer.CustomerService;
import cn.iocoder.yudao.module.customer.service.customerContacts.CustomerContactsService;
......@@ -7,8 +8,10 @@ import cn.iocoder.yudao.module.customer.vo.customer.customerContacts.CustomerCon
import cn.iocoder.yudao.module.customer.vo.customer.vo.CustomerCreateReqVO;
import cn.iocoder.yudao.module.ecw.api.customer.CustomerApi;
import cn.iocoder.yudao.module.ecw.dal.dataobject.country.CountryDO;
import cn.iocoder.yudao.module.ecw.enums.CustomerCreateFromEnum;
import cn.iocoder.yudao.module.ecw.enums.CustomerStatusEnum;
import cn.iocoder.yudao.module.ecw.service.country.CountryService;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
......@@ -84,6 +87,9 @@ public class CustomerApiImpl implements CustomerApi {
customerCreateReqVO.setCustomerOperateLogRemark("会员注册关联创建客户. 会员id:" + memberUserId + "; 电话:" + phone);
// app创建
customerCreateReqVO.setCreateFrom(CustomerCreateFromEnum.APP_REGISTER.getValue());
customerService.createCustomer(customerCreateReqVO);
}
......@@ -98,4 +104,12 @@ public class CustomerApiImpl implements CustomerApi {
public void approvalCustomerTransfer(String approveId, Integer result) {
customerService.approvalCustomerTransfer(approveId, result);
}
@Override
public void fillFirstDealTimeIfNull(Long customerId, Date firstDealTime) {
customerService.update(new LambdaUpdateWrapper<CustomerDO>()
.set(CustomerDO::getFirstDealTime, firstDealTime)
.isNull(CustomerDO::getFirstDealTime)
.eq(CustomerDO::getId, customerId));
}
}
......@@ -64,9 +64,7 @@ import cn.iocoder.yudao.module.customer.vo.customerBank.CustomerBankUpdateReqVO;
import cn.iocoder.yudao.module.customer.vo.customerDetail.CustomerOrderBackPageVO;
import cn.iocoder.yudao.module.customer.vo.customerOperateLog.CustomerOperateLogCreateReqVO;
import cn.iocoder.yudao.module.ecw.dal.dataobject.country.CountryDO;
import cn.iocoder.yudao.module.ecw.enums.CustomerOperateTypeEnum;
import cn.iocoder.yudao.module.ecw.enums.CustomerStatusEnum;
import cn.iocoder.yudao.module.ecw.enums.ErrorCodeConstants;
import cn.iocoder.yudao.module.ecw.enums.*;
import cn.iocoder.yudao.module.ecw.service.country.CountryService;
import cn.iocoder.yudao.module.ecw.service.internalMessage.InternalMessageService;
import cn.iocoder.yudao.module.ecw.service.paramValid.ParamValidatorService;
......@@ -210,8 +208,8 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper,
customerService = consignorCustomerDO.getCustomerService();
// 待分配。 若是发货人为代理和同行时,订单的收货人不同步到待分配客户
boolean isProxyConsignor = StringUtils.isNotEmpty(consignorCustomerDO.getType())
&& (consignorCustomerDO.getType().contains("2") || consignorCustomerDO.getType().contains("3"));
boolean isProxyConsignor = StringUtils.isNotEmpty(consignorCustomerDO.getRoles())
&& (consignorCustomerDO.getRoles().contains("2") || consignorCustomerDO.getRoles().contains("3"));
if (isProxyConsignor) {
log.info("若是发货人为代理和同行时,订单的收货人不同步到待分配客户");
return null;
......@@ -262,6 +260,8 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper,
customerCreateReqVO.setCustomerOperateLogRemark("管理端创建收货人时关联创建客户,进待分配列表");
customerCreateReqVO.setCustomerOperateLogOrderNo(orderNo);
customerCreateReqVO.setCreateFrom(CustomerCreateFromEnum.APP_CONSIGNOR.getValue());
Long customerId = this.createCustomer(customerCreateReqVO);
List<CustomerContactsDO> customerContactsDOS =
......@@ -319,6 +319,11 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper,
// 设置跟进客户经理
customer.setCustomerService(WebFrameworkUtils.getLoginUserId());
// 获取方式:自主创建
customer.setGetMethod(CustomerGetMethodEnum.CREATE.getValue());
// 归属时间:当前时间
customer.setCustomerServiceConfirmedTime(new Date());
boolean isFcl = isFcl(customer);
......@@ -532,6 +537,11 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper,
if (customerOld.getCustomerServiceAssignedTime() == null) {
customerNew.setCustomerServiceAssignedTime(now);
}
// 获取方式:分配/移交接收
customerNew.setGetMethod(CustomerGetMethodEnum.ASSIGN.getValue());
//老的归属时间为空,就设置归属时间
customerNew.setCustomerServiceConfirmedTime(now);
//设置预计进行公海池时间
//海运整柜 不掉入公海
if (isFcl) {
......
package cn.iocoder.yudao.module.customer.service.customerCompetitor;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.framework.mybatis.core.service.IService;
import cn.iocoder.yudao.module.customer.vo.customerCompetitor.*;
import cn.iocoder.yudao.module.customer.dal.dataobject.customerCompetitor.CustomerCompetitorDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
/**
* 客户竞争对手 Service 接口
*
* @author yanghao
*/
public interface CustomerCompetitorService extends IService<CustomerCompetitorDO> {
/**
* 创建客户竞争对手
* @param createReqVO 创建信息
* @return 编号
*/
Long createCompetitor(@Valid CustomerCompetitorCreateReqVO createReqVO);
/**
* 更新客户竞争对手
* @param updateReqVO 更新信息
*/
void updateCompetitor(@Valid CustomerCompetitorUpdateReqVO updateReqVO);
/**
* 删除客户竞争对手
* @param id 编号
*/
void deleteCompetitor(Long id);
/**
* 获得客户竞争对手
* @param id 编号
* @return 客户竞争对手
*/
CustomerCompetitorDO getCompetitor(Long id);
/**
* 获得客户竞争对手列表
* @param ids 编号
* @return 客户竞争对手列表
*/
List<CustomerCompetitorDO> getCompetitorList(Collection<Long> ids);
List<CustomerCompetitorDO> getCompetitorList();
/**
* 获得客户竞争对手分页
* @param page 分页查询
* @param query 查询
* @return 客户竞争对手分页
*/
PageResult<CustomerCompetitorDO> getCompetitorPage(CustomerCompetitorQueryVO query, PageVO page);
/**
* 获得客户竞争对手列表, 用于 Excel 导出
* @param query 查询
* @return 客户竞争对手列表
*/
List<CustomerCompetitorDO> getCompetitorList(CustomerCompetitorQueryVO query);
}
package cn.iocoder.yudao.module.customer.service.customerCompetitor;
import java.util.*;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.framework.mybatis.core.service.AbstractService;
import cn.iocoder.yudao.module.customer.vo.customerCompetitor.*;
import cn.iocoder.yudao.module.customer.dal.dataobject.customerCompetitor.CustomerCompetitorDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.customer.convert.customerCompetitor.CustomerCompetitorConvert;
import cn.iocoder.yudao.module.customer.dal.mysql.customerCompetitor.CustomerCompetitorMapper;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.customer.enums.ErrorCodeConstants.*;
/**
* 客户竞争对手 Service 实现类
*
* @author yanghao
*/
@Service
@Validated
public class CustomerCompetitorServiceImpl extends AbstractService<CustomerCompetitorMapper, CustomerCompetitorDO> implements CustomerCompetitorService {
@Resource
private CustomerCompetitorMapper competitorMapper;
@Override
public Long createCompetitor(CustomerCompetitorCreateReqVO createReqVO) {
// 校验存在
Long count = competitorMapper.selectCount("name", createReqVO.getName());
if (count != 0) {
throw exception(COMPETITOR_EXISTS);
}
// 插入
CustomerCompetitorDO competitor = CustomerCompetitorConvert.INSTANCE.convert(createReqVO);
competitorMapper.insert(competitor);
// 返回
return competitor.getId();
}
@Override
public void updateCompetitor(CustomerCompetitorUpdateReqVO updateReqVO) {
// 校验存在
this.validateCompetitorExists(updateReqVO.getId());
// 更新
CustomerCompetitorDO updateObj = CustomerCompetitorConvert.INSTANCE.convert(updateReqVO);
competitorMapper.updateById(updateObj);
}
@Override
public void deleteCompetitor(Long id) {
// 校验存在
this.validateCompetitorExists(id);
// 删除
competitorMapper.deleteById(id);
}
private void validateCompetitorExists(Long id) {
if (competitorMapper.selectById(id) == null) {
throw exception(COMPETITOR_NOT_EXISTS);
}
}
@Override
public CustomerCompetitorDO getCompetitor(Long id) {
return competitorMapper.selectById(id);
}
@Override
public List<CustomerCompetitorDO> getCompetitorList(Collection<Long> ids) {
return competitorMapper.selectBatchIds(ids);
}
@Override
public List<CustomerCompetitorDO> getCompetitorList() {
return competitorMapper.selectList();
}
@Override
public PageResult<CustomerCompetitorDO> getCompetitorPage(CustomerCompetitorQueryVO query, PageVO page) {
return competitorMapper.selectPage(page, query);
}
@Override
public List<CustomerCompetitorDO> getCompetitorList(CustomerCompetitorQueryVO query) {
return competitorMapper.selectList(query);
}
}
......@@ -37,11 +37,14 @@ public class CustomeDetailServiceImpl implements CustomerDetailService {
}
@Override
public PageResult<CustomerOfferBackVo> getCustomerOfferPage(Long customerId, PageParam pageParam) {
public PageResult<CustomerOfferBackVo> getCustomerOfferPage(CustomerOfferQueryVo offerQueryVo, PageParam pageParam) {
IPage<CustomerOfferBackVo> mpPage = MyBatisUtils.buildPage(pageParam);
QueryWrapperX queryWrapper = new QueryWrapperX();
queryWrapper.eq("t.deleted", 0);
queryWrapper.eq("t.relation_id", customerId);
queryWrapper.eq("t.relation_id", offerQueryVo.getCustomerId());
queryWrapper.inIfPresent("dst.guojia", offerQueryVo.getDestCountryId());
queryWrapper.inIfPresent("dst.shi", offerQueryVo.getObjectiveId());
queryWrapper.inIfPresent("dst.id", offerQueryVo.getDestWarehouseId());
customerDetailMapper.selectCustomerOfferPage(mpPage, queryWrapper);
return PageResult.of(mpPage);
}
......
......@@ -22,11 +22,11 @@ public interface CustomerDetailService {
/**
* 获得客户报价分页
*
* @param customerId 客户ID
* @param offerQueryVo 客户ID
* @param pageParam 分页参数
* @return 客户级别分页
*/
PageResult<CustomerOfferBackVo> getCustomerOfferPage(Long customerId, PageParam pageParam);
PageResult<CustomerOfferBackVo> getCustomerOfferPage(CustomerOfferQueryVo offerQueryVo, PageParam pageParam);
/**
* 根据运输方式得到订单总数
......
......@@ -46,11 +46,11 @@ public class CustomerCreateReqVO extends CustomerBaseVO {
@ApiModelProperty(value = "产品类型id")
private Long productType;
@ApiModelProperty(value = "产品id")
private Long productId;
@ApiModelProperty(value = "产品ids")
private String productIds;
@ApiModelProperty(value = "常用提货网点id")
private Long pickupPoint;
@ApiModelProperty(value = "常用提货网点ids")
private String pickupPoints;
@ApiModelProperty(value = "关联会员账号id")
private Long memberId;
......@@ -153,6 +153,51 @@ public class CustomerCreateReqVO extends CustomerBaseVO {
@ApiModelProperty(value = "客户银行账户", notes = "参见CustomerBankCreateReqVO")
private List<CustomerBankCreateReqVO> customerBanks;
// ======== 20240821 add start
/**
* 客户角色
* <p>
* 枚举 {@link TODO customer_role 字典}
*/
@ApiModelProperty(value = "客户角色")
private String roles;
/**
* 业务国家 逗号分隔
*/
@ApiModelProperty(value = "业务国家ids")
private String busiCountryIds;
/**
* 竞争对手IDs, 关联 customer_competitor 表主键
*/
@ApiModelProperty(value = "竞争对手IDs")
private String competitorIds;
/**
* 年度发货量
*/
@ApiModelProperty(value = "年度发货量")
private BigDecimal weightYearly;
/**
* 年度发货次数
*/
@ApiModelProperty(value = "年度发货次数")
private Integer numYearly;
/**
* 默认开票,1-是,0-否
*/
@ApiModelProperty(value = "默认开票,1-是,0-否")
private Boolean defaultBilling;
// ======== 20240821 add end
/**
......@@ -173,6 +218,10 @@ public class CustomerCreateReqVO extends CustomerBaseVO {
private String customerOperateLogOrderNo;
@JsonIgnore
private Integer createFrom;
/**
* 是否被订单收货人同步的
......
......@@ -63,11 +63,11 @@ public class CustomerDetailRespVO extends CustomerBaseVO {
@ApiModelProperty(value = "产品类型id")
private Long productType;
@ApiModelProperty(value = "产品id")
private Long productId;
@ApiModelProperty(value = "产品ids")
private String productIds;
@ApiModelProperty(value = "常用提货网点id")
private Long pickupPoint;
@ApiModelProperty(value = "常用提货网点ids")
private String pickupPoints;
@ApiModelProperty(value = "关联会员账号id")
private Long memberId;
......@@ -96,9 +96,17 @@ public class CustomerDetailRespVO extends CustomerBaseVO {
//客户创建日期格式化
//@JsonFormat(value = "创建时间", example = "1652017501000")
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY,
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND,
timezone = TIME_ZONE_DEFAULT)
private Date createTime;
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND,
timezone = TIME_ZONE_DEFAULT)
private Date updateTime;
@ApiModelProperty(value = "创建人名称")
private String creatorName;
@ApiModelProperty(value = "更新人名称")
private String updaterName;
//--------发票信息
......@@ -182,6 +190,50 @@ public class CustomerDetailRespVO extends CustomerBaseVO {
private List<CustomerBankBackVO> customerBankBackVOList;
// ======== 20240821 add start
/**
* 客户角色
* <p>
* 枚举 {@link TODO customer_role 字典}
*/
@ApiModelProperty(value = "客户角色")
private String roles;
/**
* 业务国家 逗号分隔
*/
@ApiModelProperty(value = "业务国家ids")
private String busiCountryIds;
/**
* 竞争对手IDs, 关联 customer_competitor 表主键
*/
@ApiModelProperty(value = "竞争对手IDs")
private String competitorIds;
/**
* 年度发货量
*/
@ApiModelProperty(value = "年度发货量")
private BigDecimal weightYearly;
/**
* 年度发货次数
*/
@ApiModelProperty(value = "年度发货次数")
private Integer numYearly;
/**
* 默认开票,1-是,0-否
*/
@ApiModelProperty(value = "默认开票,1-是,0-否")
private Boolean defaultBilling;
// ======== 20240821 add end
@ApiModelProperty(value = "国家中文名称")
private String countryNameZh;
......@@ -204,6 +256,22 @@ public class CustomerDetailRespVO extends CustomerBaseVO {
@ApiModelProperty(value = "常用提货点英文名称")
private String pickupPointNameEn;
@ApiModelProperty(value = "业务国家中文名称")
private String busiCountryNameZh;
@ApiModelProperty(value = "业务国家英文名称")
private String busiCountryNameEn;
/**
* 竞争对手IDs, 关联 customer_competitor 表主键
*/
@ApiModelProperty(value = "竞争对手名称")
private String competitorNames;
@ApiModelProperty(value = "付款人姓名")
private String payerName;
......
......@@ -53,11 +53,11 @@ public class CustomerUpdateReqVO extends CustomerBaseVO {
@ApiModelProperty(value = "产品类型")
private Long productType;
@ApiModelProperty(value = "产品id")
private Long productId;
@ApiModelProperty(value = "产品ids")
private String productIds;
@ApiModelProperty(value = "常用提货网点")
private Long pickupPoint;
@ApiModelProperty(value = "常用提货网点ids")
private String pickupPoints;
@ApiModelProperty(value = "关联会员账号")
private Long memberId;
......@@ -181,4 +181,49 @@ public class CustomerUpdateReqVO extends CustomerBaseVO {
@ApiModelProperty(value = "是否潜在客户")
private Boolean isPotential = false;
// ======== 20240821 add start
/**
* 客户角色
* <p>
* 枚举 {@link TODO customer_role 字典}
*/
@ApiModelProperty(value = "客户角色")
private String roles;
/**
* 业务国家 逗号分隔
*/
@ApiModelProperty(value = "业务国家ids")
private String busiCountryIds;
/**
* 竞争对手IDs, 关联 customer_competitor 表主键
*/
@ApiModelProperty(value = "竞争对手IDs")
private String competitorIds;
/**
* 年度发货量
*/
@ApiModelProperty(value = "年度发货量")
private BigDecimal weightYearly;
/**
* 年度发货次数
*/
@ApiModelProperty(value = "年度发货次数")
private Integer numYearly;
/**
* 默认开票,1-是,0-否
*/
@ApiModelProperty(value = "默认开票,1-是,0-否")
private Boolean defaultBilling;
// ======== 20240821 add end
}
package cn.iocoder.yudao.module.customer.vo.customerCompetitor;
import lombok.*;
import java.util.*;
import io.swagger.annotations.*;
import com.alibaba.excel.annotation.ExcelProperty;
import org.springframework.format.annotation.DateTimeFormat;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
/**
* 客户竞争对手 Response VO
* @author yanghao
*/
@Data
@ApiModel("管理后台 - 客户竞争对手 Response VO")
public class CustomerCompetitorBackVO {
@ExcelProperty("主键ID")
@ApiModelProperty(value = "主键ID", required = true)
private Long id;
@ExcelProperty("名称")
@ApiModelProperty(value = "名称", required = true)
private String name;
@ExcelProperty("创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "创建时间", required = true)
private Date createTime;
}
package cn.iocoder.yudao.module.customer.vo.customerCompetitor;
import lombok.*;
import java.util.*;
import io.swagger.annotations.*;
import javax.validation.constraints.*;
/**
* 客户竞争对手 Base VO,提供给添加、修改、详细的子 VO 使用
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
*/
@Data
public class CustomerCompetitorBaseVO {
@ApiModelProperty(value = "名称", required = true)
@NotNull(message = "名称不能为空")
private String name;
}
package cn.iocoder.yudao.module.customer.vo.customerCompetitor;
import lombok.*;
import java.util.*;
import io.swagger.annotations.*;
import javax.validation.constraints.*;
@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel("管理后台 - 客户竞争对手创建 Request VO")
public class CustomerCompetitorCreateReqVO extends CustomerCompetitorBaseVO {
}
package cn.iocoder.yudao.module.customer.vo.customerCompetitor;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Data
@ApiModel("管理后台 - 客户竞争对手查询 VO")
public class CustomerCompetitorQueryVO {
@ApiModelProperty(value = "名称")
private String name;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始创建时间")
private Date beginCreateTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束创建时间")
private Date endCreateTime;
}
package cn.iocoder.yudao.module.customer.vo.customerCompetitor;
import lombok.*;
import java.util.*;
import io.swagger.annotations.*;
import javax.validation.constraints.*;
@ApiModel("管理后台 - 客户竞争对手更新 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class CustomerCompetitorUpdateReqVO extends CustomerCompetitorBaseVO {
@ApiModelProperty(value = "主键ID", required = true)
@NotNull(message = "主键ID不能为空")
private Long id;
}
package cn.iocoder.yudao.module.customer.vo.customerDetail;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -8,6 +9,7 @@ import lombok.Data;
import java.util.Date;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@ApiModel("管理后台 - 客户基本信息客户报价 Response VO")
@Data
......@@ -21,6 +23,7 @@ public class CustomerOfferBackVo {
@ApiModelProperty(value = "客户名称")
private String consignorName;
@ApiModelProperty(value = "目的地中文")
private String objectiveName;
......@@ -30,10 +33,44 @@ public class CustomerOfferBackVo {
@ApiModelProperty(value = "取消报价:0,特价审批中:1,草稿:2, 需求确认:3,赢单:4,输单:5,报价完成:6 跟进中:7")
private Integer status;
@ApiModelProperty(value = "业务员名称")
@ApiModelProperty(value = "业务员名称-客户经理")
private String businessManagerName;
@ApiModelProperty(value = "预计结束时间")
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY)
private Date stopTime;
@ApiModelProperty(value = "创建时间", required = true)
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date createTime;
@ExcelProperty("价格有效期开始")
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY)
private Date startTime;
@ExcelProperty("价格有效期结束")
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY)
private Date endTime;
@ExcelProperty("重要程度")
private Integer importance;
@ApiModelProperty(value = "联系人名称")
private String relationName;
@ApiModelProperty(value = "联系人区号")
private String relationAreaCode;
@ApiModelProperty(value = "联系人手机号")
private String relationPhone;
// 线路相关
@ExcelProperty("始发仓库id")
private Long startWarehouseId;
@ExcelProperty("目的仓库id")
private Long destWarehouseId;
@ExcelProperty("运输方式")
private String transportType;
}
package cn.iocoder.yudao.module.customer.vo.customerDetail;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@ApiModel("管理后台 - 客户基本信息报价查询 Request VO")
@Data
public class CustomerOfferQueryVo {
@ApiModelProperty(value = "客户id")
private Long customerId;
@ApiModelProperty(value = "目的国id")
private List<Long> destCountryId ;
@ApiModelProperty(value = "目的地id")
private List<Long> objectiveId;
@ApiModelProperty(value = "目的仓ID")
private List<Long> destWarehouseId;
}
......@@ -19,11 +19,18 @@
s.title_en as objective_name_en,
t.status as status,
t.stop_time as stop_time,
u.nickname as business_manager_name
u.nickname as business_manager_name,
t.create_time, t.start_time, t.end_time, t.importance,
cc.name as relation_name, cc.area_code as relation_area_code, cc.phone_new as relation_phone,
line.start_warehouse_id, line.dest_warehouse_id, line.transport_type
from ecw_offer t
left join ecw_region s
on t.objective_id = s.id
left join ecw_region s on t.objective_id = s.id
left join system_user u on t.follow_up_salesman_id = u.id
left join ecw_customer_contacts cc on (t.relation = 1 and cc.id = t.consignor_id) or (t.relation = 2 and cc.id = t.consignee_id)
left join ecw_warehouse_line line on t.line_id = line.id
left join ecw_warehouse dst on line.dest_warehouse_id = dst.id
${ew.customSqlSegment}
</select>
<select id="selectCustomerFollowPage"
......
......@@ -788,6 +788,8 @@
a.customer_service = #{customerServiceId},
-- 分配时间
a.customer_service_assigned_time = now(),
-- 获取方式:分配/移交接收
a.get_method = 2,
-- 确认接收置为false
a.is_customer_service_confirmed = 0,
......@@ -867,6 +869,10 @@
a.is_customer_service_confirmed = 1,
-- 分配时间
a.customer_service_assigned_time = now(),
-- 归属时间
a.customer_service_confirmed_time = now(),
-- 获取方式:公海捞取
a.get_method = 3,
-- 设置捞取时间
a.catch_time = now(),
-- 报价单延期次数重置为0
......
......@@ -50,6 +50,7 @@ import cn.iocoder.yudao.module.customer.vo.customerBank.CustomerBankBackVO;
import cn.iocoder.yudao.module.customer.vo.customerBank.CustomerBankQueryVO;
import cn.iocoder.yudao.module.ecw.api.paramValid.ParamValidatorApi;
import cn.iocoder.yudao.module.ecw.enums.CustomerContactsDefaultEnum;
import cn.iocoder.yudao.module.ecw.enums.CustomerCreateFromEnum;
import cn.iocoder.yudao.module.ecw.enums.CustomerOperateTypeEnum;
import cn.iocoder.yudao.module.ecw.enums.ErrorCodeConstants;
import cn.iocoder.yudao.module.ecw.service.busiPwd.BusiPwdService;
......@@ -239,6 +240,9 @@ public class CustomerController {
}
}
// 后台创建
createReqVO.setCreateFrom(CustomerCreateFromEnum.BACKEND.getValue());
return success(customerService.createCustomer(createReqVO));
}
......
package cn.iocoder.yudao.module.customer.controller.admin.customerCompetitor;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.*;
import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.customer.vo.customerCompetitor.*;
import cn.iocoder.yudao.module.customer.dal.dataobject.customerCompetitor.CustomerCompetitorDO;
import cn.iocoder.yudao.module.customer.convert.customerCompetitor.CustomerCompetitorConvert;
import cn.iocoder.yudao.module.customer.service.customerCompetitor.CustomerCompetitorService;
@Validated
@RestController
@Api(tags = "管理后台 - 客户竞争对手")
@RequestMapping("/customer/competitor")
public class CustomerCompetitorController {
@Resource
private CustomerCompetitorService competitorService;
@PostMapping("/create")
@ApiOperation("创建客户竞争对手")
// @PreAuthorize("@ss.hasPermission('customer:competitor:create')")
public CommonResult<Long> createCompetitor(@Valid @RequestBody CustomerCompetitorCreateReqVO createReqVO) {
return success(competitorService.createCompetitor(createReqVO));
}
// @PutMapping("/update")
// @ApiOperation("更新客户竞争对手")
// @PreAuthorize("@ss.hasPermission('customer:competitor:update')")
// public CommonResult<Boolean> updateCompetitor(@Valid @RequestBody CustomerCompetitorUpdateReqVO updateReqVO) {
// competitorService.updateCompetitor(updateReqVO);
// return success(true);
// }
//
// @DeleteMapping("/delete")
// @ApiOperation("删除客户竞争对手")
// @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
// @PreAuthorize("@ss.hasPermission('customer:competitor:delete')")
// public CommonResult<Boolean> deleteCompetitor(@RequestParam("id") Long id) {
// competitorService.deleteCompetitor(id);
// return success(true);
// }
//
// @GetMapping("/get")
// @ApiOperation("获得客户竞争对手")
// @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
// @PreAuthorize("@ss.hasPermission('customer:competitor:query')")
// public CommonResult<CustomerCompetitorBackVO> getCompetitor(@RequestParam("id") Long id) {
// CustomerCompetitorDO competitor = competitorService.getCompetitor(id);
// return success(CustomerCompetitorConvert.INSTANCE.convert(competitor));
// }
@GetMapping("/list")
@ApiOperation("获得客户竞争对手列表")
@ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)
// @PreAuthorize("@ss.hasPermission('customer:competitor:query')")
public CommonResult<List<CustomerCompetitorBackVO>> getCompetitorList(@RequestParam("ids") Collection<Long> ids) {
List<CustomerCompetitorDO> list = competitorService.getCompetitorList(ids);
return success(CustomerCompetitorConvert.INSTANCE.convertList(list));
}
@GetMapping("/listAll")
@ApiOperation("获得所有客户竞争对手列表")
// @PreAuthorize("@ss.hasPermission('customer:competitor:query')")
public CommonResult<List<CustomerCompetitorBackVO>> getCompetitorListAll() {
List<CustomerCompetitorDO> list = competitorService.getCompetitorList();
return success(CustomerCompetitorConvert.INSTANCE.convertList(list));
}
// @GetMapping("/page")
// @ApiOperation("获得客户竞争对手分页")
// @PreAuthorize("@ss.hasPermission('customer:competitor:query')")
// public CommonResult<PageResult<CustomerCompetitorBackVO>> getCompetitorPage(@Valid CustomerCompetitorQueryVO query, PageVO page) {
// PageResult<CustomerCompetitorDO> pageResult = competitorService.getCompetitorPage(query, page);
// return success(CustomerCompetitorConvert.INSTANCE.convertPage(pageResult));
// }
// @GetMapping("/export-excel")
// @ApiOperation("导出客户竞争对手 Excel")
// @PreAuthorize("@ss.hasPermission('customer:competitor:export')")
// @OperateLog(type = EXPORT)
// public void exportCompetitorExcel(@Valid CustomerCompetitorQueryVO query,
// HttpServletResponse response) throws IOException {
// List<CustomerCompetitorDO> list = competitorService.getCompetitorList(query);
// // 导出 Excel
// List<CustomerCompetitorBackVO> datas = CustomerCompetitorConvert.INSTANCE.convertList(list);
// ExcelUtils.write(response, "客户竞争对手.xls", "数据", CustomerCompetitorBackVO.class, datas);
// }
}
......@@ -10,4 +10,13 @@ Content-Type: application/json
GET {{baseUrl}}/customer/detail/infoList/creditScoreStatistic?customerId=34831
Authorization: Bearer {{token}}
tenant-id: {{adminTenentId}}
Content-Type: application/json
### 客户报价
GET {{baseUrl}}/customer/detail/infoList/offerPage?pageNo=1&pageSize=10&total=0&customerId=12925
Authorization: Bearer {{token}}
tenant-id: {{adminTenentId}}
Content-Type: application/json
\ No newline at end of file
......@@ -48,9 +48,9 @@ public class CustomerDetailController {
@GetMapping("/offerPage")
@ApiOperation("获取报价分页")
public CommonResult<PageResult<CustomerOfferBackVo>> getOfferPage(@RequestParam("customerId") Long customerId, PageParam page) {
public CommonResult<PageResult<CustomerOfferBackVo>> getOfferPage(CustomerOfferQueryVo offerQueryVo, PageParam page) {
PageResult<CustomerOfferBackVo> pageResult =
customerDetailService.getCustomerOfferPage(customerId, page);
customerDetailService.getCustomerOfferPage(offerQueryVo, page);
return success(pageResult);
}
......
package cn.iocoder.yudao.module.ecw.api.customer;
import java.util.Date;
public interface CustomerApi {
void associateCustomerAuto(String areaCode, String phone, Long userId, String newName);
void approvalCustomerDelay(String approveId, Integer result);
void approvalCustomerTransfer(String approveId, Integer result);
void fillFirstDealTimeIfNull(Long customerId, Date firstDealTime);
}
package cn.iocoder.yudao.module.ecw.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
/**
* 客户创建入口类型枚举
*/
@AllArgsConstructor
@Getter
public enum CustomerCreateFromEnum {
//1、导入 2、后台用户创建 3、APP注册 4、发货人创建
IMPORT(1, "导入"),
BACKEND(2, "后台用户创建"),
APP_REGISTER(3, "APP注册"),
APP_CONSIGNOR(4, "APP发货人创建");
;
/**
* 类型
*/
private final Integer value;
/**
* 类型名
*/
private final String name;
public static String getNameByValue(Integer value) {
return Arrays.stream(CustomerCreateFromEnum.values()).filter(t -> t.getValue().equals(value)).map(CustomerCreateFromEnum::getName).findFirst().orElse("");
}
public static CustomerCreateFromEnum get(Integer value) {
return Arrays.stream(CustomerCreateFromEnum.values()).filter(t -> t.getValue().equals(value)).findFirst().orElse(null);
}
}
package cn.iocoder.yudao.module.ecw.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
/**
* 客户获取方式类型枚举
*/
@AllArgsConstructor
@Getter
public enum CustomerGetMethodEnum {
CREATE(1, "自主创建"),
ASSIGN(2, "分配/移交接收"),
CATCH(3, "公海捞取");
;
/**
* 类型
*/
private final Integer value;
/**
* 类型名
*/
private final String name;
public static String getNameByValue(Integer value) {
return Arrays.stream(CustomerGetMethodEnum.values()).filter(t -> t.getValue().equals(value)).map(CustomerGetMethodEnum::getName).findFirst().orElse("");
}
public static CustomerGetMethodEnum get(Integer value) {
return Arrays.stream(CustomerGetMethodEnum.values()).filter(t -> t.getValue().equals(value)).findFirst().orElse(null);
}
}
package cn.iocoder.yudao.module.ecw.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
/**
* 客户角色类型枚举
*/
@AllArgsConstructor
@Getter
public enum CustomerRoleEnum {
//0、CO 1、工程商 2、代理 6、集运
C0(0, "C0"),
CONTRACTOR(1, "工程商"),
PROXY(2, "代理"),
CONSOLIDATOR(6, "集运");
;
/**
* 类型
*/
private final Integer value;
/**
* 类型名
*/
private final String name;
public static String getNameByValue(Integer value) {
return Arrays.stream(CustomerRoleEnum.values()).filter(t -> t.getValue().equals(value)).map(CustomerRoleEnum::getName).findFirst().orElse("");
}
public static CustomerRoleEnum get(Integer value) {
return Arrays.stream(CustomerRoleEnum.values()).filter(t -> t.getValue().equals(value)).findFirst().orElse(null);
}
}
......@@ -120,8 +120,8 @@ public class MemberRegListener {
OrderConsignorDO orderConsignorByOrderId = orderConsignorService.getOrderConsignorByOrderId(orderId);
if (orderConsignorByOrderId != null && orderConsignorByOrderId.getCustomerId() != null) {
CustomerDO orderConsignorCustomer = customerService.getCustomer(orderConsignorByOrderId.getCustomerId());
if (orderConsignorCustomer != null && StringUtils.isNotEmpty(orderConsignorCustomer.getType())
&& !orderConsignorCustomer.getType().contains("2") && !orderConsignorCustomer.getType().contains("3")) {
if (orderConsignorCustomer != null && StringUtils.isNotEmpty(orderConsignorCustomer.getRoles())
&& !orderConsignorCustomer.getRoles().contains("2") && !orderConsignorCustomer.getRoles().contains("3")) {
//设置为发货人的客户经理
orderConsigneeCustomer.setCustomerService(orderConsignorCustomer.getCustomerService());
orderConsigneeCustomer.setConsigneeFirstCustomerService(orderConsignorCustomer.getCustomerService());
......
......@@ -1464,6 +1464,9 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
orderTimeDO.setRemarksZh(String.format(orderAirTimeEnum.getRemarksZh(), objective.getTitleZh()));
orderTimeDO.setRemarksEn(String.format(orderAirTimeEnum.getRemarksEn(), objective.getTitleEn()));
}
orderMapper.update(null, new LambdaUpdateWrapper<OrderDO>()
.set(OrderDO::getUnloadTime, businessTime)
.eq(OrderDO::getOrderId, orderDO.getOrderId()));
// LogisticsInfoDto logisticsDestInfoDto = warehouseLineMapper.getStartInfoAndDestInfoByLineId(orderDO.getLineId());
// if (Objects.nonNull(logisticsDestInfoDto)) {
// orderTimeDO.setRemarksZh(String.format(orderAirTimeEnum.getRemarksZh(), logisticsDestInfoDto.getDestTitleZh()));
......@@ -1596,6 +1599,9 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
orderTimeDO.setRemarksZh(String.format(orderSeaTimeEnum.getRemarksZh(), objective.getTitleZh()));
orderTimeDO.setRemarksEn(String.format(orderSeaTimeEnum.getRemarksEn(), objective.getTitleEn()));
}
orderMapper.update(null, new LambdaUpdateWrapper<OrderDO>()
.set(OrderDO::getUnloadTime, businessTime)
.eq(OrderDO::getOrderId, orderDO.getOrderId()));
// LogisticsInfoDto logisticsDestInfoDto = warehouseLineMapper.getStartInfoAndDestInfoByLineId(orderDO.getLineId());
// if (Objects.nonNull(logisticsDestInfoDto)) {
// orderTimeDO.setRemarksZh(String.format(orderSeaTimeEnum.getRemarksZh(), logisticsDestInfoDto.getDestTitleZh()));
......
......@@ -4252,16 +4252,16 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
currentOrderDO.setDaogangTime(now);
// }
break;
case UNLOADED_CABINET:
// case UNLOADED_CABINET:
// if (Objects.isNull(currentOrderDO.getUnloadTime())) {
currentOrderDO.setUnloadTime(now);
// currentOrderDO.setUnloadTime(now);
// }
break;
case UNLOADED_CABINET_AIR:
// break;
// case UNLOADED_CABINET_AIR:
// if (Objects.isNull(currentOrderDO.getUnloadTime())) {
currentOrderDO.setUnloadTime(now);
// currentOrderDO.setUnloadTime(now);
// }
break;
// break;
case PICKED_UP:
// if (Objects.isNull(currentOrderDO.getTakeTime())) {
currentOrderDO.setTakeTime(now);
......
......@@ -418,9 +418,9 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
customerService.getCustomer(orderConsignorDO.getCustomerId());
// 发货人不是代理或同行
if (orderConsignorCustomer != null &&
StringUtils.isNotEmpty(orderConsignorCustomer.getType())
&& !orderConsignorCustomer.getType().contains("2") &&
!orderConsignorCustomer.getType().contains("3")) {
StringUtils.isNotEmpty(orderConsignorCustomer.getRoles())
&& !orderConsignorCustomer.getRoles().contains("2") &&
!orderConsignorCustomer.getRoles().contains("3")) {
// 收货人信息
OrderConsigneeDO orderConsigneeDO =
orderConsigneeService.getOrderConsigneeByOrderId(orderId);
......
......@@ -323,9 +323,12 @@ public class OrderBackPageVO {
@ApiModelProperty(value = "首次入仓时间")
private Date inTime;
@ApiModelProperty(value = "已装柜时间")
@ApiModelProperty(value = "已装柜时间/到仓时间")
private Date loadTime;
@ApiModelProperty(value = "已卸柜时间/出仓时间")
private Date unloadTime;
/**
* 渠道名称
......@@ -460,6 +463,23 @@ public class OrderBackPageVO {
private Integer lang;
// -----------start -----------
// add 20240825. 客户详情中 订单列表返回的数据
@ApiModelProperty(value = "报价单编号 多个以逗号分隔")
private String offerNumbers;
@ApiModelProperty(value = "业绩归属客户名称")
private String customerName;
@ApiModelProperty(value = "提货数量")
private Integer pickNum;
// -----------end -----------
public void setGuanLianOrderStatus(String guanLianOrderStatus) {
this.guanLianOrderStatus = guanLianOrderStatus;
if (StringUtils.isNotBlank(guanLianOrderStatus)) {
......
......@@ -1006,6 +1006,7 @@
o.is_exception,
o.create_time,
o.load_time,
o.unload_time,
(select su.nickname from system_user su where su.deleted = 0 and su.id = o.salesman_id) as salesman_name,
(select min(wi.`in_time`) from ecw_order_warehouse_in wi where wi.deleted = 0 and wi.order_id = o.order_id ) as
in_time,
......@@ -1020,8 +1021,12 @@
nee.country_code as consignee_country_code,
if(#{query.lang} = 0, channel.name_zh, channel.name_en) as channel_name,
o.update_time,
#{query.lang} as lang
#{query.lang} as lang,
(SELECT GROUP_CONCAT(t1.number) FROM ecw_offer t1 WHERE t1.order_id = o.order_id and t1.status = 4) as offer_numbers,
c.name as customer_name,
(SELECT sum(eop.pick_num) FROM ecw_order_pickup eop WHERE eop.order_id = o.order_no) AS pickNum
from ecw_order o
left join ecw_customer c on o.customer_id = c.id
left join (
SELECT
ewl.id AS line_id,
......
......@@ -74,7 +74,7 @@ tenant-id: {{adminTenentId}}
### 查询前20条
GET {{baseUrl}}/ecw/order/customer-order-page?customerDetailId=29572
GET {{baseUrl}}/ecw/order/customer-order-page?page=2&customerDetailId=12925
Authorization: Bearer {{token}}
tenant-id: {{adminTenentId}}
......
......@@ -139,5 +139,21 @@ public interface ReceiptService extends IService<ReceiptDO> {
ReceiptExportDto getReceiptExportByOrderId(Long orderId);
/**
* 判断当前收款单有没有达到比例
*
* @param receiptDO
* @param proportion
* @return
*/
Boolean judgingProportion(ReceiptDO receiptDO, String proportion);
/**
* 自动更新收款单的核销状态
*
* @param receiptDO
*/
void autoWriteOffReceipt(ReceiptDO receiptDO, String userId, String userName);
}
package cn.iocoder.yudao.module.wealth.controller.admin.job;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
import cn.iocoder.yudao.framework.tenant.core.job.TenantJob;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receipt.ReceiptDO;
import cn.iocoder.yudao.module.wealth.enums.ReceiptStatusEnum;
import cn.iocoder.yudao.module.wealth.service.receipt.ReceiptService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.List;
/**
* 收款单自动核销任务
*/
@Component
@TenantJob
@Slf4j
public class ReceiptAutoWriteOff implements JobHandler {
@Resource
ReceiptService receiptService;
@Resource
AdminUserApi adminUserApi;
@Override
public String execute(String param) throws Exception {
if (StrUtil.isBlank(param)) {
log.error("自动核销比例未配置,自动退出");
return "";
}
String[] paramArray = param.split(",");
if (paramArray.length != 2 || StrUtil.isBlank(paramArray[0]) || StrUtil.isBlank(paramArray[1])) {
log.error("自动核销比例JOB参数错误,自动退出");
return "";
}
AdminUserRespDTO adminUserRespDTO = adminUserApi.getUser(Long.parseLong(paramArray[1]));
if (null == adminUserRespDTO) {
log.error("自动核销比例JOB参数错误,核销人配置错误,自动退出");
return "";
}
//查询所有收款单状态为待核销的
LambdaQueryWrapper<ReceiptDO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.and(i -> i.eq(ReceiptDO::getState, ReceiptStatusEnum.WRITE_OFF_WAITING.getValue()).or().eq(ReceiptDO::getState, ReceiptStatusEnum.WRITE_OFF_PART_ING.getValue()));
List<ReceiptDO> receiptDOList = receiptService.selectList(lambdaQueryWrapper);
for (ReceiptDO receiptDO : receiptDOList) {
try {
//判断当前收款单下的收款明细是不是全部是已核销并且核销比例要大于配置(params)
Boolean result = receiptService.judgingProportion(receiptDO, paramArray[0]);
if (result) {
receiptService.autoWriteOffReceipt(receiptDO, paramArray[1], adminUserRespDTO.getNickname());
}
} catch (Exception e) {
log.error("收款单{}自动核销出错原因:{}", receiptDO.getReceiptNo(), e.getMessage());
}
}
return "";
}
}
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