Commit d8c15dc3 authored by yanghao's avatar yanghao

Merge branch 'release-fix' into release

parents ffa5db4d 0121e121
......@@ -12,3 +12,13 @@ INSERT INTO `system_dict_data` (`sort`, `value`, `label`, `label_en`, `dict_type
VALUES (26, '26', '编辑跟进纪录', 'Update Customer Followup', 'customer_operate_type', 0, 'default', '', NULL, '1', now(), '115', now(), b'0');
INSERT INTO `system_dict_data` (`sort`, `value`, `label`, `label_en`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES (27, '27', '提交跟进纪录', 'Commit Customer Followup', 'customer_operate_type', 0, 'default', '', NULL, '1', now(), '115', now(), b'0');
INSERT INTO `system_dict_data` (`sort`, `value`, `label`, `label_en`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES (28, '28', '设置是否显示提单价格', 'Set Customer Is Show Tidan Price', 'customer_operate_type', 0, 'default', '', NULL, '1', now(), '115', now(), b'0');
INSERT INTO `system_dict_data` (`sort`, `value`, `label`, `label_en`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES (29, '29', '设置到仓确认', 'Set Customer Arrival Confirm', 'customer_operate_type', 0, 'default', '', NULL, '1', now(), '115', now(), b'0');
INSERT INTO `system_dict_data` (`sort`, `value`, `label`, `label_en`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES (30, '30', '设置重货标准', 'Set Customer Wight Unit', 'customer_operate_type', 0, 'default', '', NULL, '1', now(), '115', now(), b'0');
INSERT INTO `system_dict_data` (`sort`, `value`, `label`, `label_en`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES (31, '31', '设置泡货标准', 'Set Customer Light Unit', 'customer_operate_type', 0, 'default', '', NULL, '1', now(), '115', now(), b'0');
......@@ -421,6 +421,11 @@ public interface CustomerService extends IService<CustomerDO> {
void changeCustomerDefaultPay(CustomerChangeDefaultPayReqVO customerChangeDefaultPayReqVO);
void changeCustomerDefaultBilling(CustomerChangeDefaultBillingReqVO customerChangeDefaultBillingReqVO);
void changeCustomerIsShowTidanPrice(CustomerChangeIsShowTidanPriceReqVO customerChangeIsShowTidanPriceReqVO);
void changeCustomerArrivalConfirm(CustomerChangeArrivalConfirmReqVO customerChangeArrivalConfirmReqVO);
void changeCustomerWeightUnit(CustomerChangeWeightUnitReqVO customerChangeWeightUnitReqVO);
void changeCustomerLightUnit(CustomerChangeLightUnitReqVO customerChangeLightUnitReqVO);
/**
* @param areaCode 区号 eg: 86
* @param phone 电话 eg: 13233334444
......
......@@ -712,42 +712,7 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper,
//客户线路处理
List<CustomerLineUpdateReqVO> customerLines = updateReqVO.getCustomerLines();
if (!CollectionUtils.isEmpty(customerLines)) {
//设置客户id
customerLines.stream().forEach(customerLineUpdateReqVO -> customerLineUpdateReqVO.setCustomerId(customerId));
List<CustomerLineDO> customerLinesOld = customerLineMapper.selectList(CustomerLineDO::getCustomerId, customerId);
if (!CollectionUtils.isEmpty(customerLinesOld)) {
//old line id
List<Long> idsOld = customerLinesOld.stream().map(CustomerLineDO::getId).collect(Collectors.toList());
//update line
List<CustomerLineDO> updateList = customerLines.stream().filter(t -> idsOld.contains(t.getId())).map(customerLinesUpdateReqVO ->
CustomerLineConvert.INSTANCE.convert(customerLinesUpdateReqVO)).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(updateList)) {
customerLineMapper.updateBatch(updateList);
}
//delete line
List<Long> deleteIds = idsOld.stream().filter(old -> customerLines.stream().noneMatch(u -> old.equals(u.getId()))).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(deleteIds)) {
customerLineMapper.deleteBatchIds(deleteIds);
}
}
//add line
List<CustomerLineDO> createDoList = customerLines.stream().filter(t -> t.getId() == null)
.map(customerLinesUpdateReqVO -> {
CustomerLineDO convert = CustomerLineConvert.INSTANCE.convert(customerLinesUpdateReqVO);
return convert;
}).collect(Collectors.toList());
customerLineMapper.insertBatch(createDoList);
} else {
//删除所有指定路线
customerLineMapper.delete(new LambdaQueryWrapperX<CustomerLineDO>().eq(CustomerLineDO::getCustomerId, customerId));
}
updateCustomerLine(customerId, customerLines);
//客户银行账户处理
......@@ -796,6 +761,45 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper,
customerOperateLogService.createOperateLog(customerOperateLogCreateReqVO);
}
private void updateCustomerLine(Long customerId, List<CustomerLineUpdateReqVO> customerLines) {
if (!CollectionUtils.isEmpty(customerLines)) {
//设置客户id
customerLines.stream().forEach(customerLineUpdateReqVO -> customerLineUpdateReqVO.setCustomerId(customerId));
List<CustomerLineDO> customerLinesOld = customerLineMapper.selectList(CustomerLineDO::getCustomerId, customerId);
if (!CollectionUtils.isEmpty(customerLinesOld)) {
//old line id
List<Long> idsOld = customerLinesOld.stream().map(CustomerLineDO::getId).collect(Collectors.toList());
//update line
List<CustomerLineDO> updateList = customerLines.stream().filter(t -> idsOld.contains(t.getId())).map(customerLinesUpdateReqVO ->
CustomerLineConvert.INSTANCE.convert(customerLinesUpdateReqVO)).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(updateList)) {
customerLineMapper.updateBatch(updateList);
}
//delete line
List<Long> deleteIds = idsOld.stream().filter(old -> customerLines.stream().noneMatch(u -> old.equals(u.getId()))).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(deleteIds)) {
customerLineMapper.deleteBatchIds(deleteIds);
}
}
//add line
List<CustomerLineDO> createDoList = customerLines.stream().filter(t -> t.getId() == null)
.map(customerLinesUpdateReqVO -> {
CustomerLineDO convert = CustomerLineConvert.INSTANCE.convert(customerLinesUpdateReqVO);
return convert;
}).collect(Collectors.toList());
customerLineMapper.insertBatch(createDoList);
} else {
//删除所有指定路线
customerLineMapper.delete(new LambdaQueryWrapperX<CustomerLineDO>().eq(CustomerLineDO::getCustomerId, customerId));
}
}
private void compareCustomer(CustomerDO customerOld, CustomerDO customerNew, List<ApplyInfoVO> applyInfoList) {
if (customerOld == null || customerNew == null) {
......@@ -3571,6 +3575,131 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper,
}
}
@Override
public void changeCustomerIsShowTidanPrice(CustomerChangeIsShowTidanPriceReqVO customerChangeIsShowTidanPriceReqVO) {
List<CustomerDO> customerDOList = customerMapper.selectBatchIds(customerChangeIsShowTidanPriceReqVO.getCustomerIdList());
if (CollectionUtil.isNotEmpty(customerDOList)) {
Boolean isShowTidanPrice = customerChangeIsShowTidanPriceReqVO.getIsShowTidanPrice();
customerDOList.stream()
.filter(t -> t.getIsShowTidanPrice() == null || !t.getIsShowTidanPrice().equals(isShowTidanPrice))
.forEach(customerDO -> {
customerDO.setIsShowTidanPrice(isShowTidanPrice);
customerMapper.updateById(customerDO);
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
CustomerOperateLogCreateReqVO customerOperateLogCreateReqVO = new CustomerOperateLogCreateReqVO()
.setOperator(loginUser == null ? null : loginUser.getId())
.setOperatorName(loginUser == null ? null : loginUser.getNickname())
.setCustomerId(customerDO.getId())
.setNumber(customerDO.getNumber())
.setName(customerDO.getName())
.setOperateType(CustomerOperateTypeEnum.CHANGE_IS_SHOW_TIDAN_PRICE.getValue())
.setRemark("设置是否显示提单价格为:" + (isShowTidanPrice ? "【是】" : "【否】"));
customerOperateLogService.createOperateLog(customerOperateLogCreateReqVO);
});
}
}
@Override
public void changeCustomerArrivalConfirm(CustomerChangeArrivalConfirmReqVO customerChangeArrivalConfirmReqVO) {
List<CustomerDO> customerDOList = customerMapper.selectBatchIds(customerChangeArrivalConfirmReqVO.getCustomerIdList());
if (CollectionUtil.isNotEmpty(customerDOList)) {
Integer arrivalConfirm = customerChangeArrivalConfirmReqVO.getArrivalConfirm();
customerDOList.stream()
.filter(t -> t.getArrivalConfirm() == null || !t.getArrivalConfirm().equals(arrivalConfirm))
.forEach(customerDO -> {
customerDO.setArrivalConfirm(arrivalConfirm);
customerMapper.updateById(customerDO);
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
CustomerOperateLogCreateReqVO customerOperateLogCreateReqVO = new CustomerOperateLogCreateReqVO()
.setOperator(loginUser == null ? null : loginUser.getId())
.setOperatorName(loginUser == null ? null : loginUser.getNickname())
.setCustomerId(customerDO.getId())
.setNumber(customerDO.getNumber())
.setName(customerDO.getName())
.setOperateType(CustomerOperateTypeEnum.CHANGE_ARRIVAL_CONFIRM.getValue())
.setRemark("设置到仓确认为:" + (arrivalConfirm == 1 ? "【是】" : "【否】"));
customerOperateLogService.createOperateLog(customerOperateLogCreateReqVO);
});
}
}
@Override
public void changeCustomerWeightUnit(CustomerChangeWeightUnitReqVO customerChangeWeightUnitReqVO) {
List<CustomerDO> customerDOList = customerMapper.selectBatchIds(customerChangeWeightUnitReqVO.getCustomerIdList());
if (CollectionUtil.isNotEmpty(customerDOList)) {
BigDecimal weightUnit = customerChangeWeightUnitReqVO.getWeightUnit();
customerDOList.stream()
.forEach(customerDO -> {
//若为空
if (weightUnit == null) {
customerMapper.updateWeightUnitToNull(customerDO.getId());
// 更新线路
this.updateCustomerLine(customerDO.getId(), null);
} else {
customerDO.setWeightUnit(weightUnit);
customerMapper.updateById(customerDO);
// 更新线路
this.updateCustomerLine(customerDO.getId(), customerChangeWeightUnitReqVO.getCustomerLines());
}
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
CustomerOperateLogCreateReqVO customerOperateLogCreateReqVO = new CustomerOperateLogCreateReqVO()
.setOperator(loginUser == null ? null : loginUser.getId())
.setOperatorName(loginUser == null ? null : loginUser.getNickname())
.setCustomerId(customerDO.getId())
.setNumber(customerDO.getNumber())
.setName(customerDO.getName())
.setOperateType(CustomerOperateTypeEnum.CHANGE_WEIGHT_UNIT.getValue())
.setRemark("设置重货标准:" + weightUnit == null ? "0" : weightUnit.toString());
customerOperateLogService.createOperateLog(customerOperateLogCreateReqVO);
});
}
}
@Override
public void changeCustomerLightUnit(CustomerChangeLightUnitReqVO customerChangeLightUnitReqVO) {
List<CustomerDO> customerDOList = customerMapper.selectBatchIds(customerChangeLightUnitReqVO.getCustomerIdList());
if (CollectionUtil.isNotEmpty(customerDOList)) {
BigDecimal lightUnit = customerChangeLightUnitReqVO.getLightUnit();
customerDOList.stream()
.forEach(customerDO -> {
if (lightUnit == null) {
customerMapper.updateLightUnitToNull(customerDO.getId());
this.updateCustomerLine(customerDO.getId(), null);
} else {
customerDO.setLightUnit(lightUnit);
customerMapper.updateById(customerDO);
// 更新线路
this.updateCustomerLine(customerDO.getId(), customerChangeLightUnitReqVO.getCustomerLines());
}
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
CustomerOperateLogCreateReqVO customerOperateLogCreateReqVO = new CustomerOperateLogCreateReqVO()
.setOperator(loginUser == null ? null : loginUser.getId())
.setOperatorName(loginUser == null ? null : loginUser.getNickname())
.setCustomerId(customerDO.getId())
.setNumber(customerDO.getNumber())
.setName(customerDO.getName())
.setOperateType(CustomerOperateTypeEnum.CHANGE_LIGHT_UNIT.getValue())
.setRemark("设置泡货标准:" + lightUnit == null ? "0" : lightUnit.toString());
customerOperateLogService.createOperateLog(customerOperateLogCreateReqVO);
});
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void recycleUnConfirmedCustomer(CustomerUnConfirmReqVO customerUnConfirmReqVO) {
......
......@@ -9,7 +9,7 @@ import io.swagger.annotations.*;
@ToString(callSuper = true)
public class CustomerLineUpdateReqVO extends CustomerLineBaseVO {
@ApiModelProperty(value = "自增ID")
@ApiModelProperty(value = "自增ID 有id时需要填,没有时设空")
private Long id;
}
package cn.iocoder.yudao.module.customer.vo.customer.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import javax.validation.constraints.NotEmpty;
import java.util.List;
@ApiModel("管理后台 - 到仓确认切换 Request VO")
@Data
@EqualsAndHashCode
@ToString
public class CustomerChangeArrivalConfirmReqVO {
@ApiModelProperty(value = "客户ID列表", required = true)
@NotEmpty(message = "客户ID列表不能为空")
private List<Long> customerIdList;
/**
* 到仓确认
*/
@ApiModelProperty(value = "到仓确认", required = true)
private Integer arrivalConfirm;
}
package cn.iocoder.yudao.module.customer.vo.customer.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;
@ApiModel("管理后台 - 是否显示提单价格切换 Request VO")
@Data
@EqualsAndHashCode
@ToString
public class CustomerChangeIsShowTidanPriceReqVO {
@ApiModelProperty(value = "客户ID列表", required = true)
@NotEmpty(message = "客户ID列表不能为空")
private List<Long> customerIdList;
/**
* 是否显示提单价格
*/
@ApiModelProperty(value = "是否显示提单价格", required = true)
private Boolean isShowTidanPrice;
}
package cn.iocoder.yudao.module.customer.vo.customer.vo;
import cn.iocoder.yudao.module.customer.vo.customer.line.CustomerLineUpdateReqVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import java.math.BigDecimal;
import java.util.List;
@ApiModel("管理后台 - 泡货标准切换 Request VO")
@Data
@EqualsAndHashCode
@ToString
public class CustomerChangeLightUnitReqVO {
@ApiModelProperty(value = "客户ID列表", required = true)
@NotEmpty(message = "客户ID列表不能为空")
private List<Long> customerIdList;
/**
* 泡货标准(kg)
*/
@ApiModelProperty(value = "泡货标准(kg) 可以为空。当为空时线路会被删除", required = true)
private BigDecimal lightUnit;
/**
* 客户线路集合
*/
@ApiModelProperty(value = "客户线路集合", notes = "参见CustomerLineUpdateReqVO")
@Valid
private List<CustomerLineUpdateReqVO> customerLines;
}
package cn.iocoder.yudao.module.customer.vo.customer.vo;
import cn.iocoder.yudao.module.customer.vo.customer.line.CustomerLineUpdateReqVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import java.math.BigDecimal;
import java.util.List;
@ApiModel("管理后台 - 重货标准切换 Request VO")
@Data
@EqualsAndHashCode
@ToString
public class CustomerChangeWeightUnitReqVO {
@ApiModelProperty(value = "客户ID列表", required = true)
@NotEmpty(message = "客户ID列表不能为空")
private List<Long> customerIdList;
/**
* 重货标准(CBM)
*/
@ApiModelProperty(value = "重货标准 可以为空。 当为空时线路会被删除", required = true)
private BigDecimal weightUnit;
/**
* 客户线路集合
*/
@ApiModelProperty(value = "客户线路集合", notes = "参见CustomerLineUpdateReqVO")
@Valid
private List<CustomerLineUpdateReqVO> customerLines;
}
......@@ -1143,6 +1143,40 @@ public class CustomerController {
return success(true);
}
@PutMapping("/change-customer-is-show-tidan-price")
@ApiOperation("设置客户是否显示提单价格")
@Idempotent(timeout = 5)
public CommonResult<Boolean> changeCustomerIsShowTidanPrice(@Valid @RequestBody CustomerChangeIsShowTidanPriceReqVO customerChangeIsShowTidanPriceReqVO) {
customerService.changeCustomerIsShowTidanPrice(customerChangeIsShowTidanPriceReqVO);
return success(true);
}
@PutMapping("/change-customer-arrival-confirm")
@ApiOperation("设置客户到仓确认")
@Idempotent(timeout = 5)
public CommonResult<Boolean> changeCustomerArrivalConfirm(@Valid @RequestBody CustomerChangeArrivalConfirmReqVO customerChangeArrivalConfirmReqVO) {
customerService.changeCustomerArrivalConfirm(customerChangeArrivalConfirmReqVO);
return success(true);
}
@PutMapping("/change-customer-weight-unit")
@ApiOperation("设置客户重货标准")
@Idempotent(timeout = 5)
public CommonResult<Boolean> changeCustomerWeightUnit(@Valid @RequestBody CustomerChangeWeightUnitReqVO customerChangeWeightUnitReqVO) {
customerService.changeCustomerWeightUnit(customerChangeWeightUnitReqVO);
return success(true);
}
@PutMapping("/change-customer-light-unit")
@ApiOperation("设置客户泡货标准")
@Idempotent(timeout = 5)
public CommonResult<Boolean> changeCustomerLightUnit(@Valid @RequestBody CustomerChangeLightUnitReqVO customerChangeLightUnitReqVO) {
customerService.changeCustomerLightUnit(customerChangeLightUnitReqVO);
return success(true);
}
@PutMapping("/recycle-unconfirmed-customer")
@ApiOperation("回收已分配未接收的客户")
......
......@@ -58,6 +58,13 @@ public enum CustomerOperateTypeEnum {
FOLLOWUP_UPDATE(26, "编辑跟进纪录"),
FOLLOWUP_COMMIT(27, "提交跟进纪录"),
CHANGE_IS_SHOW_TIDAN_PRICE(28, "设置是否显示提单价格"),
CHANGE_ARRIVAL_CONFIRM(29, "设置到仓确认"),
CHANGE_WEIGHT_UNIT(30, "设置重货标准"),
CHANGE_LIGHT_UNIT(31, "设置泡货标准"),
DELETE(100, "删除"),
......
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