xinwei #3

Merged
root merged 30 commits from xinwei into master 2024-08-15 09:53:30 +08:00
31 changed files with 1002 additions and 144 deletions
Showing only changes of commit 42671a4074 - Show all commits

View File

@ -0,0 +1,16 @@
package cn.iocoder.yudao.module.datacenter.controller.admin.transitionflight;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Description 车辆过渡情况
*/
@Tag(name = "大屏服务 - 车辆过渡情况")
@RestController
@RequestMapping("/h5/transitionFlight")
@Validated
public class TransitionFlightApi {
}

View File

@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.ticket.api.checkticket;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.ticket.api.checkticket.dto.CheckTicketSaveReqDTO;
import cn.iocoder.yudao.module.ticket.controller.admin.checkticket.vo.vo.CheckTicketSaveReqVO;
import cn.iocoder.yudao.module.ticket.controller.admin.checkticket.vo.CheckTicketSaveReqVO;
import cn.iocoder.yudao.module.ticket.service.checkticket.CheckTicketService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.ticket.controller.admin.checkticket.vo.vo;
package cn.iocoder.yudao.module.ticket.controller.admin.checkticket.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;

View File

@ -1,14 +1,11 @@
package cn.iocoder.yudao.module.ticket.dal.mysql.checkticket;
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.controller.admin.checkticket.vo.vo.CheckTicketPageReqVO;
import cn.iocoder.yudao.module.ticket.controller.admin.checkticket.vo.CheckTicketPageReqVO;
import cn.iocoder.yudao.module.ticket.dal.dataobject.checkticket.CheckTicketDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.ticket.controller.admin.checkticket.vo.*;
/**
* 检票 Mapper

View File

@ -3,13 +3,11 @@ package cn.iocoder.yudao.module.ticket.service.checkticket;
import javax.validation.*;
import cn.iocoder.yudao.module.ticket.api.checkticket.dto.CheckTicketSaveReqDTO;
import cn.iocoder.yudao.module.ticket.controller.admin.checkticket.vo.vo.CheckTicketPageReqVO;
import cn.iocoder.yudao.module.ticket.controller.admin.checkticket.vo.vo.CheckTicketSaveReqVO;
import cn.iocoder.yudao.module.ticket.controller.admin.checkticket.vo.CheckTicketPageReqVO;
import cn.iocoder.yudao.module.ticket.controller.admin.checkticket.vo.CheckTicketSaveReqVO;
import cn.iocoder.yudao.module.ticket.dal.dataobject.checkticket.CheckTicketDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import org.springframework.web.bind.annotation.PathVariable;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

View File

@ -2,16 +2,14 @@ package cn.iocoder.yudao.module.ticket.service.checkticket;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.ticket.api.checkticket.dto.CheckTicketSaveReqDTO;
import cn.iocoder.yudao.module.ticket.controller.admin.checkticket.vo.vo.CheckTicketPageReqVO;
import cn.iocoder.yudao.module.ticket.controller.admin.checkticket.vo.vo.CheckTicketSaveReqVO;
import cn.iocoder.yudao.module.ticket.controller.admin.checkticket.vo.CheckTicketPageReqVO;
import cn.iocoder.yudao.module.ticket.controller.admin.checkticket.vo.CheckTicketSaveReqVO;
import cn.iocoder.yudao.module.ticket.dal.dataobject.checkticket.CheckTicket;
import cn.iocoder.yudao.module.ticket.dal.mongodb.checkticket.CheckTicketRepository;
import com.baomidou.dynamic.datasource.annotation.Slave;
import com.mongodb.MongoException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.ExampleMatcher;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;

View File

@ -1,8 +1,5 @@
package cn.iocoder.yudao.module.ticket.service.checkticket;
import cn.iocoder.yudao.module.ticket.controller.admin.checkticket.vo.vo.CheckTicketPageReqVO;
import cn.iocoder.yudao.module.ticket.controller.admin.checkticket.vo.vo.CheckTicketSaveReqVO;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import javax.annotation.Resource;
@ -11,15 +8,12 @@ import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
import cn.iocoder.yudao.module.ticket.dal.dataobject.checkticket.CheckTicketDO;
import cn.iocoder.yudao.module.ticket.dal.mysql.checkticket.CheckTicketMapper;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import org.springframework.context.annotation.Import;
import static cn.iocoder.yudao.module.ticket.enums.ErrorCodeConstants.*;
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*;
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.*;
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*;
import static org.junit.jupiter.api.Assertions.*;
/**

View File

@ -19,18 +19,17 @@
</description>
<dependencies>
<!-- mongodb -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
<!-- 定时任务 -->
<dependency>
<groupId>cn.iocoder.cloud</groupId>
<artifactId>ludu-job-core</artifactId>
<version>${revision}</version>
</dependency>
<!-- 测试调用票务API -->
<dependency>
<groupId>cn.iocoder.cloud</groupId>
<artifactId>ludu-module-ticketing-api</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>cn.iocoder.cloud</groupId>
<artifactId>ludu-job-admin-api</artifactId>

View File

@ -0,0 +1,50 @@
package cn.iocoder.yudao.module.infra.controller.checkticket.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 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 CheckTicketPageReqVO extends PageParam {
@Schema(description = "ID", example = "16476")
private Long id;
@Schema(description = "数据ID", example = "15422")
private String dataId;
@Schema(description = "检票点ID")
private String checkstation;
@Schema(description = "检票点名称", example = "李四")
private String checkstationname;
@Schema(description = "检票日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private String[] checkticketdate;
@Schema(description = "检票时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private String[] checktickettime;
@Schema(description = "人数", example = "23164")
private Integer personcount;
@Schema(description = "订单明细ID")
private String sdshipping;
@Schema(description = "票ID")
private String ticket;
@Schema(description = "销售特征名称(票种名称)", example = "张三")
private String salepropetyvaluename;
}

View File

@ -0,0 +1,53 @@
package cn.iocoder.yudao.module.infra.controller.checkticket.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Schema(description = "管理后台 - 检票 Response VO")
@Data
@ExcelIgnoreUnannotated
public class CheckTicketRespVO {
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "16476")
@ExcelProperty("ID")
private Long id;
@Schema(description = "数据ID", example = "15422")
@ExcelProperty("数据ID")
private String dataId;
@Schema(description = "检票点ID")
@ExcelProperty("检票点ID")
private String checkstation;
@Schema(description = "检票点名称", example = "李四")
@ExcelProperty("检票点名称")
private String checkstationname;
@Schema(description = "检票日期")
@ExcelProperty("检票日期")
private String checkticketdate;
@Schema(description = "检票时间")
@ExcelProperty("检票时间")
private String checktickettime;
@Schema(description = "人数", example = "23164")
@ExcelProperty("人数")
private Integer personcount;
@Schema(description = "订单明细ID")
@ExcelProperty("订单明细ID")
private String sdshipping;
@Schema(description = "票ID")
@ExcelProperty("票ID")
private String ticket;
@Schema(description = "销售特征名称(票种名称)", example = "张三")
@ExcelProperty("销售特征名称(票种名称)")
private String salepropetyvaluename;
}

View File

@ -0,0 +1,40 @@
package cn.iocoder.yudao.module.infra.controller.checkticket.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Schema(description = "管理后台 - 检票新增/修改 Request VO")
@Data
public class CheckTicketSaveReqVO {
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "16476")
private Long id;
@Schema(description = "数据ID", example = "15422")
private String dataId;
@Schema(description = "检票点ID")
private String checkstation;
@Schema(description = "检票点名称", example = "李四")
private String checkstationname;
@Schema(description = "检票日期")
private String checkticketdate;
@Schema(description = "检票时间")
private String checktickettime;
@Schema(description = "人数", example = "23164")
private Integer personcount;
@Schema(description = "订单明细ID")
private String sdshipping;
@Schema(description = "票ID")
private String ticket;
@Schema(description = "销售特征名称(票种名称)", example = "张三")
private String salepropetyvaluename;
@Schema(description = "租户编号")
private Long tenant_id;
}

View File

@ -0,0 +1,70 @@
package cn.iocoder.yudao.module.infra.controller.saledata.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.math.BigDecimal;
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 SaleDataPageReqVO extends PageParam {
@Schema(description = "ID", example = "20492")
private Long id;
@Schema(description = "数据id", example = "32044")
private String dataId;
@Schema(description = "金额")
private BigDecimal amount;
@Schema(description = "证件号")
private String certificateno;
@Schema(description = "证件类别", example = "2")
private String certificatetype;
@Schema(description = "产品ID")
private String item;
@Schema(description = "产品名称", example = "张三")
private String itemname;
@Schema(description = "产品类型ID", example = "2")
private String itemtype;
@Schema(description = "产品类型名称", example = "张三")
private String itemtypename;
@Schema(description = "出游日期")
private String productbatchno;
@Schema(description = "数量")
private Integer quantity;
@Schema(description = "销售日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private String[] sddate;
@Schema(description = "订单号")
private String sdno;
@Schema(description = "销售时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private String[] sdtime;
@Schema(description = "交易类别(订单类型)")
private String transactiontypeno;
@Schema(description = "销售特征名称(票种名称)", example = "赵六")
private String salepropetyvaluename;
}

View File

@ -0,0 +1,79 @@
package cn.iocoder.yudao.module.infra.controller.saledata.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.math.BigDecimal;
@Schema(description = "管理后台 - 售票 Response VO")
@Data
@ExcelIgnoreUnannotated
public class SaleDataRespVO {
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "20492")
@ExcelProperty("ID")
private Long id;
@Schema(description = "数据id", example = "32044")
@ExcelProperty("数据id")
private String dataId;
@Schema(description = "金额")
@ExcelProperty("金额")
private BigDecimal amount;
@Schema(description = "证件号")
@ExcelProperty("证件号")
private String certificateno;
@Schema(description = "证件类别", example = "2")
@ExcelProperty("证件类别")
private String certificatetype;
@Schema(description = "产品ID")
@ExcelProperty("产品ID")
private String item;
@Schema(description = "产品名称", example = "张三")
@ExcelProperty("产品名称")
private String itemname;
@Schema(description = "产品类型ID", example = "2")
@ExcelProperty("产品类型ID")
private String itemtype;
@Schema(description = "产品类型名称", example = "张三")
@ExcelProperty("产品类型名称")
private String itemtypename;
@Schema(description = "出游日期")
@ExcelProperty("出游日期")
private String productbatchno;
@Schema(description = "数量")
@ExcelProperty("数量")
private Integer quantity;
@Schema(description = "销售日期")
@ExcelProperty("销售日期")
private String sddate;
@Schema(description = "订单号")
@ExcelProperty("订单号")
private String sdno;
@Schema(description = "销售时间")
@ExcelProperty("销售时间")
private String sdtime;
@Schema(description = "交易类别(订单类型)")
@ExcelProperty("交易类别(订单类型)")
private String transactiontypeno;
@Schema(description = "销售特征名称(票种名称)", example = "赵六")
@ExcelProperty("销售特征名称(票种名称)")
private String salepropetyvaluename;
}

View File

@ -0,0 +1,61 @@
package cn.iocoder.yudao.module.infra.controller.saledata.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
@Schema(description = "管理后台 - 售票新增/修改 Request VO")
@Data
public class SaleDataSaveReqVO {
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "16476")
private Long id;
@Schema(description = "数据id", example = "32044")
private String dataId;
@Schema(description = "金额")
private BigDecimal amount;
@Schema(description = "证件号")
private String certificateno;
@Schema(description = "证件类别", example = "2")
private String certificatetype;
@Schema(description = "产品ID")
private String item;
@Schema(description = "产品名称", example = "张三")
private String itemname;
@Schema(description = "产品类型ID", example = "2")
private String itemtype;
@Schema(description = "产品类型名称", example = "张三")
private String itemtypename;
@Schema(description = "出游日期")
private String productbatchno;
@Schema(description = "数量")
private Integer quantity;
@Schema(description = "销售日期")
private String sddate;
@Schema(description = "订单号")
private String sdno;
@Schema(description = "销售时间")
private String sdtime;
@Schema(description = "交易类别(订单类型)")
private String transactiontypeno;
@Schema(description = "销售特征名称(票种名称)", example = "赵六")
private String salepropetyvaluename;
@Schema(description = "租户编号")
private Long tenant_id;
}

View File

@ -0,0 +1,20 @@
package cn.iocoder.yudao.module.infra.dal.dataobject.checkticket;
import lombok.Data;
import org.springframework.data.mongodb.core.mapping.Document;
@Document("checkticket")
@Data
public class CheckTicket {
private String id;
private String dataId;
private String checkstation;
private String checkstationname;
private String ticket;
private String checkticketdate;
private String checktickettime;
private Integer personcount;
private String sdshipping;
private String salepropetyvaluename;
}

View File

@ -0,0 +1,69 @@
package cn.iocoder.yudao.module.infra.dal.dataobject.checkticket;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
/**
* 检票 DO
*
* @author 芋道源码
*/
@TableName("checkticket")
@KeySequence("checkticket_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CheckTicketDO extends BaseDO {
/**
* ID
*/
@TableId
private Long id;
/**
* 数据ID
*/
private String dataId;
/**
* 检票点ID
*/
private String checkstation;
/**
* 检票点名称
*/
private String checkstationname;
/**
* 检票日期
*/
private String checkticketdate;
/**
* 检票时间
*/
private String checktickettime;
/**
* 人数
*/
private Integer personcount;
/**
* 订单明细ID
*/
private String sdshipping;
/**
* 票ID
*/
private String ticket;
/**
* 销售特征名称票种名称
*/
private String salepropetyvaluename;
/**
* 租户编号
*/
private Long tenant_id;
}

