|
@@ -446,6 +446,7 @@ public class StudentPaymentRouteOrderServiceImpl extends BaseServiceImpl<Long, S
|
|
|
StudentPaymentRouteOrder studentPaymentRouteOrder = JSONObject.parseObject(objectMap.toJSONString(), StudentPaymentRouteOrder.class);
|
|
|
//销售收入
|
|
|
if ("销售收入".equals(studentPaymentRouteOrder.getIncomeType())) {
|
|
|
+ Boolean calenderFlag = studentPaymentRouteOrder.getCalenderId()==null;
|
|
|
if (studentPaymentRouteOrder.getSaleAmount() == null) {
|
|
|
throw new BizException("导入失败:交易流水号{},收入类型为销售收入时,销售金额不可为空", studentPaymentRouteOrder.getTransNo());
|
|
|
}
|
|
@@ -453,30 +454,32 @@ public class StudentPaymentRouteOrderServiceImpl extends BaseServiceImpl<Long, S
|
|
|
String goodsIds = studentPaymentRouteOrder.getGoodsIds();
|
|
|
String goodsNums = studentPaymentRouteOrder.getGoodsNums();
|
|
|
|
|
|
- if (StringUtils.isEmpty(goodsNums)) {
|
|
|
+ if (calenderFlag && StringUtils.isEmpty(goodsNums)) {
|
|
|
throw new BizException("导入失败:有销售金额时商品数量必填");
|
|
|
}
|
|
|
- if (StringUtils.isEmpty(goodsIds)) {
|
|
|
+ if (calenderFlag && StringUtils.isEmpty(goodsIds)) {
|
|
|
throw new BizException("导入失败:有销售金额时商品编号必填");
|
|
|
}
|
|
|
- List<String> goodsIdList = new ArrayList(Arrays.asList(goodsIds.split(",")));
|
|
|
- List<String> goodsNumList = new ArrayList(Arrays.asList(goodsNums.split(",")));
|
|
|
- if (goodsIdList.size() != goodsNumList.size()) {
|
|
|
- throw new BizException("导入失败:商品编号和商品数量不一致");
|
|
|
- }
|
|
|
- JSONObject goodsJSON = new JSONObject();
|
|
|
- for (int i = 0; i < goodsIdList.size(); i++) {
|
|
|
- if (!goodsDao.findByIdAndStatus(goodsIdList.get(i), 1)) {
|
|
|
- throw new BizException("导入失败:商品编号{}不存在", goodsIdList.get(i));
|
|
|
+ if(StringUtils.isNotEmpty(goodsNums) && StringUtils.isNotEmpty(goodsIds)){
|
|
|
+ List<String> goodsIdList = new ArrayList(Arrays.asList(goodsIds.split(",")));
|
|
|
+ List<String> goodsNumList = new ArrayList(Arrays.asList(goodsNums.split(",")));
|
|
|
+ if (goodsIdList.size() != goodsNumList.size()) {
|
|
|
+ throw new BizException("导入失败:商品编号和商品数量不一致");
|
|
|
}
|
|
|
- try {
|
|
|
- int goodsNum = Integer.parseInt(goodsNumList.get(i));
|
|
|
- goodsJSON.put(goodsIdList.get(i), goodsNum);
|
|
|
- } catch (Exception e1) {
|
|
|
- throw new BizException("导入失败:商品数量{}填写错误", goodsNumList.get(i));
|
|
|
+ JSONObject goodsJSON = new JSONObject();
|
|
|
+ for (int i = 0; i < goodsIdList.size(); i++) {
|
|
|
+ if (!goodsDao.findByIdAndStatus(goodsIdList.get(i), 1)) {
|
|
|
+ throw new BizException("导入失败:商品编号{}不存在", goodsIdList.get(i));
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ int goodsNum = Integer.parseInt(goodsNumList.get(i));
|
|
|
+ goodsJSON.put(goodsIdList.get(i), goodsNum);
|
|
|
+ } catch (Exception e1) {
|
|
|
+ throw new BizException("导入失败:商品数量{}填写错误", goodsNumList.get(i));
|
|
|
+ }
|
|
|
}
|
|
|
+ studentPaymentRouteOrder.setGoodsJson(goodsJSON.toJSONString());
|
|
|
}
|
|
|
- studentPaymentRouteOrder.setGoodsJson(goodsJSON.toJSONString());
|
|
|
//服务收入
|
|
|
} else {
|
|
|
studentPaymentRouteOrder.setSaleAmount(BigDecimal.ZERO);
|