|
|
@@ -240,6 +240,30 @@ public class OwnBillController extends BaseController {
|
|
|
if(fileList.size() == 0){
|
|
|
return R.fail(500,"往来账款发票数据不能为空,请上传发票后重试");
|
|
|
}
|
|
|
+ //校验发票
|
|
|
+ for (Map<String,String> file : fileList) {
|
|
|
+ //开票日期
|
|
|
+ String ziiDate = CommonUtil.objToString(file.get("ziiDate"));
|
|
|
+ Date ziiDateParse = sdf.parse(ziiDate);
|
|
|
+ //校验结果
|
|
|
+ String ziiCheckStt = CommonUtil.objToString(file.get("ziiCheckStt"));
|
|
|
+ if (!"1".equals(ziiCheckStt)) {
|
|
|
+// return R.fail(500,"存在未验真或验真未通过发票,不可进行账款关联");
|
|
|
+ }
|
|
|
+ //贸易日期前一个月
|
|
|
+ Calendar startDate = Calendar.getInstance();
|
|
|
+ startDate.setTime(date);
|
|
|
+ startDate.add(Calendar.MONTH, -1);
|
|
|
+ Date start = startDate.getTime();
|
|
|
+ //付款日期后两个月
|
|
|
+ Calendar endDate = Calendar.getInstance();
|
|
|
+ endDate.setTime(payDate);
|
|
|
+ endDate.add(Calendar.MONTH, 2);
|
|
|
+ Date end = endDate.getTime();
|
|
|
+ if (start.compareTo(ziiDateParse) > 0 || end.compareTo(ziiDateParse) < 0) {
|
|
|
+ return R.fail(500, "存在不符合账款期限内发票,不可进行账款关联");
|
|
|
+ }
|
|
|
+ }
|
|
|
for (Map<String,String> file : fileList) {
|
|
|
//发票代码
|
|
|
String ziiNo = CommonUtil.objToString(file.get("ziiNo"));
|
|
|
@@ -270,22 +294,6 @@ public class OwnBillController extends BaseController {
|
|
|
String ziiCheckStt = CommonUtil.objToString(file.get("ziiCheckStt"));
|
|
|
//附件
|
|
|
String ziiFile = CommonUtil.objToString(file.get("ziiFile"));
|
|
|
- if (!"1".equals(ziiCheckStt)) {
|
|
|
-// return R.fail(500,"存在未验真或验真未通过发票,不可进行账款关联");
|
|
|
- }
|
|
|
- //贸易日期前一个月
|
|
|
- Calendar startDate = Calendar.getInstance();
|
|
|
- startDate.setTime(date);
|
|
|
- startDate.add(Calendar.MONTH,-1);
|
|
|
- Date start = startDate.getTime();
|
|
|
- //付款日期后两个月
|
|
|
- Calendar endDate = Calendar.getInstance();
|
|
|
- endDate.setTime(payDate);
|
|
|
- endDate.add(Calendar.MONTH,2);
|
|
|
- Date end = endDate.getTime();
|
|
|
- if(start.compareTo(ziiDateParse) > 0 || end.compareTo(ziiDateParse) < 0){
|
|
|
- return R.fail(500,"存在不符合账款期限内发票,不可进行账款关联");
|
|
|
- }
|
|
|
ZcInvoiceInf zcInvoiceInf = new ZcInvoiceInf();
|
|
|
String id = IdUtils.fastSimpleUUID();
|
|
|
zcInvoiceInf.setZiiId(id);
|
|
|
@@ -437,6 +445,36 @@ public class OwnBillController extends BaseController {
|
|
|
if(fileList.size() == 0){
|
|
|
return R.fail(500,"往来账款发票数据不能为空,请上传发票后重试");
|
|
|
}
|
|
|
+ //校验发票
|
|
|
+ for (Map<String,String> file : fileList) {
|
|
|
+ //开票日期
|
|
|
+ String ziiDate = CommonUtil.objToString(file.get("ziiDate"));
|
|
|
+ Date ziiDateParse = sdf.parse(ziiDate);
|
|
|
+ //校验结果
|
|
|
+ String ziiCheckStt = CommonUtil.objToString(file.get("ziiCheckStt"));
|
|
|
+ if (!"1".equals(ziiCheckStt)) {
|
|
|
+// return R.fail(500,"存在未验真或验真未通过发票,不可进行账款关联");
|
|
|
+ }
|
|
|
+ //贸易日期前一个月
|
|
|
+ Calendar startDate = Calendar.getInstance();
|
|
|
+ startDate.setTime(date);
|
|
|
+ startDate.add(Calendar.MONTH, -1);
|
|
|
+ Date start = startDate.getTime();
|
|
|
+ //付款日期后两个月
|
|
|
+ Calendar endDate = Calendar.getInstance();
|
|
|
+ endDate.setTime(payDate);
|
|
|
+ endDate.add(Calendar.MONTH, 2);
|
|
|
+ Date end = endDate.getTime();
|
|
|
+ if (start.compareTo(ziiDateParse) > 0 || end.compareTo(ziiDateParse) < 0) {
|
|
|
+ return R.fail(500, "存在不符合账款期限内发票,不可进行账款关联");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //查询关联往来账款的附件
|
|
|
+ LambdaQueryWrapper<ZcBillInvoiceRel> lambdaQueryWrapperInvoice = new LambdaQueryWrapper<>();
|
|
|
+ //往来账款id
|
|
|
+ lambdaQueryWrapperInvoice.eq(ZcBillInvoiceRel::getZbirBillId,zbiId);
|
|
|
+ //删除旧关联
|
|
|
+ iZcBillInvoiceRelService.deleteZcBillInvoiceRel(lambdaQueryWrapperInvoice);
|
|
|
for (Map<String,String> file : fileList) {
|
|
|
//发票id
|
|
|
String ziiId = CommonUtil.objToString(file.get("ziiId"));
|
|
|
@@ -469,22 +507,6 @@ public class OwnBillController extends BaseController {
|
|
|
String ziiCheckStt = CommonUtil.objToString(file.get("ziiCheckStt"));
|
|
|
//附件
|
|
|
String ziiFile = CommonUtil.objToString(file.get("ziiFile"));
|
|
|
- if (!"1".equals(ziiCheckStt)) {
|
|
|
-// return R.fail(500,"存在未验真或验真未通过发票,不可进行账款关联");
|
|
|
- }
|
|
|
- //贸易日期前一个月
|
|
|
- Calendar startDate = Calendar.getInstance();
|
|
|
- startDate.setTime(date);
|
|
|
- startDate.add(Calendar.MONTH,-1);
|
|
|
- Date start = startDate.getTime();
|
|
|
- //付款日期后两个月
|
|
|
- Calendar endDate = Calendar.getInstance();
|
|
|
- endDate.setTime(payDate);
|
|
|
- endDate.add(Calendar.MONTH,2);
|
|
|
- Date end = endDate.getTime();
|
|
|
- if(start.compareTo(ziiDateParse) > 0 || end.compareTo(ziiDateParse) < 0){
|
|
|
- return R.fail(500,"存在不符合账款期限内发票,不可进行账款关联");
|
|
|
- }
|
|
|
ZcInvoiceInf zcInvoiceInf = new ZcInvoiceInf();
|
|
|
zcInvoiceInf.setZiiNo(ziiNo);
|
|
|
zcInvoiceInf.setZiiNumber(ziiNumber);
|
|
|
@@ -519,6 +541,11 @@ public class OwnBillController extends BaseController {
|
|
|
zcInvoiceInf.setUpdateTime(DateUtils.getNowDate());
|
|
|
//创建发票
|
|
|
iZcInvoiceInfService.updateZcInvoiceInf(zcInvoiceInf);
|
|
|
+ //创建账款发票关联
|
|
|
+ ZcBillInvoiceRel zcBillInvoiceRel = new ZcBillInvoiceRel();
|
|
|
+ zcBillInvoiceRel.setZbirBillId(zbiId);
|
|
|
+ zcBillInvoiceRel.setZbirInvoiceId(ziiId);
|
|
|
+ iZcBillInvoiceRelService.createZcBillInvoiceRel(zcBillInvoiceRel);
|
|
|
}
|
|
|
}
|
|
|
//查询关联往来账款的附件
|