xs 5 년 전
부모
커밋
e17c719e3e

+ 3 - 1
src/main/java/com/jeeplus/modules/sg/managementcenter/project/mapper/ProjectMapper.java

@@ -7,6 +7,7 @@ import com.jeeplus.core.persistence.BaseMapper;
 import com.jeeplus.core.persistence.annotation.MyBatisMapper;
 import com.jeeplus.modules.sg.managementcenter.project.entity.PickingRequisition;
 import com.jeeplus.modules.sg.managementcenter.project.entity.Project;
+import com.jeeplus.modules.sys.entity.User;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
@@ -37,5 +38,6 @@ public interface ProjectMapper extends BaseMapper<Project> {
 
     //查找项目信息
     List<Project> findListProjectRequisitions(@Param("list") List<PickingRequisition> list);
-
+    //查找所有用户
+    List<String> findAllUser();
 }

+ 8 - 0
src/main/java/com/jeeplus/modules/sg/managementcenter/project/mapper/xml/ProjectMapper.xml

@@ -582,4 +582,12 @@
 			</foreach>
 		</if>
 	</select>
+
+	<select id="findAllUser" resultType="java.lang.String">
+		<!-- 查询全部用户 -->
+		SELECT
+			a.login_name AS "loginName"
+		FROM sys_user a
+		WHERE a.del_flag = '0'
+	</select>
 </mapper>

+ 5 - 0
src/main/java/com/jeeplus/modules/sg/managementcenter/project/service/ProjectService.java

@@ -11,6 +11,7 @@ import com.jeeplus.modules.sg.managementcenter.project.entity.PickingRequisition
 import com.jeeplus.modules.sg.managementcenter.project.entity.Project;
 import com.jeeplus.modules.sg.managementcenter.project.entity.ProjectManager;
 import com.jeeplus.modules.sg.managementcenter.project.mapper.ProjectMapper;
+import com.jeeplus.modules.sys.entity.User;
 import io.swagger.models.auth.In;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -311,4 +312,8 @@ public class ProjectService extends CrudService<ProjectMapper, Project> {
 	public void getUpdateAcquisitionStatus(String acquisitionStatus,String id){
 		projectMapper.updateAcquisitionStatus(acquisitionStatus,id);
 	}
+	//查找所有用户信息
+	public List<String> findAllUser(){
+		return projectMapper.findAllUser();
+	}
 }

+ 76 - 4
src/main/java/com/jeeplus/modules/sg/managementcenter/project/util/ProExcelInfo.java

