Pārlūkot izejas kodu

兴光会计报销代码

user5 3 gadi atpakaļ
vecāks
revīzija
b491d9e024
21 mainītis faili ar 3920 papildinājumiem un 1 dzēšanām
  1. 134 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/controller/AccountantReimbursementBusinessController.java
  2. 261 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/controller/AccountantReimbursementSysController.java
  3. 231 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/controller/AccountantReimbursementUserController.java
  4. 34 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/domain/dto/AccountantReimbursementBusinessDTO.java
  5. 29 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/domain/dto/AccountantReimbursementBusinessReturnDTO.java
  6. 77 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/domain/dto/AccountantReimbursementDTO.java
  7. 64 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/domain/dto/AccountantReimbursementUserDTO.java
  8. 121 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/mapper/AccountantReimbursementBusinessMapper.java
  9. 218 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/mapper/AccountantReimbursementSysMapper.java
  10. 82 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/mapper/AccountantReimbursementUserMapper.java
  11. 247 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/mapper/xml/AccountantReimbursementBusinessMapper.xml
  12. 494 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/mapper/xml/AccountantReimbursementSysMapper.xml
  13. 236 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/mapper/xml/AccountantReimbursementUserMapper.xml
  14. 85 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/service/AccountantReimbursementBusinessService.java
  15. 101 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/service/AccountantReimbursementSysService.java
  16. 80 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/service/AccountantReimbursementUserService.java
  17. 264 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/service/impl/AccountantReimbursementBusinessServiceImpl.java
  18. 529 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/service/impl/AccountantReimbursementSysServiceImpl.java
  19. 322 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/service/impl/AccountantReimbursementUserServiceImpl.java
  20. 310 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/utils/MyBeanUtils.java
  21. 1 1
      jeeplus-web/src/main/resources/application-development.yml

+ 134 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/controller/AccountantReimbursementBusinessController.java

@@ -0,0 +1,134 @@
+package com.jeeplus.test.reimbursementAccountant.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.google.common.collect.Lists;
+import com.jeeplus.aop.demo.annotation.DemoMode;
+import com.jeeplus.aop.logging.annotation.ApiLog;
+import com.jeeplus.sys.utils.StringUtils;
+import com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementBusinessDTO;
+import com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementBusinessReturnDTO;
+import com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementDTO;
+import com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementUserDTO;
+import com.jeeplus.test.reimbursementAccountant.service.AccountantReimbursementBusinessService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Map;
+
+/**
+ * @author 徐滕
+ * @version 1.0.0
+ * @ClassName ReimbursementUserController.java
+ * @Description TODO 报销人员年份金额信息
+ * @createTime 2022年05月16日 10:35:21
+ */
+@RestController
+@RequestMapping("/accountant/reimbursementBusiness")
+public class AccountantReimbursementBusinessController {
+
+    @Autowired
+    private AccountantReimbursementBusinessService service;
+
+    /**
+     * 根据id报销人员信息
+     * @param id
+     * @return
+     */
+    @ApiLog("根据id报销人员信息")
+    @GetMapping("queryById")
+    public ResponseEntity queryById(@RequestParam String id) {
+        AccountantReimbursementBusinessDTO reimbursementDTO = service.queryById (id);
+        return ResponseEntity.ok (reimbursementDTO);
+    }
+
+    /**
+     * 根据id报销人员信息
+     * @param id
+     * @return
+     */
+    @ApiLog("根据id报销人员信息")
+    @PreAuthorize("hasAnyAuthority('accountant:reimbursementBusiness:add')")
+    @GetMapping("getBusinessById")
+    public ResponseEntity getBusinessById(@RequestParam String id) {
+        AccountantReimbursementDTO reimbursementDTO = service.getBusinessById (id);
+        return ResponseEntity.ok (reimbursementDTO);
+    }
+
+    /**
+     * 根据人员id查询报销年份信息
+     * @param reimbursementUser
+     * @param page
+     * @return
+     */
+    @ApiLog("查询角色列表")
+    @GetMapping("getYearList")
+    public ResponseEntity<IPage<AccountantReimbursementUserDTO>> getYearList(AccountantReimbursementUserDTO reimbursementUser, Page<AccountantReimbursementUserDTO> page) {
+        IPage<AccountantReimbursementUserDTO> list = service.getYearList(page,reimbursementUser);
+        return ResponseEntity.ok (list);
+    }
+
+
+    /**
+     * 查询报销信息
+     * @return
+     */
+    @ApiLog("查询报销人员信息列表")
+    @GetMapping("findList")
+    public ResponseEntity findList(AccountantReimbursementUserDTO reimbursementUser, Page<AccountantReimbursementUserDTO> page) {
+        IPage<AccountantReimbursementUserDTO> list = service.findList(page,reimbursementUser);
+        return ResponseEntity.ok(list);
+    }
+
+    /**
+     * 保存业务报销编码
+     * @return
+     */
+    @ApiLog("保存报销人员信息")
+    @PostMapping("save")
+    public ResponseEntity save(@RequestBody AccountantReimbursementBusinessDTO reimbursementUser) {
+        Map<String, Object> result = service.save(reimbursementUser);
+        Boolean success = (Boolean) result.get("success");
+        if(success){
+            return ResponseEntity.ok(result.get("message"));
+        }
+        return ResponseEntity.badRequest ().body (result.get("message"));
+    }
+
+    /**
+     * 批量删除
+     * @param ids
+     * @return
+     */
+    @DemoMode
+    @ApiLog("批量删除")
+    @PreAuthorize("hasAuthority('accountant:reimbursementBusiness:del')")
+    @DeleteMapping("delete")
+    public ResponseEntity delete(String ids) {
+        String idArray[] =ids.split(",");
+        service.delete ( Lists.newArrayList (idArray) );
+        return ResponseEntity.ok ("删除成功!");
+    }
+
+
+
+
+    /**
+     * 查询报销信息
+     * @return
+     */
+    @ApiLog("查询业务报销信息列表")
+    @PreAuthorize("hasAuthority('accountant:reimbursementBusiness:view')")
+    @GetMapping("findListByBusinessCodeId")
+    public ResponseEntity findListByBusinessCodeId(String id) {
+        if(StringUtils.isBlank(id)){
+            return ResponseEntity.badRequest ().body ("请先选择业务信息");
+        }
+        AccountantReimbursementBusinessDTO reimbursementBusiness = new AccountantReimbursementBusinessDTO();
+        reimbursementBusiness.setBusinessCodeId(id);
+        AccountantReimbursementBusinessReturnDTO info = service.findListByBusinessCodeId(reimbursementBusiness);
+        return ResponseEntity.ok(info);
+    }
+}

+ 261 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/controller/AccountantReimbursementSysController.java

@@ -0,0 +1,261 @@
+package com.jeeplus.test.reimbursementAccountant.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.google.common.collect.Lists;
+import com.jeeplus.aop.demo.annotation.DemoMode;
+import com.jeeplus.aop.logging.annotation.ApiLog;
+import com.jeeplus.core.excel.utils.EasyPoiUtil;
+import com.jeeplus.sys.service.dto.RoleDTO;
+import com.jeeplus.sys.service.dto.UserDTO;
+import com.jeeplus.sys.utils.StringUtils;
+import com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementDTO;
+import com.jeeplus.test.reimbursementAccountant.service.AccountantReimbursementSysService;
+import org.springframework.beans.factory.annotation.Autowired;
+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.servlet.http.HttpServletRequest;
+import javax.validation.Valid;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author li-peike
+ * @version 1.0.0
+ * @ClassName ReimbursementSysController.java
+ * @Description TODO 发票信息
+ * @createTime 2022年05月05日 20:41:00
+ */
+@RestController
+@RequestMapping("/accountant/reimbursement")
+public class AccountantReimbursementSysController {
+
+    @Autowired
+    private AccountantReimbursementSysService service;
+
+    /**
+     * 根据id查询业务信息
+     * @param id
+     * @return
+     */
+    @ApiLog("查询业务具体信息")
+    @PreAuthorize("hasAnyAuthority('accountant:reimbursement:view','accountant:reimbursement:add','accountant:reimbursement:edit')")
+    @GetMapping("queryBusinessById")
+    public ResponseEntity queryBusinessById(@RequestParam String id) {
+        AccountantReimbursementDTO reimbursementDTO = service.queryBusinessById (id);
+        return ResponseEntity.ok (reimbursementDTO);
+    }
+
+    /**
+     * 根据发票id查询业务信息
+     * @param id
+     * @return
+     */
+    @ApiLog("根据发票id查询业务具体信息")
+    @PreAuthorize("hasAnyAuthority('accountant:reimbursement:view','accountant:reimbursement:add','accountant:reimbursement:edit')")
+    @GetMapping("queryBusinessByInvoiceId")
+    public ResponseEntity queryBusinessByInvoiceId(@RequestParam String id) {
+        AccountantReimbursementDTO reimbursementDTO = service.queryBusinessByInvoiceId (id);
+        return ResponseEntity.ok (reimbursementDTO);
+    }
+    /**
+     * 根据id查询部门
+     * @param id
+     * @return
+     */
+    @ApiLog("查询发票具体信息")
+    @PreAuthorize("hasAnyAuthority('accountant:reimbursement:view','accountant:reimbursement:add','accountant:reimbursement:edit')")
+    @GetMapping("queryInvoiceById")
+    public ResponseEntity queryInvoiceById(@RequestParam String id) {
+        AccountantReimbursementDTO reimbursementDTO = service.queryInvoiceById (id);
+        return ResponseEntity.ok (reimbursementDTO);
+    }
+
+
+    /**
+     * 查询报销信息
+     * @return
+     */
+    @ApiLog("查询未进行报销流程的发票信息集合")
+    @GetMapping("list")
+    public ResponseEntity list(AccountantReimbursementDTO reimbursementDTO,  Page<AccountantReimbursementDTO> page) {
+        IPage<AccountantReimbursementDTO> list = service.findList(page,reimbursementDTO);
+        return ResponseEntity.ok(list);
+    }
+
+
+    /**
+     * 查询报销信息
+     * @return
+     */
+    @ApiLog("查询业务报销信息")
+    @GetMapping("treeData")
+    public ResponseEntity treeData(AccountantReimbursementDTO reimbursementDTO,  Page<AccountantReimbursementDTO> page) {
+        IPage<AccountantReimbursementDTO> list = service.treeData(page,reimbursementDTO);
+        return ResponseEntity.ok(list);
+    }
+
+    /**
+     * 上传文件
+     * @return
+     * @throws IOException
+     */
+    @ApiLog("上传文件")
+    @RequestMapping("uploadFile")
+    public Map<String,Object> uploadFile(HttpServletRequest request, MultipartFile file) {
+        Map<String,Object> map = new HashMap<>();
+        try {
+            List <AccountantReimbursementDTO> list = EasyPoiUtil.importExcel ( file, 0, 1, AccountantReimbursementDTO.class );
+            /*ImportExcel ei = new ImportExcel(file, 0, 0);
+            List<AccountantReimbursementDTO> list = ei.getDataList(AccountantReimbursementDTO.class);*/
+            map = service.save(list);
+            return map;
+        } catch (Exception e) {
+            map.put("message", "文件上传失败。失败原因:"+ e.getMessage());
+            map.put("success", false);
+            return map;
+        }
+    }
+
+
+    /**
+     * 保存业务报销编码
+     * @return
+     */
+    @ApiLog("保存业务报销编码")
+    @PostMapping("saveBusiness")
+    public ResponseEntity saveBusiness(@Valid @RequestBody AccountantReimbursementDTO reimbursementDTO) {
+        if(StringUtils.isBlank(reimbursementDTO.getBusinessCode())){
+            return ResponseEntity.badRequest ().body ("业务编码不可为空,请重新填写!");
+        }
+        service.saveBusiness(reimbursementDTO);
+        return ResponseEntity.ok("保存业务编码" + reimbursementDTO.getBusinessCode() + "成功");
+    }
+    /**
+     * 保存业务报销编码
+     * @return
+     */
+    @ApiLog("保存业务报销比例")
+    @PostMapping("updateReimbursementRatio")
+    public ResponseEntity updateReimbursementRatio(@Valid @RequestBody AccountantReimbursementDTO reimbursementDTO) {
+        if(StringUtils.isBlank(reimbursementDTO.getReimbursementRatio())){
+            return ResponseEntity.badRequest ().body ("报销比例不可为空,请重新填写!");
+        }
+        service.updateReimbursementRatio(reimbursementDTO);
+        return ResponseEntity.ok("保存业务编码" + reimbursementDTO.getBusinessCode() + "成功");
+    }
+
+
+    /**
+     * 保存发票收款时间
+     * @return
+     */
+    @ApiLog("保存发票收款时间")
+    @PostMapping("saveInvoice")
+    public ResponseEntity saveInvoice(@Valid @RequestBody AccountantReimbursementDTO reimbursementDTO) {
+        service.saveInvoice(reimbursementDTO);
+        return ResponseEntity.ok("保存发票收款时间成功");
+    }
+
+
+    /**
+     * 保存发票收款时间
+     * @return
+     */
+    @ApiLog("修改发票信息")
+    @PostMapping("modifyInvoice")
+    public ResponseEntity modifyInvoice(@Valid @RequestBody AccountantReimbursementDTO reimbursementDTO) {
+        service.modifyInvoice(reimbursementDTO);
+        return ResponseEntity.ok("修改发票信息成功");
+    }
+
+    /**
+     * 批量删除
+     * @param ids
+     * @return
+     */
+    @DemoMode
+    @ApiLog("批量删除")
+    @PreAuthorize("hasAuthority('accountant:reimbursement:del')")
+    @DeleteMapping("delete")
+    public ResponseEntity delete(String ids) {
+        String idArray[] =ids.split(",");
+        service.removeBusinessByIds ( Lists.newArrayList (idArray) );
+        return ResponseEntity.ok ("删除成功!");
+    }
+
+    /**
+     * 保存业务报销编码
+     * @return
+     */
+    @ApiLog("保存收款时间信息")
+    @PostMapping("saveGatheringTime")
+    public ResponseEntity saveGatheringTime(@Valid @RequestBody AccountantReimbursementDTO reimbursementDTO) {
+        if(StringUtils.isBlank(reimbursementDTO.getId())){
+            return ResponseEntity.badRequest ().body ("未选择发票信息!");
+        }
+        if(null == reimbursementDTO.getGatheringTime()){
+            return ResponseEntity.badRequest ().body ("未选择收款时间!");
+        }
+        Map<String, Object> map = service.saveGatheringTime(reimbursementDTO);
+        Boolean success = (Boolean) map.get("success");
+        if(success){
+            return ResponseEntity.ok("保存业务编码" + reimbursementDTO.getBusinessCode() + "成功");
+        }
+        return ResponseEntity.badRequest().body ( map.get("message"));
+    }
+
+    /**
+     * 删除业务信息
+     * @param ids
+     * @return
+     */
+    @DemoMode
+    @ApiLog("删除业务信息")
+    @PreAuthorize("hasAuthority('accountant:reimbursement:del')")
+    @DeleteMapping("deleteBusiness")
+    public ResponseEntity deleteBusiness(String ids) {
+        String idArray[] =ids.split(",");
+        service.removeBusinessByIds ( Lists.newArrayList (idArray) );
+        return ResponseEntity.ok ("删除成功!");
+    }
+
+    /**
+     * 删除发票信息
+     * @param ids
+     * @return
+     */
+    @DemoMode
+    @ApiLog("删除发票信息")
+    @PreAuthorize("hasAuthority('accountant:reimbursement:del')")
+    @DeleteMapping("deleteInvoice")
+    public ResponseEntity deleteInvoice(String ids) {
+        String idArray[] =ids.split(",");
+        service.removeInvoiceByIds ( Lists.newArrayList (idArray) );
+        return ResponseEntity.ok ("删除成功!");
+    }
+
+    /**
+     * 批次报销
+     * @param invoiceNumbers
+     * @return
+     */
+    @DemoMode
+    @ApiLog("批次报销")
+    @PreAuthorize("hasAuthority('accountant:reimbursement:addBatchReimbursement')")
+    @PutMapping("addBatchReimbursement")
+    public ResponseEntity addBatchReimbursement(String[] invoiceNumbers) {
+        ArrayList<String> invoiceIdList = Lists.newArrayList(invoiceNumbers);
+        if(invoiceIdList.size()<=0){
+            return ResponseEntity.badRequest().body ("请选择需要批量报销的发票信息");
+        }
+        service.addBatchReimbursement (invoiceIdList);
+        return ResponseEntity.ok ("批量报销操作成功");
+    }
+}

+ 231 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/controller/AccountantReimbursementUserController.java

