feature:订单导入删除物料多余字段

release
gaorl 2 years ago
parent a6eabe36e2
commit 1998af7b40
  1. 473
      order-management-consumer/src/main/java/com/dxhy/order/consumer/modules/order/service/impl/OrderExcelReadServiceImpl.java
  2. BIN
      order-management-consumer/src/main/resources/download/OrderExcel.xlsx

@ -337,85 +337,85 @@ public class OrderExcelReadServiceImpl implements OrderExcelReadService {
} }
// 商品名称 70位 必填 ==>改成90 (19-03-28) // 商品名称 70位 必填 ==>改成90 (19-03-28)
if (StringUtils.isBlank(orderExcel.getXmmc())) { // if (StringUtils.isBlank(orderExcel.getXmmc())) {
isValid = true; // isValid = true;
resultList.add(buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_XMMC.getCellName(), ExcelErrorMessageEnum.ORDERINFO_XMMC_NULL, true)); // resultList.add(buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_XMMC.getCellName(), ExcelErrorMessageEnum.ORDERINFO_XMMC_NULL, true));
} // }
if(CommonUtils.judgeIsQdfp("", orderExcel.getFpzlDm())){ // if(CommonUtils.judgeIsQdfp("", orderExcel.getFpzlDm())){
if (!StringUtils.isBlank(orderExcel.getXmmc()) && GbkUtils.getGbkLength(orderExcel.getXmmc()) > ConfigureConstant.INT_600) { // if (!StringUtils.isBlank(orderExcel.getXmmc()) && GbkUtils.getGbkLength(orderExcel.getXmmc()) > ConfigureConstant.INT_600) {
isValid = true; // isValid = true;
resultList.add( // resultList.add(
buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_XMMC.getCellName(), ExcelErrorMessageEnum.QD_ORDERINFO_SPMC_OVERLENGTH, false)); // buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_XMMC.getCellName(), ExcelErrorMessageEnum.QD_ORDERINFO_SPMC_OVERLENGTH, false));
} // }
} else { // } else {
if (!StringUtils.isBlank(orderExcel.getXmmc()) && GbkUtils.getGbkLength(orderExcel.getXmmc()) > ConfigureConstant.INT_90) { // if (!StringUtils.isBlank(orderExcel.getXmmc()) && GbkUtils.getGbkLength(orderExcel.getXmmc()) > ConfigureConstant.INT_90) {
isValid = true; // isValid = true;
resultList.add( // resultList.add(
buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_XMMC.getCellName(), ExcelErrorMessageEnum.ORDERINFO_SPMC_OVERLENGTH, false)); // buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_XMMC.getCellName(), ExcelErrorMessageEnum.ORDERINFO_SPMC_OVERLENGTH, false));
} // }
} // }
// 规格型号 40位 // 规格型号 40位
if(CommonUtils.judgeIsQdfp("", orderExcel.getFpzlDm())){ // if(CommonUtils.judgeIsQdfp("", orderExcel.getFpzlDm())){
if (!StringUtils.isBlank(orderExcel.getGgxh()) && GbkUtils.getGbkLength(orderExcel.getGgxh()) > ConfigureConstant.INT_150) { // if (!StringUtils.isBlank(orderExcel.getGgxh()) && GbkUtils.getGbkLength(orderExcel.getGgxh()) > ConfigureConstant.INT_150) {
isValid = true; // isValid = true;
resultList.add( // resultList.add(
buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_GGXH.getCellName(), ExcelErrorMessageEnum.QD_ORDERINFO_GGXH_OVERLENGTH, false)); // buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_GGXH.getCellName(), ExcelErrorMessageEnum.QD_ORDERINFO_GGXH_OVERLENGTH, false));
} // }
} else { // } else {
if (!StringUtils.isBlank(orderExcel.getGgxh()) && GbkUtils.getGbkLength(orderExcel.getGgxh()) > ConfigureConstant.INT_40) { // if (!StringUtils.isBlank(orderExcel.getGgxh()) && GbkUtils.getGbkLength(orderExcel.getGgxh()) > ConfigureConstant.INT_40) {
isValid = true; // isValid = true;
resultList.add( // resultList.add(
buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_GGXH.getCellName(), ExcelErrorMessageEnum.ORDERINFO_GGXH_OVERLENGTH, false)); // buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_GGXH.getCellName(), ExcelErrorMessageEnum.ORDERINFO_GGXH_OVERLENGTH, false));
} // }
} // }
//根据金额判断是否为折扣行,金额小于0为折扣行 //根据金额判断是否为折扣行,金额小于0为折扣行
String fphxz = StringUtils.isNotBlank(orderExcel.getXmje()) && Double.parseDouble(orderExcel.getXmje()) < 0 ? OrderInfoEnum.FPHXZ_CODE_1.getKey() : OrderInfoEnum.FPHXZ_CODE_0.getKey(); String fphxz = StringUtils.isNotBlank(orderExcel.getXmje()) && Double.parseDouble(orderExcel.getXmje()) < 0 ? OrderInfoEnum.FPHXZ_CODE_1.getKey() : OrderInfoEnum.FPHXZ_CODE_0.getKey();
//如果机动车类型为 `经销企业`,则规格型号不能为空且不允许重复 //如果机动车类型为 `经销企业`,则规格型号不能为空且不允许重复
if (OrderInfoEnum.TSPZ_2.getValue().equals(orderExcel.getTspz()) && OrderInfoEnum.JDCQYLX_02.getValue().equals(orderExcel.getJdcqylx()) && // if (OrderInfoEnum.TSPZ_2.getValue().equals(orderExcel.getTspz()) && OrderInfoEnum.JDCQYLX_02.getValue().equals(orderExcel.getJdcqylx()) &&
(OrderInfoEnum.FPHXZ_CODE_0.getKey().equals(fphxz) || OrderInfoEnum.FPHXZ_CODE_2.getKey().equals(fphxz))) { // (OrderInfoEnum.FPHXZ_CODE_0.getKey().equals(fphxz) || OrderInfoEnum.FPHXZ_CODE_2.getKey().equals(fphxz))) {
if (StringUtils.isBlank(orderExcel.getGgxh()) || (ggxhSet.size() != itemCount)) { // if (StringUtils.isBlank(orderExcel.getGgxh()) || (ggxhSet.size() != itemCount)) {
isValid = true; // isValid = true;
resultList.add( // resultList.add(
buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_GGXH.getCellName(), ExcelErrorMessageEnum.ORDERINFO_GGXH_ERROR, false)); // buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_GGXH.getCellName(), ExcelErrorMessageEnum.ORDERINFO_GGXH_ERROR, false));
} // }
} // }
//全电发票 单位、单价、数量关系校验 //全电发票 单位、单价、数量关系校验
//全电发票,单位、单价、数量同时为空或同时不为空 //全电发票,单位、单价、数量同时为空或同时不为空
if(CommonUtils.judgeIsQdfp("", orderExcel.getFpzlDm())){ // if(CommonUtils.judgeIsQdfp("", orderExcel.getFpzlDm())){
boolean isEmpty = StringUtils.isBlank(orderExcel.getXmdw()) // boolean isEmpty = StringUtils.isBlank(orderExcel.getXmdw())
&& StringUtils.isBlank(orderExcel.getXmsl()) // && StringUtils.isBlank(orderExcel.getXmsl())
&& StringUtils.isBlank(orderExcel.getXmdj()); // && StringUtils.isBlank(orderExcel.getXmdj());
//
boolean isNotEmpty = StringUtils.isNotBlank(orderExcel.getXmdw()) // boolean isNotEmpty = StringUtils.isNotBlank(orderExcel.getXmdw())
&& StringUtils.isNotBlank(orderExcel.getXmsl()) // && StringUtils.isNotBlank(orderExcel.getXmsl())
&& StringUtils.isNotBlank(orderExcel.getXmdj()); // && StringUtils.isNotBlank(orderExcel.getXmdj());
//
if(!(isEmpty || isNotEmpty)){ // if(!(isEmpty || isNotEmpty)){
isValid = true; // isValid = true;
resultList.add(buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_XMDW.getCellName(), // resultList.add(buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_XMDW.getCellName(),
ExcelErrorMessageEnum.QD_ORDERINFO_XMDW_XMSL_XMDJ_OVERLENGTH, false)); // ExcelErrorMessageEnum.QD_ORDERINFO_XMDW_XMSL_XMDJ_OVERLENGTH, false));
} // }
} // }
// 单位 20位 // 单位 20位
if(CommonUtils.judgeIsQdfp("", orderExcel.getFpzlDm())){ // if(CommonUtils.judgeIsQdfp("", orderExcel.getFpzlDm())){
if (!StringUtils.isBlank(orderExcel.getXmdw()) && GbkUtils.getGbkLength(orderExcel.getXmdw()) > ConfigureConstant.INT_300) { // if (!StringUtils.isBlank(orderExcel.getXmdw()) && GbkUtils.getGbkLength(orderExcel.getXmdw()) > ConfigureConstant.INT_300) {
isValid = true; // isValid = true;
resultList // resultList
.add(buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_XMDW.getCellName(), ExcelErrorMessageEnum.QD_ORDERINFO_DW_OVERLENGTH, false)); // .add(buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_XMDW.getCellName(), ExcelErrorMessageEnum.QD_ORDERINFO_DW_OVERLENGTH, false));
} // }
} else { // } else {
if (!StringUtils.isBlank(orderExcel.getXmdw()) && GbkUtils.getGbkLength(orderExcel.getXmdw()) > ConfigureConstant.INT_20) { // if (!StringUtils.isBlank(orderExcel.getXmdw()) && GbkUtils.getGbkLength(orderExcel.getXmdw()) > ConfigureConstant.INT_20) {
isValid = true; // isValid = true;
resultList // resultList
.add(buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_XMDW.getCellName(), ExcelErrorMessageEnum.ORDERINFO_DW_OVERLENGTH, false)); // .add(buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_XMDW.getCellName(), ExcelErrorMessageEnum.ORDERINFO_DW_OVERLENGTH, false));
} // }
} // }
//如果特殊票种为 `机动车发票` 则单位必须为 `辆` //如果特殊票种为 `机动车发票` 则单位必须为 `辆`
if (StringUtils.equals(OrderInfoEnum.TSPZ_2.getValue(), orderExcel.getTspz()) && if (StringUtils.equals(OrderInfoEnum.TSPZ_2.getValue(), orderExcel.getTspz()) &&
!StringUtils.equals(ConfigureConstant.STRING_LINAG, orderExcel.getXmdw()) && !StringUtils.equals(ConfigureConstant.STRING_LINAG, orderExcel.getXmdw()) &&
@ -424,29 +424,29 @@ public class OrderExcelReadServiceImpl implements OrderExcelReadService {
resultList.add(buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_XMDW.getCellName(), ExcelErrorMessageEnum.ORDERINFO_XMDW_JDCZP, false)); resultList.add(buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_XMDW.getCellName(), ExcelErrorMessageEnum.ORDERINFO_XMDW_JDCZP, false));
} }
String spbm = orderExcel.getSsflbm(); // String spbm = orderExcel.getSsflbm();
if (StringUtils.isNotEmpty(spbm)) { // if (StringUtils.isNotEmpty(spbm)) {
spbm = StringUtil.fillZero(spbm, ConfigureConstant.INT_19); // spbm = StringUtil.fillZero(spbm, ConfigureConstant.INT_19);
} // }
TaxClassCodeEntity taxClassCodeEntity = taxClassCodeService.queryTaxClassCodeFromCache(spbm); // TaxClassCodeEntity taxClassCodeEntity = taxClassCodeService.queryTaxClassCodeFromCache(spbm);
if (ObjectUtil.isNotEmpty(taxClassCodeEntity)) { // if (ObjectUtil.isNotEmpty(taxClassCodeEntity)) {
if (ConfigureConstant.STRING_Y.equals(taxClassCodeEntity.getCpy())) { // if (ConfigureConstant.STRING_Y.equals(taxClassCodeEntity.getCpy())) {
orderExcel.setTspz(OrderInfoEnum.TSPZ_1.getValue()); // orderExcel.setTspz(OrderInfoEnum.TSPZ_1.getValue());
//成品油单位只能为升或吨 // //成品油单位只能为升或吨
if (Double.parseDouble(orderExcel.getXmje()) > 0 && !ConfigureConstant.STRING_SHENG.equals(orderExcel.getXmdw()) && !ConfigureConstant.STRING_DUN.equals(orderExcel.getXmdw())) { // if (Double.parseDouble(orderExcel.getXmje()) > 0 && !ConfigureConstant.STRING_SHENG.equals(orderExcel.getXmdw()) && !ConfigureConstant.STRING_DUN.equals(orderExcel.getXmdw())) {
isValid = true; // isValid = true;
resultList.add( // resultList.add(
buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_XMDW.getCellName(), ExcelErrorMessageEnum.ORDERINFO_9714, false)); // buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_XMDW.getCellName(), ExcelErrorMessageEnum.ORDERINFO_9714, false));
} // }
} // }
} else { // } else {
if (StringUtils.isBlank(orderExcel.getSl())) { // if (StringUtils.isBlank(orderExcel.getSl())) {
isValid = true; // isValid = true;
resultList.add(buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_SL.getCellName(), // resultList.add(buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_SL.getCellName(),
ExcelErrorMessageEnum.ORDERINFO_SSFLBM_SL_NULL, false)); // ExcelErrorMessageEnum.ORDERINFO_SSFLBM_SL_NULL, false));
//
} // }
} // }
//扣除额不为空时,长度不能超过20 //扣除额不为空时,长度不能超过20
if (StringUtils.isNotBlank(orderExcel.getKce()) && GbkUtils.getGbkLength(orderExcel.getKce()) > ConfigureConstant.INT_20) { if (StringUtils.isNotBlank(orderExcel.getKce()) && GbkUtils.getGbkLength(orderExcel.getKce()) > ConfigureConstant.INT_20) {
@ -499,12 +499,13 @@ public class OrderExcelReadServiceImpl implements OrderExcelReadService {
resultList.add( resultList.add(
buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_XMSL.getCellName(), ExcelErrorMessageEnum.ORDERINFO_XMSL_OVERLENGTH, false)); buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_XMSL.getCellName(), ExcelErrorMessageEnum.ORDERINFO_XMSL_OVERLENGTH, false));
} }
} else if (StringUtils.isNotEmpty(orderExcel.getXmje()) && Double.parseDouble(orderExcel.getXmje()) > 0 && ObjectUtil.isNotEmpty(taxClassCodeEntity) && ConfigureConstant.STRING_Y.equals(taxClassCodeEntity.getCpy())) {
isValid = true;
resultList.add(
buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_XMSL.getCellName(), ExcelErrorMessageEnum.ORDERINFO_9716, false));
} }
// else if (StringUtils.isNotEmpty(orderExcel.getXmje()) && Double.parseDouble(orderExcel.getXmje()) > 0 && ObjectUtil.isNotEmpty(taxClassCodeEntity) && ConfigureConstant.STRING_Y.equals(taxClassCodeEntity.getCpy())) {
// isValid = true;
// resultList.add(
// buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_XMSL.getCellName(), ExcelErrorMessageEnum.ORDERINFO_9716, false));
//
// }
//根据机动车企业类型判断,当企业类型为 `生产企业`,规格型号为空时,数量可以是大于0的整数,规格型号不为空时,数量必须是1 //根据机动车企业类型判断,当企业类型为 `生产企业`,规格型号为空时,数量可以是大于0的整数,规格型号不为空时,数量必须是1
//当企业类型为`经销企业`时,数量必须为1 //当企业类型为`经销企业`时,数量必须为1
@ -654,10 +655,10 @@ public class OrderExcelReadServiceImpl implements OrderExcelReadService {
isValid = true; isValid = true;
resultList.add( resultList.add(
buildReturnMap(orderExcel.getRowIndex(), ConfigureConstant.STRING_EXCEL_ZKH, ExcelErrorMessageEnum.ORDERINFO_ZKH_ERROR, true)); buildReturnMap(orderExcel.getRowIndex(), ConfigureConstant.STRING_EXCEL_ZKH, ExcelErrorMessageEnum.ORDERINFO_ZKH_ERROR, true));
} else if (StringUtils.isNotBlank(orderExcel.getXmmc()) && !orderExcel.getXmmc().equals(lastOrderExcel.getXmmc())) { // } else if (StringUtils.isNotBlank(orderExcel.getXmmc()) && !orderExcel.getXmmc().equals(lastOrderExcel.getXmmc())) {
isValid = true; // isValid = true;
resultList.add( // resultList.add(
buildReturnMap(orderExcel.getRowIndex(), ConfigureConstant.STRING_EXCEL_ZKH, ExcelErrorMessageEnum.ORDERINFO_ZKH_ERROR, true)); // buildReturnMap(orderExcel.getRowIndex(), ConfigureConstant.STRING_EXCEL_ZKH, ExcelErrorMessageEnum.ORDERINFO_ZKH_ERROR, true));
} else if (lastOrderExcel.getXmje() != null && Double.parseDouble(lastOrderExcel.getXmje()) <= ConfigureConstant.DOUBLE_PENNY_ZERO) { } else if (lastOrderExcel.getXmje() != null && Double.parseDouble(lastOrderExcel.getXmje()) <= ConfigureConstant.DOUBLE_PENNY_ZERO) {
isValid = true; isValid = true;
resultList.add( resultList.add(
@ -673,41 +674,38 @@ public class OrderExcelReadServiceImpl implements OrderExcelReadService {
resultList.add(buildReturnMap(orderExcel.getRowIndex(), ConfigureConstant.STRING_EXCEL_ZKH, ExcelErrorMessageEnum.ORDERINFO_ZKH_SL_ERROR, true)); resultList.add(buildReturnMap(orderExcel.getRowIndex(), ConfigureConstant.STRING_EXCEL_ZKH, ExcelErrorMessageEnum.ORDERINFO_ZKH_SL_ERROR, true));
} }
if (StringUtils.isNotBlank(orderExcel.getXmdw())) { // if (StringUtils.isNotBlank(orderExcel.getXmdw())) {
isValid = true; // isValid = true;
resultList.add(buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_XMDW.getCellName(), ExcelErrorMessageEnum.ORDERINFO_ZKH_XMDW_ERROR, true)); // resultList.add(buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_XMDW.getCellName(), ExcelErrorMessageEnum.ORDERINFO_ZKH_XMDW_ERROR, true));
} // }
if (StringUtils.isNotBlank(orderExcel.getGgxh())) { // if (StringUtils.isNotBlank(orderExcel.getGgxh())) {
isValid = true; // isValid = true;
resultList.add(buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_GGXH.getCellName(), ExcelErrorMessageEnum.ORDERINFO_ZKH_GGXH_ERROR, true)); // resultList.add(buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_GGXH.getCellName(), ExcelErrorMessageEnum.ORDERINFO_ZKH_GGXH_ERROR, true));
} // }
} }
} }
if (StringUtils.isNotBlank(orderExcel.getXmmc()) && StringUtils.isEmpty(orderExcel.getSsflbm())) { // if (StringUtils.isNotBlank(orderExcel.getXmmc()) && StringUtils.isEmpty(orderExcel.getSsflbm())) {
/** // /**
* 校验商品重复 // * 校验商品重复
*/ // */
CommodityCodeCheckQuery commodityCodeCheckQuery = new CommodityCodeCheckQuery(); // CommodityCodeCheckQuery commodityCodeCheckQuery = new CommodityCodeCheckQuery();
commodityCodeCheckQuery.setXmmc(orderExcel.getXmmc()); // commodityCodeCheckQuery.setXmmc(orderExcel.getXmmc());
commodityCodeCheckQuery.setZxbm(orderExcel.getZxbm()); // commodityCodeCheckQuery.setZxbm(orderExcel.getZxbm());
commodityCodeCheckQuery.setGgxh(orderExcel.getGgxh()); // commodityCodeCheckQuery.setGgxh(orderExcel.getGgxh());
commodityCodeCheckQuery.setXmdw(orderExcel.getXmdw()); // commodityCodeCheckQuery.setXmdw(orderExcel.getXmdw());
commodityCodeCheckQuery.setXmdj(orderExcel.getXmdj()); // commodityCodeCheckQuery.setXmdj(orderExcel.getXmdj());
commodityCodeCheckQuery.setSl(orderExcel.getSl()); // commodityCodeCheckQuery.setSl(orderExcel.getSl());
commodityCodeCheckQuery.setDeptId(entId); // commodityCodeCheckQuery.setDeptId(entId);
R r = commodityService.checkRepeat(commodityCodeCheckQuery, shList, false); // R r = commodityService.checkRepeat(commodityCodeCheckQuery, shList, false);
if (OrderInfoContentEnum.COMMODITY_MESSAGE_ERROR_174015.getKey().equals(r.get(OrderManagementConstant.CODE))) { // if (OrderInfoContentEnum.COMMODITY_MESSAGE_ERROR_174015.getKey().equals(r.get(OrderManagementConstant.CODE))) {
log.error("根据商品名称查到多个商品!"); // log.error("根据商品名称查到多个商品!");
isValid = true; // isValid = true;
resultList.add(buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_SPBM.getCellName(), // resultList.add(buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_SPBM.getCellName(),
ExcelErrorMessageEnum.ORDERINFO_XMMC_ERROR, false)); // ExcelErrorMessageEnum.ORDERINFO_XMMC_ERROR, false));
} // }
// }
}
//税额 非必填 必须为数字,最多20位 0.06误差 //税额 非必填 必须为数字,最多20位 0.06误差
if (!StringUtils.isBlank(orderExcel.getSe())) { if (!StringUtils.isBlank(orderExcel.getSe())) {
@ -787,70 +785,70 @@ public class OrderExcelReadServiceImpl implements OrderExcelReadService {
//是否享受税收优惠政策 //是否享受税收优惠政策
//优惠政策标识只能为0或者1 必填 //优惠政策标识只能为0或者1 必填
String yhzcbs = orderExcel.getYhzcbs(); // String yhzcbs = orderExcel.getYhzcbs();
if ((ConfigureConstant.STRING_YHZCBS_F.equals(yhzcbs))) { // if ((ConfigureConstant.STRING_YHZCBS_F.equals(yhzcbs))) {
orderExcel.setYhzcbs(OrderInfoEnum.YHZCBS_0.getKey()); // orderExcel.setYhzcbs(OrderInfoEnum.YHZCBS_0.getKey());
yhzcbs = OrderInfoEnum.YHZCBS_0.getKey(); // yhzcbs = OrderInfoEnum.YHZCBS_0.getKey();
} else if (ConfigureConstant.STRING_YHZCBS_S.equals(yhzcbs)) { // } else if (ConfigureConstant.STRING_YHZCBS_S.equals(yhzcbs)) {
orderExcel.setYhzcbs(OrderInfoEnum.YHZCBS_1.getKey()); // orderExcel.setYhzcbs(OrderInfoEnum.YHZCBS_1.getKey());
yhzcbs = OrderInfoEnum.YHZCBS_1.getKey(); // yhzcbs = OrderInfoEnum.YHZCBS_1.getKey();
} else { // } else {
isValid = true; // isValid = true;
resultList.add(buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_YHZCBS.getCellName(), // resultList.add(buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_YHZCBS.getCellName(),
ExcelErrorMessageEnum.ORDERINFO_9707, false)); // ExcelErrorMessageEnum.ORDERINFO_9707, false));
} // }
//享受税收优惠政策内容 //享受税收优惠政策内容
//享受税收优惠政策内容只能是 `免税`,`不征税`,`出口零税` //享受税收优惠政策内容只能是 `免税`,`不征税`,`出口零税`
String zzstsgl = orderExcel.getZzstsgl(); // String zzstsgl = orderExcel.getZzstsgl();
if (StringUtils.isNotBlank(zzstsgl)) { // if (StringUtils.isNotBlank(zzstsgl)) {
if (ConfigureConstant.STRING_CKLS.equals(zzstsgl)) { // if (ConfigureConstant.STRING_CKLS.equals(zzstsgl)) {
orderExcel.setLslbs(OrderInfoEnum.LSLBS_0.getKey()); // orderExcel.setLslbs(OrderInfoEnum.LSLBS_0.getKey());
} else if (ConfigureConstant.STRING_MS.equals(zzstsgl)) { // } else if (ConfigureConstant.STRING_MS.equals(zzstsgl)) {
orderExcel.setLslbs(OrderInfoEnum.LSLBS_1.getKey()); // orderExcel.setLslbs(OrderInfoEnum.LSLBS_1.getKey());
} else if (ConfigureConstant.STRING_BZS.equals(zzstsgl)) { // } else if (ConfigureConstant.STRING_BZS.equals(zzstsgl)) {
orderExcel.setLslbs(OrderInfoEnum.LSLBS_2.getKey()); // orderExcel.setLslbs(OrderInfoEnum.LSLBS_2.getKey());
} else { // } else {
isValid = true; // isValid = true;
resultList.add(buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_ZZSTSGL.getCellName(), // resultList.add(buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_ZZSTSGL.getCellName(),
ExcelErrorMessageEnum.ORDERINFO_9901, false)); // ExcelErrorMessageEnum.ORDERINFO_9901, false));
} // }
} // }
//优惠政策标识为1时; //优惠政策标识为1时;
if (OrderInfoEnum.YHZCBS_1.getKey().equals(yhzcbs)) { // if (OrderInfoEnum.YHZCBS_1.getKey().equals(yhzcbs)) {
if (StringUtils.isBlank(zzstsgl)) { // if (StringUtils.isBlank(zzstsgl)) {
isValid = true; // isValid = true;
resultList.add(buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_ZZSTSGL.getCellName(), // resultList.add(buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_ZZSTSGL.getCellName(),
ExcelErrorMessageEnum.ORDERINFO_9708, false)); // ExcelErrorMessageEnum.ORDERINFO_9708, false));
} // }
//订单明细信息中YHZCBS(优惠政策标识)为1, 且税率为0, 则ZZSTSGL内容只能写"出口零税/免税/不征税 // //订单明细信息中YHZCBS(优惠政策标识)为1, 且税率为0, 则ZZSTSGL内容只能写"出口零税/免税/不征税
if (!StringUtils.isBlank(orderExcel.getSl()) && // if (!StringUtils.isBlank(orderExcel.getSl()) &&
ConfigureConstant.STRING_000.equals(orderExcel.getSl()) && (StringUtils.isBlank(zzstsgl))) { // ConfigureConstant.STRING_000.equals(orderExcel.getSl()) && (StringUtils.isBlank(zzstsgl))) {
isValid = true; // isValid = true;
resultList.add(buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_ZZSTSGL.getCellName(), // resultList.add(buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_ZZSTSGL.getCellName(),
ExcelErrorMessageEnum.ORDERINFO_9706, false)); // ExcelErrorMessageEnum.ORDERINFO_9706, false));
} // }
} // }
//订单明细信息中优惠政策标识为0时,增值税特殊管理须为空 //订单明细信息中优惠政策标识为0时,增值税特殊管理须为空
if (OrderInfoEnum.YHZCBS_0.getKey().equals(yhzcbs)) { // if (OrderInfoEnum.YHZCBS_0.getKey().equals(yhzcbs)) {
if (StringUtils.isNotBlank(zzstsgl)) { // if (StringUtils.isNotBlank(zzstsgl)) {
isValid = true; // isValid = true;
resultList.add(buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_ZZSTSGL.getCellName(), // resultList.add(buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_ZZSTSGL.getCellName(),
ExcelErrorMessageEnum.ORDERINFO_9708, false)); // ExcelErrorMessageEnum.ORDERINFO_9708, false));
} else { // } else {
//如果税率为0,但并不属于优惠政策(即普通的零税率),则YHZCBS填0,ZZSTSGL为空,LSLBS填3,; // //如果税率为0,但并不属于优惠政策(即普通的零税率),则YHZCBS填0,ZZSTSGL为空,LSLBS填3,;
if(ConfigureConstant.STRING_000.equals(orderExcel.getSl())){ // if(ConfigureConstant.STRING_000.equals(orderExcel.getSl())){
orderExcel.setLslbs(OrderInfoEnum.LSLBS_3.getKey()); // orderExcel.setLslbs(OrderInfoEnum.LSLBS_3.getKey());
} // }
} // }
} // }
/** /**
* 税率非空时,逻辑判断 * 税率非空时,逻辑判断
*/ */
if (!StringUtils.isBlank(orderExcel.getSl())) { // if (!StringUtils.isBlank(orderExcel.getSl())) {
/** /**
* 增值税特殊管理不为空,不为不征税,不为免税,不为出口零税逻辑处理 * 增值税特殊管理不为空,不为不征税,不为免税,不为出口零税逻辑处理
* 如果是按5%简易征收需要保证税率为0.05 * 如果是按5%简易征收需要保证税率为0.05
@ -858,58 +856,58 @@ public class OrderExcelReadServiceImpl implements OrderExcelReadService {
* 如果是简易征收需要保证税率为0.03或0.04或0.05 * 如果是简易征收需要保证税率为0.03或0.04或0.05
* 如果是按5%简易征收减按1.5%计征需要保证税率为0.015 * 如果是按5%简易征收减按1.5%计征需要保证税率为0.015
*/ */
if ((!StringUtils.isBlank(zzstsgl)) && // if ((!StringUtils.isBlank(zzstsgl)) &&
(!ConfigureConstant.STRING_BZS.equals(zzstsgl)) && // (!ConfigureConstant.STRING_BZS.equals(zzstsgl)) &&
(!ConfigureConstant.STRING_MS.equals(zzstsgl)) && // (!ConfigureConstant.STRING_MS.equals(zzstsgl)) &&
(!ConfigureConstant.STRING_CKLS.equals(zzstsgl))) { // (!ConfigureConstant.STRING_CKLS.equals(zzstsgl))) {
//
if (zzstsgl.contains(ConfigureConstant.STRING_ERROR_PERCENT)) { // if (zzstsgl.contains(ConfigureConstant.STRING_ERROR_PERCENT)) {
resultList.add(buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_SL.getCellName(), ExcelErrorMessageEnum.ORDERINFO_9720, false)); // resultList.add(buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_SL.getCellName(), ExcelErrorMessageEnum.ORDERINFO_9720, false));
} // }
switch (zzstsgl) { // switch (zzstsgl) {
case ConfigureConstant.STRING_JYZS5: // case ConfigureConstant.STRING_JYZS5:
if (new BigDecimal(orderExcel.getSl()).doubleValue() != ConfigureConstant.DOUBLE_PENNY_5) { // if (new BigDecimal(orderExcel.getSl()).doubleValue() != ConfigureConstant.DOUBLE_PENNY_5) {
isValid = true; // isValid = true;
resultList.add(buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_SL.getCellName(), ExcelErrorMessageEnum.ORDERINFO_9711, false)); // resultList.add(buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_SL.getCellName(), ExcelErrorMessageEnum.ORDERINFO_9711, false));
} // }
break; // break;
case ConfigureConstant.STRING_JYZS3: // case ConfigureConstant.STRING_JYZS3:
if (new BigDecimal(orderExcel.getSl()).doubleValue() != ConfigureConstant.DOUBLE_PENNY_3) { // if (new BigDecimal(orderExcel.getSl()).doubleValue() != ConfigureConstant.DOUBLE_PENNY_3) {
isValid = true; // isValid = true;
resultList.add(buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_SL.getCellName(), ExcelErrorMessageEnum.ORDERINFO_9711, false)); // resultList.add(buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_SL.getCellName(), ExcelErrorMessageEnum.ORDERINFO_9711, false));
} // }
break; // break;
case ConfigureConstant.STRING_JYZS: // case ConfigureConstant.STRING_JYZS:
if (new BigDecimal(orderExcel.getSl()).doubleValue() != ConfigureConstant.DOUBLE_PENNY_3 && new BigDecimal(orderExcel.getSl()).doubleValue() != ConfigureConstant.DOUBLE_PENNY_4 && new BigDecimal(orderExcel.getSl()).doubleValue() != ConfigureConstant.DOUBLE_PENNY_5) { // if (new BigDecimal(orderExcel.getSl()).doubleValue() != ConfigureConstant.DOUBLE_PENNY_3 && new BigDecimal(orderExcel.getSl()).doubleValue() != ConfigureConstant.DOUBLE_PENNY_4 && new BigDecimal(orderExcel.getSl()).doubleValue() != ConfigureConstant.DOUBLE_PENNY_5) {
isValid = true; // isValid = true;
resultList.add(buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_SL.getCellName(), ExcelErrorMessageEnum.ORDERINFO_9711, false)); // resultList.add(buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_SL.getCellName(), ExcelErrorMessageEnum.ORDERINFO_9711, false));
} // }
break; // break;
case ConfigureConstant.STRING_JYZS5_1: // case ConfigureConstant.STRING_JYZS5_1:
if (DecimalCalculateUtil.stringCompare(orderExcel.getSl(), ConfigureConstant.STRING_0015) != 0) { // if (DecimalCalculateUtil.stringCompare(orderExcel.getSl(), ConfigureConstant.STRING_0015) != 0) {
isValid = true; // isValid = true;
resultList.add(buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_SL.getCellName(), ExcelErrorMessageEnum.ORDERINFO_9711, false)); // resultList.add(buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_SL.getCellName(), ExcelErrorMessageEnum.ORDERINFO_9711, false));
} // }
break; // break;
default: // default:
break; // break;
} // }
} // }
//零税率标识不为空,税率必须为0 //零税率标识不为空,税率必须为0
if ((!StringUtils.isBlank(orderExcel.getLslbs())) && (ConfigureConstant.DOUBLE_PENNY_ZERO != new BigDecimal(orderExcel.getSl()).doubleValue())) { // if ((!StringUtils.isBlank(orderExcel.getLslbs())) && (ConfigureConstant.DOUBLE_PENNY_ZERO != new BigDecimal(orderExcel.getSl()).doubleValue())) {
isValid = true; // isValid = true;
resultList.add(buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_SL.getCellName(), // resultList.add(buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_SL.getCellName(),
ExcelErrorMessageEnum.ORDERINFO_9709, false)); // ExcelErrorMessageEnum.ORDERINFO_9709, false));
} // }
//
//零税率标识为空,税率不能为0 // //零税率标识为空,税率不能为0
if ((StringUtils.isBlank(orderExcel.getLslbs())) && (ConfigureConstant.DOUBLE_PENNY_ZERO == new BigDecimal(orderExcel.getSl()).doubleValue())) { // if ((StringUtils.isBlank(orderExcel.getLslbs())) && (ConfigureConstant.DOUBLE_PENNY_ZERO == new BigDecimal(orderExcel.getSl()).doubleValue())) {
isValid = true; // isValid = true;
resultList.add(buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_SL.getCellName(), // resultList.add(buildReturnMap(orderExcel.getRowIndex(), NewExcelEnum.ORDERITEM_SL.getCellName(),
ExcelErrorMessageEnum.ORDERINFO_9709, false)); // ExcelErrorMessageEnum.ORDERINFO_9709, false));
} // }
} // }
// 自行编码 // 自行编码
if (!StringUtils.isBlank(orderExcel.getZxbm()) && GbkUtils.getGbkLength(orderExcel.getZxbm()) > ConfigureConstant.INT_18) { if (!StringUtils.isBlank(orderExcel.getZxbm()) && GbkUtils.getGbkLength(orderExcel.getZxbm()) > ConfigureConstant.INT_18) {
@ -1649,8 +1647,7 @@ public class OrderExcelReadServiceImpl implements OrderExcelReadService {
errorList.add(examinData); errorList.add(examinData);
} }
} else { } else {
Map<String, Object> examinData = examinData(newOrderExcel, lastOrderExcel, xhfNsrsbh, Map<String, Object> examinData = examinData(newOrderExcel, lastOrderExcel, xhfNsrsbh,ggxhSet, (i + 1), userId, terminalCode,entId);
ggxhSet, (i + 1), userId, terminalCode,entId);
List<Object> resultList = (List<Object>) examinData.get("resultList"); List<Object> resultList = (List<Object>) examinData.get("resultList");
//验证扣除额是否合法 //验证扣除额是否合法
if (ObjectUtil.isNotNull(newOrderExcel) && StringUtils.isNotBlank(newOrderExcel.getKce())) { if (ObjectUtil.isNotNull(newOrderExcel) && StringUtils.isNotBlank(newOrderExcel.getKce())) {

Loading…
Cancel
Save