|
@@ -2,17 +2,24 @@ package com.platform.rest.controller.sb;
|
|
|
|
|
|
import com.platform.common.bean.AbstractPageResultBean;
|
|
|
import com.platform.common.exception.DeniedException;
|
|
|
+import com.platform.common.model.OauthUser;
|
|
|
+import com.platform.common.model.UserInfo;
|
|
|
import com.platform.common.util.BeanConverterUtil;
|
|
|
+import com.platform.common.util.IdGeneratorUtils;
|
|
|
import com.platform.common.util.R;
|
|
|
import com.platform.common.util.SecurityUtils;
|
|
|
import com.platform.common.validation.group.AddGroup;
|
|
|
import com.platform.common.validation.group.UpdateGroup;
|
|
|
import com.platform.dao.dto.sb.SbChangeRecordDTO;
|
|
|
import com.platform.dao.dto.sb.SbInfoDTO;
|
|
|
+import com.platform.dao.dto.sb.SbMeasureLogDTO;
|
|
|
import com.platform.dao.entity.sb.SbInfo;
|
|
|
+import com.platform.dao.entity.sb.SbMeasureLog;
|
|
|
import com.platform.dao.entity.sb.SbType;
|
|
|
+import com.platform.dao.enums.SbMeasureLogOtherTypeEnum;
|
|
|
import com.platform.dao.enums.SysRoleCodeEnum;
|
|
|
import com.platform.dao.mapper.sb.SbInfoMapper;
|
|
|
+import com.platform.dao.mapper.sb.SbMeasureLogMapper;
|
|
|
import com.platform.dao.mapper.sb.SbTypeMapper;
|
|
|
import com.platform.dao.util.ExcelUtil;
|
|
|
import com.platform.dao.util.TreeUtil;
|
|
@@ -37,6 +44,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.FileInputStream;
|
|
|
import java.io.FileNotFoundException;
|
|
|
+import java.time.LocalDateTime;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
@@ -57,6 +65,7 @@ public class SbInfoController {
|
|
|
private final FillGatherTaskService fillGatherTaskService;
|
|
|
private final SbInfoMapper sbInfoMapper;
|
|
|
private final SbTypeMapper sbTypeMapper;
|
|
|
+ private final SbMeasureLogMapper sbMeasureLogMapper;
|
|
|
|
|
|
/**
|
|
|
* 设备工作台数据
|
|
@@ -252,9 +261,42 @@ public class SbInfoController {
|
|
|
ids.forEach(item->{
|
|
|
fillGatherTaskService.getDetailBySbId(item);
|
|
|
});
|
|
|
+ SbInfoDTO dto = new SbInfoDTO();
|
|
|
+ dto.setSbIds(ids);
|
|
|
+ dto.setUseType(4);
|
|
|
+ List<SbInfoVO> sbInfoVOS = sbInfoMapper.selectVOList(dto);
|
|
|
sbInfoService.batchDelete(ids);
|
|
|
+
|
|
|
+ List<SbMeasureLog> measureLogs = new ArrayList<>();
|
|
|
+ StringBuffer stringBuffer = new StringBuffer();
|
|
|
+ if (sbInfoVOS!=null&&sbInfoVOS.size()>0) {
|
|
|
+ for (SbInfoVO vo : sbInfoVOS) {
|
|
|
+ SbMeasureLog log = new SbMeasureLog();
|
|
|
+ log.setOtherType(SbMeasureLogOtherTypeEnum.DELETE.getValue());
|
|
|
+ log.setId(IdGeneratorUtils.getObjectId());
|
|
|
+ setCreateUserInfo(log);
|
|
|
+ log.setSbId(vo.getId());
|
|
|
+ stringBuffer.append("设备位号为:"+vo.getPositionNo()==null?"":vo.getPositionNo()+",设备位置为:"+vo.getPositionName()==null?"":vo.getPositionName()+"的设备:"+vo.getName()+"于"+log.getCreatedTime()+"被"+log.getCreatedUserName()+"删除");
|
|
|
+ log.setContent(stringBuffer.toString());
|
|
|
+ measureLogs.add(log);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ sbMeasureLogMapper.insertListforComplex(measureLogs);
|
|
|
return new R<>();
|
|
|
}
|
|
|
+ public void setCreateUserInfo(SbMeasureLog model) {
|
|
|
+ model.setCreatedTime(LocalDateTime.now());
|
|
|
+ model.setUpdateTime(LocalDateTime.now());
|
|
|
+ OauthUser user = SecurityUtils.getUser();
|
|
|
+ if (user != null) {
|
|
|
+ UserInfo userInfo = user.getUserInfo();
|
|
|
+ model.setCreatedUserId(userInfo.getUserId());
|
|
|
+ model.setCreatedUserName(userInfo.getRealName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 获取分页
|