|
@@ -0,0 +1,388 @@
|
|
|
|
+package com.management.platform.service.impl;
|
|
|
|
+
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
+import com.management.platform.entity.*;
|
|
|
|
+import com.management.platform.entity.vo.SysRichFunction;
|
|
|
|
+import com.management.platform.mapper.*;
|
|
|
|
+import com.management.platform.service.PlanDeptService;
|
|
|
|
+import com.management.platform.service.PlanService;
|
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
+import com.management.platform.service.WxCorpInfoService;
|
|
|
|
+import com.management.platform.util.ExcelUtil;
|
|
|
|
+import com.management.platform.util.HttpRespMsg;
|
|
|
|
+import com.management.platform.util.MessageUtils;
|
|
|
|
+import org.apache.poi.EncryptedDocumentException;
|
|
|
|
+import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
|
|
|
+import org.apache.poi.ss.usermodel.CellType;
|
|
|
|
+import org.apache.poi.xssf.usermodel.XSSFCell;
|
|
|
|
+import org.apache.poi.xssf.usermodel.XSSFRow;
|
|
|
|
+import org.apache.poi.xssf.usermodel.XSSFSheet;
|
|
|
|
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
+import org.springframework.util.StringUtils;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
+
|
|
|
|
+import javax.annotation.Resource;
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
|
+import java.io.*;
|
|
|
|
+import java.math.BigDecimal;
|
|
|
|
+import java.sql.Wrapper;
|
|
|
|
+import java.time.Instant;
|
|
|
|
+import java.time.LocalDate;
|
|
|
|
+import java.time.ZoneId;
|
|
|
|
+import java.time.format.DateTimeFormatter;
|
|
|
|
+import java.util.*;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * <p>
|
|
|
|
+ * 服务实现类
|
|
|
|
+ * </p>
|
|
|
|
+ *
|
|
|
|
+ * @author Seyason
|
|
|
|
+ * @since 2023-07-24
|
|
|
|
+ */
|
|
|
|
+@Service
|
|
|
|
+public class PlanServiceImpl extends ServiceImpl<PlanMapper, Plan> implements PlanService {
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private PlanMapper planMapper;
|
|
|
|
+ @Resource
|
|
|
|
+ private WxCorpInfoService wxCorpInfoService;
|
|
|
|
+ @Resource
|
|
|
|
+ private HttpServletRequest request;
|
|
|
|
+ @Resource
|
|
|
|
+ private UserMapper userMapper;
|
|
|
|
+ @Resource
|
|
|
|
+ private PlanDeptMapper planDeptMapper;
|
|
|
|
+ @Resource
|
|
|
|
+ private PlanDeptService planDeptService;
|
|
|
|
+ @Resource
|
|
|
|
+ private DepartmentMapper departmentMapper;
|
|
|
|
+ @Resource
|
|
|
|
+ private ProdMaterialMapper prodMaterialMapper;
|
|
|
|
+ @Resource
|
|
|
|
+ private ProdProcedureMapper prodProcedureMapper;
|
|
|
|
+ @Resource
|
|
|
|
+ private ProductMapper productMapper;
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public HttpRespMsg getList(String date, String steelStampNumber, Integer planType,Integer deptId) {
|
|
|
|
+ HttpRespMsg msg=new HttpRespMsg();
|
|
|
|
+ QueryWrapper<Plan> queryWrapper=new QueryWrapper();
|
|
|
|
+ DateTimeFormatter df=DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
|
+ queryWrapper.eq("plan_type",planType);
|
|
|
|
+ if(planType!=2){
|
|
|
|
+ queryWrapper.eq("dept_id",deptId);
|
|
|
|
+ }
|
|
|
|
+ if(date!=null){
|
|
|
|
+ queryWrapper.eq("plan_date",LocalDate.parse(date,df));
|
|
|
|
+ }else {
|
|
|
|
+ queryWrapper.eq("plan_date",planType==0?LocalDate.now():LocalDate.now().plusDays(1));
|
|
|
|
+ }
|
|
|
|
+ if(!StringUtils.isEmpty(steelStampNumber)){
|
|
|
|
+ queryWrapper.gt("steel_stamp_number_start",steelStampNumber);
|
|
|
|
+ queryWrapper.lt("steel_stamp_number_end",steelStampNumber);
|
|
|
|
+ }
|
|
|
|
+ List<Plan> planList = planMapper.selectList(queryWrapper);
|
|
|
|
+ msg.setData(planList);
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public HttpRespMsg addOrUpdatePlan(Plan plan) {
|
|
|
|
+ HttpRespMsg msg=new HttpRespMsg();
|
|
|
|
+ if(plan.getId()==null){
|
|
|
|
+ if(count(new QueryWrapper<Plan>().eq("product_scheduling_num",plan.getProductSchedulingNum()))>0){
|
|
|
|
+ msg.setError("当前排产工单号已存在");
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
|
|
+ switch (plan.getPlanType()){
|
|
|
|
+ case 0:
|
|
|
|
+ plan.setPlanDate(LocalDate.now());
|
|
|
|
+ break;
|
|
|
|
+ case 1:
|
|
|
|
+ plan.setPlanDate(LocalDate.now().plusDays(1));
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ if(planMapper.insert(plan)<0){
|
|
|
|
+ msg.setError("验证失败");
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ if(planMapper.updateById(plan)<0){
|
|
|
|
+ msg.setError("验证失败");
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public HttpRespMsg allocationPlan(String ids,Integer planType) {
|
|
|
|
+ HttpRespMsg msg=new HttpRespMsg();
|
|
|
|
+ List<String> idList = Arrays.asList(ids.split(","));
|
|
|
|
+ List<Plan> planList = planMapper.selectBatchIds(idList);
|
|
|
|
+ Integer companyId = userMapper.selectById(request.getHeader("token")).getCompanyId();
|
|
|
|
+ List<WxCorpInfo> wxCorpInfoList = wxCorpInfoService.list(new QueryWrapper<WxCorpInfo>().eq("company_id", companyId));
|
|
|
|
+ if(wxCorpInfoList.size()>0){
|
|
|
|
+ WxCorpInfo wxCorpInfo = wxCorpInfoList.get(0);
|
|
|
|
+ List<Integer> foremanIds = planList.stream().map(Plan::getForemanId).distinct().collect(Collectors.toList());
|
|
|
|
+ List<User> userList = userMapper.selectBatchIds(foremanIds);
|
|
|
|
+ for (Plan plan : planList) {
|
|
|
|
+ Optional<User> first = userList.stream().filter(ul -> ul.getId().equals(plan.getForemanId())).findFirst();
|
|
|
|
+ if(first.isPresent()){
|
|
|
|
+ //推送到企业微信
|
|
|
|
+ JSONObject json=new JSONObject();
|
|
|
|
+ JSONArray dataJson=new JSONArray();
|
|
|
|
+ JSONObject jsonObj=new JSONObject();
|
|
|
|
+ jsonObj.put("key",planType==0?"今日计划":planType==1?"明日计划":"插单计划");
|
|
|
|
+ jsonObj.put("value",planType==2?"任务名称"+plan.getTaskName()+"\n"+"任务变更通知号"+plan.getTaskChangeNoticeNum():"产品名称"+plan.getProductName()+"\n"+"排产工单号"+plan.getProductSchedulingNum());
|
|
|
|
+ dataJson.add(jsonObj);
|
|
|
|
+ //todo:配置消息模板以及推送后入口
|
|
|
|
+ json.put("template_id","tty9TkCAAALUiWvjdoDg_PZf48gwucZA");
|
|
|
|
+ json.put("url","https://open.weixin.qq.com/connect/oauth2/authorize?appid=ww4e237fd6abb635af&redirect_uri=http://worktime.ttkuaiban.com/api/corpWXAuth&response_type=code&scope=snsapi_base&state=expense#wechat_redirect");
|
|
|
|
+ json.put("content_item",dataJson);
|
|
|
|
+ wxCorpInfoService.sendWXCorpTemplateMsg(wxCorpInfo,first.get().getCorpwxUserid(), json);
|
|
|
|
+ }else msg.setError("验证失败");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public HttpRespMsg importData(MultipartFile multipartFile, Integer planType) {
|
|
|
|
+ HttpRespMsg msg=new HttpRespMsg();
|
|
|
|
+ DateTimeFormatter df=DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
|
+ String fileName = multipartFile.getOriginalFilename();
|
|
|
|
+ File file = new File(fileName == null ? "file" : fileName);
|
|
|
|
+ InputStream inputStream = null;
|
|
|
|
+ OutputStream outputStream = null;
|
|
|
|
+ try {
|
|
|
|
+ inputStream = multipartFile.getInputStream();
|
|
|
|
+ outputStream = new FileOutputStream(file);
|
|
|
|
+ byte[] buffer = new byte[4096];
|
|
|
|
+ int temp = 0;
|
|
|
|
+ while ((temp = inputStream.read(buffer, 0, 4096)) != -1) {
|
|
|
|
+ outputStream.write(buffer, 0, temp);
|
|
|
|
+ }
|
|
|
|
+ inputStream.close();
|
|
|
|
+ outputStream.close();
|
|
|
|
+ //然后解析表格
|
|
|
|
+ XSSFWorkbook workbook = new XSSFWorkbook(file);
|
|
|
|
+ //我们只需要第一个sheet
|
|
|
|
+ XSSFSheet sheet = workbook.getSheetAt(0);
|
|
|
|
+ int rowNum = sheet.getLastRowNum();
|
|
|
|
+ //获取相关数据
|
|
|
|
+ Integer companyId = userMapper.selectById(request.getHeader("token")).getCompanyId();
|
|
|
|
+ List<User> userList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId));
|
|
|
|
+ List<Department> departmentList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", companyId));
|
|
|
|
+ List<Product> productList = productMapper.selectList(new QueryWrapper<Product>().eq("company_id", companyId));
|
|
|
|
+ List<Plan> needInsertList=new ArrayList<>();
|
|
|
|
+ for (int rowIndex = 1; rowIndex <= rowNum; rowIndex++) {
|
|
|
|
+ XSSFRow row = sheet.getRow(rowIndex);
|
|
|
|
+ if (row == null) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ //跳过空行
|
|
|
|
+ if (ExcelUtil.isRowEmpty(row)) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ //部门 排产工单号 产品名称 钢印号 数量 主工序 工位 开工时间 完工时间 描述
|
|
|
|
+ XSSFCell deptCell = row.getCell(0);
|
|
|
|
+ XSSFCell productSchedulingNumCell = row.getCell(1);
|
|
|
|
+ XSSFCell productNameCell = row.getCell(2);
|
|
|
|
+ XSSFCell steelStampNumberCell = row.getCell(3);
|
|
|
|
+ XSSFCell numCell = row.getCell(4);
|
|
|
|
+ XSSFCell mainProcessCell = row.getCell(5);
|
|
|
|
+ XSSFCell stationNameCell = row.getCell(6);
|
|
|
|
+ XSSFCell startDateCell = row.getCell(7);
|
|
|
|
+ XSSFCell endDateCell = row.getCell(8);
|
|
|
|
+ XSSFCell descCell = row.getCell(9);
|
|
|
|
+
|
|
|
|
+ if (deptCell != null) deptCell.setCellType(CellType.STRING);
|
|
|
|
+ if (productSchedulingNumCell != null) productSchedulingNumCell.setCellType(CellType.NUMERIC);
|
|
|
|
+ if (productNameCell != null) productNameCell.setCellType(CellType.STRING);
|
|
|
|
+ if (steelStampNumberCell != null) steelStampNumberCell.setCellType(CellType.STRING);
|
|
|
|
+ if (numCell != null) numCell.setCellType(CellType.NUMERIC);
|
|
|
|
+ if (mainProcessCell != null) mainProcessCell.setCellType(CellType.STRING);
|
|
|
|
+ if (stationNameCell != null) stationNameCell.setCellType(CellType.STRING);
|
|
|
|
+ if (startDateCell != null) startDateCell.setCellType(CellType.NUMERIC);
|
|
|
|
+ if (endDateCell != null) endDateCell.setCellType(CellType.NUMERIC);
|
|
|
|
+ if (descCell != null) descCell.setCellType(CellType.STRING);
|
|
|
|
+ Plan plan=new Plan();
|
|
|
|
+ plan.setPlanDate(planType==0?LocalDate.now():LocalDate.now().plusDays(1));
|
|
|
|
+ if(deptCell!=null){
|
|
|
|
+ Optional<Department> first = departmentList.stream().filter(dl -> dl.getDepartmentName().equals(deptCell.getStringCellValue())).findFirst();
|
|
|
|
+ if(first.isPresent()){
|
|
|
|
+ plan.setDeptId(first.get().getDepartmentId());
|
|
|
|
+ }else {
|
|
|
|
+ msg.setError("部门["+deptCell.getStringCellValue()+"]不存在");
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ msg.setError("部门不能为空");
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
|
|
+ if(productSchedulingNumCell!=null){
|
|
|
|
+ if(count(new QueryWrapper<Plan>().eq("product_scheduling_num",productSchedulingNumCell.getStringCellValue()))>0){
|
|
|
|
+ msg.setError("已存在的排产工单号"+productSchedulingNumCell.getStringCellValue());
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
|
|
+ plan.setProductSchedulingNum(productSchedulingNumCell.getStringCellValue());
|
|
|
|
+ }
|
|
|
|
+ if(productNameCell!=null){
|
|
|
|
+ Optional<Product> first = productList.stream().filter(pl -> pl.getName().equals(productNameCell.getStringCellValue())).findFirst();
|
|
|
|
+ if(first.isPresent()){
|
|
|
|
+ plan.setProductId(first.get().getId());
|
|
|
|
+ plan.setProductName(first.get().getName());
|
|
|
|
+ }else {
|
|
|
|
+ msg.setError("产品["+productNameCell.getStringCellValue()+"]不存在");
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(steelStampNumberCell!=null){
|
|
|
|
+ String value = steelStampNumberCell.getStringCellValue();
|
|
|
|
+ String[] split = value.split("-");
|
|
|
|
+ if(split.length>1){
|
|
|
|
+ plan.setSteelStampNumberStart(split[0]);
|
|
|
|
+ plan.setSteelStampNumberEnd(split[1]);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ plan.setNum(numCell==null?0:Integer.valueOf(String.valueOf(numCell.getNumericCellValue())));
|
|
|
|
+ plan.setMainProcess(mainProcessCell==null?"":mainProcessCell.getStringCellValue());
|
|
|
|
+ if(stationNameCell!=null){
|
|
|
|
+ Optional<Department> first = departmentList.stream().filter(dl -> dl.getDepartmentName().equals(stationNameCell.getStringCellValue())).findFirst();
|
|
|
|
+ if(first.isPresent()){
|
|
|
|
+ if(!first.get().getSuperiorId().equals(plan.getDeptId())){
|
|
|
|
+ msg.setError("工位["+stationNameCell.getStringCellValue()+"]不属于部门["+deptCell.getStringCellValue()+"]");
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
|
|
+ plan.setStationId(first.get().getDepartmentId());
|
|
|
|
+ plan.setStationName(first.get().getDepartmentName());
|
|
|
|
+ }else {
|
|
|
|
+ msg.setError("工位["+stationNameCell.getStringCellValue()+"]不存在");
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(startDateCell!=null){
|
|
|
|
+ plan.setStartDate(LocalDate.parse(startDateCell.getDateCellValue().toString(),df));
|
|
|
|
+ }
|
|
|
|
+ if(endDateCell!=null){
|
|
|
|
+ plan.setEndDate(LocalDate.parse(endDateCell.getDateCellValue().toString(),df));
|
|
|
|
+ }
|
|
|
|
+ plan.setDesc(descCell==null?"":descCell.getStringCellValue());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ } catch (NullPointerException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ //msg.setError("数据格式有误或存在空数据 导入失败");
|
|
|
|
+ msg.setError(MessageUtils.message("file.dataFormatError"));
|
|
|
|
+ return msg;
|
|
|
|
+ } catch (InvalidFormatException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ //msg.setError("文件格式错误,如果安装了加密软件需要先解密再上传");
|
|
|
|
+ msg.setError(MessageUtils.message("file.FormatErrorAndDecrypt"));
|
|
|
|
+ } catch (EncryptedDocumentException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ //msg.setError("文件加密状态,需要先解除加密状态再上传");
|
|
|
|
+ msg.setError(MessageUtils.message("file.encryption"));
|
|
|
|
+ return msg;
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ //msg.setError("上传失败:" + e.getMessage());
|
|
|
|
+ msg.setError(MessageUtils.message("file.uploadError",e.getMessage()));
|
|
|
|
+ return msg;
|
|
|
|
+ } finally {
|
|
|
|
+ //关闭流
|
|
|
|
+ try {
|
|
|
|
+ if (outputStream != null && inputStream != null) {
|
|
|
|
+ outputStream.close();
|
|
|
|
+ inputStream.close();
|
|
|
|
+ System.out.println("流已关闭");
|
|
|
|
+ }
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+// file.deleteOnExit();//程序退出时删除临时文件
|
|
|
|
+ System.out.println(file.delete());
|
|
|
|
+ }
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public HttpRespMsg exportData(String date, Integer planType) {
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public HttpRespMsg deptList() {
|
|
|
|
+ HttpRespMsg msg=new HttpRespMsg();
|
|
|
|
+ Integer companyId = userMapper.selectById(request.getHeader("token")).getCompanyId();
|
|
|
|
+ List<PlanDept> planDeptList = planDeptService.list(new QueryWrapper<PlanDept>().eq("company_id", companyId));
|
|
|
|
+ List<Integer> deptIds = planDeptList.stream().map(PlanDept::getDeptId).distinct().collect(Collectors.toList());
|
|
|
|
+ deptIds.add(-1);
|
|
|
|
+ List<Department> departmentList = departmentMapper.selectBatchIds(deptIds);
|
|
|
|
+ msg.setData(departmentList);
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public HttpRespMsg planDetail(Integer productSchedulingNum, Integer type) {
|
|
|
|
+ HttpRespMsg msg=new HttpRespMsg();
|
|
|
|
+ Plan plan = planMapper.selectOne(new QueryWrapper<Plan>().eq("product_scheduling_num", productSchedulingNum));
|
|
|
|
+ if(plan!=null){
|
|
|
|
+ switch (type){
|
|
|
|
+ case 0:
|
|
|
|
+ List<ProdProcedure> prodProcedureList = prodProcedureMapper.selectList(new QueryWrapper<ProdProcedure>().eq("product_id", plan.getProductId()));
|
|
|
|
+ msg.setData(prodProcedureList);
|
|
|
|
+ break;
|
|
|
|
+ case 1:
|
|
|
|
+ List<ProdMaterial> prodMaterialList = prodMaterialMapper.selectList(new QueryWrapper<ProdMaterial>().eq("product_id", plan.getProductId()));
|
|
|
|
+ msg.setData(prodMaterialList);
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public HttpRespMsg deptSet(String deptIds) {
|
|
|
|
+ HttpRespMsg msg=new HttpRespMsg();
|
|
|
|
+ List<String> deptIdList = Arrays.asList(deptIds.split(","));
|
|
|
|
+ Integer companyId = userMapper.selectById(request.getHeader("token")).getCompanyId();
|
|
|
|
+ //已经保存了的部门设置 删除之前 部门下不存在计划数据的部门
|
|
|
|
+ List<PlanDept> allPlanDept = planDeptMapper.selectList(new QueryWrapper<PlanDept>().eq("company_id", companyId));
|
|
|
|
+ if(allPlanDept.size()>0){
|
|
|
|
+ List<Integer> allDeptIds = allPlanDept.stream().map(PlanDept::getDeptId).distinct().collect(Collectors.toList());
|
|
|
|
+ for (Integer allDeptId : allDeptIds) {
|
|
|
|
+ if(planMapper.selectCount(new QueryWrapper<Plan>().eq("dept_id",allDeptId))<=0){
|
|
|
|
+ Map map=new HashMap();
|
|
|
|
+ map.put("company_id",companyId);
|
|
|
|
+ map.put("dept_id",allDeptId);
|
|
|
|
+ planDeptMapper.deleteByMap(map);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ List<PlanDept> afterRemoveDept = planDeptMapper.selectList(new QueryWrapper<PlanDept>().eq("company_id", companyId));
|
|
|
|
+ List<PlanDept> planDeptList=new ArrayList<>();
|
|
|
|
+ deptIdList.forEach(dl->{
|
|
|
|
+ PlanDept planDept=new PlanDept();
|
|
|
|
+ planDept.setCompanyId(companyId);
|
|
|
|
+ planDept.setDeptId(Integer.valueOf(dl));
|
|
|
|
+ if(!afterRemoveDept.contains(planDept)){
|
|
|
|
+ planDeptList.add(planDept);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ if(!planDeptService.saveBatch(planDeptList)){
|
|
|
|
+ msg.setError("验证失败");
|
|
|
|
+ }
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
|
|
+}
|