Browse Source

开票管理

sangwenwei 1 year ago
parent
commit
1189878fc1
48 changed files with 5052 additions and 7 deletions
  1. 0 2
      jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/borrow/controller/BorrowController.java
  2. 0 2
      jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/borrow/service/BorrowService.java
  3. 399 0
      jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/controller/CwFinanceInvoiceController.java
  4. 200 0
      jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/domain/JyFinanceInvoice.java
  5. 58 0
      jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/domain/JyFinanceInvoiceBase.java
  6. 63 0
      jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/domain/JyFinanceInvoiceDetail.java
  7. 43 0
      jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/domain/JyFinanceInvoiceInvalid.java
  8. 50 0
      jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/domain/JyFinanceInvoiceReceivables.java
  9. 95 0
      jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/domain/SealUserInfo.java
  10. 14 0
      jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/mapper/JyFinanceInvoiceBaseMapper.java
  11. 14 0
      jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/mapper/JyFinanceInvoiceDetailMapper.java
  12. 15 0
      jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/mapper/JyFinanceInvoiceInvalidMapper.java
  13. 49 0
      jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/mapper/JyFinanceInvoiceMapper.java
  14. 14 0
      jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/mapper/JyFinanceInvoiceReceivablesMapper.java
  15. 36 0
      jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/mapper/xml/JyFinanceInvoiceBaseMapper.xml
  16. 42 0
      jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/mapper/xml/JyFinanceInvoiceDetailMapper.xml
  17. 34 0
      jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/mapper/xml/JyFinanceInvoiceInvalidMapper.xml
  18. 420 0
      jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/mapper/xml/JyFinanceInvoiceMapper.xml
  19. 36 0
      jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/mapper/xml/JyFinanceInvoiceReceivablesMapper.xml
  20. 673 0
      jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/service/JyFinanceInvoiceService.java
  21. 9 0
      jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/service/dto/JyFinanceDTO.java
  22. 61 0
      jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/service/dto/JyFinanceInvoiceBaseDTO.java
  23. 345 0
      jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/service/dto/JyFinanceInvoiceDTO.java
  24. 71 0
      jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/service/dto/JyFinanceInvoiceDetailDTO.java
  25. 42 0
      jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/service/dto/JyFinanceInvoiceInvalidDTO.java
  26. 51 0
      jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/service/dto/JyFinanceInvoiceReceivablesDTO.java
  27. 15 0
      jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/service/mapstruct/JyFinanceInvoiceBaseWrapper.java
  28. 15 0
      jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/service/mapstruct/JyFinanceInvoiceDetailWrapper.java
  29. 15 0
      jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/service/mapstruct/JyFinanceInvoiceInvalidWrapper.java
  30. 15 0
      jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/service/mapstruct/JyFinanceInvoiceReceivablesWrapper.java
  31. 15 0
      jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/service/mapstruct/JyFinanceInvoiceWrapper.java
  32. 323 0
      jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/util/EasyPoiUtil.java
  33. 75 0
      jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/util/ExcelDiceAddressListHandlerImpl.java
  34. 34 0
      jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/util/FlowTaskUtil.java
  35. 25 0
      jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/util/FreemarkerUtil.java
  36. 501 0
      jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/util/Global.java
  37. 154 0
      jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/util/PropertiesLoader.java
  38. 61 0
      jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/util/ResponseUtil.java
  39. 818 0
      jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/util/SignaturePostUtil.java
  40. 1 1
      jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/inscription/controller/InscriptionController.java
  41. 1 1
      jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/monthly/controller/MonthlyController.java
  42. 1 1
      jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/project/controller/JyProjectController.java
  43. 8 0
      jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/workClientInfo/controller/JyWorkClientController.java
  44. 6 0
      jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/workClientInfo/domain/JyWorkClientInfo.java
  45. 2 0
      jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/workClientInfo/mapper/JyWorkClientInfoMapper.java
  46. 13 0
      jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/workClientInfo/mapper/xml/JyWorkClientInfoMapper.xml
  47. 18 0
      jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/workClientInfo/service/JyWorkClientService.java
  48. 102 0
      jeeplus-modules/jeeplus-flowable/src/main/java/com/jeeplus/modules/flowable/listener/FinanceListener.java

+ 0 - 2
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/borrow/controller/BorrowController.java

@@ -6,8 +6,6 @@ import com.jeeplus.business.borrow.domain.BorrowMoney;
 import com.jeeplus.business.borrow.service.BorrowService;
 import com.jeeplus.business.borrow.service.BorrowService;
 import com.jeeplus.business.borrow.service.dto.BorrowDTO;
 import com.jeeplus.business.borrow.service.dto.BorrowDTO;
 import com.jeeplus.business.borrow.service.dto.RefundDTO;
 import com.jeeplus.business.borrow.service.dto.RefundDTO;
-import com.jeeplus.business.drive.service.dto.DriveApplyDTO;
-import com.jeeplus.business.goOut.service.dto.GoOutDTO;
 import com.jeeplus.common.utils.ResponseUtil;
 import com.jeeplus.common.utils.ResponseUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;

+ 0 - 2
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/borrow/service/BorrowService.java

@@ -10,7 +10,6 @@ import com.jeeplus.business.borrow.mapper.BorrowMapper;
 import com.jeeplus.business.borrow.mapper.RefundMapper;
 import com.jeeplus.business.borrow.mapper.RefundMapper;
 import com.jeeplus.business.borrow.service.dto.BorrowDTO;
 import com.jeeplus.business.borrow.service.dto.BorrowDTO;
 import com.jeeplus.business.borrow.service.dto.RefundDTO;
 import com.jeeplus.business.borrow.service.dto.RefundDTO;
-import com.jeeplus.business.project.service.dto.JyProjectDTO;
 import com.jeeplus.business.reimbursement.domain.JyReimbursementDetailInfoBorrow;
 import com.jeeplus.business.reimbursement.domain.JyReimbursementDetailInfoBorrow;
 import com.jeeplus.business.reimbursement.mapper.JyReimbursementInfoBorrowMapper;
 import com.jeeplus.business.reimbursement.mapper.JyReimbursementInfoBorrowMapper;
 import com.jeeplus.common.TokenProvider;
 import com.jeeplus.common.TokenProvider;
@@ -19,7 +18,6 @@ import com.jeeplus.sys.feign.IUserApi;
 import com.jeeplus.sys.feign.IWorkAttachmentApi;
 import com.jeeplus.sys.feign.IWorkAttachmentApi;
 import com.jeeplus.sys.service.dto.UserDTO;
 import com.jeeplus.sys.service.dto.UserDTO;
 import com.jeeplus.utils.StringUtils;
 import com.jeeplus.utils.StringUtils;
-import org.apache.ibatis.javassist.runtime.Desc;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 

+ 399 - 0
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/controller/CwFinanceInvoiceController.java

@@ -0,0 +1,399 @@
+package com.jeeplus.business.finance.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.jeeplus.aop.demo.annotation.DemoMode;
+import com.jeeplus.business.finance.domain.JyFinanceInvoice;
+import com.jeeplus.business.finance.service.JyFinanceInvoiceService;
+import com.jeeplus.business.finance.service.dto.JyFinanceDTO;
+import com.jeeplus.business.finance.service.dto.JyFinanceInvoiceDTO;
+import com.jeeplus.business.finance.service.dto.JyFinanceInvoiceDetailDTO;
+import com.jeeplus.business.finance.util.EasyPoiUtil;
+import com.jeeplus.common.excel.ExcelOptions;
+import com.jeeplus.common.excel.annotation.ExportMode;
+import com.jeeplus.common.utils.ResponseUtil;
+
+import com.jeeplus.flowable.feign.IFlowableApi;
+import com.jeeplus.logging.annotation.ApiLog;
+import com.jeeplus.logging.constant.enums.LogTypeEnum;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.http.ResponseEntity;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.Valid;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.lang.reflect.Field;
+import java.lang.reflect.Type;
+import java.net.URLEncoder;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+//import com.jeeplus.sys.utils.DictUtils;
+//import com.jeeplus.sys.utils.SpringContextHolder;
+
+@Api("财务管理-发票")
+@RestController
+@RequestMapping(value = "/cw_finance/invoice")
+public class CwFinanceInvoiceController {
+
+    private static Logger log = LoggerFactory.getLogger(CwFinanceInvoiceController.class);
+
+    @Resource
+    private JyFinanceInvoiceService cwFinanceInvoiceService;
+
+    @Resource
+    private IFlowableApi flowTaskService;
+
+    /**
+     * 查询发票列表
+     * @param cwFinanceInvoiceDTO
+     * @param page
+     * @return
+     * @throws Exception
+     */
+    @ApiLog("查询发票列表")
+    @PreAuthorize("hasAuthority('cw_finance:invoice:list')")
+    @GetMapping("list")
+    public ResponseEntity<IPage<JyFinanceInvoiceDTO>> data(JyFinanceInvoiceDTO cwFinanceInvoiceDTO, Page<JyFinanceInvoiceDTO> page) throws Exception {
+        IPage<JyFinanceInvoiceDTO> result = new Page<JyFinanceInvoiceDTO>();
+        result = cwFinanceInvoiceService.findList (page, cwFinanceInvoiceDTO);
+        System.out.println("当前时间1:"+System.currentTimeMillis());
+        result.getRecords().stream().forEach(i -> {
+            // 发票申请
+            if (StringUtils.isNotBlank(i.getTaskId()) && StringUtils.isNotBlank(i.getStatus())) {
+                if ("2".equals(i.getStatus())) { // “审核中”的数据要获取数据审核人
+                    i.setAuditUserIds(flowTaskService.getTaskAuditUsers(i.getTaskId()));  // 获取数据审核人
+                }
+            }
+            // 发票作废
+            if (StringUtils.isNotBlank(i.getInvalidTaskId()) && StringUtils.isNotBlank(i.getStatus())) {
+                if ("6".equals(i.getStatus())) { // “审核中”的数据要获取数据审核人
+                    i.setAuditUserIdsInvalid(flowTaskService.getTaskAuditUsers(i.getInvalidTaskId()));  // 获取数据审核人
+                }
+            }
+        });
+        System.out.println("当前时间2:"+System.currentTimeMillis());
+        return ResponseEntity.ok (result);
+    }
+
+    /**
+     * 查询发票数据
+     * @param id
+     * @return
+     */
+    @ApiLog("查询发票数据")
+    @PreAuthorize ("hasAnyAuthority('cw_finance:invoice:view','cw_finance:invoice:add','cw_finance:invoice:edit')")
+    @GetMapping("queryById")
+    public ResponseEntity queryById(@RequestParam("id") String id) {
+        JyFinanceInvoiceDTO cwFinanceInvoiceDTO = cwFinanceInvoiceService.queryById ( id );
+        return ResponseEntity.ok (cwFinanceInvoiceDTO);
+    }
+
+    /**
+     * 查询发票号是否存在
+     * @param number
+     * @return
+     */
+    @ApiLog("查询发票号是否存在")
+    @GetMapping("queryByNumber")
+    public ResponseEntity queryByNumber(@RequestParam("number") String number, @RequestParam(value="id", required = false) String id) {
+        Boolean bool = cwFinanceInvoiceService.queryByNumber ( number, id );
+        return ResponseEntity.ok (bool);
+    }
+
+    /**
+     * 保存发票数据
+     * @param cwFinanceInvoiceDTO
+     * @return
+     */
+    @ApiLog(value = "修改/新增发票数据", type = LogTypeEnum.SAVE)
+    @PreAuthorize("hasAnyAuthority('cw_finance:invoice:add','cw_finance:invoice:edit')")
+    @PostMapping("save")
+    public ResponseEntity save(@Valid @RequestBody JyFinanceInvoiceDTO cwFinanceInvoiceDTO) throws Exception {
+        cwFinanceInvoiceService.saveInvoice(cwFinanceInvoiceDTO);
+        return ResponseEntity.ok ("操作成功");
+    }
+
+    /**
+     * 保存发票数据-流程
+     * @param cwFinanceInvoiceDTO
+     * @return
+     */
+    @ApiLog(value = "保存发票数据-流程", type = LogTypeEnum.SAVE)
+    @PreAuthorize("hasAnyAuthority('cw_finance:invoice:add','cw_finance:invoice:edit')")
+    @PostMapping("saveForm")
+    public ResponseEntity saveForm(@Valid @RequestBody JyFinanceInvoiceDTO cwFinanceInvoiceDTO) throws Exception {
+        JyFinanceInvoice cwFinanceInvoice = cwFinanceInvoiceService.saveForm(cwFinanceInvoiceDTO);
+        return ResponseUtil.newInstance().add("businessTable", "jy_finance_invoice")
+                .add("businessId", cwFinanceInvoice.getId())
+                .add("recordType",cwFinanceInvoice.getRecordType())
+                .add("no", cwFinanceInvoice.getNo())
+                .ok ("操作成功");
+    }
+
+    /**
+     * 作废发票数据-流程
+     * @param cwFinanceInvoiceDTO
+     * @return
+     */
+    @ApiLog(value = "作废发票数据-流程", type = LogTypeEnum.SAVE)
+    @PreAuthorize("hasAnyAuthority('cw_finance:invoice:add','cw_finance:invoice:edit')")
+    @PostMapping("saveFormInvalid")
+    public ResponseEntity saveFormInvalid(@Valid @RequestBody JyFinanceInvoiceDTO cwFinanceInvoiceDTO) throws Exception {
+        String id = cwFinanceInvoiceService.saveFormInvalid(cwFinanceInvoiceDTO);
+        return ResponseUtil.newInstance().add("businessTable", "jy_finance_invoice_invalid").add("businessId", id).ok ("操作成功");
+    }
+
+    /**
+     * 根据发票作废数据的id查询发票id
+     * @param id
+     * @return
+     */
+    @GetMapping("queryIdByInvalidId")
+    @ApiOperation(value = "查询发票号是否存在")
+    public ResponseEntity<JyFinanceDTO> queryIdByInvalidId(@RequestParam String id) {
+        String businessId = cwFinanceInvoiceService.queryIdByInvalidId ( id );
+        JyFinanceDTO cwFinanceDTO = new JyFinanceDTO();
+        cwFinanceDTO.setBusinessId(businessId);
+        return ResponseEntity.ok(cwFinanceDTO);
+    }
+
+    /**
+     * 删除附件类型
+     * @param ids
+     * @return
+     */
+    @ApiLog(value = "删除附件类型", type = LogTypeEnum.SAVE)
+    @PreAuthorize ("hasAuthority('cw_finance:invoice:del')")
+    @DeleteMapping("delete")
+    public ResponseEntity delete(String ids) {
+        return cwFinanceInvoiceService.deleteByIds(ids);
+    }
+
+    /**
+     * 根据id修改状态值status
+     * @param dto
+     * @return
+     */
+    @ApiOperation(value = "根据id修改状态值status")
+    @PostMapping(value = "/updateStatusById")
+    public ResponseEntity<String> updateStatusById(@RequestBody JyFinanceInvoiceDTO dto) {
+        String s = cwFinanceInvoiceService.updateStatusById(dto);
+        return ResponseEntity.ok(s);
+    }
+
+    /**
+     * 确认收款
+     * @param dto
+     * @return
+     */
+    @ApiOperation(value = "确认收款")
+    @PostMapping(value = "/isReceivables")
+    public ResponseEntity<String> isReceivables(@RequestBody JyFinanceInvoiceDTO dto) {
+        String s = cwFinanceInvoiceService.isReceivables(dto);
+        return ResponseEntity.ok(s);
+    }
+
+    /**
+     * 下载发票明细导入模板
+     *
+     * @param response
+     * @return
+     */
+    @GetMapping("/importDetail/template")
+    @ApiOperation(value = "下载模板")
+    public void importFileTemplate(HttpServletResponse response, HttpServletRequest request) {
+        try {
+            InputStream inputStream = this.getClass().getResourceAsStream("/dot/发票明细导入模板.xlsx");
+            //强制下载不打开
+            response.setContentType("application/force-download");
+            OutputStream out = response.getOutputStream();
+            //使用URLEncoder来防止文件名乱码或者读取错误
+            response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode("finance_invoice_detail_template.xlsx", "UTF-8"));
+            int b = 0;
+            byte[] buffer = new byte[1000000];
+            while (b != -1) {
+                b = inputStream.read(buffer);
+                if (b != -1) out.write(buffer, 0, b);
+            }
+            inputStream.close();
+            out.close();
+            out.flush();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 导入发票明细数据
+     *
+     * @return
+     */
+    @DemoMode
+    @PostMapping("/importDetail")
+    @ApiLog(value = "导入发票明细数据excel", type = LogTypeEnum.IMPORT)
+    public ResponseEntity importDetail(MultipartFile file, HttpServletRequest request) throws IOException {
+
+        ArrayList<JyFinanceInvoiceDetailDTO> arrayList = new ArrayList<>();
+        HashMap<String,String> hashMap = new HashMap<>();
+
+        List<JyFinanceInvoiceDetailDTO> listA = new ArrayList<>();
+        //获取sheet
+        listA = EasyPoiUtil.importExcel(file, 0, 1, JyFinanceInvoiceDetailDTO.class);
+        //去除excel中的空行
+        listA = getExcelList(listA);
+        //导入前检测数据
+        String resultA = cwFinanceInvoiceService.importDecide(listA, arrayList, hashMap);
+        if(StringUtils.isNotBlank(resultA)){
+            //有返回值,说明导入的数据不正确。向用户抛提示
+            return ResponseEntity.badRequest().body  (resultA);
+        }
+        //判断文件中是否有重复的发票号
+        if(hashMap.size() != listA.size()){
+            return ResponseEntity.badRequest().body  ("文件中存在重复的发票号");
+        }
+
+        return ResponseEntity.ok(arrayList);
+    }
+
+    /**
+     * 去除excel中的空行
+     * @param list
+     * @return
+     */
+    public ArrayList<JyFinanceInvoiceDetailDTO> getExcelList(List<JyFinanceInvoiceDetailDTO> list){
+
+        ArrayList<JyFinanceInvoiceDetailDTO> cwFinanceInvoiceDetailDTOS = new ArrayList<>();
+
+        list.stream().forEach(item->{
+            if(objectCheckIsNull(item)){
+                cwFinanceInvoiceDetailDTOS.add(item);
+            }
+        });
+
+        return cwFinanceInvoiceDetailDTOS;
+    }
+
+    /**
+     * 根据项目id查询项目关联发票
+     * @param projectId
+     * @param cwFinanceInvoiceDTO
+     * @return
+     * @throws Exception
+     */
+    @GetMapping("getByIds")
+    @ApiOperation(value = "根据项目id查询项目关联发票")
+    public ResponseEntity<List<JyFinanceInvoiceDTO>> getByIds(String projectId,JyFinanceInvoiceDTO cwFinanceInvoiceDTO) throws Exception {
+        List<JyFinanceInvoiceDTO> cwFinanceDTO = cwFinanceInvoiceService.getByIds(projectId, cwFinanceInvoiceDTO);
+        return ResponseEntity.ok(cwFinanceDTO);
+    }
+
+    /**
+     * 根据合同id查询项目关联发票
+     * @param contractId
+     * @param cwFinanceInvoiceDTO
+     * @return
+     * @throws Exception
+     */
+    @GetMapping("getByContractId")
+    @ApiOperation(value = "根据合同id查询项目关联发票")
+    public ResponseEntity<List<JyFinanceInvoiceDTO>> getByContractId(String contractId,JyFinanceInvoiceDTO cwFinanceInvoiceDTO) throws Exception {
+        List<JyFinanceInvoiceDTO> cwFinanceDTO = cwFinanceInvoiceService.getByContractId(contractId, cwFinanceInvoiceDTO);
+        return ResponseEntity.ok(cwFinanceDTO);
+    }
+
+    /**
+     * 根据客户id查询项目关联发票
+     * @param clientId
+     * @param cwFinanceInvoiceDTO
+     * @return
+     * @throws Exception
+     */
+    @GetMapping("getIdByClientId")
+    @ApiOperation(value = "根据客户id查询项目关联发票")
+    public ResponseEntity<List<JyFinanceInvoiceDTO>> getIdByClientId(String clientId,JyFinanceInvoiceDTO cwFinanceInvoiceDTO) throws Exception {
+        List<JyFinanceInvoiceDTO> cwFinanceDTO = cwFinanceInvoiceService.getIdByClientId(clientId, cwFinanceInvoiceDTO);
+        return ResponseEntity.ok(cwFinanceDTO);
+    }
+
+    @ApiLog(value = "导出发票数据", type = LogTypeEnum.EXPORT)
+    @GetMapping("export")
+    //@PreAuthorize ("hasAuthority('cw_finance:invoice:export')")
+    @ApiOperation(value = "导出发票数据")
+    public void exportFile(JyFinanceInvoiceDTO cwFinanceInvoiceDTO, Page <JyFinanceInvoiceDTO> page, ExcelOptions options, HttpServletResponse response) throws Exception {
+        String fileName = options.getFilename();
+        String sheetName = options.getSheetName();
+        List<JyFinanceInvoiceDTO> result = new ArrayList<>();
+        if ( ExportMode.current.equals ( options.getMode() ) ) {
+            result = cwFinanceInvoiceService.findList (page,cwFinanceInvoiceDTO).getRecords();
+        } else if (ExportMode.selected.equals ( options.getMode() )) {
+            result = cwFinanceInvoiceService.findList (page,cwFinanceInvoiceDTO).getRecords().stream ( ).filter ( item ->
+                    options.getSelectIds ( ).contains ( item.getId ( ) )
+            ).collect ( Collectors.toList ( ) );
+        } else {
+            page.setSize (-1);
+            page.setCurrent (0);
+            result = cwFinanceInvoiceService.findList (page,cwFinanceInvoiceDTO).getRecords();
+        }
+        EasyPoiUtil.exportExcel ( result, sheetName,  sheetName, JyFinanceInvoiceDTO.class, fileName, response );
+
+    }
+
+    public static boolean objectCheckIsNull(Object object) {
+        boolean flag = false; //定义返回结果,默认为true
+
+        if (Objects.isNull(object)) {
+            flag = false;
+        } else {
+            Class clazz = (Class) object.getClass(); // 得到类对象
+            Field fields[] = clazz.getDeclaredFields(); // 得到所有属性
+            for (Field field : fields) {
+                if("serialVersionUID".equals(field.getName()) || "BIZ_CODE".equalsIgnoreCase(field.getName())){
+                    continue;
+                }
+                field.setAccessible(true);
+                Object fieldValue = null;
+                try {
+                    fieldValue = field.get(object); //得到属性值
+                    Type fieldType = field.getGenericType();//得到属性类型
+                    String fieldName = field.getName(); // 得到属性名
+                    log.info("属性类型:" + fieldType + ",属性名:" + fieldName + ",属性值:" + fieldValue);
+                } catch (IllegalArgumentException e) {
+                    log.error(e.getMessage(), e);
+                } catch (IllegalAccessException e) {
+                    log.error(e.getMessage(), e);
+                }
+                if (fieldValue != null && fieldValue != "") {  //只要有一个属性值不为null 就返回false 表示对象不为null
+                    flag = true;
+                    break;
+                }
+            }
+        }
+
+        return flag;
+    }
+
+
+
+
+
+
+
+
+
+
+}

+ 200 - 0
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/domain/JyFinanceInvoice.java

@@ -0,0 +1,200 @@
+package com.jeeplus.business.finance.domain;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.jeeplus.core.domain.BaseEntity;
+import com.jeeplus.core.query.Query;
+import com.jeeplus.core.query.QueryType;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.Date;
+
+/**
+ * 财务管理-发票
+ * @TableName cw_finance_invoice
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@TableName("jy_finance_invoice")
+public class JyFinanceInvoice extends BaseEntity {
+
+    /**
+     * 备注信息
+     */
+    private String remarks;
+
+    /**
+     * 发票类型
+     */
+    @Query(tableColumn = "fi.type",type = QueryType.EQ)
+    private String type;
+
+    /**
+     * 发票申请编号
+     */
+    @Query(tableColumn = "fi.no",type = QueryType.LIKE)
+    private String no;
+
+    /**
+     * 开票类型
+     */
+    private String billingType;
+
+    /**
+     * 实际开票单位
+     */
+    @Query(tableColumn = "fi.billing_workplace_real",type = QueryType.LIKE)
+    private String billingWorkplaceReal;
+
+    /**
+     * 纳税人识别号
+     */
+    private String taxpayerIdentificationNo;
+
+    /**
+     * 地址
+     */
+    private String address;
+
+    /**
+     * 电话
+     */
+    private String telPhone;
+
+    /**
+     * 开户银行
+     */
+    private String openBank;
+
+    /**
+     * 银行账号
+     */
+    private String bankAccount;
+
+    /**
+     * 姓名
+     */
+    private String name;
+
+    /**
+     * 收款类型
+     */
+    @Query(tableColumn = "fi.receivables_type",type = QueryType.EQ)
+    private String receivablesType;
+
+    /**
+     * 开票内容
+     */
+    @Query(tableColumn = "fi.billing_content",type = QueryType.EQ)
+    private String billingContent;
+
+    /**
+     * 发票金额(元)
+     */
+    private String account;
+
+    /**
+     * 开票内容要求
+     */
+    private String billingContentTerms;
+
+    /**
+     * 开票人
+     */
+    private String billingPeople;
+
+    /**
+     * 开票时间
+     */
+    private Date billingDate;
+
+    /**
+     * 领票时间
+     */
+    private Date collectDate;
+
+    /**
+     * 实际开票人
+     */
+    private String billingPeopleReal;
+
+    /**
+     * 对账人
+     */
+    @Query(tableColumn = "fi.reconciliation_people",type = QueryType.EQ)
+    private String reconciliationPeople;
+
+    /**
+     * 实际开票单位id
+     */
+    @Query(tableColumn = "fi.billing_workplace_real_id",type = QueryType.EQ)
+    private String billingWorkplaceRealId;
+
+    /**
+     * 开票人id
+     */
+    private String billingPeopleId;
+
+    /**
+     * 对账地区
+     */
+    @Query(tableColumn = "fi.reconciliation_area",type = QueryType.EQ)
+    private String reconciliationArea;
+
+    /**
+     * 状态  待审核:2;通过:3;驳回:4
+     */
+    @Query(tableColumn = "fi.status",type = QueryType.EQ)
+    private String status;
+
+    /**
+     * 流程id
+     */
+    private String procInsId;
+
+    /**
+     * 流程信息
+     */
+    private String processDefinitionId;
+
+    /**
+     * 是否确认收款
+     */
+    @Query(tableColumn = "fi.receivables_status",type = QueryType.EQ)
+    private String receivablesStatus;
+
+    /**
+     * 是否作废
+     */
+    @Query(tableColumn = "fi.invalid_status",type = QueryType.EQ)
+    private String invalidStatus;
+
+    /**
+     * 收款日期
+     */
+    private Date receivablesDate;
+
+    /**
+     * 是否多张开票  1是  0否
+     */
+    private String isMultiple;
+
+    /**
+     * 实际开票单位的开票信息id
+     */
+    private String billingId;
+
+
+    /**
+     * 报备类型(其他)
+     */
+    private String reportType;
+
+    /**
+     * 基本信息中的类型(项目:1;报告:2;其他:0)
+     */
+    private String recordType;
+
+
+    private static final long serialVersionUID = 1L;
+}

