Ver código fonte

代码优化

hlf 1 ano atrás
pai
commit
e397e67480

+ 109 - 12
ims-service/ims-eval/src/main/java/com/ims/eval/controller/DepartmentAllocationController.java

@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ims.common.utils.StringUtils;
 import com.ims.eval.config.CustomException;
 import com.ims.eval.entity.EvaluationDept;
+import com.ims.eval.entity.dto.request.DeptDTO;
 import com.ims.eval.entity.dto.request.UserDTO;
 import com.ims.eval.entity.dto.result.R;
 import com.ims.eval.service.IEvaluationDeptService;
@@ -18,8 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
-import java.util.Arrays;
-import java.util.List;
+import java.util.*;
 
 /**
  * 考评部门配置
@@ -93,16 +93,18 @@ public class DepartmentAllocationController {
 	@PostMapping(value = "/save")
 	public R addAll(@RequestBody EvaluationDept evaluationDept) {
 		try {
-			QueryWrapper<EvaluationDept> qw = new QueryWrapper<>();
-			if (StringUtils.isNotEmpty(evaluationDept.getParentId())) {
-				qw.lambda().eq(EvaluationDept::getParentId, evaluationDept.getParentId());
-			}
-			if (StringUtils.isNotEmpty(evaluationDept.getDeptId())) {
-				qw.lambda().eq(EvaluationDept::getDeptId, evaluationDept.getDeptId());
-			}
-			EvaluationDept obj = evaluationDeptService.getOne(qw);
-			if (obj != null) {
-				return R.error("部门重复,请重新添加!");
+			if (StringUtils.isEmpty(evaluationDept.getId())) {
+				QueryWrapper<EvaluationDept> qw = new QueryWrapper<>();
+				if (StringUtils.isNotEmpty(evaluationDept.getParentId())) {
+					qw.lambda().eq(EvaluationDept::getParentId, evaluationDept.getParentId());
+				}
+				if (StringUtils.isNotEmpty(evaluationDept.getDeptId())) {
+					qw.lambda().eq(EvaluationDept::getDeptId, evaluationDept.getDeptId());
+				}
+				EvaluationDept obj = evaluationDeptService.getOne(qw);
+				if (obj != null) {
+					return R.error("部门重复,请重新添加!");
+				}
 			}
 			boolean b = evaluationDeptService.saveOrUpdate(evaluationDept);
 			if (b) {
@@ -150,4 +152,99 @@ public class DepartmentAllocationController {
 		}
 	}
 
+	/**
+	 * 人员假数据
+	 *
+	 * @return 结果
+	 */
+	@GetMapping(value = "/getUser")
+	public R getUser() {
+		List<UserDTO> userList = new ArrayList<>();
+		Map<String, String> map = new HashMap<>();
+		map.put("bffe73e031d44e00a8c8506e317aa41f", "孙志廷");
+		map.put("48063c851236d1347900e6e9667ac0d6", "云天宝");
+		map.put("df2c3798f5b14994aac7eb3410cf1c69", "孙严冬");
+		map.put("06a45127a25f49e798d13233f881b382", "李宝岩");
+		map.put("53c5bb07e6834d928aea5f9d2f57aa7f", "任晓霞");
+		map.put("972f3f68fac44c9b95c2e479bb3de815", "李金柱");
+		map.put("b4ee5ccdec1941f889176e3d913b1994", "刘全");
+		map.put("5014b41d06dd4b428348cbfcdf36c160", "宫广正");
+		map.put("8cfbb27966264920b24635f95ca6b0a7", "孙纳新");
+		map.put("f9305976eaab4edca55538238914b07c", "刘景春");
+		map.put("34c57c2ad8184e9795b2a77501e97671", "车晔");
+		map.put("5b7c61a5556742baa9018d17ee5f42c2", "杨建国");
+		map.put("9ea19aa48cc1483b9efcf3210e50de4f", "陈宏");
+		map.put("5eca483c13c94639bdfae0754c314164", "王颖聪");
+		map.put("aa300762de524c27b9ca3439b76c9e26", "朱传兴");
+		for (Map.Entry<String, String> entry : map.entrySet()) {
+			UserDTO user = new UserDTO();
+			user.setId(entry.getKey());
+			user.setName(entry.getValue());
+			userList.add(user);
+		}
+		return R.ok().data(userList);
+	}
+
+	/**
+	 * 部门假数据
+	 *
+	 * @return 结果
+	 */
+	@GetMapping(value = "/getDept")
+	public R getDept() {
+		List<DeptDTO> deptList = new ArrayList<>();
+		Map<String, String> map = new HashMap<>();
+		map.put("23031004", "综合管理部(党委办公室)");
+		map.put("23031015", "纪委办公室(党委巡察办)");
+		map.put("23031006", "计划发展部");
+		map.put("23031007", "市场营销部");
+		map.put("23031008", "资本运营部(董事会办公室)");
+		map.put("23031010", "财务部");
+		map.put("23031005", "企业管理与法律事务部");
+		map.put("23031023", "安全环保监察部");
+		map.put("23031014", "生产调运部(调度中心)");
+		map.put("23032496", "科技信息部");
+		map.put("23031016", "审计部");
+		map.put("23031018", "工会工作部");
+		map.put("23031019", "采购与物资管理部");
+		map.put("23031020", "国际业务部");
+		map.put("23031022", "工程建设部");
+		for (Map.Entry<String, String> entry : map.entrySet()) {
+			DeptDTO dept = new DeptDTO();
+			dept.setId(entry.getKey());
+			dept.setName(entry.getValue());
+			deptList.add(dept);
+		}
+		return R.ok().data(deptList);
+	}
+
+	/**
+	 * 子部门假数据
+	 *
+	 * @return 结果
+	 */
+	@GetMapping(value = "/getSubdepartment/{id}")
+	public R getSubdepartment(@PathVariable String id) {
+		List<DeptDTO> deptList = new ArrayList<>();
+		Map<String, String> map = new HashMap<>();
+		if ("23031004".equals(id)) {
+			map.put("11111111", "子部门1");
+			map.put("22222222", "子部门2");
+			map.put("33333333", "子部门3");
+			map.put("44444444", "子部门4");
+		}
+		if ("23031015".equals(id)) {
+			map.put("55555555", "子部门1");
+			map.put("66666666", "子部门2");
+			map.put("77777777", "子部门3");
+			map.put("88888888", "子部门4");
+		}
+		for (Map.Entry<String, String> entry : map.entrySet()) {
+			DeptDTO dept = new DeptDTO();
+			dept.setId(entry.getKey());
+			dept.setName(entry.getValue());
+			deptList.add(dept);
+		}
+		return R.ok().data(deptList);
+	}
 }

+ 1 - 1
ims-service/ims-eval/src/main/java/com/ims/eval/controller/DeptAssessmentDeclarationController.java

@@ -315,7 +315,7 @@ public class DeptAssessmentDeclarationController {
 					}
 				}
 				String msg = "导入成功,本次新增" + successCount + "条,更新" + renewalCount + "条,失败" + loseCount + "条数据。";
-				return R.ok().data(msg);
+				return R.ok().message(msg);
 			} catch (Exception e) {
 				log.error("错误", e);
 				return R.customError(e.getMessage()).data("失败!");

+ 6 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/entity/dto/request/DeptDTO.java

@@ -22,4 +22,10 @@ public class DeptDTO {
 
 	//生成报表word数据
 	private EvaluationDeptBusinessContent evaluationDeptBusinessContent;
+
+	//临时字段
+	private String id;
+
+	//临时字段
+	private String name;
 }

+ 1 - 1
ims-service/ims-eval/src/main/resources/mappers/DeptAssessmentDeclarationMapper.xml

@@ -75,7 +75,7 @@
                 AND dad.declaration_month = #{declarationMonth}
             </if>
         </where>
-        order by ed.serial_number asc
+        order by ed.serial_number asc, dad.declaration_month desc
     </select>
 
 </mapper>