@@ -171,54 +171,115 @@ public  class ProExcelInfo {
     /*
         对值进行验证 配网工程专职验证
      */
-    public static String getJudgeValue(List<Project> projects){
+    public static String getJudgeValue(List<Project> projects,List<String> users){
         Boolean flag = false;
         String str = "";
+        boolean judgeLoginName = false;
         for (Project project:projects){
             if (null==project.getDistributionEngineering()||"".equals(project.getDistributionEngineering())){//配网工程专职角色
                 str+="配网工程专职角色不能为空;";
+            }else {
+                judgeLoginName = getJudgeLoginName(users, project.getDistributionEngineering());
+                if (judgeLoginName){
+                    str+="配网工程专职角色不存在;";
+                }
             }
             if (null==project.getDistributionMaterials()||"".equals(project.getDistributionMaterials())){//配网物资专职角色
                 str+="配网物资专职角色不能为空;";
+            }else {
+                judgeLoginName = getJudgeLoginName(users,project.getDistributionMaterials());
+                if (judgeLoginName){
+                    str+="配网物资专职角色不存在;";
+                }
             }
             if (null==project.getDistributionSystem()||"".equals(project.getDistributionSystem())){//配网系统专职角色
                 str+="配网系统专职角色不能为空;";
+            }else {
+               judgeLoginName = getJudgeLoginName(users, project.getDistributionSystem());
+                if (judgeLoginName){
+                    str+="配网系统专职角色不存在;";
+                }
             }
             if (null==project.getDistributionPolicy()||"".equals(project.getDistributionPolicy())){//配网政策处理专职角色
                 str+="配网政策处理专职角色不能为空;";
+            }else {
+                judgeLoginName = getJudgeLoginName(users, project.getDistributionPolicy());
+                if (judgeLoginName){
+                    str+="配网政策处理专职角色不存在;";
+                }
             }
             if (null==project.getManagementLeader()||"".equals(project.getManagementLeader())){//项目管理中心领导角色
                 str+="项目管理中心领导角色不能为空;";
+            }else {
+                judgeLoginName = getJudgeLoginName(users, project.getManagementLeader());
+                if (judgeLoginName){
+                    str+="项目管理中心领导角色不存在;";
+                }
             }
             if (null==project.getRunUnit()||"".equals(project.getRunUnit())){//运行单位
                 str+="运行单位不能为空;";
             }
             if (null==project.getRunUnitRole()||"".equals(project.getRunUnitRole())){//运行单位角色
                 str+="运行单位角色不能为空;";
+            }else {
+                judgeLoginName = getJudgeLoginName(users, project.getRunUnitRole());
+                if (judgeLoginName){
+                    str+="运行单位角色不存在;";
+                }
             }
             if (null==project.getThroughResearchRole()||"".equals(project.getThroughResearchRole())){//经研所角色
                 str+="经研所角色不能为空;";
+            }else {
+                judgeLoginName = getJudgeLoginName(users, project.getThroughResearchRole());
+                if (judgeLoginName){
+                    str+="经研所角色不存在;";
+                }
             }
             if (null==project.getConstructionUnit()||"".equals(project.getConstructionUnit())){//施工单位
                 str+="施工单位不能为空;";
             }
             if (null==project.getConstructionUnitRole()||"".equals(project.getConstructionUnitRole())){//施工单位:施工单位角色
                 str+="施工单位角色不能为空;";
+            }else {
+               judgeLoginName = getJudgeLoginName(users, project.getConstructionUnitRole());
+                if (judgeLoginName){
+                    str+="施工单位角色不存在;";
+                }
             }
             if (null==project.getConstructionUnitManage()||"".equals(project.getConstructionUnitManage())){//施工单位:施工单位角色
                 str+="施工单位项目经理不能为空;";
+            }else {
+                judgeLoginName = getJudgeLoginName(users, project.getConstructionUnitManage());
+                if (judgeLoginName){
+                    str+="施工单位项目经理不存在;";
+                }
             }
             if (null==project.getConstructionUnitLeader()||"".equals(project.getConstructionUnitLeader())){//施工单位:施工单位角色
                 str+="施工单位领导不能为空;";
+            }else {
+                judgeLoginName = getJudgeLoginName(users, project.getConstructionUnitLeader());
+                if (judgeLoginName){
+                    str+="施工单位领导不存在;";
+                }
             }
             if (null==project.getDesignUnit()||"".equals(project.getDesignUnit())){//设计单位
                 str+="设计单位不能为空;";
             }
             if (null==project.getDesignUnitManage()||"".equals(project.getDesignUnitManage())){//设计单位角色
                 str+="设计单位项目经理不能为空;";
+            }else {
+                judgeLoginName = getJudgeLoginName(users,project.getDesignUnitManage());
+                if (judgeLoginName){
+                    str+="设计单位项目经理不存在;";
+                }
             }
             if (null==project.getDesignUnitLeader()||"".equals(project.getDesignUnitLeader())){//设计单位
                 str+="设计单位领导不能为空;";
+            }else {
+                judgeLoginName = getJudgeLoginName(users, project.getDesignUnitLeader());
+                if (judgeLoginName){
+                    str+="设计单位领导不存在;";
+                }
             }
             if (null!=project.getType()){//类型
                 flag = getJudge(project.getType(), PRO_TYPE);
@@ -238,13 +299,24 @@ public  class ProExcelInfo {
                     str+="交底类型填写有误;";
                 }
             }
-        }
-        if (!"".equals(str)){
-            return str;
+            if (!"".equals(str)){
+                return str;
+            }
         }
         return str;
     }
 
+    //对登录人进行验证
+    public static boolean getJudgeLoginName(List<String> users,String string){
+        boolean flag = true;
+        for (String user:users){
+            if (string.equals(user)){
+                flag = false;
+                break;
+            }
+        }
+        return flag;
+    }
     /*
         对值进行验证:项目经理验证
     */

+ 12 - 8
src/main/java/com/jeeplus/modules/sg/managementcenter/project/web/ProjectController.java

@@ -189,7 +189,10 @@ public class ProjectController extends BaseController {
 		List<Project> projects = new ArrayList<Project>();
 		projects.add(project);
 		String loginName = UserUtils.getUser().getLoginName();
-		String judgeValue = ProExcelInfo.getJudgeValue(projects);
+		List<String> allUser = projectService.findAllUser();
+		String judgeValue1 = ProExcelInfo.getJudgeValue(projects,allUser);
+		String judgeValue2 = ProExcelInfo.getJudgeValueManager(projects);
+		String judgeValue = judgeValue1+judgeValue2;
 		if (project.getIsNewRecord()){
 			if (!"".equals(judgeValue)||!project.getProjectManageRole().equals(loginName)){
 				j.setSuccess(false);
@@ -326,7 +329,8 @@ public class ProjectController extends BaseController {
 			}
 			if (judgeRole.equals("0")){
 				List<Project> projects =ProExcelInfo.getSureProjects(ProExcelInfo.getProjectUtilDistribution(importUtil));
-				String judgeValue = ProExcelInfo.getJudgeValue(projects);
+				List<String> users = projectService.findAllUser();
+				String judgeValue = ProExcelInfo.getJudgeValue(projects,users);
 				if (!"".equals(judgeValue)){
 					j.setSuccess(false);
 					j.setMsg("导入失败:"+judgeValue+"数据不符合规范!");
@@ -383,10 +387,10 @@ public class ProjectController extends BaseController {
 	@ResponseBody
 	@RequiresPermissions("sg:managementcenter:project:importPicking")
 	@RequestMapping(value = "importPicking")
-	public AjaxJson importFileRequisition(@RequestParam("file")MultipartFile file, HttpServletResponse response, HttpServletRequest request) throws IOException, InvalidFormatException {
+	public AjaxJson importFileRequisition(@RequestParam("file")MultipartFile file, HttpServletResponse response, HttpServletRequest request) {
 		AjaxJson j = new AjaxJson();
 		String str = "";//提示
-//		try {
+		try {
 			ImportUtil importUtil = new ImportUtil(file, 0, 0);
 			//读取表格list
 			List<PickingRequisition> listPickRequisition = PickingInfo.getListPickRequisition(importUtil);
@@ -527,10 +531,10 @@ public class ProjectController extends BaseController {
 				}
 			}
 			j.setMsg( "已成功导入 "+sureSavePicking.size()+" 条领料表单记录."+str);
-//		} catch (Exception e) {
-//			j.setSuccess(false);
-//			j.setMsg("导入领料表单失败!失败信息:"+e.getMessage());
-//		}
+		} catch (Exception e) {
+			j.setSuccess(false);
+			j.setMsg("导入领料表单失败!失败信息:"+e.getMessage());
+		}
 		return j;
 	}
 }