View File

@ -0,0 +1,27 @@
package cn.iocoder.yudao.module.infra.dal.dataobject.saledata;
import lombok.Data;
import org.springframework.data.mongodb.core.mapping.Document;
import java.math.BigDecimal;
@Document("saledata")
@Data
public class SaleData {
private String id;
private String dataId;
private String sdno;
private String transactiontypeno;
private String sddate;
private String sdtime;
private BigDecimal amount;
private Integer quantity;
private String certificatetype;
private String certificateno;
private String itemtype;
private String itemtypename;
private String item;
private String itemname;
private String productbatchno;
private String salepropetyvaluename;
}

View File

@ -0,0 +1,97 @@
package cn.iocoder.yudao.module.infra.dal.dataobject.saledata;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import java.math.BigDecimal;
/**
* 售票 DO
*
* @author 芋道源码
*/
@TableName("saledata")
@KeySequence("saledata_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SaleDataDO extends BaseDO {
/**
* ID
*/
@TableId
private Long id;
/**
* 数据id
*/
private String dataId;
/**
* 金额
*/
private BigDecimal amount;
/**
* 证件号
*/
private String certificateno;
/**
* 证件类别
*/
private String certificatetype;
/**
* 产品ID
*/
private String item;
/**
* 产品名称
*/
private String itemname;
/**
* 产品类型ID
*/
private String itemtype;
/**
* 产品类型名称
*/
private String itemtypename;
/**
* 出游日期
*/
private String productbatchno;
/**
* 数量
*/
private Integer quantity;
/**
* 销售日期
*/
private String sddate;
/**
* 订单号
*/
private String sdno;
/**
* 销售时间
*/
private String sdtime;
/**
* 交易类别订单类型
*/
private String transactiontypeno;
/**
* 销售特征名称票种名称
*/
private String salepropetyvaluename;
/**
* 租户编号
*/
private Long tenant_id;
}

