Browse Source

简易程序 联系群众后不能退回信件

master
wxc 2 years ago
parent
commit
a9d516b110
  1. 3
      mailbox-common/src/main/java/com/biutag/exception/GlobalException.java
  2. 6
      mailbox-lan/pom.xml
  3. 43
      mailbox-lan/src/main/java/com/biutag/lan/config/AdminInterceptor.java
  4. 69
      mailbox-lan/src/main/java/com/biutag/lan/controller/system/CrontabController.java
  5. 3
      mailbox-lan/src/main/java/com/biutag/lan/domain/Mail.java
  6. 2
      mailbox-lan/src/main/java/com/biutag/lan/flow/FlowConfig.java
  7. 3
      mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeVerifyFlow.java
  8. 5
      mailbox-lan/src/main/java/com/biutag/lan/service/MailService.java
  9. 2
      mailbox-lan/src/main/java/com/biutag/lan/service/WorkService.java
  10. 10
      mailbox-lan/src/test/java/com/biutag/lan/JsonTest.java
  11. 162
      mailbox-lan/src/test/java/com/biutag/lan/SpringBootMailImportTest.java
  12. 41
      mailbox-outer-admin/pom.xml
  13. 2
      mailbox-outer-admin/src/main/resources/application.yml
  14. 1
      mailbox-outer-admin/src/main/resources/license/license.dat

3
mailbox-common/src/main/java/com/biutag/exception/GlobalException.java

