Переглянути джерело

专项维修资金增加下载

LAPTOP-FO2T5SIU\35838 4 місяців тому
батько
коміт
3519588878

+ 13 - 0
pro-base/src/main/java/com/idea/paymentManagement/controller/MaintenanceFundsManagementController.java

@@ -2,6 +2,7 @@ package com.idea.paymentManagement.controller;
 
 import com.github.pagehelper.PageInfo;
 import com.idea.customerManagement.dto.ContractManageDto;
+import com.idea.customerManagement.dto.RoomSelectionInfoDto;
 import com.idea.paymentManagement.model.MaintenanceFundsManagement;
 import com.idea.paymentManagement.service.MaintenanceFundsManagementService;
 import com.rockstar.common.base.BaseController;
@@ -13,10 +14,12 @@ import com.rockstar.util.StringUtils;
 import io.swagger.annotations.Api;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.ResponseBody;
 
+import javax.servlet.http.HttpServletResponse;
 import java.util.List;
 
 @Controller
@@ -100,4 +103,14 @@ public class MaintenanceFundsManagementController extends BaseController {
     }
 
 
+    /**
+     * 定金收据下载
+     * @param model
+     * @param response
+     */
+    @GetMapping(value = "downLoadReceipt",produces = {"application/json;charset=UTF-8"})
+    public void downLoadReceipt(MaintenanceFundsManagement model, HttpServletResponse response) {
+        modelService.downLoadReceipt(model,response);
+    }
+
 }

+ 135 - 32
pro-base/src/main/java/com/idea/paymentManagement/service/MaintenanceFundsManagementService.java

@@ -1,14 +1,21 @@
 package com.idea.paymentManagement.service;
 
+import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.io.IoUtil;
 import cn.hutool.core.util.IdUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
+import com.idea.buildManage.mapper.ParkRoomExtendMapper;
 import com.idea.buildManage.mapper.ParkRoomMapper;
 import com.idea.buildManage.model.ParkRoom;
+import com.idea.buildManage.response.ParkRoomResponse;
 import com.idea.customerManagement.dto.ContractManageDto;
 import com.idea.customerManagement.mapper.ContractManageMapper;
+import com.idea.customerManagement.model.Buyer;
+import com.idea.customerManagement.model.BuyerExample;
 import com.idea.customerManagement.model.ContractManage;
+import com.idea.customerManagement.service.BuyerService;
 import com.idea.invoice.model.InvoiceBank;
 import com.idea.invoice.model.InvoiceBankExample;
 import com.idea.invoice.model.InvoiceManage;
@@ -22,21 +29,30 @@ import com.idea.paymentManagement.model.MaintenanceFundsManagement;
 import com.idea.paymentManagement.model.MaintenanceFundsManagementExample;
 import com.idea.paymentManagement.model.PayLog;
 import com.idea.paymentManagement.model.PayLogExample;
+import com.idea.util.DateUtils;
+import com.idea.util.MoneyUtils;
+import com.idea.util.ReplaceWord;
+import com.idea.util.WordToPdfUtil;
 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 lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import javax.servlet.http.HttpServletResponse;
+import java.io.File;
+import java.io.OutputStream;
 import java.math.BigDecimal;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
+import java.net.URLEncoder;
+import java.util.*;
 
+@Slf4j
 @Service
 public class MaintenanceFundsManagementService implements BaseService<MaintenanceFundsManagement, MaintenanceFundsManagementExample> {
 
@@ -54,7 +70,12 @@ public class MaintenanceFundsManagementService implements BaseService<Maintenanc
     private PayLogMapper payLogMapper;
     @Autowired
     private InvoiceManageService invoiceManageService;
-
+    @Autowired
+    private BuyerService buyerService;
+    @Autowired
+    private ParkRoomExtendMapper roomExtendMapper;
+    @Autowired
+    private SysDictService sysDictService;
 
 
     @Override
@@ -160,34 +181,35 @@ public class MaintenanceFundsManagementService implements BaseService<Maintenanc
         payLog.setBankNumber(model.getBankNumber());
         payLogMapper.insertSelective(payLog);
 
-        // 查询合同的房款收款情况
-        Integer collectionStatus = contractManage.getFundCollectionStatus();
-        // 完全收款
-        if(collectionStatus == 2){
-            // 查询该合同是否已生成 正式发票 且类型是专项维修资金
-            InvoiceManageExample invoiceManageExample = new InvoiceManageExample();
-            invoiceManageExample.createCriteria().andTypeEqualTo("2")
-                    .andContractIdEqualTo(model.getContractId())
-                    .andPaymentTypeEqualTo("2");
-            List<InvoiceManage> invoiceManages = invoiceManageService.selectByExample(invoiceManageExample);
-            if(CollectionUtils.isEmpty(invoiceManages)){
-                // 生成一条待推送的开票信息
-                InvoiceManage invoiceManage = invoiceManageService.getInfoByContract(model.getContractId(),
-                        "*不动产*",2);
-                invoiceManage.setInvoiceAmount(payMoney);
-                // 正式发票
-                invoiceManage.setType("2");
-                // 专项维修资金
-                invoiceManage.setPaymentType("2");
-                invoiceManage.setSendStatus("0");
-                invoiceManage.setInvoiceStatus("0");
-                invoiceManage.setInvoiceTax(null);
-                invoiceManage.setRemark(null);
-                invoiceManage.setCreateUser(ShiroUtils.getUserId());
-                invoiceManage.setCreateTime(new Date());
-                invoiceManageService.insertSelective(invoiceManage);
-            }
-        }
+        // TODO: 2025/1/14 取消正式发票新增
+//        // 查询合同的房款收款情况
+//        Integer collectionStatus = contractManage.getFundCollectionStatus();
+//        // 完全收款
+//        if(collectionStatus == 2){
+//            // 查询该合同是否已生成 正式发票 且类型是专项维修资金
+//            InvoiceManageExample invoiceManageExample = new InvoiceManageExample();
+//            invoiceManageExample.createCriteria().andTypeEqualTo("2")
+//                    .andContractIdEqualTo(model.getContractId())
+//                    .andPaymentTypeEqualTo("2");
+//            List<InvoiceManage> invoiceManages = invoiceManageService.selectByExample(invoiceManageExample);
+//            if(CollectionUtils.isEmpty(invoiceManages)){
+//                // 生成一条待推送的开票信息
+//                InvoiceManage invoiceManage = invoiceManageService.getInfoByContract(model.getContractId(),
+//                        "*不动产*",2);
+//                invoiceManage.setInvoiceAmount(payMoney);
+//                // 正式发票
+//                invoiceManage.setType("2");
+//                // 专项维修资金
+//                invoiceManage.setPaymentType("2");
+//                invoiceManage.setSendStatus("0");
+//                invoiceManage.setInvoiceStatus("0");
+//                invoiceManage.setInvoiceTax(null);
+//                invoiceManage.setRemark(null);
+//                invoiceManage.setCreateUser(ShiroUtils.getUserId());
+//                invoiceManage.setCreateTime(new Date());
+//                invoiceManageService.insertSelective(invoiceManage);
+//            }
+//        }
 
 
 
@@ -304,7 +326,88 @@ public class MaintenanceFundsManagementService implements BaseService<Maintenanc
 
 
 
+    public void downLoadReceipt(MaintenanceFundsManagement model, HttpServletResponse response) {
+
+        MaintenanceFundsManagementExample example = new MaintenanceFundsManagementExample();
+        example.createCriteria().andContractIdEqualTo(model.getContractId());
+        List<MaintenanceFundsManagement> maintenanceFundsManagements = selectByExample(example);
+        MaintenanceFundsManagement newRecord = maintenanceFundsManagements.get(0);
+        ContractManage contractManage = contractManageMapper.selectByPrimaryKey(newRecord.getContractId());
+
+        String filePath = "/home/project/settleDown/tem/receipt.docx";
+        String fileName = "专项维修资金收据.docx";
+        String sealPath = "/home/project/settleDown/tem/seal.png";
+        String sealPath2 = "/home/project/settleDown/tem/huanpiao.png";
+        String customerManagementId = newRecord.getCustomerManagementId();
+        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);
+            }
+        }
+
+        ParkRoomResponse roomResponse = roomExtendMapper.getFullName(newRecord.getHouseId());
+        String fullName = roomResponse.getGroupName() + "-"
+                + roomResponse.getDiscName() + "-"
+                + roomResponse.getBuildName() + "-"
+                + roomResponse.getRoomNo();
+
+        String serialNumber = contractManage.getContractNumber();
+        String collectionTime = DateUtils.parseDateToStr(DateUtils.DATE_CH, newRecord.getPayTime());
+        String content = "专项维修资金";
+        String paymentMethod = "";
+        String dictLabel = sysDictService.getDictLabel("COLLECTION_METHODS", newRecord.getPaymentMethod().toString());
+        if (StringUtils.isNotEmpty(dictLabel)) {
+            paymentMethod = dictLabel;
+        }
+        String receivedAmount = newRecord.getPayMoney().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", "0");
+        settingData.put("${seal}", settingInfoData);
+
+
+        try {
+            File tempWord = ReplaceWord.operateWord(response, filePath, fileName, data, picData, sealData, settingData);
+            File tempPDF = WordToPdfUtil.word2Pdf(tempWord);
+            response.setContentType("text/html;charset=UTF-8");
+            response.setContentType("application/pdf");
+            response.setHeader("Content-disposition", "attachment; filename=" + URLEncoder.encode(fileName, "utf-8"));
+            OutputStream out = response.getOutputStream();
+            IoUtil.copy(FileUtil.getInputStream(tempPDF), out);
+            out.close();
+            tempWord.deleteOnExit();
+            tempPDF.deleteOnExit();
+        }catch (Exception e){
+            log.error("文档生成报错:", e);
+        }
 
+    }
 
 
 

+ 5 - 4
pro-base/src/main/java/com/idea/util/OAUtil.java

@@ -41,7 +41,7 @@ public class OAUtil {
                 .body(body)
                 .execute();
 
-        System.out.println("请求参数:" + JSON.toJSONString(parma));
+//        System.out.println("请求参数:" + JSON.toJSONString(parma));
         // 获取响应状态码
         int statusCode = response.getStatus();
 //        System.out.println("Status Code: " + statusCode);
@@ -57,11 +57,11 @@ public class OAUtil {
         String date = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, new Date());
         Map json = new HashMap<String, Object>();
         json.put("syscode", "AJ");
-        json.put("flowid", "GJU3IETllGmJniazSVP2");
-        json.put("requestname", "周天一的付款申请单");
+        json.put("flowid", "vNLLiH6iPLi1iVlWKUp");
+        json.put("requestname", "豆浆的付款申请单");
         json.put("workflowname", "付款申请");
         json.put("nodeName", "财务负责人");
-        json.put("pcurl", "https://www.idea-co-sf.com/settleDown/#/login");
+        json.put("pcurl", "");
         json.put("appurl", "");
         json.put("creator", "ceshi");
         json.put("createdatetime", date);
@@ -73,6 +73,7 @@ public class OAUtil {
 
         String body = JSON.toJSONString(json);
         String url = prefix + "/rest/ofs/ReceiveRequestInfoByJson";
+//        String url = prefix + "/rest/ofs/deleteUserRequestInfoByJson";
 
         // 发送POST请求
         HttpResponse response = HttpRequest.post(url)

+ 8 - 7
pro-base/src/main/java/com/idea/workPanel/service/ParkWaitHandleService.java

@@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.IdUtil;
 import cn.hutool.crypto.SecureUtil;
 import cn.hutool.crypto.symmetric.AES;
+import com.alibaba.fastjson.JSON;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.idea.oa.apply.util.constant.ConstantFlowType;
@@ -339,7 +340,7 @@ public class ParkWaitHandleService implements BaseService<ParkWaitHandle, ParkWa
             String nodeName = flowMainPush.getNodeName();
             String pcurl = serverUrl + "&loginid=" + username;
             String appurl = "";
-            String isremark = "0";
+            String isremark = "2";
             String viewtype = "0";
             // TODO: 2024/11/15 创建者和接收者需求oa协商
             String creator = "ceshi";
@@ -363,7 +364,7 @@ public class ParkWaitHandleService implements BaseService<ParkWaitHandle, ParkWa
             map.put("viewtype", viewtype);
             map.put("receivets", receivets);
 
-            log.info("泛微刷新待办详情:{}", map);
+            log.info("泛微刷新待办详情:{}", JSON.toJSONString(map));
             String result = OAUtil.receiveRequestInfoByJson(map);
             log.info("泛微刷新待办结果:{}", result);
         } catch (Exception e) {
@@ -393,7 +394,7 @@ public class ParkWaitHandleService implements BaseService<ParkWaitHandle, ParkWa
             String nodeName = flowMainPush.getNodeName();
             String pcurl = serverUrl + "&loginid=" + username;
             String appurl = "";
-            String isremark = "0";
+            String isremark = "2";
             String viewtype = "0";
             // TODO: 2024/11/15 创建者和接收者需求oa协商
             String creator = "ceshi";
@@ -417,7 +418,7 @@ public class ParkWaitHandleService implements BaseService<ParkWaitHandle, ParkWa
             map.put("viewtype", viewtype);
             map.put("receivets", receivets);
 
-            log.info("泛微刷新待办详情:{}", map);
+            log.info("泛微刷新待办详情:{}", JSON.toJSONString(map));
             String result = OAUtil.receiveRequestInfoByJson(map);
             log.info("泛微刷新待办结果:{}", result);
         } catch (Exception e) {
@@ -493,9 +494,9 @@ public class ParkWaitHandleService implements BaseService<ParkWaitHandle, ParkWa
                     map.put("viewtype", viewtype);
                     map.put("receivets", receivets);
 
-                    log.info("泛微推送详情:{}", map);
+                    log.info("泛微开始流程推送详情:{}", JSON.toJSONString(map));
                     String result = OAUtil.receiveRequestInfoByJson(map);
-                    log.info("泛微推送结果:{}", result);
+                    log.info("泛微开始流程推送结果:{}", result);
 
                 }
 
@@ -567,7 +568,7 @@ public class ParkWaitHandleService implements BaseService<ParkWaitHandle, ParkWa
                 map.put("viewtype", viewtype);
                 map.put("receivets", receivets);
 
-                log.info("泛微推送待办详情:{}", map);
+                log.info("泛微推送待办详情:{}", JSON.toJSONString(map));
                 String result = OAUtil.receiveRequestInfoByJson(map);
                 log.info("泛微推送待办结果:{}", result);