diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/framework/security/config/SecurityConfiguration.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/framework/security/config/SecurityConfiguration.java index 921644e67..725273fb6 100644 --- a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/framework/security/config/SecurityConfiguration.java +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/framework/security/config/SecurityConfiguration.java @@ -18,8 +18,6 @@ public class SecurityConfiguration { @Override public void customize(ExpressionUrlAuthorizationConfigurer.ExpressionInterceptUrlRegistry registry) { - // TODO 暂时放行所有,用于测试 - registry.antMatchers("/**").permitAll(); // Swagger 接口文档 registry.antMatchers("/v3/api-docs/**").permitAll() // 元数据 .antMatchers("/swagger-ui.html").permitAll(); // Swagger UI diff --git a/ludu-module-ticketing/ludu-module-ticketing-api/src/main/java/cn/iocoder/yudao/module/ticket/api/checkticket/TicketCheckTicketApi.java b/ludu-module-ticketing/ludu-module-ticketing-api/src/main/java/cn/iocoder/yudao/module/ticket/api/checkticket/TicketCheckTicketApi.java index d00fccbbf..d36024018 100644 --- a/ludu-module-ticketing/ludu-module-ticketing-api/src/main/java/cn/iocoder/yudao/module/ticket/api/checkticket/TicketCheckTicketApi.java +++ b/ludu-module-ticketing/ludu-module-ticketing-api/src/main/java/cn/iocoder/yudao/module/ticket/api/checkticket/TicketCheckTicketApi.java @@ -31,4 +31,7 @@ public interface TicketCheckTicketApi { @PostMapping(PREFIX + "/create") @Operation(summary = "插入检票记录") public CommonResult createCheckTicket(@Valid @RequestBody CheckTicketSaveReqDTO checkTicketSaveReqDTO); + @PostMapping(PREFIX + "/createByMongoDB") + @Operation(summary = "插入MongoDB检票记录") + public CommonResult createCheckTicketByMongoDB(@RequestBody CheckTicketSaveReqDTO checkTicketSaveReqDTO); } diff --git a/ludu-module-ticketing/ludu-module-ticketing-api/src/main/java/cn/iocoder/yudao/module/ticket/api/saledata/TicketSaleDataApi.java b/ludu-module-ticketing/ludu-module-ticketing-api/src/main/java/cn/iocoder/yudao/module/ticket/api/saledata/TicketSaleDataApi.java index af86a0ca5..30a19cda1 100644 --- a/ludu-module-ticketing/ludu-module-ticketing-api/src/main/java/cn/iocoder/yudao/module/ticket/api/saledata/TicketSaleDataApi.java +++ b/ludu-module-ticketing/ludu-module-ticketing-api/src/main/java/cn/iocoder/yudao/module/ticket/api/saledata/TicketSaleDataApi.java @@ -1,6 +1,7 @@ package cn.iocoder.yudao.module.ticket.api.saledata; import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.module.ticket.api.checkticket.dto.CheckTicketSaveReqDTO; import cn.iocoder.yudao.module.ticket.api.saledata.dto.SaleDataSaveReqDTO; import cn.iocoder.yudao.module.ticket.enums.ApiConstants; import io.swagger.v3.oas.annotations.Operation; @@ -68,4 +69,7 @@ public interface TicketSaleDataApi { @PostMapping(PREFIX + "/create") @Operation(summary = "插入售票记录") public CommonResult createSaleData(@Valid @RequestBody SaleDataSaveReqDTO saleDataSaveReqDTO); + @PostMapping(PREFIX + "/createByMongoDB") + @Operation(summary = "插入MongoDB检票记录") + public CommonResult createSaleDataByMongoDB(@RequestBody SaleDataSaveReqDTO saleDataSaveReqDTO); } \ No newline at end of file diff --git a/ludu-module-ticketing/ludu-module-ticketing-biz/pom.xml b/ludu-module-ticketing/ludu-module-ticketing-biz/pom.xml index 6f5dfae96..a7ddb0126 100644 --- a/ludu-module-ticketing/ludu-module-ticketing-biz/pom.xml +++ b/ludu-module-ticketing/ludu-module-ticketing-biz/pom.xml @@ -26,6 +26,11 @@ ludu-module-ticketing-api ${revision} + + + org.springframework.boot + spring-boot-starter-data-mongodb + org.springframework.cloud diff --git a/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/api/checkticket/TicketCheckTicketApiImpl.java b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/api/checkticket/TicketCheckTicketApiImpl.java index 1fcd2a4c8..e36ae057c 100644 --- a/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/api/checkticket/TicketCheckTicketApiImpl.java +++ b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/api/checkticket/TicketCheckTicketApiImpl.java @@ -36,4 +36,12 @@ public class TicketCheckTicketApiImpl implements TicketCheckTicketApi{ public CommonResult createCheckTicket(CheckTicketSaveReqDTO checkTicketSaveReqDTO) { return success(checkTicketService.createCheckTicket(BeanUtils.toBean(checkTicketSaveReqDTO, CheckTicketSaveReqVO.class))); } + + @Override + public CommonResult createCheckTicketByMongoDB(CheckTicketSaveReqDTO checkTicketSaveReqDTO) { + return success(checkTicketService.createCheckTicketByMongoDB(checkTicketSaveReqDTO)); + } + + + } diff --git a/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/api/saledata/TicketSaleDataApiImpl.java b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/api/saledata/TicketSaleDataApiImpl.java index c6cfc6bdc..e23109819 100644 --- a/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/api/saledata/TicketSaleDataApiImpl.java +++ b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/api/saledata/TicketSaleDataApiImpl.java @@ -101,4 +101,9 @@ public class TicketSaleDataApiImpl implements TicketSaleDataApi{ public CommonResult createSaleData(@Valid @RequestBody SaleDataSaveReqDTO saleDataSaveReqDTO) { return success(saleDataService.createSaleData(BeanUtils.toBean(saleDataSaveReqDTO, SaleDataSaveReqVO.class))); } + + @Override + public CommonResult createSaleDataByMongoDB(SaleDataSaveReqDTO saleDataSaveReqDTO) { + return success(saleDataService.createSaleDataByMongoDB(saleDataSaveReqDTO)); + } } diff --git a/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/dal/dataobject/checkticket/CheckTicket.java b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/dal/dataobject/checkticket/CheckTicket.java new file mode 100644 index 000000000..8808e1bc3 --- /dev/null +++ b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/dal/dataobject/checkticket/CheckTicket.java @@ -0,0 +1,20 @@ +package cn.iocoder.yudao.module.ticket.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; + +} diff --git a/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/dal/dataobject/saledata/SaleData.java b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/dal/dataobject/saledata/SaleData.java new file mode 100644 index 000000000..a6b7ff926 --- /dev/null +++ b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/dal/dataobject/saledata/SaleData.java @@ -0,0 +1,27 @@ +package cn.iocoder.yudao.module.ticket.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; +} diff --git a/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/dal/mongodb/checkticket/CheckTicketRepository.java b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/dal/mongodb/checkticket/CheckTicketRepository.java new file mode 100644 index 000000000..6048de6d1 --- /dev/null +++ b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/dal/mongodb/checkticket/CheckTicketRepository.java @@ -0,0 +1,10 @@ +package cn.iocoder.yudao.module.ticket.dal.mongodb.checkticket; + + +import cn.iocoder.yudao.module.ticket.dal.dataobject.checkticket.CheckTicket; +import org.springframework.data.mongodb.repository.MongoRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface CheckTicketRepository extends MongoRepository { +} diff --git a/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/dal/mongodb/saledata/SaleDataRepository.java b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/dal/mongodb/saledata/SaleDataRepository.java new file mode 100644 index 000000000..9a60b5ac6 --- /dev/null +++ b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/dal/mongodb/saledata/SaleDataRepository.java @@ -0,0 +1,11 @@ +package cn.iocoder.yudao.module.ticket.dal.mongodb.saledata; + + +import cn.iocoder.yudao.module.ticket.dal.dataobject.saledata.SaleData; +import org.springframework.data.mongodb.repository.MongoRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface SaleDataRepository extends MongoRepository { + +} diff --git a/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/service/checkticket/CheckTicketService.java b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/service/checkticket/CheckTicketService.java index 8a6446fb1..74822dd7f 100644 --- a/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/service/checkticket/CheckTicketService.java +++ b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/service/checkticket/CheckTicketService.java @@ -2,6 +2,7 @@ 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.dal.dataobject.checkticket.CheckTicketDO; @@ -70,4 +71,6 @@ public interface CheckTicketService { * @return long 检票人数 */ public long checkTicketTotal(String day); + + String createCheckTicketByMongoDB(CheckTicketSaveReqDTO checkTicketSaveReqDTO); } \ No newline at end of file diff --git a/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/service/checkticket/CheckTicketServiceImpl.java b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/service/checkticket/CheckTicketServiceImpl.java index 144af1b3b..39bafbbdd 100644 --- a/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/service/checkticket/CheckTicketServiceImpl.java +++ b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/service/checkticket/CheckTicketServiceImpl.java @@ -1,8 +1,12 @@ 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.dal.dataobject.checkticket.CheckTicket; +import cn.iocoder.yudao.module.ticket.dal.mongodb.checkticket.CheckTicketRepository; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -36,6 +40,8 @@ public class CheckTicketServiceImpl implements CheckTicketService { @Resource private CheckTicketMapper checkTicketMapper; + @Resource + private CheckTicketRepository checkTicketRepository; @Override public Long createCheckTicket(CheckTicketSaveReqVO createReqVO) { @@ -109,4 +115,14 @@ public class CheckTicketServiceImpl implements CheckTicketService { return checkTicketMapper.selectCount(wrapperX); } + @Override + public String createCheckTicketByMongoDB(CheckTicketSaveReqDTO checkTicketSaveReqDTO) { + CheckTicket checkTicket = BeanUtils.toBean(checkTicketSaveReqDTO, CheckTicket.class); + // TODO 插入失败会自动抛出异常,需要对异常进行处理 + // DuplicateKeyException:当插入的文档违反唯一索引约束时,会抛出此异常。 + // MongoWriteException:在写入操作中发生的其他错误,例如文档格式不正确或数据库连接问题。 + checkTicketRepository.insert(checkTicket); + return "添加成功"; + } + } \ No newline at end of file diff --git a/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/service/saledata/SaleDataService.java b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/service/saledata/SaleDataService.java index 0dad7cd95..61d3505a1 100644 --- a/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/service/saledata/SaleDataService.java +++ b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/service/saledata/SaleDataService.java @@ -3,6 +3,8 @@ package cn.iocoder.yudao.module.ticket.service.saledata; import java.math.BigDecimal; import java.util.*; import javax.validation.*; + +import cn.iocoder.yudao.module.ticket.api.saledata.dto.SaleDataSaveReqDTO; import cn.iocoder.yudao.module.ticket.controller.admin.saledata.vo.*; import cn.iocoder.yudao.module.ticket.dal.dataobject.saledata.SaleDataDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; @@ -130,4 +132,6 @@ public interface SaleDataService { * @return java.math.BigDecimal */ BigDecimal findyearJun(List list); + + String createSaleDataByMongoDB(SaleDataSaveReqDTO saleDataSaveReqDTO); } \ No newline at end of file diff --git a/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/service/saledata/SaleDataServiceImpl.java b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/service/saledata/SaleDataServiceImpl.java index 8efe1190a..88dde56f0 100644 --- a/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/service/saledata/SaleDataServiceImpl.java +++ b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/java/cn/iocoder/yudao/module/ticket/service/saledata/SaleDataServiceImpl.java @@ -2,7 +2,11 @@ package cn.iocoder.yudao.module.ticket.service.saledata; import cn.iocoder.yudao.framework.common.util.ticket.IdCardUtil; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.module.ticket.api.saledata.dto.SaleDataSaveReqDTO; +import cn.iocoder.yudao.module.ticket.dal.dataobject.saledata.SaleData; +import cn.iocoder.yudao.module.ticket.dal.mongodb.saledata.SaleDataRepository; import kotlin.jvm.internal.Lambda; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.Resource; import org.springframework.validation.annotation.Validated; @@ -33,7 +37,8 @@ import static cn.iocoder.yudao.module.ticket.enums.ErrorCodeConstants.*; @Service @Validated public class SaleDataServiceImpl implements SaleDataService { - + @Resource + private SaleDataRepository saleDataRepository; @Resource private SaleDataMapper saleDataMapper; @@ -427,5 +432,12 @@ public class SaleDataServiceImpl implements SaleDataService { return total; } + @Override + public String createSaleDataByMongoDB(SaleDataSaveReqDTO saleDataSaveReqDTO) { + SaleData saleData = BeanUtils.toBean(saleDataSaveReqDTO, SaleData.class); + saleDataRepository.insert(saleData); + return "添加成功"; + } + } \ No newline at end of file