Commit 0c80de6a authored by yanghao's avatar yanghao

chore: 更新客户设置接口

parent 66987a51
......@@ -22,6 +22,9 @@ INSERT INTO `system_dict_data` (`sort`, `value`, `label`, `label_en`, `dict_type
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');
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 (32, '32', '设置客户设置', 'Set Customer Setup', 'customer_operate_type', 0, 'default', '', NULL, '1', now(), '115', now(), b'0');
......
......@@ -426,6 +426,8 @@ public interface CustomerService extends IService<CustomerDO> {
void changeCustomerWeightUnit(CustomerChangeWeightUnitReqVO customerChangeWeightUnitReqVO);
void changeCustomerLightUnit(CustomerChangeLightUnitReqVO customerChangeLightUnitReqVO);
void updateCustomerSetup(CustomerSetupUpdateReqVO customerSetupUpdateReqVO);
/**
* @param areaCode 区号 eg: 86
* @param phone 电话 eg: 13233334444
......
......@@ -3700,6 +3700,81 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper,
}
}
@Override
public void updateCustomerSetup(CustomerSetupUpdateReqVO customerSetupUpdateReqVO) {
CustomerDO customerDO = customerMapper.selectById(customerSetupUpdateReqVO.getId());
if (customerDO != null) {
Boolean defaultPay = customerSetupUpdateReqVO.getDefaultPay();
Boolean defaultBilling = customerSetupUpdateReqVO.getDefaultBilling();
Boolean noConsignee = customerSetupUpdateReqVO.getNoConsignee();
Integer arrivalConfirm = customerSetupUpdateReqVO.getArrivalConfirm();
Boolean isShowTidanPrice = customerSetupUpdateReqVO.getIsShowTidanPrice();
BigDecimal lightUnit = customerSetupUpdateReqVO.getLightUnit();
BigDecimal weightUnit = customerSetupUpdateReqVO.getWeightUnit();
if (arrivalConfirm != null) {
customerDO.setArrivalConfirm(arrivalConfirm);
}
if (defaultBilling != null) {
customerDO.setDefaultBilling(defaultBilling);
}
if (noConsignee != null) {
customerDO.setNoConsignee(noConsignee);
}
if (isShowTidanPrice != null) {
customerDO.setIsShowTidanPrice(isShowTidanPrice);
}
if (defaultPay != null) {
customerDO.setDefaultPay(defaultPay);
}
if (lightUnit != null) {
customerDO.setLightUnit(lightUnit);
}
if (weightUnit != null) {
customerDO.setWeightUnit(weightUnit);
}
customerMapper.updateById(customerDO);
if (lightUnit == null) {
customerMapper.updateLightUnitToNull(customerDO.getId());
}
if (lightUnit == null) {
customerMapper.updateLightUnitToNull(customerDO.getId());
}
// 更新线路
this.updateCustomerLine(customerDO.getId(), customerSetupUpdateReqVO.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.CUSTOMER_UPDATE_SETUP.getValue())
.setRemark(String.format("【是否显示提单价格】:%s, 【到仓确认】:%s, 【重货标准】:%s, 【泡货标准】:%s, 【控制无收货人】:%s, 【默认付款】:%s, 【默认开票】:%s",
Boolean.TRUE.equals(isShowTidanPrice) ? "是" : "否",
arrivalConfirm != null && arrivalConfirm == 1 ? "是" : "否",
weightUnit == null ? "空" : weightUnit.toPlainString(),
lightUnit == null ? "空" : lightUnit.toPlainString(),
Boolean.TRUE.equals(noConsignee) ? "是" : "否",
Boolean.TRUE.equals(defaultPay) ? "是" : "否",
Boolean.TRUE.equals(defaultBilling) ? "是" : "否"));
customerOperateLogService.createOperateLog(customerOperateLogCreateReqVO);
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void recycleUnConfirmedCustomer(CustomerUnConfirmReqVO customerUnConfirmReqVO) {
......
package cn.iocoder.yudao.module.customer.vo.customer.vo;
import cn.iocoder.yudao.module.customer.vo.customer.customerContacts.CustomerContactsUpdateReqVO;
import cn.iocoder.yudao.module.customer.vo.customer.line.CustomerLineUpdateReqVO;
import cn.iocoder.yudao.module.customer.vo.customerBank.CustomerBankUpdateReqVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.hibernate.validator.constraints.Length;
import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@ApiModel("管理后台 - 客户设置更新 Request VO")
@Data
@ToString(callSuper = true)
public class CustomerSetupUpdateReqVO {
@ApiModelProperty(value = "客户ID 主键", required = true)
@NotNull(message = "客户ID不能为空")
private Long id;
/**
* 是否显示提单价格
*/
@ApiModelProperty(value = "是否显示提单价格")
private Boolean isShowTidanPrice;
/**
* 到仓确认
*/
@ApiModelProperty(value = "到仓确认")
private Integer arrivalConfirm;
/**
* 默认开票,1-是,0-否
*/
@ApiModelProperty(value = "默认开票,1-是,0-否")
private Boolean defaultBilling;
@ApiModelProperty(value = "是否默认付款")
private Boolean defaultPay;
@ApiModelProperty(value = "是否控货无收货人")
private Boolean noConsignee;
/**
* 重货标准(CBM)
*/
@ApiModelProperty(value = "重货标准")
private BigDecimal weightUnit;
/**
* 泡货标准(kg)
*/
@ApiModelProperty(value = "泡货标准(kg)")
private BigDecimal lightUnit;
/**
* 客户线路集合
*/
@ApiModelProperty(value = "客户线路集合", notes = "参见CustomerLineUpdateReqVO")
@Valid
private List<CustomerLineUpdateReqVO> customerLines;
}
......@@ -40,6 +40,31 @@ 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}
### update
PUT {{baseUrl}}/ecw/customer/update-customer-setup
Authorization: Bearer {{token}}
tenant-id: {{adminTenentId}}
Content-Type: application/json
{
"customerIdList": [51966],
"arrivalConfirm": 1,
"customerLines": [
{
"objectiveIds": "2,4",
"departureId": 1,
"zhongPaoType": 1
}
],
"defaultBilling": true,
"defaultPay": true,
"isShowTidanPrice": true,
"lightUnit": "13"
}
### page
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}}
......
......@@ -245,6 +245,19 @@ public class CustomerController {
}
@PutMapping("/update-customer-setup")
@ApiOperation("更新客户的设置")
@PreAuthorize("@ss.hasAnyPermissions('ecw:customer:update', 'ecw:customer:dep-update', 'ecw:customer:my-update', 'ecw:customer:distribution-update')")
@Idempotent(timeout = 5)
public CommonResult<Boolean> updateCustomerSetup(
@Valid @RequestBody CustomerSetupUpdateReqVO updateReqVO) {
customerService.updateCustomerSetup(updateReqVO);
return success(true);
}
@PutMapping("/update")
@ApiOperation("更新客户")
@PreAuthorize("@ss.hasAnyPermissions('ecw:customer:update', 'ecw:customer:dep-update', 'ecw:customer:my-update', 'ecw:customer:distribution-update')")
......
......@@ -65,6 +65,8 @@ public enum CustomerOperateTypeEnum {
CHANGE_WEIGHT_UNIT(30, "设置重货标准"),
CHANGE_LIGHT_UNIT(31, "设置泡货标准"),
CUSTOMER_UPDATE_SETUP(32, "设置客户设置"),
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