|
@@ -1,5 +1,6 @@
|
|
|
package com.idea.customerManagement.service;
|
|
|
|
|
|
+import cn.hutool.core.math.Money;
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
@@ -19,11 +20,14 @@ import com.idea.invoice.service.ReceiptManageService;
|
|
|
import com.idea.paymentManagement.mapper.PayLogMapper;
|
|
|
import com.idea.paymentManagement.model.PayLog;
|
|
|
import com.idea.util.DateUtils;
|
|
|
+import com.idea.util.MoneyUtils;
|
|
|
import com.idea.util.ReplaceWord;
|
|
|
import com.rockstar.common.base.BaseService;
|
|
|
import com.rockstar.frame.model.extend.DateTrans;
|
|
|
import com.rockstar.frame.model.extend.Tablepar;
|
|
|
import com.rockstar.shiro.util.ShiroUtils;
|
|
|
+import com.rockstar.system.service.SysDictService;
|
|
|
+import com.rockstar.util.StringUtils;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -31,6 +35,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
|
|
|
@Service
|
|
@@ -54,6 +59,8 @@ public class RoomSelectionInfoService implements BaseService<RoomSelectionInfo,
|
|
|
private PayLogMapper payLogMapper;
|
|
|
@Autowired
|
|
|
private ReceiptManageService receiptManageService;
|
|
|
+ @Autowired
|
|
|
+ private SysDictService sysDictService;
|
|
|
|
|
|
|
|
|
@Override
|
|
@@ -179,10 +186,11 @@ public class RoomSelectionInfoService implements BaseService<RoomSelectionInfo,
|
|
|
|
|
|
/**
|
|
|
* 获取收据流水号(定金编号)
|
|
|
+ *
|
|
|
* @param houseId
|
|
|
* @return
|
|
|
*/
|
|
|
- public String getSerialNumber(String houseId){
|
|
|
+ public String getSerialNumber(String houseId) {
|
|
|
ParkRoomResponse response = roomExtendMapper.getFullName(houseId);
|
|
|
String groupId = response.getGroupId();
|
|
|
// 查找这个小区已收取认购金的 数据量
|
|
@@ -190,23 +198,24 @@ public class RoomSelectionInfoService implements BaseService<RoomSelectionInfo,
|
|
|
example.createCriteria().andGroupIdEqualTo(groupId).andStatusEqualTo(2);
|
|
|
Long count = countByExample(example);
|
|
|
String number = "";
|
|
|
- if(count.doubleValue() == 0){
|
|
|
+ if (count.doubleValue() == 0) {
|
|
|
number = "00001";
|
|
|
- }else {
|
|
|
- count ++;
|
|
|
+ } else {
|
|
|
+ count++;
|
|
|
number = String.format("%05d", count);
|
|
|
}
|
|
|
- String serialNumber = response.getGroupName()+ response.getDiscName() + "-DJ" + number;
|
|
|
+ String serialNumber = response.getGroupName() + response.getDiscName() + "-DJ" + number;
|
|
|
return serialNumber;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 认购金登记
|
|
|
+ *
|
|
|
* @param model
|
|
|
* @return
|
|
|
*/
|
|
|
@Transactional
|
|
|
- public int add(RoomSelectionInfoDto model){
|
|
|
+ public int add(RoomSelectionInfoDto model) {
|
|
|
|
|
|
model.setUpdatedAt(new Date());
|
|
|
model.setUpdatedId(ShiroUtils.getUserId());
|
|
@@ -216,7 +225,7 @@ public class RoomSelectionInfoService implements BaseService<RoomSelectionInfo,
|
|
|
int result = updateByPrimaryKeySelective(model);
|
|
|
// 生成合同
|
|
|
String contractId = IdUtil.simpleUUID();
|
|
|
- contractManageService.addContract(model,contractId);
|
|
|
+ contractManageService.addContract(model, contractId);
|
|
|
// 修改房间已收状态 已认购
|
|
|
ParkRoom parkRoom = new ParkRoom();
|
|
|
parkRoom.setId(model.getHouseId());
|
|
@@ -257,10 +266,11 @@ public class RoomSelectionInfoService implements BaseService<RoomSelectionInfo,
|
|
|
|
|
|
/**
|
|
|
* 认购金修改
|
|
|
+ *
|
|
|
* @param model
|
|
|
* @return
|
|
|
*/
|
|
|
- public int edit(RoomSelectionInfoDto model){
|
|
|
+ public int edit(RoomSelectionInfoDto model) {
|
|
|
|
|
|
model.setUpdatedAt(new Date());
|
|
|
model.setUpdatedId(ShiroUtils.getUserId());
|
|
@@ -270,20 +280,22 @@ public class RoomSelectionInfoService implements BaseService<RoomSelectionInfo,
|
|
|
|
|
|
/**
|
|
|
* 查看详情
|
|
|
+ *
|
|
|
* @param id
|
|
|
* @return
|
|
|
*/
|
|
|
- public RoomSelectionInfo getById(String id){
|
|
|
+ public RoomSelectionInfo getById(String id) {
|
|
|
return selectByPrimaryKey(id);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 房源确认单 下载
|
|
|
+ *
|
|
|
* @param model
|
|
|
* @param request
|
|
|
* @param response
|
|
|
*/
|
|
|
- public void downLoad(RoomSelectionInfoDto model,HttpServletRequest request, HttpServletResponse response) {
|
|
|
+ public void downLoad(RoomSelectionInfoDto model, HttpServletRequest request, HttpServletResponse response) {
|
|
|
|
|
|
String filePath = "/home/project/settleDown/tem/roomConfirmationSheet.docx";
|
|
|
String picturePath = "C:\\Users\\35838\\Pictures\\liuhaizhu.jpg";
|
|
@@ -294,7 +306,7 @@ public class RoomSelectionInfoService implements BaseService<RoomSelectionInfo,
|
|
|
buyerExample.setOrderByClause("order_num asc");
|
|
|
buyerExample.createCriteria().andCustomerManagementIdEqualTo(customerManagementId);
|
|
|
List<Buyer> buyers = buyerService.selectByExample(buyerExample);
|
|
|
- if(CollectionUtils.isNotEmpty(buyers)){
|
|
|
+ if (CollectionUtils.isNotEmpty(buyers)) {
|
|
|
Buyer buyer = buyers.get(0);
|
|
|
ParkRoomResponse roomResponse = roomExtendMapper.getFullName(model.getHouseId());
|
|
|
String fullName = roomResponse.getGroupName() + roomResponse.getDiscName() + roomResponse.getBuildName()
|
|
@@ -314,17 +326,16 @@ public class RoomSelectionInfoService implements BaseService<RoomSelectionInfo,
|
|
|
data.put("${username}", loginName);
|
|
|
picData.put("${picture}", picturePath);
|
|
|
sealData.put("${seal}", sealPath);
|
|
|
- ReplaceWord.operateWord(response,filePath,fileName,data, picData,sealData);
|
|
|
+ ReplaceWord.operateWord(response, filePath, fileName, data, picData, sealData);
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 定金列表
|
|
|
+ *
|
|
|
* @param tablepar
|
|
|
* @param model
|
|
|
* @param dt
|
|
@@ -337,5 +348,58 @@ public class RoomSelectionInfoService implements BaseService<RoomSelectionInfo,
|
|
|
return pageInfo;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 定金收据
|
|
|
+ * @param model
|
|
|
+ * @param response
|
|
|
+ */
|
|
|
+ public void downLoadReceipt(RoomSelectionInfoDto model, HttpServletResponse response) {
|
|
|
+
|
|
|
+ // TODO: 2024/10/24 定金收据暂无word文档
|
|
|
+ String filePath = "/home/project/settleDown/tem/.docx";
|
|
|
+ String fileName = "定金收据.docx";
|
|
|
+ String customerManagementId = model.getCustomerManagementId();
|
|
|
+ BuyerExample buyerExample = new BuyerExample();
|
|
|
+ buyerExample.setOrderByClause("order_num asc");
|
|
|
+ buyerExample.createCriteria().andCustomerManagementIdEqualTo(customerManagementId);
|
|
|
+ List<Buyer> buyers = buyerService.selectByExample(buyerExample);
|
|
|
+ String name = "";
|
|
|
+ if (CollectionUtils.isNotEmpty(buyers)) {
|
|
|
+ Buyer buyer = buyers.get(0);
|
|
|
+ name = buyer.getName();
|
|
|
+ }
|
|
|
+ ParkRoomResponse roomResponse = roomExtendMapper.getFullName(model.getHouseId());
|
|
|
+ String fullName = roomResponse.getGroupName()
|
|
|
+ + "-"
|
|
|
+ + roomResponse.getDiscName()
|
|
|
+ + roomResponse.getBuildName()
|
|
|
+ + roomResponse.getRoomNo();
|
|
|
+
|
|
|
+ String collectionTime = DateUtils.parseDateToStr(DateUtils.DATE_CH, model.getCollectionTime());
|
|
|
+ String content = "定金";
|
|
|
+ String paymentMethod = "";
|
|
|
+ String dictLabel = sysDictService.getDictLabel("COLLECTION_METHODS", model.getPaymentMethod().toString());
|
|
|
+ if(StringUtils.isNotEmpty(dictLabel)){
|
|
|
+ paymentMethod = dictLabel;
|
|
|
+ }
|
|
|
+ String receivedAmount = model.getReceivedAmount().toString();
|
|
|
+ String capital = MoneyUtils.amountConversion(receivedAmount);
|
|
|
+
|
|
|
+ Map<String, Object> data = new HashMap<>();
|
|
|
+ Map<String, Object> picData = new HashMap<>();
|
|
|
+ Map<String, Object> sealData = new HashMap<>();
|
|
|
+ data.put("${name}", name);
|
|
|
+ data.put("${collectionTime}", collectionTime);
|
|
|
+ data.put("${content}", content);
|
|
|
+ data.put("${paymentMethod}", paymentMethod);
|
|
|
+ data.put("${fullName}", fullName);
|
|
|
+ data.put("${capital}", capital);
|
|
|
+ data.put("${receivedAmount}", receivedAmount);
|
|
|
+
|
|
|
+ ReplaceWord.operateWord(response, filePath, fileName, data, picData, sealData);
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|