|
@@ -11,14 +11,19 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.ruoyi.common.exception.base.BaseException;
|
|
import com.ruoyi.common.exception.base.BaseException;
|
|
import com.ruoyi.system.domain.BerthingPoint;
|
|
import com.ruoyi.system.domain.BerthingPoint;
|
|
import com.ruoyi.system.domain.BerthingPointConfig;
|
|
import com.ruoyi.system.domain.BerthingPointConfig;
|
|
|
|
+import com.ruoyi.system.domain.BerthingTimeConfig;
|
|
import com.ruoyi.system.domain.SiteInfo;
|
|
import com.ruoyi.system.domain.SiteInfo;
|
|
import com.ruoyi.system.dto.BerthingPointConfigDTO;
|
|
import com.ruoyi.system.dto.BerthingPointConfigDTO;
|
|
import com.ruoyi.system.dto.BerthingPointDTO;
|
|
import com.ruoyi.system.dto.BerthingPointDTO;
|
|
|
|
+import com.ruoyi.system.dto.BerthingTimeDTO;
|
|
import com.ruoyi.system.dto.PrintExcelDTO;
|
|
import com.ruoyi.system.dto.PrintExcelDTO;
|
|
import com.ruoyi.system.mapper.BerthingPointConfigMapper;
|
|
import com.ruoyi.system.mapper.BerthingPointConfigMapper;
|
|
import com.ruoyi.system.mapper.BerthingPointMapper;
|
|
import com.ruoyi.system.mapper.BerthingPointMapper;
|
|
|
|
+import com.ruoyi.system.mapper.BerthingTimeConfigMapper;
|
|
import com.ruoyi.system.mapper.SiteInfoMapper;
|
|
import com.ruoyi.system.mapper.SiteInfoMapper;
|
|
import com.ruoyi.system.paramet.BerthingPointQuery;
|
|
import com.ruoyi.system.paramet.BerthingPointQuery;
|
|
|
|
+import com.ruoyi.system.paramet.StopPointQuery;
|
|
|
|
+import com.ruoyi.system.paramet.TimePointQuery;
|
|
import com.ruoyi.system.service.BerthingService;
|
|
import com.ruoyi.system.service.BerthingService;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -26,6 +31,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
+import javax.validation.constraints.NotBlank;
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.Comparator;
|
|
import java.util.Comparator;
|
|
@@ -51,6 +57,9 @@ public class BerthingServiceImpl implements BerthingService {
|
|
@Resource
|
|
@Resource
|
|
private BerthingPointConfigMapper berthingPointConfigMapper;
|
|
private BerthingPointConfigMapper berthingPointConfigMapper;
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ private BerthingTimeConfigMapper berthingTimeConfigMapper;
|
|
|
|
+
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public ArrayList<PrintExcelDTO> uploadFile(MultipartFile file) {
|
|
public ArrayList<PrintExcelDTO> uploadFile(MultipartFile file) {
|
|
@@ -133,8 +142,8 @@ public class BerthingServiceImpl implements BerthingService {
|
|
if (berthingPoint == null) {
|
|
if (berthingPoint == null) {
|
|
throw new BaseException("没有断面数据");
|
|
throw new BaseException("没有断面数据");
|
|
}
|
|
}
|
|
- List<PrintExcelDTO> positions = JSONUtil.toList(berthingPoint.getPositions(), PrintExcelDTO.class);
|
|
|
|
try {
|
|
try {
|
|
|
|
+ List<PrintExcelDTO> positions = JSONUtil.toList(berthingPoint.getPositions(), PrintExcelDTO.class);
|
|
response.setContentType("application/octet-stream; charset=utf-8");
|
|
response.setContentType("application/octet-stream; charset=utf-8");
|
|
// 文件名中文名需要转义
|
|
// 文件名中文名需要转义
|
|
String today = new SimpleDateFormat("yyyyMMdd").format(new Date());
|
|
String today = new SimpleDateFormat("yyyyMMdd").format(new Date());
|
|
@@ -204,6 +213,79 @@ public class BerthingServiceImpl implements BerthingService {
|
|
return res;
|
|
return res;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public Page<BerthingPointConfig> queryStopPrint(StopPointQuery stopPointQuery) {
|
|
|
|
+ try {
|
|
|
|
+ if (stopPointQuery.getPage() == null || stopPointQuery.getSize() == null) {
|
|
|
|
+ stopPointQuery.setPage(1L);
|
|
|
|
+ stopPointQuery.setSize(10L);
|
|
|
|
+ }
|
|
|
|
+ return berthingPointConfigMapper.queryAllByLimit(stopPointQuery, new Page<>(stopPointQuery.getPage(), stopPointQuery.getSize()));
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ log.error("查询停泊点错误", e);
|
|
|
|
+ throw new BaseException("查询停泊点错误");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public boolean addTimePrint(BerthingTimeDTO berthingTimeDTO) {
|
|
|
|
+ SiteInfo siteInfo = siteInfoMapper.queryById(berthingTimeDTO.getSiteId());
|
|
|
|
+ if (siteInfo == null) {
|
|
|
|
+ throw new BaseException("站点不存在");
|
|
|
|
+ }
|
|
|
|
+ if (berthingTimeDTO.getTimeId() == null) {
|
|
|
|
+ berthingTimeDTO.setTimeId(0L);
|
|
|
|
+ }
|
|
|
|
+ boolean res = false;
|
|
|
|
+ BerthingTimeConfig berthingTime = berthingTimeConfigMapper.queryById(berthingTimeDTO.getTimeId());
|
|
|
|
+ try {
|
|
|
|
+ ArrayList<String> times = berthingTimeDTO.getTimes();
|
|
|
|
+ if (berthingTime == null) {
|
|
|
|
+ //新增
|
|
|
|
+ berthingTime = new BerthingTimeConfig();
|
|
|
|
+ berthingTime.setTimeId(0L);
|
|
|
|
+ berthingTime.setSiteId(siteInfo.getSiteId());
|
|
|
|
+ berthingTime.setPlanid(berthingTimeDTO.getPlanid());
|
|
|
|
+ berthingTime.setTimes(JSONUtil.toJsonStr(times));
|
|
|
|
+ berthingTime.setWlevel(berthingTimeDTO.getWlevel());
|
|
|
|
+ berthingTime.setCreateTime(new Date());
|
|
|
|
+ berthingTime.setIsDel(0);
|
|
|
|
+ berthingTime.setStatus(1);
|
|
|
|
+ berthingTime.setId(siteInfo.getId());
|
|
|
|
+ berthingTime.setType(berthingTimeDTO.getType());
|
|
|
|
+ res = berthingTimeConfigMapper.insert(berthingTime) > 0;
|
|
|
|
+ } else {
|
|
|
|
+ //更新
|
|
|
|
+ berthingTime.setPlanid(berthingTimeDTO.getPlanid());
|
|
|
|
+ berthingTime.setWlevel(berthingTimeDTO.getWlevel());
|
|
|
|
+ berthingTime.setTimes(JSONUtil.toJsonStr(times));
|
|
|
|
+ berthingTime.setType(berthingTimeDTO.getType());
|
|
|
|
+ res = berthingTimeConfigMapper.update(berthingTime) > 0;
|
|
|
|
+ }
|
|
|
|
+ } catch (Exception e){
|
|
|
|
+ log.error("新增或修改时间策略错误", e);
|
|
|
|
+ throw new BaseException("新增或修改时间策略错误");
|
|
|
|
+ }
|
|
|
|
+ //TODO 下发配置
|
|
|
|
+ return res;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Page<BerthingTimeConfig> queryTimePrint(TimePointQuery timePointQuery) {
|
|
|
|
+ try {
|
|
|
|
+ if (timePointQuery.getPage() == null || timePointQuery.getSize() == null) {
|
|
|
|
+ timePointQuery.setPage(1L);
|
|
|
|
+ timePointQuery.setSize(10L);
|
|
|
|
+ }
|
|
|
|
+ return berthingTimeConfigMapper.queryAllByLimit(timePointQuery, new Page<>(timePointQuery.getPage(), timePointQuery.getSize()));
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ log.error("查询停泊点错误", e);
|
|
|
|
+ throw new BaseException("查询停泊点错误");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|