Commit 24f5fc34 authored by huangcb's avatar huangcb

承运商接口:新增承运商

parent 4c13d8f6
...@@ -106,6 +106,11 @@ ...@@ -106,6 +106,11 @@
<artifactId>druid-spring-boot-starter</artifactId> <artifactId>druid-spring-boot-starter</artifactId>
<version>${alibaba-druid.version}</version> <version>${alibaba-druid.version}</version>
</dependency> </dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>3.3.0</version>
</dependency>
<dependency> <dependency>
<groupId>com.esv.platform</groupId> <groupId>com.esv.platform</groupId>
<artifactId>gateway-common</artifactId> <artifactId>gateway-common</artifactId>
......
...@@ -101,7 +101,6 @@ public class ErrorMessageComponent { ...@@ -101,7 +101,6 @@ public class ErrorMessageComponent {
@Value("${error-message.goodsowner.regularly-route.detail.1001}") @Value("${error-message.goodsowner.regularly-route.detail.1001}")
private String goodsOwnerRegularlyRouteDetail1001; private String goodsOwnerRegularlyRouteDetail1001;
@Value("${error-message.goodsowner.ext.account-address.1001}") @Value("${error-message.goodsowner.ext.account-address.1001}")
private String goodsOwnerExtAccountAddress1001; private String goodsOwnerExtAccountAddress1001;
@Value("${error-message.goodsowner.ext.account-address.1002}") @Value("${error-message.goodsowner.ext.account-address.1002}")
...@@ -109,4 +108,13 @@ public class ErrorMessageComponent { ...@@ -109,4 +108,13 @@ public class ErrorMessageComponent {
@Value("${error-message.goodsowner.ext.account-address.1003}") @Value("${error-message.goodsowner.ext.account-address.1003}")
private String goodsOwnerExtAccountAddress1003; private String goodsOwnerExtAccountAddress1003;
@Value("${error-message.carrier.account.add.1011}")
private String carrierAccountAdd1011;
@Value("${error-message.carrier.account.add.1012}")
private String carrierAccountAdd1012;
@Value("${error-message.carrier.account.add.1013}")
private String carrierAccountAdd1013;
@Value("${error-message.carrier.account.add.1014}")
private String carrierAccountAdd1014;
} }
package com.esv.freight.customer.module.carrier;
/**
* @description:
* @project: freight-customer-service
* @name: com.esv.freight.customer.module.carrier.CarrierConstants
* @author: 黄朝斌
* @email: huangchaobin@esvtek.com
* @createTime: 2020/04/23 16:46
* @version:1.0
*/
public class CarrierConstants {
/**
* 承运商类别:1-企业承运人、2-个体承运人
**/
public static final Integer CARRIER_TYPE_COMPANY = 1;
public static final Integer CARRIER_TYPE_PERSONAL = 2;
/**
* 帐号状态:1-正常、2-停用
**/
public static final String CARRIER_ACCOUNT_STATUS_UNBLOCK = "1";
public static final String CARRIER_ACCOUNT_STATUS_BLOCK = "2";
}
package com.esv.freight.customer.module.carrier.controller;
import com.alibaba.fastjson.JSONObject;
import com.esv.freight.customer.common.exception.EException;
import com.esv.freight.customer.common.response.EResponse;
import com.esv.freight.customer.common.util.ReqUtils;
import com.esv.freight.customer.common.validator.groups.ValidatorInsert;
import com.esv.freight.customer.module.carrier.CarrierConstants;
import com.esv.freight.customer.module.carrier.form.CarrierInfoForm;
import com.esv.freight.customer.module.carrier.service.CarrierAccountService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @description: 承运商帐号Controller
* @project: freight-customer-service
* @name: com.esv.freight.customer.module.carrier.controller.AccountController
* @author: 黄朝斌
* @email: huangchaobin@esvtek.com
* @createTime: 2020/04/23 20:21
* @version:1.0
*/
@Slf4j
@RestController
@RequestMapping("/carrier/account")
@Validated
public class CarrierAccountController {
private CarrierAccountService carrierAccountService;
public CarrierAccountController(CarrierAccountService carrierAccountService) {
this.carrierAccountService = carrierAccountService;
}
@PostMapping("/add")
public EResponse createAccountByManage(@RequestBody @Validated(ValidatorInsert.class) CarrierInfoForm form) throws EException {
/****************************** 参数校验 ******************************/
// 承运商为企业
if (CarrierConstants.CARRIER_TYPE_COMPANY.equals(form.getCarrierType())) {
String[] notBlankParams = new String[] {"uniCreditCode", "carrierFullName", "provinceCode", "cityCode", "districtCode", "detailAddress"
, "legalPerson", "businessLicenseUrl"};
ReqUtils.checkParamsNotBlank(JSONObject.parseObject(form.toString()), notBlankParams);
}
/****************************** 参数校验 ******************************/
Long id = carrierAccountService.insertCarrier(form);
JSONObject data = new JSONObject();
data.put("id", id);
return EResponse.ok(data);
}
}
package com.esv.freight.customer.module.carrier.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.esv.freight.customer.module.carrier.dto.CarrierInfoDto;
import com.esv.freight.customer.module.carrier.entity.CarrierAccountEntity;
import com.esv.freight.customer.module.carrier.form.CarrierQueryForm;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 承运商帐号表
*
* @author 黄朝斌
* @email huangchaobin@esvtek.com
* @date 2020-04-23 16:51:54
*/
@Mapper
public interface CarrierAccountDao extends BaseMapper<CarrierAccountEntity> {
/**
* description 查询帐号列表
* param [queryObj]
* return java.util.List<com.esv.freight.customer.module.carrier.dto.CarrierInfoDto>
* author Administrator
* createTime 2020/04/23 19:36
**/
List<CarrierInfoDto> selectCarrierList(CarrierQueryForm queryObj);
}
package com.esv.freight.customer.module.carrier.dao;
import com.esv.freight.customer.module.carrier.entity.CarrierInfoEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* 承运商信息表
*
* @author 黄朝斌
* @email huangchaobin@esvtek.com
* @date 2020-04-23 16:51:54
*/
@Mapper
public interface CarrierInfoDao extends BaseMapper<CarrierInfoEntity> {
}
package com.esv.freight.customer.module.carrier.dto;
import lombok.Data;
import java.util.Date;
/**
* @description:
* @project: freight-customer-service
* @name: com.esv.freight.customer.module.carrier.dto.CarrierInfoDto
* @author: 黄朝斌
* @email: huangchaobin@esvtek.com
* @createTime: 2020/04/23 19:20
* @version:1.0
*/
@Data
public class CarrierInfoDto {
/**
*
*/
private Long id;
/**
* 登录帐号,承运商联系人电话
*/
private String account;
/**
* 帐号状态:1-正常、2-停用
*/
private String accountStatus;
/**
* 创建者
*/
private String createUser;
/**
* 创建时间
*/
private Date createTime;
/**
* 客户编码
*/
private String carrierNumber;
/**
* 统一社会信用代码
*/
private String uniCreditCode;
/**
* 承运商名称
*/
private String carrierFullName;
/**
* 承运商简称
*/
private String carrierBriefName;
/**
* 承运商类别:1-企业承运人、2-个体承运人
*/
private Integer carrierType;
/**
* 承运商车辆类型(字典表):1-自营车、2-外协车、3-其他
*/
private Integer carrierVehicleType;
/**
* 企业注册地址-省份代码
*/
private String provinceCode;
/**
* 企业注册地址-市代码
*/
private String cityCode;
/**
* 企业注册地址-区县代码
*/
private String districtCode;
/**
* 企业注册地址-详细地址
*/
private String detailAddress;
/**
* 企业法人姓名
*/
private String legalPerson;
/**
* 营业执照URL
*/
private String businessLicenseUrl;
/**
* 道路运输经营许可证号
*/
private String roadLicenseNumber;
/**
* 经营范围
*/
private String businessScope;
/**
* 道路运输经营许可证有效期
*/
private String roadLicenseExpireDate;
/**
* 道路运输经营许可证URL
*/
private String roadLicenseUrl;
/**
* 联系人
*/
private String contactor;
/**
* 电子邮件
*/
private String email;
/**
* 信用评分:1-100
*/
private Integer creditScore;
/**
* 备注
*/
private String remark;
}
package com.esv.freight.customer.module.carrier.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 承运商帐号表
*
* @author 黄朝斌
* @email huangchaobin@esvtek.com
* @date 2020-04-23 16:51:54
*/
@Data
@TableName("carrier_account")
public class CarrierAccountEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId
private Long id;
/**
* 租户ID
*/
@TableField(fill = FieldFill.INSERT)
private Long tenantId;
/**
* 部门ID
*/
@TableField(fill = FieldFill.INSERT)
private Long departmentId;
/**
* 登录帐号,承运商联系人电话
*/
private String account;
/**
* 帐号密码
*/
private String password;
/**
* 密码盐
*/
private String salt;
/**
* 帐号状态:1-正常、2-停用
*/
private String accountStatus;
/**
* 创建者
*/
@TableField(fill = FieldFill.INSERT)
private String createUser;
/**
* 修改者
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private String updateUser;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
private Date createTime;
/**
* 修改时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateTime;
}
package com.esv.freight.customer.module.carrier.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 承运商信息表
*
* @author 黄朝斌
* @email huangchaobin@esvtek.com
* @date 2020-04-23 17:39:25
*/
@Data
@TableName("carrier_info")
public class CarrierInfoEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId
private Long id;
/**
* 租户ID
*/
@TableField(fill = FieldFill.INSERT)
private Long tenantId;
/**
* 部门ID
*/
@TableField(fill = FieldFill.INSERT)
private Long departmentId;
/**
* 承运商帐号ID
*/
private Long accountId;
/**
* 客户编码
*/
private String carrierNumber;
/**
* 统一社会信用代码
*/
private String uniCreditCode;
/**
* 承运商名称
*/
private String carrierFullName;
/**
* 承运商简称
*/
private String carrierBriefName;
/**
* 承运商类别:1-企业承运人、2-个体承运人
*/
private Integer carrierType;
/**
* 承运商车辆类型(字典表):1-自营车、2-外协车、3-其他
*/
private Integer carrierVehicleType;
/**
* 企业注册地址-省份代码
*/
private String provinceCode;
/**
* 企业注册地址-市代码
*/
private String cityCode;
/**
* 企业注册地址-区县代码
*/
private String districtCode;
/**
* 企业注册地址-详细地址
*/
private String detailAddress;
/**
* 企业法人姓名
*/
private String legalPerson;
/**
* 营业执照URL
*/
private String businessLicenseUrl;
/**
* 道路运输经营许可证号
*/
private String roadLicenseNumber;
/**
* 经营范围
*/
private String businessScope;
/**
* 道路运输经营许可证有效期
*/
private String roadLicenseExpireDate;
/**
* 道路运输经营许可证URL
*/
private String roadLicenseUrl;
/**
* 联系人
*/
private String contactor;
/**
* 电子邮件
*/
private String email;
/**
* 信用评分:1-100
*/
private Integer creditScore;
/**
* 上报状态
*/
private Integer reportState;
/**
* 上报时间
*/
private Date reportTime;
/**
* 备注
*/
private String remark;
/**
* 创建者
*/
@TableField(fill = FieldFill.INSERT)
private String createUser;
/**
* 修改者
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private String updateUser;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
private Date createTime;
/**
* 修改时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateTime;
}
package com.esv.freight.customer.module.carrier.form;
import com.esv.freight.customer.common.validator.groups.ValidatorInsert;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
/**
* @description:
* @project: freight-customer-service
* @name: com.esv.freight.customer.module.carrier.form.CarrierInfoForm
* @author: 黄朝斌
* @email: huangchaobin@esvtek.com
* @createTime: 2020/04/23 19:23
* @version:1.0
*/
@Data
public class CarrierInfoForm {
/**
*
*/
private Long id;
/**
* 登录帐号,承运商联系人电话
*/
@Length(min = 11, max = 11, message = "参数account长度不合法", groups = {ValidatorInsert.class})
@NotBlank(message = "参数account不能为空", groups = {ValidatorInsert.class})
private String account;
/**
* 帐号密码
*/
@Length(min = 32, max = 32, message = "参数password长度不合法", groups = {ValidatorInsert.class})
@NotBlank(message = "参数password不能为空", groups = {ValidatorInsert.class})
private String password;
/**
* 统一社会信用代码
*/
@Length(max = 32, message = "参数uniCreditCode长度不合法", groups = {ValidatorInsert.class})
private String uniCreditCode;
/**
* 承运商名称
*/
@Length(max = 50, message = "参数carrierFullName长度不合法", groups = {ValidatorInsert.class})
private String carrierFullName;
/**
* 承运商简称
*/
@Length(max = 50, message = "参数carrierBriefName长度不合法", groups = {ValidatorInsert.class})
private String carrierBriefName;
/**
* 承运商类别:1-企业承运人、2-个体承运人
*/
@Range(min = 1, max = 2, message = "参数carrierType不合法")
@NotNull(message = "参数carrierType不能为空", groups = {ValidatorInsert.class})
private Integer carrierType;
/**
* 承运商车辆类型(字典表):1-自营车、2-外协车、3-其他
*/
@Range(min = 1, max = 3, message = "参数carrierVehicleType不合法")
@NotNull(message = "参数carrierVehicleType不能为空", groups = {ValidatorInsert.class})
private Integer carrierVehicleType;
/**
* 企业注册地址-省份代码
*/
@Length(min = 6, max = 6, message = "参数provinceCode长度不合法", groups = {ValidatorInsert.class})
private String provinceCode;
/**
* 企业注册地址-市代码
*/
@Length(min = 6, max = 6, message = "参数cityCode长度不合法", groups = {ValidatorInsert.class})
private String cityCode;
/**
* 企业注册地址-区县代码
*/
@Length(min = 6, max = 6, message = "参数districtCode长度不合法", groups = {ValidatorInsert.class})
private String districtCode;
/**
* 企业注册地址-详细地址
*/
@Length(max = 100, message = "参数detailAddress长度不合法", groups = {ValidatorInsert.class})
private String detailAddress;
/**
* 企业法人姓名
*/
@Length(max = 20, message = "参数legalPerson长度不合法", groups = {ValidatorInsert.class})
private String legalPerson;
/**
* 营业执照URL
*/
@Length(max = 200, message = "参数businessLicenseUrl长度不合法", groups = {ValidatorInsert.class})
private String businessLicenseUrl;
/**
* 道路运输经营许可证号
*/
@Length(max = 20, message = "参数roadLicenseNumber长度不合法", groups = {ValidatorInsert.class})
@NotBlank(message = "参数roadLicenseNumber不能为空", groups = {ValidatorInsert.class})
private String roadLicenseNumber;
/**
* 经营范围
*/
@Length(max = 200, message = "参数businessScope长度不合法", groups = {ValidatorInsert.class})
private String businessScope;
/**
* 道路运输经营许可证有效期
*/
@Length(max = 20, message = "参数roadLicenseExpireDate长度不合法", groups = {ValidatorInsert.class})
private String roadLicenseExpireDate;
/**
* 道路运输经营许可证URL
*/
@Length(max = 200, message = "参数roadLicenseUrl长度不合法", groups = {ValidatorInsert.class})
@NotBlank(message = "参数roadLicenseUrl不能为空", groups = {ValidatorInsert.class})
private String roadLicenseUrl;
/**
* 联系人
*/
@Length(max = 20, message = "参数contactor长度不合法", groups = {ValidatorInsert.class})
@NotBlank(message = "参数contactor不能为空", groups = {ValidatorInsert.class})
private String contactor;
/**
* 电子邮件
*/
@Length(max = 50, message = "参数email长度不合法", groups = {ValidatorInsert.class})
private String email;
/**
* 信用评分:1-100
*/
@Range(min = 1, max = 100, message = "参数creditScore不合法")
private Integer creditScore;
/**
* 备注
*/
@Length(max = 100, message = "参数remark长度不合法", groups = {ValidatorInsert.class})
private String remark;
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
}
}
package com.esv.freight.customer.module.carrier.form;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* @description:
* @project: freight-customer-service
* @name: com.esv.freight.customer.module.carrier.form.CarrierQueryForm
* @author: 黄朝斌
* @email: huangchaobin@esvtek.com
* @createTime: 2020/04/23 19:23
* @version:1.0
*/
@Data
public class CarrierQueryForm {
/**
*
*/
private Long id;
/**
* 登录帐号,承运商联系人电话
*/
private String account;
/**
* 帐号状态:1-正常、2-停用
*/
private String accountStatus;
/**
* 客户编码
*/
private String carrierNumber;
/**
* 统一社会信用代码
*/
private String uniCreditCode;
/**
* 道路运输经营许可证号
*/
private String roadLicenseNumber;
/**
* 承运商全称
*/
private String carrierFullName;
/**
* 承运商名称
*/
private String carrierName;
/**
* 承运商类别:1-企业承运人、2-个体承运人
*/
private Integer carrierType;
/**
* 承运商车辆类型(字典表):1-自营车、2-外协车、3-其他
*/
private Integer carrierVehicleType;
/**
* 联系人
*/
private String contactor;
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
}
}
package com.esv.freight.customer.module.carrier.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.esv.freight.customer.module.carrier.entity.CarrierAccountEntity;
import com.esv.freight.customer.module.carrier.form.CarrierInfoForm;
import com.esv.freight.customer.module.carrier.form.CarrierQueryForm;
/**
* 承运商帐号表
*
* @author 黄朝斌
* @email huangchaobin@esvtek.com
* @date 2020-04-23 16:51:54
*/
public interface CarrierAccountService extends IService<CarrierAccountEntity> {
/**
* description 判断帐号是否存在
* param [form]
* return boolean
* author Administrator
* createTime 2020/04/23 19:38
**/
boolean isAccountExit(CarrierQueryForm form);
/**
* description 新增承运商
* param [form]
* return java.lang.Long
* author Administrator
* createTime 2020/04/23 20:02
**/
Long insertCarrier(CarrierInfoForm form);
}
package com.esv.freight.customer.module.carrier.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.esv.freight.customer.module.carrier.entity.CarrierInfoEntity;
/**
* 承运商信息表
*
* @author 黄朝斌
* @email huangchaobin@esvtek.com
* @date 2020-04-23 16:51:54
*/
public interface CarrierInfoService extends IService<CarrierInfoEntity> {
}
package com.esv.freight.customer.module.carrier.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.esv.freight.customer.common.component.ErrorMessageComponent;
import com.esv.freight.customer.common.component.PasswordComponent;
import com.esv.freight.customer.common.exception.EException;
import com.esv.freight.customer.common.util.FeignUtils;
import com.esv.freight.customer.feign.FeignBaseService;
import com.esv.freight.customer.module.carrier.CarrierConstants;
import com.esv.freight.customer.module.carrier.dao.CarrierAccountDao;
import com.esv.freight.customer.module.carrier.dto.CarrierInfoDto;
import com.esv.freight.customer.module.carrier.entity.CarrierAccountEntity;
import com.esv.freight.customer.module.carrier.entity.CarrierInfoEntity;
import com.esv.freight.customer.module.carrier.form.CarrierInfoForm;
import com.esv.freight.customer.module.carrier.form.CarrierQueryForm;
import com.esv.freight.customer.module.carrier.service.CarrierAccountService;
import com.esv.freight.customer.module.carrier.service.CarrierInfoService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service("carrierAccountService")
public class CarrierAccountServiceImpl extends ServiceImpl<CarrierAccountDao, CarrierAccountEntity> implements CarrierAccountService {
private FeignBaseService feignBaseService;
private ErrorMessageComponent errorMessageComponent;
private PasswordComponent passwordComponent;
private CarrierInfoService carrierInfoService;
@Autowired
public CarrierAccountServiceImpl(FeignBaseService feignBaseService, ErrorMessageComponent errorMessageComponent,
PasswordComponent passwordComponent, CarrierInfoService carrierInfoService) {
this.feignBaseService = feignBaseService;
this.errorMessageComponent = errorMessageComponent;
this.passwordComponent = passwordComponent;
this.carrierInfoService = carrierInfoService;
}
@Override
public boolean isAccountExit(CarrierQueryForm form) {
List<CarrierInfoDto> dtoList = this.baseMapper.selectCarrierList(form);
if (null == dtoList || 0 == dtoList.size()) {
return false;
} else {
return true;
}
}
@Override
public Long insertCarrier(CarrierInfoForm form) {
// 1:校验
// 1.1:校验帐号是否已存在
CarrierQueryForm carrierQueryForm = new CarrierQueryForm();
carrierQueryForm.setAccount(form.getAccount());
if (this.isAccountExit(carrierQueryForm)) {
throw new EException(1011, errorMessageComponent.getCarrierAccountAdd1011());
}
// 1.2:校验道路运输经营许可证号是否已存在
carrierQueryForm = new CarrierQueryForm();
carrierQueryForm.setRoadLicenseNumber(form.getRoadLicenseNumber());
if (this.isAccountExit(carrierQueryForm)) {
throw new EException(1012, errorMessageComponent.getCarrierAccountAdd1012());
}
// 承运商为企业
if (CarrierConstants.CARRIER_TYPE_COMPANY.equals(form.getCarrierType())) {
// 1.3:校验统一社会信用代码是否已存在
carrierQueryForm = new CarrierQueryForm();
carrierQueryForm.setUniCreditCode(form.getUniCreditCode());
if (this.isAccountExit(carrierQueryForm)) {
throw new EException(1013, errorMessageComponent.getCarrierAccountAdd1013());
}
// 1.4:校验名称是否已存在
carrierQueryForm = new CarrierQueryForm();
carrierQueryForm.setCarrierFullName(form.getCarrierFullName());
if (this.isAccountExit(carrierQueryForm)) {
throw new EException(1014, errorMessageComponent.getCarrierAccountAdd1014());
}
}
// 2:获取客户编码
JSONObject batchIdReqJson = new JSONObject();
batchIdReqJson.put("prefix", "CYS");
batchIdReqJson.put("formatter", "yyyyMMdd");
batchIdReqJson.put("length", 15);
JSONObject batchIdResJson;
try {
batchIdResJson = FeignUtils.getFeignResultData(feignBaseService.getBatchId(batchIdReqJson));
} catch (Exception e) {
log.error("调用[基础服务]生成承运商编号失败:" + e.getMessage());
throw new EException("生成承运商编号时发生错误");
}
String carrierNumber = batchIdResJson.getString("batchId");
// 3:新增帐号
CarrierAccountEntity carrierAccountEntity = new CarrierAccountEntity();
carrierAccountEntity.setAccount(form.getAccount());
String salt = passwordComponent.generateAccountPwdSalt();
carrierAccountEntity.setSalt(salt);
carrierAccountEntity.setPassword(passwordComponent.generatePwd4Salt(form.getPassword(), salt));
this.baseMapper.insert(carrierAccountEntity);
Long accountId = carrierAccountEntity.getId();
// 4:新增帐号信息
CarrierInfoEntity carrierInfoEntity = new CarrierInfoEntity();
BeanUtils.copyProperties(form, carrierInfoEntity);
carrierInfoEntity.setAccountId(accountId);
carrierInfoEntity.setCarrierNumber(carrierNumber);
this.carrierInfoService.getBaseMapper().insert(carrierInfoEntity);
return accountId;
}
}
\ No newline at end of file
package com.esv.freight.customer.module.carrier.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.esv.freight.customer.module.carrier.dao.CarrierInfoDao;
import com.esv.freight.customer.module.carrier.entity.CarrierInfoEntity;
import com.esv.freight.customer.module.carrier.service.CarrierInfoService;
import org.springframework.stereotype.Service;
@Service("carrierInfoService")
public class CarrierInfoServiceImpl extends ServiceImpl<CarrierInfoDao, CarrierInfoEntity> implements CarrierInfoService {
}
\ No newline at end of file
...@@ -99,7 +99,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountDao, AccountEntity> i ...@@ -99,7 +99,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountDao, AccountEntity> i
try { try {
batchIdResJson = FeignUtils.getFeignResultData(feignBaseService.getBatchId(batchIdReqJson)); batchIdResJson = FeignUtils.getFeignResultData(feignBaseService.getBatchId(batchIdReqJson));
} catch (Exception e) { } catch (Exception e) {
log.error("调用[基础服务]生成客户编号失败"); log.error("调用[基础服务]生成客户编号失败:" + e.getMessage());
throw new EException("生成客户编号时发生错误"); throw new EException("生成客户编号时发生错误");
} }
String ownerNumber = batchIdResJson.getString("batchId"); String ownerNumber = batchIdResJson.getString("batchId");
......
...@@ -59,8 +59,7 @@ public class DeliveryAddressServiceImpl extends ServiceImpl<DeliveryAddressDao, ...@@ -59,8 +59,7 @@ public class DeliveryAddressServiceImpl extends ServiceImpl<DeliveryAddressDao,
try { try {
batchIdResJson = FeignUtils.getFeignResultData(feignBaseService.getBatchId(batchIdReqJson)); batchIdResJson = FeignUtils.getFeignResultData(feignBaseService.getBatchId(batchIdReqJson));
} catch (Exception e) { } catch (Exception e) {
log.error("调用[基础服务]生成发货地址编号失败"); log.error("调用[基础服务]生成发货地址编号失败:" + e.getMessage());
log.error(e.getMessage(), e);
throw new EException("生成发货地址编号时发生错误"); throw new EException("生成发货地址编号时发生错误");
} }
String addressNumber = batchIdResJson.getString("batchId"); String addressNumber = batchIdResJson.getString("batchId");
......
...@@ -59,8 +59,7 @@ public class ReceiveAddressServiceImpl extends ServiceImpl<ReceiveAddressDao, Re ...@@ -59,8 +59,7 @@ public class ReceiveAddressServiceImpl extends ServiceImpl<ReceiveAddressDao, Re
try { try {
batchIdResJson = FeignUtils.getFeignResultData(feignBaseService.getBatchId(batchIdReqJson)); batchIdResJson = FeignUtils.getFeignResultData(feignBaseService.getBatchId(batchIdReqJson));
} catch (Exception e) { } catch (Exception e) {
log.error("调用[基础服务]生成收货地址编号失败"); log.error("调用[基础服务]生成收货地址编号失败:" + e.getMessage());
log.error(e.getMessage(), e);
throw new EException("生成收货地址编号时发生错误"); throw new EException("生成收货地址编号时发生错误");
} }
String addressNumber = batchIdResJson.getString("batchId"); String addressNumber = batchIdResJson.getString("batchId");
......
...@@ -105,4 +105,11 @@ error-message: ...@@ -105,4 +105,11 @@ error-message:
account-address: account-address:
1001: 无效的货主ID 1001: 无效的货主ID
1002: 无效的发货地址ID 1002: 无效的发货地址ID
1003: 无效的收货地址ID 1003: 无效的收货地址ID
\ No newline at end of file carrier:
account:
add:
1011: 帐号已存在
1012: 道路运输经营许可证号已存在
1013: 统一社会信用代码已存在
1014: 承运商名称已存在
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.esv.freight.customer.module.carrier.dao.CarrierAccountDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.esv.freight.customer.module.carrier.entity.CarrierAccountEntity" id="accountMap">
<result property="id" column="id"/>
<result property="tenantId" column="tenant_id"/>
<result property="departmentId" column="department_id"/>
<result property="account" column="account"/>
<result property="password" column="password"/>
<result property="salt" column="salt"/>
<result property="accountStatus" column="account_status"/>
<result property="createUser" column="create_user"/>
<result property="updateUser" column="update_user"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<!-- 查询帐号列表 -->
<select id="selectCarrierList" parameterType="com.esv.freight.customer.module.carrier.form.CarrierQueryForm"
resultType="com.esv.freight.customer.module.carrier.dto.CarrierInfoDto">
select a.id, a.account, a.account_status, a.create_user, a.create_time,
b.carrier_number, b.uni_credit_code, b.carrier_full_name, b.carrier_brief_name, b.carrier_type, b.carrier_vehicle_type,
b.province_code, b.city_code, b.district_code, b.detail_address, b.legal_person, b.business_license_url, b.road_license_number,
b.business_scope, b.road_license_expire_date, b.road_license_url, b.contactor, b.email, b.credit_score, b.remark
from carrier_account a, carrier_info b
where a.id = b.account_id
<if test="id != null">
<![CDATA[ a.id <> #{id} ]]>
</if>
<if test="account != null">
and a.account like CONCAT('%', #{account}, '%')
</if>
<if test="accountStatus != null">
and a.account_status = #{accountStatus}
</if>
<if test="carrierNumber != null">
and b.carrier_number like CONCAT('%', #{carrierNumber}, '%')
</if>
<if test="uniCreditCode != null">
and b.uni_credit_code like CONCAT('%', #{uniCreditCode}, '%')
</if>
<if test="carrierFullName != null">
and b.carrier_full_name = #{carrierFullName}
</if>
<if test="roadLicenseNumber != null">
and b.road_license_number = #{roadLicenseNumber}
</if>
<if test="carrierName != null">
and (b.carrier_full_name like CONCAT('%', #{carrierName}, '%')
or b.carrier_brief_name like CONCAT('%', #{carrierName}, '%')
or b.contactor like CONCAT('%', #{carrierName}, '%'))
</if>
ORDER BY a.update_time DESC, a.account ASC
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.esv.freight.customer.module.carrier.dao.CarrierInfoDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.esv.freight.customer.module.carrier.entity.CarrierInfoEntity" id="infoMap">
<result property="id" column="id"/>
<result property="tenantId" column="tenant_id"/>
<result property="departmentId" column="department_id"/>
<result property="accountId" column="account_id"/>
<result property="carrierNumber" column="carrier_number"/>
<result property="uniCreditCode" column="uni_credit_code"/>
<result property="carrierFullName" column="carrier_full_name"/>
<result property="carrierBriefName" column="carrier_brief_name"/>
<result property="carrierType" column="carrier_type"/>
<result property="carrierVehicleType" column="carrier_vehicle_type"/>
<result property="provinceCode" column="province_code"/>
<result property="cityCode" column="city_code"/>
<result property="districtCode" column="district_code"/>
<result property="detailAddress" column="detail_address"/>
<result property="legalPerson" column="legal_person"/>
<result property="businessLicenseUrl" column="business_license_url"/>
<result property="roadLicenseNumber" column="road_license_number"/>
<result property="businessScope" column="business_scope"/>
<result property="roadLicenseExpireDate" column="road_license_expire_date"/>
<result property="roadLicenseUrl" column="road_license_url"/>
<result property="contactor" column="contactor"/>
<result property="email" column="email"/>
<result property="creditScore" column="credit_score"/>
<result property="reportState" column="report_state"/>
<result property="reportTime" column="report_time"/>
<result property="remark" column="remark"/>
<result property="createUser" column="create_user"/>
<result property="updateUser" column="update_user"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
</resultMap>
</mapper>
\ No newline at end of file
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