浏览代码

财务报销 功能优化

zhaoxian 3 年之前
父节点
当前提交
1fcfd064a3

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

@@ -20,9 +20,9 @@ public interface IReimburseApplyService extends IService<ReimburseApply> {
 
     List<JSONObject> queryList(ReimburseApply reimburseApply);
 
-    Result<Object> add(JSONObject data);
+    Result<Object> add(JSONObject data) throws Exception;
 
-    Result<Object> edit(JSONObject data);
+    Result<Object> edit(JSONObject data) throws Exception;
 
     Result<Object> submitReview(String id);
 

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

@@ -11,7 +11,6 @@ import cn.com.ctop.reimburse.mondule.mapper.ReimburseApplyMapper;
 import cn.com.ctop.reimburse.mondule.service.IReimburseApplyService;
 import cn.com.ctop.reimburse.mondule.service.IReimburseProjectService;
 import cn.hutool.core.util.RandomUtil;
-import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -68,7 +67,7 @@ public class ReimburseApplyServiceImpl extends ServiceImpl<ReimburseApplyMapper,
     }
 
     @Override
-    public Result<Object> add(JSONObject data) {
+    public Result<Object> add(JSONObject data) throws Exception {
         ReimburseApply apply = JSONObject.parseObject(data.toJSONString(), ReimburseApply.class);
         List<String> ids = JSONObject.parseArray(data.getJSONArray("ids").toJSONString(), String.class);
         List<ReimburseProject> projects = projectService.getByIds(ids);
@@ -109,7 +108,7 @@ public class ReimburseApplyServiceImpl extends ServiceImpl<ReimburseApplyMapper,
     }
 
     @Override
-    public Result<Object> edit(JSONObject data) {
+    public Result<Object> edit(JSONObject data) throws Exception {
         String sender = null;
         String msg = null;
         String type = "1";
@@ -220,8 +219,11 @@ public class ReimburseApplyServiceImpl extends ServiceImpl<ReimburseApplyMapper,
     }
 
     // 获取审核人ID
-    private String getLeader(String userId) {
+    private String getLeader(String userId) throws Exception {
         JSONObject company = userCompanyService.getCompanyInfoByUserId(userId);
+        if (Check.isNull(company)) {
+            throw new Exception("用户ID:" + userId + ",未查询到所属公司");
+        }
         String companyId = company.getString("companyId");
         if ("6608ed13c0dd42de93c790dbdf124234".equals(companyId)) {
             //广州汇创思拓数字科技有限公司(华南) 直接返回 何田田
@@ -251,7 +253,7 @@ public class ReimburseApplyServiceImpl extends ServiceImpl<ReimburseApplyMapper,
             String orgCode = departs.get(0).getOrgCode();
             JSONObject object = sysDepartService.queryAllParentIdByOrgCode(orgCode);
             JSONObject map = object.getJSONObject(orgCode).getJSONObject("parentMap");
-            JSONObject leader = null;
+            JSONObject leader = new JSONObject();
             //查询审核人员信息
             List<JSONObject> list = baseMapper.selectLeaders(companyId);
             for (JSONObject obj : list) {