|
|
@@ -11,6 +11,7 @@ import com.xunmei.common.core.constant.SecurityConstants;
|
|
|
import com.xunmei.common.core.exception.ServiceException;
|
|
|
import com.xunmei.common.core.utils.IDHelper;
|
|
|
import com.xunmei.common.core.utils.StringUtils;
|
|
|
+import com.xunmei.common.core.utils.Ymd;
|
|
|
import com.xunmei.common.core.utils.bean.BeanUtils;
|
|
|
import com.xunmei.common.core.vo.IdNameVo;
|
|
|
import com.xunmei.common.core.web.page.TableDataInfo;
|
|
|
@@ -39,6 +40,7 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
@@ -274,7 +276,7 @@ public class SafetyCheckRegisterSericeImpl extends ServiceImpl<CoreSafetyTaskMap
|
|
|
pointData.getCheckList().addAll(itemVo.getPointList());
|
|
|
}
|
|
|
|
|
|
- return submit(pointData);
|
|
|
+ return submit(pointData, false);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -306,11 +308,55 @@ public class SafetyCheckRegisterSericeImpl extends ServiceImpl<CoreSafetyTaskMap
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- return submit(appdata);
|
|
|
+ return submit(appdata, false);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Web临时登记_保存、提交
|
|
|
+ *
|
|
|
+ * @param data
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Boolean webTempSubmit(@RequestBody TaskRegisterVo<TaskRegisterAreaVo> data) {
|
|
|
+ if (ObjectUtil.isNull(data.getId())) {
|
|
|
+ data.setId(IDHelper.id());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+// TaskRegisterVo<AppTaskRegisterPointVo> appdata = new TaskRegisterVo<AppTaskRegisterPointVo>();
|
|
|
+// BeanUtils.copyProperties(data, appdata);
|
|
|
+// appdata.setCheckList(new ArrayList<>());
|
|
|
+// for (TaskRegisterAreaVo areaVo : data.getCheckList()) {
|
|
|
+// boolean firstPoint = true;
|
|
|
+//
|
|
|
+// for (TaskRegisterItemVo itemVo : areaVo.getItemList()) {
|
|
|
+//
|
|
|
+// for (TaskRegisterPointVo pointVo : itemVo.getPointList()) {
|
|
|
+//
|
|
|
+// AppTaskRegisterPointVo appPointVo = new AppTaskRegisterPointVo();
|
|
|
+// BeanUtils.copyProperties(pointVo, appPointVo);
|
|
|
+// BeanUtils.copyProperties(itemVo, appPointVo);
|
|
|
+// BeanUtils.copyProperties(areaVo, appPointVo);
|
|
|
+// appPointVo.setNfcList(new ArrayList<>());
|
|
|
+// if (firstPoint) {
|
|
|
+// appPointVo.setNfcList(areaVo.getNfcList());
|
|
|
+// firstPoint = false;
|
|
|
+// }
|
|
|
+// appdata.getCheckList().add(appPointVo);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+ return webSubmit(data);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param data
|
|
|
+ * @param isNewTask 临时登记
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@Transactional
|
|
|
- public Boolean submit(TaskRegisterVo<AppTaskRegisterPointVo> data) {
|
|
|
+ public Boolean submit(TaskRegisterVo<AppTaskRegisterPointVo> data, Boolean isNewTask) {
|
|
|
if (ObjectUtil.isNull(data) || CollectionUtil.isEmpty(data.getCheckList())) {
|
|
|
throw new ServiceException("检查内容不存在");
|
|
|
}
|
|
|
@@ -326,7 +372,10 @@ public class SafetyCheckRegisterSericeImpl extends ServiceImpl<CoreSafetyTaskMap
|
|
|
throw new ServiceException("任务已完成");
|
|
|
}
|
|
|
|
|
|
- removeExistData(data.getId());
|
|
|
+ if (!isNewTask) {
|
|
|
+ removeExistData(data.getId());
|
|
|
+ }
|
|
|
+
|
|
|
LoginUser user = SecurityUtils.getLoginUser();
|
|
|
List<CoreSafetyTaskData> points = new ArrayList();
|
|
|
List<CoreSafetyTaskDataNfc> nfcs = new ArrayList<>();
|
|
|
@@ -459,6 +508,53 @@ public class SafetyCheckRegisterSericeImpl extends ServiceImpl<CoreSafetyTaskMap
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 添加临时任务
|
|
|
+ *
|
|
|
+ * @param data
|
|
|
+ * @param exceptionCount
|
|
|
+ * @param isSubmit
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private boolean addTask(TaskRegisterVo data, Integer exceptionCount, Integer isSubmit) {
|
|
|
+ SysOrg beCheckedOrg = remoteOrgService.selectOrgById(data.getBeCheckedOrgId(), SecurityConstants.INNER);
|
|
|
+ SysOrg checkOrg = remoteOrgService.selectOrgById(data.getCheckOrgId(), SecurityConstants.INNER);
|
|
|
+
|
|
|
+ CoreSafetyTask task = new CoreSafetyTask();
|
|
|
+ task.setId(task.getId());
|
|
|
+ task.setTitle(data.getTaskName());
|
|
|
+ task.setCount(1);
|
|
|
+ task.setExceptionCount(exceptionCount.longValue());
|
|
|
+ task.setOrgId(data.getBeCheckedOrgId());
|
|
|
+ task.setOrgName(beCheckedOrg.getShortName());
|
|
|
+ task.setOrgPath(beCheckedOrg.getPath());
|
|
|
+ task.setCheckOrgId(data.getCheckOrgId());
|
|
|
+ task.setCheckOrgName(checkOrg.getShortName());
|
|
|
+ task.setStatus(ObjectUtil.equal(data.getIsSubmit(), 0) ? SafetyCheckTaskStatus.UnderWay.getValue() : SafetyCheckTaskStatus.Completed.getValue());
|
|
|
+ task.setSourceType(1L);
|
|
|
+ task.setBatchId(IDHelper.id());
|
|
|
+ task.setCheckTeam(data.getCheckTeam());
|
|
|
+ task.setDeleted(0L);
|
|
|
+ task.setRoleId(((IdNameVo) data.getCheckRoles().get(0)).getId());
|
|
|
+ task.setPlanStartTime(data.getPlanStartTime());
|
|
|
+ task.setPlanEndTime(data.getPlanEndTime());
|
|
|
+ task.setStartTime(new Date());
|
|
|
+ task.setEndTime(new Date());
|
|
|
+ Ymd ymd = Ymd.of(data.getYmdDate());
|
|
|
+ task.setYmdDate(ymd.getDate());
|
|
|
+ task.setYmdDay(ymd.getDay().longValue());
|
|
|
+ task.setYmdMonth(ymd.getMonth().longValue());
|
|
|
+ task.setYmdQuarter(ymd.getQuarter().longValue());
|
|
|
+ task.setYmdWeek(ymd.getWeek().longValue());
|
|
|
+ task.setYmdYear(ymd.getYear().longValue());
|
|
|
+ task.setYmdHalfyear(ymd.getHalfyear().longValue());
|
|
|
+ task.setSubmitTime(new Date());
|
|
|
+ task.setSubmitorId(SecurityUtils.getUserId());
|
|
|
+ task.setSubmitBy(SecurityUtils.getLoginUser().getName());
|
|
|
+
|
|
|
+ return baseMapper.insert(task) > 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 保存前删除之前保存的数据
|
|
|
*
|
|
|
* @param taskId
|