zelong.shao

customer|add运单校验

Showing 15 changed files with 181 additions and 18 deletions
package com.fedex.connect.customer.controller.biz.impl;
import com.fedex.connect.common.dependencies.annotation.OperationMethodLog;
import com.fedex.connect.common.dependencies.date.model.LogShowModel;
import com.fedex.connect.common.dependencies.date.vo.ResponseVo;
import com.fedex.connect.common.dependencies.enums.ResponseCode;
......@@ -30,7 +31,7 @@ public class ConsignmentController extends BaseController implements IConsignmen
@PostMapping("/add")
@ApiOperation("上传运单")
// @OperationMethodLog()
@OperationMethodLog(describe = "con_add_oper")
public ResponseVo addConsignment(@RequestBody AddBo bo){
ResponseVo responseResultVo = consignmentValidate.preCheckAdd(bo);
if (responseResultVo != null){
......
package com.fedex.connect.customer.data.dto;
import com.fedex.connect.common.model.biz.Consignment;
import lombok.Data;
@Data
public class ConsignmentAddDto {
Integer isCreatorFlag;
Consignment consignment;
}
package com.fedex.connect.customer.data.dto;
import lombok.Data;
import java.util.Date;
@Data
public class FindConsignmentsDto {
private String consignmentCode;
private String recipientContactName;
private String recipientCompany;
private String shipperCountry;
private String docNondocFlag;
private String createUserName;
private Date createTime;
private Date commitTime;
private String statusName;
}
package com.fedex.connect.customer.repository.dao;
import com.fedex.connect.common.model.biz.Consignment;
import com.fedex.connect.customer.data.dto.FindConsignmentsDto;
import com.fedex.connect.customer.data.query.ConsignmentQuery;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -10,7 +11,7 @@ import java.util.List;
@Mapper
public interface ConsignmentExtMapper {
List<Consignment> findConsignments(ConsignmentQuery query);
List<FindConsignmentsDto> findConsignments(ConsignmentQuery query);
Long findAllCount(ConsignmentQuery query);
......
......@@ -2,8 +2,38 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.fedex.connect.customer.repository.dao.ConsignmentExtMapper">
<select id="findConsignments" resultType="com.fedex.connect.common.model.biz.Consignment">
SELECT DISTINCT c.*
<sql id="OracleDialectPrefix">
<if test="start != null and start >= 0 and size != null and size >= 0">
select * from ( select row_.*, rownum rownum_ from (
</if>
</sql>
<sql id="OracleDialectSuffix">
<if test="start != null and start >= 0 and size != null and size >= 0">
<![CDATA[ ) row_ ) where rownum_ > #{start} and rownum_ <= #{start} + #{size} ]]>
</if>
</sql>
<sql id="findConsignments_Column">
c.CONSIGNMENT_CODE,
c.RECIPIENT_CONTACT_NAME,
c.RECIPIENT_COMPANY,
c.SHIPPER_COUNTRY,
CASE
WHEN c.DOC_NONDOC_FLAG = 'Y' THEN 'ITEM'
WHEN c.DOC_NONDOC_FLAG = 'N' THEN 'DOC'
ELSE c.DOC_NONDOC_FLAG
END AS DOC_NONDOC_FLAG,
c.CREATE_USER_NAME,
c.CREATE_TIME,
c.COMMIT_TIME,
c.STATUS_NAME
</sql>
<select id="findConsignments" resultType="com.fedex.connect.customer.data.dto.FindConsignmentsDto">
<include refid="OracleDialectPrefix"/>
SELECT DISTINCT
<include refid="findConsignments_Column"/>
FROM T_BIZ_CONSIGNMENT c
LEFT JOIN T_BIZ_USER_CONSIGNMENT_MAPPING m ON c.id = m.consignment_id
WHERE
......@@ -23,6 +53,7 @@
#{item}
</foreach>
</if>
<include refid="OracleDialectSuffix" />
</select>
......
package com.fedex.connect.customer.repository.repo;
import com.fedex.connect.common.model.biz.Consignment;
import com.fedex.connect.customer.data.dto.FindConsignmentsDto;
import com.fedex.connect.customer.data.query.ConsignmentQuery;
import java.util.List;
public interface IConsignmentExtRepository {
List<Consignment> findConsignments(ConsignmentQuery query);
List<FindConsignmentsDto> findConsignments(ConsignmentQuery query);
Long findAllCount(ConsignmentQuery query);
......
package com.fedex.connect.customer.repository.repo.impl;
import com.fedex.connect.common.model.biz.Consignment;
import com.fedex.connect.customer.data.dto.FindConsignmentsDto;
import com.fedex.connect.customer.data.query.ConsignmentQuery;
import com.fedex.connect.customer.repository.base.BaseDao;
import com.fedex.connect.customer.repository.repo.IConsignmentExtRepository;
......@@ -12,7 +13,7 @@ import java.util.List;
public class ConsignmentExtRepositoryImpl extends BaseDao implements IConsignmentExtRepository {
@Override
public List<Consignment> findConsignments(ConsignmentQuery query) {
public List<FindConsignmentsDto> findConsignments(ConsignmentQuery query) {
return consignmentExtMapper.findConsignments(query);
}
......
......@@ -7,6 +7,7 @@ import com.fedex.connect.common.dependencies.util.Utils;
import com.fedex.connect.common.model.biz.Consignment;
import com.fedex.connect.common.model.sys.User;
import com.fedex.connect.customer.data.bo.AddBo;
import com.fedex.connect.customer.data.dto.FindConsignmentsDto;
import com.fedex.connect.customer.data.query.ConsignmentQuery;
import com.fedex.connect.customer.service.base.BaseService;
import com.fedex.connect.customer.service.biz.IConsignmentService;
......@@ -49,7 +50,7 @@ public class ConsignmentServiceImpl extends BaseService implements IConsignmentS
pageResult.setPage(query.getPage());
pageResult.setSize(query.getSize());
if (total != null && total > 0) {
List<Consignment> consignments = consignmentExtRepository.findConsignments(query);
List<FindConsignmentsDto> consignments = consignmentExtRepository.findConsignments(query);
pageResult.setList(consignments);
}
return ResponseVo.succ(pageResult);
......@@ -73,7 +74,10 @@ public class ConsignmentServiceImpl extends BaseService implements IConsignmentS
return responseResultVo;
}
//校验是否是本账号的运单
ResponseVo responseVo = consignmentUtil.consignmentUuidCheck(consignment, user);
if (responseVo != null){
return responseVo;
}
}
//如果不存在直接返回
return ResponseVo.succ(null);
......
package com.fedex.connect.customer.util.service.biz;
import com.fedex.connect.common.dependencies.contants.DigitConstants;
import com.fedex.connect.common.dependencies.date.vo.ResponseVo;
import com.fedex.connect.common.dependencies.enums.ResponseCode;
import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil;
import com.fedex.connect.common.model.biz.Consignment;
import com.fedex.connect.common.model.sys.User;
import com.fedex.connect.customer.data.bo.AddBo;
import com.fedex.connect.customer.data.dto.ConsignmentAddDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* @Author Szl
......@@ -38,7 +42,7 @@ public class ConsignmentUtil {
if (!errList.isEmpty()) {
String enumResCode601 = localeMessageUtil.getMessage("enum_res_code_601");
String errResult = String.join(",", errList) + enumResCode601;
return ResponseVo.fail(ResponseCode.CONSIGNMENT_CREATOR_ERR.getCode(), errResult);
return ResponseVo.fail(ResponseCode.CONSIGNMENT_CREATOR_ERR, errResult);
}
return null;
......@@ -59,4 +63,28 @@ public class ConsignmentUtil {
errList.add(localeMessageUtil.getMessage(messageKey));
}
}
/**
* @Author Szl
* @Description 功能说明 判断是否为该用户的uuid
* @Date 2024/11/6
* @param consignment
* @param user
* @return com.fedex.connect.common.dependencies.date.vo.ResponseVo
*/
public ResponseVo consignmentUuidCheck(Consignment consignment, User user){
ConsignmentAddDto consignmentAddDto = new ConsignmentAddDto();
consignmentAddDto.setIsCreatorFlag(DigitConstants.DIGIT_ONE);
consignmentAddDto.setConsignment(consignment);
if (!Objects.equals(consignment.getUserUuid(), user.getUserUuid())){
consignmentAddDto.setIsCreatorFlag(DigitConstants.DIGIT_TWO);
if (Objects.equals(consignment.getShipperAccount(),user.getAccountNo())){
return ResponseVo.succ(ResponseCode.CONSIGNMENT_CREATOR_SHIPPER_ACCOUNT_SUC.getCode(),ResponseCode.CONSIGNMENT_CREATOR_SHIPPER_ACCOUNT_SUC.getMsg(),consignmentAddDto);
}else {
return ResponseVo.succ(ResponseCode.CONSIGNMENT_CREATOR_SHIPPER_ACCOUNT_DIFF_SUC.getCode(),ResponseCode.CONSIGNMENT_CREATOR_SHIPPER_ACCOUNT_DIFF_SUC.getMsg(),consignmentAddDto);
}
}else {
return ResponseVo.succ(consignmentAddDto);
}
}
}
......
......@@ -3,8 +3,12 @@ conl_cus_declare_count_max=單次最多可查詢1000個運單號碼
enum_res_code_301=登錄身份異常
enum_res_code_305=登錄已過期,請重新登錄
enum_res_code_601 = 不正确,请重新输入
enum_res_code_601=不正确,请重新输入
enum_res_code_602=The waybill you entered is generated by another user, whether continue uploading? Confirm, Cancel. No more prompts in the future for the same situation.
enum_res_code_603=The waybill you entered is generated by another account, whether continue uploading? Confirm, Cancel. No more prompts in the future for the same situation.
con_shipperAccount = 发货人计费账号
con_shipperCountry = 始发国
con_recipientCountry = 目的国
\ No newline at end of file
con_shipperAccount=发货人计费账号
con_shipperCountry=始发国
con_recipientCountry=目的国
con_add_oper=添加运单
\ No newline at end of file
......
......@@ -3,8 +3,12 @@ conl_cus_declare_count_max=單次最多可查詢1000個運單號碼
enum_res_code_301=登錄身份異常
enum_res_code_305=登錄已過期,請重新登錄
enum_res_code_601 = 不正确,请重新输入
enum_res_code_601=不正确,请重新输入
enum_res_code_602=The waybill you entered is generated by another user, whether continue uploading? Confirm, Cancel. No more prompts in the future for the same situation.
enum_res_code_603=The waybill you entered is generated by another account, whether continue uploading? Confirm, Cancel. No more prompts in the future for the same situation.
con_shipperAccount = 发货人计费账号
con_shipperCountry = 始发国
con_recipientCountry = 目的国
\ No newline at end of file
con_shipperAccount=发货人计费账号
con_shipperCountry=始发国
con_recipientCountry=目的国
con_add_oper=添加运单
\ No newline at end of file
......
......@@ -110,4 +110,9 @@ public class CacheSystem implements CommandLineRunner {
List<DictionaryEntries> filter = dictionaryMap.get(DictionaryConstants.COUNTRY).stream().filter(p -> ext1.equals(p.getExt1())).collect(Collectors.toList());
return filter.isEmpty() ? null : filter.get(DigitConstants.DIGIT_ZERO);
}
public DictionaryEntries getDicUserLoginType(String code){
List<DictionaryEntries> filter = dictionaryMap.get(DictionaryConstants.USER_LOGIN_TYPE).stream().filter(p -> code.equals(p.getCode())).collect(Collectors.toList());
return filter.isEmpty() ? null : filter.get(DigitConstants.DIGIT_ZERO);
}
}
\ No newline at end of file
......
......@@ -12,4 +12,6 @@ public interface DictionaryConstants {
String USER_TYPE = "USER_TYPE";
//国家
String COUNTRY = "COUNTRY";
//用户操作类型
String USER_LOGIN_TYPE = "USER_LOGIN_TYPE";
}
......
......@@ -53,7 +53,9 @@ public enum ResponseCode {
REQUEST_OBJECT_NULL(606, "enum_res_code_606"),
REQUEST_PARAM_UNREASONABLE(606, "enum_res_code_607"),
CONSIGNMENT_CREATOR_ERR(601,"enum_res_code_601")
CONSIGNMENT_CREATOR_ERR(601,"enum_res_code_601"),
CONSIGNMENT_CREATOR_SHIPPER_ACCOUNT_SUC(602,"enum_res_code_602"),
CONSIGNMENT_CREATOR_SHIPPER_ACCOUNT_DIFF_SUC(603,"enum_res_code_603"),
;
private Integer code;
private String msg;
......
package com.fedex.connect.common.dependencies.enums.sys;
public enum UserLoginTypeEnum {
LOGIN(0L,"Login","登录"),
EXIT(1L,"Exit","退出"),
CHANGEPASSWORD(2L,"ChangePassword","修改密码"),
FCLLOGINREGISTRATION(3L,"FCLLoginRegistration","FCL登录注册"),
DEACTIVATE(4L,"Deactivate","停用"),
ENABLE(5L,"Enable","启用"),
;
private Long code;
private String enMsg;
private String msg;
UserLoginTypeEnum(Long code, String enMsg,String msg) {
this.code = code;
this.enMsg = enMsg;
this.msg = msg;
}
public Long getCode() {
return code;
}
public void setCode(Long code) {
this.code = code;
}
public String getEnMsg() {
return enMsg;
}
public void setEnMsg(String enMsg) {
this.enMsg = enMsg;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
}