给单据增加订金字段和接口逻辑
This commit is contained in:
@@ -376,9 +376,12 @@ public class ExceptionConstants {
|
||||
//单据录入-商品的批号不能为空
|
||||
public static final int DEPOT_HEAD_BATCH_NUMBERE_EMPTY_CODE = 8000015;
|
||||
public static final String DEPOT_HEAD_BATCH_NUMBERE_EMPTY_MSG = "抱歉,商品条码:%s的批号不能为空";
|
||||
//单据录入-商品的批号重复
|
||||
public static final int DEPOT_HEAD_BATCH_NUMBERE_EXISTS_CODE = 8000016;
|
||||
public static final String DEPOT_HEAD_BATCH_NUMBERE_EXISTS_MSG = "抱歉,商品条码:%s的批号已存在";
|
||||
//单据录入-会员预付款余额不足
|
||||
public static final int DEPOT_HEAD_MEMBER_PAY_LACK_CODE = 8000016;
|
||||
public static final String DEPOT_HEAD_MEMBER_PAY_LACK_MSG = "抱歉,会员预付款余额不足";
|
||||
//单据录入-累计订金超出原订单中的订金
|
||||
public static final int DEPOT_HEAD_DEPOSIT_OVER_PRE_CODE = 8000017;
|
||||
public static final String DEPOT_HEAD_DEPOSIT_OVER_PRE_MSG = "抱歉,累计订金超出原订单中的订金";
|
||||
/**
|
||||
* 单据明细信息
|
||||
* type = 90
|
||||
|
||||
@@ -118,6 +118,8 @@ public class AccountController {
|
||||
JSONArray dataArray = new JSONArray();
|
||||
if (null != dataList) {
|
||||
for (AccountVo4InOutList aEx : dataList) {
|
||||
String type = aEx.getType().replace("其它", "");
|
||||
aEx.setType(type);
|
||||
String timeStr = aEx.getOperTime().toString();
|
||||
BigDecimal balance = accountService.getAccountSum(accountId, timeStr, "date").add(accountService.getAccountSumByHead(accountId, timeStr, "date"))
|
||||
.add(accountService.getAccountSumByDetail(accountId, timeStr, "date")).add(accountService.getManyAccountSum(accountId, timeStr, "date")).add(initialAmount);
|
||||
|
||||
@@ -52,6 +52,8 @@ public class DepotHead {
|
||||
|
||||
private BigDecimal otherMoney;
|
||||
|
||||
private BigDecimal deposit;
|
||||
|
||||
private String status;
|
||||
|
||||
private String purchaseStatus;
|
||||
@@ -254,6 +256,14 @@ public class DepotHead {
|
||||
this.otherMoney = otherMoney;
|
||||
}
|
||||
|
||||
public BigDecimal getDeposit() {
|
||||
return deposit;
|
||||
}
|
||||
|
||||
public void setDeposit(BigDecimal deposit) {
|
||||
this.deposit = deposit;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -1656,6 +1656,66 @@ public class DepotHeadExample {
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDepositIsNull() {
|
||||
addCriterion("deposit is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDepositIsNotNull() {
|
||||
addCriterion("deposit is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDepositEqualTo(BigDecimal value) {
|
||||
addCriterion("deposit =", value, "deposit");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDepositNotEqualTo(BigDecimal value) {
|
||||
addCriterion("deposit <>", value, "deposit");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDepositGreaterThan(BigDecimal value) {
|
||||
addCriterion("deposit >", value, "deposit");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDepositGreaterThanOrEqualTo(BigDecimal value) {
|
||||
addCriterion("deposit >=", value, "deposit");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDepositLessThan(BigDecimal value) {
|
||||
addCriterion("deposit <", value, "deposit");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDepositLessThanOrEqualTo(BigDecimal value) {
|
||||
addCriterion("deposit <=", value, "deposit");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDepositIn(List<BigDecimal> values) {
|
||||
addCriterion("deposit in", values, "deposit");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDepositNotIn(List<BigDecimal> values) {
|
||||
addCriterion("deposit not in", values, "deposit");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDepositBetween(BigDecimal value1, BigDecimal value2) {
|
||||
addCriterion("deposit between", value1, value2, "deposit");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDepositNotBetween(BigDecimal value1, BigDecimal value2) {
|
||||
addCriterion("deposit not between", value1, value2, "deposit");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andStatusIsNull() {
|
||||
addCriterion("status is null");
|
||||
return (Criteria) this;
|
||||
|
||||
@@ -181,4 +181,11 @@ public interface DepotHeadMapperEx {
|
||||
@Param("endTime") String endTime,
|
||||
@Param("materialParam") String materialParam,
|
||||
@Param("depotArray") String[] depotArray);
|
||||
|
||||
BigDecimal getFinishDepositByNumber(
|
||||
@Param("number") String number);
|
||||
|
||||
BigDecimal getFinishDepositByNumberExceptCurrent(
|
||||
@Param("linkNumber") String linkNumber,
|
||||
@Param("number") String number);
|
||||
}
|
||||
|
||||
@@ -35,6 +35,8 @@ public class DepotHeadVo4List extends DepotHead{
|
||||
|
||||
private String address;
|
||||
|
||||
private BigDecimal finishDeposit;
|
||||
|
||||
public String getProjectName() {
|
||||
return projectName;
|
||||
}
|
||||
@@ -146,4 +148,12 @@ public class DepotHeadVo4List extends DepotHead{
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public BigDecimal getFinishDeposit() {
|
||||
return finishDeposit;
|
||||
}
|
||||
|
||||
public void setFinishDeposit(BigDecimal finishDeposit) {
|
||||
this.finishDeposit = finishDeposit;
|
||||
}
|
||||
}
|
||||
@@ -135,6 +135,7 @@ public class DepotHeadService {
|
||||
if(dh.getDeposit() == null) {
|
||||
dh.setDeposit(BigDecimal.ZERO);
|
||||
}
|
||||
dh.setFinishDeposit(depotHeadMapperEx.getFinishDepositByNumber(dh.getNumber()));
|
||||
if(StringUtil.isNotEmpty(dh.getSalesMan())) {
|
||||
dh.setSalesManStr(personService.getPersonByMapAndIds(personMap,dh.getSalesMan()));
|
||||
}
|
||||
@@ -745,6 +746,16 @@ public class DepotHeadService {
|
||||
}
|
||||
depotHead.setAccountMoneyList(accountMoneyList);
|
||||
}
|
||||
//校验累计扣除订金是否超出订单中的金额
|
||||
if(depotHead.getDeposit()!=null && StringUtil.isNotEmpty(depotHead.getLinkNumber())) {
|
||||
BigDecimal finishDeposit = depotHeadMapperEx.getFinishDepositByNumberExceptCurrent(depotHead.getLinkNumber(), depotHead.getNumber());
|
||||
//订单中的订金金额
|
||||
BigDecimal preDeposit = getDepotHead(depotHead.getLinkNumber()).getChangeAmount().abs();
|
||||
if(depotHead.getDeposit().add(finishDeposit).compareTo(preDeposit)>0) {
|
||||
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_DEPOSIT_OVER_PRE_CODE,
|
||||
String.format(ExceptionConstants.DEPOT_HEAD_DEPOSIT_OVER_PRE_MSG));
|
||||
}
|
||||
}
|
||||
try{
|
||||
depotHeadMapper.insertSelective(depotHead);
|
||||
}catch(Exception e){
|
||||
@@ -818,6 +829,16 @@ public class DepotHeadService {
|
||||
}
|
||||
depotHead.setAccountMoneyList(accountMoneyList);
|
||||
}
|
||||
//校验累计扣除订金是否超出订单中的金额
|
||||
if(depotHead.getDeposit()!=null && StringUtil.isNotEmpty(depotHead.getLinkNumber())) {
|
||||
BigDecimal finishDeposit = depotHeadMapperEx.getFinishDepositByNumberExceptCurrent(depotHead.getLinkNumber(), depotHead.getNumber());
|
||||
//订单中的订金金额
|
||||
BigDecimal preDeposit = getDepotHead(depotHead.getLinkNumber()).getChangeAmount().abs();
|
||||
if(depotHead.getDeposit().add(finishDeposit).compareTo(preDeposit)>0) {
|
||||
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_DEPOSIT_OVER_PRE_CODE,
|
||||
String.format(ExceptionConstants.DEPOT_HEAD_DEPOSIT_OVER_PRE_MSG));
|
||||
}
|
||||
}
|
||||
try{
|
||||
depotHeadMapper.updateByPrimaryKeySelective(depotHead);
|
||||
}catch(Exception e){
|
||||
|
||||
@@ -414,8 +414,6 @@ public class DepotItemService {
|
||||
}
|
||||
}
|
||||
if (StringUtil.isExist(rowObj.get("batchNumber"))) {
|
||||
//校验录入的批号是否重复
|
||||
checkBatchNumberIsExist(depotHead.getType(), depotHead.getSubType(), materialExtend.getId(), rowObj.getString("batchNumber"), barCode);
|
||||
depotItem.setBatchNumber(rowObj.getString("batchNumber"));
|
||||
} else {
|
||||
//批号不能为空
|
||||
@@ -573,27 +571,6 @@ public class DepotItemService {
|
||||
String.format(ExceptionConstants.DEPOT_HEAD_ROW_FAILED_MSG));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 校验录入的批号是否重复
|
||||
* @param type
|
||||
* @param subType
|
||||
* @param meId
|
||||
* @param batchNumber
|
||||
* @param barCode
|
||||
*/
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public void checkBatchNumberIsExist(String type, String subType, Long meId, String batchNumber, String barCode) {
|
||||
if ((BusinessConstants.SUB_TYPE_PURCHASE.equals(subType) ||
|
||||
BusinessConstants.SUB_TYPE_OTHER.equals(subType) ||
|
||||
BusinessConstants.SUB_TYPE_SALES_RETURN.equals(subType)) &&
|
||||
BusinessConstants.DEPOTHEAD_TYPE_IN.equals(type)) {
|
||||
Long bnCount = depotItemMapperEx.getCountByMaterialAndBatchNumber(meId, batchNumber);
|
||||
if (bnCount > 0) {
|
||||
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_BATCH_NUMBERE_EXISTS_CODE,
|
||||
String.format(ExceptionConstants.DEPOT_HEAD_BATCH_NUMBERE_EXISTS_MSG, barCode));
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 判断单据的状态
|
||||
* 通过数组对比:原单据的商品和商品数量(汇总) 与 分批操作后单据的商品和商品数量(汇总)
|
||||
|
||||
@@ -424,8 +424,10 @@ public class SerialNumberService {
|
||||
serialNumber.setInBillNo(inBillNo);
|
||||
serialNumberMapper.insertSelective(serialNumber);
|
||||
} else {
|
||||
throw new BusinessRunTimeException(ExceptionConstants.SERIAL_NUMBERE_ALREADY_EXISTS_CODE,
|
||||
String.format(ExceptionConstants.SERIAL_NUMBERE_ALREADY_EXISTS_MSG, sn));
|
||||
if(!inBillNo.equals(list.get(0).getInBillNo())) {
|
||||
throw new BusinessRunTimeException(ExceptionConstants.SERIAL_NUMBERE_ALREADY_EXISTS_CODE,
|
||||
String.format(ExceptionConstants.SERIAL_NUMBERE_ALREADY_EXISTS_MSG, sn));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user