Commit dea7eb34 authored by Administrator's avatar Administrator

Merge branch 'release' into 'jd_dev'

Release最新代码合并入捷道研发分支20241119

See merge request !36
parents 90e1c543 9c098594
-- 补充跟进记录列表的客户经理所属部门id
alter table ecw_customer_followup
add COLUMN `dept_id` bigint DEFAULT NULL COMMENT '客户经理/跟进业务员所属部门id' after `follow_user_id`;
update `ecw_customer_followup` f left join `system_user` u on f.follow_user_id = u.id set f.dept_id = u.dept_id;
\ No newline at end of file
......@@ -75,6 +75,10 @@ public class CustomerFollowupDO extends BaseDO {
* 客户经理/跟进业务员id
*/
private Long followUserId;
@ApiModelProperty(value = "客户经理/跟进业务员所属部门id")
private Long deptId;
/**
* 目的
*/
......
......@@ -37,4 +37,17 @@ public interface ErrorCodeConstants {
ErrorCode FOLLOWUP_NUMBER_NOT_NULL = new ErrorCode(1005001015, "客户跟进编号不能为空");
ErrorCode FOLLOWUP_TYPE_NOT_NULL = new ErrorCode(1005001016, "请选择跟进类型");
ErrorCode BUSINESS_OPPORTUNITY_FOLLOWUP_OFFER_NOT_NULL = new ErrorCode(1005001017, "商机跟进时,请选择报价单");
ErrorCode CUSTOMER_NOT_NULL = new ErrorCode(1005001018, "请选择客户");
ErrorCode CUSTOMER_CONTACT_NOT_NULL = new ErrorCode(1005001019, "请选择客户联系人");
ErrorCode FOLLOWUP_TIME_NOT_NULL = new ErrorCode(1005001020, "请选择跟进时间");
ErrorCode FOLLOWUP_METHOD_NOT_NULL = new ErrorCode(1005001021, "请选择跟进方式");
ErrorCode CUSTOMER_SERVICE_NOT_NULL = new ErrorCode(1005001022, "请选择客户经理");
ErrorCode FOLLOWUP_RESULT_NOT_NULL = new ErrorCode(1005001023, "请选择跟进结果");
ErrorCode FOLLOWUP_PURPOSE_NOT_NULL = new ErrorCode(1005001024, "请填写跟进目的");
ErrorCode FOLLOWUP_FEEFBACK_NOT_NULL = new ErrorCode(1005001025, "请填写跟进情况");
ErrorCode NEXT_FOLLOWUP_TIME_NOT_NULL = new ErrorCode(1005001026, "请选择下次跟进时间");
ErrorCode NEXT_FOLLOWUP_PLAN_NOT_NULL = new ErrorCode(1005001027, "请填写下一步计划");
}
......@@ -22,8 +22,12 @@ import cn.iocoder.yudao.module.customer.vo.customerFollowup.*;
import cn.iocoder.yudao.module.customer.vo.customerOperateLog.CustomerOperateLogCreateReqVO;
import cn.iocoder.yudao.module.ecw.enums.CustomerFollowupStatusEnum;
import cn.iocoder.yudao.module.ecw.enums.CustomerOperateTypeEnum;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.ApplicationContext;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
......@@ -32,10 +36,11 @@ import javax.annotation.Resource;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.customer.enums.ErrorCodeConstants.FOLLOWUP_ALREADY_SUBMITTED;
import static cn.iocoder.yudao.module.customer.enums.ErrorCodeConstants.FOLLOWUP_NOT_EXISTS;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
import static cn.iocoder.yudao.module.customer.enums.ErrorCodeConstants.*;
/**
* 客户跟进 Service 实现类
......@@ -49,7 +54,8 @@ public class CustomerFollowupServiceImpl extends AbstractService<CustomerFollowu
@Resource
private CustomerFollowupMapper followupMapper;
@Resource
private AdminUserApi adminUserApi;
@Resource
private CustomerOperateLogService customerOperateLogService;
......@@ -90,6 +96,7 @@ public class CustomerFollowupServiceImpl extends AbstractService<CustomerFollowu
@Override
@Transactional(rollbackFor = Exception.class)
public Long createFollowup(CustomerFollowupCreateReqVO createReqVO) {
// 更新编号,内部会判断冲突
//OrderNumberLogListener
OrderNumberLogEvent event = new OrderNumberLogEvent();
......@@ -101,12 +108,25 @@ public class CustomerFollowupServiceImpl extends AbstractService<CustomerFollowu
// 待将最新单号持久化
event.setNewNumber(newNumber);
applicationContext.publishEvent(event);
// 插入
CustomerFollowupDO followup = CustomerFollowupConvert.INSTANCE.convert(createReqVO);
if (Objects.isNull(followup.getFollowType())){
throw exception(FOLLOWUP_TYPE_NOT_NULL);
}
if (followup.getFollowType() == 2 && Objects.isNull(followup.getOfferId())){
throw exception(BUSINESS_OPPORTUNITY_FOLLOWUP_OFFER_NOT_NULL);
}
// 设置联系人名称
setContactName(followup);
followup.setNumber(newNumber);
if (Objects.nonNull(followup.getFollowUserId())){
// 获取客户经理的部门id
followup.setDeptId(adminUserApi.getUserDeptId(followup.getFollowUserId()));
}
// 当跟进为提交结果时,除附件和上级跟进单非必填,其他参数都时必填
if (followup.getStatus() == 1){
validateFollowupMustParams(followup);
}
followupMapper.insert(followup);
Long customerId = createReqVO.getCustomerId();
......@@ -137,6 +157,40 @@ public class CustomerFollowupServiceImpl extends AbstractService<CustomerFollowu
return followup.getId();
}
private void validateFollowupMustParams(CustomerFollowupDO followup) {
if (Objects.isNull(followup.getCustomerId())){
throw exception(CUSTOMER_NOT_NULL);
}
if (Objects.isNull(followup.getContactId())){
throw exception(CUSTOMER_CONTACT_NOT_NULL);
}
if (Objects.isNull(followup.getFollowTime())){
throw exception(FOLLOWUP_TIME_NOT_NULL);
}
if (Objects.isNull(followup.getFollowMethod())){
throw exception(FOLLOWUP_METHOD_NOT_NULL);
}
if (Objects.isNull(followup.getFollowUserId())){
throw exception(CUSTOMER_SERVICE_NOT_NULL);
}
if (Objects.isNull(followup.getResultType())){
throw exception(FOLLOWUP_RESULT_NOT_NULL);
}
if (StringUtils.isBlank(followup.getPurpose())){
throw exception(FOLLOWUP_PURPOSE_NOT_NULL);
}
if (StringUtils.isBlank(followup.getFeedback())){
throw exception(FOLLOWUP_FEEFBACK_NOT_NULL);
}
if (Objects.isNull(followup.getNextTime())){
throw exception(NEXT_FOLLOWUP_TIME_NOT_NULL);
}
if (StringUtils.isBlank(followup.getNextPlan())){
throw exception(NEXT_FOLLOWUP_PLAN_NOT_NULL);
}
}
private void setContactName(CustomerFollowupDO followup) {
// 设置联系人名称
Long contactId = followup.getContactId();
......@@ -150,6 +204,7 @@ public class CustomerFollowupServiceImpl extends AbstractService<CustomerFollowu
@Override
public void updateFollowup(CustomerFollowupUpdateReqVO updateReqVO) {
// 校验存在
Long id = updateReqVO.getId();
CustomerFollowupDO customerFollowupDO = followupMapper.selectById(id);
......@@ -161,10 +216,22 @@ public class CustomerFollowupServiceImpl extends AbstractService<CustomerFollowu
}
// 更新
CustomerFollowupDO updateObj = CustomerFollowupConvert.INSTANCE.convert(updateReqVO);
if (Objects.isNull(updateObj.getFollowType())){
throw exception(FOLLOWUP_TYPE_NOT_NULL);
}
if (updateObj.getFollowType() == 2 && Objects.isNull(updateObj.getOfferId())){
throw exception(BUSINESS_OPPORTUNITY_FOLLOWUP_OFFER_NOT_NULL);
}
// 设置联系人名称
setContactName(updateObj);
if (Objects.nonNull(updateObj.getFollowUserId())){
// 获取客户经理的部门id
updateObj.setDeptId(adminUserApi.getUserDeptId(updateObj.getFollowUserId()));
}
// 当跟进为提交结果时,除附件和上级跟进单非必填,其他参数都时必填
if (updateObj.getStatus() == 1){
validateFollowupMustParams(updateObj);
}
followupMapper.updateById(updateObj);
Long customerId = updateReqVO.getCustomerId();
......
package cn.iocoder.yudao.module.customer.vo.customer.customerContacts;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.*;
import io.swagger.annotations.*;
import javax.validation.constraints.*;
......@@ -54,4 +55,19 @@ public class CustomerContactsBaseVO {
@NotNull(message = "手机号码(不带任何区号)不能为空")
private String phoneNew;
/**
* 客户编号
*/
@TableField(exist = false)
@ApiModelProperty(value = "客户编号")
private String customerNumber;
/**
* 客户编号
*/
@TableField(exist = false)
@ApiModelProperty(value = "客户经理")
private Long customerService;
}
......@@ -57,9 +57,16 @@ public class CustomerFollowupBackVO {
@ApiModelProperty(value = "客户经理/跟进业务员id")
private Long followUserId;
@ExcelProperty("客户经理")
@ApiModelProperty("客户经理")
private String followUserName;
@ApiModelProperty(value = "客户经理/跟进业务员所属部门id")
private Long deptId;
@ApiModelProperty("部门名称")
private String deptName;
......
......@@ -50,6 +50,9 @@ public class CustomerFollowupBaseVO {
@ApiModelProperty(value = "客户经理/跟进业务员id")
private Long followUserId;
@ApiModelProperty(value = "客户经理/跟进业务员所属部门id")
private Long deptId;
@ApiModelProperty(value = "目的")
private String purpose;
......
......@@ -124,4 +124,9 @@ public class CustomerFollowupQueryVO extends PageParam {
@ApiModelProperty(value = "联系人电话")
private String contactPhone;
@ApiModelProperty(value = "操作用户的所属权限部门ID列表")
private List<Long> deptIdList;
}
......@@ -24,6 +24,10 @@
AND a.offer_id in
<foreach item='item' index="index" collection='query.offerIds' open='(' separator=',' close=')'>#{item}</foreach>
</if>
<if test="query.deptIdList != null and query.deptIdList.size() > 0">
AND a.dept_id in
<foreach item='deptId' index="index" collection='query.deptIdList' open='(' separator=',' close=')'>#{deptId}</foreach>
</if>
<if test="query.followType != null">
AND a.follow_type = #{query.followType}
......
......@@ -109,6 +109,8 @@ public class CustomerContactsController {
if (customer != null) {
respVOList.stream().forEach(customerContactsRespVO -> {
customerContactsRespVO.setCompany(customer.getCompany());
customerContactsRespVO.setCustomerNumber(customer.getNumber());
customerContactsRespVO.setCustomerService(customer.getCustomerService());
});
}
}
......
package cn.iocoder.yudao.module.customer.controller.admin.customerFollowup;
import cn.hutool.core.collection.CollectionUtil;
import cn.iocoder.yudao.framework.i18n.core.I18nMessage;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.customer.dto.CustomerExportReqDTO;
import cn.iocoder.yudao.module.sale.vo.offer.OfferPageReqVO;
import cn.iocoder.yudao.module.system.api.file.FileMakeApi;
import cn.iocoder.yudao.module.system.api.file.dto.FileMakeReqDTO;
import cn.iocoder.yudao.module.system.api.permission.RoleApi;
import cn.iocoder.yudao.module.system.api.permission.dto.RoleRespDTO;
import cn.iocoder.yudao.module.system.enums.ErrorCodeConstants;
import cn.iocoder.yudao.module.system.enums.download.DownloadTypeEnum;
import cn.iocoder.yudao.module.system.enums.permission.DataScopeEnum;
import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
......@@ -19,10 +27,14 @@ import java.util.*;
import java.io.IOException;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.ROLE_NOT_EXISTS;
import cn.iocoder.yudao.module.customer.vo.customerFollowup.*;
import cn.iocoder.yudao.module.customer.dal.dataobject.customerFollowup.CustomerFollowupDO;
import cn.iocoder.yudao.module.customer.convert.customerFollowup.CustomerFollowupConvert;
......@@ -37,7 +49,8 @@ public class CustomerFollowupController {
@Resource
private CustomerFollowupService followupService;
@Resource
private RoleApi roleApi;
@Resource
private FileMakeApi fileMakeApi;
......@@ -110,6 +123,48 @@ public class CustomerFollowupController {
return success(CustomerFollowupConvert.INSTANCE.convertPage(pageResult));
}
@GetMapping("/data/space/page")
@ApiOperation("数据权限获得客户跟进分页")
// @PreAuthorize("@ss.hasPermission('customer:followup:query')")
public CommonResult<PageResult<CustomerFollowupBackVO>> getDataSpaceFollowupPage(@Valid CustomerFollowupQueryVO query, PageVO page) {
if (Objects.isNull(query)) {
query = new CustomerFollowupQueryVO();
}
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
if (Objects.isNull(loginUser)){
throw exception(ErrorCodeConstants.USER_NOT_EXISTS);
}
List<RoleRespDTO> roleRespDTOS = roleApi.getRoles(loginUser.getRoleIds());
if (Objects.isNull(roleRespDTOS)){
throw exception(ROLE_NOT_EXISTS);
}
addDataScopeQuery(query, loginUser, roleRespDTOS);
PageResult<CustomerFollowupDO> pageResult = followupService.getFollowupPage(query, page);
return success(CustomerFollowupConvert.INSTANCE.convertPage(pageResult));
}
@GetMapping("/data/space/export-excel")
@ApiOperation("数据权限导出客户跟进 Excel")
@OperateLog(type = EXPORT)
public CommonResult<Boolean> exportDataSpaceFollowupExcel(@Valid CustomerFollowupQueryVO query,
HttpServletResponse response) throws IOException {
if (Objects.isNull(query)) {
query = new CustomerFollowupQueryVO();
}
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
if (Objects.isNull(loginUser)){
throw exception(ErrorCodeConstants.USER_NOT_EXISTS);
}
List<RoleRespDTO> roleRespDTOS = roleApi.getRoles(loginUser.getRoleIds());
if (Objects.isNull(roleRespDTOS)){
throw exception(ROLE_NOT_EXISTS);
}
addDataScopeQuery(query, loginUser, roleRespDTOS);
sendFileMake(query, DownloadTypeEnum.CUSTOMER_FOLLOWUP_EXPORT, "跟进纪录导出Excel");
return success(true);
}
@GetMapping("/export-excel")
@ApiOperation("导出客户跟进 Excel")
// @PreAuthorize("@ss.hasPermission('customer:followup:export')")
......@@ -140,4 +195,44 @@ public class CustomerFollowupController {
}
private static void addDataScopeQuery(CustomerFollowupQueryVO query, LoginUser loginUser, List<RoleRespDTO> roleRespDTOS) {
List<Long> deptIdList = new ArrayList<>();
boolean isAll = Boolean.FALSE;
for (RoleRespDTO roleRespDTO : roleRespDTOS) {
DataScopeEnum dataScopeEnum = DataScopeEnum.valueOf(roleRespDTO.getDataScope());
switch (dataScopeEnum){
case ALL:
// 全部数据权限,不限制
isAll = Boolean.TRUE;
break;
case DEPT_CUSTOM:
// 指定部门数据权限
if (CollectionUtil.isNotEmpty(roleRespDTO.getDataScopeDeptIds())) {
deptIdList.addAll(roleRespDTO.getDataScopeDeptIds());
}
break;
case DEPT_ONLY:
// 部门数据权限
if (Objects.nonNull(loginUser.getDeptId())) {
deptIdList.add(loginUser.getDeptId());
}
break;
case DEPT_AND_CHILD:
// 部门及以下数据权限
deptIdList.add(loginUser.getDeptId());
break;
}
}
if (!isAll){
// 非全部数据权限时查询限制条件
if (CollectionUtil.isEmpty(deptIdList) || deptIdList.size() == 0){
// 没有部门限制条件时,只查询当前用户自己的
query.setFollowUserId(loginUser.getId());
}else {
// 查询限定部门的数据
query.setDeptIdList(deptIdList);
}
}
}
}
......@@ -56,7 +56,6 @@
<if test="params.destWarehouseId != null and params.destWarehouseId != 0">
and ewl.dest_warehouse_id = #{params.destWarehouseId}
</if>
<!--目的地-->
<if test="params.destCityIds != null and params.destCityIds.size()>0 ">
and ew_dest.`shi` in
......
......@@ -217,15 +217,17 @@ public class WarehouseController {
channelInfoEvent.setChannelId(requestVO.getChannelId());
applicationContext.publishEvent(channelInfoEvent);
if (Objects.nonNull(channelInfoEvent.getCountryId()) && channelInfoEvent.getCountryId() > 0L){
if (Objects.nonNull(requestVO.getDestCountryIds()) && requestVO.getDestCountryIds().size() > 0 ) {
List<Long> destCountryIds = requestVO.getDestCountryIds();
for(Long countryid:destCountryIds) {
if(!Objects.equals(countryid,channelInfoEvent.getCountryId())) {
if (Objects.nonNull(requestVO.getDestCountryId()) && requestVO.getDestCountryId() > 0L && !Objects.equals(requestVO.getDestCountryId(),channelInfoEvent.getCountryId())) {
return error(400,"目的国与渠道不匹配");
}else {
if (Objects.nonNull(requestVO.getDestCountryIds()) && requestVO.getDestCountryIds().size() > 0) {
List<Long> destCountryIds = requestVO.getDestCountryIds();
if (!destCountryIds.contains(channelInfoEvent.getCountryId())) {
return error(400, "目的国与渠道不匹配");
}
}
}
//requestVO.setDestCountryId(channelInfoEvent.getCountryId());
requestVO.setDestCountryId(channelInfoEvent.getCountryId());
}
}
List<WarehouseLineDO> list = warehouseService.openedRouterList(requestVO);
......
......@@ -3087,7 +3087,7 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
"<script>",
"select cc.userId from ecw_order_consignee nee ",
"LEFT JOIN ecw_customer_contacts cc on cc.id = nee.customer_contacts_id",
"where nee.order_id = #{orderId}",
"where nee.deleted = 0 and cc.deleted = 0 and nee.order_id = #{orderId}",
"</script>"
})
Long getOrderConsigneeMemberInfo(@Param("orderId") Long orderId);
......
......@@ -2041,7 +2041,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
// TODO 非控货订单是否必须有收货人
if (vo.getIsCargoControl() && vo.getHasConsignee() != hasConsignee) {
ApplyInfoVO infoVO = new ApplyInfoVO();
infoVO.setName("控货订单发货人控货无收货人");
infoVO.setName("控货订单是否有无收货人");
infoVO.setOrgValue(vo.getHasConsignee() ? "有" : "无");
infoVO.setNewValue(hasConsignee ? "有" : "无");
vo.setHasConsignee(hasConsignee);
......@@ -2059,9 +2059,15 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
OrderConsigneeBackVO orderConsigneeBackVO = vo.getConsigneeVO();
CustomerDO consigneeDO = customerService.getById(updateReqVO.getConsigneeId());
if (Objects.nonNull(consigneeDO)) {
if (Objects.isNull(orderConsigneeBackVO)){
orderConsigneeBackVO = new OrderConsigneeBackVO();
// 会走这里,说明订单从无收货人改为有收货人
orderConsigneeBackVO.setIsCharge(true);
}
orderConsigneeBackVO.setCustomerNumber(consigneeDO.getNumber());
}
if (vo.getIsCargoControl() && hasConsignee) {
// if (vo.getIsCargoControl() && hasConsignee) {
if (hasConsignee) {
if (Objects.isNull(consigneeContactsDO)) {
//todo 需要判断手机号唯一性,判断规则:1.区号相同,2.先判断手机号码是否存在,然后再判断:a.如果是0开头,判断是否存在非0开头号码;b.如果非0开头,判断是否存在0开头号码
// consigneeDO = customerService.getById(updateReqVO.getConsignorId());
......@@ -2083,7 +2089,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
}
} else {
// 控货订单发货人设置为控货无收货人,这里需要处理掉订单的收货人信息
if (Objects.nonNull(orderConsigneeBackVO)) {
if (Objects.nonNull(orderConsigneeBackVO) && !hasConsignee) {
ApplyInfoVO infoVO = new ApplyInfoVO();
infoVO.setName("控货订单发货人设置为控货无收货人,清除订单收货人信息/Set the shipper of the controlled goods order to no consignee, and clear the consignee information of the order");
applyInfoList.add(infoVO);
......@@ -2990,11 +2996,13 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
if (updateReqVO.getHarvestMethod() == 2) {
OrderConsigneeBackVO orderConsigneeBackVO = vo.getConsigneeVO();
// 送货地址
if(Objects.nonNull(orderConsigneeBackVO)) {
orderConsigneeBackVO.setCountry(updateReqVO.getCountry());
orderConsigneeBackVO.setProvince(updateReqVO.getProvince());
orderConsigneeBackVO.setCity(updateReqVO.getCity());
orderConsigneeBackVO.setAddress(updateReqVO.getConsigneeAddress());
orderConsigneeBackVO.setHarvestMethod(updateReqVO.getHarvestMethod());
}
vo.setConsigneeVO(orderConsigneeBackVO);
vo.setCountry(updateReqVO.getCountry());
vo.setProvince(updateReqVO.getProvince());
......@@ -3716,7 +3724,8 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
OrderConsigneeDO orderConsigneeDO = orderConsigneeService.getOne(new LambdaQueryWrapper<OrderConsigneeDO>().eq(OrderConsigneeDO::getOrderId, orderDO.getOrderId()).last("limit 1"));
orderBusinessService.costCalculation(String.valueOf(SecurityFrameworkUtils.getLoginUserId()), orderDO, orderConsignorDO.getCustomerId(),
orderConsigneeDO.getCustomerId(), orderConsignorDO.getCustomerContactsId(), orderConsigneeDO.getCustomerContactsId(),
Objects.isNull(orderConsigneeDO) ? 0L : orderConsigneeDO.getCustomerId(), orderConsignorDO.getCustomerContactsId(),
Objects.isNull(orderConsigneeDO) ? 0L : orderConsigneeDO.getCustomerContactsId(),
orderItemDOList, 18);
return orderDO;
}
......@@ -4396,9 +4405,9 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
* @param auditType 审批类型
* @param auditResult 审批结果
*/
private void checkOrderProcessingApprovalType( OrderDO orderDO, Integer auditType, String auditResult) {
private void checkOrderProcessingApprovalType(OrderDO orderDO, Integer auditType, String auditResult) {
// 出货审批更新
if (StringUtils.isNotBlank(orderDO.getContainerNumber())){
if (StringUtils.isNotBlank(orderDO.getContainerNumber())) {
BoxCheckOrderApprovalEvent boxCheckOrderApprovalEvent = new BoxCheckOrderApprovalEvent(orderDO.getOrderId(), orderDO.getContainerNumber(), auditType, auditResult, false);
applicationContext.publishEvent(boxCheckOrderApprovalEvent);
if (boxCheckOrderApprovalEvent.getIsExists()) {
......@@ -4413,8 +4422,8 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
.eq(OrderWarehouseApprovalDO::getStatus, 1)
.orderByDesc(OrderWarehouseApprovalDO::getId)
.last("limit 1"));
if (Objects.nonNull(warehouseApprovalDO)){
switch (warehouseApprovalDO.getType()){
if (Objects.nonNull(warehouseApprovalDO)) {
switch (warehouseApprovalDO.getType()) {
case 1:
// 入仓修改
orderDO.setAuditType(warehouse_update_processing.getType());
......@@ -4438,7 +4447,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
.eq(OrderApprovalDO::getStatus, 1)
.orderByDesc(OrderApprovalDO::getOrderApprovalId)
.last("limit 1"));
if (Objects.nonNull(approvalDO)){
if (Objects.nonNull(approvalDO)) {
OrderApprovalTypeResultEnum resultEnum = OrderApprovalTypeResultEnum.typeAndResultOf(approvalDO.getType(), approvalDO.getStatus());
orderDO.setAuditType(resultEnum.getType());
orderDO.setAuditResult(resultEnum.getDesc());
......@@ -5817,26 +5826,36 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
OrderConsigneeBackVO consigneeVO = orderBackVO.getConsigneeVO();
OrderConsignorDO orderConsignorDO = orderConsignorService.getById(consignorVO.getId());
OrderConsigneeDO orderConsigneeDO = orderConsigneeService.getById(consigneeVO.getId());
OrderConsigneeDO orderConsigneeDO = null;
if (Objects.nonNull(consigneeVO)) {
orderConsigneeService.getById(consigneeVO.getId());
}
//
boolean isConsignorChange = orderConsignorDO != null && !Objects.equals(consignorVO.getCustomerId(), orderConsignorDO.getCustomerId());
boolean isConsigneeChange = orderConsigneeDO != null && !Objects.equals(consigneeVO.getCustomerId(), orderConsigneeDO.getCustomerId());
boolean isConsigneeChange = orderConsigneeDO != null && Objects.nonNull(consigneeVO) && !Objects.equals(consigneeVO.getCustomerId(), orderConsigneeDO.getCustomerId());
// 收发货人信息变更
OrderConsignorDO consignorDO = OrderConsignorConvert.INSTANCE.convert(consignorVO);
orderConsignorService.updateById(consignorDO);
OrderConsigneeDO consigneeDO = OrderConsigneeConvert.INSTANCE.convert(consigneeVO);
OrderConsigneeDO consigneeDO = null;
if (Objects.nonNull(consigneeVO)) {
consigneeDO = OrderConsigneeConvert.INSTANCE.convert(consigneeVO);
}
// 控货订单发货人无收货人属性变动,需要清空订单收货人信息
Boolean isLimitUpdateConsignee = Boolean.FALSE;
if (orderBackVO.getIsChargeNoConsignee()) {
if (Objects.nonNull(consigneeDO)) {
orderConsigneeService.removeById(consigneeDO.getId());
}
} else {
if (Objects.nonNull(consigneeDO)) {
orderConsigneeService.updateById(consigneeDO);
if (orderBackVO.getIsCargoControl()) {
// 控货订单有收货人则限制修改收货人
isLimitUpdateConsignee = Boolean.TRUE;
}
}
}
// 始发地目的地更新
OrderDepartureDO departureDO = OrderDepartureConvert.INSTANCE.convert(orderBackVO.getOrderDepartureVO());
orderDepartureService.updateById(departureDO);
......@@ -6761,6 +6780,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
// newOrder.setDisplayBillLadingPrice(null);
// 状态重置
newOrder.setStatus(DRAFT.getValue());// 默认草稿订单
newOrder.setCargoControlStatus(null);
newOrder.setAbnormalState(null);
newOrder.setInWarehouseState(null);
newOrder.setShipmentState(null);
......
package cn.iocoder.yudao.module.sale.vo.offer;
import cn.iocoder.yudao.module.customer.vo.customerFollowup.CustomerFollowupBackVO;
import cn.iocoder.yudao.module.depository.dto.LogisticsInfoDto;
import cn.iocoder.yudao.module.sale.vo.offer.prod.OfferProdRespVO;
import cn.iocoder.yudao.module.sale.vo.offer.transport.OfferTransportCreateReqVO;
import cn.iocoder.yudao.module.sale.vo.offer.transport.OfferTransportRespVO;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;
......@@ -90,4 +92,8 @@ public class OfferRespVO extends OfferBaseVO {
@ApiModelProperty(value = "业务员名称-客户经理")
private String businessManagerName;
@ApiModelProperty("最新跟进记录信息")
@TableField(exist = false)
private CustomerFollowupBackVO followupBackVO;
}
......@@ -2,8 +2,13 @@ package cn.iocoder.yudao.module.sale.controller.admin.offer;
import cn.hutool.core.collection.CollectionUtil;
import cn.iocoder.yudao.framework.idempotent.core.annotation.Idempotent;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.customer.convert.customerFollowup.CustomerFollowupConvert;
import cn.iocoder.yudao.module.customer.dal.dataobject.customerFollowup.CustomerFollowupDO;
import cn.iocoder.yudao.module.customer.service.customerFollowup.CustomerFollowupService;
import cn.iocoder.yudao.module.customer.vo.customer.vo.CustomerRespVO;
import cn.iocoder.yudao.module.sale.dal.dataobject.offer.OfferDO;
import cn.iocoder.yudao.module.sale.vo.offer.*;
import cn.iocoder.yudao.module.sale.vo.offerApproval.OfferApprovalBackInfoVO;
......@@ -49,7 +54,8 @@ public class OfferController {
private OfferService offerService;
@Resource
private RoleApi roleApi;
@Resource
private CustomerFollowupService customerFollowupService;
@PostMapping("/create")
@ApiOperation("创建报价单管理")
......@@ -179,6 +185,17 @@ public class OfferController {
// @PreAuthorize("@ss.hasPermission('ecw:offer:query')")
public CommonResult<PageResult<OfferRespVO>> getOfferPage(@Valid OfferPageReqVO pageVO) {
PageResult<OfferRespVO> pageResult = offerService.offerPage(pageVO);
if (CollectionUtil.isNotEmpty(pageResult.getList())) {
for (OfferRespVO respVO : pageResult.getList()) {
CustomerFollowupDO customerFollowupDO = customerFollowupService.getOne(new LambdaQueryWrapperX<CustomerFollowupDO>()
.eq(CustomerFollowupDO::getOfferId, respVO.getOfferId())
.orderByDesc(CustomerFollowupDO::getId)
.last("limit 1"));
if (Objects.nonNull(customerFollowupDO)) {
respVO.setFollowupBackVO(CustomerFollowupConvert.INSTANCE.convert(customerFollowupDO));
}
}
}
return success(pageResult);
}
......@@ -200,6 +217,17 @@ public class OfferController {
}
addDataScopeQuery(pageVO, loginUser, roleRespDTOS);
PageResult<OfferRespVO> pageResult = offerService.offerPage(pageVO);
if (CollectionUtil.isNotEmpty(pageResult.getList())) {
for (OfferRespVO respVO : pageResult.getList()) {
CustomerFollowupDO customerFollowupDO = customerFollowupService.getOne(new LambdaQueryWrapperX<CustomerFollowupDO>()
.eq(CustomerFollowupDO::getOfferId, respVO.getOfferId())
.orderByDesc(CustomerFollowupDO::getId)
.last("limit 1"));
if (Objects.nonNull(customerFollowupDO)) {
respVO.setFollowupBackVO(CustomerFollowupConvert.INSTANCE.convert(customerFollowupDO));
}
}
}
return success(pageResult);
}
......@@ -210,6 +238,17 @@ public class OfferController {
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
pageVO.setDeptId(Objects.isNull(loginUser) || Objects.isNull(loginUser.getDeptId()) ? 0L : loginUser.getDeptId());
PageResult<OfferRespVO> pageResult = offerService.offerPage(pageVO);
if (CollectionUtil.isNotEmpty(pageResult.getList())) {
for (OfferRespVO respVO : pageResult.getList()) {
CustomerFollowupDO customerFollowupDO = customerFollowupService.getOne(new LambdaQueryWrapperX<CustomerFollowupDO>()
.eq(CustomerFollowupDO::getOfferId, respVO.getOfferId())
.orderByDesc(CustomerFollowupDO::getId)
.last("limit 1"));
if (Objects.nonNull(customerFollowupDO)) {
respVO.setFollowupBackVO(CustomerFollowupConvert.INSTANCE.convert(customerFollowupDO));
}
}
}
return success(pageResult);
}
......
......@@ -2198,6 +2198,15 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
// 设置报关方式
boxTallyBackVO.setCustomsType(boxPreloadGoodsDO.getCustomsType());
// 设置包装类型
String units = orderGoodsItemList.stream()
.map(boxPreloadGoodsBackVO -> boxPreloadGoodsBackVO.getUnits())
.filter(StringUtils::isNotEmpty)
.flatMap(t -> Arrays.stream(t.split(",")))
.distinct()
.collect(Collectors.joining(","));
boxTallyBackVO.setUnits(units);
// 是否有关联单
boolean hasRelationOrder = orderGoodsItemList.stream().anyMatch(t -> t.getGuanLianOrderCount() > 0);
boxTallyBackVO.setHasRelationOrder(hasRelationOrder);
......@@ -2298,6 +2307,15 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
// 设置报关方式
boxGuanlianOrderBackVO.setCustomsType(boxPreloadGoodsDO.getCustomsType());
// 设置包装类型
String units = orderGoodsItemList.stream()
.map(boxPreloadGoodsBackVO -> boxPreloadGoodsBackVO.getUnits())
.filter(StringUtils::isNotEmpty)
.flatMap(t -> Arrays.stream(t.split(",")))
.distinct()
.collect(Collectors.joining(","));
boxGuanlianOrderBackVO.setUnits(units);
// 是否有关联单
boolean hasRelationOrder = orderGoodsItemList.stream().anyMatch(t -> t.getGuanLianOrderCount() > 0);
boxGuanlianOrderBackVO.setHasRelationOrder(hasRelationOrder);
......
......@@ -61,6 +61,8 @@ public class BoxGuanlianOrderBackVO {
*/
private Integer customsType;
@ApiModelProperty(value = "包装类型(入仓汇总的,逗号分隔)")
private String units;
@ApiModelProperty(value = "混箱状态, 1-混箱")
private Integer mixStatus = 0;
......
......@@ -78,6 +78,9 @@ public class BoxTallyBackVO {
@ApiModelProperty(value = "混箱状态, 1-混箱")
private Integer mixStatus = 0;
@ApiModelProperty(value = "包装类型(入仓汇总的,逗号分隔)")
private String units;
@ApiModelProperty(value = "是否有关联单")
private Boolean hasRelationOrder = false;
......
......@@ -141,11 +141,10 @@ public class MakeBillOfLadingController {
@ApiOperation("检查提单状态是否已制作提单")
@ApiImplicitParam(name = "orderId", value = "该值为orderId", required = true, example = "1024", dataType = "Long")
public CommonResult<Boolean> checkBillOfLadingStatus(@PathVariable Long orderId) {
MakeBillOfLadingDO billOfLadingDO = makeBillOfLadingService.getOne(new LambdaQueryWrapperX<MakeBillOfLadingDO>()
long count = makeBillOfLadingService.count(new LambdaQueryWrapperX<MakeBillOfLadingDO>()
.eq(MakeBillOfLadingDO::getOrderId, orderId)
.orderByDesc(MakeBillOfLadingDO::getId)
.last("limit 1"));
return success(Objects.nonNull(billOfLadingDO) && StringUtils.isNotBlank(billOfLadingDO.getImgUrl()));
.eq(MakeBillOfLadingDO::getStatus, 2));
return success(count > 0);
}
......
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