|
@@ -14,9 +14,11 @@ import com.ims.common.utils.StringUtils;
|
|
|
import com.ims.eval.dao.DeptAssessmentDeclarationMapper;
|
|
|
import com.ims.eval.entity.DeptAssessmentDeclaration;
|
|
|
import com.ims.eval.entity.DeptAssessmentDeclarationContent;
|
|
|
+import com.ims.eval.entity.EvaluationDept;
|
|
|
import com.ims.eval.entity.dto.request.UserDTO;
|
|
|
import com.ims.eval.service.IDeptAssessmentDeclarationContentService;
|
|
|
import com.ims.eval.service.IDeptAssessmentDeclarationService;
|
|
|
+import com.ims.eval.service.IEvaluationDeptService;
|
|
|
import com.ims.eval.service.IUserService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -39,6 +41,9 @@ public class DeptAssessmentDeclarationServiceImpl extends ServiceImpl<DeptAssess
|
|
|
@Autowired
|
|
|
private IUserService userService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IEvaluationDeptService evaluationDeptService;
|
|
|
+
|
|
|
@Override
|
|
|
public IPage<DeptAssessmentDeclaration> listPage(Integer pageNum, Integer pageSize, String orderNumber, String deptId, String annual, String declarationMonth) {
|
|
|
if (null == pageNum || null == pageSize) {
|
|
@@ -66,20 +71,60 @@ public class DeptAssessmentDeclarationServiceImpl extends ServiceImpl<DeptAssess
|
|
|
deptAssessmentDeclaration.setStage("流程未启动");
|
|
|
deptAssessmentDeclaration.setCreateTime(DateUtil.date());
|
|
|
List<DeptAssessmentDeclarationContent> deptAssessmentDeclarationContentList = new ArrayList<>();
|
|
|
- JSONObject jsonArr = userService.pageList(1, 500, deptAssessmentDeclaration.getDeptId(), "", "", "", "", "", request);
|
|
|
- JSONObject jsonArr1 = (JSONObject) jsonArr.get("data");
|
|
|
- JSONArray array = JSONUtil.parseArray(jsonArr1.get("records"));
|
|
|
- List<UserDTO> userList = JSONUtil.toList(array, UserDTO.class);
|
|
|
- for (int i = 0; i < userList.size(); i++) {
|
|
|
- if (StringUtils.isNotEmpty(userList.get(i).getNo())) {
|
|
|
- DeptAssessmentDeclarationContent deptAssessmentDeclarationContent = new DeptAssessmentDeclarationContent();
|
|
|
- deptAssessmentDeclarationContent.setAssessmentDeclarationId(id);
|
|
|
- deptAssessmentDeclarationContent.setSerialNumber(i + 1);
|
|
|
- deptAssessmentDeclarationContent.setEmployeeId(userList.get(i).getId());
|
|
|
- deptAssessmentDeclarationContent.setEmployeeNo(userList.get(i).getNo());
|
|
|
- deptAssessmentDeclarationContent.setEmployeeName(userList.get(i).getName());
|
|
|
- deptAssessmentDeclarationContent.setSuggestedValue("1");
|
|
|
- deptAssessmentDeclarationContentList.add(deptAssessmentDeclarationContent);
|
|
|
+ QueryWrapper<EvaluationDept> deptQw = new QueryWrapper<>();
|
|
|
+ if (StringUtils.isNotEmpty(deptAssessmentDeclaration.getDeptId())) {
|
|
|
+ deptQw.lambda().eq(EvaluationDept::getDeptId, deptAssessmentDeclaration.getDeptId());
|
|
|
+ }
|
|
|
+ EvaluationDept evaluationDept = evaluationDeptService.getOne(deptQw);
|
|
|
+ if (null != evaluationDept) {
|
|
|
+ if ("".equals(evaluationDept.getParentId()) || null == evaluationDept.getParentId()) {//父级部门为空 表示当前为父级
|
|
|
+ List<UserDTO> secondaryList = new ArrayList<>();
|
|
|
+ QueryWrapper<EvaluationDept> secondaryDeptQw = new QueryWrapper<>();
|
|
|
+ if (StringUtils.isNotEmpty(evaluationDept.getDeptId())) {
|
|
|
+ secondaryDeptQw.lambda().eq(EvaluationDept::getParentId, evaluationDept.getDeptId());
|
|
|
+ }
|
|
|
+ List<EvaluationDept> evaluationDeptList = evaluationDeptService.list(secondaryDeptQw);
|
|
|
+ for (EvaluationDept obj : evaluationDeptList) {
|
|
|
+ JSONObject jsonArr = userService.pageList(1, 1000, obj.getDeptId(), "", "", "", "", "", request);
|
|
|
+ JSONObject jsonArr1 = (JSONObject) jsonArr.get("data");
|
|
|
+ JSONArray array = JSONUtil.parseArray(jsonArr1.get("records"));
|
|
|
+ List<UserDTO> userList = JSONUtil.toList(array, UserDTO.class);
|
|
|
+ secondaryList.addAll(userList);
|
|
|
+ }
|
|
|
+ JSONObject jsonArr = userService.pageList(1, 1000, deptAssessmentDeclaration.getDeptId(), "", "", "", "", "", request);
|
|
|
+ JSONObject jsonArr1 = (JSONObject) jsonArr.get("data");
|
|
|
+ JSONArray array = JSONUtil.parseArray(jsonArr1.get("records"));
|
|
|
+ List<UserDTO> userList = JSONUtil.toList(array, UserDTO.class);
|
|
|
+ userList.removeAll(secondaryList);
|
|
|
+ for (int i = 0; i < userList.size(); i++) {
|
|
|
+ if (StringUtils.isNotEmpty(userList.get(i).getNo())) {
|
|
|
+ DeptAssessmentDeclarationContent deptAssessmentDeclarationContent = new DeptAssessmentDeclarationContent();
|
|
|
+ deptAssessmentDeclarationContent.setAssessmentDeclarationId(id);
|
|
|
+ deptAssessmentDeclarationContent.setSerialNumber(i + 1);
|
|
|
+ deptAssessmentDeclarationContent.setEmployeeId(userList.get(i).getId());
|
|
|
+ deptAssessmentDeclarationContent.setEmployeeNo(userList.get(i).getNo());
|
|
|
+ deptAssessmentDeclarationContent.setEmployeeName(userList.get(i).getName());
|
|
|
+ deptAssessmentDeclarationContent.setSuggestedValue("1");
|
|
|
+ deptAssessmentDeclarationContentList.add(deptAssessmentDeclarationContent);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {//子级部门
|
|
|
+ JSONObject jsonArr = userService.pageList(1, 1000, deptAssessmentDeclaration.getDeptId(), "", "", "", "", "", request);
|
|
|
+ JSONObject jsonArr1 = (JSONObject) jsonArr.get("data");
|
|
|
+ JSONArray array = JSONUtil.parseArray(jsonArr1.get("records"));
|
|
|
+ List<UserDTO> userList = JSONUtil.toList(array, UserDTO.class);
|
|
|
+ for (int i = 0; i < userList.size(); i++) {
|
|
|
+ if (StringUtils.isNotEmpty(userList.get(i).getNo())) {
|
|
|
+ DeptAssessmentDeclarationContent deptAssessmentDeclarationContent = new DeptAssessmentDeclarationContent();
|
|
|
+ deptAssessmentDeclarationContent.setAssessmentDeclarationId(id);
|
|
|
+ deptAssessmentDeclarationContent.setSerialNumber(i + 1);
|
|
|
+ deptAssessmentDeclarationContent.setEmployeeId(userList.get(i).getId());
|
|
|
+ deptAssessmentDeclarationContent.setEmployeeNo(userList.get(i).getNo());
|
|
|
+ deptAssessmentDeclarationContent.setEmployeeName(userList.get(i).getName());
|
|
|
+ deptAssessmentDeclarationContent.setSuggestedValue("1");
|
|
|
+ deptAssessmentDeclarationContentList.add(deptAssessmentDeclarationContent);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
boolean b = super.save(deptAssessmentDeclaration);
|