Commit ddcf924c authored by 332784038@qq.com's avatar 332784038@qq.com

Merge branch 'release-fix' into dev

parents f1ba7836 7c8be878
...@@ -356,12 +356,12 @@ public class CustomerDO extends BaseDO { ...@@ -356,12 +356,12 @@ public class CustomerDO extends BaseDO {
/** /**
* 默认付款,1-是,0-否 * 默认付款,1-是,0-否
*/ */
private Boolean defaultPay ; private Boolean defaultPay;
/** /**
* 控货无收货人,1-是,0-否 * 控货无收货人,1-是,0-否
*/ */
private Boolean noConsignee ; private Boolean noConsignee;
@ApiModelProperty("延期申请次数") @ApiModelProperty("延期申请次数")
private int delayApprovalNum ; private int delayApprovalNum ;
...@@ -504,6 +504,12 @@ public class CustomerDO extends BaseDO { ...@@ -504,6 +504,12 @@ public class CustomerDO extends BaseDO {
@TableField(exist = false) @TableField(exist = false)
private String customerServiceName; private String customerServiceName;
/**
* 创建者名字
*/
@TableField(exist = false)
private String createUsername;
/** /**
* 国家名称 * 国家名称
......
...@@ -36,7 +36,7 @@ public interface CustomerMapper extends BaseMapperX<CustomerDO> { ...@@ -36,7 +36,7 @@ public interface CustomerMapper extends BaseMapperX<CustomerDO> {
IPage<CustomerDO> getPage(IPage<CustomerDO> page, IPage<CustomerDO> getPage(IPage<CustomerDO> page,
@Param(Constants.WRAPPER) Wrapper<CustomerDO> queryWrapper); @Param(Constants.WRAPPER) Wrapper<CustomerDO> queryWrapper);
List<CustomerDO> getMyPage(@Param("start") int start, @Param("size") int size, @Param("query")CustomerPageReqDTO customerPageReqDTO); List<CustomerDO> getMyPage(@Param("start") Integer start, @Param("size") Integer size, @Param("query")CustomerPageReqDTO customerPageReqDTO);
List<CustomerDO> getWaitToAssignedCustomerPageReq(@Param("start") int start, @Param("size") int size, @Param("query")CustomerPageReqDTO customerPageReqDTO); List<CustomerDO> getWaitToAssignedCustomerPageReq(@Param("start") int start, @Param("size") int size, @Param("query")CustomerPageReqDTO customerPageReqDTO);
/** /**
......
...@@ -11,90 +11,90 @@ import java.util.List; ...@@ -11,90 +11,90 @@ 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.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Data @Data
public class CustomerExportReqDTO { public class CustomerExportReqDTO extends CustomerPageReqDTO {
@ApiModelProperty(value = "客户编号") // @ApiModelProperty(value = "客户编号")
private String number; // private String number;
//
@ApiModelProperty(value = "客户名称") // @ApiModelProperty(value = "客户名称")
private String name; // private String name;
//
@ApiModelProperty(value = "客户等级") // @ApiModelProperty(value = "客户等级")
private List<Integer> level; // private List<Integer> level;
//
@ApiModelProperty(value = "客户来源") // @ApiModelProperty(value = "客户来源")
private List<Integer> source; // private List<Integer> source;
//
@ApiModelProperty(value = "客户类别") // @ApiModelProperty(value = "客户类别")
private List<String> type; // private List<String> type;
//
@ApiModelProperty(value = "客户货运类型", notes = "参见customer_transport_type数据字典") // @ApiModelProperty(value = "客户货运类型", notes = "参见customer_transport_type数据字典")
private String transportType; // private String transportType;
//
@ApiModelProperty(value = "客户资源类型", notes = "参见customer_resource_type数据字典") // @ApiModelProperty(value = "客户资源类型", notes = "参见customer_resource_type数据字典")
private List<Integer> resourceType; // private List<Integer> resourceType;
//
@ApiModelProperty(value = "跟进客服") // @ApiModelProperty(value = "跟进客服")
private List<Long> customerService; // private List<Long> customerService;
//
@ApiModelProperty(value = "客户状态") // @ApiModelProperty(value = "客户状态")
private List<Integer> status; // private List<Integer> status;
//
@ApiModelProperty(value = "部门") // @ApiModelProperty(value = "部门")
private String department; // private String department;
//
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) // @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始创建时间") // @ApiModelProperty(value = "开始创建时间")
private Date beginCreateTime; // private Date beginCreateTime;
//
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) // @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束创建时间") // @ApiModelProperty(value = "结束创建时间")
private Date endCreateTime; // private Date endCreateTime;
//
//
//
@ApiModelProperty(value = "主联系人") // @ApiModelProperty(value = "主联系人")
private String defaultContactName; // private String defaultContactName;
//
@ApiModelProperty(value = "主联系电话") // @ApiModelProperty(value = "主联系电话")
private String defaultContactPhone; // private String defaultContactPhone;
//
//
//
@ApiModelProperty(value = "信用等级") // @ApiModelProperty(value = "信用等级")
private List<Integer> creditLevel; // private List<Integer> creditLevel;
//
@ApiModelProperty(value = "国家") // @ApiModelProperty(value = "国家")
private List<Integer> country; // private List<Integer> country;
//
@ApiModelProperty(value = "是否在公海") // @ApiModelProperty(value = "是否在公海")
private Boolean isInOpenSea; // private Boolean isInOpenSea;
//
@ApiModelProperty(value = "是否潜在客户") // @ApiModelProperty(value = "是否潜在客户")
private Boolean isPotential; // private Boolean isPotential;
//
//
//
//api不显示此3个字段 // //api不显示此3个字段
//是否接收,后台使用 // //是否接收,后台使用
@JsonIgnore // @JsonIgnore
private Boolean isCustomerServiceConfirmed; // private Boolean isCustomerServiceConfirmed;
//
//因接口公用方法新增:24小时内数据查询条件标识 // //因接口公用方法新增:24小时内数据查询条件标识
private String flag4QueryCondition; // private String flag4QueryCondition;
//
private List<Integer> marketType; // private List<Integer> marketType;
//
private int deptId ; // private int deptId ;
//
@ApiModelProperty(value = "会员编号") // @ApiModelProperty(value = "会员编号")
private String memberCode; // private String memberCode;
@ApiModelProperty(value = "会员名称") // @ApiModelProperty(value = "会员名称")
private String memberName; // private String memberName;
@ApiModelProperty(value = "会员手机") // @ApiModelProperty(value = "会员手机")
private String memberMobile; // private String memberMobile;
@ApiModelProperty(value = "会员区号") // @ApiModelProperty(value = "会员区号")
private String memberAreaCode; // private String memberAreaCode;
} }
...@@ -9,6 +9,7 @@ import lombok.EqualsAndHashCode; ...@@ -9,6 +9,7 @@ import lombok.EqualsAndHashCode;
import lombok.ToString; import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -35,8 +36,8 @@ public class CustomerPageReqDTO extends PageParam { ...@@ -35,8 +36,8 @@ public class CustomerPageReqDTO extends PageParam {
@ApiModelProperty(value = "客户类别") @ApiModelProperty(value = "客户类别")
private List<String> type; private List<String> type;
@ApiModelProperty(value = "客户货运类型", notes = "参见customer_transport_type数据字典") @ApiModelProperty(value = "出货渠道", notes = "参见customer_transport_type数据字典")
private String transportType; private List<String> transportType;
@ApiModelProperty(value = "客户资源类型", notes = "参见customer_resource_type数据字典") @ApiModelProperty(value = "客户资源类型", notes = "参见customer_resource_type数据字典")
private List<Integer> resourceType; private List<Integer> resourceType;
...@@ -51,8 +52,11 @@ public class CustomerPageReqDTO extends PageParam { ...@@ -51,8 +52,11 @@ public class CustomerPageReqDTO extends PageParam {
@ApiModelProperty(value = "客户状态") @ApiModelProperty(value = "客户状态")
private List<Integer> status; private List<Integer> status;
// @ApiModelProperty(value = "部门")
// private String department;
@ApiModelProperty(value = "部门") @ApiModelProperty(value = "部门")
private String department; private List<Long> deptIds;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始创建时间") @ApiModelProperty(value = "开始创建时间")
...@@ -100,4 +104,112 @@ public class CustomerPageReqDTO extends PageParam { ...@@ -100,4 +104,112 @@ public class CustomerPageReqDTO extends PageParam {
private String memberMobile; private String memberMobile;
@ApiModelProperty(value = "会员区号") @ApiModelProperty(value = "会员区号")
private String memberAreaCode; private String memberAreaCode;
// 20240904 add start
@ApiModelProperty(value = "客户角色")
private List<String> role;
/**
* 业务国家 逗号分隔
*/
@ApiModelProperty(value = "业务国家")
private List<Long> busiCountryIds;
@ApiModelProperty(value = "常用提货网点")
private List<Long> pickupPoints;
@ApiModelProperty(value = "创建人")
private Long founder;
// 开始入公海时间和结束入公海时间
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始入公海时间")
private Date beginEnterOpenSeaTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束入公海时间")
private Date endEnterOpenSeaTime;
@ApiModelProperty(value = "业绩类型(老客户:0 新客户:1)")
private Boolean isNew;
// 大于等于年度发货量
@ApiModelProperty(value = "大于等于年度发货量")
private BigDecimal geWeightYearly;
// 小于等于年度发货量
@ApiModelProperty(value = "小于等于年度发货量")
private BigDecimal leWeightYearly;
// 等于年度发货量
@ApiModelProperty(value = "等于年度发货量")
private BigDecimal eqWeightYearly;
// 大于等于年度发货次数
@ApiModelProperty(value = "大于等于年度发货次数")
private Integer geNumYearly;
// 小于等于年度发货次数
@ApiModelProperty(value = "小于等于年度发货次数")
private Integer leNumYearly;
// 等于年度发货次数
@ApiModelProperty(value = "等于年度发货次数")
private Integer eqNumYearly;
@ApiModelProperty(value = "主营商品类型")
private List<Long> productTypes;
@ApiModelProperty(value = "主营商品名称")
private List<Long> productIds;
@ApiModelProperty(value = "主要竞争对手")
private List<Long> competitorIds;
@ApiModelProperty(value = "推介人")
private Long promoter;
@ApiModelProperty(value = "到仓确认")
private Integer arrivalConfirm;
@ApiModelProperty(value = "控货无收货人,1-是,0-否")
private Boolean noConsignee;
@ApiModelProperty(value = "默认付款")
private Boolean defaultPay;
@ApiModelProperty(value = "是否显示提单价格")
private Boolean isShowTidanPrice;
//归属时间
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始归属时间")
private Date beginCustomerServiceConfirmedTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束归属时间")
private Date endCustomerServiceConfirmedTime;
// 首次成交时间
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始首次成交时间")
private Date beginFirstDealTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束首次成交时间")
private Date endFirstDealTime;
@ApiModelProperty(value = "获取方式")
private List<String> getMethods;
//创建入口
@ApiModelProperty(value = "创建入口")
private List<String> createFroms;
// 结算方式
@ApiModelProperty(value = "结算方式")
private List<String> balances;
// 20240904 add end
} }
...@@ -1251,20 +1251,27 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, ...@@ -1251,20 +1251,27 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper,
deptId = loginUser.getDeptId(); deptId = loginUser.getDeptId();
} }
List<CustomerDO> list = // List<CustomerDO> list =
customerMapper.getDeptCustomerPageReq(start, size, pageReqVO, deptId); // customerMapper.getDeptCustomerPageReq(start, size, pageReqVO, deptId);
long total = customerMapper.getDeptCustomerPageReqCount(pageReqVO, deptId); // long total = customerMapper.getDeptCustomerPageReqCount(pageReqVO, deptId);
return new PageResult<>(list, total, mpPage.getSize(), page.getPage(), (total + mpPage.getSize() - 1) / mpPage.getSize()); // return new PageResult<>(list, total, mpPage.getSize(), page.getPage(), (total + mpPage.getSize() - 1) / mpPage.getSize());
// 20240905 注释上面内容,调整使用全部客户分页查询语句
pageReqVO.setDeptIds(Arrays.asList(deptId));
return this.getMyCustomerPage(pageReqVO, page);
} }
@Override @Override
public List<CustomerDO> getDeptCustomerExcelVoListReq(CustomerExportReqDTO exportReqVO) { public List<CustomerDO> getDeptCustomerExcelVoListReq(CustomerExportReqDTO reqVO) {
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
Long deptId = null; Long deptId = null;
if (null != loginUser && loginUser.getDeptId() > 0) { if (null != loginUser && loginUser.getDeptId() > 0) {
deptId = loginUser.getDeptId(); deptId = loginUser.getDeptId();
} }
return customerMapper.getDeptCustomerExcelVoListReq(exportReqVO, deptId); // return customerMapper.getDeptCustomerExcelVoListReq(reqVO, deptId);
reqVO.setDeptIds(Arrays.asList(deptId));
return customerMapper.getMyPage(null, null, reqVO);
} }
@Override @Override
...@@ -1384,18 +1391,19 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, ...@@ -1384,18 +1391,19 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper,
pageReqVO.setIsInOpenSea(false); pageReqVO.setIsInOpenSea(false);
pageReqVO.setIsCustomerServiceConfirmed(false); pageReqVO.setIsCustomerServiceConfirmed(false);
pageReqVO.setCustomerService(null); pageReqVO.setCustomerService(null);
IPage<CustomerDO> mpPage = MyBatisUtils.buildPage(page); // IPage<CustomerDO> mpPage = MyBatisUtils.buildPage(page);
log.warn(I18nMessage.getLang().toString()); // log.warn(I18nMessage.getLang().toString());
//
page.setPage(pageReqVO.getPageNo()); // page.setPage(pageReqVO.getPageNo());
page.setRows(pageReqVO.getPageSize()); // page.setRows(pageReqVO.getPageSize());
//
int start = (page.getPage() - 1) * page.getRows(); // int start = (page.getPage() - 1) * page.getRows();
int size = page.getRows(); // int size = page.getRows();
List<CustomerDO> list = // List<CustomerDO> list =
customerMapper.getWaitToAssignedCustomerPageReq(start, size, pageReqVO); // customerMapper.getWaitToAssignedCustomerPageReq(start, size, pageReqVO);
long total = customerMapper.getWaitToAssignedCustomerPageReqCount(pageReqVO); // long total = customerMapper.getWaitToAssignedCustomerPageReqCount(pageReqVO);
return new PageResult<>(list, total, mpPage.getSize(), page.getPage(), (total + mpPage.getSize() - 1) / mpPage.getSize()); // return new PageResult<>(list, total, mpPage.getSize(), page.getPage(), (total + mpPage.getSize() - 1) / mpPage.getSize());
return this.getMyCustomerPage(pageReqVO, page);
} }
@Override @Override
...@@ -1446,8 +1454,9 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, ...@@ -1446,8 +1454,9 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper,
} }
@Override @Override
public List<CustomerDO> getWaitToAssignedCustomerExcelVoListReq(CustomerExportReqDTO exportReqVO) { public List<CustomerDO> getWaitToAssignedCustomerExcelVoListReq(CustomerExportReqDTO reqVO) {
return customerMapper.getWaitToAssignedCustomerListReq(exportReqVO); // return customerMapper.getWaitToAssignedCustomerListReq(reqVO);
return customerMapper.getMyPage(null, null, reqVO);
} }
@Override @Override
...@@ -1509,18 +1518,20 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, ...@@ -1509,18 +1518,20 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper,
public PageResult<CustomerDO> getWaitToConfirmCustomerPageReq(CustomerPageReqDTO pageReqVO, PageVO page) { public PageResult<CustomerDO> getWaitToConfirmCustomerPageReq(CustomerPageReqDTO pageReqVO, PageVO page) {
pageReqVO.setIsCustomerServiceConfirmed(false); pageReqVO.setIsCustomerServiceConfirmed(false);
pageReqVO.setIsInOpenSea(false); pageReqVO.setIsInOpenSea(false);
IPage<CustomerDO> mpPage = MyBatisUtils.buildPage(page); // IPage<CustomerDO> mpPage = MyBatisUtils.buildPage(page);
log.warn(I18nMessage.getLang().toString()); // log.warn(I18nMessage.getLang().toString());
//
page.setPage(pageReqVO.getPageNo()); // page.setPage(pageReqVO.getPageNo());
page.setRows(pageReqVO.getPageSize()); // page.setRows(pageReqVO.getPageSize());
//
// int start = (page.getPage() - 1) * page.getRows();
// int size = page.getRows();
// List<CustomerDO> list =
// customerMapper.getWaitToConfirmCustomerPageReq(start, size, pageReqVO);
// long total = customerMapper.getWaitToConfirmCustomerPageReqCount(pageReqVO);
// return new PageResult<>(list, total, mpPage.getSize(), page.getPage(), (total + mpPage.getSize() - 1) / mpPage.getSize());
int start = (page.getPage() - 1) * page.getRows(); return this.getMyCustomerPage(pageReqVO, page);
int size = page.getRows();
List<CustomerDO> list =
customerMapper.getWaitToConfirmCustomerPageReq(start, size, pageReqVO);
long total = customerMapper.getWaitToConfirmCustomerPageReqCount(pageReqVO);
return new PageResult<>(list, total, mpPage.getSize(), page.getPage(), (total + mpPage.getSize() - 1) / mpPage.getSize());
} }
@Override @Override
...@@ -1589,7 +1600,8 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, ...@@ -1589,7 +1600,8 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper,
reqVO.setCustomerService(setCustomerService); reqVO.setCustomerService(setCustomerService);
} }
return customerMapper.getWaitToConfirmCustomerExcelVoListReq(reqVO); // return customerMapper.getWaitToConfirmCustomerExcelVoListReq(reqVO);
return customerMapper.getMyPage(null, null, reqVO);
} }
@Override @Override
...@@ -1648,18 +1660,20 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, ...@@ -1648,18 +1660,20 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper,
public PageResult<CustomerDO> getOpenSeaCustomerPageReq(CustomerPageReqDTO pageReqVO, PageVO page) { public PageResult<CustomerDO> getOpenSeaCustomerPageReq(CustomerPageReqDTO pageReqVO, PageVO page) {
pageReqVO.setIsInOpenSea(true); pageReqVO.setIsInOpenSea(true);
IPage<CustomerDO> mpPage = MyBatisUtils.buildPage(page); // IPage<CustomerDO> mpPage = MyBatisUtils.buildPage(page);
log.warn(I18nMessage.getLang().toString()); // log.warn(I18nMessage.getLang().toString());
//
page.setPage(pageReqVO.getPageNo()); // page.setPage(pageReqVO.getPageNo());
page.setRows(pageReqVO.getPageSize()); // page.setRows(pageReqVO.getPageSize());
//
// int start = (page.getPage() - 1) * page.getRows();
// int size = page.getRows();
// List<CustomerDO> list =
// customerMapper.getOpenSeaCustomerPageReq(start, size, pageReqVO);
// long total = customerMapper.getOpenSeaCustomerPageReqCount(pageReqVO);
// return new PageResult<>(list, total, mpPage.getSize(), page.getPage(), (total + mpPage.getSize() - 1) / mpPage.getSize());
int start = (page.getPage() - 1) * page.getRows(); return this.getMyCustomerPage(pageReqVO, page);
int size = page.getRows();
List<CustomerDO> list =
customerMapper.getOpenSeaCustomerPageReq(start, size, pageReqVO);
long total = customerMapper.getOpenSeaCustomerPageReqCount(pageReqVO);
return new PageResult<>(list, total, mpPage.getSize(), page.getPage(), (total + mpPage.getSize() - 1) / mpPage.getSize());
} }
@Override @Override
...@@ -1712,7 +1726,8 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, ...@@ -1712,7 +1726,8 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper,
@Override @Override
public List<CustomerDO> getPublicCustomerExcelVoReqList(@Param("query") CustomerExportReqDTO reqVO) { public List<CustomerDO> getPublicCustomerExcelVoReqList(@Param("query") CustomerExportReqDTO reqVO) {
reqVO.setIsInOpenSea(true); reqVO.setIsInOpenSea(true);
return customerMapper.getPublicCustomerExcelVoReqList(reqVO); // return customerMapper.getPublicCustomerExcelVoReqList(reqVO);
return customerMapper.getMyPage(null, null, reqVO);
} }
@Override @Override
...@@ -1760,7 +1775,8 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, ...@@ -1760,7 +1775,8 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper,
@Override @Override
public List<CustomerDO> getMyCustomerExcelVoList(CustomerExportReqDTO reqVO) { public List<CustomerDO> getMyCustomerExcelVoList(CustomerExportReqDTO reqVO) {
return customerMapper.getMyCustomerExcelVoList(reqVO); // return customerMapper.getMyCustomerExcelVoList(reqVO);
return customerMapper.getMyPage(null, null, reqVO);
} }
@Override @Override
......
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
su.nickname as customer_service_name, su.nickname as customer_service_name,
su.dept_id as dept_id, su.dept_id as dept_id,
(SELECT GROUP_CONCAT(name) FROM ecw_customer_competitor n WHERE FIND_IN_SET(n.id,(SELECT competitor_ids FROM ecw_customer WHERE id=a.id))) AS competitor_names, (SELECT GROUP_CONCAT(name) FROM ecw_customer_competitor n WHERE FIND_IN_SET(n.id,(SELECT competitor_ids FROM ecw_customer WHERE id=a.id))) AS competitor_names,
su2.creator as create_username su2.nickname as create_username
from ecw_customer a from ecw_customer a
left join (select * from ecw_customer_contacts where is_default = 1 and deleted = 0) as c on a.id = c.customer_id left join (select * from ecw_customer_contacts where is_default = 1 and deleted = 0) as c on a.id = c.customer_id
left join system_user su on a.customer_service = su.id left join system_user su on a.customer_service = su.id
...@@ -97,7 +97,10 @@ ...@@ -97,7 +97,10 @@
GROUP BY contact.id GROUP BY contact.id
order by contact.id desc order by contact.id desc
limit #{start}, #{size} <if test="start != null and size != null">
limit #{start}, #{size}
</if>
</select> </select>
<select id="getWaitToAssignedCustomerPageReq" <select id="getWaitToAssignedCustomerPageReq"
...@@ -519,26 +522,21 @@ ...@@ -519,26 +522,21 @@
AND contact.is_customer_service_confirmed = #{query.isCustomerServiceConfirmed} AND contact.is_customer_service_confirmed = #{query.isCustomerServiceConfirmed}
</if> </if>
<if test="query.department != null and query.department != '' ">
AND contact.department = #{query.department} <!--部门deptIds-->
<if test="query.deptIds != null and query.deptIds.size()>0">
AND
<foreach item='item' index="index" collection='query.deptIds' open='(' separator='or' close=')'>
FIND_IN_SET(#{item}, contact.dept_id)
</foreach>
</if> </if>
<!--跟进客服 --> <!--跟进客服 -->
<if test="query.customerService != null and query.customerService.size()>0"> <if test="query.customerService != null and query.customerService.size()>0">
AND
<if test="query.customerService != null and query.customerService != '' and query.customerService.size()==1 "> <foreach item='item' index="index" collection='query.customerService' open='(' separator='or' close=')'>
AND contact.customer_service = FIND_IN_SET(#{item}, contact.customer_service)
<foreach item='customerService' index="index" collection='query.customerService' > </foreach>
#{customerService}
</foreach>
</if>
<if test="query.customerService != null and query.customerService != '' and query.customerService.size()>1 ">
AND contact.customer_service in
<foreach item='customerService' index="index" collection='query.customerService' open='(' separator=',' close=')'>
#{customerService}
</foreach>
</if>
</if> </if>
...@@ -577,111 +575,192 @@ ...@@ -577,111 +575,192 @@
<!--信用等级 --> <!--信用等级 -->
<if test="query.creditLevel != null and query.creditLevel.size()>0"> <if test="query.creditLevel != null and query.creditLevel.size()>0">
AND
<if test="query.creditLevel != null and query.creditLevel != '' and query.creditLevel.size()==1 "> <foreach item='item' index="index" collection='query.creditLevel' open='(' separator='or' close=')'>
AND contact.credit_level = FIND_IN_SET(#{item}, contact.credit_level)
<foreach item='creditLevel' index="index" collection='query.creditLevel' > </foreach>
#{creditLevel}
</foreach>
</if>
<if test="query.creditLevel != null and query.creditLevel != '' and query.creditLevel.size()>1 ">
AND contact.credit_level in
<foreach item='creditLevel' index="index" collection='query.creditLevel' open='(' separator=',' close=')'>
#{creditLevel}
</foreach>
</if>
</if> </if>
<!--客户类别 --> <!--客户类别 -->
<if test="query.type != null and query.type.size()>0"> <if test="query.type != null and query.type.size()>0">
AND
<foreach item='item' index="index" collection='query.type' open='(' separator='or' close=')'>
FIND_IN_SET(#{item}, contact.type)
</foreach>
</if>
<if test="query.type != null and query.type != '' and query.type.size()==1 "> <!--客户来源 -->
AND contact.type = <if test="query.source != null and query.source.size()>0">
<foreach item='type' index="index" collection='query.type' > AND
#{type} <foreach item='item' index="index" collection='query.source' open='(' separator='or' close=')'>
</foreach> FIND_IN_SET(#{item}, contact.source)
</if> </foreach>
</if>
<if test="query.type != null and query.type != '' and query.type.size()>1 "> <!--国家 -->
AND contact.type in <if test="query.country != null and query.country.size()>0">
<foreach item='type' index="index" collection='query.type' open='(' separator=',' close=')'> AND
#{type} <foreach item='item' index="index" collection='query.country' open='(' separator='or' close=')'>
</foreach> FIND_IN_SET(#{item}, contact.country)
</if> </foreach>
</if> </if>
<!--客户状态 -->
<if test="query.status != null and query.status.size()>0">
AND
<foreach item='item' index="index" collection='query.status' open='(' separator='or' close=')'>
FIND_IN_SET(#{item}, contact.status)
</foreach>
</if>
<!--客户来源 --> <!--客户等级 -->
<if test="query.source != null and query.source.size()>0"> <if test="query.level != null and query.level.size()>0">
AND
<foreach item='item' index="index" collection='query.level' open='(' separator='or' close=')'>
FIND_IN_SET(#{item}, contact.level)
</foreach>
</if>
<if test="query.source != null and query.source != '' and query.source.size()==1 "> <!--角色-->
AND contact.source = <if test="query.role != null and query.role.size()>0">
<foreach item='source' index="index" collection='query.source' > AND
#{source} <foreach item='item' index="index" collection='query.role' open='(' separator='or' close=')'>
</foreach> FIND_IN_SET(#{item}, contact.roles)
</if> </foreach>
</if>
<if test="query.source != null and query.source != '' and query.source.size()>1 "> <!--出货渠道-->
AND contact.source in <if test="query.transportType != null and query.transportType.size()>0">
<foreach item='source' index="index" collection='query.source' open='(' separator=',' close=')'> AND
#{source} <foreach item='item' index="index" collection='query.transportType' open='(' separator='or' close=')'>
</foreach> FIND_IN_SET(#{item}, contact.transport_type)
</if> </foreach>
</if> </if>
<!--国家 --> <!--业务国家-->
<if test="query.country != null and query.country.size()>0"> <if test="query.busiCountryIds != null and query.busiCountryIds.size()>0">
AND
<foreach item='item' index="index" collection='query.busiCountryIds' open='(' separator='or' close=')'>
FIND_IN_SET(#{item}, contact.busi_country_ids)
</foreach>
</if>
<if test="query.country != null and query.country != '' and query.country.size()==1 "> <!--创建人-->
AND contact.country = <if test="query.founder != null">
<foreach item='country' index="index" collection='query.country' > AND contact.founder = #{query.founder}
#{country} </if>
</foreach>
</if>
<if test="query.country != null and query.country != '' and query.country.size()>1 "> <!--开始入公海时间和结束入公海时间-->
AND contact.country in <if test="query.beginEnterOpenSeaTime != null and query.endEnterOpenSeaTime != null">
<foreach item='country' index="index" collection='query.country' open='(' separator=',' close=')'> AND (
#{country} (contact.enter_open_sea_time is not null and contact.enter_open_sea_time BETWEEN #{query.beginEnterOpenSeaTime} AND #{query.endEnterOpenSeaTime})
</foreach> or (contact.enter_open_sea_time is null and contact.estimate_enter_open_sea_time BETWEEN #{query.beginEnterOpenSeaTime} AND #{query.endEnterOpenSeaTime})
</if> )
</if> </if>
<!--客户状态 --> <!--是否新客户-->
<if test="query.status != null and query.status.size()>0"> <if test="query.isNew != null">
AND contact.is_new = #{query.isNew}
</if>
<if test="query.status != null and query.status != '' and query.status.size()==1 ">
AND contact.status =
<foreach item='status' index="index" collection='query.status' >
#{status}
</foreach>
</if>
<if test="query.status != null and query.status != '' and query.status.size()>1 "> <!--年度发货量 大于等于/小于等于/等于-->
AND contact.status in <if test="query.geWeightYearly != null">
<foreach item='status' index="index" collection='query.status' open='(' separator=',' close=')'> AND contact.weight_yearly <![CDATA[ >= ]]> #{query.geWeightYearly}
#{status} </if>
</foreach> <if test="query.leWeightYearly != null">
</if> AND contact.weight_yearly <![CDATA[ <= ]]> #{query.leWeightYearly}
</if>
<if test="query.eqWeightYearly != null">
AND contact.weight_yearly = #{query.eqWeightYearly}
</if> </if>
<!--客户等级 --> <!--年度发货次数 大于等于/小于等于/等于-->
<if test="query.level != null and query.level.size()>0"> <if test="query.geNumYearly != null">
AND contact.num_yearly <![CDATA[ >= ]]> #{query.geNumYearly}
</if>
<if test="query.leNumYearly != null">
AND contact.num_yearly <![CDATA[ <= ]]> #{query.leNumYearly}
</if>
<if test="query.leNumYearly != null">
AND contact.num_yearly = #{query.leNumYearly}
</if>
<if test="query.level != null and query.level != '' and query.level.size()==1 ">
AND contact.level =
<foreach item='level' index="index" collection='query.level' >
#{level}
</foreach>
</if>
<if test="query.level != null and query.level != '' and query.level.size()>1 "> <!--主营商品类型-->
AND contact.level in <if test="query.productTypes != null and query.productTypes.size()>0">
<foreach item='level' index="index" collection='query.level' open='(' separator=',' close=')'> AND
#{level} <foreach item='item' index="index" collection='query.productTypes' open='(' separator='or' close=')'>
</foreach> FIND_IN_SET(#{item}, contact.product_type)
</if> </foreach>
</if>
<!--主营商品名称-->
<if test="query.productIds != null and query.productIds.size()>0">
AND
<foreach item='item' index="index" collection='query.productIds' open='(' separator='or' close=')'>
FIND_IN_SET(#{item}, contact.product_ids)
</foreach>
</if>
<!--主要竞争对手-->
<if test="query.competitorIds != null and query.competitorIds.size()>0">
AND
<foreach item='item' index="index" collection='query.competitorIds' open='(' separator='or' close=')'>
FIND_IN_SET(#{item}, contact.competitor_ids)
</foreach>
</if>
<!--推介人 promoter-->
<if test="query.promoter != null">
AND contact.promoter = #{query.promoter}
</if>
<!--到仓确认-->
<if test="query.arrivalConfirm != null">
AND contact.arrival_confirm = #{query.arrivalConfirm}
</if>
<!--控货无收货人-->
<if test="query.noConsignee != null">
AND contact.no_consignee = #{query.noConsignee}
</if>
<!--默认付款-->
<if test="query.defaultPay != null">
AND contact.default_pay = #{query.defaultPay}
</if>
<!--是否显示提单价格-->
<if test="query.isShowTidanPrice != null">
AND contact.is_show_tidan_price = #{query.isShowTidanPrice}
</if>
<!--归属时间-->
<if test="query.beginCustomerServiceConfirmedTime != null and query.endCustomerServiceConfirmedTime != null">
AND contact.customer_service_confirmed_time BETWEEN #{query.beginCustomerServiceConfirmedTime} AND #{query.endCustomerServiceConfirmedTime}
</if>
<!--首次成交时间-->
<if test="query.beginFirstDealTime != null and query.endFirstDealTime != null">
AND contact.first_deal_time BETWEEN #{query.beginFirstDealTime} AND #{query.endFirstDealTime}
</if>
<!--获取方式-->
<if test="query.getMethods != null and query.getMethods.size()>0">
AND
<foreach item='item' index="index" collection='query.getMethods' open='(' separator='or' close=')'>
FIND_IN_SET(#{item}, contact.get_method)
</foreach>
</if>
<!--创建入口-->
<if test="query.createFroms != null and query.createFroms.size()>0">
AND
<foreach item='item' index="index" collection='query.createFroms' open='(' separator='or' close=')'>
FIND_IN_SET(#{item}, contact.create_from)
</foreach>
</if>
<!--结算方式balances-->
<if test="query.balances != null and query.balances.size()>0">
AND
<foreach item='item' index="index" collection='query.balances' open='(' separator='or' close=')'>
FIND_IN_SET(#{item}, contact.balance)
</foreach>
</if> </if>
<!-- 会员信息 --> <!-- 会员信息 -->
<if test="query.memberCode != null and query.memberCode != '' "> <if test="query.memberCode != null and query.memberCode != '' ">
......
...@@ -41,7 +41,7 @@ Content-Type: application/json ...@@ -41,7 +41,7 @@ Content-Type: application/json
{"inquiry":null,"id":"38155","number":"SGP00004","name":"yh2345","nameEn":null,"level":1,"country":194,"type":"0,1","transportType":"1","agentId":null,"company":"","companyEn":null,"payerName":null,"address":null,"productType":null,"productId":null,"pickupPoint":null,"memberId":null,"birthday":null,"balance":null,"source":5,"picture":null,"customerService":null,"customerContacts":[{"customerId":38155,"department":"","position":"","name":"yh12345","nameEn":"","social":null,"socialNumber":"","email":"","isDefault":1,"userid":null,"username":null,"areaCode":"65","phoneNew":"66666666","createTime":1692929203000,"id":69056,"customerContactsId":69056,"customerName":null,"company":""}],"customerLines":[],"lightUnit":null,"promoter":null,"status":1,"founder":118,"department":null,"invoiceTitle":null,"licenseNumber":null,"bank":null,"bankNumber":null,"project":null,"billingAddress":null,"billingTell":null,"taxRate":0,"remarks":null,"arrivalConfirm":0,"weightUnit":null,"createTime":1692924735000,"isShowTidanPrice":true,"carName":null,"carNo":null,"customerBanks":[],"creditLevel":3,"vipLevelScore":1,"vipLevelNameZh":"普通","vipLevelNameEn":"common","creditLevelScore":400,"creditLevelNameZh":"信用良好","creditLevelNameEn":"good credit","customerServiceName":null,"consigneeFirstCustomerService":null,"isNew":true,"resourceType":1,"isInOpenSea":false,"enterOpenSeaTime":null,"estimateEnterOpenSeaTime":null,"catchTime":null,"promoterName":null,"enquiryInfo":null,"isCustomerServiceConfirmed":false,"isWebOrderConsigneeSync":false,"isPotential":false,"founderName":"yanghao","customerBankBackVOList":[],"countryNameZh":"新加坡","countryNameEn":"Singapore","productTypeNameZh":null,"productTypeNameEn":null,"productNameZh":null,"productNameEn":null,"pickupPointNameZh":null,"pickupPointNameEn":null} {"inquiry":null,"id":"38155","number":"SGP00004","name":"yh2345","nameEn":null,"level":1,"country":194,"type":"0,1","transportType":"1","agentId":null,"company":"","companyEn":null,"payerName":null,"address":null,"productType":null,"productId":null,"pickupPoint":null,"memberId":null,"birthday":null,"balance":null,"source":5,"picture":null,"customerService":null,"customerContacts":[{"customerId":38155,"department":"","position":"","name":"yh12345","nameEn":"","social":null,"socialNumber":"","email":"","isDefault":1,"userid":null,"username":null,"areaCode":"65","phoneNew":"66666666","createTime":1692929203000,"id":69056,"customerContactsId":69056,"customerName":null,"company":""}],"customerLines":[],"lightUnit":null,"promoter":null,"status":1,"founder":118,"department":null,"invoiceTitle":null,"licenseNumber":null,"bank":null,"bankNumber":null,"project":null,"billingAddress":null,"billingTell":null,"taxRate":0,"remarks":null,"arrivalConfirm":0,"weightUnit":null,"createTime":1692924735000,"isShowTidanPrice":true,"carName":null,"carNo":null,"customerBanks":[],"creditLevel":3,"vipLevelScore":1,"vipLevelNameZh":"普通","vipLevelNameEn":"common","creditLevelScore":400,"creditLevelNameZh":"信用良好","creditLevelNameEn":"good credit","customerServiceName":null,"consigneeFirstCustomerService":null,"isNew":true,"resourceType":1,"isInOpenSea":false,"enterOpenSeaTime":null,"estimateEnterOpenSeaTime":null,"catchTime":null,"promoterName":null,"enquiryInfo":null,"isCustomerServiceConfirmed":false,"isWebOrderConsigneeSync":false,"isPotential":false,"founderName":"yanghao","customerBankBackVOList":[],"countryNameZh":"新加坡","countryNameEn":"Singapore","productTypeNameZh":null,"productTypeNameEn":null,"productNameZh":null,"productNameEn":null,"pickupPointNameZh":null,"pickupPointNameEn":null}
### page ### page
GET {{baseUrl}}/ecw/customer/page?pageNo=1&pageSize=100&name= GET {{baseUrl}}/ecw/customer/page?pageNo=1&pageSize=10&customerService[0]=1144&customerService[1]=2659&beginEnterOpenSeaTime=2024-10-02%2000%3A00%3A00&endEnterOpenSeaTime=2024-10-05%2000%3A00%3A00
Authorization: Bearer {{token}} Authorization: Bearer {{token}}
tenant-id: {{adminTenentId}} tenant-id: {{adminTenentId}}
......
...@@ -30,6 +30,8 @@ import java.util.List; ...@@ -30,6 +30,8 @@ import java.util.List;
public interface OrderService extends IService<OrderDO> { public interface OrderService extends IService<OrderDO> {
void updateOrderSalesmanId(Long orderId,Long salesman_id); void updateOrderSalesmanId(Long orderId,Long salesman_id);
/** /**
* 创建订单 * 创建订单
* *
...@@ -379,4 +381,15 @@ public interface OrderService extends IService<OrderDO> { ...@@ -379,4 +381,15 @@ public interface OrderService extends IService<OrderDO> {
void updateOrderCustomerAndSalesmanId(Long customerId, Long salesmanId, Long orderId); void updateOrderCustomerAndSalesmanId(Long customerId, Long salesmanId, Long orderId);
/**
* copy订单
*
* @param copyOrderId 复制的订单id
* @param memberUserDO 会员信息
* @return 编号
*/
Long copyOrder(Long copyOrderId,MemberUserDO memberUserDO);
} }
...@@ -94,7 +94,6 @@ import cn.iocoder.yudao.module.order.vo.orderItem.OrderItemInWarehouseVO; ...@@ -94,7 +94,6 @@ import cn.iocoder.yudao.module.order.vo.orderItem.OrderItemInWarehouseVO;
import cn.iocoder.yudao.module.order.vo.orderObjective.OrderObjectiveBackVO; import cn.iocoder.yudao.module.order.vo.orderObjective.OrderObjectiveBackVO;
import cn.iocoder.yudao.module.order.vo.orderSpecialNeed.OrderSpecialNeedCreateReqVO; import cn.iocoder.yudao.module.order.vo.orderSpecialNeed.OrderSpecialNeedCreateReqVO;
import cn.iocoder.yudao.module.order.vo.orderWarehouseIn.OrderWarehouseInSumBackVO; import cn.iocoder.yudao.module.order.vo.orderWarehouseIn.OrderWarehouseInSumBackVO;
import cn.iocoder.yudao.module.order.vo.targetLog.TargetOfferBackVO;
import cn.iocoder.yudao.module.product.dto.FeeDto; import cn.iocoder.yudao.module.product.dto.FeeDto;
import cn.iocoder.yudao.module.product.enums.FeeTypeEnum; import cn.iocoder.yudao.module.product.enums.FeeTypeEnum;
import cn.iocoder.yudao.module.system.api.dict.DictDataApi; import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
...@@ -130,6 +129,7 @@ import static cn.iocoder.yudao.framework.apollo.core.constants.Constants.*; ...@@ -130,6 +129,7 @@ import static cn.iocoder.yudao.framework.apollo.core.constants.Constants.*;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.order.enums.ErrorCodeConstants.*; import static cn.iocoder.yudao.module.order.enums.ErrorCodeConstants.*;
import static cn.iocoder.yudao.module.order.enums.OrderApprovalTypeEnum.ORDER_UPDATE; import static cn.iocoder.yudao.module.order.enums.OrderApprovalTypeEnum.ORDER_UPDATE;
import static cn.iocoder.yudao.module.order.enums.OrderStatusEnum.DRAFT;
/** /**
* 订单 Service 实现类 * 订单 Service 实现类
...@@ -228,7 +228,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -228,7 +228,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
throw exception(EXTERNAL_WAREHOUSE_AND_CONCENTRATE_TRANSPORT_NOT_PARALLEL); throw exception(EXTERNAL_WAREHOUSE_AND_CONCENTRATE_TRANSPORT_NOT_PARALLEL);
} }
if (createReqVO.getIsExternalWarehouse() != null && if (createReqVO.getIsExternalWarehouse() != null &&
createReqVO.getIsExternalWarehouse() && !Objects.equals(createReqVO.getStatus(), OrderStatusEnum.DRAFT.getValue())) { createReqVO.getIsExternalWarehouse() && !Objects.equals(createReqVO.getStatus(), DRAFT.getValue())) {
// 校验外部仓信息是否为空 // 校验外部仓信息是否为空
if (CollectionUtil.isEmpty(createReqVO.getExternalWarehouseDtoList())) { if (CollectionUtil.isEmpty(createReqVO.getExternalWarehouseDtoList())) {
throw exception(ORDER_EXTERNAL_WAREHOUSE_NOT_NULL); throw exception(ORDER_EXTERNAL_WAREHOUSE_NOT_NULL);
...@@ -242,7 +242,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -242,7 +242,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
} else { } else {
if (Objects.isNull(createReqVO.getDeliveryDate()) && if (Objects.isNull(createReqVO.getDeliveryDate()) &&
!Objects.equals(createReqVO.getStatus(), !Objects.equals(createReqVO.getStatus(),
OrderStatusEnum.DRAFT.getValue())) { DRAFT.getValue())) {
throw exception(ORDER_DELIVERY_DATE_NOT_NULL); throw exception(ORDER_DELIVERY_DATE_NOT_NULL);
} }
} }
...@@ -272,7 +272,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -272,7 +272,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
if (CollectionUtil.isNotEmpty(createReqVO.getCustomDraweeVOList())) { if (CollectionUtil.isNotEmpty(createReqVO.getCustomDraweeVOList())) {
order.setCustomDrawee(JSONObject.toJSONString(createReqVO.getCustomDraweeVOList())); order.setCustomDrawee(JSONObject.toJSONString(createReqVO.getCustomDraweeVOList()));
} else { } else {
if (!Objects.equals(createReqVO.getStatus(), OrderStatusEnum.DRAFT.getValue())) { if (!Objects.equals(createReqVO.getStatus(), DRAFT.getValue())) {
throw exception(ORDER_CUSTOM_DRAWEE_INFO_NOT_NULL); throw exception(ORDER_CUSTOM_DRAWEE_INFO_NOT_NULL);
} }
} }
...@@ -294,7 +294,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -294,7 +294,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
RegionDO objective = regionService.getRegion(createReqVO.getObjectiveId()); RegionDO objective = regionService.getRegion(createReqVO.getObjectiveId());
String newOrderNo; String newOrderNo;
if (Objects.equals(createReqVO.getStatus(), OrderStatusEnum.DRAFT.getValue())) { if (Objects.equals(createReqVO.getStatus(), DRAFT.getValue())) {
newOrderNo = "DRAFT-" + System.currentTimeMillis(); newOrderNo = "DRAFT-" + System.currentTimeMillis();
} else { } else {
newOrderNo = orderBusinessService.saveOrUpdateOrderNo(objective, newOrderNo = orderBusinessService.saveOrUpdateOrderNo(objective,
...@@ -312,7 +312,6 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -312,7 +312,6 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
order.setUpdater(creator); order.setUpdater(creator);
order.setCreateTime(now); order.setCreateTime(now);
order.setUpdateTime(now); order.setUpdateTime(now);
orderMapper.insert(order); orderMapper.insert(order);
//订单始发地信息 //订单始发地信息
...@@ -440,7 +439,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -440,7 +439,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
//非草稿状态下才更新客户状态及其他数据 //非草稿状态下才更新客户状态及其他数据
if (!OrderStatusEnum.DRAFT.getValue().equals(order.getStatus())) { if (!DRAFT.getValue().equals(order.getStatus())) {
Set<Long> idSet = Stream.of(createReqVO.getConsignorId(), createReqVO.getConsigneeId(), order.getCustomerId()).filter(Objects::nonNull).collect(Collectors.toSet()); Set<Long> idSet = Stream.of(createReqVO.getConsignorId(), createReqVO.getConsigneeId(), order.getCustomerId()).filter(Objects::nonNull).collect(Collectors.toSet());
for (Long id : idSet) { for (Long id : idSet) {
customerService.updateCustomerByCreateOrder(id, order.getOrderId(), order.getOrderNo(), order.getCreateTime()); customerService.updateCustomerByCreateOrder(id, order.getOrderId(), order.getOrderNo(), order.getCreateTime());
...@@ -683,11 +682,11 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -683,11 +682,11 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
// 控货订单没有收货人则不限制修改收货人 // 控货订单没有收货人则不限制修改收货人
order.setIsLimitUpdateConsignee(Boolean.FALSE); order.setIsLimitUpdateConsignee(Boolean.FALSE);
} }
if (!Objects.equals(createReqVO.getStatus(), OrderStatusEnum.DRAFT.getValue())) { if (!Objects.equals(createReqVO.getStatus(), DRAFT.getValue())) {
//customerType 发货人-1 收货人 2 //customerType 发货人-1 收货人 2
int customerType = this.checkOrderSalesman(order, createReqVO.getOfferId(), null, null, orderConsignorDO, orderConsigneeDO); int customerType = this.checkOrderSalesman(order, createReqVO.getOfferId(), null, null, orderConsignorDO, orderConsigneeDO);
// 更新所属客户经理(业务员) // 更新所属客户经理(业务员)
if (!OrderStatusEnum.DRAFT.getValue().equals(order.getStatus()) && Objects.nonNull(order.getIsChargeCustomer()) && order.getIsChargeCustomer()) { if (!DRAFT.getValue().equals(order.getStatus()) && Objects.nonNull(order.getIsChargeCustomer()) && order.getIsChargeCustomer()) {
addOrderCustomerService(order, customerType); addOrderCustomerService(order, customerType);
} }
} }
...@@ -737,7 +736,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -737,7 +736,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
orderConsignorDO.setCustomerId(consignorContactsDO.getCustomerId()); orderConsignorDO.setCustomerId(consignorContactsDO.getCustomerId());
} else { } else {
if (!Objects.equals(createReqVO.getStatus(), if (!Objects.equals(createReqVO.getStatus(),
OrderStatusEnum.DRAFT.getValue())) { DRAFT.getValue())) {
if (StringUtils.isBlank(createReqVO.getConsignorPhone())) { if (StringUtils.isBlank(createReqVO.getConsignorPhone())) {
throw exception(CONSIGNOR_PHONE_NOT_NULL); throw exception(CONSIGNOR_PHONE_NOT_NULL);
} }
...@@ -751,7 +750,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -751,7 +750,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
orderConsignorDO.setEmail(createReqVO.getConsignorEmail()); orderConsignorDO.setEmail(createReqVO.getConsignorEmail());
} }
if (!Objects.equals(createReqVO.getStatus(), if (!Objects.equals(createReqVO.getStatus(),
OrderStatusEnum.DRAFT.getValue())) { DRAFT.getValue())) {
if (StringUtils.isBlank(orderConsignorDO.getPhone()) || if (StringUtils.isBlank(orderConsignorDO.getPhone()) ||
StringUtils.isBlank(orderConsignorDO.getCountryCode())) { StringUtils.isBlank(orderConsignorDO.getCountryCode())) {
throw exception(ORDER_CONSIGNOR_PHONE_INFO_NOT_COMPLETE); throw exception(ORDER_CONSIGNOR_PHONE_INFO_NOT_COMPLETE);
...@@ -789,7 +788,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -789,7 +788,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
} }
if (order.getIsCargoControl() && if (order.getIsCargoControl() &&
!Objects.equals(createReqVO.getStatus(), !Objects.equals(createReqVO.getStatus(),
OrderStatusEnum.DRAFT.getValue())) { DRAFT.getValue())) {
// 控货订单 添加控货人信息 (当放货人为空时不添加 注: // 控货订单 添加控货人信息 (当放货人为空时不添加 注:
// 当报价单赢单创建的草稿订单可能发货人为空) // 当报价单赢单创建的草稿订单可能发货人为空)
...@@ -859,7 +858,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -859,7 +858,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
orderConsigneeDO.setCustomerId(consigneeContactsDO.getCustomerId()); orderConsigneeDO.setCustomerId(consigneeContactsDO.getCustomerId());
} else { } else {
if (!Objects.equals(createReqVO.getStatus(), if (!Objects.equals(createReqVO.getStatus(),
OrderStatusEnum.DRAFT.getValue())) { DRAFT.getValue())) {
if (StringUtils.isBlank(createReqVO.getConsigneePhone())) { if (StringUtils.isBlank(createReqVO.getConsigneePhone())) {
throw exception(CONSIGNEE_PHONE_NOT_NULL); throw exception(CONSIGNEE_PHONE_NOT_NULL);
...@@ -889,7 +888,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -889,7 +888,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
orderConsigneeDO.setUpdateTime(now); orderConsigneeDO.setUpdateTime(now);
if (!Objects.equals(createReqVO.getStatus(), if (!Objects.equals(createReqVO.getStatus(),
OrderStatusEnum.DRAFT.getValue())) { DRAFT.getValue())) {
if (StringUtils.isBlank(orderConsigneeDO.getPhone()) || if (StringUtils.isBlank(orderConsigneeDO.getPhone()) ||
StringUtils.isBlank(orderConsigneeDO.getCountryCode())) { StringUtils.isBlank(orderConsigneeDO.getCountryCode())) {
...@@ -932,7 +931,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -932,7 +931,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
order.setIsLimitUpdateConsignee(Boolean.FALSE); order.setIsLimitUpdateConsignee(Boolean.FALSE);
} }
if (!Objects.equals(createReqVO.getStatus(), if (!Objects.equals(createReqVO.getStatus(),
OrderStatusEnum.DRAFT.getValue())) { DRAFT.getValue())) {
// 发货人 1 收货人 2 // 发货人 1 收货人 2
int customerType = this.checkOrderSalesman(order, int customerType = this.checkOrderSalesman(order,
createReqVO.getOfferId(), createReqVO.getOfferId(),
...@@ -941,7 +940,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -941,7 +940,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
orderConsignorDO, orderConsignorDO,
orderConsigneeDO); orderConsigneeDO);
// 更新所属客户经理(业务员) // 更新所属客户经理(业务员)
if (!OrderStatusEnum.DRAFT.getValue().equals(order.getStatus()) && Objects.nonNull(order.getIsChargeCustomer()) && order.getIsChargeCustomer()) { if (!DRAFT.getValue().equals(order.getStatus()) && Objects.nonNull(order.getIsChargeCustomer()) && order.getIsChargeCustomer()) {
addOrderCustomerService(order, customerType); addOrderCustomerService(order, customerType);
} }
} }
...@@ -1518,7 +1517,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -1518,7 +1517,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
(StringUtils.isBlank(oldOrderDO.getType()) && StringUtils.isNotBlank(updateReqVO.getType()) && updateReqVO.getType().contains("1"))) { (StringUtils.isBlank(oldOrderDO.getType()) && StringUtils.isNotBlank(updateReqVO.getType()) && updateReqVO.getType().contains("1"))) {
isResetOrderNo = Boolean.TRUE; isResetOrderNo = Boolean.TRUE;
} }
if (null == updateReqVO.getStatus() || !Objects.equals(oldOrderDO.getStatus(), OrderStatusEnum.DRAFT.getValue())) { if (null == updateReqVO.getStatus() || !Objects.equals(oldOrderDO.getStatus(), DRAFT.getValue())) {
updateObj.setStatus(oldOrderDO.getStatus()); updateObj.setStatus(oldOrderDO.getStatus());
} }
List<OrderItemDO> oldOrderItemDOList = orderItemMapper.selectList(new LambdaQueryWrapper<OrderItemDO>().eq(OrderItemDO::getOrderId, oldOrderDO.getOrderId())); List<OrderItemDO> oldOrderItemDOList = orderItemMapper.selectList(new LambdaQueryWrapper<OrderItemDO>().eq(OrderItemDO::getOrderId, oldOrderDO.getOrderId()));
...@@ -1530,7 +1529,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -1530,7 +1529,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
// 编辑时有对商品项进行删除 // 编辑时有对商品项进行删除
orderItemMapper.update(null, new LambdaUpdateWrapper<OrderItemDO>().set(OrderItemDO::getDeleted, 1).in(OrderItemDO::getOrderItemId, itemIds)); orderItemMapper.update(null, new LambdaUpdateWrapper<OrderItemDO>().set(OrderItemDO::getDeleted, 1).in(OrderItemDO::getOrderItemId, itemIds));
} }
if (!Objects.equals(oldOrderDO.getStatus(), OrderStatusEnum.DRAFT.getValue()) && !Objects.equals(oldOrderDO.getStatus(), OrderStatusEnum.ORDER_PLACED.getValue()) && !Objects.equals(oldOrderDO.getStatus(), OrderStatusEnum.WAREHOUSING.getValue())) { if (!Objects.equals(oldOrderDO.getStatus(), DRAFT.getValue()) && !Objects.equals(oldOrderDO.getStatus(), OrderStatusEnum.ORDER_PLACED.getValue()) && !Objects.equals(oldOrderDO.getStatus(), OrderStatusEnum.WAREHOUSING.getValue())) {
// 不是草稿、已下单、入仓中状态 走审批流程 // 不是草稿、已下单、入仓中状态 走审批流程
throw exception(PLEASE_SUBMIT_ORDER_UPDATE_APPROVAL); throw exception(PLEASE_SUBMIT_ORDER_UPDATE_APPROVAL);
} }
...@@ -1570,7 +1569,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -1570,7 +1569,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
RegionDO oldObjective = JSONObject.parseObject(objectiveDO.getObjective(), RegionDO.class); RegionDO oldObjective = JSONObject.parseObject(objectiveDO.getObjective(), RegionDO.class);
// 如果是空运订单,订单运输方式未变,目的地国家未变,则不用更新订单编号 // 如果是空运订单,订单运输方式未变,目的地国家未变,则不用更新订单编号
if (updateReqVO.getTransportId() == 3 && Objects.equals(updateReqVO.getTransportId(), oldOrderDO.getTransportId()) && !oldOrderDO.getOrderNo().contains("DRAFT") if (updateReqVO.getTransportId() == 3 && Objects.equals(updateReqVO.getTransportId(), oldOrderDO.getTransportId()) && !oldOrderDO.getOrderNo().contains("DRAFT")
&& !Objects.equals(updateReqVO.getStatus(), OrderStatusEnum.DRAFT.getValue())) { && !Objects.equals(updateReqVO.getStatus(), DRAFT.getValue())) {
if (Objects.nonNull(objective) && Objects.nonNull(oldObjective)) { if (Objects.nonNull(objective) && Objects.nonNull(oldObjective)) {
String[] labelCodes = objective.getLabelCode().split(StrUtil.DASHED); String[] labelCodes = objective.getLabelCode().split(StrUtil.DASHED);
String[] oldLabelCodes = oldObjective.getLabelCode().split(StrUtil.DASHED); String[] oldLabelCodes = oldObjective.getLabelCode().split(StrUtil.DASHED);
...@@ -1583,7 +1582,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -1583,7 +1582,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
} }
if (Objects.equals(objectiveDO.getObjectiveId(), updateReqVO.getObjectiveId()) && updateReqVO.getTransportId() == 3 if (Objects.equals(objectiveDO.getObjectiveId(), updateReqVO.getObjectiveId()) && updateReqVO.getTransportId() == 3
&& Objects.equals(updateReqVO.getTransportId(), oldOrderDO.getTransportId()) && !oldOrderDO.getOrderNo().contains("DRAFT") && Objects.equals(updateReqVO.getTransportId(), oldOrderDO.getTransportId()) && !oldOrderDO.getOrderNo().contains("DRAFT")
&& !Objects.equals(updateReqVO.getStatus(), OrderStatusEnum.DRAFT.getValue())) { && !Objects.equals(updateReqVO.getStatus(), DRAFT.getValue())) {
isSaveOrUpdateOrderNo = false; isSaveOrUpdateOrderNo = false;
} }
...@@ -1592,7 +1591,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -1592,7 +1591,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
if (isSaveOrUpdateOrderNo) { if (isSaveOrUpdateOrderNo) {
String newOrderNo; String newOrderNo;
if (Objects.equals(updateReqVO.getStatus(), OrderStatusEnum.DRAFT.getValue())) { if (Objects.equals(updateReqVO.getStatus(), DRAFT.getValue())) {
newOrderNo = "DRAFT-" + System.currentTimeMillis(); newOrderNo = "DRAFT-" + System.currentTimeMillis();
} else { } else {
newOrderNo = orderBusinessService.saveOrUpdateOrderNo(objective, updateReqVO.getTransportId(), updateReqVO.getIsExternalWarehouse(), newOrderNo = orderBusinessService.saveOrUpdateOrderNo(objective, updateReqVO.getTransportId(), updateReqVO.getIsExternalWarehouse(),
...@@ -1606,7 +1605,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -1606,7 +1605,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
// 目的地未变,运输方式变更,重新生成订单号 // 目的地未变,运输方式变更,重新生成订单号
RegionDO objective = JSONObject.parseObject(objectiveDO.getObjective(), RegionDO.class); RegionDO objective = JSONObject.parseObject(objectiveDO.getObjective(), RegionDO.class);
String newOrderNo; String newOrderNo;
if (Objects.equals(updateReqVO.getStatus(), OrderStatusEnum.DRAFT.getValue())) { if (Objects.equals(updateReqVO.getStatus(), DRAFT.getValue())) {
newOrderNo = "DRAFT-" + System.currentTimeMillis(); newOrderNo = "DRAFT-" + System.currentTimeMillis();
} else { } else {
newOrderNo = orderBusinessService.saveOrUpdateOrderNo(objective, updateReqVO.getTransportId(), updateObj.getIsExternalWarehouse(), newOrderNo = orderBusinessService.saveOrUpdateOrderNo(objective, updateReqVO.getTransportId(), updateObj.getIsExternalWarehouse(),
...@@ -1756,7 +1755,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -1756,7 +1755,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
if (Objects.nonNull(orderApprovalDO) && orderApprovalDO.getStatus() == 1) { if (Objects.nonNull(orderApprovalDO) && orderApprovalDO.getStatus() == 1) {
throw exception(YOUR_APPLY_PENDING); throw exception(YOUR_APPLY_PENDING);
} }
if (Objects.equals(vo.getStatus(), OrderStatusEnum.DRAFT.getValue()) if (Objects.equals(vo.getStatus(), DRAFT.getValue())
|| Objects.equals(vo.getStatus(), OrderStatusEnum.ORDER_PLACED.getValue()) || Objects.equals(vo.getStatus(), OrderStatusEnum.WAREHOUSING.getValue())) { || Objects.equals(vo.getStatus(), OrderStatusEnum.ORDER_PLACED.getValue()) || Objects.equals(vo.getStatus(), OrderStatusEnum.WAREHOUSING.getValue())) {
// 是草稿、已下单、入仓中状态 直接修改 // 是草稿、已下单、入仓中状态 直接修改
this.updateOrder(updateReqVO, memberUserDO); this.updateOrder(updateReqVO, memberUserDO);
...@@ -2547,7 +2546,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -2547,7 +2546,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
CustomerDO orgCustomerDO = customerService.getCustomer(vo.getCustomerId()); CustomerDO orgCustomerDO = customerService.getCustomer(vo.getCustomerId());
// TODO 客户归属变动时记录日志 // TODO 客户归属变动时记录日志
if (!Objects.equals(vo.getStatus(), OrderStatusEnum.DRAFT.getValue())) { if (!Objects.equals(vo.getStatus(), DRAFT.getValue())) {
ApplyInfoVO infoVO = null; ApplyInfoVO infoVO = null;
int customerType = 0; // 无变动 0 发货人 1 收货人 2 int customerType = 0; // 无变动 0 发货人 1 收货人 2
if (StringUtils.isNotBlank(vo.getType()) && vo.getType().contains("2")) { if (StringUtils.isNotBlank(vo.getType()) && vo.getType().contains("2")) {
...@@ -3120,7 +3119,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -3120,7 +3119,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
updateObj.setIsLimitUpdateConsignee(Boolean.FALSE); updateObj.setIsLimitUpdateConsignee(Boolean.FALSE);
} }
if (!Objects.equals(updateReqVO.getStatus(), if (!Objects.equals(updateReqVO.getStatus(),
OrderStatusEnum.DRAFT.getValue())) { DRAFT.getValue())) {
//customerType 发货人 1 收货人 2 //customerType 发货人 1 收货人 2
int customerType = int customerType =
...@@ -3131,7 +3130,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -3131,7 +3130,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
orderConsignorDO, orderConsignorDO,
orderConsigneeDO); orderConsigneeDO);
// 更新所属客户经理(业务员) // 更新所属客户经理(业务员)
if (!OrderStatusEnum.DRAFT.getValue().equals(updateObj.getStatus()) if (!DRAFT.getValue().equals(updateObj.getStatus())
&& ((Objects.nonNull(updateObj.getIsChargeCustomer()) && updateObj.getIsChargeCustomer()) && ((Objects.nonNull(updateObj.getIsChargeCustomer()) && updateObj.getIsChargeCustomer())
|| (Objects.nonNull(updateObj.getIsChargeDraft()) && updateObj.getIsChargeDraft()))) { || (Objects.nonNull(updateObj.getIsChargeDraft()) && updateObj.getIsChargeDraft()))) {
addOrderCustomerService(updateObj, customerType); addOrderCustomerService(updateObj, customerType);
...@@ -3177,7 +3176,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -3177,7 +3176,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
orderConsignorDO.setCustomerContactsId(consignorContactsDO.getId()); orderConsignorDO.setCustomerContactsId(consignorContactsDO.getId());
orderConsignorDO.setCustomerId(consignorContactsDO.getCustomerId()); orderConsignorDO.setCustomerId(consignorContactsDO.getCustomerId());
} else { } else {
if (!Objects.equals(updateReqVO.getStatus(), OrderStatusEnum.DRAFT.getValue())) { if (!Objects.equals(updateReqVO.getStatus(), DRAFT.getValue())) {
if (StringUtils.isBlank(updateReqVO.getConsignorPhone())) { if (StringUtils.isBlank(updateReqVO.getConsignorPhone())) {
throw exception(CONSIGNOR_PHONE_NOT_NULL); throw exception(CONSIGNOR_PHONE_NOT_NULL);
} }
...@@ -3198,7 +3197,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -3198,7 +3197,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
orderConsignorDO.setRelationId(updateObj.getCustomerId()); orderConsignorDO.setRelationId(updateObj.getCustomerId());
orderConsignorDO.setUpdateTime(now); orderConsignorDO.setUpdateTime(now);
if (!Objects.equals(updateReqVO.getStatus(), OrderStatusEnum.DRAFT.getValue())) { if (!Objects.equals(updateReqVO.getStatus(), DRAFT.getValue())) {
if (StringUtils.isBlank(orderConsignorDO.getPhone()) || StringUtils.isBlank(orderConsignorDO.getCountryCode())) { if (StringUtils.isBlank(orderConsignorDO.getPhone()) || StringUtils.isBlank(orderConsignorDO.getCountryCode())) {
throw exception(ORDER_CONSIGNOR_PHONE_INFO_NOT_COMPLETE); throw exception(ORDER_CONSIGNOR_PHONE_INFO_NOT_COMPLETE);
} }
...@@ -3232,7 +3231,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -3232,7 +3231,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
if (StringUtils.isNotBlank(orderConsignorDO.getPhone())) { if (StringUtils.isNotBlank(orderConsignorDO.getPhone())) {
orderConsignorService.saveOrUpdate(orderConsignorDO); orderConsignorService.saveOrUpdate(orderConsignorDO);
} }
if (updateObj.getIsCargoControl() && !Objects.equals(updateReqVO.getStatus(), OrderStatusEnum.DRAFT.getValue())) { if (updateObj.getIsCargoControl() && !Objects.equals(updateReqVO.getStatus(), DRAFT.getValue())) {
OrderCargoControlDO orgOrderCargoControlDO = orderCargoControlMapper.selectOne(new LambdaQueryWrapper<OrderCargoControlDO>().eq(OrderCargoControlDO::getOrderId, updateObj.getOrderId()).eq(OrderCargoControlDO::getIsActual, Boolean.TRUE).last("limit 1")); OrderCargoControlDO orgOrderCargoControlDO = orderCargoControlMapper.selectOne(new LambdaQueryWrapper<OrderCargoControlDO>().eq(OrderCargoControlDO::getOrderId, updateObj.getOrderId()).eq(OrderCargoControlDO::getIsActual, Boolean.TRUE).last("limit 1"));
// 控货订单 添加控货人信息 // 控货订单 添加控货人信息
OrderCargoControlDO orderCargoControlDO = new OrderCargoControlDO(); OrderCargoControlDO orderCargoControlDO = new OrderCargoControlDO();
...@@ -3306,7 +3305,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -3306,7 +3305,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
orderConsigneeDO.setCustomerContactsId(consigneeContactsDO.getId()); orderConsigneeDO.setCustomerContactsId(consigneeContactsDO.getId());
orderConsigneeDO.setCustomerId(consigneeContactsDO.getCustomerId()); orderConsigneeDO.setCustomerId(consigneeContactsDO.getCustomerId());
} else { } else {
if (!Objects.equals(updateReqVO.getStatus(), OrderStatusEnum.DRAFT.getValue())) { if (!Objects.equals(updateReqVO.getStatus(), DRAFT.getValue())) {
if (StringUtils.isBlank(updateReqVO.getConsigneePhone())) { if (StringUtils.isBlank(updateReqVO.getConsigneePhone())) {
throw exception(CONSIGNEE_PHONE_NOT_NULL); throw exception(CONSIGNEE_PHONE_NOT_NULL);
} }
...@@ -3338,7 +3337,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -3338,7 +3337,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
orderConsigneeDO.setRelationId(updateReqVO.getCustomerId()); orderConsigneeDO.setRelationId(updateReqVO.getCustomerId());
orderConsigneeDO.setUpdateTime(now); orderConsigneeDO.setUpdateTime(now);
if (!Objects.equals(updateReqVO.getStatus(), OrderStatusEnum.DRAFT.getValue())) { if (!Objects.equals(updateReqVO.getStatus(), DRAFT.getValue())) {
if (StringUtils.isBlank(orderConsigneeDO.getPhone()) || StringUtils.isBlank(orderConsigneeDO.getCountryCode())) { if (StringUtils.isBlank(orderConsigneeDO.getPhone()) || StringUtils.isBlank(orderConsigneeDO.getCountryCode())) {
throw exception(ORDER_CONSIGNEE_PHONE_INFO_NOT_COMPLETE); throw exception(ORDER_CONSIGNEE_PHONE_INFO_NOT_COMPLETE);
} }
...@@ -3381,7 +3380,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -3381,7 +3380,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
updateObj.setIsLimitUpdateConsignee(Boolean.FALSE); updateObj.setIsLimitUpdateConsignee(Boolean.FALSE);
} }
if (!Objects.equals(updateReqVO.getStatus(), if (!Objects.equals(updateReqVO.getStatus(),
OrderStatusEnum.DRAFT.getValue())) { DRAFT.getValue())) {
//customerType 发货人 1 收货人 2 //customerType 发货人 1 收货人 2
int customerType = this.checkOrderSalesman(updateObj, int customerType = this.checkOrderSalesman(updateObj,
updateReqVO.getOfferId(), updateReqVO.getOfferId(),
...@@ -3391,7 +3390,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -3391,7 +3390,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
orderConsigneeDO); orderConsigneeDO);
// 更新所属客户经理(业务员) // 更新所属客户经理(业务员)
if (!OrderStatusEnum.DRAFT.getValue().equals(updateObj.getStatus()) if (!DRAFT.getValue().equals(updateObj.getStatus())
&& ((Objects.nonNull(updateObj.getIsChargeCustomer()) && updateObj.getIsChargeCustomer()) && ((Objects.nonNull(updateObj.getIsChargeCustomer()) && updateObj.getIsChargeCustomer())
|| (Objects.nonNull(updateObj.getIsChargeDraft()) && updateObj.getIsChargeDraft()))) { || (Objects.nonNull(updateObj.getIsChargeDraft()) && updateObj.getIsChargeDraft()))) {
addOrderCustomerService(updateObj, customerType); addOrderCustomerService(updateObj, customerType);
...@@ -6201,4 +6200,251 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -6201,4 +6200,251 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
orderMapper.updateOrderCustomerAndSalesmanId(customerId, salesmanId, orderId); orderMapper.updateOrderCustomerAndSalesmanId(customerId, salesmanId, orderId);
} }
@Override
public Long copyOrder(Long copyOrderId, MemberUserDO memberUserDO) {
OrderDO orderDO = orderMapper.selectById(copyOrderId);
if (Objects.isNull(orderDO)){
throw exception(ORDER_NOT_EXISTS);
}
// 重新生成订单编号, 并重置订单中其他冗余信息
OrderDO newOrder = new OrderDO();
BeanUtils.copyProperties(orderDO, newOrder);
// 初始化订单信息
initializeOrderInfo(newOrder);
// 生成草稿订单编号
String newOrderNo = "DRAFT-" + System.currentTimeMillis();
newOrder.setOrderNo(newOrderNo);
if (Objects.nonNull(memberUserDO)){
// 会员端下单,需要保存会员id信息
newOrder.setUserId(memberUserDO.getId());
}
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
String creator = String.valueOf(loginUser != null ? loginUser.getId() : null);
Date now = new Date();
newOrder.setCreator(creator);
newOrder.setUpdater(creator);
newOrder.setCreateTime(now);
newOrder.setUpdateTime(now);
orderMapper.insert(newOrder);
Long newOrderId = newOrder.getOrderId();
// 始发地
OrderDepartureDO orderDepartureDO = orderDepartureService.getOne(new LambdaQueryWrapper<OrderDepartureDO>().eq(OrderDepartureDO::getOrderId, orderDO.getOrderId()).orderByDesc(OrderDepartureDO::getId).last("limit 1"));
OrderDepartureDO departureDO = new OrderDepartureDO();
BeanUtils.copyProperties(orderDepartureDO, departureDO);
departureDO.setId(null);
departureDO.setOrderId(newOrderId);
departureDO.setCreator(creator);
departureDO.setUpdater(creator);
departureDO.setCreateTime(now);
departureDO.setUpdateTime(now);
orderDepartureService.save(departureDO);
// 目的地
OrderObjectiveDO orderObjectiveDO = orderObjectiveService.getOne(new LambdaQueryWrapper<OrderObjectiveDO>().eq(OrderObjectiveDO::getOrderId, orderDO.getOrderId()).orderByDesc(OrderObjectiveDO::getId).last("limit 1"));
OrderObjectiveDO objectiveDO = new OrderObjectiveDO();
BeanUtils.copyProperties(orderObjectiveDO, objectiveDO);
objectiveDO.setId(null);
objectiveDO.setOrderId(newOrderId);
objectiveDO.setCreator(creator);
objectiveDO.setUpdater(creator);
objectiveDO.setCreateTime(now);
objectiveDO.setUpdateTime(now);
orderObjectiveService.save(objectiveDO);
// 发货人信息
OrderConsignorDO orderConsignorDO = orderConsignorService.getOne(new LambdaQueryWrapper<OrderConsignorDO>().eq(OrderConsignorDO::getOrderId, orderDO.getOrderId()).orderByDesc(OrderConsignorDO::getId).last("limit 1"));
OrderConsignorDO consignorDO = new OrderConsignorDO();
BeanUtils.copyProperties(orderConsignorDO, consignorDO);
consignorDO.setId(null);
consignorDO.setOrderId(newOrderId);
if (Objects.nonNull(memberUserDO)) {
consignorDO.setRelationId(memberUserDO.getId());
}
consignorDO.setCreator(creator);
consignorDO.setUpdater(creator);
consignorDO.setCreateTime(now);
consignorDO.setUpdateTime(now);
orderConsignorService.save(consignorDO);
// 收货人信息
OrderConsigneeDO orderConsigneeDO = orderConsigneeService.getOne(new LambdaQueryWrapper<OrderConsigneeDO>().eq(OrderConsigneeDO::getOrderId, orderDO.getOrderId()).orderByDesc(OrderConsigneeDO::getId).last("limit 1"));
OrderConsigneeDO consigneeDO = null;
if (Objects.nonNull(orderConsigneeDO)) {
consigneeDO = new OrderConsigneeDO();
BeanUtils.copyProperties(orderConsigneeDO, consigneeDO);
consigneeDO.setId(null);
consigneeDO.setOrderId(newOrderId);
consigneeDO.setCreator(creator);
consigneeDO.setUpdater(creator);
consigneeDO.setCreateTime(now);
consigneeDO.setUpdateTime(now);
orderConsigneeService.save(consigneeDO);
}
if (newOrder.getIsCargoControl()) {
// 控货信息
OrderCargoControlDO orderCargoControlDO = orderCargoControlMapper.selectOne(new LambdaQueryWrapper<OrderCargoControlDO>().eq(OrderCargoControlDO::getOrderId, orderDO.getOrderId()).orderByDesc(OrderCargoControlDO::getId).last("limit 1"));
OrderCargoControlDO cargoControlDO = new OrderCargoControlDO();
BeanUtils.copyProperties(orderCargoControlDO, cargoControlDO);
cargoControlDO.setId(null);
cargoControlDO.setOrderId(newOrderId);
cargoControlDO.setCreator(creator);
cargoControlDO.setUpdater(creator);
cargoControlDO.setCreateTime(now);
cargoControlDO.setUpdateTime(now);
orderCargoControlMapper.insert(cargoControlDO);
}
// 当订单的包装类型不为空时,创建特需需要在订单业务执行完成后再进行,避免部分订单数据还未插入
if (StringUtils.isNotBlank(newOrder.getPackageType())) {
String[] packageTypes = newOrder.getPackageType().split(StrUtil.COMMA);
List<OrderSpecialNeedCreateReqVO> createReqVOList = new ArrayList<>();
for (String packageType : packageTypes) {
OrderSpecialNeedCreateReqVO reqVO =
new OrderSpecialNeedCreateReqVO();
reqVO.setOrderId(newOrderId);
reqVO.setAdvanceType(packageType);
reqVO.setTransFee(BigDecimal.ZERO);
reqVO.setTransCurrency(1);
reqVO.setTodoDetail(newOrder.getPackageRemarks());
createReqVOList.add(reqVO);
}
orderSpecialNeedService.createOrderSpecialNeed(createReqVOList, Boolean.FALSE);
}
// 商品信息
List<OrderItemDO> itemDOList = orderItemMapper.selectList(new LambdaQueryWrapper<OrderItemDO>().eq(OrderItemDO::getOrderId, orderDO.getOrderId()).orderByDesc(OrderItemDO::getOrderItemId));
List<OrderItemDO> newItemDOList = itemDOList.stream().map(io -> copyNewOrderItem(io, newOrderId, newOrderNo, newOrder, now, creator)).collect(Collectors.toList());
// 插入订单商品项
orderBusinessService.costCalculation(creator,
newOrder, consignorDO.getCustomerId(),
Objects.isNull(consigneeDO) ? 0L : consigneeDO.getCustomerId(),
consignorDO.getCustomerContactsId(),
Objects.isNull(consigneeDO) ? 0L : consigneeDO.getCustomerContactsId(),
newItemDOList, 1);
try {
if (memberUserDO != null && Objects.nonNull(consigneeDO)) {
// app-web添加的订单
AdminClientCreateEvent adminClientCreateEvent =
new AdminClientCreateEvent();
//下单用户
adminClientCreateEvent.setUid(memberUserDO.getId());
//收货人信息
adminClientCreateEvent.setName(orderConsigneeDO.getName());
adminClientCreateEvent.setCompany(orderConsigneeDO.getCompany());
adminClientCreateEvent.setPhone(orderConsigneeDO.getPhone());
adminClientCreateEvent.setEmail(orderConsigneeDO.getEmail());
adminClientCreateEvent.setAddress(orderConsigneeDO.getAddress());
adminClientCreateEvent.setDialCode(Integer.parseInt(orderConsigneeDO.getCountryCode()));
adminClientCreateEvent.setMaitou(newOrder.getMarks());
adminClientCreateEvent.setDefaultContact(true);
indirectCustomerService.createIndirectCustomer(
adminClientCreateEvent);
}
} catch (Exception e) {
log.error("");
}
//发货人的信用日志
customerCreditLogService.sendPackageCreditLog(orderConsignorDO.getCustomerContactsId(), newOrderId, newOrderNo);
// 创建订单操作日志
orderBusinessService.addOrderOperateLog(newOrderId,
"新建订单", null);
// //在创建完订单号,计算订单业绩类型
// CalculateOrderYeJiTypeEvent even = new CalculateOrderYeJiTypeEvent();
// even.setOrderId(newOrderId);
// applicationContext.publishEvent(even);
return newOrderId;
}
@NotNull
private static OrderItemDO copyNewOrderItem(OrderItemDO io, Long newOrderId, String newOrderNo, OrderDO newOrder, Date now, String creator) {
OrderItemDO orderItemDO = new OrderItemDO();
orderItemDO.setOrderId(newOrderId);
orderItemDO.setOrderNo(newOrderNo);
orderItemDO.setTransportId(newOrder.getTransportId());
orderItemDO.setLineId(newOrder.getLineId());
orderItemDO.setChannelId(newOrder.getChannelId());
orderItemDO.setLink(io.getLink());
orderItemDO.setProdId(io.getProdId());
orderItemDO.setProdAttrIds(io.getProdAttrIds());
orderItemDO.setProdTitleEn(io.getProdTitleEn());
orderItemDO.setProdType(io.getProdType());
orderItemDO.setProdTitleZh(io.getProdTitleZh());
orderItemDO.setVolume(io.getVolume());
orderItemDO.setWeight(io.getWeight());
orderItemDO.setQuantity(io.getQuantity());
orderItemDO.setNum(io.getQuantity());
orderItemDO.setBoxGauge(io.getBoxGauge());
orderItemDO.setBrand(io.getBrand());
orderItemDO.setBrandType(io.getBrandType());
orderItemDO.setCreateTime(now);
orderItemDO.setCreator(creator);
return orderItemDO;
}
/**
* 初始化订单信息
*
* @param newOrder 需要初始化的订单信息
*/
private static void initializeOrderInfo(OrderDO newOrder) {
newOrder.setOrderId(null);
newOrder.setUserId(null);
newOrder.setSumNum(null);
newOrder.setSumQuantity(null);
newOrder.setSumVolume(null);
newOrder.setSumWeight(null);
newOrder.setPickleType(null);
newOrder.setPickRatio(null);
newOrder.setPickNum(null);
newOrder.setCost(null);
newOrder.setPackingListUrl(null);
newOrder.setCommissionPayable(null);
newOrder.setSpecialVWeight(null);
newOrder.setHandlerChannelAttrException(null);
newOrder.setWeightBeforePack(null);
newOrder.setWeightAfterPack(null);
newOrder.setStockOverWeightLimit(null);
newOrder.setFirstStockedTime(null);
newOrder.setHasConsignee(null);
newOrder.setIsLimitUpdateConsignee(null);
newOrder.setLockConsigneeDay(null);
newOrder.setLockConsigneeTime(null);
// newOrder.setDisplayBillLadingPrice(null);
// 状态重置
newOrder.setSplitSeparateOrder(null);
newOrder.setShipmentState(null);
newOrder.setStatus(DRAFT.getValue());// 默认草稿订单
newOrder.setAirShipment(null);
newOrder.setAbnormalState(null);
newOrder.setAuditType(null);
newOrder.setAuditResult(null);
newOrder.setPickState(null);
newOrder.setGuanLianOrderStatus(null);
// 时间重置
newOrder.setTakeTime(null);
newOrder.setUnloadTime(null);
newOrder.setRucangTime(null);
newOrder.setLoadTime(null);
newOrder.setPreLoadTime(null);
newOrder.setDeliveryDate(null);
newOrder.setDaogangTime(null);
newOrder.setQingguanTime(null);
newOrder.setSplitTime(null);
newOrder.setIsException(null);
newOrder.setExceptionReason(null);
newOrder.setExternalWarehouseJson(null);
newOrder.setHasConsignee(null);
newOrder.setHasExitAndEntry(null);
newOrder.setHasSendRucangSms(null);
newOrder.setHasSendWarehouseInNotice(null);
}
} }
...@@ -625,6 +625,16 @@ public class OrderQueryVO { ...@@ -625,6 +625,16 @@ public class OrderQueryVO {
@ApiModelProperty(value = "是否预警控货订单: 1 是") @ApiModelProperty(value = "是否预警控货订单: 1 是")
private Integer warningOrder; private Integer warningOrder;
@ApiModelProperty(value = "是否有收货人")
private Boolean hasConsignee;
public void setHasConsignee(Boolean hasConsignee) {
if (Objects.nonNull(hasConsignee)) {
// 这里数据的条件正好相反,数据库是同步的客户信息设置,是否允许无收货人,true为允许无收货人
this.hasConsignee = !hasConsignee;
}
}
public void setStatus(Integer status) { public void setStatus(Integer status) {
this.status = status; this.status = status;
this.asStatus = status; this.asStatus = status;
......
...@@ -1222,7 +1222,7 @@ ...@@ -1222,7 +1222,7 @@
in_time, in_time,
if(#{query.userType} = 1, 1, 2) as user_type, if(#{query.userType} = 1, 1, 2) as user_type,
nor.customer_id as consignor_customer_id, nor.customer_id as consignor_customer_id,
if(nor.customer_id != null and nor.customer_id > 0L, if(nor.customer_id != null and nor.customer_id > 0,
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nor.customer_id), (SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nor.customer_id),
"") as consignor_follow_customerService, "") as consignor_follow_customerService,
nor.customer_number as consignor_customer_number, nor.customer_number as consignor_customer_number,
...@@ -1231,7 +1231,7 @@ ...@@ -1231,7 +1231,7 @@
nor.phone as consignor_phone, nor.phone as consignor_phone,
nor.country_code as consignor_country_code, nor.country_code as consignor_country_code,
nee.customer_id as consignee_customer_id, nee.customer_id as consignee_customer_id,
if(nee.customer_id != null and nee.customer_id > 0L, if(nee.customer_id != null and nee.customer_id > 0,
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nee.customer_id), (SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nee.customer_id),
"") as consignee_follow_customerService, "") as consignee_follow_customerService,
nee.customer_number as consignee_customer_number, nee.customer_number as consignee_customer_number,
...@@ -1364,7 +1364,7 @@ ...@@ -1364,7 +1364,7 @@
in_time, in_time,
if(#{query.userType} = 1, 1, 2) as user_type, if(#{query.userType} = 1, 1, 2) as user_type,
nor.customer_id as consignor_customer_id, nor.customer_id as consignor_customer_id,
if(nor.customer_id != null and nor.customer_id > 0L, if(nor.customer_id != null and nor.customer_id > 0,
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nor.customer_id), (SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nor.customer_id),
"") as consignor_follow_customerService, "") as consignor_follow_customerService,
nor.customer_number as consignor_customer_number, nor.customer_number as consignor_customer_number,
...@@ -1373,7 +1373,7 @@ ...@@ -1373,7 +1373,7 @@
nor.phone as consignor_phone, nor.phone as consignor_phone,
nor.country_code as consignor_country_code, nor.country_code as consignor_country_code,
nee.customer_id as consignee_customer_id, nee.customer_id as consignee_customer_id,
if(nee.customer_id != null and nee.customer_id > 0L, if(nee.customer_id != null and nee.customer_id > 0,
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nee.customer_id), (SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nee.customer_id),
"") as consignee_follow_customerService, "") as consignee_follow_customerService,
nee.customer_number as consignee_customer_number, nee.customer_number as consignee_customer_number,
...@@ -3707,7 +3707,7 @@ ...@@ -3707,7 +3707,7 @@
in_time, in_time,
if(#{query.userType} = 1, 1, 2) as user_type, if(#{query.userType} = 1, 1, 2) as user_type,
nor.customer_id as consignor_customer_id, nor.customer_id as consignor_customer_id,
if(nor.customer_id != null and nor.customer_id > 0L, if(nor.customer_id != null and nor.customer_id > 0,
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nor.customer_id), (SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nor.customer_id),
"") as consignor_follow_customerService, "") as consignor_follow_customerService,
nor.customer_number as consignor_customer_number, nor.customer_number as consignor_customer_number,
...@@ -3716,7 +3716,7 @@ ...@@ -3716,7 +3716,7 @@
nor.phone as consignor_phone, nor.phone as consignor_phone,
nor.country_code as consignor_country_code, nor.country_code as consignor_country_code,
nee.customer_id as consignee_customer_id, nee.customer_id as consignee_customer_id,
if(nee.customer_id != null and nee.customer_id > 0L, if(nee.customer_id != null and nee.customer_id > 0,
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nee.customer_id), (SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nee.customer_id),
"") as consignee_follow_customerService, "") as consignee_follow_customerService,
nee.customer_number as consignee_customer_number, nee.customer_number as consignee_customer_number,
...@@ -3831,7 +3831,7 @@ ...@@ -3831,7 +3831,7 @@
in_time, in_time,
if(#{query.userType} = 1, 1, 2) as user_type, if(#{query.userType} = 1, 1, 2) as user_type,
nor.customer_id as consignor_customer_id, nor.customer_id as consignor_customer_id,
if(nor.customer_id != null and nor.customer_id > 0L, if(nor.customer_id != null and nor.customer_id > 0,
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nor.customer_id), (SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nor.customer_id),
"") as consignor_follow_customerService, "") as consignor_follow_customerService,
nor.customer_number as consignor_customer_number, nor.customer_number as consignor_customer_number,
...@@ -3840,7 +3840,7 @@ ...@@ -3840,7 +3840,7 @@
nor.phone as consignor_phone, nor.phone as consignor_phone,
nor.country_code as consignor_country_code, nor.country_code as consignor_country_code,
nee.customer_id as consignee_customer_id, nee.customer_id as consignee_customer_id,
if(nee.customer_id != null and nee.customer_id > 0L, if(nee.customer_id != null and nee.customer_id > 0,
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nee.customer_id), (SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nee.customer_id),
"") as consignee_follow_customerService, "") as consignee_follow_customerService,
nee.customer_number as consignee_customer_number, nee.customer_number as consignee_customer_number,
...@@ -3981,7 +3981,7 @@ ...@@ -3981,7 +3981,7 @@
in_time, in_time,
if(#{query.userType} = 1, 1, 2) as user_type, if(#{query.userType} = 1, 1, 2) as user_type,
nor.customer_id as consignor_customer_id, nor.customer_id as consignor_customer_id,
if(nor.customer_id != null and nor.customer_id > 0L, if(nor.customer_id != null and nor.customer_id > 0,
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nor.customer_id), (SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nor.customer_id),
"") as consignor_follow_customerService, "") as consignor_follow_customerService,
nor.customer_number as consignor_customer_number, nor.customer_number as consignor_customer_number,
...@@ -3990,7 +3990,7 @@ ...@@ -3990,7 +3990,7 @@
nor.phone as consignor_phone, nor.phone as consignor_phone,
nor.country_code as consignor_country_code, nor.country_code as consignor_country_code,
nee.customer_id as consignee_customer_id, nee.customer_id as consignee_customer_id,
if(nee.customer_id != null and nee.customer_id > 0L, if(nee.customer_id != null and nee.customer_id > 0,
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nee.customer_id), (SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nee.customer_id),
"") as consignee_follow_customerService, "") as consignee_follow_customerService,
nee.customer_number as consignee_customer_number, nee.customer_number as consignee_customer_number,
...@@ -4117,7 +4117,7 @@ ...@@ -4117,7 +4117,7 @@
in_time, in_time,
if(#{query.userType} = 1, 1, 2) as user_type, if(#{query.userType} = 1, 1, 2) as user_type,
nor.customer_id as consignor_customer_id, nor.customer_id as consignor_customer_id,
if(nor.customer_id != null and nor.customer_id > 0L, if(nor.customer_id != null and nor.customer_id > 0,
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nor.customer_id), (SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nor.customer_id),
"") as consignor_follow_customerService, "") as consignor_follow_customerService,
nor.customer_number as consignor_customer_number, nor.customer_number as consignor_customer_number,
...@@ -4126,7 +4126,7 @@ ...@@ -4126,7 +4126,7 @@
nor.phone as consignor_phone, nor.phone as consignor_phone,
nor.country_code as consignor_country_code, nor.country_code as consignor_country_code,
nee.customer_id as consignee_customer_id, nee.customer_id as consignee_customer_id,
if(nee.customer_id != null and nee.customer_id > 0L, if(nee.customer_id != null and nee.customer_id > 0,
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nee.customer_id), (SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nee.customer_id),
"") as consignee_follow_customerService, "") as consignee_follow_customerService,
nee.customer_number as consignee_customer_number, nee.customer_number as consignee_customer_number,
...@@ -4222,7 +4222,7 @@ ...@@ -4222,7 +4222,7 @@
in_time, in_time,
if(#{query.userType} = 1, 1, 2) as user_type, if(#{query.userType} = 1, 1, 2) as user_type,
nor.customer_id as consignor_customer_id, nor.customer_id as consignor_customer_id,
if(nor.customer_id != null and nor.customer_id > 0L, if(nor.customer_id != null and nor.customer_id > 0,
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nor.customer_id), (SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nor.customer_id),
"") as consignor_follow_customerService, "") as consignor_follow_customerService,
nor.customer_number as consignor_customer_number, nor.customer_number as consignor_customer_number,
...@@ -4231,7 +4231,7 @@ ...@@ -4231,7 +4231,7 @@
nor.phone as consignor_phone, nor.phone as consignor_phone,
nor.country_code as consignor_country_code, nor.country_code as consignor_country_code,
nee.customer_id as consignee_customer_id, nee.customer_id as consignee_customer_id,
if(nee.customer_id != null and nee.customer_id > 0L, if(nee.customer_id != null and nee.customer_id > 0,
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nee.customer_id), (SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nee.customer_id),
"") as consignee_follow_customerService, "") as consignee_follow_customerService,
nee.customer_number as consignee_customer_number, nee.customer_number as consignee_customer_number,
...@@ -4340,7 +4340,7 @@ ...@@ -4340,7 +4340,7 @@
o.is_exception, o.is_exception,
o.create_time, o.create_time,
nor.customer_id as consignor_customer_id, nor.customer_id as consignor_customer_id,
if(nor.customer_id != null and nor.customer_id > 0L, if(nor.customer_id != null and nor.customer_id > 0,
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nor.customer_id), (SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nor.customer_id),
"") as consignor_follow_customerService, "") as consignor_follow_customerService,
nor.customer_number as consignor_customer_number, nor.customer_number as consignor_customer_number,
...@@ -4349,7 +4349,7 @@ ...@@ -4349,7 +4349,7 @@
nor.phone as consignor_phone, nor.phone as consignor_phone,
nor.country_code as consignor_country_code, nor.country_code as consignor_country_code,
nee.customer_id as consignee_customer_id, nee.customer_id as consignee_customer_id,
if(nee.customer_id != null and nee.customer_id > 0L, if(nee.customer_id != null and nee.customer_id > 0,
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nee.customer_id), (SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nee.customer_id),
"") as consignee_follow_customerService, "") as consignee_follow_customerService,
nee.customer_number as consignee_customer_number, nee.customer_number as consignee_customer_number,
...@@ -5328,7 +5328,7 @@ ...@@ -5328,7 +5328,7 @@
o.create_time, o.create_time,
if(#{query.userType} = 1, 1, 2) as user_type, if(#{query.userType} = 1, 1, 2) as user_type,
nor.customer_id as consignor_customer_id, nor.customer_id as consignor_customer_id,
if(nor.customer_id != null and nor.customer_id > 0L, if(nor.customer_id != null and nor.customer_id > 0,
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nor.customer_id), (SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nor.customer_id),
"") as consignor_follow_customerService, "") as consignor_follow_customerService,
nor.customer_number as consignor_customer_number, nor.customer_number as consignor_customer_number,
...@@ -5337,7 +5337,7 @@ ...@@ -5337,7 +5337,7 @@
nor.phone as consignor_phone, nor.phone as consignor_phone,
nor.country_code as consignor_country_code, nor.country_code as consignor_country_code,
nee.customer_id as consignee_customer_id, nee.customer_id as consignee_customer_id,
if(nee.customer_id != null and nee.customer_id > 0L, if(nee.customer_id != null and nee.customer_id > 0,
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nee.customer_id), (SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nee.customer_id),
"") as consignee_follow_customerService, "") as consignee_follow_customerService,
nee.customer_number as consignee_customer_number, nee.customer_number as consignee_customer_number,
...@@ -5427,7 +5427,7 @@ ...@@ -5427,7 +5427,7 @@
o.create_time, o.create_time,
if(#{query.userType} = 1, 1, 2) as user_type, if(#{query.userType} = 1, 1, 2) as user_type,
nor.customer_id as consignor_customer_id, nor.customer_id as consignor_customer_id,
if(nor.customer_id != null and nor.customer_id > 0L, if(nor.customer_id != null and nor.customer_id > 0,
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nor.customer_id), (SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nor.customer_id),
"") as consignor_follow_customerService, "") as consignor_follow_customerService,
nor.customer_number as consignor_customer_number, nor.customer_number as consignor_customer_number,
...@@ -5436,7 +5436,7 @@ ...@@ -5436,7 +5436,7 @@
nor.phone as consignor_phone, nor.phone as consignor_phone,
nor.country_code as consignor_country_code, nor.country_code as consignor_country_code,
nee.customer_id as consignee_customer_id, nee.customer_id as consignee_customer_id,
if(nee.customer_id != null and nee.customer_id > 0L, if(nee.customer_id != null and nee.customer_id > 0,
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nee.customer_id), (SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nee.customer_id),
"") as consignee_follow_customerService, "") as consignee_follow_customerService,
nee.customer_number as consignee_customer_number, nee.customer_number as consignee_customer_number,
......
...@@ -160,6 +160,16 @@ public class OrderController { ...@@ -160,6 +160,16 @@ public class OrderController {
} }
@PostMapping("/copy/{copyOrderId}")
@ApiOperation("复制订单")
@DynamicRateLimiter(base = "#Headers['Authorization']", permits = 1)
@Idempotent(timeout = 5)
public CommonResult<Long> copyOrder(@PathVariable Long copyOrderId) {
Long orderId = orderService.copyOrder(copyOrderId, null);
return success(orderId);
}
@PutMapping("/update") @PutMapping("/update")
@ApiOperation("更新订单") @ApiOperation("更新订单")
@Idempotent(timeout = 5) @Idempotent(timeout = 5)
......
...@@ -158,6 +158,28 @@ public class MyOrderController { ...@@ -158,6 +158,28 @@ public class MyOrderController {
return success(orderService.createOrder(createReqVO, memberUserDO).getOrderId()); return success(orderService.createOrder(createReqVO, memberUserDO).getOrderId());
} }
@PostMapping("/copy/{copyOrderId}")
@DynamicRateLimiter(base = "#Headers['Authorization']", permits = 1)
@ApiOperation(value = "复制订单", notes = "发货人只取当前用户信息,收货人取当前用户的客户信息")
@Idempotent(timeout = 15)
@PreAuthenticated
public CommonResult<Long> copyOrder(@PathVariable Long copyOrderId) {
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
Integer userType = loginUser.getUserType();
if (userType != 1){
return error(UNAUTHORIZED);
}
Long userId = loginUser.getId();
MemberUserDO memberUserDO = memberUserService.info(userId);
if (Objects.isNull(memberUserDO) ||
memberUserDO.getStatus() == 1 ||
memberUserDO.getDeleted()) {
return error(MEMBER_NOT_EXISTS);
}
Long orderId = orderService.copyOrder(copyOrderId, memberUserDO);
return success(orderId);
}
@PostMapping("/checkKycStatus") @PostMapping("/checkKycStatus")
@ApiOperation("检查kyc状态") @ApiOperation("检查kyc状态")
public CommonResult<Boolean> checkKycStatus(OrderKycReqVO kycReqVO) { public CommonResult<Boolean> checkKycStatus(OrderKycReqVO kycReqVO) {
......
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