View File

@ -0,0 +1,11 @@
package cn.iocoder.yudao.module.infra.dal.mongodb.checkticket;
import cn.iocoder.yudao.module.infra.dal.dataobject.checkticket.CheckTicket;
import com.baomidou.dynamic.datasource.annotation.DS;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface CheckTicketRepository extends MongoRepository<CheckTicket,String> {
}

View File

@ -0,0 +1,12 @@
package cn.iocoder.yudao.module.infra.dal.mongodb.saledata;
import cn.iocoder.yudao.module.infra.dal.dataobject.saledata.SaleData;
import com.baomidou.dynamic.datasource.annotation.DS;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface SaleDataRepository extends MongoRepository<SaleData,String> {
}

View File

@ -0,0 +1,35 @@
package cn.iocoder.yudao.module.infra.dal.mysql.checkticket;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.infra.controller.checkticket.vo.CheckTicketPageReqVO;
import cn.iocoder.yudao.module.infra.dal.dataobject.checkticket.CheckTicketDO;
import com.baomidou.dynamic.datasource.annotation.DS;
import org.apache.ibatis.annotations.Mapper;
/**
* 检票 Mapper
*
* @author 芋道源码
*/
@Mapper
@DS("ticketing")
public interface CheckTicketMapper extends BaseMapperX<CheckTicketDO> {
default PageResult<CheckTicketDO> selectPage(CheckTicketPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<CheckTicketDO>()
.eqIfPresent(CheckTicketDO::getId, reqVO.getId())
.eqIfPresent(CheckTicketDO::getDataId, reqVO.getDataId())
.eqIfPresent(CheckTicketDO::getCheckstation, reqVO.getCheckstation())
.likeIfPresent(CheckTicketDO::getCheckstationname, reqVO.getCheckstationname())
.betweenIfPresent(CheckTicketDO::getCheckticketdate, reqVO.getCheckticketdate())
.betweenIfPresent(CheckTicketDO::getChecktickettime, reqVO.getChecktickettime())
.eqIfPresent(CheckTicketDO::getPersoncount, reqVO.getPersoncount())
.eqIfPresent(CheckTicketDO::getSdshipping, reqVO.getSdshipping())
.eqIfPresent(CheckTicketDO::getTicket, reqVO.getTicket())
.likeIfPresent(CheckTicketDO::getSalepropetyvaluename, reqVO.getSalepropetyvaluename())
.orderByDesc(CheckTicketDO::getId));
}
}

