zouxuan %!s(int64=3) %!d(string=hai) anos
pai
achega
0caf4651df

+ 12 - 28
mec-biz/src/main/java/com/ym/mec/biz/service/impl/FinancialExpenditureServiceImpl.java

@@ -2,10 +2,7 @@ package com.ym.mec.biz.service.impl;
 
 
 import com.alibaba.fastjson.JSONObject;
-import com.ym.mec.biz.dal.dao.CooperationOrganDao;
-import com.ym.mec.biz.dal.dao.EmployeeDao;
-import com.ym.mec.biz.dal.dao.FinancialExpenditureDao;
-import com.ym.mec.biz.dal.dao.OrganizationDao;
+import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.entity.Employee;
 import com.ym.mec.biz.dal.entity.FinancialExpenditure;
@@ -65,7 +62,7 @@ public class FinancialExpenditureServiceImpl extends BaseServiceImpl<Long, Finan
     @Autowired
     private MusicGroupService musicGroupService;
     @Autowired
-    private CooperationOrganDao cooperationOrganDao;
+    private TeacherDao teacherDao;
     @Autowired
     private FinancialExpenditureService financialExpenditureService;
 
@@ -235,6 +232,13 @@ public class FinancialExpenditureServiceImpl extends BaseServiceImpl<Long, Finan
             if(hasFinancial != null){
                 return;
             }
+            String realName = "";
+            if(pWorkOrderInfo.getCreator() != null){
+                SimpleUserDto simpleUser = teacherDao.getSimpleUser(pWorkOrderInfo.getCreator());
+                if(Objects.nonNull(simpleUser)){
+                    realName = simpleUser.getRealName();
+                }
+            }
             String formStructure = financialExpenditureDao.getFormStructure(workOrderId);
             JSONObject formData = JSONObject.parseObject(financialExpenditureDao.getFormData(workOrderId));
             OaFormStructureDto oaFormStructureDto = JSONObject.parseObject(formStructure, OaFormStructureDto.class);
@@ -257,24 +261,12 @@ public class FinancialExpenditureServiceImpl extends BaseServiceImpl<Long, Finan
                         FinancialExpenditure financialExpenditure = new FinancialExpenditure();
                         financialExpenditure.setBatchNo(pWorkOrderInfo.getId().toString());
                         financialExpenditure.setFinancialProcessNo(pWorkOrderInfo.getId().toString());
+                        financialExpenditure.setApplyUser(realName);
                         List<OaColumnDto> columns = oaInputDto.getColumns();
                         if(columns != null && columns.size() > 0){
                             for (OaColumnDto column : columns) {
                                 List<OaInputDto> columnList = column.getList();
                                 if(columnList != null && columnList.size() > 0){
-                                    Employee employee = employeeDao.get(pWorkOrderInfo.getCreator());
-                                    List<SimpleUserDto> byIds = new ArrayList<>();
-                                    if(employee != null){
-                                        List<Integer> userIds = new ArrayList<>();
-                                        userIds.add(employee.getUserId());
-                                        byIds = employeeDao.findByIds(userIds);
-                                    }
-                                    if(employee != null){
-                                        if(byIds != null && byIds.size() > 0){
-                                            SimpleUserDto simpleUserDto = byIds.get(0);
-                                            financialExpenditure.setApplyUser(simpleUserDto.getUserName());
-                                        }
-                                    }
                                     for (OaInputDto inputDto : columnList) {
                                         String name = inputDto.getName();
                                         if(name.contains("课程组编号")){
@@ -415,6 +407,7 @@ public class FinancialExpenditureServiceImpl extends BaseServiceImpl<Long, Finan
                     }
                     if(CollectionUtils.isNotEmpty(financialExpenditures)){
                         for (FinancialExpenditure financialExpenditure : financialExpenditures) {
+                            financialExpenditure.setApplyUser(realName);
                             financialExpenditure.setType(ExpenditureTypeEnum.REFUND);
                             financialExpenditure.setFeeProject(FeeProjectEnum.REFUND);
                             financialExpenditure.setBatchNo(pWorkOrderInfo.getId().toString());
@@ -431,22 +424,13 @@ public class FinancialExpenditureServiceImpl extends BaseServiceImpl<Long, Finan
                 FinancialExpenditure financialExpenditure = new FinancialExpenditure();
                 financialExpenditure.setBatchNo(workOrderId.toString());
                 financialExpenditure.setFinancialProcessNo(workOrderId.toString());
-                Employee employee = employeeDao.get(pWorkOrderInfo.getCreator());
+                financialExpenditure.setApplyUser(realName);
                 Integer organId = financialExpenditureDao.getDeptId(pWorkOrderInfo.getDeptId());
                 Organization organization = organizationDao.get(organId);
                 if(organization != null){
                     financialExpenditure.setOrganId(organization.getId());
                     financialExpenditure.setOrganName(organization.getName());
                 }
-                if(employee != null){
-                    List<Integer> userIds = new ArrayList<>();
-                    userIds.add(employee.getUserId());
-                    List<SimpleUserDto> byIds = employeeDao.findByIds(userIds);
-                    if(byIds != null && byIds.size() > 0){
-                        SimpleUserDto simpleUserDto = byIds.get(0);
-                        financialExpenditure.setApplyUser(simpleUserDto.getUserName());
-                    }
-                }
                 for (OaInputDto oaInputDto : oaInputDtos) {
                     String name = oaInputDto.getName();
                     if(name.contains("金额")){