@ -36,10 +36,11 @@ public class GlobalException {
@ExceptionHandler(Exception.class)
@ResponseBody
public AjaxResult<Object> handleException(Exception e, HttpServletResponse response) {
log.error("系统异常 {}", e.getMessage(), e);
if ("application/javascript;charset=UTF-8".equals(response.getHeader("Content-Type"))) {
return null;
}
log.error("系统异常 {}", e.getMessage(), e);
return AjaxResult.failed(ErrorEnum.SYSTEM_ERROR.getCode(), e.getMessage());
}

6
mailbox-lan/pom.xml

@ -140,6 +140,12 @@
<scope>compile</scope>
</dependency>
<!-- <dependency>-->
<!-- <groupId>io.springboot.ai</groupId>-->
<!-- <artifactId>spring-ai-transformers</artifactId>-->
<!-- <version>1.0.0</version>-->
<!-- </dependency>-->
</dependencies>
<build>

43
mailbox-lan/src/main/java/com/biutag/lan/config/AdminInterceptor.java

@ -6,12 +6,10 @@ import com.alibaba.fastjson2.JSON;
import com.biutag.aop.NotLogin;
import com.biutag.aop.NotPower;
import com.biutag.core.AjaxResult;
import com.biutag.enums.ErrorEnum;
import com.biutag.exception.LoginException;
import com.biutag.lan.util.LoginUserHelper;
import com.biutag.lan.vo.system.LoginUser;
import com.biutag.util.StringUtils;
import com.biutag.util.YmlUtils;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.jetbrains.annotations.NotNull;
@ -20,8 +18,6 @@ import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.HandlerInterceptor;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.List;
/**
* 拦截器
@ -57,23 +53,6 @@ public class AdminInterceptor implements HandlerInterceptor {
response.getWriter().print(JSON.toJSONString(result));
return false;
}
// 演示环境拦截
String env = YmlUtils.get("like.production");
if (StringUtils.isNotNull(env) && env.equals("true")) {
String prefix = "/api/";
String route = request.getRequestURI().replaceFirst(prefix, "");
String auths = route.replace("/", ":");
List<String> ignoreUrl = Arrays.asList("system:login", "system:logout");
if (request.getMethod().equals("POST") && !ignoreUrl.contains(auths)) {
String message = "演示环境不支持修改数据,请下载源码本地部署体验";
AjaxResult<Object> result = AjaxResult.failed(ErrorEnum.NO_PERMISSION.getCode(), message);
response.getWriter().print(JSON.toJSONString(result));
return false;
}
}
// 验证通过继续
return HandlerInterceptor.super.preHandle(request, response, handler);
}
@ -101,20 +80,9 @@ public class AdminInterceptor implements HandlerInterceptor {
* @return Method
* @throws Exception 异常
*/
private Method obtainAop(@NotNull Object handler) throws Exception {
String[] objArr = handler.toString().split("#");
String methodStr = objArr[1].split("\\(")[0];
String classStr = objArr[0];
Class<?> clazz = Class.forName(classStr);
Method[] methods = clazz.getDeclaredMethods();
for (Method method : methods) {
if (method.getName().equals(methodStr)) {
return method;
}
}
return null;
private Method obtainAop(@NotNull Object handler) {
HandlerMethod handlerMethod = (HandlerMethod) handler;
return handlerMethod.getMethod();
}
/**
@ -124,7 +92,7 @@ public class AdminInterceptor implements HandlerInterceptor {
* @author
*/
private void checkLogin(Method method, String reqUri) {
for (int i=0; i<=0; i++) {
for (int i = 0; i <= 0; i++) {
// 免登校验
if (StringUtils.isNotNull(method) && method.isAnnotationPresent(NotLogin.class)) {
break;
@ -154,7 +122,7 @@ public class AdminInterceptor implements HandlerInterceptor {
* @author
*/
private void checkAuth(Method method, String uri) {
for (int i=0; i<=0; i++) {
for (int i = 0; i <= 0; i++) {
// 免权限校验
if (StringUtils.isNotNull(method) && method.isAnnotationPresent(NotPower.class)) {
break;
@ -176,4 +144,5 @@ public class AdminInterceptor implements HandlerInterceptor {
StpUtil.checkPermission(auths);
}
}
}

69
mailbox-lan/src/main/java/com/biutag/lan/controller/system/CrontabController.java

@ -1,69 +0,0 @@
package com.biutag.lan.controller.system;
import com.biutag.lan.aop.Log;
import com.biutag.lan.service.ICrontabService;
import com.biutag.lan.validate.commons.IdValidate;
import com.biutag.lan.validate.commons.PageValidate;
import com.biutag.lan.validate.crontab.CrontabCreateValidate;
import com.biutag.lan.validate.crontab.CrontabUpdateValidate;
import com.biutag.lan.vo.system.CrontabDetailVo;
import com.biutag.lan.vo.system.CrontabListedVo;
import com.biutag.core.AjaxResult;
import com.biutag.core.PageResult;
import com.biutag.validator.annotation.IDMust;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import jakarta.annotation.Resource;
import org.quartz.SchedulerException;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("api/crontab")
@Api(tags = "计划任务管理")
public class CrontabController {
@Resource
ICrontabService iCrontabService;
@GetMapping("/list")
@ApiOperation(value="计划任务列表")
public AjaxResult< PageResult<CrontabListedVo>> list(@Validated PageValidate pageValidate) {
PageResult<CrontabListedVo> list = iCrontabService.list(pageValidate);
return AjaxResult.success(list);
}
@GetMapping("/detail")
@ApiOperation(value="计划任务详情")
public AjaxResult<Object> detail(@Validated @IDMust() @RequestParam("id") Integer id) {
CrontabDetailVo vo = iCrontabService.detail(id);
return AjaxResult.success(vo);
}
@Log(title = "计划任务新增")
@PostMapping("/add")
@ApiOperation(value="计划任务新增")
public AjaxResult<Void> add(@Validated @RequestBody CrontabCreateValidate createValidate) throws SchedulerException {
iCrontabService.add(createValidate);
return AjaxResult.success();
}
@Log(title = "计划任务编辑")
@PostMapping("/edit")
@ApiOperation(value="计划任务编辑")
public AjaxResult<Void> edit(@Validated @RequestBody CrontabUpdateValidate updateValidate) throws SchedulerException {
iCrontabService.edit(updateValidate);
return AjaxResult.success();
}
@Log(title = "计划任务删除")
@PostMapping("/del")
@ApiOperation(value="计划任务删除")
public AjaxResult<Void> del(@Validated @RequestBody IdValidate idValidate) throws SchedulerException {
iCrontabService.del(idValidate.getId());
return AjaxResult.success();
}
}

3
mailbox-lan/src/main/java/com/biutag/lan/domain/Mail.java

@ -1,6 +1,7 @@
package com.biutag.lan.domain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
@ -54,7 +55,9 @@ public class Mail {
/**
* 来信时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime mailTime;
/**
* 来源
*/

2
mailbox-lan/src/main/java/com/biutag/lan/flow/FlowConfig.java

@ -126,7 +126,7 @@ public class FlowConfig {
// 三级机构核查办理
threeVerifyFlow
.setFlowNode(getFlowNode(flowNodes, FlowNodeEnum.VERIFY))
.setActions(Arrays.asList(applyExtensionAction, secondSaveAction, applicationCompletedAction))
.setActions(Arrays.asList(returnAction, applyExtensionAction, secondSaveAction, applicationCompletedAction))
// 线上申请办结
.next("online", threeLeaderApprovalFlow)
// 线下申请办结

3
mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeVerifyFlow.java

@ -43,6 +43,9 @@ public class ThreeVerifyFlow extends Flow {
@Override
public Flow next(String nextActionKey, String mailId, JSONObject data) {
if (ActionEnum.mailReturn.getValue().equals(nextActionKey)) {
return threeSignFlow.mailReturn(mailId, data);
}
// 线下
if (ActionEnum.offline.name().equals(nextActionKey)) {
return offline(nextActionKey, mailId, data);

5
mailbox-lan/src/main/java/com/biutag/lan/service/MailService.java

@ -92,7 +92,10 @@ public class MailService extends ServiceImpl<MailMapper, Mail> {
if (!mailSource.getSignFlag()) {
flow = SpringUtil.getBean(FirstSignFlow.class);
mail = mailSource.toMail();
LambdaQueryWrapper<Mail> queryWrapper = new LambdaQueryWrapper<Mail>().eq(Mail::getContactPhone, mail.getContactPhone()).eq(Mail::getContactName, mail.getContactName());
LambdaQueryWrapper<Mail> queryWrapper = new LambdaQueryWrapper<Mail>()
.eq(Mail::getContactPhone, mail.getContactPhone())
.eq(Mail::getContactName, mail.getContactName())
.orderByDesc(Mail::getCreateTime);
flowDetail.setHistorys(list(queryWrapper));
} else {
mail = getById(mailId);

2
mailbox-lan/src/main/java/com/biutag/lan/service/WorkService.java

@ -484,7 +484,7 @@ public class WorkService extends ServiceImpl<WorkMapper, Work> {
}
// 申诉状态
if (AppealState.UN_APPEAL.getValue().equals(mailQuery.getAppealState())) {
queryWrapper.eq("mm.satisfied", AppConstants.FALSE).isNull("ma.appeal_state");
queryWrapper.eq("mm.satisfied", AppConstants.FALSE).eq("mm.completed", AppConstants.TRUE).isNull("ma.appeal_state");
} else {
queryWrapper.eq(StrUtil.isNotBlank(mailQuery.getAppealState()), "ma.appeal_state", mailQuery.getAppealState());
}

10
mailbox-lan/src/test/java/com/biutag/lan/JsonTest.java

@ -5,6 +5,9 @@ import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import org.junit.jupiter.api.Test;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
import java.util.Map;
@ -12,10 +15,9 @@ public class JsonTest {
@Test
public void testJson() {
Map<String, String> map = new HashMap<>();
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(map));
JSONArray jsonArray = jsonObject.getJSONArray("a");
System.out.println();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
LocalDate parse = LocalDate.parse("20230915", formatter);
System.out.println(parse.atStartOfDay());
}
}

162
mailbox-lan/src/test/java/com/biutag/lan/SpringBootMailImportTest.java

@ -0,0 +1,162 @@
package com.biutag.lan;
import cn.hutool.core.date.DateUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.excel.read.listener.ReadListener;
import com.alibaba.excel.util.ListUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.biutag.constants.AppConstants;
import com.biutag.entity.setting.DictData;
import com.biutag.entity.system.Dept;
import com.biutag.lan.domain.Mail;
import com.biutag.lan.domain.MailMark;
import com.biutag.lan.domain.MailSource;
import com.biutag.lan.mapper.MailMapper;
import com.biutag.lan.mapper.MailMarkMapper;
import com.biutag.lan.mapper.MailSourceMapper;
import com.biutag.lan.service.IDictDataService;
import com.biutag.lan.service.MailService;
import com.biutag.mapper.setting.DictDataMapper;
import com.biutag.mapper.system.DeptMapper;
import jakarta.annotation.Resource;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
@SpringBootTest
public class SpringBootMailImportTest {
@Resource
private MailService mailService;
@Resource
private MailMapper mailMapper;
@Resource
private MailSourceMapper mailSourceMapper;
@Resource
private MailMarkMapper mailMarkMapper;
@Resource
private DictDataMapper dictDataMapper;
@Resource
private DeptMapper deptMapper;
@Test
public void test() {
ExcelListener excelListener = new ExcelListener();
EasyExcel.read("D:\\deploy\\线下台账(0116).xlsx", excelListener).sheet().doRead();
List<LinkedHashMap<Integer, String>> dataList = excelListener.getDataList();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
System.out.println(dataList);
LocalDateTime now = LocalDateTime.now();
// mail mail_souce mail_mark
for (int i = 1; i < 2; i++) {
LinkedHashMap<Integer, String> map = dataList.get(i);
MailSource mailSource = new MailSource();
DictData dictData = dictDataMapper.selectOne(new LambdaQueryWrapper<DictData>().eq(DictData::getName, map.get(1)).eq(DictData::getTypeId, 7));
System.out.println(dictData.getValue());
Integer seqVal = mailMapper.getMailIdSeqVal();
int length = 6 - seqVal.toString().length();
StringBuilder zeroString = new StringBuilder();
for (int j = 0; j < length; j++) {
zeroString.append('0');
}
String id = map.get(2) + "0000" + dictData.getRemark() + zeroString + seqVal;
LocalDateTime mailTime = LocalDate.parse(map.get(2), formatter).atStartOfDay();
mailSource.setId(id).setContactName(map.get(3)).setContactPhone(map.get(4)).setContent(map.get(7))
.setMailTime(mailTime).setCreateTime(now).setSignFlag(true).setAttachments("[]");
Dept dept = deptMapper.selectOne(new QueryWrapper<Dept>().eq("name", map.get(6)));
Dept pDept = deptMapper.selectById(dept.getPid());
Mail mail = mailSource.toMail()
.setMailLevel("一般信件")
.setMailCategory(map.get(11))
.setMailFirstCategory(map.get(9))
.setMailSecondCategory(map.get(10))
.setMailThreeCategory(map.get(11))
.setSecondDeptId(dept.getPid())
.setSecondDeptName(pDept.getName())
.setThreeDeptId(dept.getId())
.setThreeDeptName(dept.getName())
.setCreateTime(now)
.setUpdateTime(now)
.setFlowKey("completion")
.setFlowName("已办结")
.setMailState("completion")
.setSimpleFlowFlag(false)
.setExtensionFlag(false)
.setSource(dictData.getValue())
.setQualifiedProcessingStatus("合格")
.setProblemSolvingStatus(true)
.setSatisfactionStatus(map.get(12).equals("满意") || "申诉通过".equals(map.get(13)) ? "非常满意" : "不满意");
MailMark mailMark = new MailMark();
mailMark.setMailId(id).setCompleted(AppConstants.TRUE)
.setResolved(AppConstants.TRUE)
.setSatisfied(map.get(12).equals("满意") || "申诉通过".equals(map.get(13)) ?AppConstants.TRUE : AppConstants.FALSE)
.setThreeDeptName(dept.getName())
.setThreeDeptId(dept.getId())
.setSecondDeptId(dept.getPid())
.setSecondDeptName(pDept.getName())
.setCompletionTime(mailTime.plusDays(4))
.setSignTimeout(false)
.setContactWriterTimeout(false)
.setProcessTimeout(false);
mailSourceMapper.insert(mailSource);
mailService.save(mail);
mailMarkMapper.insert(mailMark);
}
}
@Setter
@Getter
public static class DemoData {
@ExcelProperty(index= 0)
private String orderNo;
@ExcelProperty(index= 1)
private String source;
@ExcelProperty(index= 2)
private String date;
@ExcelProperty(index= 3)
private String contactName;
@ExcelProperty(index= 4)
private String contactPhone;
}
static class ExcelListener extends AnalysisEventListener<LinkedHashMap<Integer, String>> {
@Getter
private List<LinkedHashMap<Integer, String>> dataList = new ArrayList<>();
@Override
public void invoke(LinkedHashMap<Integer, String> data, AnalysisContext context) {
dataList.add(data); // 将每行数据存入列表
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
System.out.println("All data has been read.");
// 在此处可以对 dataList 中的数据进行处理
}
}
}

41
mailbox-outer-admin/pom.xml

@ -84,4 +84,45 @@
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>application.yml</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<finalName>mailbox-outer-admin</finalName>
</build>
</project>

2
mailbox-outer-admin/src/main/resources/application.yml

@ -2,7 +2,7 @@ server:
port: 8083
tongweb:
license:
path: license/license.dat
path: classpath:license/license.dat
spring:
datasource:

1
mailbox-outer-admin/src/main/resources/license/license.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