View File

@ -0,0 +1,46 @@
package cn.iocoder.yudao.module.infra.dal.mysql.saledata;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
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 java.util.List;
import java.util.Map;
/**
* 售票 Mapper
*
* @author 芋道源码
*/
@Mapper
@DS("ticketing")
public interface SaleDataMapper extends BaseMapperX<SaleDataDO> {
default PageResult<SaleDataDO> selectPage(SaleDataPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<SaleDataDO>()
.eqIfPresent(SaleDataDO::getId, reqVO.getId())
.eqIfPresent(SaleDataDO::getDataId, reqVO.getDataId())
.eqIfPresent(SaleDataDO::getAmount, reqVO.getAmount())
.eqIfPresent(SaleDataDO::getCertificateno, reqVO.getCertificateno())
.eqIfPresent(SaleDataDO::getCertificatetype, reqVO.getCertificatetype())
.eqIfPresent(SaleDataDO::getItem, reqVO.getItem())
.likeIfPresent(SaleDataDO::getItemname, reqVO.getItemname())
.eqIfPresent(SaleDataDO::getItemtype, reqVO.getItemtype())
.likeIfPresent(SaleDataDO::getItemtypename, reqVO.getItemtypename())
.eqIfPresent(SaleDataDO::getProductbatchno, reqVO.getProductbatchno())
.eqIfPresent(SaleDataDO::getQuantity, reqVO.getQuantity())
.betweenIfPresent(SaleDataDO::getSddate, reqVO.getSddate())
.eqIfPresent(SaleDataDO::getSdno, reqVO.getSdno())
.betweenIfPresent(SaleDataDO::getSdtime, reqVO.getSdtime())
.eqIfPresent(SaleDataDO::getTransactiontypeno, reqVO.getTransactiontypeno())
.likeIfPresent(SaleDataDO::getSalepropetyvaluename, reqVO.getSalepropetyvaluename())
.orderByDesc(SaleDataDO::getId));
}
}

