|
|
|
@ -6,13 +6,10 @@ import com.dxhy.base.common.constant.OrderManagementConstant; |
|
|
|
|
import com.dxhy.base.common.model.OrderInfo; |
|
|
|
|
import com.dxhy.base.common.model.R; |
|
|
|
|
import com.dxhy.base.common.utils.DecimalCalculateUtil; |
|
|
|
|
import com.dxhy.base.service.module.buyer.model.BuyerEntity; |
|
|
|
|
import com.dxhy.base.service.module.buyer.service.BuyerService; |
|
|
|
|
import com.dxhy.base.service.module.thirdservice.simsback.model.TaxEquipmentInfo; |
|
|
|
|
import com.dxhy.base.service.module.thirdservice.simsback.service.SimsBackService; |
|
|
|
|
import com.dxhy.base.service.module.thirdservice.user.model.DeptEntity; |
|
|
|
|
import com.dxhy.base.service.module.thirdservice.user.service.UserInfoService; |
|
|
|
|
import com.dxhy.base.service.openapi.protocol.qd.PageGfxxReq; |
|
|
|
|
import com.dxhy.base.thirdservice.module.base.service.BaseService; |
|
|
|
|
import com.dxhy.base.thirdservice.module.thirdservice.redis.service.RedissonService; |
|
|
|
|
import com.dxhy.management.common.constant.ConfigureConstant; |
|
|
|
@ -49,6 +46,7 @@ import org.redisson.api.RLock; |
|
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
|
import java.math.BigDecimal; |
|
|
|
|
import java.math.RoundingMode; |
|
|
|
@ -80,8 +78,6 @@ public class YyOrderServiceImpl implements OrderService { |
|
|
|
|
@Resource |
|
|
|
|
private AllocateInvoiceInterfaceServiceV3 allocateInvoiceInterfaceServiceImplV3; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private BuyerService buyerService; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private SimsBackService simsBackService; |
|
|
|
@ -184,8 +180,14 @@ public class YyOrderServiceImpl implements OrderService { |
|
|
|
|
try { |
|
|
|
|
if (locked){ |
|
|
|
|
List<YyOrderItemInfo> yyOrderItemInfoList = yyOrderItemInfoMapper.queryOrderItemInfo(yyOrderInfo.getId()); |
|
|
|
|
boolean fpresent = yyOrderItemInfoList.stream().anyMatch(item->DecimalCalculateUtil.stringLessZero(item.getIsum())); |
|
|
|
|
boolean zpresent = yyOrderItemInfoList.stream().anyMatch(item->DecimalCalculateUtil.stringMoreZero(item.getIsum())); |
|
|
|
|
if (fpresent && zpresent && yyOrderItemInfoList.size() > ConfigureConstant.INT_2){ |
|
|
|
|
backMessage.add(String.format(message, yyOrderInfo.getCdlcode(), "含有负数行订单明细不能超过两行")); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
if (CollectionUtils.isNotEmpty(yyOrderItemInfoList)) { |
|
|
|
|
DdpcxxReqBO ddpcxxReqBO = transitionReadData(yyOrderInfo, yyOrderItemInfoList, deptEntity); |
|
|
|
|
DdpcxxReqBO ddpcxxReqBO = transitionReadData(fpresent && zpresent,yyOrderInfo, yyOrderItemInfoList, deptEntity); |
|
|
|
|
DdpcxxRspBO ddpcxxRspBO = allocateInvoiceInterfaceServiceImplV3.allocateInvoicesV3(ddpcxxReqBO, "", null, ConfigurerInfo.INTERFACE_VERSION_V6); |
|
|
|
|
log.debug("V3生成预制返回信息:{}", JSON.toJSONString(ddpcxxRspBO)); |
|
|
|
|
String format = String.format(message, yyOrderInfo.getCdlcode(), ddpcxxRspBO.getZTXX()); |
|
|
|
@ -295,8 +297,19 @@ public class YyOrderServiceImpl implements OrderService { |
|
|
|
|
DynamicContextHolder.push(ConfigureConstant.MAIN); |
|
|
|
|
tInvoiceInvmapMapper.deleteBackMsg(fphm); |
|
|
|
|
for (NewTable newTable : newTableList) { |
|
|
|
|
//判断是否存在逗号
|
|
|
|
|
log.debug("cdlCode:{}", newTable.getCDLCode()); |
|
|
|
|
List<String> ddhList = new ArrayList<>(); |
|
|
|
|
if (newTable.getCDLCode().contains(",") || newTable.getCDLCode().contains(",")){ |
|
|
|
|
String[] ddhs = newTable.getCDLCode().replace(",", ",").split(","); |
|
|
|
|
ddhList = Arrays.asList(ddhs); |
|
|
|
|
}else { |
|
|
|
|
ddhList.add(newTable.getCDLCode()); |
|
|
|
|
} |
|
|
|
|
log.debug("cdlCodeList:{}", JSON.toJSONString(ddhList)); |
|
|
|
|
for (String cdlCode : ddhList) { |
|
|
|
|
DynamicContextHolder.push(nsrsbh); |
|
|
|
|
List<InvoiceBpmmap> ddbhList = yyOrderMapper.getDdbh(newTable.getCDLCode()); |
|
|
|
|
List<InvoiceBpmmap> ddbhList = yyOrderMapper.getDdbh(cdlCode); |
|
|
|
|
log.debug("查询到中间表信息:{}", JSON.toJSONString(ddbhList)); |
|
|
|
|
if (CollectionUtils.isNotEmpty(ddbhList)) { |
|
|
|
|
for (InvoiceBpmmap invoiceBpmmap : ddbhList) { |
|
|
|
@ -304,6 +317,7 @@ public class YyOrderServiceImpl implements OrderService { |
|
|
|
|
BeanUtil.copyProperties(newTable, newTableFull); |
|
|
|
|
newTableFull.setBpmNo(invoiceBpmmap.getBpmno()); |
|
|
|
|
newTableFull.setBpmlsNo(invoiceBpmmap.getBpmlsno()); |
|
|
|
|
newTableFull.setCDLCode(cdlCode); |
|
|
|
|
DynamicContextHolder.push(ConfigureConstant.MAIN); |
|
|
|
|
count += tInvoiceInvmapMapper.insertBackMsg(newTableFull); |
|
|
|
|
} |
|
|
|
@ -311,6 +325,8 @@ public class YyOrderServiceImpl implements OrderService { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return count; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -361,7 +377,7 @@ public class YyOrderServiceImpl implements OrderService { |
|
|
|
|
return ConfigureConstant.INT_1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public DdpcxxReqBO transitionReadData(YyOrderInfo yyOrderInfo, List<YyOrderItemInfo> yyOrderItemInfoList, DeptEntity deptEntity) { |
|
|
|
|
public DdpcxxReqBO transitionReadData(boolean isZk,YyOrderInfo yyOrderInfo, List<YyOrderItemInfo> yyOrderItemInfoList, DeptEntity deptEntity) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TaxEquipmentInfo taxEquipmentInfo = simsBackService.queryTaxEquipment(deptEntity.getTaxpayerCode(), deptEntity.getDeptId()); |
|
|
|
@ -411,7 +427,6 @@ public class YyOrderServiceImpl implements OrderService { |
|
|
|
|
String invoiceAmount = ConfigureConstant.STRING_0; |
|
|
|
|
String taxAmount = ConfigureConstant.STRING_0; |
|
|
|
|
|
|
|
|
|
boolean isZk = yyOrderItemInfoList.size()>ConfigureConstant.INT_1; |
|
|
|
|
String xmmc = yyOrderItemInfoList.get(ConfigureConstant.INT_0).getCinvname(); |
|
|
|
|
if (isZk){ |
|
|
|
|
List<YyOrderItemInfo> collect = yyOrderItemInfoList.stream().filter(item -> DecimalCalculateUtil.stringCompare(item.getIsum(), ConfigureConstant.STRING_0) > ConfigureConstant.INT_0).collect(Collectors.toList()); |
|
|
|
|