@@ -0,0 +1,231 @@
+package com.jeeplus.test.reimbursementAccountant.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.google.common.collect.Lists;
+import com.jeeplus.aop.demo.annotation.DemoMode;
+import com.jeeplus.aop.logging.annotation.ApiLog;
+import com.jeeplus.common.beanvalidator.BeanValidators;
+import com.jeeplus.core.excel.utils.EasyPoiUtil;
+import com.jeeplus.sys.service.dto.UserDTO;
+import com.jeeplus.sys.utils.DictUtils;
+import com.jeeplus.sys.utils.StringUtils;
+import com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementBusinessReturnDTO;
+import com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementUserDTO;
+import com.jeeplus.test.reimbursementAccountant.service.AccountantReimbursementUserService;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+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.servlet.http.HttpServletResponse;
+import javax.validation.ConstraintViolationException;
+import java.time.LocalDate;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author 徐滕
+ * @version 1.0.0
+ * @ClassName ReimbursementUserController.java
+ * @Description TODO 报销人员年份金额信息
+ * @createTime 2022年05月16日 10:35:21
+ */
+@RestController
+@RequestMapping("/accountant/reimbursementUser")
+public class AccountantReimbursementUserController {
+
+    @Autowired
+    private AccountantReimbursementUserService service;
+
+    /**
+     * 根据id报销人员信息
+     * @param id
+     * @return
+     */
+    @ApiLog("根据id报销人员信息")
+    @PreAuthorize("hasAnyAuthority('accountant:reimbursementUser:view','accountant:reimbursementUser:add','accountant:reimbursementUser:edit')")
+    @GetMapping("queryById")
+    public ResponseEntity queryById(@RequestParam String id) {
+        AccountantReimbursementUserDTO reimbursementDTO = service.queryById (id);
+        return ResponseEntity.ok (reimbursementDTO);
+    }
+
+    /**
+     * 根据id报销人员信息
+     * @return
+     */
+    @ApiLog("查询字典中日报销额度和年度假日天数")
+    @PreAuthorize("hasAnyAuthority('accountant:reimbursementUser:add')")
+    @GetMapping("getReimbursementQuotaDay")
+    public ResponseEntity getReimbursementQuotaDay() {
+        AccountantReimbursementUserDTO reimbursementDTO = new AccountantReimbursementUserDTO();
+        //获取日报销额度
+        String reimbursementQuotaDay = DictUtils.getDictLabel("1", "reimbursement_quota_day", null);
+        //获取当年度的总天数
+        int yearDay = LocalDate.now().lengthOfYear();
+        //获取年度休假天数
+        String holidayDay = DictUtils.getDictLabel("1", "reimbursement_holiday_day", null);
+        Integer reimbursementAllDay = yearDay;
+        if(StringUtils.isNotBlank(holidayDay)){
+            int i = Integer.parseInt(holidayDay);
+            reimbursementAllDay = yearDay - Integer.parseInt(holidayDay);
+        }
+        reimbursementDTO.setReimbursementQuotaDay(reimbursementQuotaDay);
+        reimbursementDTO.setReimbursementAllDay(reimbursementAllDay);
+        return ResponseEntity.ok (reimbursementDTO);
+    }
+
+
+    /**
+     * 查询报销信息
+     * @return
+     */
+    @ApiLog("查询报销人员信息列表")
+    @GetMapping("findList")
+    public ResponseEntity findList(AccountantReimbursementUserDTO reimbursementUser, Page<AccountantReimbursementUserDTO> page) {
+        IPage<AccountantReimbursementUserDTO> list = service.findList(page,reimbursementUser);
+        return ResponseEntity.ok(list);
+    }
+
+    /**
+     * 保存业务报销编码
+     * @return
+     */
+    @ApiLog("保存报销人员信息")
+    @PostMapping("save")
+    public ResponseEntity save(@RequestBody AccountantReimbursementUserDTO reimbursementUser) {
+        Map<String, Object> result = service.save(reimbursementUser);
+        Boolean success = (Boolean) result.get("success");
+        if(success){
+            return ResponseEntity.ok(result.get("message"));
+        }
+        return ResponseEntity.badRequest ().body (result.get("message"));
+    }
+
+    /**
+     * 批量删除
+     * @param ids
+     * @return
+     */
+    @DemoMode
+    @ApiLog("批量删除")
+    @PreAuthorize("hasAuthority('accountant:reimbursementUser:del')")
+    @DeleteMapping("delete")
+    public ResponseEntity delete(String ids) {
+        String idArray[] =ids.split(",");
+        Map<String, Object> result = service.delete(Lists.newArrayList(idArray));
+        if(!(Boolean) result.get("success")){
+            return ResponseEntity.badRequest ().body (result.get("message"));
+        }
+        return ResponseEntity.ok (result.get("message"));
+    }
+
+
+
+    /**
+     * 查询报销信息
+     * @return
+     */
+    @ApiLog("查询业务报销信息列表")
+    @PreAuthorize("hasAuthority('accountant:reimbursementBusiness:view')")
+    @GetMapping("findListByUserId")
+    public ResponseEntity findListByUserId(String id) {
+        if(StringUtils.isBlank(id)){
+            return ResponseEntity.badRequest ().body ("请先选择报销人员信息");
+        }
+
+        //根据id查询人员填报的报销信息
+        AccountantReimbursementUserDTO reimbursementUserDTO = service.queryById(id);
+        if(null == reimbursementUserDTO){
+            return ResponseEntity.badRequest ().body ("报销人员信息无效,请重新选择");
+        }
+        AccountantReimbursementBusinessReturnDTO info = service.findListByUserId(reimbursementUserDTO);
+        return ResponseEntity.ok(info);
+    }
+    /**
+     * 下载导入用户数据模板
+     *
+     * @param response
+     * @return
+     */
+    @PreAuthorize ("hasAnyAuthority('accountant:reimbursementUser:import')")
+    @GetMapping("import/template")
+    @ApiOperation(value = "下载模板")
+    public void importFileTemplate(HttpServletResponse response) {
+        String fileName = "报销人员数据导入模板.xlsx";
+        List<AccountantReimbursementUserDTO> list = Lists.newArrayList();
+        EasyPoiUtil.exportExcel ( list, "报销人员数据",  "报销人员数据", AccountantReimbursementUserDTO.class, fileName, response );
+    }
+
+    /**
+     * 导入用户数据
+     *
+     * @return
+     */
+    @DemoMode
+    @PreAuthorize("hasAnyAuthority('accountant:reimbursementUser:import')")
+    @PostMapping("import")
+    @ApiOperation(value = "导入员工报销信息excel")
+    public ResponseEntity importFile(MultipartFile file) {
+        try {
+            int successNum = 0;
+            int failureNum = 0;
+            StringBuilder failureMsg = new StringBuilder ( );
+            List <AccountantReimbursementUserDTO> list = EasyPoiUtil.importExcel ( file, 1, 1, AccountantReimbursementUserDTO.class );
+            List<AccountantReimbursementUserDTO> saveList = Lists.newArrayList();
+            Map<String, Object> resultMap = new HashMap<>();
+            for (AccountantReimbursementUserDTO user : list) {
+                try {
+                    //根据部门和人员名称查询人员信息
+                    List<UserDTO> userByNameAndOfficeName = service.getUserByNameAndOfficeName(user);
+                    if(userByNameAndOfficeName.size()>1){
+                        failureMsg.append ( "。 " + user.getOfficeName() + " 部门下的员工 " + user.getUserName() + " 存在多个,无法进行导入;" );
+                        failureNum++;
+                    }else if(userByNameAndOfficeName.size() == 0){
+                        failureMsg.append ( "。 " + user.getOfficeName() + " 部门下的员工 " + user.getUserName() + " 不存在,无法进行导入;" );
+                        failureNum++;
+                    }else {
+                        user.setUserId(userByNameAndOfficeName.get(0).getId());
+                        user.setUser(userByNameAndOfficeName.get(0));
+                        user.setKeyFlag(user.getYear() + user.getUserId());
+                        saveList.add(user);
+                        successNum ++;
+                    }
+                } catch (ConstraintViolationException ex) {
+                    failureMsg.append ( "。 " + user.getOfficeName() + " 部门下的员工 " + user.getUserName() + " 导入失败:" );
+                    List <String> messageList = BeanValidators.extractPropertyAndMessageAsList ( ex, ": " );
+                    for (String message : messageList) {
+                        failureMsg.append ( message + "; " );
+                        failureNum++;
+                    }
+                } catch (Exception ex) {
+                    failureNum++;
+                    failureMsg.append ( "。 " + user.getOfficeName() + " 部门下的员工 " + user.getUserName() + " 导入失败:" + ex.getMessage ( ) );
+                }
+            }
+
+            if ( failureNum > 0 ) {
+                failureMsg.insert ( 0, ",失败 " + failureNum + " 条员工报销数据,导入信息如下:" );
+            }
+
+            if(saveList.size()>0){
+                resultMap = service.saveList(saveList);
+
+                Boolean success = (Boolean) resultMap.get("success");
+                if(!success){
+                    return ResponseEntity.badRequest().body ( resultMap.get("message"));
+                }
+                Object saveCount = resultMap.get("saveCount");
+                Object message = resultMap.get("message");
+                return ResponseEntity.ok ( "已成功导入 " + saveCount + " 条员工报销数据" + failureMsg+message );
+            }
+            return ResponseEntity.ok ( "已成功导入 " + successNum + " 条员工报销数据" + failureMsg );
+        } catch (Exception e) {
+            return ResponseEntity.badRequest().body ( "导入员工报销数据失败!失败信息:" + e.getMessage ( ) );
+        }
+    }
+}

+ 34 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/domain/dto/AccountantReimbursementBusinessDTO.java

@@ -0,0 +1,34 @@
+package com.jeeplus.test.reimbursementAccountant.domain.dto;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.jeeplus.core.domain.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 报销信息表
+ * @author: 徐滕
+ * @version: 2022-05-16 11:06
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@TableName("zs_reimbursement_business_info")
+public class AccountantReimbursementBusinessDTO extends BaseEntity {
+
+    private static final long serialVersionUID = 1L;
+
+    private String businessCode;  //业务编号
+    private String businessCodeId;  //业务编号Id
+    private String userId;  //报销人id
+    private String userName;  //报销人
+    private String year;    //报销年份
+    private String reimbursementQuota;  //年报销额度
+    private String reimbursementQuotaDay;  //日报销额度
+    private String reimbursementDay;  //报销天数
+    private String reimbursementType;  //报销类型(1:正常报销;2:补差)
+    private String reimbursementAmount;  //报销额度
+    private String remainReimbursementAmount;  //剩余报销额度
+    private String remarks; //备注
+
+
+}

+ 29 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/domain/dto/AccountantReimbursementBusinessReturnDTO.java

@@ -0,0 +1,29 @@
+package com.jeeplus.test.reimbursementAccountant.domain.dto;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.List;
+
+/**
+ * 报销信息表(返回信息表)
+ * @author: 徐滕
+ * @version: 2022-05-16 11:06
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class AccountantReimbursementBusinessReturnDTO {
+
+    private static final long serialVersionUID = 1L;
+
+    private String reimbursementQuotaDay;  //日报销额度
+    private String reimbursementDay;  //报销天数
+    private String alreadyReimbursementDay;  //已报销天数
+    private String surplusReimbursementDay;  //剩余报销天数
+    private String reimbursementQuota;  //报销额度
+    private String alreadyReimbursementAmount;  //已报销额度
+    private String surplusReimbursementAmount;  //剩余报销额度
+    private List<AccountantReimbursementBusinessDTO> list;
+
+
+}

+ 77 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/domain/dto/AccountantReimbursementDTO.java

@@ -0,0 +1,77 @@
+package com.jeeplus.test.reimbursementAccountant.domain.dto;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.jeeplus.core.domain.TreeEntity;
+import com.jeeplus.sys.utils.StringUtils;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 中审报表数据表
+ * @author: 徐滕
+ * @version: 2022-05-11 10:31
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@TableName("zs_reimbursement_info")
+public class AccountantReimbursementDTO extends TreeEntity<AccountantReimbursementDTO> {
+    private static final long serialVersionUID = 1L;
+    @Excel(name = "业务编号")
+    private String businessCode;    //业务编号
+    private String businessCodeId;    //业务编号id
+    @Excel(name = "发票代码")
+    private String invoiceCode;     //发票代码
+    @Excel(name = "发票号码")
+    private String invoiceNumber;   //发票号码
+    @Excel(name = "购方企业名称")
+    private String firmName;        //购方企业名称
+
+    @DateTimeFormat(pattern =  "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    @Excel(name = "开票日期")
+    private Date makeTime;          //开票日期
+    @Excel(name = "商品名称")
+    private String name;     //商品名称
+    @Excel(name = "金额")
+    private String money;       //金额
+    @Excel(name = "税额")
+    private String tax;         //税额
+    @Excel(name = "收入")
+    private String income;      //收入
+    @Excel(name = "申请人")
+    private String proposer;        //申请人
+    @Excel(name = "合伙人")
+    private String partner;         //合伙人
+    @Excel(name = "业务类型")
+    private String businessType;    //业务类型
+    private String remarks;    //备注
+    private Integer type;    //状态
+    private String reimbursementRatio;    //报销比例
+    private String allAlreadyReimbursementQuota;    //总报销额度(已报金额)
+    private String canReimbursementAmount;    //可报销额度
+    private String surplusReimbursementAmount;    //剩余报销额度
+    private String reimbursementType;    //报销比例
+    private String gatheringStatus;    //收款状态
+    private String reimbursementStatus;    //报销状态
+    private List<String> idList;
+    private String businessFlag;    //报销判定条件(1:表示该数据没有业务编码,即没有进行报销;0:表示该数据有业务编码)
+    private String batchFlag;    //批量报销状态(1:批量报销)(仅业务表中使用)
+
+    @DateTimeFormat(pattern =  "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date gatheringTime;     //收款日期
+
+
+    public String getReimbursementType() {
+        if(StringUtils.isBlank(this.reimbursementType)){
+            this.reimbursementType = "1";
+        }
+        return reimbursementType;
+    }
+}

+ 64 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/domain/dto/AccountantReimbursementUserDTO.java

@@ -0,0 +1,64 @@
+package com.jeeplus.test.reimbursementAccountant.domain.dto;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.jeeplus.core.domain.BaseEntity;
+import com.jeeplus.sys.service.dto.UserDTO;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.hibernate.validator.constraints.Length;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * 报销人员表
+ * @author: 徐滕
+ * @version: 2022-05-16 11:06
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@TableName("zs_reimbursement_user_info")
+public class AccountantReimbursementUserDTO extends BaseEntity {
+
+    @Excel(name = "姓名")
+    @Length(min = 1, max = 100)
+    @NotNull(message = "姓名不能为空")
+    private String userName;//员工姓名
+    @Excel(name = "部门")
+    @Length(min = 1, max = 100)
+    @NotNull(message = "部门不能为空")
+    private String officeName;//部门名称
+
+    private String userId;  //报销人id
+    private UserDTO user;   //报销人员信息
+
+    @Excel(name = "报销年份")
+    @Length(min = 1, max = 100)
+    @NotNull(message = "报销年份不能为空")
+    private String year;    //报销年份
+    @Excel(name = "年报销额度")
+    @Length(min = 1, max = 100)
+    @NotNull(message = "年报销额度不能为空")
+    private String reimbursementQuota;  //年报销额度
+
+    @Excel(name = "年可报销天数")
+    @NotNull(message = "年可报销天数不能为空")
+    private Integer reimbursementAllDay;  //年可报销天数
+    @Excel(name = "日报销额度")
+    @Length(min = 1, max = 100)
+    @NotNull(message = "日报销额度不能为空")
+    private String reimbursementQuotaDay;  //日报销额度
+    private String reimbursementDay;  //报销天数
+    private String reimbursementAmount;  //报销额度
+    private String remainReimbursementAmount;  //剩余报销额度
+    private String alreadyReimbursementAmount;  //已报销额度
+    private String remarks; //备注
+
+
+    private String alreadyReimbursementDay;  //已报销天数
+    private String surplusReimbursementDay;  //剩余报销天数
+    private String surplusReimbursementAmount;  //剩余报销额度
+    private String keyFlag; //用于判断使用
+
+
+}

+ 121 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/mapper/AccountantReimbursementBusinessMapper.java

@@ -0,0 +1,121 @@
+package com.jeeplus.test.reimbursementAccountant.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementBusinessDTO;
+import com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementDTO;
+import com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementUserDTO;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @author li-peike
+ * @version 1.0.0
+ * @ClassName ReimbursementSysMapper.java
+ * @Description TODO
+ * @createTime 2022年05月06日 10:40:00
+ */
+@Mapper
+public interface AccountantReimbursementBusinessMapper extends BaseMapper<AccountantReimbursementUserDTO> {
+    /**
+     * 根据条件查询数据信息
+     * @param page
+     * @param reimbursementUser
+     * @return
+     */
+    IPage<AccountantReimbursementUserDTO> findList(Page<AccountantReimbursementUserDTO> page, @Param("reimbursementUser")AccountantReimbursementUserDTO reimbursementUser);
+    /**
+     * 根据条件查询数据信息
+     * @param reimbursementBusiness
+     * @return
+     */
+    List<AccountantReimbursementBusinessDTO> findListByBusinessCodeId(AccountantReimbursementBusinessDTO reimbursementBusiness);
+    /**
+     * 根据条件查询数据信息
+     * @param reimbursementBusiness
+     * @return
+     */
+    List<AccountantReimbursementBusinessDTO> findListByUserIdAndYear(AccountantReimbursementBusinessDTO reimbursementBusiness);
+    /**
+     * 根据条件查询数据信息
+     * @param page
+     * @param reimbursementUser
+     * @return
+     */
+    IPage<AccountantReimbursementUserDTO> getYearList(Page<AccountantReimbursementUserDTO> page, @Param("reimbursementUser")AccountantReimbursementUserDTO reimbursementUser);
+    /**
+     * 根据条件查询数据信息
+     * @param reimbursementUser
+     * @return
+     */
+    List<AccountantReimbursementUserDTO> getReimbursementMoneyByYear(AccountantReimbursementUserDTO reimbursementUser);
+
+    /**
+     * 保存人员报销信息
+     * @param reimbursementUser
+     */
+    void save(AccountantReimbursementBusinessDTO reimbursementUser);
+
+    /**
+     * 修改人员报销信息
+     * @param reimbursementUser
+     */
+    void update(AccountantReimbursementBusinessDTO reimbursementUser);
+
+    /**
+     * 查询业务信息
+     * @param id
+     * @return
+     */
+    AccountantReimbursementBusinessDTO queryById(String id);
+
+    /**
+     * 查询业务信息
+     * @param reimbursementUser
+     * @return
+     */
+    AccountantReimbursementUserDTO reimbursementUserByUserIdAndYear(AccountantReimbursementBusinessDTO reimbursementUser);
+
+    /**
+     * 查询报销信息(根据人员id和年份)
+     * @param reimbursementUser
+     * @return
+     */
+    AccountantReimbursementUserDTO queryByUserIdAndYear(AccountantReimbursementBusinessDTO reimbursementUser);
+
+    /**
+     * 根据id删除人员报销信息(物理删除)
+     * @param idList
+     */
+    void delete(@Param("idList") List<String> idList);
+
+    /**
+     * 根据人员id和年份查询该员工当年报销额度总额
+     * @param reimbursementUser
+     * @return
+     */
+    String getAlreadyReimbursementQuotaByUserIdAndYear(AccountantReimbursementBusinessDTO reimbursementUser);
+
+    /**
+     * 根据人员id和年份查询该员工当年报销额度总额
+     * @param reimbursementUser
+     * @return
+     */
+    String getAlreadyReimbursementQuotaByBusinessCodeId(AccountantReimbursementBusinessDTO reimbursementUser);
+
+    /**
+     * 根据业务id查询收款状态
+     * @param reimbursementUser
+     * @return
+     */
+    String getGatheringStatusById(AccountantReimbursementBusinessDTO reimbursementUser);
+
+    /**
+     * 修改业务报销是否完成状态
+     * @param reimbursementDTO
+     */
+    void updateReimbursementInfo(AccountantReimbursementDTO reimbursementDTO);
+}

+ 218 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/mapper/AccountantReimbursementSysMapper.java

