26 changed files with 1141 additions and 99 deletions
@ -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<Page<Hot>> list(Page page, HotSearchValidate searchValidate) throws ParseException { |
||||
Page<Hot> list = hotService.getlist(page, searchValidate); |
||||
return AjaxResult.success(list); |
||||
} |
||||
@NotPower |
||||
@PostMapping("addIntoMail") |
||||
public AjaxResult<Boolean> addIntoMail(@RequestBody Map<String,Object> hot) { |
||||
return AjaxResult.success(hotService.addIntoMail(hot.get("id"))); |
||||
} |
||||
@NotPower |
||||
@PostMapping("addIntoBadMail") |
||||
public AjaxResult<Boolean> addIntoBadMail(@RequestBody Map<String,Object> report) { |
||||
return AjaxResult.success(hotService.addIntoBadMail(report.get("id"),report.get("reason"))); |
||||
} |
||||
@NotPower |
||||
@GetMapping("detail") |
||||
public AjaxResult<Hot> detail(String id) { |
||||
Hot hot = hotService.getdetail(id); |
||||
return AjaxResult.success(hot); |
||||
} |
||||
@NotPower |
||||
@PostMapping("add") |
||||
public AjaxResult<Boolean> add(@RequestBody Map<String,Object> 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; |
||||
} |
||||
} |
||||
@ -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; |
||||
} |
||||
@ -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; |
||||
|
||||
} |
||||
@ -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; |
||||
} |
||||
} |
||||
@ -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; |
||||
@ -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<HotAndMail> { |
||||
|
||||
} |
||||
@ -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<Hot> { |
||||
|
||||
} |
||||
@ -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<HotMapper, Hot> { |
||||
@Resource |
||||
MailService mailService; |
||||
@Resource |
||||
MailSourceService mailSourceService; |
||||
HotAndMailMapper hotAndMailMapper; |
||||
// @Resource
|
||||
// HotLogMapper reportLogMapper;
|
||||
// @Resource
|
||||
// HotAndMailMapper reportAndMailMapper;
|
||||
|
||||
public Page<Hot> getlist(Page page, HotSearchValidate searchValidate) { |
||||
QueryWrapper<Hot> queryWrapper = new QueryWrapper<Hot>() |
||||
.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<Hot> list = baseMapper.selectList(page,queryWrapper); |
||||
Page<Hot> 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<Hot> lambdaQueryWrapper = new LambdaQueryWrapper<Hot>().eq(Hot::getId,id); |
||||
Hot hot = baseMapper.selectOne(lambdaQueryWrapper); |
||||
return hot; |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
public Boolean addIntoMail(Object id) { |
||||
LambdaQueryWrapper<Hot> lambdaQueryWrapper = new LambdaQueryWrapper<Hot>().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<Hot> 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<Hot> lambdaQueryWrapper = new LambdaQueryWrapper<Hot>().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<Hot> 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); |
||||
} |
||||
} |
||||
@ -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; |
||||
|
||||
} |
||||
@ -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; |
||||
} |
||||
@ -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; |
||||
} |
||||
@ -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; |
||||
|
||||
} |
||||
@ -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<Hot> 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); |
||||
} |
||||
} |
||||
} |
||||
|
||||
} |
||||
@ -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<HotEtl> { |
||||
} |
||||
@ -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<Hot> { |
||||
@Select("select h.* from hot h left join hot_etl etl on h.id = etl.hot_id where etl.id is null") |
||||
List<Hot> listByHotEtl(); |
||||
} |
||||
@ -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<HotMapper, Hot> { |
||||
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<User> 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; |
||||
} |
||||
|
||||
|
||||
} |
||||
Loading…
Reference in new issue