|
|
|
@ -15,9 +15,11 @@ import com.biutag.lan.domain.MailLabel; |
|
|
|
import com.biutag.lan.domain.MailSource; |
|
|
|
import com.biutag.lan.domain.MailSource; |
|
|
|
import com.biutag.lan.domain.Work; |
|
|
|
import com.biutag.lan.domain.Work; |
|
|
|
import com.biutag.lan.domain.bo.MailQuery; |
|
|
|
import com.biutag.lan.domain.bo.MailQuery; |
|
|
|
|
|
|
|
import com.biutag.lan.domain.vo.QueryMailVo; |
|
|
|
import com.biutag.lan.domain.vo.WorkVo; |
|
|
|
import com.biutag.lan.domain.vo.WorkVo; |
|
|
|
import com.biutag.lan.enums.WorkType; |
|
|
|
import com.biutag.lan.enums.WorkType; |
|
|
|
import com.biutag.lan.mapper.MailLabelMapper; |
|
|
|
import com.biutag.lan.mapper.MailLabelMapper; |
|
|
|
|
|
|
|
import com.biutag.lan.mapper.MailMapper; |
|
|
|
import com.biutag.lan.mapper.WorkMapper; |
|
|
|
import com.biutag.lan.mapper.WorkMapper; |
|
|
|
import jakarta.annotation.Resource; |
|
|
|
import jakarta.annotation.Resource; |
|
|
|
import jakarta.servlet.http.HttpServletResponse; |
|
|
|
import jakarta.servlet.http.HttpServletResponse; |
|
|
|
@ -44,6 +46,9 @@ public class WorkService extends ServiceImpl<WorkMapper, Work> { |
|
|
|
@Resource |
|
|
|
@Resource |
|
|
|
private WorkMapper workMapper; |
|
|
|
private WorkMapper workMapper; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
|
|
private MailMapper mailMapper; |
|
|
|
|
|
|
|
|
|
|
|
public boolean saveBatch(List<MailSource> mailSources) { |
|
|
|
public boolean saveBatch(List<MailSource> mailSources) { |
|
|
|
LocalDateTime now = LocalDateTime.now(); |
|
|
|
LocalDateTime now = LocalDateTime.now(); |
|
|
|
List<Work> list = mailSources.stream().map(mail -> { |
|
|
|
List<Work> list = mailSources.stream().map(mail -> { |
|
|
|
@ -268,52 +273,40 @@ public class WorkService extends ServiceImpl<WorkMapper, Work> { |
|
|
|
return list(new LambdaQueryWrapper<Work>().eq(Work::getMailId, mailId).eq(Work::getSignRoleId, roleId).eq(Work::getWorkType, workType)); |
|
|
|
return list(new LambdaQueryWrapper<Work>().eq(Work::getMailId, mailId).eq(Work::getSignRoleId, roleId).eq(Work::getWorkType, workType)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public Page<WorkVo> queryPage(Page<Work> page, MailQuery todoQuery) { |
|
|
|
public Page<QueryMailVo> queryPage(Page<Mail> page, MailQuery mailQuery) { |
|
|
|
QueryWrapper<Work> queryWrapper = new QueryWrapper<Work>() |
|
|
|
QueryWrapper<Mail> queryWrapper = new QueryWrapper<Mail>() |
|
|
|
.ge(StrUtil.isNotBlank(todoQuery.getMailTimeStart()), "TO_CHAR(m.mail_time, 'YYYY-MM-DD')", todoQuery.getMailTimeStart()) |
|
|
|
.ge(StrUtil.isNotBlank(mailQuery.getMailTimeStart()), "TO_CHAR(m.mail_time, 'YYYY-MM-DD')", mailQuery.getMailTimeStart()) |
|
|
|
.le(StrUtil.isNotBlank(todoQuery.getMailTimeStartEnd()), "TO_CHAR(m.mail_time, 'YYYY-MM-DD')", todoQuery.getMailTimeStartEnd()) |
|
|
|
.le(StrUtil.isNotBlank(mailQuery.getMailTimeStartEnd()), "TO_CHAR(m.mail_time, 'YYYY-MM-DD')", mailQuery.getMailTimeStartEnd()) |
|
|
|
.eq(StrUtil.isNotBlank(todoQuery.getSource()), "m.source", todoQuery.getSource()) |
|
|
|
.eq(StrUtil.isNotBlank(mailQuery.getSource()), "m.source", mailQuery.getSource()) |
|
|
|
.eq(StrUtil.isNotBlank(todoQuery.getMailLevel()), "m.mail_level", todoQuery.getMailLevel()) |
|
|
|
.eq(StrUtil.isNotBlank(mailQuery.getMailLevel()), "m.mail_level", mailQuery.getMailLevel()) |
|
|
|
.eq(StrUtil.isNotBlank(todoQuery.getMailCategory()), "m.mail_category", todoQuery.getMailCategory()) |
|
|
|
.eq(StrUtil.isNotBlank(mailQuery.getMailCategory()), "m.mail_category", mailQuery.getMailCategory()) |
|
|
|
.like(StrUtil.isNotBlank(todoQuery.getThreeDeptName()), "m.three_dept_name", todoQuery.getThreeDeptName()) |
|
|
|
.like(StrUtil.isNotBlank(mailQuery.getThreeDeptName()), "m.three_dept_name", mailQuery.getThreeDeptName()) |
|
|
|
.eq(StrUtil.isNotBlank(todoQuery.getFlowKey()), "m.flow_key", todoQuery.getFlowKey()); |
|
|
|
.eq(StrUtil.isNotBlank(mailQuery.getFlowKey()), "m.flow_key", mailQuery.getFlowKey()); |
|
|
|
if (StrUtil.isNotBlank(todoQuery.getMailLabels())) { |
|
|
|
if (StrUtil.isNotBlank(mailQuery.getMailLabels())) { |
|
|
|
List<String> labelIds = todoQuery.handleMailLabels(); |
|
|
|
List<String> labelIds = mailQuery.handleMailLabels(); |
|
|
|
for (String labelId : labelIds) { |
|
|
|
for (String labelId : labelIds) { |
|
|
|
queryWrapper.like("m.mail_labels", labelId); |
|
|
|
queryWrapper.like("m.mail_labels", labelId); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
Integer roleId = AdminThreadLocal.getRoleId(); |
|
|
|
roleCheck(queryWrapper); |
|
|
|
// 与角色相关的件
|
|
|
|
if (StrUtil.isNotBlank(mailQuery.getContactField()) && StrUtil.isNotBlank(mailQuery.getContactFieldValue())) { |
|
|
|
if (roleId.equals(RoleEnum.MUNICIPAL_DEPT_CLASSES.getRoleId()) || |
|
|
|
switch (mailQuery.getContactField()) { |
|
|
|
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); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (StrUtil.isNotBlank(todoQuery.getContactField()) && StrUtil.isNotBlank(todoQuery.getContactFieldValue())) { |
|
|
|
|
|
|
|
switch (todoQuery.getContactField()) { |
|
|
|
|
|
|
|
case "name": |
|
|
|
case "name": |
|
|
|
queryWrapper.like("w.contact_name", todoQuery.getContactFieldValue()); |
|
|
|
queryWrapper.like("w.contact_name", mailQuery.getContactFieldValue()); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case "idCard": |
|
|
|
case "idCard": |
|
|
|
queryWrapper.like("w.contactIdCard", todoQuery.getContactFieldValue()); |
|
|
|
queryWrapper.like("w.contact_idCard", mailQuery.getContactFieldValue()); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case "phone": |
|
|
|
case "phone": |
|
|
|
queryWrapper.like("w.contactPhone", todoQuery.getContactFieldValue()); |
|
|
|
queryWrapper.like("w.contactPhone", mailQuery.getContactFieldValue()); |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
// 排序
|
|
|
|
// 排序
|
|
|
|
queryWrapper.orderByDesc("w.update_time"); |
|
|
|
queryWrapper.orderByDesc("w.update_time"); |
|
|
|
Page<WorkVo> result = baseMapper.selectPageTodo(page, queryWrapper); |
|
|
|
Page<QueryMailVo> result = baseMapper.selectQueryPage(page, queryWrapper); |
|
|
|
for (WorkVo workVo : result.getRecords()) { |
|
|
|
for (QueryMailVo workVo : result.getRecords()) { |
|
|
|
List<MailLabel> labelNames = mailLabelMapper.selectList(null); |
|
|
|
List<MailLabel> labelNames = mailLabelMapper.selectList(null); |
|
|
|
if (StrUtil.isNotBlank(workVo.getMailLabels())) { |
|
|
|
if (StrUtil.isNotBlank(workVo.getMailLabels())) { |
|
|
|
String[] labelIds = workVo.getMailLabels().split(","); |
|
|
|
String[] labelIds = workVo.getMailLabels().split(","); |
|
|
|
@ -331,28 +324,56 @@ public class WorkService extends ServiceImpl<WorkMapper, Work> { |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void export(HttpServletResponse response, String dataWorkVo) throws IOException { |
|
|
|
public void export(HttpServletResponse response, String ids) throws IOException { |
|
|
|
List<WorkVo> data = JSON.parseArray(dataWorkVo, WorkVo.class); |
|
|
|
List<String> data = JSON.parseArray(ids, String.class); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Mail> mailList = mailMapper.selectBatchIds(data); |
|
|
|
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
|
|
|
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
|
|
|
response.setCharacterEncoding("utf-8"); |
|
|
|
response.setCharacterEncoding("utf-8"); |
|
|
|
// 这里URLEncoder.encode可以防止中文乱码
|
|
|
|
// 这里URLEncoder.encode可以防止中文乱码
|
|
|
|
String fileName = URLEncoder.encode("测试", "UTF-8").replaceAll("\\+", "%20"); |
|
|
|
String fileName = URLEncoder.encode("测试", "UTF-8").replaceAll("\\+", "%20"); |
|
|
|
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx"); |
|
|
|
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx"); |
|
|
|
EasyExcel.write(response.getOutputStream(), WorkVo.class).sheet("模板").doWrite(data); |
|
|
|
EasyExcel.write(response.getOutputStream(), Mail.class).sheet("模板").doWrite(mailList); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public Page<WorkVo> dissatisfied(Page<Work> page, MailQuery todoQuery) { |
|
|
|
public Page<QueryMailVo> dissatisfied(Page<Mail> page, MailQuery mailQuery) { |
|
|
|
QueryWrapper<Work> queryWrapper = new QueryWrapper<Work>() |
|
|
|
QueryWrapper<Mail> queryWrapper = new QueryWrapper<Mail>() |
|
|
|
.ge(StrUtil.isNotBlank(todoQuery.getMailTimeStart()), "TO_CHAR(m.mail_time, 'YYYY-MM-DD')", todoQuery.getMailTimeStart()) |
|
|
|
.ge(StrUtil.isNotBlank(mailQuery.getMailTimeStart()), "TO_CHAR(m.mail_time, 'YYYY-MM-DD')", mailQuery.getMailTimeStart()) |
|
|
|
.le(StrUtil.isNotBlank(todoQuery.getMailTimeStartEnd()), "TO_CHAR(m.mail_time, 'YYYY-MM-DD')", todoQuery.getMailTimeStartEnd()) |
|
|
|
.le(StrUtil.isNotBlank(mailQuery.getMailTimeStartEnd()), "TO_CHAR(m.mail_time, 'YYYY-MM-DD')", mailQuery.getMailTimeStartEnd()) |
|
|
|
.eq(StrUtil.isNotBlank(todoQuery.getSource()), "m.source", todoQuery.getSource()) |
|
|
|
.eq(StrUtil.isNotBlank(mailQuery.getSource()), "m.source", mailQuery.getSource()) |
|
|
|
.eq(StrUtil.isNotBlank(todoQuery.getMailLevel()), "m.mail_level", todoQuery.getMailLevel()) |
|
|
|
.eq(StrUtil.isNotBlank(mailQuery.getMailLevel()), "m.mail_level", mailQuery.getMailLevel()) |
|
|
|
.eq(StrUtil.isNotBlank(todoQuery.getMailCategory()), "m.mail_category", todoQuery.getMailCategory()) |
|
|
|
.eq(StrUtil.isNotBlank(mailQuery.getMailCategory()), "m.mail_category", mailQuery.getMailCategory()) |
|
|
|
.like(StrUtil.isNotBlank(todoQuery.getThreeDeptName()), "m.three_dept_name", todoQuery.getThreeDeptName()) |
|
|
|
.like(StrUtil.isNotBlank(mailQuery.getThreeDeptName()), "m.three_dept_name", mailQuery.getThreeDeptName()) |
|
|
|
// .eq(StrUtil.isNotBlank(todoQuery.getAppealState()), "m.appeal_state", todoQuery.getAppealState())
|
|
|
|
// .eq(StrUtil.isNotBlank(todoQuery.getAppealState()), "m.appeal_state", todoQuery.getAppealState())
|
|
|
|
.eq("m.satisfaction_status", "不满意") |
|
|
|
.eq("m.satisfaction_status", "不满意") |
|
|
|
.or() |
|
|
|
.or() |
|
|
|
.eq("m.verify_feedback", "不满意"); |
|
|
|
.eq("m.verify_feedback", "不满意"); |
|
|
|
|
|
|
|
roleCheck(queryWrapper); |
|
|
|
|
|
|
|
if (StrUtil.isNotBlank(mailQuery.getContactField()) && StrUtil.isNotBlank(mailQuery.getContactFieldValue())) { |
|
|
|
|
|
|
|
switch (mailQuery.getContactField()) { |
|
|
|
|
|
|
|
case "name": |
|
|
|
|
|
|
|
queryWrapper.like("w.contact_name", mailQuery.getContactFieldValue()); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case "idCard": |
|
|
|
|
|
|
|
queryWrapper.like("w.contactIdCard", mailQuery.getContactFieldValue()); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case "phone": |
|
|
|
|
|
|
|
queryWrapper.like("w.contactPhone", mailQuery.getContactFieldValue()); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 排序
|
|
|
|
|
|
|
|
queryWrapper.orderByDesc("w.update_time"); |
|
|
|
|
|
|
|
return baseMapper.selectQueryPage(page, queryWrapper); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 信件查询检查权限并显示 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param queryWrapper |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private void roleCheck(QueryWrapper<Mail> queryWrapper) { |
|
|
|
Integer roleId = AdminThreadLocal.getRoleId(); |
|
|
|
Integer roleId = AdminThreadLocal.getRoleId(); |
|
|
|
// 与角色相关的件
|
|
|
|
// 与角色相关的件
|
|
|
|
if (roleId.equals(RoleEnum.MUNICIPAL_DEPT_CLASSES.getRoleId()) || |
|
|
|
if (roleId.equals(RoleEnum.MUNICIPAL_DEPT_CLASSES.getRoleId()) || |
|
|
|
@ -362,32 +383,24 @@ public class WorkService extends ServiceImpl<WorkMapper, Work> { |
|
|
|
queryWrapper.eq("w.sign_role_id", roleId) |
|
|
|
queryWrapper.eq("w.sign_role_id", roleId) |
|
|
|
// 如果不是市局专班,则需要查询签收部门ID
|
|
|
|
// 如果不是市局专班,则需要查询签收部门ID
|
|
|
|
.eq(!RoleEnum.MUNICIPAL_DEPT_CLASSES.getRoleId().equals(roleId), "w.sign_dept_id", deptId); |
|
|
|
.eq(!RoleEnum.MUNICIPAL_DEPT_CLASSES.getRoleId().equals(roleId), "w.sign_dept_id", deptId); |
|
|
|
|
|
|
|
} else if (roleId.equals(RoleEnum.MUNICIPAL_DEPT_LEADER.getRoleId())) { |
|
|
|
|
|
|
|
//空操作
|
|
|
|
|
|
|
|
} else if (roleId.equals(RoleEnum.SECOND_DEPT_LEADER.getRoleId())) { |
|
|
|
|
|
|
|
//数据,领导只能看到自己管辖的部门
|
|
|
|
|
|
|
|
Integer deptId = AdminThreadLocal.getDeptId(); |
|
|
|
|
|
|
|
queryWrapper.eq("m.second_dept_id", deptId); |
|
|
|
|
|
|
|
} else if (roleId.equals(RoleEnum.THREE_DEPT_LEADER.getRoleId())) { |
|
|
|
|
|
|
|
Integer deptId = AdminThreadLocal.getDeptId(); |
|
|
|
|
|
|
|
queryWrapper.eq("m.three_dept_id", deptId); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
String empNo = AdminThreadLocal.getEmpNo(); |
|
|
|
String empNo = AdminThreadLocal.getEmpNo(); |
|
|
|
queryWrapper.eq("w.police_emp_no", empNo); |
|
|
|
queryWrapper.eq("w.police_emp_no", empNo); |
|
|
|
} |
|
|
|
} |
|
|
|
if (StrUtil.isNotBlank(todoQuery.getContactField()) && StrUtil.isNotBlank(todoQuery.getContactFieldValue())) { |
|
|
|
|
|
|
|
switch (todoQuery.getContactField()) { |
|
|
|
|
|
|
|
case "name": |
|
|
|
|
|
|
|
queryWrapper.like("w.contact_name", todoQuery.getContactFieldValue()); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case "idCard": |
|
|
|
|
|
|
|
queryWrapper.like("w.contactIdCard", todoQuery.getContactFieldValue()); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case "phone": |
|
|
|
|
|
|
|
queryWrapper.like("w.contactPhone", todoQuery.getContactFieldValue()); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 排序
|
|
|
|
|
|
|
|
queryWrapper.orderByDesc("w.update_time"); |
|
|
|
|
|
|
|
return baseMapper.selectPageTodo(page, queryWrapper); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public AjaxResult<List<WorkVo>> checkExcel(MultipartFile file, MailQuery mailQuery) throws IOException { |
|
|
|
public AjaxResult<List<QueryMailVo>> checkExcel(MultipartFile file, MailQuery mailQuery) throws IOException { |
|
|
|
ExcelService excelService = new ExcelService(workMapper, mailQuery); |
|
|
|
ExcelService excelService = new ExcelService(mailMapper, mailQuery); |
|
|
|
EasyExcel.read(file.getInputStream(), WorkVo.class, excelService).sheet().doRead(); |
|
|
|
EasyExcel.read(file.getInputStream(), Mail.class, excelService).sheet().doRead(); |
|
|
|
return AjaxResult.success(excelService.getResult()); |
|
|
|
return AjaxResult.success(excelService.getResult()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |