hlf 1 rok pred
rodič
commit
5cbf123e84

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

@@ -17,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.InputStream;
 import java.net.URLEncoder;
@@ -83,9 +84,9 @@ public class DeptAssessmentDeclarationController {
 	 * @return 结果
 	 */
 	@PostMapping(value = "/save")
-	public R addAll(@RequestBody DeptAssessmentDeclaration deptAssessmentDeclaration) {
+	public R addAll(@RequestBody DeptAssessmentDeclaration deptAssessmentDeclaration, HttpServletRequest request) {
 		try {
-			boolean b = deptAssessmentDeclarationService.save(deptAssessmentDeclaration);
+			boolean b = deptAssessmentDeclarationService.save(deptAssessmentDeclaration, request);
 			if (b) {
 				return R.ok().data(b);
 			} else {

+ 28 - 7
ims-service/ims-eval/src/main/java/com/ims/eval/controller/NoticeManagementController.java

@@ -248,18 +248,39 @@ public class NoticeManagementController {
 		List<EvaluationNotice> list = new ArrayList<>();
 		for (EvaluationNotice evaluationNotice : evaluationNoticeList) {
 			if ("所有单位".equals(evaluationNotice.getSendTo())) {
-				String[] noticeAnnexList = evaluationNotice.getNoticeAnnex().split(",");
-				String noticeAnnex = "";
-				for (String str : noticeAnnexList) {
-					if (str.contains("All")) {
-						noticeAnnex += str;
+				if (evaluationNotice.getNoticeAnnex().length() > 0){
+					String[] noticeAnnexList = evaluationNotice.getNoticeAnnex().split(",");
+					StringBuilder noticeAnnex = new StringBuilder();
+					for (String str : noticeAnnexList) {
+						if (str.contains("All")) {
+							noticeAnnex.append(str).append(",");
+						} else if (str.contains(deptId)) {
+							noticeAnnex.append(str).append(",");
+						}
+					}
+					if (noticeAnnex.toString().length() > 0){
+						evaluationNotice.setNoticeAnnex(noticeAnnex.toString().substring(0, noticeAnnex.toString().length() - 1));
 					}
 				}
 				list.add(evaluationNotice);
 			} else if ("个别部门".equals(evaluationNotice.getSendTo())) {
-				String[] strings = evaluationNotice.getSendToContent().split(",");
-				for (String str : strings) {
+				String[] sendToContentList = evaluationNotice.getSendToContent().split(",");
+				for (String str : sendToContentList) {
 					if (str.equals(deptId)) {
+						if (evaluationNotice.getNoticeAnnex().length() > 0){
+							String[] noticeAnnexList = evaluationNotice.getNoticeAnnex().split(",");
+							StringBuilder noticeAnnex = new StringBuilder();
+							for (String str1 : noticeAnnexList) {
+								if (str1.contains("All")) {
+									noticeAnnex.append(str1).append(",");
+								} else if (str1.contains(deptId)) {
+									noticeAnnex.append(str1).append(",");
+								}
+							}
+							if (noticeAnnex.toString().length() > 0){
+								evaluationNotice.setNoticeAnnex(noticeAnnex.toString().substring(0, noticeAnnex.toString().length() - 1));
+							}
+						}
 						list.add(evaluationNotice);
 						break;
 					}

+ 17 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/entity/dto/request/UserDTO.java

@@ -0,0 +1,17 @@
+package com.ims.eval.entity.dto.request;
+
+import lombok.Data;
+
+/**
+ * @author hlf
+ * @date 2023/6/26 10:46
+ * 文件说明:
+ */
+@Data
+public class UserDTO {
+
+	private String id;
+
+	private String name;
+
+}

+ 2 - 1
ims-service/ims-eval/src/main/java/com/ims/eval/service/IDeptAssessmentDeclarationService.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.ims.eval.entity.DeptAssessmentDeclaration;
 
+import javax.servlet.http.HttpServletRequest;
 import java.util.List;
 
 /**
@@ -15,7 +16,7 @@ public interface IDeptAssessmentDeclarationService extends IService<DeptAssessme
 
 	IPage<DeptAssessmentDeclaration> listPage(Integer pageNum, Integer pageSize, String orderNumber, String deptId, String annual, String declarationMonth);
 
-	boolean save(DeptAssessmentDeclaration deptAssessmentDeclaration);
+	boolean save(DeptAssessmentDeclaration deptAssessmentDeclaration, HttpServletRequest request);
 
 	boolean removeByIds(List<String> ids);
 

+ 34 - 2
ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/DeptAssessmentDeclarationServiceImpl.java

@@ -1,6 +1,11 @@
 package com.ims.eval.service.impl;
 
+import cn.hutool.core.convert.Convert;
 import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.IdUtil;
+import cn.hutool.json.JSONArray;
+import cn.hutool.json.JSONUtil;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -8,11 +13,16 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 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.dto.request.UserDTO;
 import com.ims.eval.service.IDeptAssessmentDeclarationContentService;
 import com.ims.eval.service.IDeptAssessmentDeclarationService;
+import com.ims.eval.service.IUserService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import javax.servlet.http.HttpServletRequest;
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -26,6 +36,9 @@ public class DeptAssessmentDeclarationServiceImpl extends ServiceImpl<DeptAssess
 	@Autowired
 	private IDeptAssessmentDeclarationContentService deptAssessmentDeclarationContentService;
 
+	@Autowired
+	private IUserService userService;
+
 	@Override
 	public IPage<DeptAssessmentDeclaration> listPage(Integer pageNum, Integer pageSize, String orderNumber, String deptId, String annual, String declarationMonth) {
 		if (null == pageNum || null == pageSize) {
@@ -37,7 +50,7 @@ public class DeptAssessmentDeclarationServiceImpl extends ServiceImpl<DeptAssess
 	}
 
 	@Override
-	public boolean save(DeptAssessmentDeclaration deptAssessmentDeclaration) {
+	public boolean save(DeptAssessmentDeclaration deptAssessmentDeclaration, HttpServletRequest request) {
 		QueryWrapper<DeptAssessmentDeclaration> qw = new QueryWrapper<>();
 		if (StringUtils.isNotEmpty(deptAssessmentDeclaration.getAnnual())) {
 			qw.lambda().like(DeptAssessmentDeclaration::getAnnual, deptAssessmentDeclaration.getAnnual());
@@ -46,10 +59,29 @@ public class DeptAssessmentDeclarationServiceImpl extends ServiceImpl<DeptAssess
 			qw.lambda().eq(DeptAssessmentDeclaration::getDeclarationMonth, deptAssessmentDeclaration.getDeclarationMonth());
 		}
 		int count = super.count(qw);
+		String id = Convert.toStr(IdUtil.getSnowflake(1, 1).nextId());
+		deptAssessmentDeclaration.setId(id);
 		deptAssessmentDeclaration.setOrderNumber("KHSB_GDDL_" + deptAssessmentDeclaration.getAnnual() + "_" + StringUtils.addZeroForStr(String.valueOf(Integer.parseInt(deptAssessmentDeclaration.getDeclarationMonth())), 2, "l") + StringUtils.addZeroForStr(String.valueOf(count + 1), 2, "l"));
 		deptAssessmentDeclaration.setStage("流程未启动");
 		deptAssessmentDeclaration.setCreateTime(DateUtil.date());
-		return super.save(deptAssessmentDeclaration);
+		List<DeptAssessmentDeclarationContent> deptAssessmentDeclarationContentList = new ArrayList<>();
+		JSONObject jsonArr = userService.pageList(1, 500, deptAssessmentDeclaration.getDeptId(), "", "", "", "", "", request);
+		JSONArray array = JSONUtil.parseArray(jsonArr);
+		List<UserDTO> userList = JSONUtil.toList(array, UserDTO.class);
+		for (int i = 0; i < userList.size(); i++) {
+			DeptAssessmentDeclarationContent deptAssessmentDeclarationContent = new DeptAssessmentDeclarationContent();
+			deptAssessmentDeclarationContent.setAssessmentDeclarationId(id);
+			deptAssessmentDeclarationContent.setSerialNumber(Convert.toStr(i + 1));
+			deptAssessmentDeclarationContent.setEmployeeId(userList.get(i).getId());
+			deptAssessmentDeclarationContent.setEmployeeName(userList.get(i).getName());
+			deptAssessmentDeclarationContent.setSuggestedValue("1");
+			deptAssessmentDeclarationContentList.add(deptAssessmentDeclarationContent);
+		}
+		boolean b = super.save(deptAssessmentDeclaration);
+		if (b) {
+			b = deptAssessmentDeclarationContentService.saveBatch(deptAssessmentDeclarationContentList);
+		}
+		return b;
 	}
 
 	@Override