Bladeren bron

修改发票逻辑

y 2 jaren geleden
bovenliggende
commit
13f5572538

+ 2 - 5
src/main/java/com/ydtech/modules/inv/controller/InvAccountIncoiceController.java

@@ -34,11 +34,7 @@ public class InvAccountIncoiceController {
     private InvAccountIncoiceService invAccountIncoiceService;
 
 
-    @GetMapping("excel")
-    @ApiOperation("导出开票记录表")
-    public HttpResult selectAccountIncoiceExcel() {
-        return HttpResult.ok();
-    }
+
 
     /**
      * 分页查询所有数据
@@ -58,6 +54,7 @@ public class InvAccountIncoiceController {
                 .eq(!StringUtils.isEmpty(invAccountIncoice.getBiller()), InvAccountIncoice::getBiller, invAccountIncoice.getBiller())
                 .eq(!StringUtils.isEmpty(invAccountIncoice.getInvoiceBy()), InvAccountIncoice::getInvoiceBy,
                         invAccountIncoice.getInvoiceBy())
+                .eq( InvAccountIncoice::getDelFlag, "0")
                 .eq(!StringUtils.isEmpty(invAccountIncoice.getInvoiceType()), InvAccountIncoice::getInvoiceType,
                         invAccountIncoice.getInvoiceType());
 

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

@@ -31,6 +31,9 @@ public class InvAccountIncoice implements Serializable{
     @ExcelProperty("发票序号")
     private String invoiceId;
 
+    @ApiModelProperty(value = "账户id")
+    private String accountId;
+
     //开票员
     @ApiModelProperty(value = "开票员")
     @ExcelProperty("开票员")
@@ -122,6 +125,37 @@ public class InvAccountIncoice implements Serializable{
     @ApiModelProperty(value = "撤销标志(0正常 1撤销)")
     private String delFlag;
 
+
+
+    /**
+     * 大写金额
+     */
+    @ApiModelProperty(value = "大写金额")
+    @TableField(exist = false)
+    private String bigApplyAmount;
+
+    /**
+     * 资金流向
+     */
+    @ApiModelProperty(value = "资金流向")
+    @TableField(exist = false)
+    private String fundFlow;
+
+    /**
+     * 支付方式(0现金 1微信 2转账 3其他)
+     */
+    @ApiModelProperty(value = "支付方式(0现金 1微信 2转账 3其他)")
+    @TableField(exist = false)
+    private String payMethod;
+
+    /**
+     * 单位
+     */
+    @ApiModelProperty(value = "单位")
+    @TableField(exist = false)
+    private String company;
+
+
     @TableField(exist = false)
     private int pageNo;
 

+ 7 - 0
src/main/java/com/ydtech/modules/inv/model/vo/InvAccountQueryVo.java

@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.io.Serializable;
+import java.time.LocalDate;
 
 @Data
 public class InvAccountQueryVo implements Serializable {
@@ -22,6 +23,12 @@ public class InvAccountQueryVo implements Serializable {
     @ApiModelProperty(value = "外部账户标识(0内部账户 1外部账户)")
     private String outerFlag;
 
+    @ApiModelProperty(value = "开票日期  无需传递")
+    private LocalDate invoiceTimeStart;
+
+    @ApiModelProperty(value = "开票日期  无需传递")
+    private LocalDate invoiceTimeEnd;
+
     private int pageNo;
 
     private int pageSize;

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

@@ -57,6 +57,11 @@ public class InvAccountIncoiceServiceImpl extends ServiceImpl<InvAccountIncoiceM
         invAccountOperate.setEnterCardId(bankCardNum);
         invAccountOperate.setApplyAmount(payoutMoney);
         invAccountOperate.setRemark(invAccountIncoice.getRemark());
+        invAccountOperate.setRevenueOutlay("0");
+        invAccountOperate.setBigApplyAmount(invAccountIncoice.getBigApplyAmount());
+        invAccountOperate.setFundFlow(invAccountIncoice.getFundFlow());
+        invAccountOperate.setPayMethod(invAccountIncoice.getPayMethod());
+        invAccountOperate.setCompany(invAccountIncoice.getCompany());
 
         invAccountIncoiceMapper.insert(invAccountIncoice);
 
@@ -89,7 +94,12 @@ public class InvAccountIncoiceServiceImpl extends ServiceImpl<InvAccountIncoiceM
         //回滚收入
         InvAccountCard enterAccount = invAccountCardService.getById(enInvAccountIncoice.getBankCardNum());
 
+        //新增收入回滚操作
         InvAccountCard invAccount = quashOutsideTransfer(enterAccount, enInvAccountIncoice);
+        InvAccountOperate invAccountOperate = new InvAccountOperate();
+        invAccountOperate.setRevenueOutlay("1");
+        invAccountOperate.setApplyAmount("发票撤销 收入撤销");
+        invAccountOperate.setCompany(enInvAccountIncoice.getInvoiceBy());
 
         try {
             invAccountIncoiceMapper.updateById(invAccountIncoice);

+ 10 - 1
src/main/java/com/ydtech/modules/inv/service/impl/InvAccountServiceImpl.java

@@ -12,6 +12,8 @@ import com.ydtech.modules.inv.service.InvAccountService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.time.LocalDate;
+import java.time.temporal.TemporalAdjusters;
 import java.util.List;
 
 /**
@@ -29,7 +31,6 @@ public class InvAccountServiceImpl extends ServiceImpl<InvAccountMapper, InvAcco
     /**
      * 分页查询
      *
-     * @param account
      * @return
      */
     @Override
@@ -38,6 +39,13 @@ public class InvAccountServiceImpl extends ServiceImpl<InvAccountMapper, InvAcco
         pageRequest.setPageNum(invAccountQueryVo.getPageNo());
         pageRequest.setPageSize(invAccountQueryVo.getPageSize());
         Page page = PageRequest.buildPageRequest(pageRequest);
+        LocalDate date = LocalDate.now();
+        LocalDate nowDay = date.with(TemporalAdjusters.lastDayOfMonth()); // 获取当前月的最后一天
+        LocalDate lastMonth = date.minusMonths(12); // 当前月份减12
+        LocalDate firstDay = lastMonth.with(TemporalAdjusters.firstDayOfMonth()); // 获取12月前月的第一天
+        System.out.println("当前月份:" + nowDay + "  12月:" + firstDay);
+        invAccountQueryVo.setInvoiceTimeStart(firstDay);
+        invAccountQueryVo.setInvoiceTimeEnd(nowDay);
         IPage<InvAccount> invAccountIPage = insAccountMapper.selectAccountsListPage(page, invAccountQueryVo);
         List<InvAccount> records = invAccountIPage.getRecords();
         records.forEach(invAccount -> {
@@ -50,6 +58,7 @@ public class InvAccountServiceImpl extends ServiceImpl<InvAccountMapper, InvAcco
         return invAccountIPage;
     }
 
+
     @Override
     public List<InvAccount> selectAccounts(InvAccount account) {
         return insAccountMapper.selectAccountsList(account);

+ 21 - 3
src/main/resources/mapper/modules/inv/InvAccountMapper.xml

@@ -69,10 +69,10 @@
         a.establish_time,
         a.biller,
         a.invoicing_amount,
-        a.invoicing_amount_excess,
+        ABS(sum(c.invoice_money) - 5000000) as invoicing_amount_excess,
+
 
 
-	    b.account_id,
         b.bank_card_num,
         b.bank_name,
         b.bank,
@@ -101,12 +101,20 @@
         b.pub_day_lines_excess,
         b.pri_day_lines_excess,
         b.spend
+
     </sql>
     <select id="selectAccountsListPage" 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
+        left join inv_account_incoice c on a.account_id = c.account_id
+        <if test="account.invoiceTimeStart!= null">
+            and c.invoice_time &gt;= #{account.invoiceTimeStart}
+        </if>
+        <if test="account.invoiceTimeEnd!= null">
+            and c.invoice_time &lt;= #{account.invoiceTimeEnd}
+        </if>
         where a.del_flag = '0'
         <if test="account.accountName!= null and account.accountName!= ''">
             and a.account_name like concat('%',#{account.accountName},'%')
@@ -120,6 +128,8 @@
         <if test="account.bankCardNum!= null and account.bankCardNum!= ''">
             and b.bank_card_num like concat('%',#{account.bankCardNum},'%')
         </if>
+        GROUP BY
+        a.account_id
     </select>
 
     <select id="selectAccountsList" resultMap="BaseResultMap">
@@ -127,6 +137,13 @@
         <include refid="Base_Column_List"/>
         from inv_account a
         left join inv_account_card b on a.account_id = b.account_id
+        left join inv_account_incoice c on a.account_id = c.account_id
+        <if test="account.invoiceTimeStart!= null">
+            and c.invoice_time &gt;= #{account.invoiceTimeStart}
+        </if>
+        <if test="account.invoiceTimeEnd!= null">
+            and c.invoice_time &lt;= #{account.invoiceTimeEnd}
+        </if>
         where a.del_flag = '0'
         <if test="account.accountId != null and account.accountId != ''">
             and a.account_id = #{account.accountId}
@@ -140,6 +157,7 @@
         <if test="account.juridicalPerson!= null and account.juridicalPerson!= ''">
             and a.juridical_person like concat('%',#{account.juridicalPerson},'%')
         </if>
-
+        GROUP BY
+        a.account_id
     </select>
 </mapper>