ly 1 год назад
Родитель
Сommit
9cd70fde33

+ 93 - 0
src/main/java/cn/ezhizao/project/business/invoice/controller/BizCopyInfoController.java

@@ -0,0 +1,93 @@
+package cn.ezhizao.project.business.invoice.controller;
+
+import java.util.List;
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+
+import cn.ezhizao.project.business.invoice.domain.BizCopyInfo;
+import cn.ezhizao.project.business.invoice.service.IBizCopyInfoService;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import cn.ezhizao.framework.web.controller.BaseController;
+import cn.ezhizao.framework.web.domain.AjaxResult;
+import cn.ezhizao.common.utils.poi.ExcelUtil;
+import cn.ezhizao.framework.web.page.TableDataInfo;
+
+/**
+ * 企业租户Controller
+ *
+ * @author ruoyi
+ * @date 2024-08-26
+ */
+@RestController
+@RequestMapping("/business/info")
+public class BizCopyInfoController extends BaseController
+{
+    @Resource
+    private IBizCopyInfoService bizCopyInfoService;
+
+    /**
+     * 查询列表
+     */
+    @GetMapping("/list")
+    public TableDataInfo list(BizCopyInfo bizCopyInfo) throws NoSuchFieldException, IllegalAccessException
+    {
+        setTenantId(bizCopyInfo);
+        startPage();
+        List<BizCopyInfo> list = bizCopyInfoService.getList(bizCopyInfo);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出列表
+     */
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, BizCopyInfo bizCopyInfo) throws NoSuchFieldException, IllegalAccessException
+    {
+        setTenantId(bizCopyInfo);
+        List<BizCopyInfo> list = bizCopyInfoService.getList(bizCopyInfo);
+        ExcelUtil<BizCopyInfo> util = new ExcelUtil<BizCopyInfo>(BizCopyInfo.class);
+        util.exportExcel(response, list, "企业租户数据");
+    }
+
+
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return success(bizCopyInfoService.getById(id));
+    }
+    @GetMapping(value = "/tenantId")
+    public AjaxResult getInfoByTenantId(){
+        Long tenantId = getTenantId();
+        BizCopyInfo one = bizCopyInfoService.getOne(new LambdaQueryWrapper<BizCopyInfo>().eq(BizCopyInfo::getTenantId, tenantId));
+        return success(one);
+    }
+    @PostMapping
+    public AjaxResult add(@RequestBody BizCopyInfo bizCopyInfo) throws NoSuchFieldException, IllegalAccessException
+    {
+        setTenantId(bizCopyInfo);
+        return toAjax(bizCopyInfoService.save(bizCopyInfo));
+    }
+
+
+    @PutMapping
+    public AjaxResult edit(@RequestBody BizCopyInfo bizCopyInfo) throws NoSuchFieldException, IllegalAccessException
+    {
+        setTenantId(bizCopyInfo);
+        return toAjax(bizCopyInfoService.updateById(bizCopyInfo));
+    }
+
+
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable List<Long> ids)
+    {
+        return toAjax(bizCopyInfoService.removeBatchByIds(ids));
+    }
+}

+ 148 - 17
src/main/java/cn/ezhizao/project/business/invoice/controller/BizInvoiceController.java

@@ -1,11 +1,28 @@
 package cn.ezhizao.project.business.invoice.controller;
 
+import java.math.BigDecimal;
+import java.util.Collection;
+import java.util.Date;
 import java.util.List;
+import java.util.stream.Collectors;
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
 
+import cn.ezhizao.project.business.collection.domain.BizCollection;
+import cn.ezhizao.project.business.collection.domain.BizCollectionDetail;
+import cn.ezhizao.project.business.collection.service.IBizCollectionDetailService;
+import cn.ezhizao.project.business.collection.service.IBizCollectionService;
+import cn.ezhizao.project.business.invoice.domain.BizCopyInfo;
 import cn.ezhizao.project.business.invoice.domain.BizInvoice;
+import cn.ezhizao.project.business.invoice.service.IBizCopyInfoService;
 import cn.ezhizao.project.business.invoice.service.IBizInvoiceService;
+import cn.ezhizao.project.business.order.service.IBizArchiveInputService;
+import cn.ezhizao.project.system.domain.SysFileStorage;
+import cn.ezhizao.project.system.service.ISysFileStorageService;
+import cn.ezhizao.project.system.service.ISysUserService;
+import com.alibaba.nacos.common.utils.CollectionUtils;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -30,18 +47,34 @@ import cn.ezhizao.framework.web.page.TableDataInfo;
  */
 @RestController
 @RequestMapping("/business/invoice")
-public class BizInvoiceController extends BaseController
-{
+public class BizInvoiceController extends BaseController {
     @Resource
     private IBizInvoiceService bizInvoiceService;
 
+    @Resource
+    private IBizCollectionService collectionService;
+
+    @Resource
+    private IBizCollectionDetailService collectionDetailService;
+
+    @Resource
+    private IBizCopyInfoService bizCopyInfoService;
+
+    @Resource
+    private IBizArchiveInputService bizArchiveInputService;
+
+    @Resource
+    private ISysUserService userService;
+
+    @Resource
+    private ISysFileStorageService fileStorageService;
+
     /**
      * 查询开票管理列表
      */
     @PreAuthorize("@ss.hasPermi('business:invoice:list')")
     @GetMapping("/list")
-    public TableDataInfo list(BizInvoice bizInvoice) throws NoSuchFieldException, IllegalAccessException
-    {
+    public TableDataInfo list(BizInvoice bizInvoice) throws NoSuchFieldException, IllegalAccessException {
         startPage();
         List<BizInvoice> list = bizInvoiceService.getList(bizInvoice);
         return getDataTable(list);
@@ -51,10 +84,9 @@ public class BizInvoiceController extends BaseController
      * 导出开票管理列表
      */
     @PreAuthorize("@ss.hasPermi('business:invoice:export')")
-    @Log(title = "开票管理", businessType = BusinessType.EXPORT)
+    @Log(title = "开票管理导出", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
-    public void export(HttpServletResponse response, BizInvoice bizInvoice) throws NoSuchFieldException, IllegalAccessException
-    {
+    public void export(HttpServletResponse response, BizInvoice bizInvoice) throws NoSuchFieldException, IllegalAccessException {
         List<BizInvoice> list = bizInvoiceService.getList(bizInvoice);
         ExcelUtil<BizInvoice> util = new ExcelUtil<BizInvoice>(BizInvoice.class);
         util.exportExcel(response, list, "开票管理数据");
@@ -65,9 +97,33 @@ public class BizInvoiceController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('business:invoice:query')")
     @GetMapping(value = "/{id}")
-    public AjaxResult getInfo(@PathVariable("id") Long id)
-    {
-        return success(bizInvoiceService.getById(id));
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
+        BizInvoice bizInvoice = bizInvoiceService.getById(id);
+
+        SysFileStorage one = fileStorageService.getOne(new LambdaQueryWrapper<SysFileStorage>().eq(SysFileStorage::getMasterId, bizInvoice.getId()));
+        if (one != null) {
+            bizInvoice.setEvidenceFile(one.getFileUrl());
+        }
+
+        String contractNo = bizArchiveInputService.getById(bizInvoice.getContractId()).getContractNo();
+        bizInvoice.setContractNo(contractNo);
+        if (bizInvoice.getInvoiceId() != null) {
+            String userName2 = userService.selectUserById(bizInvoice.getInvoiceId()).getUserName();
+            bizInvoice.setInvoiceName(userName2);
+        }
+
+        if (bizInvoice.getApplierId() != null) {
+            String userName1 = userService.selectUserById(bizInvoice.getApplierId()).getUserName();
+            bizInvoice.setApplierName(userName1);
+        }
+        return success(bizInvoice);
+    }
+
+
+    @GetMapping(value = "/getInfoByName/{name}")
+    public AjaxResult getInfoByName(@PathVariable String name) {
+        BizCopyInfo one = bizCopyInfoService.getOne(new LambdaQueryWrapper<BizCopyInfo>().eq(BizCopyInfo::getName, name));
+        return success(one);
     }
 
     /**
@@ -76,8 +132,34 @@ public class BizInvoiceController extends BaseController
     @PreAuthorize("@ss.hasPermi('business:invoice:add')")
     @Log(title = "开票管理", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody BizInvoice bizInvoice) throws NoSuchFieldException, IllegalAccessException
-    {
+    public AjaxResult add(@RequestBody BizInvoice bizInvoice) throws NoSuchFieldException, IllegalAccessException {
+        BizCopyInfo info1 = new BizCopyInfo();
+        BizCopyInfo info2 = new BizCopyInfo();
+        //开票户
+        Long tenantId = getTenantId();
+        BizCopyInfo one = bizCopyInfoService.getOne(new LambdaQueryWrapper<BizCopyInfo>().eq(BizCopyInfo::getTenantId, tenantId));
+        if (one != null) {
+            info1.setId(one.getId());
+        }
+        info1.setName(one.getName());
+        info1.setAddress(one.getAddress());
+        info1.setAccount(one.getAccount());
+        info1.setCode(one.getCode());
+        info1.setTenantId(tenantId);
+        bizCopyInfoService.saveOrUpdate(info1);
+        //收票户
+        String invoiceOther = bizInvoice.getInvoiceOther();
+        BizCopyInfo one1 = bizCopyInfoService.getOne(new LambdaQueryWrapper<BizCopyInfo>().eq(BizCopyInfo::getName, invoiceOther));
+        if (one1 != null) {
+            info2.setId(one1.getId());
+        }
+        info2.setName(invoiceOther);
+        info2.setAddress(bizInvoice.getOtherAddress());
+        info2.setAccount(bizInvoice.getOtherAccount());
+        info2.setCode(bizInvoice.getOtherCreditSocietyCode());
+        bizCopyInfoService.saveOrUpdate(info2);
+        bizInvoice.setApplierId(getUserId());
+        bizInvoice.setApplierTime(new Date());
         return toAjax(bizInvoiceService.save(bizInvoice));
     }
 
@@ -87,8 +169,21 @@ public class BizInvoiceController extends BaseController
     @PreAuthorize("@ss.hasPermi('business:invoice:edit')")
     @Log(title = "开票管理", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@RequestBody BizInvoice bizInvoice) throws NoSuchFieldException, IllegalAccessException
-    {
+    public AjaxResult edit(@RequestBody BizInvoice bizInvoice) throws NoSuchFieldException, IllegalAccessException {
+        if (bizInvoice.getStatus().equals(3)) {
+            Long userId = getUserId();
+            bizInvoice.setInvoiceId(userId);
+            SysFileStorage sysFileStorage = new SysFileStorage();
+            sysFileStorage.setMasterId(bizInvoice.getId());
+            sysFileStorage.setMasterTableName("biz_invoice");
+            sysFileStorage.setFileUrl(bizInvoice.getEvidenceFile());
+            sysFileStorage.setFileName(bizInvoice.getFileName());
+            sysFileStorage.setOriginalFileName(bizInvoice.getOriginalFileName());
+            SysFileStorage one = fileStorageService.getOne(new LambdaQueryWrapper<SysFileStorage>().eq(SysFileStorage::getMasterId, bizInvoice.getId()));
+            fileStorageService.physicalDelete(one);
+            fileStorageService.save(sysFileStorage);
+        }
+
         return toAjax(bizInvoiceService.updateById(bizInvoice));
     }
 
@@ -97,9 +192,45 @@ public class BizInvoiceController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('business:invoice:remove')")
     @Log(title = "开票管理", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{ids}")
-    public AjaxResult remove(@PathVariable List<Long> ids)
-    {
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable List<Long> ids) {
         return toAjax(bizInvoiceService.removeBatchByIds(ids));
     }
+
+    @GetMapping(value = "/getCollectionToAmount/{id}")
+    public AjaxResult getCollectionToAmount(@PathVariable String id) {
+        List<BizCollection> list = collectionService.list(new LambdaQueryWrapper<BizCollection>()
+                .eq(BizCollection::getContractId, id)
+                .eq(BizCollection::getStatus, 1)
+                .eq(BizCollection::getArriveStatus, 1)
+                .eq(BizCollection::getDeleted, 0));
+        List<Long> ids = list.stream().map(v -> v.getId()).collect(Collectors.toList());
+        if (CollectionUtils.isEmpty(ids)) {
+            return success(0);
+        }
+        List<BizCollectionDetail> details = collectionDetailService.list(
+                new LambdaQueryWrapper<BizCollectionDetail>()
+                        .in(BizCollectionDetail::getCollectionId, ids)
+                        .eq(BizCollectionDetail::getDeleted, 0)
+        );
+        //所有审核通过的合同
+        BigDecimal amount = details.stream().map(BizCollectionDetail::getArriveAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
+
+        //已开票 或待审核的开票
+        LambdaQueryWrapper<BizInvoice> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(BizInvoice::getContractId, id);
+        wrapper.eq(BizInvoice::getDeleted, 0);
+        wrapper.and(item -> item.eq(BizInvoice::getStatus, 3).or().eq(BizInvoice::getStatus, 1));
+        List<BizInvoice> invoices = bizInvoiceService.list(wrapper);
+        if (!CollectionUtils.isEmpty(invoices)) {
+            BigDecimal haveAmount = invoices.stream().map(v -> v.getAllowInvoiceAmount()).reduce(BigDecimal.ZERO, BigDecimal::add);
+            amount = amount.subtract(haveAmount);
+            if (amount.compareTo(BigDecimal.ZERO)<0){
+                amount = BigDecimal.ZERO;
+            }
+        }
+
+        return success(amount);
+
+    }
 }

+ 31 - 0
src/main/java/cn/ezhizao/project/business/invoice/domain/BizCopyInfo.java

@@ -0,0 +1,31 @@
+package cn.ezhizao.project.business.invoice.domain;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import cn.ezhizao.framework.web.domain.BaseEntity;
+import lombok.Data;
+import io.swagger.annotations.ApiModelProperty;
+import cn.ezhizao.framework.aspectj.lang.annotation.Excel;
+
+/**
+ * 企业租户对象 biz_copy_info
+ *
+ * @author ruoyi
+ * @date 2024-08-26
+ */
+@Data
+@TableName(value = "biz_copy_info")
+public class BizCopyInfo
+{
+    private static final long serialVersionUID = 1L;
+    private Long id;
+    private Long tenantId;
+
+    private String code;
+
+    private String address;
+
+    private String account;
+
+    private String name;
+
+}

+ 91 - 41
src/main/java/cn/ezhizao/project/business/invoice/domain/BizInvoice.java

@@ -2,6 +2,9 @@ package cn.ezhizao.project.business.invoice.domain;
 
 import java.math.BigDecimal;
 import java.util.Date;
+import java.util.List;
+
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.baomidou.mybatisplus.annotation.TableName;
 import cn.ezhizao.framework.web.domain.BaseEntity;
@@ -17,92 +20,139 @@ import cn.ezhizao.framework.aspectj.lang.annotation.Excel;
  */
 @Data
 @TableName(value = "biz_invoice")
-public class BizInvoice extends BaseEntity
-{
+public class BizInvoice extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
-    /** 发票类型 */
-    @Excel(name = "发票类型")
+    /**
+     * 发票类型
+     */
+    @Excel(name = "发票类型",sort = 3,readConverterExp = "1=增值税专用发票,2=增值税普通发票")
     @ApiModelProperty(value = "发票类型")
     private Integer invoiceType;
 
-    /** 合同id */
-    @ApiModelProperty(value = "发票类型")
+    /**
+     * 合同id
+     */
     private Long contractId;
 
-    /** 申请开票金额 */
-    @Excel(name = "申请开票金额")
+    /**
+     * 申请开票金额
+     */
+    @Excel(name = "申请开票金额",sort = 4)
     @ApiModelProperty(value = "申请开票金额")
     private BigDecimal allowInvoiceAmount;
 
-    /** 发票信息 */
-    @Excel(name = "发票信息")
+    /**
+     * 发票信息
+     */
     @ApiModelProperty(value = "发票信息")
-    private Integer invoiceContent;
+    private Long invoiceContent;
 
-    /** 开票方 */
-    @Excel(name = "开票方")
+    /**
+     * 开票方
+     */
     @ApiModelProperty(value = "开票方")
     private String invoiceMy;
 
-    /** 社会信用代码 */
-    @Excel(name = "社会信用代码")
+    /**
+     * 社会信用代码
+     */
     @ApiModelProperty(value = "社会信用代码")
     private String myCreditSocietyCode;
 
-    /** 地址 */
-    @Excel(name = "地址")
+    /**
+     * 地址
+     */
     @ApiModelProperty(value = "地址")
     private String myAddress;
 
-    /** 账号 */
-    @Excel(name = "账号")
+    /**
+     * 账号
+     */
     @ApiModelProperty(value = "账号")
     private String myAccount;
 
-    /** 收票方 */
-    @Excel(name = "收票方")
+    /**
+     * 收票方
+     */
+    @Excel(name = "收票方",sort = 1)
     @ApiModelProperty(value = "收票方")
     private String invoiceOther;
 
-    /** $column.columnComment */
-    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
-    @ApiModelProperty(value = "${comment}")
     private String otherCreditSocietyCode;
 
-    /** $column.columnComment */
-    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
-    @ApiModelProperty(value = "${comment}")
     private String otherAddress;
-
-    /** 申请人 */
-    @ApiModelProperty(value = "${comment}")
+    private String otherAccount;
+    /**
+     * 申请人
+     */
     private Long applierId;
 
-    /** 申请时间 */
+    @Excel(name = "发票备注",sort = 5)
+    private String remark;
+    /**
+     * 申请时间
+     */
     @JsonFormat(pattern = "yyyy-MM-dd")
-    @Excel(name = "申请时间", width = 30, dateFormat = "yyyy-MM-dd")
+    @Excel(name = "申请时间", width = 30,sort = 8,dateFormat = "yyyy-MM-dd")
     @ApiModelProperty(value = "申请时间")
     private Date applierTime;
 
-    /** 0-未提交 1-待开票 2-已拒绝  3-已开票 */
-    @Excel(name = "0-未提交 1-待开票 2-已拒绝  3-已开票")
-    @ApiModelProperty(value = "0-未提交 1-待开票 2-已拒绝  3-已开票")
+    /**
+     * 0-未提交 1-待开票 2-已拒绝  3-已开票
+     */
+    @Excel(name = "状态",sort = 6,readConverterExp = "0=未提交,1=待开票,2=已拒绝,3=已开票")
     private Integer status;
 
-    /** 开票人 */
-    @ApiModelProperty(value = "0-未提交 1-待开票 2-已拒绝  3-已开票")
+    /**
+     * 开票人
+     */
     private Long invoiceId;
 
-    /** 开票时间 */
+    /**
+     * 开票时间
+     */
     @JsonFormat(pattern = "yyyy-MM-dd")
-    @Excel(name = "开票时间", width = 30, dateFormat = "yyyy-MM-dd")
+    @Excel(name = "开票时间", width = 30,sort = 10,dateFormat = "yyyy-MM-dd")
     @ApiModelProperty(value = "开票时间")
     private Date invoiceTime;
 
-    /** 开票备注 */
-    @Excel(name = "开票备注")
+    /**
+     * 开票备注
+     */
     @ApiModelProperty(value = "开票备注")
     private String invoiceRemark;
 
+    private String refuseReason;
+
+    private String returnReason;
+
+    @TableField(exist = false)
+    @Excel(name = "合同编号",sort = 2)
+    private String contractNo;
+
+    @TableField(exist = false)
+    @Excel(name = "申请人",sort = 7)
+    private String applierName;
+
+
+    @TableField(exist = false)
+    @ApiModelProperty("凭证文件url")
+    private String evidenceFile;
+    @TableField(exist = false)
+    @ApiModelProperty("凭证文件名称")
+    private String fileName;
+    @TableField(exist = false)
+    @ApiModelProperty("凭证原始文件名称")
+    private String originalFileName;
+    @TableField(exist = false)
+    @Excel(name = "开票人",sort = 9)
+    private String invoiceName;
+
+
+    @TableField(exist = false)
+    private List<String> dateFilter;
+
+    @TableField(exist = false)
+    private List<String> invoiceDateFilter;
 }

+ 30 - 0
src/main/java/cn/ezhizao/project/business/invoice/mapper/BizCopyInfoMapper.java

@@ -0,0 +1,30 @@
+package cn.ezhizao.project.business.invoice.mapper;
+
+import java.util.List;
+
+import cn.ezhizao.project.business.invoice.domain.BizCopyInfo;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 企业租户Mapper接口
+ *
+ * @author ruoyi
+ * @date 2024-08-26
+ */
+public interface BizCopyInfoMapper extends BaseMapper<BizCopyInfo>
+{
+    /**
+     * 查询企业租户列表
+     *
+     * @param bizCopyInfo 企业租户
+     * @return 企业租户集合
+     */
+    public List<BizCopyInfo> getList(BizCopyInfo bizCopyInfo);
+
+    /**
+     * 物理删除
+     * @param bizCopyInfo
+     * @return 删除结果
+    */
+    public int physicalDelete(BizCopyInfo bizCopyInfo);
+}

+ 31 - 0
src/main/java/cn/ezhizao/project/business/invoice/service/IBizCopyInfoService.java

@@ -0,0 +1,31 @@
+package cn.ezhizao.project.business.invoice.service;
+
+import java.util.List;
+
+import cn.ezhizao.project.business.invoice.domain.BizCopyInfo;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 企业租户Service接口
+ *
+ * @author ruoyi
+ * @date 2024-08-26
+ */
+public interface IBizCopyInfoService extends IService<BizCopyInfo>
+{
+    /**
+     * 查询企业租户列表
+     *
+     * @param bizCopyInfo 企业租户
+     * @return 企业租户集合
+     */
+    public List<BizCopyInfo> getList(BizCopyInfo bizCopyInfo);
+
+    /**
+     * 物理删除
+     * @param bizCopyInfo
+     * @return 删除结果
+     */
+    public int physicalDelete(BizCopyInfo bizCopyInfo);
+
+}

+ 44 - 0
src/main/java/cn/ezhizao/project/business/invoice/service/impl/BizCopyInfoServiceImpl.java

@@ -0,0 +1,44 @@
+package cn.ezhizao.project.business.invoice.service.impl;
+
+import java.util.List;
+import javax.annotation.Resource;
+
+import cn.ezhizao.project.business.invoice.domain.BizCopyInfo;
+import cn.ezhizao.project.business.invoice.mapper.BizCopyInfoMapper;
+import cn.ezhizao.project.business.invoice.service.IBizCopyInfoService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * 企业租户Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2024-08-26
+ */
+@Service
+public class BizCopyInfoServiceImpl  extends ServiceImpl<BizCopyInfoMapper, BizCopyInfo> implements IBizCopyInfoService
+{
+    @Resource
+    private BizCopyInfoMapper bizCopyInfoMapper;
+
+    /**
+     * 查询企业租户列表
+     *
+     * @param bizCopyInfo 企业租户
+     * @return 企业租户
+     */
+    @Override
+    public List<BizCopyInfo> getList(BizCopyInfo bizCopyInfo)
+    {
+        return bizCopyInfoMapper.getList(bizCopyInfo);
+    }
+
+    /**
+     * 物理删除
+     * @param bizCopyInfo
+     * @return 删除结果
+     */
+    @Override
+    public int physicalDelete(BizCopyInfo bizCopyInfo){ return bizCopyInfoMapper.physicalDelete(bizCopyInfo); };
+
+}

+ 31 - 0
src/main/resources/mybatis/business/BizCopyInfoMapper.xml

@@ -0,0 +1,31 @@
+<?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="cn.ezhizao.project.business.invoice.mapper.BizCopyInfoMapper">
+
+    <resultMap type="cn.ezhizao.project.business.invoice.domain.BizCopyInfo" id="BizCopyInfoResult">
+        <id column="id" property="id"/>
+    </resultMap>
+
+
+    <select id="getList" parameterType="BizCopyInfo" resultMap="BizCopyInfoResult">
+        SELECT * FROM biz_copy_info
+        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
+            deleted = 0
+            <if test="code != null  and code != ''"> AND code = #{code}</if>
+            <if test="address != null  and address != ''"> AND address = #{address}</if>
+            <if test="account != null  and account != ''"> AND account = #{account}</if>
+        </trim>
+    </select>
+
+    <delete id="physicalDelete">
+        DELETE FROM biz_copy_info
+        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
+            <if test="id != null">
+                id = #{id} AND
+            </if>
+       <!-- 删除条件为其他外键可以在这里加 -->
+        </trim>
+    </delete>
+</mapper>

+ 39 - 19
src/main/resources/mybatis/business/BizInvoiceMapper.xml

@@ -1,7 +1,7 @@
 <?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">
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.ezhizao.project.business.invoice.mapper.BizInvoiceMapper">
 
     <resultMap type="cn.ezhizao.project.business.invoice.domain.BizInvoice" id="BizInvoiceResult">
@@ -10,24 +10,44 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
 
     <select id="getList" parameterType="BizInvoice" resultMap="BizInvoiceResult">
-        SELECT * FROM biz_invoice
+        SELECT t1.*,t2.contract_no ,t3.user_name as applierName,t4.user_name as invoiceName
+
+        FROM biz_invoice t1
+        left join biz_archive_input t2 on t1.contract_id = t2.id
+        left join sys_user t3 on t1.applier_id = t3.user_id
+        left join sys_user t4 on t1.invoice_id = t4.user_id
         <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
-            deleted = 0
-            <if test="invoiceType != null "> AND invoice_type = #{invoiceType}</if>
-            <if test="allowInvoiceAmount != null "> AND allow_invoice_amount = #{allowInvoiceAmount}</if>
-            <if test="invoiceContent != null "> AND invoice_content = #{invoiceContent}</if>
-            <if test="invoiceMy != null  and invoiceMy != ''"> AND invoice_my = #{invoiceMy}</if>
-            <if test="myCreditSocietyCode != null  and myCreditSocietyCode != ''"> AND my_credit_society_code = #{myCreditSocietyCode}</if>
-            <if test="myAddress != null  and myAddress != ''"> AND my_address = #{myAddress}</if>
-            <if test="myAccount != null  and myAccount != ''"> AND my_account = #{myAccount}</if>
-            <if test="invoiceOther != null  and invoiceOther != ''"> AND invoice_other = #{invoiceOther}</if>
-            <if test="otherCreditSocietyCode != null  and otherCreditSocietyCode != ''"> AND other_credit_society_code = #{otherCreditSocietyCode}</if>
-            <if test="otherAddress != null  and otherAddress != ''"> AND other_address = #{otherAddress}</if>
-            <if test="applierTime != null "> AND applier_time = #{applierTime}</if>
-            <if test="status != null "> AND status = #{status}</if>
-            <if test="invoiceTime != null "> AND invoice_time = #{invoiceTime}</if>
-            <if test="invoiceRemark != null  and invoiceRemark != ''"> AND invoice_remark = #{invoiceRemark}</if>
+            t1.deleted = 0
+            <if test="invoiceType != null ">AND invoice_type = #{invoiceType}</if>
+            <if test="invoiceMy != null  and invoiceMy != ''">
+                AND t1.invoice_my like concat('%',#{invoiceMy}, '%')
+            </if>
+            <if test="contractNo != null  and contractNo != ''">
+                AND t2.contract_no like concat('%',#{contractNo}, '%')
+            </if>
+            <if test="applierName != null  and applierName != ''">
+                AND t3.user_name like concat('%',#{applierName}, '%')
+            </if>
+            <if test="invoiceName != null  and invoiceName != ''">
+                AND t4.user_name like concat('%',#{invoiceName}, '%')
+            </if>
+            <if test="status != null ">AND t1.status = #{status}</if>
+            <if test="dateFilter!= null and dateFilter.size() ">
+                AND (
+                DATE_FORMAT(t1.applier_time,'%Y-%m-%d') &gt;= #{dateFilter[0]}
+                AND
+                DATE_FORMAT(t1.applier_time,'%Y-%m-%d') &lt;= #{dateFilter[1]}
+                )
+            </if>
+            <if test="invoiceDateFilter!= null and invoiceDateFilter.size() ">
+                AND(
+                DATE_FORMAT(t1.invoice_time,'%Y-%m-%d') &gt;= #{invoiceDateFilter[0]}
+                AND
+                DATE_FORMAT(t1.invoice_time,'%Y-%m-%d') &lt;= #{invoiceDateFilter[1]}
+                )
+            </if>
         </trim>
+        order by t1.create_time DESC
     </select>
 
     <delete id="physicalDelete">
@@ -36,7 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="id != null">
                 id = #{id} AND
             </if>
-       <!-- 删除条件为其他外键可以在这里加 -->
+            <!-- 删除条件为其他外键可以在这里加 -->
         </trim>
     </delete>
 </mapper>