diff --git a/mailbox-lan/src/main/java/com/biutag/lan/controller/ApiV1Controller.java b/mailbox-lan/src/main/java/com/biutag/lan/controller/ApiV1Controller.java index 0b0c659..0c36784 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/controller/ApiV1Controller.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/controller/ApiV1Controller.java @@ -12,18 +12,17 @@ import com.biutag.entity.system.Holiday; import com.biutag.enums.ErrorEnum; import com.biutag.exception.AuthException; import com.biutag.exception.BusinessException; +import com.biutag.lan.domain.Hot; import com.biutag.lan.domain.Mail; import com.biutag.lan.domain.MailMark; import com.biutag.lan.domain.MailSource; import com.biutag.lan.domain.bo.HolidayV1Req; +import com.biutag.lan.domain.bo.HotApiV1Req; import com.biutag.lan.domain.bo.MailApiV1Req; import com.biutag.lan.domain.bo.MailEvaluateApiV1Req; import com.biutag.lan.enums.MailCategory; import com.biutag.lan.enums.MailState; -import com.biutag.lan.service.HolidayService; -import com.biutag.lan.service.MailMarkService; -import com.biutag.lan.service.MailService; -import com.biutag.lan.service.MailSourceService; +import com.biutag.lan.service.*; import com.biutag.util.IOUtil; import jakarta.servlet.http.HttpServletRequest; import jakarta.validation.Valid; @@ -47,6 +46,8 @@ public class ApiV1Controller { private final MailSourceService mailSourceService; + private final HotService hotService; + private final MailService mailService; private final MailMarkService mailMarkService; @@ -145,4 +146,14 @@ public class ApiV1Controller { } } + @PostMapping("hot") + public AjaxResult addHot(@RequestBody @Valid HotApiV1Req hot, HttpServletRequest request) { + validAuth(request); + if (hotService.exists(new LambdaQueryWrapper().eq(Hot::getId, hot.getId()))) { + return AjaxResult.success(); + } + hotService.saveBatch(Collections.singletonList(hot.toHot())); + return AjaxResult.success(); + } + } diff --git a/mailbox-lan/src/main/java/com/biutag/lan/controller/HotController.java b/mailbox-lan/src/main/java/com/biutag/lan/controller/HotController.java new file mode 100644 index 0000000..ac84ba0 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/controller/HotController.java @@ -0,0 +1,84 @@ +package com.biutag.lan.controller; + +import cn.hutool.core.date.DateUtil; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.biutag.aop.NotPower; +import com.biutag.core.AjaxResult; +import com.biutag.lan.domain.Hot; +import com.biutag.lan.domain.Report; +import com.biutag.lan.domain.bo.MailOuter; +import com.biutag.lan.domain.vo.ReportOptionsVO; +import com.biutag.lan.mapper.MailMapper; +import com.biutag.lan.service.HotService; +import com.biutag.lan.service.ReportService; +import com.biutag.lan.validate.system.HotSearchValidate; +import com.biutag.lan.validate.system.ReportSearchValidate; +import jakarta.validation.Valid; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; + +import java.text.ParseException; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Date; +import java.util.List; +import java.util.Map; + +@RequiredArgsConstructor +@RequestMapping("/api/hot") +@RestController +public class HotController { + private final HotService hotService; + private final MailMapper mailMapper; + @NotPower + @GetMapping("list") + public AjaxResult> list(Page page, HotSearchValidate searchValidate) throws ParseException { + Page list = hotService.getlist(page, searchValidate); + return AjaxResult.success(list); + } + @NotPower + @PostMapping("addIntoMail") + public AjaxResult addIntoMail(@RequestBody Map hot) { + return AjaxResult.success(hotService.addIntoMail(hot.get("id"))); + } + @NotPower + @PostMapping("addIntoBadMail") + public AjaxResult addIntoBadMail(@RequestBody Map report) { + return AjaxResult.success(hotService.addIntoBadMail(report.get("id"),report.get("reason"))); + } + @NotPower + @GetMapping("detail") + public AjaxResult detail(String id) { + Hot hot = hotService.getdetail(id); + return AjaxResult.success(hot); + } + @NotPower + @PostMapping("add") + public AjaxResult add(@RequestBody Map hot) { + Hot newhot = new Hot(); + newhot.setId(generateMailId()); + newhot.setCreateTime(LocalDateTime.now()); + newhot.setCaseType(hot.get("caseType").toString()); + newhot.setContactIdCard(hot.get("contactIdCard").toString()); + newhot.setContactName(hot.get("contactName").toString()); + newhot.setContent(hot.get("content").toString()); + DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + newhot.setPhoneTime(LocalDateTime.parse(hot.get("phoneTime").toString(),dateFormat)); + newhot.setContactType(hot.get("contactType").toString()); + newhot.setContactPhone(hot.get("contactPhone").toString()); + newhot.setSource(hot.get("source").toString()); + newhot.setHotStatus("initial"); + return AjaxResult.success(hotService.save(newhot)); + } + + public String generateMailId() { + Integer seqVal = mailMapper.getMailIdSeqVal(); + int length = 6 - seqVal.toString().length(); + StringBuilder zeroString = new StringBuilder(); + for (int i = 0; i < length; i++) { + zeroString.append('0'); + } + // HOT 12345市长热线 + return DateUtil.format(new Date(), "yyyyMMddHHMM") + "HOT" + zeroString + seqVal; + } +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/domain/Hot.java b/mailbox-lan/src/main/java/com/biutag/lan/domain/Hot.java new file mode 100644 index 0000000..0728f30 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/domain/Hot.java @@ -0,0 +1,119 @@ +package com.biutag.lan.domain; + +import com.baomidou.mybatisplus.annotation.TableId; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +import java.time.LocalDateTime; +import java.util.Date; + +@Accessors(chain = true) +@Setter +@Getter +public class Hot { + @TableId + private String id; + + /** + * 联系人姓名 + */ + private String contactName; + + /** + * 联系人性别 + */ + private String contactSex; + + /** + * 联系人身份证号码 + */ + private String contactIdCard; + + /** + * 联系人手机号码 + */ + private String contactPhone; + + /** + * 案件编号 + */ + private String caseNumber; + + /** + * 内容 + */ + private String content; + + /** + * 附件 + */ + private String attachments; + + /** + * 用户ID + */ + private Integer userId; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 更新时间 + */ + private LocalDateTime updateTime; + + + +// /** +// * 评价 +// */ +// private String evaluate; + + /** + * 是否满意 + */ + private String satisfaction; + + /** + * 信件状态 + */ + private String mailState; + + + /** + * 涉及单位ID + */ + private Integer involvedDeptId; + + /** + * 涉及单位名称 + */ + private String involvedDeptName; + + /** + * 来电时间 + */ + private LocalDateTime phoneTime; + + /** + * 来源 + */ + private String source; + + /** + * 话务类型 + */ + private String contactType; + + /** + * 案件类型 + */ + private String caseType; + /** + * 是否转入状态 + */ + private String hotStatus; +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/domain/HotAndMail.java b/mailbox-lan/src/main/java/com/biutag/lan/domain/HotAndMail.java new file mode 100644 index 0000000..69b60c2 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/domain/HotAndMail.java @@ -0,0 +1,21 @@ +package com.biutag.lan.domain; + +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + + +@Accessors(chain = true) +@Setter +@Getter + +@TableName("mail_hot_mapping") +public class HotAndMail { + private String id; + + private String mailid; + + private String hotid; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/domain/bo/HotApiV1Req.java b/mailbox-lan/src/main/java/com/biutag/lan/domain/bo/HotApiV1Req.java new file mode 100644 index 0000000..c52e136 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/domain/bo/HotApiV1Req.java @@ -0,0 +1,137 @@ +package com.biutag.lan.domain.bo; + +import com.alibaba.fastjson2.annotation.JSONField; +import com.biutag.lan.domain.Hot; +import com.biutag.lan.domain.MailSource; +import com.biutag.validator.annotation.IdCard; +import com.biutag.validator.annotation.Phone; +import com.fasterxml.jackson.annotation.JsonFormat; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Getter; +import lombok.Setter; +import org.hibernate.validator.constraints.Length; +import org.springframework.beans.BeanUtils; + +import java.time.LocalDateTime; +import java.util.Date; + +@Setter +@Getter +public class HotApiV1Req { + + @NotBlank + private String id; + + /** + * 联系人姓名 + */ + @NotBlank(message = "请输入联系人姓名") + private String contactName; + + /** + * 联系人性别 + */ + private String contactSex; + + /** + * 联系人身份证号码 + */ + private String contactIdCard; + + /** + * 联系人手机号码 + */ + private String contactPhone; + + /** + * 案件编号 + */ + private String caseNumber; + + /** + * 内容 + */ + private String content; + + /** + * 附件 + */ + private String attachments; + + /** + * 用户ID + */ + private Integer userId; + + /** + * 创建时间 + */ + @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + /** + * 更新时间 + */ + @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + + + +// /** +// * 评价 +// */ +// private String evaluate; + + /** + * 是否满意 + */ + private String satisfaction; + + /** + * 信件状态 + */ + private String mailState; + + + /** + * 涉及单位ID + */ + private Integer involvedDeptId; + + /** + * 涉及单位名称 + */ + private String involvedDeptName; + + /** + * 来电时间 + */ + @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime phoneTime; + + /** + * 来源 + */ + private String source; + + /** + * 话务类型 + */ + private String contactType; + + /** + * 案件类型 + */ + private String caseType; + /** + * 是否转入状态 + */ + private String hotStatus; + + public Hot toHot() { + Hot hot = new Hot(); + BeanUtils.copyProperties(this, hot); + return hot; + } +} \ No newline at end of file diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/DataSyncScheduler.java b/mailbox-lan/src/main/java/com/biutag/lan/job/DataSyncScheduler.java similarity index 94% rename from mailbox-lan/src/main/java/com/biutag/lan/service/DataSyncScheduler.java rename to mailbox-lan/src/main/java/com/biutag/lan/job/DataSyncScheduler.java index da0f1b0..5b89539 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/service/DataSyncScheduler.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/job/DataSyncScheduler.java @@ -1,4 +1,4 @@ -package com.biutag.lan.service; +package com.biutag.lan.job; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; diff --git a/mailbox-lan/src/main/java/com/biutag/lan/mapper/HotAndMailMapper.java b/mailbox-lan/src/main/java/com/biutag/lan/mapper/HotAndMailMapper.java new file mode 100644 index 0000000..1e1cfb9 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/mapper/HotAndMailMapper.java @@ -0,0 +1,11 @@ +package com.biutag.lan.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.biutag.lan.domain.HotAndMail; +import com.biutag.lan.domain.ReportAndMail; + + +public interface HotAndMailMapper extends BaseMapper { + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/mapper/HotMapper.java b/mailbox-lan/src/main/java/com/biutag/lan/mapper/HotMapper.java new file mode 100644 index 0000000..9b67a80 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/mapper/HotMapper.java @@ -0,0 +1,9 @@ +package com.biutag.lan.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.biutag.lan.domain.Hot; + +public interface HotMapper extends BaseMapper { + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/mapper/ReportMapper.java b/mailbox-lan/src/main/java/com/biutag/lan/mapper/ReportMapper.java index 7ffb666..03599b4 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/mapper/ReportMapper.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/mapper/ReportMapper.java @@ -4,7 +4,6 @@ package com.biutag.lan.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.biutag.lan.domain.Report; - public interface ReportMapper extends BaseMapper { } diff --git a/mailbox-lan/src/main/java/com/biutag/lan/service/HotService.java b/mailbox-lan/src/main/java/com/biutag/lan/service/HotService.java new file mode 100644 index 0000000..685de1a --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/service/HotService.java @@ -0,0 +1,137 @@ +package com.biutag.lan.service; + +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpResponse; +import cn.hutool.http.HttpUtil; +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.biutag.exception.BusinessException; +import com.biutag.lan.domain.*; +import com.biutag.lan.domain.bo.FlowAction; +import com.biutag.lan.domain.bo.MailOuter; +//import com.biutag.lan.domain.vo.HotOptionsVO; +import com.biutag.lan.mapper.HotAndMailMapper; +import com.biutag.lan.mapper.HotMapper; +//import com.biutag.lan.mapper.HotAndMailMapper; +//import com.biutag.lan.mapper.HotLogMapper; +import com.biutag.lan.mapper.HotMapper; +import com.biutag.lan.validate.system.HotSearchValidate; +import com.biutag.lan.validate.system.HotSearchValidate; +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; +import jakarta.annotation.Resource; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import java.lang.reflect.Type; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +@Slf4j +@RequiredArgsConstructor +@Service +public class HotService extends ServiceImpl { + @Resource + MailService mailService; + @Resource + MailSourceService mailSourceService; + HotAndMailMapper hotAndMailMapper; +// @Resource +// HotLogMapper reportLogMapper; +// @Resource +// HotAndMailMapper reportAndMailMapper; + + public Page getlist(Page page, HotSearchValidate searchValidate) { + QueryWrapper queryWrapper = new QueryWrapper() + .ge(StrUtil.isNotBlank(searchValidate.getSearchStartTime()), "phone_time", searchValidate.getSearchStartTime()) + .le(StrUtil.isNotBlank(searchValidate.getSearchEndTime()), "phone_time", searchValidate.getSearchEndTime()) + .eq(StrUtil.isNotBlank(searchValidate.getContactName()), "contact_name", searchValidate.getContactName()) + .eq(StrUtil.isNotBlank(searchValidate.getId()), "id", searchValidate.getId()) + .eq(StrUtil.isNotBlank(searchValidate.getSource()), "source",searchValidate.getSource()) + .eq(StrUtil.isNotBlank(searchValidate.getContactType()), "contact_type",searchValidate.getContactType()) + .eq(StrUtil.isNotBlank(searchValidate.getCaseType()), "case_type",searchValidate.getCaseType()) + .like(StrUtil.isNotBlank(searchValidate.getContactIdCard()), "contact_id_card", searchValidate.getContactIdCard()) + .like(StrUtil.isNotBlank(searchValidate.getContactPhone()), "contact_phone", searchValidate.getContactPhone()) + .eq("hot_status","initial"); + List list = baseMapper.selectList(page,queryWrapper); + Page dataVoPage = new Page<>(); + dataVoPage.setRecords(list); + dataVoPage.setTotal(page.getTotal()); + dataVoPage.setCurrent(page.getCurrent()); + dataVoPage.setSize(page.getSize()); + dataVoPage.setPages(page.getPages()); + return dataVoPage; + } + + + public Hot getdetail(String id) { + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper().eq(Hot::getId,id); + Hot hot = baseMapper.selectOne(lambdaQueryWrapper); + return hot; + } + + + + + public Boolean addIntoMail(Object id) { + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper().eq(Hot::getId,id.toString()); + Hot hot = baseMapper.selectOne(lambdaQueryWrapper); + MailOuter mail = new MailOuter(); + mail.setSource(MailSource.Source.HOTLINE.getValue()); + mail.setContactName(hot.getContactName()); + mail.setContent(hot.getContent()); + mail.setContactPhone(hot.getContactPhone()); + LocalDateTime now = LocalDateTime.now(); + mail.setId(mailService.generateMailId(mail.getSource())); + mail.setMailTime(now); + mail.setCreateTime(now); + HotAndMail hotAndMail = new HotAndMail(); + hotAndMail.setHotid(id.toString()); + hotAndMail.setMailid(mail.getId()); + hotAndMailMapper.insert(hotAndMail); + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.eq("id", id.toString()).set("hot_status", "into"); + baseMapper.update(updateWrapper); + return mailSourceService.saveBatch(Collections.singletonList(mail)); + } + + public Boolean addIntoBadMail(Object id,Object reason) { + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper().eq(Hot::getId,id.toString()); + Hot hot = baseMapper.selectOne(lambdaQueryWrapper); + MailOuter mail = new MailOuter(); + mail.setSource(MailSource.Source.HOTLINE.getValue()); + mail.setContactName(hot.getContactName()); + mail.setContent(hot.getContent()); + mail.setContactPhone(hot.getContactPhone()); + mail.setContactPhone(hot.getContactPhone()); + LocalDateTime now = LocalDateTime.now(); + mail.setId(mailService.generateMailId(mail.getSource())); + mail.setMailTime(now); + mail.setCreateTime(now); + HotAndMail hotAndMail = new HotAndMail(); + hotAndMail.setHotid(id.toString()); + hotAndMail.setMailid(mail.getId()); + hotAndMailMapper.insert(hotAndMail); + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.eq("id", id.toString()).set("hot_status", "reject"); + baseMapper.update(updateWrapper); + mailSourceService.saveBatch(Collections.singletonList(mail)); + FlowAction flowAction = new FlowAction(); + flowAction.setFlowKey("first_sign"); + flowAction.setMailId(mail.getId()); + String jsonString = "{\"mailFirstCategory\":\"无效类\",\"mailSecondCategory\":null,\"mailThreeCategory\":null,\"mailCategory\":\"无效类\",\"invalidationReason\":\""+reason.toString()+"\"}"; + JSONObject jsonObject = JSONObject.parseObject(jsonString); + flowAction.setData(jsonObject); + flowAction.setNextActionKey("confirmedCompletion"); + return mailService.next(flowAction); + } +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/validate/system/HotSearchValidate.java b/mailbox-lan/src/main/java/com/biutag/lan/validate/system/HotSearchValidate.java new file mode 100644 index 0000000..b8b4b28 --- /dev/null +++ b/mailbox-lan/src/main/java/com/biutag/lan/validate/system/HotSearchValidate.java @@ -0,0 +1,125 @@ +package com.biutag.lan.validate.system; + +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.Date; + +@Data +@ApiModel("通知搜素参数") +public class HotSearchValidate implements Serializable { + + private static final long serialVersionUID = 1L; + //编号 + private String id; + @ApiModelProperty(value = "时间") + private String searchTime; + + @ApiModelProperty(value = "起始时间") + private String searchStartTime; + + @ApiModelProperty(value = "结束时间") + private String searchEndTime; + /** + * 联系人姓名 + */ + private String contactName; + + /** + * 联系人性别 + */ + private String contactSex; + + /** + * 联系人身份证号码 + */ + private String contactIdCard; + + /** + * 联系人手机号码 + */ + private String contactPhone; + + /** + * 案件编号 + */ + private String caseNumber; + + /** + * 内容 + */ + private String content; + + /** + * 附件 + */ + private String attachments; + + /** + * 用户ID + */ + private Integer userId; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 更新时间 + */ + private Date updateTime; + + + +// /** +// * 评价 +// */ +// private String evaluate; + + /** + * 是否满意 + */ + private String satisfaction; + + /** + * 信件状态 + */ + private String mailState; + + + /** + * 涉及单位ID + */ + private Integer involvedDeptId; + + /** + * 涉及单位名称 + */ + private String involvedDeptName; + + /** + * 来电时间 + */ + private Date phoneTime; + + /** + * 来源 + */ + private String source; + + /** + * 话务类型 + */ + private String contactType; + + /** + * 案件类型 + */ + private String caseType; + +} diff --git a/mailbox-lan/src/main/java/com/biutag/lan/validate/system/ReportSearchValidate.java b/mailbox-lan/src/main/java/com/biutag/lan/validate/system/ReportSearchValidate.java index 3c6bfba..c6ae409 100644 --- a/mailbox-lan/src/main/java/com/biutag/lan/validate/system/ReportSearchValidate.java +++ b/mailbox-lan/src/main/java/com/biutag/lan/validate/system/ReportSearchValidate.java @@ -18,10 +18,10 @@ public class ReportSearchValidate implements Serializable { @ApiModelProperty(value = "话终时间") private String searchTime; - @ApiModelProperty(value = "话终时间") + @ApiModelProperty(value = "起始时间") private String searchStartTime; - @ApiModelProperty(value = "话终时间") + @ApiModelProperty(value = "结束时间") private String searchEndTime; @ApiModelProperty(value = "报警类型") diff --git a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/OuterAdminApplication.java b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/OuterAdminApplication.java index 7cc116c..adf9e4a 100644 --- a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/OuterAdminApplication.java +++ b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/OuterAdminApplication.java @@ -2,7 +2,9 @@ package com.biutag.outeradmin; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.scheduling.annotation.EnableScheduling; +@EnableScheduling @SpringBootApplication public class OuterAdminApplication { diff --git a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/controller/MailController.java b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/controller/MailController.java index 9e167de..19b7269 100644 --- a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/controller/MailController.java +++ b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/controller/MailController.java @@ -10,6 +10,7 @@ import com.biutag.exception.BusinessException; import com.biutag.outeradmin.dto.*; import com.biutag.outeradmin.entity.*; import com.biutag.outeradmin.mapper.MailMapper; +import com.biutag.outeradmin.service.HotService; import com.biutag.outeradmin.service.MailService; import com.biutag.outeradmin.util.DesensitizedUtil; import com.biutag.outeradmin.util.ExcelUtil; @@ -20,6 +21,7 @@ import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; import java.io.IOException; +import java.text.ParseException; import java.util.List; @RequiredArgsConstructor @@ -28,7 +30,7 @@ import java.util.List; public class MailController { private final MailService mailService; private final MailMapper mailMapper; - + private final HotService hotService; /** * 查询所有信件 * @@ -47,10 +49,10 @@ public class MailController { } @PostMapping("add") - public AjaxResult add(@RequestBody String form) { + public AjaxResult add(@RequestBody String form) throws ParseException { JSONObject jsonObject = JSON.parseObject(form); JSONObject mailBo = jsonObject.getJSONObject("MailBo"); - return AjaxResult.success(mailService.save(mailBo)); + return AjaxResult.success(hotService.save(mailBo)); } diff --git a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/controller/UserController.java b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/controller/UserController.java index 27d73d5..9022c34 100644 --- a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/controller/UserController.java +++ b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/controller/UserController.java @@ -75,13 +75,10 @@ public class UserController { LocalDateTime createTime = LocalDateTime.now(); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - try { - user.setCreateTime(simpleDateFormat.parse(createTime.format(formatter))); - userMapper.insert(user); - return "success"; - } catch (ParseException e) { - throw new RuntimeException(e); - } + user.setCreateTime(LocalDateTime.now()); + userService.save(user); + return "success"; + } @RequestMapping("/delete-user") diff --git a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/dto/MailVo.java b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/dto/MailVo.java new file mode 100644 index 0000000..864c6be --- /dev/null +++ b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/dto/MailVo.java @@ -0,0 +1,75 @@ +package com.biutag.outeradmin.dto; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.baomidou.mybatisplus.annotation.TableId; +import lombok.Data; + +import java.time.LocalDateTime; +import java.util.Date; + +@Data +public class MailVo { + @TableId + private String id; + + /** + * 联系人姓名 + */ + @ExcelProperty("联系人姓名") + private String contactName; + + /** + * 联系人性别 + */ + @ExcelProperty("联系人性别") + private String contactSex; + + /** + * 联系人身份证号码 + */ + @ExcelProperty("联系人身份证号码") + private String contactIdCard; + + /** + * 联系人手机号码 + */ + @ExcelProperty("联系人手机号码") + private String contactPhone; + + /** + * 案件编号 + */ + @ExcelProperty("案件编号") + private String caseNumber; + + /** + * 内容 + */ + @ExcelProperty("信件内容") + private String content; + + /** + * 创建时间 + */ + @ExcelProperty("联系人姓名") + private LocalDateTime createTime; + + /** + * 更新时间 + */ + @ExcelProperty("更新时间") + private Date updateTime; + + + /** + * 是否满意 + */ + @ExcelProperty("是否满意") + private String satisfaction; + + /** + * 涉及单位名称 + */ + @ExcelProperty("涉及单位名称") + private String involvedDeptName; +} diff --git a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/entity/Hot.java b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/entity/Hot.java new file mode 100644 index 0000000..401c6a6 --- /dev/null +++ b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/entity/Hot.java @@ -0,0 +1,123 @@ +package com.biutag.outeradmin.entity; + +import com.alibaba.fastjson2.annotation.JSONField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.tongweb.tianfu.json.Json; +import lombok.Data; + +import java.time.LocalDateTime; +import java.util.Date; + +@Data +public class Hot { + @TableId + private String id; + + /** + * 联系人姓名 + */ + private String contactName; + + /** + * 联系人性别 + */ + private String contactSex; + + /** + * 联系人身份证号码 + */ + private String contactIdCard; + + /** + * 联系人手机号码 + */ + private String contactPhone; + + /** + * 案件编号 + */ + private String caseNumber; + + /** + * 内容 + */ + private String content; + + /** + * 附件 + */ + private String attachments; + + /** + * 用户ID + */ + private Integer userId; + + /** + * 创建时间 + */ + @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + /** + * 更新时间 + */ + @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss") + + private LocalDateTime updateTime; + + + +// /** +// * 评价 +// */ +// private String evaluate; + + /** + * 是否满意 + */ + private String satisfaction; + + /** + * 信件状态 + */ + private String mailState; + + + /** + * 涉及单位ID + */ + private Integer involvedDeptId; + + /** + * 涉及单位名称 + */ + private String involvedDeptName; + + /** + * 来电时间 + */ + @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss") + + private LocalDateTime phoneTime; + + /** + * 来源 + */ + private String source; + + /** + * 话务类型 + */ + private String contactType; + + /** + * 案件类型 + */ + private String caseType; + /** + * 是否转入状态 + */ + private String hotStatus; +} diff --git a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/entity/HotEtl.java b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/entity/HotEtl.java new file mode 100644 index 0000000..7f0eee7 --- /dev/null +++ b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/entity/HotEtl.java @@ -0,0 +1,29 @@ +package com.biutag.outeradmin.entity; + +import com.alibaba.fastjson2.annotation.JSONField; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +import java.time.LocalDateTime; + +@Accessors(chain = true) +@Setter +@Getter +public class HotEtl { + + @TableId(type = IdType.AUTO) + private String id; + + private String hotId; + + private Boolean success; + @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + private String errMsg; + +} diff --git a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/entity/User.java b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/entity/User.java index cd59426..9ba00e9 100644 --- a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/entity/User.java +++ b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/entity/User.java @@ -14,7 +14,7 @@ public class User { private Integer id; private String openid; private String nickName; - private Date createTime; + private LocalDateTime createTime; private String idCard; private String realName; private String phone; diff --git a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/job/Job.java b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/job/Job.java new file mode 100644 index 0000000..abcdd4d --- /dev/null +++ b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/job/Job.java @@ -0,0 +1,80 @@ +package com.biutag.outeradmin.job; + +import cn.hutool.core.util.StrUtil; +import cn.hutool.crypto.digest.MD5; +import cn.hutool.http.HttpResponse; +import cn.hutool.http.HttpUtil; +import cn.hutool.http.Method; +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONObject; +import com.alibaba.fastjson2.JSONWriter; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.biutag.config.Minio; +import com.biutag.entity.system.Holiday; + +import com.biutag.outeradmin.entity.Hot; +import com.biutag.outeradmin.entity.HotEtl; +import com.biutag.outeradmin.mapper.HotEtlMapper; +import com.biutag.outeradmin.mapper.HotMapper; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import java.time.LocalDateTime; +import java.util.Date; +import java.util.List; +import java.util.Objects; + +@Slf4j +@RequiredArgsConstructor +@Component +public class Job { + + private final HotMapper hotMapper; + + private final HotEtlMapper hotEtlMapper; + + @Value("${mailbox.url}") + private String mailboxUrl; + + private final String key = "mailbox"; + + + /** + * 推送12345热线数据 + */ + @Scheduled(fixedRate = 30000) + public void pushHotData() { + System.out.println(LocalDateTime.now()); + List hots = hotMapper.listByHotEtl(); + for (Hot hot : hots) { + try { + long timestamp = new Date().getTime(); + HttpResponse httpResponse = HttpUtil.createPost(mailboxUrl + "hot") + .header("timestamp", String.valueOf(timestamp)) + .auth(MD5.create().digestHex(key + timestamp)) + .body(JSON.toJSONString(hot)) + .execute(); + if (!httpResponse.isOk()) { + log.error("推送12345热线数据异常,body: {}", httpResponse.body()); + throw new RuntimeException(String.format("httpCode: %s", httpResponse.getStatus())); + } + log.info("推送12345热线数据返回结果:{}", httpResponse.body()); + JSONObject response = JSONObject.parseObject(httpResponse.body()); + if (response.getInteger("code") != 200) { + throw new RuntimeException(response.getString("msg")); + } + HotEtl hotEtl = new HotEtl().setHotId(hot.getId()).setSuccess(true).setCreateTime(LocalDateTime.now()); + hotEtlMapper.insert(hotEtl); + } catch (RuntimeException e) { + log.error("推送信件[{}]异常: {}", hot.getId(), e.getMessage(), e); + HotEtl hotEtl = new HotEtl().setHotId(hot.getId()).setSuccess(false).setCreateTime(LocalDateTime.now()).setErrMsg(e.getMessage()); + hotEtlMapper.insert(hotEtl); + } + } + } + +} diff --git a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/mapper/HotEtlMapper.java b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/mapper/HotEtlMapper.java new file mode 100644 index 0000000..bfdb6eb --- /dev/null +++ b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/mapper/HotEtlMapper.java @@ -0,0 +1,10 @@ +package com.biutag.outeradmin.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +import com.biutag.outeradmin.entity.HotEtl; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface HotEtlMapper extends BaseMapper { +} diff --git a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/mapper/HotMapper.java b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/mapper/HotMapper.java new file mode 100644 index 0000000..04115fb --- /dev/null +++ b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/mapper/HotMapper.java @@ -0,0 +1,15 @@ +package com.biutag.outeradmin.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.biutag.outeradmin.entity.Hot; +import com.biutag.outeradmin.entity.Mail; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Select; + +import java.util.List; + +@Mapper +public interface HotMapper extends BaseMapper { + @Select("select h.* from hot h left join hot_etl etl on h.id = etl.hot_id where etl.id is null") + List listByHotEtl(); +} diff --git a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/service/HotService.java b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/service/HotService.java new file mode 100644 index 0000000..06e067d --- /dev/null +++ b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/service/HotService.java @@ -0,0 +1,88 @@ +package com.biutag.outeradmin.service; + +import cn.hutool.core.date.DateUtil; +import com.alibaba.fastjson2.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.biutag.outeradmin.entity.Hot; +import com.biutag.outeradmin.entity.User; +import com.biutag.outeradmin.enums.MailStateEnum; +import com.biutag.outeradmin.mapper.HotMapper; +import com.biutag.outeradmin.mapper.MailMapper; +import com.biutag.outeradmin.mapper.UserMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.time.LocalDateTime; +import java.util.Date; + +@Service +public class HotService extends ServiceImpl { + public final UserService userService; + public final MailMapper mailMapper; + + public HotService(UserService userService, MailMapper mailMapper) { + this.userService = userService; + this.mailMapper = mailMapper; + } + + @Transactional(rollbackFor = Exception.class) + public boolean save(JSONObject mailBo) throws ParseException { +// HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); +// String authorization = request.getHeader("Authorization"); +// String jwtToken = null; +// if (authorization.startsWith("Bearer ")) { +// jwtToken = authorization.substring(7); // 7是"Bearer "的长度 +// } +// Claims claims = JwtUtil.parsePayload(jwtToken); +// String phone = claims.get("username").toString(); + Hot hot = new Hot(); + hot.setId(generateMailId()); + hot.setCreateTime(LocalDateTime.now()); + hot.setContactName(mailBo.getString("contactName")); + hot.setCaseNumber(mailBo.getString("caseNumber")); + hot.setContactPhone(mailBo.getString("contactPhone")); + hot.setContactIdCard(mailBo.getString("contactIdCard")); + hot.setContent(mailBo.getString("content")); + hot.setPhoneTime(LocalDateTime.parse(mailBo.getString("phoneTime"))); + hot.setContactType(mailBo.getString("contactType")); + hot.setCaseType(mailBo.getString("caseType")); + hot.setSource(mailBo.getString("source")); + hot.setContactSex(mailBo.getString("contactSex")); + hot.setHotStatus("initial"); +// hot.setAttachments(mailBo.getString("attachments")); +// if (!mailBo.getString("involvedDeptId").equals("")){ +// hot.setInvolvedDeptId(Integer.parseInt(mailBo.getString("involvedDeptId"))); +// hot.setInvolvedDeptName(mailBo.getString("involvedDeptName")); +// } +// QueryWrapper queryWrapper = new QueryWrapper<>(); +// queryWrapper.eq("phone",mailBo.getString("contactPhone")); +// User user = userService.getOne(queryWrapper, false); +// if (user == null) { +// user = new User(); +// user.setPhone(mailBo.getString("contactPhone")); +// user.setCreateTime(LocalDateTime.now()); +// userService.save(user); +// } +// hot.setUserId(user.getId()); +// hot.setMailState(MailStateEnum.processing.getValue()); + baseMapper.insert(hot); + return true; + } + + public String generateMailId() { + Integer seqVal = mailMapper.getMailIdSeqVal(); + int length = 6 - seqVal.toString().length(); + StringBuilder zeroString = new StringBuilder(); + for (int i = 0; i < length; i++) { + zeroString.append('0'); + } + // HOT 12345市长热线 + return DateUtil.format(new Date(), "yyyyMMddHHMM") + "HOT" + zeroString + seqVal; + } + + +} diff --git a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/service/MailService.java b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/service/MailService.java index 212ada2..52195ee 100644 --- a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/service/MailService.java +++ b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/service/MailService.java @@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil; import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.biutag.outeradmin.entity.Hot; import com.biutag.outeradmin.entity.Mail; import com.biutag.outeradmin.entity.User; import com.biutag.outeradmin.enums.MailStateEnum; @@ -17,59 +18,4 @@ import java.util.Date; @Service public class MailService extends ServiceImpl { - public final UserService userService; - - public MailService(UserService userService) { - this.userService = userService; - } - - @Transactional(rollbackFor = Exception.class) - public boolean save(JSONObject mailBo) { - // HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - // 获取请求头的值 -// String authorization = request.getHeader("Authorization"); -// String jwtToken = null; -// if (authorization.startsWith("Bearer ")) { -// // 截取并去掉"Bearer "前缀,得到JWT令牌 -// jwtToken = authorization.substring(7); // 7是"Bearer "的长度 -// } -// Claims claims = JwtUtil.parsePayload(jwtToken); -// String phone = claims.get("username").toString(); - Mail mail = new Mail(); - mail.setId(generateMailId()); - mail.setCreateTime(LocalDateTime.now()); - mail.setContactName(mailBo.getString("contactName")); - mail.setAttachments(mailBo.getString("attachments")); - mail.setCaseNumber(mailBo.getString("caseNumber")); - mail.setContactPhone(mailBo.getString("contactPhone")); - mail.setContactIdCard(mailBo.getString("contactIdCard")); - mail.setContactSex(mailBo.getString("contactSex")); - mail.setContent(mailBo.getString("content")); - mail.setInvolvedDeptId(Integer.parseInt(mailBo.getString("involvedDeptId"))); - mail.setInvolvedDeptName(mailBo.getString("involvedDeptName")); - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("phone",mailBo.getString("contactPhone")); - User user = userService.getOne(queryWrapper, false); - if (user == null){ - return false; - } - mail.setUserId(user.getId()); - mail.setMailState(MailStateEnum.processing.getValue()); - boolean save = save(mail); -// boolean save = true; - return save; - } - - public String generateMailId() { - 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") + "XXWW" + zeroString + seqVal; - } - - } diff --git a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/util/ExcelUtil.java b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/util/ExcelUtil.java index d03b99d..82eebbf 100644 --- a/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/util/ExcelUtil.java +++ b/mailbox-outer-admin/src/main/java/com/biutag/outeradmin/util/ExcelUtil.java @@ -6,11 +6,15 @@ package com.biutag.outeradmin.util; import com.alibaba.excel.EasyExcel; import com.alibaba.excel.ExcelWriter; +import com.alibaba.excel.write.builder.ExcelWriterBuilder; +import com.alibaba.excel.write.builder.ExcelWriterSheetBuilder; import com.alibaba.excel.write.metadata.WriteSheet; import com.alibaba.excel.write.metadata.fill.FillConfig; import com.alibaba.excel.write.metadata.fill.FillWrapper; +import com.biutag.outeradmin.dto.MailVo; import com.biutag.outeradmin.entity.Mail; import jakarta.servlet.http.HttpServletResponse; +import org.springframework.beans.BeanUtils; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; @@ -18,6 +22,7 @@ import org.springframework.core.io.Resource; import java.io.IOException; import java.io.InputStream; +import java.io.OutputStream; import java.text.SimpleDateFormat; import java.util.*; @@ -26,37 +31,51 @@ public class ExcelUtil { public static void exportExcel(HttpServletResponse response,List mailPage) throws IOException { // 模板文件 // String templateFile = "/excelmodel.xlsx"; - Resource resource = new ClassPathResource("excelmodel.xlsx"); - InputStream is = resource.getInputStream(); // long date = new Date().getTime(); + List list = new ArrayList<>(); + for (Mail mail : mailPage) { + MailVo mailVo = new MailVo(); + BeanUtils.copyProperties(mail, mailVo); + list.add(mailVo); + } Calendar calendar = Calendar.getInstance(); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - System.out.println(formatter.format(calendar.getTime())); - String name = formatter.format(calendar.getTime())+".xlsx"; + String name = formatter.format(calendar.getTime()) + ".xlsx"; String fileName = new String(name.getBytes()); response.setContentType("application/octet-stream"); response.setCharacterEncoding("utf8"); response.setHeader("Content-disposition", "attachment;filename=" + fileName); + try (OutputStream out = response.getOutputStream()) { + ExcelWriter excelWriter = EasyExcel.write(out).inMemory(Boolean.TRUE).build(); + WriteSheet writeSheet = EasyExcel.writerSheet("局长信箱即接即办信件列表").head(MailVo.class).automaticMergeHead(true).build(); + excelWriter.write(list, writeSheet); + excelWriter.finish(); + } catch (Exception e) { + if (!response.isCommitted()) { + response.reset(); + response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); + response.getWriter().write("Failed to export data due to an internal error."); + } + } // 根据模板文件生成目标文件 - ExcelWriter excelWriter = EasyExcel - .write(response.getOutputStream(), Mail.class) - .withTemplate(is) - // 单独设置单元格格式 -// .registerWriteHandler(new CellStyleHandler()) - .build(); - WriteSheet writeSheet = EasyExcel.writerSheet().build(); - // 每次都会重新生成新的一行,而不是使用下面的空行 - FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build(); - // 第一种占位符替换 -// Map map = new HashMap(); -// map.put("reportDate", reportDate); -// excelWriter.fill(map, writeSheet); - // 第二种占位符替换,这里定义了 hisData - System.out.println(mailPage); - excelWriter.fill(new FillWrapper("mailPage",mailPage),fillConfig, writeSheet); - excelWriter.finish(); - } - +// ExcelWriter excelWriter = EasyExcel +// .write(response.getOutputStream(), Mail.class) +// .withTemplate(is) +// // 单独设置单元格格式 +//// .registerWriteHandler(new CellStyleHandler()) +// .build(); +// WriteSheet writeSheet = EasyExcel.writerSheet().build(); +// // 每次都会重新生成新的一行,而不是使用下面的空行 +// FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build(); +// // 第一种占位符替换 +//// Map map = new HashMap(); +//// map.put("reportDate", reportDate); +//// excelWriter.fill(map, writeSheet); +// // 第二种占位符替换,这里定义了 hisData +// System.out.println(mailPage); +// excelWriter.fill(new FillWrapper("mailPage",mailPage),fillConfig, writeSheet); +// excelWriter.finish(); +// } // // private static List mailData(){ // List resList = new ArrayList<>(); @@ -71,6 +90,6 @@ public class ExcelUtil { // return resList; // } - + } } diff --git a/mailbox-outer-admin/src/main/resources/application.yml b/mailbox-outer-admin/src/main/resources/application.yml index d0e0610..f972295 100644 --- a/mailbox-outer-admin/src/main/resources/application.yml +++ b/mailbox-outer-admin/src/main/resources/application.yml @@ -18,4 +18,7 @@ oss: endpoint: http://172.31.217.20:31401 accessKey: n8yPVAJk4yw879zi secretKey: eElQ7gCwuNxaFhKEbtRRq0lsovoOTgI1 - bucketName: mailbox \ No newline at end of file + bucketName: mailbox + +mailbox: + url: http://127.0.0.1:8082/v1/ \ No newline at end of file