@@ -0,0 +1,218 @@
+package com.jeeplus.test.reimbursementAccountant.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementDTO;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @author li-peike
+ * @version 1.0.0
+ * @ClassName ReimbursementSysMapper.java
+ * @Description TODO
+ * @createTime 2022年05月06日 10:40:00
+ */
+@Mapper
+public interface AccountantReimbursementSysMapper extends BaseMapper<AccountantReimbursementDTO> {
+    /**
+     * 根据条件查询数据信息
+     * @param page
+     * @param reimbursement
+     * @return
+     */
+    IPage<AccountantReimbursementDTO> findList(Page<AccountantReimbursementDTO> page, @Param("reimbursement")AccountantReimbursementDTO reimbursement);
+
+    /**
+     * 根据条件查询数据信息
+     * @param page
+     * @param reimbursement
+     * @return
+     */
+    IPage<AccountantReimbursementDTO> queryAllList(Page<AccountantReimbursementDTO> page, @Param("reimbursement")AccountantReimbursementDTO reimbursement);
+
+
+    List<AccountantReimbursementDTO> getInvoiceList(AccountantReimbursementDTO reimbursement);
+
+    /**
+     * 根据父id查询已收款的发票信息的首款额度总和
+     * @param parentId
+     * @return
+     */
+    String getReceiptInvoiceIncomeByReimbursementId(String parentId);
+
+    /**
+     * 根据业务id查询报销比例
+     * @param id
+     * @return
+     */
+    String getReimbursementRatioByReimbursementId(String id);
+
+    /**
+     * 根据父节点id查询发票信息
+     * @param parentIdList
+     * @return
+     */
+    List<AccountantReimbursementDTO> getInvoiceByParentIdList(@Param("parentIdList")List<String> parentIdList);
+
+    /**
+     * 查询是否存在需要保存的发票信息
+     * @param invoiceNumberList
+     * @return
+     */
+    List<String> selectOldInvoiceNumber(@Param("invoiceNumberList") List<String> invoiceNumberList);
+
+    /**
+     * 查询是否存在已有的业务编号信息
+     * @param businessCodeList
+     * @return
+     */
+    List<String> selectOldBusinessCode(@Param("businessCodeList") List<String> businessCodeList);
+
+    /**
+     * 保存业务编号信息
+     * @param businessCodeList
+     */
+    void insertBusinessCodeList(@Param("businessCodeList")List<AccountantReimbursementDTO> businessCodeList);
+
+    /**
+     * 保存发票编号数据信息
+     * @param invoiceInfoList
+     */
+    void insertInvoiceList(@Param("invoiceInfoList")List<AccountantReimbursementDTO> invoiceInfoList);
+
+    /**
+     * 查询业务信息
+     * @param id
+     * @return
+     */
+    AccountantReimbursementDTO queryBusinessById(String id);
+
+    /**
+     * 根据发票id查询业务具体信息
+     * @param id
+     * @return
+     */
+    AccountantReimbursementDTO queryBusinessByInvoiceId(String id);
+
+    /**
+     * 查询发票信息
+     * @param id
+     * @return
+     */
+    AccountantReimbursementDTO queryInvoiceById(String id);
+
+    /**
+     * 保存业务编码
+     * @param reimbursement
+     * @return
+     */
+    Integer saveBusiness(AccountantReimbursementDTO reimbursement);
+
+    /**
+     * 保存发票收款时间
+     * @param reimbursement
+     * @return
+     */
+    Integer saveInvoice(AccountantReimbursementDTO reimbursement);
+
+    /**
+     * 修改发票信息
+     * @param reimbursement
+     * @return
+     */
+    Integer modifyInvoice(AccountantReimbursementDTO reimbursement);
+
+    /**
+     * 根据业务编码查询业务信息
+     * @param businessCode
+     * @return
+     */
+    AccountantReimbursementDTO getInfoByBusinessCode(String businessCode);
+
+    /**
+     * 批量修改发票信息
+     * @param invoiceInfoList
+     */
+    void updateInvoiceList(@Param("invoiceInfoList")List<AccountantReimbursementDTO> invoiceInfoList);
+
+    /**
+     * 根据id删除对应业务信息(物理删除)
+     * @param id
+     */
+    void deleteBusinessById(String id);
+
+    /**
+     * 根据id删除对应业务信息(物理删除)
+     * @param idList
+     */
+    void deleteBusinessByIdList(@Param("idList")List<String> idList);
+
+    /**
+     * 删除业务信息(逻辑删除)
+     * @param idList
+     */
+    void removeBusinessByIds(@Param("idList")List<String> idList);
+
+    /**
+     * 删除发票信息(逻辑删除)
+     * @param idList
+     */
+    void removeBusinessByParentIds(@Param("idList")List<String> idList);
+
+    /**
+     * 删除发票信息(逻辑删除)
+     * @param idList
+     */
+    void removeInvoiceByIds(@Param("idList")List<String> idList);
+
+    /**
+     * 查询该发票信息下是否存在有效的同级数据信息
+     * @param id
+     */
+    String getValidBusinessIdByInvoiceId(String id);
+
+    /**
+     * 修改业务报销比例
+     * @param reimbursement
+     */
+    void updateReimbursementRatio(AccountantReimbursementDTO reimbursement);
+
+    /**
+     * 修改业务信息
+     * @param reimbursement
+     */
+    int updateById(AccountantReimbursementDTO reimbursement);
+
+    /**
+     * 根据发票id查询是否已经填写收款时间
+     * @param idList
+     * @return
+     */
+    List<AccountantReimbursementDTO> getGatheringTimeInvoiceList(@Param("idList") List<String> idList);
+
+    /**
+     * 根据发票id查询发票信息
+     * @param idList
+     * @return
+     */
+    List<AccountantReimbursementDTO> getInvoiceByIdList(@Param("idList") List<String> idList);
+
+    /**
+     * 根据该条发票信息查询同业务编号下的没有收款的发票信息
+     * @param reimbursement
+     * @return
+     */
+    List<AccountantReimbursementDTO> getNotGatheringTimeInvoice(AccountantReimbursementDTO reimbursement);
+
+    void updateGatheringTime(@Param("idList") List<String> idList, @Param("reimbursement") AccountantReimbursementDTO reimbursement);
+
+    /**
+     * 根据id修改业务信息的收款状态
+     * @param id
+     */
+    void updateGatheringStatusById(String id);
+}

+ 82 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/mapper/AccountantReimbursementUserMapper.java

@@ -0,0 +1,82 @@
+package com.jeeplus.test.reimbursementAccountant.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.jeeplus.sys.service.dto.UserDTO;
+import com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementUserDTO;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @author li-peike
+ * @version 1.0.0
+ * @ClassName ReimbursementSysMapper.java
+ * @Description TODO
+ * @createTime 2022年05月06日 10:40:00
+ */
+@Mapper
+public interface AccountantReimbursementUserMapper extends BaseMapper<AccountantReimbursementUserDTO> {
+    /**
+     * 根据条件查询数据信息
+     * @param page
+     * @param reimbursementUser
+     * @return
+     */
+    IPage<AccountantReimbursementUserDTO> findList(Page<AccountantReimbursementUserDTO> page, @Param("reimbursementUser")AccountantReimbursementUserDTO reimbursementUser);
+    /**
+     * 根据条件查询数据信息
+     * @param page
+     * @param reimbursementUser
+     * @return
+     */
+    IPage<AccountantReimbursementUserDTO> getYearList(Page<AccountantReimbursementUserDTO> page, @Param("reimbursementUser")AccountantReimbursementUserDTO reimbursementUser);
+
+    /**
+     * 保存人员报销信息
+     * @param reimbursementUser
+     */
+    void save(AccountantReimbursementUserDTO reimbursementUser);
+
+    /**
+     * 保存人员报销信息
+     * @param reimbursementUserList
+     */
+    void saveList(@Param("reimbursementUserList")List<AccountantReimbursementUserDTO> reimbursementUserList);
+
+    /**
+     * 修改人员报销信息
+     * @param reimbursementUser
+     */
+    void update(AccountantReimbursementUserDTO reimbursementUser);
+
+    /**
+     * 查询业务信息
+     * @param id
+     * @return
+     */
+    AccountantReimbursementUserDTO queryById(String id);
+
+    /**
+     * 查询报销信息(根据人员id和年份)
+     * @param reimbursementUser
+     * @return
+     */
+    AccountantReimbursementUserDTO queryByUserIdAndYear(AccountantReimbursementUserDTO reimbursementUser);
+
+    /**
+     * 根据id删除人员报销信息(物理删除)
+     * @param idList
+     */
+    void delete(@Param("idList") List<String> idList);
+
+    /**
+     * 根据部门和人员名称查询人员信息
+     * @param reimbursementUserDTO
+     * @return
+     */
+    List<UserDTO> getUserByNameAndOfficeName(AccountantReimbursementUserDTO reimbursementUserDTO);
+
+}

+ 247 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/mapper/xml/AccountantReimbursementBusinessMapper.xml

