|  | @@ -1,5 +1,6 @@
 | 
	
		
			
				|  |  |  package com.xunmei.core.drill.service.impl;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +import cn.hutool.core.date.DateField;
 | 
	
		
			
				|  |  |  import cn.hutool.core.date.DateUtil;
 | 
	
		
			
				|  |  |  import cn.hutool.core.map.MapUtil;
 | 
	
		
			
				|  |  |  import cn.hutool.core.util.ObjectUtil;
 | 
	
	
		
			
				|  | @@ -10,15 +11,13 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 | 
	
		
			
				|  |  |  import com.baomidou.mybatisplus.core.metadata.IPage;
 | 
	
		
			
				|  |  |  import com.baomidou.mybatisplus.core.toolkit.IdWorker;
 | 
	
		
			
				|  |  |  import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 | 
	
		
			
				|  |  | +import com.xunmei.common.core.constant.DictConstants;
 | 
	
		
			
				|  |  |  import com.xunmei.common.core.constant.ErrorMsgConstants;
 | 
	
		
			
				|  |  |  import com.xunmei.common.core.constant.SecurityConstants;
 | 
	
		
			
				|  |  |  import com.xunmei.common.core.domain.DateRange;
 | 
	
		
			
				|  |  |  import com.xunmei.common.core.domain.R;
 | 
	
		
			
				|  |  |  import com.xunmei.common.core.domain.drill.domain.*;
 | 
	
		
			
				|  |  | -import com.xunmei.common.core.domain.drill.dto.CoreDrillTaskEditDto;
 | 
	
		
			
				|  |  | -import com.xunmei.common.core.domain.drill.dto.CoreDrillTaskPageDto;
 | 
	
		
			
				|  |  | -import com.xunmei.common.core.domain.drill.dto.CoreDrillTaskReportDto;
 | 
	
		
			
				|  |  | -import com.xunmei.common.core.domain.drill.dto.CoreDrillTaskSignDto;
 | 
	
		
			
				|  |  | +import com.xunmei.common.core.domain.drill.dto.*;
 | 
	
		
			
				|  |  |  import com.xunmei.common.core.domain.drill.vo.CoreDrillPlanDataVo;
 | 
	
		
			
				|  |  |  import com.xunmei.common.core.domain.drill.vo.CoreDrillTaskDetailVo;
 | 
	
		
			
				|  |  |  import com.xunmei.common.core.domain.drill.vo.CoreDrillTaskPageVo;
 | 
	
	
		
			
				|  | @@ -31,6 +30,7 @@ import com.xunmei.common.core.exception.SystemException;
 | 
	
		
			
				|  |  |  import com.xunmei.common.core.utils.DateUtils;
 | 
	
		
			
				|  |  |  import com.xunmei.common.core.web.domain.AjaxResult;
 | 
	
		
			
				|  |  |  import com.xunmei.common.core.web.page.TableDataInfo;
 | 
	
		
			
				|  |  | +import com.xunmei.common.security.utils.DictUtils;
 | 
	
		
			
				|  |  |  import com.xunmei.common.security.utils.SecurityUtils;
 | 
	
		
			
				|  |  |  import com.xunmei.core.drill.mapper.CoreDrillPlanMapper;
 | 
	
		
			
				|  |  |  import com.xunmei.core.drill.mapper.CoreDrillTaskMapper;
 | 
	
	
		
			
				|  | @@ -41,6 +41,8 @@ import com.xunmei.core.drill.service.ICoreDrillTaskToRoleService;
 | 
	
		
			
				|  |  |  import com.xunmei.core.drill.service.ICoreDrillTaskToUserService;
 | 
	
		
			
				|  |  |  import com.xunmei.system.api.RemoteFileService;
 | 
	
		
			
				|  |  |  import com.xunmei.system.api.RemoteOrgService;
 | 
	
		
			
				|  |  | +import com.xunmei.system.api.RemoteRoleService;
 | 
	
		
			
				|  |  | +import com.xunmei.system.api.domain.SysDictData;
 | 
	
		
			
				|  |  |  import com.xunmei.system.api.domain.SysOrg;
 | 
	
		
			
				|  |  |  import com.xunmei.system.api.domain.SysUser;
 | 
	
		
			
				|  |  |  import com.xunmei.system.api.function.RemoteCallHandlerExecutor;
 | 
	
	
		
			
				|  | @@ -59,6 +61,8 @@ import java.util.*;
 | 
	
		
			
				|  |  |  import java.util.concurrent.CompletableFuture;
 | 
	
		
			
				|  |  |  import java.util.stream.Collectors;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +import static com.xunmei.common.core.utils.StringUtils.calculatePercent;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  /**
 | 
	
		
			
				|  |  |   * 教育任务Service业务层处理
 | 
	
	
		
			
				|  | @@ -75,6 +79,8 @@ public class CoreDrillTaskServiceImpl extends ServiceImpl<CoreDrillTaskMapper, C
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private RemoteFileService fileService;
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  | +    private RemoteRoleService roleService;
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  |      private ICoreDrillTaskToRoleService coreDrillTaskToRoleService;
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private CoreDrillTaskToRoleMapper taskToRoleMapper;
 | 
	
	
		
			
				|  | @@ -88,26 +94,7 @@ public class CoreDrillTaskServiceImpl extends ServiceImpl<CoreDrillTaskMapper, C
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      public TableDataInfo<CoreDrillTaskPageVo> selectPage(CoreDrillTaskPageDto request) {
 | 
	
		
			
				|  |  | -        //如果是web段的查询
 | 
	
		
			
				|  |  | -        if (ObjectUtil.isNotEmpty(request.getRange())) {
 | 
	
		
			
				|  |  | -            request.setStartTime(DateUtil.beginOfDay(request.getRange()[0]));
 | 
	
		
			
				|  |  | -            request.setEndTime(DateUtil.endOfDay(request.getRange()[1]));
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        //如果是App段的查询
 | 
	
		
			
				|  |  | -        if (ObjectUtil.isNotNull(request.getDate())) {
 | 
	
		
			
				|  |  | -            // Date date = java.sql.Date.valueOf(request.getDate());
 | 
	
		
			
				|  |  | -            request.setStartTime(DateUtil.beginOfMonth(request.getDate()));
 | 
	
		
			
				|  |  | -            request.setEndTime(DateUtil.endOfMonth(request.getDate()));
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        if (ObjectUtil.equal(1, request.getIsAppSelect())) {
 | 
	
		
			
				|  |  | -            request.setCheckSub(true);
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        //App 默认下穿
 | 
	
		
			
				|  |  | -        if (Boolean.TRUE.equals(request.getCheckSub())) {
 | 
	
		
			
				|  |  | -            SysOrg org = RemoteCallHandlerExecutor.executeRemoteCall(() -> orgService.selectOrgById(request.getOrgId(), SecurityConstants.INNER), ErrorMsgConstants.QUERY_ORG_DATA_ERROR);
 | 
	
		
			
				|  |  | -            request.setOrgPath(org.getPath());
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | +        dealParam(request);
 | 
	
		
			
				|  |  |          IPage<CoreDrillTaskPageVo> pageData = coreDrillTaskMapper.selectPageData(request.getPageRequest(), request);
 | 
	
		
			
				|  |  |          if (ObjectUtil.isNotEmpty(pageData.getRecords())) {
 | 
	
		
			
				|  |  |              List<Long> idList = pageData.getRecords().stream().map(CoreDrillTaskPageVo::getId).collect(Collectors.toList());
 | 
	
	
		
			
				|  | @@ -123,10 +110,29 @@ public class CoreDrillTaskServiceImpl extends ServiceImpl<CoreDrillTaskMapper, C
 | 
	
		
			
				|  |  |          return TableDataInfo.build(pageData);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    private String getStaticPathPrefix() {
 | 
	
		
			
				|  |  | -        return RemoteCallHandlerExecutor.executeRemoteCall(() -> fileService.getStaticPathPrefix(), ErrorMsgConstants.QUERY_STATICS_SAVE_PATH_ERROR);
 | 
	
		
			
				|  |  | +    private void dealParam(CoreDrillTaskPageDto request) {
 | 
	
		
			
				|  |  | +        if (ObjectUtil.isNotNull(request.getIsAppSelect()) && 1 == request.getIsAppSelect()) {
 | 
	
		
			
				|  |  | +            //App的查询, App 默认下穿
 | 
	
		
			
				|  |  | +            request.setCheckSub(true);
 | 
	
		
			
				|  |  | +            //App端的时间按季度查询
 | 
	
		
			
				|  |  | +            DateRange dateRange = DateUtils.getStartAndEnd(request.getDate(), 4);
 | 
	
		
			
				|  |  | +            request.setStartTime(dateRange.getStartTime());
 | 
	
		
			
				|  |  | +            request.setEndTime(dateRange.getEndTime());
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +            if (ObjectUtil.isNotEmpty(request.getRange())) {
 | 
	
		
			
				|  |  | +                //web的查询
 | 
	
		
			
				|  |  | +                request.setStartTime(DateUtil.beginOfDay(request.getRange()[0]));
 | 
	
		
			
				|  |  | +                request.setEndTime(DateUtil.endOfDay(request.getRange()[1]));
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (Boolean.TRUE.equals(request.getCheckSub())) {
 | 
	
		
			
				|  |  | +            SysOrg org = RemoteCallHandlerExecutor.executeRemoteCall(() -> orgService.selectOrgById(request.getOrgId(), SecurityConstants.INNER), ErrorMsgConstants.QUERY_ORG_DATA_ERROR);
 | 
	
		
			
				|  |  | +            request.setOrgPath(org.getPath());
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      private void dealData(CoreDrillTaskPageVo record, List<CoreDrillTaskPageVo> records, Map<Long, List<CoreDrillTaskToRole>> listMap) {
 | 
	
		
			
				|  |  |          record.setNo(records.indexOf(record) + 1);
 | 
	
		
			
				|  |  |          record.setTypeText(DrillType.getName(record.getType()));
 | 
	
	
		
			
				|  | @@ -138,13 +144,20 @@ public class CoreDrillTaskServiceImpl extends ServiceImpl<CoreDrillTaskMapper, C
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          record.setTaskRoleList(coreDrillTaskToRoles);
 | 
	
		
			
				|  |  |          record.setTaskRoleNameList(coreDrillTaskToRoles.stream().map(CoreDrillTaskToRole::getRoleName).collect(Collectors.joining(",")));
 | 
	
		
			
				|  |  | -        List<CoreDrillTaskToUser> userList = taskToUserMapper.selectList(new LambdaQueryWrapper<CoreDrillTaskToUser>()
 | 
	
		
			
				|  |  | -                .eq(CoreDrillTaskToUser::getDrillTaskId, record.getId()));
 | 
	
		
			
				|  |  | -        int signNums = (int) userList.stream().filter(user -> user.getSign() == 1 && ObjectUtil.equal(user.getType(), 1)).count();
 | 
	
		
			
				|  |  | -        int totalNums = (int) userList.stream().filter(user -> ObjectUtil.equal(user.getType(), 1)).count();
 | 
	
		
			
				|  |  | -        record.setSignNums(signNums + "/" + totalNums);
 | 
	
		
			
				|  |  | -        record.setUserList(userList);
 | 
	
		
			
				|  |  | +        //状态 != 待执行才存在相关用户信息
 | 
	
		
			
				|  |  | +        if (!record.getStatus().equals(DrillDoStatus.WAIT_RECORDED.getCode())) {
 | 
	
		
			
				|  |  | +            List<CoreDrillTaskToUser> userList = taskToUserMapper.selectList(new LambdaQueryWrapper<CoreDrillTaskToUser>()
 | 
	
		
			
				|  |  | +                    .eq(CoreDrillTaskToUser::getDrillTaskId, record.getId()));
 | 
	
		
			
				|  |  | +            int signNums = (int) userList.stream().filter(user -> user.getSign() == 1 && ObjectUtil.equal(user.getType(), 1)).count();
 | 
	
		
			
				|  |  | +            int totalNums = (int) userList.stream().filter(user -> ObjectUtil.equal(user.getType(), 1)).count();
 | 
	
		
			
				|  |  | +            record.setSignNums(signNums + "/" + totalNums);
 | 
	
		
			
				|  |  | +            record.setUserList(userList);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        final List<SysDictData> drillTypeDictList = DictUtils.getDictCache(DictConstants.CORE_DRILL_TYPE);
 | 
	
		
			
				|  |  | +        if (ObjectUtil.isNotEmpty(drillTypeDictList) && ObjectUtil.isNotEmpty(record.getType())) {
 | 
	
		
			
				|  |  | +            drillTypeDictList.stream().filter(dict -> ObjectUtil.equal(dict.getDictValue(), record.getType().toString())).findFirst().ifPresent(dict -> record.setTypeText(dict.getDictLabel()));
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
	
		
			
				|  | @@ -171,6 +184,10 @@ public class CoreDrillTaskServiceImpl extends ServiceImpl<CoreDrillTaskMapper, C
 | 
	
		
			
				|  |  |          if (ObjectUtil.isNotEmpty(userList)) {
 | 
	
		
			
				|  |  |              detailVo.setTaskUserList(userList);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +        final List<SysDictData> drillTypeDictList = DictUtils.getDictCache(DictConstants.CORE_DRILL_TYPE);
 | 
	
		
			
				|  |  | +        if (ObjectUtil.isNotEmpty(drillTypeDictList) && ObjectUtil.isNotEmpty(detailVo.getType())) {
 | 
	
		
			
				|  |  | +            drillTypeDictList.stream().filter(dict -> ObjectUtil.equal(dict.getDictValue(), detailVo.getType().toString())).findFirst().ifPresent(dict -> detailVo.setTypeText(dict.getDictLabel()));
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |          return detailVo;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -215,7 +232,13 @@ public class CoreDrillTaskServiceImpl extends ServiceImpl<CoreDrillTaskMapper, C
 | 
	
		
			
				|  |  |          coreDrillTask.setRecorderId(SecurityUtils.getUserId());
 | 
	
		
			
				|  |  |          coreDrillTask.setImageList(request.getImageList());
 | 
	
		
			
				|  |  |          //主持人默认取网点负责人,具体还没落实,暂时处理成这样   TODO
 | 
	
		
			
				|  |  | -        coreDrillTask.setHostId(SecurityUtils.getUserId());
 | 
	
		
			
				|  |  | +        List<SysUser> userList = RemoteCallHandlerExecutor.executeRemoteCall(() ->
 | 
	
		
			
				|  |  | +                roleService.selectUserByRoleNameAndOrgId("网点负责人", coreDrillTask.getOrgId(), SecurityConstants.INNER), ErrorMsgConstants.QUERY_USER_DATA_ERROR);
 | 
	
		
			
				|  |  | +        if (ObjectUtil.isNotEmpty(userList)) {
 | 
	
		
			
				|  |  | +            coreDrillTask.setHostId(userList.get(0).getId());
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +            coreDrillTask.setHostId(SecurityUtils.getUserId());
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |          List<CoreDrillTaskToUser> taskUserList = request.getTaskUserList();
 | 
	
		
			
				|  |  |          if (ObjectUtil.isNotEmpty(taskUserList)) {
 | 
	
		
			
				|  |  |              checkTheSameUser(taskUserList);
 | 
	
	
		
			
				|  | @@ -279,6 +302,9 @@ public class CoreDrillTaskServiceImpl extends ServiceImpl<CoreDrillTaskMapper, C
 | 
	
		
			
				|  |  |              DateRange dateRange = DateUtils.getStartAndEnd(new Date(), plan.getPlanCycle());
 | 
	
		
			
				|  |  |              start = dateRange.getStartTime();
 | 
	
		
			
				|  |  |              end = dateRange.getEndTime();
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +            start = DateUtil.beginOfDay(start).setField(DateField.MILLISECOND, 0);
 | 
	
		
			
				|  |  | +            end = DateUtil.endOfDay(end).setField(DateField.MILLISECOND, 0);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          List<CoreDrillPlanToExecOrg> planExecOrgList = plan.getPlanExecOrgList();
 | 
	
		
			
				|  |  |          List<SysOrg> orgList;
 | 
	
	
		
			
				|  | @@ -355,9 +381,13 @@ public class CoreDrillTaskServiceImpl extends ServiceImpl<CoreDrillTaskMapper, C
 | 
	
		
			
				|  |  |              planIdList = coreDrillPlanMapper.selectIdByParentId(plan.getId());
 | 
	
		
			
				|  |  |              planId = null;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          request.setStartDate(DateUtil.beginOfMonth(request.getDate()));
 | 
	
		
			
				|  |  |          request.setEndDate(DateUtil.endOfMonth(request.getDate()));
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          Long orgId = request.getOrgId();
 | 
	
		
			
				|  |  | +        SysOrg sysOrg = RemoteCallHandlerExecutor.executeRemoteCall(() -> orgService.selectOrgById(orgId, SecurityConstants.INNER), ErrorMsgConstants.QUERY_ORG_DATA_ERROR);
 | 
	
		
			
				|  |  | +        request.setOrgPath(sysOrg.getPath());
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          List<SysOrg> sysOrgList = RemoteCallHandlerExecutor.executeRemoteCall(() -> orgService.selectSysOrgByParentId(orgId, SecurityConstants.INNER), ErrorMsgConstants.QUERY_ORG_DATA_ERROR);
 | 
	
		
			
				|  |  |          if (ObjectUtil.isEmpty(sysOrgList)) {
 | 
	
	
		
			
				|  | @@ -365,39 +395,40 @@ public class CoreDrillTaskServiceImpl extends ServiceImpl<CoreDrillTaskMapper, C
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          List<CoreDrillTaskReportVo> result = new ArrayList<>();
 | 
	
		
			
				|  |  |          List<CoreDrillTaskReportVo> list = coreDrillTaskMapper.selectReport(request, planId, planIdList);
 | 
	
		
			
				|  |  | -        for (SysOrg org : sysOrgList) {
 | 
	
		
			
				|  |  | -            List<CoreDrillTaskReportVo> childrenOrgData = list.stream().filter(vo -> vo.getOrgPath().startsWith(org.getPath())).collect(Collectors.toList());
 | 
	
		
			
				|  |  | -            CoreDrillTaskReportVo reportVo=new CoreDrillTaskReportVo();
 | 
	
		
			
				|  |  | -            reportVo.setOrgId(org.getId());
 | 
	
		
			
				|  |  | -            reportVo.setOrgName(org.getName());
 | 
	
		
			
				|  |  | -            if (ObjectUtil.isEmpty(childrenOrgData)) {;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if (list.size() == 1 && list.get(0).getOrgId() == null) {
 | 
	
		
			
				|  |  | +            //走到这 说明mapper没有查到数据 构建空数据返回
 | 
	
		
			
				|  |  | +            for (SysOrg org : sysOrgList) {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                CoreDrillTaskReportVo reportVo = new CoreDrillTaskReportVo();
 | 
	
		
			
				|  |  | +                reportVo.setOrgId(org.getId());
 | 
	
		
			
				|  |  | +                reportVo.setOrgName(org.getName());
 | 
	
		
			
				|  |  |                  reportVo.setShouldFinish(0);
 | 
	
		
			
				|  |  |                  reportVo.setFinish(0);
 | 
	
		
			
				|  |  |                  reportVo.setFinishRate("0%");
 | 
	
		
			
				|  |  | -            } else {
 | 
	
		
			
				|  |  | -                childrenOrgData.stream().map(CoreDrillTaskReportVo::getShouldFinish).reduce(Integer::sum).ifPresent(reportVo::setShouldFinish);
 | 
	
		
			
				|  |  | -                childrenOrgData.stream().map(CoreDrillTaskReportVo::getFinish).reduce(Integer::sum).ifPresent(reportVo::setFinish);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -                reportVo.setFinishRate(calculatePercent(reportVo.getFinish(), reportVo.getShouldFinish()));
 | 
	
		
			
				|  |  | +                result.add(reportVo);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +            for (SysOrg org : sysOrgList) {
 | 
	
		
			
				|  |  | +                List<CoreDrillTaskReportVo> childrenOrgData = list.stream().filter(vo -> vo.getOrgPath().startsWith(org.getPath())).collect(Collectors.toList());
 | 
	
		
			
				|  |  | +                CoreDrillTaskReportVo reportVo = new CoreDrillTaskReportVo();
 | 
	
		
			
				|  |  | +                reportVo.setOrgId(org.getId());
 | 
	
		
			
				|  |  | +                reportVo.setOrgName(org.getName());
 | 
	
		
			
				|  |  | +                if (ObjectUtil.isEmpty(childrenOrgData)) {
 | 
	
		
			
				|  |  | +                    ;
 | 
	
		
			
				|  |  | +                    reportVo.setShouldFinish(0);
 | 
	
		
			
				|  |  | +                    reportVo.setFinish(0);
 | 
	
		
			
				|  |  | +                    reportVo.setFinishRate("0%");
 | 
	
		
			
				|  |  | +                } else {
 | 
	
		
			
				|  |  | +                    childrenOrgData.stream().map(CoreDrillTaskReportVo::getShouldFinish).reduce(Integer::sum).ifPresent(reportVo::setShouldFinish);
 | 
	
		
			
				|  |  | +                    childrenOrgData.stream().map(CoreDrillTaskReportVo::getFinish).reduce(Integer::sum).ifPresent(reportVo::setFinish);
 | 
	
		
			
				|  |  | +                    reportVo.setFinishRate(calculatePercent(reportVo.getFinish(), reportVo.getShouldFinish()));
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | -            result.add(reportVo);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |          return result;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    private String calculatePercent(Integer num1, Integer num2) {
 | 
	
		
			
				|  |  | -        if (num1 == 0 || num2 == 0) {
 | 
	
		
			
				|  |  | -            return "0%";
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        BigDecimal a1 = new BigDecimal(num1);
 | 
	
		
			
				|  |  | -        BigDecimal a2 = new BigDecimal(num2);
 | 
	
		
			
				|  |  | -        BigDecimal r = a1.divide(a2, 4, RoundingMode.HALF_UP);
 | 
	
		
			
				|  |  | -        NumberFormat percent = NumberFormat.getPercentInstance();
 | 
	
		
			
				|  |  | -        percent.setMaximumFractionDigits(4);
 | 
	
		
			
				|  |  | -        return percent.format(r.doubleValue());
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      public Integer sign(CoreDrillTaskSignDto request) {
 | 
	
	
		
			
				|  | @@ -411,7 +442,6 @@ public class CoreDrillTaskServiceImpl extends ServiceImpl<CoreDrillTaskMapper, C
 | 
	
		
			
				|  |  |              throw new SystemException("未获取到当前用户于该教育培训的详细信息");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          taskToUser.setSign(1);
 | 
	
		
			
				|  |  | -        dealImageUrl(request.getSignImage());
 | 
	
		
			
				|  |  |          taskToUser.setSignImage(request.getSignImage());
 | 
	
		
			
				|  |  |          final int sign = taskToUserMapper.updateSign(taskToUser);
 | 
	
		
			
				|  |  |          //判断是否已全部完成签名,如果是将任务修改成已完成
 | 
	
	
		
			
				|  | @@ -433,10 +463,6 @@ public class CoreDrillTaskServiceImpl extends ServiceImpl<CoreDrillTaskMapper, C
 | 
	
		
			
				|  |  |          return sign;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    private void dealImageUrl(String signImage) {
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      public AjaxResult buildEduPdf(Long id) {
 | 
	
	
		
			
				|  | @@ -571,6 +597,14 @@ public class CoreDrillTaskServiceImpl extends ServiceImpl<CoreDrillTaskMapper, C
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    @Override
 | 
	
		
			
				|  |  | +    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
 | 
	
		
			
				|  |  | +    public int evaluate(CoreDrillTaskEvaluateDto request) {
 | 
	
		
			
				|  |  | +        CoreDrillTask drillTask = getById(request.getTaskId());
 | 
	
		
			
				|  |  | +        drillTask.setCommentScore(request.getScore());
 | 
	
		
			
				|  |  | +        drillTask.setStatus(DrillDoStatus.DONE.getCode());
 | 
	
		
			
				|  |  | +        return baseMapper.updateById(drillTask);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 |