Browse Source

BUG修复

master
wxc 2 years ago
parent
commit
eeaceb4eaa
  1. 10
      mailbox-lan/src/main/java/com/biutag/lan/controller/HomeController.java
  2. 11
      mailbox-lan/src/main/java/com/biutag/lan/flow/node/FirstApprovalFlow.java
  3. 3
      mailbox-lan/src/main/java/com/biutag/lan/flow/node/SecondDistributeFlow.java
  4. 3
      mailbox-lan/src/main/java/com/biutag/lan/flow/node/SecondSignFlow.java
  5. 29
      mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeSignFlow.java
  6. 43
      mailbox-lan/src/main/java/com/biutag/lan/service/DataScreenService.java
  7. 20
      mailbox-lan/src/main/resources/mapper/DataScreenMapper.xml
  8. 12
      mailbox-lan/src/test/java/com/biutag/lan/NumberUtilTest.java

10
mailbox-lan/src/main/java/com/biutag/lan/controller/HomeController.java

@ -8,8 +8,10 @@ import com.biutag.aop.NotPower;
import com.biutag.core.AjaxResult;
import com.biutag.enums.RoleEnum;
import com.biutag.lan.config.AdminThreadLocal;
import com.biutag.lan.domain.Mail;
import com.biutag.lan.domain.Work;
import com.biutag.lan.domain.bo.MailTotal;
import com.biutag.lan.enums.MailState;
import com.biutag.lan.flow.FlowNameEnum;
import com.biutag.lan.flow.FlowNodeEnum;
import com.biutag.lan.service.MailMarkService;
@ -74,9 +76,11 @@ public class HomeController {
Integer contactWriterTotal = workService.count(FlowNodeEnum.CONTACT_WRITER.getKey(), deptId);
Integer interviewWriterTotal = workService.count(FlowNodeEnum.INTERVIEW_WRITER.getKey(), deptId);
Integer verifyTotal = workService.count(FlowNodeEnum.VERIFY.getKey(), deptId);
// 已申请延期
Integer extensionTotal = workService.count(true, deptId);
Integer approvalTotal = workService.count(Arrays.asList(FlowNodeEnum.THREE_LEADER_APPROVAL.getKey(),
// 申请延期中
int extensionTotal = Long.valueOf(mailService.count(new LambdaQueryWrapper<Mail>().eq(Mail::getMailState, MailState.delayed.getName()))).intValue();
Integer approvalTotal = workService.count(Arrays.asList(
FlowNodeEnum.THREE_LEADER_APPROVAL.getKey(),
FlowNodeEnum.SECOND_APPROVAL.getKey(),
FlowNodeEnum.SECOND_DEPUTY_APPROVAL.getKey(),
FlowNodeEnum.SECOND_LEADER_APPROVAL.getKey(),
FlowNodeEnum.SECOND_REPORTING.getKey(),

11
mailbox-lan/src/main/java/com/biutag/lan/flow/node/FirstApprovalFlow.java

@ -6,21 +6,24 @@ import com.biutag.constants.AppConstants;
import com.biutag.enums.RoleEnum;
import com.biutag.exception.BusinessException;
import com.biutag.lan.config.AdminThreadLocal;
import com.biutag.lan.domain.*;
import com.biutag.lan.enums.MailCategory;
import com.biutag.lan.domain.Mail;
import com.biutag.lan.domain.MailMark;
import com.biutag.lan.domain.MailReturn;
import com.biutag.lan.enums.MailState;
import com.biutag.lan.flow.ActionEnum;
import com.biutag.lan.flow.Flow;
import com.biutag.lan.flow.FlowNameEnum;
import com.biutag.lan.flow.FlowNodeEnum;
import com.biutag.lan.service.*;
import com.biutag.lan.service.MailMarkService;
import com.biutag.lan.service.MailReturnService;
import com.biutag.lan.service.MailService;
import com.biutag.lan.service.WorkService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;
import java.time.LocalDateTime;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;
@RequiredArgsConstructor

3
mailbox-lan/src/main/java/com/biutag/lan/flow/node/SecondDistributeFlow.java

@ -48,9 +48,8 @@ public class SecondDistributeFlow extends Flow {
LocalDateTime now = LocalDateTime.now();
Mail mail = mailService.getById(mailId);
// 将我的工作待办改成已办
Work myWork = workService.getOne(mailId, AdminThreadLocal.getEmpNo());
Work myWork = workService.getOne(mailId, AdminThreadLocal.getRoleId(), AdminThreadLocal.getDeptId());
myWork.setWorkState(Work.State.done.name()).setUpdateTime(now);
workService.updateById(myWork);
DeptVo deptVo = deptService.detail(mainDeptId);

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

@ -79,7 +79,8 @@ public class SecondSignFlow extends Flow {
if (work.getMainDeptFlag()) {
mail.setUpdateTime(now)
.setFlowKey(FlowNodeEnum.FIRST_SIGN.getKey())
.setFlowName(FlowNameEnum.MAIL_RETURN.getName());
.setFlowName(FlowNameEnum.MAIL_RETURN.getName())
.setFlowLimitedLastHandlerTime(now);
// 将信件源表的签收设置为未签收
MailSource mailSource = mailSourceService.getById(mailId).setSignFlag(false);
mailSourceService.updateById(mailSource);

29
mailbox-lan/src/main/java/com/biutag/lan/flow/node/ThreeSignFlow.java

@ -51,7 +51,7 @@ public class ThreeSignFlow extends Flow {
Assert.hasText(reason, "参数错误");
LocalDateTime now = LocalDateTime.now();
Integer deptId = AdminThreadLocal.getDeptId();
Work work = workService.getOne(mailId, RoleEnum.THREE_DEPT_CLASSES.getRoleId(),deptId);
Work work = workService.getOne(mailId, RoleEnum.THREE_DEPT_CLASSES.getRoleId(), deptId);
if (work.getWorkState().equals(Work.State.done.name())) {
throw new BusinessException("该信件已被其他专班处理");
}
@ -69,15 +69,24 @@ public class ThreeSignFlow extends Flow {
// 更新已办
work.setUpdateTime(now).setWorkState(Work.State.done.name()).setFlowName(FlowNameEnum.MAIL_RETURN.getDoneName());
workService.updateById(work);
// 将所有协办的待办更新为已办
workService.updateDoneByCoHandling(mailId);
// 更新二级机构专班的待办
workService.updateTodo(mailId, RoleEnum.SECOND_DEPT_CLASSES.getRoleId(), mail.getSecondDeptId(), FlowNameEnum.MAIL_RETURN.getName());
// 更新信件
mail.setUpdateTime(now)
.setFlowKey(FlowNodeEnum.SECOND_DISTRIBUTE.getKey())
.setFlowName(FlowNameEnum.MAIL_RETURN.getName());
mailService.updateById(mail);
// 主责单位
if (work.getMainDeptFlag()) {
// 将所有协办的待办更新为已办
workService.updateDoneByCoHandling(mailId);
// 更新二级机构专班的待办
workService.updateTodo(mailId, RoleEnum.SECOND_DEPT_CLASSES.getRoleId(), mail.getSecondDeptId(), FlowNameEnum.MAIL_RETURN.getName());
// 更新信件
mail.setUpdateTime(now)
.setFlowKey(FlowNodeEnum.SECOND_DISTRIBUTE.getKey())
.setFlowName(FlowNameEnum.MAIL_RETURN.getName())
// 更新操作时间
.setFlowLimitedLastHandlerTime(now);
mailService.updateById(mail);
}
// 非主责
else {
}
// 通知
noticeService.sendNoticeDoneByRole();
return null;

43
mailbox-lan/src/main/java/com/biutag/lan/service/DataScreenService.java

@ -1,10 +1,14 @@
package com.biutag.lan.service;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.NumberUtil;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.biutag.constants.AppConstants;
import com.biutag.entity.system.Duty;
import com.biutag.enums.DeptTypeEnum;
import com.biutag.lan.domain.Mail;
@ -29,6 +33,8 @@ public class DataScreenService extends ServiceImpl<DataScreenMapper, Mail> {
private final MailMarkService mailMarkService;
private final MailSourceService mailSourceService;
public List<Map<String, Object>> mapData(String deptId) {
return baseMapper.mapData(deptId);
}
@ -117,25 +123,40 @@ public class DataScreenService extends ServiceImpl<DataScreenMapper, Mail> {
Map<String, Object> mapSatisfied = baseMapper.getAllSatisfiedRate(null);//获取长沙市局 满意率
Long allSum = mailMarkService.count();
Integer toDayCount = baseMapper.getTodayMailCount(null);
mapCompleted.putAll(mapResolved);
mapCompleted.putAll(mapSatisfied);
mapCompleted.put("todaySum", toDayCount);
String today = DateUtil.format(new Date(), DatePattern.NORM_DATE_FORMAT);
mapCompleted.put("todaySum", mailSourceService.count(today));
mapCompleted.put("allSum", allSum);
return mapCompleted;
} else {
String deptId = params.get("id").toString();
Map<String, Object> mapCompleted = baseMapper.getAllCompletedRate(deptId);//获取长沙市局 办结率
Map<String, Object> mapResolved = baseMapper.getAllResolvedRate(deptId);//获取长沙市局 解决率
Map<String, Object> mapSatisfied = baseMapper.getAllSatisfiedRate(deptId);//获取长沙市局 满意率
Long allSum = mailMarkService.count(new LambdaQueryWrapper<MailMark>().eq(MailMark::getSecondDeptId, deptId));
HashMap<String, Object> map = new HashMap<>();
long completedsum = mailMarkService.count(new LambdaQueryWrapper<MailMark>().eq(MailMark::getSecondDeptId, deptId));
long completed = mailMarkService.count(new LambdaQueryWrapper<MailMark>().eq(MailMark::getCompleted, AppConstants.TRUE).eq(MailMark::getSecondDeptId, deptId));
long resolved = mailMarkService.count(new LambdaQueryWrapper<MailMark>().eq(MailMark::getResolved, AppConstants.TRUE).eq(MailMark::getSecondDeptId, deptId));
long satisfied = mailMarkService.count(new LambdaQueryWrapper<MailMark>().eq(MailMark::getSatisfied, AppConstants.TRUE).eq(MailMark::getSecondDeptId, deptId));
map.put("completedsum", completedsum);
map.put("completed", completed);
// 办结率=已办结数/信件总数
map.put("completedrate", completedsum == 0 ? "0%" : Double.valueOf(NumberUtil.div(completed, completedsum, 2) * 100).intValue() + "%");
map.put("resolvedsum", completed);
map.put("resolved", resolved);
// 解决率=解决数/已办结数
map.put("resolvedrate", completed == 0 ? "0%" : Double.valueOf(NumberUtil.div(resolved, completed, 2) * 100).intValue() + "%");
map.put("satisfiedSum", completed);
map.put("satisfied", satisfied);
// 满意率=满意数/已办结数
map.put("satisfiedrate", completed == 0 ? "0%" : Double.valueOf(NumberUtil.div(satisfied, completed, 2) * 100).intValue() + "%");
Long allSum = mailMarkService.count(new LambdaQueryWrapper<MailMark>().eq(MailMark::getSecondDeptId, deptId));
Integer toDayCount = baseMapper.getTodayMailCount(deptId);
mapCompleted.putAll(mapResolved);
mapCompleted.putAll(mapSatisfied);
mapCompleted.put("todaySum", toDayCount);
mapCompleted.put("allSum", allSum);
return mapCompleted;
map.put("todaySum", toDayCount);
map.put("allSum", allSum);
return map;
}
}

20
mailbox-lan/src/main/resources/mapper/DataScreenMapper.xml

@ -30,7 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="getResolvedRate" resultType="java.util.Map">
select t.name, t.resolved, t.sum, CASE WHEN t.sum = 0 THEN 0 ELSE (ROUND(t.resolved / t.sum)) * 100 END AS rateNumber, concat(rateNumber, '%') rate
select t.name, t.resolved, t.sum, CASE WHEN t.sum = 0 THEN 0 ELSE ROUND((t.resolved / t.sum) * 100) END AS rateNumber, concat(rateNumber, '%') rate
from
(select a.name, SUM(COALESCE(b.resolved, 0)) resolved,
SUM(CASE WHEN b.completed = '1' THEN 1 ELSE 0 END) sum
@ -53,28 +53,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getStationCompletedRateByDept" resultType="java.util.Map" parameterType="String">
select b.three_dept_name name,
select a.name,
ROUND(sum(COALESCE(b.completed, 0))*100/count(1),0) rateNumber,
CONCAT(rateNumber,'%') rate,
SUM(COALESCE(b.completed, 0)) completed,count(1) sum
from dept a inner join mail_mark b on a.id=b.second_dept_id where b.second_dept_id=#{deptId}
GROUP BY three_dept_name order by rateNumber desc ,sum desc limit 10
from dept a left join mail_mark b on a.id=b.three_dept_id where a.pid=#{deptId}
GROUP BY a.name order by rateNumber desc ,sum desc
</select>
<select id="getStationResolvedRateByDept" resultType="java.util.Map" parameterType="String">
select b.three_dept_name name,
select a.name,
ROUND(sum(COALESCE(b.resolved, 0))*100/count(1),0) rateNumber,
CONCAT(rateNumber,'%') rate,
SUM(COALESCE(b.resolved, 0)) resolved,count(1) sum
from dept a inner join mail_mark b on a.id=b.second_dept_id where b.second_dept_id=#{deptId}
GROUP BY three_dept_name order by rateNumber desc ,sum desc limit 10
from dept a left join mail_mark b on a.id=b.three_dept_id where a.pid=#{deptId}
GROUP BY a.name order by rateNumber desc ,sum desc
</select>
<select id="getStationSatisfiedRateByDept" resultType="java.util.Map" parameterType="String">
select b.three_dept_name name,
select a.name,
ROUND(sum(COALESCE(b.satisfied, 0))*100/count(1),0) rateNumber,
CONCAT(rateNumber,'%') rate,
SUM(COALESCE(b.satisfied, 0)) satisfied,count(1) sum
from dept a inner join mail_mark b on a.id=b.second_dept_id where b.second_dept_id=#{deptId}
GROUP BY three_dept_name order by rateNumber desc ,sum desc limit 10
from dept a left join mail_mark b on a.id=b.three_dept_id where a.pid=#{deptId}
GROUP BY a.name order by rateNumber desc ,sum desc
</select>
<select id="getTodayMailCount" resultType="Integer" parameterType="String">

12
mailbox-lan/src/test/java/com/biutag/lan/NumberUtilTest.java

@ -0,0 +1,12 @@
package com.biutag.lan;
import cn.hutool.core.util.NumberUtil;
import org.junit.jupiter.api.Test;
public class NumberUtilTest {
@Test
public void test() {
System.out.println(Double.valueOf(NumberUtil.div(1L, 2, 2) * 100).intValue());
}
}
Loading…
Cancel
Save