+ 58 - 0
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/domain/JyFinanceInvoiceBase.java

@@ -0,0 +1,58 @@
+package com.jeeplus.business.finance.domain;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.jeeplus.core.domain.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.io.Serializable;
+
+/**
+ * 财务管理-发票基本信息
+ * @TableName cw_finance_invoice_base
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@TableName("jy_finance_invoice_base")
+public class JyFinanceInvoiceBase extends BaseEntity implements Serializable {
+
+    /**
+     * 发票id
+     */
+    private String invoiceId;
+
+    /**
+     * 项目id
+     */
+    private String programId;
+
+    /**
+     * 项目名称
+     */
+    private String programName;
+
+    /**
+     * 合同名称
+     */
+    private String contractName;
+
+    /**
+     * 项目编号
+     */
+    private String programNo;
+
+    /**
+     * 合同id
+     */
+    private String contractId;
+
+    private String account;
+    /**
+     * 类型 项目1,报告2,其他0
+     */
+    private String type;
+
+
+
+    private static final long serialVersionUID = 1L;
+}

+ 63 - 0
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/domain/JyFinanceInvoiceDetail.java

@@ -0,0 +1,63 @@
+package com.jeeplus.business.finance.domain;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.jeeplus.core.domain.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 财务管理-发票明细
+ * @TableName cw_finance_invoice_detail
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@TableName("jy_finance_invoice_detail")
+public class JyFinanceInvoiceDetail extends BaseEntity {
+
+    /**
+     * 备注信息
+     */
+    private String remarks;
+
+    /**
+     * 发票id
+     */
+    private String invoiceId;
+
+    /**
+     * 发票代码
+     */
+    private String code;
+
+    /**
+     * 发票号
+     */
+    private String number;
+
+    /**
+     * 开票金额(元)
+     */
+    private String account;
+
+    /**
+     * 税率
+     */
+    private String rate;
+
+    /**
+     * 金额
+     */
+    private String amount;
+
+    /**
+     * 税额
+     */
+    private String tax;
+
+    /**
+     * 累计登记金额
+     */
+    private String allAmount;
+
+    private static final long serialVersionUID = 1L;
+}

+ 43 - 0
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/domain/JyFinanceInvoiceInvalid.java

@@ -0,0 +1,43 @@
+package com.jeeplus.business.finance.domain;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.jeeplus.core.domain.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 财务管理-发票-发票作废
+ * @TableName cw_finance_invoice_invalid
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@TableName("jy_finance_invoice_invalid")
+public class JyFinanceInvoiceInvalid extends BaseEntity {
+
+    /**
+     * 备注信息
+     */
+    private String remarks;
+
+    /**
+     * 发票id
+     */
+    private String invoiceId;
+
+    /**
+     * 是否作废
+     */
+    private String invalidStatus;
+
+    /**
+     * 流程id
+     */
+    private String procInsId;
+
+    /**
+     * 流程信息
+     */
+    private String processDefinitionId;
+
+    private static final long serialVersionUID = 1L;
+}

+ 50 - 0
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/domain/JyFinanceInvoiceReceivables.java

@@ -0,0 +1,50 @@
+package com.jeeplus.business.finance.domain;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.jeeplus.core.domain.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.Date;
+
+/**
+ * 财务管理-发票-收款明细
+ * @TableName cw_finance_invoice_receivables
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@TableName("jy_finance_invoice_receivables")
+public class JyFinanceInvoiceReceivables extends BaseEntity {
+
+    /**
+     * 备注信息
+     */
+    private String remarks;
+
+    /**
+     * 发票id
+     */
+    private String invoiceId;
+
+    /**
+     * 汇款单位
+     */
+    private String remittanceUnit;
+
+    /**
+     * 汇款金额
+     */
+    private String remittanceAmount;
+
+    /**
+     * 汇款时间
+     */
+    private Date remittanceDate;
+
+    /**
+     * 是否收款
+     */
+    private String status;
+
+    private static final long serialVersionUID = 1L;
+}

+ 95 - 0
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/domain/SealUserInfo.java

