Browse Source

1. 细节完善 2. BUG修复

master
wxc 2 years ago
parent
commit
02c132ac41
  1. 9
      mailbox-common/src/main/java/com/biutag/enums/RoleEnum.java
  2. 6
      mailbox-lan/src/main/java/com/biutag/lan/controller/FileController.java
  3. 2
      mailbox-lan/src/main/java/com/biutag/lan/flow/node/SecondSignFlow.java
  4. 1
      mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeContactWriterFlow.java
  5. 38
      mailbox-lan/src/main/java/com/biutag/lan/service/WorkService.java
  6. 27
      mailbox-lan/src/main/java/com/biutag/lan/service/impl/PoliceUserServiceImpl.java
  7. 3
      mailbox-lan/src/main/java/com/biutag/lan/validate/system/PoliceUserUpdateValidate.java
  8. 2
      mailbox-lan/src/main/java/com/biutag/lan/vo/system/PoliceUserInformVo.java
  9. 37
      mailbox-lan/src/test/java/com/biutag/lan/AESTest.java

9
mailbox-common/src/main/java/com/biutag/enums/RoleEnum.java

@ -29,4 +29,13 @@ public enum RoleEnum {
private String name;
public static RoleEnum get(Integer roleId) {
for (RoleEnum value : values()) {
if (value.getRoleId().equals(roleId)) {
return value;
}
}
return null;
}
}

6
mailbox-lan/src/main/java/com/biutag/lan/controller/FileController.java

