Browse Source

财务报销表

zhaoxian 3 năm trước cách đây
mục cha
commit
cac0abcce6
15 tập tin đã thay đổi với 327 bổ sung117 xóa
  1. 46 1
      jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/controller/ReimburseApplyController.java
  2. 41 92
      jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/controller/ReimburseExpressController.java
  3. 3 5
      jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/controller/ReimburseProjectController.java
  4. 6 1
      jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/entity/ReimburseApply.java
  5. 6 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/entity/ReimburseProject.java
  6. 2 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/mapper/ReimburseApplyMapper.java
  7. 4 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/mapper/ReimburseExpressMapper.java
  8. 105 10
      jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/mapper/xml/ReimburseApplyMapper.xml
  9. 19 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/mapper/xml/ReimburseExpressMapper.xml
  10. 1 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/service/IReimburseApplyService.java
  11. 5 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/service/IReimburseExpressService.java
  12. 1 1
      jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/service/IReimburseProjectService.java
  13. 25 7
      jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/service/impl/ReimburseApplyServiceImpl.java
  14. 60 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/service/impl/ReimburseExpressServiceImpl.java
  15. 3 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/service/impl/ReimburseProjectServiceImpl.java

+ 46 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/controller/ReimburseApplyController.java

@@ -4,8 +4,13 @@ import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.ExportExcelUtils;
 import cn.com.ctop.common.module.utils.HttpUtils;
 import cn.com.ctop.reimburse.mondule.entity.ReimburseApply;
+import cn.com.ctop.reimburse.mondule.entity.ReimburseDict;
+import cn.com.ctop.reimburse.mondule.entity.ReimburseProject;
 import cn.com.ctop.reimburse.mondule.service.IReimburseApplyService;