@@ -0,0 +1,95 @@
+package com.jeeplus.business.finance.domain;
+
+import java.util.Date;
+
+/**
+ * 员工印章表
+ * @author: 徐滕
+ * @create: 2021-11-05 09:18
+ **/
+public class SealUserInfo {
+    private String id;  //印章ID
+    private String owner;   //公司ID
+    private String name;    //印章名称
+    private String otherName;   //印章别名
+    //private SealType type;    //签章类型
+    //private SealSpec spec;    //印章规格
+    private String sealKey; //印章图片key
+    private Date createTime; //创建时间
+    //private SealStatus status; //印章状态
+    private String useCount; //印章使用的次数
+    private String category; //印章类型:物理章,电子章
+    private String sealCategoryName; //印章分类名称
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getOwner() {
+        return owner;
+    }
+
+    public void setOwner(String owner) {
+        this.owner = owner;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getOtherName() {
+        return otherName;
+    }
+
+    public void setOtherName(String otherName) {
+        this.otherName = otherName;
+    }
+
+    public String getSealKey() {
+        return sealKey;
+    }
+
+    public void setSealKey(String sealKey) {
+        this.sealKey = sealKey;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public String getUseCount() {
+        return useCount;
+    }
+
+    public void setUseCount(String useCount) {
+        this.useCount = useCount;
+    }
+
+    public String getCategory() {
+        return category;
+    }
+
+    public void setCategory(String category) {
+        this.category = category;
+    }
+
+    public String getSealCategoryName() {
+        return sealCategoryName;
+    }
+
+    public void setSealCategoryName(String sealCategoryName) {
+        this.sealCategoryName = sealCategoryName;
+    }
+}

+ 14 - 0
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/mapper/JyFinanceInvoiceBaseMapper.java

@@ -0,0 +1,14 @@
+package com.jeeplus.business.finance.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.jeeplus.business.finance.domain.JyFinanceInvoiceBase;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface JyFinanceInvoiceBaseMapper extends BaseMapper<JyFinanceInvoiceBase> {
+
+}
+
+
+
+

+ 14 - 0
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/mapper/JyFinanceInvoiceDetailMapper.java

@@ -0,0 +1,14 @@
+package com.jeeplus.business.finance.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.jeeplus.business.finance.domain.JyFinanceInvoiceDetail;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface JyFinanceInvoiceDetailMapper extends BaseMapper<JyFinanceInvoiceDetail> {
+
+}
+
+
+
+

+ 15 - 0
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/mapper/JyFinanceInvoiceInvalidMapper.java

@@ -0,0 +1,15 @@
+package com.jeeplus.business.finance.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.jeeplus.business.finance.domain.JyFinanceInvoiceInvalid;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+//@InterceptorIgnore(tenantLine = "true")
+public interface JyFinanceInvoiceInvalidMapper extends BaseMapper<JyFinanceInvoiceInvalid> {
+
+}
+
+
+
+

+ 49 - 0
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/mapper/JyFinanceInvoiceMapper.java

@@ -0,0 +1,49 @@
+package com.jeeplus.business.finance.mapper;
+
+import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Constants;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.jeeplus.business.finance.domain.JyFinanceInvoice;
+
+import com.jeeplus.business.finance.service.dto.JyFinanceInvoiceDTO;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+@Mapper
+//@InterceptorIgnore(tenantLine = "true")
+public interface JyFinanceInvoiceMapper extends BaseMapper<JyFinanceInvoice> {
+
+    public IPage<JyFinanceInvoiceDTO> findList(Page<JyFinanceInvoiceDTO> page, @Param(Constants.WRAPPER) QueryWrapper<JyFinanceInvoice> queryWrapper);
+    @InterceptorIgnore(tenantLine = "true")
+    public JyFinanceInvoiceDTO queryById(@Param("id") String id);
+
+    public List<String> getIdByProjectId(@Param("id") String id);
+
+    public List<JyFinanceInvoiceDTO> getByIds(@Param(Constants.WRAPPER) QueryWrapper<JyFinanceInvoice> queryWrapper);
+
+    public List<String> getIdByContractId(@Param("id") String id);
+
+    public List<String> getIdByClientId(@Param("id") String id);
+
+    /**
+     * 根据发票id清空发票的收款日期
+     * @param id
+     */
+    void setReceivablesDateNull(@Param("id") String id);
+
+    /**
+     * 根据发票id清空发票的收款日期
+     * @param cwFinanceInvoice
+     */
+    @InterceptorIgnore(tenantLine = "true")
+    void updateInfoById(JyFinanceInvoice cwFinanceInvoice);
+}
+
+
+
+

+ 14 - 0
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/mapper/JyFinanceInvoiceReceivablesMapper.java

@@ -0,0 +1,14 @@
+package com.jeeplus.business.finance.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.jeeplus.business.finance.domain.JyFinanceInvoiceReceivables;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface JyFinanceInvoiceReceivablesMapper extends BaseMapper<JyFinanceInvoiceReceivables> {
+
+}
+
+
+
+

+ 36 - 0
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/mapper/xml/JyFinanceInvoiceBaseMapper.xml

@@ -0,0 +1,36 @@
+<?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.jeeplus.business.finance.mapper.JyFinanceInvoiceBaseMapper">
+
+    <resultMap id="BaseResultMap" type="com.jeeplus.business.finance.service.dto.JyFinanceInvoiceBaseDTO">
+            <id property="id" column="id" jdbcType="VARCHAR"/>
+            <result property="createBy.id" column="create_by" jdbcType="VARCHAR"/>
+            <result property="createTime" column="create_date" jdbcType="TIMESTAMP"/>
+            <result property="updateBy.id" column="update_by" jdbcType="VARCHAR"/>
+            <result property="updateTime" column="update_date" jdbcType="TIMESTAMP"/>
+            <result property="delFlag" column="del_flag" jdbcType="INTEGER"/>
+            <result property="invoiceId" column="invoice_id" jdbcType="VARCHAR"/>
+            <result property="programId" column="program_id" jdbcType="VARCHAR"/>
+            <result property="programName" column="program_name" jdbcType="VARCHAR"/>
+            <result property="contractName" column="contract_name" jdbcType="VARCHAR"/>
+            <result property="programNo" column="program_no" jdbcType="VARCHAR"/>
+            <result property="contractId" column="contract_id" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        fib.id,
+        fib.create_by,
+        fib.create_date,
+        fib.update_by,
+        fib.update_date,
+        fib.del_flag,
+        fib.invoice_id,
+        fib.program_id,
+        fib.program_name,
+        fib.contract_name,
+        fib.program_no,
+        fib.contract_id
+    </sql>
+</mapper>

+ 42 - 0
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/mapper/xml/JyFinanceInvoiceDetailMapper.xml

@@ -0,0 +1,42 @@
+<?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.jeeplus.business.finance.mapper.JyFinanceInvoiceDetailMapper">
+
+    <resultMap id="BaseResultMap" type="com.jeeplus.business.finance.service.dto.JyFinanceInvoiceDetailDTO">
+            <id property="id" column="id" jdbcType="VARCHAR"/>
+            <result property="createBy.id" column="create_by" jdbcType="VARCHAR"/>
+            <result property="createTime" column="create_date" jdbcType="TIMESTAMP"/>
+            <result property="updateBy.id" column="update_by" jdbcType="VARCHAR"/>
+            <result property="updateTime" column="update_date" jdbcType="TIMESTAMP"/>
+            <result property="delFlag" column="del_flag" jdbcType="INTEGER"/>
+            <result property="remarks" column="remarks" jdbcType="VARCHAR"/>
+            <result property="invoiceId" column="invoice_id" jdbcType="VARCHAR"/>
+            <result property="code" column="code" jdbcType="VARCHAR"/>
+            <result property="number" column="number" jdbcType="VARCHAR"/>
+            <result property="account" column="account" jdbcType="VARCHAR"/>
+            <result property="rate" column="rate" jdbcType="VARCHAR"/>
+            <result property="amount" column="amount" jdbcType="VARCHAR"/>
+            <result property="tax" column="tax" jdbcType="VARCHAR"/>
+            <result property="allAmount" column="all_amount" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        fid.id,
+        fid.create_by,
+        fid.create_date,
+        fid.update_by,
+        fid.update_date,
+        fid.del_flag,
+        fid.remarks,
+        fid.invoice_id,
+        fid.code,
+        fid.number,
+        fid.account,
+        fid.rate,
+        fid.amount,
+        fid.tax,
+        fid.all_amount
+    </sql>
+</mapper>

+ 34 - 0
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/mapper/xml/JyFinanceInvoiceInvalidMapper.xml

@@ -0,0 +1,34 @@
+<?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.jeeplus.business.finance.mapper.JyFinanceInvoiceInvalidMapper">
+
+    <resultMap id="BaseResultMap" type="com.jeeplus.business.finance.service.dto.JyFinanceInvoiceInvalidDTO">
+            <id property="id" column="id" jdbcType="VARCHAR"/>
+            <result property="createBy.id" column="create_by" jdbcType="VARCHAR"/>
+            <result property="createTime" column="create_date" jdbcType="TIMESTAMP"/>
+            <result property="updateBy.id" column="update_by" jdbcType="VARCHAR"/>
+            <result property="updateTime" column="update_date" jdbcType="TIMESTAMP"/>
+            <result property="delFlag" column="del_flag" jdbcType="INTEGER"/>
+            <result property="remarks" column="remarks" jdbcType="VARCHAR"/>
+            <result property="invoiceId" column="invoice_id" jdbcType="VARCHAR"/>
+            <result property="invalidStatus" column="invalid_status" jdbcType="VARCHAR"/>
+            <result property="procInsId" column="proc_ins_id" jdbcType="VARCHAR"/>
+            <result property="processDefinitionId" column="process_definition_id" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        fii.id,
+        fii.create_by,
+        fii.create_date,
+        fii.update_by,
+        fii.update_date,
+        fii.del_flag,
+        fii.remarks,
+        fii.invoice_id,
+        fii.invalid_status,
+        fii.proc_ins_id,
+        fii.process_definition_id
+    </sql>
+</mapper>

+ 420 - 0
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/mapper/xml/JyFinanceInvoiceMapper.xml

@@ -0,0 +1,420 @@
+<?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.jeeplus.business.finance.mapper.JyFinanceInvoiceMapper">
+
+    <resultMap id="BaseResultMap" type="com.jeeplus.business.finance.service.dto.JyFinanceInvoiceDTO">
+            <id property="id" column="id" jdbcType="VARCHAR"/>
+            <result property="createBy.id" column="create_by_id" jdbcType="VARCHAR"/>
+            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+            <result property="updateBy.id" column="update_by_id" jdbcType="VARCHAR"/>
+            <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
+            <result property="delFlag" column="del_flag" jdbcType="INTEGER"/>
+            <result property="remarks" column="remarks" jdbcType="VARCHAR"/>
+            <result property="type" column="type" jdbcType="VARCHAR"/>
+            <result property="no" column="no" jdbcType="VARCHAR"/>
+            <result property="billingType" column="billing_type" jdbcType="VARCHAR"/>
+            <result property="billingWorkplaceReal" column="billing_workplace_real" jdbcType="VARCHAR"/>
+            <result property="taxpayerIdentificationNo" column="taxpayer_identification_no" jdbcType="VARCHAR"/>
+            <result property="address" column="address" jdbcType="VARCHAR"/>
+            <result property="telPhone" column="tel_phone" jdbcType="VARCHAR"/>
+            <result property="openBank" column="open_bank" jdbcType="VARCHAR"/>
+            <result property="bankAccount" column="bank_account" jdbcType="VARCHAR"/>
+            <result property="name" column="name" jdbcType="VARCHAR"/>
+            <result property="receivablesType" column="receivables_type" jdbcType="VARCHAR"/>
+            <result property="billingContent" column="billing_content" jdbcType="VARCHAR"/>
+            <result property="account" column="account" jdbcType="VARCHAR"/>
+            <result property="billingContentTerms" column="billing_content_terms" jdbcType="VARCHAR"/>
+            <result property="billingPeople" column="billing_people" jdbcType="VARCHAR"/>
+            <result property="billingDate" column="billing_date" jdbcType="TIMESTAMP"/>
+            <result property="collectDate" column="collect_date" jdbcType="TIMESTAMP"/>
+            <result property="billingPeopleReal" column="billing_people_real" jdbcType="VARCHAR"/>
+            <result property="reconciliationPeople" column="reconciliation_people" jdbcType="VARCHAR"/>
+            <result property="reconciliationArea" column="reconciliation_area" jdbcType="VARCHAR"/>
+            <result property="billingWorkplaceRealId" column="billing_workplace_real_id" jdbcType="VARCHAR"/>
+            <result property="billingPeopleId" column="billing_people_id" jdbcType="VARCHAR"/>
+            <result property="status" column="status" jdbcType="VARCHAR"/>
+            <result property="procInsId" column="proc_ins_id" jdbcType="VARCHAR"/>
+            <result property="processDefinitionId" column="process_definition_id" jdbcType="VARCHAR"/>
+            <result property="receivablesStatus" column="receivables_status" jdbcType="VARCHAR"/>
+            <result property="invalidStatus" column="invalid_status" jdbcType="VARCHAR"/>
+            <result property="receivablesDate" column="receivables_date" jdbcType="TIMESTAMP"/>
+            <result property="operator" column="operator" jdbcType="VARCHAR"/>
+            <result property="operatorOffice" column="operator_office" jdbcType="VARCHAR"/>
+            <result property="invalidTaskId" column="invalid_task_id" jdbcType="VARCHAR"/>
+            <result property="taskId" column="task_id" jdbcType="VARCHAR"/>
+            <result property="isMultiple" column="is_multiple" jdbcType="VARCHAR"/>
+            <result property="billingId" column="billing_id" jdbcType="VARCHAR"/>
+            <association property="financeInvoiceInvalidDTO" column="id" select="getFii" javaType="com.jeeplus.business.finance.service.dto.JyFinanceInvoiceInvalidDTO"></association>
+            <collection property="financeInvoiceReceivablesDTOList" column="id" select="getFirList" ofType="com.jeeplus.business.finance.service.dto.JyFinanceInvoiceReceivablesDTO"></collection>
+            <collection property="financeInvoiceBaseDTOList" column="id" select="getBaseList" ofType="com.jeeplus.business.finance.service.dto.JyFinanceInvoiceBaseDTO"></collection>
+            <collection property="financeInvoiceDetailDTOList" column="id" select="getFidList" ofType="com.jeeplus.business.finance.service.dto.JyFinanceInvoiceDetailDTO"></collection>
+            <collection property="workAttachmentDtoList" ofType="com.jeeplus.sys.domain.WorkAttachmentInfo" column="id" select="getFileList"></collection>
+    </resultMap>
+
+    <resultMap id="AttachmentMap" type="com.jeeplus.sys.service.dto.WorkAttachmentInfoDTO">
+        <id property="id" column="id" jdbcType="VARCHAR"/>
+        <result property="createBy.id" column="create_by_id" jdbcType="VARCHAR"/>
+        <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+        <result property="updateBy.id" column="update_by_id" jdbcType="VARCHAR"/>
+        <result property="createBy.name" column="create_name" jdbcType="VARCHAR"/>
+        <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
+        <result property="delFlag" column="del_flag" jdbcType="VARCHAR"/>
+        <result property="url" column="url" jdbcType="VARCHAR"/>
+        <result property="name" column="attachment_name" jdbcType="VARCHAR"/>
+        <result property="size" column="file_size" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <sql id="FIR_Column_List">
+        fir.id,
+        fir.create_by_id,
+        fir.create_time,
+        fir.update_by_id,
+        fir.update_time,
+        fir.del_flag,
+        fir.remarks,
+        fir.invoice_id,
+        fir.remittance_unit,
+        fir.remittance_amount,
+        fir.remittance_date,
+        fir.status
+    </sql>
+
+    <sql id="FII_Column_List">
+        fii.id,
+        fii.create_by_id,
+        fii.create_time,
+        fii.update_by_id,
+        fii.update_time,
+        fii.del_flag,
+        fii.remarks,
+        fii.invoice_id,
+        fii.invalid_status,
+        fii.proc_ins_id,
+        fii.process_definition_id
+    </sql>
+
+    <sql id="FID_Column_List">
+        fid.id,
+        fid.create_by_id,
+        fid.create_time,
+        fid.update_by_id,
+        fid.update_time,
+        fid.del_flag,
+        fid.remarks,
+        fid.invoice_id,
+        fid.code,
+        fid.number,
+        fid.account,
+        fid.rate,
+        fid.amount,
+        fid.tax,
+        fid.all_amount
+    </sql>
+
+    <sql id="Base_Column_List">
+        fi.id,
+        fi.create_by_id,
+        fi.create_time,
+        fi.update_by_id,
+        fi.update_time,
+        fi.del_flag,
+        fi.remarks,
+        fi.type,
+        fi.no,
+        fi.billing_type,
+        fi.billing_workplace_real,
+        fi.taxpayer_identification_no,
+        fi.address,
+        fi.tel_phone,
+        fi.open_bank,
+        fi.bank_account,
+        fi.name,
+        fi.receivables_type,
+        fi.billing_content,
+        fi.account,
+        fi.billing_content_terms,
+        fi.billing_people,
+        fi.billing_date,
+        fi.collect_date,
+        fi.billing_people_real,
+        fi.reconciliation_people,
+        fi.reconciliation_area,
+        fi.billing_workplace_real_id,
+        fi.billing_people_id,
+        fi.status,
+        fi.proc_ins_id,
+        fi.process_definition_id,
+        fi.receivables_status,
+        fi.invalid_status,
+        fi.receivables_date,
+        fi.is_multiple,
+        fi.billing_id,
+        fi.report_type
+    </sql>
+
+    <sql id="File_Column_List">
+        wa.id,
+        wa.create_by_id,
+        wa.create_time,
+        wa.update_by_id,
+        wa.update_time,
+        wa.remarks,
+        wa.del_flag,
+        wa.url,
+        wa.type,
+        wa.attachment_id,
+        wa.attachment_name,
+        wa.attachment_flag,
+        wa.module_type,
+        wa.attachment_type,
+        wa.file_size,
+        wa.sort,
+        wa.description
+    </sql>
+
+    <sql id="FIB_Column_List">
+        fib.id,
+        fib.create_by_id,
+        fib.create_time,
+        fib.update_by_id,
+        fib.update_time,
+        fib.del_flag,
+        fib.invoice_id,
+        fib.program_id,
+        fib.program_name,
+        fib.contract_name,
+        fib.program_no,
+        fib.contract_id,
+        fib.account
+    </sql>
+
+    <select id="getFileList" resultMap="AttachmentMap">
+        select
+        <include refid="File_Column_List"></include>,
+        su.name as create_name
+        from work_attachment wa
+        left join sys_user su on su.id = wa.create_by_id and su.del_flag = '0'
+        where wa.del_flag = '0' and wa.attachment_id = #{id}
+    </select>
+
+    <select id="getFii" resultType="com.jeeplus.business.finance.service.dto.JyFinanceInvoiceInvalidDTO">
+        select
+        <include refid="FII_Column_List"></include>,
+        d1.ID_ AS invalidTaskId
+        from jy_finance_invoice_invalid fii
+        LEFT JOIN act_ru_task d1 ON fii.proc_ins_id = d1.PROC_INST_ID_
+        where fii.del_flag = '0' and fii.invoice_id = ${id}
+    </select>
+
+    <select id="getFirList" resultType="com.jeeplus.business.finance.service.dto.JyFinanceInvoiceReceivablesDTO">
+        select
+        <include refid="FIR_Column_List"></include>
+        from jy_finance_invoice_receivables fir
+        where fir.del_flag = '0' and fir.invoice_id = ${id}
+    </select>
+
+    <select id="getFidList" resultType="com.jeeplus.business.finance.service.dto.JyFinanceInvoiceDetailDTO">
+        select
+        <include refid="FID_Column_List"></include>
+        from jy_finance_invoice_detail fid
+        where fid.del_flag = '0' and fid.invoice_id = ${id}
+    </select>
+
+    <select id="getBaseList" resultType="com.jeeplus.business.finance.service.dto.JyFinanceInvoiceBaseDTO">
+        select
+        <include refid="FIB_Column_List"></include>
+        ,rpl.report_no
+        from jy_finance_invoice_base fib
+        left join cw_project_report_new_line rpl on fib.program_id=rpl.report_id
+        where fib.del_flag = '0' and fib.invoice_id = #{id}
+    </select>
+    <select id="findList" resultMap="BaseResultMap">
+        select DISTINCT a.id as 'baseId',
+        <include refid="Base_Column_List"></include>,
+        su.name as operator,
+        so.name as operator_office,
+        d.ID_ AS task_id,
+
+        (
+        case
+                 when a.type = '0' then (concat('其他:',a.program_name))
+                 when a.type = '1' then (select rpr.name from jy_project_record rpr where id = a.program_id)
+            else '' end
+        ) as programName,
+        cfid.number as "number",
+        cfid.account as "accountDetail",
+        a.program_id,
+        a.type as 'recordType'
+        from jy_finance_invoice_base a
+        left join jy_finance_invoice fi on a.invoice_id = fi.id
+        left join jy_finance_invoice_detail cfid on cfid.invoice_id = fi.id and cfid.del_flag = '0'
+        left join sys_user su on fi.create_by_id = 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'
+        LEFT JOIN act_ru_task d ON fi.proc_ins_id = d.PROC_INST_ID_
+        LEFT JOIN jy_project_record pr on a.program_id=pr.id
+        ${ew.customSqlSegment}
+        ORDER BY
+        fi.create_time DESC, cfid.number asc
+    </select>
+
+    <select id="queryById" resultMap="BaseResultMap">
+        select
+        DISTINCT
+        <include refid="Base_Column_List"></include>,
+        su.name as reconciliationPeopleName,
+        fi.report_type
+        from jy_finance_invoice fi
+        left join jy_finance_invoice_base fib on fib.invoice_id = fi.id
+        left join sys_user su on fi.reconciliation_people = su.id
+        left join jy_project_record pr on fib.program_id=pr.id
+        where fi.del_flag = '0' and fi.id = #{id}
+    </select>
+
+    <select id="getIdByProjectId" resultType="string">
+        select
+            invoice_id
+        from jy_finance_invoice_base cw_fib
+        where cw_fib.del_flag = '0' and cw_fib.program_id = #{id}
+    </select>
+
+    <select id="getByIds" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List"></include>,
+        su.name as operator
+        from jy_finance_invoice fi
+        left join sys_user su on fi.create_by_id = su.id and su.del_flag = '0'
+        ${ew.customSqlSegment}
+    </select>
+
+    <select id="getIdByContractId" resultType="string">
+        select
+        a.invoice_id
+        from
+        (select distinct
+            cw_fib.invoice_id
+        from jy_finance_invoice_base cw_fib
+        where cw_fib.del_flag = '0'
+        and cw_fib.program_id in (select cw_pr.id from jy_project_record cw_pr where cw_pr.contract_id = #{id} and cw_pr.del_flag = '0')
+        union
+        select distinct
+            fi.invoice_id
+        from jy_finance_invoice_base fi
+        where (fi.program_id is null or fi.program_id = '')
+        and fi.contract_id = #{id}
+        AND fi.del_flag = '0') a
+    </select>
+
+    <select id="getIdByClientId" resultType="string">
+        select
+            cw_fi.id
+        from jy_finance_invoice cw_fi
+        where cw_fi.del_flag = '0' and cw_fi.billing_workplace_real_id = #{id}
+    </select>
+
+    <update id="setReceivablesDateNull" parameterType="string">
+        update jy_finance_invoice set receivables_date = null where id = #{id}
+    </update>
+
+    <update id="updateInfoById">
+        update jy_finance_invoice set
+        <if test="null != delFlag and delFlag != ''">
+            del_flag = #{delFlag},
+        </if>
+        <if test="null != type and type != ''">
+            type = #{type},
+        </if>
+        <if test="null != reportType and reportType != ''">
+            report_type = #{reportType},
+        </if>
+        <if test="null != billingType and billingType != ''">
+            billing_type = #{billingType},
+        </if>
+        <if test="null != billingWorkplaceReal and billingWorkplaceReal != ''">
+            billing_workplace_real = #{billingWorkplaceReal},
+        </if>
+        <if test="null != taxpayerIdentificationNo and taxpayerIdentificationNo != ''">
+            taxpayer_identification_no = #{taxpayerIdentificationNo},
+        </if>
+        <if test="null != address and address != ''">
+            address = #{address},
+        </if>
+        <if test="null != telPhone and telPhone != ''">
+            tel_phone = #{telPhone},
+        </if>
+        <if test="null != openBank and openBank != ''">
+            open_bank = #{openBank},
+        </if>
+        <if test="null != bankAccount and bankAccount != ''">
+            bank_account = #{bankAccount},
+        </if>
+        <if test="null != name and name != ''">
+            name = #{name},
+        </if>
+        <if test="null != receivablesType and receivablesType != ''">
+            receivables_type = #{receivablesType},
+        </if>
+        <if test="null != billingContent and billingContent != ''">
+            billing_content = #{billingContent},
+        </if>
+        <if test="null != account and account != ''">
+            account = #{account},
+        </if>
+        <if test="null != billingContentTerms and billingContentTerms != ''">
+            billing_content_terms = #{billingContentTerms},
+        </if>
+        <if test="null != billingPeople and billingPeople != ''">
+            billing_people = #{billingPeople},
+        </if>
+        <if test="null != billingDate">
+            billing_date = #{billingDate},
+        </if>
+        <if test="null != collectDate">
+            collect_date = #{collectDate},
+        </if>
+        <if test="null != billingPeopleReal and billingPeopleReal != ''">
+            billing_people_real = #{billingPeopleReal},
+        </if>
+        <if test="null != reconciliationPeople and reconciliationPeople != ''">
+            reconciliation_people = #{reconciliationPeople},
+        </if>
+        <if test="null != reconciliationArea and reconciliationArea != ''">
+            reconciliation_area = #{reconciliationArea},
+        </if>
+        <if test="null != billingWorkplaceRealId and billingWorkplaceRealId != ''">
+            billing_workplace_real_id = #{billingWorkplaceRealId},
+        </if>
+        <if test="null != billingPeopleId and billingPeopleId != ''">
+            billing_people_id = #{billingPeopleId},
+        </if>
+        <if test="null != status and status != ''">
+            status = #{status},
+        </if>
+        <if test="null != procInsId and procInsId != ''">
+            proc_ins_id = #{procInsId},
+        </if>
+        <if test="null != processDefinitionId and processDefinitionId != ''">
+            process_definition_id = #{processDefinitionId},
+        </if>
+        <if test="null != receivablesStatus and receivablesStatus != ''">
+            receivables_status = #{receivablesStatus},
+        </if>
+        <if test="null != invalidStatus and invalidStatus != ''">
+            invalid_status = #{invalidStatus},
+        </if>
+        <if test="null != receivablesDate">
+            receivables_date = #{receivablesDate},
+        </if>
+        <if test="null != isMultiple and isMultiple != ''">
+            is_multiple = #{isMultiple},
+        </if>
+        <if test="null != billingId and billingId != ''">
+            billing_id = #{billingId},
+        </if>
+
+        remarks = #{remarks}
+        where id = #{id}
+    </update>
+</mapper>

+ 36 - 0
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/mapper/xml/JyFinanceInvoiceReceivablesMapper.xml

@@ -0,0 +1,36 @@
+<?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.jeeplus.business.finance.mapper.JyFinanceInvoiceReceivablesMapper">
+
+    <resultMap id="BaseResultMap" type="com.jeeplus.business.finance.service.dto.JyFinanceInvoiceReceivablesDTO">
+            <id property="id" column="id" jdbcType="VARCHAR"/>
+            <result property="createBy.id" column="create_by" jdbcType="VARCHAR"/>
+            <result property="createTime" column="create_date" jdbcType="TIMESTAMP"/>
+            <result property="updateBy.id" column="update_by" jdbcType="VARCHAR"/>
+            <result property="updateTime" column="update_date" jdbcType="TIMESTAMP"/>
+            <result property="delFlag" column="del_flag" jdbcType="INTEGER"/>
+            <result property="remarks" column="remarks" jdbcType="VARCHAR"/>
+            <result property="invoiceId" column="invoice_id" jdbcType="VARCHAR"/>
+            <result property="remittanceUnit" column="remittance_unit" jdbcType="VARCHAR"/>
+            <result property="remittanceAmount" column="remittance_amount" jdbcType="VARCHAR"/>
+            <result property="remittanceDate" column="remittance_date" jdbcType="TIMESTAMP"/>
+            <result property="status" column="status" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        fir.id,
+        fir.create_by,
+        fir.create_date,
+        fir.update_by,
+        fir.update_date,
+        fir.del_flag,
+        fir.remarks,
+        fir.invoice_id,
+        fir.remittance_unit,
+        fir.remittance_amount,
+        fir.remittance_date,
+        fir.status
+    </sql>
+</mapper>

+ 673 - 0
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/service/JyFinanceInvoiceService.java

@@ -0,0 +1,673 @@
+package com.jeeplus.business.finance.service;
+
+import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.extra.spring.SpringUtil;
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.google.common.collect.Lists;
+import com.jeeplus.business.finance.domain.*;
+import com.jeeplus.business.finance.mapper.*;
+import com.jeeplus.business.finance.service.dto.JyFinanceInvoiceBaseDTO;
+import com.jeeplus.business.finance.service.dto.JyFinanceInvoiceDTO;
+import com.jeeplus.business.finance.service.dto.JyFinanceInvoiceDetailDTO;
+import com.jeeplus.business.finance.service.dto.JyFinanceInvoiceReceivablesDTO;
+import com.jeeplus.business.finance.service.mapstruct.*;
+import com.jeeplus.business.project.mapper.JyProjectMapper;
+import com.jeeplus.business.workClientInfo.domain.dto.JyWorkClientInfosDto;
+import com.jeeplus.business.workClientInfo.service.JyWorkClientService;
+import com.jeeplus.common.TokenProvider;
+import com.jeeplus.core.query.QueryWrapperGenerator;
+import com.jeeplus.sys.domain.User;
+import com.jeeplus.sys.feign.IUserApi;
+import com.jeeplus.sys.feign.IWorkAttachmentApi;
+import com.jeeplus.sys.service.dto.UserDTO;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.stream.Collectors;
+
+
+@Service
+@Transactional(rollbackFor = Exception.class)
+public class JyFinanceInvoiceService extends ServiceImpl<JyFinanceInvoiceMapper, JyFinanceInvoice> {
+
+    @Resource
+    private JyFinanceInvoiceMapper cwFinanceInvoiceMapper;
+    @Resource
+    private JyFinanceInvoiceBaseMapper cwFinanceInvoiceBaseMapper;
+    @Resource
+    private JyFinanceInvoiceDetailMapper cwFinanceInvoiceDetailMapper;
+    @Resource
+    private JyFinanceInvoiceReceivablesMapper cwFinanceInvoiceReceivablesMapper;
+    @Resource
+    private JyFinanceInvoiceInvalidMapper cwFinanceInvoiceInvalidMapper;
+    @Resource
+    private JyProjectMapper cwProjectRecordsMapper;
+
+
+
+//    @Resource
+//    private SerialnumTplService serialnumTplService;
+//    @Resource
+//    private OssServiceMapper ossServiceMapper;
+//    @Resource
+//    private UserService userService;
+//    @Resource
+//    private OssService ossService;
+    @Resource
+    private JyWorkClientService jyWorkClientService;
+
+    public List<String> getSearchList(ArrayList<String> searchIdList, List<String> ids) {
+        List<String> newSearchIdList = searchIdList.stream().filter(item -> {
+            AtomicInteger num = new AtomicInteger();
+            ids.stream().forEach(id -> {
+                if (item.equals(id)) {
+                    num.getAndIncrement();
+                }
+            });
+            if (num.get() > 0) {
+                return true;
+            }
+            return false;
+        }).collect(Collectors.toList());
+        return newSearchIdList;
+    }
+
+    public IPage<JyFinanceInvoiceDTO> findList(Page<JyFinanceInvoiceDTO> page, JyFinanceInvoiceDTO jyFinanceInvoiceDTO) throws Exception{
+        QueryWrapper<JyFinanceInvoice> queryWrapper = QueryWrapperGenerator.buildQueryCondition ( JyFinanceInvoiceWrapper.INSTANCE.toEntity(jyFinanceInvoiceDTO), JyFinanceInvoice.class );
+        queryWrapper.eq("fi.del_flag","0");
+        queryWrapper.eq("a.del_flag","0");
+        ArrayList<String> searchIdList = new ArrayList<>();
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        AtomicInteger checkNum = new AtomicInteger();
+        if (ObjectUtil.isNotEmpty(jyFinanceInvoiceDTO)) {
+            //发票编号查询
+            if (StringUtils.isNotBlank(jyFinanceInvoiceDTO.getNo())){
+                queryWrapper.like("fi.no",jyFinanceInvoiceDTO.getNo());
+            }
+            // 发票号查询
+            if (StringUtils.isNotBlank(jyFinanceInvoiceDTO.getNumber())) {
+                List<JyFinanceInvoiceDetail> cwFinanceInvoiceDetails = cwFinanceInvoiceDetailMapper.selectList(new LambdaQueryWrapper<JyFinanceInvoiceDetail>().like(JyFinanceInvoiceDetail::getNumber, jyFinanceInvoiceDTO.getNumber()));
+                List<String> ids = cwFinanceInvoiceDetails.stream().distinct().map(JyFinanceInvoiceDetail::getInvoiceId).collect(Collectors.toList());
+                if(CollectionUtil.isEmpty(ids)) {
+                    return new Page<JyFinanceInvoiceDTO>();
+                }else{
+                    if (CollectionUtil.isNotEmpty(searchIdList)){
+                        List<String> newSearchIdList = getSearchList(searchIdList,ids);
+                        searchIdList = new ArrayList<String>();
+                        for (String item : newSearchIdList) {
+                            searchIdList.add(item);
+                        }
+                    }else{
+                        if (checkNum.get() > 0){
+                            return new Page<JyFinanceInvoiceDTO>();
+                        }else{
+                            for (String item : ids) {
+                                searchIdList.add(item);
+                            }
+                        }
+                    }
+                    checkNum.getAndIncrement();
+                }
+            }
+            // 开票总金额
+            if (StringUtils.isNotBlank(jyFinanceInvoiceDTO.getAccountBegin())&&StringUtils.isNotBlank(jyFinanceInvoiceDTO.getAccountEnd())) {
+                List<JyFinanceInvoice> cwFinanceInvoices = cwFinanceInvoiceMapper.selectList(new LambdaQueryWrapper<JyFinanceInvoice>()
+                        .between(JyFinanceInvoice::getAccount, new BigDecimal(jyFinanceInvoiceDTO.getAccountBegin()), new BigDecimal(jyFinanceInvoiceDTO.getAccountEnd())));
+                List<String> ids = cwFinanceInvoices.stream().distinct().map(JyFinanceInvoice::getId).collect(Collectors.toList());
+                if(CollectionUtil.isEmpty(ids)) {
+                    return new Page<JyFinanceInvoiceDTO>();
+                }else{
+                    if (CollectionUtil.isNotEmpty(searchIdList)){
+                        List<String> newSearchIdList = getSearchList(searchIdList,ids);
+                        searchIdList = new ArrayList<String>();
+                        for (String item : newSearchIdList) {
+                            searchIdList.add(item);
+                        }
+                    }else{
+                        if (checkNum.get() > 0){
+                            return new Page<JyFinanceInvoiceDTO>();
+                        }else{
+                            for (String item : ids) {
+                                searchIdList.add(item);
+                            }
+                        }
+                    }
+                    checkNum.getAndIncrement();
+                }
+            }
+            // 开票日期
+            if (StringUtils.isNotBlank(jyFinanceInvoiceDTO.getBillingDateBegin())&&StringUtils.isNotBlank(jyFinanceInvoiceDTO.getBillingDateEnd())) {
+                List<JyFinanceInvoice> cwFinanceInvoices = cwFinanceInvoiceMapper.selectList(new LambdaQueryWrapper<JyFinanceInvoice>()
+                        .between(JyFinanceInvoice::getBillingDate, sdf.parse(jyFinanceInvoiceDTO.getBillingDateBegin()), sdf.parse(jyFinanceInvoiceDTO.getBillingDateEnd())));
+                List<String> ids = cwFinanceInvoices.stream().distinct().map(JyFinanceInvoice::getId).collect(Collectors.toList());
+                if(CollectionUtil.isEmpty(ids)) {
+                    return new Page<JyFinanceInvoiceDTO>();
+                }else{
+                    if (CollectionUtil.isNotEmpty(searchIdList)){
+                        List<String> newSearchIdList = getSearchList(searchIdList,ids);
+                        searchIdList = new ArrayList<String>();
+                        for (String item : newSearchIdList) {
+                            searchIdList.add(item);
+                        }
+                    }else{
+                        if (checkNum.get() > 0){
+                            return new Page<JyFinanceInvoiceDTO>();
+                        }else{
+                            for (String item : ids) {
+                                searchIdList.add(item);
+                            }
+                        }
+                    }
+                    checkNum.getAndIncrement();
+                }
+            }
+            // 收款日期
+            if (StringUtils.isNotBlank(jyFinanceInvoiceDTO.getRemittanceDateBegin())&&StringUtils.isNotBlank(jyFinanceInvoiceDTO.getRemittanceDateEnd())) {
+                List<JyFinanceInvoice> cwFinanceInvoices = cwFinanceInvoiceMapper.selectList(new LambdaQueryWrapper<JyFinanceInvoice>()
+                        .between(JyFinanceInvoice::getReceivablesDate, sdf.parse(jyFinanceInvoiceDTO.getRemittanceDateBegin()), sdf.parse(jyFinanceInvoiceDTO.getRemittanceDateEnd())));
+                List<String> ids = cwFinanceInvoices.stream().distinct().map(JyFinanceInvoice::getId).collect(Collectors.toList());
+                if(CollectionUtil.isEmpty(ids)) {
+                    return new Page<JyFinanceInvoiceDTO>();
+                }else{
+                    if (CollectionUtil.isNotEmpty(searchIdList)){
+                        List<String> newSearchIdList = getSearchList(searchIdList,ids);
+                        searchIdList = new ArrayList<String>();
+                        for (String item : newSearchIdList) {
+                            searchIdList.add(item);
+                        }
+                    }else{
+                        if (checkNum.get() > 0){
+                            return new Page<JyFinanceInvoiceDTO>();
+                        }else{
+                            for (String item : ids) {
+                                searchIdList.add(item);
+                            }
+                        }
+                    }
+                    checkNum.getAndIncrement();
+                }
+            }
+            // 项目名称
+            if (StringUtils.isNotBlank(jyFinanceInvoiceDTO.getProgramId())){
+                    List<JyFinanceInvoiceBase> cwFinanceInvoiceBaseList = cwFinanceInvoiceBaseMapper.selectList(new LambdaQueryWrapper<JyFinanceInvoiceBase>()
+                            .eq(JyFinanceInvoiceBase::getProgramId, jyFinanceInvoiceDTO.getProgramId()));
+                    List<String> ids = cwFinanceInvoiceBaseList.stream().distinct().map(JyFinanceInvoiceBase::getInvoiceId).collect(Collectors.toList());
+                    if(CollectionUtil.isEmpty(ids)) {
+                        return new Page<JyFinanceInvoiceDTO>();
+                    }else{
+                        if (CollectionUtil.isNotEmpty(searchIdList)){
+                            List<String> newSearchIdList = getSearchList(searchIdList,ids);
+                            searchIdList = new ArrayList<String>();
+                            for (String item : newSearchIdList) {
+                                searchIdList.add(item);
+                            }
+                        }else{
+                            if (checkNum.get() > 0){
+                                return new Page<JyFinanceInvoiceDTO>();
+                            }else{
+                                for (String item : ids) {
+                                    searchIdList.add(item);
+                                }
+                            }
+                        }
+                        checkNum.getAndIncrement();
+
+                    }
+            }
+            // 经办人
+            if (StringUtils.isNotBlank(jyFinanceInvoiceDTO.getOperator())){
+                queryWrapper.like("su.name", jyFinanceInvoiceDTO.getOperator());
+            }
+            //报备类型
+            if (StringUtils.isNotBlank(jyFinanceInvoiceDTO.getReportType())){
+                queryWrapper.eq("fi.report_type",jyFinanceInvoiceDTO.getReportType()).or(i->i.eq("pr.report_type",jyFinanceInvoiceDTO.getReportType()));
+            }
+
+            // 对账人
+            if (StringUtils.isNotBlank(jyFinanceInvoiceDTO.getReconciliationPeopleName())) {
+                List<User> users = SpringUtil.getBean ( IUserApi.class ).selectListByName(jyFinanceInvoiceDTO.getReconciliationPeopleName());
+                List<String> userIdList = users.stream().distinct().map(User::getId).collect(Collectors.toList());
+                if (CollectionUtil.isNotEmpty(userIdList)) {
+                    queryWrapper.in("fi.reconciliation_people",userIdList);
+                } else {
+                    return new Page<JyFinanceInvoiceDTO>();
+                 }
+            }
+            // 经办人部门
+            if (StringUtils.isNotBlank(jyFinanceInvoiceDTO.getOperatorOffice())){
+                List<User> userList = SpringUtil.getBean ( IUserApi.class ).getUserByOfficeAll(jyFinanceInvoiceDTO.getOperatorOffice());
+                if (CollectionUtil.isNotEmpty(userList)) {
+                    List<String> userIdList = userList.stream().distinct().map(User::getId).collect(Collectors.toList());
+                    if (CollectionUtil.isNotEmpty(userIdList)) {
+                        queryWrapper.in("fi.create_by_id",userIdList);
+                    } else {
+                        return new Page<JyFinanceInvoiceDTO>();
+                    }
+                } else {
+                    return new Page<JyFinanceInvoiceDTO>();
+                }
+            }
+        }
+        if (CollectionUtil.isNotEmpty(searchIdList)){
+            List<String> ids = searchIdList.stream().distinct().collect(Collectors.toList());
+            queryWrapper.in("fi.id",ids);
+        } else{
+            if (checkNum.get() > 0) {
+                return new Page<JyFinanceInvoiceDTO>();
+            }
+        }
+        // 如果当前用户是部门主任,则可以查看部门所有的项目、自己创建的项目以及所属项目组的项目
+        // 如果当前用户是员工,则可以查看自己创建的项目以及所属项目组的项目
+        StringBuilder officeIds = new StringBuilder();
+//        UserDTO userDTO = SpringUtil.getBean ( IUserApi.class ).getByToken(TokenProvider.getCurrentToken());
+        List<String> manageOfficeIdList= Lists.newArrayList();
+        //判定是否为会计所长
+//        if(CommonUtils.haveRoleKjsz()){
+//            //获取当前人管理的部门id
+//            if(StringUtils.isNotBlank(userDTO.getManageOfficeIds())){
+//                manageOfficeIdList = Arrays.asList(userDTO.getManageOfficeIds().split(","));
+//            }else{
+//                manageOfficeIdList.add(userDTO.getOfficeDTO().getId());
+//            }
+//            for (int i = 0; i <manageOfficeIdList.size(); i++){
+//                officeIds.append("'").append(manageOfficeIdList.get(i)).append("'");
+//                if(i < manageOfficeIdList.size()-1){
+//                    officeIds.append(",");
+//                }
+//            }
+//        }
+
+
+        //获取当前登录人信息
+//        UserDTO userDTO = SpringUtil.getBean ( IUserApi.class ).getByToken(TokenProvider.getCurrentToken ( ));
+        //获取当前登录人所属角色
+        //若是评估部门主任,则仅展示部门主任信息
+        //若是评估员工,则仅展示自己的数据信息
+//        List<RoleDTO> roleDTOList = userDTO.getRoleDTOList();
+//        for (RoleDTO roleDTO : roleDTOList) {
+//            //根据角色id查询角色信息
+//            RoleDTO roleDTOById = SpringUtil.getBean(IRoleApi.class).getRoleDTOById(roleDTO.getId());
+//            if("cwyg".equals(roleDTOById.getEnName()) && "兴光会计员工".equals(roleDTOById.getName())){
+//                queryWrapper.eq("a.create_by_id", userDTO.getId());
+//                break;
+//            }else if("cw_bmzr".equals(roleDTOById.getEnName()) && "兴光会计部门主任".equals(roleDTOById.getName())){
+//                queryWrapper.eq("sumo.user_id", userDTO.getId());
+//                break;
+//            }else if("szfbdagly".equals(roleDTOById.getEnName()) && "苏州分部档案管理员".equals(roleDTOById.getName())){
+//                queryWrapper.eq("d.office_id", "1613800824395530242");
+//                break;
+//            }
+//        }
+        IPage<JyFinanceInvoiceDTO> list = cwFinanceInvoiceMapper.findList(page, queryWrapper);
+
+        return list;
+    }
+
+    public JyFinanceInvoiceDTO queryById(String id) {
+
+        JyFinanceInvoiceDTO cwFinanceInvoiceDTO = cwFinanceInvoiceMapper.queryById(id);
+
+        // 电话号获取
+        if (ObjectUtil.isNotEmpty(cwFinanceInvoiceDTO) && StringUtils.isNotBlank(cwFinanceInvoiceDTO.getBillingId())) {
+            JyWorkClientInfosDto cwWorkClientBilling = jyWorkClientService.findById(cwFinanceInvoiceDTO.getBillingId());
+            if (ObjectUtil.isNotEmpty(cwWorkClientBilling) && StringUtils.isNotBlank(cwWorkClientBilling.getWorkClientInfo().getTelephone())) {
+                // 如果通过billingId(开票信息id)可以查询到数据,并且数据的phone(电话)有值的话,那么就将方法返回结果的telPhone替换为查询到的phone
+                cwFinanceInvoiceDTO.setTelPhone(cwWorkClientBilling.getWorkClientInfo().getTelephone());
+            } else {
+                // 如果通过billingId(开票信息id)查询不到数据或者查询到数据的phone值为空
+                // 将billingId(开票信息id)置空,因为前端根据billingId是否有值来判断->是否允许电话号码可以手填
+                cwFinanceInvoiceDTO.setBillingId("");
+                // 将telPhone(电话号)置空
+//                cwFinanceInvoiceDTO.setTelPhone("");
+            }
+        }
+
+        // 实际开票单位名称获取
+        if (ObjectUtil.isNotEmpty(cwFinanceInvoiceDTO) && StringUtils.isNotBlank(cwFinanceInvoiceDTO.getBillingWorkplaceRealId())) {
+            JyWorkClientInfosDto cwWorkClientBase = jyWorkClientService.findById(cwFinanceInvoiceDTO.getBillingWorkplaceRealId());
+            if (ObjectUtil.isNotEmpty(cwWorkClientBase) && StringUtils.isNotBlank(cwWorkClientBase.getWorkClientInfo().getName())) {
+                // 如果通过billingWorkplaceRealId(实际开票单位id)可以查询到数据,并且数据的name(实际开票单位名称)有值的话,
+                // 那么就将方法返回结果的billingWorkplaceReal替换
+                cwFinanceInvoiceDTO.setBillingWorkplaceReal(cwWorkClientBase.getWorkClientInfo().getName());
+            }
+        }
+
+
+
+
+
+        return cwFinanceInvoiceDTO;
+    }
+
+    public JyFinanceInvoice saveForm(JyFinanceInvoiceDTO cwFinanceInvoiceDTO) throws Exception{
+        JyFinanceInvoice cwFinanceInvoice = JyFinanceInvoiceWrapper.INSTANCE.toEntity(cwFinanceInvoiceDTO);
+        if (ObjectUtil.isNotEmpty(cwFinanceInvoice)) {
+            if(StringUtils.isBlank(cwFinanceInvoice.getId())){
+                //获取当前登录人信息
+                UserDTO userDTO = SpringUtil.getBean ( IUserApi.class ).getByToken(TokenProvider.getCurrentToken());
+                //发票编号生成
+                String serialNum = SpringUtil.getBean ( IWorkAttachmentApi.class ).genSerialNum(userDTO.getCompanyDTO().getId(), JyFinanceInvoiceDTO.BIZ_CODE,TokenProvider.getCurrentToken());
+                cwFinanceInvoice.setNo(serialNum);
+                if (StringUtils.isBlank(cwFinanceInvoice.getInvalidStatus())){
+                    cwFinanceInvoice.setInvalidStatus("0");
+                }
+                if (StringUtils.isBlank(cwFinanceInvoice.getReceivablesStatus())){
+                    cwFinanceInvoice.setReceivablesStatus("0");
+                }
+                if(StringUtils.isNotEmpty(cwFinanceInvoice.getReportType())){
+                    cwFinanceInvoice.setReportType(cwFinanceInvoiceDTO.getReportType());
+                }
+
+            }
+        }
+        if(StringUtils.isNotBlank(cwFinanceInvoiceDTO.getId())){
+            cwFinanceInvoiceMapper.updateInfoById(cwFinanceInvoice);
+        }else{
+            cwFinanceInvoiceMapper.insert(cwFinanceInvoice);
+        }
+
+        if (ObjectUtil.isNotEmpty(cwFinanceInvoiceDTO)) {
+            // 如果当前是执行的是收款页面的保存方法
+            if ("1".equals(cwFinanceInvoiceDTO.getIsReceivables())) {
+                // 如果传过来的收款日期为空,则将本条发票的收款日期置空
+                if (ObjectUtil.isEmpty(cwFinanceInvoiceDTO.getReceivablesDate())) {
+                    // 根据发票id,置空发票的收款日期
+                    cwFinanceInvoiceMapper.setReceivablesDateNull(cwFinanceInvoice.getId());
+                }
+            }
+            // 基本信息保存
+            if(CollectionUtil.isNotEmpty(cwFinanceInvoiceDTO.getFinanceInvoiceBaseDTOList())){
+                List<String> delIds = cwFinanceInvoiceDTO.getFinanceInvoiceBaseDTOList().stream().distinct().filter(item->{
+                    if(StringUtils.isNotBlank(item.getId())){
+                        return true;
+                    }
+                    return false;
+                }).map(JyFinanceInvoiceBaseDTO::getId).collect(Collectors.toList());
+                if(CollectionUtil.isNotEmpty(delIds)){
+                    cwFinanceInvoiceBaseMapper.delete(new QueryWrapper<JyFinanceInvoiceBase>().lambda()
+                            .eq(JyFinanceInvoiceBase::getInvoiceId, cwFinanceInvoice.getId()).notIn(JyFinanceInvoiceBase::getId,delIds));
+                }else{
+                    cwFinanceInvoiceBaseMapper.delete(new QueryWrapper<JyFinanceInvoiceBase>().lambda()
+                            .eq(JyFinanceInvoiceBase::getInvoiceId, cwFinanceInvoice.getId()));
+                }
+                cwFinanceInvoiceDTO.getFinanceInvoiceBaseDTOList().stream().forEach(item->{
+                    JyFinanceInvoiceBase cwFinanceInvoiceBase = JyFinanceInvoiceBaseWrapper.INSTANCE.toEntity(item);
+
+                    cwFinanceInvoiceBase.setAccount(item.getAccount());
+                    if(StringUtils.isNotBlank(cwFinanceInvoiceBase.getId())){
+                        cwFinanceInvoiceBaseMapper.updateById(cwFinanceInvoiceBase);
+                    }else{
+                        cwFinanceInvoiceBase.setInvoiceId(cwFinanceInvoice.getId());
+                        cwFinanceInvoiceBaseMapper.insert(cwFinanceInvoiceBase);
+                    }
+                    if (StringUtils.isNotEmpty(cwFinanceInvoiceBase.getProgramId())){
+                        if (null!=cwProjectRecordsMapper.getById(cwFinanceInvoiceBase.getProgramId())){
+                            cwFinanceInvoiceBase.setType("1");
+                            cwFinanceInvoiceBaseMapper.updateById(cwFinanceInvoiceBase);
+                            cwFinanceInvoice.setRecordType(cwFinanceInvoiceBase.getType());
+                        }
+                    }else {
+                        cwFinanceInvoiceBase.setType("0");
+                        cwFinanceInvoiceBaseMapper.updateById(cwFinanceInvoiceBase);
+                        cwFinanceInvoice.setRecordType(cwFinanceInvoiceBase.getType());
+                    }
+
+                });
+            }else{
+                cwFinanceInvoiceBaseMapper.delete(new QueryWrapper<JyFinanceInvoiceBase>().lambda()
+                        .eq(JyFinanceInvoiceBase::getInvoiceId, cwFinanceInvoice.getId()));
+            }
+            // 附件
+            Map<String,String> map = new HashMap<>();
+            String fileList = JSON.toJSONString((cwFinanceInvoiceDTO.getWorkAttachmentDtoList()));
+            String attachmentId = cwFinanceInvoice.getId();
+            String attachmentFlag = "jy_invoice";
+            map.put("fileList",fileList);
+            map.put("attachmentId",attachmentId);
+            map.put("attachmentFlag",attachmentFlag);
+            map.put("currentToken", TokenProvider.getCurrentToken ( ));
+            SpringUtil.getBean ( IWorkAttachmentApi.class ).saveOrUpdateFileList(map);
+
+            // 发票明细保存
+            if(CollectionUtil.isNotEmpty(cwFinanceInvoiceDTO.getFinanceInvoiceDetailDTOList())){
+                List<String> delIds = cwFinanceInvoiceDTO.getFinanceInvoiceDetailDTOList().stream().distinct().filter(item -> {
+                    if (StringUtils.isNotBlank(item.getId())) {
+                        return true;
+                    }
+                    return false;
+                }).map(JyFinanceInvoiceDetailDTO::getId).collect(Collectors.toList());
+                if(CollectionUtil.isNotEmpty(delIds)){
+                    cwFinanceInvoiceDetailMapper.delete(new QueryWrapper<JyFinanceInvoiceDetail>().lambda()
+                            .eq(JyFinanceInvoiceDetail::getInvoiceId, cwFinanceInvoice.getId())
+                            .notIn(JyFinanceInvoiceDetail::getId,delIds));
+                }else{
+                    cwFinanceInvoiceDetailMapper.delete(new QueryWrapper<JyFinanceInvoiceDetail>().lambda().eq(JyFinanceInvoiceDetail::getInvoiceId, cwFinanceInvoice.getId()));
+                }
+                cwFinanceInvoiceDTO.getFinanceInvoiceDetailDTOList().stream().forEach(item->{
+                    JyFinanceInvoiceDetail cwFinanceInvoiceDetail = JyFinanceInvoiceDetailWrapper.INSTANCE.toEntity(item);
+                    if(StringUtils.isNotBlank(cwFinanceInvoiceDetail.getId())){
+                        cwFinanceInvoiceDetailMapper.updateById(cwFinanceInvoiceDetail);
+                    }else{
+                        cwFinanceInvoiceDetail.setInvoiceId(cwFinanceInvoice.getId());
+                        cwFinanceInvoiceDetailMapper.insert(cwFinanceInvoiceDetail);
+                    }
+                });
+            }else{
+                cwFinanceInvoiceDetailMapper.delete(new QueryWrapper<JyFinanceInvoiceDetail>().lambda().eq(JyFinanceInvoiceDetail::getInvoiceId, cwFinanceInvoice.getId()));
+            }
+            // 收款明细保存
+            if(CollectionUtil.isNotEmpty(cwFinanceInvoiceDTO.getFinanceInvoiceReceivablesDTOList())){
+                List<String> delIds = cwFinanceInvoiceDTO.getFinanceInvoiceReceivablesDTOList().stream().distinct().filter(item -> {
+                    if (StringUtils.isNotBlank(item.getId())) {
+                        return true;
+                    }
+                    return false;
+                }).map(JyFinanceInvoiceReceivablesDTO::getId).collect(Collectors.toList());
+                if(CollectionUtil.isNotEmpty(delIds)){
+                    cwFinanceInvoiceReceivablesMapper.delete(new QueryWrapper<JyFinanceInvoiceReceivables>().lambda()
+                            .eq(JyFinanceInvoiceReceivables::getInvoiceId, cwFinanceInvoice.getId())
+                            .notIn(JyFinanceInvoiceReceivables::getId,delIds));
+                }else{
+                    cwFinanceInvoiceReceivablesMapper.delete(new QueryWrapper<JyFinanceInvoiceReceivables>().lambda().eq(JyFinanceInvoiceReceivables::getInvoiceId, cwFinanceInvoice.getId()));
+                }
+                cwFinanceInvoiceDTO.getFinanceInvoiceReceivablesDTOList().stream().forEach(item->{
+                    JyFinanceInvoiceReceivables cwFinanceInvoiceReceivables = JyFinanceInvoiceReceivablesWrapper.INSTANCE.toEntity(item);
+                    if(StringUtils.isNotBlank(cwFinanceInvoiceReceivables.getId())){
+                        cwFinanceInvoiceReceivablesMapper.updateById(cwFinanceInvoiceReceivables);
+                    }else{
+                        cwFinanceInvoiceReceivables.setInvoiceId(cwFinanceInvoice.getId());
+                        cwFinanceInvoiceReceivablesMapper.insert(cwFinanceInvoiceReceivables);
+                    }
+                });
+            }else{
+                cwFinanceInvoiceReceivablesMapper.delete(new QueryWrapper<JyFinanceInvoiceReceivables>().lambda().eq(JyFinanceInvoiceReceivables::getInvoiceId, cwFinanceInvoice.getId()));
+            }
+            // 作废信息保存
+            if(ObjectUtil.isNotEmpty(cwFinanceInvoiceDTO.getFinanceInvoiceInvalidDTO())){
+                JyFinanceInvoiceInvalid cwFinanceInvoiceInvalid = JyFinanceInvoiceInvalidWrapper.INSTANCE.toEntity(cwFinanceInvoiceDTO.getFinanceInvoiceInvalidDTO());
+                if(StringUtils.isNotBlank(cwFinanceInvoiceInvalid.getId())){
+                    cwFinanceInvoiceInvalidMapper.update(cwFinanceInvoiceInvalid,
+                            new QueryWrapper<JyFinanceInvoiceInvalid>().lambda().eq(JyFinanceInvoiceInvalid::getId, cwFinanceInvoiceInvalid.getId()));
+                }else{
+                    cwFinanceInvoiceInvalid.setInvalidStatus("0");
+                    cwFinanceInvoiceInvalid.setInvoiceId(cwFinanceInvoice.getId());
+                    cwFinanceInvoiceInvalidMapper.insert(cwFinanceInvoiceInvalid);
+                }
+            }else{
+                cwFinanceInvoiceInvalidMapper.delete(new QueryWrapper<JyFinanceInvoiceInvalid>().lambda().eq(JyFinanceInvoiceInvalid::getInvoiceId, cwFinanceInvoice.getId()));
+                JyFinanceInvoiceInvalid cwFinanceInvoiceInvalid = new JyFinanceInvoiceInvalid();
+                cwFinanceInvoiceInvalid.setInvalidStatus("0");
+                cwFinanceInvoiceInvalid.setInvoiceId(cwFinanceInvoice.getId());
+                cwFinanceInvoiceInvalidMapper.insert(cwFinanceInvoiceInvalid);
+            }
+        }
+        return cwFinanceInvoice;
+    }
+
+    public ResponseEntity saveInvoice(JyFinanceInvoiceDTO cwFinanceInvoiceDTO) throws Exception{
+        this.saveForm(cwFinanceInvoiceDTO);
+        return ResponseEntity.ok("保存成功");
+    }
+
+    public String saveFormInvalid(JyFinanceInvoiceDTO cwFinanceInvoiceDTO) throws Exception{
+        String invoiceId = this.saveForm(cwFinanceInvoiceDTO).getId();
+        List<JyFinanceInvoiceInvalid> cwFinanceInvoiceInvalids = cwFinanceInvoiceInvalidMapper.selectList(
+                new QueryWrapper<JyFinanceInvoiceInvalid>().lambda().eq(JyFinanceInvoiceInvalid::getInvoiceId, invoiceId));
+        return cwFinanceInvoiceInvalids.get(0).getId();
+    }
+
+    public ResponseEntity deleteByIds(String ids) {
+        String idArray[] =ids.split(",");
+        this.removeByIds (Lists.newArrayList (idArray));
+        return ResponseEntity.ok ("删除成功");
+    }
+
+    public Boolean queryByNumber(String number, String id) {
+        List<JyFinanceInvoiceDetail> cwFinanceInvoiceDetails = cwFinanceInvoiceDetailMapper.selectList(new QueryWrapper<JyFinanceInvoiceDetail>().lambda()
+                .eq(JyFinanceInvoiceDetail::getNumber, number)
+                .eq(JyFinanceInvoiceDetail::getDelFlag, '0')
+                .ne(StringUtils.isNotBlank(id), JyFinanceInvoiceDetail::getId,id));
+        if (CollectionUtil.isNotEmpty(cwFinanceInvoiceDetails)) {
+            return true;
+        }
+        return false;
+    }
+
+    public String queryIdByInvalidId(String id) {
+        JyFinanceInvoiceInvalid cwFinanceInvoiceInvalid = cwFinanceInvoiceInvalidMapper.selectById(id);
+        return cwFinanceInvoiceInvalid.getInvoiceId();
+    }
+
+    public String updateStatusById(JyFinanceInvoiceDTO cwFinanceInvoiceDTO) {
+        JyFinanceInvoice cwFinanceInvoice = JyFinanceInvoiceWrapper.INSTANCE.toEntity(cwFinanceInvoiceDTO);
+        if ("4".equals(cwFinanceInvoice.getStatus())) {
+            cwFinanceInvoiceMapper.updateInfoById(cwFinanceInvoice);
+        }else{
+            cwFinanceInvoiceMapper.update(cwFinanceInvoice, new QueryWrapper<JyFinanceInvoice>().lambda().eq(JyFinanceInvoice::getId, cwFinanceInvoice.getId()));
+        }
+        return "操作成功";
+    }
+
+    public String isReceivables(JyFinanceInvoiceDTO cwFinanceInvoiceDTO) {
+        JyFinanceInvoice cwFinanceInvoice = JyFinanceInvoiceWrapper.INSTANCE.toEntity(cwFinanceInvoiceDTO);
+        cwFinanceInvoiceMapper.update(cwFinanceInvoice, new QueryWrapper<JyFinanceInvoice>().lambda().eq(JyFinanceInvoice::getId, cwFinanceInvoice.getId()));
+        return "操作成功";
+    }
+
+    public String importDecide(List<JyFinanceInvoiceDetailDTO> list, ArrayList<JyFinanceInvoiceDetailDTO> arrayList, HashMap<String,String> hashMap){
+        for (JyFinanceInvoiceDetailDTO cwFinanceInvoiceDetailDTO : list) {
+            if(ObjectUtil.isEmpty(cwFinanceInvoiceDetailDTO)){
+                continue;
+            }
+
+            if(StringUtils.isBlank(cwFinanceInvoiceDetailDTO.getNumber())){
+                return "文件中有发票号为空,请重新填写";
+            }
+            if(StringUtils.isNotBlank(cwFinanceInvoiceDetailDTO.getNumber())){
+                try {
+                    Integer integer = new Integer(cwFinanceInvoiceDetailDTO.getNumber());
+                    if (integer < 0) {
+                        return "文件中有发票号填写不正确,请重新填写";
+                    }
+                }catch (Exception e){
+                    return "文件中有发票号填写不正确,请重新填写";
+                }
+                List<JyFinanceInvoiceDetail> cwFinanceInvoiceDetailList = cwFinanceInvoiceDetailMapper.selectList(new QueryWrapper<JyFinanceInvoiceDetail>().eq("number", cwFinanceInvoiceDetailDTO.getNumber()));
+                if(CollectionUtil.isNotEmpty(cwFinanceInvoiceDetailList)){
+                    return "文件中有发票号已在系统中存在,请重新填写";
+                }
+            }
+//            if (StringUtils.isBlank(financeInvoiceDetailDTO.getRate())) {
+//                return "文件中有税率为空,请重新填写";
+//            }
+            if (StringUtils.isNotBlank(cwFinanceInvoiceDetailDTO.getRate())) {
+                try {
+                    if ((new BigDecimal(cwFinanceInvoiceDetailDTO.getRate())).compareTo(new BigDecimal(1)) == -1
+                            || (new BigDecimal(cwFinanceInvoiceDetailDTO.getRate())).compareTo(new BigDecimal(100)) == 1) {
+                        return "文件中有税率填写不正确,请重新填写";
+                    }
+                }catch (Exception e){
+                    return "文件中有税率填写不正确,请重新填写";
+                }
+            }
+            if (StringUtils.isBlank(cwFinanceInvoiceDetailDTO.getAccount())) {
+                return "文件中有开票金额为空,请重新填写";
+            } else {
+                try {
+                    cwFinanceInvoiceDetailDTO.setAccount(new BigDecimal(cwFinanceInvoiceDetailDTO.getAccount()).toString());
+                }catch (Exception e){
+                    return "文件中有开票金额填写不正确,请重新填写";
+                }
+            }
+
+            hashMap.put(cwFinanceInvoiceDetailDTO.getNumber(),null);
+
+            arrayList.add(cwFinanceInvoiceDetailDTO);
+        }
+        return null;
+    }
+
+    public List<JyFinanceInvoiceDTO> getByIds(String projectId,JyFinanceInvoiceDTO cwFinanceInvoiceDTO) throws Exception{
+        if(StringUtils.isNotBlank(projectId)){
+            List<String> idByProjectId = cwFinanceInvoiceMapper.getIdByProjectId(projectId);
+            if (CollectionUtil.isNotEmpty(idByProjectId)){
+                QueryWrapper<JyFinanceInvoice> queryWrapper = QueryWrapperGenerator.buildQueryCondition ( JyFinanceInvoiceWrapper.INSTANCE.toEntity(cwFinanceInvoiceDTO), JyFinanceInvoice.class );
+                queryWrapper.in("fi.id", idByProjectId);
+                queryWrapper.eq("fi.del_flag","0");
+                queryWrapper.eq("fi.status","5"); // 发票申请流程已通过
+                queryWrapper.orderByDesc("fi.create_time");
+                queryWrapper.eq("fi.invalid_status","0"); // 未作废
+                return cwFinanceInvoiceMapper.getByIds(queryWrapper);
+            }
+        }
+        return new ArrayList<>();
+    }
+
+    public List<JyFinanceInvoiceDTO> getByContractId(String contractId,JyFinanceInvoiceDTO cwFinanceInvoiceDTO) throws Exception{
+        if(StringUtils.isNotBlank(contractId)){
+            List<String> idByContractId = cwFinanceInvoiceMapper.getIdByContractId(contractId);
+            if (CollectionUtil.isNotEmpty(idByContractId)){
+                QueryWrapper<JyFinanceInvoice> queryWrapper = QueryWrapperGenerator.buildQueryCondition ( JyFinanceInvoiceWrapper.INSTANCE.toEntity(cwFinanceInvoiceDTO), JyFinanceInvoice.class );
+                queryWrapper.in("fi.id", idByContractId);
+                queryWrapper.eq("fi.del_flag","0");
+                queryWrapper.eq("fi.status","5"); // 发票申请流程已通过
+                queryWrapper.orderByDesc("fi.create_time");
+                queryWrapper.eq("fi.invalid_status","0"); // 未作废
+                return cwFinanceInvoiceMapper.getByIds(queryWrapper);
+            }
+        }
+        return new ArrayList<>();
+    }
+
+    public List<JyFinanceInvoiceDTO> getIdByClientId(String clientId,JyFinanceInvoiceDTO cwFinanceInvoiceDTO) throws Exception{
+        if(StringUtils.isNotBlank(clientId)){
+            List<String> idByClientId = cwFinanceInvoiceMapper.getIdByClientId(clientId);
+            if (CollectionUtil.isNotEmpty(idByClientId)){
+                QueryWrapper<JyFinanceInvoice> queryWrapper = QueryWrapperGenerator.buildQueryCondition ( JyFinanceInvoiceWrapper.INSTANCE.toEntity(cwFinanceInvoiceDTO), JyFinanceInvoice.class );
+                queryWrapper.in("fi.id", idByClientId);
+                queryWrapper.eq("fi.del_flag","0");
+                queryWrapper.eq("fi.status","5"); // 发票申请流程已通过
+                queryWrapper.orderByDesc("fi.create_time");
+                queryWrapper.eq("fi.invalid_status","0"); // 未作废
+                return cwFinanceInvoiceMapper.getByIds(queryWrapper);
+            }
+        }
+        return new ArrayList<>();
+    }
+}

+ 9 - 0
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/service/dto/JyFinanceDTO.java

@@ -0,0 +1,9 @@
+package com.jeeplus.business.finance.service.dto;
+
+import lombok.Data;
+
+@Data
+public class JyFinanceDTO {
+
+    private String businessId;
+}

+ 61 - 0
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/service/dto/JyFinanceInvoiceBaseDTO.java

@@ -0,0 +1,61 @@
+package com.jeeplus.business.finance.service.dto;
+
+import com.jeeplus.core.service.dto.BaseDTO;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 财务管理-发票基本信息
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class JyFinanceInvoiceBaseDTO extends BaseDTO {
+
+    /**
+     * 发票id
+     */
+    private String invoiceId;
+
+    /**
+     * 项目id
+     */
+    private String programId;
+
+    /**
+     * 项目名称
+     */
+    private String programName;
+
+    /**
+     * 合同名称
+     */
+    private String contractName;
+
+    /**
+     * 项目编号
+     */
+    private String programNo;
+
+    /**
+     * 合同id
+     */
+    private String contractId;
+
+    private String account;
+
+    private String reportType;
+    /**
+     * 类型 项目1,报告2,其他0
+     */
+    private String type;
+
+    /**
+     * 报备类型
+     */
+    private String reportNo;
+
+
+
+
+    private static final long serialVersionUID = 1L;
+}

+ 345 - 0
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/service/dto/JyFinanceInvoiceDTO.java

@@ -0,0 +1,345 @@
+package com.jeeplus.business.finance.service.dto;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.jeeplus.business.project.domain.JyProject;
+import com.jeeplus.core.service.dto.BaseDTO;
+import com.jeeplus.sys.domain.WorkAttachmentInfo;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 财务管理-发票
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class JyFinanceInvoiceDTO extends BaseDTO {
+
+    public static final String BIZ_CODE = "41";
+
+
+    /**
+     * 发票申请编号
+     */
+    @Excel(name = "开票申请编号",width = 16)
+    private String no;
+
+    /**
+     * 项目名称
+     */
+    @Excel(name = "项目名称",width = 25)
+    private String programName;
+
+    /**
+     * 实际开票单位
+     */
+    @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;
+
+    /**
+     * 备注信息
+     */
+    private String remarks;
+
+    /**
+     * 开票类型
+     */
+    private String billingType;
+
+
+    /**
+     * 纳税人识别号
+     */
+    private String taxpayerIdentificationNo;
+
+    /**
+     * 地址
+     */
+    private String address;
+
+    /**
+     * 电话
+     */
+    private String telPhone;
+
+    /**
+     * 开户银行
+     */
+    private String openBank;
+
+    /**
+     * 银行账号
+     */
+    private String bankAccount;
+
+    /**
+     * 姓名
+     */
+    private String name;
+
+    /**
+     * 收款类型
+     */
+    private String receivablesType;
+
+    /**
+     * 开票内容要求
+     */
+    private String billingContentTerms;
+
+    /**
+     * 开票人
+     */
+    private String billingPeople;
+
+
+    /**
+     * 领票时间
+     */
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
+    private Date collectDate;
+
+    /**
+     * 实际开票人
+     */
+    private String billingPeopleReal;
+
+    /**
+     * 对账人id
+     */
+    private String reconciliationPeople;
+
+    /**
+     * 对账人姓名
+     */
+    private String reconciliationPeopleName;
+
+    /**
+     * 对账地区
+     */
+    private String reconciliationArea;
+
+    /**
+     * 实际开票单位id
+     */
+    private String billingWorkplaceRealId;
+
+    /**
+     * 开票人id
+     */
+    private String billingPeopleId;
+
+    /**
+     * 流程id
+     */
+    private String procInsId;
+
+    /**
+     * 流程信息
+     */
+    private String processDefinitionId;
+
+    /**
+     * 是否作废
+     */
+    private String invalidStatus;
+
+    /**
+     * 基础项目信息
+     */
+    private List<JyProject> projectRecordsDTOList;
+
+    /**
+     * 基础信息
+     */
+    private List<JyFinanceInvoiceBaseDTO> financeInvoiceBaseDTOList;
+
+    /**
+     * 附件信息
+     */
+    private List<WorkAttachmentInfo> workAttachmentDtoList;
+
+    /**
+     * 发票明细
+     */
+    private List<JyFinanceInvoiceDetailDTO> financeInvoiceDetailDTOList;
+
+    /**
+     * 收款明细
+     */
+    private List<JyFinanceInvoiceReceivablesDTO> financeInvoiceReceivablesDTOList;
+
+    /**
+     * 作废信息
+     */
+    private JyFinanceInvoiceInvalidDTO financeInvoiceInvalidDTO;
+
+    /**
+     * 开票总金额 Begin
+     */
+    private String accountBegin;
+
+    /**
+     * 开票总金额 End
+     */
+    private String accountEnd;
+
+    /**
+     * 开票日期 Begin
+     */
+    private String billingDateBegin;
+
+    /**
+     * 开票日期 End
+     */
+    private String billingDateEnd;
+
+    /**
+     * 收款日期Begin
+     */
+    private String remittanceDateBegin;
+
+    /**
+     * 收款日期End
+     */
+    private String remittanceDateEnd;
+
+    /**
+     * 项目id
+     */
+    private String programId;
+
+    /**
+     * 数据审核人  发票申请
+     */
+    private List<String> auditUserIds;
+
+    /**
+     * 发票作废  taskId
+     */
+    private String invalidTaskId;
+
+    private String taskId;
+
+    /**
+     * 数据审核人  发票作废
+     */
+    private List<String> auditUserIdsInvalid;
+
+    /**
+     * 是否为收款页面   0否  1是
+     */
+    private String isReceivables;
+
+    /**
+     * 是否多张开票  1是  0否
+     */
+    private String isMultiple;
+
+    /**
+     * 实际开票单位的开票信息id
+     */
+    private String billingId;
+    /**
+     * 报备类型(其他)
+     */
+    private String reportType;
+
+
+    /**
+     * 基本信息表id
+     */
+    private String baseId;
+
+    /**
+     * 基本信息中的类型(项目:1;报告:2;其他:0)
+     */
+    private String recordType;
+
+    /**
+     * 报告文号
+     */
+    private String reportNo;
+
+
+
+
+
+
+    private static final long serialVersionUID = 1L;
+}

+ 71 - 0
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/service/dto/JyFinanceInvoiceDetailDTO.java

@@ -0,0 +1,71 @@
+package com.jeeplus.business.finance.service.dto;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.jeeplus.core.service.dto.BaseDTO;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 财务管理-发票明细
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class JyFinanceInvoiceDetailDTO extends BaseDTO {
+
+    /**
+     * 备注信息
+     */
+    private String remarks;
+
+    /**
+     * 发票id
+     */
+    private String invoiceId;
+
+    /**
+     * 发票代码
+     */
+    @Excel(name = "发票代码",width = 25)
+    private String code;
+
+    /**
+     * 发票号
+     */
+    @Excel(name = "发票号",width = 25)
+    private String number;
+
+    /**
+     * 开票金额(元)
+     */
+    @Excel(name = "开票金额(元)",width = 25)
+    private String account;
+
+    /**
+     * 税率
+     */
+    @Excel(name = "税率(%)",width = 25)
+    private String rate;
+
+    /**
+     * 金额
+     */
+    private String amount;
+
+    /**
+     * 税额
+     */
+    private String tax;
+
+    /**
+     * 累计登记金额
+     */
+    private String allAmount;
+
+    /**
+     * 纳税人识别号
+     */
+    @Excel(name = "纳税人识别号",width = 25)
+    private String taxpayerIdentificationNo;
+
+    private static final long serialVersionUID = 1L;
+}

+ 42 - 0
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/service/dto/JyFinanceInvoiceInvalidDTO.java

@@ -0,0 +1,42 @@
+package com.jeeplus.business.finance.service.dto;
+
+import com.jeeplus.core.service.dto.BaseDTO;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 财务管理-发票-发票作废
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class JyFinanceInvoiceInvalidDTO extends BaseDTO {
+
+    /**
+     * 备注信息
+     */
+    private String remarks;
+
+    /**
+     * 发票id
+     */
+    private String invoiceId;
+
+    /**
+     * 是否作废
+     */
+    private String invalidStatus;
+
+    /**
+     * 流程id
+     */
+    private String procInsId;
+
+    /**
+     * 流程信息
+     */
+    private String processDefinitionId;
+
+    private static final long serialVersionUID = 1L;
+
+    private String invalidTaskId;
+}

+ 51 - 0
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/service/dto/JyFinanceInvoiceReceivablesDTO.java

@@ -0,0 +1,51 @@
+package com.jeeplus.business.finance.service.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.jeeplus.core.service.dto.BaseDTO;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+/**
+ * 财务管理-发票-收款明细
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class JyFinanceInvoiceReceivablesDTO extends BaseDTO {
+
+    /**
+     * 备注信息
+     */
+    private String remarks;
+
+    /**
+     * 发票id
+     */
+    private String invoiceId;
+
+    /**
+     * 汇款单位
+     */
+    private String remittanceUnit;
+
+    /**
+     * 汇款金额
+     */
+    private String remittanceAmount;
+
+    /**
+     * 汇款时间
+     */
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
+    private Date remittanceDate;
+
+    /**
+     * 是否收款
+     */
+    private String status;
+
+    private static final long serialVersionUID = 1L;
+}

+ 15 - 0
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/service/mapstruct/JyFinanceInvoiceBaseWrapper.java

@@ -0,0 +1,15 @@
+package com.jeeplus.business.finance.service.mapstruct;
+
+import com.jeeplus.business.finance.domain.JyFinanceInvoiceBase;
+import com.jeeplus.business.finance.service.dto.JyFinanceInvoiceBaseDTO;
+import com.jeeplus.core.mapstruct.EntityWrapper;
+import org.mapstruct.Mapper;
+import org.mapstruct.ReportingPolicy;
+import org.mapstruct.factory.Mappers;
+
+@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE, uses = {})
+public interface JyFinanceInvoiceBaseWrapper extends EntityWrapper<JyFinanceInvoiceBaseDTO, JyFinanceInvoiceBase>{
+
+        JyFinanceInvoiceBaseWrapper INSTANCE = Mappers.getMapper(JyFinanceInvoiceBaseWrapper.class);
+
+}

+ 15 - 0
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/service/mapstruct/JyFinanceInvoiceDetailWrapper.java

@@ -0,0 +1,15 @@
+package com.jeeplus.business.finance.service.mapstruct;
+
+import com.jeeplus.business.finance.domain.JyFinanceInvoiceDetail;
+import com.jeeplus.business.finance.service.dto.JyFinanceInvoiceDetailDTO;
+import com.jeeplus.core.mapstruct.EntityWrapper;
+import org.mapstruct.Mapper;
+import org.mapstruct.ReportingPolicy;
+import org.mapstruct.factory.Mappers;
+
+@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE, uses = {})
+public interface JyFinanceInvoiceDetailWrapper extends EntityWrapper<JyFinanceInvoiceDetailDTO, JyFinanceInvoiceDetail>{
+
+        JyFinanceInvoiceDetailWrapper INSTANCE = Mappers.getMapper(JyFinanceInvoiceDetailWrapper.class);
+
+}

+ 15 - 0
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/service/mapstruct/JyFinanceInvoiceInvalidWrapper.java

@@ -0,0 +1,15 @@
+package com.jeeplus.business.finance.service.mapstruct;
+
+import com.jeeplus.business.finance.domain.JyFinanceInvoiceInvalid;
+import com.jeeplus.business.finance.service.dto.JyFinanceInvoiceInvalidDTO;
+import com.jeeplus.core.mapstruct.EntityWrapper;
+import org.mapstruct.Mapper;
+import org.mapstruct.ReportingPolicy;
+import org.mapstruct.factory.Mappers;
+
+@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE, uses = {})
+public interface JyFinanceInvoiceInvalidWrapper extends EntityWrapper<JyFinanceInvoiceInvalidDTO, JyFinanceInvoiceInvalid>{
+
+        JyFinanceInvoiceInvalidWrapper INSTANCE = Mappers.getMapper(JyFinanceInvoiceInvalidWrapper.class);
+
+}

+ 15 - 0
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/service/mapstruct/JyFinanceInvoiceReceivablesWrapper.java

@@ -0,0 +1,15 @@
+package com.jeeplus.business.finance.service.mapstruct;
+
+import com.jeeplus.business.finance.domain.JyFinanceInvoiceReceivables;
+import com.jeeplus.business.finance.service.dto.JyFinanceInvoiceReceivablesDTO;
+import com.jeeplus.core.mapstruct.EntityWrapper;
+import org.mapstruct.Mapper;
+import org.mapstruct.ReportingPolicy;
+import org.mapstruct.factory.Mappers;
+
+@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE, uses = {})
+public interface JyFinanceInvoiceReceivablesWrapper extends EntityWrapper<JyFinanceInvoiceReceivablesDTO, JyFinanceInvoiceReceivables>{
+
+        JyFinanceInvoiceReceivablesWrapper INSTANCE = Mappers.getMapper(JyFinanceInvoiceReceivablesWrapper.class);
+
+}

