|
|
|
@ -21,7 +21,6 @@ import com.dxhy.erp.model.auth.InterfaceCode; |
|
|
|
|
import com.dxhy.erp.service.InvoiceAuthService; |
|
|
|
|
import com.dxhy.erp.service.TDxInvoiceReimburseService; |
|
|
|
|
import com.dxhy.erp.utils.CheckUtils; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import com.dxhy.erp.utils.DateUtil; |
|
|
|
|
import com.google.common.collect.Maps; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
@ -44,7 +43,7 @@ import java.util.stream.Collectors; |
|
|
|
|
@Service |
|
|
|
|
@Slf4j |
|
|
|
|
public class InvoiceAuthServiceImpl extends MpBaseServiceImpl<RecordInvoiceDao, RecordInvoice> |
|
|
|
|
implements InvoiceAuthService { |
|
|
|
|
implements InvoiceAuthService { |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
AuthRecordDao authRecordDao; |
|
|
|
@ -59,7 +58,7 @@ public class InvoiceAuthServiceImpl extends MpBaseServiceImpl<RecordInvoiceDao, |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public String applyInvoiceAuth(GlobalInfo globalInfo, Map<String, String> map, HttpServletRequest request, |
|
|
|
|
HttpServletResponse response, Authorize authorize) { |
|
|
|
|
HttpServletResponse response, Authorize authorize) { |
|
|
|
|
ReturnStateInfo run = new ReturnStateInfo(); |
|
|
|
|
InterfaceCode interfaceCode = new InterfaceCode(); |
|
|
|
|
AuthDateReq data = null; |
|
|
|
@ -86,7 +85,7 @@ public class InvoiceAuthServiceImpl extends MpBaseServiceImpl<RecordInvoiceDao, |
|
|
|
|
interfaceCode.setReturnStateInfo(run); |
|
|
|
|
return JSON.toJSONString(interfaceCode); |
|
|
|
|
} |
|
|
|
|
List<Map<String, Object>> authStateList = (List<Map<String, Object>>)data.getInvoices(); |
|
|
|
|
List<Map<String, Object>> authStateList = (List<Map<String, Object>>) data.getInvoices(); |
|
|
|
|
run = getCheckData(authStateList, data.getContentRows()); |
|
|
|
|
if (run.getReturnCode() != null || run.getReturnMessage() != null) { |
|
|
|
|
interfaceCode.setReturnStateInfo(run); |
|
|
|
@ -126,39 +125,39 @@ public class InvoiceAuthServiceImpl extends MpBaseServiceImpl<RecordInvoiceDao, |
|
|
|
|
} |
|
|
|
|
for (Map<String, Object> authState : authStateList) { |
|
|
|
|
DynamicContextHolder.push(dbName + DbConstant.BUSINESS_READ); |
|
|
|
|
TdxRecordInvoice recordInvoice = tDxrecordInvoiceDao.getRecordInvoice((String)authState.get("buyerTaxNo"), |
|
|
|
|
(String)authState.get("invoiceCode"), (String)authState.get("invoiceNo")); |
|
|
|
|
TdxRecordInvoice recordInvoice = tDxrecordInvoiceDao.getRecordInvoice((String) authState.get("buyerTaxNo"), |
|
|
|
|
(String) authState.get("invoiceCode"), (String) authState.get("invoiceNo")); |
|
|
|
|
DynamicContextHolder.push(dbName + DbConstant.BUSINESS_WRITE); |
|
|
|
|
if (recordInvoice != null) { |
|
|
|
|
if ("01".equals(recordInvoice.getInvoiceType()) || "03".equals(recordInvoice.getInvoiceType()) |
|
|
|
|
|| "08".equals(recordInvoice.getInvoiceType()) || "14".equals(recordInvoice.getInvoiceType()) |
|
|
|
|
|| "08".equals(recordInvoice.getInvoiceType()) || "14".equals(recordInvoice.getInvoiceType()) |
|
|
|
|
|| "31".equals(recordInvoice.getInvoiceType())) { |
|
|
|
|
if ("5".equals(data.getApplyRzlx())) { |
|
|
|
|
if (!"4".equals(recordInvoice.getCxrzStatus()) && !"2".equals(recordInvoice.getCxrzStatus()) |
|
|
|
|
&& !"1".equals(recordInvoice.getCxrzStatus())) { |
|
|
|
|
String invoiceCode = StringUtils.isBlank((String)authState.get("invoiceCode"))?"":(String)authState.get("invoiceCode"); |
|
|
|
|
tDxrecordInvoiceDao.updateCxrz((String)authState.get("applyTaxPeriod"), |
|
|
|
|
invoiceCode+ (String)authState.get("invoiceNo")); |
|
|
|
|
&& !"1".equals(recordInvoice.getCxrzStatus())) { |
|
|
|
|
String invoiceCode = StringUtils.isBlank((String) authState.get("invoiceCode")) ? "" : (String) authState.get("invoiceCode"); |
|
|
|
|
tDxrecordInvoiceDao.updateCxrz((String) authState.get("applyTaxPeriod"), |
|
|
|
|
invoiceCode + (String) authState.get("invoiceNo")); |
|
|
|
|
} |
|
|
|
|
} else if ("6".equals(data.getApplyRzlx())) { |
|
|
|
|
if (!"4".equals(recordInvoice.getCxbdkStatus()) && !"2".equals(recordInvoice.getCxbdkStatus()) |
|
|
|
|
&& !"1".equals(recordInvoice.getCxrzStatus())) { |
|
|
|
|
String invoiceCode = StringUtils.isBlank((String)authState.get("invoiceCode"))?"":(String)authState.get("invoiceCode"); |
|
|
|
|
tDxrecordInvoiceDao.updateCxbdk((String)authState.get("applyTaxPeriod"), |
|
|
|
|
invoiceCode + (String)authState.get("invoiceNo")); |
|
|
|
|
&& !"1".equals(recordInvoice.getCxrzStatus())) { |
|
|
|
|
String invoiceCode = StringUtils.isBlank((String) authState.get("invoiceCode")) ? "" : (String) authState.get("invoiceCode"); |
|
|
|
|
tDxrecordInvoiceDao.updateCxbdk((String) authState.get("applyTaxPeriod"), |
|
|
|
|
invoiceCode + (String) authState.get("invoiceNo")); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
if (!"4".equals(recordInvoice.getAuthStatus()) && !"3".equals(recordInvoice.getAuthStatus()) |
|
|
|
|
&& !"2".equals(recordInvoice.getAuthStatus())) { |
|
|
|
|
&& !"2".equals(recordInvoice.getAuthStatus())) { |
|
|
|
|
if ("1".equals(data.getApplyRzlx())) { |
|
|
|
|
tDxrecordInvoiceDao.updateRz(authState, data.getApplyRzlx(), "1", |
|
|
|
|
recordInvoice.getUuid()); |
|
|
|
|
recordInvoice.getUuid()); |
|
|
|
|
} else if ("4".equals(data.getApplyRzlx())) { |
|
|
|
|
tDxrecordInvoiceDao.updateRz(authState, data.getApplyRzlx(), "2", |
|
|
|
|
recordInvoice.getUuid()); |
|
|
|
|
recordInvoice.getUuid()); |
|
|
|
|
} else { |
|
|
|
|
tDxrecordInvoiceDao.updateRz(authState, data.getApplyRzlx(), "99", |
|
|
|
|
recordInvoice.getUuid()); |
|
|
|
|
recordInvoice.getUuid()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -179,17 +178,17 @@ public class InvoiceAuthServiceImpl extends MpBaseServiceImpl<RecordInvoiceDao, |
|
|
|
|
for (Map<String, Object> map : list) { |
|
|
|
|
AuthRecord authRecord = new AuthRecord(); |
|
|
|
|
authRecord.setBatchNo(batchNo); |
|
|
|
|
authRecord.setInvoiceCode((String)map.get("invoiceCode")); |
|
|
|
|
authRecord.setInvoiceNo((String)map.get("invoiceNo")); |
|
|
|
|
authRecord.setUuid(map.get("invoiceCode") + (String)map.get("invoiceNo")); |
|
|
|
|
authRecord.setInvoiceCode((String) map.get("invoiceCode")); |
|
|
|
|
authRecord.setInvoiceNo((String) map.get("invoiceNo")); |
|
|
|
|
authRecord.setUuid(map.get("invoiceCode") + (String) map.get("invoiceNo")); |
|
|
|
|
if (StringUtils.isBlank(rzlx)) { |
|
|
|
|
authRecord.setRzlx("1"); |
|
|
|
|
} else { |
|
|
|
|
authRecord.setRzlx(rzlx); |
|
|
|
|
} |
|
|
|
|
authRecord.setApplyTaxPeriod((String)map.get("applyTaxPeriod")); |
|
|
|
|
authRecord.setBuyerTaxNo((String)map.get("buyerTaxNo")); |
|
|
|
|
authRecord.setYxse((String)map.get("taxCredit")); |
|
|
|
|
authRecord.setApplyTaxPeriod((String) map.get("applyTaxPeriod")); |
|
|
|
|
authRecord.setBuyerTaxNo((String) map.get("buyerTaxNo")); |
|
|
|
|
authRecord.setYxse((String) map.get("taxCredit")); |
|
|
|
|
authRecord.setCreateDate(new Date()); |
|
|
|
|
authRecordList.add(authRecord); |
|
|
|
|
} |
|
|
|
@ -198,7 +197,7 @@ public class InvoiceAuthServiceImpl extends MpBaseServiceImpl<RecordInvoiceDao, |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public String getAuthResult(GlobalInfo globalInfo, Map<String, String> map, HttpServletRequest request, |
|
|
|
|
HttpServletResponse response, Authorize authorize) { |
|
|
|
|
HttpServletResponse response, Authorize authorize) { |
|
|
|
|
ReturnStateInfo run = new ReturnStateInfo(); |
|
|
|
|
InterfaceCode interfaceCode = new InterfaceCode(); |
|
|
|
|
AuthDateReq data = null; |
|
|
|
@ -289,22 +288,22 @@ public class InvoiceAuthServiceImpl extends MpBaseServiceImpl<RecordInvoiceDao, |
|
|
|
|
} else { |
|
|
|
|
authStatus.setTaxCredit(""); |
|
|
|
|
} |
|
|
|
|
if("5".equals(authStatus.getRzlx())){ |
|
|
|
|
if ("5".equals(authStatus.getRzlx())) { |
|
|
|
|
authStatus.setAuthState(authStatus.getCxrzStatus()); |
|
|
|
|
} |
|
|
|
|
if(StringUtils.isBlank(authStatus.getInvoiceCode())){ |
|
|
|
|
if (StringUtils.isBlank(authStatus.getInvoiceCode())) { |
|
|
|
|
authStatus.setInvoiceCode(""); |
|
|
|
|
} |
|
|
|
|
authStatus.setTaxCredit(""); |
|
|
|
|
if ("1".equals(authStatus.getRzlx()) || "4".equals(authStatus.getRzlx())) { |
|
|
|
|
if(StringUtils.isNotBlank(authStatus.getTaxCredit())){ |
|
|
|
|
if (StringUtils.isNotBlank(authStatus.getTaxCredit())) { |
|
|
|
|
authStatus.setTaxCredit(df.format(new BigDecimal(authStatus.getTaxCredit()))); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if("5".equals(authStatus.getRzlx())){ |
|
|
|
|
if ("5".equals(authStatus.getRzlx())) { |
|
|
|
|
authStatus.setAuthState(authStatus.getCxrzStatus()); |
|
|
|
|
} |
|
|
|
|
if("6".equals(authStatus.getRzlx())){ |
|
|
|
|
if ("6".equals(authStatus.getRzlx())) { |
|
|
|
|
authStatus.setAuthState(authStatus.getCxbdkStatus()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -332,11 +331,11 @@ public class InvoiceAuthServiceImpl extends MpBaseServiceImpl<RecordInvoiceDao, |
|
|
|
|
StringBuilder promsg = new StringBuilder(); |
|
|
|
|
String zdata2 = isInput.getZDATA(); |
|
|
|
|
List<ZDATA> zdata = JSON.parseArray(zdata2, ZDATA.class); |
|
|
|
|
AuthDateReq authDateReq=new AuthDateReq(); |
|
|
|
|
AuthDateReq authDateReq = new AuthDateReq(); |
|
|
|
|
authDateReq.setBatchNo(isInput.getSAPKEY()); |
|
|
|
|
authDateReq.setApplyRzlx("1"); |
|
|
|
|
StringBuilder errorMsg = new StringBuilder(); |
|
|
|
|
DynamicContextHolder.push("business"+DbConstant.BUSINESS_READ); |
|
|
|
|
DynamicContextHolder.push("business" + DbConstant.BUSINESS_READ); |
|
|
|
|
List<String> fplxList = new ArrayList<>(); |
|
|
|
|
fplxList.add("01"); |
|
|
|
|
fplxList.add("03"); |
|
|
|
@ -347,115 +346,125 @@ public class InvoiceAuthServiceImpl extends MpBaseServiceImpl<RecordInvoiceDao, |
|
|
|
|
fplxList.add("14"); |
|
|
|
|
fplxList.add("31"); |
|
|
|
|
fplxList.add("32"); |
|
|
|
|
for(ZDATA zdata1:zdata){ |
|
|
|
|
log.info("zdata1.getZFPHM()===>{}",zdata1.getZFPHM()); |
|
|
|
|
for (ZDATA zdata1 : zdata) { |
|
|
|
|
log.info("zdata1.getZFPHM()===>{}", zdata1.getZFPHM()); |
|
|
|
|
String collect = fplxList.stream().collect(Collectors.joining(",")); |
|
|
|
|
if(!collect.contains(convertFpzldm(zdata1.getZFPLX()))){ |
|
|
|
|
log.info("非增值税先不处理:{}",JSON.toJSONString(zdata1)); |
|
|
|
|
if (!collect.contains(convertFpzldm(zdata1.getZFPLX()))) { |
|
|
|
|
log.info("非增值税先不处理:{}", JSON.toJSONString(zdata1)); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
String fphm = zdata1.getZFPHM(); |
|
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(fphm) && fphm.length() > 8 && !("26".equals(zdata1.getZFPLX()) || "27".equals(zdata1.getZFPLX()))){ |
|
|
|
|
fphm = fphm.replace(zdata1.getZFPDM(),""); |
|
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(fphm) && fphm.length() > 8 && !("26".equals(zdata1.getZFPLX()) || "27".equals(zdata1.getZFPLX()))) { |
|
|
|
|
fphm = fphm.replace(zdata1.getZFPDM(), ""); |
|
|
|
|
log.info("非全电但是号码"); |
|
|
|
|
} |
|
|
|
|
log.info("发票号码{}",fphm); |
|
|
|
|
String uuid = zdata1.getZFPDM()+fphm; |
|
|
|
|
log.info("发票号码{}", fphm); |
|
|
|
|
String uuid = zdata1.getZFPDM() + fphm; |
|
|
|
|
zdata1.setZFPLX(convertFpzldm(zdata1.getZFPLX())); |
|
|
|
|
TdxRecordInvoice recordInvoiceByUuid = tDxrecordInvoiceDao.getRecordInvoiceByUuid(uuid); |
|
|
|
|
//查询票池
|
|
|
|
|
//查询票池
|
|
|
|
|
QueryWrapper<TDxInvoiceReimburse> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
queryWrapper.eq("uuid",uuid); |
|
|
|
|
queryWrapper.eq("uuid", uuid); |
|
|
|
|
TDxInvoiceReimburse tDxInvoiceReimburse = tDxInvoiceReimburseService.getBaseMapper().selectOne(queryWrapper); |
|
|
|
|
//没法区分来源是不是销项发票
|
|
|
|
|
TdxSaleRecordInvoice tdxSaleRecordInvoice = tdxSaleRecordInvoiceDao.selectByUuid(uuid); |
|
|
|
|
if(recordInvoiceByUuid==null && tDxInvoiceReimburse==null && tdxSaleRecordInvoice==null){ |
|
|
|
|
errorMsg.append("发票号码:"+zdata1.getZFPHM()); |
|
|
|
|
if (recordInvoiceByUuid == null && tDxInvoiceReimburse == null && tdxSaleRecordInvoice == null) { |
|
|
|
|
errorMsg.append("发票号码:" + zdata1.getZFPHM()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if(errorMsg.length()>1){ |
|
|
|
|
es.setZMESSAGE(errorMsg.toString()+"不存在"); |
|
|
|
|
if (errorMsg.length() > 1) { |
|
|
|
|
es.setZMESSAGE(errorMsg.toString() + "不存在"); |
|
|
|
|
es.setZTYPE("E"); |
|
|
|
|
return es; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for(ZDATA zdata1:zdata){ |
|
|
|
|
for (ZDATA zdata1 : zdata) { |
|
|
|
|
//成功或者失败标识
|
|
|
|
|
boolean flag = false; |
|
|
|
|
log.info("zdata1.getZFPHM():{}",zdata1.getZFPHM()); |
|
|
|
|
log.info("zdata1.getZFPHM():{}", zdata1.getZFPHM()); |
|
|
|
|
String fphm = zdata1.getZFPHM(); |
|
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(fphm) && fphm.length() > 8 && !("26".equals(zdata1.getZFPLX()) || "27".equals(zdata1.getZFPLX()))){ |
|
|
|
|
fphm = fphm.replace(zdata1.getZFPDM(),""); |
|
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(fphm) && fphm.length() > 8 && !("26".equals(zdata1.getZFPLX()) || "27".equals(zdata1.getZFPLX()))) { |
|
|
|
|
fphm = fphm.replace(zdata1.getZFPDM(), ""); |
|
|
|
|
log.info("非全电但是号码"); |
|
|
|
|
} |
|
|
|
|
log.info("发票号码{}",fphm); |
|
|
|
|
String uuid = zdata1.getZFPDM()+fphm; |
|
|
|
|
log.info("发票号码{}", fphm); |
|
|
|
|
String uuid = zdata1.getZFPDM() + fphm; |
|
|
|
|
//销项标识
|
|
|
|
|
String xxbs = zdata1.getXXBS(); |
|
|
|
|
DynamicContextHolder.push("business"+DbConstant.BUSINESS_READ); |
|
|
|
|
if(fplxList.contains(zdata1.getZFPLX()) && !"X".equalsIgnoreCase(xxbs)){ |
|
|
|
|
DynamicContextHolder.push("business" + DbConstant.BUSINESS_READ); |
|
|
|
|
if (fplxList.contains(zdata1.getZFPLX()) && !"X".equalsIgnoreCase(xxbs)) { |
|
|
|
|
TdxRecordInvoice recordInvoiceByUuid = tDxrecordInvoiceDao.getRecordInvoiceByUuid(uuid); |
|
|
|
|
if(recordInvoiceByUuid!=null){ |
|
|
|
|
UpdateWrapper updateWrapper = convertRecordInvoice(zdata1,uuid); |
|
|
|
|
DynamicContextHolder.push("business"+DbConstant.BUSINESS_WRITE); |
|
|
|
|
if (recordInvoiceByUuid != null) { |
|
|
|
|
UpdateWrapper updateWrapper = new UpdateWrapper(); |
|
|
|
|
updateWrapper.eq("uuid", uuid); |
|
|
|
|
//凭证号
|
|
|
|
|
updateWrapper.set("sn_voucher_number", zdata1.getBELNR()); |
|
|
|
|
//凭证过账日期
|
|
|
|
|
updateWrapper.set("posting_time", zdata1.getBUDAT()); |
|
|
|
|
//账期
|
|
|
|
|
updateWrapper.set("account_period", zdata1.getBUDAT().substring(0, 7)); |
|
|
|
|
//报账单号
|
|
|
|
|
updateWrapper.set("bzdh", zdata1.getZBZDH()); |
|
|
|
|
//入账状态
|
|
|
|
|
updateWrapper.set("inaccount_status", zdata1.getZYWZT()); |
|
|
|
|
updateWrapper.set("comp_code", zdata1.getZGSDM()); |
|
|
|
|
updateWrapper.set("bzr", zdata1.getZJBRT()); |
|
|
|
|
DynamicContextHolder.push("business" + DbConstant.BUSINESS_WRITE); |
|
|
|
|
int update = tDxrecordInvoiceDao.update(null, updateWrapper); |
|
|
|
|
if(update>0){ |
|
|
|
|
if (update > 0) { |
|
|
|
|
DynamicContextHolder.push(DbConstant.BASICS_READ); |
|
|
|
|
SysDeptEntity org = sysDeptDao.getOrg(recordInvoiceByUuid.getGfTaxNo()); |
|
|
|
|
zdata1.setZFPLX(convertFpzldm(zdata1.getZFPLX())); |
|
|
|
|
//如果设置的自动认证走申请认证逻辑
|
|
|
|
|
if(org!=null && "1".equals(org.getAutoRz()) && ("01".equals(zdata1.getZFPLX()) || "03".equals(zdata1.getZFPLX()) |
|
|
|
|
if (org != null && "1".equals(org.getAutoRz()) && ("01".equals(zdata1.getZFPLX()) || "03".equals(zdata1.getZFPLX()) |
|
|
|
|
|| "08".equals(zdata1.getZFPLX()) || "14".equals(zdata1.getZFPLX()) |
|
|
|
|
|| "31".equals(zdata1.getZFPLX())) && StringUtils.isNotBlank(zdata1.getBUDAT())){ |
|
|
|
|
if(!"4".equals(recordInvoiceByUuid.getAuthStatus()) && !"3".equals(recordInvoiceByUuid.getAuthStatus()) |
|
|
|
|
&& !"2".equals(recordInvoiceByUuid.getAuthStatus())){ |
|
|
|
|
Map<String,Object> authState = new HashMap<>(); |
|
|
|
|
authState.put("rz_user",zdata1.getZJBRT()); |
|
|
|
|
authState.put("applyTaxPeriod",zdata1.getBUDAT().substring(0,7).replace("-","")); |
|
|
|
|
DynamicContextHolder.push("business"+DbConstant.BUSINESS_WRITE); |
|
|
|
|
tDxrecordInvoiceDao.updateRz(authState,"1","1",recordInvoiceByUuid.getUuid()); |
|
|
|
|
|| "31".equals(zdata1.getZFPLX())) && StringUtils.isNotBlank(zdata1.getBUDAT())) { |
|
|
|
|
if (!"4".equals(recordInvoiceByUuid.getAuthStatus()) && !"3".equals(recordInvoiceByUuid.getAuthStatus()) |
|
|
|
|
&& !"2".equals(recordInvoiceByUuid.getAuthStatus())) { |
|
|
|
|
Map<String, Object> authState = new HashMap<>(); |
|
|
|
|
authState.put("rz_user", zdata1.getZJBRT()); |
|
|
|
|
authState.put("applyTaxPeriod", zdata1.getBUDAT().substring(0, 7).replace("-", "")); |
|
|
|
|
DynamicContextHolder.push("business" + DbConstant.BUSINESS_WRITE); |
|
|
|
|
tDxrecordInvoiceDao.updateRz(authState, "1", "1", recordInvoiceByUuid.getUuid()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}else { |
|
|
|
|
UpdateWrapper updateWrapper = convertRecordInvoice(zdata1,uuid); |
|
|
|
|
DynamicContextHolder.push("business"+DbConstant.BUSINESS_WRITE); |
|
|
|
|
tDxInvoiceReimburseService.getBaseMapper().update(null,updateWrapper); |
|
|
|
|
} else { |
|
|
|
|
UpdateWrapper updateWrapper = convertRecordInvoice(zdata1, uuid); |
|
|
|
|
DynamicContextHolder.push("business" + DbConstant.BUSINESS_WRITE); |
|
|
|
|
tDxInvoiceReimburseService.getBaseMapper().update(null, updateWrapper); |
|
|
|
|
} |
|
|
|
|
if ("X".equalsIgnoreCase(xxbs)){ |
|
|
|
|
DynamicContextHolder.push("business"+DbConstant.BUSINESS_WRITE); |
|
|
|
|
UpdateWrapper updateWrapper = convertRecordInvoice(zdata1,uuid); |
|
|
|
|
tdxSaleRecordInvoiceDao.update(null,updateWrapper); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(!flag){ |
|
|
|
|
promsg.append("票据号码:"+zdata1.getZFPHM()+"绑定成功! "); |
|
|
|
|
} |
|
|
|
|
zdataresp.setPROMSG(promsg.toString()); |
|
|
|
|
zdataresp.setPROTYP("S"); |
|
|
|
|
es.setZMESSAGE("处理成功"); |
|
|
|
|
es.setZdata(zdataresp); |
|
|
|
|
return es; |
|
|
|
|
} |
|
|
|
|
zdataresp.setPROMSG(promsg.toString()); |
|
|
|
|
zdataresp.setPROTYP("S"); |
|
|
|
|
es.setZMESSAGE("处理成功"); |
|
|
|
|
es.setZdata(zdataresp); |
|
|
|
|
return es; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public UpdateWrapper convertRecordInvoice(ZDATA zdata,String uuid){ |
|
|
|
|
public UpdateWrapper convertRecordInvoice(ZDATA zdata, String uuid) { |
|
|
|
|
UpdateWrapper updateWrapper = new UpdateWrapper(); |
|
|
|
|
updateWrapper.set("sn_voucher_number",zdata.getBELNR()); |
|
|
|
|
updateWrapper.set("sn_voucher_number", zdata.getBELNR()); |
|
|
|
|
try { |
|
|
|
|
DateTime parse = DateTime.parse(zdata.getBUDAT()); |
|
|
|
|
updateWrapper.set("posting_time",zdata.getBUDAT()); |
|
|
|
|
updateWrapper.set("posting_time", zdata.getBUDAT()); |
|
|
|
|
//账期
|
|
|
|
|
updateWrapper.set("account_period",zdata.getBUDAT().substring(0,7)); |
|
|
|
|
updateWrapper.set("account_period", zdata.getBUDAT().substring(0, 7)); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("时间转换异常:{}",e); |
|
|
|
|
log.error("时间转换异常:{}", e); |
|
|
|
|
} |
|
|
|
|
updateWrapper.set("bzdh",zdata.getZBZDH()); |
|
|
|
|
updateWrapper.set("inaccount_status",zdata.getZYWZT()); |
|
|
|
|
updateWrapper.set("comp_code",zdata.getZGSDM()); |
|
|
|
|
updateWrapper.set("bzr",zdata.getZJBRT()); |
|
|
|
|
updateWrapper.eq("uuid",uuid); |
|
|
|
|
updateWrapper.set("bzdh", zdata.getZBZDH()); |
|
|
|
|
updateWrapper.set("inaccount_status", zdata.getZYWZT()); |
|
|
|
|
updateWrapper.set("comp_code", zdata.getZGSDM()); |
|
|
|
|
updateWrapper.set("bzr", zdata.getZJBRT()); |
|
|
|
|
updateWrapper.eq("uuid", uuid); |
|
|
|
|
return updateWrapper; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -475,24 +484,24 @@ public class InvoiceAuthServiceImpl extends MpBaseServiceImpl<RecordInvoiceDao, |
|
|
|
|
// return run;
|
|
|
|
|
// }
|
|
|
|
|
boolean r = |
|
|
|
|
!(CheckUtils.stringLength((String)map.get("invoiceNo"), 8) || CheckUtils.stringLength((String)map.get("invoiceNo"), 10) |
|
|
|
|
|| CheckUtils.stringLength((String)map.get("invoiceNo"), 18) || CheckUtils.stringLength((String)map.get("invoiceNo"), 20)); |
|
|
|
|
if (CheckUtils.isNullOrEmpty((String)map.get("invoiceNo")) || r) { |
|
|
|
|
!(CheckUtils.stringLength((String) map.get("invoiceNo"), 8) || CheckUtils.stringLength((String) map.get("invoiceNo"), 10) |
|
|
|
|
|| CheckUtils.stringLength((String) map.get("invoiceNo"), 18) || CheckUtils.stringLength((String) map.get("invoiceNo"), 20)); |
|
|
|
|
if (CheckUtils.isNullOrEmpty((String) map.get("invoiceNo")) || r) { |
|
|
|
|
run.setReturnCode(ReturnCodeEnum.DMHMBF.getFhzDm()); |
|
|
|
|
run.setReturnMessage(ReturnCodeEnum.DMHMBF.getFhzMc(ReturnCodeEnum.DMHMBF.getIndex())); |
|
|
|
|
} |
|
|
|
|
if (StringUtils.isBlank((String)map.get("applyTaxPeriod")) |
|
|
|
|
|| ((String)map.get("applyTaxPeriod")).length() != 6) { |
|
|
|
|
if (StringUtils.isBlank((String) map.get("applyTaxPeriod")) |
|
|
|
|
|| ((String) map.get("applyTaxPeriod")).length() != 6) { |
|
|
|
|
run.setReturnCode(ReturnCodeEnum.SKSSQBF.getFhzDm()); |
|
|
|
|
run.setReturnMessage(ReturnCodeEnum.SKSSQBF.getFhzMc(ReturnCodeEnum.SKSSQBF.getIndex())); |
|
|
|
|
return run; |
|
|
|
|
} |
|
|
|
|
if (StringUtils.isBlank((String)map.get("buyerTaxNo"))) { |
|
|
|
|
if (StringUtils.isBlank((String) map.get("buyerTaxNo"))) { |
|
|
|
|
run.setReturnCode(ReturnCodeEnum.SHBNWK.getFhzDm()); |
|
|
|
|
run.setReturnMessage(ReturnCodeEnum.SHBNWK.getFhzMc(ReturnCodeEnum.SHBNWK.getIndex())); |
|
|
|
|
return run; |
|
|
|
|
} |
|
|
|
|
if (StringUtils.isBlank((String)map.get("rz_user"))) { |
|
|
|
|
if (StringUtils.isBlank((String) map.get("rz_user"))) { |
|
|
|
|
run.setReturnCode(ReturnCodeEnum.RZRBNWK.getFhzDm()); |
|
|
|
|
run.setReturnMessage(ReturnCodeEnum.RZRBNWK.getFhzMc(ReturnCodeEnum.RZRBNWK.getIndex())); |
|
|
|
|
return run; |
|
|
|
@ -506,27 +515,27 @@ public class InvoiceAuthServiceImpl extends MpBaseServiceImpl<RecordInvoiceDao, |
|
|
|
|
} |
|
|
|
|
return run; |
|
|
|
|
} |
|
|
|
|
public String convertFpzldm(String fpzldm){ |
|
|
|
|
if("10".equals(fpzldm)){ |
|
|
|
|
fpzldm= FplxEnum.ZP.getFplxDm(); |
|
|
|
|
}else if("11".equals(fpzldm)){ |
|
|
|
|
fpzldm=FplxEnum.PP.getFplxDm(); |
|
|
|
|
}else if("12".equals(fpzldm)){ |
|
|
|
|
fpzldm=FplxEnum.DZP.getFplxDm(); |
|
|
|
|
}else if("13".equals(fpzldm)){ |
|
|
|
|
fpzldm=FplxEnum.JSP.getFplxDm(); |
|
|
|
|
}else if("14".equals(fpzldm)){ |
|
|
|
|
fpzldm=FplxEnum.JDC.getFplxDm(); |
|
|
|
|
}else if("15".equals(fpzldm)){ |
|
|
|
|
fpzldm=FplxEnum.ESC.getFplxDm(); |
|
|
|
|
}else if("24".equals(fpzldm)){ |
|
|
|
|
fpzldm=FplxEnum.TXF.getFplxDm(); |
|
|
|
|
}else if("25".equals(fpzldm)){ |
|
|
|
|
fpzldm=FplxEnum.DZZP.getFplxDm(); |
|
|
|
|
}else if("26".equals(fpzldm)){ |
|
|
|
|
fpzldm= FplxEnum.QDZZP.getFplxDm(); |
|
|
|
|
}else if("27".equals(fpzldm)){ |
|
|
|
|
fpzldm=FplxEnum.QDPP.getFplxDm(); |
|
|
|
|
public String convertFpzldm(String fpzldm) { |
|
|
|
|
if ("10".equals(fpzldm)) { |
|
|
|
|
fpzldm = FplxEnum.ZP.getFplxDm(); |
|
|
|
|
} else if ("11".equals(fpzldm)) { |
|
|
|
|
fpzldm = FplxEnum.PP.getFplxDm(); |
|
|
|
|
} else if ("12".equals(fpzldm)) { |
|
|
|
|
fpzldm = FplxEnum.DZP.getFplxDm(); |
|
|
|
|
} else if ("13".equals(fpzldm)) { |
|
|
|
|
fpzldm = FplxEnum.JSP.getFplxDm(); |
|
|
|
|
} else if ("14".equals(fpzldm)) { |
|
|
|
|
fpzldm = FplxEnum.JDC.getFplxDm(); |
|
|
|
|
} else if ("15".equals(fpzldm)) { |
|
|
|
|
fpzldm = FplxEnum.ESC.getFplxDm(); |
|
|
|
|
} else if ("24".equals(fpzldm)) { |
|
|
|
|
fpzldm = FplxEnum.TXF.getFplxDm(); |
|
|
|
|
} else if ("25".equals(fpzldm)) { |
|
|
|
|
fpzldm = FplxEnum.DZZP.getFplxDm(); |
|
|
|
|
} else if ("26".equals(fpzldm)) { |
|
|
|
|
fpzldm = FplxEnum.QDZZP.getFplxDm(); |
|
|
|
|
} else if ("27".equals(fpzldm)) { |
|
|
|
|
fpzldm = FplxEnum.QDPP.getFplxDm(); |
|
|
|
|
} |
|
|
|
|
return fpzldm; |
|
|
|
|
} |
|
|
|
@ -537,17 +546,17 @@ public class InvoiceAuthServiceImpl extends MpBaseServiceImpl<RecordInvoiceDao, |
|
|
|
|
DateTime parse1 = DateTime.parse("2012-12-01"); |
|
|
|
|
Date date11 = parse1.toDate(); |
|
|
|
|
HashMap<Object, Object> map = Maps.newHashMap(); |
|
|
|
|
map.put("1","3"); |
|
|
|
|
map.put("1", "3"); |
|
|
|
|
try { |
|
|
|
|
DateTime parse = DateTime.parse("0000-00-00"); |
|
|
|
|
map.put("2","3"); |
|
|
|
|
map.put("2", "3"); |
|
|
|
|
Date date1 = parse.toDate(); |
|
|
|
|
String s = parse.toString("yyyy-MM-dd "); |
|
|
|
|
System.out.println(""); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
// throw new RuntimeException(e);
|
|
|
|
|
} |
|
|
|
|
map.put("3","3"); |
|
|
|
|
map.put("3", "3"); |
|
|
|
|
System.out.println(); |
|
|
|
|
// String d="2023";
|
|
|
|
|
// String substring = d.substring(0, 7);
|
|
|
|
|