Jelajahi Sumber

修改发票逻辑

y 2 tahun lalu
induk
melakukan
794b62f961

+ 1 - 7
src/main/java/com/ydtech/modules/inv/controller/InvAccountController.java

@@ -50,8 +50,6 @@ public class InvAccountController {
     @ApiOperation("查询账户卡列表")
     @PostMapping("getAccountCardList")
     public HttpResult getInsAccountCardList(@RequestBody InvAccountCard invAccountCard) {
-
-
         LambdaQueryWrapper<InvAccountCard> objectLambdaQueryWrapper = new LambdaQueryWrapper<>();
         objectLambdaQueryWrapper.eq(InvAccountCard::getAccountId, invAccountCard.getAccountId());
         if (invAccountCard.getBankCardNum() != null) {
@@ -80,7 +78,7 @@ public class InvAccountController {
     }
 
     @ApiOperation("删除账户卡")
-    @DeleteMapping("{bankCardNum}")
+    @DeleteMapping("card/{bankCardNum}")
     public HttpResult deleteInsAccountCard(@PathVariable("bankCardNum") String bankCardNum) {
         if (bankCardNum == null) {
             throw new RuntimeException("卡号为空");
@@ -110,10 +108,6 @@ public class InvAccountController {
         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();

+ 11 - 8
src/main/java/com/ydtech/modules/inv/controller/InvAccountIncoiceController.java

@@ -6,6 +6,7 @@ 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.core.page.PageRequest;
 import com.ydtech.modules.inv.model.InvAccountIncoice;
 import com.ydtech.modules.inv.service.InvAccountIncoiceService;
 import io.swagger.annotations.Api;
@@ -40,14 +41,17 @@ public class InvAccountIncoiceController{
     /**
      * 分页查询所有数据
      *
-     * @param page 分页对象
      * @param invAccountIncoice 查询实体
      * @return 所有数据
      */
-    @GetMapping
+    @PostMapping("page")
     @ApiOperation("分页查询")
-    public HttpResult selectAll(Page<InvAccountIncoice> page, InvAccountIncoice invAccountIncoice) {
-        return HttpResult.ok(invAccountIncoiceService.page(page, new QueryWrapper<>(invAccountIncoice)));
+    public HttpResult selectAll(@RequestBody InvAccountIncoice invAccountIncoice) {
+        PageRequest pageRequest = new PageRequest();
+        pageRequest.setPageNum(invAccountIncoice.getPageNo());
+        pageRequest.setPageSize(invAccountIncoice.getPageSize());
+        Page page = PageRequest.buildPageRequest(pageRequest);
+        return HttpResult.ok(this.invAccountIncoiceService.page(page, new QueryWrapper<>(invAccountIncoice)));
     }
 
     /**
@@ -56,9 +60,9 @@ public class InvAccountIncoiceController{
      * @param id 主键
      * @return 单条数据
      */
-    @GetMapping("{id}")
+    @GetMapping("byId/{id}")
     @ApiOperation("根据id查询")
-    public HttpResult selectOne(@PathVariable Serializable id) {
+    public HttpResult selectOne(@PathVariable("id") Serializable id) {
         return HttpResult.ok(this.invAccountIncoiceService.getById(id));
     }
 
@@ -88,11 +92,10 @@ public class InvAccountIncoiceController{
 
     /**
      * 撤销
-     *
      */
     @DeleteMapping
     @ApiOperation("删除")
-    public HttpResult delete(@RequestParam("id") Long id) {
+    public HttpResult delete(@RequestParam("id") String id) {
         if (id == null) {
             throw new RuntimeException("id不能为空");
         }

+ 3 - 0
src/main/java/com/ydtech/modules/inv/controller/invAccountExcelController.java

@@ -102,6 +102,9 @@ public class invAccountExcelController {
     public HttpResult deleteAccountExcel(@PathVariable("excelAccountOperateId") String excelAccountOperateId) {
         InvAccountExcel invAccountExcel = invAccountExcelService.getById(excelAccountOperateId);
         if (excelAccountOperateId != null) {
+            if (invAccountExcel.getTransferFlag() == null) {
+                return HttpResult.error("转账标志未传递");
+            }
             if (invAccountExcel.getTransferFlag().equals("1")) {
                 invAccountExcel.setDelFlag("1");
                 return HttpResult.ok("", invAccountExcelService.updateById(invAccountExcel));

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

@@ -53,31 +53,6 @@ public class InvAccountCard {
     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私户)
@@ -212,8 +187,6 @@ public class InvAccountCard {
     @ApiModelProperty(value = "对私单日限额剩余")
     private String priDayLinesExcess;
 
-    @ApiModelProperty(value = "删除标志 删除时不需要传递")
-    private String delFlag;
 
     /**
      * 支出金额

+ 18 - 8
src/main/java/com/ydtech/modules/inv/model/InvAccountIncoice.java

@@ -2,6 +2,7 @@ package com.ydtech.modules.inv.model;
 
 
 import com.alibaba.excel.annotation.ExcelProperty;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
@@ -11,6 +12,7 @@ import lombok.Data;
 import lombok.EqualsAndHashCode;
 
 import java.io.Serializable;
+import java.time.LocalDate;
 import java.util.Date;
 
 /**
@@ -27,7 +29,7 @@ public class InvAccountIncoice implements Serializable{
     @ApiModelProperty(value = "发票序号")
     @TableId
     @ExcelProperty("发票序号")
-    private Long invoiceId;
+    private String invoiceId;
 
     //开票员
     @ApiModelProperty(value = "开票员")
@@ -40,8 +42,8 @@ public class InvAccountIncoice implements Serializable{
     private String invoiceSubjects;
 
     //开票方
-    @ApiModelProperty(value = "对方单位")
-    @ExcelProperty("对方单位")
+    @ApiModelProperty(value = "开票方")
+    @ExcelProperty("开票方")
     private String invoiceBy;
 
     //对方单位
@@ -56,11 +58,12 @@ public class InvAccountIncoice implements Serializable{
 
     //开票日期
     @ApiModelProperty(value = "开票日期")
-    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
-    private Date invoiceTime;
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private LocalDate invoiceTime;
 
     @ApiModelProperty(value = "解决开票日期报错问题无需传递参数")
     @ExcelProperty("开票日期")
+    @TableField(exist = false)
     private String invoiceDate;
 
     //不含税金额
@@ -75,7 +78,7 @@ public class InvAccountIncoice implements Serializable{
 
     //税额
     @ApiModelProperty(value = "税额")
-    @ExcelProperty("税额 填写百分数  不填写小数")
+    @ExcelProperty("税额")
     private String tax;
 
     //开票金额
@@ -90,11 +93,12 @@ public class InvAccountIncoice implements Serializable{
 
     //进账日期
     @ApiModelProperty(value = "进账日期")
-    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
-    private Date payoutTime;
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private LocalDate payoutTime;
 
     @ApiModelProperty(value = "解决进账日期报错问题无需传递参数")
     @ExcelProperty("进账日期")
+    @TableField(exist = false)
     private String payoutDate;
 
     @ApiModelProperty(value = "卡号")
@@ -117,5 +121,11 @@ public class InvAccountIncoice implements Serializable{
     //撤销标志(0正常 1撤销)
     @ApiModelProperty(value = "撤销标志(0正常 1撤销)")
     private String delFlag;
+
+    @TableField(exist = false)
+    private int pageNo;
+
+    @TableField(exist = false)
+    private int pageSize;
 }
 

+ 1 - 6
src/main/java/com/ydtech/modules/inv/service/impl/InvAccountCardServiceImpl.java

@@ -38,9 +38,6 @@ public class InvAccountCardServiceImpl extends ServiceImpl<InvAccountCardMapper,
     public int insertInsAccountCard(InvAccountCard insAccountCard) {
         InvAccount byId = invAccountService.getById(insAccountCard.getAccountId());
 
-        if(byId.getOuterFlag().equals("1")) {
-            throw new RuntimeException("外部账户无法录入卡片信息");
-        }
             //插入剩余额度以及笔数
         insAccountCard.setPubYearExcess(insAccountCard.getPubYearLines());
         insAccountCard.setPubDayLinesExcess(insAccountCard.getPubDayLines());
@@ -73,9 +70,7 @@ public class InvAccountCardServiceImpl extends ServiceImpl<InvAccountCardMapper,
      */
     @Override
     public int updateInsAccountCard(InvAccountCard invAccountCard) {
-        BaseController baseController = new BaseController();
-        invAccountCard.setUpdateBy(baseController.getUserName());
-        invAccountCard.setUpdateTime(new Date());
+
         //不允许修改余额
         invAccountCard.setBalance(null);
         invAccountCard.setDayStrokeNumExcess(null);

+ 1 - 6
src/main/java/com/ydtech/modules/inv/service/impl/InvAccountExcelServiceImpl.java

@@ -93,12 +93,7 @@ public class InvAccountExcelServiceImpl extends ServiceImpl<InvAccountExcelMappe
         InvAccountCard outAccountCard = invAccountCardService.getById(invAccountExcel.getOutCardNum());
         InvAccountCard enterAccountCard = invAccountCardService.getById(invAccountExcel.getEnterCardNum());
 
-        BaseController baseController = new BaseController();
-        String userName = baseController.getUserName();
-        outAccountCard.setUpdateBy(userName);
-        outAccountCard.setUpdateTime(new Date());
-        enterAccountCard.setUpdateBy(userName);
-        enterAccountCard.setUpdateTime(new Date());
+
         //修改转账状态
         invAccountExcel.setTransferFlag("0");
         //判断是转账给内部还是外部

+ 19 - 9
src/main/java/com/ydtech/modules/inv/service/impl/InvAccountIncoiceServiceImpl.java

@@ -38,15 +38,7 @@ public class InvAccountIncoiceServiceImpl extends ServiceImpl<InvAccountIncoiceM
 
     @Override
     public HttpResult 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 tax = getBigDecimal(invAccountIncoice);
         //不含税金额
         BigDecimal noHasTax = new BigDecimal(invAccountIncoice.getInvoiceMoney()).subtract(tax);
 
@@ -72,6 +64,24 @@ public class InvAccountIncoiceServiceImpl extends ServiceImpl<InvAccountIncoiceM
         return  invAccountOperateService.insertIncoice(invAccountOperate,invAccountIncoice.getBankCardNum());
     }
 
+    private static BigDecimal getBigDecimal(InvAccountIncoice invAccountIncoice) {
+        if (invAccountIncoice.getRate().isEmpty()){
+            throw new SystemException("请填写税率");
+        }
+
+        if (invAccountIncoice.getInvoiceMoney().isEmpty()){
+            throw new SystemException("请填写开票金额");
+        }
+        if (invAccountIncoice.getPayoutMoney().isEmpty()){
+            throw new SystemException("请填写进账金额");
+        }
+        //税率百分数转为小数
+        BigDecimal divide = new BigDecimal(invAccountIncoice.getRate()).divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP);
+        //税额
+        BigDecimal tax = new BigDecimal(invAccountIncoice.getInvoiceMoney()).divide((divide.add(new BigDecimal("1"))), 2, RoundingMode.HALF_UP);
+        return tax;
+    }
+
     @Override
     public HttpResult delInvAccountIncoice(InvAccountIncoice invAccountIncoice) {
         //发票信息

+ 9 - 0
src/main/java/com/ydtech/modules/inv/service/impl/InvAccountServiceImpl.java

@@ -68,9 +68,18 @@ public class InvAccountServiceImpl extends ServiceImpl<InvAccountMapper, InvAcco
     public HttpResult selectByAccountName() {
         InvAccount invAccount = new InvAccount();
         List<InvAccount> insAccounts = insAccountMapper.selectAccountsList(invAccount);
+
         if (!insAccounts.isEmpty()) {
+            insAccounts.forEach(invAccountN -> {
+                if (invAccountN.getInvAccountCardList().size() < 2) {
+                    if (invAccountN.getInvAccountCardList().get(0).getBankCardNum() == null) {
+                        invAccountN.setInvAccountCardList(null);
+                    }
+                }
+            });
             return HttpResult.ok("", insAccounts);
         }
+
         return HttpResult.error("查询错误");
     }
 

+ 6 - 0
src/main/java/com/ydtech/modules/inv/utils/TransferUtils.java

@@ -172,6 +172,12 @@ public class TransferUtils {
      * @return
      */
     private static InvAccountCard enterAccountUtils(String remark, InvAccountCard enterAccountCard, BigDecimal invAccountExcelApplyAmount) {
+        if (remark.isEmpty()){
+            throw new SystemException("备注不能为空");
+        }
+        if (enterAccountCard == null){
+            throw new SystemException("收入账户为空");
+        }
         switch (remark) {
             case "0":
                 enterAccountCard.setInsuranceProfit(new BigDecimal(enterAccountCard.getInsuranceProfit()).add(invAccountExcelApplyAmount).toString());

+ 7 - 7
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="enterCardNum" column="enter_account_id" jdbcType="VARCHAR"/>
-            <result property="outCardNum" column="out_account_id" jdbcType="VARCHAR"/>
+            <result property="enterCardNum" column="enter_card_num" jdbcType="VARCHAR"/>
+            <result property="outCardNum" column="out_card_num" 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"/>
@@ -36,7 +36,7 @@
         fund_flow,fund_use,remark,
         apply_amount,big_apply_amount,uplode_path,
         update_by,update_time,create_by,
-        create_time,enter_account_id,out_account_id,
+        create_time,enter_card_num,out_card_num,
         del_flag,out_flag,out_account_quality,transfer_flag,pay_method
     </sql>
     <select id="selectExcelAccount" resultType="com.ydtech.modules.inv.model.InvAccountExcel">
@@ -102,11 +102,11 @@
         <if test="insAccountExcel.createTime!= null">
             and create_time &lt;= #{insAccountExcel.createTime}
         </if>
-        <if test="insAccountExcel.enterAccountId!= null and insAccountExcel.enterAccountId!= ''">
-            and enter_account_id = #{insAccountExcel.enterAccountId}
+        <if test="insAccountExcel.enterCardNum!= null and insAccountExcel.enterCardNum!= ''">
+            and enter_card_num = #{insAccountExcel.enterCardNum}
         </if>
-        <if test="insAccountExcel.outAccountId!= null and insAccountExcel.outAccountId!= ''">
-            and out_account_id = #{insAccountExcel.outAccountId}
+        <if test="insAccountExcel.outCardNum!= null and insAccountExcel.outCardNum!= ''">
+            and out_card_num = #{insAccountExcel.outCardNum}
         </if>
         <if test="insAccountExcel.outFlag!= null and insAccountExcel.outFlag!= ''">
             and out_flag = #{insAccountExcel.outFlag}

+ 0 - 1
src/main/resources/mapper/modules/inv/InvAccountMapper.xml

@@ -51,7 +51,6 @@
         <result property="dayStrokeNumExcess" column="day_stroke_num_excess" jdbcType="VARCHAR"/>
         <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="spend" column="spend" jdbcType="VARCHAR"/>
     </resultMap>