+ 15 - 0
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/service/mapstruct/JyFinanceInvoiceWrapper.java

@@ -0,0 +1,15 @@
+package com.jeeplus.business.finance.service.mapstruct;
+
+import com.jeeplus.business.finance.domain.JyFinanceInvoice;
+import com.jeeplus.business.finance.service.dto.JyFinanceInvoiceDTO;
+import com.jeeplus.core.mapstruct.EntityWrapper;
+import org.mapstruct.Mapper;
+import org.mapstruct.ReportingPolicy;
+import org.mapstruct.factory.Mappers;
+
+@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE, uses = {})
+public interface JyFinanceInvoiceWrapper extends EntityWrapper<JyFinanceInvoiceDTO, JyFinanceInvoice>{
+
+        JyFinanceInvoiceWrapper INSTANCE = Mappers.getMapper(JyFinanceInvoiceWrapper.class);
+
+}

+ 323 - 0
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/util/EasyPoiUtil.java

@@ -0,0 +1,323 @@
+package com.jeeplus.business.finance.util;
+
+import cn.afterturn.easypoi.excel.ExcelExportUtil;
+import cn.afterturn.easypoi.excel.ExcelImportUtil;
+import cn.afterturn.easypoi.excel.entity.ExportParams;
+import cn.afterturn.easypoi.excel.entity.ImportParams;
+import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.File;
+import java.io.IOException;
+import java.net.URLEncoder;
+import java.util.List;
+import java.util.Map;
+import java.util.NoSuchElementException;
+
+/**
+ * @Author Steel.D
+ * @Description easypoi导入导出通用工具类
+ * @Date 2019-7-31 9:29
+ * @Param
+ * @return
+ **/
+
+public class EasyPoiUtil {
+
+    /**
+     * 功能描述:复杂导出Excel,包括文件名以及表名。创建表头
+     *
+     * @param list           导出的实体类
+     * @param title          表头名称
+     * @param sheetName      sheet表名
+     * @param pojoClass      映射的实体类
+     * @param isCreateHeader 是否创建表头
+     * @param fileName
+     * @param response
+     * @return
+     * @author Steel.D
+     * @Date 2019-7-31 9:30
+     */
+
+    public static void exportExcel(List <?> list, String title, String sheetName, Class <?> pojoClass, String fileName, boolean isCreateHeader, HttpServletResponse response) {
+
+        ExportParams exportParams = new ExportParams ( title, sheetName );
+
+        exportParams.setCreateHeadRows ( isCreateHeader );
+
+        defaultExport ( list, pojoClass, fileName, response, exportParams );
+
+    }
+
+
+    /**
+     * 功能描述:复杂导出Excel,包括文件名以及表名,不创建表头
+     *
+     * @param list      导出的实体类
+     * @param title     表头名称
+     * @param sheetName sheet表名
+     * @param pojoClass 映射的实体类
+     * @param fileName  文件名
+     * @param response
+     * @return
+     * @author Steel.D
+     * @Date 2019-7-31 9:35
+     */
+
+    public static void exportExcel(List <?> list, String title, String sheetName, Class <?> pojoClass, String fileName, HttpServletResponse response) {
+        ExportParams exportParams = new ExportParams(title, sheetName);
+        exportParams.setDictHandler(new ExcelDiceAddressListHandlerImpl());
+        defaultExport ( list, pojoClass, fileName, response, exportParams );
+
+    }
+
+
+    /**
+     * 功能描述:Map 集合导出
+     *
+     * @param list     实体集合
+     * @param fileName 导出的文件名称
+     * @param response
+     * @return
+     * @author Steel.D
+     * @Date 2019-7-31 9:45
+     */
+
+    public static void exportExcel(List <Map <String, Object>> list, String fileName, HttpServletResponse response) {
+
+        defaultExport ( list, fileName, response );
+
+    }
+
+
+    /**
+     * 功能描述:默认导出方法
+     *
+     * @param list         导出的实体集合
+     * @param fileName     导出的文件名
+     * @param pojoClass    pojo实体
+     * @param exportParams ExportParams封装实体
+     * @param response
+     * @return
+     * @author Steel.D
+     * @Date 2019-7-31 9:50
+     */
+
+    private static void defaultExport(List <?> list, Class <?> pojoClass, String fileName, HttpServletResponse response, ExportParams exportParams) {
+
+        Workbook workbook = ExcelExportUtil.exportExcel ( exportParams, pojoClass, list );
+
+        if ( workbook != null ) {
+
+            downLoadExcel ( fileName, response, workbook );
+
+        }
+
+    }
+
+    /**
+     * 功能描述:Excel导出
+     *
+     * @param fileName 文件名称
+     * @param response
+     * @param workbook Excel对象
+     * @return
+     * @author Steel.D
+     * @Date 2019-7-31 10:35
+     */
+
+    private static void downLoadExcel(String fileName, HttpServletResponse response, Workbook workbook) {
+
+        try {
+
+            response.setCharacterEncoding ( "UTF-8" );
+
+            response.setHeader ( "content-Type", "application/vnd.ms-excel" );
+
+            response.setHeader ( "Content-Disposition", "attachment;filename=" + URLEncoder.encode ( fileName, "UTF-8" ) );
+
+            workbook.write ( response.getOutputStream ( ) );
+
+        } catch (IOException e) {
+
+            throw new RuntimeException ( e );
+
+        }
+
+    }
+
+
+    /**
+     * 功能描述:默认导出方法
+     *
+     * @param list     导出的实体集合
+     * @param fileName 导出的文件名
+     * @param response
+     * @return
+     * @author SteeL.D
+     * @Date 2019-7-31 10:45
+     */
+
+    private static void defaultExport(List <Map <String, Object>> list, String fileName, HttpServletResponse response) {
+
+        Workbook workbook = ExcelExportUtil.exportExcel ( list, ExcelType.HSSF );
+
+        if ( workbook != null ) ;
+
+        downLoadExcel ( fileName, response, workbook );
+
+    }
+
+
+    /**
+     * 功能描述:根据文件路径来导入Excel
+     *
+     * @param filePath   文件路径
+     * @param titleRows  表标题的行数
+     * @param headerRows 表头行数
+     * @param pojoClass  Excel实体类
+     * @return
+     * @author Steel.D
+     * @Date 2019-7-31 11:05
+     */
+
+    public static <T> List <T> importExcel(String filePath, Integer titleRows, Integer headerRows, Class <T> pojoClass) {
+
+        //判断文件是否存在
+
+        if ( StringUtils.isBlank ( filePath ) ) {
+
+            return null;
+
+        }
+
+        ImportParams params = new ImportParams ( );
+
+        params.setTitleRows ( titleRows );
+
+        params.setHeadRows ( headerRows );
+
+        List <T> list = null;
+
+        try {
+
+            list = ExcelImportUtil.importExcel ( new File ( filePath ), pojoClass, params );
+
+        } catch (NoSuchElementException e) {
+
+            throw new RuntimeException ( "模板不能为空" );
+
+        } catch (Exception e) {
+
+            e.printStackTrace ( );
+
+
+        }
+
+        return list;
+
+    }
+
+
+    /**
+     * 功能描述:根据接收的Excel文件来导入Excel,并封装成实体类
+     *
+     * @param file       上传的文件
+     * @param titleRows  表标题的行数
+     * @param headerRows 表头行数
+     * @param pojoClass  Excel实体类
+     * @return
+     * @author Steel.D
+     * @Date 2019-7-31 11:30
+     */
+
+    public static <T> List <T> importExcel(MultipartFile file, Integer titleRows, Integer headerRows, Class <T> pojoClass) {
+
+        if ( file == null ) {
+
+            return null;
+
+        }
+
+        ImportParams params = new ImportParams ( );
+
+        params.setTitleRows ( titleRows );
+
+        params.setHeadRows ( headerRows );
+
+        List <T> list = null;
+
+        try {
+
+            list = ExcelImportUtil.importExcel ( file.getInputStream ( ), pojoClass, params );
+
+        } catch (NoSuchElementException e) {
+
+            throw new RuntimeException ( "excel文件不能为空" );
+
+        } catch (Exception e) {
+            e.printStackTrace ();
+            throw new RuntimeException ( e.getMessage ( ) );
+
+        }
+
+        return list;
+
+    }
+
+    /**
+     * 功能描述:根据接收的Excel文件来导入Excel,并封装成实体类
+     *
+     * @param file       上传的文件
+     * @param titleRows  表标题的行数
+     * @param headerRows 表头行数
+     * @param sheetNum   开始sheet页
+     * @param sheetNum   sheet页数
+     * @param pojoClass  Excel实体类
+     * @return
+     * @author Steel.D
+     * @Date 2019-7-31 11:30
+     */
+    public static <T> List <T> importSheetExcel(MultipartFile file, Integer titleRows, Integer headerRows, Integer startSheetIndex, Integer sheetNum, Class <T> pojoClass) {
+
+        if ( file == null ) {
+
+            return null;
+
+        }
+
+        ImportParams params = new ImportParams ( );
+
+        params.setTitleRows ( titleRows );
+
+        params.setHeadRows ( headerRows );
+
+        params.setStartSheetIndex(startSheetIndex);
+
+        params.setSheetNum(sheetNum);
+
+        List <T> list = null;
+
+        try {
+
+            list = ExcelImportUtil.importExcel ( file.getInputStream ( ), pojoClass, params );
+
+        } catch (NoSuchElementException e) {
+
+            throw new RuntimeException ( "excel文件不能为空" );
+
+        } catch (Exception e) {
+            e.printStackTrace ();
+            throw new RuntimeException ( e.getMessage ( ) );
+
+        }
+
+        return list;
+
+    }
+
+
+}

