|
@@ -19,6 +19,7 @@ import com.platform.dao.bean.MyVOPage;
|
|
|
import com.platform.dao.dto.check.CheckStandardDTO;
|
|
|
import com.platform.dao.dto.part.PartInfoDTO;
|
|
|
import com.platform.dao.dto.sb.SbInfoDTO;
|
|
|
+import com.platform.dao.dto.sb.SbMeasureLogDTO;
|
|
|
import com.platform.dao.dto.sb.SbModelSpareBomDTO;
|
|
|
import com.platform.dao.dto.upms.SysDeptDTO;
|
|
|
import com.platform.dao.dto.upms.SysUserDeptDTO;
|
|
@@ -52,7 +53,10 @@ import com.platform.dao.util.compare.FieldComparedUtils;
|
|
|
import com.platform.dao.vo.SysUserDeptVO;
|
|
|
import com.platform.dao.vo.SysUserVO;
|
|
|
import com.platform.dao.vo.export.sb.ExportSbInfoVO;
|
|
|
+import com.platform.dao.vo.query.sb.SbMeasureLogVO;
|
|
|
import com.platform.dao.vo.query.upms.SysDeptVO;
|
|
|
+import com.platform.dao.vo.report.MeasureLogReportVO;
|
|
|
+import com.platform.dao.vo.report.SbInfoTypeReportVO;
|
|
|
import com.platform.dao.vo.sb.*;
|
|
|
import com.platform.service.base.impl.BaseServiceImpl;
|
|
|
import com.platform.service.business.ActivitiBusinessService;
|
|
@@ -464,7 +468,7 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
@Override
|
|
|
public void modModelByDTO(SbInfoDTO model) {
|
|
|
|
|
|
- if(model.getCheckDate() != null && model.getCheckPeriod() != null && model.getNextCheckDate() == null){
|
|
|
+ if (model.getCheckDate() != null && model.getCheckPeriod() != null && model.getNextCheckDate() == null) {
|
|
|
model.setNextCheckDate(model.getCheckDate().minusMonths(-model.getCheckPeriod()));
|
|
|
}
|
|
|
if (model.getIsFinancing() == null) {
|
|
@@ -483,9 +487,9 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
setSbStatusLogAndStopLog(model);
|
|
|
// 保存修改记录
|
|
|
SbInfo sbInfo = mapper.selectByPrimaryKey(model.getId());
|
|
|
- SbInfoDTO oldDTO = BeanConverterUtil.copyObjectProperties(sbInfo,SbInfoDTO.class);
|
|
|
- String updateInfo = FieldComparedUtils.compareBean(oldDTO,model);
|
|
|
- packageLogInfo(updateInfo,model.getId());
|
|
|
+ SbInfoDTO oldDTO = BeanConverterUtil.copyObjectProperties(sbInfo, SbInfoDTO.class);
|
|
|
+ String updateInfo = FieldComparedUtils.compareBean(oldDTO, model);
|
|
|
+ packageLogInfo(updateInfo, model.getId());
|
|
|
super.modModelByDTO(model);
|
|
|
// 保存文件
|
|
|
this.saveImageFile(model);
|
|
@@ -494,7 +498,7 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
this.saveRecheckFile(model);
|
|
|
}
|
|
|
|
|
|
- private void packageLogInfo(String updateInfo,String sbId){
|
|
|
+ private void packageLogInfo(String updateInfo, String sbId) {
|
|
|
SbChangeLog log = new SbChangeLog();
|
|
|
log.setCreatedTime(LocalDateTime.now());
|
|
|
log.setCreatedUserId(SecurityUtils.getUserInfo().getUserId());
|
|
@@ -593,36 +597,36 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
List<SbModelSpareBomVO> spareList = new ArrayList<>();
|
|
|
List<SbModelSpareBomVO> spareList2 = new ArrayList<>();
|
|
|
for (PartInfo info : partInfoList) {
|
|
|
- for (SbModelSpareBomVO vo : sbModelSpareBomVOList) {
|
|
|
- if (StringUtils.isBlank(vo.getSbPartId())) {
|
|
|
- spareList.add(vo);
|
|
|
- } else {
|
|
|
- if (info.getId().equals(vo.getSbPartId())) {
|
|
|
- spareList2.add(vo);
|
|
|
+ for (SbModelSpareBomVO vo : sbModelSpareBomVOList) {
|
|
|
+ if (StringUtils.isBlank(vo.getSbPartId())) {
|
|
|
+ spareList.add(vo);
|
|
|
+ } else {
|
|
|
+ if (info.getId().equals(vo.getSbPartId())) {
|
|
|
+ spareList2.add(vo);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ info.setSparePartInfoVOList(spareList2);
|
|
|
}
|
|
|
- info.setSparePartInfoVOList(spareList2);
|
|
|
- }
|
|
|
sbTreeVO.setId(sbInfoDTO.getId());
|
|
|
sbTreeVO.setPartInfoList(partInfoList);
|
|
|
sbTreeVO.setSbModelSpareBomVOList(spareList);
|
|
|
return sbTreeVO;
|
|
|
}
|
|
|
|
|
|
-@Override
|
|
|
+ @Override
|
|
|
public SbTreeVO getSbVOById(SbInfoDTO sbInfoDTO) {
|
|
|
- SbInfoVO sbInfoVO=sbInfoMapper.getById(sbInfoDTO.getId());
|
|
|
- List<SbInfoVO> ids=sbInfoMapper.getSubSb(sbInfoDTO);
|
|
|
+ SbInfoVO sbInfoVO = sbInfoMapper.getById(sbInfoDTO.getId());
|
|
|
+ List<SbInfoVO> ids = sbInfoMapper.getSubSb(sbInfoDTO);
|
|
|
SbTreeVO sbTreeVO = new SbTreeVO();
|
|
|
sbTreeVO.setModel(sbInfoVO.getModel());
|
|
|
sbTreeVO.setName(sbInfoVO.getName());
|
|
|
sbTreeVO.setStatus(sbInfoVO.getStatus());
|
|
|
- List<SbTreeVO> subSbTreeList=new ArrayList<>();
|
|
|
- if(ids!=null&&ids.size()>0){
|
|
|
- for(SbInfoVO id: ids){
|
|
|
- SbInfoDTO infoDTO=new SbInfoDTO();
|
|
|
- SbTreeVO subSbTreeVO= getSbVOById(infoDTO.setId(id.getId()));
|
|
|
+ List<SbTreeVO> subSbTreeList = new ArrayList<>();
|
|
|
+ if (ids != null && ids.size() > 0) {
|
|
|
+ for (SbInfoVO id : ids) {
|
|
|
+ SbInfoDTO infoDTO = new SbInfoDTO();
|
|
|
+ SbTreeVO subSbTreeVO = getSbVOById(infoDTO.setId(id.getId()));
|
|
|
// subSbTreeVO.setName(id.getName());
|
|
|
|
|
|
subSbTreeList.add(subSbTreeVO);
|
|
@@ -669,10 +673,10 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
List<SysUser> users = sysUserMapper.selectAll(); // 用户集合
|
|
|
try {
|
|
|
List<ExportSbInfoVO> list = ExcelUtil.importExcel(file.getInputStream(), ExportSbInfoVO.class, 1);
|
|
|
- if(CollectionUtil.isNotEmpty(list)){
|
|
|
- for(ExportSbInfoVO vo : list){
|
|
|
- SbInfo tempInfo = BeanConverterUtil.copyObjectProperties(vo,SbInfo.class);
|
|
|
- if(StringUtils.isNotBlank(vo.getTypeName())){ // 设备类型匹配
|
|
|
+ if (CollectionUtil.isNotEmpty(list)) {
|
|
|
+ for (ExportSbInfoVO vo : list) {
|
|
|
+ SbInfo tempInfo = BeanConverterUtil.copyObjectProperties(vo, SbInfo.class);
|
|
|
+ if (StringUtils.isNotBlank(vo.getTypeName())) { // 设备类型匹配
|
|
|
boolean findSbType = false;
|
|
|
for (SbType sbType : typeList) {
|
|
|
if (sbType.getName().equalsIgnoreCase(vo.getTypeName().trim())) {
|
|
@@ -685,7 +689,7 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
throw new BusinessException("系统找不到该设备类型名称,请先添加设备类型, 设备类型名称" + vo.getTypeName());
|
|
|
}
|
|
|
}
|
|
|
- if(StringUtils.isNotBlank(vo.getPositionName())){ // 设备位置匹配
|
|
|
+ if (StringUtils.isNotBlank(vo.getPositionName())) { // 设备位置匹配
|
|
|
boolean findPosition = false;
|
|
|
for (SbPosition position : positionList) {
|
|
|
if (position.getName().equalsIgnoreCase(vo.getPositionName().trim())) {
|
|
@@ -698,7 +702,7 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
throw new BusinessException("系统找不到车间名称,请先添加车间, 车间名称" + vo.getPositionName());
|
|
|
}
|
|
|
}
|
|
|
- if(StringUtils.isNotBlank(vo.getProducerName())){ // 生产商匹配
|
|
|
+ if (StringUtils.isNotBlank(vo.getProducerName())) { // 生产商匹配
|
|
|
boolean findProducer = false;
|
|
|
for (FirmProducer producer : producerList) {
|
|
|
if (producer.getName().equalsIgnoreCase(vo.getProducerName().trim())) {
|
|
@@ -711,7 +715,7 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
throw new BusinessException("找不到生产商,请先添加:" + vo.getProducerName());
|
|
|
}
|
|
|
}
|
|
|
- if(StringUtils.isNotBlank(vo.getSaveUserName())){ // 使用人员
|
|
|
+ if (StringUtils.isNotBlank(vo.getSaveUserName())) { // 使用人员
|
|
|
boolean findSaveUser = false;
|
|
|
for (SysUser user : users) {
|
|
|
if (user.getRealName().equalsIgnoreCase(vo.getSaveUserName().trim())) {
|
|
@@ -738,11 +742,11 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
}
|
|
|
}*/
|
|
|
// 如果计量设备
|
|
|
- if(vo.getUseType() == SbUseType.BGCL.getValue() && vo.getIsMeasure() == YesNoEnum.YES.getValue()){
|
|
|
- if(vo.getCheckDate() == null && vo.getNextCheckDate() == null){
|
|
|
+ if (vo.getUseType() == SbUseType.BGCL.getValue() && vo.getIsMeasure() == YesNoEnum.YES.getValue()) {
|
|
|
+ if (vo.getCheckDate() == null && vo.getNextCheckDate() == null) {
|
|
|
throw new BusinessException("上次和下次检定日期,不能全部为空");
|
|
|
}
|
|
|
- if(vo.getCheckPeriod() == null){
|
|
|
+ if (vo.getCheckPeriod() == null) {
|
|
|
throw new BusinessException("检定周期不能为空");
|
|
|
}
|
|
|
}
|
|
@@ -761,9 +765,8 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
* 定时任务,对需要检定的进行检定状态设置,
|
|
|
* 1:根据设备的检定预警周期
|
|
|
* 2:筛选
|
|
|
- * a) 检定状态为正常的
|
|
|
- * b) 当前日期+预警天数>有效期的
|
|
|
- *
|
|
|
+ * a) 检定状态为正常的
|
|
|
+ * b) 当前日期+预警天数>有效期的
|
|
|
*/
|
|
|
@Override
|
|
|
public void generateSbMeasureLog() {
|
|
@@ -773,40 +776,40 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
record.setIsMeasure(YesNoEnum.YES.getValue());
|
|
|
List<SbInfoVO> list = mapper.selectPageInfoForWarn(record);
|
|
|
List<SbInfoVO> updateList = new ArrayList<>();
|
|
|
- if(CollectionUtil.isNotEmpty(list)){
|
|
|
- for(SbInfoVO vo:list){
|
|
|
+ if (CollectionUtil.isNotEmpty(list)) {
|
|
|
+ for (SbInfoVO vo : list) {
|
|
|
SbInfoVO update = new SbInfoVO();
|
|
|
update.setId(vo.getId());
|
|
|
update.setMeasureStatus(YesNoEnum.YES.getValue());
|
|
|
updateList.add(update);
|
|
|
}
|
|
|
}
|
|
|
- if(CollectionUtil.isNotEmpty(updateList)){
|
|
|
+ if (CollectionUtil.isNotEmpty(updateList)) {
|
|
|
updateBatch(updateList);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<SbInfoVO> getChildSbByIds(List<String> ids) {
|
|
|
- Map<String,String> maps = new HashMap<>();
|
|
|
- ids.forEach(item -> maps.put(item,item));
|
|
|
+ Map<String, String> maps = new HashMap<>();
|
|
|
+ ids.forEach(item -> maps.put(item, item));
|
|
|
SbInfoDTO queryDTO = new SbInfoDTO();
|
|
|
queryDTO.setIds(ids);
|
|
|
List<SbInfoVO> list = mapper.selectVOList(queryDTO);
|
|
|
List<SbInfoVO> resultList = ListUtils.newArrayList();
|
|
|
- if(list != null && list.size() > 0){
|
|
|
+ if (list != null && list.size() > 0) {
|
|
|
list.forEach(item -> {
|
|
|
// 子设备且父设备在maps中不添加
|
|
|
- if(StringUtils.isNotBlank(item.getParentId())){
|
|
|
+ if (StringUtils.isNotBlank(item.getParentId())) {
|
|
|
// 子设备
|
|
|
- if(StringUtils.isBlank(maps.get(item.getParentId()))){
|
|
|
+ if (StringUtils.isBlank(maps.get(item.getParentId()))) {
|
|
|
// 获取子设备
|
|
|
SbInfoDTO query = new SbInfoDTO();
|
|
|
query.setParentId(item.getId());
|
|
|
item.setChildren(mapper.selectVOList(query));
|
|
|
resultList.add(item);
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
// 获取子设备
|
|
|
SbInfoDTO query = new SbInfoDTO();
|
|
|
query.setParentId(item.getId());
|
|
@@ -820,18 +823,19 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
|
|
|
/**
|
|
|
* 更新和记录修改
|
|
|
+ *
|
|
|
* @param sbInfos
|
|
|
*/
|
|
|
- private void updateListAndSaveChange(List<SbInfo> sbInfos){
|
|
|
- if(sbInfos.size() > 0){
|
|
|
- for(SbInfo sbInfo : sbInfos){
|
|
|
- SbInfoDTO afterDTO = BeanConverterUtil.copyObjectProperties(sbInfo,SbInfoDTO.class);
|
|
|
+ private void updateListAndSaveChange(List<SbInfo> sbInfos) {
|
|
|
+ if (sbInfos.size() > 0) {
|
|
|
+ for (SbInfo sbInfo : sbInfos) {
|
|
|
+ SbInfoDTO afterDTO = BeanConverterUtil.copyObjectProperties(sbInfo, SbInfoDTO.class);
|
|
|
SbInfo old = mapper.selectByPrimaryKey(sbInfo.getId());
|
|
|
- SbInfoDTO beforeDTO = BeanConverterUtil.copyObjectProperties(old,SbInfoDTO.class);
|
|
|
+ SbInfoDTO beforeDTO = BeanConverterUtil.copyObjectProperties(old, SbInfoDTO.class);
|
|
|
mapper.updateByPrimaryKeySelective(sbInfo);
|
|
|
- String info = FieldComparedUtils.compareBean(beforeDTO,afterDTO);
|
|
|
- if(StringUtils.isNotBlank(info)){
|
|
|
- packageLogInfo(info,sbInfo.getId()); // 保存修改记录
|
|
|
+ String info = FieldComparedUtils.compareBean(beforeDTO, afterDTO);
|
|
|
+ if (StringUtils.isNotBlank(info)) {
|
|
|
+ packageLogInfo(info, sbInfo.getId()); // 保存修改记录
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1175,15 +1179,15 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
@Override
|
|
|
public List<Map<String, String>> selectCountByPositionGroup() {
|
|
|
List<Map<String, String>> sbInfoCountMapList = mapper.selectCountByPositionGroup();
|
|
|
- if(sbInfoCountMapList != null) {
|
|
|
- for (Map<String, String> map: sbInfoCountMapList) {
|
|
|
+ if (sbInfoCountMapList != null) {
|
|
|
+ for (Map<String, String> map : sbInfoCountMapList) {
|
|
|
// 汇总厂区的,将厂区下面的车间数量累加到上面
|
|
|
if (String.valueOf(map.get("type")).equals("1")) {
|
|
|
int childNum = 0;
|
|
|
- for (Map<String, String> child: sbInfoCountMapList) {
|
|
|
+ for (Map<String, String> child : sbInfoCountMapList) {
|
|
|
if (map.get("id").equals(child.get("parentId"))) {
|
|
|
String childNumStr = String.valueOf(child.get("num"));
|
|
|
- if(!StringUtils.isEmpty(childNumStr)){
|
|
|
+ if (!StringUtils.isEmpty(childNumStr)) {
|
|
|
childNum = childNum + Integer.valueOf(childNumStr);
|
|
|
}
|
|
|
}
|
|
@@ -1197,6 +1201,7 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
|
|
|
/**
|
|
|
* 按照类型分组统计数量
|
|
|
+ *
|
|
|
* @param positionCode : 位置code
|
|
|
* @return
|
|
|
*/
|
|
@@ -1208,7 +1213,7 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
List<String> positionIds = sbPositions.stream().map(SbPosition::getId).collect(Collectors.toList());
|
|
|
List<SbInfoVO> sbInfoVOS = mapper.selectVOList(new SbInfoDTO().setPositionIds(positionIds));
|
|
|
List<Map<String, String>> result = new ArrayList<>();
|
|
|
- if(CollectionUtil.isNotEmpty(sbInfoVOS)) {
|
|
|
+ if (CollectionUtil.isNotEmpty(sbInfoVOS)) {
|
|
|
Map<String, Long> stringStringMap = sbInfoVOS.stream().collect(Collectors.groupingBy(SbInfoVO::getTypeId, Collectors.counting()));
|
|
|
List<SbType> typeList = sbTypeMapper.selectAll();
|
|
|
for (SbType type : typeList) {
|
|
@@ -1227,6 +1232,7 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
|
|
|
/**
|
|
|
* 查询某个车间下面的数据,状态分组统计数量
|
|
|
+ *
|
|
|
* @param positionCode : 位置code
|
|
|
* @return
|
|
|
*/
|
|
@@ -1238,6 +1244,7 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
|
|
|
/**
|
|
|
* 按照自定义类型分组统计数量
|
|
|
+ *
|
|
|
* @param positionCode : 位置code
|
|
|
* @return
|
|
|
*/
|
|
@@ -1962,6 +1969,7 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
LocalDateTime now = LocalDateTime.now();
|
|
|
System.out.println(DateUtils.dateToString(now.minusMonths(-12)));
|
|
|
}
|
|
|
+
|
|
|
@Override
|
|
|
public void generateSbCodeAll() {
|
|
|
List<SbInfo> list = mapper.selectAll();
|
|
@@ -2096,48 +2104,55 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
List<String> addTypeList = new ArrayList<>();
|
|
|
try {
|
|
|
List<ExportSbInfoVO> list = ExcelUtil.importExcel(file.getInputStream(), ExportSbInfoVO.class, 1);
|
|
|
- if(CollectionUtil.isNotEmpty(list)){
|
|
|
+ if (CollectionUtil.isNotEmpty(list)) {
|
|
|
int i = 2;
|
|
|
- for(ExportSbInfoVO vo : list){
|
|
|
+ for (ExportSbInfoVO vo : list) {
|
|
|
i++;
|
|
|
// 如果有检定周期,就是需要检定
|
|
|
- SbInfo tempInfo = BeanConverterUtil.copyObjectProperties(vo,SbInfo.class);
|
|
|
+ SbInfo tempInfo = BeanConverterUtil.copyObjectProperties(vo, SbInfo.class);
|
|
|
tempInfo.setSeatNumber(30);// 默认30天提醒
|
|
|
+
|
|
|
// 对必填字段进行判断
|
|
|
- if(StringUtils.isBlank(vo.getPositionNo())){
|
|
|
- throw new BusinessException("第" + i + "行,位号为空,位号为必填项目,请填写;");// 编号为空,复制位号
|
|
|
+ if (StringUtils.isBlank(vo.getPositionNo())) {
|
|
|
+ throw new BusinessException("第" + i + "行,位号为空,位号为必填项目,请填写;");// 编号为空,复制位号
|
|
|
}
|
|
|
- if(vo.getIsFinancing() == 1 && StringUtils.isBlank(vo.getFinancingNo())){
|
|
|
+ if (vo.getIsFinancing() == 1 && StringUtils.isBlank(vo.getFinancingNo())) {
|
|
|
throw new BusinessException("第" + i + "行,是固定资产,但是资产编号为空,请填写;");// 编号为空,复制位号
|
|
|
}
|
|
|
- if(StringUtils.isBlank(vo.getName())){
|
|
|
+ if (StringUtils.isBlank(vo.getName())) {
|
|
|
throw new BusinessException("第" + i + "行,名称为空,请填写;");// 编号为空,复制位号
|
|
|
}
|
|
|
- if(StringUtils.isBlank(vo.getModel())){
|
|
|
+ if (StringUtils.isBlank(vo.getModel())) {
|
|
|
throw new BusinessException("第" + i + "行,型号为空,请填写;");// 编号为空,复制位号
|
|
|
}
|
|
|
- if(vo.getLevel() == null || vo.getLevel()<1 || vo.getLevel()>3){
|
|
|
+ if (vo.getLevel() == null || vo.getLevel() < 1 || vo.getLevel() > 3) {
|
|
|
throw new BusinessException("第" + i + "行,等级为空,A级请填1,B级填2,C级填3;");// 编号为空,复制位号
|
|
|
}
|
|
|
- if(vo.getUseType() == null || vo.getUseType()<3 || vo.getUseType()>5){
|
|
|
+ if (vo.getUseType() == null || vo.getUseType() < 3 || vo.getUseType() > 5) {
|
|
|
throw new BusinessException("第" + i + "行,自定义类型为空,生产设备请填3,计量设备填4,特种设备填5;");// 编号为空,复制位号
|
|
|
}
|
|
|
- if(vo.getStatus() == null || vo.getStatus()<1 || vo.getStatus()>2){
|
|
|
+ if (vo.getUseType() == 4) {
|
|
|
+ tempInfo.setIsChild(1);
|
|
|
+ }
|
|
|
+ if (vo.getUseType() != 4) {
|
|
|
+ tempInfo.setIsChild(0);
|
|
|
+ }
|
|
|
+ if (vo.getStatus() == null || vo.getStatus() < 1 || vo.getStatus() > 2) {
|
|
|
throw new BusinessException("第" + i + "行,状态为空,在库请填1,使用中填2;");// 编号为空,复制位号
|
|
|
}
|
|
|
- if(StringUtils.isBlank(vo.getNo())){
|
|
|
+ if (StringUtils.isBlank(vo.getNo())) {
|
|
|
tempInfo.setNo(vo.getPositionNo());// 编号为空,复制位号
|
|
|
}
|
|
|
- if(StringUtils.isNotEmpty(vo.getPpNo())){
|
|
|
+ if (StringUtils.isNotEmpty(vo.getPpNo())) {
|
|
|
tempInfo.setIsChild(1);
|
|
|
}
|
|
|
- if(StringUtils.isNotEmpty(vo.getFinancingNo())){
|
|
|
+ if (StringUtils.isNotEmpty(vo.getFinancingNo())) {
|
|
|
tempInfo.setIsFinancing(1);
|
|
|
}
|
|
|
- if(vo.getCheckPeriod() != null){
|
|
|
+ if (vo.getCheckPeriod() != null) {
|
|
|
tempInfo.setIsMeasure(1);
|
|
|
}
|
|
|
- if(StringUtils.isNotBlank(vo.getTypeName())){ // 设备类型匹配
|
|
|
+ if (StringUtils.isNotBlank(vo.getTypeName())) { // 设备类型匹配
|
|
|
boolean findSbType = false;
|
|
|
for (SbType sbType : typeList) {
|
|
|
if (sbType.getName().equalsIgnoreCase(vo.getTypeName().trim())) {
|
|
@@ -2151,7 +2166,7 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
// throw new BusinessException("系统找不到该设备类型名称,请先添加设备类型, 设备类型名称" + vo.getTypeName());
|
|
|
}
|
|
|
}
|
|
|
- if(StringUtils.isNotBlank(vo.getPositionName())){ // 设备位置匹配
|
|
|
+ if (StringUtils.isNotBlank(vo.getPositionName())) { // 设备位置匹配
|
|
|
boolean findPosition = false;
|
|
|
for (SbPosition position : positionList) {
|
|
|
if (position.getName().equalsIgnoreCase(vo.getPositionName().trim())) {
|
|
@@ -2178,7 +2193,7 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
throw new BusinessException("找不到生产商,请先添加:" + vo.getProducerName());
|
|
|
}
|
|
|
}*/
|
|
|
- if(StringUtils.isNotBlank(vo.getSaveUserName())){ // 使用人员
|
|
|
+ if (StringUtils.isNotBlank(vo.getSaveUserName())) { // 使用人员
|
|
|
boolean findSaveUser = false;
|
|
|
for (SysUser user : users) {
|
|
|
if (user.getRealName().equalsIgnoreCase(vo.getSaveUserName().trim())) {
|
|
@@ -2192,14 +2207,17 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
}
|
|
|
}
|
|
|
// 如果计量设备 且是需要检定
|
|
|
- if(vo.getUseType() == SbUseType.BGCL.getValue() && vo.getIsMeasure() == YesNoEnum.YES.getValue()){
|
|
|
- if(vo.getCheckDate() == null && vo.getNextCheckDate() == null){
|
|
|
+ if (vo.getUseType() == SbUseType.BGCL.getValue() && vo.getIsMeasure() == YesNoEnum.YES.getValue()) {
|
|
|
+ if (vo.getCheckDate() == null && vo.getNextCheckDate() == null) {
|
|
|
throw new BusinessException("上次和下次检定日期,不能全部为空");
|
|
|
}
|
|
|
- if(vo.getCheckPeriod() == null){
|
|
|
+ if (vo.getCheckPeriod() == null) {
|
|
|
throw new BusinessException("检定周期不能为空");
|
|
|
}
|
|
|
}
|
|
|
+ // 初始化的默认数据
|
|
|
+ tempInfo.setMeasureStatus(0);
|
|
|
+ tempInfo.setIsShow(0);
|
|
|
tempInfo.setId(IdGeneratorUtils.getObjectId());
|
|
|
tempInfo.setCreatedUserName(SecurityUtils.getUserInfo().getUsername());
|
|
|
tempInfo.setCreatedUserId(SecurityUtils.getUserInfo().getUserId());
|
|
@@ -2208,8 +2226,8 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if(CollectionUtil.isNotEmpty(addTypeList)){
|
|
|
- throw new BusinessException(addTypeList.size() + "个设备类型名称找不到,请先添加:" + addTypeList.toString());
|
|
|
+ if (CollectionUtil.isNotEmpty(addTypeList)) {
|
|
|
+ throw new BusinessException(addTypeList.size() + "个设备类型名称找不到,请先添加:" + addTypeList);
|
|
|
}
|
|
|
// 导入数据
|
|
|
mapper.insertListforComplex(addList);
|
|
@@ -2500,4 +2518,28 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
backlogUserDTO.setDetailType(WorkplaceBacklogDetailTypeEnum.SB_SCRAP_RESULT.getValue());
|
|
|
backlogUserMapper.updateByUser(backlogUserDTO);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<SbInfoTypeReportVO> getTypeReport(SbInfoDTO sbInfoDTO, Integer searchYear, LocalDate startMonth, LocalDate endMonth) {
|
|
|
+ List<Map<String, String>> countMap = mapper.selectCountMap(sbInfoDTO);
|
|
|
+ List<SbType> typeList = sbTypeMapper.selectAll();
|
|
|
+ List<SbInfoTypeReportVO> result = new ArrayList<>();
|
|
|
+ Integer totalNum = 0;
|
|
|
+ for (Map<String, String> map : countMap) {
|
|
|
+ SbInfoTypeReportVO vo = new SbInfoTypeReportVO();
|
|
|
+ vo.setTotalNum(Integer.valueOf(String.valueOf(map.get("num"))));
|
|
|
+ totalNum = totalNum + vo.getTotalNum();
|
|
|
+ for (SbType sbType : typeList) {
|
|
|
+ if (map.get("typeId").equals(sbType.getId())) {
|
|
|
+ vo.setTypeName(sbType.getName());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ result.add(vo);
|
|
|
+ }
|
|
|
+ for (SbInfoTypeReportVO sbInfoTypeReportVO : result) {
|
|
|
+ sbInfoTypeReportVO.setRate(BigDecimalUtil.div(sbInfoTypeReportVO.getTotalNum() * 100, totalNum, 2));
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
}
|