LAPTOP-FO2T5SIU\35838 hace 7 meses
padre
commit
b15b2e82fe

+ 1 - 2
pro-base/src/main/java/com/idea/invoice/controller/InvoiceManageController.java

@@ -129,8 +129,7 @@ public class InvoiceManageController extends BaseController {
     @PostMapping(value = "sendInvoice",produces = {"application/json;charset=UTF-8"})
     @ResponseBody
     public AjaxResult sendInvoice(InvoiceManageDto record){
-        int result = modelService.sendInvoice(record);
-        return result(result);
+        return modelService.sendInvoice(record);
     }
 
     /**

+ 20 - 0
pro-base/src/main/java/com/idea/invoice/model/InvoiceManage.java

@@ -121,6 +121,10 @@ public class InvoiceManage implements Serializable {
 
     private String specifications;
 
+    private String ncCode;
+
+    private String ncJson;
+
     private static final long serialVersionUID = 1L;
 
     public String getId() {
@@ -586,4 +590,20 @@ public class InvoiceManage implements Serializable {
     public void setSpecifications(String specifications) {
         this.specifications = specifications == null ? null : specifications.trim();
     }
+
+    public String getNcCode() {
+        return ncCode;
+    }
+
+    public void setNcCode(String ncCode) {
+        this.ncCode = ncCode == null ? null : ncCode.trim();
+    }
+
+    public String getNcJson() {
+        return ncJson;
+    }
+
+    public void setNcJson(String ncJson) {
+        this.ncJson = ncJson == null ? null : ncJson.trim();
+    }
 }

+ 70 - 0
pro-base/src/main/java/com/idea/invoice/model/InvoiceManageExample.java

@@ -4085,6 +4085,76 @@ public class InvoiceManageExample {
             addCriterion("specifications not between", value1, value2, "specifications");
             return (Criteria) this;
         }
+
+        public Criteria andNcCodeIsNull() {
+            addCriterion("nc_code is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andNcCodeIsNotNull() {
+            addCriterion("nc_code is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andNcCodeEqualTo(String value) {
+            addCriterion("nc_code =", value, "ncCode");
+            return (Criteria) this;
+        }
+
+        public Criteria andNcCodeNotEqualTo(String value) {
+            addCriterion("nc_code <>", value, "ncCode");
+            return (Criteria) this;
+        }
+
+        public Criteria andNcCodeGreaterThan(String value) {
+            addCriterion("nc_code >", value, "ncCode");
+            return (Criteria) this;
+        }
+
+        public Criteria andNcCodeGreaterThanOrEqualTo(String value) {
+            addCriterion("nc_code >=", value, "ncCode");
+            return (Criteria) this;
+        }
+
+        public Criteria andNcCodeLessThan(String value) {
+            addCriterion("nc_code <", value, "ncCode");
+            return (Criteria) this;
+        }
+
+        public Criteria andNcCodeLessThanOrEqualTo(String value) {
+            addCriterion("nc_code <=", value, "ncCode");
+            return (Criteria) this;
+        }
+
+        public Criteria andNcCodeLike(String value) {
+            addCriterion("nc_code like", value, "ncCode");
+            return (Criteria) this;
+        }
+
+        public Criteria andNcCodeNotLike(String value) {
+            addCriterion("nc_code not like", value, "ncCode");
+            return (Criteria) this;
+        }
+
+        public Criteria andNcCodeIn(List<String> values) {
+            addCriterion("nc_code in", values, "ncCode");
+            return (Criteria) this;
+        }
+
+        public Criteria andNcCodeNotIn(List<String> values) {
+            addCriterion("nc_code not in", values, "ncCode");
+            return (Criteria) this;
+        }
+
+        public Criteria andNcCodeBetween(String value1, String value2) {
+            addCriterion("nc_code between", value1, value2, "ncCode");
+            return (Criteria) this;
+        }
+
+        public Criteria andNcCodeNotBetween(String value1, String value2) {
+            addCriterion("nc_code not between", value1, value2, "ncCode");
+            return (Criteria) this;
+        }
     }
 
     public static class Criteria extends GeneratedCriteria {

+ 121 - 37
pro-base/src/main/java/com/idea/invoice/service/InvoiceManageService.java

@@ -3,15 +3,19 @@ package com.idea.invoice.service;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.IdUtil;
 import cn.hutool.core.util.ObjectUtil;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
+import com.idea.buildManage.mapper.ParkInfoMapper;
 import com.idea.buildManage.mapper.ParkRoomExtendMapper;
 import com.idea.buildManage.mapper.ParkRoomMapper;
 import com.idea.buildManage.model.ParkFloorDisc;
+import com.idea.buildManage.model.ParkInfo;
 import com.idea.buildManage.model.ParkRoom;
 import com.idea.buildManage.response.ParkRoomResponse;
 import com.idea.customerManagement.dto.ContractManageDto;
+import com.idea.customerManagement.mapper.BuyerMapper;
 import com.idea.customerManagement.mapper.CustomerManagementMapper;
 import com.idea.customerManagement.model.Buyer;
 import com.idea.customerManagement.model.BuyerExample;
@@ -24,9 +28,11 @@ import com.idea.invoice.mapper.InvoiceManageExtendMapper;
 import com.idea.invoice.mapper.InvoiceManageMapper;
 import com.idea.invoice.model.*;
 import com.idea.invoice.util.InvoiceConstant;
+import com.idea.invoice.util.InvoiceUtil;
 import com.idea.paymentManagement.model.PayLog;
 import com.idea.paymentManagement.model.PayLogExample;
 import com.idea.paymentManagement.service.PayLogService;
+import com.idea.util.DateUtils;
 import com.rockstar.common.base.BaseService;
 import com.rockstar.common.domain.AjaxResult;
 import com.rockstar.frame.model.extend.DateTrans;
@@ -34,6 +40,7 @@ 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;
@@ -45,6 +52,7 @@ import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
 
+@Slf4j
 @Service
 public class InvoiceManageService implements BaseService<InvoiceManage, InvoiceManageExample> {
 
@@ -73,6 +81,11 @@ public class InvoiceManageService implements BaseService<InvoiceManage, InvoiceM
     private CustomerManagementMapper customerManagementMapper;
     @Autowired
     private ReceiptManageService receiptManageService;
+    @Autowired
+    private ParkInfoMapper parkInfoMapper;
+    @Autowired
+    private BuyerMapper buyerMapper;
+
 
     @Override
     public int deleteByPrimaryKey(String s) {
@@ -137,7 +150,7 @@ public class InvoiceManageService implements BaseService<InvoiceManage, InvoiceM
         model.setType("1");
         PageHelper.startPage(tablepar.getPageNum(), tablepar.getPageSize());
         List<InvoiceManageDto> list = extendMapper.listByModel(model);
-        for(InvoiceManageDto invoiceManage : list){
+        for (InvoiceManageDto invoiceManage : list) {
 //            String money = payLogService.getMoneyByContractId(invoiceManage.getContractId(), null);
 //            invoiceManage.setReceivedMoney(new BigDecimal(money));
             // 预收款发票 已收金额
@@ -148,6 +161,7 @@ public class InvoiceManageService implements BaseService<InvoiceManage, InvoiceM
 
     /**
      * 新增预收款发票
+     *
      * @param model
      * @return
      */
@@ -160,7 +174,7 @@ public class InvoiceManageService implements BaseService<InvoiceManage, InvoiceM
         model.setCreateUser(ShiroUtils.getUserId());
         int result = insertWithoutId(model);
         // 预收款发票 新增后 推送用友
-        if(model.getType().equals("1")){
+        if (model.getType().equals("1")) {
             sendInvoice(model);
         }
 
@@ -177,6 +191,7 @@ public class InvoiceManageService implements BaseService<InvoiceManage, InvoiceM
 
     /**
      * 正式发票管理
+     *
      * @param tablepar
      * @param model
      * @param dt
@@ -186,15 +201,15 @@ public class InvoiceManageService implements BaseService<InvoiceManage, InvoiceM
         model.setType("2");
         PageHelper.startPage(tablepar.getPageNum(), tablepar.getPageSize());
         List<InvoiceManageDto> list = extendMapper.listByModel(model);
-        for(InvoiceManageDto invoiceManage : list){
+        for (InvoiceManageDto invoiceManage : list) {
             String money = "";
             // 房款
-            if(invoiceManage.getPaymentType().equals("1")){
+            if (invoiceManage.getPaymentType().equals("1")) {
                 money = payLogService.getMoneyByContractId(invoiceManage.getContractId(), 1);
                 invoiceManage.setReceivableMoney(invoiceManage.getBuyerMoney());
             }
             // 专项维修资金
-            if(invoiceManage.getPaymentType().equals("2")){
+            if (invoiceManage.getPaymentType().equals("2")) {
                 money = payLogService.getMoneyByContractId(invoiceManage.getContractId(), 2);
                 invoiceManage.setReceivableMoney(invoiceManage.getMaintenanceTotalPrice());
             }
@@ -205,10 +220,11 @@ public class InvoiceManageService implements BaseService<InvoiceManage, InvoiceM
 
     /**
      * 根据合同id查询
+     *
      * @param contractId
      * @return
      */
-    public InvoiceManageDto getInfoByContract(String contractId,String invoiceGoodsName,Integer payType){
+    public InvoiceManageDto getInfoByContract(String contractId, String invoiceGoodsName, Integer payType) {
 
         InvoiceManageDto invoiceManage = new InvoiceManageDto();
         // 合同信息
@@ -222,8 +238,8 @@ public class InvoiceManageService implements BaseService<InvoiceManage, InvoiceM
         // 房间信息
         ParkRoomResponse room = roomExtendMapper.getFullName(contract.getHouseId());
         StringBuilder builder = new StringBuilder();
-        for(Buyer item : buyers){
-            if(item.getRelationship() != null){
+        for (Buyer item : buyers) {
+            if (item.getRelationship() != null) {
                 builder.append(item.getName()).append("身份证号:").append(item.getIdentityCard()).append("\n");
             }
         }
@@ -231,12 +247,12 @@ public class InvoiceManageService implements BaseService<InvoiceManage, InvoiceM
         PayLogExample.Criteria criteria = payLogExample.createCriteria();
         criteria.andContractIdEqualTo(contractId)
                 .andStatusEqualTo(0);
-        if(ObjectUtil.isNotNull(payType)){
+        if (ObjectUtil.isNotNull(payType)) {
             criteria.andPayTypeEqualTo(payType);
         }
         List<PayLog> payLogs = payLogService.selectByExample(payLogExample);
         BigDecimal money = BigDecimal.ZERO;
-        for(PayLog payLog : payLogs){
+        for (PayLog payLog : payLogs) {
             money = money.add(payLog.getPayMoney());
         }
 
@@ -249,7 +265,7 @@ public class InvoiceManageService implements BaseService<InvoiceManage, InvoiceM
         // TODO: 2024/10/17 商品编码目前为空 对接接口后调整
         invoiceManage.setInvoiceGoodsCode(InvoiceConstant.INVOICE_GOODS_CODE_ADVANCE_PAYMENT);
         invoiceManage.setInvoiceGoodsName(invoiceGoodsName + room.getGroupName());
-        invoiceManage.setSpecifications(room.getBuildName()+ "-" + room.getRoomNo());
+        invoiceManage.setSpecifications(room.getBuildName() + "-" + room.getRoomNo());
         invoiceManage.setInvoiceCount(new BigDecimal(contract.getActualBuildArea().toString()));
         invoiceManage.setInvoiceAmount(money);
         invoiceManage.setInvoiceTax("0");
@@ -260,6 +276,7 @@ public class InvoiceManageService implements BaseService<InvoiceManage, InvoiceM
 
     /**
      * 查询对应的银行
+     *
      * @param id
      * @return
      */
@@ -302,12 +319,11 @@ public class InvoiceManageService implements BaseService<InvoiceManage, InvoiceM
     }
 
     /**
-     *
      * @param contractId
      * @param paymentType 1-房款,2-专项维修资金
      * @return
      */
-    public JSONObject getBankTaxRateByFloor(String contractId,String paymentType) {
+    public JSONObject getBankTaxRateByFloor(String contractId, String paymentType) {
         JSONObject jsonObject = new JSONObject();
         String result = "";
         String dictLabel = sysDictService.getDictLabel("PAYMENT_TYPE", paymentType);
@@ -342,14 +358,15 @@ public class InvoiceManageService implements BaseService<InvoiceManage, InvoiceM
 
     /**
      * 批量开票列表
+     *
      * @param invoiceManages
      * @return
      */
-    public List<InvoiceManageDto> batchListVo(String invoiceManages){
+    public List<InvoiceManageDto> batchListVo(String invoiceManages) {
 
         List<InvoiceManageDto> result = new ArrayList<>();
         String[] ids = invoiceManages.split(",");
-        for(String id :ids){
+        for (String id : ids) {
             InvoiceManageDto model = getById(id);
             JSONObject jsonObject = getBankTaxRateByFloor(id);
             model.setInvoiceSellerBank(jsonObject.getString("invoiceSellerBank"));
@@ -361,63 +378,130 @@ public class InvoiceManageService implements BaseService<InvoiceManage, InvoiceM
 
     /**
      * 推送开票
+     *
      * @param model
      */
     @Transactional
-    public int sendInvoice(InvoiceManageDto model){
-        model.setSendStatus("1");
-        model.setSubmitTime(new Date());
-        model.setSubmitUser(ShiroUtils.getUserId());
-        int result = updateByPrimaryKeySelective(model);
-        // TODO: 2024/10/17 等待接口 推送开票信息
-        return result;
+    public AjaxResult sendInvoice(InvoiceManageDto model) {
+
+        // 查询客户管理信息
+        CustomerManagement customerManagement = customerManagementMapper.selectByPrimaryKey(model.getCustomerManagementId());
+        // 查询小区信息
+        ParkInfo parkInfo = parkInfoMapper.selectByPrimaryKey(customerManagement.getGroupId());
+//        // 查询买受人信息
+//        BuyerExample buyerExample = new BuyerExample();
+//        buyerExample.setOrderByClause("order_num asc");
+//        buyerExample.createCriteria().andCustomerManagementIdEqualTo(customerManagement.getId());
+//        List<Buyer> buyers = buyerMapper.selectByExample(buyerExample);
+//        Buyer buyer = buyers.get(0);
+        // 查询房间信息
+        ParkRoom parkRoom = parkRoomMapper.selectByPrimaryKey(customerManagement.getHouseId());
+
+        String address = parkInfo.getAddress();
+//        String identityCard = buyer.getIdentityCard();
+        int invoiceTax = Integer.parseInt(model.getInvoiceTax()) * 100;
+
+
+        JSONObject json = new JSONObject();
+
+        JSONObject ar_recbill = new JSONObject();
+        String srcsystemid = model.getId();
+        String billdate = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, new Date());
+        ar_recbill.put("srcsystemid", srcsystemid); //外系统标识,必选
+        ar_recbill.put("pk_tradetype", InvoiceConstant.INVOICE_BUSINESS_F0_Cxx_05); //交易类型,必选
+        ar_recbill.put("pk_org", InvoiceUtil.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", address); //不动产地址,必填,字符串
+        ar_recbill.put("def22", "N"); //是否跨地址标志,必填,Y-是,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", model.getInvoiceHeaderNumber()); //客商的纳税人识别号
+        ar_recitemJson.put("money_de", model.getInvoiceAmount()); //金额,必选
+        ar_recitemJson.put("taxrate", invoiceTax); //税率,必选,无税传0
+        ar_recitemJson.put("def11", parkRoom.getId()); //转出前房号编码,收除了诚意金之外的首期等需要选
+        ar_recitemJson.put("def9", InvoiceConstant.INVOICE_BUSINESS_FORMAT_001); //业态,必选,看云文档业态
+        // TODO: 2024/11/6 没有 
+        ar_recitemJson.put("def7", ""); //房产工程项目,必选,看云文档
+        ar_recitemJson.put("def8", parkRoom.getBuildId()); //楼栋,必选,看云文档
+        ar_recitemJson.put("material", InvoiceConstant.INVOICE_MATERIAL_hjjy); //物料
+        ar_recitem.add(ar_recitemJson);
+        json.put("ar_recitem", ar_recitem);
+
+        String result = "";
+        try {
+            result = InvoiceUtil.recbillAdd(json);
+        } catch (Exception e) {
+            log.error("推送发票失败:{}", e);
+            return AjaxResult.error(e.getMessage());
+        }
+        JSONObject jsonObject = JSONObject.parseObject(result);
+        String success = jsonObject.getString("success");
+        if (success.equals("true")) {
+            String code = jsonObject.getJSONObject("data").getJSONObject("ar_recbill").getString("code");
+            model.setSendStatus("1");
+            model.setSubmitTime(new Date());
+            model.setSubmitUser(ShiroUtils.getUserId());
+            model.setNcJson(result);
+            model.setNcCode(code);
+            updateByPrimaryKeySelective(model);
+            return AjaxResult.success();
+        } else if (success.equals("false")) {
+            return AjaxResult.error(jsonObject.getString("message"));
+        }
+        return AjaxResult.error();
+
     }
 
     /**
      * 批量推送
+     *
      * @param list
      * @return
      */
-    public AjaxResult batchSendInvoice(List<InvoiceManageDto> list){
+    public AjaxResult batchSendInvoice(List<InvoiceManageDto> list) {
 
         // 推送前校验状态
         for (InvoiceManageDto model : list) {
             InvoiceManage invoiceManage = selectByPrimaryKey(model.getId());
-            if(null!=invoiceManage && !InvoiceConstant.INVOICE_STATUS_WAIT.equals(invoiceManage.getInvoiceStatus())
-                    && !InvoiceConstant.INVOICE_STATUS_ERROR.equals(invoiceManage.getInvoiceStatus())){
+            if (null != invoiceManage && !InvoiceConstant.INVOICE_STATUS_WAIT.equals(invoiceManage.getInvoiceStatus())
+                    && !InvoiceConstant.INVOICE_STATUS_ERROR.equals(invoiceManage.getInvoiceStatus())) {
                 return AjaxResult.error(504, "提交失败,开票状态发生变化");
             }
         }
-        int result = 0;
         String userId = ShiroUtils.getUserId();
         for (InvoiceManageDto invoiceManage : list) {
             invoiceManage.setUpdateUser(userId);
             InvoiceManage newRecord = selectByPrimaryKey(invoiceManage.getId());
             // 如果流水号为空 则创建一个流水号
             String serialNo;
-            if(StringUtils.isEmpty(newRecord.getSerialNo())){
+            if (StringUtils.isEmpty(newRecord.getSerialNo())) {
                 serialNo = "wuxi-" + System.currentTimeMillis() + "-001";
                 newRecord.setSerialNo(serialNo);
                 updateByPrimaryKeySelective(newRecord);
-            }else {
+            } else {
                 serialNo = newRecord.getSerialNo();
             }
             invoiceManage.setSerialNo(serialNo);
-            try {
-                result += invoiceManageService.sendInvoice(invoiceManage);
-            }catch (Exception e){
-                return AjaxResult.error(503, e.getMessage());
-            }
+            invoiceManageService.sendInvoice(invoiceManage);
         }
-        return result > 0 ? AjaxResult.success() : AjaxResult.error();
+        return AjaxResult.success();
     }
 
     /**
      * 票据管理 新增记录 开票后调用
+     *
      * @param model
      * @return
      */
-    public int addReceiptManage(InvoiceManage model){
+    public int addReceiptManage(InvoiceManage model) {
         // 票据管理 新增一条记录
         ContractManage contractManage = contractManageService.selectByPrimaryKey(model.getContractId());
         CustomerManagement customerManagement = customerManagementMapper.selectByPrimaryKey(contractManage.getCustomerManagementId());
@@ -428,11 +512,11 @@ public class InvoiceManageService implements BaseService<InvoiceManage, InvoiceM
         receiptManage.setCustomerManagementId(model.getCustomerManagementId());
         // 票据类型
         // 预收款发票
-        if(model.getType().equals("1")){
+        if (model.getType().equals("1")) {
             receiptManage.setReceiptType("5");
         }
         // 正式发票
-        if(model.getType().equals("2")){
+        if (model.getType().equals("2")) {
             receiptManage.setReceiptType("6");
         }
         receiptManage.setReceiptMoney(model.getInvoiceAmount());

+ 22 - 0
pro-base/src/main/java/com/idea/invoice/task/InvoiceTask.java

@@ -0,0 +1,22 @@
+package com.idea.invoice.task;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+@Slf4j
+@Component
+public class InvoiceTask {
+
+
+    @Scheduled(cron = "0 0/10 * * * ?")
+    public void refreshStatus() {
+
+    }
+
+
+
+
+
+
+}

+ 51 - 0
pro-base/src/main/java/com/idea/invoice/util/InvoiceConstant.java

@@ -39,4 +39,55 @@ public class InvoiceConstant {
     public static final String INVOICE_SELLER_PHONE = "";
 
 
+    // 收款单
+    public static final String INVOICE_BUSINESS_F2_Cxx_06 = "F2-Cxx-06";
+
+    // 转账单
+    public static final String INVOICE_BUSINESS_F2_Cxx_07 = "F2_Cxx_07";
+
+    // 换票单
+    public static final String INVOICE_BUSINESS_F2_Cxx_08 = "F2_Cxx_08";
+
+    // 退款单
+    public static final String INVOICE_BUSINESS_F3_Cxx_06 = "F3_Cxx_06";
+
+    // 划拨单(水电费、维修)
+    public static final String INVOICE_BUSINESS_F2_Cxx_09 = "F2_Cxx_09";
+
+    // 收入结转单
+    public static final String INVOICE_BUSINESS_F0_Cxx_05 = "F0_Cxx_05";
+
+    /**
+     * 业态
+     */
+    // 住宅
+    public static final String INVOICE_BUSINESS_FORMAT_001 = "001";
+    // 车位
+    public static final String INVOICE_BUSINESS_FORMAT_002 = "002";
+    // 储藏室
+    public static final String INVOICE_BUSINESS_FORMAT_003 = "003";
+    // 商业
+    public static final String INVOICE_BUSINESS_FORMAT_004 = "004";
+    // 酒店
+    public static final String INVOICE_BUSINESS_FORMAT_005 = "005";
+    // 配套
+    public static final String INVOICE_BUSINESS_FORMAT_006 = "006";
+
+    /**
+     * 物料
+     */
+    // 东璟家园C
+    public static final String INVOICE_MATERIAL_djjy = "djjy";
+
+    // 共有产权房惠景家园
+    public static final String INVOICE_MATERIAL_gycqrjjy = "gycqrjjy";
+    // 惠景家园
+    public static final String INVOICE_MATERIAL_hjjy = "hjjy";
+    // 黄石家园
+    public static final String INVOICE_MATERIAL_hsjy = "hsjy";
+    // 毛湾家园B
+    public static final String INVOICE_MATERIAL_mwjyB = "mwjyB";
+    // 瑞扬家园
+    public static final String INVOICE_MATERIAL_ryjy = "ryjy";
+
 }

+ 2 - 34
pro-base/src/main/java/com/idea/invoice/util/InvoiceUtil.java

@@ -228,46 +228,14 @@ public class InvoiceUtil {
      *
      * @throws Exception
      */
-    public static void recbillAdd() throws Exception {
+    public static String recbillAdd(JSONObject json) 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", "F0-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"); //是否跨地址标志,必填,Y-是,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", "AJ003"); //收支项目编码,非必选
-        ar_recitemJson.put("def11", "100"); //转出前房号编码,收除了诚意金之外的首期等需要选
-        ar_recitemJson.put("def9", "001"); //业态,必选,看云文档业态
-        ar_recitemJson.put("def7", "AJ001"); //房产工程项目,必选,看云文档
-        ar_recitemJson.put("def8", "1300419721555869696"); //楼栋,必选,看云文档
-        ar_recitemJson.put("material", "mwjyB"); //物料
-        ar_recitem.add(ar_recitemJson);
-        json.put("ar_recitem", ar_recitem);
-
         log.info("应收接口-收入结转单传参:{}", json.toJSONString());
         String result = util.getAPIRetrun(token, json.toJSONString());
         log.info("应收接口-收入结转单:{}", result);
+        return result;
     }
 
     /**

+ 188 - 6
pro-base/src/main/resources/mybatis/invoice/InvoiceManageMapper.xml

@@ -60,6 +60,10 @@
     <result column="e_invoice_url" jdbcType="VARCHAR" property="eInvoiceUrl" />
     <result column="serial_no" jdbcType="VARCHAR" property="serialNo" />
     <result column="specifications" jdbcType="VARCHAR" property="specifications" />
+    <result column="nc_code" jdbcType="VARCHAR" property="ncCode" />
+  </resultMap>
+  <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.idea.invoice.model.InvoiceManage">
+    <result column="nc_json" jdbcType="LONGVARCHAR" property="ncJson" />
   </resultMap>
   <sql id="Example_Where_Clause">
     <where>
@@ -130,8 +134,27 @@
     invoice_header_bank_number, bad_debt_reason, create_user, create_time, update_user,
     update_time, invoice_file, take_status, take_user, take_date, take_notes, take_update_user,
     red_invoice_no, red_confirm_uuid, red_confirm_no, red_confirm_serial_no, confirm_state,
-    remark, e_invoice_url, serial_no, specifications
+    remark, e_invoice_url, serial_no, specifications, nc_code
+  </sql>
+  <sql id="Blob_Column_List">
+    nc_json
   </sql>
+  <select id="selectByExampleWithBLOBs" parameterType="com.idea.invoice.model.InvoiceManageExample" resultMap="ResultMapWithBLOBs">
+    select
+    <if test="distinct">
+      distinct
+    </if>
+    <include refid="Base_Column_List" />
+    ,
+    <include refid="Blob_Column_List" />
+    from invoice_manage
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+    <if test="orderByClause != null">
+      order by ${orderByClause}
+    </if>
+  </select>
   <select id="selectByExample" parameterType="com.idea.invoice.model.InvoiceManageExample" resultMap="BaseResultMap">
     select
     <if test="distinct">
@@ -146,9 +169,11 @@
       order by ${orderByClause}
     </if>
   </select>
-  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
+  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
     select
     <include refid="Base_Column_List" />
+    ,
+    <include refid="Blob_Column_List" />
     from invoice_manage
     where id = #{id,jdbcType=VARCHAR}
   </select>
@@ -183,7 +208,8 @@
                                 take_notes, take_update_user, red_invoice_no,
                                 red_confirm_uuid, red_confirm_no, red_confirm_serial_no,
                                 confirm_state, remark, e_invoice_url,
-                                serial_no, specifications)
+                                serial_no, specifications, nc_code,
+                                nc_json)
     values (#{id,jdbcType=VARCHAR}, #{contractId,jdbcType=VARCHAR}, #{customerManagementId,jdbcType=VARCHAR},
             #{contractNumber,jdbcType=VARCHAR}, #{recordNumber,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
             #{costType,jdbcType=VARCHAR}, #{paymentType,jdbcType=VARCHAR}, #{sendStatus,jdbcType=VARCHAR},
@@ -204,7 +230,8 @@
             #{takeNotes,jdbcType=VARCHAR}, #{takeUpdateUser,jdbcType=VARCHAR}, #{redInvoiceNo,jdbcType=VARCHAR},
             #{redConfirmUuid,jdbcType=VARCHAR}, #{redConfirmNo,jdbcType=VARCHAR}, #{redConfirmSerialNo,jdbcType=VARCHAR},
             #{confirmState,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{eInvoiceUrl,jdbcType=VARCHAR},
-            #{serialNo,jdbcType=VARCHAR}, #{specifications,jdbcType=VARCHAR})
+            #{serialNo,jdbcType=VARCHAR}, #{specifications,jdbcType=VARCHAR}, #{ncCode,jdbcType=VARCHAR},
+            #{ncJson,jdbcType=LONGVARCHAR})
   </insert>
   <insert id="insertSelective" parameterType="com.idea.invoice.model.InvoiceManage">
     insert into invoice_manage
@@ -383,6 +410,12 @@
       <if test="specifications != null">
         specifications,
       </if>
+      <if test="ncCode != null">
+        nc_code,
+      </if>
+      <if test="ncJson != null">
+        nc_json,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="id != null">
@@ -559,6 +592,12 @@
       <if test="specifications != null">
         #{specifications,jdbcType=VARCHAR},
       </if>
+      <if test="ncCode != null">
+        #{ncCode,jdbcType=VARCHAR},
+      </if>
+      <if test="ncJson != null">
+        #{ncJson,jdbcType=LONGVARCHAR},
+      </if>
     </trim>
   </insert>
   <select id="countByExample" parameterType="com.idea.invoice.model.InvoiceManageExample" resultType="java.lang.Long">
@@ -744,11 +783,83 @@
       <if test="record.specifications != null">
         specifications = #{record.specifications,jdbcType=VARCHAR},
       </if>
+      <if test="record.ncCode != null">
+        nc_code = #{record.ncCode,jdbcType=VARCHAR},
+      </if>
+      <if test="record.ncJson != null">
+        nc_json = #{record.ncJson,jdbcType=LONGVARCHAR},
+      </if>
     </set>
     <if test="_parameter != null">
       <include refid="Update_By_Example_Where_Clause" />
     </if>
   </update>
+  <update id="updateByExampleWithBLOBs" parameterType="map">
+    update invoice_manage
+    set id = #{record.id,jdbcType=VARCHAR},
+    contract_id = #{record.contractId,jdbcType=VARCHAR},
+    customer_management_id = #{record.customerManagementId,jdbcType=VARCHAR},
+    contract_number = #{record.contractNumber,jdbcType=VARCHAR},
+    record_number = #{record.recordNumber,jdbcType=VARCHAR},
+    type = #{record.type,jdbcType=VARCHAR},
+    cost_type = #{record.costType,jdbcType=VARCHAR},
+    payment_type = #{record.paymentType,jdbcType=VARCHAR},
+    send_status = #{record.sendStatus,jdbcType=VARCHAR},
+    invoice_status = #{record.invoiceStatus,jdbcType=VARCHAR},
+    invoice_date = #{record.invoiceDate,jdbcType=TIMESTAMP},
+    invoice_code = #{record.invoiceCode,jdbcType=VARCHAR},
+    invoice_no = #{record.invoiceNo,jdbcType=VARCHAR},
+    invoice_type = #{record.invoiceType,jdbcType=VARCHAR},
+    invoice_amount = #{record.invoiceAmount,jdbcType=DECIMAL},
+    invoice_tax = #{record.invoiceTax,jdbcType=VARCHAR},
+    invoice_count = #{record.invoiceCount,jdbcType=DECIMAL},
+    invoice_price = #{record.invoicePrice,jdbcType=DECIMAL},
+    invoice_goods_code = #{record.invoiceGoodsCode,jdbcType=VARCHAR},
+    invoice_goods_name = #{record.invoiceGoodsName,jdbcType=VARCHAR},
+    invoice_seller_name = #{record.invoiceSellerName,jdbcType=VARCHAR},
+    invoice_seller_number = #{record.invoiceSellerNumber,jdbcType=VARCHAR},
+    invoice_seller_bank = #{record.invoiceSellerBank,jdbcType=VARCHAR},
+    invoice_seller_bank_number = #{record.invoiceSellerBankNumber,jdbcType=VARCHAR},
+    invoice_seller_address = #{record.invoiceSellerAddress,jdbcType=VARCHAR},
+    invoice_seller_phone = #{record.invoiceSellerPhone,jdbcType=VARCHAR},
+    invoice_email = #{record.invoiceEmail,jdbcType=VARCHAR},
+    invoice_phone = #{record.invoicePhone,jdbcType=VARCHAR},
+    invoice_content = #{record.invoiceContent,jdbcType=VARCHAR},
+    submit_time = #{record.submitTime,jdbcType=TIMESTAMP},
+    submit_user = #{record.submitUser,jdbcType=VARCHAR},
+    invoice_header_id = #{record.invoiceHeaderId,jdbcType=VARCHAR},
+    invoice_header_name = #{record.invoiceHeaderName,jdbcType=VARCHAR},
+    invoice_header_number = #{record.invoiceHeaderNumber,jdbcType=VARCHAR},
+    invoice_header_address = #{record.invoiceHeaderAddress,jdbcType=VARCHAR},
+    invoice_header_phone = #{record.invoiceHeaderPhone,jdbcType=VARCHAR},
+    invoice_header_bank = #{record.invoiceHeaderBank,jdbcType=VARCHAR},
+    invoice_header_bank_number = #{record.invoiceHeaderBankNumber,jdbcType=VARCHAR},
+    bad_debt_reason = #{record.badDebtReason,jdbcType=VARCHAR},
+    create_user = #{record.createUser,jdbcType=VARCHAR},
+    create_time = #{record.createTime,jdbcType=TIMESTAMP},
+    update_user = #{record.updateUser,jdbcType=VARCHAR},
+    update_time = #{record.updateTime,jdbcType=TIMESTAMP},
+    invoice_file = #{record.invoiceFile,jdbcType=VARCHAR},
+    take_status = #{record.takeStatus,jdbcType=VARCHAR},
+    take_user = #{record.takeUser,jdbcType=VARCHAR},
+    take_date = #{record.takeDate,jdbcType=TIMESTAMP},
+    take_notes = #{record.takeNotes,jdbcType=VARCHAR},
+    take_update_user = #{record.takeUpdateUser,jdbcType=VARCHAR},
+    red_invoice_no = #{record.redInvoiceNo,jdbcType=VARCHAR},
+    red_confirm_uuid = #{record.redConfirmUuid,jdbcType=VARCHAR},
+    red_confirm_no = #{record.redConfirmNo,jdbcType=VARCHAR},
+    red_confirm_serial_no = #{record.redConfirmSerialNo,jdbcType=VARCHAR},
+    confirm_state = #{record.confirmState,jdbcType=VARCHAR},
+    remark = #{record.remark,jdbcType=VARCHAR},
+    e_invoice_url = #{record.eInvoiceUrl,jdbcType=VARCHAR},
+    serial_no = #{record.serialNo,jdbcType=VARCHAR},
+    specifications = #{record.specifications,jdbcType=VARCHAR},
+    nc_code = #{record.ncCode,jdbcType=VARCHAR},
+    nc_json = #{record.ncJson,jdbcType=LONGVARCHAR}
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
   <update id="updateByExample" parameterType="map">
     update invoice_manage
     set id = #{record.id,jdbcType=VARCHAR},
@@ -808,7 +919,8 @@
     remark = #{record.remark,jdbcType=VARCHAR},
     e_invoice_url = #{record.eInvoiceUrl,jdbcType=VARCHAR},
     serial_no = #{record.serialNo,jdbcType=VARCHAR},
-    specifications = #{record.specifications,jdbcType=VARCHAR}
+    specifications = #{record.specifications,jdbcType=VARCHAR},
+    nc_code = #{record.ncCode,jdbcType=VARCHAR}
     <if test="_parameter != null">
       <include refid="Update_By_Example_Where_Clause" />
     </if>
@@ -987,9 +1099,78 @@
       <if test="specifications != null">
         specifications = #{specifications,jdbcType=VARCHAR},
       </if>
+      <if test="ncCode != null">
+        nc_code = #{ncCode,jdbcType=VARCHAR},
+      </if>
+      <if test="ncJson != null">
+        nc_json = #{ncJson,jdbcType=LONGVARCHAR},
+      </if>
     </set>
     where id = #{id,jdbcType=VARCHAR}
   </update>
+  <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.idea.invoice.model.InvoiceManage">
+    update invoice_manage
+    set contract_id = #{contractId,jdbcType=VARCHAR},
+        customer_management_id = #{customerManagementId,jdbcType=VARCHAR},
+        contract_number = #{contractNumber,jdbcType=VARCHAR},
+        record_number = #{recordNumber,jdbcType=VARCHAR},
+        type = #{type,jdbcType=VARCHAR},
+        cost_type = #{costType,jdbcType=VARCHAR},
+        payment_type = #{paymentType,jdbcType=VARCHAR},
+        send_status = #{sendStatus,jdbcType=VARCHAR},
+        invoice_status = #{invoiceStatus,jdbcType=VARCHAR},
+        invoice_date = #{invoiceDate,jdbcType=TIMESTAMP},
+        invoice_code = #{invoiceCode,jdbcType=VARCHAR},
+        invoice_no = #{invoiceNo,jdbcType=VARCHAR},
+        invoice_type = #{invoiceType,jdbcType=VARCHAR},
+        invoice_amount = #{invoiceAmount,jdbcType=DECIMAL},
+        invoice_tax = #{invoiceTax,jdbcType=VARCHAR},
+        invoice_count = #{invoiceCount,jdbcType=DECIMAL},
+        invoice_price = #{invoicePrice,jdbcType=DECIMAL},
+        invoice_goods_code = #{invoiceGoodsCode,jdbcType=VARCHAR},
+        invoice_goods_name = #{invoiceGoodsName,jdbcType=VARCHAR},
+        invoice_seller_name = #{invoiceSellerName,jdbcType=VARCHAR},
+        invoice_seller_number = #{invoiceSellerNumber,jdbcType=VARCHAR},
+        invoice_seller_bank = #{invoiceSellerBank,jdbcType=VARCHAR},
+        invoice_seller_bank_number = #{invoiceSellerBankNumber,jdbcType=VARCHAR},
+        invoice_seller_address = #{invoiceSellerAddress,jdbcType=VARCHAR},
+        invoice_seller_phone = #{invoiceSellerPhone,jdbcType=VARCHAR},
+        invoice_email = #{invoiceEmail,jdbcType=VARCHAR},
+        invoice_phone = #{invoicePhone,jdbcType=VARCHAR},
+        invoice_content = #{invoiceContent,jdbcType=VARCHAR},
+        submit_time = #{submitTime,jdbcType=TIMESTAMP},
+        submit_user = #{submitUser,jdbcType=VARCHAR},
+        invoice_header_id = #{invoiceHeaderId,jdbcType=VARCHAR},
+        invoice_header_name = #{invoiceHeaderName,jdbcType=VARCHAR},
+        invoice_header_number = #{invoiceHeaderNumber,jdbcType=VARCHAR},
+        invoice_header_address = #{invoiceHeaderAddress,jdbcType=VARCHAR},
+        invoice_header_phone = #{invoiceHeaderPhone,jdbcType=VARCHAR},
+        invoice_header_bank = #{invoiceHeaderBank,jdbcType=VARCHAR},
+        invoice_header_bank_number = #{invoiceHeaderBankNumber,jdbcType=VARCHAR},
+        bad_debt_reason = #{badDebtReason,jdbcType=VARCHAR},
+        create_user = #{createUser,jdbcType=VARCHAR},
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+        update_user = #{updateUser,jdbcType=VARCHAR},
+        update_time = #{updateTime,jdbcType=TIMESTAMP},
+        invoice_file = #{invoiceFile,jdbcType=VARCHAR},
+        take_status = #{takeStatus,jdbcType=VARCHAR},
+        take_user = #{takeUser,jdbcType=VARCHAR},
+        take_date = #{takeDate,jdbcType=TIMESTAMP},
+        take_notes = #{takeNotes,jdbcType=VARCHAR},
+        take_update_user = #{takeUpdateUser,jdbcType=VARCHAR},
+        red_invoice_no = #{redInvoiceNo,jdbcType=VARCHAR},
+        red_confirm_uuid = #{redConfirmUuid,jdbcType=VARCHAR},
+        red_confirm_no = #{redConfirmNo,jdbcType=VARCHAR},
+        red_confirm_serial_no = #{redConfirmSerialNo,jdbcType=VARCHAR},
+        confirm_state = #{confirmState,jdbcType=VARCHAR},
+        remark = #{remark,jdbcType=VARCHAR},
+        e_invoice_url = #{eInvoiceUrl,jdbcType=VARCHAR},
+        serial_no = #{serialNo,jdbcType=VARCHAR},
+        specifications = #{specifications,jdbcType=VARCHAR},
+        nc_code = #{ncCode,jdbcType=VARCHAR},
+        nc_json = #{ncJson,jdbcType=LONGVARCHAR}
+    where id = #{id,jdbcType=VARCHAR}
+  </update>
   <update id="updateByPrimaryKey" parameterType="com.idea.invoice.model.InvoiceManage">
     update invoice_manage
     set contract_id = #{contractId,jdbcType=VARCHAR},
@@ -1048,7 +1229,8 @@
         remark = #{remark,jdbcType=VARCHAR},
         e_invoice_url = #{eInvoiceUrl,jdbcType=VARCHAR},
         serial_no = #{serialNo,jdbcType=VARCHAR},
-        specifications = #{specifications,jdbcType=VARCHAR}
+        specifications = #{specifications,jdbcType=VARCHAR},
+        nc_code = #{ncCode,jdbcType=VARCHAR}
     where id = #{id,jdbcType=VARCHAR}
   </update>
 </mapper>