|
|
@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateField;
|
|
|
import cn.hutool.core.date.DateTime;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
+import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
@@ -175,51 +176,61 @@ public class ResumptionServiceImpl extends ServiceImpl<ResumptionMapper, Resumpt
|
|
|
|
|
|
@Override
|
|
|
public void dayTaskByWorkTime(Map<String, Object> params) {
|
|
|
- SysWorkTime workTime = (SysWorkTime) params.get("sysWorkTime");
|
|
|
- List<Long> orgIds = (List<Long>) params.get("orgIds");
|
|
|
- //按机构删除当天的每日履职
|
|
|
- QueryWrapper<Resumption> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.lambda().eq(Resumption::getYmdDate, workTime.getYmdDate());
|
|
|
- queryWrapper.lambda().in(Resumption::getOrgId, orgIds);
|
|
|
- //待履职,进行中
|
|
|
- //queryWrapper.lambda().in(Resumption::getStatus, 1, 2);
|
|
|
- //每日任务
|
|
|
- queryWrapper.lambda().eq(Resumption::getType, 2);
|
|
|
- List<Resumption> resumptionList = resumptionMapper.selectList(queryWrapper);
|
|
|
- List<Resumption> resumptionListYlz =resumptionList.stream().filter(item -> item.getStatus()==3).collect(Collectors.toList());
|
|
|
- if (CollectionUtils.isNotEmpty(resumptionList)) {
|
|
|
- //取出未履职的数据(待履职,进行中)
|
|
|
- List<Resumption> resumptionListWlz = resumptionList.stream().filter(item -> item.getStatus() == 1 || item.getStatus() == 2).collect(Collectors.toList());
|
|
|
- //删除这些数据
|
|
|
- resumptionMapper.deleteBatchIds(resumptionListWlz.stream().map(Resumption::getId).collect(Collectors.toList()));
|
|
|
- }
|
|
|
+ try {
|
|
|
+ Gson gson = new Gson();
|
|
|
+ SysWorkTime workTime = gson.fromJson((String) params.get("sysWorkTime"), SysWorkTime.class);
|
|
|
+ //SysWorkTime workTime = params.get("sysWorkTime");
|
|
|
+ List<Long> orgIds = (List<Long>) params.get("orgIds");
|
|
|
+ //按机构删除当天的每日履职
|
|
|
+ QueryWrapper<Resumption> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.lambda().eq(Resumption::getYmdDate, workTime.getYmdDate());
|
|
|
+ queryWrapper.lambda().in(Resumption::getOrgId, orgIds);
|
|
|
+ //待履职,进行中
|
|
|
+ //queryWrapper.lambda().in(Resumption::getStatus, 1, 2);
|
|
|
+ //每日任务
|
|
|
+ queryWrapper.lambda().eq(Resumption::getType, 2);
|
|
|
+ List<Resumption> resumptionList = resumptionMapper.selectList(queryWrapper);
|
|
|
+ List<Resumption> resumptionListYlz =resumptionList.stream().filter(item -> item.getStatus()==3).collect(Collectors.toList());
|
|
|
+ if (CollectionUtils.isNotEmpty(resumptionList)) {
|
|
|
+ //取出未履职的数据(待履职,进行中)
|
|
|
+ List<Resumption> resumptionListWlz = resumptionList.stream().filter(item -> item.getStatus() == 1 || item.getStatus() == 2).collect(Collectors.toList());
|
|
|
+ //删除这些数据
|
|
|
+ if(CollectionUtils.isNotEmpty(resumptionListWlz)){
|
|
|
+ resumptionMapper.deleteBatchIds(resumptionListWlz.stream().map(Resumption::getId).collect(Collectors.toList()));
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- //营业重新生成任务
|
|
|
- if (workTime.getIsEnable() == 1) {
|
|
|
- QueryWrapper<AppPlan> qw = new QueryWrapper<>();
|
|
|
- qw.lambda().eq(AppPlan::getPlanStatus, 0);
|
|
|
- qw.lambda().in(AppPlan::getPlanOfOrgId, orgIds);
|
|
|
- List<AppPlan> listPlans = appPlanMapper.selectList(qw);
|
|
|
- //通过resumptionListYlz中的planId过滤除已履职的计划
|
|
|
- List<AppPlan> lists = listPlans.stream().filter(item -> !resumptionListYlz.stream().map(Resumption::getPlanId).collect(
|
|
|
- Collectors.toList()).contains(item.getId())).collect(Collectors.toList());
|
|
|
- //通过计划id获取计划关系的角色
|
|
|
- if (CollectionUtils.isNotEmpty(lists)) {
|
|
|
- List<Long> planIds = lists.stream().map(AppPlan::getId).collect(Collectors.toList());
|
|
|
- List<AppPlanToRole> appPlanToRoles = appPlanToRoleMapper.selectList(new QueryWrapper<AppPlanToRole>().lambda().in(AppPlanToRole::getPlanId, planIds));
|
|
|
- List<Resumption> newResumptionList = new ArrayList<>();
|
|
|
- for(AppPlan plan:lists){
|
|
|
- //根据计划获取角色
|
|
|
- List<AppPlanToRole> planToRoles = appPlanToRoles.stream().filter(item -> item.getPlanId().equals(plan.getId())).collect(Collectors.toList());
|
|
|
- List<Resumption> resumptionLista = this.buildResumptions(plan, planToRoles,workTime);
|
|
|
- if(CollectionUtils.isNotEmpty(resumptionLista)){
|
|
|
- newResumptionList.addAll(resumptionLista);
|
|
|
+ //营业重新生成任务
|
|
|
+ if (workTime.getIsEnable() == 1) {
|
|
|
+ QueryWrapper<AppPlan> qw = new QueryWrapper<>();
|
|
|
+ qw.lambda().eq(AppPlan::getPlanStatus, 1);
|
|
|
+ qw.lambda().in(AppPlan::getPlanOfOrgId, orgIds);
|
|
|
+ List<AppPlan> listPlans = appPlanMapper.selectList(qw);
|
|
|
+ //通过计划id获取计划关系的角色
|
|
|
+ if (CollectionUtils.isNotEmpty(listPlans)) {
|
|
|
+ List<Long> planIds = listPlans.stream().map(AppPlan::getId).collect(Collectors.toList());
|
|
|
+ List<AppPlanToRole> appPlanToRoles = appPlanToRoleMapper.selectList(new QueryWrapper<AppPlanToRole>().lambda().in(AppPlanToRole::getPlanId, planIds));
|
|
|
+ List<Resumption> newResumptionList = new ArrayList<>();
|
|
|
+ for(AppPlan plan:listPlans){
|
|
|
+ //根据计划获取角色
|
|
|
+ List<AppPlanToRole> planToRoles = appPlanToRoles.stream().filter(item -> item.getPlanId().equals(plan.getId())).collect(Collectors.toList());
|
|
|
+ List<Resumption> resumptionLista = this.buildResumptions(plan, planToRoles,workTime);
|
|
|
+ if(CollectionUtils.isNotEmpty(resumptionLista)){
|
|
|
+ //根据planId和roleId是否判断resumptionLista中的数据是否在resumptionListYlz中
|
|
|
+ List<Resumption> resumptionListb = resumptionLista.stream().filter(item -> !resumptionListYlz.stream().filter(item1 -> item1.getPlanId().equals(item.getPlanId())
|
|
|
+ && item1.getRoleId().equals(item.getRoleId())).findFirst().isPresent()).collect(Collectors.toList());
|
|
|
+ if(CollectionUtils.isNotEmpty(resumptionListb)){
|
|
|
+ newResumptionList.addAll(resumptionListb);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+ this.saveBatch(newResumptionList);
|
|
|
}
|
|
|
- this.saveBatch(newResumptionList);
|
|
|
- }
|
|
|
|
|
|
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -265,7 +276,7 @@ public class ResumptionServiceImpl extends ServiceImpl<ResumptionMapper, Resumpt
|
|
|
resumption.setYmdHalfyear(Long.valueOf(ymd.getHalfyear()));
|
|
|
resumption.setPlanId((ObjectUtil.equal(appPlan.getParentId(), -1L) || ObjectUtil.isNull(appPlan.getParentId())) ? appPlan.getId() : appPlan.getParentId());
|
|
|
resumption.setOrgId(appPlan.getPlanOfOrgId());
|
|
|
- resumption.setType(appPlan.getPlanType());
|
|
|
+ resumption.setType(appPlan.getPlanCycle());
|
|
|
resumption.setRoleId(role.getRoleId());
|
|
|
resumption.setPlanStartTime(planstartTime);
|
|
|
resumption.setPlanEndTime(planendTime);
|