|
@@ -8,16 +8,19 @@ import com.platform.common.bean.AbstractPageResultBean;
|
|
|
import com.platform.common.cache.ConfigCache;
|
|
|
import com.platform.common.constant.RedisKeyConstants;
|
|
|
import com.platform.common.exception.DeniedException;
|
|
|
+import com.platform.common.model.OauthUser;
|
|
|
import com.platform.common.model.UserInfo;
|
|
|
import com.platform.common.util.*;
|
|
|
import com.platform.dao.bean.MyPage;
|
|
|
import com.platform.dao.dto.fill.FillGatherTaskDTO;
|
|
|
import com.platform.dao.dto.fill.FillGatherTaskDetailDTO;
|
|
|
import com.platform.dao.entity.fill.*;
|
|
|
+import com.platform.dao.entity.sb.SbChangeRecord;
|
|
|
import com.platform.dao.entity.upms.SysRole;
|
|
|
import com.platform.dao.entity.upms.SysUser;
|
|
|
import com.platform.dao.enums.*;
|
|
|
import com.platform.dao.mapper.fill.*;
|
|
|
+import com.platform.dao.mapper.sb.SbChangeRecordMapper;
|
|
|
import com.platform.dao.mapper.upms.SysRoleMapper;
|
|
|
import com.platform.dao.mapper.upms.SysUserMapper;
|
|
|
import com.platform.dao.util.MessageTemplateUtil;
|
|
@@ -35,6 +38,9 @@ import org.springframework.stereotype.Service;
|
|
|
import tk.mybatis.mapper.weekend.Weekend;
|
|
|
import tk.mybatis.mapper.weekend.WeekendCriteria;
|
|
|
|
|
|
+import javax.persistence.Id;
|
|
|
+import java.lang.annotation.Annotation;
|
|
|
+import java.lang.reflect.Field;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.ArrayList;
|
|
@@ -60,6 +66,7 @@ public class FillGatherTaskServiceImpl extends BaseServiceImpl<FillGatherTaskMap
|
|
|
private final SysUserMapper sysUserMapper;
|
|
|
private final FillUpdateRecordMapper fillUpdateRecordMapper;
|
|
|
private final SysRoleMapper sysRoleMapper;
|
|
|
+ private final SbChangeRecordMapper sbChangeRecordMapper;
|
|
|
|
|
|
private void deleteDetails(List<String> detailIds,String taskId){
|
|
|
StringBuilder ids = new StringBuilder();
|
|
@@ -502,15 +509,49 @@ public class FillGatherTaskServiceImpl extends BaseServiceImpl<FillGatherTaskMap
|
|
|
if(StringUtils.isBlank(model.getId())){
|
|
|
throw new DeniedException("任务ID不能为空");
|
|
|
}
|
|
|
+
|
|
|
FillGatherTask task = new FillGatherTask();
|
|
|
task.setId(model.getId());
|
|
|
task.setRecordJson(model.getRecordJson());
|
|
|
task.setUpdateTime(LocalDateTime.now());
|
|
|
task.setStatus(model.getStatus());
|
|
|
mapper.updateByPrimaryKeySelective(task);
|
|
|
+ List<SbChangeRecord> list = new ArrayList<>();
|
|
|
+ for (String id:model.getSbIds()) {
|
|
|
+ SbChangeRecord sbChangeRecord = new SbChangeRecord();
|
|
|
+ sbChangeRecord.setCreatedTime(LocalDateTime.now());
|
|
|
+ sbChangeRecord.setUpdateTime(LocalDateTime.now());
|
|
|
+ sbChangeRecord.setTransformType(SbTransFormTypeEnum.FILL_CHECK.getValue());
|
|
|
+ sbChangeRecord.setSbId(id);
|
|
|
+ OauthUser user = SecurityUtils.getUser();
|
|
|
+ if (user != null) {
|
|
|
+ UserInfo userInfo = user.getUserInfo();
|
|
|
+ sbChangeRecord.setCreatedUserId(userInfo.getUserId());
|
|
|
+ sbChangeRecord.setCreatedUserName(userInfo.getRealName());
|
|
|
+ }
|
|
|
+ setKey(sbChangeRecord);
|
|
|
+ list.add(sbChangeRecord);
|
|
|
+
|
|
|
+ }
|
|
|
+ sbChangeRecordMapper.insertListforComplex(list);
|
|
|
// 通知巡检人
|
|
|
//sendMessageToChecker(mapper.selectByPrimaryKey(task.getId()),null);
|
|
|
}
|
|
|
+ public void setKey(SbChangeRecord t) {
|
|
|
+ Field[] fields = t.getClass().getDeclaredFields();
|
|
|
+ for (Field field : fields) {
|
|
|
+ Annotation id = field.getAnnotation(Id.class);
|
|
|
+ if (id == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ field.setAccessible(true);
|
|
|
+ field.set(t, IdGeneratorUtils.getObjectId());
|
|
|
+ } catch (IllegalAccessException e) {
|
|
|
+// log.error("主键赋值异常");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
@Override
|
|
|
public void fillStopDefault(String taskId, String detailId) {
|