Ver código fonte

Merge remote-tracking branch 'origin/master'

zt 9 meses atrás
pai
commit
13712c69e2

+ 16 - 0
pro-base/pom.xml

@@ -13,6 +13,22 @@
     <packaging>jar</packaging>
 
     <dependencies>
+        <!-- 用友工具类 -->
+        <dependency>
+            <groupId>openAPIUtil</groupId>
+            <artifactId>openAPIUtil</artifactId>
+            <version>1.0.0</version>
+            <scope>system</scope>
+            <systemPath>${project.basedir}/../pro-base/src/main/resources/lib/OpenAPIUtil-1.0.0.jar</systemPath>
+        </dependency>
+        <dependency>
+            <groupId>commons-codec</groupId>
+            <artifactId>commons-codec</artifactId>
+            <version>1.6</version>
+            <scope>system</scope>
+            <systemPath>${project.basedir}/../pro-base/src/main/resources/lib/commons-codec-1.6.jar</systemPath>
+        </dependency>
+
         <!-- Rock 工程依赖 -->
         <dependency>
             <groupId>com.rockstar.anticontrol</groupId>

+ 13 - 1
pro-base/src/main/java/com/idea/customerManagement/controller/IntentionalDepositController.java

@@ -2,6 +2,7 @@ package com.idea.customerManagement.controller;
 
 import com.github.pagehelper.PageInfo;
 import com.idea.customerManagement.dto.IntentionalDepositDto;
+import com.idea.customerManagement.dto.RoomSelectionInfoDto;
 import com.idea.customerManagement.model.IntentionalDeposit;
 import com.idea.customerManagement.service.IntentionalDepositService;
 import com.rockstar.common.base.BaseController;
@@ -12,10 +13,13 @@ import com.rockstar.frame.model.extend.Tablepar;
 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;
+
 @Controller
 @RequestMapping(value = "IntentionalDepositController")
 @Api(tags = "意向金管理")
@@ -129,7 +133,15 @@ public class IntentionalDepositController extends BaseController {
     }
 
 
-
+    /**
+     * 意向金收据下载
+     * @param model
+     * @param response
+     */
+    @GetMapping(value = "downLoadReceipt",produces = {"application/json;charset=UTF-8"})
+    public void downLoadReceipt(IntentionalDeposit model, HttpServletResponse response) {
+        modelService.downLoadReceipt(model,response);
+    }
 
 
 

+ 10 - 0
pro-base/src/main/java/com/idea/customerManagement/controller/RoomSelectionInfoController.java

@@ -108,6 +108,16 @@ public class RoomSelectionInfoController extends BaseController {
         modelService.downLoad(model,request,response);
     }
 
