台站运行管理页面接口修改

数据库修改postgresql后系统问题修改
新增web-statistics模块
This commit is contained in:
qiaoqinzheng 2023-06-05 10:04:35 +08:00
parent f2c26efebc
commit 07ce768733
26 changed files with 662 additions and 53 deletions

View File

@ -16,6 +16,13 @@
<groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-boot-base-core</artifactId>
</dependency>
<!-- 用于存储计算经纬度 -->
<dependency>
<groupId>com.spatial4j</groupId>
<artifactId>spatial4j</artifactId>
<version>0.5</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,36 @@
package org.jeecg.common;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import java.util.Objects;
public class PointUtil {
public static String calculate(String pointValue){
Double Degrees = 0.0;
Double minutes = 0.0;
Double seconds = 0.0;
if (pointValue.indexOf("°")>0 || pointValue.indexOf("")>0 || pointValue.indexOf("")>0){
if (pointValue.indexOf("°")>0){
Degrees = Double.valueOf(pointValue.substring(0, pointValue.indexOf("°")));
pointValue = pointValue.substring(pointValue.indexOf("°")+1);
}
if (pointValue.indexOf("")>0){
minutes = Double.valueOf(pointValue.substring(0, pointValue.indexOf("")));
pointValue = pointValue.substring(pointValue.indexOf("")+1);
}
if (pointValue.indexOf("")>0){
seconds = Double.valueOf(pointValue.substring(0, pointValue.indexOf("")));
}
if (Objects.nonNull(Degrees) || Objects.nonNull(minutes) || Objects.nonNull(seconds)){
Double result = Degrees + minutes/60+seconds/3600;
pointValue = String.valueOf(result);
}
}
return pointValue;
}
}

View File

@ -1,14 +1,17 @@
package org.jeecg.modules.controller;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.entity.Point;
import org.jeecg.modules.entity.PointVo;
import org.jeecg.modules.entity.StationOperation;
import org.jeecg.modules.service.IStationOperationService;
import org.jeecg.modules.system.entity.GardsNuclearfacility;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@ -34,4 +37,17 @@ public class StationOperationController {
return result;
}
@GetMapping("findTree")
public Result findTree(){
Result result = stationOperationService.findTree();
return result;
}
@PostMapping("getHitEquList")
@ApiOperation(value = "查询半径内核设施信息", notes = "查询半径内核设施信息")
public Result getHitEquList(@RequestBody PointVo pointVo){
Result result = stationOperationService.getHitEquList(pointVo);
return result;
}
}

View File

@ -0,0 +1,22 @@
package org.jeecg.modules.entity;
import lombok.Data;
import java.io.Serializable;
@Data
public class Point implements Serializable {
private String stationName;
private String nuclearFacilityName;
private String lon;
private String lat;
private String radius;
private String nuclearFacilityId;
}

View File

@ -0,0 +1,14 @@
package org.jeecg.modules.entity;
import lombok.Data;
import java.util.List;
@Data
public class PointVo {
private List<String> stationIds;
private Double radius;
}

View File

@ -0,0 +1,17 @@
package org.jeecg.modules.entity;
import lombok.Data;
import org.jeecg.modules.system.entity.GardsStations;
import java.util.List;
@Data
public class StationTree {
private Integer stationId;
private String code;
List<GardsStations> children;
}

View File

@ -2,14 +2,40 @@ package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.entity.Point;
import org.jeecg.modules.entity.PointVo;
import org.jeecg.modules.entity.StationOperation;
import org.jeecg.modules.system.entity.GardsNuclearfacility;
import java.util.List;
public interface IStationOperationService extends IService<StationOperation> {
/**
* 查询台站核设施信息
* @param status
* @return
*/
List<StationOperation> findList(String status);
/**
* 查看台站核设施详情信息
* @param stationId
* @param type
* @return
*/
Result findInfo(String stationId, String type);
/**
* 查询台站信息的树形结构
* @return
*/
Result findTree();
/**
* 查询半径内核设施信息
* @param pointVo
* @return
*/
Result getHitEquList(PointVo pointVo);
}

View File