+ 75 - 0
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/util/ExcelDiceAddressListHandlerImpl.java

@@ -0,0 +1,75 @@
+package com.jeeplus.business.finance.util;
+
+import cn.afterturn.easypoi.handler.inter.IExcelDictHandler;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.extra.spring.SpringUtil;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.TypeReference;
+import com.jeeplus.sys.feign.IDictApi;
+import com.jeeplus.sys.service.dto.DictValueInfoDTO;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+//import com.jeeplus.sys.utils.DictUtils;
+//import com.jeeplus.sys.service.dto.DictValueDTO;
+//import com.jeeplus.sys.utils.DictUtils;
+
+/**
+ * 模拟使用,生产请用真实字典
+ *
+ */
+public class ExcelDiceAddressListHandlerImpl implements IExcelDictHandler {
+
+    /**
+     * 返回字典所有值
+     * key: dictKey
+     *
+     * @param dict 字典Key
+     * @return
+     */
+    @Override
+    public List<Map> getList(String dict) {
+        List<Map> list = new ArrayList<> ();
+//        Map<String, String> dictMap = new HashMap<>();
+//        dictMap.put("dictKey", "0");
+//        dictMap.put("dictValue", "严重瞌睡");
+//        list.add(dictMap);
+//        dictMap = new HashMap<>();
+//        dictMap.put("dictKey", "1");
+//        dictMap.put("dictValue", "小B");
+//        list.add(dictMap);
+//        dictMap = new HashMap<>();
+//        dictMap.put("dictKey", "1");
+//        dictMap.put("dictValue", "深度富有");
+//        list.add(dictMap);
+        String datas = SpringUtil.getBean ( IDictApi.class ).getDictMap (dict);
+        List<DictValueInfoDTO> dictValueDTOs = JSON.parseObject(datas, new TypeReference<List<DictValueInfoDTO>>() {});
+//        List<DictValueInfoDTO> dictValueDTOs = DictUtils.getDictMap ().get (dict);
+        dictValueDTOs.forEach (dictValueDTO -> {
+            Map<String, String> dictMap = new HashMap<> ();
+            dictMap.put ("dictKey", dictValueDTO.getValue ());
+            dictMap.put ("dictValue", dictValueDTO.getLabel ());
+            list.add (dictMap);
+        });
+        return list;
+    }
+
+    @Override
+    public String toName(String dict, Object obj, String name, Object value) {
+        if (ObjectUtil.isNotEmpty(value)) {
+            return SpringUtil.getBean ( IDictApi.class ).getDictLabel (value.toString (), dict, null);
+        }
+        return "";
+    }
+
+    @Override
+    public String toValue(String dict, Object obj, String name, Object value) {
+        if (ObjectUtil.isNotEmpty(value)) {
+            return SpringUtil.getBean ( IDictApi.class ).getDictLabel (value.toString (), dict, null);
+        }
+        return "";
+    }
+}

+ 34 - 0
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/util/FlowTaskUtil.java

@@ -0,0 +1,34 @@
+package com.jeeplus.business.finance.util;
+
+import com.jeeplus.flowable.feign.IFlowableApi;
+
+import javax.annotation.Resource;
+import java.lang.reflect.Field;
+
+//import com.jeeplus.sys.utils.SpringContextHolder;
+//import org.flowable.task.api.Task;
+
+/**
+ * @author: 徐滕
+ * @version: 2022-12-08 15:34
+ */
+public class FlowTaskUtil {
+
+    @Resource
+    private IFlowableApi iFlowableApi;
+
+    /**
+     * 数据整合方法
+     * @param a
+     * @param b
+     * @return
+     */
+    static Field[] concat(Field[] a, Field[] b) {
+
+        Field[] c= new Field[a.length+b.length];
+        System.arraycopy(a, 0, c, 0, a.length);
+        System.arraycopy(b, 0, c, a.length, b.length);
+        return c;
+    }
+
+}

+ 25 - 0
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/util/FreemarkerUtil.java

@@ -0,0 +1,25 @@
+package com.jeeplus.business.finance.util;
+
+import freemarker.template.Template;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.util.Map;
+
+public class FreemarkerUtil {
+    public static void generateFile(Map<?, ?> dataMap, Template template, File file){
+
+        Template t = template;
+        try {
+            // 这个地方不能使用FileWriter因为需要指定编码类型否则生成的Word文档会因为有无法识别的编码而无法打开
+            Writer w = new OutputStreamWriter(new FileOutputStream(file), "UTF-8");
+            t.process(dataMap, w);
+            w.close();
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            throw new RuntimeException(ex);
+        }
+    }
+}

+ 501 - 0
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/util/Global.java