+import cn.com.ctop.reimburse.mondule.service.IReimburseDictService;
+import cn.com.ctop.reimburse.mondule.service.IReimburseProjectService;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
@@ -25,7 +30,9 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * 报销申请提交表
@@ -39,6 +46,11 @@ public class ReimburseApplyController {
     private IReimburseApplyService reimburseApplyService;
 
     @Autowired
+    private IReimburseDictService reimburseDictService;
+
+    @Autowired
+    private IReimburseProjectService projectService;
+    @Autowired
     private ISysRoleService sysRoleService;
 
     /**
@@ -55,6 +67,9 @@ public class ReimburseApplyController {
             if ("financialReview".equals(roleCode)) {
                 //财务查询
                 reimburseApply.setFinancialReview(1);
+            } else if ("admin".equals(roleCode)) {
+                //管理员
+                reimburseApply.setFinancialReview(2);
             }
             return reimburseApplyService.queryPageList(reimburseApply, pageNo, pageSize);
         } catch (Exception e) {
@@ -70,9 +85,17 @@ public class ReimburseApplyController {
         if ("financialReview".equals(roleCode)) {
             //财务查询
             reimburseApply.setFinancialReview(1);
+        } else if ("admin".equals(roleCode)) {
+            //管理员
+            reimburseApply.setFinancialReview(2);
         }
         List<JSONObject> list = reimburseApplyService.queryList(reimburseApply);
         if (!Check.isNull(list)) {
+            List<ReimburseDict> dictList = reimburseDictService.list();
+            Map<String, String> map = new HashMap<>();
+            for (ReimburseDict dict : dictList) {
+                map.put(dict.getDcode(), dict.getDname());
+            }
             try {
                 List<List<Object>> excelList = new ArrayList<>();
                 if (!list.isEmpty()) {
@@ -84,7 +107,7 @@ public class ReimburseApplyController {
                         temp.add(info.getString("companyName"));
                         temp.add(info.getString("media"));
                         temp.add(info.getString("type"));
-                        temp.add(info.getString("project"));
+                        temp.add(map.get(info.getString("project")));
                         temp.add(info.getString("amount"));
                         temp.add(info.getString("expenseDate"));
                         temp.add(info.getString("statDate"));
@@ -136,6 +159,20 @@ public class ReimburseApplyController {
     }
 
     /**
+     * 提交审核
+     */
+    @GetMapping(value = "/submitReview")
+    public Result<Object> submitReview(String id) {
+        try {
+            return reimburseApplyService.submitReview(id);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return Result.error("操作失败!");
+        }
+    }
+
+
+    /**
      * 通过id删除
      */
     @GetMapping(value = "/delete")
@@ -182,6 +219,14 @@ public class ReimburseApplyController {
         if (reimburseApply == null) {
             result.error500("未找到对应实体");
         } else {
+            QueryWrapper<ReimburseProject> queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("apply_id", reimburseApply.getId());
+            List<ReimburseProject> list = projectService.list(queryWrapper);
+            List<Long> ids = new ArrayList<>();
+            for (ReimburseProject project : list) {
+                ids.add(project.getId());
+            }
+            reimburseApply.setIds(JSONObject.toJSONString(ids));
             result.setResult(reimburseApply);
             result.setSuccess(true);
         }

+ 41 - 92
jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/controller/ReimburseExpressController.java

@@ -1,5 +1,7 @@
 package cn.com.ctop.reimburse.mondule.controller;
 
+import cn.com.ctop.common.module.service.ISysUserService;
+import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.reimburse.mondule.entity.ReimburseExpress;
 import cn.com.ctop.reimburse.mondule.service.IReimburseExpressService;
 import com.alibaba.fastjson.JSON;
@@ -10,6 +12,7 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.entity.SysUser;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecgframework.poi.excel.ExcelImportUtil;
@@ -26,6 +29,7 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartHttpServletRequest;
@@ -55,6 +59,9 @@ public class ReimburseExpressController {
     @Autowired
     private IReimburseExpressService reimburseExpressService;
 
+    @Autowired
+    private ISysUserService sysUserService;
+
     /**
      * 分页列表查询
      *
@@ -71,7 +78,17 @@ public class ReimburseExpressController {
                                                          @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                          HttpServletRequest req) {
         Result<IPage<ReimburseExpress>> result = new Result<>();
+        String statDate = reimburseExpress.getStatDate();
+        String userId = reimburseExpress.getUserId();
+        reimburseExpress = new ReimburseExpress();
         QueryWrapper<ReimburseExpress> queryWrapper = QueryGenerator.initQueryWrapper(reimburseExpress, req.getParameterMap());
+        if (!Check.isNull(statDate)) {
+            queryWrapper.likeLeft("stat_date", statDate);
+        }
+        if (!Check.isNull(userId)) {
+            queryWrapper.likeLeft("user_id", userId);
+        }
+
         Page<ReimburseExpress> page = new Page<ReimburseExpress>(pageNo, pageSize);
         IPage<ReimburseExpress> pageList = reimburseExpressService.page(page, queryWrapper);
         result.setSuccess(true);
@@ -81,15 +98,15 @@ public class ReimburseExpressController {
 
     /**
      * 添加
-     *
-     * @param reimburseExpress
-     * @return
      */
-    @ApiOperation(value = "报销申请——快递记录表-添加", notes = "报销申请——快递记录表-添加")
     @PostMapping(value = "/add")
     public Result<ReimburseExpress> add(@RequestBody ReimburseExpress reimburseExpress) {
         Result<ReimburseExpress> result = new Result<>();
         try {
+            SysUser user = sysUserService.getById(reimburseExpress.getUserId());
+            if (!Check.isNull(user)) {
+                reimburseExpress.setUserName(user.getRealname());
+            }
             reimburseExpressService.save(reimburseExpress);
             result.success("添加成功!");
         } catch (Exception e) {
@@ -100,13 +117,31 @@ public class ReimburseExpressController {
     }
 
     /**
+     * 导入EXCEL批量创建
+     */
+    @PostMapping(value = "/importExcel")
+    @ResponseBody
+    public Result<Object> importExcel(HttpServletResponse response, @RequestParam("file") MultipartFile file) {
+        response.setHeader("Access-Control-Allow-Origin", "*");
+        try {
+            if (Check.isNull(file)) {
+                return Result.error("执行失败,请上传应用Excel文件");
+            }
+            return reimburseExpressService.importExcel(file);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return Result.error("导入EXCEL失败," + e.getMessage());
+        }
+    }
+
+    /**
      * 编辑
      *
      * @param reimburseExpress
      * @return
      */
     @ApiOperation(value = "报销申请——快递记录表-编辑", notes = "报销申请——快递记录表-编辑")
-    @PutMapping(value = "/edit")
+    @PostMapping(value = "/edit")
     public Result<ReimburseExpress> edit(@RequestBody ReimburseExpress reimburseExpress) {
         Result<ReimburseExpress> result = new Result<ReimburseExpress>();
         ReimburseExpress reimburseExpressEntity = reimburseExpressService.getById(reimburseExpress.getId());
@@ -129,7 +164,7 @@ public class ReimburseExpressController {
      * @return
      */
     @ApiOperation(value = "报销申请——快递记录表-通过id删除", notes = "报销申请——快递记录表-通过id删除")
-    @DeleteMapping(value = "/delete")
+    @GetMapping(value = "/delete")
     public Result<?> delete(@RequestParam(name = "id") String id) {
         try {
             reimburseExpressService.removeById(id);
@@ -140,24 +175,6 @@ public class ReimburseExpressController {
         return Result.ok("删除成功!");
     }
 
-    /**
-     * 批量删除
-     *
-     * @param ids
-     * @return
-     */
-    @ApiOperation(value = "报销申请——快递记录表-批量删除", notes = "报销申请——快递记录表-批量删除")
-    @DeleteMapping(value = "/deleteBatch")
-    public Result<ReimburseExpress> deleteBatch(@RequestParam(name = "ids") String ids) {
-        Result<ReimburseExpress> result = new Result<>();
-        if (ids == null || "".equals(ids.trim())) {
-            result.error500("参数不识别!");
-        } else {
-            this.reimburseExpressService.removeByIds(Arrays.asList(ids.split(",")));
-            result.success("删除成功!");
-        }
-        return result;
-    }
 
     /**
      * 通过id查询
@@ -178,72 +195,4 @@ public class ReimburseExpressController {
         }
         return result;
     }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<ReimburseExpress> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                ReimburseExpress reimburseExpress = JSON.parseObject(deString, ReimburseExpress.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(reimburseExpress, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<ReimburseExpress> pageList = reimburseExpressService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "报销申请——快递记录表列表");
-        mv.addObject(NormalExcelConstants.CLASS, ReimburseExpress.class);
-        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("报销申请——快递记录表列表数据", "导出人:Jeecg", "导出信息"));
-        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-        return mv;
-    }
-
-    /**
-     * 通过excel导入数据
-     *
-     * @param request
-     * @param response
-     * @return
-     */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-            MultipartFile file = entity.getValue();
-            ImportParams params = new ImportParams();
-            params.setTitleRows(2);
-            params.setHeadRows(1);
-            params.setNeedSave(true);
-            try {
-                List<ReimburseExpress> listReimburseExpresss = ExcelImportUtil.importExcel(file.getInputStream(), ReimburseExpress.class, params);
-                reimburseExpressService.saveBatch(listReimburseExpresss);
-                return Result.ok("文件导入成功!数据行数:" + listReimburseExpresss.size());
-            } catch (Exception e) {
-                log.error(e.getMessage(), e);
-                return Result.error("文件导入失败:" + e.getMessage());
-            } finally {
-                try {
-                    file.getInputStream().close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-        return Result.ok("文件导入失败!");
-    }
-
 }

+ 3 - 5
jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/controller/ReimburseProjectController.java

@@ -59,16 +59,14 @@ public class ReimburseProjectController {
      * 添加
      */
     @PostMapping(value = "/add")
-    public Result<ReimburseProject> add(@RequestBody ReimburseProject reimburseProject) {
-        Result<ReimburseProject> result = new Result<>();
+    public Result<Object> add(@RequestBody ReimburseProject reimburseProject) {
         try {
             reimburseProjectService.save(reimburseProject);
-            result.success("添加成功!");
+            return Result.ok(reimburseProject.getId());
         } catch (Exception e) {
             log.error(e.getMessage(), e);
-            result.error500("操作失败");
+            return Result.error("操作失败");
         }
-        return result;
     }
 
     /**

+ 6 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/entity/ReimburseApply.java

@@ -30,7 +30,6 @@ public class ReimburseApply {
     /**
      * id
      */
-    @TableId(type = IdType.AUTO)
     @ApiModelProperty(value = "id")
     private Long id;
     /**
@@ -137,4 +136,10 @@ public class ReimburseApply {
     @TableField(exist = false)
     private Integer financialReview;
 
+    @TableField(exist = false)
+    private String ids;
+
+    @TableField(exist = false)
+    private String flag;
+
 }

+ 6 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/entity/ReimburseProject.java

@@ -85,6 +85,12 @@ public class ReimburseProject {
     @ApiModelProperty(value = "备注")
     private String remarks;
     /**
+     * 备注
+     */
+    @Excel(name = "审核说明", width = 15)
+    @ApiModelProperty(value = "审核说明")
+    private String auditDescription;
+    /**
      * 创建时间
      */
     @ApiModelProperty(value = "创建时间")

+ 2 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/mapper/ReimburseApplyMapper.java

@@ -3,6 +3,7 @@ package cn.com.ctop.reimburse.mondule.mapper;
 import cn.com.ctop.reimburse.mondule.entity.ReimburseApply;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -21,4 +22,5 @@ public interface ReimburseApplyMapper extends BaseMapper<ReimburseApply> {
 
     List<JSONObject> selectLeaders();
 
+    void insertRel(@Param("leader") String leader, @Param("applyId") Long applyId);
 }

+ 4 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/mapper/ReimburseExpressMapper.java

@@ -2,6 +2,9 @@ package cn.com.ctop.reimburse.mondule.mapper;
 
 import cn.com.ctop.reimburse.mondule.entity.ReimburseExpress;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * 报销申请——快递记录表
@@ -12,4 +15,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface ReimburseExpressMapper extends BaseMapper<ReimburseExpress> {
 
+    void replaceBatch(@Param(value = "list") List<ReimburseExpress> list);
 }

+ 105 - 10
jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/mapper/xml/ReimburseApplyMapper.xml

@@ -3,16 +3,62 @@
 <mapper namespace="cn.com.ctop.reimburse.mondule.mapper.ReimburseApplyMapper">
 
     <select id="queryPageList" resultType="cn.com.ctop.reimburse.mondule.entity.ReimburseApply">
-        SELECT * FROM ctop_reimburse_apply
+
+        SELECT * FROM (
+        SELECT *, 1 as 'flag' FROM ctop_reimburse_apply
+        where 1=1
+        <if test="financialReview == 1">
+            AND leader_id = ''
+        </if>
+        <if test="financialReview == null">
+            AND user_id = #{userId}
+        </if>
+        <if test="companyId != null and companyId != ''">
+            AND company_id =#{companyId}
+        </if>
+        <if test="media != null and media != ''">
+            AND media =#{media}
+        </if>
+        <if test="type != null and type != ''">
+            AND `type` =#{type}
+        </if>
+        <if test="status != null and status != ''">
+            AND status =#{status}
+        </if>
+        <if test="startDate != null and startDate != ''">
+            AND stat_date >=#{startDate}
+            AND stat_date &lt;=#{endDate}
+        </if>
+        union
+        SELECT *, 2 as 'flag' FROM ctop_reimburse_apply
         where 1=1
         <if test="financialReview == 1">
+            AND leader_id = ''
+        </if>
+        <if test="financialReview == null">
+            AND leader_id = #{userId}
+        </if>
+        <if test="companyId != null and companyId != ''">
             AND company_id =#{companyId}
         </if>
-        <if test="financialReview != 1">
-        ( user_id = #{userId}
-        OR
-        leader_id = #{userId})
+        <if test="media != null and media != ''">
+            AND media =#{media}
+        </if>
+        <if test="type != null and type != ''">
+            AND `type` =#{type}
+        </if>
+        <if test="status != null and status != ''">
+            AND status =#{status}
+        </if>
+        <if test="startDate != null and startDate != ''">
+            AND stat_date >=#{startDate}
+            AND stat_date &lt;=#{endDate}
         </if>
+        union
+        SELECT t1.*, 3 as 'flag' FROM ctop_reimburse_apply t1
+        left join ctop_reimburse_apply_leader_rel t2 on t1.id = t2.apply_id
+        where
+        t2.user_id = #{userId}
         <if test="companyId != null and companyId != ''">
             AND company_id =#{companyId}
         </if>
@@ -29,11 +75,16 @@
             AND stat_date >=#{startDate}
             AND stat_date &lt;=#{endDate}
         </if>
+        ) t
+        group by id
+        order by update_time
     </select>
 
     <select id="queryList" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT * from (
         SELECT
         t1.id,
+        t1.user_id,
         t1.user_name as 'userName',
         t1.depart_name as 'departName',
         t1.company_name as 'companyName',
@@ -47,13 +98,13 @@
         t1.`status`
         FROM ctop_reimburse_apply t1
         LEFT JOIN ctop_reimburse_project t2 ON t1.id = t2.apply_id
-        WHERE  1=1
+        WHERE 1=1
         <if test="financialReview == 1">
-            AND t1.company_id =#{companyId}
+            AND leader_id = ''
         </if>
-        <if test="financialReview != 1">
-        ( t1.user_id = #{userId}
-        OR
+        <if test="financialReview == null">
+            AND ( t1.user_id = #{userId}
+            OR
             t1.leader_id = #{userId})
         </if>
         <if test="companyId != null and companyId != ''">
@@ -72,10 +123,54 @@
             AND t1.stat_date >=#{startDate}
             AND t1.stat_date &lt;=#{endDate}
         </if>
+        UNION
+        SELECT
+        t1.id,
+        t1.user_id,
+        t1.user_name as 'userName',
+        t1.depart_name as 'departName',
+        t1.company_name as 'companyName',
+        t1.media,
+        t2.type,
+        t2.project,
+        t2.amount,
+        t2.stat_date as 'expenseDate',
+        t1.stat_date as 'statDate',
+        t2.remarks,
+        t1.`status`
+        FROM ctop_reimburse_apply t1
+        LEFT JOIN ctop_reimburse_project t2 ON t1.id = t2.apply_id
+        LEFT JOIN ctop_reimburse_apply_leader_rel t3 on t1.id = t3.apply_id
+        where t3.user_id = #{userId}
+        <if test="companyId != null and companyId != ''">
+            AND t1.company_id =#{companyId}
+        </if>
+        <if test="media != null and media != ''">
+            AND t1.media =#{media}
+        </if>
+        <if test="type != null and type != ''">
+            AND t1.`type` =#{type}
+        </if>
+        <if test="status != null and status != ''">
+            AND t1.status =#{status}
+        </if>
+        <if test="startDate != null and startDate != ''">
+            AND t1.stat_date >=#{startDate}
+            AND t1.stat_date &lt;=#{endDate}
+        </if>
+        ) t
+        order by t.user_id,t.statDate
     </select>
 
     <select id="selectLeaders" resultType="com.alibaba.fastjson.JSONObject">
         SELECT *
         FROM ctop_reimburse_leader
     </select>
+    <insert id="insertRel">
+        replace
+        into ctop_reimburse_apply_leader_rel(apply_id,user_id)VALUE (
+        #{applyId},
+        #{leader}
+        )
+    </insert>
 </mapper>

+ 19 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/mapper/xml/ReimburseExpressMapper.xml

@@ -2,4 +2,23 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.com.ctop.reimburse.mondule.mapper.ReimburseExpressMapper">
 
+    <insert id="replaceBatch">
+        replace into ctop_reimburse_express(
+        stat_date,
+        express_number,
+        user_id,
+        user_name,
+        remarks
+        )
+        values
+        <foreach collection="list" item="ad" separator=",">
+            (
+            #{ad.statDate},
+            #{ad.expressNumber},
+            #{ad.userId},
+            #{ad.userName},
+            #{ad.remarks}
+            )
+        </foreach>
+    </insert>
 </mapper>

+ 1 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/service/IReimburseApplyService.java

@@ -24,4 +24,5 @@ public interface IReimburseApplyService extends IService<ReimburseApply> {
 
     Result<Object> edit(JSONObject data);
 
+    Result<Object> submitReview(String id);
 }

+ 5 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/service/IReimburseExpressService.java

@@ -2,6 +2,10 @@ package cn.com.ctop.reimburse.mondule.service;
 
 import cn.com.ctop.reimburse.mondule.entity.ReimburseExpress;
 import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.common.api.vo.Result;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.IOException;
 
 /**
  * 报销申请——快递记录表
@@ -12,4 +16,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface IReimburseExpressService extends IService<ReimburseExpress> {
 
+    Result<Object> importExcel(MultipartFile file) throws IOException, Exception;
 }

+ 1 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/service/IReimburseProjectService.java

@@ -12,7 +12,7 @@ import java.util.List;
  * 2022-11-21
  * @version V1.0
  */
-public interface IReimburseProjectService extends IService<ReimburseProject> {
+    public interface IReimburseProjectService extends IService<ReimburseProject> {
 
     List<ReimburseProject> getByIds(List<String> ids);
 }

+ 25 - 7
jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/service/impl/ReimburseApplyServiceImpl.java

@@ -82,6 +82,14 @@ public class ReimburseApplyServiceImpl extends ServiceImpl<ReimburseApplyMapper,
         }
         String leader = getLeader(data.getString("userId"));
         apply.setLeaderId(leader);
+        SysUser user = sysUserService.getById(apply.getUserId());
+        if (!Check.isNull(user)) {
+            apply.setUserName(user.getRealname());
+        }
+        SysDepart depart = sysDepartService.getById(apply.getDepartId());
+        if (!Check.isNull(depart)) {
+            apply.setDepartName(depart.getDepartName());
+        }
         String randomNumber = RandomUtil.randomNumbers(6);
         String today = DateUtils.formatDate(new Date());
         String todayStr = DateUtils.getDateInteger(today).toString();
@@ -93,7 +101,7 @@ public class ReimburseApplyServiceImpl extends ServiceImpl<ReimburseApplyMapper,
             project.setApplyId(apply.getId());
             projectService.updateById(project);
         }
-        sendMsg(leader, "1", id, null);
+        baseMapper.insertRel(leader, apply.getId());
         return Result.ok();
     }
 
@@ -114,6 +122,7 @@ public class ReimburseApplyServiceImpl extends ServiceImpl<ReimburseApplyMapper,
             for (ReimburseProject project : projects) {
                 invoices += project.getInvoices();
                 amount += Double.valueOf(project.getAmount());
+                msg += project.getAuditDescription();
             }
             apply.setInvoices(invoices);
             apply.setAmount(amount.toString());
@@ -132,6 +141,7 @@ public class ReimburseApplyServiceImpl extends ServiceImpl<ReimburseApplyMapper,
                 project.setApplyId(apply.getId());
                 projectService.updateById(project);
             }
+            return Result.ok();
         } else {
             //获取下次审核人信息
             String leader = getLeader(data.getString("leaderId"));
@@ -161,6 +171,7 @@ public class ReimburseApplyServiceImpl extends ServiceImpl<ReimburseApplyMapper,
                 sender = apply.getUserId();
             }
             this.updateById(apply);
+            baseMapper.insertRel(sender, apply.getId());
         }
         //流程到财务审核
         if (isFinancialReview) {
@@ -172,14 +183,19 @@ public class ReimburseApplyServiceImpl extends ServiceImpl<ReimburseApplyMapper,
         } else {
             sendMsg(sender, type, id, msg);
         }
-
         return Result.ok();
     }
 
+    @Override
+    public Result<Object> submitReview(String id) {
+        ReimburseApply apply = this.getById(id);
+        sendMsg(apply.getLeaderId(), "1", id, null);
+        return null;
+    }
+
     // 获取审核人ID
     private String getLeader(String userId) {
         String leaderId = "";
-        //todo 查询公司
         JSONObject company = userCompanyService.getCompanyInfoByUserId(userId);
         String companyId = company.getString("companyId");
         if ("6608ed13c0dd42de93c790dbdf124234".equals(companyId)) {
@@ -259,11 +275,13 @@ public class ReimburseApplyServiceImpl extends ServiceImpl<ReimburseApplyMapper,
                         .append(")待您审批,请您及时查看审批!");
             } else {
                 text.append("报销提示").append("<br/>")
-                        .append("您好,你的报销单(编号:").append(id)
-                        .append(")审批未通过,未通过原因:")
-                        .append(msg).append(",请及时修改报销内容,以免耽误您的报销!");
+                        .append("您好,你的报销单(编号:").append(id).append(")审批未通过,");
+                if (!Check.isNull(msg)) {
+                    text.append("未通过原因:").append(msg).append(",");
+                }
+                text.append("请及时修改报销内容,以免耽误您的报销!");
             }
-            sendMessageService.sendMessage(userId, text.toString());
+//            sendMessageService.sendMessage(userId, text.toString());
             log.info("发送报销提醒,userId:{}  msg:{}", userId, text.toString());
         } catch (Exception e) {
             e.printStackTrace();

+ 60 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/service/impl/ReimburseExpressServiceImpl.java

@@ -1,10 +1,26 @@
 package cn.com.ctop.reimburse.mondule.service.impl;
 
+import cn.com.ctop.common.module.service.ISysUserService;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.ExportExcelUtils;
 import cn.com.ctop.reimburse.mondule.entity.ReimburseExpress;
 import cn.com.ctop.reimburse.mondule.mapper.ReimburseExpressMapper;
 import cn.com.ctop.reimburse.mondule.service.IReimburseExpressService;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.entity.SysUser;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * 报销申请——快递记录表
@@ -15,5 +31,49 @@ import org.springframework.stereotype.Service;
  */
 @Service
 public class ReimburseExpressServiceImpl extends ServiceImpl<ReimburseExpressMapper, ReimburseExpress> implements IReimburseExpressService {
+    @Autowired
+    private ISysUserService sysUserService;
 
+    @Override
+    public Result<Object> importExcel(MultipartFile file) throws Exception {
+        JSONObject returnJson = new JSONObject();
+        Workbook workbook = null;
+        String fileName = file.getOriginalFilename();
+        String substring = fileName.substring(fileName.lastIndexOf(".") + 1).toUpperCase();
+        if ("XLS".equals(substring)) {
+            workbook = new HSSFWorkbook(file.getInputStream());
+        } else if ("XLSX".equals(substring)) {
+            workbook = new XSSFWorkbook(file.getInputStream());
+        } else {
+            throw new Exception("文件不是Excel文件");
+        }
+        Sheet sheet = workbook.getSheetAt(0);
+        int rows = sheet.getLastRowNum();//行数,一共有多少行+
+        if (rows == 0) {
+            throw new Exception("请填写数据");
+        }
+        ExportExcelUtils eeu = new ExportExcelUtils();
+        //标题行
+        Row titleRow = sheet.getRow(0);
+        //最后一列
+        int lastCellNum = titleRow.getLastCellNum();
+        List<ReimburseExpress> list = new ArrayList<>();
+        for (int i = 1; i <= rows + 1; i++) {
+            Row row = sheet.getRow(i);
+            if (row != null) {
+                ReimburseExpress express = new ReimburseExpress();
+                express.setStatDate(eeu.getCellValue2(row.getCell(0)));
+                express.setExpressNumber(eeu.getCellValue2(row.getCell(1)));
+                express.setUserName(eeu.getCellValue2(row.getCell(2)));
+                SysUser user = sysUserService.getUserByRealName(express.getUserName());
+                if (!Check.isNull(user)) {
+                    express.setUserId(user.getId());
+                }
+                express.setRemarks(eeu.getCellValue2(row.getCell(3)));
+                list.add(express);
+            }
+        }
+        baseMapper.replaceBatch(list);
+        return Result.ok("数据导入成功 ");
+    }
 }

+ 3 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/reimburse/mondule/service/impl/ReimburseProjectServiceImpl.java

@@ -20,6 +20,9 @@ public class ReimburseProjectServiceImpl extends ServiceImpl<ReimburseProjectMap
 
     @Override
     public List<ReimburseProject> getByIds(List<String> ids) {
+        if (ids.isEmpty()) {
+            return null;
+        }
         return baseMapper.getByIds(ids);
     }
 }