@@ -0,0 +1,247 @@
+<?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.test.reimbursementAccountant.mapper.AccountantReimbursementBusinessMapper">
+    <sql id="reimbursementUserColumns">
+        a.id AS "id",
+		a.create_by AS "createBy.id",
+		a.create_date AS "createDate",
+		a.update_by AS "updateBy.id",
+		a.update_date AS "updateDate",
+		a.remarks AS "remarks",
+		a.del_flag AS "delFlag",
+		a.user_id AS "userId",
+        a.year AS "year",
+        a.reimbursement_quota AS "reimbursementQuota",
+        a.reimbursement_quota_day AS "reimbursementQuotaDay",
+        su.id as "user.id",
+        su.name as "user.name"
+    </sql>
+
+    <sql id="reimbursementBusinessColumns">
+        a.id AS "id",
+		a.create_by AS "createBy.id",
+		a.create_date AS "createDate",
+		a.update_by AS "updateBy.id",
+		a.update_date AS "updateDate",
+		a.remarks AS "remarks",
+		a.del_flag AS "delFlag",
+		a.business_code_id as "businessCodeId",
+		a.user_id AS "userId",
+        su.name as "userName",
+        a.year AS "year",
+        a.reimbursement_day as "reimbursementDay",
+        a.reimbursement_type AS "reimbursementType",
+        a.reimbursement_amount as "reimbursementAmount"
+    </sql>
+
+    <sql id="reimbursementUserJoinColumns">
+        left join sys_user su on su.id = a.user_id
+    </sql>
+
+    <select id="findList" resultType="com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementUserDTO">
+        SELECT
+            <include refid="reimbursementUserColumns"/>
+        FROM zs_reimbursement_user_accountant_info a
+        <include refid="reimbursementUserJoinColumns"/>
+        <where>
+            a.del_flag = 0
+            <if test="reimbursementUser.year != null and reimbursementUser.year != ''">
+                and a.year like concat('%',#{reimbursementUser.year},'%')
+            </if>
+            <if test="reimbursementUser.userId != null and reimbursementUser.userId != ''">
+                and a.user_id = #{reimbursementUser.userId}
+            </if>
+        </where>
+        order by a.update_date desc,a.year desc, a.user_id asc
+    </select>
+
+    <select id="getYearList" resultType="com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementUserDTO">
+        SELECT
+            <include refid="reimbursementUserColumns"/>
+        FROM zs_reimbursement_user_accountant_info a
+        <include refid="reimbursementUserJoinColumns"/>
+        <where>
+            a.del_flag = 0
+            <if test="reimbursementUser.userId != null and reimbursementUser.userId != ''">
+                and a.user_id = #{reimbursementUser.userId}
+            </if>
+        </where>
+        order by a.year desc
+    </select>
+
+    <select id="getReimbursementMoneyByYear" resultType="com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementUserDTO">
+        SELECT
+            a.year as year,
+            sum(a.reimbursement_amount) as alreadyReimbursementAmount
+        FROM zs_reimbursement_business_accountant_info a
+        <where>
+            a.del_flag = 0
+            and a.user_id = #{userId}
+            and a.year in (${year})
+        </where>
+        group by a.year
+        order by a.year desc
+    </select>
+
+    <select id="reimbursementUserByUserIdAndYear" resultType="com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementUserDTO">
+        SELECT
+            <include refid="reimbursementUserColumns"/>
+        FROM zs_reimbursement_user_accountant_info a
+        <include refid="reimbursementUserJoinColumns"/>
+        <where>
+            a.del_flag = 0
+            and a.user_id = #{userId}
+            and a.year = #{year}
+        </where>
+    </select>
+
+    <insert id="save">
+        insert into zs_reimbursement_business_accountant_info (
+            id,
+            create_by,
+            create_date,
+            update_by,
+            update_date,
+            remarks,
+            del_flag,
+            business_code_id,
+            user_id,
+            year,
+            <if test="reimbursementDay != null and reimbursementDay != ''">
+                reimbursement_day,
+            </if>
+            reimbursement_type,
+            reimbursement_amount
+        )
+        values
+        (
+            #{id},
+            #{createBy},
+            #{createDate},
+            #{updateBy},
+            #{updateDate},
+            #{remarks},
+            #{delFlag},
+            #{businessCodeId},
+            #{userId},
+            #{year},
+            <if test="reimbursementDay != null and reimbursementDay != ''">
+                #{reimbursementDay},
+            </if>
+            #{reimbursementType},
+            #{reimbursementAmount}
+        )
+    </insert>
+
+    <update id="update">
+        update zs_reimbursement_user_accountant_info
+        set
+            update_by = #{updateBy}
+            ,update_date = #{updateDate}
+            <if test="year != null and year != ''">
+                ,year = #{year}
+            </if>
+            <if test="reimbursementQuota != null and reimbursementQuota != ''">
+                ,reimbursement_quota = #{reimbursementQuota}
+            </if>
+            <if test="reimbursementQuotaDay != null and reimbursementQuotaDay != ''">
+                ,reimbursement_quota_day = #{reimbursementQuotaDay}
+            </if>
+        <where>
+            id = #{id}
+        </where>
+    </update>
+
+    <select id="queryById" resultType="com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementBusinessDTO">
+        SELECT
+        <include refid="reimbursementUserColumns"/>
+            FROM zs_reimbursement_user_accountant_info a
+        <include refid="reimbursementUserJoinColumns"/>
+        <where>
+            a.del_flag = 0
+            and a.id = #{id}
+        </where>
+    </select>
+
+    <select id="queryByUserIdAndYear" resultType="com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementUserDTO">
+        SELECT
+        <include refid="reimbursementUserColumns"/>
+            FROM zs_reimbursement_user_accountant_info a
+        <include refid="reimbursementUserJoinColumns"/>
+        <where>
+            a.del_flag = 0
+            and a.user_id = #{userId}
+            and a.year = #{year}
+        </where>
+    </select>
+
+    <delete id="delete">
+        delete from zs_reimbursement_user_accountant_info
+        <where>
+            <if test="idList != null and idList.size>0">
+                and id in
+                <foreach collection="idList" item="id" separator="," open="(" close=")">
+                    #{id}
+                </foreach>
+            </if>
+        </where>
+    </delete>
+
+    <select id="getAlreadyReimbursementQuotaByUserIdAndYear" resultType="java.lang.String">
+        select ifnull(sum(a.reimbursement_amount),0)
+        from zs_reimbursement_business_accountant_info a
+        where a.del_flag = 0
+        and a.user_id= #{userId}
+        and a.year = #{year}
+    </select>
+
+    <select id="getAlreadyReimbursementQuotaByBusinessCodeId" resultType="java.lang.String">
+        select ifnull(sum(a.reimbursement_amount),0)
+        from zs_reimbursement_business_accountant_info a
+        where a.del_flag = 0
+        and a.business_code_id= #{businessCodeId}
+    </select>
+
+    <select id="getGatheringStatusById" resultType="java.lang.String">
+        select a.gathering_status
+        from zs_reimbursement_accountant_info a
+        where a.del_flag = 0
+        and a.id= #{businessCodeId}
+    </select>
+
+
+
+    <select id="findListByBusinessCodeId" resultType="com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementBusinessDTO">
+        SELECT
+        <include refid="reimbursementBusinessColumns"/>
+        FROM zs_reimbursement_business_accountant_info a
+        <include refid="reimbursementUserJoinColumns"/>
+        <where>
+            a.del_flag = 0
+            and a.business_code_id = #{businessCodeId}
+        </where>
+        order by a.update_date desc,a.year desc, a.user_id asc
+    </select>
+
+
+    <select id="findListByUserIdAndYear" resultType="com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementBusinessDTO">
+        SELECT
+        <include refid="reimbursementBusinessColumns"/>
+        ,zri.business_code as "businessCode"
+        FROM zs_reimbursement_business_accountant_info a
+        <include refid="reimbursementUserJoinColumns"/>
+        left join zs_reimbursement_accountant_info zri on zri.id = a.business_code_id
+        <where>
+            a.del_flag = 0
+            and a.user_id = #{userId}
+            and a.year = #{year}
+        </where>
+        order by a.update_date desc,a.year desc, a.user_id asc
+    </select>
+
+    <update id="updateReimbursementInfo">
+        update zs_reimbursement_accountant_info
+        set reimbursement_status = #{reimbursementStatus}
+        where id = #{id}
+    </update>
+</mapper>

+ 494 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/mapper/xml/AccountantReimbursementSysMapper.xml

@@ -0,0 +1,494 @@
+<?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.test.reimbursementAccountant.mapper.AccountantReimbursementSysMapper">
+    <sql id="reimbursementColumns">
+        a.id AS "id",
+		a.create_by AS "createBy.id",
+		a.create_date AS "createDate",
+		a.update_by AS "updateBy.id",
+		a.update_date AS "updateDate",
+		a.remarks AS "remarks",
+		a.del_flag AS "delFlag",
+		a.parent_id AS "parent.id",
+		a.parent_id AS "parentId",
+		a.parent_ids AS "parentIds",
+        a.invoice_code AS "invoiceCode",
+        a.invoice_number AS "invoiceNumber",
+        a.firm_name AS "firmName",
+        a.make_time AS "makeTime",
+		a.name AS "name",
+        a.money AS "money",
+        a.tax AS "tax",
+        a.income AS "income",
+        a.business_code AS "businessCode",
+        a.gathering_time AS "gatheringTime",
+        a.proposer AS "proposer",
+        a.partner AS "partner",
+        a.business_type AS "businessType",
+        a.reimbursement_ratio AS "reimbursementRatio",
+        a.reimbursement_status AS "reimbursementStatus",
+        a.batch_flag as "batchFlag"
+    </sql>
+
+    <select id="findList" resultType="com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementDTO">
+        SELECT
+        <include refid="reimbursementColumns"/>
+        FROM zs_reimbursement_invoice_accountant_info a
+        left join zs_reimbursement_accountant_info b on a.parent_id = b.id
+        <where>
+            a.del_flag = 0
+            and a.batch_flag = 0
+            and (b.business_code is null or b.business_code = '')
+            <if test="reimbursement.invoiceNumber != null and reimbursement.invoiceNumber != ''">
+                and a.invoice_number like concat('%',#{reimbursement.invoiceNumber},'%')
+            </if>
+            <if test="reimbursement.proposer != null and reimbursement.proposer != ''">
+                and a.proposer like concat('%',#{reimbursement.proposer},'%')
+            </if>
+            <if test="reimbursement.partner != null and reimbursement.partner != ''">
+                and a.partner like concat('%',#{reimbursement.partner},'%')
+            </if>
+        </where>
+    </select>
+
+    <select id="queryAllList" resultType="com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementDTO">
+        SELECT
+            <include refid="reimbursementColumns"/>
+        FROM zs_reimbursement_accountant_info a
+        <where>
+            a.del_flag = 0
+            <if test="reimbursement.businessCode != null and reimbursement.businessCode != ''">
+            and a.business_code like concat('%',#{reimbursement.businessCode},'%')
+            </if>
+            <if test="reimbursement.idList != null and reimbursement.idList.size>0">
+                and a.id in
+                <foreach collection="reimbursement.idList" item="id" separator="," open="(" close=")">
+                    #{id}
+                </foreach>
+            </if>
+        </where>
+        order by a.business_code
+    </select>
+
+    <select id="getInvoiceList" resultType="com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementDTO">
+        SELECT
+            <include refid="reimbursementColumns"/>
+        FROM zs_reimbursement_invoice_accountant_info a
+        <where>
+            a.del_flag = 0
+            <if test="invoiceNumber != null and invoiceNumber != ''">
+                and a.invoice_number like concat('%',#{invoiceNumber},'%')
+            </if>
+            <if test="proposer != null and proposer != ''">
+                and a.proposer like concat('%',#{proposer},'%')
+            </if>
+            <if test="partner != null and partner != ''">
+                and a.partner like concat('%',#{partner},'%')
+            </if>
+        </where>
+        order by a.invoice_number
+    </select>
+
+    <select id="getInvoiceByIdList" resultType="com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementDTO">
+        SELECT
+            <include refid="reimbursementColumns"/>
+        FROM zs_reimbursement_invoice_accountant_info a
+        <where>
+            a.del_flag = 0
+            <if test="idList != null and idList.size>0">
+                and a.id in
+                <foreach collection="idList" item="id" separator="," open="(" close=")">
+                    #{id}
+                </foreach>
+            </if>
+        </where>
+        order by a.invoice_number
+    </select>
+
+    <select id="getReceiptInvoiceIncomeByReimbursementId" resultType="java.lang.String">
+        SELECT
+            ifnull(sum(a.income),0) as "income"
+        FROM zs_reimbursement_invoice_accountant_info a
+        <where>
+            a.del_flag = 0
+            and a.parent_id =#{parentId}
+            and a.gathering_time is not null
+        </where>
+        order by a.invoice_number
+    </select>
+
+    <select id="getReimbursementRatioByReimbursementId" resultType="java.lang.String">
+        SELECT
+            a.reimbursement_ratio as "reimbursementRatio"
+        FROM zs_reimbursement_accountant_info a
+        <where>
+            a.del_flag = 0
+            and a.id =#{id}
+        </where>
+        order by a.invoice_number
+    </select>
+
+    <select id="getInvoiceByParentIdList" resultType="com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementDTO">
+        SELECT
+            <include refid="reimbursementColumns"/>
+        FROM zs_reimbursement_invoice_accountant_info a
+        <where>
+            a.del_flag = 0
+            <if test="parentIdList.size>0">
+                and a.parent_id in
+                <foreach collection="parentIdList" item="parentId" separator="," open="(" close=")">
+                    #{parentId}
+                </foreach>
+            </if>
+        </where>
+        order by a.invoice_number
+    </select>
+
+    <select id="selectOldInvoiceNumber" resultType="java.lang.String">
+        SELECT
+            a.invoice_number as "invoiceNumber"
+        FROM zs_reimbursement_invoice_accountant_info a
+        <where>
+            a.del_flag = 0
+            <if test="invoiceNumberList.size>0">
+                and a.invoice_number in
+                <foreach collection="invoiceNumberList" item="invoiceNumber" separator="," open="(" close=")">
+                    #{invoiceNumber}
+                </foreach>
+            </if>
+        </where>
+    </select>
+
+    <select id="selectOldBusinessCode" resultType="java.lang.String">
+        SELECT
+            a.business_code
+        FROM zs_reimbursement_invoice_accountant_info a
+        <where>
+            a.del_flag = 0
+            <if test="businessCodeList.size>0">
+                and a.business_code in
+                <foreach collection="businessCodeList" item="businessCode" separator="," open="(" close=")">
+                    #{businessCode}
+                </foreach>
+            </if>
+        </where>
+    </select>
+
+    <insert id="insertBusinessCodeList">
+        insert into zs_reimbursement_accountant_info (
+          id,
+          create_by,
+          create_date,
+          update_by,
+          update_date,
+          remarks,
+          del_flag,
+          parent_id,
+          parent_ids,
+          business_code
+        )
+        values
+        <foreach collection="businessCodeList" item="item" separator=",">
+            ( #{item.id},
+            #{item.createBy},
+            #{item.createDate},
+            #{item.updateBy},
+            #{item.updateDate},
+            #{item.remarks},
+            #{item.delFlag},
+            #{item.parentId},
+            #{item.parentIds},
+            #{item.businessCode}
+            )
+        </foreach>
+    </insert>
+
+    <insert id="insertInvoiceList">
+        insert into zs_reimbursement_invoice_accountant_info (
+            id,
+            create_by,
+            create_date,
+            update_by,
+            update_date,
+            remarks,
+            del_flag,
+            parent_id,
+            parent_ids,
+            invoice_code,
+            invoice_number,
+            firm_name,
+            make_time,
+            name,
+            money,
+            tax,
+            income,
+            business_code,
+            gathering_time,
+            proposer,
+            partner,
+            business_type
+        )
+        values
+        <foreach collection="invoiceInfoList" item="item" separator=",">
+            ( #{item.id},
+            #{item.createBy},
+            #{item.createDate},
+            #{item.updateBy},
+            #{item.updateDate},
+            #{item.remarks},
+            #{item.delFlag},
+            #{item.parentId},
+            #{item.parentIds},
+            #{item.invoiceCode},
+            #{item.invoiceNumber},
+            #{item.firmName},
+            #{item.makeTime},
+            #{item.name},
+            #{item.money},
+            #{item.tax},
+            #{item.income},
+            #{item.businessCode},
+            #{item.gatheringTime},
+            #{item.proposer},
+            #{item.partner},
+            #{item.businessType}
+            )
+        </foreach>
+    </insert>
+
+    <select id="queryBusinessById" resultType="com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementDTO">
+        SELECT
+        <include refid="reimbursementColumns"/>
+        FROM zs_reimbursement_accountant_info a
+        <where>
+            a.del_flag = 0
+            and a.id = #{id}
+        </where>
+    </select>
+
+    <select id="queryBusinessByInvoiceId" resultType="com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementDTO">
+        SELECT
+        <include refid="reimbursementColumns"/>
+        FROM zs_reimbursement_accountant_info a
+        <where>
+            a.del_flag = 0
+            and a.id = (select parent_id from zs_reimbursement_invoice_accountant_info where id = #{id})
+        </where>
+    </select>
+
+    <select id="queryInvoiceById" resultType="com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementDTO">
+        SELECT
+        <include refid="reimbursementColumns"/>
+        FROM zs_reimbursement_invoice_accountant_info a
+        <where>
+            a.del_flag = 0
+            and a.id = #{id}
+        </where>
+    </select>
+
+    <update id="saveBusiness">
+        update zs_reimbursement_accountant_info
+        set
+            update_by = #{updateBy},
+            update_date = #{updateDate},
+            business_code = #{businessCode}
+        where
+            id = #{id} and del_flag = 0
+    </update>
+
+    <update id="saveInvoice">
+        update zs_reimbursement_invoice_accountant_info
+        set
+            update_by = #{updateBy},
+            update_date = #{updateDate},
+            gathering_time = #{gatheringTime}
+        where
+            id = #{id} and del_flag = 0
+    </update>
+
+    <update id="modifyInvoice">
+        update zs_reimbursement_invoice_accountant_info
+        set
+            update_by = #{updateBy},
+            update_date = #{updateDate}
+        <if test="proposer != null and proposer != ''">
+            ,proposer = #{proposer}
+        </if>
+        <if test="partner != null and partner != ''">
+            ,partner = #{partner}
+        </if>
+        where
+            id = #{id} and del_flag = 0
+    </update>
+
+    <update id="updateById">
+        update zs_reimbursement_accountant_info
+        set
+            update_by = #{updateBy},
+            update_date = #{updateDate}
+        <if test="batchFlag != null and batchFlag != ''">
+            ,batch_flag = #{batchFlag}
+        </if>
+        where
+            id = #{id} and del_flag = 0
+    </update>
+
+    <select id="getInfoByBusinessCode" resultType="com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementDTO">
+        SELECT
+        <include refid="reimbursementColumns"/>
+        FROM zs_reimbursement_accountant_info a
+        <where>
+            a.del_flag = 0
+            and a.business_code = #{businessCode}
+        </where>
+        limit 1;
+    </select>
+
+    <update id="updateInvoiceList">
+        <foreach collection="invoiceInfoList" item="item" index="index" open="" close="" separator=";">
+            update zs_reimbursement_invoice_accountant_info
+            <set >
+                    update_by = #{item.updateBy}
+                    ,update_date = #{item.updateDate}
+                <if test="item.businessCode != null and item.businessCode != ''">
+                    ,business_code = #{item.businessCode}
+                </if>
+                <if test="item.parentId != null and item.parentId != ''">
+                    ,parent_id = #{item.parentId}
+                </if>
+                <if test="item.parentIds != null and item.parentIds != ''">
+                    ,parent_ids = #{item.parentIds}
+                </if>
+                <if test="item.batchFlag != null and item.batchFlag != ''">
+                    ,batch_flag = #{item.batchFlag}
+                </if>
+            </set>
+            where id = #{item.id} and del_flag = 0
+        </foreach>
+    </update>
+
+    <delete id="deleteBusinessById">
+        delete from zs_reimbursement_accountant_info
+        where
+            id = #{id}
+    </delete>
+
+    <delete id="deleteBusinessByIdList">
+        delete from zs_reimbursement_accountant_info
+        <where>
+            <if test="idList != null and idList.size>0">
+                and id in
+                <foreach collection="idList" item="id" separator="," open="(" close=")">
+                    #{id}
+                </foreach>
+            </if>
+        </where>
+    </delete>
+
+    <update id="removeBusinessByIds">
+        update zs_reimbursement_accountant_info
+        set
+            del_flag = 1
+        <where>
+            <if test="idList != null and idList.size>0">
+                and id in
+                <foreach collection="idList" item="id" separator="," open="(" close=")">
+                    #{id}
+                </foreach>
+            </if>
+        </where>
+    </update>
+
+    <update id="removeBusinessByParentIds">
+        update zs_reimbursement_invoice_accountant_info
+        set
+        del_flag = 1
+        <where>
+            <if test="idList != null and idList.size>0">
+                and parent_id in
+                <foreach collection="idList" item="id" separator="," open="(" close=")">
+                    #{id}
+                </foreach>
+            </if>
+        </where>
+    </update>
+
+    <update id="removeInvoiceByIds">
+        update zs_reimbursement_invoice_accountant_info
+        set
+        del_flag = 1
+        <where>
+            <if test="idList != null and idList.size>0">
+                and id in
+                <foreach collection="idList" item="id" separator="," open="(" close=")">
+                    #{id}
+                </foreach>
+            </if>
+        </where>
+    </update>
+
+    <select id="getValidBusinessIdByInvoiceId" resultType="java.lang.String">
+        select parent_id from zs_reimbursement_invoice_accountant_info
+        where parent_id = (
+        select parent_id from zs_reimbursement_invoice_accountant_info
+        where id = #{id}
+        ) and del_flag = 0 limit 1
+    </select>
+
+    <update id="updateReimbursementRatio">
+        update zs_reimbursement_accountant_info
+        set
+        reimbursement_ratio = #{reimbursementRatio}
+        <where>
+            id = #{id}
+        </where>
+    </update>
+
+    <select id="getGatheringTimeInvoiceList" resultType="com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementDTO">
+        SELECT
+        <include refid="reimbursementColumns"/>
+        FROM zs_reimbursement_invoice_accountant_info a
+        <where>
+            a.del_flag = 0
+            <if test="idList != null and idList.size>0">
+                and a.id in
+                <foreach collection="idList" item="id" separator="," open="(" close=")">
+                    #{id}
+                </foreach>
+            </if>
+            and gathering_time is not null
+        </where>
+        order by a.invoice_number
+    </select>
+
+    <select id="getNotGatheringTimeInvoice" resultType="com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementDTO">
+        SELECT
+        <include refid="reimbursementColumns"/>
+        FROM zs_reimbursement_invoice_accountant_info a
+        <where>
+            a.del_flag = 0
+            and business_code = (
+            select business_code from zs_reimbursement_invoice_accountant_info where id = #{businessCode}
+            ) and gathering_time is null
+        </where>
+        order by a.invoice_number
+    </select>
+
+    <update id="updateGatheringTime">
+        <foreach collection="idList" item="id" index="index" open="" close="" separator=";">
+            update zs_reimbursement_invoice_accountant_info
+            <set >
+                update_by = #{reimbursement.updateBy}
+                ,update_date = #{reimbursement.updateDate}
+                ,gathering_time = #{reimbursement.gatheringTime}
+            </set>
+            where id = #{id}
+        </foreach>
+    </update>
+
+    <update id="updateGatheringStatusById">
+        update zs_reimbursement_accountant_info
+        set gathering_status = 1
+        where id = #{id}
+    </update>
+</mapper>

+ 236 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/mapper/xml/AccountantReimbursementUserMapper.xml

@@ -0,0 +1,236 @@
+<?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.test.reimbursementAccountant.mapper.AccountantReimbursementUserMapper">
+    <sql id="reimbursementUserColumns">
+        a.id AS "id",
+		a.create_by AS "createBy.id",
+		a.create_date AS "createDate",
+		a.update_by AS "updateBy.id",
+		a.update_date AS "updateDate",
+		a.remarks AS "remarks",
+		a.del_flag AS "delFlag",
+		a.user_id AS "userId",
+        a.year AS "year",
+        a.reimbursement_quota AS "reimbursementQuota",
+        a.reimbursement_all_day AS "reimbursementAllDay",
+        a.reimbursement_quota_day AS "reimbursementQuotaDay",
+        su.id as "user.id",
+        su.name as "user.name"
+    </sql>
+
+    <sql id="reimbursementUserJoinColumns">
+        left join sys_user su on su.id = a.user_id
+    </sql>
+
+    <sql id="userColumns">
+    	a.id,
+    	a.company_id AS "companyDTO.id",
+    	a.office_id AS "officeDTO.id",
+    	a.login_name AS "loginName",
+		a.is_admin AS "isAdmin",
+    	a.password,
+    	a.no,
+		a.name,
+		a.email,
+		a.phone,
+		a.mobile,
+		a.login_ip AS "loginIp",
+		a.login_date AS "loginDate",
+		a.remarks,
+		a.login_flag,
+		a.photo,
+		a.qr_code,
+		a.sign,
+		a.create_by AS "createBy.id",
+		a.create_date,
+		a.update_by AS "updateBy.id",
+		a.update_date,
+    	c.name AS "companyDTO.name",
+    	c.parent_id AS "companyDTO.parent.id",
+    	c.parent_ids AS "companyDTO.parentIds",
+    	o.name AS "officeDTO.name",
+    	o.parent_id AS "officeDTO.parent.id",
+    	o.parent_ids AS "officeDTO.parentIds"
+    </sql>
+
+    <sql id="userJoins">
+		LEFT JOIN sys_office c ON c.id = a.company_id
+		LEFT JOIN sys_office o ON o.id = a.office_id
+    </sql>
+
+    <select id="findList" resultType="com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementUserDTO">
+        SELECT
+            <include refid="reimbursementUserColumns"/>
+            ,
+        ifnull(sum(zrbi.reimbursement_day),0) as "alreadyReimbursementDay",
+        ifnull(sum(zrbi.reimbursement_amount),0) as "alreadyReimbursementAmount",
+        ifnull((a.reimbursement_quota - ifnull(sum(zrbi.reimbursement_amount),0)),0) as "remainReimbursementAmount",
+        ifnull(( CONVERT ( a.reimbursement_quota / a.reimbursement_quota_day, DECIMAL ( 15, 2 )) - ifnull(sum( zrbi.reimbursement_day ),0)), 0 ) AS "surplusReimbursementDay"
+        FROM zs_reimbursement_user_accountant_info a
+        <include refid="reimbursementUserJoinColumns"/>
+        LEFT JOIN zs_reimbursement_business_accountant_info zrbi ON zrbi.user_id = a.user_id and zrbi.year = a.year
+        <where>
+            a.del_flag = 0
+            <if test="reimbursementUser.year != null and reimbursementUser.year != ''">
+                and a.year like concat('%',#{reimbursementUser.year},'%')
+            </if>
+            <if test="reimbursementUser.userId != null and reimbursementUser.userId != ''">
+                and a.user_id = #{reimbursementUser.userId}
+            </if>
+        </where>
+        group by a.user_id,a.year
+        order by a.update_date desc,a.year desc, a.user_id asc
+    </select>
+
+    <select id="getYearList" resultType="com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementUserDTO">
+        SELECT
+            <include refid="reimbursementUserColumns"/>
+        FROM zs_reimbursement_user_info a
+        <include refid="reimbursementUserJoinColumns"/>
+        <where>
+            a.del_flag = 0
+            <if test="reimbursementUser.userId != null and reimbursementUser.userId != ''">
+                and a.user_id = #{reimbursementUser.userId}
+            </if>
+        </where>
+        order by a.year desc
+    </select>
+
+    <insert id="save">
+        insert into zs_reimbursement_user_accountant_info (
+            id,
+            create_by,
+            create_date,
+            update_by,
+            update_date,
+            remarks,
+            del_flag,
+            user_id,
+            year,
+            reimbursement_quota,
+            reimbursement_all_day,
+            reimbursement_quota_day
+        )
+        values
+        (
+            #{id},
+            #{createBy},
+            #{createDate},
+            #{updateBy},
+            #{updateDate},
+            #{remarks},
+            #{delFlag},
+            #{userId},
+            #{year},
+            #{reimbursementQuota},
+            #{reimbursementAllDay},
+            #{reimbursementQuotaDay}
+        )
+    </insert>
+
+    <insert id="saveList">
+        insert into zs_reimbursement_user_accountant_info (
+        id,
+        create_by,
+        create_date,
+        update_by,
+        update_date,
+        remarks,
+        del_flag,
+        user_id,
+        year,
+        reimbursement_quota,
+        reimbursement_all_day,
+        reimbursement_quota_day
+        )
+        values
+        <foreach collection="reimbursementUserList" item="item" separator=",">
+            ( #{item.id},
+            #{item.createBy},
+            #{item.createDate},
+            #{item.updateBy},
+            #{item.updateDate},
+            #{item.remarks},
+            #{item.delFlag},
+            #{item.userId},
+            #{item.year},
+            #{item.reimbursementQuota},
+            #{item.reimbursementAllDay},
+            #{item.reimbursementQuotaDay}
+            )
+        </foreach>
+    </insert>
+
+
+
+    <update id="update">
+        update zs_reimbursement_user_accountant_info
+        set
+            update_by = #{updateBy}
+            ,update_date = #{updateDate}
+            <if test="year != null and year != ''">
+                ,year = #{year}
+            </if>
+            <if test="reimbursementQuota != null and reimbursementQuota != ''">
+                ,reimbursement_quota = #{reimbursementQuota}
+            </if>
+            <if test="reimbursementAllDay != null and reimbursementAllDay != ''">
+                ,reimbursement_all_day = #{reimbursementAllDay}
+            </if>
+            <if test="reimbursementQuotaDay != null and reimbursementQuotaDay != ''">
+                ,reimbursement_quota_day = #{reimbursementQuotaDay}
+            </if>
+        <where>
+            id = #{id}
+        </where>
+    </update>
+
+    <select id="queryById" resultType="com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementUserDTO">
+        SELECT
+        <include refid="reimbursementUserColumns"/>
+            FROM zs_reimbursement_user_accountant_info a
+        <include refid="reimbursementUserJoinColumns"/>
+        <where>
+            a.del_flag = 0
+            and a.id = #{id}
+        </where>
+    </select>
+
+    <select id="queryByUserIdAndYear" resultType="com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementUserDTO">
+        SELECT
+        <include refid="reimbursementUserColumns"/>
+            FROM zs_reimbursement_user_accountant_info a
+        <include refid="reimbursementUserJoinColumns"/>
+        <where>
+            a.del_flag = 0
+            and a.user_id = #{userId}
+            and a.year = #{year}
+        </where>
+        order by id limit 1
+    </select>
+
+    <delete id="delete">
+        delete from zs_reimbursement_user_accountant_info
+        <where>
+            <if test="idList != null and idList.size>0">
+                and id in
+                <foreach collection="idList" item="id" separator="," open="(" close=")">
+                    #{id}
+                </foreach>
+            </if>
+        </where>
+    </delete>
+
+    <select id="getUserByNameAndOfficeName" resultType="com.jeeplus.sys.service.dto.UserDTO">
+        SELECT
+        <include refid="userColumns"/>
+        FROM sys_user a
+        <include refid="userJoins"/>
+        <where>
+            a.del_flag = 0
+            and a.name = #{userName}
+            and o.name = #{officeName}
+        </where>
+
+    </select>
+</mapper>

+ 85 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/service/AccountantReimbursementBusinessService.java

@@ -0,0 +1,85 @@
+package com.jeeplus.test.reimbursementAccountant.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementBusinessDTO;
+import com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementBusinessReturnDTO;
+import com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementDTO;
+import com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementUserDTO;
+import com.jeeplus.test.reimbursementsys.domain.dto.ReimbursementBusinessDTO;
+import com.jeeplus.test.reimbursementsys.domain.dto.ReimbursementBusinessReturnDTO;
+import com.jeeplus.test.reimbursementsys.domain.dto.ReimbursementDTO;
+import com.jeeplus.test.reimbursementsys.domain.dto.ReimbursementUserDTO;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author li-peike
+ * @version 1.0.0
+ * @ClassName ReimbursementSysService.java
+ * @Description TODO
+ * @createTime 2022年05月06日 10:25:00
+ */
+
+public interface AccountantReimbursementBusinessService {
+    /**
+     * 查询报销人员信息
+     * @param id
+     * @return
+     */
+    AccountantReimbursementBusinessDTO queryById(String id);
+    /**
+     * 查询业务报销额度相关信息
+     * @param id
+     * @return
+     */
+    AccountantReimbursementDTO getBusinessById(String id);
+    /**
+     * 查询报销信息(根据人员id和年份)
+     * @param reimbursementUser
+     * @return
+     */
+    AccountantReimbursementUserDTO queryByUserIdAndYear(AccountantReimbursementBusinessDTO reimbursementUser);
+
+    /**
+     * 查询列表信息
+     * @param page
+     * @param reimbursementUser
+     * @return
+     */
+    IPage<AccountantReimbursementUserDTO> findList(Page<AccountantReimbursementUserDTO> page, AccountantReimbursementUserDTO reimbursementUser);
+
+    /**
+     * 根据人员信息查询报销年份信息
+     * @param page
+     * @param reimbursementUser
+     * @return
+     */
+    IPage<AccountantReimbursementUserDTO> getYearList(Page<AccountantReimbursementUserDTO> page, AccountantReimbursementUserDTO reimbursementUser);
+
+    /**
+     * 保存报销数据信息
+     * @param reimbursementUser
+     */
+    Map<String,Object> save(AccountantReimbursementBusinessDTO reimbursementUser);
+
+    /**
+     * 修改报销人员信息
+     * @param reimbursementUser
+     */
+    void update(AccountantReimbursementBusinessDTO reimbursementUser);
+
+    /**
+     * 根据id删除人员报销信息(物理删除)
+     * @param idList
+     */
+    void delete(List<String> idList);
+
+    /**
+     * 查询列表信息
+     * @param reimbursementBusiness
+     * @return
+     */
+    AccountantReimbursementBusinessReturnDTO findListByBusinessCodeId(AccountantReimbursementBusinessDTO reimbursementBusiness);
+}

+ 101 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/service/AccountantReimbursementSysService.java

@@ -0,0 +1,101 @@
+package com.jeeplus.test.reimbursementAccountant.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementDTO;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author li-peike
+ * @version 1.0.0
+ * @ClassName ReimbursementSysService.java
+ * @Description TODO
+ * @createTime 2022年05月06日 10:25:00
+ */
+
+public interface AccountantReimbursementSysService {
+    /**
+     * 查询业务具体信息
+     * @param id
+     * @return
+     */
+    AccountantReimbursementDTO queryBusinessById(String id);
+    /**
+     * 根据发票id查询业务具体信息
+     * @param id
+     * @return
+     */
+    AccountantReimbursementDTO queryBusinessByInvoiceId(String id);
+    /**
+     * 查询业务具体信息
+     * @param id
+     * @return
+     */
+    AccountantReimbursementDTO queryInvoiceById(String id);
+
+    IPage<AccountantReimbursementDTO> findList(Page<AccountantReimbursementDTO> page, AccountantReimbursementDTO reimbursement);
+
+    IPage<AccountantReimbursementDTO> treeData(Page<AccountantReimbursementDTO> page, AccountantReimbursementDTO reimbursement);
+
+    /**
+     * 保存方法
+     * @param reimbursementList
+     */
+    Map<String,Object> save(List<AccountantReimbursementDTO> reimbursementList);
+
+    /**
+     * 保存业务编码
+     * @param reimbursement
+     */
+    void saveBusiness(AccountantReimbursementDTO reimbursement);
+
+    /**
+     * 保存收款时间信息
+     * @param reimbursement
+     */
+    Map<String,Object> saveGatheringTime(AccountantReimbursementDTO reimbursement);
+
+    /**
+     * 保存发票收款时间
+     * @param reimbursement
+     */
+    void saveInvoice(AccountantReimbursementDTO reimbursement);
+
+    /**
+     * 修改发票信息
+     * @param reimbursement
+     */
+    void modifyInvoice(AccountantReimbursementDTO reimbursement);
+
+    /**
+     * 批量删除(逻辑删除)
+     * @param idList
+     */
+    void removeByIds(List <String> idList);
+
+    /**
+     * 根据业务id删除对应的业务信息以及发票信息(逻辑删除)
+     * @param idList
+     */
+    void removeBusinessByIds(List <String> idList);
+
+    /**
+     * 根据发票id删除发票信息(逻辑删除)
+     * @param idList
+     */
+    void removeInvoiceByIds(List <String> idList);
+
+    /**
+     * 修改业务报销比例
+     * @param reimbursement
+     */
+    void updateReimbursementRatio(AccountantReimbursementDTO reimbursement);
+
+    /**
+     * 根据发票id删除发票信息(逻辑删除)
+     * @param idList
+     */
+    Map<String,Object>  addBatchReimbursement(List <String> idList);
+}

+ 80 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/service/AccountantReimbursementUserService.java

@@ -0,0 +1,80 @@
+package com.jeeplus.test.reimbursementAccountant.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.jeeplus.sys.service.dto.UserDTO;
+import com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementBusinessReturnDTO;
+import com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementUserDTO;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author li-peike
+ * @version 1.0.0
+ * @ClassName ReimbursementSysService.java
+ * @Description TODO
+ * @createTime 2022年05月06日 10:25:00
+ */
+
+public interface AccountantReimbursementUserService {
+    /**
+     * 查询报销人员信息
+     * @param id
+     * @return
+     */
+    AccountantReimbursementUserDTO queryById(String id);
+    /**
+     * 查询报销信息(根据人员id和年份)
+     * @param reimbursementUser
+     * @return
+     */
+    AccountantReimbursementUserDTO queryByUserIdAndYear(AccountantReimbursementUserDTO reimbursementUser);
+
+    /**
+     * 查询列表信息
+     * @param page
+     * @param reimbursementUser
+     * @return
+     */
+    IPage<AccountantReimbursementUserDTO> findList(Page<AccountantReimbursementUserDTO> page, AccountantReimbursementUserDTO reimbursementUser);
+
+    /**
+     * 保存方法
+     * @param reimbursementUser
+     */
+    Map<String,Object> save(AccountantReimbursementUserDTO reimbursementUser);
+
+    /**
+     * 修改报销人员信息
+     * @param reimbursementUser
+     */
+    void update(AccountantReimbursementUserDTO reimbursementUser);
+
+    /**
+     * 根据id删除人员报销信息(物理删除)
+     * @param idList
+     */
+    Map<String,Object> delete(List<String> idList);
+
+    /**
+     * 查询人员报销信息列表
+     * @param reimbursementUserDTO
+     * @return
+     */
+    AccountantReimbursementBusinessReturnDTO findListByUserId(AccountantReimbursementUserDTO reimbursementUserDTO);
+
+    /**
+     * 根据部门和人员名称查询人员信息
+     * @param reimbursementUserDTO
+     * @return
+     */
+    List<UserDTO> getUserByNameAndOfficeName(AccountantReimbursementUserDTO reimbursementUserDTO);
+
+
+    /**
+     * 保存方法(批量导入)
+     * @param reimbursementUserList
+     */
+    Map<String,Object> saveList(List<AccountantReimbursementUserDTO> reimbursementUserList);
+}

+ 264 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/service/impl/AccountantReimbursementBusinessServiceImpl.java

@@ -0,0 +1,264 @@
+package com.jeeplus.test.reimbursementAccountant.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.google.common.collect.Lists;
+import com.jeeplus.sys.service.dto.UserDTO;
+import com.jeeplus.sys.utils.DictUtils;
+import com.jeeplus.sys.utils.StringUtils;
+import com.jeeplus.sys.utils.UserUtils;
+import com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementBusinessDTO;
+import com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementBusinessReturnDTO;
+import com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementDTO;
+import com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementUserDTO;
+import com.jeeplus.test.reimbursementAccountant.mapper.AccountantReimbursementBusinessMapper;
+import com.jeeplus.test.reimbursementAccountant.mapper.AccountantReimbursementSysMapper;
+import com.jeeplus.test.reimbursementAccountant.service.AccountantReimbursementBusinessService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author li-peike
+ * @version 1.0.0
+ * @ClassName ReimbursementSysServiceImpl.java
+ * @Description TODO
+ * @createTime 2022年05月06日 10:38:00
+ */
+@Service
+@Transactional(readOnly = true)
+public class AccountantReimbursementBusinessServiceImpl implements AccountantReimbursementBusinessService {
+
+    @Autowired
+    private AccountantReimbursementBusinessMapper mapper;
+    @Autowired
+    private AccountantReimbursementSysMapper reimbursementSysMapper;
+
+
+    @Override
+    public AccountantReimbursementBusinessDTO queryById(String id) {
+        return mapper.queryById(id);
+    }
+
+    @Override
+    public AccountantReimbursementDTO getBusinessById(String id) {
+        AccountantReimbursementDTO reimbursement = new AccountantReimbursementDTO();
+        reimbursement.setBusinessCodeId(id);
+        AccountantReimbursementBusinessDTO reimbursementBusiness = new AccountantReimbursementBusinessDTO();
+        reimbursementBusiness.setBusinessCodeId(id);
+        //根据业务id查询已收款的发票信息收款总额
+        String getReceiptInvoiceByReimbursementId = reimbursementSysMapper.getReceiptInvoiceIncomeByReimbursementId(id);
+        BigDecimal income = new BigDecimal(getReceiptInvoiceByReimbursementId);    //发票收入
+        //根据业务id查询报销比例
+        String getReimbursementRatioByReimbursementId = reimbursementSysMapper.getReimbursementRatioByReimbursementId(id);
+        if(StringUtils.isBlank(getReimbursementRatioByReimbursementId)){
+            getReimbursementRatioByReimbursementId = "0";
+            reimbursement.setReimbursementRatio("0");
+        }
+        BigDecimal reimbursementRatio = new BigDecimal(getReimbursementRatioByReimbursementId);    //报销比例
+        BigDecimal canReimbursementAmount = income.multiply(reimbursementRatio).divide(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);    //该项目可报销额度计算
+        //查询该业务总报销额度
+        String alreadyReimbursementQuotaByBusinessCodeId = mapper.getAlreadyReimbursementQuotaByBusinessCodeId(reimbursementBusiness);
+        BigDecimal allAlreadyReimbursementQuota = new BigDecimal(alreadyReimbursementQuotaByBusinessCodeId);    //总报销额度
+        reimbursement.setAllAlreadyReimbursementQuota(allAlreadyReimbursementQuota.toString());
+        reimbursement.setCanReimbursementAmount(canReimbursementAmount.toString());
+        reimbursement.setSurplusReimbursementAmount(canReimbursementAmount.subtract(allAlreadyReimbursementQuota).toString());
+        return reimbursement;
+    }
+
+    @Override
+    public AccountantReimbursementUserDTO queryByUserIdAndYear(AccountantReimbursementBusinessDTO reimbursementUser) {
+        return mapper.queryByUserIdAndYear(reimbursementUser);
+    }
+
+
+    @Override
+    public IPage<AccountantReimbursementUserDTO> findList(Page<AccountantReimbursementUserDTO> page, AccountantReimbursementUserDTO reimbursementUser) {
+        return mapper.findList (page, reimbursementUser);
+    }
+
+    @Override
+    public IPage<AccountantReimbursementUserDTO> getYearList(Page<AccountantReimbursementUserDTO> page, AccountantReimbursementUserDTO reimbursementUser) {
+        IPage<AccountantReimbursementUserDTO> yearList = mapper.getYearList(page, reimbursementUser);
+        List<AccountantReimbursementUserDTO> list = yearList.getRecords();
+        if(list.size()>0){
+            List<String> yearStrList = Lists.newArrayList();
+            for (AccountantReimbursementUserDTO info : list) {
+                yearStrList.add(info.getYear());
+            }
+            String years = StringUtils.join(yearStrList, ',');
+            reimbursementUser.setYear(years);
+            //根据人员和年份查询他的已报金额
+            List<AccountantReimbursementUserDTO> reimbursementMoneyByYear = mapper.getReimbursementMoneyByYear(reimbursementUser);
+            for (AccountantReimbursementUserDTO info : list) {
+                for (AccountantReimbursementUserDTO yearInfo : reimbursementMoneyByYear) {
+                    if(info.getYear().equals(yearInfo.getYear())){
+                        //获取当年总报销额度
+                        BigDecimal allAlreadyReimbursementQuota = new BigDecimal(info.getReimbursementQuota());
+                        //获取当年已报销额度
+                        BigDecimal alreadyReimbursementQuota = new BigDecimal(yearInfo.getAlreadyReimbursementAmount());
+                        info.setAlreadyReimbursementAmount(alreadyReimbursementQuota.toString());
+                        //计算出当年所剩报销额度
+                        info.setRemainReimbursementAmount(allAlreadyReimbursementQuota.subtract(alreadyReimbursementQuota).toString());
+                        break;
+                    }
+                }
+            }
+
+        }
+        return yearList;
+    }
+
+    /**
+     * 保存
+     * @param reimbursementUser
+     */
+    @Override
+    @Transactional(readOnly = false)
+    public Map<String,Object> save(AccountantReimbursementBusinessDTO reimbursementUser) {
+        Map<String,Object> map = new HashMap<>();
+
+        if(StringUtils.isBlank(reimbursementUser.getUserId())){
+            map.put("success", false);
+            map.put("message", "报销人员为空,无法进行添加报销信息!");
+            return map;
+        }
+        if(StringUtils.isBlank(reimbursementUser.getYear())){
+            map.put("success", false);
+            map.put("message", "报销年份不正确,请重新填写!");
+            return map;
+        }
+        if(StringUtils.isBlank(reimbursementUser.getReimbursementType())){
+            map.put("success", false);
+            map.put("message", "请选择报销类型!");
+            return map;
+        }else{
+            if("1".equals(reimbursementUser.getReimbursementType()) && (StringUtils.isBlank(reimbursementUser.getReimbursementDay()) || !StringUtils.isNumeric(reimbursementUser.getReimbursementDay()))){
+                map.put("success", false);
+                map.put("message", "报销天数不正确,请重新填写!");
+                return map;
+            }
+        }
+        //根据人员id和报销年份查询该年度的报销信息
+        AccountantReimbursementUserDTO reimbursementUserByUserIdAndYear = mapper.reimbursementUserByUserIdAndYear(reimbursementUser);
+        if(null == reimbursementUserByUserIdAndYear){
+            map.put("success", false);
+            map.put("message", "该员工" + reimbursementUser.getYear() + "年度未添加报销信息,无法进行报销");
+            return map;
+        }
+        //查询该人员该年度已报销额度
+        String alreadyReimbursementQuota = mapper.getAlreadyReimbursementQuotaByUserIdAndYear(reimbursementUser);
+        //判断本地报销额度是否超过该年度所剩余报销额度,如果超过,则不允许报销,并抛出。否则进行报销并保存报销数据
+        BigDecimal alreadyReimbursementQuotaB = new BigDecimal(alreadyReimbursementQuota);    //已报销额度
+        BigDecimal reimbursementAmount = null;
+        if("1".equals(reimbursementUser.getReimbursementType())){
+            BigDecimal reimbursementQuotaDay = new BigDecimal(reimbursementUser.getReimbursementQuotaDay());    //日报销额度
+            BigDecimal reimbursementDay = new BigDecimal(reimbursementUser.getReimbursementDay());  //报销天数
+            reimbursementAmount = reimbursementQuotaDay.multiply(reimbursementDay).setScale(2, BigDecimal.ROUND_HALF_UP);    //报销额度
+
+        }else{
+            reimbursementAmount = new BigDecimal(reimbursementUser.getReimbursementAmount());
+        }
+
+        //往期加这次的总报销额度和当年的总报销额度进行比较,小于当年报销额度 则个人可以进行报销,否则,无法进行报销
+        if(alreadyReimbursementQuotaB.add(reimbursementAmount).compareTo(new BigDecimal(reimbursementUser.getReimbursementQuota())) == 1){
+            map.put("success", false);
+            map.put("message", "本次报销金额已超出当年报销额度所剩余额,无法进行报销");
+            return map;
+        }
+
+        //根据业务id查询已收款的发票信息收款总额
+        String getReceiptInvoiceByReimbursementId = reimbursementSysMapper.getReceiptInvoiceIncomeByReimbursementId(reimbursementUser.getBusinessCodeId());
+        BigDecimal income = new BigDecimal(getReceiptInvoiceByReimbursementId);    //发票收入
+        if(new BigDecimal("0").compareTo(income) == 0){
+            map.put("success", false);
+            map.put("message", "该业务可报销额度为0,无法进行报销");
+            return map;
+        }
+        //根据业务id查询报销比例
+        String getReimbursementRatioByReimbursementId = reimbursementSysMapper.getReimbursementRatioByReimbursementId(reimbursementUser.getBusinessCodeId());
+        if(StringUtils.isBlank(getReimbursementRatioByReimbursementId)){
+            map.put("success", false);
+            map.put("message", "该业务报销比例为0,无法进行报销");
+            return map;
+        }
+        BigDecimal reimbursementRatio = new BigDecimal(getReimbursementRatioByReimbursementId);    //报销比例
+        BigDecimal canReimbursementAmount = income.multiply(reimbursementRatio).divide(new BigDecimal("100")).setScale(2, BigDecimal.ROUND_HALF_UP);    //该项目可报销额度计算
+        //查询该业务总报销额度
+        String alreadyReimbursementQuotaByBusinessCodeId = mapper.getAlreadyReimbursementQuotaByBusinessCodeId(reimbursementUser);
+        String gatheringStatus = mapper.getGatheringStatusById(reimbursementUser);
+        BigDecimal allAlreadyReimbursementQuota = new BigDecimal(alreadyReimbursementQuotaByBusinessCodeId);    //总报销额度
+        //往期加这次的总报销额度和当年的总报销额度进行比较,小于当年报销额度 则个人可以进行报销,否则,无法进行报销
+        if(allAlreadyReimbursementQuota.add(reimbursementAmount).compareTo(canReimbursementAmount) == 1){
+            map.put("success", false);
+            map.put("message", "本次报销金额已超出该业务可报销额度所剩余额,无法进行报销");
+            return map;
+        } else if (allAlreadyReimbursementQuota.add(reimbursementAmount).compareTo(canReimbursementAmount) == 0 && "1".equals(gatheringStatus)){
+            //如果报销额度和剩余报销额度相同
+            AccountantReimbursementDTO reimbursementDTO = new AccountantReimbursementDTO();
+            reimbursementDTO.setId(reimbursementUser.getBusinessCodeId());
+            reimbursementDTO.setReimbursementStatus("1");
+
+            mapper.updateReimbursementInfo(reimbursementDTO);
+        }
+
+
+        UserDTO user = UserUtils.get(reimbursementUser.getUserId());
+
+        reimbursementUser.setReimbursementAmount(reimbursementAmount.toString());
+        if(StringUtils.isNotBlank(reimbursementUser.getId())){
+            reimbursementUser.preUpdate();
+            //新增
+            mapper.update(reimbursementUser);
+        }else{
+            reimbursementUser.preInsert();
+            //新增
+            mapper.save(reimbursementUser);
+        }
+
+        map.put("success", true);
+        map.put("message", user.getName() + "报销" + reimbursementUser.getReimbursementAmount() + "金额成功");
+        return map;
+    }
+
+
+    @Override
+    @Transactional(readOnly = false)
+    public void update(AccountantReimbursementBusinessDTO reimbursementUser) {
+        mapper.update(reimbursementUser);
+    }
+
+    @Override
+    @Transactional(readOnly = false)
+    public void delete(List<String> idList) {
+        //删除发票信息
+        mapper.delete(idList);
+    }
+
+
+    @Override
+    public AccountantReimbursementBusinessReturnDTO findListByBusinessCodeId(AccountantReimbursementBusinessDTO reimbursementBusiness) {
+        List<AccountantReimbursementBusinessDTO> list = mapper.findListByBusinessCodeId(reimbursementBusiness);
+        for (AccountantReimbursementBusinessDTO info : list) {
+            info.setReimbursementType(DictUtils.getDictLabel(info.getReimbursementType(), "reimbursement_type", null));
+        }
+        AccountantReimbursementBusinessReturnDTO reimbursementBusinessReturnDTO = new AccountantReimbursementBusinessReturnDTO();
+        //获取业务报销信息
+        AccountantReimbursementDTO business = this.getBusinessById(reimbursementBusiness.getBusinessCodeId());
+        reimbursementBusinessReturnDTO.setList(list);
+        //剩余报销额度
+        reimbursementBusinessReturnDTO.setSurplusReimbursementAmount(business.getSurplusReimbursementAmount());
+        //已报销额度
+        reimbursementBusinessReturnDTO.setAlreadyReimbursementAmount(business.getAllAlreadyReimbursementQuota());
+        //总报销额度
+        reimbursementBusinessReturnDTO.setReimbursementQuota(business.getCanReimbursementAmount());
+        return reimbursementBusinessReturnDTO;
+    }
+
+}

+ 529 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/service/impl/AccountantReimbursementSysServiceImpl.java

@@ -0,0 +1,529 @@
+package com.jeeplus.test.reimbursementAccountant.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.google.common.collect.Lists;
+import com.jeeplus.sys.utils.StringUtils;
+import com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementDTO;
+import com.jeeplus.test.reimbursementAccountant.mapper.AccountantReimbursementSysMapper;
+import com.jeeplus.test.reimbursementAccountant.service.AccountantReimbursementBusinessService;
+import com.jeeplus.test.reimbursementAccountant.service.AccountantReimbursementSysService;
+import com.jeeplus.test.reimbursementAccountant.utils.MyBeanUtils;
+import org.apache.commons.collections4.CollectionUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.util.*;
+
+/**
+ * @author li-peike
+ * @version 1.0.0
+ * @ClassName ReimbursementSysServiceImpl.java
+ * @Description TODO
+ * @createTime 2022年05月06日 10:38:00
+ */
+@Service
+@Transactional(readOnly = true)
+public class AccountantReimbursementSysServiceImpl implements AccountantReimbursementSysService {
+
+    @Autowired
+    private AccountantReimbursementSysMapper mapper;
+    @Autowired
+    private AccountantReimbursementBusinessService reimbursementBusinessService;
+
+
+    @Override
+    public AccountantReimbursementDTO queryBusinessById(String id) {
+        //根据发票id查询业务具体信息
+        return mapper.queryBusinessById(id);
+    }
+
+    @Override
+    public AccountantReimbursementDTO queryBusinessByInvoiceId(String id) {
+        //根据发票id查询业务具体信息
+        return mapper.queryBusinessByInvoiceId(id);
+    }
+
+    @Override
+    public AccountantReimbursementDTO queryInvoiceById(String id) {
+        return mapper.queryInvoiceById(id);
+    }
+
+    @Override
+    public IPage<AccountantReimbursementDTO> findList(Page<AccountantReimbursementDTO> page, AccountantReimbursementDTO reimbursement) {
+        IPage<AccountantReimbursementDTO> list = mapper.findList(page, reimbursement);
+        return list;
+    }
+
+
+    @Override
+    public IPage<AccountantReimbursementDTO> treeData(Page<AccountantReimbursementDTO> page, AccountantReimbursementDTO reimbursement) {
+        IPage<AccountantReimbursementDTO> pageList = new Page();
+        //如果筛选项含有发票号码,则需先查询对应的发票信息
+        if(StringUtils.isNotBlank(reimbursement.getInvoiceNumber()) || StringUtils.isNotBlank(reimbursement.getProposer()) || StringUtils.isNotBlank(reimbursement.getPartner())){
+            List<AccountantReimbursementDTO> invoiceList =  mapper.getInvoiceList(reimbursement);
+            //如果存在发票信息,则根据发票的父节点查询对应的业务信息
+            if(invoiceList.size()>0){
+                Set<String> idSet = new HashSet<String>();
+                for (AccountantReimbursementDTO  info : invoiceList) {
+                    idSet.add(info.getParentId());
+                }
+                reimbursement.setIdList(new ArrayList<>(idSet));
+                pageList = mapper.queryAllList(page,reimbursement);
+
+                List<AccountantReimbursementDTO> list =  pageList.getRecords();
+                if(list.size()>0){
+                    //将子节点信息进行分组
+                    Map<String, List<AccountantReimbursementDTO>> invoiceListMap = dataMessageDispose(invoiceList);
+                    //将分组后的子节点信息通过遍历的方式添加到父节点中的children中
+                    for (AccountantReimbursementDTO info:list) {
+                        for (String key : invoiceListMap.keySet()) {
+                            if (info.getId().equals(key)) {
+                                List<AccountantReimbursementDTO> children = invoiceListMap.get(key);
+                                if(StringUtils.isNotBlank(info.getBusinessCode()) || "1".equals(info.getBatchFlag())){
+                                    info.setChildren(children);
+                                    info.setBusinessFlag("0");
+                                }else{
+                                    //空业务编码添加状态
+                                    info.setBusinessFlag("1");
+                                    MyBeanUtils.copyBeanNotNull2Bean(children.get(0), info);//将编辑表单中的非NULL值覆盖数据库记录中的值
+                                }
+                            }
+                        }
+                        AccountantReimbursementDTO businessById = reimbursementBusinessService.getBusinessById(info.getId());
+                        if(null != businessById){
+                            info.setAllAlreadyReimbursementQuota(businessById.getAllAlreadyReimbursementQuota());
+                            info.setCanReimbursementAmount(businessById.getCanReimbursementAmount());
+                            info.setSurplusReimbursementAmount(businessById.getSurplusReimbursementAmount());
+                        }
+                    }
+                }
+            }else{
+                return page;
+            }
+        }else{
+            pageList = mapper.queryAllList(page,reimbursement);
+            List<AccountantReimbursementDTO> list =  pageList.getRecords();
+            if(list.size()>0){
+                //获取所有发票信息表中的数据
+                List<String> parentIdList = Lists.newArrayList();
+                for (AccountantReimbursementDTO info:list) {
+                    parentIdList.add(info.getId());
+                }
+                //根据查询的父节点信息查询对应的子节点信息
+                List<AccountantReimbursementDTO> invoiceList =  mapper.getInvoiceByParentIdList(parentIdList);
+                if(invoiceList.size()>0){
+                    //将子节点信息进行分组
+                    Map<String, List<AccountantReimbursementDTO>> invoiceListMap = dataMessageDispose(invoiceList);
+                    //将分组后的子节点信息通过遍历的方式添加到父节点中的children中
+                    for (AccountantReimbursementDTO info:list) {
+                        for (String key : invoiceListMap.keySet()) {
+                            if (info.getId().equals(key)) {
+                                List<AccountantReimbursementDTO> children = invoiceListMap.get(key);
+                                if(StringUtils.isNotBlank(info.getBusinessCode()) || "1".equals(info.getBatchFlag())){
+                                    info.setChildren(children);
+                                    info.setBusinessFlag("0");
+                                }else{
+                                    //空业务编码添加状态
+                                    info.setBusinessFlag("1");
+                                    MyBeanUtils.copyBeanNotNull2Bean(children.get(0), info);//将编辑表单中的非NULL值覆盖数据库记录中的值
+                                }
+                            }
+                        }
+                        AccountantReimbursementDTO businessById = reimbursementBusinessService.getBusinessById(info.getId());
+                        if(null != businessById){
+                            info.setAllAlreadyReimbursementQuota(businessById.getAllAlreadyReimbursementQuota());
+                            info.setCanReimbursementAmount(businessById.getCanReimbursementAmount());
+                            info.setSurplusReimbursementAmount(businessById.getSurplusReimbursementAmount());
+                        }
+                    }
+                }
+            }
+        }
+
+        return pageList;
+    }
+
+    /**
+     * 文件数据分组
+     * @param dataList
+     * @return
+     */
+    public Map<String, List<AccountantReimbursementDTO>> dataMessageDispose(List<AccountantReimbursementDTO> dataList) {
+        //所有有效数据均添加到list中,下边将list中的数据根据店号和收银员的id进行分割处理
+        Map<String, List<AccountantReimbursementDTO>> result = listGroup2Map(dataList);
+        return result;
+    }
+
+    private Map<String, List<AccountantReimbursementDTO>> listGroup2Map(List<AccountantReimbursementDTO> list) {
+        Map<String, List<AccountantReimbursementDTO>> userSignSerialMap = new HashMap<>();
+        if (CollectionUtils.isNotEmpty(list)) {
+            // 分组
+            for (AccountantReimbursementDTO vo : list) {
+                List<AccountantReimbursementDTO> tempList = userSignSerialMap.get(vo.getParentId());
+                /*如果取不到数据,那么直接new一个空的ArrayList**/
+                if (tempList == null) {
+                    tempList = new ArrayList<>();
+                    tempList.add(vo);
+                    userSignSerialMap.put(vo.getParentId(), tempList);
+                }
+                else {
+                    /*某个vo之前已经存放过了,则直接追加数据到原来的List里**/
+                    tempList.add(vo);
+                }
+            }
+        }
+        return userSignSerialMap;
+    }
+
+    /**
+     * 保存
+     * @param reimbursementList
+     */
+    @Override
+    @Transactional(readOnly = false)
+    public Map<String,Object> save(List<AccountantReimbursementDTO> reimbursementList) {
+        Map<String,Object> map = new HashMap<>();
+        Set<String> invoiceNumberSet = new HashSet<String>();
+        for (AccountantReimbursementDTO info : reimbursementList) {
+            if(StringUtils.isBlank(info.getBusinessCode())){
+                info.setBusinessCode("");
+            }
+            invoiceNumberSet.add(info.getInvoiceNumber());
+        }
+        //如果发票编号数量不等于总数量,则表示所传数据中存在重复的发票编号,则进行抛出
+        if(invoiceNumberSet.size() != reimbursementList.size()){
+            map.put("success", false);
+            map.put("message", "数据中存在相同的发票号,请重新验证上传");
+            return map;
+        }
+        //set转list
+        List<String> invoiceNumberList = new ArrayList<String>(invoiceNumberSet);
+        //查询发票号是否存在,若含有已存在发票号,则直接进行抛出
+        List<String> oldInvoiceNumberList = mapper.selectOldInvoiceNumber(invoiceNumberList);
+        if(oldInvoiceNumberList.size()>0){
+            String oldInvoiceNumber = String.join(",", oldInvoiceNumberList);
+            map.put("success", false);
+            map.put("message", "发票号码:" + oldInvoiceNumber + " 已存在。无法再次上传");
+            return map;
+        }
+
+        //业务编号对应的数据集合
+        List<AccountantReimbursementDTO> businessCodeInfoList = Lists.newArrayList();
+        List<AccountantReimbursementDTO> businessCodeNullList = Lists.newArrayList();
+        List<String> businessCodeList = Lists.newArrayList();
+        //循环遍历reimbursementList 整理出相同的业务编号(null或者空字符串除外),并将这些业务编号进行去重,保存到数据库
+        Map<String, List<AccountantReimbursementDTO>> businessCodeListMap = dataDisposeOnSaveByBusinessCode(reimbursementList);
+        for (String key : businessCodeListMap.keySet()) {
+            if("".equals(key)){
+                List<AccountantReimbursementDTO> infoList = businessCodeListMap.get(key);
+                businessCodeNullList.addAll(infoList);
+            }else{
+                List<AccountantReimbursementDTO> infoList = businessCodeListMap.get(key);
+                businessCodeInfoList.add(infoList.get(0));
+                businessCodeList.add(key);
+            }
+        }
+
+        //查询非空的业务编号数据在数据库中是否存在,若存在,返回已存在的业务编号集合
+        List<String> oldBusinessCodeList = mapper.selectOldBusinessCode(businessCodeList);
+        if (oldBusinessCodeList.size()>0){
+            //如果数据库已存在部分业务编号信息,则去除该部分的业务编号信息
+            for (String oldBusinessCode: oldBusinessCodeList) {
+                Iterator iterator = businessCodeInfoList.iterator();
+                while (iterator.hasNext()) {
+                    AccountantReimbursementDTO data = (AccountantReimbursementDTO) iterator.next();
+                    if (oldBusinessCode.equals(data.getBusinessCode())){
+                        iterator.remove();
+                    }
+                }
+            }
+
+        }
+
+        //将空的业务编号 的信息添加到集合中
+        businessCodeInfoList.addAll(businessCodeNullList);
+        //对业务编号的数据进行新增保存
+        for (AccountantReimbursementDTO newBusinessCodeInfo : businessCodeInfoList) {
+            newBusinessCodeInfo.preInsert();
+            newBusinessCodeInfo.setParentId("0");
+            newBusinessCodeInfo.setParentIds("0,");
+        }
+        mapper.insertBusinessCodeList(businessCodeInfoList);
+
+
+        //业务编号对应的数据集合
+        List<AccountantReimbursementDTO> invoiceInfoList = Lists.newArrayList();
+
+        for (AccountantReimbursementDTO info : businessCodeInfoList) {
+            if(StringUtils.isNotBlank(info.getBusinessCode())){
+                //处理业务编号不为空的数据
+                for (String key : businessCodeListMap.keySet()) {
+                    if(info.getBusinessCode().equals(key)){
+                        List<AccountantReimbursementDTO> infoList = businessCodeListMap.get(key);
+                        for (AccountantReimbursementDTO childrenInfo : infoList) {
+                            if(info.getBusinessCode().equals("2021-01768")){
+                                System.out.println("");
+                            }
+                            childrenInfo.setParentId(info.getId());
+                            String parentIds = "0," + info.getId() + ",";
+                            childrenInfo.setParentIds(parentIds);
+                            //childrenInfo.preInsert();
+                            invoiceInfoList.add(childrenInfo);
+                        }
+                    }
+                }
+
+            }else{
+                //处理业务编号为空的数据
+                info.setParentId(info.getId());
+                String parentIds = "0," + info.getId() + ",";
+                info.setParentIds(parentIds);
+                //info.preInsert();
+                invoiceInfoList.add(info);
+            }
+        }
+        for (AccountantReimbursementDTO childrenInfo : invoiceInfoList) {
+            childrenInfo.preInsert();
+        }
+        //新增
+        mapper.insertInvoiceList(invoiceInfoList);
+
+        map.put("success", true);
+        map.put("message", "数据上传成功");
+        return map;
+    }
+
+    @Override
+    @Transactional(readOnly = false)
+    public void saveBusiness(AccountantReimbursementDTO reimbursement) {
+        //查询该业务编码在数据库中是否存在
+        AccountantReimbursementDTO infoByBusinessCode = mapper.getInfoByBusinessCode(reimbursement.getBusinessCode());
+        if(null != infoByBusinessCode){
+            //如果存在该业务编码 则将该业务编码对应的发票数据的父节点变更为已存在的业务编码的id信息
+            //根据id 查询对应的发票信息
+            List<String> parentIdList = Lists.newArrayList();
+            parentIdList.add(reimbursement.getId());
+            List<AccountantReimbursementDTO> invoiceByParentIdList = mapper.getInvoiceByParentIdList(parentIdList);
+            if(invoiceByParentIdList.size()>0){
+                List<AccountantReimbursementDTO> updateInvoiceData = Lists.newArrayList();
+                for (AccountantReimbursementDTO invoiceInfo: invoiceByParentIdList) {
+                    invoiceInfo.setBusinessCode(infoByBusinessCode.getBusinessCode());
+                    invoiceInfo.setParentId(infoByBusinessCode.getId());
+                    invoiceInfo.setParentIds("0," + infoByBusinessCode.getId() + ",");
+                    invoiceInfo.preUpdate();
+                    updateInvoiceData.add(invoiceInfo);
+                }
+                mapper.updateInvoiceList(updateInvoiceData);
+            }
+            //删除该业务编码信息
+            mapper.deleteBusinessById(reimbursement.getId());
+        }else{
+            //根据id查询对应发票信息
+            List<String> parentIdList = Lists.newArrayList();
+            parentIdList.add(reimbursement.getId());
+            List<AccountantReimbursementDTO> invoiceByParentIdList = mapper.getInvoiceByParentIdList(parentIdList);
+            if(invoiceByParentIdList.size()>0){
+                List<AccountantReimbursementDTO> updateInvoiceData = Lists.newArrayList();
+                for (AccountantReimbursementDTO invoiceInfo: invoiceByParentIdList) {
+                    invoiceInfo.setBusinessCode(reimbursement.getBusinessCode());
+                    invoiceInfo.preUpdate();
+                    updateInvoiceData.add(invoiceInfo);
+                }
+                mapper.updateInvoiceList(updateInvoiceData);
+            }
+            reimbursement.preUpdate();
+            mapper.saveBusiness(reimbursement);
+        }
+    }
+
+    @Override
+    @Transactional(readOnly = false)
+    public Map<String,Object> saveGatheringTime(AccountantReimbursementDTO reimbursement) {
+        Map<String,Object> map = new HashMap<String,Object>();
+        String[] idArray =reimbursement.getId().split(",");
+        ArrayList<String> idList = Lists.newArrayList(idArray);
+        //根据id查询发票是否已经填写过收款时间信息
+        List<AccountantReimbursementDTO> invoiceList =  mapper.getGatheringTimeInvoiceList(idList);
+        if(invoiceList.size()>0){
+            List<String> invoiceNumber = Lists.newArrayList();
+            for (AccountantReimbursementDTO invoice : invoiceList) {
+                invoiceNumber.add(invoice.getInvoiceNumber());
+            }
+            String invoiceNumberStr = StringUtils.join(invoiceNumber, ",");
+            map.put("message","发票号:" + invoiceNumberStr + " 已经填写过收款日期,无法重复填写。<br/> 本次收款操作失败");
+            map.put("success",false);
+            return map;
+        }
+        //修改发票收款时间
+        reimbursement.preUpdate();
+        mapper.updateGatheringTime(idList,reimbursement);
+
+        for (String id : idList) {
+            reimbursement.setBusinessCode(id);
+
+            //根据该条发票信息查询同业务编号下的没有收款的发票信息
+            List<AccountantReimbursementDTO> notGatheringTimeInvoice = mapper.getNotGatheringTimeInvoice(reimbursement);
+            if(notGatheringTimeInvoice.size() == 0){
+                //查询该发票信息
+                AccountantReimbursementDTO reimbursementDTO = mapper.queryInvoiceById(id);
+                //如果所有的发票均已收款,则将业务信息添加全部收款状态
+                if(null != reimbursementDTO){
+                    mapper.updateGatheringStatusById(reimbursementDTO.getParentId());
+                }
+            }
+        }
+
+
+        map.put("success",true);
+        map.put("message","收款成功");
+        return map;
+    }
+
+    @Override
+    @Transactional(readOnly = false)
+    public void saveInvoice(AccountantReimbursementDTO reimbursement) {
+        reimbursement.preUpdate();
+        mapper.saveInvoice(reimbursement);
+        //根据该条发票信息查询同业务编号下的没有收款的发票信息
+        List<AccountantReimbursementDTO> notGatheringTimeInvoice = mapper.getNotGatheringTimeInvoice(reimbursement);
+        if(notGatheringTimeInvoice.size() == 0){
+            //查询该发票信息
+            AccountantReimbursementDTO reimbursementDTO = mapper.queryInvoiceById(reimbursement.getId());
+            //如果所有的发票均已收款,则将业务信息添加全部收款状态
+            mapper.updateGatheringStatusById(reimbursementDTO.getParentId());
+        }
+    }
+
+    @Override
+    @Transactional(readOnly = false)
+    public void modifyInvoice(AccountantReimbursementDTO reimbursement) {
+        reimbursement.preUpdate();
+        mapper.modifyInvoice(reimbursement);
+    }
+
+    @Override
+    @Transactional(readOnly = false)
+    public void removeByIds(List<String> idList) {
+        //删除业务信息
+        mapper.removeBusinessByIds(idList);
+        //删除发票信息
+        mapper.removeInvoiceByIds(idList);
+    }
+
+    @Override
+    @Transactional(readOnly = false)
+    public void removeBusinessByIds(List<String> idList) {
+        //删除业务信息
+        mapper.removeBusinessByIds(idList);
+        //删除发票信息
+        mapper.removeBusinessByParentIds(idList);
+
+        this.removeInvoiceByIds(idList);
+
+    }
+
+    @Override
+    @Transactional(readOnly = false)
+    public void removeInvoiceByIds(List<String> idList) {
+        //删除发票信息
+        mapper.removeInvoiceByIds(idList);
+        Set<String> set = new HashSet<>();
+        //遍历发票id查询对应得业务信息下是否存在有效的发票信息,若不存在,则将对应的业务信息同时删除
+        for (String id : idList) {
+            //查询该发票信息下是否存在有效的同级数据信息
+            String businessId = mapper.getValidBusinessIdByInvoiceId(id);
+
+            if(StringUtils.isBlank(businessId)){
+                AccountantReimbursementDTO accountantReimbursementDTO = this.queryBusinessByInvoiceId(id);
+                if(null != accountantReimbursementDTO){
+                    set.add(accountantReimbursementDTO.getId());
+                }
+            }
+        }
+        if (set.size()>0){
+            mapper.removeBusinessByIds(new ArrayList<>(set));
+        }
+    }
+
+    @Override
+    @Transactional(readOnly = false)
+    public void updateReimbursementRatio(AccountantReimbursementDTO reimbursement) {
+        mapper.updateReimbursementRatio(reimbursement);
+    }
+
+    @Override
+    @Transactional(readOnly = false)
+    public Map<String,Object> addBatchReimbursement(List<String> idList) {
+        Map<String,Object> map = new HashMap<String,Object>();
+        //根据发票id查询对应的发票信息
+        List<AccountantReimbursementDTO> invoiceList = mapper.getInvoiceByIdList(idList);
+        if(invoiceList.size()>0){
+            String firstParentId = invoiceList.get(0).getParentId();
+            String firstParentIds = invoiceList.get(0).getParentIds();
+            Set<String> reimbursementIdSet = new HashSet<String>();
+            for (AccountantReimbursementDTO info : invoiceList) {
+                reimbursementIdSet.add(info.getParentId());
+            }
+            reimbursementIdSet.remove(firstParentId);
+            //删除除第一个以外的所有业务信息
+            if(reimbursementIdSet.size()>0){
+                mapper.deleteBusinessByIdList(new ArrayList<>(reimbursementIdSet));
+            }
+            //将所有发票信息的父节点变更为存在的业务信息id
+            for (AccountantReimbursementDTO info : invoiceList) {
+                info.setParentId(firstParentId);
+                info.setParentIds(firstParentIds);
+                info.setBatchFlag("1");
+                info.preUpdate();
+            }
+            //批量修改发票信息
+            mapper.updateInvoiceList(invoiceList);
+            //修改业务信息(添加状态)
+            AccountantReimbursementDTO info = new AccountantReimbursementDTO();
+            info.setId(firstParentId);
+            info.setBatchFlag("1");
+            info.preUpdate();
+            mapper.updateById(info);
+
+        } else {
+            map.put("success", false);
+            map.put("message", "未查询到符合条件的发票信息");
+        }
+        return map;
+    }
+
+    /**
+     * 文件数据分组
+     * @param dataList
+     * @return
+     */
+    public Map<String, List<AccountantReimbursementDTO>> dataDisposeOnSaveByBusinessCode(List<AccountantReimbursementDTO> dataList) {
+        Map<String, List<AccountantReimbursementDTO>> result = listMapOnSaveByBusinessCode(dataList);
+        return result;
+    }
+
+    private Map<String, List<AccountantReimbursementDTO>> listMapOnSaveByBusinessCode(List<AccountantReimbursementDTO> list) {
+        Map<String, List<AccountantReimbursementDTO>> userSignSerialMap = new HashMap<>();
+        if (CollectionUtils.isNotEmpty(list)) {
+            // 分组
+            for (AccountantReimbursementDTO vo : list) {
+                List<AccountantReimbursementDTO> tempList = userSignSerialMap.get(vo.getBusinessCode());
+                /*如果取不到数据,那么直接new一个空的ArrayList**/
+                if (tempList == null) {
+                    tempList = new ArrayList<>();
+                    tempList.add(vo);
+                    userSignSerialMap.put(vo.getBusinessCode(), tempList);
+                }
+                else {
+                    /*某个vo之前已经存放过了,则直接追加数据到原来的List里**/
+                    tempList.add(vo);
+                }
+            }
+        }
+        return userSignSerialMap;
+    }
+
+}

+ 322 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/service/impl/AccountantReimbursementUserServiceImpl.java

@@ -0,0 +1,322 @@
+package com.jeeplus.test.reimbursementAccountant.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.google.common.collect.Lists;
+import com.jeeplus.sys.service.dto.UserDTO;
+import com.jeeplus.sys.utils.DictUtils;
+import com.jeeplus.sys.utils.StringUtils;
+import com.jeeplus.sys.utils.UserUtils;
+import com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementBusinessDTO;
+import com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementBusinessReturnDTO;
+import com.jeeplus.test.reimbursementAccountant.domain.dto.AccountantReimbursementUserDTO;
+import com.jeeplus.test.reimbursementAccountant.mapper.AccountantReimbursementBusinessMapper;
+import com.jeeplus.test.reimbursementAccountant.mapper.AccountantReimbursementUserMapper;
+import com.jeeplus.test.reimbursementAccountant.service.AccountantReimbursementUserService;
+import org.apache.commons.collections4.CollectionUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author li-peike
+ * @version 1.0.0
+ * @ClassName ReimbursementSysServiceImpl.java
+ * @Description TODO
+ * @createTime 2022年05月06日 10:38:00
+ */
+@Service
+@Transactional(readOnly = true)
+public class AccountantReimbursementUserServiceImpl implements AccountantReimbursementUserService {
+
+    @Autowired
+    private AccountantReimbursementUserMapper mapper;
+
+    @Autowired
+    private AccountantReimbursementBusinessMapper businessMapper;
+
+
+    @Override
+    public AccountantReimbursementUserDTO queryById(String id) {
+        return mapper.queryById(id);
+    }
+
+    @Override
+    public AccountantReimbursementUserDTO queryByUserIdAndYear(AccountantReimbursementUserDTO reimbursementUser) {
+        return mapper.queryByUserIdAndYear(reimbursementUser);
+    }
+
+
+    @Override
+    public IPage<AccountantReimbursementUserDTO> findList(Page<AccountantReimbursementUserDTO> page, AccountantReimbursementUserDTO reimbursementUser) {
+        IPage<AccountantReimbursementUserDTO> pageList = mapper.findList(page, reimbursementUser);
+        List<AccountantReimbursementUserDTO> list = pageList.getRecords();
+        pageList.setRecords(list);
+        return pageList;
+    }
+
+    /**
+     * 保存
+     * @param reimbursementUser
+     */
+    @Override
+    @Transactional(readOnly = false)
+    public Map<String,Object> save(AccountantReimbursementUserDTO reimbursementUser) {
+        Map<String,Object> map = new HashMap<>();
+
+        if(StringUtils.isBlank(reimbursementUser.getUserId())){
+            map.put("success", false);
+            map.put("message", "报销人员为空,无法进行添加报销信息!");
+            return map;
+        }
+        if(StringUtils.isBlank(reimbursementUser.getYear())){
+            map.put("success", false);
+            map.put("message", "报销年份不正确,请重新填写!");
+            return map;
+        }
+
+        if(StringUtils.isBlank(reimbursementUser.getReimbursementQuotaDay())){
+            map.put("success", false);
+            map.put("message", "日报销额度填写不正确!");
+            return map;
+        }
+        if(null == reimbursementUser.getReimbursementAllDay()){
+            map.put("success", false);
+            map.put("message", "年可报销天数填写不正确!");
+            return map;
+        }
+        //日报销额度
+        BigDecimal reimbursementQuotaDay = new BigDecimal(reimbursementUser.getReimbursementQuotaDay());
+        //年可报销天数
+        BigDecimal reimbursementAllDay = new BigDecimal(reimbursementUser.getReimbursementAllDay());
+
+        //计算并赋值年报销额度
+        reimbursementUser.setReimbursementQuota(reimbursementQuotaDay.multiply(reimbursementAllDay).toString());
+
+        UserDTO user = UserUtils.get(reimbursementUser.getUserId());
+        if(StringUtils.isNotBlank(reimbursementUser.getId())){
+            reimbursementUser.preUpdate();
+            //新增
+            mapper.update(reimbursementUser);
+        }else{
+            //查询该用户该年度是否已经添加报销额度
+            AccountantReimbursementUserDTO queryByUserIdAndYear = mapper.queryByUserIdAndYear(reimbursementUser);
+            if(null != queryByUserIdAndYear){
+                map.put("success", false);
+                map.put("message", user.getName() + " " + reimbursementUser.getYear() + "年度报销额度已添加,无法重复添加!");
+                return map;
+            }
+            reimbursementUser.preInsert();
+            //新增
+            mapper.save(reimbursementUser);
+        }
+
+        map.put("success", true);
+        map.put("message", user.getName() + " " + reimbursementUser.getYear() + "年度报销额度:" + reimbursementUser.getReimbursementQuota() +" 保存成功");
+        return map;
+    }
+
+
+    @Override
+    @Transactional(readOnly = false)
+    public void update(AccountantReimbursementUserDTO reimbursementUser) {
+        mapper.update(reimbursementUser);
+    }
+
+    @Override
+    @Transactional(readOnly = false)
+    public Map<String,Object> delete(List<String> idList) {
+        Map<String,Object> map = new HashMap<>();
+        List<String> userName = Lists.newArrayList();
+        //删除发票信息
+        //判断该人员该年度是否已经存在报销情况,如存在则不可以删除
+        //根据id集合查询人员信息
+        for (String id: idList) {
+            AccountantReimbursementUserDTO reimbursementUserDTO = mapper.queryById(id);
+            AccountantReimbursementBusinessDTO reimbursementBusiness = new AccountantReimbursementBusinessDTO();
+            reimbursementBusiness.setUserId(reimbursementUserDTO.getUserId());
+            reimbursementBusiness.setYear(reimbursementUserDTO.getYear());
+            List<AccountantReimbursementBusinessDTO> list = businessMapper.findListByUserIdAndYear(reimbursementBusiness);
+            if(list.size()>0){
+                userName.add(reimbursementUserDTO.getUser().getName());
+            }
+        }
+        if(userName.size()>0){
+            map.put("success",false);
+            String userNames = StringUtils.join(userName, "、");
+            map.put("message", "员工 " + userNames + " 存在已报销情况,本次删除失败");
+        }else{
+            mapper.delete(idList);
+            map.put("success",true);
+            map.put("message", "删除成功");
+        }
+        return map;
+    }
+
+    @Override
+    public AccountantReimbursementBusinessReturnDTO findListByUserId(AccountantReimbursementUserDTO reimbursementUserDTO) {
+        AccountantReimbursementBusinessDTO reimbursementBusiness = new AccountantReimbursementBusinessDTO();
+        reimbursementBusiness.setUserId(reimbursementUserDTO.getUserId());
+        reimbursementBusiness.setYear(reimbursementUserDTO.getYear());
+        AccountantReimbursementBusinessReturnDTO reimbursementBusinessReturnDTO = new AccountantReimbursementBusinessReturnDTO();
+        List<AccountantReimbursementBusinessDTO> list = businessMapper.findListByUserIdAndYear(reimbursementBusiness);
+
+        //获取人员年度报销详情
+        AccountantReimbursementUserDTO reimbursementUserInfo = mapper.queryByUserIdAndYear(reimbursementUserDTO);
+        reimbursementBusinessReturnDTO.setList(list);
+        reimbursementBusinessReturnDTO.setReimbursementQuota(reimbursementUserInfo.getReimbursementQuota());
+
+        //已报销额度
+        BigDecimal alreadyReimbursementAmount = new BigDecimal("0");
+        //已报销天数
+        BigDecimal alreadyReimbursementDay = new BigDecimal("0");
+
+        for (AccountantReimbursementBusinessDTO info : list) {
+            BigDecimal bigDecimal = new BigDecimal(info.getReimbursementAmount());
+            alreadyReimbursementAmount = alreadyReimbursementAmount.add(bigDecimal);
+            if("1".equals(info.getReimbursementType())){
+                alreadyReimbursementDay = alreadyReimbursementDay.add(new BigDecimal(info.getReimbursementDay()));
+            }
+            info.setReimbursementType(DictUtils.getDictLabel(info.getReimbursementType(), "reimbursement_type", null));
+        }
+        //剩余报销额度
+        reimbursementBusinessReturnDTO.setSurplusReimbursementAmount(new BigDecimal(reimbursementBusinessReturnDTO.getReimbursementQuota()).subtract(alreadyReimbursementAmount).toString());
+        //计算出可报销总天数
+        BigDecimal reimbursementDay = new BigDecimal("0");
+        if(null == reimbursementUserInfo.getReimbursementAllDay()){
+            reimbursementDay = new BigDecimal(reimbursementBusinessReturnDTO.getReimbursementQuota()).divide(new BigDecimal(reimbursementUserInfo.getReimbursementQuotaDay()),2, BigDecimal.ROUND_HALF_UP);
+        }else{
+            reimbursementDay = new BigDecimal(reimbursementUserInfo.getReimbursementAllDay());
+        }
+
+        //剩余报销天数
+        reimbursementBusinessReturnDTO.setSurplusReimbursementDay(reimbursementDay.subtract(alreadyReimbursementDay).toString());
+        //报销天数
+        reimbursementBusinessReturnDTO.setReimbursementDay(reimbursementDay.toString());
+        //已报销天数
+        reimbursementBusinessReturnDTO.setAlreadyReimbursementDay(alreadyReimbursementDay.toString());
+        //已报销额度
+        reimbursementBusinessReturnDTO.setAlreadyReimbursementAmount(alreadyReimbursementAmount.toString());
+        //日报销额度
+        reimbursementBusinessReturnDTO.setReimbursementQuotaDay(reimbursementUserInfo.getReimbursementQuotaDay());
+
+        return reimbursementBusinessReturnDTO;
+    }
+
+    @Override
+    public List<UserDTO> getUserByNameAndOfficeName(AccountantReimbursementUserDTO reimbursementUserDTO) {
+        return mapper.getUserByNameAndOfficeName(reimbursementUserDTO);
+    }
+
+    @Override
+    @Transactional(readOnly = false)
+    public Map<String, Object> saveList(List<AccountantReimbursementUserDTO> reimbursementUserList) {
+
+        List<AccountantReimbursementUserDTO> saveList = Lists.newArrayList();
+        List<AccountantReimbursementUserDTO> existList = Lists.newArrayList();
+        StringBuilder failureMsg = new StringBuilder ( );
+
+        Map<String,Object> map = new HashMap<>();
+        Map<String, List<AccountantReimbursementUserDTO>> stringListMap = dataDispose(reimbursementUserList);
+        if(reimbursementUserList.size() != stringListMap.size()){
+            map.put("success", false);
+            map.put("message", "报销人员中存在重复项,无法进行导入!");
+            return map;
+        }
+
+
+        for (AccountantReimbursementUserDTO reimbursementUser: reimbursementUserList) {
+            if(StringUtils.isBlank(reimbursementUser.getYear())){
+                map.put("success", false);
+                map.put("message", reimbursementUser.getUserName() + " 的报销年份不正确,请重新填写!");
+                return map;
+            }
+            if(StringUtils.isBlank(reimbursementUser.getReimbursementQuotaDay())){
+                map.put("success", false);
+                map.put("message", reimbursementUser.getUserName() + " 的日报销额度填写不正确!");
+                return map;
+            }
+            if(null == reimbursementUser.getReimbursementAllDay()){
+                map.put("success", false);
+                map.put("message", reimbursementUser.getUserName() + " 的年可报销天数填写不正确!");
+                return map;
+            }
+            //日报销额度
+            BigDecimal reimbursementQuotaDay = new BigDecimal(reimbursementUser.getReimbursementQuotaDay());
+            //年可报销天数
+            BigDecimal reimbursementAllDay = new BigDecimal(reimbursementUser.getReimbursementAllDay());
+
+            //计算并赋值年报销额度
+            reimbursementUser.setReimbursementQuota(reimbursementQuotaDay.multiply(reimbursementAllDay).toString());
+
+            //根据用户id和年份查询报数员工库表中是否存在数据
+            //如果有,则将其从list列表中剔除
+            AccountantReimbursementUserDTO reimbursementUserDTOS = mapper.queryByUserIdAndYear(reimbursementUser);
+            if(null != reimbursementUserDTOS){
+                existList.add(reimbursementUser);
+            }else{
+                reimbursementUser.preInsert();
+                saveList.add(reimbursementUser);
+            }
+
+        }
+
+
+        //新增
+        if(saveList.size()>0){
+            mapper.saveList(saveList);
+        }
+
+        if(existList.size()>0){
+            for (AccountantReimbursementUserDTO user : existList) {
+                failureMsg.append ( "。 " + user.getOfficeName() + " 部门下的员工 " + user.getUserName() + " 已添加,无法再次添加;" );
+            }
+        }
+
+        map.put("success", true);
+        map.put("saveCount", saveList.size());
+        map.put("message", failureMsg);
+
+        return map;
+    }
+
+
+    /**
+     * 文件数据分组
+     * @param dataList
+     * @return
+     */
+    public Map<String, List<AccountantReimbursementUserDTO>> dataDispose(List<AccountantReimbursementUserDTO> dataList) {
+        Map<String, List<AccountantReimbursementUserDTO>> result = listMap(dataList);
+        return result;
+    }
+
+    private Map<String, List<AccountantReimbursementUserDTO>> listMap(List<AccountantReimbursementUserDTO> list) {
+        Map<String, List<AccountantReimbursementUserDTO>> userSignSerialMap = new HashMap<>();
+        if (CollectionUtils.isNotEmpty(list)) {
+            // 分组
+            for (AccountantReimbursementUserDTO vo : list) {
+                List<AccountantReimbursementUserDTO> tempList = userSignSerialMap.get(vo.getKeyFlag());
+                /*如果取不到数据,那么直接new一个空的ArrayList**/
+                if (tempList == null) {
+                    tempList = new ArrayList<>();
+                    tempList.add(vo);
+                    userSignSerialMap.put(vo.getKeyFlag(), tempList);
+                }
+                else {
+                    /*某个vo之前已经存放过了,则直接追加数据到原来的List里**/
+                    tempList.add(vo);
+                }
+            }
+        }
+        return userSignSerialMap;
+    }
+
+}

+ 310 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/utils/MyBeanUtils.java

@@ -0,0 +1,310 @@
+package com.jeeplus.test.reimbursementAccountant.utils;
+
+import org.apache.commons.beanutils.DynaBean;
+import org.apache.commons.beanutils.DynaProperty;
+import org.apache.commons.beanutils.PropertyUtils;
+import org.apache.commons.beanutils.PropertyUtilsBean;
+
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * <p>Title: </p>
+ * <p>Description: </p>
+ * @author  刘高峰
+ * @version 2.0
+ */
+
+public class MyBeanUtils
+    extends PropertyUtilsBean {
+
+  private static void convert(Object dest, Object orig) throws
+      IllegalAccessException, InvocationTargetException {
+
+      // Validate existence of the specified beans
+      if (dest == null) {
+          throw new IllegalArgumentException
+              ("No destination bean specified");
+      }
+      if (orig == null) {
+          throw new IllegalArgumentException("No origin bean specified");
+      }
+
+      // Copy the properties, converting as necessary
+      if (orig instanceof DynaBean) {
+          DynaProperty origDescriptors[] =
+              ( (DynaBean) orig).getDynaClass().getDynaProperties();
+          for (int i = 0; i < origDescriptors.length; i++) {
+              String name = origDescriptors[i].getName();
+              if (PropertyUtils.isWriteable(dest, name)) {
+                  Object value = ( (DynaBean) orig).get(name);
+                  try {
+                	  getInstance().setSimpleProperty(dest, name, value);
+                  }
+                  catch (Exception e) {
+                      ; // Should not happen
+                  }
+
+              }
+          }
+      }
+      else if (orig instanceof Map) {
+          Iterator names = ( (Map) orig).keySet().iterator();
+          while (names.hasNext()) {
+              String name = (String) names.next();
+              if (PropertyUtils.isWriteable(dest, name)) {
+                  Object value = ( (Map) orig).get(name);
+                  try {
+                	  getInstance().setSimpleProperty(dest, name, value);
+                  }
+                  catch (Exception e) {
+                      ; // Should not happen
+                  }
+
+              }
+          }
+      }
+      else
+      /* if (orig is a standard JavaBean) */
+      {
+          PropertyDescriptor origDescriptors[] =
+              PropertyUtils.getPropertyDescriptors(orig);
+          for (int i = 0; i < origDescriptors.length; i++) {
+              String name = origDescriptors[i].getName();
+//              String type = origDescriptors[i].getPropertyType().toString();
+              if ("class".equals(name)) {
+                  continue; // No point in trying to set an object's class
+              }
+              if (PropertyUtils.isReadable(orig, name) &&
+                  PropertyUtils.isWriteable(dest, name)) {
+                  try {
+                      Object value = PropertyUtils.getSimpleProperty(orig, name);
+                      getInstance().setSimpleProperty(dest, name, value);
+                  }
+                  catch (IllegalArgumentException ie) {
+                      ; // Should not happen
+                  }
+                  catch (Exception e) {
+                      ; // Should not happen
+                  }
+
+              }
+          }
+      }
+
+  }
+
+  
+  /**
+	 * 对象拷贝
+	 * 数据对象空值不拷贝到目标对象
+	 * 
+	 * @param databean
+	 * @param tobean
+	 * @throws NoSuchMethodException
+	 * copy
+	 */
+  public static void copyBeanNotNull2Bean(Object databean,Object tobean) {
+	  PropertyDescriptor origDescriptors[] = PropertyUtils.getPropertyDescriptors(databean);
+      for (int i = 0; i < origDescriptors.length; i++) {
+          String name = origDescriptors[i].getName();
+//          String type = origDescriptors[i].getPropertyType().toString();
+          if ("class".equals(name)) {
+              continue; // No point in trying to set an object's class
+          }
+          if (PropertyUtils.isReadable(databean, name) && PropertyUtils.isWriteable(tobean, name)) {
+              try { 
+                  Object value = PropertyUtils.getSimpleProperty(databean, name);
+                  if(value!=null){
+                	  getInstance().setSimpleProperty(tobean, name, value);
+                  }
+              }
+              catch (IllegalArgumentException ie) {
+                  ; // Should not happen
+              }
+              catch (Exception e) {
+                  ; // Should not happen
+              }
+
+          }
+      }
+  }
+  
+  
+  /**
+   * 把orig和dest相同属性的value复制到dest中
+   * @param dest
+   * @param orig
+   * @throws IllegalAccessException
+   * @throws InvocationTargetException
+   */
+  public static void copyBean2Bean(Object dest, Object orig) throws Exception {
+      convert(dest, orig);
+  }
+
+  public static void copyBean2Map(Map map, Object bean){
+	PropertyDescriptor[] pds = PropertyUtils.getPropertyDescriptors(bean);
+	for (int i =0;i<pds.length;i++)
+	{
+		PropertyDescriptor pd = pds[i];
+		String propname = pd.getName();
+		try {
+			Object propvalue = PropertyUtils.getSimpleProperty(bean,propname);
+			map.put(propname, propvalue);
+		} catch (IllegalAccessException e) {
+			//e.printStackTrace();
+		} catch (InvocationTargetException e) {
+			//e.printStackTrace();
+		} catch (NoSuchMethodException e) {
+			//e.printStackTrace();
+		}
+	}
+  }
+
+  /**
+   * 将Map内的key与Bean中属性相同的内容复制到BEAN中
+   * @param bean Object
+   * @param properties Map
+   * @throws IllegalAccessException
+   * @throws InvocationTargetException
+   */
+  public static void copyMap2Bean(Object bean, Map properties) throws
+      IllegalAccessException, InvocationTargetException {
+      // Do nothing unless both arguments have been specified
+      if ( (bean == null) || (properties == null)) {
+          return;
+      }
+      // Loop through the property name/value pairs to be set
+      Iterator names = properties.keySet().iterator();
+      while (names.hasNext()) {
+          String name = (String) names.next();
+          // Identify the property name and value(s) to be assigned
+          if (name == null) {
+              continue;
+          }
+          Object value = properties.get(name);
+          try {
+              Class clazz = PropertyUtils.getPropertyType(bean, name);
+              if (null == clazz) {
+                  continue;
+              }
+              String className = clazz.getName();
+              if (className.equalsIgnoreCase("java.sql.Timestamp")) {
+                  if (value == null || value.equals("")) {
+                      continue;
+                  }
+              }
+              getInstance().setSimpleProperty(bean, name, value);
+          }
+          catch (NoSuchMethodException e) {
+              continue;
+          }
+      }
+  }
+  
+
+  /**
+   * 自动转Map key值大写
+   * 将Map内的key与Bean中属性相同的内容复制到BEAN中
+   * @param bean Object
+   * @param properties Map
+   * @throws IllegalAccessException
+   * @throws InvocationTargetException
+   */
+  public static void copyMap2Bean_Nobig(Object bean, Map properties) throws
+      IllegalAccessException, InvocationTargetException {
+      // Do nothing unless both arguments have been specified
+      if ( (bean == null) || (properties == null)) {
+          return;
+      }
+      // Loop through the property name/value pairs to be set
+      Iterator names = properties.keySet().iterator();
+      while (names.hasNext()) {
+          String name = (String) names.next();
+          // Identify the property name and value(s) to be assigned
+          if (name == null) {
+              continue;
+          }
+          Object value = properties.get(name);
+          // 命名应该大小写应该敏感(否则取不到对象的属性)
+          //name = name.toLowerCase();
+          try {
+        	  if (value == null) {	// 不光Date类型,好多类型在null时会出错
+                  continue;	// 如果为null不用设 (对象如果有特殊初始值也可以保留?)
+              }
+              Class clazz = PropertyUtils.getPropertyType(bean, name);
+              if (null == clazz) {	// 在bean中这个属性不存在
+                  continue;
+              }
+              String className = clazz.getName();
+              // 临时对策(如果不处理默认的类型转换时会出错)
+              if (className.equalsIgnoreCase("java.util.Date")) {
+                  value = new java.util.Date(((java.sql.Timestamp)value).getTime());// wait to do:貌似有时区问题, 待进一步确认
+              }
+//              if (className.equalsIgnoreCase("java.sql.Timestamp")) {
+//                  if (value == null || value.equals("")) {
+//                      continue;
+//                  }
+//              }
+              getInstance().setSimpleProperty(bean, name, value);
+          }
+          catch (NoSuchMethodException e) {
+              continue;
+          }
+      }
+  }
+
+  /**
+   * Map内的key与Bean中属性相同的内容复制到BEAN中
+   * 对于存在空值的取默认值
+   * @param bean Object
+   * @param properties Map
+   * @param defaultValue String
+   * @throws IllegalAccessException
+   * @throws InvocationTargetException
+   */
+  public static void copyMap2Bean(Object bean, Map properties, String defaultValue) throws
+      IllegalAccessException, InvocationTargetException {
+      // Do nothing unless both arguments have been specified
+      if ( (bean == null) || (properties == null)) {
+          return;
+      }
+      // Loop through the property name/value pairs to be set
+      Iterator names = properties.keySet().iterator();
+      while (names.hasNext()) {
+          String name = (String) names.next();
+          // Identify the property name and value(s) to be assigned
+          if (name == null) {
+              continue;
+          }
+          Object value = properties.get(name);
+          try {
+              Class clazz = PropertyUtils.getPropertyType(bean, name);
+              if (null == clazz) {
+                  continue;
+              }
+              String className = clazz.getName();
+              if (className.equalsIgnoreCase("java.sql.Timestamp")) {
+                  if (value == null || value.equals("")) {
+                      continue;
+                  }
+              }
+              if (className.equalsIgnoreCase("java.lang.String")) {
+                  if (value == null) {
+                      value = defaultValue;
+                  }
+              }
+              getInstance().setSimpleProperty(bean, name, value);
+          }
+          catch (NoSuchMethodException e) {
+              continue;
+          }
+      }
+  }
+  
+  public MyBeanUtils() {
+    super();
+  }
+}

+ 1 - 1
jeeplus-web/src/main/resources/application-development.yml

@@ -48,7 +48,7 @@ spring:
         master:
         master:
           username: root
           username: root
           password: root
           password: root
-          url: jdbc:mysql://127.0.0.1:3306/jeeplus-vue-base?useUnicode=true&characterEncoding=utf-8&useSSL=false&nullCatalogMeansCurrent=true&serverTimezone=Asia/Shanghai&allowMultiQueries=true
+          url: jdbc:mysql://127.0.0.1:3306/zs_reimbursement?useUnicode=true&characterEncoding=utf-8&useSSL=false&nullCatalogMeansCurrent=true&serverTimezone=Asia/Shanghai&allowMultiQueries=true
           driver-class-name: com.mysql.cj.jdbc.Driver
           driver-class-name: com.mysql.cj.jdbc.Driver
 
 
           #oracle database settings
           #oracle database settings