Compare commits
43 Commits
d6687f97f1
...
ef429d3194
Author | SHA1 | Date | |
---|---|---|---|
ef429d3194 | |||
0425a150d5 | |||
71b00ea5c1 | |||
f14168e872 | |||
d42e981c2f | |||
a93317d558 | |||
4b0995a009 | |||
2e99b505c6 | |||
c6f2684150 | |||
f95361ad23 | |||
2e3ebd0383 | |||
d1876c76a5 | |||
32329dff77 | |||
34f7df819d | |||
e58be046fc | |||
6dcfba3b74 | |||
5292f7c3f4 | |||
da85b4b461 | |||
b76b8f110b | |||
08bf2d1433 | |||
b4b37221cd | |||
dda07281f0 | |||
497c101b5b | |||
02740c701e | |||
8a57ad232c | |||
194a7bb227 | |||
f552e8afd3 | |||
c09078506a | |||
3ec2186b03 | |||
84a34052b3 | |||
894f8bf8c3 | |||
4c3d9c7878 | |||
f9982b7ec0 | |||
0dde9222f4 | |||
5f93aab040 | |||
40ba1cb503 | |||
e2ccdbd4c4 | |||
8187ed3143 | |||
605d2787a8 | |||
a6a4d1e382 | |||
1e26d750ff | |||
9c0636ee45 | |||
a4685cbf50 |
155
.drone-images.yml
Normal file
155
.drone-images.yml
Normal file
@ -0,0 +1,155 @@
|
||||
kind: pipeline # 定义对象类型,还有secret和signature两种类型
|
||||
|
||||
type: docker # 定义流水线类型,还有kubernetes、exec、ssh等类型
|
||||
|
||||
name: ludu-drone-images # 定义流水线名称
|
||||
|
||||
|
||||
steps: # 定义流水线执行步骤,这些步骤将顺序执行
|
||||
- name: package # 流水线名称
|
||||
|
||||
image: maven:3-jdk-8 # 定义创建容器的Docker镜像
|
||||
|
||||
volumes: # 将容器内目录挂载到宿主机,仓库需要开启Trusted设置
|
||||
|
||||
- name: maven-cache
|
||||
|
||||
path: /root/.m2 # 将maven下载依赖的目录挂载出来,防止重复下载
|
||||
|
||||
- name: maven-build
|
||||
|
||||
path: /app/build # 将应用打包好的Jar和执行脚本挂载出来
|
||||
|
||||
commands: # 定义在Docker容器中执行的shell命令
|
||||
- mvn package -Dmaven.test.skip=true # 应用打包命令
|
||||
- |
|
||||
if [ "${service}" = "gateway" ] || [ "${service}" = "all" ]; then
|
||||
mkdir -p /app/build/yudao-gateway/target
|
||||
cp ./yudao-gateway/target/yudao-gateway.jar /app/build/yudao-gateway/target/
|
||||
cp ./yudao-gateway/Dockerfile /app/build/yudao-gateway/
|
||||
cp ./yudao-gateway/run.sh /app/build/yudao-gateway/
|
||||
fi
|
||||
if [ "${service}" = "system" ] || [ "${service}" = "all" ]; then
|
||||
mkdir -p /app/build/yudao-module-system/target
|
||||
cp ./yudao-module-system/yudao-module-system-biz/target/yudao-module-system-biz.jar /app/build/yudao-module-system/target/
|
||||
cp ./yudao-module-system/yudao-module-system-biz/Dockerfile /app/build/yudao-module-system/
|
||||
cp ./yudao-module-system/yudao-module-system-biz/run.sh /app/build/yudao-module-system/
|
||||
fi
|
||||
if [ "${service}" = "infra" ] || [ "${service}" = "all" ]; then
|
||||
mkdir -p /app/build/yudao-module-infra/target
|
||||
cp ./yudao-module-infra/yudao-module-infra-biz/target/yudao-module-infra-biz.jar /app/build/yudao-module-infra/target/
|
||||
cp ./yudao-module-infra/yudao-module-infra-biz/Dockerfile /app/build/yudao-module-infra/
|
||||
cp ./yudao-module-infra/yudao-module-infra-biz/run.sh /app/build/yudao-module-infra/
|
||||
fi
|
||||
if [ "${service}" = "job" ] || [ "${service}" = "all" ]; then
|
||||
mkdir -p /app/build/ludu-job-admin/target
|
||||
cp ./ludu-job-admin/ludu-job-admin-biz/target/ludu-job-admin-biz.jar /app/build/ludu-job-admin/target/
|
||||
cp ./ludu-job-admin/ludu-job-admin-biz/Dockerfile /app/build/ludu-job-admin/
|
||||
cp ./ludu-job-admin/ludu-job-admin-biz/run.sh /app/build/ludu-job-admin/
|
||||
fi
|
||||
if [ "${service}" = "ticketing" ] || [ "${service}" = "all" ]; then
|
||||
mkdir -p /app/build/ludu-module-ticketing/target
|
||||
cp ./ludu-module-ticketing/ludu-module-ticketing-biz/target/ludu-module-ticketing-biz.jar /app/build/ludu-module-ticketing/target/
|
||||
cp ./ludu-module-ticketing/ludu-module-ticketing-biz/Dockerfile /app/build/ludu-module-ticketing/
|
||||
cp ./ludu-module-ticketing/ludu-module-ticketing-biz/run.sh /app/build/ludu-module-ticketing/
|
||||
fi
|
||||
if [ "${service}" = "parking" ] || [ "${service}" = "all" ]; then
|
||||
mkdir -p /app/build/ludu-module-parking/target
|
||||
cp ./ludu-module-parking/ludu-module-parking-biz/target/ludu-module-parking-biz.jar /app/build/ludu-module-parking/target/
|
||||
cp ./ludu-module-parking/ludu-module-parking-biz/Dockerfile /app/build/ludu-module-parking/
|
||||
cp ./ludu-module-parking/ludu-module-parking-biz/run.sh /app/build/ludu-module-parking/
|
||||
fi
|
||||
if [ "${service}" = "datacenter" ] || [ "${service}" = "all" ]; then
|
||||
mkdir -p /app/build/ludu-module-datacenter/target
|
||||
cp ./ludu-module-datacenter/ludu-module-datacenter-biz/target/ludu-module-datacenter-biz.jar /app/build/ludu-module-datacenter/target
|
||||
cp ./ludu-module-datacenter/ludu-module-datacenter-biz/Dockerfile /app/build/ludu-module-datacenter/
|
||||
cp ./ludu-module-datacenter/ludu-module-datacenter-biz/run.sh /app/build/ludu-module-datacenter/
|
||||
fi
|
||||
|
||||
- name: push-images
|
||||
|
||||
image: appleboy/drone-ssh # SSH工具镜像
|
||||
|
||||
settings:
|
||||
|
||||
host: 101.43.112.107 # 远程连接地址
|
||||
|
||||
username: root # 远程连接账号
|
||||
|
||||
password:
|
||||
|
||||
from_secret: ssh_password # 从Secret中读取SSH密码
|
||||
|
||||
port: 22 # 远程连接端口
|
||||
|
||||
command_timeout: 30m # 远程执行命令超时时间
|
||||
|
||||
script:
|
||||
- |
|
||||
deploy_service() {
|
||||
local image_name=$1
|
||||
local container_name=$2
|
||||
if [[ -z "${image_name}" || -z "${container_name}" ]]; then
|
||||
echo "Error: image_name or container_name is empty."
|
||||
exit 1
|
||||
fi
|
||||
cd /ludu/build/${image_name}
|
||||
docker stop ${container_name}
|
||||
docker rm ${container_name}
|
||||
docker rmi -f ${image_name}:1.0.0
|
||||
docker buildx build -f Dockerfile -t ${image_name}:1.0.0 .
|
||||
docker tag ${image_name}:1.0.0 120.46.37.243:8080/lundu/${image_name}:1.0.0
|
||||
docker push 120.46.37.243:8080/lundu/${image_name}:1.0.0
|
||||
}
|
||||
if [ "${service}" = "gateway" ] || [ "${service}" = "all" ]; then
|
||||
deploy_service "yudao-gateway" "yudao-gateway"
|
||||
fi
|
||||
if [ "${service}" = "system" ] || [ "${service}" = "all" ]; then
|
||||
deploy_service "yudao-module-system" "yudao-system"
|
||||
fi
|
||||
if [ "${service}" = "infra" ] || [ "${service}" = "all" ]; then
|
||||
deploy_service "yudao-module-infra" "yudao-infra"
|
||||
fi
|
||||
if [ "${service}" = "job" ] || [ "${service}" = "all" ]; then
|
||||
deploy_service "ludu-job-admin" "ludu-job-admin"
|
||||
fi
|
||||
if [ "${service}" = "ticketing" ] || [ "${service}" = "all" ]; then
|
||||
deploy_service "ludu-module-ticketing" "ludu-ticketing"
|
||||
fi
|
||||
if [ "${service}" = "parking" ] || [ "${service}" = "all" ]; then
|
||||
deploy_service "ludu-module-parking" "ludu-parking"
|
||||
fi
|
||||
if [ "${service}" = "datacenter" ] || [ "${service}" = "all" ]; then
|
||||
deploy_service "ludu-module-datacenter" "ludu-datacenter"
|
||||
fi
|
||||
|
||||
- name: pull-image-and-run
|
||||
|
||||
image: appleboy/drone-ssh # SSH工具镜像
|
||||
|
||||
settings:
|
||||
|
||||
host: 121.36.203.133 # 远程连接地址
|
||||
|
||||
username: root # 远程连接账号
|
||||
|
||||
password:
|
||||
|
||||
from_secret: ssh_password3 # 从Secret中读取SSH密码
|
||||
|
||||
port: 22 # 远程连接端口
|
||||
|
||||
command_timeout: 20m # 远程执行命令超时时间
|
||||
|
||||
script:
|
||||
- cd /ludu
|
||||
- ./start_service.sh ${service}
|
||||
volumes: # 定义流水线挂载目录,用于共享数据
|
||||
|
||||
- name: maven-build
|
||||
host:
|
||||
path: /ludu/maven/build # 从宿主机中挂载的目录
|
||||
|
||||
- name: maven-cache
|
||||
host:
|
||||
path: /ludu/maven/cache # 从宿主机中挂载的目录
|
@ -50,7 +50,7 @@ steps: # 定义流水线执行步骤,这些步骤将顺序执行
|
||||
- chmod +x run.sh
|
||||
- ./run.sh || echo "job build failed"
|
||||
|
||||
- cd ludu-module-datacenter/ludu-module-datacenter-biz/
|
||||
- cd /root/ludu-cloud/ludu-module-datacenter/ludu-module-datacenter-biz/
|
||||
- chmod +x run.sh
|
||||
- ./run.sh || echo "datacenter build failed"
|
||||
|
||||
|
@ -0,0 +1,28 @@
|
||||
package cn.iocoder.yudao.module.datacenter.controller.app.flight;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.datacenter.dal.dataobject.flight.TodayFlightDO;
|
||||
import cn.iocoder.yudao.module.datacenter.service.flight.TodayFlightService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/flight")
|
||||
public class TodayFlightController {
|
||||
|
||||
@Resource
|
||||
private TodayFlightService todayFlightService;
|
||||
|
||||
@GetMapping("/getFlightData")
|
||||
public CommonResult<List<Object>> getFlightData(){
|
||||
|
||||
List<Object> listCommonResult = todayFlightService.todayFlightData();
|
||||
|
||||
return CommonResult.success(listCommonResult);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package cn.iocoder.yudao.module.datacenter.controller.app.flight.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class Datas {
|
||||
private String classes;
|
||||
private String timeOne;
|
||||
private String timeTwo;
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package cn.iocoder.yudao.module.datacenter.controller.app.flight.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class FlightDataDO {
|
||||
private String name;
|
||||
private List<Datas> datas = new ArrayList<>();
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package cn.iocoder.yudao.module.datacenter.controller.app.flight.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 今日航班分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class TodayFlightPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "航线", example = "19067")
|
||||
private Long shipRouteId;
|
||||
|
||||
@Schema(description = "班次")
|
||||
private String classes;
|
||||
|
||||
@Schema(description = "开始时间")
|
||||
private String startTime;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package cn.iocoder.yudao.module.datacenter.controller.app.flight.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 今日航班 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class TodayFlightRespVO {
|
||||
|
||||
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "12418")
|
||||
@ExcelProperty("id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "航线", example = "19067")
|
||||
@ExcelProperty("航线")
|
||||
private Long shipRouteId;
|
||||
|
||||
@Schema(description = "班次")
|
||||
@ExcelProperty("班次")
|
||||
private String classes;
|
||||
|
||||
@Schema(description = "开始时间")
|
||||
@ExcelProperty("开始时间")
|
||||
private String startTime;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "航线")
|
||||
@ExcelProperty("航线")
|
||||
private String shipRouteName;
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package cn.iocoder.yudao.module.datacenter.controller.app.flight.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 今日航班新增/修改 Request VO")
|
||||
@Data
|
||||
public class TodayFlightSaveReqVO {
|
||||
|
||||
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "12418")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "航线", example = "19067")
|
||||
private Long shipRouteId;
|
||||
|
||||
@Schema(description = "班次")
|
||||
private String classes;
|
||||
|
||||
@Schema(description = "开始时间")
|
||||
private String startTime;
|
||||
|
||||
}
|
@ -53,27 +53,33 @@ public class VehicleAccessApi {
|
||||
LocalDateTime startOfDay = LocalDateTime.of(today, LocalTime.MIN);
|
||||
LocalDateTime endOfDay = LocalDateTime.of(today, LocalTime.MAX);
|
||||
|
||||
Revenue revenue = new Revenue();
|
||||
revenue.setAreaName("中关村软件园一号院");
|
||||
revenue.setCreateTime(LocalDateTime.now());
|
||||
revenue.setGetTime("2024.05.14 12:15:36");
|
||||
revenue.setMemo("");
|
||||
revenue.setPayCharge("30");
|
||||
revenue.setPayKind("微信");
|
||||
revenue.setPlate("京A 88888");
|
||||
revenueRepository.insert(revenue);
|
||||
Optional<BlueCardHeartbeat> topByCreateTimeBetween = blueCardHeartbeatRepository.findFirstByCreateTimeBetweenOrderByCreateTimeDesc(startOfDay, endOfDay);
|
||||
|
||||
return ResponseVO.success(200, "添加成功", null, 0);
|
||||
// Revenue revenue = new Revenue();
|
||||
// revenue.setAreaName("中关村软件园一号院");
|
||||
// revenue.setCreateTime(LocalDateTime.now());
|
||||
// revenue.setGetTime("2024.05.14 12:15:36");
|
||||
// revenue.setMemo("");
|
||||
// revenue.setPayCharge("30");
|
||||
// revenue.setPayKind("微信");
|
||||
// revenue.setPlate("京A 88888");
|
||||
// revenueRepository.insert(revenue);
|
||||
|
||||
return ResponseVO.success(200, "添加成功", topByCreateTimeBetween, 0);
|
||||
}
|
||||
|
||||
|
||||
//获取实时车辆进出数据和今日车位统计
|
||||
@GetMapping("/parkingLotData")
|
||||
public ResponseVO parkAndVacancy() {
|
||||
|
||||
// 获取今天的日期
|
||||
LocalDate today = LocalDate.now();
|
||||
// 计算今天的起始时间和结束时间
|
||||
LocalDateTime startOfDay = LocalDateTime.of(today, LocalTime.MIN);
|
||||
LocalDateTime endOfDay = LocalDateTime.of(today, LocalTime.MAX);
|
||||
|
||||
//时间最新的一条数据
|
||||
Optional<BlueCardHeartbeat> latestHeartbeat = blueCardHeartbeatRepository.findTopByOrderByCreateTimeDesc();
|
||||
Optional<BlueCardHeartbeat> latestHeartbeat = blueCardHeartbeatRepository.findFirstByCreateTimeBetweenOrderByCreateTimeDesc(startOfDay,endOfDay);
|
||||
|
||||
if (latestHeartbeat.isPresent()) {
|
||||
BlueCardHeartbeat heartbeat = latestHeartbeat.get();
|
||||
@ -87,11 +93,6 @@ public class VehicleAccessApi {
|
||||
parkingLotDataVO.setParkingNum(parkingNum);//实时停车数
|
||||
parkingLotDataVO.setResidualStopNum(residualStopNum);//剩余车位数
|
||||
|
||||
// 获取今天的日期
|
||||
LocalDate today = LocalDate.now();
|
||||
// 计算今天的起始时间和结束时间
|
||||
LocalDateTime startOfDay = LocalDateTime.of(today, LocalTime.MIN);
|
||||
LocalDateTime endOfDay = LocalDateTime.of(today, LocalTime.MAX);
|
||||
List<EntryRecord> entryRecords = entryRecordRepository.findByCreateTimeBetween(startOfDay, endOfDay);
|
||||
parkingLotDataVO.setIntoNum(entryRecords.size());//车辆进入数
|
||||
//固定车临时车
|
||||
|
@ -12,6 +12,8 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @Description 大屏服务-天气接口
|
||||
*/
|
||||
|
@ -0,0 +1,55 @@
|
||||
package cn.iocoder.yudao.module.datacenter.dal.dataobject.flight;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* 今日航班 DO
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@TableName("today_flight")
|
||||
@KeySequence("today_flight_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class TodayFlightDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 航线
|
||||
*/
|
||||
private Long shipRouteId;
|
||||
/**
|
||||
* 班次
|
||||
*/
|
||||
private String classes;
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
private String startTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String shipRouteName;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String routeName;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String flightName;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String flightId;
|
||||
|
||||
}
|
@ -2,7 +2,9 @@ package cn.iocoder.yudao.module.datacenter.dal.mongodb.vehicleaccess;
|
||||
|
||||
import cn.iocoder.yudao.module.datacenter.dal.dataobject.vehicleaccess.BlueCardHeartbeat;
|
||||
import org.springframework.data.mongodb.repository.MongoRepository;
|
||||
import org.springframework.data.mongodb.repository.Query;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface BlueCardHeartbeatRepository extends MongoRepository<BlueCardHeartbeat,String> {
|
||||
@ -10,5 +12,7 @@ public interface BlueCardHeartbeatRepository extends MongoRepository<BlueCardHea
|
||||
|
||||
Optional<BlueCardHeartbeat> findTopByOrderByCreateTimeDesc();
|
||||
|
||||
Optional<BlueCardHeartbeat> findFirstByCreateTimeBetweenOrderByCreateTimeDesc(LocalDateTime startOfDay, LocalDateTime endOfDay);
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,27 @@
|
||||
package cn.iocoder.yudao.module.datacenter.dal.mysql.flight;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.datacenter.dal.dataobject.flight.TodayFlightDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 今日航班 Mapper
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Mapper
|
||||
public interface TodayFlightMapper extends BaseMapperX<TodayFlightDO> {
|
||||
|
||||
|
||||
@Select(" select count(c.id),c.id as flight_id from today_flight a " +
|
||||
" inner join ship_route b on a.ship_route_id = b.id " +
|
||||
" inner join flight c on b.flight_id = c.id GROUP BY c.id ")
|
||||
List<TodayFlightDO> todayFlightData();
|
||||
|
||||
@Select("select ship_route_id,classes,start_time from today_flight where ship_route_id = #{id} ORDER BY start_time ASC")
|
||||
List<TodayFlightDO> byRouteId(String id);
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package cn.iocoder.yudao.module.datacenter.service.flight;
|
||||
|
||||
|
||||
import cn.iocoder.yudao.module.datacenter.dal.dataobject.flight.TodayFlightDO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 今日航班 Service 接口
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
public interface TodayFlightService {
|
||||
|
||||
|
||||
List<Object> todayFlightData();
|
||||
|
||||
}
|
@ -0,0 +1,144 @@
|
||||
package cn.iocoder.yudao.module.datacenter.service.flight;
|
||||
|
||||
import cn.iocoder.yudao.module.datacenter.controller.app.flight.vo.Datas;
|
||||
import cn.iocoder.yudao.module.datacenter.controller.app.flight.vo.FlightDataDO;
|
||||
import cn.iocoder.yudao.module.datacenter.dal.dataobject.flight.TodayFlightDO;
|
||||
import cn.iocoder.yudao.module.datacenter.dal.mysql.flight.TodayFlightMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 今日航班 Service 实现类
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class TodayFlightServiceImpl implements TodayFlightService {
|
||||
|
||||
@Resource
|
||||
private TodayFlightMapper todayFlightMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public List<Object> todayFlightData() {
|
||||
List<Object> flightVO = new ArrayList<>();//所有航班集合
|
||||
List<TodayFlightDO> todayFlightDOS = todayFlightMapper.todayFlightData();
|
||||
for (int i = 0; i < todayFlightDOS.size(); i++) {
|
||||
TodayFlightDO todayFlightDO = todayFlightDOS.get(i);
|
||||
if (todayFlightDO.getFlightId().equals("1")){ //石南航班信息
|
||||
FlightDataDO flightDataDO = new FlightDataDO();
|
||||
flightDataDO.setName("石南航班信息");
|
||||
List<TodayFlightDO> todayFlightDOS1 = todayFlightMapper.byRouteId("2"); //石城至南日
|
||||
List<TodayFlightDO> todayFlightDOS2 = todayFlightMapper.byRouteId("1");//南日至石城
|
||||
for (int j = 0; j < todayFlightDOS1.size(); j++) {
|
||||
Datas datas = new Datas();
|
||||
datas.setClasses(todayFlightDOS1.get(j).getClasses());
|
||||
datas.setTimeOne(todayFlightDOS1.get(j).getStartTime());
|
||||
if (j <= todayFlightDOS2.size() - 1){
|
||||
datas.setTimeTwo(todayFlightDOS2.get(j).getStartTime());
|
||||
}
|
||||
flightDataDO.getDatas().add(datas);
|
||||
}
|
||||
flightVO.add(flightDataDO);
|
||||
}
|
||||
|
||||
if (todayFlightDO.getFlightId().equals("2")){ //筶杯航班信息
|
||||
FlightDataDO flightDataDO = new FlightDataDO();
|
||||
flightDataDO.setName("筶杯航班信息");
|
||||
List<TodayFlightDO> todayFlightDOS1 = todayFlightMapper.byRouteId("3"); //筶杯出岛
|
||||
List<TodayFlightDO> todayFlightDOS2 = todayFlightMapper.byRouteId("4");//鹅头进岛
|
||||
for (int j = 0; j < todayFlightDOS1.size(); j++) {
|
||||
Datas datas = new Datas();
|
||||
datas.setClasses(todayFlightDOS1.get(j).getClasses());
|
||||
datas.setTimeOne(todayFlightDOS1.get(j).getStartTime());
|
||||
if (j <= todayFlightDOS2.size() - 1){
|
||||
datas.setTimeTwo(todayFlightDOS2.get(j).getStartTime());
|
||||
}
|
||||
flightDataDO.getDatas().add(datas);
|
||||
}
|
||||
flightVO.add(flightDataDO);
|
||||
}
|
||||
|
||||
if (todayFlightDO.getFlightId().equals("3")){ //黄瓜航班信息
|
||||
FlightDataDO flightDataDO = new FlightDataDO();
|
||||
flightDataDO.setName("黄瓜航班信息");
|
||||
List<TodayFlightDO> todayFlightDOS1 = todayFlightMapper.byRouteId("5"); //黄瓜出岛
|
||||
List<TodayFlightDO> todayFlightDOS2 = todayFlightMapper.byRouteId("6");//淇泸进岛
|
||||
for (int j = 0; j < todayFlightDOS1.size(); j++) {
|
||||
Datas datas = new Datas();
|
||||
datas.setClasses(todayFlightDOS1.get(j).getClasses());
|
||||
datas.setTimeOne(todayFlightDOS1.get(j).getStartTime());
|
||||
if (j <= todayFlightDOS2.size() - 1){
|
||||
datas.setTimeTwo(todayFlightDOS2.get(j).getStartTime());
|
||||
}
|
||||
flightDataDO.getDatas().add(datas);
|
||||
}
|
||||
flightVO.add(flightDataDO);
|
||||
}
|
||||
|
||||
|
||||
if (todayFlightDO.getFlightId().equals("4")){ //小日
|
||||
FlightDataDO flightDataDO = new FlightDataDO();
|
||||
flightDataDO.setName("小日航班信息");
|
||||
List<TodayFlightDO> todayFlightDOS1 = todayFlightMapper.byRouteId("7"); // 小日出岛
|
||||
List<TodayFlightDO> todayFlightDOS2 = todayFlightMapper.byRouteId("8");//坑口进岛
|
||||
for (int j = 0; j < todayFlightDOS1.size(); j++) {
|
||||
Datas datas = new Datas();
|
||||
datas.setClasses(todayFlightDOS1.get(j).getClasses());
|
||||
datas.setTimeOne(todayFlightDOS1.get(j).getStartTime());
|
||||
if (j <= todayFlightDOS2.size() - 1){
|
||||
datas.setTimeTwo(todayFlightDOS2.get(j).getStartTime());
|
||||
}
|
||||
flightDataDO.getDatas().add(datas);
|
||||
}
|
||||
flightVO.add(flightDataDO);
|
||||
}
|
||||
|
||||
if (todayFlightDO.getFlightId().equals("5")){ //罗盘航班信息
|
||||
FlightDataDO flightDataDO = new FlightDataDO();
|
||||
flightDataDO.setName("罗盘航班信息");
|
||||
List<TodayFlightDO> todayFlightDOS1 = todayFlightMapper.byRouteId("11"); //罗盘出岛
|
||||
List<TodayFlightDO> todayFlightDOS2 = todayFlightMapper.byRouteId("12");//东岱进岛
|
||||
for (int j = 0; j < todayFlightDOS1.size(); j++) {
|
||||
Datas datas = new Datas();
|
||||
datas.setClasses(todayFlightDOS1.get(j).getClasses());
|
||||
datas.setTimeOne(todayFlightDOS1.get(j).getStartTime());
|
||||
if (j <= todayFlightDOS2.size() - 1){
|
||||
datas.setTimeTwo(todayFlightDOS2.get(j).getStartTime());
|
||||
}
|
||||
flightDataDO.getDatas().add(datas);
|
||||
}
|
||||
flightVO.add(flightDataDO);
|
||||
}
|
||||
|
||||
if (todayFlightDO.getFlightId().equals("6")){ //鳌屿航班信息
|
||||
FlightDataDO flightDataDO = new FlightDataDO();
|
||||
flightDataDO.setName("鳌屿航班信息");
|
||||
List<TodayFlightDO> todayFlightDOS1 = todayFlightMapper.byRouteId("9"); //鳌屿出岛
|
||||
List<TodayFlightDO> todayFlightDOS2 = todayFlightMapper.byRouteId("10");//东岱进岛
|
||||
for (int j = 0; j < todayFlightDOS1.size(); j++) {
|
||||
Datas datas = new Datas();
|
||||
datas.setClasses(todayFlightDOS1.get(j).getClasses());
|
||||
datas.setTimeOne(todayFlightDOS1.get(j).getStartTime());
|
||||
if (j <= todayFlightDOS2.size() - 1){
|
||||
datas.setTimeTwo(todayFlightDOS2.get(j).getStartTime());
|
||||
}
|
||||
flightDataDO.getDatas().add(datas);
|
||||
}
|
||||
flightVO.add(flightDataDO);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return flightVO;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -13,4 +13,4 @@ docker rmi ${app_name}:${app_version}
|
||||
echo '----build image----'
|
||||
docker buildx build -f Dockerfile -t ${app_name}:${app_version} .
|
||||
echo '----start container----'
|
||||
docker run -d -p 48090:48090 --name ${app_name} --memory 600m ${app_name}:${app_version}
|
||||
docker run -d -p 48090:48090 --name ${app_name} --memory 800m ${app_name}:${app_version}
|
@ -1,5 +1,7 @@
|
||||
package cn.iocoder.yudao.module.parking.controller.admin.black;
|
||||
|
||||
import cn.iocoder.yudao.module.parking.util.BlueCarRequestUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@ -42,6 +44,9 @@ public class BlackController {
|
||||
@Resource
|
||||
private BlackService blackService;
|
||||
|
||||
@Resource
|
||||
private BlueCarRequestUtil blueCarRequestUtil;
|
||||
|
||||
|
||||
/**
|
||||
* 删除黑名单
|
||||
@ -61,26 +66,7 @@ public class BlackController {
|
||||
datasList.add(datas);
|
||||
blackVO.setDatas(datasList);
|
||||
//调用蓝卡接口
|
||||
try {
|
||||
String url = "http://蓝卡云 ip:端口/bcopenapi/out/delBlack";
|
||||
URL obj = new URL(url);
|
||||
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
|
||||
// 请求方式
|
||||
con.setRequestMethod("GET");
|
||||
// 获取响应
|
||||
int responseCode = con.getResponseCode();
|
||||
System.out.println("Response Code : " + responseCode);
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
|
||||
String inputLine;
|
||||
StringBuilder response = new StringBuilder();
|
||||
while ((inputLine = in.readLine()) != null) {
|
||||
response.append(inputLine);
|
||||
}
|
||||
in.close();
|
||||
System.out.println(response.toString());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
CommonResult<String> stringCommonResult = blueCarRequestUtil.doBlueCarPost(blackVO, "bcopenapi/out/delBlack");
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@ -101,26 +87,7 @@ public class BlackController {
|
||||
datasList.add(datas);
|
||||
blackVO.setDatas(datasList);
|
||||
//调用蓝卡接口
|
||||
try {
|
||||
String url = " http://蓝卡云 ip:端口/bcopenapi/out/queryBlack";
|
||||
URL obj = new URL(url);
|
||||
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
|
||||
// 请求方式
|
||||
con.setRequestMethod("GET");
|
||||
// 获取响应
|
||||
int responseCode = con.getResponseCode();
|
||||
System.out.println("Response Code : " + responseCode);
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
|
||||
String inputLine;
|
||||
StringBuilder response = new StringBuilder();
|
||||
while ((inputLine = in.readLine()) != null) {
|
||||
response.append(inputLine);
|
||||
}
|
||||
in.close();
|
||||
System.out.println(response.toString());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
blueCarRequestUtil.doBlueCarPost(blackVO,"bcopenapi/out/queryBlack");
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@ -130,39 +97,19 @@ public class BlackController {
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/synBlack")
|
||||
public CommonResult<Boolean> synBlack(BlackDO blackDO) {
|
||||
public CommonResult<Boolean> synBlack(BlackSaveReqVO blackSaveReqVO) {
|
||||
//设置请求参数
|
||||
BlackVO blackVO = new BlackVO();
|
||||
blackVO.setParkNumber(blackDO.getParkNumber());
|
||||
blackVO.setSource(blackDO.getSource());
|
||||
blackVO.setParkNumber(blackSaveReqVO.getParkNumber());
|
||||
blackVO.setSource(blackSaveReqVO.getSource());
|
||||
List<Datas> datasList = new ArrayList<>();
|
||||
Datas datas = new Datas();
|
||||
datas.setPlate(blackDO.getPlate());
|
||||
datas.setMemo(blackDO.getMemo());
|
||||
datas.setPlate(blackSaveReqVO.getPlate());
|
||||
datas.setMemo(blackSaveReqVO.getMemo());
|
||||
datasList.add(datas);
|
||||
blackVO.setDatas(datasList);
|
||||
//调用蓝卡接口
|
||||
try {
|
||||
String url = "http://蓝卡云 ip:端口/bcopenapi/out/synBlack";
|
||||
URL obj = new URL(url);
|
||||
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
|
||||
// 请求方式
|
||||
con.setRequestMethod("GET");
|
||||
// 获取响应
|
||||
int responseCode = con.getResponseCode();
|
||||
System.out.println("Response Code : " + responseCode);
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
|
||||
String inputLine;
|
||||
StringBuilder response = new StringBuilder();
|
||||
while ((inputLine = in.readLine()) != null) {
|
||||
response.append(inputLine);
|
||||
}
|
||||
in.close();
|
||||
System.out.println(response.toString());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
blueCarRequestUtil.doBlueCarPost(blackVO,"bcopenapi/out/synBlack");
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@ -172,6 +119,7 @@ public class BlackController {
|
||||
@Operation(summary = "创建黑名单")
|
||||
@PreAuthorize("@ss.hasPermission('parking:black:create')")
|
||||
public CommonResult<Long> createBlack(@Valid @RequestBody BlackSaveReqVO createReqVO) {
|
||||
CommonResult<Boolean> booleanCommonResult = synBlack(createReqVO);
|
||||
return success(blackService.createBlack(createReqVO));
|
||||
}
|
||||
|
||||
|
@ -52,11 +52,16 @@ public class WhiteController {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增白名单
|
||||
* @param createReqVO
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建白名单管理")
|
||||
@PreAuthorize("@ss.hasPermission('parking:white:create')")
|
||||
public CommonResult<Integer> createWhite(@Valid @RequestBody WhiteSaveReqVO createReqVO) {
|
||||
return success(whiteService.createWhite(createReqVO));
|
||||
public CommonResult<Integer> createWhite(@Valid @RequestBody WhiteAddVO whiteAddVO) {
|
||||
return success(whiteService.createWhite(whiteAddVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
|
@ -0,0 +1,26 @@
|
||||
package cn.iocoder.yudao.module.parking.controller.admin.white.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class WhiteAddVO {
|
||||
private Integer fixedId;
|
||||
private String parkNumber;
|
||||
private Integer size;
|
||||
private String plate;
|
||||
private String chargeType;
|
||||
private String name;
|
||||
private String certificate;
|
||||
private String address;
|
||||
private String phone;
|
||||
private String plateColor;
|
||||
private String start;
|
||||
private String end;
|
||||
private String dept;
|
||||
private String carType;
|
||||
private String memo;
|
||||
private Integer areaId;
|
||||
private String areaStart;
|
||||
private String areaEnd;
|
||||
private String source;
|
||||
}
|
@ -22,7 +22,7 @@ public interface WhiteService {
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Integer createWhite(@Valid WhiteSaveReqVO createReqVO);
|
||||
Integer createWhite(@Valid WhiteAddVO whiteAddVO);
|
||||
|
||||
/**
|
||||
* 更新白名单管理
|
||||
|
@ -6,9 +6,12 @@ import cn.iocoder.yudao.module.parking.dal.dataobject.userinfo.UserInfoDO;
|
||||
import cn.iocoder.yudao.module.parking.dal.mysql.areasandvalidity.AreasAndValidityMapper;
|
||||
import cn.iocoder.yudao.module.parking.dal.mysql.carinfo.CarInfoMapper;
|
||||
import cn.iocoder.yudao.module.parking.dal.mysql.userinfo.UserInfoMapper;
|
||||
import cn.iocoder.yudao.module.parking.util.BlueCarRequestUtil;
|
||||
import cn.iocoder.yudao.module.parking.util.BlueCardResult;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@ -49,15 +52,74 @@ public class WhiteServiceImpl implements WhiteService {
|
||||
@Resource
|
||||
private AreasAndValidityMapper areasAndValidityMapper;
|
||||
|
||||
@Resource
|
||||
private BlueCarRequestUtil blueCarRequestUtil;
|
||||
|
||||
@Override
|
||||
public Integer createWhite(WhiteSaveReqVO createReqVO) {
|
||||
public Integer createWhite(WhiteAddVO whiteAddVO) {
|
||||
// 插入
|
||||
WhiteDO white = BeanUtils.toBean(createReqVO, WhiteDO.class);
|
||||
WhiteDO white = BeanUtils.toBean(whiteAddVO, WhiteDO.class);
|
||||
whiteMapper.insert(white);
|
||||
|
||||
WhiteDO whiteDO = new WhiteDO();
|
||||
whiteDO.setFixedId(whiteAddVO.getFixedId());
|
||||
whiteDO.setParkNumber(whiteAddVO.getParkNumber());
|
||||
whiteDO.setPlate(whiteAddVO.getPlate());
|
||||
whiteDO.setChargeType(whiteAddVO.getChargeType());
|
||||
whiteDO.setCertificate(whiteAddVO.getCertificate());
|
||||
whiteDO.setStart(whiteAddVO.getStart());
|
||||
whiteDO.setEnd(whiteAddVO.getEnd());
|
||||
whiteDO.setDept(whiteAddVO.getDept());
|
||||
whiteDO.setMemo(whiteAddVO.getMemo());
|
||||
whiteDO.setSource(whiteAddVO.getSource());
|
||||
WhiteDO whiteDO1 = whiteMapper.selectOne("fixed_id", whiteAddVO.getFixedId());
|
||||
if (whiteDO1 != null){
|
||||
whiteMapper.updateById(whiteDO);
|
||||
}else {
|
||||
whiteMapper.insert(whiteDO);
|
||||
}
|
||||
|
||||
|
||||
UserInfoDO userInfoDO = new UserInfoDO();
|
||||
userInfoDO.setIdCard(whiteAddVO.getCertificate());
|
||||
userInfoDO.setUserName(whiteAddVO.getName());
|
||||
userInfoDO.setPhone(whiteAddVO.getPhone());
|
||||
userInfoDO.setAddress(whiteAddVO.getAddress());
|
||||
UserInfoDO userInfoDOOne = userInfoMapper.selectOne("id_card", whiteAddVO.getCertificate());
|
||||
if (userInfoDOOne == null){
|
||||
userInfoMapper.insert(userInfoDO);
|
||||
}else {
|
||||
userInfoMapper.updateById(userInfoDO);
|
||||
}
|
||||
|
||||
CarInfoDO carInfoDO = new CarInfoDO();
|
||||
carInfoDO.setPlate(whiteAddVO.getPlate());
|
||||
carInfoDO.setPlateColor(whiteAddVO.getPlateColor());
|
||||
// carInfoDO.setTicketCode(whiteDatasDO.get)
|
||||
carInfoDO.setCarType(whiteAddVO.getCarType());
|
||||
// carInfoDO.setConfidence(whiteDatasDO.ge)
|
||||
CarInfoDO carInfoDO1 = carInfoMapper.selectOne("plate", whiteAddVO.getPlate());
|
||||
if (carInfoDO1 == null){
|
||||
carInfoMapper.insert(carInfoDO);
|
||||
}else {
|
||||
carInfoDO.setId(carInfoDO1.getId());
|
||||
carInfoMapper.updateById(carInfoDO);
|
||||
}
|
||||
|
||||
AreasAndValidityDO areasAndValidityDOs = new AreasAndValidityDO();
|
||||
areasAndValidityDOs.setAreaId(whiteAddVO.getAreaId());
|
||||
areasAndValidityDOs.setStart(whiteAddVO.getStart());
|
||||
areasAndValidityDOs.setEnd(whiteAddVO.getEnd());
|
||||
areasAndValidityDOs.setFixedId(whiteAddVO.getFixedId());
|
||||
areasAndValidityMapper.insert(areasAndValidityDOs);
|
||||
|
||||
|
||||
// 返回
|
||||
blueCarRequestUtil.doBlueCarPost(whiteAddVO,"/bcopenapi/out/synWhite");
|
||||
return white.getFixedId();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void updateWhite(WhiteSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
@ -86,27 +148,7 @@ public class WhiteServiceImpl implements WhiteService {
|
||||
areasAndValidityDOS.add(areasAndValidityDO);
|
||||
whiteDeleteDO.setAreasAndValidity(areasAndValidityDOS);
|
||||
//调用蓝卡接口白名单删除
|
||||
try {
|
||||
String url = "http://蓝卡云 ip:端口/bcopenapi/out/delWhite";
|
||||
URL obj = new URL(url);
|
||||
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
|
||||
// 请求方式
|
||||
con.setRequestMethod("GET");
|
||||
// 获取响应
|
||||
int responseCode = con.getResponseCode();
|
||||
System.out.println("Response Code : " + responseCode);
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
|
||||
String inputLine;
|
||||
StringBuilder response = new StringBuilder();
|
||||
while ((inputLine = in.readLine()) != null) {
|
||||
response.append(inputLine);
|
||||
}
|
||||
in.close();
|
||||
System.out.println(response.toString());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
blueCarRequestUtil.doBlueCarPost(whiteDeleteDO,"bcopenapi/out/delWhite");
|
||||
}
|
||||
|
||||
private void validateWhiteExists(Integer id) {
|
||||
|
@ -12,5 +12,8 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode INFORMATION_NOT_EXISTS = new ErrorCode(1_005_002_001, "旅客信息不存在");
|
||||
ErrorCode ALL_NOT_EXISTS = new ErrorCode(1_005_003_001, "设备登录日志不存在");
|
||||
ErrorCode UM_NOT_EXISTS = new ErrorCode(1_005_004_001, "上行报文不存在");
|
||||
ErrorCode FLIGHT_NOT_EXISTS = new ErrorCode(1_005_005_001, "航班不存在");
|
||||
ErrorCode SHIP_ROUTE_NOT_EXISTS = new ErrorCode(1_005_006_001, "航线不存在");
|
||||
ErrorCode TODAY_FLIGHT_NOT_EXISTS = new ErrorCode(1_005_007_001, "今日航班不存在");
|
||||
|
||||
}
|
||||
|
@ -13,4 +13,4 @@ docker rmi ${app_name}:${app_version}
|
||||
echo '----build image----'
|
||||
docker buildx build -f Dockerfile -t ${app_name}:${app_version} .
|
||||
echo '----start container----'
|
||||
docker run -d -p 48088:48088 --name ${app_name} --memory 600m ${app_name}:${app_version}
|
||||
docker run -d -p 48088:48088 --name ${app_name} --memory 800m ${app_name}:${app_version}
|
@ -0,0 +1,109 @@
|
||||
package cn.iocoder.yudao.module.ticket.controller.admin.flight;
|
||||
|
||||
import cn.iocoder.yudao.module.ticket.dal.dataobject.todayflight.TodayFlightDO;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import cn.iocoder.yudao.module.ticket.controller.admin.flight.vo.*;
|
||||
import cn.iocoder.yudao.module.ticket.dal.dataobject.flight.FlightDO;
|
||||
import cn.iocoder.yudao.module.ticket.service.flight.FlightService;
|
||||
|
||||
@Tag(name = "管理后台 - 航班")
|
||||
@RestController
|
||||
@RequestMapping("/ticket/flight")
|
||||
@Validated
|
||||
public class FlightController {
|
||||
|
||||
@Resource
|
||||
private FlightService flightService;
|
||||
|
||||
/**
|
||||
* 下拉框数据
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/flightNameOption")
|
||||
public CommonResult<List<FlightDO>> flightNameOption(){
|
||||
return success(flightService.flightNameOption());
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建航班")
|
||||
@PreAuthorize("@ss.hasPermission('ticket:flight:create')")
|
||||
public CommonResult<Long> createFlight(@Valid @RequestBody FlightSaveReqVO createReqVO) {
|
||||
return success(flightService.createFlight(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新航班")
|
||||
@PreAuthorize("@ss.hasPermission('ticket:flight:update')")
|
||||
public CommonResult<Boolean> updateFlight(@Valid @RequestBody FlightSaveReqVO updateReqVO) {
|
||||
flightService.updateFlight(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除航班")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('ticket:flight:delete')")
|
||||
public CommonResult<Boolean> deleteFlight(@RequestParam("id") Long id) {
|
||||
flightService.deleteFlight(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得航班")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('ticket:flight:query')")
|
||||
public CommonResult<FlightRespVO> getFlight(@RequestParam("id") Long id) {
|
||||
FlightDO flight = flightService.getFlight(id);
|
||||
return success(BeanUtils.toBean(flight, FlightRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得航班分页")
|
||||
@PreAuthorize("@ss.hasPermission('ticket:flight:query')")
|
||||
public CommonResult<PageResult<FlightRespVO>> getFlightPage(@Valid FlightPageReqVO pageReqVO) {
|
||||
PageResult<FlightDO> pageResult = flightService.getFlightPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, FlightRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出航班 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('ticket:flight:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportFlightExcel(@Valid FlightPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<FlightDO> list = flightService.getFlightPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "航班.xls", "数据", FlightRespVO.class,
|
||||
BeanUtils.toBean(list, FlightRespVO.class));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package cn.iocoder.yudao.module.ticket.controller.admin.flight.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 航班分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class FlightPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "航班名称", example = "芋艿")
|
||||
private String flightName;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package cn.iocoder.yudao.module.ticket.controller.admin.flight.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.util.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 航班 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class FlightRespVO {
|
||||
|
||||
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "26858")
|
||||
@ExcelProperty("id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "航班名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
|
||||
@ExcelProperty("航班名称")
|
||||
private String flightName;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package cn.iocoder.yudao.module.ticket.controller.admin.flight.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 航班新增/修改 Request VO")
|
||||
@Data
|
||||
public class FlightSaveReqVO {
|
||||
|
||||
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "26858")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "航班名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
|
||||
@NotEmpty(message = "航班名称不能为空")
|
||||
private String flightName;
|
||||
|
||||
}
|
@ -0,0 +1,114 @@
|
||||
package cn.iocoder.yudao.module.ticket.controller.admin.shiproute;
|
||||
|
||||
import cn.iocoder.yudao.module.ticket.dal.dataobject.flight.FlightDO;
|
||||
import cn.iocoder.yudao.module.ticket.dal.mysql.flight.FlightMapper;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import cn.iocoder.yudao.module.ticket.controller.admin.shiproute.vo.*;
|
||||
import cn.iocoder.yudao.module.ticket.dal.dataobject.shiproute.ShipRouteDO;
|
||||
import cn.iocoder.yudao.module.ticket.service.shiproute.ShipRouteService;
|
||||
|
||||
@Tag(name = "管理后台 - 航线")
|
||||
@RestController
|
||||
@RequestMapping("/ticket/ship-route")
|
||||
@Validated
|
||||
public class ShipRouteController {
|
||||
|
||||
@Resource
|
||||
private ShipRouteService shipRouteService;
|
||||
|
||||
@Resource
|
||||
private FlightMapper flightMapper;
|
||||
|
||||
/**
|
||||
* 下拉框数据
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/routeNameOption")
|
||||
public CommonResult<List<ShipRouteDO>> routeNameOption(){
|
||||
return success(shipRouteService.routeNameOption());
|
||||
}
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建航线")
|
||||
@PreAuthorize("@ss.hasPermission('ticket:ship-route:create')")
|
||||
public CommonResult<Long> createShipRoute(@Valid @RequestBody ShipRouteSaveReqVO createReqVO) {
|
||||
return success(shipRouteService.createShipRoute(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新航线")
|
||||
@PreAuthorize("@ss.hasPermission('ticket:ship-route:update')")
|
||||
public CommonResult<Boolean> updateShipRoute(@Valid @RequestBody ShipRouteSaveReqVO updateReqVO) {
|
||||
shipRouteService.updateShipRoute(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除航线")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('ticket:ship-route:delete')")
|
||||
public CommonResult<Boolean> deleteShipRoute(@RequestParam("id") Long id) {
|
||||
shipRouteService.deleteShipRoute(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得航线")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('ticket:ship-route:query')")
|
||||
public CommonResult<ShipRouteRespVO> getShipRoute(@RequestParam("id") Long id) {
|
||||
ShipRouteDO shipRoute = shipRouteService.getShipRoute(id);
|
||||
return success(BeanUtils.toBean(shipRoute, ShipRouteRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得航线分页")
|
||||
@PreAuthorize("@ss.hasPermission('ticket:ship-route:query')")
|
||||
public CommonResult<PageResult<ShipRouteRespVO>> getShipRoutePage(@Valid ShipRoutePageReqVO pageReqVO) {
|
||||
PageResult<ShipRouteDO> pageResult = shipRouteService.getShipRoutePage(pageReqVO);
|
||||
for (int i = 0; i < pageResult.getList().size(); i++) {
|
||||
ShipRouteDO shipRouteDO = pageResult.getList().get(i);
|
||||
FlightDO flightDO = flightMapper.selectOne("id", shipRouteDO.getFlightId());
|
||||
shipRouteDO.setFlightName(flightDO.getFlightName());
|
||||
}
|
||||
return success(BeanUtils.toBean(pageResult, ShipRouteRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出航线 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('ticket:ship-route:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportShipRouteExcel(@Valid ShipRoutePageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<ShipRouteDO> list = shipRouteService.getShipRoutePage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "航线.xls", "数据", ShipRouteRespVO.class,
|
||||
BeanUtils.toBean(list, ShipRouteRespVO.class));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package cn.iocoder.yudao.module.ticket.controller.admin.shiproute.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 航线分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class ShipRoutePageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "航班", example = "4836")
|
||||
private Long flightId;
|
||||
|
||||
@Schema(description = "航线名称", example = "王五")
|
||||
private String routeName;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package cn.iocoder.yudao.module.ticket.controller.admin.shiproute.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.util.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 航线 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class ShipRouteRespVO {
|
||||
|
||||
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "19757")
|
||||
@ExcelProperty("id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "航班", example = "4836")
|
||||
@ExcelProperty("航班")
|
||||
private Long flightId;
|
||||
|
||||
@Schema(description = "航线名称", example = "王五")
|
||||
@ExcelProperty("航线名称")
|
||||
private String routeName;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@ExcelProperty("航班")
|
||||
private String flightName;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package cn.iocoder.yudao.module.ticket.controller.admin.shiproute.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 航线新增/修改 Request VO")
|
||||
@Data
|
||||
public class ShipRouteSaveReqVO {
|
||||
|
||||
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "19757")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "航班", example = "4836")
|
||||
private Long flightId;
|
||||
|
||||
@Schema(description = "航线名称", example = "王五")
|
||||
private String routeName;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,107 @@
|
||||
package cn.iocoder.yudao.module.ticket.controller.admin.todayflight;
|
||||
|
||||
import cn.iocoder.yudao.module.ticket.dal.dataobject.shiproute.ShipRouteDO;
|
||||
import cn.iocoder.yudao.module.ticket.dal.mysql.shiproute.ShipRouteMapper;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import cn.iocoder.yudao.module.ticket.controller.admin.todayflight.vo.*;
|
||||
import cn.iocoder.yudao.module.ticket.dal.dataobject.todayflight.TodayFlightDO;
|
||||
import cn.iocoder.yudao.module.ticket.service.todayflight.TodayFlightService;
|
||||
|
||||
@Tag(name = "管理后台 - 今日航班")
|
||||
@RestController
|
||||
@RequestMapping("/ticket/today-flight")
|
||||
@Validated
|
||||
public class TodayFlightController {
|
||||
|
||||
@Resource
|
||||
private TodayFlightService todayFlightService;
|
||||
|
||||
@Resource
|
||||
private ShipRouteMapper shipRouteMapper;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建今日航班")
|
||||
@PreAuthorize("@ss.hasPermission('ticket:today-flight:create')")
|
||||
public CommonResult<Long> createTodayFlight(@Valid @RequestBody TodayFlightSaveReqVO createReqVO) {
|
||||
return success(todayFlightService.createTodayFlight(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新今日航班")
|
||||
@PreAuthorize("@ss.hasPermission('ticket:today-flight:update')")
|
||||
public CommonResult<Boolean> updateTodayFlight(@Valid @RequestBody TodayFlightSaveReqVO updateReqVO) {
|
||||
todayFlightService.updateTodayFlight(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除今日航班")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('ticket:today-flight:delete')")
|
||||
public CommonResult<Boolean> deleteTodayFlight(@RequestParam("id") Long id) {
|
||||
todayFlightService.deleteTodayFlight(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得今日航班")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('ticket:today-flight:query')")
|
||||
public CommonResult<TodayFlightRespVO> getTodayFlight(@RequestParam("id") Long id) {
|
||||
TodayFlightDO todayFlight = todayFlightService.getTodayFlight(id);
|
||||
return success(BeanUtils.toBean(todayFlight, TodayFlightRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得今日航班分页")
|
||||
@PreAuthorize("@ss.hasPermission('ticket:today-flight:query')")
|
||||
public CommonResult<PageResult<TodayFlightRespVO>> getTodayFlightPage(@Valid TodayFlightPageReqVO pageReqVO) {
|
||||
PageResult<TodayFlightDO> pageResult = todayFlightService.getTodayFlightPage(pageReqVO);
|
||||
for (int i = 0; i < pageResult.getList().size(); i++) {
|
||||
TodayFlightDO todayFlightDO = pageResult.getList().get(i);
|
||||
ShipRouteDO shipRouteDO = shipRouteMapper.selectOne("id", todayFlightDO.getShipRouteId());
|
||||
todayFlightDO.setShipRouteName(shipRouteDO.getRouteName());
|
||||
}
|
||||
return success(BeanUtils.toBean(pageResult, TodayFlightRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出今日航班 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('ticket:today-flight:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportTodayFlightExcel(@Valid TodayFlightPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<TodayFlightDO> list = todayFlightService.getTodayFlightPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "今日航班.xls", "数据", TodayFlightRespVO.class,
|
||||
BeanUtils.toBean(list, TodayFlightRespVO.class));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package cn.iocoder.yudao.module.ticket.controller.admin.todayflight.vo;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalTime;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 今日航班分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class TodayFlightPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "航线", example = "19067")
|
||||
private Long shipRouteId;
|
||||
|
||||
@Schema(description = "班次")
|
||||
private String classes;
|
||||
|
||||
@Schema(description = "开始时间")
|
||||
private String startTime;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package cn.iocoder.yudao.module.ticket.controller.admin.todayflight.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalTime;
|
||||
import java.util.*;
|
||||
import java.util.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 今日航班 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class TodayFlightRespVO {
|
||||
|
||||
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "12418")
|
||||
@ExcelProperty("id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "航线", example = "19067")
|
||||
@ExcelProperty("航线")
|
||||
private Long shipRouteId;
|
||||
|
||||
@Schema(description = "班次")
|
||||
@ExcelProperty("班次")
|
||||
private String classes;
|
||||
|
||||
@Schema(description = "开始时间")
|
||||
@ExcelProperty("开始时间")
|
||||
private String startTime;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "航线")
|
||||
@ExcelProperty("航线")
|
||||
private String shipRouteName;
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package cn.iocoder.yudao.module.ticket.controller.admin.todayflight.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalTime;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 今日航班新增/修改 Request VO")
|
||||
@Data
|
||||
public class TodayFlightSaveReqVO {
|
||||
|
||||
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "12418")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "航线", example = "19067")
|
||||
private Long shipRouteId;
|
||||
|
||||
@Schema(description = "班次")
|
||||
private String classes;
|
||||
|
||||
@Schema(description = "开始时间")
|
||||
private String startTime;
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package cn.iocoder.yudao.module.ticket.dal.dataobject.flight;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 航班 DO
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@TableName("flight")
|
||||
@KeySequence("flight_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class FlightDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 航班名称
|
||||
*/
|
||||
private String flightName;
|
||||
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package cn.iocoder.yudao.module.ticket.dal.dataobject.shiproute;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 航线 DO
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@TableName("ship_route")
|
||||
@KeySequence("ship_route_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ShipRouteDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 航班
|
||||
*/
|
||||
private Long flightId;
|
||||
/**
|
||||
* 航线名称
|
||||
*/
|
||||
private String routeName;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String flightName;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
package cn.iocoder.yudao.module.ticket.dal.dataobject.todayflight;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.sql.Time;
|
||||
import java.time.LocalTime;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 今日航班 DO
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@TableName("today_flight")
|
||||
@KeySequence("today_flight_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class TodayFlightDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 航线
|
||||
*/
|
||||
private Long shipRouteId;
|
||||
/**
|
||||
* 班次
|
||||
*/
|
||||
private String classes;
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
private String startTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String shipRouteName;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String routeName;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String flightName;
|
||||
|
||||
@TableField
|
||||
private String flightId;
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package cn.iocoder.yudao.module.ticket.dal.mysql.flight;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.ticket.dal.dataobject.flight.FlightDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.ticket.controller.admin.flight.vo.*;
|
||||
|
||||
/**
|
||||
* 航班 Mapper
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Mapper
|
||||
public interface FlightMapper extends BaseMapperX<FlightDO> {
|
||||
|
||||
default PageResult<FlightDO> selectPage(FlightPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<FlightDO>()
|
||||
.likeIfPresent(FlightDO::getFlightName, reqVO.getFlightName())
|
||||
.betweenIfPresent(FlightDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(FlightDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package cn.iocoder.yudao.module.ticket.dal.mysql.shiproute;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.ticket.dal.dataobject.shiproute.ShipRouteDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.ticket.controller.admin.shiproute.vo.*;
|
||||
|
||||
/**
|
||||
* 航线 Mapper
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Mapper
|
||||
public interface ShipRouteMapper extends BaseMapperX<ShipRouteDO> {
|
||||
|
||||
default PageResult<ShipRouteDO> selectPage(ShipRoutePageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<ShipRouteDO>()
|
||||
.eqIfPresent(ShipRouteDO::getFlightId, reqVO.getFlightId())
|
||||
.likeIfPresent(ShipRouteDO::getRouteName, reqVO.getRouteName())
|
||||
.betweenIfPresent(ShipRouteDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(ShipRouteDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package cn.iocoder.yudao.module.ticket.dal.mysql.todayflight;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.ticket.dal.dataobject.todayflight.TodayFlightDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.ticket.controller.admin.todayflight.vo.*;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
/**
|
||||
* 今日航班 Mapper
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Mapper
|
||||
public interface TodayFlightMapper extends BaseMapperX<TodayFlightDO> {
|
||||
|
||||
default PageResult<TodayFlightDO> selectPage(TodayFlightPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<TodayFlightDO>()
|
||||
.eqIfPresent(TodayFlightDO::getShipRouteId, reqVO.getShipRouteId())
|
||||
.eqIfPresent(TodayFlightDO::getClasses, reqVO.getClasses())
|
||||
// .betweenIfPresent(TodayFlightDO::getFlightDate, reqVO.getFlightDate())
|
||||
// .betweenIfPresent(TodayFlightDO::getStartTime, reqVO.getStartTime())
|
||||
.betweenIfPresent(TodayFlightDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(TodayFlightDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package cn.iocoder.yudao.module.ticket.service.flight;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.module.ticket.controller.admin.flight.vo.*;
|
||||
import cn.iocoder.yudao.module.ticket.dal.dataobject.flight.FlightDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
/**
|
||||
* 航班 Service 接口
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
public interface FlightService {
|
||||
|
||||
/**
|
||||
* 创建航班
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createFlight(@Valid FlightSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新航班
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateFlight(@Valid FlightSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除航班
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteFlight(Long id);
|
||||
|
||||
/**
|
||||
* 获得航班
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 航班
|
||||
*/
|
||||
FlightDO getFlight(Long id);
|
||||
|
||||
/**
|
||||
* 获得航班分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 航班分页
|
||||
*/
|
||||
PageResult<FlightDO> getFlightPage(FlightPageReqVO pageReqVO);
|
||||
|
||||
List<FlightDO> flightNameOption();
|
||||
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
package cn.iocoder.yudao.module.ticket.service.flight;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.module.ticket.controller.admin.flight.vo.*;
|
||||
import cn.iocoder.yudao.module.ticket.dal.dataobject.flight.FlightDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
import cn.iocoder.yudao.module.ticket.dal.mysql.flight.FlightMapper;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.ticket.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 航班 Service 实现类
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class FlightServiceImpl implements FlightService {
|
||||
|
||||
@Resource
|
||||
private FlightMapper flightMapper;
|
||||
|
||||
@Override
|
||||
public Long createFlight(FlightSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
FlightDO flight = BeanUtils.toBean(createReqVO, FlightDO.class);
|
||||
flightMapper.insert(flight);
|
||||
// 返回
|
||||
return flight.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateFlight(FlightSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateFlightExists(updateReqVO.getId());
|
||||
// 更新
|
||||
FlightDO updateObj = BeanUtils.toBean(updateReqVO, FlightDO.class);
|
||||
flightMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteFlight(Long id) {
|
||||
// 校验存在
|
||||
validateFlightExists(id);
|
||||
// 删除
|
||||
flightMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateFlightExists(Long id) {
|
||||
if (flightMapper.selectById(id) == null) {
|
||||
throw exception(FLIGHT_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlightDO getFlight(Long id) {
|
||||
return flightMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<FlightDO> getFlightPage(FlightPageReqVO pageReqVO) {
|
||||
return flightMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FlightDO> flightNameOption() {
|
||||
return flightMapper.selectList();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package cn.iocoder.yudao.module.ticket.service.shiproute;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.module.ticket.controller.admin.shiproute.vo.*;
|
||||
import cn.iocoder.yudao.module.ticket.dal.dataobject.shiproute.ShipRouteDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
/**
|
||||
* 航线 Service 接口
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
public interface ShipRouteService {
|
||||
|
||||
/**
|
||||
* 创建航线
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createShipRoute(@Valid ShipRouteSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新航线
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateShipRoute(@Valid ShipRouteSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除航线
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteShipRoute(Long id);
|
||||
|
||||
/**
|
||||
* 获得航线
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 航线
|
||||
*/
|
||||
ShipRouteDO getShipRoute(Long id);
|
||||
|
||||
/**
|
||||
* 获得航线分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 航线分页
|
||||
*/
|
||||
PageResult<ShipRouteDO> getShipRoutePage(ShipRoutePageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 下拉框数据
|
||||
*/
|
||||
List<ShipRouteDO> routeNameOption();
|
||||
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
package cn.iocoder.yudao.module.ticket.service.shiproute;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.module.ticket.controller.admin.shiproute.vo.*;
|
||||
import cn.iocoder.yudao.module.ticket.dal.dataobject.shiproute.ShipRouteDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
import cn.iocoder.yudao.module.ticket.dal.mysql.shiproute.ShipRouteMapper;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.ticket.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 航线 Service 实现类
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class ShipRouteServiceImpl implements ShipRouteService {
|
||||
|
||||
@Resource
|
||||
private ShipRouteMapper shipRouteMapper;
|
||||
|
||||
@Override
|
||||
public Long createShipRoute(ShipRouteSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
ShipRouteDO shipRoute = BeanUtils.toBean(createReqVO, ShipRouteDO.class);
|
||||
shipRouteMapper.insert(shipRoute);
|
||||
// 返回
|
||||
return shipRoute.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateShipRoute(ShipRouteSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateShipRouteExists(updateReqVO.getId());
|
||||
// 更新
|
||||
ShipRouteDO updateObj = BeanUtils.toBean(updateReqVO, ShipRouteDO.class);
|
||||
shipRouteMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteShipRoute(Long id) {
|
||||
// 校验存在
|
||||
validateShipRouteExists(id);
|
||||
// 删除
|
||||
shipRouteMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateShipRouteExists(Long id) {
|
||||
if (shipRouteMapper.selectById(id) == null) {
|
||||
throw exception(SHIP_ROUTE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ShipRouteDO getShipRoute(Long id) {
|
||||
return shipRouteMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<ShipRouteDO> getShipRoutePage(ShipRoutePageReqVO pageReqVO) {
|
||||
return shipRouteMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ShipRouteDO> routeNameOption() {
|
||||
return shipRouteMapper.selectList();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
package cn.iocoder.yudao.module.ticket.service.todayflight;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.ticket.controller.admin.todayflight.vo.*;
|
||||
import cn.iocoder.yudao.module.ticket.dal.dataobject.todayflight.TodayFlightDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
/**
|
||||
* 今日航班 Service 接口
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
public interface TodayFlightService {
|
||||
|
||||
/**
|
||||
* 创建今日航班
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createTodayFlight(@Valid TodayFlightSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新今日航班
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateTodayFlight(@Valid TodayFlightSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除今日航班
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteTodayFlight(Long id);
|
||||
|
||||
/**
|
||||
* 获得今日航班
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 今日航班
|
||||
*/
|
||||
TodayFlightDO getTodayFlight(Long id);
|
||||
|
||||
/**
|
||||
* 获得今日航班分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 今日航班分页
|
||||
*/
|
||||
PageResult<TodayFlightDO> getTodayFlightPage(TodayFlightPageReqVO pageReqVO);
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
package cn.iocoder.yudao.module.ticket.service.todayflight;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.module.ticket.controller.admin.todayflight.vo.*;
|
||||
import cn.iocoder.yudao.module.ticket.dal.dataobject.todayflight.TodayFlightDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
import cn.iocoder.yudao.module.ticket.dal.mysql.todayflight.TodayFlightMapper;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.ticket.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 今日航班 Service 实现类
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class TodayFlightServiceImpl implements TodayFlightService {
|
||||
|
||||
@Resource
|
||||
private TodayFlightMapper todayFlightMapper;
|
||||
|
||||
@Override
|
||||
public Long createTodayFlight(TodayFlightSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
TodayFlightDO todayFlight = BeanUtils.toBean(createReqVO, TodayFlightDO.class);
|
||||
todayFlightMapper.insert(todayFlight);
|
||||
// 返回
|
||||
return todayFlight.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTodayFlight(TodayFlightSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateTodayFlightExists(updateReqVO.getId());
|
||||
// 更新
|
||||
TodayFlightDO updateObj = BeanUtils.toBean(updateReqVO, TodayFlightDO.class);
|
||||
todayFlightMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteTodayFlight(Long id) {
|
||||
// 校验存在
|
||||
validateTodayFlightExists(id);
|
||||
// 删除
|
||||
todayFlightMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateTodayFlightExists(Long id) {
|
||||
if (todayFlightMapper.selectById(id) == null) {
|
||||
throw exception(TODAY_FLIGHT_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TodayFlightDO getTodayFlight(Long id) {
|
||||
return todayFlightMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<TodayFlightDO> getTodayFlightPage(TodayFlightPageReqVO pageReqVO) {
|
||||
return todayFlightMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
27
pom.xml
27
pom.xml
@ -128,18 +128,29 @@
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<!-- 使用 huawei / aliyun 的 Maven 源,提升下载速度 -->
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>huaweicloud</id>
|
||||
<name>huawei</name>
|
||||
<url>https://mirrors.huaweicloud.com/repository/maven/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>aliyunmaven</id>
|
||||
<name>aliyun</name>
|
||||
<id>public</id>
|
||||
<name>aliyun nexus</name>
|
||||
<url>https://maven.aliyun.com/repository/public</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>public</id>
|
||||
<name>aliyun nexus</name>
|
||||
<url>https://maven.aliyun.com/repository/public</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
|
||||
</project>
|
||||
|
@ -1,68 +1,82 @@
|
||||
version: '3'
|
||||
version: '3.8'
|
||||
services:
|
||||
yudao-gateway:
|
||||
image: yudao-gateway
|
||||
image: 120.46.37.243:8080/lundu/yudao-gateway:1.0.0
|
||||
container_name: yudao-gateway
|
||||
networks:
|
||||
- ludu_network
|
||||
environment:
|
||||
- TZ=Asia/Shanghai # 配置程序默认时区为上海(中国标准时间)
|
||||
- JAVA_TOOL_OPTIONS=-javaagent:/data/skywalking/skywalking-agent/skywalking-agent.jar # 配置skywalking
|
||||
- SW_AGENT_NAME=yudao-gateway
|
||||
- SW_AGENT_TRACE_IGNORE_PATH=Redisson/PING,/actuator/**,/admin/**
|
||||
- SW_AGENT_COLLECTOR_BACKEND_SERVICES=[YOUR_SKYWALKING_ADDR] # 请替换 your.skywalking.addr 为你的 skywalking 地址
|
||||
- SPRING_PROFILES_ACTIVE=test # 指定程序运行环境
|
||||
- SPRING_CLOUD_NACOS_CONFIG_SERVER_ADDR=[YOUR_NACOS_ADDR] # 配置中心地址
|
||||
- SPRING_CLOUD_NACOS_CONFIG_NAMESPACE=[YOUR_NAMESPACE] # 命名空间
|
||||
- SPRING_CLOUD_NACOS_SERVER_ADDR=[YOUR_NACOS_ADDR] # 注册中心地址
|
||||
- SPRING_CLOUD_NACOS_DISCOVERY_NAMESPACE=[YOUR_NAMESPACE] # 命名空间
|
||||
volumes:
|
||||
- /docker/yudao-cloud/logs:/root/logs/
|
||||
- /data/skywalking/skywalking-agent:/data/skywalking/skywalking-agent
|
||||
restart: always
|
||||
network_mode: host # 以主机网络环境运行
|
||||
healthcheck:
|
||||
test: [ "CMD","curl","-f","http://localhost:48080" ]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 5
|
||||
start_period: 60s
|
||||
ports:
|
||||
- "48083:48080"
|
||||
yudao-system:
|
||||
image: yudao-module-system-biz
|
||||
image: 120.46.37.243:8080/lundu/yudao-module-system:1.0.0
|
||||
container_name: yudao-system
|
||||
networks:
|
||||
- ludu_network
|
||||
environment:
|
||||
- TZ=Asia/Shanghai # 配置程序默认时区为上海(中国标准时间)
|
||||
- JAVA_TOOL_OPTIONS=-javaagent:/data/skywalking/skywalking-agent/skywalking-agent.jar # 配置skywalking
|
||||
- SW_AGENT_NAME=yudao-gateway
|
||||
- SW_AGENT_TRACE_IGNORE_PATH=Redisson/PING,/actuator/**,/admin/**
|
||||
- SW_AGENT_COLLECTOR_BACKEND_SERVICES=[YOUR_SKYWALKING_ADDR] # 请替换 your.skywalking.addr 为你的 skywalking 地址
|
||||
- SPRING_PROFILES_ACTIVE=test # 指定程序运行环境
|
||||
- SPRING_CLOUD_NACOS_CONFIG_SERVER_ADDR=[YOUR_NACOS_ADDR] # 配置中心地址
|
||||
- SPRING_CLOUD_NACOS_CONFIG_NAMESPACE=[YOUR_NAMESPACE] # 命名空间
|
||||
- SPRING_CLOUD_NACOS_SERVER_ADDR=[YOUR_NACOS_ADDR] # 注册中心地址
|
||||
- SPRING_CLOUD_NACOS_DISCOVERY_NAMESPACE=[YOUR_NAMESPACE] # 命名空间
|
||||
volumes:
|
||||
- /docker/yudao-cloud/logs:/root/logs/
|
||||
- /data/skywalking/skywalking-agent:/data/skywalking/skywalking-agent
|
||||
healthcheck:
|
||||
test: [ "CMD","curl","-f","http://localhost:48081" ]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 5
|
||||
start_period: 60s
|
||||
start_period: 120s
|
||||
restart: always
|
||||
network_mode: host
|
||||
yudao-infra:
|
||||
image: yudao-module-infra-biz
|
||||
container_name: yudao-infra
|
||||
depends_on:
|
||||
yudao-gateway:
|
||||
condition: service_healthy
|
||||
ludu-job-admin:
|
||||
image: 120.46.37.243:8080/lundu/ludu-job-admin:1.0.0
|
||||
container_name: ludu-job-admin
|
||||
networks:
|
||||
- ludu_network
|
||||
environment:
|
||||
- TZ=Asia/Shanghai # 配置程序默认时区为上海(中国标准时间)
|
||||
- SW_AGENT_NAME=yudao-gateway
|
||||
- SW_AGENT_TRACE_IGNORE_PATH=Redisson/PING,/actuator/**,/admin/**
|
||||
volumes:
|
||||
- /docker/yudao-cloud/logs:/root/logs/
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "curl -f http://localhost:9090 || exit 0"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 5
|
||||
start_period: 60s
|
||||
restart: always
|
||||
ports:
|
||||
- "48084:9090"
|
||||
depends_on:
|
||||
yudao-gateway:
|
||||
condition: service_healthy
|
||||
|
||||
yudao-infra:
|
||||
image: 120.46.37.243:8080/lundu/yudao-module-infra:1.0.0
|
||||
container_name: yudao-infra
|
||||
networks:
|
||||
- ludu_network
|
||||
environment:
|
||||
- TZ=Asia/Shanghai # 配置程序默认时区为上海(中国标准时间)
|
||||
- JAVA_TOOL_OPTIONS=-javaagent:/data/skywalking/skywalking-agent/skywalking-agent.jar # 配置skywalking
|
||||
- SW_AGENT_NAME=yudao-gateway
|
||||
- SW_AGENT_TRACE_IGNORE_PATH=Redisson/PING,/actuator/**,/admin/**
|
||||
- SW_AGENT_COLLECTOR_BACKEND_SERVICES=[YOUR_SKYWALKING_ADDR] # 请替换 your.skywalking.addr 为你的 skywalking 地址
|
||||
- SPRING_PROFILES_ACTIVE=test # 指定程序运行环境
|
||||
- SPRING_CLOUD_NACOS_CONFIG_SERVER_ADDR=[YOUR_NACOS_ADDR] # 配置中心地址
|
||||
- SPRING_CLOUD_NACOS_CONFIG_NAMESPACE=[YOUR_NAMESPACE] # 命名空间
|
||||
- SPRING_CLOUD_NACOS_SERVER_ADDR=[YOUR_NACOS_ADDR] # 注册中心地址
|
||||
- SPRING_CLOUD_NACOS_DISCOVERY_NAMESPACE=[YOUR_NAMESPACE] # 命名空间
|
||||
volumes:
|
||||
- /docker/yudao-cloud/logs:/root/logs/
|
||||
- /data/skywalking/skywalking-agent:/data/skywalking/skywalking-agent
|
||||
restart: always
|
||||
network_mode: host
|
||||
healthcheck:
|
||||
test: [ "CMD","curl","-f","http://localhost:48082" ]
|
||||
interval: 30s
|
||||
@ -72,91 +86,75 @@ services:
|
||||
depends_on:
|
||||
yudao-system:
|
||||
condition: service_healthy
|
||||
yudao-report:
|
||||
image: yudao-module-report-biz
|
||||
container_name: yudao-report
|
||||
yudao-gateway:
|
||||
condition: service_healthy
|
||||
ludu-datacenter:
|
||||
image: 120.46.37.243:8080/lundu/ludu-module-datacenter:1.0.0
|
||||
container_name: ludu-datacenter
|
||||
networks:
|
||||
- ludu_network
|
||||
environment:
|
||||
- TZ=Asia/Shanghai # 配置程序默认时区为上海(中国标准时间)
|
||||
- JAVA_TOOL_OPTIONS=-javaagent:/data/skywalking/skywalking-agent/skywalking-agent.jar # 配置skywalking
|
||||
- SW_AGENT_NAME=yudao-gateway
|
||||
- SW_AGENT_TRACE_IGNORE_PATH=Redisson/PING,/actuator/**,/admin/**
|
||||
- SW_AGENT_COLLECTOR_BACKEND_SERVICES=[YOUR_SKYWALKING_ADDR] # 请替换 your.skywalking.addr 为你的 skywalking 地址
|
||||
- SPRING_PROFILES_ACTIVE=test # 指定程序运行环境
|
||||
- SPRING_CLOUD_NACOS_CONFIG_SERVER_ADDR=[YOUR_NACOS_ADDR] # 配置中心地址
|
||||
- SPRING_CLOUD_NACOS_CONFIG_NAMESPACE=[YOUR_NAMESPACE] # 命名空间
|
||||
- SPRING_CLOUD_NACOS_SERVER_ADDR=[YOUR_NACOS_ADDR] # 注册中心地址
|
||||
- SPRING_CLOUD_NACOS_DISCOVERY_NAMESPACE=[YOUR_NAMESPACE] # 命名空间
|
||||
volumes:
|
||||
- /docker/yudao-cloud/logs:/root/logs/
|
||||
- /data/skywalking/skywalking-agent:/data/skywalking/skywalking-agent
|
||||
restart: always
|
||||
network_mode: host
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "curl -f http://localhost:48092 || exit 0"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 5
|
||||
start_period: 60s
|
||||
depends_on:
|
||||
yudao-infra:
|
||||
yudao-gateway:
|
||||
condition: service_healthy
|
||||
yudao-bpm:
|
||||
image: yudao-module-bpm-biz
|
||||
container_name: yudao-bpm
|
||||
ludu-parking:
|
||||
image: 120.46.37.243:8080/lundu/ludu-module-parking:1.0.0
|
||||
container_name: ludu-parking
|
||||
networks:
|
||||
- ludu_network
|
||||
environment:
|
||||
- TZ=Asia/Shanghai # 配置程序默认时区为上海(中国标准时间)
|
||||
- JAVA_TOOL_OPTIONS=-javaagent:/data/skywalking/skywalking-agent/skywalking-agent.jar # 配置skywalking
|
||||
- SW_AGENT_NAME=yudao-gateway
|
||||
- SW_AGENT_TRACE_IGNORE_PATH=Redisson/PING,/actuator/**,/admin/**
|
||||
- SW_AGENT_COLLECTOR_BACKEND_SERVICES=[YOUR_SKYWALKING_ADDR] # 请替换 your.skywalking.addr 为你的 skywalking 地址
|
||||
- SPRING_PROFILES_ACTIVE=test # 指定程序运行环境
|
||||
- SPRING_CLOUD_NACOS_CONFIG_SERVER_ADDR=[YOUR_NACOS_ADDR] # 配置中心地址
|
||||
- SPRING_CLOUD_NACOS_CONFIG_NAMESPACE=[YOUR_NAMESPACE] # 命名空间
|
||||
- SPRING_CLOUD_NACOS_SERVER_ADDR=[YOUR_NACOS_ADDR] # 注册中心地址
|
||||
- SPRING_CLOUD_NACOS_DISCOVERY_NAMESPACE=[YOUR_NAMESPACE] # 命名空间
|
||||
volumes:
|
||||
- /docker/yudao-cloud/logs:/root/logs/
|
||||
- /data/skywalking/skywalking-agent:/data/skywalking/skywalking-agent
|
||||
restart: always
|
||||
network_mode: host
|
||||
healthcheck:
|
||||
test: [ "CMD","curl","-f","http://localhost:48090" ]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 5
|
||||
start_period: 60s
|
||||
depends_on:
|
||||
yudao-infra:
|
||||
yudao-system:
|
||||
condition: service_healthy
|
||||
yudao-pay:
|
||||
image: yudao-module-pay-biz
|
||||
container_name: yudao-pay
|
||||
yudao-gateway:
|
||||
condition: service_healthy
|
||||
ludu-ticketing:
|
||||
image: 120.46.37.243:8080/lundu/ludu-module-ticketing:1.0.0
|
||||
container_name: ludu-ticketing
|
||||
networks:
|
||||
- ludu_network
|
||||
environment:
|
||||
- TZ=Asia/Shanghai # 配置程序默认时区为上海(中国标准时间)
|
||||
- JAVA_TOOL_OPTIONS=-javaagent:/data/skywalking/skywalking-agent/skywalking-agent.jar # 配置skywalking
|
||||
- SW_AGENT_NAME=yudao-gateway
|
||||
- SW_AGENT_TRACE_IGNORE_PATH=Redisson/PING,/actuator/**,/admin/**
|
||||
- SW_AGENT_COLLECTOR_BACKEND_SERVICES=[YOUR_SKYWALKING_ADDR] # 请替换 your.skywalking.addr 为你的 skywalking 地址
|
||||
- SPRING_PROFILES_ACTIVE=test # 指定程序运行环境
|
||||
- SPRING_CLOUD_NACOS_CONFIG_SERVER_ADDR=[YOUR_NACOS_ADDR] # 配置中心地址
|
||||
- SPRING_CLOUD_NACOS_CONFIG_NAMESPACE=[YOUR_NAMESPACE] # 命名空间
|
||||
- SPRING_CLOUD_NACOS_SERVER_ADDR=[YOUR_NACOS_ADDR] # 注册中心地址
|
||||
- SPRING_CLOUD_NACOS_DISCOVERY_NAMESPACE=[YOUR_NAMESPACE] # 命名空间
|
||||
volumes:
|
||||
- /docker/yudao-cloud/logs:/root/logs/
|
||||
- /data/skywalking/skywalking-agent:/data/skywalking/skywalking-agent
|
||||
restart: always
|
||||
network_mode: host
|
||||
healthcheck:
|
||||
test: [ "CMD","curl","-f","http://localhost:48088" ]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 5
|
||||
start_period: 60s
|
||||
depends_on:
|
||||
yudao-infra:
|
||||
yudao-system:
|
||||
condition: service_healthy
|
||||
yudao-mp:
|
||||
image: yudao-module-mp-biz
|
||||
container_name: yudao-mp
|
||||
environment:
|
||||
- TZ=Asia/Shanghai # 配置程序默认时区为上海(中国标准时间)
|
||||
- JAVA_TOOL_OPTIONS=-javaagent:/data/skywalking/skywalking-agent/skywalking-agent.jar # 配置skywalking
|
||||
- SW_AGENT_NAME=yudao-gateway
|
||||
- SW_AGENT_TRACE_IGNORE_PATH=Redisson/PING,/actuator/**,/admin/**
|
||||
- SW_AGENT_COLLECTOR_BACKEND_SERVICES=[YOUR_SKYWALKING_ADDR] # 请替换 your.skywalking.addr 为你的 skywalking 地址
|
||||
- SPRING_PROFILES_ACTIVE=test # 指定程序运行环境
|
||||
- SPRING_CLOUD_NACOS_CONFIG_SERVER_ADDR=[YOUR_NACOS_ADDR] # 配置中心地址
|
||||
- SPRING_CLOUD_NACOS_CONFIG_NAMESPACE=[YOUR_NAMESPACE] # 命名空间
|
||||
- SPRING_CLOUD_NACOS_SERVER_ADDR=[YOUR_NACOS_ADDR] # 注册中心地址
|
||||
- SPRING_CLOUD_NACOS_DISCOVERY_NAMESPACE=[YOUR_NAMESPACE] # 命名空间
|
||||
volumes:
|
||||
- /docker/yudao-cloud/logs:/root/logs/
|
||||
- /data/skywalking/skywalking-agent:/data/skywalking/skywalking-agent
|
||||
restart: always
|
||||
network_mode: host
|
||||
depends_on:
|
||||
yudao-infra:
|
||||
yudao-gateway:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
ludu_network:
|
||||
driver: bridge
|
||||
|
93
script/docker/start_service.sh
Normal file
93
script/docker/start_service.sh
Normal file
@ -0,0 +1,93 @@
|
||||
#!/bin/bash
|
||||
cd /ludu
|
||||
# 定义要检查的服务和 URL
|
||||
declare -A services=(
|
||||
["mysql"]="http://101.43.112.107:3306"
|
||||
["mongo"]="http://101.43.112.107:27017"
|
||||
#["redis"]="http://101.43.112.107:6379"
|
||||
["nacos"]="http://101.43.112.107/nacos/#"
|
||||
)
|
||||
|
||||
# 检查服务是否可达
|
||||
check_services() {
|
||||
for service in "${!services[@]}"; do
|
||||
url="${services[$service]}"
|
||||
if ! curl --silent --fail "$url"; then
|
||||
echo "Error: $service is not available at $url."
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
# 从命令行参数获取服务类型
|
||||
SERVICE_TYPE=$1
|
||||
|
||||
# 检查服务类型是否提供
|
||||
if [ -z "$SERVICE_TYPE" ]; then
|
||||
echo "Usage: $0 <service_type>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 检查端口是否全部可达
|
||||
if check_services; then
|
||||
# 根据服务类型启动不同的服务
|
||||
case $SERVICE_TYPE in
|
||||
"gateway")
|
||||
docker-compose stop yudao-gateway
|
||||
docker-compose rm yudao-gateway
|
||||
docker-compose pull yudao-gateway
|
||||
docker-compose up -d yudao-gateway
|
||||
;;
|
||||
"system")
|
||||
docker-compose stop yudao-system
|
||||
docker-compose rm yudao-system
|
||||
docker-compose pull yudao-system
|
||||
docker-compose up -d yudao-system
|
||||
;;
|
||||
"job")
|
||||
docker-compose stop ludu-job-admin
|
||||
docker-compose rm ludu-job-admin
|
||||
docker-compose pull ludu-job-admin
|
||||
docker-compose up -d ludu-job-admin
|
||||
;;
|
||||
"infra")
|
||||
docker-compose stop yudao-infra
|
||||
docker-compose rm yudao-infra
|
||||
docker-compose pull yudao-infra
|
||||
docker-compose up -d yudao-infra
|
||||
;;
|
||||
"datacenter")
|
||||
docker-compose stop ludu-datacenter
|
||||
docker-compose rm ludu-datacenter
|
||||
docker-compose pull ludu-datacenter
|
||||
docker-compose up -d ludu-datacenter
|
||||
;;
|
||||
"parking")
|
||||
docker-compose stop ludu-parking
|
||||
docker-compose rm ludu-parking
|
||||
docker-compose pull ludu-parking
|
||||
docker-compose up -d ludu-parking
|
||||
;;
|
||||
"ticketing")
|
||||
docker-compose stop ludu-ticketing
|
||||
docker-compose rm ludu-ticketing
|
||||
docker-compose pull ludu-ticketing
|
||||
docker-compose up -d ludu-ticketing
|
||||
;;
|
||||
"all")
|
||||
docker-compose down
|
||||
docker-compose pull
|
||||
docker-compose up -d
|
||||
;;
|
||||
*)
|
||||
echo "Invalid service type."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "Started service: $SERVICE_TYPE"
|
||||
else
|
||||
echo "One or more required services are not available. Please check the dependencies."
|
||||
fi
|
||||
|
302
settings.xml
Normal file
302
settings.xml
Normal file
@ -0,0 +1,302 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
<!--
|
||||
| This is the configuration file for Maven. It can be specified at two levels:
|
||||
|
|
||||
| 1. User Level. This settings.xml file provides configuration for a single user,
|
||||
| and is normally provided in ${user.home}/.m2/settings.xml.
|
||||
|
|
||||
| NOTE: This location can be overridden with the CLI option:
|
||||
|
|
||||
| -s /path/to/user/settings.xml
|
||||
|
|
||||
| 2. Global Level. This settings.xml file provides configuration for all Maven
|
||||
| users on a machine (assuming they're all using the same Maven
|
||||
| installation). It's normally provided in
|
||||
| ${maven.conf}/settings.xml.
|
||||
|
|
||||
| NOTE: This location can be overridden with the CLI option:
|
||||
|
|
||||
| -gs /path/to/global/settings.xml
|
||||
|
|
||||
| The sections in this sample file are intended to give you a running start at
|
||||
| getting the most out of your Maven installation. Where appropriate, the default
|
||||
| values (values used when the setting is not specified) are provided.
|
||||
|
|
||||
|-->
|
||||
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
|
||||
<!-- localRepository
|
||||
| The path to the local repository maven will use to store artifacts.
|
||||
|
|
||||
| Default: ${user.home}/.m2/repository
|
||||
<localRepository>/path/to/local/repo</localRepository>
|
||||
-->
|
||||
<localRepository>D:\Maven\apache-maven-3.5.2\repository</localRepository>
|
||||
<!-- interactiveMode
|
||||
| This will determine whether maven prompts you when it needs input. If set to false,
|
||||
| maven will use a sensible default value, perhaps based on some other setting, for
|
||||
| the parameter in question.
|
||||
|
|
||||
| Default: true
|
||||
<interactiveMode>true</interactiveMode>
|
||||
-->
|
||||
|
||||
<!-- offline
|
||||
| Determines whether maven should attempt to connect to the network when executing a build.
|
||||
| This will have an effect on artifact downloads, artifact deployment, and others.
|
||||
|
|
||||
| Default: false
|
||||
<offline>false</offline>
|
||||
-->
|
||||
|
||||
<!-- pluginGroups
|
||||
| This is a list of additional group identifiers that will be searched when resolving plugins by their prefix, i.e.
|
||||
| when invoking a command line like "mvn prefix:goal". Maven will automatically add the group identifiers
|
||||
| "org.apache.maven.plugins" and "org.codehaus.mojo" if these are not already contained in the list.
|
||||
|-->
|
||||
<pluginGroups>
|
||||
<!-- pluginGroup
|
||||
| Specifies a further group identifier to use for plugin lookup.
|
||||
<pluginGroup>com.your.plugins</pluginGroup>
|
||||
-->
|
||||
</pluginGroups>
|
||||
|
||||
<!-- proxies
|
||||
| This is a list of proxies which can be used on this machine to connect to the network.
|
||||
| Unless otherwise specified (by system property or command-line switch), the first proxy
|
||||
| specification in this list marked as active will be used.
|
||||
|-->
|
||||
<proxies>
|
||||
<!-- proxy
|
||||
| Specification for one proxy, to be used in connecting to the network.
|
||||
|
|
||||
<proxy>
|
||||
<id>optional</id>
|
||||
<active>true</active>
|
||||
<protocol>http</protocol>
|
||||
<username>proxyuser</username>
|
||||
<password>proxypass</password>
|
||||
<host>proxy.host.net</host>
|
||||
<port>80</port>
|
||||
<nonProxyHosts>local.net|some.host.com</nonProxyHosts>
|
||||
</proxy>
|
||||
-->
|
||||
</proxies>
|
||||
|
||||
<!-- servers
|
||||
| This is a list of authentication profiles, keyed by the server-id used within the system.
|
||||
| Authentication profiles can be used whenever maven must make a connection to a remote server.
|
||||
|-->
|
||||
<servers>
|
||||
<!-- server
|
||||
| Specifies the authentication information to use when connecting to a particular server, identified by
|
||||
| a unique name within the system (referred to by the 'id' attribute below).
|
||||
|
|
||||
| NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are
|
||||
| used together.
|
||||
|
|
||||
<server>
|
||||
<id>deploymentRepo</id>
|
||||
<username>repouser</username>
|
||||
<password>repopwd</password>
|
||||
</server>
|
||||
-->
|
||||
|
||||
<!-- Another sample, using keys to authenticate.
|
||||
<server>
|
||||
<id>siteServer</id>
|
||||
<privateKey>/path/to/private/key</privateKey>
|
||||
<passphrase>optional; leave empty if not used.</passphrase>
|
||||
</server>
|
||||
-->
|
||||
</servers>
|
||||
|
||||
<!-- mirrors
|
||||
| This is a list of mirrors to be used in downloading artifacts from remote repositories.
|
||||
|
|
||||
| It works like this: a POM may declare a repository to use in resolving certain artifacts.
|
||||
| However, this repository may have problems with heavy traffic at times, so people have mirrored
|
||||
| it to several places.
|
||||
|
|
||||
| That repository definition will have a unique id, so we can create a mirror reference for that
|
||||
| repository, to be used as an alternate download site. The mirror site will be the preferred
|
||||
| server for that repository.
|
||||
|-->
|
||||
<mirrors>
|
||||
<!-- mirror
|
||||
| Specifies a repository mirror site to use instead of a given repository. The repository that
|
||||
| this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
|
||||
| for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
|
||||
|
|
||||
<mirror>
|
||||
<id>mirrorId</id>
|
||||
<mirrorOf>repositoryId</mirrorOf>
|
||||
<name>Human Readable Name for this Mirror.</name>
|
||||
<url>http://my.repository.com/repo/path</url>
|
||||
</mirror>
|
||||
-->
|
||||
<!-- <mirror>
|
||||
<id>alimaven</id>
|
||||
<mirrorOf>central</mirrorOf>
|
||||
<name>aliyun maven</name>
|
||||
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
|
||||
</mirror> -->
|
||||
<mirror>
|
||||
<id>alimaven</id>
|
||||
<name>aliyun maven</name>
|
||||
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
|
||||
<mirrorOf>central</mirrorOf>
|
||||
</mirror>
|
||||
<mirror>
|
||||
<id>alimaven</id>
|
||||
<mirrorOf>central</mirrorOf>
|
||||
<name>aliyun maven</name>
|
||||
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
|
||||
</mirror>
|
||||
<mirror>
|
||||
<id>repo2</id>
|
||||
<mirrorOf>central</mirrorOf>
|
||||
<name>Human Readable Name for this Mirror.</name>
|
||||
<url>http://repo2.maven.org/maven2/</url>
|
||||
</mirror>
|
||||
<mirror>
|
||||
<id>maven-default-http-blocker</id>
|
||||
<mirrorOf>external:http:*</mirrorOf>
|
||||
<name>Pseudo repository to mirror external repositories initially using HTTP.</name>
|
||||
<url>http://0.0.0.0/</url>
|
||||
<!-- <blocked>true</blocked> -->
|
||||
</mirror>
|
||||
</mirrors>
|
||||
|
||||
<!-- profiles
|
||||
| This is a list of profiles which can be activated in a variety of ways, and which can modify
|
||||
| the build process. Profiles provided in the settings.xml are intended to provide local machine-
|
||||
| specific paths and repository locations which allow the build to work in the local environment.
|
||||
|
|
||||
| For example, if you have an integration testing plugin - like cactus - that needs to know where
|
||||
| your Tomcat instance is installed, you can provide a variable here such that the variable is
|
||||
| dereferenced during the build process to configure the cactus plugin.
|
||||
|
|
||||
| As noted above, profiles can be activated in a variety of ways. One way - the activeProfiles
|
||||
| section of this document (settings.xml) - will be discussed later. Another way essentially
|
||||
| relies on the detection of a system property, either matching a particular value for the property,
|
||||
| or merely testing its existence. Profiles can also be activated by JDK version prefix, where a
|
||||
| value of '1.4' might activate a profile when the build is executed on a JDK version of '1.4.2_07'.
|
||||
| Finally, the list of active profiles can be specified directly from the command line.
|
||||
|
|
||||
| NOTE: For profiles defined in the settings.xml, you are restricted to specifying only artifact
|
||||
| repositories, plugin repositories, and free-form properties to be used as configuration
|
||||
| variables for plugins in the POM.
|
||||
|
|
||||
|-->
|
||||
<profiles>
|
||||
<!-- 设置默认JDK版本 -->
|
||||
<!--<profile>
|
||||
<id>jdk1.8</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
<jdk>1.8</jdk>
|
||||
</activation>
|
||||
<properties>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
|
||||
<encoding>UTF-8</encoding>
|
||||
</properties>
|
||||
</profile> -->
|
||||
<!-- profile
|
||||
| Specifies a set of introductions to the build process, to be activated using one or more of the
|
||||
| mechanisms described above. For inheritance purposes, and to activate profiles via <activatedProfiles/>
|
||||
| or the command line, profiles have to have an ID that is unique.
|
||||
|
|
||||
| An encouraged best practice for profile identification is to use a consistent naming convention
|
||||
| for profiles, such as 'env-dev', 'env-test', 'env-production', 'user-jdcasey', 'user-brett', etc.
|
||||
| This will make it more intuitive to understand what the set of introduced profiles is attempting
|
||||
| to accomplish, particularly when you only have a list of profile id's for debug.
|
||||
|
|
||||
| This profile example uses the JDK version to trigger activation, and provides a JDK-specific repo.
|
||||
<profile>
|
||||
<id>jdk-1.4</id>
|
||||
|
||||
<activation>
|
||||
<jdk>1.4</jdk>
|
||||
</activation>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>jdk14</id>
|
||||
<name>Repository for JDK 1.4 builds</name>
|
||||
<url>http://www.myhost.com/maven/jdk14</url>
|
||||
<layout>default</layout>
|
||||
<snapshotPolicy>always</snapshotPolicy>
|
||||
</repository>
|
||||
</repositories>
|
||||
</profile>
|
||||
-->
|
||||
|
||||
<!--
|
||||
| Here is another profile, activated by the system property 'target-env' with a value of 'dev',
|
||||
| which provides a specific path to the Tomcat instance. To use this, your plugin configuration
|
||||
| might hypothetically look like:
|
||||
|
|
||||
| ...
|
||||
| <plugin>
|
||||
| <groupId>org.myco.myplugins</groupId>
|
||||
| <artifactId>myplugin</artifactId>
|
||||
|
|
||||
| <configuration>
|
||||
| <tomcatLocation>${tomcatPath}</tomcatLocation>
|
||||
| </configuration>
|
||||
| </plugin>
|
||||
| ...
|
||||
|
|
||||
| NOTE: If you just wanted to inject this configuration whenever someone set 'target-env' to
|
||||
| anything, you could just leave off the <value/> inside the activation-property.
|
||||
|
|
||||
<profile>
|
||||
<id>env-dev</id>
|
||||
|
||||
<activation>
|
||||
<property>
|
||||
<name>target-env</name>
|
||||
<value>dev</value>
|
||||
</property>
|
||||
</activation>
|
||||
|
||||
<properties>
|
||||
<tomcatPath>/path/to/tomcat/instance</tomcatPath>
|
||||
</properties>
|
||||
</profile>
|
||||
-->
|
||||
</profiles>
|
||||
|
||||
<!-- activeProfiles
|
||||
| List of profiles that are active for all builds.
|
||||
|
|
||||
<activeProfiles>
|
||||
<activeProfile>alwaysActiveProfile</activeProfile>
|
||||
<activeProfile>anotherAlwaysActiveProfile</activeProfile>
|
||||
</activeProfiles>
|
||||
-->
|
||||
</settings>
|
@ -13,4 +13,4 @@ docker rmi ${app_name}:${app_version}
|
||||
echo '----build image----'
|
||||
docker buildx build -f Dockerfile -t ${app_name}:${app_version} .
|
||||
echo '----start container----'
|
||||
docker run -d -p 48082:48082 --name ${app_name} --memory 700m ${app_name}:${app_version}
|
||||
docker run -d -p 48082:48082 --name ${app_name} ${app_name}:${app_version}
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.infra.clients;
|
||||
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
@ -17,4 +18,49 @@ public interface LargeScreenClient {
|
||||
|
||||
@GetMapping("/api/checkticket")
|
||||
Object checkTicketTotal(@RequestParam("starTime") String starTime, @RequestParam("endTime") String endTime);
|
||||
|
||||
@GetMapping("/api/checkticket/qushi")
|
||||
Object findByTimeTemp(@RequestParam("starTime") String starTime, @RequestParam("endTime") String endTime);
|
||||
|
||||
@GetMapping("/api/saledata/thisyear")
|
||||
Object thisYearNum(@RequestParam("starTime") String starTime, @RequestParam("endTime") String endTime);
|
||||
|
||||
@GetMapping("/api/saledata/lastyear")
|
||||
Object lastYearNum(@RequestParam("starTime") String starTime, @RequestParam("endTime") String endTime);
|
||||
|
||||
@GetMapping("/api/saledata/gender")
|
||||
Object findByGender(@RequestParam("starTime") String starTime, @RequestParam("endTime") String endTime);
|
||||
|
||||
@GetMapping("/api/saledata/age")
|
||||
Object findByage(@RequestParam("starTime") String starTime, @RequestParam("endTime") String endTime);
|
||||
|
||||
@GetMapping("/api/saledata/lastyear/region")
|
||||
Object lastYearFindByRegion(@RequestParam("starTime") String starTime, @RequestParam("endTime") String endTime);
|
||||
|
||||
@GetMapping("/api/saledata/thisyear/region")
|
||||
Object thisYearFindByRegion(@RequestParam("starTime") String starTime, @RequestParam("endTime") String endTime);
|
||||
|
||||
@GetMapping("/api/saledata/salemethod")
|
||||
Object findBySaleMethod(@RequestParam("starTime") String starTime, @RequestParam("endTime") String endTime);
|
||||
|
||||
@GetMapping("/api/saledata/itemType")
|
||||
Object findByItemType(@RequestParam("starTime") String starTime, @RequestParam("endTime") String endTime);
|
||||
|
||||
// @GetMapping("/api/saledata/gender")
|
||||
// Object findByWuYi(@RequestParam("starTime") String starTime, @RequestParam("endTime") String endTime);
|
||||
//
|
||||
// @GetMapping("/api/saledata/gender")
|
||||
// Object findByGuoQing(@RequestParam("starTime") String starTime, @RequestParam("endTime") String endTime);
|
||||
//
|
||||
// @GetMapping("/api/saledata/rijunthisyear/{startTime}")
|
||||
// Object findThisYearRiJun(@PathVariable("startTime") String startTime);
|
||||
//
|
||||
// @GetMapping("/api/saledata/rijunlastyear/{startTime}")
|
||||
// Object findLastYearRiJun(@PathVariable("startTime") String startTime);
|
||||
|
||||
@GetMapping("/api/saledata/thisyear/nianjun")
|
||||
Object findMoneyThisYear();
|
||||
|
||||
@GetMapping("/api/saledata/lastyear/nianjun")
|
||||
Object findMoneyLastYear();
|
||||
}
|
||||
|
@ -12,7 +12,6 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
@ -41,42 +40,50 @@ public class TicketingController {
|
||||
private LargeScreenClient largeScreenClient;
|
||||
|
||||
@GetMapping
|
||||
public CommonResult<String> testTicketing(@RequestParam("startDate") String startDate, @RequestParam("endDate")String endDate, @RequestParam("method") String method) throws Exception {
|
||||
public CommonResult<String> testTicketing(@RequestParam("startDate") String startDate, @RequestParam("endDate") String endDate, @RequestParam("method") String method) throws Exception {
|
||||
Calendar startCalendar = Calendar.getInstance();
|
||||
Calendar endCalendar = Calendar.getInstance();
|
||||
startCalendar.setTime(TickingDateUtils.parse(startDate));
|
||||
endCalendar.setTime(TickingDateUtils.parse(endDate));
|
||||
return CommonResult.success(ticketDataMigration.getTicketDataByTimeZonesToMongo(startCalendar, endCalendar, method));
|
||||
}
|
||||
@GetMapping("/test1")
|
||||
public CommonResult<List<String>> testAll(){
|
||||
return CommonResult.success(checkTicketService.deleteTwoYearLastMonthAgo());
|
||||
|
||||
@GetMapping("/2")
|
||||
public CommonResult<String> testTicketing2(@RequestParam("method") String method) throws Exception {
|
||||
Calendar startCalendar = Calendar.getInstance();
|
||||
startCalendar.add(Calendar.DAY_OF_MONTH, 1);
|
||||
startCalendar.add(Calendar.YEAR, -1);
|
||||
return CommonResult.success(ticketDataMigration.getTicketDataByTimeZonesToMongo(startCalendar, startCalendar, method));
|
||||
}
|
||||
|
||||
private void methodUtils(Map<String, Object> map, String name, Object list){
|
||||
map.put(name,list);
|
||||
@GetMapping("/intoMysql")
|
||||
public CommonResult<String> testTicketingMysql(@RequestParam("startDate") String startDate, @RequestParam("endDate") String endDate, @RequestParam("method") String method) throws Exception {
|
||||
return CommonResult.success("");
|
||||
}
|
||||
private String methodDataUtils(){
|
||||
|
||||
private void methodUtils(Map<String, Object> map, String name, Object list) {
|
||||
map.put(name, list);
|
||||
}
|
||||
|
||||
private String methodDataUtils() {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
return now.format(formatter);
|
||||
}
|
||||
|
||||
@GetMapping("/test")
|
||||
public void test(){
|
||||
public void test() {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
String dataUtils = this.methodDataUtils();
|
||||
this.methodUtils(map, "assetCount", largeScreenClient.assetMethod1());
|
||||
this.methodUtils(map,"saleDataTotal",largeScreenClient.saleDataTotal(dataUtils,dataUtils));
|
||||
this.methodUtils(map,"checkTicketTotal",largeScreenClient.checkTicketTotal(dataUtils,dataUtils));
|
||||
webSocketSenderApi.sendObject(2,1L,"1",map);
|
||||
this.methodUtils(map, "saleDataTotal", largeScreenClient.saleDataTotal(dataUtils, dataUtils));
|
||||
this.methodUtils(map, "checkTicketTotal", largeScreenClient.checkTicketTotal(dataUtils, dataUtils));
|
||||
webSocketSenderApi.sendObject(2, 1L, "1", map);
|
||||
}
|
||||
|
||||
@GetMapping("/testa")
|
||||
public CommonResult<List<String>> testAlla(){
|
||||
public CommonResult<List<String>> testAlla() {
|
||||
return CommonResult.success(saleDataService.deleteTwoYearLastMonthAgo());
|
||||
}
|
||||
@GetMapping("/testSample")
|
||||
public void testSample(){
|
||||
ticketDataMigration.deleteTwoYearOneMonthAgoAndUpdateLastYearTomorrow();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import cn.iocoder.yudao.module.infra.dal.dataobject.db.DataSourceConfigDO;
|
||||
import cn.iocoder.yudao.module.infra.enums.codegen.CodegenFrontTypeEnum;
|
||||
import cn.iocoder.yudao.module.infra.enums.codegen.CodegenSceneEnum;
|
||||
import cn.iocoder.yudao.module.infra.enums.codegen.CodegenTemplateTypeEnum;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
@ -28,7 +29,7 @@ public class CodegenTableDO extends BaseDO {
|
||||
/**
|
||||
* ID 编号
|
||||
*/
|
||||
@TableId
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
|
@ -7,6 +7,7 @@ import cn.iocoder.yudao.module.infra.controller.checkticket.vo.CheckTicketPageRe
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.checkticket.CheckTicketDO;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 检票 Mapper
|
||||
@ -32,4 +33,10 @@ public interface CheckTicketMapper extends BaseMapperX<CheckTicketDO> {
|
||||
.orderByDesc(CheckTicketDO::getId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据检票日期物理删除数据
|
||||
* @param checkticketdate
|
||||
* @return java.lang.Integer
|
||||
*/
|
||||
Integer physicalDeleteByCheckticketdate(@Param("checkticketdate") String checkticketdate);
|
||||
}
|
@ -6,10 +6,7 @@ import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.infra.controller.saledata.vo.SaleDataPageReqVO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.saledata.SaleDataDO;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Result;
|
||||
import org.apache.ibatis.annotations.Results;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -43,4 +40,11 @@ public interface SaleDataMapper extends BaseMapperX<SaleDataDO> {
|
||||
.likeIfPresent(SaleDataDO::getSalepropetyvaluename, reqVO.getSalepropetyvaluename())
|
||||
.orderByDesc(SaleDataDO::getId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据销售日期物理删除
|
||||
* @param sddate
|
||||
* @return java.lang.Integer
|
||||
*/
|
||||
Integer physicalDeleteBySddate(@Param("sddate") String sddate);
|
||||
}
|
@ -40,6 +40,17 @@ public class LargeScreenHeartbeat {
|
||||
this.methodUtils(map, "assetCount", largeScreenClient.assetMethod1());
|
||||
this.methodUtils(map,"saleDataTotal",largeScreenClient.saleDataTotal(dataUtils,dataUtils));
|
||||
this.methodUtils(map,"checkTicketTotal",largeScreenClient.checkTicketTotal(dataUtils,dataUtils));
|
||||
this.methodUtils(map,"findByTimeTemp",largeScreenClient.findByTimeTemp(dataUtils,dataUtils));
|
||||
this.methodUtils(map,"thisYearNum",largeScreenClient.thisYearNum(dataUtils,dataUtils));
|
||||
this.methodUtils(map,"lastYearNum",largeScreenClient.lastYearNum(dataUtils,dataUtils));
|
||||
this.methodUtils(map,"findByGender",largeScreenClient.findByGender(dataUtils,dataUtils));
|
||||
this.methodUtils(map,"findByage",largeScreenClient.findByage(dataUtils,dataUtils));
|
||||
this.methodUtils(map,"lastYearFindByRegion",largeScreenClient.lastYearFindByRegion(dataUtils,dataUtils));
|
||||
this.methodUtils(map,"thisYearFindByRegion",largeScreenClient.thisYearFindByRegion(dataUtils,dataUtils));
|
||||
this.methodUtils(map,"findBySaleMethod",largeScreenClient.findBySaleMethod(dataUtils,dataUtils));
|
||||
this.methodUtils(map,"findByItemType",largeScreenClient.findByItemType(dataUtils,dataUtils));
|
||||
this.methodUtils(map,"findMoneyThisYear",largeScreenClient.findMoneyThisYear());
|
||||
this.methodUtils(map,"findMoneyLastYear",largeScreenClient.findMoneyLastYear());
|
||||
webSocketSenderApi.sendObject(2,1L,"1",map);
|
||||
}
|
||||
|
||||
|
@ -59,274 +59,119 @@ public class TicketDataMigration {
|
||||
* 存入售票数据的定时任务mysql
|
||||
*/
|
||||
@XxlJob("getSaleData")
|
||||
public void getSaleDataHandler() throws Exception {
|
||||
public String getSaleDataHandler() throws Exception {
|
||||
int failedCount = 0;
|
||||
int pageNumber = 1;
|
||||
XxlJobHelper.log("抽数服务:mysql销售数据开始抽数...");
|
||||
StringJoiner result = new StringJoiner("\n");
|
||||
XxlJobHelper.log("抽数服务:mysql售票数据开始抽数...");
|
||||
result.add("抽数服务:mysql售票数据开始抽数...");
|
||||
TicketingSamplingRespVO ticketingSamplingRespVO = this.getUrlResponseData(SALE_DATA_SERVICE, SALE_DATA_METHOD, TickingDateUtils.getPreviousDayFormat(), pageNumber);
|
||||
if (ticketingSamplingRespVO == null) {
|
||||
XxlJobHelper.log("暂无数据!");
|
||||
return;
|
||||
XxlJobHelper.log("日期:{}暂无数据!", TickingDateUtils.getPreviousDayFormat());
|
||||
result.add("日期:" + TickingDateUtils.getPreviousDayFormat() + "暂无数据!");
|
||||
return result.toString();
|
||||
}
|
||||
int totalRows = ticketingSamplingRespVO.getTotalRows();
|
||||
List<Map<String, Object>> mapList = ticketingSamplingRespVO.getDataMapList();
|
||||
// 总条数小于等于每页条数 则直接按照总条数进行插入即可
|
||||
if (totalRows <= PAGE_SIZE) {
|
||||
failedCount += insertSaleData(mapList, totalRows, pageNumber);
|
||||
} else {
|
||||
// 总条数大于每页条数 执行完第一次插入后根据返回的页数继续进行请求和插入
|
||||
// 插入第一页的数据
|
||||
failedCount += insertSaleData(mapList, PAGE_SIZE, pageNumber);
|
||||
pageNumber++;
|
||||
// 获得总页数
|
||||
int totalPages = ticketingSamplingRespVO.getTotalPages();
|
||||
// 处理剩余页的数据
|
||||
for (; pageNumber <= totalPages; pageNumber++) {
|
||||
ticketingSamplingRespVO = this.getUrlResponseData(SALE_DATA_SERVICE, SALE_DATA_METHOD, TickingDateUtils.getPreviousDayFormat(), pageNumber);
|
||||
|
||||
mapList = ticketingSamplingRespVO.getDataMapList();
|
||||
// 对最后一页进行处理,得到最后一页的实际条数
|
||||
if (pageNumber != totalPages) {
|
||||
failedCount += insertSaleData(mapList, PAGE_SIZE, pageNumber);
|
||||
} else {
|
||||
failedCount += insertSaleData(mapList, totalRows % PAGE_SIZE, pageNumber);
|
||||
}
|
||||
List<Map<String, Object>> mapList;
|
||||
// 获得总页数
|
||||
int totalPages = ticketingSamplingRespVO.getTotalPages();
|
||||
// 处理剩余页的数据
|
||||
for (; pageNumber <= totalPages; pageNumber++) {
|
||||
ticketingSamplingRespVO = this.getUrlResponseData(SALE_DATA_SERVICE, SALE_DATA_METHOD, TickingDateUtils.getPreviousDayFormat(), pageNumber);
|
||||
mapList = ticketingSamplingRespVO.getDataMapList();
|
||||
// 对最后一页进行处理,得到最后一页的实际条数
|
||||
if (!saleDataService.createSaleData(BeanUtils.toBean(mapList, SaleDataDO.class))) {
|
||||
failedCount += ticketingSamplingRespVO.getPageSize();
|
||||
}
|
||||
|
||||
}
|
||||
if (failedCount != 0) {
|
||||
XxlJobHelper.handleFail("总共:" + totalRows + "条数据," + failedCount + "条数据插入失败!即将重试......");
|
||||
result.add("总共:" + totalRows + "条数据," + failedCount + "条数据插入失败!即将重试......");
|
||||
return result.toString();
|
||||
}
|
||||
if (!saleDataService.dataValidation(TickingDateUtils.getPreviousDayFormat())) {
|
||||
XxlJobHelper.log("mysql和mongo数据验证不一致!!!");
|
||||
XxlJobHelper.log("重新抽取({})mongo数据", TickingDateUtils.getPreviousDayFormat());
|
||||
getSaleDataByMongoDBHandler();
|
||||
XxlJobHelper.log("抽数完,比对结果:{}", saleDataService.dataValidation(TickingDateUtils.getPreviousDayFormat()) ? "相等" : "不想等");
|
||||
XxlJobHelper.log("mysql和mongo数据验证不一致!!!重新进行mongo抽数中......");
|
||||
result.add("mysql和mongo数据验证不一致!!!重新进行mongo抽数中......");
|
||||
Calendar yesterday = Calendar.getInstance();
|
||||
yesterday.add(Calendar.DAY_OF_MONTH, -1);
|
||||
getTicketDataByTimeZonesToMongo(yesterday, yesterday, "saleData");
|
||||
if (!saleDataService.dataValidation(TickingDateUtils.getPreviousDayFormat())) {
|
||||
XxlJobHelper.handleFail("日期:" + TickingDateUtils.getPreviousDayFormat() + "中mongo和mysql售票数据不一致!!!");
|
||||
result.add("日期:" + TickingDateUtils.getPreviousDayFormat() + "中mongo和mysql售票数据不一致!!!");
|
||||
}
|
||||
}
|
||||
XxlJobHelper.log("抽数服务:销售数据抽数正常结束!总共:{}条数据,{}条数据插入失败!", totalRows, failedCount);
|
||||
XxlJobHelper.log("抽数服务:售票数据抽数正常结束!总共:{}条数据,{}条数据插入失败!", totalRows, failedCount);
|
||||
result.add("抽数服务:售票数据抽数正常结束!总共:" + totalRows + "条数据," + failedCount + "条数据插入失败!");
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 存入检票数据的定时任务mysql
|
||||
*/
|
||||
@XxlJob("getCheckTicket")
|
||||
public void getCheckTicketHandler() throws Exception {
|
||||
public String getCheckTicketHandler() throws Exception {
|
||||
int failedCount = 0;
|
||||
int pageNumber = 1;
|
||||
StringJoiner result = new StringJoiner("\n");
|
||||
result.add("抽数服务:mysql检票数据开始抽数...");
|
||||
XxlJobHelper.log("抽数服务:mysql检票数据开始抽数...");
|
||||
TicketingSamplingRespVO ticketingSamplingRespVO = this.getUrlResponseData(CHECK_TICKET_SERVICE, CHECK_TICKET_METHOD, TickingDateUtils.getPreviousDayFormat(), pageNumber);
|
||||
if (ticketingSamplingRespVO == null) {
|
||||
XxlJobHelper.log("暂无数据!");
|
||||
return;
|
||||
XxlJobHelper.log("日期:{}暂无数据!", TickingDateUtils.getPreviousDayFormat());
|
||||
result.add("日期:" + TickingDateUtils.getPreviousDayFormat() + "暂无数据!");
|
||||
return result.toString();
|
||||
}
|
||||
int totalRows = ticketingSamplingRespVO.getTotalRows();
|
||||
List<Map<String, Object>> mapList = ticketingSamplingRespVO.getDataMapList();
|
||||
// 总条数小于等于每页条数 则直接按照总条数进行插入即可
|
||||
if (totalRows <= PAGE_SIZE) {
|
||||
failedCount += insertCheckTicket(mapList, totalRows, pageNumber);
|
||||
} else {
|
||||
// 总条数大于每页条数 执行完第一次插入后根据返回的页数继续进行请求和插入
|
||||
// 插入第一页的数据
|
||||
failedCount += insertCheckTicket(mapList, PAGE_SIZE, pageNumber);
|
||||
pageNumber++;
|
||||
// 获得总页数
|
||||
int totalPages = ticketingSamplingRespVO.getTotalPages();
|
||||
// 处理剩余页的数据
|
||||
for (; pageNumber <= totalPages; pageNumber++) {
|
||||
ticketingSamplingRespVO = this.getUrlResponseData(CHECK_TICKET_SERVICE, CHECK_TICKET_METHOD, TickingDateUtils.getPreviousDayFormat(), pageNumber);
|
||||
mapList = ticketingSamplingRespVO.getDataMapList();
|
||||
// 对最后一页进行处理,得到最后一页的实际条数
|
||||
if (pageNumber != totalPages) {
|
||||
failedCount += insertCheckTicket(mapList, PAGE_SIZE, pageNumber);
|
||||
} else {
|
||||
failedCount += insertCheckTicket(mapList, totalRows % PAGE_SIZE, pageNumber);
|
||||
}
|
||||
List<Map<String, Object>> mapList;
|
||||
// 获得总页数
|
||||
int totalPages = ticketingSamplingRespVO.getTotalPages();
|
||||
// 处理剩余页的数据
|
||||
for (; pageNumber <= totalPages; pageNumber++) {
|
||||
ticketingSamplingRespVO = this.getUrlResponseData(CHECK_TICKET_SERVICE, CHECK_TICKET_METHOD, TickingDateUtils.getPreviousDayFormat(), pageNumber);
|
||||
mapList = ticketingSamplingRespVO.getDataMapList();
|
||||
if (!checkTicketService.createCheckTicket(BeanUtils.toBean(mapList, CheckTicketDO.class))) {
|
||||
failedCount += ticketingSamplingRespVO.getPageSize();
|
||||
}
|
||||
}
|
||||
if (failedCount != 0) {
|
||||
XxlJobHelper.handleFail("总共:" + totalRows + "条数据," + failedCount + "条数据插入失败!即将重试......");
|
||||
result.add("总共:" + totalRows + "条数据," + failedCount + "条数据插入失败!即将重试......");
|
||||
return result.toString();
|
||||
}
|
||||
if (!checkTicketService.dataValidation(TickingDateUtils.getPreviousDayFormat())) {
|
||||
XxlJobHelper.log("mysql和mongo数据验证不一致!!!");
|
||||
XxlJobHelper.log("重新抽取({})mongo数据", TickingDateUtils.getPreviousDayFormat());
|
||||
getCheckTicketByMongoDBHandler();
|
||||
XxlJobHelper.log("抽数完,比对结果:{}", checkTicketService.dataValidation(TickingDateUtils.getPreviousDayFormat()) ? "相等" : "不想等");
|
||||
XxlJobHelper.log("mysql和mongo数据验证不一致!!!重新进行mongo抽数中......");
|
||||
result.add("mysql和mongo数据验证不一致!!!重新进行mongo抽数中......");
|
||||
Calendar yesterday = Calendar.getInstance();
|
||||
yesterday.add(Calendar.DAY_OF_MONTH, -1);
|
||||
getTicketDataByTimeZonesToMongo(yesterday, yesterday, "checkTicket");
|
||||
if (!checkTicketService.dataValidation(TickingDateUtils.getPreviousDayFormat())) {
|
||||
XxlJobHelper.handleFail("日期:" + TickingDateUtils.getPreviousDayFormat() + "中mongo和mysql检票数据不一致!!!");
|
||||
result.add("日期:" + TickingDateUtils.getPreviousDayFormat() + "中mongo和mysql检票数据不一致!!!");
|
||||
}
|
||||
}
|
||||
XxlJobHelper.log("抽数服务:检票数据抽数正常结束!总共:{}条数据,{}条数据插入失败!", totalRows, failedCount);
|
||||
result.add("抽数服务:检票数据抽数正常结束!总共:" + totalRows + "条数据," + failedCount + "条数据插入失败!");
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 存入销售数据的定时任务mongodb
|
||||
*/
|
||||
@XxlJob("getSaleDataByMongoDB")
|
||||
public void getSaleDataByMongoDBHandler() throws Exception {
|
||||
int successCount = 0;
|
||||
int duplicatesCount = 0;
|
||||
int pageNumber = 1;
|
||||
XxlJobHelper.log("抽数服务:mongodb销售数据开始抽数...");
|
||||
TicketingSamplingRespVO ticketingSamplingRespVO = this.getUrlResponseData(SALE_DATA_SERVICE, SALE_DATA_METHOD, TickingDateUtils.getNowDayFormat(), pageNumber);
|
||||
if (ticketingSamplingRespVO == null) {
|
||||
XxlJobHelper.log("暂无数据!");
|
||||
return;
|
||||
}
|
||||
int totalRows = ticketingSamplingRespVO.getTotalRows();
|
||||
List<Map<String, Object>> mapList;
|
||||
// 获得总页数
|
||||
int totalPages = ticketingSamplingRespVO.getTotalPages();
|
||||
// 处理剩余页的数据
|
||||
for (; pageNumber <= totalPages; pageNumber++) {
|
||||
ticketingSamplingRespVO = this.getUrlResponseData(SALE_DATA_SERVICE, SALE_DATA_METHOD, TickingDateUtils.getNowDayFormat(), pageNumber);
|
||||
mapList = ticketingSamplingRespVO.getDataMapList();
|
||||
List<Integer> resultNum = saleDataService.insertTodayByMongoDB(BeanUtils.toBean(mapList, SaleDataToday.class));
|
||||
if (resultNum == null) {
|
||||
XxlJobHelper.log("数据批量插入异常!", pageNumber);
|
||||
} else {
|
||||
successCount += resultNum.get(0);
|
||||
duplicatesCount += resultNum.get(1);
|
||||
}
|
||||
}
|
||||
|
||||
XxlJobHelper.log("抽数服务:检票数据抽数正常结束!总共:{}条数据,{}条数据重复,{}条数据插入成功!", totalRows, duplicatesCount, successCount);
|
||||
public String getSaleDataByMongoDBHandler() throws Exception {
|
||||
Calendar now = Calendar.getInstance();
|
||||
return getTicketDataByTimeZonesToMongo(now, now, "saleData");
|
||||
}
|
||||
|
||||
/**
|
||||
* 存入检票数据的定时任务mongodb
|
||||
*/
|
||||
@XxlJob("getCheckTicketByMongoDB")
|
||||
public void getCheckTicketByMongoDBHandler() throws Exception {
|
||||
XxlJobHelper.log("抽数服务:mongodb检票数据开始抽数...");
|
||||
int successCount = 0;
|
||||
int duplicatesCount = 0;
|
||||
int pageNumber = 1;
|
||||
String date = TickingDateUtils.getNowDayFormat();
|
||||
TicketingSamplingRespVO ticketingSamplingRespVO = this.getUrlResponseData(CHECK_TICKET_SERVICE, CHECK_TICKET_METHOD, date, pageNumber);
|
||||
if (ticketingSamplingRespVO == null) {
|
||||
XxlJobHelper.log("暂无数据!");
|
||||
return;
|
||||
}
|
||||
int totalRows = ticketingSamplingRespVO.getTotalRows();
|
||||
List<Map<String, Object>> mapList;
|
||||
// 获得总页数
|
||||
int totalPages = ticketingSamplingRespVO.getTotalPages();
|
||||
// 处理剩余页的数据
|
||||
for (; pageNumber <= totalPages; pageNumber++) {
|
||||
ticketingSamplingRespVO = this.getUrlResponseData(CHECK_TICKET_SERVICE, CHECK_TICKET_METHOD, date, pageNumber);
|
||||
mapList = ticketingSamplingRespVO.getDataMapList();
|
||||
List<Integer> resultNum = checkTicketService.insertTodayByMongoDB(BeanUtils.toBean(mapList, CheckTicketToday.class));
|
||||
if (resultNum == null) {
|
||||
XxlJobHelper.log("数据批量插入异常!", pageNumber);
|
||||
} else {
|
||||
successCount += resultNum.get(0);
|
||||
duplicatesCount += resultNum.get(1);
|
||||
}
|
||||
}
|
||||
|
||||
XxlJobHelper.log("抽数服务:检票数据抽数正常结束!总共:{}条数据,{}条数据重复,{}条数据插入成功!", totalRows, duplicatesCount, successCount);
|
||||
public String getCheckTicketByMongoDBHandler() throws Exception {
|
||||
Calendar now = Calendar.getInstance();
|
||||
return getTicketDataByTimeZonesToMongo(now, now, "checkTicket");
|
||||
}
|
||||
|
||||
@XxlJob("getCheckTicketByMongoDBLastMonthToNow")
|
||||
public void getCheckTicketByMongoDBLastMonthToNow() throws Exception {
|
||||
XxlJobHelper.log("抽数服务:mongodb检票数据开始抽数...");
|
||||
|
||||
int successCount;
|
||||
int duplicatesCount;
|
||||
int pageNumber;
|
||||
// 获取当前日期
|
||||
Calendar startDate = Calendar.getInstance();
|
||||
// 设置开始日期为上一个月的第一天
|
||||
startDate.set(Calendar.DAY_OF_MONTH, 1); // 先将日期设置为当前月的第一天
|
||||
startDate.add(Calendar.MONTH, -1); // 然后减去一个月
|
||||
|
||||
// 设置结束日期为今天
|
||||
Calendar endDate = Calendar.getInstance();
|
||||
|
||||
// 循环从开始日期到结束日期
|
||||
while (!startDate.after(endDate)) {
|
||||
successCount = 0;
|
||||
duplicatesCount = 0;
|
||||
String dateString = TickingDateUtils.format(startDate.getTime());
|
||||
pageNumber = 1;
|
||||
TicketingSamplingRespVO ticketingSamplingRespVO = this.getUrlResponseData(CHECK_TICKET_SERVICE, CHECK_TICKET_METHOD, dateString, pageNumber);
|
||||
if (ticketingSamplingRespVO == null) {
|
||||
startDate.add(Calendar.DAY_OF_MONTH, 1);
|
||||
continue;
|
||||
}
|
||||
int totalRows = ticketingSamplingRespVO.getTotalRows();
|
||||
List<Map<String, Object>> mapList;
|
||||
|
||||
// 获得总页数
|
||||
int totalPages = ticketingSamplingRespVO.getTotalPages();
|
||||
|
||||
// 处理剩余页的数据
|
||||
for (; pageNumber <= totalPages; pageNumber++) {
|
||||
ticketingSamplingRespVO = this.getUrlResponseData(CHECK_TICKET_SERVICE, CHECK_TICKET_METHOD, dateString, pageNumber);
|
||||
mapList = ticketingSamplingRespVO.getDataMapList();
|
||||
List<Integer> resultNum = checkTicketService.insertByMongoDB(BeanUtils.toBean(mapList, CheckTicket.class));
|
||||
|
||||
if (resultNum == null) {
|
||||
XxlJobHelper.log("数据批量插入异常!", pageNumber);
|
||||
} else {
|
||||
successCount += resultNum.get(0);
|
||||
duplicatesCount += resultNum.get(1);
|
||||
}
|
||||
}
|
||||
int currentMonth = startDate.get(Calendar.MONTH) + 1; // 加1以得到1-12的月份
|
||||
int currentDay = startDate.get(Calendar.DAY_OF_MONTH);
|
||||
XxlJobHelper.log("抽数服务:{}月{}日:检票数据抽数正常结束!总共:{}条数据,{}条数据重复,{}条数据插入成功!", currentMonth, currentDay, totalRows, duplicatesCount, successCount);
|
||||
// 日期递增一天
|
||||
startDate.add(Calendar.DAY_OF_MONTH, 1);
|
||||
}
|
||||
XxlJobHelper.log("抽数结束!!!");
|
||||
}
|
||||
|
||||
@XxlJob("getSaleDataByMongoDBLastMonthToNow")
|
||||
public void getSaleDataByMongoDBLastMonthToNow() throws Exception {
|
||||
XxlJobHelper.log("抽数服务:mongodb售票数据开始抽数...");
|
||||
|
||||
int successCount;
|
||||
int duplicatesCount;
|
||||
int pageNumber;
|
||||
// 获取当前日期
|
||||
Calendar startDate = Calendar.getInstance();
|
||||
// 设置开始日期为上一个月的第一天
|
||||
startDate.set(Calendar.DAY_OF_MONTH, 1); // 先将日期设置为当前月的第一天
|
||||
startDate.add(Calendar.MONTH, -1); // 然后减去一个月
|
||||
|
||||
// 设置结束日期为今天
|
||||
Calendar endDate = Calendar.getInstance();
|
||||
|
||||
// 循环从开始日期到结束日期
|
||||
while (!startDate.after(endDate)) {
|
||||
successCount = 0;
|
||||
duplicatesCount = 0;
|
||||
String dateString = TickingDateUtils.format(startDate.getTime());
|
||||
pageNumber = 1;
|
||||
TicketingSamplingRespVO ticketingSamplingRespVO = this.getUrlResponseData(SALE_DATA_SERVICE, SALE_DATA_METHOD, dateString, pageNumber);
|
||||
if (ticketingSamplingRespVO == null) {
|
||||
startDate.add(Calendar.DAY_OF_MONTH, 1);
|
||||
continue;
|
||||
}
|
||||
int totalRows = ticketingSamplingRespVO.getTotalRows();
|
||||
List<Map<String, Object>> mapList;
|
||||
|
||||
// 获得总页数
|
||||
int totalPages = ticketingSamplingRespVO.getTotalPages();
|
||||
|
||||
// 处理剩余页的数据
|
||||
for (; pageNumber <= totalPages; pageNumber++) {
|
||||
ticketingSamplingRespVO = this.getUrlResponseData(SALE_DATA_SERVICE, SALE_DATA_METHOD, dateString, pageNumber);
|
||||
mapList = ticketingSamplingRespVO.getDataMapList();
|
||||
List<Integer> resultNum = saleDataService.insertByMongoDB(BeanUtils.toBean(mapList, SaleData.class));
|
||||
|
||||
if (resultNum == null) {
|
||||
XxlJobHelper.log("数据批量插入异常!", pageNumber);
|
||||
} else {
|
||||
successCount += resultNum.get(0);
|
||||
duplicatesCount += resultNum.get(1);
|
||||
}
|
||||
}
|
||||
int currentMonth = startDate.get(Calendar.MONTH) + 1; // 加1以得到1-12的月份
|
||||
int currentDay = startDate.get(Calendar.DAY_OF_MONTH);
|
||||
XxlJobHelper.log("抽数服务:{}月{}日:售票数据抽数正常结束!总共:{}条数据,{}条数据重复,{}条数据插入成功!", currentMonth, currentDay, totalRows, duplicatesCount, successCount);
|
||||
// 日期递增一天
|
||||
startDate.add(Calendar.DAY_OF_MONTH, 1);
|
||||
}
|
||||
XxlJobHelper.log("抽数结束!!!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除(今年和去年)往前推31天外的数据和抽取去年明天的数据
|
||||
@ -396,6 +241,10 @@ public class TicketDataMigration {
|
||||
TicketingSamplingRespVO ticketingSamplingRespVO = this.getUrlResponseData(respService, respMethod, dateString, pageNumber);
|
||||
if (ticketingSamplingRespVO == null) {
|
||||
startDate.add(Calendar.DAY_OF_MONTH, 1);
|
||||
result.add("日期:" + TickingDateUtils.format(startDate.getTime()) + "返回无值");
|
||||
if (startDate.equals(endDate)) { // 如果日期相等,退出循环
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
int totalRows = ticketingSamplingRespVO.getTotalRows();
|
||||
@ -437,48 +286,6 @@ public class TicketDataMigration {
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入销售数据的方法(mysql)
|
||||
*
|
||||
* @param mapList 数据集合数组
|
||||
* @param listSize 实际个数
|
||||
* @param pageNumber 每页显示条数
|
||||
* @return int 失败条数
|
||||
*/
|
||||
private int insertSaleData(List<Map<String, Object>> mapList, int listSize, int pageNumber) {
|
||||
int failedCount = 0;
|
||||
for (int i = 0; i < listSize; i++) {
|
||||
Map<String, Object> currentMap = mapList.get(i);
|
||||
SaleDataDO saleDataDO = BeanUtils.toBean(currentMap, SaleDataDO.class);
|
||||
if (saleDataService.createSaleData(saleDataDO) == 0) {
|
||||
failedCount++;
|
||||
XxlJobHelper.log("第{}条数据插入失败,数据值为:{}", ((pageNumber - 1) * PAGE_SIZE + i + 1), currentMap);
|
||||
}
|
||||
}
|
||||
return failedCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入检票数据的方法(mysql)
|
||||
*
|
||||
* @param mapList 数据集合数组
|
||||
* @param listSize 实际个数
|
||||
* @param pageNumber 每页显示条数
|
||||
* @return int 失败条数
|
||||
*/
|
||||
private int insertCheckTicket(List<Map<String, Object>> mapList, int listSize, int pageNumber) {
|
||||
int failedCount = 0;
|
||||
for (int i = 0; i < listSize; i++) {
|
||||
Map<String, Object> currentMap = mapList.get(i);
|
||||
CheckTicketDO checkTicketDO = BeanUtils.toBean(currentMap, CheckTicketDO.class);
|
||||
if (checkTicketService.createCheckTicket(checkTicketDO) == 0) {
|
||||
failedCount++;
|
||||
XxlJobHelper.log("第{}条数据插入失败,数据值为:{}", ((pageNumber - 1) * PAGE_SIZE + i + 1), currentMap);
|
||||
}
|
||||
}
|
||||
return failedCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求目标url的响应数据
|
||||
*
|
||||
@ -519,14 +326,4 @@ public class TicketDataMigration {
|
||||
return ticketingSamplingRespVO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验数据
|
||||
*
|
||||
* @param date
|
||||
* @return java.lang.Boolean
|
||||
*/
|
||||
public Boolean dataValidation(String date) {
|
||||
return checkTicketService.dataValidation(date) && saleDataService.dataValidation(date);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -19,12 +19,10 @@ import java.util.Map;
|
||||
public interface CheckTicketService {
|
||||
|
||||
/**
|
||||
* 创建检票
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* 批量插入检票数据(mysql)
|
||||
* @return 编号
|
||||
*/
|
||||
Long createCheckTicket(@Valid CheckTicketDO createReqVO);
|
||||
Boolean createCheckTicket(List<CheckTicketDO> checkTicketDOList);
|
||||
|
||||
/**
|
||||
* 查询重复的dataId(mongodb)
|
||||
|
@ -48,11 +48,10 @@ public class CheckTicketServiceImpl implements CheckTicketService {
|
||||
private MongoTemplate mongoTemplate;
|
||||
|
||||
@Override
|
||||
public Long createCheckTicket(CheckTicketDO checkTicketDO) {
|
||||
// 插入
|
||||
checkTicketMapper.insert(checkTicketDO);
|
||||
public Boolean createCheckTicket(List<CheckTicketDO> checkTicketDOList) {
|
||||
checkTicketMapper.physicalDeleteByCheckticketdate(checkTicketDOList.get(0).getCheckticketdate());
|
||||
// 返回
|
||||
return checkTicketDO.getId();
|
||||
return checkTicketMapper.insertBatch(checkTicketDOList);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -21,12 +21,12 @@ import java.util.Map;
|
||||
public interface SaleDataService {
|
||||
|
||||
/**
|
||||
* 创建售票
|
||||
* 批量插入售票数据(mysql)
|
||||
*
|
||||
* @param saleDataDO 创建信息
|
||||
* @param saleDataDOList
|
||||
* @return 编号
|
||||
*/
|
||||
Long createSaleData(@Valid SaleDataDO saleDataDO);
|
||||
Boolean createSaleData(List<SaleDataDO> saleDataDOList);
|
||||
|
||||
/**
|
||||
* 查询重复的dataId(mongodb)
|
||||
|
@ -42,11 +42,9 @@ public class SaleDataServiceImpl implements SaleDataService {
|
||||
private MongoTemplate mongoTemplate;
|
||||
|
||||
@Override
|
||||
public Long createSaleData(SaleDataDO saleDataDO) {
|
||||
// 插入
|
||||
saleDataMapper.insert(saleDataDO);
|
||||
// 返回
|
||||
return saleDataDO.getId();
|
||||
public Boolean createSaleData(List<SaleDataDO> saleDataDOList) {
|
||||
saleDataMapper.physicalDeleteBySddate(saleDataDOList.get(0).getSddate());
|
||||
return saleDataMapper.insertBatch(saleDataDOList);
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.infra.dal.mysql.checkticket.CheckTicketMapper">
|
||||
<delete id="physicalDeleteByCheckticketdate">
|
||||
DELETE
|
||||
FROM checkticket
|
||||
WHERE checkticketdate = #{checkticketdate}
|
||||
</delete>
|
||||
</mapper>
|
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.infra.dal.mysql.saledata.SaleDataMapper">
|
||||
<delete id="physicalDeleteBySddate">
|
||||
DELETE
|
||||
FROM saledata
|
||||
WHERE sddate = #{sddate}
|
||||
</delete>
|
||||
</mapper>
|
@ -13,4 +13,4 @@ docker rmi ${app_name}:${app_version}
|
||||
echo '----build image----'
|
||||
docker buildx build -f Dockerfile -t ${app_name}:${app_version} .
|
||||
echo '----start container----'
|
||||
docker run -d -p 48081:48081 --name ${app_name} --memory 700m ${app_name}:${app_version}
|
||||
docker run -d -p 48081:48081 --name ${app_name} --memory 750m ${app_name}:${app_version}
|
Loading…
Reference in New Issue
Block a user