|
@@ -3,21 +3,38 @@ package com.idea.invoice.service;
|
|
import cn.hutool.core.util.IdUtil;
|
|
import cn.hutool.core.util.IdUtil;
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
+import com.idea.buildManage.mapper.ParkRoomExtendMapper;
|
|
|
|
+import com.idea.buildManage.response.ParkRoomResponse;
|
|
|
|
+import com.idea.customerManagement.mapper.CustomerManagementMapper;
|
|
|
|
+import com.idea.customerManagement.mapper.IntentionalDepositMapper;
|
|
|
|
+import com.idea.customerManagement.mapper.RoomSelectionInfoMapper;
|
|
|
|
+import com.idea.customerManagement.model.*;
|
|
|
|
+import com.idea.customerManagement.service.BuyerService;
|
|
import com.idea.invoice.dto.ReceiptManageDto;
|
|
import com.idea.invoice.dto.ReceiptManageDto;
|
|
import com.idea.invoice.mapper.ReceiptManageExtendMapper;
|
|
import com.idea.invoice.mapper.ReceiptManageExtendMapper;
|
|
import com.idea.invoice.mapper.ReceiptManageMapper;
|
|
import com.idea.invoice.mapper.ReceiptManageMapper;
|
|
import com.idea.invoice.model.InvoiceManage;
|
|
import com.idea.invoice.model.InvoiceManage;
|
|
import com.idea.invoice.model.ReceiptManage;
|
|
import com.idea.invoice.model.ReceiptManage;
|
|
import com.idea.invoice.model.ReceiptManageExample;
|
|
import com.idea.invoice.model.ReceiptManageExample;
|
|
|
|
+import com.idea.paymentManagement.model.PayLog;
|
|
|
|
+import com.idea.paymentManagement.service.PayLogService;
|
|
|
|
+import com.idea.util.DateUtils;
|
|
|
|
+import com.idea.util.MoneyUtils;
|
|
|
|
+import com.idea.util.ReplaceWord;
|
|
import com.rockstar.common.base.BaseService;
|
|
import com.rockstar.common.base.BaseService;
|
|
import com.rockstar.frame.model.extend.Tablepar;
|
|
import com.rockstar.frame.model.extend.Tablepar;
|
|
import com.rockstar.shiro.util.ShiroUtils;
|
|
import com.rockstar.shiro.util.ShiroUtils;
|
|
|
|
+import com.rockstar.system.service.SysDictService;
|
|
import com.rockstar.util.StringUtils;
|
|
import com.rockstar.util.StringUtils;
|
|
|
|
+import org.apache.commons.collections.CollectionUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
|
+import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
|
|
@Service
|
|
@Service
|
|
public class ReceiptManageService implements BaseService<ReceiptManage, ReceiptManageExample> {
|
|
public class ReceiptManageService implements BaseService<ReceiptManage, ReceiptManageExample> {
|
|
@@ -26,7 +43,20 @@ public class ReceiptManageService implements BaseService<ReceiptManage, ReceiptM
|
|
private ReceiptManageMapper modelMapper;
|
|
private ReceiptManageMapper modelMapper;
|
|
@Autowired
|
|
@Autowired
|
|
private ReceiptManageExtendMapper extendMapper;
|
|
private ReceiptManageExtendMapper extendMapper;
|
|
-
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private BuyerService buyerService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private CustomerManagementMapper customerManagementMapper;
|
|
|
|
+ @Autowired
|
|
|
|
+ private ParkRoomExtendMapper roomExtendMapper;
|
|
|
|
+ @Autowired
|
|
|
|
+ private SysDictService sysDictService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private IntentionalDepositMapper intentionalDepositMapper;
|
|
|
|
+ @Autowired
|
|
|
|
+ private RoomSelectionInfoMapper roomSelectionInfoMapper;
|
|
|
|
+ @Autowired
|
|
|
|
+ private PayLogService payLogService;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public int deleteByPrimaryKey(String s) {
|
|
public int deleteByPrimaryKey(String s) {
|
|
@@ -51,12 +81,12 @@ public class ReceiptManageService implements BaseService<ReceiptManage, ReceiptM
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public int updateByExampleSelective(ReceiptManage receiptManage, ReceiptManageExample receiptManageExample) {
|
|
public int updateByExampleSelective(ReceiptManage receiptManage, ReceiptManageExample receiptManageExample) {
|
|
- return modelMapper.updateByExampleSelective(receiptManage,receiptManageExample);
|
|
|
|
|
|
+ return modelMapper.updateByExampleSelective(receiptManage, receiptManageExample);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public int updateByExample(ReceiptManage receiptManage, ReceiptManageExample receiptManageExample) {
|
|
public int updateByExample(ReceiptManage receiptManage, ReceiptManageExample receiptManageExample) {
|
|
- return modelMapper.updateByExample(receiptManage,receiptManageExample);
|
|
|
|
|
|
+ return modelMapper.updateByExample(receiptManage, receiptManageExample);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -74,34 +104,34 @@ public class ReceiptManageService implements BaseService<ReceiptManage, ReceiptM
|
|
return modelMapper.deleteByExample(receiptManageExample);
|
|
return modelMapper.deleteByExample(receiptManageExample);
|
|
}
|
|
}
|
|
|
|
|
|
- public ReceiptManageExample getCondition(ReceiptManage model){
|
|
|
|
|
|
+ public ReceiptManageExample getCondition(ReceiptManage model) {
|
|
|
|
|
|
ReceiptManageExample example = new ReceiptManageExample();
|
|
ReceiptManageExample example = new ReceiptManageExample();
|
|
example.setOrderByClause("created_at");
|
|
example.setOrderByClause("created_at");
|
|
ReceiptManageExample.Criteria criteria = example.createCriteria();
|
|
ReceiptManageExample.Criteria criteria = example.createCriteria();
|
|
- if(StringUtils.isNotEmpty(model.getHouseName())){
|
|
|
|
|
|
+ if (StringUtils.isNotEmpty(model.getHouseName())) {
|
|
criteria.andHouseNameLike("%" + model.getHouseName() + "%");
|
|
criteria.andHouseNameLike("%" + model.getHouseName() + "%");
|
|
}
|
|
}
|
|
return example;
|
|
return example;
|
|
}
|
|
}
|
|
|
|
|
|
- public PageInfo listByModel(Tablepar tablepar, ReceiptManageDto model){
|
|
|
|
|
|
+ public PageInfo listByModel(Tablepar tablepar, ReceiptManageDto model) {
|
|
|
|
|
|
- PageHelper.startPage(tablepar.getPageNum(),tablepar.getPageSize());
|
|
|
|
|
|
+ PageHelper.startPage(tablepar.getPageNum(), tablepar.getPageSize());
|
|
List<ReceiptManageDto> receiptManages = extendMapper.listByModel(model);
|
|
List<ReceiptManageDto> receiptManages = extendMapper.listByModel(model);
|
|
return new PageInfo<ReceiptManageDto>(receiptManages);
|
|
return new PageInfo<ReceiptManageDto>(receiptManages);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* 新增票据 其他业务调用
|
|
* 新增票据 其他业务调用
|
|
|
|
+ *
|
|
* @param model
|
|
* @param model
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- public int add(ReceiptManage model){
|
|
|
|
|
|
+ public int add(ReceiptManage model) {
|
|
|
|
|
|
- if(model.getReceiptStatus() == null){
|
|
|
|
|
|
+ if (model.getReceiptStatus() == null) {
|
|
// 默认 已开
|
|
// 默认 已开
|
|
model.setReceiptStatus(1);
|
|
model.setReceiptStatus(1);
|
|
}
|
|
}
|
|
@@ -111,5 +141,129 @@ public class ReceiptManageService implements BaseService<ReceiptManage, ReceiptM
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 票据管理 收款收据下载
|
|
|
|
+ *
|
|
|
|
+ * @param id
|
|
|
|
+ * @param response
|
|
|
|
+ */
|
|
|
|
+ public void downLoadReceipt(String id, HttpServletResponse response) {
|
|
|
|
+
|
|
|
|
+ ReceiptManage receiptManage = selectByPrimaryKey(id);
|
|
|
|
+ String filePath = "/home/project/settleDown/tem/receipt.docx";
|
|
|
|
+ String sealPath = "/home/project/settleDown/tem/seal.png";
|
|
|
|
+ String sealPath2 = "/home/project/settleDown/tem/huanpiao.png";
|
|
|
|
+ String fileName = "";
|
|
|
|
+ String serialNumber = "";
|
|
|
|
+ String collectionTime = "";
|
|
|
|
+ String content = "";
|
|
|
|
+ String dictLabel = "";
|
|
|
|
+ String paymentMethod = "";
|
|
|
|
+ switch (receiptManage.getReceiptType()) {
|
|
|
|
+ case "1":
|
|
|
|
+ fileName = "意向金收据.docx";
|
|
|
|
+ IntentionalDeposit record = intentionalDepositMapper.selectByPrimaryKey(receiptManage.getBusinessId());
|
|
|
|
+ serialNumber = record.getSerialNumber();
|
|
|
|
+ collectionTime = DateUtils.parseDateToStr(DateUtils.DATE_CH, record.getCollectionTime());
|
|
|
|
+ dictLabel = sysDictService.getDictLabel("COLLECTION_METHODS", record.getPaymentMethod().toString());
|
|
|
|
+ if (StringUtils.isNotEmpty(dictLabel)) {
|
|
|
|
+ paymentMethod = dictLabel;
|
|
|
|
+ }
|
|
|
|
+ content = "意向金";
|
|
|
|
+ break;
|
|
|
|
+ case "2":
|
|
|
|
+ fileName = "定金收据.docx";
|
|
|
|
+ RoomSelectionInfo deposit = roomSelectionInfoMapper.selectByPrimaryKey(receiptManage.getBusinessId());
|
|
|
|
+ serialNumber = deposit.getSerialNumber();
|
|
|
|
+ collectionTime = DateUtils.parseDateToStr(DateUtils.DATE_CH, deposit.getCollectionTime());
|
|
|
|
+ dictLabel = sysDictService.getDictLabel("COLLECTION_METHODS", deposit.getPaymentMethod().toString());
|
|
|
|
+ if (StringUtils.isNotEmpty(dictLabel)) {
|
|
|
|
+ paymentMethod = dictLabel;
|
|
|
|
+ }
|
|
|
|
+ content = "意向金";
|
|
|
|
+ break;
|
|
|
|
+ case "3":
|
|
|
|
+ fileName = "首期收据.docx";
|
|
|
|
+ content = "首期";
|
|
|
|
+ break;
|
|
|
|
+ case "4":
|
|
|
|
+ fileName = "银行按揭收据.docx";
|
|
|
|
+ content = "银行按揭";
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ PayLog payLog = payLogService.selectByPrimaryKey(receiptManage.getBusinessId());
|
|
|
|
+ collectionTime = DateUtils.parseDateToStr(DateUtils.DATE_CH, payLog.getPayTime());
|
|
|
|
+ dictLabel = sysDictService.getDictLabel("COLLECTION_METHODS", payLog.getPaymentMethod().toString());
|
|
|
|
+ if (StringUtils.isNotEmpty(dictLabel)) {
|
|
|
|
+ paymentMethod = dictLabel;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ String customerManagementId = receiptManage.getCustomerManagementId();
|
|
|
|
+ CustomerManagement customerManagement = customerManagementMapper.selectByPrimaryKey(customerManagementId);
|
|
|
|
+ BuyerExample buyerExample = new BuyerExample();
|
|
|
|
+ buyerExample.setOrderByClause("order_num asc");
|
|
|
|
+ buyerExample.createCriteria().andCustomerManagementIdEqualTo(customerManagementId);
|
|
|
|
+ List<Buyer> buyers = buyerService.selectByExample(buyerExample);
|
|
|
|
+ StringBuilder builder = new StringBuilder();
|
|
|
|
+ if (CollectionUtils.isNotEmpty(buyers)) {
|
|
|
|
+ for (Buyer buyer : buyers) {
|
|
|
|
+ builder.append(buyer.getName()).append(",");
|
|
|
|
+ }
|
|
|
|
+ if (builder.length() > 0) {
|
|
|
|
+ builder.deleteCharAt(builder.length() - 1);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ String fullName = "";
|
|
|
|
+ // 意向金只有选房后 才有houseId
|
|
|
|
+ if (StringUtils.isNotEmpty(customerManagement.getHouseId())) {
|
|
|
|
+ ParkRoomResponse roomResponse = roomExtendMapper.getFullName(customerManagement.getHouseId());
|
|
|
|
+ fullName = roomResponse.getGroupName() + "-"
|
|
|
|
+ + roomResponse.getDiscName() + "-"
|
|
|
|
+ + roomResponse.getBuildName() + "-"
|
|
|
|
+ + roomResponse.getRoomNo();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ String receivedAmount = receiptManage.getReceiptMoney().toString();
|
|
|
|
+ String capital = MoneyUtils.amountConversion(receivedAmount);
|
|
|
|
+
|
|
|
|
+ Map<String, Object> data = new HashMap<>();
|
|
|
|
+ Map<String, Object> picData = new HashMap<>();
|
|
|
|
+ Map<String, Object> sealData = new HashMap<>();
|
|
|
|
+ Map<String, Object> settingData = new HashMap<>();
|
|
|
|
+ Map<String, Object> settingInfoData;
|
|
|
|
+
|
|
|
|
+ data.put("${serialNumber}", serialNumber);
|
|
|
|
+ data.put("${name}", builder.toString());
|
|
|
|
+ data.put("${collectionTime}", collectionTime);
|
|
|
|
+ data.put("${content}", content);
|
|
|
|
+ data.put("${paymentMethod}", paymentMethod);
|
|
|
|
+ data.put("${fullName}", fullName);
|
|
|
|
+ data.put("${capital}", capital);
|
|
|
|
+ data.put("${receivedAmount}", receivedAmount);
|
|
|
|
+ sealData.put("${seal}", sealPath);
|
|
|
|
+
|
|
|
|
+ settingInfoData = new HashMap<>();
|
|
|
|
+ settingInfoData.put("leftOffset", "50");
|
|
|
|
+ settingInfoData.put("topOffset", "-50");
|
|
|
|
+ settingData.put("${seal}",settingInfoData);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // 已换票 已红冲
|
|
|
|
+ if (receiptManage.getReceiptStatus() == 2 || receiptManage.getReceiptStatus() == 3) {
|
|
|
|
+ filePath = "/home/project/settleDown/tem/receipt_huanpiao.docx";
|
|
|
|
+ sealData.put("${huanpiao}", sealPath2);
|
|
|
|
+
|
|
|
|
+ settingInfoData = new HashMap<>();
|
|
|
|
+ settingInfoData.put("leftOffset", "300");
|
|
|
|
+ settingInfoData.put("topOffset", "-50");
|
|
|
|
+ settingData.put("${huanpiao}",settingInfoData);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ReplaceWord.operateWord(response, filePath, fileName, data, picData, sealData, settingData);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
}
|
|
}
|