Browse Source

1. 局长信箱(内网端) 自建信件

2. 完善配置
dev_ycq
wxc 2 years ago
parent
commit
a4e23b1e68
  1. 2
      mailbox-common/src/main/java/com/biutag/config/Minio.java
  2. 5
      mailbox-lan/src/main/java/com/biutag/lan/controller/MailController.java
  3. 18
      mailbox-lan/src/main/java/com/biutag/lan/domain/MailSource.java
  4. 16
      mailbox-lan/src/main/java/com/biutag/lan/domain/bo/MailOuter.java
  5. 5
      mailbox-lan/src/main/java/com/biutag/lan/mapper/MailMapper.java
  6. 22
      mailbox-lan/src/main/java/com/biutag/lan/service/MailService.java
  7. 2
      mailbox-outer/src/main/java/com/biutag/outer/domain/bo/MailBo.java
  8. 3
      mailbox-outer/src/main/java/com/biutag/outer/service/MailService.java

2
mailbox-common/src/main/java/com/biutag/config/Minio.java

@ -6,6 +6,7 @@ import com.biutag.exception.MinioOperateException;
import com.biutag.util.IOUtil; import com.biutag.util.IOUtil;
import io.minio.*; import io.minio.*;
import io.minio.errors.*; import io.minio.errors.*;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
@ -16,6 +17,7 @@ import java.security.NoSuchAlgorithmException;
import java.util.Date; import java.util.Date;
import java.util.Optional; import java.util.Optional;
@ConditionalOnProperty(value = "oss.minio.enable")
public class Minio { public class Minio {
private final MinioClient minioClient; private final MinioClient minioClient;

5
mailbox-lan/src/main/java/com/biutag/lan/controller/MailController.java

@ -6,6 +6,7 @@ import com.biutag.core.AjaxResult;
import com.biutag.lan.domain.MailSource; import com.biutag.lan.domain.MailSource;
import com.biutag.lan.domain.bo.FlowAction; import com.biutag.lan.domain.bo.FlowAction;
import com.biutag.lan.domain.bo.InvalidCompletion; import com.biutag.lan.domain.bo.InvalidCompletion;
import com.biutag.lan.domain.bo.MailOuter;
import com.biutag.lan.domain.bo.MailSourceBo; import com.biutag.lan.domain.bo.MailSourceBo;
import com.biutag.lan.domain.vo.MailFlowDetail; import com.biutag.lan.domain.vo.MailFlowDetail;
import com.biutag.lan.service.MailService; import com.biutag.lan.service.MailService;
@ -30,8 +31,8 @@ public class MailController {
@NotPower @NotPower
@PostMapping("add") @PostMapping("add")
public AjaxResult<Boolean> add(@RequestBody @Valid MailSourceBo mailBo) { public AjaxResult<Boolean> add(@RequestBody @Valid MailOuter mail) {
return AjaxResult.success(mailService.save(mailBo)); return AjaxResult.success(mailService.save(mail));
} }
@NotPower @NotPower

18
mailbox-lan/src/main/java/com/biutag/lan/domain/MailSource.java

@ -87,10 +87,26 @@ public class MailSource {
@AllArgsConstructor @AllArgsConstructor
public enum Source { public enum Source {
MAILBOX("mailbox"); MAILBOX("mailbox", "XXWW"),
REPORT_COMPLAINTS("110_report_complaints", "JBTS"),
HOTLINE("12345_mayor's_hotline", "SZRX"),
RED_NETWORK_POLITICS("red_network_politics", "HWWZ"),
CREATE_YOUR_OWN_LETTERS("create_your_own_letters", "ZJXJ");
@Getter @Getter
private String value; private String value;
@Getter
private String key;
public static Source get(String value) {
for (Source source : values()) {
if (source.getValue().equals(value)) {
return source;
}
}
return null;
}
} }
} }

16
mailbox-lan/src/main/java/com/biutag/lan/domain/bo/MailOuter.java

@ -1,8 +1,12 @@
package com.biutag.lan.domain.bo; package com.biutag.lan.domain.bo;
import com.biutag.lan.domain.MailSource; import com.biutag.lan.domain.MailSource;
import com.biutag.validator.annotation.IdCard;
import com.biutag.validator.annotation.Phone;
import jakarta.validation.constraints.NotBlank;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.hibernate.validator.constraints.Length;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@ -19,21 +23,25 @@ public class MailOuter {
/** /**
* 联系人姓名 * 联系人姓名
*/ */
@NotBlank(message = "请输入联系人姓名")
private String contactName; private String contactName;
/** /**
* 联系人性别 M / F * 联系人性别 M / F
*/ */
@NotBlank(message = "请选择联系人性别")
private String contactSex; private String contactSex;
/** /**
* 联系人身份证号 * 联系人身份证号
*/ */
@IdCard
private String contactIdCard; private String contactIdCard;
/** /**
* 联系人手机号 * 联系人手机号
*/ */
@Phone
private String contactPhone; private String contactPhone;
/** /**
@ -44,6 +52,8 @@ public class MailOuter {
/** /**
* 内容 * 内容
*/ */
@Length(min= 10, max = 300, message = "信件内容不符合规范(不少于10字,不多于300字)")
@NotBlank(message = "请输入信件内容")
private String content; private String content;
/** /**
@ -60,20 +70,24 @@ public class MailOuter {
* 来信时间 * 来信时间
*/ */
private LocalDateTime mailTime; private LocalDateTime mailTime;
/** /**
* 涉及单位ID * 涉及单位ID
*/ */
private Integer involvedDeptId; private Integer involvedDeptId;
/** /**
* 涉及单位名称 * 涉及单位名称
*/ */
private String involvedDeptName; private String involvedDeptName;
private String source = MailSource.Source.MAILBOX.getValue();
public MailSource toMailSource() { public MailSource toMailSource() {
MailSource mailSource = new MailSource(); MailSource mailSource = new MailSource();
BeanUtils.copyProperties(this, mailSource); BeanUtils.copyProperties(this, mailSource);
mailSource.setMailTime(createTime); mailSource.setMailTime(createTime);
mailSource.setSource(MailSource.Source.MAILBOX.getValue());
mailSource.setCreateTime(LocalDateTime.now()); mailSource.setCreateTime(LocalDateTime.now());
mailSource.setSignFlag(false); mailSource.setSignFlag(false);
return mailSource; return mailSource;

5
mailbox-lan/src/main/java/com/biutag/lan/mapper/MailMapper.java

@ -2,6 +2,11 @@ package com.biutag.lan.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.biutag.lan.domain.Mail; import com.biutag.lan.domain.Mail;
import org.apache.ibatis.annotations.Select;
public interface MailMapper extends BaseMapper<Mail> { public interface MailMapper extends BaseMapper<Mail> {
@Select("SELECT nextval('mail_id_seq') ")
Integer getMailIdSeqVal();
} }

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

@ -13,7 +13,7 @@ import com.biutag.lan.AdminThreadLocal;
import com.biutag.lan.domain.*; import com.biutag.lan.domain.*;
import com.biutag.lan.domain.bo.FlowAction; import com.biutag.lan.domain.bo.FlowAction;
import com.biutag.lan.domain.bo.InvalidCompletion; import com.biutag.lan.domain.bo.InvalidCompletion;
import com.biutag.lan.domain.bo.MailSourceBo; import com.biutag.lan.domain.bo.MailOuter;
import com.biutag.lan.domain.vo.MailApprovalVo; import com.biutag.lan.domain.vo.MailApprovalVo;
import com.biutag.lan.domain.vo.MailFlowDetail; import com.biutag.lan.domain.vo.MailFlowDetail;
import com.biutag.lan.domain.vo.MailVo; import com.biutag.lan.domain.vo.MailVo;
@ -291,7 +291,23 @@ public class MailService extends ServiceImpl<MailMapper, Mail> {
return true; return true;
} }
public boolean save(MailSourceBo mailBo) { public boolean save(MailOuter mail) {
return false; LocalDateTime now = LocalDateTime.now();
mail.setId(generateMailId(mail.getSource()));
mail.setMailTime(now);
mail.setCreateTime(now);
return mailSourceService.saveBatch(Collections.singletonList(mail));
}
public String generateMailId(String source) {
Integer seqVal = baseMapper.getMailIdSeqVal();
int length = 6 - seqVal.toString().length();
StringBuilder zeroString = new StringBuilder();
for (int i = 0; i < length; i++) {
zeroString.append('0');
} }
// XXWW 信箱外网
return DateUtil.format(new Date(), "yyyyMMddHHMM") + MailSource.Source.get(source).getKey() + zeroString + seqVal;
}
} }

2
mailbox-outer/src/main/java/com/biutag/outer/domain/bo/MailBo.java

@ -29,7 +29,7 @@ public class MailBo {
/** /**
* 联系人性别 * 联系人性别
*/ */
@NotBlank(message = "请选择联系人称呼") @NotBlank(message = "请选择联系人性别")
private String contactSex; private String contactSex;
/** /**

3
mailbox-outer/src/main/java/com/biutag/outer/service/MailService.java

@ -62,7 +62,8 @@ public class MailService extends ServiceImpl<MailMapper, Mail> {
for (int i = 0; i < length; i++) { for (int i = 0; i < length; i++) {
zeroString.append('0'); zeroString.append('0');
} }
return DateUtil.format(new Date(), "yyyyMMddHHMM") + zeroString + seqVal; // XXWW 信箱外网
return DateUtil.format(new Date(), "yyyyMMddHHMM") + "XXWW" + zeroString + seqVal;
} }
public Page<MailVo> pageByCurrentUserId(Page<Mail> page) { public Page<MailVo> pageByCurrentUserId(Page<Mail> page) {

Loading…
Cancel
Save