Explorar o código

发票添加导出功能

user5 %!s(int64=2) %!d(string=hai) anos
pai
achega
eccb50b7cb

+ 4 - 4
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/contractRegistration/service/ContractFilePaperService.java

@@ -83,13 +83,13 @@ public class ContractFilePaperService {
         file.setUpdateBy(userDTO.getId());
         file.setUpdateDate(new Date());
         mapper.updateById(file);
-        /*List<WorkAttachmentDto> list = filePaper.getContractInfoList();
+        List<WorkAttachmentDto> list = filePaper.getContractProperList();
         if (CollectionUtils.isNotEmpty(list)) {
             updateFiles(list, userDTO, file.getId());
         }else {
             //删除文件信息
             mapper.deleteFileInfo(file.getId());
-        }*/
+        }
         return file.getId();
     }
 
@@ -109,10 +109,10 @@ public class ContractFilePaperService {
         file.setUpdateBy(userDTO.getId());
         file.setUpdateDate(new Date());
         mapper.insert(file);
-        /*List<WorkAttachmentDto> list = filePaper.getContractInfoList();
+        List<WorkAttachmentDto> list = filePaper.getContractProperList();
         if (CollectionUtils.isNotEmpty(list)) {
             saveFiles(list, userDTO, id);
-        }*/
+        }
         return id;
     }
 

+ 12 - 8
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/contractRegistration/service/ContractInfoService.java