+    /**
+     * 定金收据下载
+     * @param model
+     * @param response
+     */
+    @GetMapping(value = "downLoadReceipt",produces = {"application/json;charset=UTF-8"})
+    public void downLoadReceipt(RoomSelectionInfoDto model, HttpServletResponse response) {
+        modelService.downLoadReceipt(model,response);
+    }
+
     @PostMapping(value = "list",produces = {"application/json;charset=UTF-8"})
     @ResponseBody
     public Object list(Tablepar tablepar, RoomSelectionInfoDto model, DateTrans dt){

+ 4 - 1
pro-base/src/main/java/com/idea/customerManagement/service/ContractManageService.java

@@ -156,7 +156,10 @@ public class ContractManageService implements BaseService<ContractManage, Contra
         contractManage.setBuyerName(builder.toString());
 
         ParkRoomResponse response = parkRoomService.getFullName(roomSelectionInfo.getHouseId());
-        String fullName = response.getGroupName() + response.getDiscName() + response.getBuildName() + response.getRoomNo();
+        String fullName = response.getGroupName() + "-" +
+                response.getDiscName() + "-" +
+                response.getBuildName() + "-" +
+                response.getRoomNo();
         contractManage.setHouseName(fullName);
         int result = insertWithoutId(contractManage);
         return result;

+ 58 - 3
pro-base/src/main/java/com/idea/customerManagement/service/IntentionalDepositService.java

@@ -15,6 +15,7 @@ import com.idea.buildManage.model.ParkRoom;
 import com.idea.buildManage.response.ParkRoomResponse;
 import com.idea.customerManagement.dto.ContractManageDto;
 import com.idea.customerManagement.dto.IntentionalDepositDto;
+import com.idea.customerManagement.dto.RoomSelectionInfoDto;
 import com.idea.customerManagement.mapper.CustomerManagementMapper;
 import com.idea.customerManagement.mapper.IntentionalDepositExtendMapper;
 import com.idea.customerManagement.mapper.IntentionalDepositMapper;
@@ -25,21 +26,24 @@ import com.idea.invoice.model.ReceiptManageExample;
 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.FrameUser;
 import com.rockstar.frame.model.extend.DateTrans;
 import com.rockstar.frame.model.extend.Tablepar;
 import com.rockstar.frame.service.FrameUserService;
 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;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+import java.util.*;
 
 @Service
 public class IntentionalDepositService implements BaseService<IntentionalDeposit, IntentionalDepositExample> {
@@ -68,6 +72,10 @@ public class IntentionalDepositService implements BaseService<IntentionalDeposit
     private PayLogMapper payLogMapper;
     @Autowired
     private ReceiptManageService receiptManageService;
+    @Autowired
+    private BuyerService buyerService;
+    @Autowired
+    private SysDictService sysDictService;
 
 
     @Override
@@ -402,4 +410,51 @@ public class IntentionalDepositService implements BaseService<IntentionalDeposit
         return intentionalDepositDto;
     }
 
+    /**
+     * 意向金收据
+     * @param model
+     * @param response
+     */
+    public void downLoadReceipt(IntentionalDeposit 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();
+        }
+        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("${capital}", capital);
+        data.put("${receivedAmount}", receivedAmount);
+
+        ReplaceWord.operateWord(response, filePath, fileName, data, picData, sealData);
+
+
+    }
+
+
+
 }

+ 78 - 14
pro-base/src/main/java/com/idea/customerManagement/service/RoomSelectionInfoService.java

@@ -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);
+
+
+    }
+
 
 }

+ 274 - 0
pro-base/src/main/java/com/idea/invoice/util/InvoiceUtil.java

