|
|
@@ -1,6 +1,8 @@
|
|
|
package com.railway.business.catenary.service.impl;
|
|
|
|
|
|
import com.github.pagehelper.Page;
|
|
|
+import com.railway.business.baseinfo.domain.BusDmcgyq;
|
|
|
+import com.railway.business.baseinfo.mapper.BusDmcgyqMapper;
|
|
|
import com.railway.business.baseinfo.service.IBaseStationService;
|
|
|
import com.railway.business.catenary.domain.BusJcbDmcgyq;
|
|
|
import com.railway.business.catenary.domain.vo.JcebCountVo;
|
|
|
@@ -11,9 +13,15 @@ import com.railway.business.catenary.mapper.BusJcbDmcgyqMapper;
|
|
|
import com.railway.business.catenary.service.IBusJcbDmcgyqService;
|
|
|
import com.railway.common.utils.SecurityUtils;
|
|
|
import com.railway.common.utils.StringUtils;
|
|
|
+import com.railway.common.utils.bean.BeanUtils;
|
|
|
import com.railway.common.utils.poi.EasyExcelUtil;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
+import java.util.Objects;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
@@ -27,11 +35,13 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
public class BusJcbDmcgyqServiceImpl extends BusJcabServiceImpl implements IBusJcbDmcgyqService {
|
|
|
|
|
|
private final BusJcbDmcgyqMapper busJcbDmcgyqMapper;
|
|
|
+ private final BusDmcgyqMapper busDmcgyqMapper;
|
|
|
|
|
|
public BusJcbDmcgyqServiceImpl(BusJcbDmcgyqMapper busJcbDmcgyqMapper,
|
|
|
- IBaseStationService stationService) {
|
|
|
+ IBaseStationService stationService, BusDmcgyqMapper busDmcgyqMapper) {
|
|
|
super(stationService);
|
|
|
this.busJcbDmcgyqMapper = busJcbDmcgyqMapper;
|
|
|
+ this.busDmcgyqMapper = busDmcgyqMapper;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -74,8 +84,8 @@ public class BusJcbDmcgyqServiceImpl extends BusJcabServiceImpl implements IBusJ
|
|
|
* 获取单个
|
|
|
*/
|
|
|
@Override
|
|
|
- public BusJcbDmcgyq getInfo(String id) {
|
|
|
- return busJcbDmcgyqMapper.getInfo(id);
|
|
|
+ public BusJcbDmcgyq getInfo(BusJcbDmcgyq busJcbDmcgyq) {
|
|
|
+ return busJcbDmcgyqMapper.getInfo(busJcbDmcgyq);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -138,9 +148,124 @@ public class BusJcbDmcgyqServiceImpl extends BusJcabServiceImpl implements IBusJ
|
|
|
@Override
|
|
|
public String exportExcel(JcebQueryVo query) {
|
|
|
List<BusJcbDmcgyq> list = busJcbDmcgyqMapper.getJcebList(query);
|
|
|
+ List<BusJcbDmcgyq> resultList = new ArrayList<>();
|
|
|
+ list.forEach(
|
|
|
+ x -> {
|
|
|
+ transDataForList(x, resultList);
|
|
|
+ }
|
|
|
+ );
|
|
|
String fileName = "地磁感应器检测记录.xls";
|
|
|
String templateFileName = "excel/template/地磁感应器检测记录.xls";
|
|
|
- return new EasyExcelUtil().writeExcel(fileName, templateFileName, list);
|
|
|
+ return new EasyExcelUtil().writeExcel(fileName, templateFileName, resultList);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 检测表list
|
|
|
+ * @param query
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<BusJcbDmcgyq> getJcebList(JcebQueryVo query) {
|
|
|
+ List<BusJcbDmcgyq> list = busJcbDmcgyqMapper.getJcebList(query);
|
|
|
+ List<BusJcbDmcgyq> resultList = new ArrayList<>();
|
|
|
+ list.forEach(
|
|
|
+ x -> {
|
|
|
+ transDataForList(x, resultList);
|
|
|
+ }
|
|
|
+ );
|
|
|
+ return resultList;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取单个jceb
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public BusJcbDmcgyq getJcebInfo(BusJcbDmcgyq busJcbDmcgyq) {
|
|
|
+ BusJcbDmcgyq result = busJcbDmcgyqMapper.getJcebInfo(busJcbDmcgyq);
|
|
|
+ return transData(result, busJcbDmcgyq.getGyqNumber());
|
|
|
+ }
|
|
|
+
|
|
|
+ private void transDataForList(BusJcbDmcgyq x, List<BusJcbDmcgyq> resultList) {
|
|
|
+ if(StringUtils.YES_VALUE.equals(x.getBspwgAzlg()) &&
|
|
|
+ StringUtils.YES_VALUE.equals(x.getBspwgBsqx()) &&
|
|
|
+ StringUtils.YES_VALUE.equals(x.getDgqwgBmqj()) &&
|
|
|
+ StringUtils.YES_VALUE.equals(x.getDgqwgWzws()) &&
|
|
|
+ StringUtils.YES_VALUE.equals(x.getDgqwgAzlg())) {
|
|
|
+ x.setWsjbjsd("无");
|
|
|
+ } else {
|
|
|
+ x.setWsjbjsd("有");
|
|
|
+ }
|
|
|
+ BusDmcgyq busDmcgyq = busDmcgyqMapper.getInfo(x.getGyqId().toString());
|
|
|
+ BusDmcgyq query = new BusDmcgyq();
|
|
|
+ query.setXingbie(busDmcgyq.getXingbie());
|
|
|
+ query.setFxmc(busDmcgyq.getFxmc());
|
|
|
+ query.setDeptStationId(busDmcgyq.getDeptStationId());
|
|
|
+ List<BusDmcgyq> busDmcgyqList = busDmcgyqMapper.getList(query);
|
|
|
+
|
|
|
+ if(x.getDgqclG1() != null) {
|
|
|
+ BusJcbDmcgyq g1detail = new BusJcbDmcgyq();
|
|
|
+ x.setGyqNumber("G1");
|
|
|
+ x.setScz(x.getDgqclG1());
|
|
|
+ x.setCzlc(getCzlc(busDmcgyqList,"G1"));
|
|
|
+ BeanUtils.copyBeanProp(g1detail, x);
|
|
|
+ resultList.add(g1detail);
|
|
|
+ }
|
|
|
+ if(x.getDgqclG2() != null) {
|
|
|
+ BusJcbDmcgyq g2detail = new BusJcbDmcgyq();
|
|
|
+ x.setGyqNumber("G2");
|
|
|
+ x.setScz(x.getDgqclG2());
|
|
|
+ x.setCzlc(getCzlc(busDmcgyqList,"G2"));
|
|
|
+ BeanUtils.copyBeanProp(g2detail, x);
|
|
|
+ resultList.add(g2detail);
|
|
|
+ }
|
|
|
+ if(x.getDgqclG3() != null) {
|
|
|
+ BusJcbDmcgyq g3detail = new BusJcbDmcgyq();
|
|
|
+ x.setGyqNumber("G3");
|
|
|
+ x.setScz(x.getDgqclG3());
|
|
|
+ x.setCzlc(getCzlc(busDmcgyqList,"G3"));
|
|
|
+ BeanUtils.copyBeanProp(g3detail, x);
|
|
|
+ resultList.add(g3detail);
|
|
|
+ }
|
|
|
+ if(x.getDgqclG4() != null) {
|
|
|
+ BusJcbDmcgyq g4detail = new BusJcbDmcgyq();
|
|
|
+ x.setGyqNumber("G4");
|
|
|
+ x.setScz(x.getDgqclG4());
|
|
|
+ x.setCzlc(getCzlc(busDmcgyqList,"G4"));
|
|
|
+ BeanUtils.copyBeanProp(g4detail, x);
|
|
|
+ resultList.add(g4detail);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private String getCzlc(List<BusDmcgyq> busDmcgyqList, String type) {
|
|
|
+ return busDmcgyqList.stream()
|
|
|
+ .filter(bus -> bus.getSbbh().equals(type))
|
|
|
+ .map(bus -> bus.getCzlc()==null?"":bus.getCzlc().toString())
|
|
|
+ .findFirst().orElse("");
|
|
|
+ }
|
|
|
+
|
|
|
+ private BusJcbDmcgyq transData(BusJcbDmcgyq x, String gyqNumber) {
|
|
|
+ if(StringUtils.YES_VALUE.equals(x.getBspwgAzlg()) &&
|
|
|
+ StringUtils.YES_VALUE.equals(x.getBspwgBsqx()) &&
|
|
|
+ StringUtils.YES_VALUE.equals(x.getDgqwgBmqj()) &&
|
|
|
+ StringUtils.YES_VALUE.equals(x.getDgqwgWzws()) &&
|
|
|
+ StringUtils.YES_VALUE.equals(x.getDgqwgAzlg())) {
|
|
|
+ x.setWsjbjsd("无");
|
|
|
+ } else {
|
|
|
+ x.setWsjbjsd("有");
|
|
|
+ }
|
|
|
+
|
|
|
+ if("G1".equals(gyqNumber)) {
|
|
|
+ x.setScz(x.getDgqclG1());
|
|
|
+ }
|
|
|
+ if("G2".equals(gyqNumber)) {
|
|
|
+ x.setScz(x.getDgqclG2());
|
|
|
+ }
|
|
|
+ if("G3".equals(gyqNumber)) {
|
|
|
+ x.setScz(x.getDgqclG3());
|
|
|
+ }
|
|
|
+ if("G4".equals(gyqNumber)) {
|
|
|
+ x.setScz(x.getDgqclG4());
|
|
|
+ }
|
|
|
+ return x;
|
|
|
}
|
|
|
|
|
|
/**
|