@ -4,8 +4,16 @@ import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.spatial4j.core.context.SpatialContext;
import com.spatial4j.core.distance.DistanceUtils;
import com.spatial4j.core.shape.Rectangle;
import io.swagger.models.auth.In;
import org.jeecg.common.PointUtil;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.modules.entity.Point;
import org.jeecg.modules.entity.PointVo;
import org.jeecg.modules.entity.StationTree;
import org.jeecg.modules.system.entity.GardsNuclearfacility;
import org.jeecg.modules.system.entity.GardsStations;
import org.jeecg.modules.entity.StationOperation;
@ -15,6 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.List;
import java.util.stream.Collectors;
@Service("stationOperationService")
@ -23,6 +32,8 @@ public class StationOperationServiceImpl extends ServiceImpl<StationOperationMap
@Autowired
private RedisUtil redisUtil;
private final SpatialContext spatialContext = SpatialContext.GEO;
@Override
public List<StationOperation> findList(String status) {
//声明结果集合
@ -55,8 +66,8 @@ public class StationOperationServiceImpl extends ServiceImpl<StationOperationMap
stationOperation.setStationName(nuclearfacility.getFacilityName());
stationOperation.setStationType("Nuclear Facility");
stationOperation.setAltitude("--");
stationOperation.setLon(nuclearfacility.getLongitude());
stationOperation.setLat(nuclearfacility.getLatitude());
stationOperation.setLon(PointUtil.calculate(nuclearfacility.getLongitude()));
stationOperation.setLat(PointUtil.calculate(nuclearfacility.getLatitude()));
stationOperation.setStatus(nuclearfacility.getStatus());
result.add(stationOperation);
}
@ -84,6 +95,8 @@ public class StationOperationServiceImpl extends ServiceImpl<StationOperationMap
HashMap<String, GardsNuclearfacility> nuclearFacilityMap = (HashMap<String, GardsNuclearfacility>) redisUtil.get("nuclearFacilityMap");
GardsNuclearfacility nuclearfacility = nuclearFacilityMap.get(stationId);
if (Objects.nonNull(nuclearfacility)){
nuclearfacility.setLongitude(PointUtil.calculate(nuclearfacility.getLongitude()));
nuclearfacility.setLatitude(PointUtil.calculate(nuclearfacility.getLatitude()));
result.setResult(nuclearfacility);
result.setSuccess(true);
}else {
@ -95,4 +108,162 @@ public class StationOperationServiceImpl extends ServiceImpl<StationOperationMap
return result;
}
@Override
public Result findTree() {
Result result = new Result();
//声明一个数组存储城市编码信息以及台站信息
List<StationTree> stationTreeList = new LinkedList<>();
//查询台站信息接口
HashMap<String, Object> stationMap = (HashMap<String, Object>)redisUtil.get("stationInfoMap");
if (CollectionUtils.isNotEmpty(stationMap)){
//遍历台站信息存储进数组
List<GardsStations> gardsStationsList = new ArrayList<>();
for (Map.Entry<String, Object> entry:stationMap.entrySet()) {
GardsStations entryValue = (GardsStations) entry.getValue();
gardsStationsList.add(entryValue);
}
if (CollectionUtils.isNotEmpty(gardsStationsList)){
//过滤出所有的台站城市编码
List<String> countryCodes = gardsStationsList.stream().map(GardsStations::getCountryCode).distinct().sorted().collect(Collectors.toList());
for (String countryCode:countryCodes) {
//声明一个数组存储城市编码对应的数组信息
List<GardsStations> stationsList = new LinkedList<>();
StationTree stationTree = new StationTree();
stationTree.setStationId(countryCodes.indexOf(countryCode)+1);
stationTree.setCode(countryCode);
for (GardsStations stations:gardsStationsList) {
if (stations.getCountryCode().equals(countryCode)){
stationsList.add(stations);
}
}
stationTree.setChildren(stationsList);
stationTreeList.add(stationTree);
}
}
}
result.setSuccess(true);
result.setResult(stationTreeList);
return result;
}
@Override
public Result getHitEquList(PointVo pointVo) {
Result result = new Result();
//声明一个map存储数据
Map<String, Object> map = new HashMap<>();
//存储台站及周边核设施数据信息
List<Object> stationsList = new LinkedList<>();
//存储台站及周边核设施的名称距离信息
List<List<Point>> resultList = new ArrayList<>();
//获取传递的台站id数据
List<String> stationIds = pointVo.getStationIds();
//获取传递的半径数据
Double radius = pointVo.getRadius();
if (Objects.isNull(radius)) {
result.error500("请传入半径");
}
if (CollectionUtils.isNotEmpty(stationIds)){
//查询全部台站信息
HashMap<String, Object> stationInfoMap = (HashMap<String, Object>) redisUtil.get("stationInfoMap");
//查询全部核设施信息
HashMap<String, GardsNuclearfacility> nuclearFacilityMap = (HashMap<String, GardsNuclearfacility>) redisUtil.get("nuclearFacilityMap");
if (CollectionUtils.isNotEmpty(nuclearFacilityMap)){
//声明一个集合存储转换经纬度后的核设施数据
List<Point> nuclearPoints = new ArrayList<>();
for (Map.Entry<String,GardsNuclearfacility> nuclearFacilityInfo:nuclearFacilityMap.entrySet()) {
GardsNuclearfacility facilityInfoValue = nuclearFacilityInfo.getValue();
Point point = new Point();
point.setNuclearFacilityId(String.valueOf(facilityInfoValue.getFacilityId()));
point.setNuclearFacilityName(facilityInfoValue.getFacilityName());
if (StringUtils.isNotBlank(facilityInfoValue.getLongitude())){
String pointValue = PointUtil.calculate(facilityInfoValue.getLongitude());
facilityInfoValue.setLongitude(pointValue);
point.setLon(pointValue);
}
if (StringUtils.isNotBlank(facilityInfoValue.getLatitude())){
String pointValue = PointUtil.calculate(facilityInfoValue.getLatitude());
facilityInfoValue.setLatitude(pointValue);
point.setLat(pointValue);
}
nuclearPoints.add(point);
}
for (String stationId:stationIds) {
GardsStations point = (GardsStations)stationInfoMap.get(stationId);
stationsList.add(point);
//声明一个数组存储对应的核设施经纬度信息
List<Point> nuclearFacilityPoints = new ArrayList<>();
nuclearFacilityPoints.addAll(nuclearPoints);
//获取当前查询的台站名称
String stationName = point.getStationCode();
//获取当前查询的经度 圆心位置经度信息
Double longitudeD = point.getLon();
//获取当前查询的纬度 圆心位置纬度信息
Double latitudeD = point.getLat();
if (Objects.isNull(longitudeD)) {
result.error500("请传入经度");
}
if (Objects.isNull(latitudeD)) {
result.error500("请传入纬度");
}
if (!(longitudeD >= -180 && longitudeD <= 180)) {
result.error500("经度不合法");
}
if (!(latitudeD >= -85.05112878 && latitudeD <= 85.05112878)) {
result.error500("纬度不合法");
}
// 1.获取外接正方形
Rectangle rectangle = getRectangle(radius, longitudeD, latitudeD);
// 2.获取位置在正方形内的所有设备 判断核设施的经纬度是否为空 不为空 判断经纬度是否在正方形的最大最小范围内 如果在则过滤出来继续使用否则弃用
nuclearFacilityPoints = nuclearFacilityPoints.stream().filter(item-> StringUtils.isNotBlank(item.getLon()) && StringUtils.isNotBlank(item.getLat()) &&
(Double.valueOf(item.getLon())>=rectangle.getMinX() && Double.valueOf(item.getLon())<= rectangle.getMaxX())
&& (Double.valueOf(item.getLat())>=rectangle.getMinY() && Double.valueOf(item.getLat())<= rectangle.getMaxY())).collect(Collectors.toList());
//遍历在正方形范围内的数据 根据点的经纬度信息以及圆心的经纬度信息 计算出两者之间的距离 半径进行比较 <=半径则说明点在范围内否则点超出半径范围
nuclearFacilityPoints = nuclearFacilityPoints.stream()
.filter(equ -> getDistance(Double.valueOf(equ.getLon()), Double.valueOf(equ.getLat()), longitudeD, latitudeD) <= radius).collect(Collectors.toList());
//在范围内的点信息 计算点与圆心间的半径距离返回信息
for (Point p:nuclearFacilityPoints) {
stationsList.add(nuclearFacilityMap.get(p.getNuclearFacilityId()));
//计算点与圆心间的距离信息
double radiusR = getDistance(Double.valueOf(p.getLon()), Double.valueOf(p.getLat()), longitudeD, latitudeD);
p.setRadius(String.valueOf(radiusR));
p.setStationName(stationName);
}
resultList.add(nuclearFacilityPoints);
}
map.put("GIS", stationsList);
map.put("table", resultList);
}
}
result.setSuccess(true);
result.setResult(map);
return result;
}
/**
* 获取外接正方形的最大最小经纬度
*
* @param radius 半径/距离
* @param longitude 圆心经度
* @param latitude 圆心纬度
*/
private Rectangle getRectangle(Double radius, Double longitude, Double latitude) {
return spatialContext.getDistCalc()
.calcBoxByDistFromPt(spatialContext.makePoint(longitude, latitude),
radius * DistanceUtils.KM_TO_DEG, spatialContext, null);
}
/***
* 球面中两点间的距离
*
* @param lon 设备经度
* @param lat 设备纬度
* @param longitude 圆心经度
* @param latitude 圆心纬度
* @return 返回距离单位km
*/
private double getDistance(Double lon, Double lat, double longitude, double latitude) {
return spatialContext.calcDistance(spatialContext.makePoint(longitude, latitude),
spatialContext.makePoint(lon, lat)) * DistanceUtils.DEG_TO_KM;
}
}

