liuyc 2 gadi atpakaļ
vecāks
revīzija
a48af50880

+ 6 - 0
blade-service-api/blade-control-api/src/main/java/org/springblade/control/vo/EMPayInfoVO.java

@@ -16,4 +16,10 @@ public class EMPayInfoVO extends EMPayInfo {
     @ApiModelProperty(value = "审批结果")
     private String approvalResultName;
 
+    @ApiModelProperty(value = "关联项目名称")
+    private String projectName;
+
+    @ApiModelProperty(value = "申请人名称")
+    private String afUserName;
+
 }

+ 12 - 0
blade-service/blade-control/src/main/java/org/springblade/control/controller/DictInfoController.java

@@ -22,10 +22,12 @@ import lombok.AllArgsConstructor;
 
 import javax.validation.Valid;
 
+import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
+import org.springblade.core.tool.utils.ObjectUtil;
 import org.springblade.system.entity.DictBiz;
 import org.springblade.system.vo.DictBizVO;
 import org.springframework.web.bind.annotation.*;
@@ -61,6 +63,12 @@ public class DictInfoController extends BladeController {
     @ApiOperationSupport(order = 1)
     @ApiOperation(value = "新增或修改", notes = "传入dictInfo")
     public R submit(@Valid @RequestBody DictInfo dictInfo) {
+        if (ObjectUtil.isNotEmpty(dictInfo.getId())) {
+            DictInfo dictInfo1 = dictInfoService.getBaseMapper().selectById(dictInfo.getId());
+            if (dictInfo1 != null && dictInfo1.getType().equals(6)) {
+                throw new ServiceException("没有权限,请联系管理员");
+            }
+        }
         return R.status(dictInfoService.saveOrUpdate(dictInfo));
     }
 
@@ -72,6 +80,10 @@ public class DictInfoController extends BladeController {
     @ApiOperationSupport(order = 2)
     @ApiOperation(value = "逻辑删除", notes = "传入ids")
     public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+        DictInfo dictInfo1 = dictInfoService.getBaseMapper().selectById(ids);
+        if (dictInfo1 != null && dictInfo1.getType().equals(6)) {
+            throw new ServiceException("没有权限,请联系管理员");
+        }
         return R.status(dictInfoService.removeBatchByIds(Func.toLongList(ids)));
     }
 

+ 89 - 11
blade-service/blade-control/src/main/java/org/springblade/control/service/impl/TaskProcessServiceImpl.java

@@ -152,13 +152,12 @@ public class TaskProcessServiceImpl extends BaseServiceImpl<TaskProcessMapper, T
         if (taskProcessInfo != null) {
             //构造基础信息
             Map<Long, String> userMap = iUserClient.selectUserAll().stream().filter(f -> ObjectUtil.isNotEmpty(f.getRealName())).collect(Collectors.toMap(User::getId, User::getRealName));
-            List<DictInfo> dictInfoList1 = jdbcTemplate.query("select dict_name,dict_value from c_dict_info where code = 'report_type'", new BeanPropertyRowMapper<>(DictInfo.class));
-            List<DictInfo> dictInfoList2 = jdbcTemplate.query("select dict_name,dict_value from c_dict_info where code = 'expense_fr_type'", new BeanPropertyRowMapper<>(DictInfo.class));
+            List<DictInfo> dictInfoListBasics = jdbcTemplate.query("select dict_name,dict_value from c_dict_info where code = 'report_type'", new BeanPropertyRowMapper<>(DictInfo.class));
             List<ControlProjectInfo> controlProjectInfos = projectInfoServiceImpl.getBaseMapper().selectList(Wrappers.<ControlProjectInfo>lambdaQuery().select(ControlProjectInfo::getId, ControlProjectInfo::getName));
             TaskProcessDetailBasicsVO basicsVO = new TaskProcessDetailBasicsVO();
             basicsVO.setTaskId(taskProcessInfo.getId());
             basicsVO.setTaskName(taskProcessInfo.getTaskName());
-            for (DictInfo dictInfo : dictInfoList1) {
+            for (DictInfo dictInfo : dictInfoListBasics) {
                 if ((taskProcessInfo.getTaskType()).equals(dictInfo.getDictValue().intValue())) {
                     basicsVO.setReportTypeName(dictInfo.getDictName());
                     break;
@@ -191,8 +190,8 @@ public class TaskProcessServiceImpl extends BaseServiceImpl<TaskProcessMapper, T
                                     voRW.setTransferObjectName(userMap.get(voRW.getTransferObject()));
                                     data = voRW;
                                 }
-
                                 break;
+
                             case 2: //财务
                                 data = jdbcTemplate.query("select * from c_expense_financial_reimbursement_info where id = " + record.getExpenseInfoId(), new BeanPropertyRowMapper<>(EMFinancialReimbursementInfo.class)).stream().findAny().orElse(null);
                                 EMFinancialReimbursementInfoVO voCW = BeanUtil.copyProperties(data, EMFinancialReimbursementInfoVO.class);
@@ -203,8 +202,9 @@ public class TaskProcessServiceImpl extends BaseServiceImpl<TaskProcessMapper, T
                                             vo.setPlanTaskInfoList(Collections.singletonList(planTaskInfoList2));
                                         }
                                     }
-                                    for (DictInfo dictInfo : dictInfoList2) {
-                                        if (dictInfo.getDictValue().equals(voCW.getFrType())) {
+                                    List<DictInfo> dictInfoListCW = jdbcTemplate.query("select dict_name,dict_value from c_dict_info where code = 'expense_fr_type'", new BeanPropertyRowMapper<>(DictInfo.class));
+                                    for (DictInfo dictInfo : dictInfoListCW) {
+                                        if (voCW.getFrType().equals(dictInfo.getDictValue().intValue())) {
                                             voCW.setFrTypeName(dictInfo.getDictName());
                                             break;
                                         }
@@ -227,37 +227,114 @@ public class TaskProcessServiceImpl extends BaseServiceImpl<TaskProcessMapper, T
 
                             case 3: //支付
                                 data = jdbcTemplate.query("select * from c_expense_pay_info where id = " + record.getExpenseInfoId(), new BeanPropertyRowMapper<>(EMPayInfo.class)).stream().findAny().orElse(null);
+                                EMPayInfoVO voZF = BeanUtil.copyProperties(data, EMPayInfoVO.class);
+                                if (voZF != null) {
+                                    ControlProjectInfo projectInfo = jdbcTemplate.query("select name from c_control_project_info where id = " + voZF.getProjectId(), new BeanPropertyRowMapper<>(ControlProjectInfo.class)).stream().findAny().orElse(null);
+                                    if (projectInfo != null) {
+                                        voZF.setProjectName(projectInfo.getName());
+                                    }
+                                    voZF.setAfUserName(userMap.get(voZF.getAfUserId()));
+
+                                    data = voZF;
+                                }
                                 break;
+
                             case 4: //借款
                                 data = jdbcTemplate.query("select * from c_expense_loan_info where id = " + record.getExpenseInfoId(), new BeanPropertyRowMapper<>(EMLoanInfo.class)).stream().findAny().orElse(null);
                                 break;
+
                             case 5: //采购
                                 data = jdbcTemplate.query("select * from c_expense_purchase_info where id = " + record.getExpenseInfoId(), new BeanPropertyRowMapper<>(EMPurchaseInfo.class)).stream().findAny().orElse(null);
+                                EMPurchaseInfoVO voCG = BeanUtil.copyProperties(data, EMPurchaseInfoVO.class);
+                                if (voCG != null) {
+                                    List<DictInfo> dictInfoListCG = jdbcTemplate.query("select dict_name,dict_value from c_dict_info where code = 'purchase_type'", new BeanPropertyRowMapper<>(DictInfo.class));
+                                    for (DictInfo dictInfo : dictInfoListCG) {
+                                        if (voCG.getPurType().equals(dictInfo.getDictValue().intValue())) {
+                                            voCG.setPurTypeName(dictInfo.getDictName());
+                                            break;
+                                        }
+                                    }
+                                    data = voCG;
+                                }
                                 break;
+
                             case 6: //用车
                                 data = jdbcTemplate.query("select * from c_expense_use_car_info where id = " + record.getExpenseInfoId(), new BeanPropertyRowMapper<>(EMUseCarInfo.class)).stream().findAny().orElse(null);
                                 break;
+
                             case 7: //发票
                                 data = jdbcTemplate.query("select * from c_expense_invoice_info where id = " + record.getExpenseInfoId(), new BeanPropertyRowMapper<>(EMInvoiceInfo.class)).stream().findAny().orElse(null);
+                                EMInvoiceInfoVO voFP = BeanUtil.copyProperties(data, EMInvoiceInfoVO.class);
+                                if (voFP != null) {
+                                    ControlProjectInfo projectInfo = jdbcTemplate.query("select name from c_control_project_info where id = " + voFP.getProjectId(), new BeanPropertyRowMapper<>(ControlProjectInfo.class)).stream().findAny().orElse(null);
+                                    if (projectInfo != null) {
+                                        voFP.setProjectName(projectInfo.getName());
+                                    }
+                                    List<DictInfo> dictInfoListFP = jdbcTemplate.query("select dict_name,dict_value from c_dict_info where code = 'invoice_type'", new BeanPropertyRowMapper<>(DictInfo.class));
+                                    for (DictInfo dictInfo : dictInfoListFP) {
+                                        if (voFP.getInvoiceType().equals(dictInfo.getDictValue().intValue())) {
+                                            voFP.setInvoiceTypeName(dictInfo.getDictName());
+                                            break;
+                                        }
+                                    }
+                                    voFP.setInvoiceUserName(userMap.get(voFP.getInvoiceUserId()));
+                                    //TODO 发票抬头等信息
 
+                                    data = voFP;
+                                }
                                 break;
+
                             case 8: //外包
                                 data = jdbcTemplate.query("select * from c_expense_outsourcing_pay_info where id = " + record.getExpenseInfoId(), new BeanPropertyRowMapper<>(EMOutsourcingPayInfo.class)).stream().findAny().orElse(null);
+                                EMOutsourcingPayInfoVO voWB = BeanUtil.copyProperties(data, EMOutsourcingPayInfoVO.class);
+                                if (voWB != null) {
+                                    ControlProjectInfo projectInfo = jdbcTemplate.query("select name from c_control_project_info where id = " + voWB.getProjectId(), new BeanPropertyRowMapper<>(ControlProjectInfo.class)).stream().findAny().orElse(null);
+                                    if (projectInfo != null) {
+                                        voWB.setProjectName(projectInfo.getName());
+                                    }
+                                    List<DictInfo> dictInfoListWB = jdbcTemplate.query("select dict_name,dict_value from c_dict_info where code = 'outsourcing_type'", new BeanPropertyRowMapper<>(DictInfo.class));
+                                    for (DictInfo dictInfo : dictInfoListWB) {
+                                        if (voWB.getOutsourcingType().equals(dictInfo.getDictValue().intValue())) {
+                                            voWB.setOutsourcingTypeName(dictInfo.getDictName());
+                                            break;
+                                        }
+                                    }
+                                    data = voWB;
+                                }
                                 break;
+
                             case 9: //出差
                                 data = jdbcTemplate.query("select * from c_attendance_trip_info where id = " + record.getExpenseInfoId(), new BeanPropertyRowMapper<>(AttendanceTripInfo.class)).stream().findAny().orElse(null);
-
                                 AttendanceTripInfoVO voCC = BeanUtil.copyProperties(data, AttendanceTripInfoVO.class);
                                 if (voCC != null) {
-                                    if (ObjectUtil.isNotEmpty(voCC.getProjectId()) && ObjectUtil.isNotEmpty(voCC.getBudgetPlanIds())) { //如果预算ids不为空,那么证明有关联计划任务(单关联)
-                                        TaskPlanInfoVO planTaskInfoList2 = this.getPlanTaskInfoList(voCC.getBudgetPlanIds(), controlProjectInfos);
-                                        if (planTaskInfoList2 != null) {
-                                            vo.setPlanTaskInfoList(Collections.singletonList(planTaskInfoList2));
+                                    if (ObjectUtil.isNotEmpty(voCC.getProjectId())) {
+                                        ControlProjectInfo projectInfo = jdbcTemplate.query("select name from c_control_project_info where id = " + voCC.getProjectId(), new BeanPropertyRowMapper<>(ControlProjectInfo.class)).stream().findAny().orElse(null);
+                                        if (projectInfo != null) {
+                                            voCC.setProjectName(projectInfo.getName());
+                                        }
+                                        if (ObjectUtil.isNotEmpty(voCC.getBudgetPlanIds())) { //如果预算ids不为空,那么证明有关联计划任务(单关联)
+                                            TaskPlanInfoVO planTaskInfoList2 = this.getPlanTaskInfoList(voCC.getBudgetPlanIds(), controlProjectInfos);
+                                            if (planTaskInfoList2 != null) {
+                                                vo.setPlanTaskInfoList(Collections.singletonList(planTaskInfoList2));
+                                            }
+                                        }
+                                    }
+
+                                    if (ObjectUtil.isNotEmpty(voCC.getFellowTravelerUserIds())) {
+                                        List<String> userIds = Func.toStrList(voCC.getFellowTravelerUserIds());
+                                        List<String> names = new ArrayList<>();
+                                        for (String userId : userIds) {
+                                            String name = userMap.getOrDefault(Long.parseLong(userId), null);
+                                            if (name != null) {
+                                                names.add(name);
+                                            }
                                         }
+                                        voCC.setFellowTravelerUserNames(StringUtils.join(names, "、"));
                                     }
                                     data = voCC;
                                 }
                                 break;
+
                             case 10: //成本测算
                                 List<ProjectCostBudget> query = jdbcTemplate.query("select project_id from c_project_cost_budget where id in(" + record.getExpenseInfoId() + ")", new BeanPropertyRowMapper<>(ProjectCostBudget.class));
                                 if (query.size() > 0) {
@@ -270,6 +347,7 @@ public class TaskProcessServiceImpl extends BaseServiceImpl<TaskProcessMapper, T
                                     }
                                 }
                                 break;
+
                         }
                     }
                 }