| | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @GetMapping("/getMailList.do") |
| | | public AllBackMsg getMailList(String mail, @RequestParam(defaultValue = "1") Integer mailType, |
| | | @RequestParam(defaultValue = "1") Integer page,@RequestParam(defaultValue = "20") Integer limit, boolean isNoRead, HttpServletRequest request, HttpServletResponse response) throws Exception { |
| | | @RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "20") Integer limit, boolean isNoRead, HttpServletRequest request, HttpServletResponse response) throws Exception { |
| | | AllBackMsg msg = new AllBackMsg(); |
| | | try { |
| | | if (StringUtils.isNotBlank(mail)) { |
| | |
| | | } |
| | | DataSourceEntity dataSourceEntity = MultiDataSource.getDataSourceMap(request);//获取数据源信息 |
| | | SpObserver.setDBtoInstance("_" + dataSourceEntity.getDbId());//切换数据源 |
| | | List<t482101HList> t482101HEntityList = emailIfc.getReceivingMailList(mail, mailType, isNoRead, userCode,page,limit); |
| | | List<t482101HList> t482101HEntityList = emailIfc.getReceivingMailList(mail, mailType, isNoRead, userCode, page, limit); |
| | | if (t482101HEntityList.size() > 0) { |
| | | msg.setSuccess("执行完成", t482101HEntityList); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/getHandleMailList.do") |
| | | public AllBackMsg getHandleMailList(String mail,@RequestParam(defaultValue = "1") Integer page,@RequestParam(defaultValue = "20") Integer limit, |
| | | public AllBackMsg getHandleMailList(String mail, @RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "20") Integer limit, |
| | | HttpServletRequest request, HttpServletResponse response) throws Exception { |
| | | AllBackMsg msg = new AllBackMsg(); |
| | | try { |
| | |
| | | } |
| | | DataSourceEntity dataSourceEntity = MultiDataSource.getDataSourceMap(request);//获取数据源信息 |
| | | SpObserver.setDBtoInstance("_" + dataSourceEntity.getDbId());//切换数据源 |
| | | List<t482101HList> t482101HEntityList = emailIfc.getHandleMailList(mail, userCode,page,limit); |
| | | List<t482101HList> t482101HEntityList = emailIfc.getHandleMailList(mail, userCode, page, limit); |
| | | if (t482101HEntityList.size() > 0) { |
| | | msg.setSuccess("执行完成", t482101HEntityList); |
| | | } |
| | |
| | | * @param response |
| | | * @return |
| | | */ |
| | | @GetMapping("/updateHandle.do") |
| | | public AllBackMsg updateHandle(String handleTime, String docCode, HttpServletRequest request, HttpServletResponse response) throws Exception { |
| | | @PostMapping("/updateHandle.do") |
| | | public AllBackMsg updateHandle(@RequestBody Map<String, Object> param, HttpServletRequest request, HttpServletResponse response) throws Exception { |
| | | AllBackMsg msg = new AllBackMsg(); |
| | | try { |
| | | HttpSession session = request.getSession(); |
| | |
| | | msg.setFail("获取不到用户信息"); |
| | | return msg; |
| | | } |
| | | |
| | | if (StringUtils.isBlank(docCode)) { |
| | | if (param.get("docCode") == null) { |
| | | msg.setFail("邮件唯一标识docCode不能空"); |
| | | return msg; |
| | | } |
| | | if (param.get("handleTime") == null) { |
| | | msg.setFail("待处理时间不能空"); |
| | | return msg; |
| | | } |
| | | List<String> docCode = (List<String>) param.get("docCode"); |
| | | String handleTime = (String) param.get("handleTime"); |
| | | // 正则表达式,用于匹配日期格式 |
| | | String regex = "\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}"; |
| | | Pattern pattern = Pattern.compile(regex); |
| | | Matcher matcher = pattern.matcher(handleTime); |
| | | if (!matcher.matches()) { |
| | | msg.setFail("待处理日期格式为:yyyy-MM-dd HH:mm(如:1900-08-01 08:00)。请检查"); |
| | | return msg; |
| | | } |
| | | DataSourceEntity dataSourceEntity = MultiDataSource.getDataSourceMap(request);//获取数据源信息 |
| | | SpObserver.setDBtoInstance("_" + dataSourceEntity.getDbId());//切换数据源 |
| | | emailIfc.updateMailHandle(handleTime, docCode); |
| | | emailIfc.updateMailHandle(handleTime, StringUtils.join(docCode, ",")); |
| | | msg.setOk("成功标记为待处理邮件"); |
| | | } catch (Exception e) { |
| | | msg.setFail(e.getCause() != null ? e.getCause().getMessage() : e.getMessage()); |