View File

@ -8,8 +8,18 @@ import java.util.List;
public interface GardsDetectorsMapper extends BaseMapper<GardsDetectors> {
/**
* 分页查询探测器数据
* @param page
* @param gardsDetectors
* @return
*/
Page<GardsDetectors> findPage(Page<GardsDetectors> page, GardsDetectors gardsDetectors);
/**
* 查询探测器类型数据
* @return
*/
List<String> findType();
}

View File

@ -32,6 +32,7 @@
and RTRIM(STATUS, ' ') = #{gardsDetectors.status}
</if>
</where>
order by DETECTOR_ID asc
</select>
<select id="findType" resultType="java.lang.String">

View File

@ -12,7 +12,7 @@
FROM
sys_task t
left join sys_user u on u.id = t.user_id
where t.scheduling_date BETWEEN #{firstDay} and #{lastDay}
where t.scheduling_date BETWEEN to_date(#{firstDay}, 'YYYY-MM-DD') and to_date(#{lastDay}, 'YYYY-MM-DD')
group by t.user_id,t.scheduling_date,t.id,u.username
</select>
@ -25,7 +25,7 @@
FROM
sys_task t
left join sys_user u on u.id = t.user_id
where t.scheduling_date BETWEEN #{firstDay} and #{lastDay}
where t.scheduling_date BETWEEN to_date(#{firstDay}, 'YYYY-MM-DD') and to_date(#{lastDay}, 'YYYY-MM-DD')
</select>
</mapper>

View File

@ -38,6 +38,7 @@ public class GardsNuclearfacilityServiceImpl extends ServiceImpl<GardsNuclearfac
queryWrapper.eq(StringUtils.isNotBlank(gardsNuclearfacility.getType()), GardsNuclearfacility::getType, gardsNuclearfacility.getType());
queryWrapper.eq(StringUtils.isNotBlank(gardsNuclearfacility.getLocation()), GardsNuclearfacility::getLocation, gardsNuclearfacility.getLocation());
queryWrapper.eq(StringUtils.isNotBlank(gardsNuclearfacility.getStatus()), GardsNuclearfacility::getStatus, gardsNuclearfacility.getStatus());
queryWrapper.orderByAsc(GardsNuclearfacility::getFacilityId);
Page<GardsNuclearfacility> gardsNuclearfacilityPage = this.baseMapper.selectPage(page, queryWrapper);
result.setSuccess(true);
result.setResult(gardsNuclearfacilityPage);

View File

@ -45,6 +45,7 @@ public class GardsSampleDataServiceImpl extends ServiceImpl<GardsSampleDataMappe
queryWrapper.eq(Objects.nonNull(gardsSampleData.getDetectorId()) ,GardsSampleData::getDetectorId, gardsSampleData.getDetectorId());
queryWrapper.ge(Objects.nonNull(gardsSampleData.getCollectStart()) ,GardsSampleData::getCollectStart, gardsSampleData.getCollectStart());
queryWrapper.le(Objects.nonNull(gardsSampleData.getCollectStop()) ,GardsSampleData::getCollectStop, gardsSampleData.getCollectStop());
queryWrapper.orderByAsc(GardsSampleData::getSampleId);
Page<GardsSampleData> sampleDataPage = this.baseMapper.selectPage(page, queryWrapper);
sampleDataPage.getRecords().forEach(item->{
if (CollectionUtils.isNotEmpty(stationMap) && Objects.nonNull(item.getStationId())){

View File

@ -46,6 +46,7 @@ public class GardsStationsServiceImpl extends ServiceImpl<GardsStationsMapper, G
queryWrapper.eq(StringUtils.isNotBlank(gardsStations.getCountryCode()), GardsStations::getCountryCode, gardsStations.getCountryCode());
queryWrapper.eq(StringUtils.isNotBlank(gardsStations.getType()), GardsStations::getType, gardsStations.getType());
queryWrapper.eq(StringUtils.isNotBlank(gardsStations.getStatus()), GardsStations::getStatus, gardsStations.getStatus());
queryWrapper.orderByAsc(GardsStations::getStationId);
Page<GardsStations> pageList = this.baseMapper.selectPage(page, queryWrapper);
result.setSuccess(true);
result.setResult(pageList);

View File

@ -252,18 +252,22 @@ public class SysTaskServiceImpl extends ServiceImpl<SysTaskMapper, SysTask> impl
* @param schedulingDate
*/
private void deleteByDate(Date schedulingDate){
//根据排班日期查询对应的任务信息
LambdaQueryWrapper<SysTask> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SysTask::getSchedulingDate, DateUtils.formatDate(schedulingDate, "yyyy-MM-dd"));
List<SysTask> sysTasks = this.baseMapper.selectList(queryWrapper);
//获取任务信息的id
List<String> taskIds = sysTasks.stream().map(SysTask::getId).collect(Collectors.toList());
//根据任务id删除关联的台站信息
LambdaQueryWrapper<SysTaskStation> taskStationQueryWrapper = new LambdaQueryWrapper<>();
taskStationQueryWrapper.in(SysTaskStation::getTaskId, taskIds);
sysTaskStationMapper.delete(taskStationQueryWrapper);
//根据任务id删除任务信息
this.baseMapper.deleteBatchIds(taskIds);
try {
//根据排班日期查询对应的任务信息
LambdaQueryWrapper<SysTask> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SysTask::getSchedulingDate, DateUtils.parseDate(DateUtils.formatDate(schedulingDate, "yyyy-MM-dd"), "yyyy-MM-dd"));
List<SysTask> sysTasks = this.baseMapper.selectList(queryWrapper);
//获取任务信息的id
List<String> taskIds = sysTasks.stream().map(SysTask::getId).collect(Collectors.toList());
//根据任务id删除关联的台站信息
LambdaQueryWrapper<SysTaskStation> taskStationQueryWrapper = new LambdaQueryWrapper<>();
taskStationQueryWrapper.in(SysTaskStation::getTaskId, taskIds);
sysTaskStationMapper.delete(taskStationQueryWrapper);
//根据任务id删除任务信息
this.baseMapper.deleteBatchIds(taskIds);
} catch (ParseException e) {
throw new RuntimeException(e);
}
}
@Override
@ -284,40 +288,44 @@ public class SysTaskServiceImpl extends ServiceImpl<SysTaskMapper, SysTask> impl
@Transactional
public Result changeScheduling(SysTaskChangeVo sysTaskChangeVo) {
Result result = new Result();
//来源用户相关信息查询
//查询出当前来源用户在排版日期的任务信息
LambdaQueryWrapper<SysTask> fromQueryWrapper = new LambdaQueryWrapper<>();
fromQueryWrapper.eq(SysTask::getUserId, sysTaskChangeVo.getFromUserId());
fromQueryWrapper.eq(SysTask::getSchedulingDate, DateUtils.formatDate(sysTaskChangeVo.getDay(), "yyyy-MM-dd"));
SysTask fromSysTask = this.baseMapper.selectOne(fromQueryWrapper);
//根据来源用户的任务以及台站信息查询出对应的任务及台站信息
LambdaQueryWrapper<SysTaskStation> fromTaskQueryWrapper = new LambdaQueryWrapper<>();
fromTaskQueryWrapper.eq(SysTaskStation::getTaskId, fromSysTask.getId());
fromTaskQueryWrapper.in(SysTaskStation::getStationId, sysTaskChangeVo.getStationIds());
List<SysTaskStation> sysTaskStations = sysTaskStationMapper.selectList(fromTaskQueryWrapper);
//转移到用户相关信息查询
//查询出当前转移到用户在排班日期的任务信息
LambdaQueryWrapper<SysTask> toQueryWrapper = new LambdaQueryWrapper<>();
toQueryWrapper.eq(SysTask::getUserId, sysTaskChangeVo.getToUserId());
toQueryWrapper.eq(SysTask::getSchedulingDate, DateUtils.formatDate(sysTaskChangeVo.getDay(), "yyyy-MM-dd"));
SysTask toSysTask = this.baseMapper.selectOne(toQueryWrapper);
//台站信息不为空
if (CollectionUtils.isNotEmpty(sysTaskStations)){
//遍历当前要进行修改的台站信息
for (SysTaskStation taskStation:sysTaskStations) {
taskStation.setTaskId(toSysTask.getId());
sysTaskStationMapper.updateById(taskStation);
try {
//来源用户相关信息查询
//查询出当前来源用户在排版日期的任务信息
LambdaQueryWrapper<SysTask> fromQueryWrapper = new LambdaQueryWrapper<>();
fromQueryWrapper.eq(SysTask::getUserId, sysTaskChangeVo.getFromUserId());
fromQueryWrapper.eq(SysTask::getSchedulingDate, DateUtils.parseDate(DateUtils.formatDate(sysTaskChangeVo.getDay(), "yyyy-MM-dd"), "yyyy-MM-dd"));
SysTask fromSysTask = this.baseMapper.selectOne(fromQueryWrapper);
//根据来源用户的任务以及台站信息查询出对应的任务及台站信息
LambdaQueryWrapper<SysTaskStation> fromTaskQueryWrapper = new LambdaQueryWrapper<>();
fromTaskQueryWrapper.eq(SysTaskStation::getTaskId, fromSysTask.getId());
fromTaskQueryWrapper.in(SysTaskStation::getStationId, sysTaskChangeVo.getStationIds());
List<SysTaskStation> sysTaskStations = sysTaskStationMapper.selectList(fromTaskQueryWrapper);
//转移到用户相关信息查询
//查询出当前转移到用户在排班日期的任务信息
LambdaQueryWrapper<SysTask> toQueryWrapper = new LambdaQueryWrapper<>();
toQueryWrapper.eq(SysTask::getUserId, sysTaskChangeVo.getToUserId());
toQueryWrapper.eq(SysTask::getSchedulingDate, DateUtils.parseDate(DateUtils.formatDate(sysTaskChangeVo.getDay(), "yyyy-MM-dd"), "yyyy-MM-dd"));
SysTask toSysTask = this.baseMapper.selectOne(toQueryWrapper);
//台站信息不为空
if (CollectionUtils.isNotEmpty(sysTaskStations)){
//遍历当前要进行修改的台站信息
for (SysTaskStation taskStation:sysTaskStations) {
taskStation.setTaskId(toSysTask.getId());
sysTaskStationMapper.updateById(taskStation);
}
}
//判断 如果当前来源用户及日期下的排班任务对应的台站信息为空排班任务信息删除
LambdaQueryWrapper<SysTaskStation> sysTaskStationQueryWrapper = new LambdaQueryWrapper<>();
sysTaskStationQueryWrapper.eq(SysTaskStation::getTaskId, fromSysTask.getId());
List<SysTaskStation> stations = sysTaskStationMapper.selectList(sysTaskStationQueryWrapper);
if (CollectionUtils.isEmpty(stations)){
this.baseMapper.deleteById(fromSysTask);
}
result.setSuccess(true);
result.success("交接完成");
} catch (ParseException e) {
throw new RuntimeException(e);
}
//判断 如果当前来源用户及日期下的排班任务对应的台站信息为空排班任务信息删除
LambdaQueryWrapper<SysTaskStation> sysTaskStationQueryWrapper = new LambdaQueryWrapper<>();
sysTaskStationQueryWrapper.eq(SysTaskStation::getTaskId, fromSysTask.getId());
List<SysTaskStation> stations = sysTaskStationMapper.selectList(sysTaskStationQueryWrapper);
if (CollectionUtils.isEmpty(stations)){
this.baseMapper.deleteById(fromSysTask);
}
result.setSuccess(true);
result.success("交接完成");
return result;
}

View File

@ -162,7 +162,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
if (userIds != null && userIds.size() > 0) {
Map<String, String> useDepNames = this.getDepNamesByUserIds(userIds);
pageList.getRecords().forEach(item -> {
item.setOrgCodeTxt(useDepNames.get(item.getId()));
String value = useDepNames.get(item.getId());
if(StringUtils.isNotBlank(value)){
item.setOrgCodeTxt(value);
}
//查询用户的租户ids
List<Integer> list = userTenantMapper.getTenantIdsByUserId(item.getId());
if (oConvertUtils.isNotEmpty(list)) {

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-boot-parent</artifactId>
<version>3.5.1</version>
</parent>
<artifactId>jeecg-module-web-statistics</artifactId>
<dependencies>
<dependency>
<groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-boot-base-core</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,7 @@
package org.jeecgframework.boot;
public class Main {
public static void main(String[] args) {
System.out.println("Hello world!");
}
}

View File

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-server-cloud</artifactId>
<version>3.5.1</version>
</parent>
<artifactId>jeecg-web-statistics-start</artifactId>
<dependencies>
<!-- 引入jeecg-boot-starter-cloud依赖 -->
<dependency>
<groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-boot-starter-cloud</artifactId>
</dependency>
<dependency>
<groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-boot-base-core</artifactId>
</dependency>
<dependency>
<groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-module-web-statistics</artifactId>
<version>3.5.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,46 @@
package org.jeecgframework.boot;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.util.oConvertUtils;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableScheduling;
import java.net.InetAddress;
import java.net.UnknownHostException;
@Slf4j
@SpringBootApplication
@EnableFeignClients(basePackages = {"org.jeecg"})
@EnableScheduling
public class JeecgWebStatisticsApplication extends SpringBootServletInitializer implements CommandLineRunner {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(JeecgWebStatisticsApplication.class);
}
public static void main(String[] args) throws UnknownHostException {
ConfigurableApplicationContext application = SpringApplication.run(JeecgWebStatisticsApplication.class, args);
Environment env = application.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");
String path = oConvertUtils.getString(env.getProperty("server.servlet.context-path"));
log.info("\n----------------------------------------------------------\n\t" +
"Application Jeecg-Boot is running! Access URLs:\n\t" +
"Local: \t\thttp://localhost:" + port + path + "/doc.html\n" +
"External: \thttp://" + ip + ":" + port + path + "/doc.html\n" +
"Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" +
"----------------------------------------------------------");
}
@Override
public void run(String... args) throws Exception {
}
}

View File

@ -0,0 +1,18 @@
server:
port: 7003
spring:
application:
name: jeecg-web-statistics
cloud:
nacos:
config:
server-addr: @config.server-addr@
group: @config.group@
namespace: @config.namespace@
discovery:
server-addr: ${spring.cloud.nacos.config.server-addr}
config:
import:
- optional:nacos:jeecg.yaml
- optional:nacos:jeecg-web-statistics-@profile.name@.yaml

View File

@ -0,0 +1,29 @@
#code_generate_project_path
project_path=E:\\workspace\\jeecg-boot
#bussi_package[User defined]
bussi_package=org.jeecg.modules.demo
#default code path
#source_root_package=src
#webroot_package=WebRoot
#maven code path
source_root_package=src.main.java
webroot_package=src.main.webapp
#ftl resource url
templatepath=/jeecg/code-template
system_encoding=utf-8
#db Table id [User defined]
db_table_id=id
#db convert flag[true/false]
db_filed_convert=true
#page Search Field num [User defined]
page_search_filed_num=1
#page_filter_fields
page_filter_fields=create_time,create_by,update_time,update_by
exclude_table=act_,ext_act_,design_,onl_,sys_,qrtz_

View File

@ -0,0 +1,27 @@
#mysql
diver_name=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/jeecg-boot?useUnicode=true&characterEncoding=UTF-8
username=root
password=root
database_name=jeecg-boot
#oracle
#diver_name=oracle.jdbc.driver.OracleDriver
#url=jdbc:oracle:thin:@192.168.1.200:1521:ORCL
#username=scott
#password=tiger
#database_name=ORCL
#postgre
#diver_name=org.postgresql.Driver
#url=jdbc:postgresql://localhost:5432/jeecg
#username=postgres
#password=postgres
#database_name=jeecg
#SQLServer2005\u4ee5\u4e0a
#diver_name=org.hibernate.dialect.SQLServerDialect
#url=jdbc:sqlserver://192.168.1.200:1433;DatabaseName=jeecg
#username=sa
#password=SA
#database_name=jeecg

View File

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<!--定义日志文件的存储地址 -->
<property name="LOG_HOME" value="../logs" />
<!--<property name="COLOR_PATTERN" value="%black(%contextName-) %red(%d{yyyy-MM-dd HH:mm:ss}) %green([%thread]) %highlight(%-5level) %boldMagenta( %replace(%caller{1}){'\t|Caller.{1}0|\r\n', ''})- %gray(%msg%xEx%n)" />-->
<!-- 控制台输出 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期%thread表示线程名%-5level级别从左显示5个字符宽度%msg日志消息%n是换行符
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}:%L - %msg%n</pattern>-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %highlight(%-5level) %cyan(%logger{50}:%L) - %msg%n</pattern>
</encoder>
</appender>
<!-- 按照每天生成日志文件 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名 -->
<FileNamePattern>${LOG_HOME}/jeecg-system-%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数 -->
<MaxHistory>30</MaxHistory>
<maxFileSize>10MB</maxFileSize>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期%thread表示线程名%-5level级别从左显示5个字符宽度%msg日志消息%n是换行符 -->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}:%L - %msg%n</pattern>
</encoder>
</appender>
<!-- 生成 error html格式日志开始 -->
<appender name="HTML" class="ch.qos.logback.core.FileAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<!--设置日志级别,过滤掉info日志,只输入error日志-->
<level>ERROR</level>
</filter>
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="ch.qos.logback.classic.html.HTMLLayout">
<pattern>%p%d%msg%M%F{32}%L</pattern>
</layout>
</encoder>
<file>${LOG_HOME}/error-log.html</file>
</appender>
<!-- 生成 error html格式日志结束 -->
<!-- 每天生成一个html格式的日志开始 -->
<appender name="FILE_HTML" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名 -->
<FileNamePattern>${LOG_HOME}/jeecg-system-%d{yyyy-MM-dd}.%i.html</FileNamePattern>
<!--日志文件保留天数 -->
<MaxHistory>30</MaxHistory>
<MaxFileSize>10MB</MaxFileSize>
</rollingPolicy>
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="ch.qos.logback.classic.html.HTMLLayout">
<pattern>%p%d%msg%M%F{32}%L</pattern>
</layout>
</encoder>
</appender>
<!-- 每天生成一个html格式的日志结束 -->
<!--myibatis log configure -->
<logger name="com.apache.ibatis" level="TRACE" />
<logger name="java.sql.Connection" level="DEBUG" />
<logger name="java.sql.Statement" level="DEBUG" />
<logger name="java.sql.PreparedStatement" level="DEBUG" />
<!-- 日志输出级别 -->
<root level="INFO">
<appender-ref ref="STDOUT" />
<appender-ref ref="FILE" />
<appender-ref ref="HTML" />
<appender-ref ref="FILE_HTML" />
</root>
</configuration>

View File

@ -22,6 +22,7 @@
<!-- 监控和测试例子 -->
<module>jeecg-visual</module>
<module>jeecg-station-operation-start</module>
<module>jeecg-web-statistics-start</module>
</modules>
</project>

View File

@ -80,7 +80,8 @@
<module>jeecg-module-system</module>
<module>jeecg-module-log-manage</module>
<module>jeecg-module-station-operation</module>
</modules>
<module>jeecg-module-web-statistics</module>
</modules>
<repositories>
<repository>
@ -179,6 +180,12 @@
<artifactId>jeecg-module-station-operation</artifactId>
<version>${jeecgboot.version}</version>
</dependency>
<!-- jeecg-module-web-statistics模块 -->
<dependency>
<groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-module-web-statistics</artifactId>
<version>${jeecgboot.version}</version>
</dependency>
<!-- jeecg tools -->
<dependency>
<groupId>org.jeecgframework.boot</groupId>