@@ -0,0 +1,501 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.business.finance.util;
+
+import com.google.common.collect.Maps;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.core.io.DefaultResourceLoader;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Map;
+
+/**
+ * 全局配置类
+ * @author jeeplus
+ * @version 2014-06-25
+ */
+public class Global {
+
+	/**
+	 * 当前对象实例
+	 */
+	private static Global global = new Global();
+
+	/**
+	 * 保存全局属性值
+	 */
+	private static Map<String, String> map = Maps.newHashMap();
+
+	/**
+	 * 属性文件加载对象
+	 */
+	private static PropertiesLoader loader = new PropertiesLoader("application-finance.yml");
+
+
+	/**
+	 * 显示/隐藏
+	 */
+	public static final String SHOW = "1";
+	public static final String HIDE = "0";
+
+	/**
+	 * 是/否
+	 */
+	public static final String YES = "1";
+	public static final String NO = "0";
+
+	/**
+	 * 对/错
+	 */
+	public static final String TRUE = "true";
+	public static final String FALSE = "false";
+
+	/**
+	 * 上传文件基础虚拟路径
+	 */
+	public static final String USERFILES_BASE_URL = "/userfiles/";
+
+	/**
+	 * 获取当前对象实例
+	 */
+	public static Global getInstance() {
+		return global;
+	}
+
+	/**
+	 * 获取配置
+	 * @see {fns:getConfig('adminPath')}
+	 */
+	public static String getConfig1(String key) {
+		String value = map.get(key);
+		if (value == null){
+			value = loader.getProperty(key);
+			map.put(key, value != null ? value : StringUtils.EMPTY);
+		}
+		return value;
+	}
+
+	public static String getConfig(String key) {
+		String value = null;
+		try {
+			String property = loader.getProperty("active");
+
+			if (StringUtils.isNotBlank(property)) {
+				switch (property){
+					case "development":
+						PropertiesLoader devLoader = new PropertiesLoader("application-finance-development.yml");
+						value = devLoader.getProperty(key);
+						break;
+					case "production":
+						PropertiesLoader proLoader = new PropertiesLoader("application-finance-production.yml");
+						value = proLoader.getProperty(key);
+						break;
+				}
+			}
+
+		} catch (Exception e) {
+
+		}
+		return value;
+	}
+
+	/**
+	 * 获取管理端根路径
+	 */
+	public static String getAdminPath() {
+		return getConfig("adminPath");
+	}
+	/**
+	 */
+	public static String getAliyunUrl() {
+		return getConfig("aliyunDownloadUrl");
+	}
+	/**
+	 */
+	public static String getAliDownloadUrl() {
+		return getConfig("aliyunUrl");
+	}
+	/**
+	 */
+	public static String getEndpoint() {
+		return getConfig("endpoint");
+	}
+	/**
+	 */
+	public static String getAccessKeyId() {
+		return getConfig("accessKeyId");
+	}
+	/**
+	 */
+	public static String getAccessKeySecret() {
+		return getConfig("accessKeySecret");
+	}
+	/**
+	 */
+	public static String getBucketName() {
+		return getConfig("bucketName");
+	}
+	/**
+	 */
+	public static String getQzBucketName() {
+		return getConfig("qzBucketName");
+	}
+	/**
+	 */
+	public static String getAvatarDir() {
+		return getConfig("avatarDir");
+	}
+	/**
+	 */
+	public static String getNotifyDir() {
+		return getConfig("notifyDir");
+	}
+	/**
+	 */
+	public static String getReportDir() {
+		return getConfig("reportDir");
+	}
+	/**
+	 */
+	public static String getRqcode() {
+		return getConfig("rqcode");
+	}
+	/**
+	 */
+	public static String getGoout() {
+		return getConfig("goout");
+	}
+	/**
+	 */
+	public static String getLeave() {
+		return getConfig("leave");
+	}
+	/**
+	 */
+	public static String getOvertimeform() {
+		return getConfig("overtimeform");
+	}
+	/**
+	 */
+	public static String getSealform() {
+		return getConfig("sealform");
+	}
+	/**
+	 *
+	 */
+	public static String getWorkReimbur() {return getConfig("workReimbur");}
+	/**
+	 */
+	public static String getEvection() {
+		return getConfig("evection");
+	}
+	/**
+	 */
+	public static String getOaBuy() {
+		return getConfig("oaBuy");
+	}
+	/**
+	 */
+	public static String getOaAll() {
+		return getConfig("oaAll");
+	}
+	/**
+	 */
+	public static String getIm() {
+		return getConfig("im");
+	}/**
+	 */
+	public static String getWorkContractInfo() {
+		return getConfig("workContractInfo");
+	}
+	/**
+	 */
+	public static String getNotifyData() {
+		return getConfig("notifyData");
+	}
+    /**
+     */
+    public static String getAppData() {
+        return getConfig("appData");
+    }
+	/**
+	 */
+	public static String getLogo() {
+		return getConfig("logo");
+	}
+    /**
+     */
+	public static String getPhoto() {
+		return getConfig("photo");
+	}
+	/**
+	 *
+	 */
+	public static String getUserEvaluation(){return getConfig("userEvaluation");}
+	/**
+	 */
+	public static String getWorkBidingDocument() {return getConfig("workBidingDocument");}
+	/**
+	 */
+	public static String getWorkEngineeringProject() {return getConfig("workEngineeringProject");}
+
+	/**
+	 */
+	public static String getWorkFullExecute() {return getConfig("workFullExecute");}
+	/**
+	 */
+	public static String getWorkFullMeetingminutes() {return getConfig("workFullMeetingminutes");}
+	/**
+	 */
+	public static String getWorkFullDesignchange(){return getConfig("workFullDesignchange");}
+	/**
+	 */
+	public static String getWorkFullConstructsheet(){return getConfig("workFullConstructsheet");}
+	/**
+	 */
+	public static String getWorkFullProprietorsheet(){return getConfig("workFullProprietorsheet");}
+	/**
+	 */
+	public static String getWorkFullSupervisorsheet(){return getConfig("workFullSupervisorsheet");}
+	/**
+	 */
+	public static String getWorkProjectReport() {return getConfig("workProjectReport");}
+	/**
+	 */
+	public static String getWorkProjectBasis() {return getConfig("workProjectBasis");}
+	/**
+	 */
+	public static String getWorkProjectRemote() {return getConfig("workProjectRemote");}
+	/**
+	 */
+	public static String getWorkProjectSummary() {return getConfig("workProjectSummary");}
+	/**
+	 */
+	public static String getWorkProjectOther() {return getConfig("workProjectOther");}
+	/**
+	 */
+	public static String getWorkVisa() {return getConfig("workVisa");}
+	/**
+	 */
+	public static String getOfficehonor() {return getConfig("Officehonor");}
+	/**
+	 *
+	 */
+	public static String getJobResume() {return getConfig("jobResume");}
+	/**
+	 *
+	 */
+	public static String getSatisfaction() {return getConfig("satisfaction");}
+	/**
+	 *
+	 */
+	public static String getCertificate() {return getConfig("certificate");}
+	/**
+	 *
+	 */
+	public static String getJudgeAttachment() {return getConfig("judgeAttachment");}
+	/**
+	 * 获取前端根路径
+	 */
+	public static String getFrontPath() {
+		return getConfig("frontPath");
+	}
+
+	/**
+	 * 获取URL后缀
+	 */
+	public static String getUrlSuffix() {
+		return getConfig("urlSuffix");
+	}
+
+	/**
+	 * 获取电子签章文件路径
+	 */
+	public static String getISignature() {
+		return getConfig("iSignature");
+	}
+
+	/**
+	 */
+	public static String getOSSUrl() {
+		return getConfig("oSSUrl");
+	}
+	public static String getContractNumPath() {
+		return getConfig("contract_num_path");
+	}
+	/**
+	 * 是否是演示模式,演示模式下不能修改用户、岗位、密码、菜单、授权
+	 */
+	public static Boolean isDemoMode() {
+		String dm = getConfig("demoMode");
+		return "true".equals(dm) || "1".equals(dm);
+	}
+
+	/**
+	 * 在修改系统用户和岗位时是否同步到Activiti
+	 */
+	public static Boolean isSynActivitiIndetity() {
+		String dm = getConfig("activiti.isSynActivitiIndetity");
+		return "true".equals(dm) || "1".equals(dm);
+	}
+
+	/**
+	 * 页面获取常量
+	 * @see {fns:getConst('YES')}
+	 */
+	public static Object getConst(String field) {
+		try {
+			return Global.class.getField(field).get(null);
+		} catch (Exception e) {
+			// 异常代表无配置,这里什么也不做
+		}
+		return null;
+	}
+
+    /**
+     * 获取工程路径
+     * @return
+     */
+    public static String getProjectPath(){
+    	// 如果配置了工程路径,则直接返回,否则自动获取。
+		String projectPath = Global.getConfig("projectPath");
+		if (StringUtils.isNotBlank(projectPath)){
+			return projectPath;
+		}
+		try {
+			File file = new DefaultResourceLoader().getResource("").getFile();
+			if (file != null){
+				while(true){
+					File f = new File(file.getPath() + File.separator + "src" + File.separator + "main");
+					if (f == null || f.exists()){
+						break;
+					}
+					if (file.getParentFile() != null){
+						file = file.getParentFile();
+					}else{
+						break;
+					}
+				}
+				projectPath = file.toString();
+			}
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		return projectPath;
+    }
+
+    /**
+     * 获取短信SMS信息
+     */
+    public static String getSmsUserid() {
+        return getConfig("sms_userid");
+    }
+    public static String getSmsAccount() {
+        return getConfig("sms_account");
+    }
+    public static String getSmsPassword() {
+        return getConfig("sms_password");
+    }
+    public static String getSmsMobile() {
+        return getConfig("sms_mobile");
+    }
+    public static String getSmsContent() {
+        return getConfig("sms_content");
+    }
+    public static String getSmsSendTime() {
+        return getConfig("sms_sendTime");
+    }
+    public static String getSmsAction() {
+        return getConfig("sms_action");
+    }
+    public static String getSmsCheckcontent() {
+        return getConfig("sms_checkcontent");
+    }
+
+	/**
+	 * 获取数据库连接信息
+	 */
+	public static String getJdbcUserName() {
+		return getConfig("jdbc.username");
+	}
+	public static String getJdbcPassword() {
+		return getConfig("jdbc.password");
+	}
+	public static String getJdbcUrl() {
+		return getConfig("jdbc.url");
+	}
+	public static String getJdbcDriver() {
+		return getConfig("jdbc.driver");
+	}
+
+	/**
+	 * 获取容联云账户信息
+	 */
+	public static String getRongUserid() {
+		return getConfig("rong_userid");
+	}
+	public static String getRongToken() {
+		return getConfig("rong_token");
+	}
+	//应用id
+	public static String getAppId() {
+		return getConfig("app_id");
+	}
+	//模板id
+	public static String getTemplateId() {
+		return getConfig("template_id");
+	}
+	//短信发送方式(1:旧的 2:容联云通讯)
+	public static String getCodeType() {
+		return getConfig("code_type");
+	}
+
+    public static String getOpenOfficeAddr() {
+        return getConfig("open_office_addr");
+    }
+
+    public static int getOpenOfficePort() {
+        String openOfficePort = getConfig("open_office_port");
+        return StringUtils.isBlank(openOfficePort)?8100:Integer.valueOf(openOfficePort);
+    }
+    public static String getOpenfireServer() {
+        String openOfficePort = getConfig("openfire.server");
+        return StringUtils.isBlank(openOfficePort)?"oa-pre.ssruihua.com":openOfficePort;
+    }
+    public static String getSysNotify() {
+        String sysNotify = getConfig("sys.notify");
+        return StringUtils.isBlank(sysNotify)?"http://cdn.gangwaninfo.com/jeeplus-resource-data/static/sys/notify.png":sysNotify;
+    }
+
+    public static String getStaffBasicFilePath() {
+        return getConfig("staff_basic_file_path");
+    }
+	public static String getDbName() {
+		return getConfig("db.name");
+	}
+	public static String getVersion() {
+		return getConfig("app_version");
+	}
+	public static String getTestVersion() {
+		return getConfig("app_version_test");
+	}
+
+    public static String getProjectTemplatePath() {
+        return getConfig("project.plan.template.path");
+    }
+
+    public static String getYyApiCode(){
+		return getConfig("yy_apicode");
+	}
+
+	public static String getYyMhUrl(){
+		return getConfig("yy_mhcxurl");
+	}
+
+	public static String getYyShUrl(){
+		return getConfig("yy_shcxurl");
+	}
+}

+ 154 - 0
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/util/PropertiesLoader.java

@@ -0,0 +1,154 @@
+/**
+ * Copyright (c) 2005-2011 springside.org.cn
+ * 
+ * $Id: PropertiesLoader.java 1690 2012-02-22 13:42:00Z calvinxiu $
+ */
+package com.jeeplus.business.finance.util;
+
+import org.apache.commons.io.IOUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.core.io.DefaultResourceLoader;
+import org.springframework.core.io.Resource;
+import org.springframework.core.io.ResourceLoader;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.NoSuchElementException;
+import java.util.Properties;
+
+/**
+ * Properties文件载入工具类. 可载入多个properties文件, 相同的属性在最后载入的文件中的值将会覆盖之前的值,但以System的Property优先.
+ * @author calvin
+ * @version 2013-05-15
+ */
+public class PropertiesLoader {
+
+	private static Logger logger = LoggerFactory.getLogger(PropertiesLoader.class);
+
+	private static ResourceLoader resourceLoader = new DefaultResourceLoader();
+
+	private final Properties properties;
+
+	public PropertiesLoader(String... resourcesPaths) {
+		properties = loadProperties(resourcesPaths);
+	}
+
+	public Properties getProperties() {
+		return properties;
+	}
+
+	/**
+	 * 取出Property,但以System的Property优先,取不到返回空字符串.
+	 */
+	private String getValue(String key) {
+		String systemProperty = System.getProperty(key);
+		if (systemProperty != null) {
+			return systemProperty;
+		}
+		if (properties.containsKey(key)) {
+	        return properties.getProperty(key);
+	    }
+	    return "";
+	}
+
+	/**
+	 * 取出String类型的Property,但以System的Property优先,如果都为Null则抛出异常.
+	 */
+	public String getProperty(String key) {
+		String value = getValue(key);
+		if (value == null) {
+			throw new NoSuchElementException();
+		}
+		return value;
+	}
+
+	/**
+	 * 取出String类型的Property,但以System的Property优先.如果都为Null则返回Default值.
+	 */
+	public String getProperty(String key, String defaultValue) {
+		String value = getValue(key);
+		return value != null ? value : defaultValue;
+	}
+
+	/**
+	 * 取出Integer类型的Property,但以System的Property优先.如果都为Null或内容错误则抛出异常.
+	 */
+	public Integer getInteger(String key) {
+		String value = getValue(key);
+		if (value == null) {
+			throw new NoSuchElementException();
+		}
+		return Integer.valueOf(value);
+	}
+
+	/**
+	 * 取出Integer类型的Property,但以System的Property优先.如果都为Null则返回Default值,如果内容错误则抛出异常
+	 */
+	public Integer getInteger(String key, Integer defaultValue) {
+		String value = getValue(key);
+		return value != null ? Integer.valueOf(value) : defaultValue;
+	}
+
+	/**
+	 * 取出Double类型的Property,但以System的Property优先.如果都为Null或内容错误则抛出异常.
+	 */
+	public Double getDouble(String key) {
+		String value = getValue(key);
+		if (value == null) {
+			throw new NoSuchElementException();
+		}
+		return Double.valueOf(value);
+	}
+
+	/**
+	 * 取出Double类型的Property,但以System的Property优先.如果都为Null则返回Default值,如果内容错误则抛出异常
+	 */
+	public Double getDouble(String key, Integer defaultValue) {
+		String value = getValue(key);
+		return value != null ? Double.valueOf(value) : defaultValue;
+	}
+
+	/**
+	 * 取出Boolean类型的Property,但以System的Property优先.如果都为Null抛出异常,如果内容不是true/false则返回false.
+	 */
+	public Boolean getBoolean(String key) {
+		String value = getValue(key);
+		if (value == null) {
+			throw new NoSuchElementException();
+		}
+		return Boolean.valueOf(value);
+	}
+
+	/**
+	 * 取出Boolean类型的Property,但以System的Property优先.如果都为Null则返回Default值,如果内容不为true/false则返回false.
+	 */
+	public Boolean getBoolean(String key, boolean defaultValue) {
+		String value = getValue(key);
+		return value != null ? Boolean.valueOf(value) : defaultValue;
+	}
+
+	/**
+	 * 载入多个文件, 文件路径使用Spring Resource格式.
+	 */
+	private Properties loadProperties(String... resourcesPaths) {
+		Properties props = new Properties();
+
+		for (String location : resourcesPaths) {
+
+//			logger.debug("Loading properties file from:" + location);
+
+			InputStream is = null;
+			try {
+				Resource resource = resourceLoader.getResource(location);
+				is = resource.getInputStream();
+				props.load(is);
+			} catch (IOException ex) {
+				logger.info("Could not load properties from path:" + location + ", " + ex.getMessage());
+			} finally {
+				IOUtils.closeQuietly(is);
+			}
+		}
+		return props;
+	}
+}

+ 61 - 0
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/util/ResponseUtil.java

@@ -0,0 +1,61 @@
+package com.jeeplus.business.finance.util;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletResponse;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.net.URLEncoder;
+import java.util.Calendar;
+
+public class ResponseUtil {
+    private static Logger logger = LoggerFactory.getLogger(ResponseUtil.class);
+
+    public static void docResponse(String fileName, File file, HttpServletResponse response) {
+        ServletOutputStream out = null;
+        FileInputStream fin = null;
+        try {
+            fin = new FileInputStream(file);
+            response.setCharacterEncoding("utf-8");
+            response.setContentType("application/octet-stream; charset=UTF-8");
+            // 设置浏览器以下载的方式处理该文件名
+            response.setHeader("Content-Disposition", "attachment;filename="
+                    .concat(String.valueOf(URLEncoder.encode(fileName, "UTF-8"))));
+            out = response.getOutputStream();
+            byte[] buffer = new byte[1024];  // 缓冲区
+            int bytesToRead = -1;
+            // 通过循环将读入的Word文件的内容输出到浏览器中
+            while ((bytesToRead = fin.read(buffer)) != -1) {
+                out.write(buffer, 0, bytesToRead);
+            }
+        } catch (Exception e) {
+            logger.error("导出模板文件发生错误!",e);
+        } finally {
+            try {
+                out.flush();
+                if (fin != null) fin.close();
+                if (out != null) out.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+
+        }
+    }
+
+
+    /**
+     * 获取当前时间年月日
+     * @return
+     */
+    public static String datePath(){
+        Calendar date = Calendar.getInstance();
+        String year = String.valueOf(date.get(Calendar.YEAR));
+        String month = String.valueOf(date.get(Calendar.MONTH)+1);
+        String day = String.valueOf(date.get(Calendar.DAY_OF_MONTH));
+        String path = "/"+year+"/"+month+"/"+day;
+        return path;
+    }
+}

+ 818 - 0
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/finance/util/SignaturePostUtil.java

@@ -0,0 +1,818 @@
+package com.jeeplus.business.finance.util;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.jeeplus.business.finance.domain.SealUserInfo;
+
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpStatus;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.config.RequestConfig;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.utils.URLEncodedUtils;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.message.BasicNameValuePair;
+import org.apache.http.util.EntityUtils;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.*;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URL;
+import java.net.URLConnection;
+import java.nio.charset.Charset;
+import java.util.*;
+import java.util.Map.Entry;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+
+
+/**
+ * @author: 徐滕
+ * @create: 2021-11-02 14:20
+ **/
+public class SignaturePostUtil {
+
+    //竖版模板templateId
+    private static final String VERTICALTEMPLATEID = Global.getConfig("vertical_templateId");
+    //横板模板templateId
+    private static final String ACROSSTEMPLATEID = Global.getConfig("across_templateId");
+    private static final String HTTPTOP = Global.getConfig("signature_http_top");
+
+    private final static String apptoken = Global.getConfig("apptoken");
+//    private final static String appsecret = Global.getConfig("appsecret");
+    private final static String signature = Global.getConfig("signature");
+
+
+    /**
+     * 发送get请求
+     *
+     * @param requestUrl
+     *      请求url
+     * @param requestHeader
+     *      请求头
+     * @param responseEncoding
+     *      响应编码
+     * @return 页面响应html
+     */
+    public static String sendGet(String requestUrl, Map<String, String> requestHeader, String responseEncoding) {
+        String result = "";
+        BufferedReader reader = null;
+        try {
+            if (requestUrl == null || requestUrl.isEmpty()) {
+                return result;
+            }
+            URL realUrl = new URL(requestUrl);
+            URLConnection connection = realUrl.openConnection();
+            connection.setRequestProperty("accept", "text/html, application/xhtml+xml, image/jxr, */*");
+            connection.setRequestProperty("user-agent", "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0");
+            if (requestHeader != null && requestHeader.size() > 0) {
+                for (Entry<String, String> entry : requestHeader.entrySet()) {
+                    connection.setRequestProperty(entry.getKey(), entry.getValue());
+                }
+            }
+            connection.connect();
+            if (responseEncoding == null || responseEncoding.isEmpty()) {
+                responseEncoding = "UTF-8";
+            }
+            reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), responseEncoding));
+            String line;
+            while ((line = reader.readLine()) != null) {
+                result += line;
+            }
+        } catch (Exception e) {
+            System.out.println("发送GET请求出现异常!");
+            e.printStackTrace();
+        } finally {
+            try {
+                if (reader != null) {
+                    reader.close();
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+        result = decodeUnicode(result);
+        return result;
+    }
+
+    /**
+     * 发送下载压缩包get请求
+     * @param requestUrl 请求url
+     * @param requestHeader 请求头
+     * @param fileName 下载文件名称
+     * @param responseEncoding 响应编码
+     * @return 页面响应html
+     */
+    public static String downloadZipGet(String requestUrl, Map<String, String> requestHeader, String fileName, String responseEncoding, HttpServletResponse response) {
+        String result = "";
+        BufferedReader reader = null;
+        try {
+            if (requestUrl == null || requestUrl.isEmpty()) {
+                return result;
+            }
+            URL realUrl = new URL(requestUrl);
+            URLConnection connection = realUrl.openConnection();
+            connection.setRequestProperty("accept", "text/html, application/xhtml+xml, image/jxr, */*");
+            connection.setRequestProperty("user-agent", "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0");
+            if (requestHeader != null && requestHeader.size() > 0) {
+                for (Entry<String, String> entry : requestHeader.entrySet()) {
+                    connection.setRequestProperty(entry.getKey(), entry.getValue());
+                }
+            }
+            connection.setRequestProperty("Content-Type", "application/zip");
+            connection.connect();
+            if (responseEncoding == null || responseEncoding.isEmpty()) {
+                responseEncoding = "UTF-8";
+            }
+            InputStream inputStream = connection.getInputStream();
+            //获取自己数组
+            byte[] getData = readInputStream(inputStream);
+
+            //设置HTTP响应头
+            response.reset();//重置 响应头
+            response.setContentType("application/x-download");//告知浏览器下载文件,而不是直接打开,浏览器默认为打开
+            fileName = new String(fileName.getBytes("UTF-8"), "ISO-8859-1");
+            response.addHeader("Content-Disposition" ,"attachment;filename=" +fileName+ "");//下载文件的名称
+            // 循环取出流中的数据
+            response.getOutputStream().write(getData);
+            response.getOutputStream().close();
+
+            if(inputStream!=null){
+                inputStream.close();
+            }
+
+        } catch (Exception e) {
+            System.out.println("发送GET请求出现异常!");
+            e.printStackTrace();
+        } finally {
+            try {
+                if (reader != null) {
+                    reader.close();
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+        return result;
+    }
+
+    /**
+     * 下载文件并保存到指定位置
+     * @param requestUrl 请求url
+     * @param requestHeader 请求头
+     * @param fileName 下载文件名称
+     * @param responseEncoding 响应编码
+     * @return 页面响应html
+     */
+    public static Map<String,Object> downloadZipDesignated(String requestUrl, Map<String, String> requestHeader, String fileName, String responseEncoding) {
+        Map<String,Object> map = new HashMap<>();
+        BufferedReader reader = null;
+        try {
+            if (requestUrl == null || requestUrl.isEmpty()) {
+                map.put("success",false);
+                map.put("message",fileName + " 的请求路径为空");
+                map.put("fileName",fileName);
+                map.put("filePath","");
+                return map;
+            }
+            URL realUrl = new URL(requestUrl);
+            URLConnection connection = realUrl.openConnection();
+            connection.setRequestProperty("accept", "text/html, application/xhtml+xml, image/jxr, */*");
+            connection.setRequestProperty("user-agent", "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0");
+            if (requestHeader != null && requestHeader.size() > 0) {
+                for (Entry<String, String> entry : requestHeader.entrySet()) {
+                    connection.setRequestProperty(entry.getKey(), entry.getValue());
+                }
+            }
+            connection.setRequestProperty("Content-Type", "application/zip");
+            connection.connect();
+            if (responseEncoding == null || responseEncoding.isEmpty()) {
+                responseEncoding = "UTF-8";
+            }
+            InputStream inputStream = connection.getInputStream();
+
+            BufferedInputStream bis = new BufferedInputStream(inputStream);
+            //判断文件的保存路径后面是否以/结尾
+            String filePath = null;
+            if(System.getProperty("os.name").toLowerCase().contains("win")){
+                filePath = "D:/attachment-file/";
+            }else{
+                filePath = "/attachment-file/";
+            }
+            //写入到文件(注意文件保存路径的后面一定要加上文件的名称)
+            fileName = fileName.replaceAll("\\\\","");
+            fileName = fileName.replaceAll("/","");
+            fileName = fileName.replaceAll("\\*","");
+            fileName = fileName.replaceAll("\\?","");
+            fileName = fileName.replaceAll("\"","");
+            fileName = fileName.replaceAll("<","");
+            fileName = fileName.replaceAll(">","");
+            fileName = fileName.replaceAll("\\|","");
+            fileName = fileName.replaceAll("\\’","'");
+            fileName = fileName.replaceAll("\\”","\"");
+            fileName = fileName.replaceAll("【","(");
+            fileName = fileName.replaceAll("\\{","(");
+            fileName = fileName.replaceAll("】",")");
+            fileName = fileName.replaceAll("}",")");
+            fileName = fileName.replaceAll(",",",");
+            fileName = fileName.replaceAll(":",":");
+            fileName = fileName.replaceAll("—","-");
+            fileName = fileName.replaceAll("……","");
+            fileName = fileName.replaceAll("±","");
+            fileName = fileName.replaceAll("#","");
+            fileName = fileName.replaceAll("%","");
+            fileName = fileName.replaceAll("Π","");
+
+            FileOutputStream fileOut = new FileOutputStream(filePath + fileName);
+            BufferedOutputStream bos = new BufferedOutputStream(fileOut);
+
+            byte[] buf = new byte[4096];
+            int length = bis.read(buf);
+            //保存文件
+            while(length != -1)
+            {
+                bos.write(buf, 0, length);
+                length = bis.read(buf);
+            }
+            //response.getOutputStream().close();
+            bos.close();
+            fileOut.close();
+            bis.close();
+            if(inputStream!=null){
+                inputStream.close();
+            }
+            map.put("success",true);
+            map.put("message","下载成功");
+            map.put("fileName",fileName);
+            map.put("filePath",filePath);
+        } catch (Exception e) {
+            System.out.println("发送GET请求出现异常!");
+            e.printStackTrace();
+        } finally {
+            try {
+                if (reader != null) {
+                    reader.close();
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+        return map;
+    }
+
+    /**
+     * 从输入流中获取字节数组
+     * @param inputStream
+     * @return
+     * @throws IOException
+     */
+    public static byte[] readInputStream(InputStream inputStream) throws IOException {
+        byte[] buffer = new byte[1024];
+        int len = 0;
+        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        while((len = inputStream.read(buffer)) != -1) {
+            bos.write(buffer, 0, len);
+        }
+        bos.close();
+        return bos.toByteArray();
+    }
+
+    /**
+     * 发送post请求
+     *
+     * @param requestUrl 请求url
+     * @param requestHeader 请求头
+     * @param formTexts 表单数据
+     * @param files 上传文件
+     * @param requestEncoding 请求编码
+     * @param responseEncoding 响应编码
+     * @return 页面响应html
+     */
+    public static String sendPost(String requestUrl, Map<String, String> requestHeader, Map<String, String> formTexts, File[] files, String requestEncoding, String responseEncoding) {
+        OutputStream out = null;
+        BufferedReader reader = null;
+        String result = "";
+        try {
+            if (requestUrl == null || requestUrl.isEmpty()) {
+                return result;
+            }
+            URL realUrl = new URL(requestUrl);
+            HttpURLConnection connection = (HttpURLConnection) realUrl.openConnection();
+            connection.setRequestProperty("accept", "text/html, application/xhtml+xml, image/jxr, */*");
+            connection.setRequestProperty("user-agent", "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0");
+            if (requestHeader != null && requestHeader.size() > 0) {
+                for (Entry<String, String> entry : requestHeader.entrySet()) {
+                    connection.setRequestProperty(entry.getKey(), entry.getValue());
+                }
+            }
+            connection.setDoOutput(true);
+            connection.setDoInput(true);
+            connection.setRequestMethod("POST");
+            if (requestEncoding == null || requestEncoding.isEmpty()) {
+                requestEncoding = "UTF-8";
+            }
+            if (responseEncoding == null || responseEncoding.isEmpty()) {
+                responseEncoding = "UTF-8";
+            }
+            if (requestHeader != null && requestHeader.size() > 0) {
+                for (Entry<String, String> entry : requestHeader.entrySet()) {
+                    connection.setRequestProperty(entry.getKey(), entry.getValue());
+                }
+            }
+            if (files == null || files.length == 0) {
+                String boundary = "-----------------------------" + String.valueOf(new Date().getTime());
+                connection.setRequestProperty("content-type", "multipart/form-data; boundary=" + boundary);
+                out = new DataOutputStream(connection.getOutputStream());
+                if (formTexts != null && formTexts.size() > 0) {
+                    StringBuilder sbFormData = new StringBuilder();
+                    for (Entry<String, String> entry : formTexts.entrySet()) {
+                        sbFormData.append("--" + boundary + "\r\n");
+                        sbFormData.append("Content-Disposition: form-data; name=\"" + entry.getKey() + "\"\r\n\r\n");
+                        sbFormData.append(entry.getValue() + "\r\n");
+                    }
+                    out.write(sbFormData.toString().getBytes(requestEncoding));
+                }
+            } else {
+                String boundary = "-----------------------------" + String.valueOf(new Date().getTime());
+                connection.setRequestProperty("content-type", "multipart/form-data; boundary=" + boundary);
+                out = new DataOutputStream(connection.getOutputStream());
+                if (formTexts != null && formTexts.size() > 0) {
+                    StringBuilder sbFormData = new StringBuilder();
+                    for (Entry<String, String> entry : formTexts.entrySet()) {
+                        sbFormData.append("--" + boundary + "\r\n");
+                        sbFormData.append("Content-Disposition: form-data; name=\"" + entry.getKey() + "\"\r\n\r\n");
+                        sbFormData.append(entry.getValue() + "\r\n");
+                    }
+                    out.write(sbFormData.toString().getBytes(requestEncoding));
+                }
+                for (File file : files) {
+                    if (!file.exists()) {
+                        continue;
+                    }
+                    out.write(("--" + boundary + "\r\n").getBytes(requestEncoding));
+                    out.write(("Content-Disposition: form-data; name=\" file \"; filename=\"" + file.getName() + "\"\r\n").getBytes(requestEncoding));
+                    out.write(("Content-Type: application/x-msdownload\r\n\r\n").getBytes(requestEncoding));
+                    DataInputStream in = new DataInputStream(new FileInputStream(file));
+                    int bytes = 0;
+                    byte[] bufferOut = new byte[1024];
+                    while ((bytes = in.read(bufferOut)) != -1) {
+                        out.write(bufferOut, 0, bytes);
+                    }
+                    in.close();
+                    out.write(("\r\n").getBytes(requestEncoding));
+                }
+                out.write(("--" + boundary + "--").getBytes(requestEncoding));
+            }
+            out.flush();
+            out.close();
+            out = null;
+            reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), responseEncoding));
+            String line;
+            while ((line = reader.readLine()) != null) {
+                result += line;
+            }
+        } catch (Exception e) {
+            System.out.println("发送POST请求出现异常!");
+            e.printStackTrace();
+        } finally {
+            try {
+                if (out != null) {
+                    out.close();
+                }
+                if (reader != null) {
+                    reader.close();
+                }
+            } catch (IOException ex) {
+                ex.printStackTrace();
+            }
+        }
+        result = decodeUnicode(result);
+        return result;
+    }
+
+    /**
+     * ApplicationJson的post请求
+     * @return
+     */
+    public static String sendPostApplicationJson(String url, String jsonString) {
+        CloseableHttpClient httpClient = null;
+        CloseableHttpResponse httpResponse = null;
+        String result = "";
+        // 创建httpClient实例
+        httpClient = HttpClients.createDefault();
+        // 创建httpPost远程连接实例
+        HttpPost httpPost = new HttpPost(url);
+        // 配置请求参数实例
+        RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(35000)// 设置连接主机服务超时时间
+                .setConnectionRequestTimeout(35000)// 设置连接请求超时时间
+                .setSocketTimeout(60000)// 设置读取数据连接超时时间
+                .build();
+        // 为httpPost实例设置配置
+        httpPost.setConfig(requestConfig);
+        // 设置请求头鉴权
+        httpPost.setHeader("x-qys-accesstoken", apptoken);
+        httpPost.setHeader("x-qys-signature", signature);
+        httpPost.setHeader("x-qys-timestamp", "0");
+        // 包含内容格式设置
+        httpPost.addHeader("Content-Type", "application/json");
+        // 封装post请求参数
+        if (null != jsonString) {
+            // 为httpPost设置封装好的请求参数
+            System.out.println("添加到实体------");
+            httpPost.setEntity(new StringEntity(jsonString, "UTF-8"));
+        }
+        try {
+            // httpClient对象执行post请求,并返回响应参数对象
+            httpResponse = httpClient.execute(httpPost);
+            // 从响应对象中获取响应内容
+            HttpEntity entity = httpResponse.getEntity();
+            result = EntityUtils.toString(entity);
+        } catch (ClientProtocolException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            // 关闭资源
+            if (null != httpResponse) {
+                try {
+                    httpResponse.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+            if (null != httpClient) {
+                try {
+                    httpClient.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        result = decodeUnicode(result);
+        System.out.println(result);
+        return result;
+    }
+    /**
+     * imagePng的post请求
+     * @return
+     */
+    public static String sendPostImagePng(String url, String jsonString) {
+        CloseableHttpClient httpClient = null;
+        CloseableHttpResponse httpResponse = null;
+        String result = "";
+        // 创建httpClient实例
+        httpClient = HttpClients.createDefault();
+        // 创建httpPost远程连接实例
+        HttpPost httpPost = new HttpPost(url);
+        // 配置请求参数实例
+        RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(35000)// 设置连接主机服务超时时间
+                .setConnectionRequestTimeout(35000)// 设置连接请求超时时间
+                .setSocketTimeout(60000)// 设置读取数据连接超时时间
+                .build();
+        // 为httpPost实例设置配置
+        httpPost.setConfig(requestConfig);
+        // 设置请求头鉴权
+        httpPost.setHeader("x-qys-accesstoken", apptoken);
+        httpPost.setHeader("x-qys-signature", signature);
+        httpPost.setHeader("x-qys-timestamp", "0");
+        // 包含内容格式设置
+        httpPost.addHeader("Content-Type", "image/png");
+        // 封装post请求参数
+        if (null != jsonString) {
+            // 为httpPost设置封装好的请求参数
+            System.out.println("添加到实体------");
+            httpPost.setEntity(new StringEntity(jsonString, "UTF-8"));
+        }
+        try {
+            // httpClient对象执行post请求,并返回响应参数对象
+            httpResponse = httpClient.execute(httpPost);
+            // 从响应对象中获取响应内容
+            HttpEntity entity = httpResponse.getEntity();
+            result = EntityUtils.toString(entity);
+        } catch (ClientProtocolException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            // 关闭资源
+            if (null != httpResponse) {
+                try {
+                    httpResponse.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+            if (null != httpClient) {
+                try {
+                    httpClient.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        result = decodeUnicode(result);
+        System.out.println(result);
+        return result;
+    }
+
+    public static String decodeUnicode(String asciicode) {
+        String[] asciis = asciicode.split ("\\\\u");
+        String nativeValue = asciis[0];
+        try
+        {
+            for ( int i = 1; i < asciis.length; i++ )
+            {
+                String code = asciis[i];
+                nativeValue += (char) Integer.parseInt (code.substring (0, 4), 16);
+                if (code.length () > 4)
+                {
+                    nativeValue += code.substring (4, code.length ());
+                }
+            }
+        }
+        catch (NumberFormatException e)
+        {
+            return asciicode;
+        }
+        return nativeValue;
+    }
+
+    /**
+     * 根据文件创建合同信息
+     * @param srcFile
+     * @return
+     */
+    public static HashMap getDocument(File srcFile) {
+        //截取文件后缀名
+        String substring = srcFile.getName().substring(srcFile.getName().lastIndexOf(".")+1, srcFile.getName().length());
+        //截取文件名称
+        String fileName = srcFile.getName().substring(0,srcFile.getName().lastIndexOf("."));
+        //添加请求头
+        Map<String,String> requestHeaderMap = new HashMap<>();
+        requestHeaderMap.put("x-qys-accesstoken", apptoken);
+        requestHeaderMap.put("x-qys-signature", signature);
+        requestHeaderMap.put("x-qys-timestamp", "0");
+        //添加文件参数
+        Map<String,String> formTextsMap = new HashMap<>();
+        formTextsMap.put("title",fileName);
+        formTextsMap.put("fileType",substring);
+        //创建文件数组
+        File[] files = new File[]{srcFile};
+        //访问方法
+        String documentResult = sendPost(HTTPTOP + "/v2/document/createbyfile", requestHeaderMap, formTextsMap, files, "", "");
+        HashMap hashMap = JSON.parseObject(documentResult, HashMap.class);
+
+        return hashMap;
+    }
+
+    /**
+     * 运行无效合同信息
+     * @param fileName
+     * @param invalidFile
+     * @return
+     */
+    public static String getVerticalInvalidDocument(String fileName,File invalidFile){
+        File[] files = new File[]{invalidFile};
+        //添加请求头
+        Map<String,String> requestHeaderMap = new HashMap<>();
+        requestHeaderMap.put("x-qys-accesstoken", apptoken);
+        requestHeaderMap.put("x-qys-signature", signature);
+        requestHeaderMap.put("x-qys-timestamp", "0");
+        //添加文件参数
+        Map<String,String> formTextsMap = new HashMap<>();
+        formTextsMap.put("title",fileName);
+        formTextsMap.put("templateId",VERTICALTEMPLATEID);
+        //访问方法
+        String documentResult = sendPost(HTTPTOP + "/document/createbytemplate", requestHeaderMap, formTextsMap, files, "", "");
+        HashMap hashMap = JSON.parseObject(documentResult, HashMap.class);
+        String code = hashMap.get("code").toString();
+        if("0".equals(code)){
+            String documentId = hashMap.get("documentId").toString();
+            return documentId;
+        }
+        return "";
+    }
+
+    /**
+     * 运行无效合同信息
+     * @param fileName
+     * @param invalidFile
+     * @return
+     */
+    public static String getAcrossVerticalInvalidDocument(String fileName,File invalidFile){
+        File[] files = new File[]{invalidFile};
+        //添加请求头
+        Map<String,String> requestHeaderMap = new HashMap<>();
+        requestHeaderMap.put("x-qys-accesstoken", apptoken);
+        requestHeaderMap.put("x-qys-signature", signature);
+        requestHeaderMap.put("x-qys-timestamp", "0");
+        //添加文件参数
+        Map<String,String> formTextsMap = new HashMap<>();
+        formTextsMap.put("title",fileName);
+        formTextsMap.put("templateId",ACROSSTEMPLATEID);
+        //访问方法
+        String documentResult = sendPost(HTTPTOP + "/document/createbytemplate", requestHeaderMap, formTextsMap, files, "", "");
+        HashMap hashMap = JSON.parseObject(documentResult, HashMap.class);
+        String code = hashMap.get("code").toString();
+        if("0".equals(code)){
+            String documentId = hashMap.get("documentId").toString();
+            return documentId;
+        }
+        return "";
+    }
+
+
+    public static String doGet(Map<String, String> paramMap, String url){
+        String result = "";
+        HttpGet get = new HttpGet(url);
+        try{
+            // 设置请求头鉴权
+            get.setHeader("x-qys-accesstoken", apptoken);
+            get.setHeader("x-qys-signature", signature);
+            get.setHeader("x-qys-timestamp", "0");
+            CloseableHttpClient httpClient = HttpClients.createDefault();
+            List<NameValuePair> params = setHttpParams(paramMap);
+            String param = URLEncodedUtils.format(params, "UTF-8");
+            get.setURI(URI.create(url + "?" + param));
+            HttpResponse response = httpClient.execute(get);
+            result = getHttpEntityContent(response);
+
+            if(response.getStatusLine().getStatusCode()!= HttpStatus.SC_OK){
+                result = "服务器异常";
+            }
+        } catch (Exception e){
+            System.out.println("请求异常");
+            throw new RuntimeException(e);
+        } finally{
+            get.abort();
+        }
+        result = decodeUnicode(result);
+        return result;
+    }
+
+    public static List<NameValuePair> setHttpParams(Map<String, String> paramMap){
+        List<NameValuePair> params = new ArrayList<NameValuePair>();
+        Set<Entry<String, String>> set = paramMap.entrySet();
+        for(Entry<String, String> entry : set){
+            params.add(new BasicNameValuePair(entry.getKey(), entry.getValue()));
+        }
+        return params;
+    }
+
+    public static String getHttpEntityContent(HttpResponse response) throws UnsupportedOperationException, IOException{
+        String result = "";
+        HttpEntity entity = response.getEntity();
+        if(entity != null){
+            InputStream in = entity.getContent();
+            BufferedReader br = new BufferedReader(new InputStreamReader(in, "utf-8"));
+            StringBuilder strber= new StringBuilder();
+            String line = null;
+            while((line = br.readLine())!=null){
+                strber.append(line+'\n');
+            }
+            br.close();
+            in.close();
+            result = strber.toString();
+        }
+
+        return result;
+    }
+
+
+    /**
+     * 根据用户手机号查询用户章信息
+     * @param userMobile
+     * @param employeeNo 用户编号
+     * @param sealName 印章名称
+     * @return
+     */
+    public static String getUserSealByMobile(String userMobile,String employeeNo,String sealName){
+        //根据contractId将文件下载下来 并上传到阿里云服务种
+        //添加请求头
+        Map<String,String> requestHeaderMap = new HashMap<>();
+        requestHeaderMap.put("x-qys-accesstoken", apptoken);
+        requestHeaderMap.put("x-qys-signature", signature);
+        requestHeaderMap.put("x-qys-timestamp", "0");
+
+        Map map =new HashMap();
+        map.put("companyName","江苏兴光项目管理有限公司");
+        map.put("mobile",userMobile);
+        map.put("employeeNo",employeeNo);
+        String viewUrlStr = SignaturePostUtil.doGet(map, HTTPTOP + "/seal/user/charge");
+        HashMap userSealStrMap = JSON.parseObject(viewUrlStr, HashMap.class);
+        String code = userSealStrMap.get("code").toString();
+        if("0".equals(code)){
+            String resultStr = userSealStrMap.get("result").toString();
+            //获取成员印章信息列表
+            List<SealUserInfo> userSealList = (List<SealUserInfo>) JSONArray.parseArray(resultStr, SealUserInfo.class);
+            //ZList <SealUserInfo> userSealList =new Gson().fromJson(resultStr, new TypeToken<List<SealUserInfo>>() {}.getType());
+            if(userSealList.size()>0){
+                //如果需要判定得印章名称不为空则进行精确印章处理
+                if(StringUtils.isNotBlank(sealName)){
+                    for (SealUserInfo userSeal: userSealList) {
+                        if(sealName.equals(userSeal.getName())){
+                            //返回成员印章编号id
+                            return userSeal.getId();
+                        }
+                    }
+                }else{
+                    if(StringUtils.isNotBlank(userSealList.get(0).getId())){
+                        //返回成员第一个印章编号id
+                        return userSealList.get(0).getId();
+                    }
+                }
+            }
+        }
+        return "";
+    }
+
+    /**
+     * 根据合同编号查询签章合同对应的url访问界面
+     * @param contractId 签章合同id
+     * @param contact 签章人手机号
+     * @return
+     */
+    public static String getSignatureContractUrl( String contractId,String contact ){
+        Map map = new HashMap();
+        map.put("contractId",contractId);
+        map.put("tenantType","COMPANY");
+        map.put("tenantName","江苏兴光项目管理有限公司");
+        map.put("contact",contact);
+        String jsonString = JSON.toJSONString(map);
+        String contractIdUrl = SignaturePostUtil.sendPostApplicationJson(HTTPTOP + "/contract/signurl", jsonString);
+        HashMap signUrlHashMap = JSON.parseObject(contractIdUrl, HashMap.class);
+        String code = signUrlHashMap.get("code").toString();
+        if("0".equals(code)){
+            String signUrl = signUrlHashMap.get("signUrl").toString();
+            return signUrl;
+        }
+        return "";
+    }
+
+    /**
+     * zip文件解压
+     * @param file 需解压的文件
+     * @param destDirPath 解压文件地址
+     */
+    public static void unZipFile(File file,String destDirPath){
+        // 开始解压
+        ZipFile zipFile = null;
+        try {
+            //zipFile = new ZipFile(file);
+            //添加解压编码,解决解压报错问题
+            zipFile = new ZipFile(file, Charset.forName("GBK"));
+            Enumeration<?> entries = zipFile.entries();
+            while (entries.hasMoreElements()) {
+                ZipEntry entry = (ZipEntry) entries.nextElement();
+                System.out.println("解压" + entry.getName());
+                // 如果是文件夹,就创建个文件夹
+                if (entry.isDirectory()) {
+                    String dirPath = destDirPath + "/" + entry.getName();
+                    File dir = new File(dirPath);
+                    dir.mkdirs();
+                } else {
+                    // 如果是文件,就先创建一个文件,然后用io流把内容copy过去
+                    File targetFile = new File(destDirPath + "/" + entry.getName());
+                    // 保证这个文件的父文件夹必须要存在
+                    if(!targetFile.getParentFile().exists()){
+                        targetFile.getParentFile().mkdirs();
+                    }
+                    targetFile.createNewFile();
+                    // 将压缩文件内容写入到这个文件中
+                    InputStream is = zipFile.getInputStream(entry);
+                    FileOutputStream fos = new FileOutputStream(targetFile);
+                    int len;
+                    byte[] buf = new byte[1024];
+                    while ((len = is.read(buf)) != -1) {
+                        fos.write(buf, 0, len);
+                    }
+                    // 关流顺序,先打开的后关闭
+                    fos.close();
+                    is.close();
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            if(zipFile != null){
+                try {
+                    zipFile.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                    e.printStackTrace();
+                }
+            }
+        }
+    }
+}
+

+ 1 - 1
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/inscription/controller/InscriptionController.java

@@ -2,12 +2,12 @@ package com.jeeplus.business.inscription.controller;
 
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.jeeplus.assess.utils.FreemarkerUtil;
 import com.jeeplus.business.goOut.service.dto.GoOutDTO;
 import com.jeeplus.business.goOut.service.dto.GoOutDTO;
 import com.jeeplus.business.inscription.domain.Inscription;
 import com.jeeplus.business.inscription.domain.Inscription;
 import com.jeeplus.business.inscription.service.InscriptionService;
 import com.jeeplus.business.inscription.service.InscriptionService;
 import com.jeeplus.business.inscription.service.dto.InscriptionDTO;
 import com.jeeplus.business.inscription.service.dto.InscriptionDTO;
 import com.jeeplus.business.project.domain.JyProject;
 import com.jeeplus.business.project.domain.JyProject;
+import com.jeeplus.business.project.utils.FreemarkerUtil;
 import com.jeeplus.business.project.utils.JyResponseUtil;
 import com.jeeplus.business.project.utils.JyResponseUtil;
 import com.jeeplus.common.utils.ResponseUtil;
 import com.jeeplus.common.utils.ResponseUtil;
 import com.jeeplus.sys.domain.WorkAttachmentInfo;
 import com.jeeplus.sys.domain.WorkAttachmentInfo;

+ 1 - 1
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/monthly/controller/MonthlyController.java

@@ -3,7 +3,7 @@ package com.jeeplus.business.monthly.controller;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.jeeplus.assess.projectRecords.Utils.EasyPoiUtil;
+import com.jeeplus.business.finance.util.EasyPoiUtil;
 import com.jeeplus.business.inscription.service.dto.InscriptionDTO;
 import com.jeeplus.business.inscription.service.dto.InscriptionDTO;
 import com.jeeplus.business.monthly.service.MonthlyService;
 import com.jeeplus.business.monthly.service.MonthlyService;
 import com.jeeplus.business.monthly.service.dto.MonthlyDTO;
 import com.jeeplus.business.monthly.service.dto.MonthlyDTO;

+ 1 - 1
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/project/controller/JyProjectController.java

@@ -9,7 +9,6 @@ import com.jeeplus.business.program.configuration.projectDict.domain.vo.FileDict
 import com.jeeplus.business.program.configuration.projectDict.service.ProjectDictService;
 import com.jeeplus.business.program.configuration.projectDict.service.ProjectDictService;
 import com.jeeplus.business.program.configuration.projectDict.service.dto.ProjectDictDto;
 import com.jeeplus.business.program.configuration.projectDict.service.dto.ProjectDictDto;
 
 
-import com.jeeplus.assess.utils.FreemarkerUtil;
 
 
 import com.jeeplus.business.project.domain.JyProject;
 import com.jeeplus.business.project.domain.JyProject;
 import com.jeeplus.business.project.domain.JyProjectAudit;
 import com.jeeplus.business.project.domain.JyProjectAudit;
@@ -17,6 +16,7 @@ import com.jeeplus.business.project.domain.JyProjectReportsSubmit;
 import com.jeeplus.business.project.service.JyProjectService;
 import com.jeeplus.business.project.service.JyProjectService;
 import com.jeeplus.business.project.service.dto.*;
 import com.jeeplus.business.project.service.dto.*;
 
 
+import com.jeeplus.business.project.utils.FreemarkerUtil;
 import com.jeeplus.business.project.utils.JyResponseUtil;
 import com.jeeplus.business.project.utils.JyResponseUtil;
 import com.jeeplus.business.workContractInfo.domain.JyWorkContractInfo;
 import com.jeeplus.business.workContractInfo.domain.JyWorkContractInfo;
 import com.jeeplus.business.workContractInfo.service.dto.JyWorkContractInfoDto;
 import com.jeeplus.business.workContractInfo.service.dto.JyWorkContractInfoDto;

+ 8 - 0
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/workClientInfo/controller/JyWorkClientController.java

@@ -219,4 +219,12 @@ public class JyWorkClientController {
     public JyWorkClientInfo componentById(@RequestParam String id) {
     public JyWorkClientInfo componentById(@RequestParam String id) {
         return jyWorkClientService.componentById(id);
         return jyWorkClientService.componentById(id);
     }
     }
+
+
+    @ApiOperation(value = "根据id查询客户信息")
+    @GetMapping(value = "getBillingListByClientId")
+    public ResponseEntity<List<JyWorkClientInfo>> getBillingListByClientId(JyWorkClientInfo workClientInfo) throws Exception {
+        List<JyWorkClientInfo> clientInfoList=jyWorkClientService.getBillingListByClientId(workClientInfo);
+        return ResponseEntity.ok(clientInfoList);
+    }
 }
 }

+ 6 - 0
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/workClientInfo/domain/JyWorkClientInfo.java

@@ -188,6 +188,12 @@ public class JyWorkClientInfo extends BaseEntity {
     @TableField(exist = false)
     @TableField(exist = false)
     private String linkId;
     private String linkId;
 
 
+    //开户行及银行账号
+    @TableField(exist = false)
+    private String ourBank;
+    @TableField(exist = false)
+    private String bankNumber;
+
 
 
 
 
 }
 }

+ 2 - 0
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/workClientInfo/mapper/JyWorkClientInfoMapper.java

@@ -28,4 +28,6 @@ public interface JyWorkClientInfoMapper extends BaseMapper<JyWorkClientInfo> {
     List<JyWorkClientLinkman> getByNameInfo(@Param("LinkmanId")String LinkmanId);
     List<JyWorkClientLinkman> getByNameInfo(@Param("LinkmanId")String LinkmanId);
     @InterceptorIgnore(tenantLine = "true")
     @InterceptorIgnore(tenantLine = "true")
     JyWorkClientInfo findById(@Param("id") String id);
     JyWorkClientInfo findById(@Param("id") String id);
+
+    List<JyWorkClientInfo> getBillingListByClientId(@Param(Constants.WRAPPER) QueryWrapper<JyWorkClientInfo> queryWrapper);
 }
 }

+ 13 - 0
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/workClientInfo/mapper/xml/JyWorkClientInfoMapper.xml

@@ -208,4 +208,17 @@
 		LEFT JOIN work_client_job_type_info f ON a.id = f.work_client_id
 		LEFT JOIN work_client_job_type_info f ON a.id = f.work_client_id
 		where  a.id = #{id}
 		where  a.id = #{id}
 	</select>
 	</select>
+
+	<select id="getBillingListByClientId" resultType="com.jeeplus.business.workClientInfo.domain.JyWorkClientInfo">
+		select
+			a.id,
+			a.name,
+			a.address,
+			a.telephone,
+			b.our_bank,
+			b.bank_number
+		from jy_work_client_info a
+		left join jy_work_client_bank b on a.id = b.client_id and b.del_flag = 0
+		${ew.customSqlSegment}
+	</select>
 </mapper>
 </mapper>

+ 18 - 0
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/workClientInfo/service/JyWorkClientService.java

@@ -43,6 +43,7 @@ import java.util.stream.Collectors;
 
 
 @Slf4j
 @Slf4j
 @Service
 @Service
+@Transactional(rollbackFor = Exception.class)
 public class JyWorkClientService {
 public class JyWorkClientService {
 
 
     @Resource
     @Resource
@@ -454,4 +455,21 @@ public class JyWorkClientService {
         JyWorkClientInfo workClientInfo = jyWorkClientInfoMapper.selectById(id);
         JyWorkClientInfo workClientInfo = jyWorkClientInfoMapper.selectById(id);
         return workClientInfo;
         return workClientInfo;
     }
     }
+
+    /**
+     * 根据id查找信息
+     * @param workClientInfo
+     * @return
+     */
+    public List<JyWorkClientInfo> getBillingListByClientId(JyWorkClientInfo workClientInfo) throws Exception {
+        QueryWrapper<JyWorkClientInfo> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("a.del_flag", "0");
+        if (ObjectUtil.isNotEmpty(workClientInfo) && StringUtils.isNotBlank(workClientInfo.getId())) {
+            queryWrapper.eq("a.id", workClientInfo.getId());
+            if (StringUtils.isNotBlank(workClientInfo.getName())) { // 公司名称
+                queryWrapper.like("b.name", workClientInfo.getName());
+            }
+        }
+        return jyWorkClientInfoMapper.getBillingListByClientId(queryWrapper);
+    }
 }
 }

+ 102 - 0
jeeplus-modules/jeeplus-flowable/src/main/java/com/jeeplus/modules/flowable/listener/FinanceListener.java

@@ -0,0 +1,102 @@
+package com.jeeplus.modules.flowable.listener;
+
+import cn.hutool.extra.spring.SpringUtil;
+import com.jeeplus.extension.domain.FlowCopy;
+import com.jeeplus.extension.service.FlowCopyService;
+import com.jeeplus.flowable.model.ActRuTaskInfo;
+import com.jeeplus.flowable.model.Flow;
+import com.jeeplus.flowable.service.FlowTaskService;
+import com.jeeplus.flowable.service.MyNoticeService;
+import com.jeeplus.sys.feign.IPostApi;
+import com.jeeplus.sys.feign.IUserApi;
+import com.jeeplus.sys.service.dto.PostDTO;
+import com.jeeplus.sys.service.dto.UserDTO;
+import lombok.SneakyThrows;
+import org.flowable.engine.RuntimeService;
+import org.flowable.engine.delegate.DelegateExecution;
+import org.flowable.engine.delegate.ExecutionListener;
+import org.flowable.engine.runtime.ProcessInstance;
+import org.springframework.stereotype.Component;
+
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+@Component("FinanceListener")
+public class FinanceListener implements ExecutionListener {
+    @SneakyThrows
+    public void notify(DelegateExecution delegateExecution) {
+        String eventName = delegateExecution.getEventName ( );
+        System.out.println("--------- delegateExecution -----------" + delegateExecution);
+
+        if ( "start".equals ( eventName ) ) {
+            System.out.println ( "start=========" );
+        } else if ( "end".equals ( eventName ) ) {
+            //根据这里的 delegateExecution的id去act_ru_task表中查该流程的数据 对应表中的EXECUTION_ID_
+            ActRuTaskInfo task = SpringUtil.getBean(MyNoticeService.class).getTaskInfoByID(delegateExecution.getId());
+
+            if (null != task) {
+                List<Flow> flows = SpringUtil.getBean(FlowTaskService.class).historicTaskList(task.getProcInstId());
+                //根据PROC_DEF_ID_去act_re_deployment中查询流程的名称
+                String substring = task.getProcDefId().substring(0, task.getProcDefId().indexOf(":"));
+                String actName = SpringUtil.getBean(FlowTaskService.class).getActNameByDefId(substring);
+
+                String titleName = "";
+                // 根据流程定义ID查询流程实例
+                ProcessInstance processInstance = SpringUtil.getBean(RuntimeService.class).createProcessInstanceQuery()
+                        .processInstanceId(task.getProcInstId())
+                        .singleResult();
+
+                if (processInstance != null) {
+                    // 获取流程实例标题变量名(假设标题存储在名为"title"的变量中)
+                    String titleVariableName = "title";
+
+                    // 查询流程实例的标题变量
+                    Object title = SpringUtil.getBean(RuntimeService.class).getVariable(processInstance.getId(), titleVariableName);
+
+                    if (title != null) {
+                        titleName = title.toString();
+                    } else {
+                        // 如果标题变量不存在或者没有值,可以返回默认标题
+                        titleName = "";
+                    }
+                }
+                Flow flow = new Flow();
+                for (int i=0;i<flows.size();i++){
+                    if (flows.get(i).getComment().getMessage().equals("发起流程")){
+                        flow = flows.get(i);
+                    }
+                }
+
+                SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+                UserDTO userDTO = SpringUtil.getBean(IUserApi.class).getById(flow.getAssigneeId());
+                //获取到岗位为财务和出纳的人员信息
+                ArrayList<UserDTO> userDTOS = new ArrayList<>();
+
+
+                PostDTO postDTOByName1 = SpringUtil.getBean(IPostApi.class).getPostDTOByName("总经理");
+                List<UserDTO> listByPostId1 = SpringUtil.getBean(IUserApi.class).findListByPostId(postDTOByName1.getId());
+                userDTOS.addAll(listByPostId1);
+                String finalTitleName = titleName;
+                userDTOS.stream().forEach(item->{
+                    FlowCopy flowCopy = new FlowCopy();
+                    flowCopy.setProcDefId(task.getProcDefId());
+//                        flowCopy.setProcDefId(task.getProcDefId());
+                    flowCopy.setProcInsName(finalTitleName);
+                    flowCopy.setProcInsId(task.getProcInstId());
+                    flowCopy.setUserId(item.getId());
+                    SpringUtil.getBean(FlowCopyService.class).save(flowCopy);
+
+                });
+
+
+            }
+
+            System.out.println ( "end=========" );
+        } else if ( "take".equals ( eventName ) ) {//连线监听
+            System.out.println ( "take=========" );
+        }
+
+    }
+}