|
@@ -14,10 +14,7 @@ import com.idea.buildManage.response.ParkRoomResponse;
|
|
|
import com.idea.customerManagement.dto.IntentionalDepositDto;
|
|
|
import com.idea.customerManagement.mapper.CustomerManagementMapper;
|
|
|
import com.idea.customerManagement.mapper.IntentionalDepositMapper;
|
|
|
-import com.idea.customerManagement.model.Buyer;
|
|
|
-import com.idea.customerManagement.model.BuyerExample;
|
|
|
-import com.idea.customerManagement.model.CustomerManagement;
|
|
|
-import com.idea.customerManagement.model.CustomerManagementExample;
|
|
|
+import com.idea.customerManagement.model.*;
|
|
|
import com.idea.customerManagement.service.BuyerService;
|
|
|
import com.idea.invoice.mapper.InvoiceManageMapper;
|
|
|
import com.idea.invoice.model.InvoiceManage;
|
|
@@ -28,9 +25,13 @@ import com.idea.paymentManagement.dto.RefundManageDto;
|
|
|
import com.idea.paymentManagement.mapper.PayLogMapper;
|
|
|
import com.idea.paymentManagement.mapper.RefundDetailMapper;
|
|
|
import com.idea.paymentManagement.model.PayLog;
|
|
|
+import com.idea.paymentManagement.model.PayLogExample;
|
|
|
import com.idea.paymentManagement.model.RefundDetail;
|
|
|
+import com.idea.paymentManagement.model.RefundDetailExample;
|
|
|
import com.idea.paymentManagement.service.PayLogService;
|
|
|
+import com.idea.transactionRecordManage.mapper.ConvertRecordMapper;
|
|
|
import com.idea.transactionRecordManage.mapper.TransactionRecordMapper;
|
|
|
+import com.idea.transactionRecordManage.model.ConvertRecord;
|
|
|
import com.idea.transactionRecordManage.vo.NccRecordVo;
|
|
|
import com.idea.util.DateUtils;
|
|
|
import com.rockstar.common.domain.AjaxResult;
|
|
@@ -74,6 +75,8 @@ public class TransactionRecordService {
|
|
|
private ParkInfoMapper parkInfoMapper;
|
|
|
@Autowired
|
|
|
private ParkRoomExtendMapper parkRoomExtendMapper;
|
|
|
+ @Autowired
|
|
|
+ private ConvertRecordMapper convertRecordMapper;
|
|
|
|
|
|
/**
|
|
|
* 收款记录
|
|
@@ -138,7 +141,7 @@ public class TransactionRecordService {
|
|
|
List<String> list = Arrays.asList(model.getDiscIds().split(","));
|
|
|
model.setDiscIdList(list);
|
|
|
}
|
|
|
- // 收款记录
|
|
|
+ // 退款记录
|
|
|
List<NccRecordVo> list = modelMapper.reFundRecord(model);
|
|
|
for (NccRecordVo recordVo : list) {
|
|
|
// 已推送
|
|
@@ -254,9 +257,12 @@ public class TransactionRecordService {
|
|
|
* @return
|
|
|
*/
|
|
|
@Synchronized
|
|
|
- public int collectionRecordSubmit(String collectionDateFrom, String collectionDateTo) {
|
|
|
+ public int collectionRecordSubmit(String ids, String collectionDateFrom, String collectionDateTo) {
|
|
|
|
|
|
- List<PayLog> payLogs = modelMapper.listByDate(collectionDateFrom, collectionDateTo);
|
|
|
+// List<PayLog> payLogs = modelMapper.listByDate(collectionDateFrom, collectionDateTo);
|
|
|
+ PayLogExample payLogExample = new PayLogExample();
|
|
|
+ payLogExample.createCriteria().andIdIn(Arrays.asList(ids.split(",")));
|
|
|
+ List<PayLog> payLogs = payLogMapper.selectByExample(payLogExample);
|
|
|
List<CustomerManagement> customerManagements = customerManagementMapper.selectByExample(new CustomerManagementExample());
|
|
|
Map<String, CustomerManagement> customerMap = customerManagements.stream()
|
|
|
.collect(Collectors.toMap(CustomerManagement::getId, item -> item));
|
|
@@ -392,7 +398,7 @@ public class TransactionRecordService {
|
|
|
* @return
|
|
|
*/
|
|
|
@Synchronized
|
|
|
- public int refundRecordSubmit(String collectionDateFrom, String collectionDateTo) {
|
|
|
+ public int refundRecordSubmit(String ids, String collectionDateFrom, String collectionDateTo) {
|
|
|
|
|
|
// 开票列表
|
|
|
Map<String, String> map = new HashMap<>();
|
|
@@ -412,7 +418,9 @@ public class TransactionRecordService {
|
|
|
Map<String, ParkInfo> parkInfoMap = parkInfos.stream().collect(Collectors.toMap(ParkInfo::getId, item -> item));
|
|
|
|
|
|
// 退款列表
|
|
|
- List<RefundManageDto> refundManages = modelMapper.refundListByDate(collectionDateFrom, collectionDateTo);
|
|
|
+ NccRecordVo model = new NccRecordVo();
|
|
|
+ model.setIdList(Arrays.asList(ids.split(",")));
|
|
|
+ List<RefundManageDto> refundManages = modelMapper.refundListByIds(model);
|
|
|
for (RefundManageDto refundManage : refundManages) {
|
|
|
try {
|
|
|
if (customerMap.containsKey(refundManage.getCustomerManagementId())) {
|
|
@@ -488,7 +496,6 @@ public class TransactionRecordService {
|
|
|
ap_payitemJson.put("pk_balatype", "4"); //结算方式,必选,默认是4
|
|
|
ap_payitemJson.put("pk_recpaytype", "001"); //付款业务类型传默认值“001”
|
|
|
ap_payitemJson.put("prepay", "0"); //默认值0
|
|
|
- // TODO: 2024/11/22 安居的退款账号 待定
|
|
|
ap_payitemJson.put("payaccount", refundManage.getBankNumber()); //付款银行账号,必选
|
|
|
ap_payitemJson.put("checktype", checktype); //票据类型,必选,看云文档票据类型
|
|
|
// TODO: 2024/11/22 退款的记录 是汇合的多笔的 票据号待定
|
|
@@ -535,7 +542,7 @@ public class TransactionRecordService {
|
|
|
* @return
|
|
|
*/
|
|
|
@Synchronized
|
|
|
- public int convertRecordSubmit(String collectionDateFrom, String collectionDateTo) {
|
|
|
+ public int convertRecordSubmit(String ids, String collectionDateFrom, String collectionDateTo) {
|
|
|
|
|
|
// 客户列表
|
|
|
List<CustomerManagement> customerManagements = customerManagementMapper.selectByExample(new CustomerManagementExample());
|
|
@@ -545,102 +552,145 @@ public class TransactionRecordService {
|
|
|
List<ParkInfo> parkInfos = parkInfoMapper.selectByExample(new ParkInfoExample());
|
|
|
Map<String, ParkInfo> parkInfoMap = parkInfos.stream().collect(Collectors.toMap(ParkInfo::getId, item -> item));
|
|
|
|
|
|
- // 意向金列表
|
|
|
- List<IntentionalDepositDto> intentionalDeposits = modelMapper.convertListByDate(collectionDateFrom, collectionDateTo);
|
|
|
- for (IntentionalDepositDto intentionalDeposit : intentionalDeposits) {
|
|
|
- try {
|
|
|
- String billdate = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, new Date());
|
|
|
- if (customerMap.containsKey(intentionalDeposit.getCustomerManagementId())) {
|
|
|
- CustomerManagement customerManagement = customerMap.get(intentionalDeposit.getCustomerManagementId());
|
|
|
+ // 转换列表
|
|
|
+ NccRecordVo model = new NccRecordVo();
|
|
|
+ model.setIdList(Arrays.asList(ids.split(",")));
|
|
|
|
|
|
- // 项目档案编码
|
|
|
- String def10 = "";
|
|
|
- if (parkInfoMap.containsKey(customerManagement.getGroupId())) {
|
|
|
- def10 = parkInfoMap.get(customerManagement.getGroupId()).getArchiveCode();
|
|
|
- }
|
|
|
- // 组织机构编码
|
|
|
- String pk_org = "";
|
|
|
- if (parkInfoMap.containsKey(customerManagement.getGroupId())) {
|
|
|
- pk_org = parkInfoMap.get(customerManagement.getGroupId()).getOrganizationalCode();
|
|
|
- }
|
|
|
+ // 转换记录
|
|
|
+ List<NccRecordVo> list = modelMapper.convertRecord(model);
|
|
|
+ for (NccRecordVo record : list) {
|
|
|
+ // 剔除已提交的记录
|
|
|
+ if (record.getNcSubmitStatus() != 1) {
|
|
|
+ convertRecordSubmitInfo(record,customerMap,parkInfoMap);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return 1;
|
|
|
|
|
|
- // 目前只有意向金转定金
|
|
|
- String pk_subjcode = InvoiceConstant.INVOICE_PAYMENT_TYPE_AJ001;
|
|
|
+ }
|
|
|
|
|
|
- String pk_balatype = "";
|
|
|
- // 现金
|
|
|
- if (intentionalDeposit.getPaymentMethod() == 1) {
|
|
|
- pk_balatype = InvoiceConstant.INVOICE_PAYMENT_METHOD_0;
|
|
|
- }
|
|
|
- // 支付宝
|
|
|
- if (intentionalDeposit.getPaymentMethod() == 2) {
|
|
|
- pk_balatype = InvoiceConstant.INVOICE_PAYMENT_METHOD_4;
|
|
|
- }
|
|
|
- // 微信
|
|
|
- if (intentionalDeposit.getPaymentMethod() == 3) {
|
|
|
- pk_balatype = InvoiceConstant.INVOICE_PAYMENT_METHOD_4;
|
|
|
- }
|
|
|
- // 银行卡
|
|
|
- if (intentionalDeposit.getPaymentMethod() == 3) {
|
|
|
- pk_balatype = InvoiceConstant.INVOICE_PAYMENT_METHOD_4;
|
|
|
- }
|
|
|
+ public void convertRecordSubmitInfo(NccRecordVo record, Map<String, CustomerManagement> customerMap, Map<String, ParkInfo> parkInfoMap) {
|
|
|
+
|
|
|
+ String customerManagementId = "";
|
|
|
+ Integer paymentMethod = null;
|
|
|
+ String money_cr = "";
|
|
|
+ String bankNumber = "";
|
|
|
+ String houseId = "";
|
|
|
+ String serialNumber = "";
|
|
|
+ // 意向金转定金
|
|
|
+ if (record.getConvertType().equals("1")) {
|
|
|
+ IntentionalDeposit intentionalDeposit = intentionalDepositMapper.selectByPrimaryKey(record.getBusinessId());
|
|
|
+ customerManagementId = intentionalDeposit.getCustomerManagementId();
|
|
|
+ paymentMethod = intentionalDeposit.getPaymentMethod();
|
|
|
+ money_cr = intentionalDeposit.getReceivedAmount().toString();
|
|
|
+ bankNumber = intentionalDeposit.getBankNumber();
|
|
|
+ houseId = intentionalDeposit.getHouseId();
|
|
|
+ serialNumber = intentionalDeposit.getSerialNumber();
|
|
|
+ }
|
|
|
+ // 定金转首款 定金转房款
|
|
|
+ if (record.getConvertType().equals("2") || record.getConvertType().equals("3")) {
|
|
|
+ PayLog payLog = payLogMapper.selectByPrimaryKey(record.getBusinessId());
|
|
|
+ customerManagementId = payLog.getCustomerManagementId();
|
|
|
+ paymentMethod = payLog.getPaymentMethod();
|
|
|
+ money_cr = payLog.getPayMoney().toString();
|
|
|
+ bankNumber = payLog.getBankNumber();
|
|
|
+ houseId = payLog.getHouseId();
|
|
|
+ serialNumber = payLog.getSerialNumber();
|
|
|
+ }
|
|
|
|
|
|
+ try {
|
|
|
+ String billdate = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, new Date());
|
|
|
+ if (customerMap.containsKey(customerManagementId)) {
|
|
|
+ CustomerManagement customerManagement = customerMap.get(customerManagementId);
|
|
|
|
|
|
- JSONObject json = new JSONObject();
|
|
|
- JSONObject ar_gatherbill = new JSONObject();
|
|
|
- String srcsystemid = intentionalDeposit.getId();
|
|
|
- ar_gatherbill.put("srcsystemid", srcsystemid); //外系统标识,必选
|
|
|
- ar_gatherbill.put("pk_tradetype", InvoiceConstant.INVOICE_BUSINESS_F2_Cxx_07); //交易类型,必选
|
|
|
- ar_gatherbill.put("pk_org", pk_org); //组织编码,必选
|
|
|
- ar_gatherbill.put("billdate", billdate); //单据日期
|
|
|
- ar_gatherbill.put("def2", srcsystemid); //外系统单据号,必填,
|
|
|
- json.put("ar_gatherbill", ar_gatherbill);
|
|
|
+ // 项目档案编码
|
|
|
+ String def10 = "";
|
|
|
+ if (parkInfoMap.containsKey(customerManagement.getGroupId())) {
|
|
|
+ def10 = parkInfoMap.get(customerManagement.getGroupId()).getArchiveCode();
|
|
|
+ }
|
|
|
+ // 组织机构编码
|
|
|
+ String pk_org = "";
|
|
|
+ if (parkInfoMap.containsKey(customerManagement.getGroupId())) {
|
|
|
+ pk_org = parkInfoMap.get(customerManagement.getGroupId()).getOrganizationalCode();
|
|
|
+ }
|
|
|
|
|
|
- JSONArray ar_gatheritem = new JSONArray();
|
|
|
- JSONObject ar_gatheritemJson = new JSONObject();
|
|
|
- ar_gatheritemJson.put("srcsystemid", srcsystemid); //外系统子表标识
|
|
|
- ar_gatheritemJson.put("objtype", "0"); //0=客户,1=供应商--判断customer和supplier是否必填,必选
|
|
|
- ar_gatheritemJson.put("customer", customerManagement.getBuyerIdentityCard()); //客商的纳税人识别号
|
|
|
- ar_gatheritemJson.put("money_cr", intentionalDeposit.getReceivedAmount()); //金额,必选
|
|
|
- ar_gatheritemJson.put("taxrate", "0"); //税率,必选,数字——3/10/6````
|
|
|
- ar_gatheritemJson.put("pk_balatype", pk_balatype); //结算方式,必选,看云文档结算方式
|
|
|
- ar_gatheritemJson.put("pk_recpaytype", "001"); //付款业务类型传默认值“001”
|
|
|
- ar_gatheritemJson.put("prepay", "0"); //收款性质应收款时传"0",收款性质预收款时传"1"
|
|
|
- ar_gatheritemJson.put("recaccount", intentionalDeposit.getBankName()); //收款银行账号,必填
|
|
|
+ // 目前只有意向金转定金
|
|
|
+ String pk_subjcode = InvoiceConstant.INVOICE_PAYMENT_TYPE_AJ001;
|
|
|
+
|
|
|
+ String pk_balatype = "";
|
|
|
+ // 现金
|
|
|
+ if (paymentMethod == 1) {
|
|
|
+ pk_balatype = InvoiceConstant.INVOICE_PAYMENT_METHOD_0;
|
|
|
+ }
|
|
|
+ // 支付宝
|
|
|
+ if (paymentMethod == 2) {
|
|
|
+ pk_balatype = InvoiceConstant.INVOICE_PAYMENT_METHOD_4;
|
|
|
+ }
|
|
|
+ // 微信
|
|
|
+ if (paymentMethod == 3) {
|
|
|
+ pk_balatype = InvoiceConstant.INVOICE_PAYMENT_METHOD_4;
|
|
|
+ }
|
|
|
+ // 银行卡
|
|
|
+ if (paymentMethod == 3) {
|
|
|
+ pk_balatype = InvoiceConstant.INVOICE_PAYMENT_METHOD_4;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ JSONObject json = new JSONObject();
|
|
|
+ JSONObject ar_gatherbill = new JSONObject();
|
|
|
+ String srcsystemid = record.getId();
|
|
|
+ ar_gatherbill.put("srcsystemid", srcsystemid); //外系统标识,必选
|
|
|
+ ar_gatherbill.put("pk_tradetype", InvoiceConstant.INVOICE_BUSINESS_F2_Cxx_07); //交易类型,必选
|
|
|
+ ar_gatherbill.put("pk_org", pk_org); //组织编码,必选
|
|
|
+ ar_gatherbill.put("billdate", billdate); //单据日期
|
|
|
+ ar_gatherbill.put("def2", srcsystemid); //外系统单据号,必填,
|
|
|
+ json.put("ar_gatherbill", ar_gatherbill);
|
|
|
+
|
|
|
+ JSONArray ar_gatheritem = new JSONArray();
|
|
|
+ JSONObject ar_gatheritemJson = new JSONObject();
|
|
|
+ ar_gatheritemJson.put("srcsystemid", srcsystemid); //外系统子表标识
|
|
|
+ ar_gatheritemJson.put("objtype", "0"); //0=客户,1=供应商--判断customer和supplier是否必填,必选
|
|
|
+ ar_gatheritemJson.put("customer", customerManagement.getBuyerIdentityCard()); //客商的纳税人识别号
|
|
|
+ ar_gatheritemJson.put("money_cr", money_cr); //金额,必选
|
|
|
+ ar_gatheritemJson.put("taxrate", "0"); //税率,必选,数字——3/10/6````
|
|
|
+ ar_gatheritemJson.put("pk_balatype", pk_balatype); //结算方式,必选,看云文档结算方式
|
|
|
+ ar_gatheritemJson.put("pk_recpaytype", "001"); //付款业务类型传默认值“001”
|
|
|
+ ar_gatheritemJson.put("prepay", "0"); //收款性质应收款时传"0",收款性质预收款时传"1"
|
|
|
+ ar_gatheritemJson.put("recaccount", bankNumber); //收款银行账号,必填
|
|
|
// ar_gatheritemJson.put("invoiceno","fphm"); //发票号码,非必选
|
|
|
- ar_gatheritemJson.put("scomment", customerManagement.getBuyerName()); //客户名称,必选
|
|
|
- ar_gatheritemJson.put("pk_subjcode", pk_subjcode); //收支项目编码,必选,看云文档收支项目对照
|
|
|
- ar_gatheritemJson.put("def11", intentionalDeposit.getHouseId()); //转出前房号编码,必选
|
|
|
- ar_gatheritemJson.put("def9", InvoiceConstant.INVOICE_BUSINESS_FORMAT_001); //业态,必选,看云文档业态
|
|
|
+ ar_gatheritemJson.put("scomment", customerManagement.getBuyerName()); //客户名称,必选
|
|
|
+ ar_gatheritemJson.put("pk_subjcode", pk_subjcode); //收支项目编码,必选,看云文档收支项目对照
|
|
|
+ ar_gatheritemJson.put("def11", houseId); //转出前房号编码,必选
|
|
|
+ ar_gatheritemJson.put("def9", InvoiceConstant.INVOICE_BUSINESS_FORMAT_001); //业态,必选,看云文档业态
|
|
|
// ar_gatheritemJson.put("def12", ""); //转出后房号编码,换房业务时要选
|
|
|
- ar_gatheritemJson.put("def14", InvoiceConstant.INVOICE_PAYMENT_TYPE_AJ026); //原收支项目编码,定金转违约金项目时 必选
|
|
|
+ ar_gatheritemJson.put("def14", InvoiceConstant.INVOICE_PAYMENT_TYPE_AJ026); //原收支项目编码,定金转违约金项目时 必选
|
|
|
// ar_gatheritemJson.put("def13", ""); //换票后票据号,换房业务必选
|
|
|
- ar_gatheritemJson.put("checktype", InvoiceConstant.INVOICE_RECEIPT_TYPE_3); //票据类型,必选,看云文档票据类型
|
|
|
- ar_gatheritemJson.put("checkno", intentionalDeposit.getSerialNumber()); //票据号,必选
|
|
|
- ar_gatheritemJson.put("def10", def10); //项目档案编码,看云文档项目档案对照
|
|
|
- ar_gatheritem.add(ar_gatheritemJson);
|
|
|
- json.put("ar_gatheritem", ar_gatheritem);
|
|
|
-
|
|
|
- log.info("转换记录推送详情:{}", json.toJSONString());
|
|
|
- String result = InvoiceUtil.gatheringbillTurn(json);
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(result);
|
|
|
- if (jsonObject.getString("success").equals("true")) {
|
|
|
- intentionalDeposit.setNcSubmitStatus(1);
|
|
|
- } else {
|
|
|
- intentionalDeposit.setNcSubmitStatus(2);
|
|
|
- }
|
|
|
- intentionalDeposit.setNcJson(result);
|
|
|
- intentionalDeposit.setNcSubmitDate(new Date());
|
|
|
- intentionalDeposit.setNcSubmitName(ShiroUtils.getUser().getTruename());
|
|
|
- intentionalDepositMapper.updateByPrimaryKeySelective(intentionalDeposit);
|
|
|
+ ar_gatheritemJson.put("checktype", InvoiceConstant.INVOICE_RECEIPT_TYPE_3); //票据类型,必选,看云文档票据类型
|
|
|
+ ar_gatheritemJson.put("checkno", serialNumber); //票据号,必选
|
|
|
+ ar_gatheritemJson.put("def10", def10); //项目档案编码,看云文档项目档案对照
|
|
|
+ ar_gatheritem.add(ar_gatheritemJson);
|
|
|
+ json.put("ar_gatheritem", ar_gatheritem);
|
|
|
+
|
|
|
+ log.info("转换记录推送详情:{}", json.toJSONString());
|
|
|
+ String result = InvoiceUtil.gatheringbillTurn(json);
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(result);
|
|
|
+ ConvertRecord convertRecord = convertRecordMapper.selectByPrimaryKey(record.getId());
|
|
|
+ if (jsonObject.getString("success").equals("true")) {
|
|
|
+ convertRecord.setNcSubmitStatus(1);
|
|
|
+ } else {
|
|
|
+ convertRecord.setNcSubmitStatus(2);
|
|
|
}
|
|
|
-
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("转换记录凭证推送报错", e);
|
|
|
+ convertRecord.setNcJson(result);
|
|
|
+ convertRecord.setNcSubmitDate(new Date());
|
|
|
+ convertRecord.setNcSubmitName(ShiroUtils.getUser().getTruename());
|
|
|
+ convertRecordMapper.updateByPrimaryKeySelective(convertRecord);
|
|
|
}
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("转换记录凭证推送报错", e);
|
|
|
}
|
|
|
- return 1;
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
}
|