y 2 роки тому
батько
коміт
50bfa69fd6
28 змінених файлів з 1101 додано та 542 видалено
  1. 50 6
      src/main/java/com/ydtech/modules/inv/controller/InvAccountController.java
  2. 109 0
      src/main/java/com/ydtech/modules/inv/controller/InvAccountIncoiceController.java
  3. 7 9
      src/main/java/com/ydtech/modules/inv/controller/invAccountExcelController.java
  4. 15 0
      src/main/java/com/ydtech/modules/inv/dao/InvAccountCardMapper.java
  5. 36 0
      src/main/java/com/ydtech/modules/inv/dao/InvAccountIncoiceMapper.java
  6. 4 1
      src/main/java/com/ydtech/modules/inv/dao/InvAccountMapper.java
  7. 41 173
      src/main/java/com/ydtech/modules/inv/model/InvAccount.java
  8. 223 0
      src/main/java/com/ydtech/modules/inv/model/InvAccountCard.java
  9. 4 4
      src/main/java/com/ydtech/modules/inv/model/InvAccountExcel.java
  10. 117 0
      src/main/java/com/ydtech/modules/inv/model/InvAccountIncoice.java
  11. 3 3
      src/main/java/com/ydtech/modules/inv/model/InvAccountOperate.java
  12. 1 1
      src/main/java/com/ydtech/modules/inv/model/po/InvChannelAccount.java
  13. 1 1
      src/main/java/com/ydtech/modules/inv/model/po/InvSettlementSource.java
  14. 1 1
      src/main/java/com/ydtech/modules/inv/model/po/InvSource.java
  15. 19 0
      src/main/java/com/ydtech/modules/inv/service/InvAccountCardService.java
  16. 17 0
      src/main/java/com/ydtech/modules/inv/service/InvAccountIncoiceService.java
  17. 5 3
      src/main/java/com/ydtech/modules/inv/service/InvAccountService.java
  18. 130 0
      src/main/java/com/ydtech/modules/inv/service/impl/InvAccountCardServiceImpl.java
  19. 17 13
      src/main/java/com/ydtech/modules/inv/service/impl/InvAccountExcelServiceImpl.java
  20. 68 0
      src/main/java/com/ydtech/modules/inv/service/impl/InvAccountIncoiceServiceImpl.java
  21. 8 3
      src/main/java/com/ydtech/modules/inv/service/impl/InvAccountOperateServiceImpl.java
  22. 15 98
      src/main/java/com/ydtech/modules/inv/service/impl/InvAccountServiceImpl.java
  23. 1 0
      src/main/java/com/ydtech/modules/inv/utils/EasyExcelUtils.java
  24. 55 54
      src/main/java/com/ydtech/modules/inv/utils/TransferUtils.java
  25. 18 16
      src/main/java/com/ydtech/modules/xxl/handler/InvAccountHandler.java
  26. 2 2
      src/main/resources/mapper/modules/inv/InvAccountExcelMapper.xml
  27. 44 0
      src/main/resources/mapper/modules/inv/InvAccountIncoiceMapper.xml
  28. 90 154
      src/main/resources/mapper/modules/inv/InvAccountMapper.xml

+ 50 - 6
src/main/java/com/ydtech/modules/inv/controller/InvAccountController.java

