合并更新 #1
@ -18,8 +18,6 @@ public class SecurityConfiguration {
|
||||
|
||||
@Override
|
||||
public void customize(ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry registry) {
|
||||
// TODO 暂时放行所有,用于测试
|
||||
registry.antMatchers("/**").permitAll();
|
||||
// Swagger 接口文档
|
||||
registry.antMatchers("/v3/api-docs/**").permitAll() // 元数据
|
||||
.antMatchers("/swagger-ui.html").permitAll(); // Swagger UI
|
||||
|
@ -31,4 +31,7 @@ public interface TicketCheckTicketApi {
|
||||
@PostMapping(PREFIX + "/create")
|
||||
@Operation(summary = "插入检票记录")
|
||||
public CommonResult<Long> createCheckTicket(@Valid @RequestBody CheckTicketSaveReqDTO checkTicketSaveReqDTO);
|
||||
@PostMapping(PREFIX + "/createByMongoDB")
|
||||
@Operation(summary = "插入MongoDB检票记录")
|
||||
public CommonResult<String> createCheckTicketByMongoDB(@RequestBody CheckTicketSaveReqDTO checkTicketSaveReqDTO);
|
||||
}
|
||||
|
@ -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<Long> createSaleData(@Valid @RequestBody SaleDataSaveReqDTO saleDataSaveReqDTO);
|
||||
@PostMapping(PREFIX + "/createByMongoDB")
|
||||
@Operation(summary = "插入MongoDB检票记录")
|
||||
public CommonResult<String> createSaleDataByMongoDB(@RequestBody SaleDataSaveReqDTO saleDataSaveReqDTO);
|
||||
}
|
@ -26,6 +26,11 @@
|
||||
<artifactId>ludu-module-ticketing-api</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<!-- mongodb -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-mongodb</artifactId>
|
||||
</dependency>
|
||||
<!-- Spring Cloud 基础 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
|
@ -36,4 +36,12 @@ public class TicketCheckTicketApiImpl implements TicketCheckTicketApi{
|
||||
public CommonResult<Long> createCheckTicket(CheckTicketSaveReqDTO checkTicketSaveReqDTO) {
|
||||
return success(checkTicketService.createCheckTicket(BeanUtils.toBean(checkTicketSaveReqDTO, CheckTicketSaveReqVO.class)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<String> createCheckTicketByMongoDB(CheckTicketSaveReqDTO checkTicketSaveReqDTO) {
|
||||
return success(checkTicketService.createCheckTicketByMongoDB(checkTicketSaveReqDTO));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -101,4 +101,9 @@ public class TicketSaleDataApiImpl implements TicketSaleDataApi{
|
||||
public CommonResult<Long> createSaleData(@Valid @RequestBody SaleDataSaveReqDTO saleDataSaveReqDTO) {
|
||||
return success(saleDataService.createSaleData(BeanUtils.toBean(saleDataSaveReqDTO, SaleDataSaveReqVO.class)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<String> createSaleDataByMongoDB(SaleDataSaveReqDTO saleDataSaveReqDTO) {
|
||||
return success(saleDataService.createSaleDataByMongoDB(saleDataSaveReqDTO));
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
}
|
@ -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<CheckTicket,String> {
|
||||
}
|
@ -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<SaleData,String> {
|
||||
|
||||
}
|
@ -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);
|
||||
}
|
@ -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 "添加成功";
|
||||
}
|
||||
|
||||
}
|
@ -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<SaleDataDO> list);
|
||||
|
||||
String createSaleDataByMongoDB(SaleDataSaveReqDTO saleDataSaveReqDTO);
|
||||
}
|
@ -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 "添加成功";
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user