|
|
@@ -6,30 +6,31 @@ 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;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
-import com.mysql.cj.PreparedQuery;
|
|
|
+import com.xunmei.common.core.constant.SecurityConstants;
|
|
|
import com.xunmei.common.core.domain.panel.dto.PanelListDto;
|
|
|
import com.xunmei.common.core.domain.panel.enums.PanelTypeEnums;
|
|
|
import com.xunmei.common.core.domain.panel.vo.PanelListVo;
|
|
|
+import com.xunmei.common.core.domain.safetyindex.domain.CoreSafetyExceptionData;
|
|
|
import com.xunmei.common.core.utils.DateHelper;
|
|
|
import com.xunmei.common.core.utils.ResumptionType;
|
|
|
import com.xunmei.common.core.utils.Ymd;
|
|
|
import com.xunmei.core.resumption.domain.AppPlan;
|
|
|
import com.xunmei.core.resumption.domain.AppPlanToRole;
|
|
|
import com.xunmei.core.resumption.domain.Resumption;
|
|
|
-import com.xunmei.core.resumption.dto.resumptionRegister.ResumptionTaskDataDto;
|
|
|
import com.xunmei.core.resumption.dto.TaskDetailsDto;
|
|
|
+import com.xunmei.core.resumption.dto.resumptionRegister.ResumptionTaskDataDto;
|
|
|
import com.xunmei.core.resumption.mapper.AppPlanMapper;
|
|
|
import com.xunmei.core.resumption.mapper.AppPlanToRoleMapper;
|
|
|
import com.xunmei.core.resumption.mapper.ResumptionMapper;
|
|
|
-import com.xunmei.core.resumption.service.AppPlanService;
|
|
|
import com.xunmei.core.resumption.service.ResumptionService;
|
|
|
import com.xunmei.core.resumption.vo.AppRulePointTaskVo;
|
|
|
import com.xunmei.core.resumption.vo.ResumptionAppVo;
|
|
|
import com.xunmei.core.resumption.vo.ResumptionTaskNewDto;
|
|
|
import com.xunmei.core.resumption.vo.WorkChangeResumptionVo;
|
|
|
+import com.xunmei.system.api.RemoteRoleService;
|
|
|
+import com.xunmei.system.api.domain.SysRole;
|
|
|
import com.xunmei.system.api.domain.SysWorkTime;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -47,46 +48,56 @@ public class ResumptionServiceImpl extends ServiceImpl<ResumptionMapper, Resumpt
|
|
|
private AppPlanToRoleMapper appPlanToRoleMapper;
|
|
|
@Autowired
|
|
|
private AppPlanMapper appPlanMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private RemoteRoleService roleService;
|
|
|
+
|
|
|
@Override
|
|
|
public List<Map<String, Object>> findDayTaskList(int year, int quarter, String dateTime, Long roleId, Long orgid) {
|
|
|
- return resumptionMapper.findDayTaskList(year,quarter,dateTime, roleId, orgid);
|
|
|
+ return resumptionMapper.findDayTaskList(year, quarter, dateTime, roleId, orgid);
|
|
|
}
|
|
|
+
|
|
|
@Override
|
|
|
public List<Map<String, Object>> findMonthTaskList(int year, int month, int type, Long roleId, Long orgid, int quarter) {
|
|
|
return resumptionMapper.findMonthTaskList(year, month, type, roleId, orgid, quarter);
|
|
|
}
|
|
|
+
|
|
|
@Override
|
|
|
public List<Map<String, Object>> findYearTaskList(int year, int type, Long roleId, Long orgid, int quarter) {
|
|
|
- return resumptionMapper.findYearTaskList(year, type, roleId, orgid,quarter);
|
|
|
+ return resumptionMapper.findYearTaskList(year, type, roleId, orgid, quarter);
|
|
|
}
|
|
|
+
|
|
|
@Override
|
|
|
public Resumption findOneByTaskIdAndDate(TaskDetailsDto request) {
|
|
|
DateHelper dateTime = new DateHelper(request.getDateTime());
|
|
|
- int year =dateTime.getYear();
|
|
|
- int quarter =dateTime.getQuarter() ;
|
|
|
+ int year = dateTime.getYear();
|
|
|
+ int quarter = dateTime.getQuarter();
|
|
|
//如果是年任务季度设为1
|
|
|
- if(request.getType()==5){
|
|
|
+ if (request.getType() == 5) {
|
|
|
quarter = 1;
|
|
|
}
|
|
|
- return resumptionMapper.findOneByTaskIdAndDate(request.getTaskId(),year,quarter);
|
|
|
+ return resumptionMapper.findOneByTaskIdAndDate(request.getTaskId(), year, quarter);
|
|
|
}
|
|
|
+
|
|
|
@Override
|
|
|
public Resumption findOneByTaskIdAndDate(ResumptionTaskDataDto request) {
|
|
|
- return resumptionMapper.findOneByTaskIdAndDate(request.getResumptionId(),request.getYear(),request.getQuarter());
|
|
|
+ return resumptionMapper.findOneByTaskIdAndDate(request.getResumptionId(), request.getYear(), request.getQuarter());
|
|
|
}
|
|
|
+
|
|
|
@Override
|
|
|
public List<Map<String, Object>> findOneByTaskId(TaskDetailsDto request) {
|
|
|
final DateHelper dateTime = new DateHelper(request.getDateTime());
|
|
|
- int year =dateTime.getYear();
|
|
|
- int quarter =dateTime.getQuarter() ;
|
|
|
+ int year = dateTime.getYear();
|
|
|
+ int quarter = dateTime.getQuarter();
|
|
|
//如果是年任务季度设为1
|
|
|
- if(request.getType()==5){
|
|
|
+ if (request.getType() == 5) {
|
|
|
quarter = 1;
|
|
|
}
|
|
|
return resumptionMapper.findOneByTaskId(request.getTaskId(), year, quarter);
|
|
|
}
|
|
|
+
|
|
|
@Override
|
|
|
- public void updateResumption(Resumption resumption){
|
|
|
+ public void updateResumption(Resumption resumption) {
|
|
|
resumptionMapper.updateResumption(resumption);
|
|
|
}
|
|
|
|
|
|
@@ -94,6 +105,7 @@ public class ResumptionServiceImpl extends ServiceImpl<ResumptionMapper, Resumpt
|
|
|
public List<ResumptionAppVo> findResumptionApp(ResumptionTaskNewDto res) {
|
|
|
return resumptionMapper.findResumptionApp(res);
|
|
|
}
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional(readOnly = false, rollbackFor = {Exception.class, RuntimeException.class}, propagation = Propagation.REQUIRES_NEW)
|
|
|
public void newbuild(Long orgId, ResumptionType type, final Date dateTime, final Boolean isWork, AppPlan appPlan, List<Object> nfcList, List<AppRulePointTaskVo> pointList, List<Long> roleIds, DateTime planstartTime, DateTime planendTime) {
|
|
|
@@ -112,7 +124,7 @@ public class ResumptionServiceImpl extends ServiceImpl<ResumptionMapper, Resumpt
|
|
|
planendTime = DateUtil.endOfDay(planendTime).offset(DateField.MILLISECOND, -999);
|
|
|
}
|
|
|
Resumption resumption = new Resumption();
|
|
|
- resumption.setStatus( 1);
|
|
|
+ resumption.setStatus(1);
|
|
|
resumption.setYmd(ymd);
|
|
|
resumption.setName(appPlan.getPlanName());
|
|
|
resumption.setYmdDate(ymd.getDate());
|
|
|
@@ -136,10 +148,12 @@ public class ResumptionServiceImpl extends ServiceImpl<ResumptionMapper, Resumpt
|
|
|
this.saveBatch(resumptions);
|
|
|
|
|
|
}
|
|
|
+
|
|
|
@Override
|
|
|
public List<WorkChangeResumptionVo> findResumptionList(List<Long> orgIds, Date date, Integer type, Integer status, Integer year, Integer quarter) {
|
|
|
return resumptionMapper.findResumptionList(orgIds, date, type, status, year, quarter);
|
|
|
}
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional(readOnly = false, rollbackFor = {Exception.class, RuntimeException.class}, propagation = Propagation.REQUIRES_NEW)
|
|
|
public void saveResumption(List<Resumption> listResumption, List<AppPlan> appPlanList, List<Map<String, Long>> planIdAndOrgs) {
|
|
|
@@ -159,6 +173,7 @@ public class ResumptionServiceImpl extends ServiceImpl<ResumptionMapper, Resumpt
|
|
|
//this.save(resumptionList);
|
|
|
this.saveBatch(resumptionList);
|
|
|
}
|
|
|
+
|
|
|
@Override
|
|
|
public void deleteResumption(List<String> ids, Integer year, Integer quarter) {
|
|
|
resumptionMapper.deleteResumption(ids, year, quarter);
|
|
|
@@ -168,8 +183,10 @@ public class ResumptionServiceImpl extends ServiceImpl<ResumptionMapper, Resumpt
|
|
|
public List<PanelListVo> selectCurUserTaskList(PanelListDto panelListDto) {
|
|
|
|
|
|
List<PanelListVo> list = resumptionMapper.selectCurUserTaskList(panelListDto);
|
|
|
- list.removeIf(item->DateUtil.compare(new Date(), item.getEndTime()) > 0);
|
|
|
- list.forEach(item->{item.setType(PanelTypeEnums.RESUMPTION.getCode());});
|
|
|
+ list.removeIf(item -> DateUtil.compare(new Date(), item.getEndTime()) > 0);
|
|
|
+ list.forEach(item -> {
|
|
|
+ item.setType(PanelTypeEnums.RESUMPTION.getCode());
|
|
|
+ });
|
|
|
|
|
|
return list;
|
|
|
}
|
|
|
@@ -190,12 +207,12 @@ public class ResumptionServiceImpl extends ServiceImpl<ResumptionMapper, Resumpt
|
|
|
//每日任务
|
|
|
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());
|
|
|
+ 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)){
|
|
|
+ if (CollectionUtils.isNotEmpty(resumptionListWlz)) {
|
|
|
resumptionMapper.deleteBatchIds(resumptionListWlz.stream().map(Resumption::getId).collect(Collectors.toList()));
|
|
|
}
|
|
|
}
|
|
|
@@ -211,15 +228,15 @@ public class ResumptionServiceImpl extends ServiceImpl<ResumptionMapper, Resumpt
|
|
|
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){
|
|
|
+ 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)){
|
|
|
+ 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)){
|
|
|
+ if (CollectionUtils.isNotEmpty(resumptionListb)) {
|
|
|
newResumptionList.addAll(resumptionListb);
|
|
|
}
|
|
|
}
|
|
|
@@ -230,7 +247,7 @@ public class ResumptionServiceImpl extends ServiceImpl<ResumptionMapper, Resumpt
|
|
|
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -260,10 +277,10 @@ public class ResumptionServiceImpl extends ServiceImpl<ResumptionMapper, Resumpt
|
|
|
planstartTime = time1.setField(DateField.HOUR_OF_DAY, Integer.parseInt(closetime.split(":")[0])).setField(DateField.MINUTE, Integer.parseInt(closetime.split(":")[1])).setField(DateField.SECOND, 0).setField(DateField.MILLISECOND, 0);
|
|
|
planendTime = DateUtil.endOfDay(time2).setField(DateField.MILLISECOND, 0);
|
|
|
}
|
|
|
- for(AppPlanToRole role :planToRoles){
|
|
|
+ for (AppPlanToRole role : planToRoles) {
|
|
|
Resumption resumption = new Resumption();
|
|
|
Ymd ymd = Ymd.of(dateTime);
|
|
|
- resumption.setStatus( 1);
|
|
|
+ resumption.setStatus(1);
|
|
|
resumption.setYmd(ymd);
|
|
|
resumption.setName(appPlan.getPlanName());
|
|
|
resumption.setYmdDate(ymd.getDate());
|
|
|
@@ -285,4 +302,10 @@ public class ResumptionServiceImpl extends ServiceImpl<ResumptionMapper, Resumpt
|
|
|
}
|
|
|
return resumptionList;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<CoreSafetyExceptionData> findResumptionList(DateTime time) {
|
|
|
+ SysRole role = roleService.getRoleByName("网点安全员", SecurityConstants.FROM_SOURCE);
|
|
|
+ return baseMapper.findResumptionExceptionList(time.year(), time.quarter(), time.month() + 1, role.getId());
|
|
|
+ }
|
|
|
}
|