@@ -99,20 +99,24 @@ public class ContractInfoService {
 
         //条件查询list
         //1、合同编号
-        if (StringUtils.isNotEmpty(info.getContractNo())) {
+        if (StringUtils.isNotBlank(info.getContractNo())) {
             wrapper.like("a.contract_no", info.getContractNo());
         }
+        //案卷号
+        if (StringUtils.isNotBlank(info.getFiledNo())) {
+            wrapper.like("h.filed_no", info.getFiledNo());
+        }
         //2、合同名称
-        if (StringUtils.isNotEmpty(info.getContractName())) {
+        if (StringUtils.isNotBlank(info.getContractName())) {
             wrapper.like("a.contract_name", info.getContractName());
         }
         //3、合同金额(区间)
         String[] contractAmounts = info.getContractAmounts();
         if (contractAmounts != null) {
-            if (StringUtils.isNotEmpty(contractAmounts[0])) {
+            if (StringUtils.isNotBlank(contractAmounts[0])) {
                 wrapper.ge("a.contract_amount",contractAmounts[0]);
             }
-            if (StringUtils.isNotEmpty(contractAmounts[1])) {
+            if (StringUtils.isNotBlank(contractAmounts[1])) {
                 wrapper.le("a.contract_amount", contractAmounts[1]);
             }
         }
@@ -123,11 +127,11 @@ public class ContractInfoService {
             wrapper.between("a.signing_date", contractDates[0], contractDates[1]);
         }
         //5、创建人
-        if (StringUtils.isNotEmpty(info.getCreateBy())) {
+        if (StringUtils.isNotBlank(info.getCreateBy())) {
             wrapper.like("c.`id`", info.getCreateBy());
         }
         //6、所属部门
-        if (StringUtils.isNotEmpty(info.getDepartment())) {
+        if (StringUtils.isNotBlank(info.getDepartment())) {
             //先根据id查出是否是父节点,是父节点则查出所有的子节点信息
             List<String> childIds = mapper.findChildIds(info.getDepartment());
             if ( null != childIds & childIds.size()>0){
@@ -149,11 +153,11 @@ public class ContractInfoService {
             }
         }
         //8、归档状态
-        if (StringUtils.isNotEmpty(info.getFiledType())) {
+        if (StringUtils.isNotBlank(info.getFiledType())) {
             wrapper.like("a.filed_type", info.getFiledType());
         }
         //纸质归档
-        if (StringUtils.isNotEmpty(info.getFiledPaperType())) {
+        if (StringUtils.isNotBlank(info.getFiledPaperType())) {
             wrapper.like("a.filed_paper_type", info.getFiledPaperType());
         }
         //委托方名称

+ 3 - 2
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/invoice/mapper/xml/CwFinanceInvoiceMapper.xml

@@ -233,7 +233,8 @@
         FROM cw_finance_invoice_base wipr1
         LEFT JOIN cw_project_records rpr1 ON wipr1.program_id = rpr1.id
         WHERE wipr1.invoice_id = fi.id) as programName,
-        cfid.number as "number"
+        cfid.number as "number",
+        cfid.account as "accountDetail"
         from cw_finance_invoice fi
         left join cw_finance_invoice_detail cfid on cfid.invoice_id = fi.id
         left join sys_user su on fi.create_by = su.id and su.del_flag = '0'
@@ -241,7 +242,7 @@
         left join sys_office so on su.office_id = so.id and so.del_flag = '0'
         ${ew.customSqlSegment}
         ORDER BY
-        fi.create_date DESC
+        fi.create_date DESC, cfid.number asc
     </select>
 
     <select id="queryById" resultMap="BaseResultMap">

+ 7 - 1
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/invoice/service/dto/CwFinanceInvoiceDTO.java

@@ -59,10 +59,16 @@ public class CwFinanceInvoiceDTO extends BaseDTO {
     private String number;
 
     /**
+     * 开票金额(元)
+     */
+    @Excel(name = "开票金额(元)",width = 16,type = 10)
+    private String account;
+
+    /**
      * 发票金额(元)
      */
     @Excel(name = "发票金额(元)",width = 16,type = 10)
-    private String account;
+    private String accountDetail;
 
     /**
      * 开票内容

+ 1 - 1
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/projectReport/mapper/xml/ProjectReportWorkAttachmentMapper.xml

@@ -25,7 +25,7 @@
 
         select a.* from work_attachment a
         left join cw_project_report_file cf on cf.report_file_id = a.id
-        where a.attachment_id = #{id} and cf.seal_type = 1
+        where a.attachment_id = #{id} and cf.seal_type = 1 and a.del_flag = 0
     </select>
     <select id="getFileId" resultType="java.lang.String">
         select id from cw_project_report_file where report_file_id = #{id}

+ 28 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/finance/invoice/controller/FinanceInvoiceController.java

@@ -9,10 +9,13 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.jeeplus.aop.demo.annotation.DemoMode;
 import com.jeeplus.aop.logging.annotation.ApiLog;
 import com.jeeplus.common.utils.ResponseUtil;
+import com.jeeplus.core.excel.ExcelOptions;
+import com.jeeplus.core.excel.ExportMode;
 import com.jeeplus.core.excel.utils.EasyPoiUtil;
 import com.jeeplus.sys.constant.enums.LogTypeEnum;
 import com.jeeplus.sys.domain.Office;
 import com.jeeplus.sys.utils.StringUtils;
+import com.jeeplus.test.cw.invoice.service.dto.CwFinanceInvoiceDTO;
 import com.jeeplus.test.finance.invoice.domain.FinanceInvoice;
 import com.jeeplus.test.finance.invoice.domain.FinanceInvoiceDetail;
 import com.jeeplus.test.finance.invoice.service.FinanceInvoiceService;
@@ -285,4 +288,29 @@ public class FinanceInvoiceController {
 //        List<FinanceInvoiceDTO> infos = financeInvoiceService.exportList(page,financeInvoiceDTO);
 //        EasyPoiUtil.exportExcel(infos, "发票列表数据",  "发票列表数据", FinanceInvoiceDTO.class, "发票数据导出", response );
 //    }
+
+
+
+    @ApiLog(value = "导出发票数据", type = LogTypeEnum.EXPORT)
+    @GetMapping("export")
+    // @PreAuthorize ("hasAuthority('finance:invoice:export')")
+    @ApiOperation(value = "导出发票数据")
+    public void exportFile(FinanceInvoiceDTO financeInvoiceDTO, Page <FinanceInvoiceDTO> page, ExcelOptions options, HttpServletResponse response) throws Exception {
+        String fileName = options.getFilename();
+        String sheetName = options.getSheetName();
+        List<FinanceInvoiceDTO> result = new ArrayList<>();
+        if ( ExportMode.current.equals ( options.getMode() ) ) {
+            result = financeInvoiceService.findList (page,financeInvoiceDTO).getRecords();
+        } else if (ExportMode.selected.equals ( options.getMode() )) {
+            result = financeInvoiceService.findList (page,financeInvoiceDTO).getRecords().stream ( ).filter ( item ->
+                    options.getSelectIds ( ).contains ( item.getId ( ) )
+            ).collect ( Collectors.toList ( ) );
+        } else {
+            page.setSize (-1);
+            page.setCurrent (0);
+            result = financeInvoiceService.findList (page,financeInvoiceDTO).getRecords();
+        }
+        EasyPoiUtil.exportExcel ( result, sheetName,  sheetName, FinanceInvoiceDTO.class, fileName, response );
+
+    }
 }

+ 14 - 1
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/finance/invoice/mapper/xml/FinanceInvoiceMapper.xml

@@ -189,11 +189,24 @@
 
     <select id="findList" resultMap="BaseResultMap">
         select
+        DISTINCT
         <include refid="Base_Column_List"></include>,
         su.name as operator,
-        so.name as operator_office
+        so.name as operator_office,
+        (select
+        CASE
+        WHEN RIGHT( GROUP_CONCAT(case when program_id is null then 2 else 1 end),1) =2 THEN GROUP_CONCAT(concat('其他:',wipr1.program_name))
+        WHEN RIGHT( GROUP_CONCAT(case when program_id is null then 2 else 1 end),1) =1 THEN GROUP_CONCAT(rpr1.name)
+        ELSE '' END
+        FROM finance_invoice_base wipr1
+        LEFT JOIN program_project_list_info rpr1 ON wipr1.program_id = rpr1.id
+        WHERE wipr1.invoice_id = fi.id) as programName,
+        cfid.number as "number",
+        cfid.account as "accountDetail"
         from finance_invoice fi
+        left join finance_invoice_detail cfid on cfid.invoice_id = fi.id
         left join sys_user su on fi.create_by = su.id and su.del_flag = '0'
+        left join sys_user_manage_office sumo on sumo.office_id = su.office_id
         left join sys_office so on su.office_id = so.id and so.del_flag = '0'
         ${ew.customSqlSegment}
     </select>

+ 86 - 82
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/finance/invoice/service/dto/FinanceInvoiceDTO.java

@@ -30,30 +30,106 @@ public class FinanceInvoiceDTO extends BaseDTO {
     private String remarks;
 
     /**
-     * 发票类型
-     */
-    @Excel(name = "发票类型", orderNum = "0", width = 30)
-    private String type;
-
-    /**
      * 发票申请编号
      */
     @Excel(name = "发票申请编号", orderNum = "0", width = 30)
     private String no;
 
     /**
-     * 开票类型
+     * 项目名称
      */
-    @Excel(name = "开票类型", orderNum = "0", width = 30)
-    private String billingType;
+    @Excel(name = "项目名称",width = 25)
+    private String programName;
 
     /**
      * 实际开票单位
      */
-    @Excel(name = "实际开票单位", orderNum = "0", width = 30)
+    @Excel(name = "实际开票单位",width = 25)
     private String billingWorkplaceReal;
 
     /**
+     * 经办人
+     */
+    @Excel(name = "经办人",width = 16)
+    private String operator;
+
+    /**
+     * 经办人部门
+     */
+    @Excel(name = "经办人部门",width = 16)
+    private String operatorOffice;
+
+    /**
+     * 发票号
+     */
+    @Excel(name = "发票号",width = 16)
+    private String number;
+
+    /**
+     * 开票金额(元)
+     */
+    @Excel(name = "开票金额(元)",width = 16,type = 10)
+    private String account;
+
+    /**
+     * 发票金额(元)
+     */
+    @Excel(name = "发票金额(元)",width = 16,type = 10)
+    private String accountDetail;
+
+    /**
+     * 开票内容
+     */
+    @Excel(name = "开票内容",width = 30,dict = "invoice_billing_content")
+    private String billingContent;
+
+    /**
+     * 发票类型
+     */
+    @Excel(name = "发票类型",width = 20,dict = "invoice_type")
+    private String type;
+
+    /**
+     * 开票时间
+     */
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
+    @Excel(name = "开票日期",width = 20,exportFormat = "yyyy-MM-dd")
+    private Date billingDate;
+
+    /**
+     * 状态
+     */
+    @Excel(name = "开票状态",width = 20,dict = "invoice_status")
+    private String status;
+
+    /**
+     * 收款日期
+     */
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
+    @Excel(name = "收款日期",width = 20,exportFormat = "yyyy-MM-dd")
+    private Date receivablesDate;
+
+    /**
+     * 是否确认收款
+     */
+    @Excel(name = "是否确认收款",width = 14, replace = {"是_1", "否_0"})
+    private String receivablesStatus;
+
+    /**
+     * 领票时间
+     */
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
+    private Date collectDate;
+
+    /**
+     * 开票类型
+     */
+    private String billingType;
+
+    /**
      * 纳税人识别号
      */
     private String taxpayerIdentificationNo;
@@ -86,20 +162,8 @@ public class FinanceInvoiceDTO extends BaseDTO {
     /**
      * 收款类型
      */
-    @Excel(name = "收款类型", orderNum = "0", width = 30)
     private String receivablesType;
 
-    /**
-     * 开票内容
-     */
-    @Excel(name = "开票内容", orderNum = "0", width = 30)
-    private String billingContent;
-
-    /**
-     * 发票金额(元)
-     */
-    @Excel(name = "发票金额(元)", orderNum = "0", width = 30)
-    private String account;
 
     /**
      * 开票内容要求
@@ -112,21 +176,6 @@ public class FinanceInvoiceDTO extends BaseDTO {
     private String billingPeople;
 
     /**
-     * 开票时间
-     */
-    @Excel(name = "开票时间", orderNum = "0", width = 30)
-    @DateTimeFormat(pattern = "yyyy-MM-dd")
-    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
-    private Date billingDate;
-
-    /**
-     * 领票时间
-     */
-    @DateTimeFormat(pattern = "yyyy-MM-dd")
-    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
-    private Date collectDate;
-
-    /**
      * 实际开票人
      */
     private String billingPeopleReal;
@@ -157,12 +206,6 @@ public class FinanceInvoiceDTO extends BaseDTO {
     private String billingPeopleId;
 
     /**
-     * 状态
-     */
-    @Excel(name = "状态", orderNum = "0", width = 30)
-    private String status;
-
-    /**
      * 流程id
      */
     private String procInsId;
@@ -173,26 +216,11 @@ public class FinanceInvoiceDTO extends BaseDTO {
     private String processDefinitionId;
 
     /**
-     * 是否确认收款
-     */
-    @Excel(name = "是否确认收款", orderNum = "0", width = 30)
-    private String receivablesStatus;
-
-    /**
      * 是否作废
      */
-    @Excel(name = "是否作废", orderNum = "0", width = 30)
     private String invalidStatus;
 
     /**
-     * 收款日期
-     */
-    @Excel(name = "收款日期", orderNum = "0", width = 30)
-    @DateTimeFormat(pattern = "yyyy-MM-dd")
-    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
-    private Date receivablesDate;
-
-    /**
      * 基础信息
      */
     private List<FinanceInvoiceBaseDTO> financeInvoiceBaseDTOList;
@@ -218,12 +246,6 @@ public class FinanceInvoiceDTO extends BaseDTO {
     private FinanceInvoiceInvalidDTO financeInvoiceInvalidDTO;
 
     /**
-     * 发票号
-     */
-    @Excel(name = "发票号", orderNum = "0", width = 30)
-    private String number;
-
-    /**
      * 开票总金额 Begin
      */
     private String accountBegin;
@@ -254,27 +276,9 @@ public class FinanceInvoiceDTO extends BaseDTO {
     private String remittanceDateEnd;
 
     /**
-     * 项目名称
-     */
-    @Excel(name = "项目名称", orderNum = "0", width = 30)
-    private String programName;
-
-    /**
      * 项目id
      */
     private String programId;
 
-    /**
-     * 经办人
-     */
-    @Excel(name = "经办人", orderNum = "0", width = 30)
-    private String operator;
-
-    /**
-     * 经办人部门
-     */
-    @Excel(name = "经办人部门", orderNum = "0", width = 30)
-    private String operatorOffice;
-
     private static final long serialVersionUID = 1L;
 }

+ 8 - 1
jeeplus-platform/jeeplus-admin/src/main/java/com/jeeplus/sys/controller/UserController.java

@@ -183,8 +183,15 @@ public class UserController {
                             companyId = split[2];
                             // 根据公司id,找到此公司下的所有部门
                             List<Office> officeList = officeService.list(new QueryWrapper<Office>().lambda().eq(Office::getParentId, companyId));
+                            Set officeIdSet = new HashSet();
+                            for (Office office : officeList) {
+                                if(StringUtils.isNotBlank(office.getId())){
+                                    officeIdSet.add(office.getId());
+                                }
+                            }
+                            List<String> officeIdList = Lists.newArrayList(officeIdSet);
                             // 拿到这些部门的id
-                            List<String> officeIdList = officeList.stream().distinct().map(Office::getId).collect(Collectors.toList());
+                            //List<String> officeIdList = officeList.stream().distinct().map(Office::getId).collect(Collectors.toList());
                             // 拿到所有公有部门的id
                             List<String> officePublicIdList = officeService.list(new LambdaQueryWrapper<Office>().eq(Office::getIsPublic,"1")).stream().map(Office::getId).collect(Collectors.toList());
                             // 拿到直属公司的id