@ -47,7 +47,11 @@ public class FileController {
@GetMapping("stream/**")
public void download(HttpServletRequest request, HttpServletResponse response) throws IOException {
String requestURI = request.getRequestURI();
response.setContentType("application/octet-stream");
if (requestURI.toLowerCase().endsWith(".pdf")) {
response.setContentType("application/pdf");
} else {
response.setContentType("application/octet-stream");
}
minio.get(requestURI.substring("/api/file/stream/".length()), response.getOutputStream());
}

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

@ -72,7 +72,7 @@ public class SecondSignFlow extends Flow {
// 主责单位
if (work.getMainDeptFlag()) {
mail.setUpdateTime(now)
.setFlowKey(FlowNodeEnum.FIRST_DISTRIBUTE.getKey())
.setFlowKey(FlowNodeEnum.FIRST_SIGN.getKey())
.setFlowName(FlowNameEnum.MAIL_RETURN.getName());
} else {
JSONObject firstDistributeInfo = JSON.parseObject(mail.getFirstDistributeInfo());

1
mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeContactWriterFlow.java

@ -71,7 +71,6 @@ public class ThreeContactWriterFlow extends Flow {
mail.setFlowKey(FlowNodeEnum.VERIFY.getKey())
.setFlowName(FlowNodeEnum.VERIFY.getFullName());
}
// 更新我的工作
Work work = workService.getOne(mailId, RoleEnum.THREE_DEPT_CLASSES.getRoleId(), AdminThreadLocal.getDeptId());
work.setFlowName(FlowNameEnum.INTERVIEW_WRITER.getName()).setUpdateTime(now);

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

@ -194,17 +194,35 @@ public class WorkService extends ServiceImpl<WorkMapper, Work> {
query.isNull("m.flow_key").or().ne("m.flow_key", FlowNodeEnum.COMPLETION.getKey());
});
Integer roleId = AdminThreadLocal.getRoleId();
Integer deptId = AdminThreadLocal.getDeptId();
String empNo = AdminThreadLocal.getEmpNo();
// 与角色相关的件
if (roleId.equals(RoleEnum.MUNICIPAL_DEPT_CLASSES.getRoleId()) ||
roleId.equals(RoleEnum.SECOND_DEPT_CLASSES.getRoleId()) ||
roleId.equals(RoleEnum.THREE_DEPT_CLASSES.getRoleId())) {
Integer deptId = AdminThreadLocal.getDeptId();
queryWrapper.eq("w.sign_role_id", roleId)
// 如果不是市局专班,则需要查询签收部门ID
.eq(!RoleEnum.MUNICIPAL_DEPT_CLASSES.getRoleId().equals(roleId), "w.sign_dept_id", deptId);
} else {
String empNo = AdminThreadLocal.getEmpNo();
queryWrapper.eq("w.police_emp_no", empNo);
switch (roleId) {
// 市局专班
case 1: {
queryWrapper.eq("w.sign_role_id", roleId);
break;
}
// 二级机构专班
case 2: {
queryWrapper.eq("w.sign_role_id", roleId)
.eq("w.sign_dept_id", deptId);
break;
}
// 三级机构专班
case 3: {
// 三级机构即是领导又是专班的情况
queryWrapper.and(query -> {
query.eq("w.sign_role_id", roleId)
.eq("w.sign_dept_id", deptId)
.or()
.eq("w.police_emp_no", empNo);
});
break;
}
default: {
queryWrapper.eq("w.police_emp_no", empNo);
}
}
if (StrUtil.isNotBlank(todoQuery.getContactField()) && StrUtil.isNotBlank(todoQuery.getContactFieldValue())) {
switch (todoQuery.getContactField()) {

27
mailbox-lan/src/main/java/com/biutag/lan/service/impl/PoliceUserServiceImpl.java

@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.toolkit.Assert;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.biutag.core.PageResult;
import com.biutag.entity.system.*;
import com.biutag.enums.RoleEnum;
import com.biutag.exception.OperateException;
import com.biutag.lan.config.AdminThreadLocal;
import com.biutag.lan.enums.PostEnums;
@ -226,14 +227,22 @@ public class PoliceUserServiceImpl implements IPoliceUserService {
.eq("is_delete", 0)
.eq("id", adminId)
.last("limit 1"));
PoliceUserInformVo policeUserInformVo = new PoliceUserInformVo();
BeanUtils.copyProperties(sysAdmin, policeUserInformVo);
policeUserInformVo.setAvatar(UrlUtils.toAbsoluteUrl(sysAdmin.getAvatar()));
policeUserInformVo.setUpdateTime(TimeUtils.timestampToDate(sysAdmin.getUpdateTime()));
policeUserInformVo.setCreateTime(TimeUtils.timestampToDate(sysAdmin.getCreateTime()));
policeUserInformVo.setLastLoginTime(TimeUtils.timestampToDate(sysAdmin.getLastLoginTime()));
policeUserInformVo.setRoleName(AdminThreadLocal.getRoleName());
PoliceUserInformVo informVo = new PoliceUserInformVo();
BeanUtils.copyProperties(sysAdmin, informVo);
informVo.setAvatar(UrlUtils.toAbsoluteUrl(sysAdmin.getAvatar()));
informVo.setUpdateTime(TimeUtils.timestampToDate(sysAdmin.getUpdateTime()));
informVo.setCreateTime(TimeUtils.timestampToDate(sysAdmin.getCreateTime()));
informVo.setLastLoginTime(TimeUtils.timestampToDate(sysAdmin.getLastLoginTime()));
informVo.setRoleName(AdminThreadLocal.getRoleName());
Integer roleId = AdminThreadLocal.getRoleId();
if (RoleEnum.MUNICIPAL_DEPT_CLASSES.getRoleId().equals(roleId)) {
informVo.setFullName(String.format("市局专班 %s", informVo.getName()));
} else if(RoleEnum.SECOND_DEPT_CLASSES.getRoleId().equals(roleId) ||
RoleEnum.THREE_DEPT_CLASSES.getRoleId().equals(roleId)) {
informVo.setFullName(String.format("%s专班 %s", informVo.getDeptName(), informVo.getName()));
} else {
informVo.setFullName(String.format("%s %s", informVo.getDeptName(), informVo.getName()));
}
// 角色权限
List<String> auths = new LinkedList<>();
@ -265,7 +274,7 @@ public class PoliceUserServiceImpl implements IPoliceUserService {
// 返回数据
PoliceUserSelvesVo vo = new PoliceUserSelvesVo();
vo.setUser(policeUserInformVo);
vo.setUser(informVo);
vo.setPermissions(auths);
return vo;
}

3
mailbox-lan/src/main/java/com/biutag/lan/validate/system/PoliceUserUpdateValidate.java

@ -32,9 +32,6 @@ public class PoliceUserUpdateValidate implements Serializable {
@ApiModelProperty(value = "姓名", required = true)
private String name;
@NotEmpty(message = "手机号不能为空")
@Length(min = 2, max = 30, message = "手机号必须在2~30个字符内")
@ApiModelProperty(value = "手机号", required = true)
private String mobile;

2
mailbox-lan/src/main/java/com/biutag/lan/vo/system/PoliceUserInformVo.java

@ -54,4 +54,6 @@ public class PoliceUserInformVo implements Serializable {
private String name;
private String fullName;
}

37
mailbox-lan/src/test/java/com/biutag/lan/AESTest.java

@ -8,7 +8,9 @@ import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.spec.SecretKeySpec;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
@ -18,7 +20,7 @@ import java.util.Map;
public class AESTest {
public static void main(String[] args) throws InvalidKeyException, IllegalBlockSizeException, BadPaddingException, NoSuchPaddingException, NoSuchAlgorithmException {
public static void main(String[] args) throws InvalidKeyException, IllegalBlockSizeException, BadPaddingException, NoSuchPaddingException, NoSuchAlgorithmException, UnsupportedEncodingException {
Map<String,Object> datamap = new HashMap<>();
datamap.put("timeStamp", "1709208164");
datamap.put("mobiles", "15608487213");
@ -27,24 +29,33 @@ public class AESTest {
datamap.put("appendID", "");
datamap.put("sendTime", "");
datamap.put("validTime", "");
String key = "fzzd12345678dxpt"; // 16字节密钥
SecretKeySpec secretKeySpec = new SecretKeySpec(key.getBytes(), "AES");
// 创建AES加密实例
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
String s = "{\"timeStamp\":\"1709208164\",\"orderNo\":\"TEST001\",\"mobiles\":\"15608487213\",\"appendID\":\"\",\"validTime\":\"\",\"content\":\"123\",\"sendTime\":\"\"}";
// 加密
cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec);
byte[] encryptedBytes = cipher.doFinal(Base64.getEncoder().encodeToString(JSON.toJSONString(datamap).getBytes(StandardCharsets.UTF_8)).getBytes());
// Base64编码加密后的数据
String base64Encoded = Base64.getEncoder().encodeToString(encryptedBytes);
System.out.println(base64Encoded);
String encrypt = encrypt(s);
System.out.println(encrypt);
System.out.println("---------------------------------------");
String s1 = "dk0vL%2FHI%2FMgeyko9w%2F2buBdoNASCWHQLuc0VdNhlEPotf8P%2Fr%2F7iP9srgLBRnrignGZCXWeaZ8cf%0D%0AqexHGp4GO7LTM0tEg9IwOEOJdMJIbuF1qcdjr%2Fb8OqeLkpNP1Ai6UevoO6fcNoZ0yBOHceS8zZ%2Ba%0D%0Ak8fQtrgakYQV7KszrVOz%2B9EcGPFGLfWmFCsFwK1P8hPqywvtpZprdXSj4d2NrnhWCbt%2BZVt9GX2u%0D%0AAPRkQuYQAmNFFGZM1iF0Jx2vt%2BoN";
System.out.println(URLDecoder.decode(s1));
System.out.println(URLDecoder.decode(s1, "UTF-8"));
}
public static String encrypt(String val) {
try {
// 加密
String key = "fzzd12345678dxpt"; // 16字节密钥
SecretKeySpec secretKeySpec = new SecretKeySpec(key.getBytes(), "AES");
// 创建AES加密实例
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec);
byte[] encryptedBytes = cipher.doFinal(Base64.getEncoder().encodeToString(val.getBytes()).getBytes());
// Base64编码加密后的数据
String base64Encoded = Base64.getEncoder().encodeToString(encryptedBytes);
return base64Encoded;
} catch (NoSuchPaddingException | IllegalBlockSizeException | NoSuchAlgorithmException | BadPaddingException |
InvalidKeyException e) {
throw new RuntimeException(e);
}
}
}

Loading…
Cancel
Save