View File

@ -1,15 +1,12 @@
package cn.iocoder.yudao.module.infra.framework.rpc.config;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.ticket.api.asset.TicketAssetApi;
import cn.iocoder.yudao.module.ticket.api.checkticket.TicketCheckTicketApi;
import cn.iocoder.yudao.module.ticket.api.saledata.TicketSaleDataApi;
import com.xxl.job.admin.api.info.JobInfoApi;
import com.xxl.job.admin.api.log.JobLogApi;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Configuration;
@Configuration(proxyBeanMethods = false)
@EnableFeignClients(clients = {AdminUserApi.class, JobInfoApi.class, JobLogApi.class, TicketSaleDataApi.class, TicketCheckTicketApi.class})
@EnableFeignClients(clients = {AdminUserApi.class, JobInfoApi.class, JobLogApi.class})
public class RpcConfiguration {
}

View File

@ -1,14 +1,21 @@
package cn.iocoder.yudao.module.infra.service.ticketing;
package cn.iocoder.yudao.module.infra.job.ticketing;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONUtil;
import cn.iocoder.yudao.framework.common.util.date.TickingDateUtils;
import cn.iocoder.yudao.module.infra.service.ticketing.vo.TicketingSamplingReqVO;
import cn.iocoder.yudao.module.infra.service.ticketing.vo.TicketingSamplingRespVO;
import cn.iocoder.yudao.module.ticket.api.checkticket.TicketCheckTicketApi;
import cn.iocoder.yudao.module.ticket.api.checkticket.dto.CheckTicketSaveReqDTO;
import cn.iocoder.yudao.module.ticket.api.saledata.TicketSaleDataApi;
import cn.iocoder.yudao.module.ticket.api.saledata.dto.SaleDataSaveReqDTO;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.infra.dal.dataobject.checkticket.CheckTicket;
import cn.iocoder.yudao.module.infra.dal.dataobject.checkticket.CheckTicketDO;
import cn.iocoder.yudao.module.infra.dal.dataobject.saledata.SaleData;
import cn.iocoder.yudao.module.infra.dal.dataobject.saledata.SaleDataDO;
import cn.iocoder.yudao.module.infra.dal.mongodb.checkticket.CheckTicketRepository;
import cn.iocoder.yudao.module.infra.dal.mongodb.saledata.SaleDataRepository;
import cn.iocoder.yudao.module.infra.dal.mysql.checkticket.CheckTicketMapper;
import cn.iocoder.yudao.module.infra.dal.mysql.saledata.SaleDataMapper;
import cn.iocoder.yudao.module.infra.job.ticketing.vo.TicketingSamplingReqVO;
import cn.iocoder.yudao.module.infra.job.ticketing.vo.TicketingSamplingRespVO;
import cn.iocoder.yudao.module.infra.service.checkticket.CheckTicketService;
import cn.iocoder.yudao.module.infra.service.saledata.SaleDataService;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
@ -32,10 +39,9 @@ public class TicketDataMigration {
// 每次读取条数
private static final int PAGE_SIZE = 500;
@Resource
private TicketSaleDataApi ticketSaleDataApi;
private SaleDataService saleDataService;
@Resource
private TicketCheckTicketApi ticketCheckTicketApi;
private CheckTicketService checkTicketService;
/**
* 存入售票数据的定时任务mysql
@ -101,6 +107,7 @@ public class TicketDataMigration {
XxlJobHelper.log("抽数服务:销售数据抽数正常结束!总共:{}条数据,{}条数据插入失败!", totalRows, failedCount);
}
/**
* 存入检票数据的定时任务mysql
*/
@ -166,6 +173,7 @@ public class TicketDataMigration {
XxlJobHelper.log("抽数服务:检票数据抽数正常结束!总共:{}条数据,{}条数据插入失败!", totalRows, failedCount);
}
/**
* 存入销售数据的定时任务mongodb
*/
@ -230,6 +238,7 @@ public class TicketDataMigration {
XxlJobHelper.log("抽数服务:销售数据抽数正常结束!总共:{}条数据,{}条数据插入失败!", totalRows, failedCount);
}
/**
* 存入检票数据的定时任务mongodb
*/
@ -295,10 +304,12 @@ public class TicketDataMigration {
XxlJobHelper.log("抽数服务:检票数据抽数正常结束!总共:{}条数据,{}条数据插入失败!", totalRows, failedCount);
}
/**
* 插入销售数据的方法mysql
* @param mapList 数据集合数组
* @param listSize 实际个数
*
* @param mapList 数据集合数组
* @param listSize 实际个数
* @param pageNumber 每页显示条数
* @return int 失败条数
*/
@ -306,67 +317,8 @@ public class TicketDataMigration {
int failedCount = 0;
for (int i = 0; i < listSize; i++) {
Map<String, Object> currentMap = mapList.get(i);
SaleDataSaveReqDTO saleData = mapToSaleDataSaveReqDTO(currentMap);
if (ticketSaleDataApi.createSaleData(saleData).getCode() != 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);
// 把获取到的数据转为插入检票的参数类型
CheckTicketSaveReqDTO checkTicket = mapToCheckTicketSaveReqDTO(currentMap);
if (ticketCheckTicketApi.createCheckTicket(checkTicket).getCode() != 0) {
failedCount++;
XxlJobHelper.log("第{}条数据插入失败,数据值为:{}", ((pageNumber - 1) * PAGE_SIZE + i + 1), currentMap);
}
}
return failedCount;
}
/**
* 插入销售数据的方法mongodb
* @param mapList 数据集合数组
* @param listSize 实际个数
* @param pageNumber 每页显示条数
* @return int 失败条数
*/
private int insertSaleDataByMongoDB(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);
SaleDataSaveReqDTO saleData = mapToSaleDataSaveReqDTO(currentMap);
if (!"添加成功".equals(ticketSaleDataApi.createSaleDataByMongoDB(saleData).getData())) {
failedCount++;
XxlJobHelper.log("第{}条数据插入失败,数据值为:{}", ((pageNumber - 1) * PAGE_SIZE + i + 1), currentMap);
}
}
return failedCount;
}
/**
* 插入检票数据的方法mongodb
* @param mapList 数据集合数组
* @param listSize 实际个数
* @param pageNumber 每页显示条数
* @return int 失败条数
*/
private int insertCheckTicketByMongoDB(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);
// 把获取到的数据转为插入检票的参数类型
CheckTicketSaveReqDTO checkTicket = mapToCheckTicketSaveReqDTO(currentMap);
if (!"添加成功".equals(ticketCheckTicketApi.createCheckTicketByMongoDB(checkTicket).getData())) {
SaleDataDO saleDataDO = BeanUtils.toBean(currentMap, SaleDataDO.class);
if (saleDataService.createSaleData(saleDataDO) == 0) {
failedCount++;
XxlJobHelper.log("第{}条数据插入失败,数据值为:{}", ((pageNumber - 1) * PAGE_SIZE + i + 1), currentMap);
}
@ -375,47 +327,87 @@ public class TicketDataMigration {
}
/**
* 集合转检票类型
* @param currentMap 当前集合
* @return cn.iocoder.yudao.module.ticket.api.checkticket.dto.CheckTicketSaveReqDTO 插入检票数据的参数
* 插入检票数据的方法mysql
*
* @param mapList 数据集合数组
* @param listSize 实际个数
* @param pageNumber 每页显示条数
* @return int 失败条数
*/
private CheckTicketSaveReqDTO mapToCheckTicketSaveReqDTO(Map<String, Object> currentMap){
CheckTicketSaveReqDTO checkTicket = new CheckTicketSaveReqDTO();
checkTicket.setDataId((String) currentMap.get("dataId"));
checkTicket.setTicket((String) currentMap.get("ticket"));
checkTicket.setCheckticketdate((String) currentMap.get("checkticketdate"));
checkTicket.setChecktickettime((String) currentMap.get("checktickettime"));
checkTicket.setPersoncount((Integer) currentMap.get("personcount"));
checkTicket.setCheckstation((String) currentMap.get("checkstation"));
checkTicket.setCheckstationname((String) currentMap.get("checkstationname"));
checkTicket.setSdshipping((String) currentMap.get("sdshipping"));
checkTicket.setSalepropetyvaluename((String) currentMap.get("salepropetyvaluename"));
checkTicket.setTenant_id(1L);
return checkTicket;
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;
}
/**
* 集合转售票类型
* @param currentMap 当前集合
* @return cn.iocoder.yudao.module.ticket.api.checkticket.dto.CheckTicketSaveReqDTO 插入检票数据的参数
* 插入销售数据的方法mongodb
*
* @param mapList 数据集合数组
* @param listSize 实际个数
* @param pageNumber 每页显示条数
* @return int 失败条数
*/
private SaleDataSaveReqDTO mapToSaleDataSaveReqDTO(Map<String, Object> currentMap){
SaleDataSaveReqDTO saleData = new SaleDataSaveReqDTO();
saleData.setDataId((String) currentMap.get("dataId"));
saleData.setSdno((String) currentMap.get("sdno"));
saleData.setTransactiontypeno((String) currentMap.get("transactiontypeno"));
saleData.setSddate((String) currentMap.get("sddate"));
saleData.setSdtime((String) currentMap.get("sdtime"));
saleData.setAmount(new BigDecimal(currentMap.get("amount").toString()));
saleData.setQuantity((Integer) currentMap.get("quantity"));
saleData.setCertificatetype((String) currentMap.get("certificatetype"));
saleData.setCertificateno((String) currentMap.get("certificateno"));
saleData.setProductbatchno((String) currentMap.get("productbatchno"));
saleData.setItem((String) currentMap.get("item"));
saleData.setItemtypename((String) currentMap.get("itemtypename"));
saleData.setItemtype((String) currentMap.get("itemtype"));
saleData.setItemname((String) currentMap.get("itemname"));
saleData.setSalepropetyvaluename((String) currentMap.get("salepropetyvaluename"));
saleData.setTenant_id(1L);
return saleData;
private int insertSaleDataByMongoDB(List<Map<String, Object>> mapList, int listSize, int pageNumber) {
int failedCount = 0;
int repeatingCount = 0;
for (int i = 0; i < listSize; i++) {
Map<String, Object> currentMap = mapList.get(i);
SaleData saleData = BeanUtils.toBean(currentMap, SaleData.class);
switch (saleDataService.createSaleDataByMongoDB(saleData)) {
case "添加成功":
break;
case "重复数据":
repeatingCount++;
XxlJobHelper.log("第{}条数据重复,数据值为:{}", ((pageNumber - 1) * PAGE_SIZE + i + 1), currentMap);
break;
case "Mongo数据库写入异常":
failedCount++;
XxlJobHelper.log("第{}条数据插入失败,数据值为:{}", ((pageNumber - 1) * PAGE_SIZE + i + 1), currentMap);
break;
}
}
XxlJobHelper.log("共有{}条数据重复,已跳过存储。", repeatingCount);
return failedCount;
}
/**
* 插入检票数据的方法mongodb
*
* @param mapList 数据集合数组
* @param listSize 实际个数
* @param pageNumber 每页显示条数
* @return int 失败条数
*/
private int insertCheckTicketByMongoDB(List<Map<String, Object>> mapList, int listSize, int pageNumber) {
int failedCount = 0;
int repeatingCount = 0;
for (int i = 0; i < listSize; i++) {
Map<String, Object> currentMap = mapList.get(i);
// 把获取到的数据转为插入检票的参数类型
CheckTicket checkTicket = BeanUtils.toBean(currentMap, CheckTicket.class);
switch (checkTicketService.createCheckTicketByMongoDB(checkTicket)) {
case "添加成功":
break;
case "重复数据":
repeatingCount++;
XxlJobHelper.log("第{}条数据重复,数据值为:{}", ((pageNumber - 1) * PAGE_SIZE + i + 1), currentMap);
break;
case "Mongo数据库写入异常":
failedCount++;
XxlJobHelper.log("第{}条数据插入失败,数据值为:{}", ((pageNumber - 1) * PAGE_SIZE + i + 1), currentMap);
break;
}
}
XxlJobHelper.log("共有{}条数据重复,已跳过存储。", repeatingCount);
return failedCount;
}
}

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.infra.service.ticketing.vo;
package cn.iocoder.yudao.module.infra.job.ticketing.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.infra.service.ticketing.vo;
package cn.iocoder.yudao.module.infra.job.ticketing.vo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.v3.oas.annotations.media.Schema;

View File

@ -0,0 +1,28 @@
package cn.iocoder.yudao.module.infra.service.checkticket;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.infra.controller.checkticket.vo.CheckTicketSaveReqVO;
import cn.iocoder.yudao.module.infra.dal.dataobject.checkticket.CheckTicket;
import cn.iocoder.yudao.module.infra.dal.dataobject.checkticket.CheckTicketDO;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
/**
* 检票 Service 接口
*
* @author 芋道源码
*/
public interface CheckTicketService {
/**
* 创建检票
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createCheckTicket(@Valid CheckTicketDO createReqVO);
String createCheckTicketByMongoDB(CheckTicket checkTicketSaveReqDTO);
}

View File

@ -0,0 +1,67 @@
package cn.iocoder.yudao.module.infra.service.checkticket;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.infra.dal.dataobject.checkticket.CheckTicket;
import cn.iocoder.yudao.module.infra.dal.dataobject.checkticket.CheckTicketDO;
import cn.iocoder.yudao.module.infra.dal.mongodb.checkticket.CheckTicketRepository;
import cn.iocoder.yudao.module.infra.dal.mysql.checkticket.CheckTicketMapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.dynamic.datasource.annotation.Slave;
import com.mongodb.MongoException;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.ExampleMatcher;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import static org.springframework.data.domain.ExampleMatcher.GenericPropertyMatchers.exact;
/**
* 检票 Service 实现类
*
* @author 芋道源码
*/
@Service
@Validated
public class CheckTicketServiceImpl implements CheckTicketService {
@Resource
private CheckTicketMapper checkTicketMapper;
@Resource
private CheckTicketRepository checkTicketRepository;
@Override
public Long createCheckTicket(CheckTicketDO checkTicketDO) {
// 插入
checkTicketMapper.insert(checkTicketDO);
// 返回
return checkTicketDO.getId();
}
@Override
public String createCheckTicketByMongoDB(CheckTicket checkTicket) {
try {
checkTicketRepository.findOne(Example.of(checkTicket, ExampleMatcher.matching().
withIgnorePaths("_id").withMatcher("dataId", exact())));
return "重复数据";
} catch (NoSuchElementException e) {
try {
// 执行插入操作
checkTicketRepository.insert(checkTicket);
return "添加成功";
} catch (MongoException e2) {
return "Mongo数据库写入异常";
}
}
}
}

View File

@ -0,0 +1,35 @@
package cn.iocoder.yudao.module.infra.service.saledata;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.infra.controller.saledata.vo.SaleDataPageReqVO;
import cn.iocoder.yudao.module.infra.controller.saledata.vo.SaleDataSaveReqVO;
import cn.iocoder.yudao.module.infra.dal.dataobject.saledata.SaleData;
import cn.iocoder.yudao.module.infra.dal.dataobject.saledata.SaleDataDO;
import javax.validation.Valid;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
/**
* 售票 Service 接口
*
* @author 芋道源码
*/
public interface SaleDataService {
/**
* 创建售票
*
* @param saleDataDO 创建信息
* @return 编号
*/
Long createSaleData(@Valid SaleDataDO saleDataDO);
/**
* 插入售票信息到mongodb中
* @param saleData
* @return java.lang.String
*/
String createSaleDataByMongoDB(SaleData saleData);
}

View File

@ -0,0 +1,60 @@
package cn.iocoder.yudao.module.infra.service.saledata;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.common.util.ticket.IdCardUtil;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.infra.controller.saledata.vo.SaleDataSaveReqVO;
import cn.iocoder.yudao.module.infra.dal.dataobject.saledata.SaleData;
import cn.iocoder.yudao.module.infra.dal.dataobject.saledata.SaleDataDO;
import cn.iocoder.yudao.module.infra.dal.mongodb.saledata.SaleDataRepository;
import cn.iocoder.yudao.module.infra.dal.mysql.saledata.SaleDataMapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.dynamic.datasource.annotation.Slave;
import com.mongodb.MongoException;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*;
/**
* 售票 Service 实现类
*
* @author 芋道源码
*/
@Service
@Validated
public class SaleDataServiceImpl implements SaleDataService {
@Resource
private SaleDataRepository saleDataRepository;
@Resource
private SaleDataMapper saleDataMapper;
@Override
public Long createSaleData(SaleDataDO saleDataDO) {
// 插入
saleDataMapper.insert(saleDataDO);
// 返回
return saleDataDO.getId();
}
@Override
public String createSaleDataByMongoDB(SaleData saleData) {
try {
saleDataRepository.insert(saleData);
return "添加成功";
} catch (MongoException e) {
return "Mongo数据库写入异常";
}
}
}

View File

@ -1,6 +1,9 @@
--- #################### 数据库相关配置 ####################
spring:
data:
mongodb:
uri: mongodb://root:123456@120.46.37.243:27017/admin?authMechanism=SCRAM-SHA-256
database: sn-lundu-db
# 数据源配置项
autoconfigure:
exclude:
@ -61,6 +64,10 @@ spring:
url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
username: root
password: 123456
ticketing:
url: jdbc:mysql://127.0.0.1:3306/ludu_ticketing?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
username: root
password: 123456
# Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
redis: