|
@@ -12,22 +12,22 @@ import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.github.pagehelper.PageInfo;
|
|
|
-import com.idea.buildManage.excel.MnpBuildingExcel;
|
|
|
|
|
-import com.idea.buildManage.excel.ParkRoomExcel;
|
|
|
|
|
import com.idea.buildManage.excel.WriteHandlerStrategy;
|
|
import com.idea.buildManage.excel.WriteHandlerStrategy;
|
|
|
import com.idea.buildManage.mapper.ParkFloorDiscMapper;
|
|
import com.idea.buildManage.mapper.ParkFloorDiscMapper;
|
|
|
import com.idea.buildManage.mapper.ParkInfoMapper;
|
|
import com.idea.buildManage.mapper.ParkInfoMapper;
|
|
|
import com.idea.buildManage.mapper.ParkRoomMapper;
|
|
import com.idea.buildManage.mapper.ParkRoomMapper;
|
|
|
import com.idea.buildManage.model.ParkFloorDisc;
|
|
import com.idea.buildManage.model.ParkFloorDisc;
|
|
|
import com.idea.buildManage.model.ParkInfo;
|
|
import com.idea.buildManage.model.ParkInfo;
|
|
|
-import com.idea.buildManage.model.ParkInfoExample;
|
|
|
|
|
import com.idea.buildManage.model.ParkRoom;
|
|
import com.idea.buildManage.model.ParkRoom;
|
|
|
import com.idea.buildManage.response.ParkRoomResponse;
|
|
import com.idea.buildManage.response.ParkRoomResponse;
|
|
|
import com.idea.buildManage.service.ParkFloorDiscService;
|
|
import com.idea.buildManage.service.ParkFloorDiscService;
|
|
|
import com.idea.buildManage.service.ParkInfoService;
|
|
import com.idea.buildManage.service.ParkInfoService;
|
|
|
|
|
+import com.idea.buildManage.service.ParkRoomService;
|
|
|
import com.idea.customerManagement.dto.CustomerManagementDto;
|
|
import com.idea.customerManagement.dto.CustomerManagementDto;
|
|
|
-import com.idea.customerManagement.dto.RoomSelectionInfoDto;
|
|
|
|
|
import com.idea.customerManagement.excel.CustomerManagementExcel;
|
|
import com.idea.customerManagement.excel.CustomerManagementExcel;
|
|
|
|
|
+import com.idea.customerManagement.excel.TempContractExcel;
|
|
|
|
|
+import com.idea.customerManagement.excel.TempCusExcel;
|
|
|
|
|
+import com.idea.customerManagement.mapper.ContractManageMapper;
|
|
|
import com.idea.customerManagement.mapper.CustomerManagementExtendMapper;
|
|
import com.idea.customerManagement.mapper.CustomerManagementExtendMapper;
|
|
|
import com.idea.customerManagement.mapper.CustomerManagementMapper;
|
|
import com.idea.customerManagement.mapper.CustomerManagementMapper;
|
|
|
import com.idea.customerManagement.mapper.RoomSelectionInfoMapper;
|
|
import com.idea.customerManagement.mapper.RoomSelectionInfoMapper;
|
|
@@ -51,7 +51,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
-import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.File;
|
|
import java.io.File;
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
@@ -61,7 +60,6 @@ import java.math.BigDecimal;
|
|
|
import java.net.URLEncoder;
|
|
import java.net.URLEncoder;
|
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
@Slf4j
|
|
@Slf4j
|
|
|
@Service
|
|
@Service
|
|
@@ -92,6 +90,13 @@ public class CustomerManagementService implements BaseService<CustomerManagement
|
|
|
private IntentionalDepositService intentionalDepositService;
|
|
private IntentionalDepositService intentionalDepositService;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private ParkFloorDiscMapper parkFloorDiscMapper;
|
|
private ParkFloorDiscMapper parkFloorDiscMapper;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private RoomSelectionInfoService roomSelectionInfoService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private ParkRoomService parkRoomService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private ContractManageService contractManageService;
|
|
|
|
|
+
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public int deleteByPrimaryKey(String s) {
|
|
public int deleteByPrimaryKey(String s) {
|
|
@@ -1036,4 +1041,240 @@ public class CustomerManagementService implements BaseService<CustomerManagement
|
|
|
return extendMapper.selectNeedSendList();
|
|
return extendMapper.selectNeedSendList();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 更新客户基础信息
|
|
|
|
|
+ * @param file
|
|
|
|
|
+ * @throws IOException
|
|
|
|
|
+ */
|
|
|
|
|
+ public void tempCusUpdate(MultipartFile file) throws IOException {
|
|
|
|
|
+
|
|
|
|
|
+ // 读取excel
|
|
|
|
|
+ ExcelUtils excelUtils = new ExcelUtils();
|
|
|
|
|
+ List<TempCusExcel> list = excelUtils.excelImport(file.getInputStream(), TempCusExcel.class,1);
|
|
|
|
|
+ for(TempCusExcel excel : list){
|
|
|
|
|
+ System.out.println("excel信息" + excel.toString());
|
|
|
|
|
+
|
|
|
|
|
+ Buyer buyer1 = new Buyer();
|
|
|
|
|
+ Buyer buyer2 = new Buyer();
|
|
|
|
|
+ Buyer buyer3 = new Buyer();
|
|
|
|
|
+ Buyer buyer4 = new Buyer();
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ String number = excel.getRoomSelectionNumber();
|
|
|
|
|
+ String[] split = number.split("批");
|
|
|
|
|
+ String batchNumber = split[0].replace("第", "");
|
|
|
|
|
+ String roomSelectionNumber = split[1].replace("号", "");
|
|
|
|
|
+ StringBuilder buyerNameBuilder = new StringBuilder();
|
|
|
|
|
+ StringBuilder idCardBuilder = new StringBuilder();
|
|
|
|
|
+
|
|
|
|
|
+ CustomerManagement customerManagement = extendMapper.getByNum(excel.getOldRoomSelectionNumber());
|
|
|
|
|
+ List<Buyer> buyers = new ArrayList<>();
|
|
|
|
|
+
|
|
|
|
|
+ // 拼接买受人名称
|
|
|
|
|
+ if(StringUtils.isNotEmpty(excel.getBuyerName1())){
|
|
|
|
|
+ buyerNameBuilder.append(excel.getBuyerName1()).append(",");
|
|
|
|
|
+
|
|
|
|
|
+ buyer1.setCustomerManagementId(customerManagement.getId());
|
|
|
|
|
+ buyer1.setName(excel.getBuyerName1());
|
|
|
|
|
+ buyer1.setIdentityCard(excel.getIdentityCard1());
|
|
|
|
|
+ buyer1.setPhone(excel.getPhone1());
|
|
|
|
|
+ buyer1.setOrderNum(1);
|
|
|
|
|
+ buyers.add(buyer1);
|
|
|
|
|
+ }
|
|
|
|
|
+ if(StringUtils.isNotEmpty(excel.getBuyerName2())){
|
|
|
|
|
+ buyerNameBuilder.append(excel.getBuyerName2()).append(",");
|
|
|
|
|
+
|
|
|
|
|
+ buyer2.setCustomerManagementId(customerManagement.getId());
|
|
|
|
|
+ buyer2.setName(excel.getBuyerName2());
|
|
|
|
|
+ buyer2.setIdentityCard(excel.getIdentityCard2());
|
|
|
|
|
+ buyer2.setPhone(excel.getPhone2());
|
|
|
|
|
+ buyer2.setOrderNum(2);
|
|
|
|
|
+ buyers.add(buyer2);
|
|
|
|
|
+ }
|
|
|
|
|
+ if(StringUtils.isNotEmpty(excel.getBuyerName3())){
|
|
|
|
|
+ buyerNameBuilder.append(excel.getBuyerName3()).append(",");
|
|
|
|
|
+
|
|
|
|
|
+ buyer3.setCustomerManagementId(customerManagement.getId());
|
|
|
|
|
+ buyer3.setName(excel.getBuyerName3());
|
|
|
|
|
+ buyer3.setIdentityCard(excel.getIdentityCard3());
|
|
|
|
|
+ buyer3.setOrderNum(3);
|
|
|
|
|
+ buyers.add(buyer3);
|
|
|
|
|
+ }
|
|
|
|
|
+ if(StringUtils.isNotEmpty(excel.getBuyerName4())){
|
|
|
|
|
+ buyerNameBuilder.append(excel.getBuyerName4()).append(",");
|
|
|
|
|
+
|
|
|
|
|
+ buyer4.setCustomerManagementId(customerManagement.getId());
|
|
|
|
|
+ buyer4.setName(excel.getBuyerName4());
|
|
|
|
|
+ buyer4.setIdentityCard(excel.getIdentityCard4());
|
|
|
|
|
+ buyer4.setOrderNum(4);
|
|
|
|
|
+ buyers.add(buyer4);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 拼接 身份证
|
|
|
|
|
+ if(StringUtils.isNotEmpty(excel.getIdentityCard1())){
|
|
|
|
|
+ idCardBuilder.append(excel.getIdentityCard1()).append(",");
|
|
|
|
|
+ }
|
|
|
|
|
+ if(StringUtils.isNotEmpty(excel.getIdentityCard2())){
|
|
|
|
|
+ idCardBuilder.append(excel.getIdentityCard2()).append(",");
|
|
|
|
|
+ }
|
|
|
|
|
+ if(StringUtils.isNotEmpty(excel.getIdentityCard3())){
|
|
|
|
|
+ idCardBuilder.append(excel.getIdentityCard3()).append(",");
|
|
|
|
|
+ }
|
|
|
|
|
+ if(StringUtils.isNotEmpty(excel.getIdentityCard4())){
|
|
|
|
|
+ idCardBuilder.append(excel.getIdentityCard4()).append(",");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if(buyerNameBuilder.length()>1){
|
|
|
|
|
+ buyerNameBuilder.deleteCharAt(buyerNameBuilder.length()-1);
|
|
|
|
|
+ }
|
|
|
|
|
+ if(idCardBuilder.length()>1){
|
|
|
|
|
+ idCardBuilder.deleteCharAt(idCardBuilder.length()-1);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ customerManagement.setBatchNumber(batchNumber);
|
|
|
|
|
+ customerManagement.setRoomSelectionNumber(roomSelectionNumber);
|
|
|
|
|
+ customerManagement.setBuyerName(buyerNameBuilder.toString());
|
|
|
|
|
+ customerManagement.setBuyerIdentityCard(idCardBuilder.toString());
|
|
|
|
|
+ updateByPrimaryKeySelective(customerManagement);
|
|
|
|
|
+
|
|
|
|
|
+ for(Buyer buyer: buyers){
|
|
|
|
|
+ buyerService.insertSelective(buyer);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 客户选房信息
|
|
|
|
|
+ * @param file
|
|
|
|
|
+ * @throws IOException
|
|
|
|
|
+ */
|
|
|
|
|
+ public void tempCusUpdate2(MultipartFile file) throws IOException {
|
|
|
|
|
+
|
|
|
|
|
+ // 读取excel
|
|
|
|
|
+ ExcelUtils excelUtils = new ExcelUtils();
|
|
|
|
|
+ List<TempCusExcel> list = excelUtils.excelImport(file.getInputStream(), TempCusExcel.class,"需要新增的选房信息",1);
|
|
|
|
|
+ for(TempCusExcel excel : list){
|
|
|
|
|
+ System.out.println("excel信息" + excel.toString());
|
|
|
|
|
+
|
|
|
|
|
+ // 原编号
|
|
|
|
|
+ String oldRoomSelectionNumber = excel.getOldRoomSelectionNumber();
|
|
|
|
|
+ String roomSelectionDate = excel.getRoomSelectionDate();
|
|
|
|
|
+ Date date = DateUtils.parseDate(roomSelectionDate);
|
|
|
|
|
+
|
|
|
|
|
+ CustomerManagement customerManagement = extendMapper.getByNum(oldRoomSelectionNumber);
|
|
|
|
|
+ customerManagement.setRoomSelectionDate(date);
|
|
|
|
|
+ updateByPrimaryKeySelective(customerManagement);
|
|
|
|
|
+
|
|
|
|
|
+ String buildName = excel.getBuildName();
|
|
|
|
|
+ String roomNo = excel.getRoomNo();
|
|
|
|
|
+ ParkRoom room = extendMapper.getByBuildHouseName(buildName, roomNo);
|
|
|
|
|
+
|
|
|
|
|
+ // 选房
|
|
|
|
|
+ roomSelectionInfoService.submit(room.getId(),customerManagement.getId(),"1");
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ public void tempContractUpdate(MultipartFile file) throws IOException {
|
|
|
|
|
+
|
|
|
|
|
+ // 读取excel
|
|
|
|
|
+ ExcelUtils excelUtils = new ExcelUtils();
|
|
|
|
|
+ List<TempContractExcel> list = excelUtils.excelImport(file.getInputStream(), TempContractExcel.class,"需要新增的合同信息",1);
|
|
|
|
|
+ for(TempContractExcel excel : list){
|
|
|
|
|
+ System.out.println("excel信息" + excel.toString());
|
|
|
|
|
+
|
|
|
|
|
+ // 原编号
|
|
|
|
|
+ String oldRoomSelectionNumber = excel.getOldRoomSelectionNumber();
|
|
|
|
|
+ // 客户信息
|
|
|
|
|
+ CustomerManagement customerManagement = extendMapper.getByNum(oldRoomSelectionNumber);
|
|
|
|
|
+ // 已签约
|
|
|
|
|
+ customerManagement.setStatus(3);
|
|
|
|
|
+ updateByPrimaryKeySelective(customerManagement);
|
|
|
|
|
+
|
|
|
|
|
+ String buildName = excel.getBuildName();
|
|
|
|
|
+ String roomNo = excel.getRoomNo();
|
|
|
|
|
+ ParkRoom parkRoom = extendMapper.getByBuildHouseName(buildName, roomNo);
|
|
|
|
|
+ ParkFloorDisc parkFloorDisc = parkFloorDiscMapper.selectByPrimaryKey(parkRoom.getDiscId());
|
|
|
|
|
+
|
|
|
|
|
+ String signingDateStr = excel.getSigningDate();
|
|
|
|
|
+ // 签约日期
|
|
|
|
|
+ Date signingDate = DateUtils.parseDate(signingDateStr);
|
|
|
|
|
+ String contractAmountStr = excel.getContractAmount();
|
|
|
|
|
+ BigDecimal contractAmount = new BigDecimal(contractAmountStr);
|
|
|
|
|
+ BigDecimal roomArea = new BigDecimal(parkRoom.getActualBuildArea() + "");
|
|
|
|
|
+ BigDecimal housePrice = contractAmount.divide(roomArea, 2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
+
|
|
|
|
|
+ // 合同新增
|
|
|
|
|
+ ContractManage contractManage = new ContractManage();
|
|
|
|
|
+ contractManage.setContractNumber(excel.getContractNumber());
|
|
|
|
|
+ contractManage.setSigningDate(signingDate);
|
|
|
|
|
+ contractManage.setTotalPrice(contractAmount);
|
|
|
|
|
+ contractManage.setHousePrice(housePrice);
|
|
|
|
|
+ contractManage.setBankName(excel.getBankName());
|
|
|
|
|
+ contractManage.setBankNumber(excel.getBankNumber());
|
|
|
|
|
+ if(excel.getPaymentMethod().equals("贷款")){
|
|
|
|
|
+ contractManage.setPaymentMethod(2);
|
|
|
|
|
+ }else if(excel.getPaymentMethod().equals("一次性付款")){
|
|
|
|
|
+ contractManage.setPaymentMethod(1);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ contractManage.setId(IdUtil.simpleUUID());
|
|
|
|
|
+ contractManage.setCustomerManagementId(customerManagement.getId());
|
|
|
|
|
+ contractManage.setHouseId(parkRoom.getId());
|
|
|
|
|
+// contractManage.setSubscriptionFunds(roomSelectionInfo.getReceivableMoney());
|
|
|
|
|
+ contractManage.setActualBuildArea(parkRoom.getActualBuildArea());
|
|
|
|
|
+ contractManage.setActualInternalArea(parkRoom.getActualInternalArea());
|
|
|
|
|
+ contractManage.setActualShareArea(parkRoom.getActualShareArea());
|
|
|
|
|
+ contractManage.setMaintenanceFunds(parkFloorDisc.getMaintenanceFunds());
|
|
|
|
|
+ if(parkFloorDisc.getMaintenanceFunds() != null){
|
|
|
|
|
+ BigDecimal area = new BigDecimal(parkRoom.getActualBuildArea().toString());
|
|
|
|
|
+ contractManage.setMaintenanceTotalPrice(parkFloorDisc.getMaintenanceFunds().multiply(area));
|
|
|
|
|
+ }
|
|
|
|
|
+ contractManage.setContractStatus(1);
|
|
|
|
|
+ contractManage.setFundCollectionStatus(1);
|
|
|
|
|
+ contractManage.setCreatedAt(new Date());
|
|
|
|
|
+ contractManage.setCreatedId("1");
|
|
|
|
|
+
|
|
|
|
|
+ // 拼接买受人名称
|
|
|
|
|
+ BuyerExample buyerExample = new BuyerExample();
|
|
|
|
|
+ buyerExample.createCriteria().andCustomerManagementIdEqualTo(customerManagement.getId());
|
|
|
|
|
+ List<Buyer> buyers = buyerService.selectByExample(buyerExample);
|
|
|
|
|
+ StringBuilder builder = new StringBuilder();
|
|
|
|
|
+ for(Buyer buyer : buyers){
|
|
|
|
|
+ if(buyer.getOrderNum() == 1){
|
|
|
|
|
+ builder.append(buyer.getName()).append(",");
|
|
|
|
|
+ }else {
|
|
|
|
|
+ String dictLabel = sysDictService.getDictLabel("RELATIONSHIP", buyer.getRelationship());
|
|
|
|
|
+ builder.append(buyer.getName())
|
|
|
|
|
+ .append("(")
|
|
|
|
|
+ .append(dictLabel)
|
|
|
|
|
+ .append(")")
|
|
|
|
|
+ .append(",");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if(builder.length() > 0){
|
|
|
|
|
+ builder.deleteCharAt(builder.length()-1);
|
|
|
|
|
+ }
|
|
|
|
|
+ contractManage.setBuyerName(builder.toString());
|
|
|
|
|
+
|
|
|
|
|
+ ParkRoomResponse response = parkRoomService.getFullName(parkRoom.getId());
|
|
|
|
|
+ String fullName = response.getGroupName() + "-" +
|
|
|
|
|
+ response.getDiscName() + "-" +
|
|
|
|
|
+ response.getBuildName() + "-" +
|
|
|
|
|
+ response.getRoomNo();
|
|
|
|
|
+ contractManage.setHouseName(fullName);
|
|
|
|
|
+ int result = contractManageService.insertWithoutId(contractManage);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|