Преглед на файлове

invw入库管理调整接口

master
huminghao преди 2 месеца
родител
ревизия
ed78217627

+ 30
- 30
zhywpt-app-invw/src/main/java/cn/com/taiji/invw/dto/enter/InvwEnterApplyCodeValidRequestDTO.java Целия файл

@@ -5,7 +5,6 @@ import cn.com.taiji.core.entity.dict.basic.CardType;
import cn.com.taiji.core.entity.dict.basic.ObuType;
import cn.com.taiji.core.entity.dict.invw.InventoryType;
import cn.com.taiji.core.dto.AbstractStaffBizRequestDTO;
import cn.com.taiji.invw.model.enter.EnterApplyDetailModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
@@ -14,9 +13,9 @@ import org.apache.commons.lang3.StringUtils;

import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigInteger;
import java.util.List;

/**
* @Auther: humh
@@ -44,52 +43,53 @@ public class InvwEnterApplyCodeValidRequestDTO extends AbstractStaffBizRequestDT
@Enumerated(EnumType.STRING)
private ObuType obuType;

@ApiModelProperty(value = "起始-结束号段list")
@NotNull
private List<EnterApplyDetailModel> enterApplyDetailModels;
@ApiModelProperty(value = "起始编码")
@NotBlank
private String startId;

@ApiModelProperty(value = "结束编码")
@NotBlank
private String endId;

@ApiModelProperty(value = "单片式OBU时有值")
private String startCardId;

@ApiModelProperty(value = "单片式OBU时有值")
private String endCardId;


public void valid() throws ManagerException {
if (InventoryType.CARD.equals(inventoryType)){
if (cardType == null){
throw new ManagerException("未选择卡类型");
}
for (EnterApplyDetailModel detailModel : enterApplyDetailModels) {
if (detailModel.getStartId().length() != 20 || detailModel.getEndId().length() != 20){
throw new ManagerException("卡号长度必须为20");
}
if (startId.length() != 20 || endId.length() != 20){
throw new ManagerException("卡号长度必须为20");
}

}else if (InventoryType.OBU.equals(inventoryType)){
if (obuType == null){
throw new ManagerException("未选择签类型");
}

for (EnterApplyDetailModel detailModel : enterApplyDetailModels) {
if (StringUtils.isEmpty(detailModel.getStartId()) || StringUtils.isEmpty(detailModel.getEndId())){
throw new ManagerException("起始或结束号段未填写完整");
}
if (detailModel.getStartId().length() != 16 || detailModel.getEndId().length() != 16){
throw new ManagerException("签号长度必须为16");
}
if (startId.length() != 16 || endId.length() != 16){
throw new ManagerException("签号长度必须为16");
}

if (ObuType.SINGLE_CHIP.equals(obuType)){
if (cardType == null){
throw new ManagerException("单片式OBU时,卡类型必填");
}
for (EnterApplyDetailModel detailModel : enterApplyDetailModels) {
int obuNUm = new BigInteger(detailModel.getEndId()).subtract(new BigInteger(detailModel.getStartId())).intValueExact()+1;
int cardNUm = new BigInteger(detailModel.getEndCardId()).subtract(new BigInteger(detailModel.getStartCardId())).intValueExact()+1;
if (obuNUm != cardNUm){
throw new ManagerException("单片式OBU时,签的号段与卡的号段数量必须相同");
}
if (StringUtils.isEmpty(detailModel.getStartCardId()) || StringUtils.isEmpty(detailModel.getEndCardId())){
throw new ManagerException("单片式OBU时,卡的是的段号和结束段号必填");
}
if (detailModel.getStartCardId().length() != 20 || detailModel.getEndCardId().length() != 20){
throw new ManagerException("卡号长度必须为20");
}
if (StringUtils.isEmpty(startCardId) || StringUtils.isEmpty(endCardId)){
throw new ManagerException("单片式OBU时,卡的是的段号和结束段号必填");
}
int obuNUm = new BigInteger(endId).subtract(new BigInteger(startId)).intValueExact()+1;
int cardNUm = new BigInteger(endCardId).subtract(new BigInteger(startCardId)).intValueExact()+1;
if (obuNUm != cardNUm){
throw new ManagerException("单片式OBU时,签的号段与卡的号段数量必须相同");
}
if (startCardId.length() != 20 || endCardId.length() != 20){
throw new ManagerException("卡号长度必须为20");
}

}
}
}

+ 18
- 2
zhywpt-app-invw/src/main/java/cn/com/taiji/invw/manager/enter/InvwEnterApplyManagerImpl.java Целия файл

@@ -154,8 +154,24 @@ public class InvwEnterApplyManagerImpl extends AbstractInvwManager implements In
public InvwEnterApplyCodeValidResponseDTO codeValid(InvwEnterApplyCodeValidRequestDTO dto) throws ManagerException {
dto.valid();
//校验
startIdAndEndIdValid(dto.getInventoryType(),dto.getObuType(),dto.getEnterApplyDetailModels());

// startIdAndEndIdValid(dto.getInventoryType(),dto.getObuType(),dto.getEnterApplyDetailModels());
if (InventoryType.CARD.equals(dto.getInventoryType())) {
List<InvwCardDetails> detailsList = cardDetailsRepo.queryByCardIdBetween(dto.getStartId(), dto.getEndId());
if (!CollectionTools.isEmpty(detailsList)) {
throw new ManagerException("卡号段已存在!");
}
} else if (InventoryType.OBU.equals(dto.getInventoryType())) {
List<InvwObuDetails> detailsList = obuDetailsRepo.queryByObuIdBetween(dto.getStartId(), dto.getEndId());
if (!CollectionTools.isEmpty(detailsList)) {
throw new ManagerException("签号段已存在!");
}
if (ObuType.SINGLE_CHIP.equals(dto.getObuType())) {
List<InvwCardDetails> cardDetailsList = cardDetailsRepo.queryByCardIdBetween(dto.getStartCardId(), dto.getEndCardId());
if (!CollectionTools.isEmpty(cardDetailsList)) {
throw new ManagerException("卡号段已存在!");
}
}
}
return new InvwEnterApplyCodeValidResponseDTO(true);
}


Loading…
Отказ
Запис