@@ -3,6 +3,8 @@ package com.ydtech.modules.inv.controller;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.modules.inv.model.InvAccount;
+import com.ydtech.modules.inv.model.InvAccountCard;
+import com.ydtech.modules.inv.service.InvAccountCardService;
 import com.ydtech.modules.inv.service.InvAccountService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -22,16 +24,25 @@ public class InvAccountController {
     @Autowired
     private InvAccountService invAccountService;
 
+    @Autowired
+    private InvAccountCardService invAccountCardService;
+
     @ApiOperation("获取账户列表")
     @PostMapping("getAccount")
     public HttpResult<IPage<InvAccount>> getInsAccountList(@RequestBody InvAccount insAccount){
-        return HttpResult.ok("", invAccountService.selectAccountsList(insAccount));
+        return HttpResult.ok("", invAccountService.selectAccountsListPage(insAccount));
     }
 
     @ApiOperation("获取账户详细信息")
     @GetMapping("getAccountById")
-    public HttpResult<InvAccount> getInsAccountById(@RequestParam("accountId") String accountId){
-        return HttpResult.ok("", invAccountService.getById(accountId));
+    public HttpResult getInsAccountById(@RequestParam("accountId") String accountId){
+        if (accountId == null){
+            throw new RuntimeException("id不能为空");
+        }
+        InvAccount invAccount = new InvAccount();
+        invAccount.setAccountId(accountId);
+
+        return HttpResult.ok("", invAccountService.selectAccounts(invAccount));
     }
 
     @ApiOperation("删除账户(只传一个id就行)")
@@ -40,7 +51,7 @@ public class InvAccountController {
         if (accountId!= null){
             InvAccount invAccount = invAccountService.getById(accountId);
             invAccount.setDelFlag("1");
-            if (invAccountService.updateInsAccount(invAccount) > 0){
+            if (invAccountService.updateById(invAccount)){
                 return HttpResult.ok("删除成功");
             }else {
                 return HttpResult.error();
@@ -53,7 +64,26 @@ public class InvAccountController {
     @ApiOperation("插入账户信息")
     @PostMapping("insertAccount")
     public HttpResult insertInsAccount(@RequestBody InvAccount invAccount){
-        if (invAccountService.insertInsAccount(invAccount) > 0){
+        if (invAccountService.save(invAccount)){
+            return HttpResult.ok();
+        }else {
+            return HttpResult.error();
+        }
+    }
+
+    @ApiOperation("插入账户卡信息")
+    @PostMapping("insertAccountCard")
+    public HttpResult insertInsAccountCard(@RequestBody InvAccountCard invAccountCard){
+
+        if (invAccountCard.getAccountId() == null){
+            throw new RuntimeException("账户id为空");
+        }
+        InvAccount byId = invAccountService.getById(invAccountCard.getAccountId());
+        if (byId.getOuterFlag().equals("1")){
+            throw new RuntimeException("外部账户不允许插入账户卡信息");
+        }
+
+        if (invAccountCardService.insertInsAccountCard(invAccountCard) > 0){
             return HttpResult.ok();
         }else {
             return HttpResult.error();
@@ -63,7 +93,21 @@ public class InvAccountController {
     @ApiOperation("修改账户信息")
     @PostMapping("updateAccount")
     public HttpResult updateInsAccount(@RequestBody InvAccount invAccount){
-        if (invAccountService.updateInsAccount(invAccount) > 0){
+        if (invAccountService.updateById(invAccount)){
+            return HttpResult.ok();
+        }else {
+            return HttpResult.error();
+        }
+    }
+
+    @ApiOperation("修改账户卡信息")
+    @PostMapping("updateAccountCard")
+    public HttpResult updateInsAccountCard(@RequestBody InvAccountCard invAccountCard){
+        if (invAccountCard.getBankCardNum() == null){
+            throw new RuntimeException("卡号不能为空");
+        }
+
+        if (invAccountCardService.updateInsAccountCard(invAccountCard) > 0){
             return HttpResult.ok();
         }else {
             return HttpResult.error();

+ 109 - 0
src/main/java/com/ydtech/modules/inv/controller/InvAccountIncoiceController.java

@@ -0,0 +1,109 @@
+package com.ydtech.modules.inv.controller;
+
+
+
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ydtech.core.page.HttpResult;
+import com.ydtech.modules.inv.model.InvAccountIncoice;
+import com.ydtech.modules.inv.service.InvAccountIncoiceService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.*;
+import org.yaml.snakeyaml.events.Event;
+
+import javax.annotation.Resource;
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 发票管理表(InvAccountIncoice)表控制层
+ *
+ * @author makejava
+ * @since 2024-01-18 16:01:25
+ */
+@RestController
+@RequestMapping("invAccountIncoice")
+@Api(tags = "发票管理表", value = "发票管理表")
+public class InvAccountIncoiceController{
+    /**
+     * 服务对象
+     */
+    @Resource
+    private InvAccountIncoiceService invAccountIncoiceService;
+
+
+    @GetMapping("excel")
+    @ApiOperation("导出开票记录表")
+    public HttpResult selectAccountIncoiceExcel() {
+        return HttpResult.ok();
+    }
+
+    /**
+     * 分页查询所有数据
+     *
+     * @param page 分页对象
+     * @param invAccountIncoice 查询实体
+     * @return 所有数据
+     */
+    @GetMapping
+    @ApiOperation("分页查询")
+    public HttpResult selectAll(Page<InvAccountIncoice> page, InvAccountIncoice invAccountIncoice) {
+        return HttpResult.ok(invAccountIncoiceService.page(page, new QueryWrapper<>(invAccountIncoice)));
+    }
+
+    /**
+     * 通过主键查询单条数据
+     *
+     * @param id 主键
+     * @return 单条数据
+     */
+    @GetMapping("{id}")
+    @ApiOperation("根据id查询")
+    public HttpResult selectOne(@PathVariable Serializable id) {
+        return HttpResult.ok(this.invAccountIncoiceService.getById(id));
+    }
+
+    /**
+     * 新增数据
+     *
+     * @param invAccountIncoice 实体对象
+     * @return 新增结果
+     */
+    @PostMapping
+    @ApiOperation("新增")
+    public HttpResult insert(@RequestBody InvAccountIncoice invAccountIncoice) {
+        return HttpResult.ok(this.invAccountIncoiceService.insertInvAccountIncoice(invAccountIncoice));
+    }
+
+    /**
+     * 修改数据
+     *
+     * @param invAccountIncoice 实体对象
+     * @return 修改结果
+     */
+    @PutMapping
+    @ApiOperation("修改")
+    public HttpResult update(@RequestBody InvAccountIncoice invAccountIncoice) {
+        return HttpResult.ok(this.invAccountIncoiceService.updateById(invAccountIncoice));
+    }
+
+    /**
+     * 撤销
+     *
+     */
+    @DeleteMapping
+    @ApiOperation("删除")
+    public HttpResult delete(@RequestParam("idList") Long idList) {
+        if (idList == null) {
+            throw new RuntimeException("id不能为空");
+        }
+
+        InvAccountIncoice invAccountIncoice = new InvAccountIncoice();
+        invAccountIncoice.setInvoiceId(idList);
+        invAccountIncoice.setDelFlag("1");
+        return HttpResult.ok(this.invAccountIncoiceService.updateById(invAccountIncoice));
+    }
+}
+

+ 7 - 9
src/main/java/com/ydtech/modules/inv/controller/invAccountExcelController.java

@@ -5,7 +5,9 @@ import com.ydtech.core.page.HttpResult;
 import com.ydtech.exception.SystemException;
 import com.ydtech.modules.base.controller.BaseController;
 import com.ydtech.modules.inv.model.InvAccount;
+import com.ydtech.modules.inv.model.InvAccountCard;
 import com.ydtech.modules.inv.model.InvAccountExcel;
+import com.ydtech.modules.inv.service.InvAccountCardService;
 import com.ydtech.modules.inv.service.InvAccountExcelService;
 import com.ydtech.modules.inv.service.InvAccountService;
 import io.swagger.annotations.Api;
@@ -26,8 +28,6 @@ import java.util.List;
 public class invAccountExcelController {
     @Autowired
     private InvAccountExcelService invAccountExcelService;
-    @Autowired
-    private InvAccountService invAccountService;
 
     @PostMapping("excel")
     @ApiOperation("导出资金申请模板")
@@ -42,15 +42,13 @@ public class invAccountExcelController {
         Date date = new Date();
         invAccountExcel.setCreateBy(baseController.getUserName());
         invAccountExcel.setCreateTime(date);
-        InvAccount byId = invAccountService.getById(invAccountExcel.getOutAccountId());
 
-        if (invAccountExcel.getEnterAccountId() != null) {
-            if (invAccountExcel.getOutAccountId().equals(invAccountExcel.getEnterAccountId())) {
-                throw new SystemException("无法转账给本公司");
-            }
+        if (invAccountExcel.getOutCardNum() == null && invAccountExcel.getEnterCardNum() == null) {
+            throw new SystemException("请先选择账户");
         }
-        if (invAccountExcel.getOutFlag().equals("1") && byId.getOuterFlag().equals("1")) {
-            throw new SystemException("外部账户转出到外部账户无法生成资金模板");
+
+        if (invAccountExcel.getEnterCardNum().equals(invAccountExcel.getOutCardNum())) {
+            throw new SystemException("无法转账给本公司");
         }
 
         if (invAccountExcelService.save(invAccountExcel)) {

+ 15 - 0
src/main/java/com/ydtech/modules/inv/dao/InvAccountCardMapper.java

@@ -0,0 +1,15 @@
+package com.ydtech.modules.inv.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.inv.model.InvAccountCard;
+import com.ydtech.modules.inv.model.InvAccountExcel;
+import org.apache.ibatis.annotations.Mapper;
+
+
+/**
+ * @author jianlong
+ * @date 2024-01-18 17:35
+ */
+@Mapper
+public interface InvAccountCardMapper extends BaseMapper<InvAccountCard> {
+}

+ 36 - 0
src/main/java/com/ydtech/modules/inv/dao/InvAccountIncoiceMapper.java

@@ -0,0 +1,36 @@
+package com.ydtech.modules.inv.dao;
+
+import java.util.List;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.inv.model.InvAccountIncoice;
+import org.apache.ibatis.annotations.Param;
+
+
+/**
+ * 发票管理表(InvAccountIncoice)表数据库访问层
+ *
+ * @author makejava
+ * @since 2024-01-18 16:01:26
+ */
+public interface InvAccountIncoiceMapper extends BaseMapper<InvAccountIncoice> {
+
+/**
+* 批量新增数据(MyBatis原生foreach方法)
+*
+* @param entities List<InvAccountIncoice> 实例对象列表
+* @return 影响行数
+*/
+int insertBatch(@Param("entities") List<InvAccountIncoice> entities);
+
+/**
+* 批量新增或按主键更新数据(MyBatis原生foreach方法)
+*
+* @param entities List<InvAccountIncoice> 实例对象列表
+* @return 影响行数
+* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参
+*/
+int insertOrUpdateBatch(@Param("entities") List<InvAccountIncoice> entities);
+
+}
+

+ 4 - 1
src/main/java/com/ydtech/modules/inv/dao/InvAccountMapper.java

@@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ydtech.modules.inv.model.InvAccount;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
+
 /**
  * @author Administrator
  * @description 针对表【ins_account(账户信息表)】的数据库操作Mapper
@@ -14,8 +16,9 @@ import org.apache.ibatis.annotations.Param;
  */
 public interface InvAccountMapper extends BaseMapper<InvAccount> {
 
-    IPage<InvAccount> SelectAccountsList(Page page, @Param("account")InvAccount account);
+    IPage<InvAccount> selectAccountsListPage(Page page, @Param("account")InvAccount account);
 
+    List<InvAccount> selectAccountsList(@Param("account")InvAccount account);
 }
 
 

+ 41 - 173
src/main/java/com/ydtech/modules/inv/model/InvAccount.java

@@ -3,8 +3,11 @@ package com.ydtech.modules.inv.model;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
+
+import java.io.PipedReader;
 import java.io.Serializable;
 import java.util.Date;
+import java.util.List;
 import java.util.Objects;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
@@ -32,36 +35,53 @@ public class InvAccount implements Serializable {
     private String accountName;
 
     /**
-     * 银行卡号
+     * 营业性质
+     */
+    @ApiModelProperty(value = "营业性质 (0一般纳税 1小规模 2个体户)")
+    private String businessQuality;
+
+    /**
+     * 所属地
      */
-    @ApiModelProperty(value = "银行卡号")
-    private String bankCardNum;
+    @ApiModelProperty(value = "所属地")
+    private String owned;
 
     /**
-     * 开户行名称
+     * 法人
      */
-    @ApiModelProperty(value = "开户行名称")
-    private String bankName;
+    @ApiModelProperty(value = "法人")
+    private String juridicalPerson;
 
     /**
-     * 开户行
+     * 成立日期
      */
-    @ApiModelProperty(value = "开户行")
-    private String bank;
+    @ApiModelProperty(value = "成立日期")
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    private Date establishTime;
 
     /**
-     * 开户行号
+     * 开票员
      */
-    @ApiModelProperty(value = "开户行号")
-    private String bankNum;
+    @ApiModelProperty(value = "开票员")
+    private String biller;
 
     /**
-     * 证书有效期开始
+     * 开票额度
      */
-    @ApiModelProperty(value = "证书有效期开始")
-    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
-    private Date startCertExpirationDate;
+    @ApiModelProperty(value = "开票额度")
+    private String invoicingAmount;
 
+    /**
+     * 剩余开票额度
+     */
+    @ApiModelProperty(value = "剩余开票额度")
+    private String invoicingAmountExcess;
+
+    /**
+     * 删除标志
+     */
+    @ApiModelProperty(value = "删除标志")
+    private String delFlag;
 
     /**
      * 创建者
@@ -73,7 +93,7 @@ public class InvAccount implements Serializable {
      * 创建时间
      */
     @ApiModelProperty(value = "创建时间")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
     private Date createTime;
 
     /**
@@ -86,144 +106,9 @@ public class InvAccount implements Serializable {
      * 更新时间
      */
     @ApiModelProperty(value = "更新时间")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
     private Date updateTime;
 
-    /**
-     * 账户性质(0公户 1私户)
-     */
-    @ApiModelProperty(value = "账户性质(0公户 1私户)")
-    private String accountQuality;
-
-    /**
-     * 对公单笔限额
-     */
-    @ApiModelProperty(value = "对公单笔限额")
-    private String pubSingleLines;
-
-    /**
-     * 对私单笔限额
-     */
-    @ApiModelProperty(value = "对私单笔限额")
-    private String priSingleLines;
-
-    /**
-     * 对公年额度
-     */
-    @ApiModelProperty(value = "对公年额度")
-    private String pubYearLines;
-
-    /**
-     * 对私年额度
-     */
-    @ApiModelProperty(value = "对私年额度")
-    private String priYearLines;
-
-    /**
-     * 单日转账笔数限制
-     */
-    @ApiModelProperty(value = "单日转账笔数限制")
-    private String dayStrokeNum;
-
-    /**
-     * 对公单日限额
-     */
-    @ApiModelProperty(value = "对公单日限额")
-    private String pubDayLines;
-
-    /**
-     * 对私单日限额
-     */
-    @ApiModelProperty(value = "对私单日限额")
-    private String priDayLines;
-
-    /**
-     * 对公年剩余额度
-     */
-    @ApiModelProperty(value = "对公年剩余额度")
-    private String pubYearExcess;
-
-    /**
-     * 对私年剩余额度
-     */
-    @ApiModelProperty(value = "对私年剩余额度")
-    private String priYearExcess;
-
-    /**
-     * 财税公司利润
-     */
-    @ApiModelProperty(value = "财务公司利润")
-    private String fiscalProfit;
-
-    /**
-     * 保险公司回款
-     */
-    @ApiModelProperty(value = "保险公司利润")
-    private String insuranceProfit;
-
-    /**
-     * 结算卡
-     */
-    @ApiModelProperty(value = "结算卡")
-    private String clearingProfit;
-
-    /**
-     * 外部过账金额
-     */
-    @ApiModelProperty(value = "外部过账金额")
-    private String exteriorProfit;
-
-    /**
-     * 园区利润
-     */
-    @ApiModelProperty(value = "园区利润")
-    private String parkProfit;
-
-    /**
-     * 天勤利润
-     */
-    @ApiModelProperty(value = "天勤利润")
-    private String tianqinProfit;
-
-    /**
-     * 其他利润
-     */
-    @ApiModelProperty(value = "其他利润")
-    private String otherProfit;
-
-    /**
-     * 证书有效期结束
-     */
-    @ApiModelProperty(value = "证书有效期结束")
-    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
-    private Date endCertExpirationDate;
-
-    /**
-     * 余额
-     */
-    @ApiModelProperty(value = "余额")
-    private String balance;
-
-    /**
-     * 单日转账笔数剩余
-     */
-    @ApiModelProperty(value = "单日转账笔数剩余")
-    private String dayStrokeNumExcess;
-
-    /**
-     * 对公单日限额剩余
-     */
-    @ApiModelProperty(value = "对公单日限额剩余")
-    private String pubDayLinesExcess;
-
-    /**
-     * 对私单日限额剩余
-     */
-    @ApiModelProperty(value = "对私单日限额剩余")
-    private String priDayLinesExcess;
-
-    @ApiModelProperty(value = "删除标志 删除时不需要传递")
-    private String delFlag;
 
     /**
      * 外部账户标识(0内部账户 1外部账户)
@@ -231,13 +116,10 @@ public class InvAccount implements Serializable {
     @ApiModelProperty(value = "外部账户标识(0内部账户 1外部账户)")
     private String outerFlag;
 
-    /**
-     * 支出金额
-     */
-    @ApiModelProperty("支出金额")
-    private String spend;
-
 
+    @ApiModelProperty(value = "所属账户下的卡")
+    @TableField(exist = false)
+    List<InvAccountCard> invAccountCardList;
 
 
     @TableField(exist = false)
@@ -248,18 +130,4 @@ public class InvAccount implements Serializable {
 
     @TableField(exist = false)
     private static final long serialVersionUID = 1L;
-
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
-        InvAccount that = (InvAccount) o;
-        return Objects.equals(pubSingleLines, that.pubSingleLines) && Objects.equals(priSingleLines, that.priSingleLines) && Objects.equals(pubYearLines, that.pubYearLines) && Objects.equals(priYearLines, that.priYearLines) && Objects.equals(dayStrokeNum, that.dayStrokeNum) && Objects.equals(pubDayLines, that.pubDayLines) && Objects.equals(priDayLines, that.priDayLines);
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hash(pubSingleLines, priSingleLines, pubYearLines, priYearLines, dayStrokeNum, pubDayLines, priDayLines);
-    }
 }

+ 223 - 0
src/main/java/com/ydtech/modules/inv/model/InvAccountCard.java

@@ -0,0 +1,223 @@
+package com.ydtech.modules.inv.model;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @author jianlong
+ * @date 2024-01-18 15:49
+ */
+@TableName(value ="inv_account_card")
+@Data
+public class InvAccountCard {
+    /**
+     * 银行卡号
+     */
+    @ApiModelProperty(value = "银行卡号")
+    @TableId
+    private String bankCardNum;
+
+
+    @ApiModelProperty(value = "账户id")
+    private String accountId;
+
+    /**
+     * 开户行名称
+     */
+    @ApiModelProperty(value = "开户行名称")
+    private String bankName;
+
+    /**
+     * 开户行
+     */
+    @ApiModelProperty(value = "开户行")
+    private String bank;
+
+    /**
+     * 开户行号
+     */
+    @ApiModelProperty(value = "开户行号")
+    private String bankNum;
+
+    /**
+     * 证书有效期开始
+     */
+    @ApiModelProperty(value = "证书有效期开始")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date startCertExpirationDate;
+
+
+    /**
+     * 创建者
+     */
+    @ApiModelProperty(value = "创建者")
+    private String createBy;
+
+    /**
+     * 创建时间
+     */
+    @ApiModelProperty(value = "创建时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date createTime;
+
+    /**
+     * 更新者
+     */
+    @ApiModelProperty(value = "更新者")
+    private String updateBy;
+
+    /**
+     * 更新时间
+     */
+    @ApiModelProperty(value = "更新时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date updateTime;
+
+    /**
+     * 账户性质(0公户 1私户)
+     */
+    @ApiModelProperty(value = "账户性质(0公户 1私户)")
+    private String accountQuality;
+
+    /**
+     * 对公单笔限额
+     */
+    @ApiModelProperty(value = "对公单笔限额")
+    private String pubSingleLines;
+
+    /**
+     * 对私单笔限额
+     */
+    @ApiModelProperty(value = "对私单笔限额")
+    private String priSingleLines;
+
+    /**
+     * 对公年额度
+     */
+    @ApiModelProperty(value = "对公年额度")
+    private String pubYearLines;
+
+    /**
+     * 对私年额度
+     */
+    @ApiModelProperty(value = "对私年额度")
+    private String priYearLines;
+
+    /**
+     * 单日转账笔数限制
+     */
+    @ApiModelProperty(value = "单日转账笔数限制")
+    private String dayStrokeNum;
+
+    /**
+     * 对公单日限额
+     */
+    @ApiModelProperty(value = "对公单日限额")
+    private String pubDayLines;
+
+    /**
+     * 对私单日限额
+     */
+    @ApiModelProperty(value = "对私单日限额")
+    private String priDayLines;
+
+    /**
+     * 对公年剩余额度
+     */
+    @ApiModelProperty(value = "对公年剩余额度")
+    private String pubYearExcess;
+
+    /**
+     * 对私年剩余额度
+     */
+    @ApiModelProperty(value = "对私年剩余额度")
+    private String priYearExcess;
+
+    /**
+     * 财税公司利润
+     */
+    @ApiModelProperty(value = "财务公司利润")
+    private String fiscalProfit;
+
+    /**
+     * 保险公司回款
+     */
+    @ApiModelProperty(value = "保险公司利润")
+    private String insuranceProfit;
+
+    /**
+     * 结算卡
+     */
+    @ApiModelProperty(value = "结算卡")
+    private String clearingProfit;
+
+    /**
+     * 外部过账金额
+     */
+    @ApiModelProperty(value = "外部过账金额")
+    private String exteriorProfit;
+
+    /**
+     * 园区利润
+     */
+    @ApiModelProperty(value = "园区利润")
+    private String parkProfit;
+
+    /**
+     * 天勤利润
+     */
+    @ApiModelProperty(value = "天勤利润")
+    private String tianqinProfit;
+
+    /**
+     * 其他利润
+     */
+    @ApiModelProperty(value = "其他利润")
+    private String otherProfit;
+
+    /**
+     * 证书有效期结束
+     */
+    @ApiModelProperty(value = "证书有效期结束")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date endCertExpirationDate;
+
+    /**
+     * 余额
+     */
+    @ApiModelProperty(value = "余额")
+    private String balance;
+
+    /**
+     * 单日转账笔数剩余
+     */
+    @ApiModelProperty(value = "单日转账笔数剩余")
+    private String dayStrokeNumExcess;
+
+    /**
+     * 对公单日限额剩余
+     */
+    @ApiModelProperty(value = "对公单日限额剩余")
+    private String pubDayLinesExcess;
+
+    /**
+     * 对私单日限额剩余
+     */
+    @ApiModelProperty(value = "对私单日限额剩余")
+    private String priDayLinesExcess;
+
+    @ApiModelProperty(value = "删除标志 删除时不需要传递")
+    private String delFlag;
+
+    /**
+     * 支出金额
+     */
+    @ApiModelProperty("支出金额")
+    private String spend;
+}

+ 4 - 4
src/main/java/com/ydtech/modules/inv/model/InvAccountExcel.java

@@ -149,14 +149,14 @@ public class InvAccountExcel implements Serializable {
     /**
      * 转入的账户id
      */
-    @ApiModelProperty(value = "转入的账户id")
-    private String enterAccountId;
+    @ApiModelProperty(value = "转入的银行卡号")
+    private String enterCardNum;
 
     /**
      * 转出的账户id
      */
-    @ApiModelProperty(value = "转出的账户id")
-    private String outAccountId;
+    @ApiModelProperty(value = "转出的银行卡号")
+    private String outCardNum;
 
 
     /**

+ 117 - 0
src/main/java/com/ydtech/modules/inv/model/InvAccountIncoice.java

@@ -0,0 +1,117 @@
+package com.ydtech.modules.inv.model;
+
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 发票管理表(InvAccountIncoice)表实体类
+ *
+ * @author makejava
+ * @since 2024-01-18 16:01:27
+ */
+@TableName(value ="inv_account_incoice")
+@Data
+public class InvAccountIncoice implements Serializable{
+
+    //发票序号
+    @ApiModelProperty(value = "发票序号")
+    @TableId
+    @ExcelProperty("发票序号")
+    private Long invoiceId;
+
+    //开票员
+    @ApiModelProperty(value = "开票员")
+    @ExcelProperty("开票员")
+    private String biller;
+
+    //开票科目
+    @ApiModelProperty(value = "开票科目")
+    @ExcelProperty("开票科目")
+    private String invoiceSubjects;
+
+    //开票方
+    @ApiModelProperty(value = "对方单位")
+    @ExcelProperty("对方单位")
+    private String invoiceBy;
+
+    //对方单位
+    @ApiModelProperty(value = "对方单位")
+    @ExcelProperty("对方单位")
+    private String otherUnit;
+
+    //发票数
+    @ApiModelProperty(value = "发票数")
+    @ExcelProperty("发票数")
+    private String invoiceNum;
+
+    //开票日期
+    @ApiModelProperty(value = "开票日期")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date invoiceTime;
+
+    @ApiModelProperty(value = "解决开票日期报错问题无需传递参数")
+    @ExcelProperty("开票日期")
+    private String invoiceDate;
+
+    //不含税金额
+    @ApiModelProperty(value = "不含税金额")
+    @ExcelProperty("不含税金额")
+    private String noHasTax;
+
+    //税率
+    @ApiModelProperty(value = "税率")
+    @ExcelProperty("税率")
+    private String rate;
+
+    //税额
+    @ApiModelProperty(value = "税额")
+    @ExcelProperty("税额 填写百分数  不填写小数")
+    private String tax;
+
+    //开票金额
+    @ApiModelProperty(value = "开票金额")
+    @ExcelProperty("开票金额")
+    private String invoiceMoney;
+
+    //发票类型
+    @ApiModelProperty(value = "发票类型")
+    @ExcelProperty("发票类型")
+    private String invoiceType;
+
+    //进账日期
+    @ApiModelProperty(value = "进账日期")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date payoutTime;
+
+    @ApiModelProperty(value = "解决进账日期报错问题无需传递参数")
+    @ExcelProperty("进账日期")
+    private String payoutDate;
+
+    @ApiModelProperty(value = "卡号")
+    private String bankCardNum;
+
+
+    //进账金额
+    @ApiModelProperty(value = "进账金额")
+    @ExcelProperty("进账金额")
+    private String payoutMoney;
+
+    //未进账金额
+    @ApiModelProperty(value = "未进账金额")
+    @ExcelProperty("未进账金额")
+    private String notPayoutMoney;
+
+    //撤销标志(0正常 1撤销)
+    private String delFlag;
+}
+

+ 3 - 3
src/main/java/com/ydtech/modules/inv/model/InvAccountOperate.java

@@ -40,7 +40,7 @@ public class InvAccountOperate implements Serializable {
      * 申请时间
      */
     @ApiModelProperty(value = "申请时间")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
     private Date applyTime;
 
     /**
@@ -97,9 +97,9 @@ public class InvAccountOperate implements Serializable {
     @ApiModelProperty(value = "收入0支出1")
     private String revenueOutlay;
 
-    @ApiModelProperty(value = "外部转内部需携带转入id")
+    @ApiModelProperty(value = "外部转内部需携带转入银行卡id")
     @TableField(exist = false)
-    private String enterAccountId;
+    private String enterCardId;
 
 
     @TableField(exist = false)

+ 1 - 1
src/main/java/com/ydtech/modules/inv/model/po/InvChannelAccount.java

@@ -18,7 +18,7 @@ public class InvChannelAccount implements Serializable {
     /**
      * 工号
      */
-    @TableId(value = "employee_id")
+    @TableField(value = "employee_id")
     private Long employeeId;
 
     /**

+ 1 - 1
src/main/java/com/ydtech/modules/inv/model/po/InvSettlementSource.java

@@ -18,7 +18,7 @@ public class InvSettlementSource implements Serializable {
     /**
      * 工号
      */
-    @TableId(value = "employee_id")
+    @TableField(value = "employee_id")
     private Long employeeId;
 
     /**

+ 1 - 1
src/main/java/com/ydtech/modules/inv/model/po/InvSource.java

@@ -19,7 +19,7 @@ public class InvSource implements Serializable {
     /**
      * 保司编码
      */
-    @TableId(value = "insurance_id")
+    @TableField(value = "insurance_id")
     private Long insuranceId;
 
     /**

+ 19 - 0
src/main/java/com/ydtech/modules/inv/service/InvAccountCardService.java

@@ -0,0 +1,19 @@
+package com.ydtech.modules.inv.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydtech.modules.inv.model.InvAccount;
+import com.ydtech.modules.inv.model.InvAccountCard;
+import org.springframework.stereotype.Service;
+
+
+/**
+ * @author jianlong
+ * @date 2024-01-18 17:34
+ */
+@Service
+public interface InvAccountCardService extends IService<InvAccountCard> {
+
+    int insertInsAccountCard(InvAccountCard insAccount);
+
+    int updateInsAccountCard(InvAccountCard insAccount);
+}

+ 17 - 0
src/main/java/com/ydtech/modules/inv/service/InvAccountIncoiceService.java

@@ -0,0 +1,17 @@
+package com.ydtech.modules.inv.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydtech.modules.inv.model.InvAccountIncoice;
+
+
+/**
+ * 发票管理表(InvAccountIncoice)表服务接口
+ *
+ * @author makejava
+ * @since 2024-01-18 16:01:30
+ */
+public interface InvAccountIncoiceService extends IService<InvAccountIncoice> {
+
+    int insertInvAccountIncoice(InvAccountIncoice invAccountIncoice);
+
+}

+ 5 - 3
src/main/java/com/ydtech/modules/inv/service/InvAccountService.java

@@ -5,6 +5,8 @@ import com.ydtech.core.page.HttpResult;
 import com.ydtech.modules.inv.model.InvAccount;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.List;
+
 /**
 * @author Administrator
 * @description 针对表【ins_account(账户信息表)】的数据库操作Service
@@ -12,11 +14,11 @@ import com.baomidou.mybatisplus.extension.service.IService;
 */
 public interface InvAccountService extends IService<InvAccount> {
 
-    IPage<InvAccount> selectAccountsList(InvAccount account);
+    IPage<InvAccount> selectAccountsListPage(InvAccount account);
+
+    List<InvAccount> selectAccounts(InvAccount account);
 
-    int updateInsAccount(InvAccount insAccount);
 
-    int insertInsAccount(InvAccount insAccount);
 
     HttpResult selectByAccountName();
 

+ 130 - 0
src/main/java/com/ydtech/modules/inv/service/impl/InvAccountCardServiceImpl.java

@@ -0,0 +1,130 @@
+package com.ydtech.modules.inv.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydtech.modules.base.controller.BaseController;
+import com.ydtech.modules.inv.dao.InvAccountCardMapper;
+import com.ydtech.modules.inv.model.InvAccount;
+import com.ydtech.modules.inv.model.InvAccountCard;
+import com.ydtech.modules.inv.service.InvAccountCardService;
+import com.ydtech.modules.inv.service.InvAccountService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+
+/**
+ * @author jianlong
+ * @date 2024-01-18 17:35
+ */
+@Service
+public class InvAccountCardServiceImpl extends ServiceImpl<InvAccountCardMapper, InvAccountCard> implements InvAccountCardService {
+
+    @Autowired
+    InvAccountCardMapper invAccountCardMapper;
+
+    @Autowired
+    InvAccountService invAccountService;
+
+    /**
+     * 插入
+     *
+     * @param
+     * @return
+     */
+
+    @Override
+    public int insertInsAccountCard(InvAccountCard insAccountCard) {
+        InvAccount byId = invAccountService.getById(insAccountCard.getAccountId());
+
+        if(byId.getOuterFlag().equals("0")) {
+            throw new RuntimeException("外部账户无法录入卡片信息");
+        }
+            //插入剩余额度以及笔数
+        insAccountCard.setPubYearExcess(insAccountCard.getPubYearLines());
+        insAccountCard.setPubDayLinesExcess(insAccountCard.getPubDayLines());
+        insAccountCard.setPriYearExcess(insAccountCard.getPriYearLines());
+        insAccountCard.setPriDayLinesExcess((insAccountCard.getPriDayLines()));
+        insAccountCard.setDayStrokeNumExcess(insAccountCard.getDayStrokeNum());
+        insAccountCard.setPubSingleLines(insAccountCard.getPubSingleLines());
+        insAccountCard.setPriSingleLines(insAccountCard.getPriSingleLines());
+
+
+            //计算余额
+            BigDecimal count = new BigDecimal(insAccountCard.getFiscalProfit())
+                    .add(new BigDecimal(insAccountCard.getInsuranceProfit())) //财税公司利润
+                    .add(new BigDecimal(insAccountCard.getInsuranceProfit())) //保险公司回款
+                    .add(new BigDecimal(insAccountCard.getExteriorProfit()))//外部过账金额
+                    .add(new BigDecimal(insAccountCard.getParkProfit()))//园区利润
+                    .add(new BigDecimal(insAccountCard.getTianqinProfit()))//天勤利润
+                    .add(new BigDecimal(insAccountCard.getOtherProfit()))//其他利润
+                    .add(new BigDecimal(insAccountCard.getClearingProfit()));//结算卡
+            BaseController baseController = new BaseController();
+        insAccountCard.setBalance(String.valueOf(count));
+        insAccountCard.setCreateBy(baseController.getUserName());
+        insAccountCard.setCreateTime(new Date());
+        return invAccountCardMapper.insert(insAccountCard);
+    }
+
+
+    /**
+     * 修改方法
+     *
+     * @param
+     * @return
+     */
+    @Override
+    public int updateInsAccountCard(InvAccountCard invAccountCard) {
+        BaseController baseController = new BaseController();
+        invAccountCard.setUpdateBy(baseController.getUserName());
+        invAccountCard.setUpdateTime(new Date());
+        //不允许修改余额
+        invAccountCard.setBalance(null);
+        invAccountCard.setDayStrokeNumExcess(null);
+        invAccountCard.setPubDayLinesExcess(null);
+        invAccountCard.setPubYearExcess(null);
+        invAccountCard.setPriDayLinesExcess(null);
+        invAccountCard.setPriYearExcess(null);
+
+        InvAccountCard oldInvAccountCard = invAccountCardMapper.selectById(invAccountCard.getBankCardNum());
+        //判断是否修改额度
+        if (!oldInvAccountCard.equals(invAccountCard)) {
+            return invAccountCardMapper.updateById(updateInsAccountLines(oldInvAccountCard, invAccountCard));
+        }
+        return invAccountCardMapper.updateById(invAccountCard);
+    }
+
+    /**
+     * 修改额度方法
+     */
+    private InvAccountCard updateInsAccountLines(InvAccountCard oldeInvAccountCard, InvAccountCard newInvAccountCard) {
+        if (oldeInvAccountCard.getPriYearLines().equals(newInvAccountCard.getPriYearLines())) {
+            //对私年额度已经消费
+            BigDecimal subtract = new BigDecimal(oldeInvAccountCard.getPriYearLines()).subtract(new BigDecimal(oldeInvAccountCard.getPriYearExcess()));
+            newInvAccountCard.setPriYearExcess(subtract.toString());
+        }
+        if (oldeInvAccountCard.getPubYearLines().equals(newInvAccountCard.getPubYearLines())) {
+            //对公年额度已经消费
+            BigDecimal subtract = new BigDecimal(oldeInvAccountCard.getPubYearLines()).subtract(new BigDecimal(oldeInvAccountCard.getPubYearExcess()));
+            newInvAccountCard.setPubYearExcess(subtract.toString());
+        }
+        if (oldeInvAccountCard.getPubDayLines().equals(newInvAccountCard.getPubDayLines())) {
+            //对公单日额度已经消费
+            BigDecimal subtract = new BigDecimal(oldeInvAccountCard.getPubDayLines()).subtract(new BigDecimal(oldeInvAccountCard.getPubDayLinesExcess()));
+            newInvAccountCard.setPubDayLinesExcess(subtract.toString());
+        }
+        if (oldeInvAccountCard.getPriDayLines().equals(newInvAccountCard.getPriDayLines())) {
+            //对私单日额度已经消费
+            BigDecimal subtract = new BigDecimal(oldeInvAccountCard.getPriDayLines()).subtract(new BigDecimal(oldeInvAccountCard.getPriDayLinesExcess()));
+            newInvAccountCard.setPriDayLinesExcess(subtract.toString());
+        }
+        if (oldeInvAccountCard.getDayStrokeNum().equals(newInvAccountCard.getDayStrokeNum())) {
+            //单日转账笔数已经消费
+            BigDecimal subtract = new BigDecimal(oldeInvAccountCard.getDayStrokeNum()).subtract(new BigDecimal(oldeInvAccountCard.getDayStrokeNumExcess()));
+            newInvAccountCard.setDayStrokeNumExcess(subtract.toString());
+        }
+
+        return newInvAccountCard;
+    }
+}

+ 17 - 13
src/main/java/com/ydtech/modules/inv/service/impl/InvAccountExcelServiceImpl.java

@@ -10,8 +10,10 @@ import com.ydtech.core.page.PageRequest;
 import com.ydtech.modules.base.controller.BaseController;
 import com.ydtech.modules.inv.dao.InvAccountExcelMapper;
 import com.ydtech.modules.inv.model.InvAccount;
+import com.ydtech.modules.inv.model.InvAccountCard;
 import com.ydtech.modules.inv.model.InvAccountExcel;
 import com.ydtech.modules.inv.model.InvAccountOperate;
+import com.ydtech.modules.inv.service.InvAccountCardService;
 import com.ydtech.modules.inv.service.InvAccountExcelService;
 import com.ydtech.modules.inv.service.InvAccountOperateService;
 import com.ydtech.modules.inv.service.InvAccountService;
@@ -39,7 +41,7 @@ public class InvAccountExcelServiceImpl extends ServiceImpl<InvAccountExcelMappe
     @Autowired
     private InvAccountOperateService insAccountOperateService;
     @Autowired
-    private InvAccountService insAccountService;
+    private InvAccountCardService invAccountCardService;
     @Autowired
     private EasyExcelUtils easyExcelUtils;
 
@@ -87,14 +89,16 @@ public class InvAccountExcelServiceImpl extends ServiceImpl<InvAccountExcelMappe
         if (invAccountExcel == null) {
             throw new RuntimeException("该记录不存在");
         }
-        InvAccount outAccount = insAccountService.getById(invAccountExcel.getOutAccountId());
-        InvAccount enterAccount = insAccountService.getById(invAccountExcel.getEnterAccountId());
+
+        InvAccountCard outAccountCard = invAccountCardService.getById(invAccountExcel.getOutCardNum());
+        InvAccountCard enterAccountCard = invAccountCardService.getById(invAccountExcel.getEnterCardNum());
+
         BaseController baseController = new BaseController();
         String userName = baseController.getUserName();
-        outAccount.setUpdateBy(userName);
-        outAccount.setUpdateTime(new Date());
-        enterAccount.setUpdateBy(userName);
-        enterAccount.setUpdateTime(new Date());
+        outAccountCard.setUpdateBy(userName);
+        outAccountCard.setUpdateTime(new Date());
+        enterAccountCard.setUpdateBy(userName);
+        enterAccountCard.setUpdateTime(new Date());
         //修改转账状态
         invAccountExcel.setTransferFlag("0");
         //判断是转账给内部还是外部
@@ -102,11 +106,11 @@ public class InvAccountExcelServiceImpl extends ServiceImpl<InvAccountExcelMappe
             //转账操作
 
             //如果转账失败就返回错误
-            List<InvAccount> insAccounts = insideTransfer(outAccount, enterAccount, invAccountExcel);
-            if (insAccounts.isEmpty()) {
+            List<InvAccountCard> insAccountCards = insideTransfer(outAccountCard, enterAccountCard, invAccountExcel);
+            if (insAccountCards.isEmpty()) {
                 throw new RuntimeException("转账失败");
             }
-            if (!insAccountService.updateBatchById(insAccounts)){
+            if (!invAccountCardService.updateBatchById(insAccountCards)){
                 throw new RuntimeException("转账失败");
             }
 
@@ -121,11 +125,11 @@ public class InvAccountExcelServiceImpl extends ServiceImpl<InvAccountExcelMappe
             }
         } else {
             //内转外部转账
-            List<InvAccount> invAccounts = enterDeTransfer(outAccount, enterAccount, invAccountExcel);
-            insAccountOperateService.save(insertOutAccountOperate(invAccountExcel));
-            if (!insAccountService.saveBatch(invAccounts)){
+            List<InvAccountCard> invAccounts = enterDeTransfer(outAccountCard, enterAccountCard, invAccountExcel);
+            if (!invAccountCardService.saveBatch(invAccounts)){
                 throw new RuntimeException("添加转账信息失败");
             }
+            insAccountOperateService.save(insertOutAccountOperate(invAccountExcel));
         }
         return HttpResult.ok("", insAccountExcelMapper.updateById(invAccountExcel));
     }

+ 68 - 0
src/main/java/com/ydtech/modules/inv/service/impl/InvAccountIncoiceServiceImpl.java

@@ -0,0 +1,68 @@
+package com.ydtech.modules.inv.service.impl;
+
+
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydtech.exception.SystemException;
+import com.ydtech.modules.inv.dao.InvAccountIncoiceMapper;
+import com.ydtech.modules.inv.model.InvAccountCard;
+import com.ydtech.modules.inv.model.InvAccountIncoice;
+import com.ydtech.modules.inv.service.InvAccountCardService;
+import com.ydtech.modules.inv.service.InvAccountIncoiceService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+
+/**
+ * 发票管理表(InvAccountIncoice)表服务实现类
+ *
+ * @author makejava
+ * @since 2024-01-18 16:01:31
+ */
+@Service("invAccountIncoiceService")
+public class InvAccountIncoiceServiceImpl extends ServiceImpl<InvAccountIncoiceMapper, InvAccountIncoice> implements InvAccountIncoiceService {
+
+    @Autowired
+    private InvAccountIncoiceMapper invAccountIncoiceMapper;
+    @Autowired
+    private InvAccountCardService invAccountCardService;
+
+    @Override
+    public int insertInvAccountIncoice(InvAccountIncoice invAccountIncoice) {
+        if (invAccountIncoice.getRate() == null){
+            throw new SystemException("请填写税率");
+        }
+        if (invAccountIncoice.getInvoiceMoney() == null){
+            throw new SystemException("请填写开票金额");
+        }
+
+        //税额
+        BigDecimal tax = new BigDecimal(invAccountIncoice.getRate()).divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP);
+        //不含税金额
+        BigDecimal noHasTax = new BigDecimal(invAccountIncoice.getInvoiceMoney()).subtract(tax);
+
+        //税额
+        invAccountIncoice.setTax(tax.toString());
+        //不含税金额
+        invAccountIncoice.setNoHasTax(noHasTax.toString());
+
+
+        InvAccountCard invAccountCard = invAccountCardService.getById(invAccountIncoice.getBankCardNum());
+        //进账卡号
+        String bankCardNum = invAccountIncoice.getBankCardNum();
+        //进账金额
+        String payoutMoney = invAccountIncoice.getPayoutMoney();
+
+        //新增发票后直接加在余额上
+        invAccountCard.setBalance(String.valueOf(new BigDecimal(payoutMoney).add(new BigDecimal(invAccountCard.getBalance()))));
+        invAccountCard.setBankCardNum(bankCardNum);
+
+        invAccountCardService.updateById(invAccountCard);
+
+        return  invAccountIncoiceMapper.insert(invAccountIncoice);
+    }
+
+}
+

+ 8 - 3
src/main/java/com/ydtech/modules/inv/service/impl/InvAccountOperateServiceImpl.java

@@ -8,8 +8,10 @@ import com.ydtech.constants.enums.inv.InvPayMethodEnum;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.core.page.PageRequest;
 import com.ydtech.modules.inv.model.InvAccount;
+import com.ydtech.modules.inv.model.InvAccountCard;
 import com.ydtech.modules.inv.model.InvAccountExcel;
 import com.ydtech.modules.inv.model.InvAccountOperate;
+import com.ydtech.modules.inv.service.InvAccountCardService;
 import com.ydtech.modules.inv.service.InvAccountOperateService;
 import com.ydtech.modules.inv.dao.InvAccountOperateMapper;
 import com.ydtech.modules.inv.service.InvAccountService;
@@ -35,6 +37,9 @@ public class InvAccountOperateServiceImpl extends ServiceImpl<InvAccountOperateM
     @Autowired
     private InvAccountService insAccountService;
 
+    @Autowired
+    private InvAccountCardService invAccountCardService;
+
     /**
      * 查询操作列表
      *
@@ -70,10 +75,10 @@ public class InvAccountOperateServiceImpl extends ServiceImpl<InvAccountOperateM
      */
     @Override
     public HttpResult insert(InvAccountOperate invAccountOperate) {
-        InvAccount enterAccount = insAccountService.getById(invAccountOperate.getEnterAccountId());
-        InvAccount invAccount = outsideTransfer(enterAccount, invAccountOperate);
+        InvAccountCard enterAccount = invAccountCardService.getById(invAccountOperate.getEnterCardId());
+        InvAccountCard invAccount = outsideTransfer(enterAccount, invAccountOperate);
 
-        if (!insAccountService.updateById(invAccount)){
+        if (!invAccountCardService.updateById(invAccount)){
 
             return HttpResult.error("新增收入失败");
         }

+ 15 - 98
src/main/java/com/ydtech/modules/inv/service/impl/InvAccountServiceImpl.java

@@ -36,112 +36,29 @@ public class InvAccountServiceImpl extends ServiceImpl<InvAccountMapper, InvAcco
      * @return
      */
     @Override
-    public IPage<InvAccount> selectAccountsList(InvAccount account) {
+    public IPage<InvAccount> selectAccountsListPage(InvAccount account) {
         PageRequest pageRequest = new PageRequest();
         pageRequest.setPageNum(account.getPageNo());
         pageRequest.setPageSize(account.getPageSize());
         Page page = PageRequest.buildPageRequest(pageRequest);
-        return insAccountMapper.SelectAccountsList(page, account);
+        IPage<InvAccount> invAccountIPage = insAccountMapper.selectAccountsListPage(page, account);
+        List<InvAccount> records = invAccountIPage.getRecords();
+        records.forEach(invAccount -> {
+            if (invAccount.getInvAccountCardList().size() < 2) {
+                if (invAccount.getInvAccountCardList().get(0).getBankCardNum() == null) {
+                    invAccount.setInvAccountCardList(null);
+                }
+            }
+        });
+        return invAccountIPage;
     }
 
-    /**
-     * 修改方法
-     *
-     * @param insAccount
-     * @return
-     */
     @Override
-    public int updateInsAccount(InvAccount invAccount) {
-        BaseController baseController = new BaseController();
-        invAccount.setUpdateBy(baseController.getUserName());
-        invAccount.setUpdateTime(new Date());
-        //不允许修改余额
-        invAccount.setBalance(null);
-        invAccount.setDayStrokeNumExcess(null);
-        invAccount.setPubDayLinesExcess(null);
-        invAccount.setPubYearExcess(null);
-        invAccount.setPriDayLinesExcess(null);
-        invAccount.setPriYearExcess(null);
-
-        InvAccount oldeInsAccount = insAccountMapper.selectById(invAccount.getAccountId());
-        //判断是否修改额度
-        if (!oldeInsAccount.equals(invAccount)) {
-            return insAccountMapper.updateById(updateInsAccountLines(oldeInsAccount, invAccount));
-        }
-        return insAccountMapper.updateById(invAccount);
+    public List<InvAccount> selectAccounts(InvAccount account) {
+        return insAccountMapper.selectAccountsList(account);
     }
 
 
-    /**
-     * 修改额度方法
-     */
-    private InvAccount updateInsAccountLines(InvAccount oldeInvAccount, InvAccount newInvAccount) {
-        if (oldeInvAccount.getPriYearLines().equals(newInvAccount.getPriYearLines())) {
-            //对私年额度已经消费
-            BigDecimal subtract = new BigDecimal(oldeInvAccount.getPriYearLines()).subtract(new BigDecimal(oldeInvAccount.getPriYearExcess()));
-            newInvAccount.setPriYearExcess(subtract.toString());
-        }
-        if (oldeInvAccount.getPubYearLines().equals(newInvAccount.getPubYearLines())) {
-            //对公年额度已经消费
-            BigDecimal subtract = new BigDecimal(oldeInvAccount.getPubYearLines()).subtract(new BigDecimal(oldeInvAccount.getPubYearExcess()));
-            newInvAccount.setPubYearExcess(subtract.toString());
-        }
-        if (oldeInvAccount.getPubDayLines().equals(newInvAccount.getPubDayLines())) {
-            //对公单日额度已经消费
-            BigDecimal subtract = new BigDecimal(oldeInvAccount.getPubDayLines()).subtract(new BigDecimal(oldeInvAccount.getPubDayLinesExcess()));
-            newInvAccount.setPubDayLinesExcess(subtract.toString());
-        }
-        if (oldeInvAccount.getPriDayLines().equals(newInvAccount.getPriDayLines())) {
-            //对私单日额度已经消费
-            BigDecimal subtract = new BigDecimal(oldeInvAccount.getPriDayLines()).subtract(new BigDecimal(oldeInvAccount.getPriDayLinesExcess()));
-            newInvAccount.setPriDayLinesExcess(subtract.toString());
-        }
-        if (oldeInvAccount.getDayStrokeNum().equals(newInvAccount.getDayStrokeNum())) {
-            //单日转账笔数已经消费
-            BigDecimal subtract = new BigDecimal(oldeInvAccount.getDayStrokeNum()).subtract(new BigDecimal(oldeInvAccount.getDayStrokeNumExcess()));
-            newInvAccount.setDayStrokeNumExcess(subtract.toString());
-        }
-
-        return newInvAccount;
-    }
-
-    /**
-     * 插入
-     *
-     * @param insAccount
-     * @return
-     */
-    @Override
-    public int insertInsAccount(InvAccount invAccount) {
-        if(invAccount.getOuterFlag().equals("0")){
-            //插入剩余额度以及笔数
-            invAccount.setPubYearExcess(invAccount.getPubYearLines());
-            invAccount.setPubDayLinesExcess(invAccount.getPubDayLines());
-            invAccount.setPriYearExcess(invAccount.getPriYearLines());
-            invAccount.setPriDayLinesExcess((invAccount.getPriDayLines()));
-            invAccount.setDayStrokeNumExcess(invAccount.getDayStrokeNum());
-            invAccount.setPubSingleLines(invAccount.getPubSingleLines());
-            invAccount.setPriSingleLines(invAccount.getPriSingleLines());
-
-
-            //计算余额
-            BigDecimal count = new BigDecimal(invAccount.getFiscalProfit())
-                    .add(new BigDecimal(invAccount.getInsuranceProfit())) //财税公司利润
-                    .add(new BigDecimal(invAccount.getInsuranceProfit())) //保险公司回款
-                    .add(new BigDecimal(invAccount.getExteriorProfit()))//外部过账金额
-                    .add(new BigDecimal(invAccount.getParkProfit()))//园区利润
-                    .add(new BigDecimal(invAccount.getTianqinProfit()))//天勤利润
-                    .add(new BigDecimal(invAccount.getOtherProfit()))//其他利润
-                    .add(new BigDecimal(invAccount.getClearingProfit()));//结算卡
-            BaseController baseController = new BaseController();
-            invAccount.setBalance(String.valueOf(count));
-            invAccount.setCreateBy(baseController.getUserName());
-            invAccount.setCreateTime(new Date());
-        }
-
-        return insAccountMapper.insert(invAccount);
-    }
-
     /**
      * 根据户名分类
      *
@@ -149,8 +66,8 @@ public class InvAccountServiceImpl extends ServiceImpl<InvAccountMapper, InvAcco
      */
     @Override
     public HttpResult selectByAccountName() {
-        LambdaQueryWrapper<InvAccount> wrapper = new LambdaQueryWrapper<>();
-        List<InvAccount> insAccounts = insAccountMapper.selectList(wrapper);
+        InvAccount invAccount = new InvAccount();
+        List<InvAccount> insAccounts = insAccountMapper.selectAccountsList(invAccount);
         if (!insAccounts.isEmpty()) {
             return HttpResult.ok("", insAccounts);
         }

+ 1 - 0
src/main/java/com/ydtech/modules/inv/utils/EasyExcelUtils.java

@@ -4,6 +4,7 @@ import com.alibaba.excel.EasyExcel;
 import com.alibaba.excel.write.builder.ExcelWriterBuilder;
 import com.ydtech.constants.enums.inv.InsAccountOperateEnum;
 import com.ydtech.constants.enums.inv.InvPayMethodEnum;
+import com.ydtech.modules.inv.model.InvAccountCard;
 import com.ydtech.modules.inv.model.InvAccountExcel;
 import com.ydtech.modules.inv.service.InvAccountExcelService;
 import org.springframework.beans.factory.annotation.Autowired;

+ 55 - 54
src/main/java/com/ydtech/modules/inv/utils/TransferUtils.java

@@ -3,6 +3,7 @@ package com.ydtech.modules.inv.utils;
 import com.ydtech.constants.enums.inv.InsAccountOperateEnum;
 import com.ydtech.exception.SystemException;
 import com.ydtech.modules.inv.model.InvAccount;
+import com.ydtech.modules.inv.model.InvAccountCard;
 import com.ydtech.modules.inv.model.InvAccountExcel;
 import com.ydtech.modules.inv.model.InvAccountOperate;
 
@@ -56,36 +57,36 @@ public class TransferUtils {
     /**
      * 内部转内部方法
      */
-    public static List<InvAccount> insideTransfer(InvAccount outAccount, InvAccount enterAccount, InvAccountExcel invAccountExcel) {
-        List<InvAccount> list = new ArrayList<>();
-        if (outAccount != null && enterAccount != null && invAccountExcel != null) {
+    public static List<InvAccountCard> insideTransfer(InvAccountCard outAccountCard, InvAccountCard enterAccountCard, InvAccountExcel invAccountExcel) {
+        List<InvAccountCard> list = new ArrayList<>();
+        if (outAccountCard != null && enterAccountCard != null && invAccountExcel != null) {
             //公户单日转账剩余
-            BigDecimal pubDayLinesExcess = new BigDecimal(outAccount.getPubDayLinesExcess());
+            BigDecimal pubDayLinesExcess = new BigDecimal(outAccountCard.getPubDayLinesExcess());
             //私户单日转账剩余
-            BigDecimal priDayLinesExcess = new BigDecimal(outAccount.getPriDayLinesExcess());
+            BigDecimal priDayLinesExcess = new BigDecimal(outAccountCard.getPriDayLinesExcess());
             //公户年额度剩余
-            BigDecimal pubYearExcess = new BigDecimal(outAccount.getPubYearExcess());
+            BigDecimal pubYearExcess = new BigDecimal(outAccountCard.getPubYearExcess());
             //私户年额度剩余
-            BigDecimal priYearExcess = new BigDecimal(outAccount.getPriYearExcess());
+            BigDecimal priYearExcess = new BigDecimal(outAccountCard.getPriYearExcess());
             //对公单笔限额
-            BigDecimal pubSingleLines = new BigDecimal(outAccount.getPubSingleLines());
+            BigDecimal pubSingleLines = new BigDecimal(outAccountCard.getPubSingleLines());
             //对私单笔限额
-            BigDecimal priSingleLines = new BigDecimal(outAccount.getPriSingleLines());
+            BigDecimal priSingleLines = new BigDecimal(outAccountCard.getPriSingleLines());
             //单日转账笔数剩余
-            long dayStrokeNumExcess = Long.parseLong(outAccount.getDayStrokeNumExcess());
+            long dayStrokeNumExcess = Long.parseLong(outAccountCard.getDayStrokeNumExcess());
             //申请金额
             BigDecimal insAccountExcelApplyAmount = new BigDecimal(invAccountExcel.getApplyAmount());
             //转出账户现支出金额
-            BigDecimal outAccountSpend = new BigDecimal(outAccount.getSpend());
+            BigDecimal outAccountSpend = new BigDecimal(outAccountCard.getSpend());
 
-            if (enterAccount.getAccountQuality().equals("0")) {
+            if (enterAccountCard.getAccountQuality().equals("0")) {
                 //公户操作
                 if (pubSingleLines.compareTo(insAccountExcelApplyAmount) > 0){
                     //收入方增加余额
                     String remark = invAccountExcel.getRemark();
 
-                    list.add(pubAccountUtils(dayStrokeNumExcess,pubDayLinesExcess,pubYearExcess,insAccountExcelApplyAmount,outAccount,outAccountSpend));
-                    list.add(enterAccountUtils(remark, enterAccount, insAccountExcelApplyAmount));
+                    list.add(pubAccountUtils(dayStrokeNumExcess,pubDayLinesExcess,pubYearExcess,insAccountExcelApplyAmount,outAccountCard,outAccountSpend));
+                    list.add(enterAccountUtils(remark, enterAccountCard, insAccountExcelApplyAmount));
                     return list;
                 }
                 throw new SystemException("公户转账金额超出单笔限额");
@@ -93,8 +94,8 @@ public class TransferUtils {
                 if(priSingleLines.compareTo(insAccountExcelApplyAmount) > 0){
                     //私户操作
                     String remark = invAccountExcel.getRemark();
-                    list.add(priAccountUtils(dayStrokeNumExcess,priDayLinesExcess,insAccountExcelApplyAmount, priYearExcess,outAccountSpend,outAccount));
-                    list.add(enterAccountUtils(remark, enterAccount, insAccountExcelApplyAmount));
+                    list.add(priAccountUtils(dayStrokeNumExcess,priDayLinesExcess,insAccountExcelApplyAmount, priYearExcess,outAccountSpend,outAccountCard));
+                    list.add(enterAccountUtils(remark, enterAccountCard, insAccountExcelApplyAmount));
 
                     return list;
                 }
@@ -108,45 +109,45 @@ public class TransferUtils {
     /**
      * 外部转内部方法
      */
-    public static InvAccount outsideTransfer(InvAccount enterAccount, InvAccountOperate invAccountOperate) {
-        if (enterAccount == null && invAccountOperate == null) {
+    public static InvAccountCard outsideTransfer(InvAccountCard enterAccountCard, InvAccountOperate invAccountOperate) {
+        if (enterAccountCard == null && invAccountOperate == null) {
             throw new SystemException("收入账户为空");
         }
         String remark = invAccountOperate.getRemark();
         BigDecimal applyAmount = new BigDecimal(invAccountOperate.getApplyAmount());
 
-        return enterAccountUtils(remark, enterAccount, applyAmount);
+        return enterAccountUtils(remark, enterAccountCard, applyAmount);
     }
 
     /**
      * 内部转外部方法
      */
-    public static List<InvAccount> enterDeTransfer(InvAccount outAccount, InvAccount enterAccount, InvAccountExcel invAccountExcel) {
-        List<InvAccount> list = new ArrayList<>();
-        if (outAccount != null && enterAccount != null && invAccountExcel != null) {
+    public static List<InvAccountCard> enterDeTransfer(InvAccountCard outAccountCard, InvAccountCard enterAccountCard, InvAccountExcel invAccountExcel) {
+        List<InvAccountCard> list = new ArrayList<>();
+        if (outAccountCard != null && enterAccountCard != null && invAccountExcel != null) {
             //公户单日转账剩余
-            BigDecimal pubDayLinesExcess = new BigDecimal(outAccount.getPubDayLinesExcess());
+            BigDecimal pubDayLinesExcess = new BigDecimal(outAccountCard.getPubDayLinesExcess());
             //私户单日转账剩余
-            BigDecimal priDayLinesExcess = new BigDecimal(outAccount.getPriDayLinesExcess());
+            BigDecimal priDayLinesExcess = new BigDecimal(outAccountCard.getPriDayLinesExcess());
             //公户年额度剩余
-            BigDecimal pubYearExcess = new BigDecimal(outAccount.getPubYearExcess());
+            BigDecimal pubYearExcess = new BigDecimal(outAccountCard.getPubYearExcess());
             //私户年额度剩余
-            BigDecimal priYearExcess = new BigDecimal(outAccount.getPriYearExcess());
+            BigDecimal priYearExcess = new BigDecimal(outAccountCard.getPriYearExcess());
             //单日转账笔数剩余
-            long dayStrokeNumExcess = Long.parseLong(outAccount.getDayStrokeNumExcess());
+            long dayStrokeNumExcess = Long.parseLong(outAccountCard.getDayStrokeNumExcess());
             //申请金额
             BigDecimal insAccountExcelApplyAmount = new BigDecimal(invAccountExcel.getApplyAmount());
             //转出账户现支出金额
-            BigDecimal outAccountSpend = new BigDecimal(outAccount.getSpend());
+            BigDecimal outAccountSpend = new BigDecimal(outAccountCard.getSpend());
 
             if (invAccountExcel.getOutAccountQuality().equals("0")) {
                 //公户操作
-                list.add(pubAccountUtils(dayStrokeNumExcess,pubDayLinesExcess,pubYearExcess,insAccountExcelApplyAmount,outAccount,outAccountSpend));
+                list.add(pubAccountUtils(dayStrokeNumExcess,pubDayLinesExcess,pubYearExcess,insAccountExcelApplyAmount,outAccountCard,outAccountSpend));
                 return list;
 
             } else {
                 //私户操作
-                list.add(priAccountUtils(dayStrokeNumExcess,priDayLinesExcess,insAccountExcelApplyAmount, priYearExcess,outAccountSpend,outAccount));
+                list.add(priAccountUtils(dayStrokeNumExcess,priDayLinesExcess,insAccountExcelApplyAmount, priYearExcess,outAccountSpend,outAccountCard));
                 return list;
             }
         }
@@ -159,38 +160,38 @@ public class TransferUtils {
      *
      * @return
      */
-    private static InvAccount enterAccountUtils(String remark, InvAccount enterAccount, BigDecimal invAccountExcelApplyAmount) {
+    private static InvAccountCard enterAccountUtils(String remark, InvAccountCard enterAccountCard, BigDecimal invAccountExcelApplyAmount) {
         switch (remark) {
             case "0":
-                enterAccount.setInsuranceProfit(new BigDecimal(enterAccount.getInsuranceProfit()).add(invAccountExcelApplyAmount).toString());
+                enterAccountCard.setInsuranceProfit(new BigDecimal(enterAccountCard.getInsuranceProfit()).add(invAccountExcelApplyAmount).toString());
                 break;
             case "1":
-                enterAccount.setClearingProfit(new BigDecimal(enterAccount.getClearingProfit()).add(invAccountExcelApplyAmount).toString());
+                enterAccountCard.setClearingProfit(new BigDecimal(enterAccountCard.getClearingProfit()).add(invAccountExcelApplyAmount).toString());
                 break;
             case "2":
-                enterAccount.setTianqinProfit(new BigDecimal(enterAccount.getTianqinProfit()).add(invAccountExcelApplyAmount).toString());
+                enterAccountCard.setTianqinProfit(new BigDecimal(enterAccountCard.getTianqinProfit()).add(invAccountExcelApplyAmount).toString());
                 break;
             case "3":
-                enterAccount.setParkProfit(new BigDecimal(enterAccount.getParkProfit()).add(invAccountExcelApplyAmount).toString());
+                enterAccountCard.setParkProfit(new BigDecimal(enterAccountCard.getParkProfit()).add(invAccountExcelApplyAmount).toString());
                 break;
             case "4":
-                enterAccount.setOtherProfit(new BigDecimal(enterAccount.getOtherProfit()).add(invAccountExcelApplyAmount).toString());
+                enterAccountCard.setOtherProfit(new BigDecimal(enterAccountCard.getOtherProfit()).add(invAccountExcelApplyAmount).toString());
                 break;
             case "5":
-                enterAccount.setFiscalProfit(new BigDecimal(enterAccount.getFiscalProfit()).add(invAccountExcelApplyAmount).toString());
+                enterAccountCard.setFiscalProfit(new BigDecimal(enterAccountCard.getFiscalProfit()).add(invAccountExcelApplyAmount).toString());
                 break;
             case "6":
-                enterAccount.setExteriorProfit(new BigDecimal(enterAccount.getExteriorProfit()).add(invAccountExcelApplyAmount).toString());
+                enterAccountCard.setExteriorProfit(new BigDecimal(enterAccountCard.getExteriorProfit()).add(invAccountExcelApplyAmount).toString());
                 break;
         }
-        enterAccount.setBalance(new BigDecimal(enterAccount.getBalance()).add(invAccountExcelApplyAmount).toString());
-        return enterAccount;
+        enterAccountCard.setBalance(new BigDecimal(enterAccountCard.getBalance()).add(invAccountExcelApplyAmount).toString());
+        return enterAccountCard;
     }
 
     /**
      * 公户扣除余额方法
      */
-    private static InvAccount pubAccountUtils(long dayStrokeNumExcess, BigDecimal pubDayLinesExcess, BigDecimal pubYearExcess, BigDecimal invAccountExcelApplyAmount, InvAccount outAccount,BigDecimal outAccountSpend) {
+    private static InvAccountCard pubAccountUtils(long dayStrokeNumExcess, BigDecimal pubDayLinesExcess, BigDecimal pubYearExcess, BigDecimal invAccountExcelApplyAmount, InvAccountCard outAccountCard,BigDecimal outAccountSpend) {
         //判断单日转账笔数是否超过
         if (dayStrokeNumExcess <= 0) {
             throw new SystemException("公户单日转账笔数不足");
@@ -205,20 +206,20 @@ public class TransferUtils {
         }
 
         //支出方减少余额
-        outAccount.setSpend(outAccountSpend.add(invAccountExcelApplyAmount).toString());
-        outAccount.setBalance(new BigDecimal(outAccount.getBalance()).subtract(invAccountExcelApplyAmount).toString());
+        outAccountCard.setSpend(outAccountSpend.add(invAccountExcelApplyAmount).toString());
+        outAccountCard.setBalance(new BigDecimal(outAccountCard.getBalance()).subtract(invAccountExcelApplyAmount).toString());
         //公户单日转账笔数减少
-        outAccount.setDayStrokeNumExcess(String.valueOf(dayStrokeNumExcess - 1));
+        outAccountCard.setDayStrokeNumExcess(String.valueOf(dayStrokeNumExcess - 1));
         //公户单日转账剩余减少
-        outAccount.setPubDayLinesExcess(pubDayLinesExcess.subtract(invAccountExcelApplyAmount).toString());
+        outAccountCard.setPubDayLinesExcess(pubDayLinesExcess.subtract(invAccountExcelApplyAmount).toString());
         //公户年额度减少
-        outAccount.setPubYearExcess(pubYearExcess.subtract(invAccountExcelApplyAmount).toString());
-        return outAccount;
+        outAccountCard.setPubYearExcess(pubYearExcess.subtract(invAccountExcelApplyAmount).toString());
+        return outAccountCard;
     }
     /**
      * 私户扣除余额方法
      */
-    private static InvAccount priAccountUtils(long dayStrokeNumExcess, BigDecimal priDayLinesExcess, BigDecimal invAccountExcelApplyAmount, BigDecimal priYearExcess, BigDecimal outAccountSpend,InvAccount outAccount) {
+    private static InvAccountCard priAccountUtils(long dayStrokeNumExcess, BigDecimal priDayLinesExcess, BigDecimal invAccountExcelApplyAmount, BigDecimal priYearExcess, BigDecimal outAccountSpend,InvAccountCard outAccountCard) {
         if (dayStrokeNumExcess <= 0) {
             throw new SystemException("私户单日转账笔数不足");
         }
@@ -229,12 +230,12 @@ public class TransferUtils {
             throw new SystemException("私户年额度不足");
         }
 
-        outAccount.setSpend(outAccountSpend.add(invAccountExcelApplyAmount).toString());
-        outAccount.setBalance(new BigDecimal(outAccount.getBalance()).subtract(invAccountExcelApplyAmount).toString());
-        outAccount.setDayStrokeNumExcess(String.valueOf(dayStrokeNumExcess - 1));
-        outAccount.setPriDayLinesExcess(priDayLinesExcess.subtract(invAccountExcelApplyAmount).toString());
-        outAccount.setPriYearExcess(priYearExcess.subtract(invAccountExcelApplyAmount).toString());
-        return outAccount;
+        outAccountCard.setSpend(outAccountSpend.add(invAccountExcelApplyAmount).toString());
+        outAccountCard.setBalance(new BigDecimal(outAccountCard.getBalance()).subtract(invAccountExcelApplyAmount).toString());
+        outAccountCard.setDayStrokeNumExcess(String.valueOf(dayStrokeNumExcess - 1));
+        outAccountCard.setPriDayLinesExcess(priDayLinesExcess.subtract(invAccountExcelApplyAmount).toString());
+        outAccountCard.setPriYearExcess(priYearExcess.subtract(invAccountExcelApplyAmount).toString());
+        return outAccountCard;
     }
 
 

+ 18 - 16
src/main/java/com/ydtech/modules/xxl/handler/InvAccountHandler.java

@@ -2,6 +2,8 @@ package com.ydtech.modules.xxl.handler;
 
 import com.xxl.job.core.handler.annotation.XxlJob;
 import com.ydtech.modules.inv.model.InvAccount;
+import com.ydtech.modules.inv.model.InvAccountCard;
+import com.ydtech.modules.inv.service.InvAccountCardService;
 import com.ydtech.modules.inv.service.InvAccountService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -24,7 +26,7 @@ public class InvAccountHandler {
 
 
     @Autowired
-    private InvAccountService insAccountService;
+    private InvAccountCardService invAccountCardService;
 
     Logger logger = LoggerFactory.getLogger(getClass());
 
@@ -35,15 +37,15 @@ public class InvAccountHandler {
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
         logger.info("重置日额度开始" + currentDateTime.format(formatter));
 
-        List<InvAccount> invAccounts = insAccountService.list();
-        List<InvAccount> invAccountList = new ArrayList<>();
-        for (InvAccount insAccount : invAccounts) {
-            insAccount.setDayStrokeNumExcess(insAccount.getDayStrokeNum());
-            insAccount.setPubDayLinesExcess(insAccount.getPubDayLines());
-            insAccount.setPriDayLinesExcess(insAccount.getPriDayLines());
-            invAccountList.add(insAccount);
+        List<InvAccountCard> list = invAccountCardService.list();
+        List<InvAccountCard> invAccountList = new ArrayList<>();
+        for (InvAccountCard insAccountCard : list) {
+            insAccountCard.setDayStrokeNumExcess(insAccountCard.getDayStrokeNum());
+            insAccountCard.setPubDayLinesExcess(insAccountCard.getPubDayLines());
+            insAccountCard.setPriDayLinesExcess(insAccountCard.getPriDayLines());
+            invAccountList.add(insAccountCard);
         }
-        insAccountService.updateBatchById(invAccountList);
+        invAccountCardService.updateBatchById(invAccountList);
         LocalDateTime currentDateTime2 = LocalDateTime.now();
         logger.info("重置日额度结束" + currentDateTime2.format(formatter));
     }
@@ -53,14 +55,14 @@ public class InvAccountHandler {
         LocalDateTime currentDateTime = LocalDateTime.now();
         logger.info("重置年额度开始" + currentDateTime);
 
-        List<InvAccount> invAccounts = insAccountService.list();
-        List<InvAccount> invAccountList = new ArrayList<>();
-        for (InvAccount invAccount : invAccounts) {
-            invAccount.setPubYearExcess(invAccount.getPubDayLines());
-            invAccount.setPriYearExcess(invAccount.getPriDayLines());
-            invAccountList.add(invAccount);
+        List<InvAccountCard> invAccountCards = invAccountCardService.list();
+        List<InvAccountCard> invAccountList = new ArrayList<>();
+        for (InvAccountCard invAccountCard : invAccountCards) {
+            invAccountCard.setPubYearExcess(invAccountCard.getPubDayLines());
+            invAccountCard.setPriYearExcess(invAccountCard.getPriDayLines());
+            invAccountList.add(invAccountCard);
         }
-        insAccountService.updateBatchById(invAccountList);
+        invAccountCardService.updateBatchById(invAccountList);
         LocalDateTime currentDateTime2 = LocalDateTime.now();
         logger.info("重置年额度结束" + currentDateTime2);
     }

+ 2 - 2
src/main/resources/mapper/modules/inv/InvAccountExcelMapper.xml

@@ -21,8 +21,8 @@
             <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
             <result property="createBy" column="create_by" jdbcType="VARCHAR"/>
             <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
-            <result property="enterAccountId" column="enter_account_id" jdbcType="VARCHAR"/>
-            <result property="outAccountId" column="out_account_id" jdbcType="VARCHAR"/>
+            <result property="enterCardNum" column="enter_account_id" jdbcType="VARCHAR"/>
+            <result property="outCardNum" column="out_account_id" jdbcType="VARCHAR"/>
             <result property="transferFlag" column="transfer_flag" jdbcType="CHAR"/>
             <result property="outFlag" column="out_flag" jdbcType="CHAR"/>
             <result property="outAccountQuality" column="out_account_quality" jdbcType="CHAR"/>

+ 44 - 0
src/main/resources/mapper/modules/inv/InvAccountIncoiceMapper.xml

@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ydtech.modules.inv.dao.InvAccountIncoiceMapper">
+
+    <resultMap type="com.ydtech.modules.inv.model.InvAccountIncoice" id="InvAccountIncoiceMap">
+        <result property="invoiceId" column="invoice_id" jdbcType="INTEGER"/>
+        <result property="biller" column="biller" jdbcType="VARCHAR"/>
+        <result property="invoiceSubjects" column="invoice_subjects" jdbcType="VARCHAR"/>
+        <result property="invoiceBy" column="invoice_by" jdbcType="VARCHAR"/>
+        <result property="otherUnit" column="other_unit" jdbcType="VARCHAR"/>
+        <result property="invoiceNum" column="invoice_num" jdbcType="VARCHAR"/>
+        <result property="invoiceTime" column="invoice_time" jdbcType="TIMESTAMP"/>
+        <result property="noHasTax" column="no_has_tax" jdbcType="VARCHAR"/>
+        <result property="rate" column="rate" jdbcType="VARCHAR"/>
+        <result property="tax" column="tax" jdbcType="VARCHAR"/>
+        <result property="invoiceMoney" column="invoice_money" jdbcType="VARCHAR"/>
+        <result property="invoiceType" column="invoice_type" jdbcType="VARCHAR"/>
+        <result property="payoutTime" column="payout_time" jdbcType="TIMESTAMP"/>
+        <result property="payoutMoney" column="payout_money" jdbcType="VARCHAR"/>
+        <result property="notPayoutMoney" column="not_payout_money" jdbcType="VARCHAR"/>
+        <result property="delFlag" column="del_flag" jdbcType="VARCHAR"/>
+        <result property="bankCardNum" column="bank_card_num" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <!-- 批量插入 -->
+    <insert id="insertBatch" keyProperty="invoiceId" useGeneratedKeys="true">
+        insert into zgdd.inv_account_incoice(billerinvoice_subjectsinvoice_byother_unitinvoice_numinvoice_timeno_has_taxratetaxinvoice_moneyinvoice_typepayout_timepayout_moneynot_payout_moneydel_flag)
+        values
+        <foreach collection="entities" item="entity" separator=",">
+        (#{entity.biller}#{entity.invoiceSubjects}#{entity.invoiceBy}#{entity.otherUnit}#{entity.invoiceNum}#{entity.invoiceTime}#{entity.noHasTax}#{entity.rate}#{entity.tax}#{entity.invoiceMoney}#{entity.invoiceType}#{entity.payoutTime}#{entity.payoutMoney}#{entity.notPayoutMoney}#{entity.delFlag})
+        </foreach>
+    </insert>
+    <!-- 批量插入或按主键更新 -->
+    <insert id="insertOrUpdateBatch" keyProperty="invoiceId" useGeneratedKeys="true">
+        insert into zgdd.inv_account_incoice(billerinvoice_subjectsinvoice_byother_unitinvoice_numinvoice_timeno_has_taxratetaxinvoice_moneyinvoice_typepayout_timepayout_moneynot_payout_moneydel_flag)
+        values
+        <foreach collection="entities" item="entity" separator=",">
+            (#{entity.biller}#{entity.invoiceSubjects}#{entity.invoiceBy}#{entity.otherUnit}#{entity.invoiceNum}#{entity.invoiceTime}#{entity.noHasTax}#{entity.rate}#{entity.tax}#{entity.invoiceMoney}#{entity.invoiceType}#{entity.payoutTime}#{entity.payoutMoney}#{entity.notPayoutMoney}#{entity.delFlag})
+        </foreach>
+        on duplicate key update
+biller = values(biller) invoice_subjects = values(invoice_subjects) invoice_by = values(invoice_by) other_unit = values(other_unit) invoice_num = values(invoice_num) invoice_time = values(invoice_time) no_has_tax = values(no_has_tax) rate = values(rate) tax = values(tax) invoice_money = values(invoice_money) invoice_type = values(invoice_type) payout_time = values(payout_time) payout_money = values(payout_money) not_payout_money = values(not_payout_money) del_flag = values(del_flag)     </insert>
+
+</mapper>
+

+ 90 - 154
src/main/resources/mapper/modules/inv/InvAccountMapper.xml

@@ -7,15 +7,28 @@
     <resultMap id="BaseResultMap" type="com.ydtech.modules.inv.model.InvAccount">
         <id property="accountId" column="account_id" jdbcType="BIGINT"/>
         <result property="accountName" column="account_name" jdbcType="VARCHAR"/>
+        <result property="createBy" column="create_by" jdbcType="VARCHAR"/>
+        <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+        <result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
+        <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
+        <result property="outerFlag" column="outer_flag" jdbcType="CHAR"/>
+        <result property="businessQuality" column="business_quality" jdbcType="CHAR"/>
+        <result property="owned" column="owned" jdbcType="VARCHAR"/>
+        <result property="juridicalPerson" column="juridical_person" jdbcType="VARCHAR"/>
+        <result property="establishTime" column="establish_time" jdbcType="TIMESTAMP"/>
+        <result property="biller" column="biller" jdbcType="VARCHAR"/>
+        <result property="invoicingAmount" column="invoicing_amount" jdbcType="VARCHAR"/>
+        <result property="invoicingAmountExcess" column="invoicing_amount_excess" jdbcType="VARCHAR"/>
+        <collection property="invAccountCardList" ofType="com.ydtech.modules.inv.model.InvAccountCard" resultMap="invAccountCardList" />
+    </resultMap>
+
+    <resultMap id="invAccountCardList" type="com.ydtech.modules.inv.model.InvAccountCard">
         <result property="bankCardNum" column="bank_card_num" jdbcType="VARCHAR"/>
+        <result property="accountId" column="account_id" jdbcType="VARCHAR"/>
         <result property="bankName" column="bank_name" jdbcType="VARCHAR"/>
         <result property="bank" column="bank" jdbcType="VARCHAR"/>
         <result property="bankNum" column="bank_num" jdbcType="VARCHAR"/>
         <result property="startCertExpirationDate" column="start_cert_expiration_date" jdbcType="TIMESTAMP"/>
-        <result property="createBy" column="create_by" jdbcType="VARCHAR"/>
-        <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
-        <result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
-        <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
         <result property="accountQuality" column="account_quality" jdbcType="CHAR"/>
         <result property="pubSingleLines" column="pub_single_lines" jdbcType="VARCHAR"/>
         <result property="priSingleLines" column="pri_single_lines" jdbcType="VARCHAR"/>
@@ -39,172 +52,95 @@
         <result property="pubDayLinesExcess" column="pub_day_lines_excess" jdbcType="VARCHAR"/>
         <result property="priDayLinesExcess" column="pri_day_lines_excess" jdbcType="VARCHAR"/>
         <result property="delFlag" column="del_flag" jdbcType="CHAR"/>
-        <result property="outerFlag" column="outer_flag" jdbcType="CHAR"/>
         <result property="spend" column="spend" jdbcType="VARCHAR"/>
     </resultMap>
 
     <sql id="Base_Column_List">
-        account_id,
-        account_name,
-        bank_card_num,
-        bank_name,
-        bank,
-        bank_num,
-        start_cert_expiration_date,
-        end_cert_expiration_date,
-        create_by,
-        create_time,
-        update_by,
-        update_time,
-        account_quality,
-        pub_single_lines,
-        pri_single_lines,
-        pub_year_lines,
-        pri_year_lines,
-        day_stroke_num,
-        pub_day_lines,
-        pri_day_lines,
-        pub_year_excess,
-        pri_year_excess,
-        fiscal_profit,
-        insurance_profit,
-        clearing_profit,
-        exterior_profit,
-        park_profit,
-        tianqin_profit,
-        other_profit,
-        balance,
-        day_stroke_num_excess,
-        pub_day_lines_excess,
-        pri_day_lines_excess,
-        del_flag,
-        outer_flag,
-        spend
+        a.account_id,
+        a.account_name,
+        a.create_by,
+        a.create_time,
+        a.update_by,
+        a.update_time,
+        a.outer_flag,
+        a.del_flag,
+        a.business_quality,
+        a.owned,
+        a.juridical_person,
+        a.establish_time,
+        a.biller,
+        a.invoicing_amount,
+        a.invoicing_amount_excess,
+
+
+	    b.account_id,
+        b.bank_card_num,
+        b.bank_name,
+        b.bank,
+        b.bank_num,
+        b.start_cert_expiration_date,
+        b.end_cert_expiration_date,
+        b.account_quality,
+        b.pub_single_lines,
+        b.pri_single_lines,
+        b.pub_year_lines,
+        b.pri_year_lines,
+        b.day_stroke_num,
+        b.pub_day_lines,
+        b.pri_day_lines,
+        b.pub_year_excess,
+        b.pri_year_excess,
+        b.fiscal_profit,
+        b.insurance_profit,
+        b.clearing_profit,
+        b.exterior_profit,
+        b.park_profit,
+        b.tianqin_profit,
+        b.other_profit,
+        b.balance,
+        b.day_stroke_num_excess,
+        b.pub_day_lines_excess,
+        b.pri_day_lines_excess,
+        b.spend
     </sql>
-    <select id="SelectAccountsList" resultType="com.ydtech.modules.inv.model.InvAccount">
+    <select id="selectAccountsListPage" resultMap="BaseResultMap">
         select
         <include refid="Base_Column_List"/>
-        from inv_account
-        where del_flag = '0'
+        from inv_account a
+        left join inv_account_card b on a.account_id = b.account_id
+        where a.del_flag = '0'
         <if test="account.accountId != null and account.accountId != ''">
-            and account_id = #{account.accountId}
+            and a.account_id = #{account.accountId}
         </if>
         <if test="account.accountName!= null and account.accountName!= ''">
-            and account_name like concat('%',#{account.accountName},'%')
-        </if>
-        <if test="account.bankCardNum!= null and account.bankCardNum!= ''">
-            and bank_card_num = #{account.bankCardNum}
-        </if>
-        <if test="account.bankName!= null and account.bankName!= ''">
-            and bank_name = #{account.bankName}
-        </if>
-        <if test="account.bank!= null and account.bank!= ''">
-            and bank = #{account.bank}
-        </if>
-        <if test="account.bankNum!= null and account.bankNum!= ''">
-            and bank_num = #{account.bankNum}
-        </if>
-        <if test="account.startCertExpirationDate!= null">
-            and start_cert_expiration_date &gt;= #{account.startCertExpirationDate}
-        </if>
-        <if test="account.endCertExpirationDate!= null">
-            and end_cert_expiration_date &lt;= #{account.endCertExpirationDate}
-        </if>
-        <if test="account.createBy!= null and account.createBy!= ''">
-            and create_by like concat('%',#{account.createBy},'%')
-        </if>
-        <if test="account.updateBy!= null and account.updateBy!= ''">
-            and update_by like concat('%', #{account.updateBy},'%')
-        </if>
-        <if test="account.createTime!= null">
-            and create_time &gt;= #{account.createTime}
-        </if>
-        <if test="account.createTime != null">
-            and create_time &lt;= #{account.createTime}
-        </if>
-        <if test="account.updateTime!= null">
-            and update_time &gt;= #{account.updateTime}
-        </if>
-        <if test="account.updateTime!= null">
-            and update_time &lt;= #{account.updateTime}
-        </if>
-        <if test="account.accountQuality!= null and account.accountQuality!= ''">
-            and account_quality = #{account.accountQuality}
+            and a.account_name like concat('%',#{account.accountName},'%')
         </if>
-        <if test="account.pubSingleLines!= null and account.pubSingleLines!= ''">
-            and pub_single_lines = #{account.pubSingleLines}
+        <if test="account.businessQuality!= null and account.businessQuality!= ''">
+            and a.business_quality = #{account.businessQuality}
         </if>
-        <if test="account.priSingleLines!= null and account.priSingleLines!= ''">
-            and pri_single_lines = #{account.priSingleLines}
+        <if test="account.juridicalPerson!= null and account.juridicalPerson!= ''">
+            and a.juridical_person like concat('%',#{account.juridicalPerson},'%')
         </if>
-        <if test="account.pubYearLines!= null and account.pubYearLines!= ''">
-            and pub_year_lines = #{account.pubYearLines}
-        </if>
-        <if test="account.priYearLines!= null and account.priYearLines!= ''">
-            and pri_year_lines = #{account.priYearLines}
-        </if>
-        <if test="account.dayStrokeNum!= null and account.dayStrokeNum!= ''">
-            and day_stroke_num = #{account.dayStrokeNum}
-        </if>
-        <if test="account.pubDayLines!= null and account.pubDayLines!= ''">
-            and pub_day_lines = #{account.pubDayLines}
-        </if>
-        <if test="account.priDayLines!= null and account.priDayLines!= ''">
-            and pri_day_lines = #{account.priDayLines}
-        </if>
-        <if test="account.pubYearExcess!= null and account.pubYearExcess!= ''">
-            and pub_year_excess = #{account.pubYearExcess}
-        </if>
-        <if test="account.priYearExcess!= null and account.priYearExcess!= ''">
-            and pri_year_excess = #{account.priYearExcess}
-        </if>
-        <if test="account.fiscalProfit!= null and account.fiscalProfit!= ''">
-            and fiscal_profit = #{account.fiscalProfit}
-        </if>
-        <if test="account.insuranceProfit!= null and account.insuranceProfit!= ''">
-            and insurance_profit = #{insuranceProfit}
-        </if>
-        <if test="account.clearingProfit!= null and account.clearingProfit!= ''">
-            and clearing_profit = #{account.clearingProfit}
-        </if>
-        <if test="account.exteriorProfit!= null and account.exteriorProfit!= ''">
-            and exterior_profit = #{account.exteriorProfit}
-        </if>
-        <if test="account.parkProfit!= null and account.parkProfit!= ''">
-            and park_profit = #{parkProfit}
-        </if>
-        <if test="account.tianqinProfit!= null and account.tianqinProfit!= ''">
-            and tianqin_profit = #{account.tianqinProfit}
-        </if>
-        <if test="account.otherProfit!= null and account.otherProfit!= ''">
-            and other_profit = #{otherProfit}
-        </if>
-        <if test="account.balance!= null and account.balance!= ''">
-            and balance = #{account.balance}
-        </if>
-        <if test="account.dayStrokeNumExcess!= null and account.dayStrokeNumExcess!= ''">
-            and day_stroke_num_excess = #{account.dayStrokeNumExcess}
-        </if>
-        <if test="account.pubDayLinesExcess!= null and account.pubDayLinesExcess!= ''">
-            and pub_day_lines_excess = #{account.pubDayLinesExcess}
-        </if>
-        <if test="account.priDayLinesExcess!= null and account.priDayLinesExcess!= ''">
-            and pri_day_lines_excess = #{account.priDayLinesExcess}
-        </if>
-        <if test="account.pubYearExcess!= null and account.pubYearExcess!= ''">
-            and pub_year_excess = #{account.pubYearExcess}
-        </if>
-        <if test="account.priYearExcess!= null and account.priYearExcess!= ''">
-            and pri_year_excess = #{account.priYearExcess}
+    </select>
+
+    <select id="selectAccountsList" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List"/>
+        from inv_account a
+        left join inv_account_card b on a.account_id = b.account_id
+        where a.del_flag = '0'
+        <if test="account.accountId != null and account.accountId != ''">
+            and a.account_id = #{account.accountId}
         </if>
-        <if test="account.delFlag!= null and account.delFlag!= ''">
-            and del_flag = #{account.delFlag}
+        <if test="account.accountName!= null and account.accountName!= ''">
+            and a.account_name like concat('%',#{account.accountName},'%')
         </if>
-        <if test="account.outerFlag != null and account.outerFlag != '' ">
-            and outer_flag = #{account.outerFlag}
+        <if test="account.businessQuality!= null and account.businessQuality!= ''">
+            and a.business_quality = #{account.businessQuality}
         </if>
-        <if test="account.spend != null and account.spend != ''">
-            and spend = #{account.spend}
+        <if test="account.juridicalPerson!= null and account.juridicalPerson!= ''">
+            and a.juridical_person like concat('%',#{account.juridicalPerson},'%')
         </if>
+
     </select>
 </mapper>