|
|
|
@ -4,7 +4,9 @@ import cn.hutool.core.date.DatePattern; |
|
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
|
|
|
|
import com.dxhy.common.constant.DbConstant; |
|
|
|
|
import com.dxhy.common.datasource.config.DynamicContextHolder; |
|
|
|
|
import com.dxhy.common.enums.FplxEnum; |
|
|
|
@ -40,6 +42,7 @@ import java.math.BigDecimal; |
|
|
|
|
import java.text.ParseException; |
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
|
import java.util.*; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 与山东能源交互数据主类 |
|
|
|
@ -88,12 +91,18 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { |
|
|
|
|
@Resource |
|
|
|
|
private TDxInvoiceReimburseDao invoiceReimburseDao; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private TdxRecordInvoiceDao tdxRecordInvoiceDao; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private BaseTDxRecordInvoiceDao baseTDxRecordInvoiceDao; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private TDxInvoiceReimburseService tDxInvoiceReimburseService; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private BaseTDxRecordInvoiceDetailDao baseTDxRecordInvoiceDetailDao; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private SysDeptDao sysDeptDao; |
|
|
|
|
|
|
|
|
@ -270,6 +279,48 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { |
|
|
|
|
return queryInvoiceResult; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public String getRecords(Map<String, Object> pramsMap) { |
|
|
|
|
DynamicContextHolder.push("business" + DbConstant.BUSINESS_WRITE); |
|
|
|
|
QueryWrapper<TdxRecordInvoice> recordWrapper = new QueryWrapper<>(); |
|
|
|
|
List<String> uuids = tdxRecordInvoiceDao.selectRecords(pramsMap); |
|
|
|
|
log.info("获取的uuid为{}",uuids); |
|
|
|
|
|
|
|
|
|
for (String uuid: uuids) { |
|
|
|
|
boolean flag = false; |
|
|
|
|
QueryWrapper<BaseTDxRecordInvoiceDetail> detailWrapper = new QueryWrapper<>(); |
|
|
|
|
detailWrapper.eq("uuid", uuid); |
|
|
|
|
DynamicContextHolder.push("business" + DbConstant.DETAIL_READ); |
|
|
|
|
List<BaseTDxRecordInvoiceDetail> details = baseTDxRecordInvoiceDetailDao.selectList(detailWrapper); |
|
|
|
|
DynamicContextHolder.push("business" + DbConstant.BUSINESS_READ); |
|
|
|
|
|
|
|
|
|
log.info("获取到的明细为:{}",details); |
|
|
|
|
String taxRate = ""; |
|
|
|
|
for(BaseTDxRecordInvoiceDetail detail : details){ |
|
|
|
|
//获取明细信息 更新主表税率
|
|
|
|
|
if(StringUtils.isNotEmpty(detail.getTaxRate())){ |
|
|
|
|
if(flag){ |
|
|
|
|
if(!taxRate.contains(detail.getTaxRate())) { |
|
|
|
|
taxRate = taxRate + "," + detail.getTaxRate(); |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
if(!taxRate.contains(detail.getTaxRate())) { |
|
|
|
|
taxRate = taxRate + detail.getTaxRate(); |
|
|
|
|
} |
|
|
|
|
flag = true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
log.info("获取的数据明细taxRate为={}",taxRate); |
|
|
|
|
Map<String, String> updateParam = new HashMap<>(); |
|
|
|
|
updateParam.put("taxRate",taxRate); |
|
|
|
|
updateParam.put("uuid",uuid); |
|
|
|
|
|
|
|
|
|
tdxRecordInvoiceDao.updateTaxRate(updateParam); |
|
|
|
|
} |
|
|
|
|
return "ok"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public JSONObject singleCheckInvoice(Map<String, String> pramsMap) throws Exception { |
|
|
|
|
|
|
|
|
|
//1.封装查验参数
|
|
|
|
|