|
@@ -1,16 +1,21 @@
|
|
|
package org.jeecg.modules.oa.controller;
|
|
|
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
import java.io.IOException;
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
import java.net.URLDecoder;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
+
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.apache.shiro.SecurityUtils;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
+import org.jeecg.common.constant.CommonConstant;
|
|
|
+import org.jeecg.common.system.api.ISysBaseAPI;
|
|
|
import org.jeecg.common.system.query.QueryGenerator;
|
|
|
+import org.jeecg.common.system.vo.LoginUser;
|
|
|
import org.jeecg.common.util.oConvertUtils;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
@@ -49,6 +54,8 @@ import org.jeecg.common.aspect.annotation.AutoLog;
|
|
|
public class ConferenceApplyController extends JeecgController<ConferenceApply, IConferenceApplyService> {
|
|
|
@Autowired
|
|
|
private IConferenceApplyService conferenceApplyService;
|
|
|
+ @Autowired
|
|
|
+ private ISysBaseAPI sysBaseAPI;
|
|
|
|
|
|
/**
|
|
|
* 分页列表查询
|
|
@@ -82,6 +89,7 @@ public class ConferenceApplyController extends JeecgController<ConferenceApply,
|
|
|
@ApiOperation(value="会务安排申请-添加", notes="会务安排申请-添加")
|
|
|
@PostMapping(value = "/add")
|
|
|
public Result<?> add(@RequestBody ConferenceApply conferenceApply) {
|
|
|
+ conferenceApply.setNotified("否");
|
|
|
conferenceApplyService.save(conferenceApply);
|
|
|
return Result.ok("添加成功!");
|
|
|
}
|
|
@@ -124,6 +132,11 @@ public class ConferenceApplyController extends JeecgController<ConferenceApply,
|
|
|
@ApiOperation(value="会务安排申请-批量删除", notes="会务安排申请-批量删除")
|
|
|
@DeleteMapping(value = "/deleteBatch")
|
|
|
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
|
|
+ Collection<ConferenceApply> conferenceApplies = this.conferenceApplyService.listByIds(Arrays.asList(ids.split(",")));
|
|
|
+ long count = conferenceApplies.stream().filter(i -> "是".equals(i.getNotified())).count();
|
|
|
+ if(count>0){
|
|
|
+ return Result.error("已通知会议,不能删除!");
|
|
|
+ }
|
|
|
this.conferenceApplyService.removeByIds(Arrays.asList(ids.split(",")));
|
|
|
return Result.ok("批量删除成功!");
|
|
|
}
|
|
@@ -168,4 +181,35 @@ public class ConferenceApplyController extends JeecgController<ConferenceApply,
|
|
|
return super.importExcel(request, response, ConferenceApply.class);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通过id通知与会人员
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "会务安排申请-通过id通知与会人员")
|
|
|
+ @ApiOperation(value="会务安排申请-通过id通知与会人员", notes="会务安排申请-通过id通知与会人员")
|
|
|
+ @GetMapping(value = "/notify")
|
|
|
+ public Result<?> notify(@RequestParam(name="id",required=true) String id) {
|
|
|
+ LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
+ ConferenceApply conferenceApply = this.conferenceApplyService.getById(id);
|
|
|
+ String attendPerson = conferenceApply.getAttendPersonIds();
|
|
|
+ if (StringUtils.isBlank(attendPerson)) {
|
|
|
+ return Result.error("请先选择与会人员");
|
|
|
+ }
|
|
|
+ List<String> userList = Arrays.asList(attendPerson.split(","));
|
|
|
+ String msgContent = "";
|
|
|
+ msgContent += "<h2>会议主题:" + conferenceApply.getConferenceTitle() + "</h2><br>";
|
|
|
+ msgContent += "<h3>会议时间:"+ DateUtil.format(conferenceApply.getStartTime(),"yyyy-MM-dd HH:mm") +" ~ "+DateUtil.format(conferenceApply.getEndTime(),"yyyy-MM-dd HH:mm")+"</h3>";
|
|
|
+ msgContent += "<h3>会议地点:"+conferenceApply.getConferenceAddress()+"</h3>";
|
|
|
+ msgContent += "<h3>会议内容:<br>"+conferenceApply.getConferenceContent()+"</h3>";
|
|
|
+
|
|
|
+ for (String o:userList){
|
|
|
+ sysBaseAPI.sendSysAnnouncement(loginUser,loginUser.getUsername(),o,"会议通知",msgContent, CommonConstant.MSG_CATEGORY_2,new HashMap<>());
|
|
|
+ }
|
|
|
+ conferenceApply.setNotified("是");
|
|
|
+ this.conferenceApplyService.saveOrUpdate(conferenceApply);
|
|
|
+ return Result.ok("通知成功!");
|
|
|
+ }
|
|
|
}
|