@@ -0,0 +1,274 @@
+package com.idea.invoice.util;
+
+import cn.hutool.core.util.IdUtil;
+import cn.hutool.http.HttpUtil;
+import cn.hutool.json.JSONUtil;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.idea.invoice.model.InvoiceManage;
+import com.idea.util.DateUtils;
+import lombok.extern.slf4j.Slf4j;
+import nccloud.open.api.auto.token.cur.utils.APICurUtils;
+
+import java.util.Date;
+import java.util.HashMap;
+
+@Slf4j
+public class InvoiceUtil {
+
+
+    public static final String ip = "10.1.2.51";
+
+    public static final String port = "9999";
+
+    public static final String biz_center = "CJJT";
+
+    public static final String client_id = "ajbzf";
+
+    public static final String client_secret = "c7ac88aa8be64197be9b";
+
+    public static final String pubKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApX9UZNt0EbdHBRGnR3SpgiP+1BEZf+1DpbYoJ0kJJuba7ZBhH+WDjSlRpEPA0FOFRyE0OvIMK5yIaodLRfeEgDyz+Jv5dnOBdS2gJqeVV/ugm5nk7TGAM/65PeFQxua3QgFeTJjZU/lGCHHl5oKRFgmB9/kumuryydKpOOkeT2fYjzoG8feuIhDoOGfR4y5sjTUFH4nN8VCE/zXylVEbj2hMeJSDzdESAy3+Ui64smCv6ZsLVgsWXhhLFsLWzkbh7/pElnoK3qhr6MVeAIokd7bS+Hp+6S5s10jwjPkd+POX/qQSHP1MmVngLlD7P0caxjQaH3+w8KsLQoydeUARVQIDAQAB";
+
+    public static final String username = "ajbzf";
+
+    public static final String password = "1234qwer!";
+
+    /**
+     * 组织编码
+     */
+    public static final String pk_org = "0102";
+
+    /**
+     * 自定义档案列表编码
+     */
+    public static final String pk_defdoclist = "CJ21";
+
+    public static void main(String[] args) throws Exception {
+
+        InvoiceUtil.paybillAdd();
+
+    }
+
+    /**
+     * 获取token
+     * @return
+     * @throws Exception
+     */
+    public static String getToken(APICurUtils util) throws Exception {
+        util.init(ip, port, biz_center, client_id, client_secret, pubKey, username, password);
+        String token = util.getToken();
+        
+        return token;
+    }
+
+    /**
+     * 房间新增
+     * @throws Exception
+     */
+    public static void defdocAdd() throws Exception {
+        APICurUtils util = new APICurUtils();
+        String token = InvoiceUtil.getToken(util);
+        util.setApiUrl("nccloud/api/wxyy/uapbd/defdoc/add");
+        JSONObject json = new JSONObject();
+        json.put("srcsystemid", "1300419721555869696");
+        json.put("code","1300419721555869696");
+        json.put("name","天鹅湖花园-一期-41-101");
+        json.put("pk_org",pk_org);
+        json.put("pk_defdoclist",pk_defdoclist);
+        String result = util.getAPIRetrun(token, json.toJSONString());
+        
+        log.info("房间新增:{}",result);
+    }
+
+    /**
+     * 客户新增
+     * @throws Exception
+     */
+    public static void customerAdd() throws Exception {
+        APICurUtils util = new APICurUtils();
+        String token = InvoiceUtil.getToken(util);
+        util.setApiUrl("nccloud/api/wxyy/uapbd/customer/add");
+        JSONObject json = new JSONObject();
+        json.put("srcsystemid", "a9eb2c6f3e1f4b36a93f06fdba1a7177");
+        json.put("name","客户测试");
+        json.put("pk_custclass","02"); //客户基本分类 ,,(默认是02),必选,01内部客户,02外部客户
+        json.put("custprop","0");//财务组织客户类型,必选,默认0
+        json.put("taxpayerid","tyxydm00002"); //统一社会信用代码,必选
+        String result = util.getAPIRetrun(token, json.toJSONString());
+        
+        log.info("客户新增:{}",result);
+    }
+
+    /**
+     * 客户分配
+     * @throws Exception
+     */
+    public static void customerAssign() throws Exception {
+        APICurUtils util = new APICurUtils();
+        String token = InvoiceUtil.getToken(util);
+        util.setApiUrl("nccloud/api/wxyy/uapbd/customer/assign");
+        JSONObject json = new JSONObject();
+        json.put("pk_org", pk_org);
+        json.put("ncid","tyxydm00002");
+        String result = util.getAPIRetrun(token, json.toJSONString());
+        
+        log.info("客户分配:{}",result);
+    }
+
+    /**
+     * 付款单接口_退款单
+     * @throws Exception
+     */
+    public static void paybillAdd() throws Exception {
+        APICurUtils util = new APICurUtils();
+        String token = InvoiceUtil.getToken(util);
+        util.setApiUrl("nccloud/api/wxyy/arap/paybill/saveandcommit");
+        String billdate = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, new Date());
+        JSONObject json = new JSONObject();
+        
+        JSONObject ap_paybill = new JSONObject();
+        String srcsystemid = IdUtil.simpleUUID();
+        ap_paybill.put("srcsystemid", srcsystemid); //外系统标识,必选
+        ap_paybill.put("pk_tradetype","F3-Cxx-06"); //交易类型,必选
+        ap_paybill.put("pk_org",pk_org); //组织编码,必选
+        ap_paybill.put("billdate",billdate); //单据日期
+        ap_paybill.put("def2",srcsystemid); //外系统单据号,必填,
+        json.put("ap_paybill",ap_paybill);
+
+        JSONArray ap_payitem = new JSONArray();
+        JSONObject ap_payitemJson = new JSONObject();
+        ap_payitemJson.put("srcsystemid",srcsystemid); //外系统子表标识
+        ap_payitemJson.put("scomment","小二"); //客户名称,必选
+        ap_payitemJson.put("pk_subjcode","MY001"); //收支项目编码,必选
+        ap_payitemJson.put("objtype","0"); //0=客户,1=供应商--判断customer和supplier是否必填,必选
+        ap_payitemJson.put("customer","tyxydm00002"); //客商的纳税人识别号
+        ap_payitemJson.put("money_de","200"); //金额,必选
+        ap_payitemJson.put("taxrate","10"); //税率,必选,无税传0
+        ap_payitemJson.put("pk_balatype","3"); //结算方式,必选,使用默认账号付款则结算方式为银企直联
+        ap_payitemJson.put("pk_recpaytype","001"); //付款业务类型传默认值“001”
+        ap_payitemJson.put("prepay","0"); //默认值0
+        ap_payitemJson.put("payaccount","2019219219212323"); //付款银行账号,必选
+        ap_payitemJson.put("checktype","1"); //票据类型,必选,看云文档票据类型
+        ap_payitemJson.put("checkno","111"); //票据号,必选
+        // TODO: 2024/10/28 可能是新增房间返回的数据
+        ap_payitemJson.put("def11","1001211000000003UGY0"); //转出前房号编码,必选
+        ap_payitemJson.put("def9","001"); //业态,必选,看云文档业态
+        ap_payitemJson.put("def10","mwjyAdk"); //项目档案编码,看云文档项目档案对照
+        ap_payitem.add(ap_payitemJson);
+        json.put("ap_payitem",ap_payitem);
+
+        log.info("付款单接口_退款单传参:{}",json.toJSONString());
+        String result = util.getAPIRetrun(token, json.toJSONString());
+        log.info("付款单接口_退款单:{}",result);
+    }
+
+    /**
+     * 应收接口-收入结转单
+     * @throws Exception
+     */
+    public static void recbillAdd() throws Exception {
+        APICurUtils util = new APICurUtils();
+        String token = InvoiceUtil.getToken(util);
+        util.setApiUrl("nccloud/api/wxyy/arap/recbill/saveandcommit");
+        JSONObject json = new JSONObject();
+
+        JSONObject ar_recbill = new JSONObject();
+        String srcsystemid = IdUtil.simpleUUID();
+        String billdate = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, new Date());
+        ar_recbill.put("srcsystemid", srcsystemid); //外系统标识,必选
+        ar_recbill.put("pk_tradetype","F3-Cxx-05"); //交易类型,必选
+        ar_recbill.put("pk_org",pk_org); //组织编码,必选
+        ar_recbill.put("billdate",billdate); //单据日期
+        ar_recbill.put("def2",srcsystemid); //外系统单据号,必填,
+        ar_recbill.put("def19","E05"); //特殊票种标识,默认是E05
+        ar_recbill.put("def20","0"); //征税方式
+        ar_recbill.put("def21","不动产地址"); //不动产地址,必填,字符串
+        ar_recbill.put("def22","N"); //不动产地址,必填,字符串
+        json.put("ar_recbill",ar_recbill);
+
+        JSONArray ar_recitem = new JSONArray();
+        JSONObject ar_recitemJson = new JSONObject();
+        ar_recitemJson.put("srcsystemid",srcsystemid); //外系统子表标识
+        ar_recitemJson.put("scomment",""); //摘要,非必选
+        ar_recitemJson.put("objtype","0"); //0=客户,1=供应商--判断customer和supplier是否必填,必选
+        ar_recitemJson.put("customer","tyxydm00002"); //客商的纳税人识别号
+        ar_recitemJson.put("money_de","100"); //金额,必选
+        ar_recitemJson.put("taxrate","16"); //税率,必选,无税传0
+        ar_recitemJson.put("pk_subjcode","MY003"); //收支项目编码,非必选
+
+        // TODO: 2024/10/28 可能是新增房间返回的数据
+        ar_recitemJson.put("def11","1001211000000003UGY0"); //转出前房号编码,收除了诚意金之外的首期等需要选
+        ar_recitemJson.put("def9","001"); //业态,必选,看云文档业态
+        // TODO: 2024/10/28 没有
+        ar_recitemJson.put("def7",""); //房产工程项目,必选,看云文档
+        // TODO: 2024/10/28 没有
+        ar_recitemJson.put("def8",""); //楼栋,必选,看云文档
+        ar_recitemJson.put("material","XXX"); //物料
+        ar_recitem.add(ar_recitemJson);
+        json.put("ar_recitem",ar_recitem);
+
+        String result = util.getAPIRetrun(token, json.toJSONString());
+        
+        log.info("应收接口-收入结转单:{}",result);
+    }
+
+    /**
+     * 收款单接口-新增提交
+     * @throws Exception
+     */
+    public static void gatheringbillAdd() throws Exception {
+        APICurUtils util = new APICurUtils();
+        String token = InvoiceUtil.getToken(util);
+        util.setApiUrl("nccloud/api/wxyy/arap/recbill/saveandcommit");
+        JSONObject json = new JSONObject();
+
+        JSONObject ar_gatherbill = new JSONObject();
+        String srcsystemid = IdUtil.simpleUUID();
+        String billdate = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, new Date());
+        ar_gatherbill.put("srcsystemid", srcsystemid); //外系统标识,必选
+        ar_gatherbill.put("pk_tradetype","F3-Cxx-06"); //交易类型,必选
+        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","tyxydm00002"); //客商的纳税人识别号
+        ar_gatheritemJson.put("money_cr","200"); //金额,必选
+        ar_gatheritemJson.put("taxrate","10"); //税率,必选,数字——3/10/6````
+        ar_gatheritemJson.put("pk_balatype","3"); //结算方式,必选,看云文档收款类型
+        ar_gatheritemJson.put("pk_recpaytype","001"); //付款业务类型传默认值“001”
+        ar_gatheritemJson.put("prepay","0"); //收款性质应收款时传"0",收款性质预收款时传"1"
+        ar_gatheritemJson.put("recaccount","0407200000001648"); //收款银行账号,必填
+        ar_gatheritemJson.put("scomment","小二"); //客户名称,必选
+        ar_gatheritemJson.put("pk_subjcode","AJ001"); //收支项目编码,必选,看云文档收支项目对照
+        ar_gatheritemJson.put("checktype","1"); //票据类型,必选,看云文档票据类型
+        ar_gatheritemJson.put("checkno","111"); //票据号,必选
+        ar_gatheritemJson.put("def9","001"); //业态,必选,看云文档业态
+        // TODO: 2024/10/28 可能是新增房间返回的数据
+        ar_gatheritemJson.put("def11",""); //转出前房号编码,收除了诚意金之外的首期等需要选
+        // TODO: 2024/10/28 没有
+        ar_gatheritemJson.put("def10",""); //项目档案编码,看云文档项目档案对照
+        ar_gatheritem.add(ar_gatheritemJson);
+        json.put("ar_gatheritem",ar_gatheritem);
+
+        String result = util.getAPIRetrun(token, json.toJSONString());
+        
+        log.info("应收接口-收入结转单:{}",result);
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+}

+ 17 - 4
pro-base/src/main/java/com/idea/paymentManagement/controller/PayLogController.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.model.IntentionalDeposit;
 import com.idea.paymentManagement.dto.PayLogDto;
 import com.idea.paymentManagement.model.PayLog;
 import com.idea.paymentManagement.service.PayLogService;
@@ -15,11 +16,9 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletResponse;
 import java.util.Date;
 
 @Controller
@@ -92,4 +91,18 @@ public class PayLogController extends BaseController {
         return result;
     }
 
+
+    /**
+     * 收款收据下载
+     * @param id
+     * @param response
+     */
+    @GetMapping(value = "downLoadReceipt",produces = {"application/json;charset=UTF-8"})
+    public void downLoadReceipt(String id, HttpServletResponse response) {
+        modelService.downLoadReceipt(id,response);
+    }
+
+
+
+
 }

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

@@ -142,18 +142,18 @@ public class MaintenanceFundsManagementService implements BaseService<Maintenanc
         payLogMapper.insertSelective(payLog);
 
         // 查询合同的房款收款情况
-        Integer collectionStatus = contractManage.getCollectionStatus();
+        Integer collectionStatus = contractManage.getFundCollectionStatus();
         // 完全收款
         if(collectionStatus == 2){
             // 查询该合同是否已生成 正式发票
             InvoiceManageExample invoiceManageExample = new InvoiceManageExample();
-            invoiceManageExample.createCriteria().andTypeEqualTo("1").andContractIdEqualTo(model.getContractId());
+            invoiceManageExample.createCriteria().andTypeEqualTo("2").andContractIdEqualTo(model.getContractId());
             List<InvoiceManage> invoiceManages = invoiceManageService.selectByExample(invoiceManageExample);
             if(CollectionUtils.isEmpty(invoiceManages)){
                 // 生成一条待推送的开票信息
                 InvoiceManage invoiceManage = invoiceManageService.getInfoByContract(model.getContractId());
                 // 正式发票
-                invoiceManage.setType("1");
+                invoiceManage.setType("2");
                 // 专项维修资金
                 invoiceManage.setPaymentType("2");
                 invoiceManage.setSendStatus("0");

+ 95 - 2
pro-base/src/main/java/com/idea/paymentManagement/service/PayLogService.java

@@ -5,14 +5,16 @@ import cn.hutool.core.util.IdUtil;
 import cn.hutool.core.util.ObjectUtil;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
+import com.idea.buildManage.mapper.ParkRoomExtendMapper;
 import com.idea.buildManage.model.ParkInfo;
 import com.idea.buildManage.model.ParkInfoExample;
 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.mapper.CustomerManagementMapper;
-import com.idea.customerManagement.model.ContractManage;
-import com.idea.customerManagement.model.CustomerManagement;
+import com.idea.customerManagement.model.*;
+import com.idea.customerManagement.service.BuyerService;
 import com.idea.invoice.dto.InvoiceManageDto;
 import com.idea.invoice.model.InvoiceManage;
 import com.idea.invoice.model.InvoiceManageExample;
@@ -25,21 +27,27 @@ import com.idea.paymentManagement.mapper.PayLogMapper;
 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.rockstar.common.base.BaseService;
 import com.rockstar.frame.model.FrameUser;
 import com.rockstar.frame.model.extend.DateTrans;
 import com.rockstar.frame.model.extend.Tablepar;
 import com.rockstar.frame.service.FrameUserService;
 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;
 import org.springframework.transaction.annotation.Transactional;
 
+import javax.servlet.http.HttpServletResponse;
 import java.math.BigDecimal;
 import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 @Service
 public class PayLogService implements BaseService<PayLog, PayLogExample> {
@@ -58,6 +66,12 @@ public class PayLogService implements BaseService<PayLog, PayLogExample> {
     private CustomerManagementMapper customerManagementMapper;
     @Autowired
     private ReceiptManageService receiptManageService;
+    @Autowired
+    private BuyerService buyerService;
+    @Autowired
+    private SysDictService sysDictService;
+    @Autowired
+    private ParkRoomExtendMapper roomExtendMapper;
 
 
     @Override
@@ -295,4 +309,83 @@ public class PayLogService implements BaseService<PayLog, PayLogExample> {
     }
 
 
+    /**
+     * 收款收据
+     * @param id
+     * @param response
+     */
+    public void downLoadReceipt(String id, HttpServletResponse response) {
+
+        PayLog payLog = selectByPrimaryKey(id);
+        Integer contentType = payLog.getContentType();
+        String filePath = "";
+        String fileName = "";
+        switch (contentType){
+            case 1: // 定金
+                filePath = "/home/project/settleDown/tem/.docx";
+                fileName = "定金收据.docx";
+                break;
+            case 2: // 首付
+                filePath = "/home/project/settleDown/tem/.docx";
+                fileName = "首付收据.docx";
+                break;
+            case 3: // 银行按揭
+                filePath = "/home/project/settleDown/tem/.docx";
+                fileName = "银行按揭收据.docx";
+                break;
+        }
+
+        String customerManagementId = payLog.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(payLog.getHouseId());
+        String fullName = roomResponse.getGroupName()
+                + "-"
+                + roomResponse.getDiscName()
+                + roomResponse.getBuildName()
+                + roomResponse.getRoomNo();
+
+        String collectionTime = DateUtils.parseDateToStr(DateUtils.DATE_CH, payLog.getPayTime());
+        String content = "";
+        String paymentMethod = "";
+        String contentTypeLabel = sysDictService.getDictLabel("CONTENT_TYPE",payLog.getContentType().toString());
+        String paymentMethodLabel = sysDictService.getDictLabel("COLLECTION_METHODS",payLog.getPaymentMethod().toString());
+        if(StringUtils.isNotEmpty(contentTypeLabel)){
+            content = contentTypeLabel;
+        }
+        if(StringUtils.isNotEmpty(paymentMethodLabel)){
+            paymentMethod = paymentMethodLabel;
+        }
+        String receivedAmount = payLog.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<>();
+        data.put("${name}", name);
+        data.put("${collectionTime}", collectionTime);
+        data.put("${fullName}", fullName);
+        data.put("${content}", content);
+        data.put("${paymentMethod}", paymentMethod);
+        data.put("${capital}", capital);
+        data.put("${receivedAmount}", receivedAmount);
+
+        ReplaceWord.operateWord(response, filePath, fileName, data, picData, sealData);
+
+
+    }
+
+
+
+
+
+
 }

+ 109 - 0
pro-base/src/main/java/com/idea/util/MoneyUtils.java

@@ -0,0 +1,109 @@
+package com.idea.util;
+
+import org.apache.commons.lang3.RandomStringUtils;
+import org.apache.commons.lang3.RandomUtils;
+import org.apache.commons.lang3.StringUtils;
+
+import java.math.BigDecimal;
+import java.text.DecimalFormat;
+
+public class MoneyUtils {
+
+    private static final String[] cnNums = { "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" }; // 汉字的数字
+    private static final String[] cnIntRadice = { "", "拾", "佰", "仟" }; // 基本单位
+    private static final String[] cnIntUnits = { "", "万", "亿", "兆" }; // 对应整数部分扩展单位
+    private static final String[] cnDecUnits = { "角", "分"}; // 对应小数部分单位
+    private static final String cnInteger = "整"; // 整数金额时后面跟的字符
+    private static final String cnIntLast = "元"; // 整型完以后的单位
+
+    /**
+     * 金额大小写转换,将数字转换为汉字
+     * @param money 支持最大16位整数2位小数
+     * @return
+     */
+    public static String amountConversion(String money){
+        //如果传入为空,则返回null
+        if(StringUtils.isBlank(money)){
+            return "null";
+        }
+        String result = "";
+        //整数部分
+        String integer="";
+        //小数部分
+        String point="";
+        if(money.matches("^[0-9]{0,16}|[0-9]{0,16}+([.]{0,1}[0-9]{0,2})$")){
+            BigDecimal bigDecimal = new BigDecimal(money);
+            //对金额进行格式化,统一小数点后面保留两位。 此举能去除整数部分多余的0,以及小数部分统一保留两位 如:00456.1-->456.10
+            money = new DecimalFormat("##0.00").format(bigDecimal);
+            //整数部分
+            integer = money.split("\\.").length==1?money:money.split("\\.")[0];
+            //小数部分
+            point = money.split("\\.").length==1?"00":money.split("\\.")[1];
+
+
+            if("0".equals(integer)){
+                result = "零"+cnIntLast;
+            }else{
+                int zeroCount = 0;
+                char[] array = integer.toCharArray();
+                String n="";
+                int p=0,q=0,m=0;
+                for (int i = 0; i < integer.length(); i++) {
+                    n = Character.toString(array[i]);
+                    p = integer.length() - i - 1;
+                    q = p / 4;
+                    m = p % 4;
+                    if (n.equals("0")) {
+                        zeroCount++;
+                    } else {
+                        if (zeroCount > 0) {
+                            result += cnNums[0];
+                        }
+                        zeroCount = 0; // 归零
+                        result += cnNums[Integer.parseInt(n)] + cnIntRadice[m];
+                    }
+                    if (m == 0 && zeroCount < 4) {
+                        result += cnIntUnits[q];
+                    }
+                }
+                result += cnIntLast;
+            }
+
+            //组装小数部分
+            if ("00".equals(point)) {
+                result += cnInteger;
+            }else{
+                String n="";
+                char[] array = point.toCharArray();
+                for (int i = 0; i < point.length(); i++) {
+                    n = Character.toString(array[i]);
+                    if (!n.equals("0")) {
+                        result += cnNums[Integer.parseInt(n)] + cnDecUnits[i];
+                    }
+                }
+            }
+
+
+        }else{
+            return "请检查金额(整数位不能超过16位,小数不能超过2位)";
+        }
+
+        return result;
+    }
+
+    public static void main(String[] args) {
+        System.out.println(amountConversion("107.01"));
+        for(int i=0;i<20;i++){
+            int integer = RandomUtils.nextInt(0,17);
+            int point = RandomUtils.nextInt(0,3);
+            String in = integer==0?"0":RandomStringUtils.randomNumeric(integer);
+            String po = point==0?"0":RandomStringUtils.randomNumeric(point);
+            String money = in+"."+po;
+            System.out.println(money +"====="+amountConversion(money));
+        }
+    }
+
+
+}
+
+

BIN
pro-base/src/main/resources/lib/OpenAPIUtil-1.0.0.jar


BIN
pro-base/src/main/resources/lib/commons-codec-1.6.jar


+ 4 - 2
pro-base/src/main/resources/mybatis/invoice/InvoiceManageExtendMapper.xml

@@ -4,8 +4,10 @@
 
 
   <select id="listByModel" resultType="com.idea.invoice.dto.InvoiceManageDto">
-      select i.*,cm.id contractId,cm.contract_number,cm.record_number,cm.buyer_name,cm.house_name,cm.total_price,
-             cm.maintenance_total_price,cm.collection_status,cm.fund_collection_status
+      select i.*,cm.id contractId,cm.contract_number,cm.record_number,cm.buyer_name,cm.house_name,
+             ifnull(cm.total_price,0) total_price,
+             ifnull(cm.maintenance_total_price,0) maintenance_total_price,
+             cm.collection_status,cm.fund_collection_status
       from invoice_manage i
       left join idea_settle_down.contract_manage cm on i.contract_id = cm.id
       <where>