抽数模块和整合xxl-job
This commit is contained in:
parent
783bd5c892
commit
d0c46176de
@ -9,6 +9,7 @@ import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
@ -19,6 +20,7 @@ import java.util.Map;
|
||||
*/
|
||||
@FeignClient(name = ApiConstants.NAME)
|
||||
@Tag(name = "RPC 服务 - 任务信息管理")
|
||||
@RequestMapping("")
|
||||
public interface JobInfoApi {
|
||||
String PREFIX = ApiConstants.PREFIX + "/info";
|
||||
@GetMapping(PREFIX + "/page")
|
||||
|
@ -27,7 +27,6 @@ import java.util.Map;
|
||||
* @author xuxueli 2015-12-19 16:13:16
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/xxl-job-admin")
|
||||
public class IndexController {
|
||||
|
||||
@Resource
|
||||
|
@ -22,7 +22,7 @@ import java.util.List;
|
||||
* Created by xuxueli on 17/5/10.
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/xxl-job-admin/api")
|
||||
@RequestMapping("/api")
|
||||
public class JobApiController {
|
||||
|
||||
@Resource
|
||||
|
@ -22,7 +22,7 @@ import java.util.List;
|
||||
* @author xuxueli 2015-12-19 16:13:16
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/xxl-job-admin/jobcode")
|
||||
@RequestMapping("/jobcode")
|
||||
public class JobCodeController {
|
||||
|
||||
@Resource
|
||||
|
@ -24,7 +24,7 @@ import java.util.*;
|
||||
* @author xuxueli 2016-10-02 20:52:56
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/xxl-job-admin/jobgroup")
|
||||
@RequestMapping("/jobgroup")
|
||||
public class JobGroupController {
|
||||
|
||||
@Resource
|
||||
|
@ -33,7 +33,7 @@ import java.util.*;
|
||||
* @author xuxueli 2015-12-19 16:13:16
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/xxl-job-admin/jobinfo")
|
||||
@RequestMapping("/jobinfo")
|
||||
public class JobInfoController {
|
||||
private static Logger logger = LoggerFactory.getLogger(JobInfoController.class);
|
||||
|
||||
|
@ -38,7 +38,7 @@ import java.util.Map;
|
||||
* @author xuxueli 2015-12-19 16:13:16
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/xxl-job-admin/joblog")
|
||||
@RequestMapping("/joblog")
|
||||
public class JobLogController {
|
||||
private static Logger logger = LoggerFactory.getLogger(JobLogController.class);
|
||||
|
||||
|
@ -26,7 +26,7 @@ import java.util.Map;
|
||||
* @author xuxueli 2019-05-04 16:39:50
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/xxl-job-admin/user")
|
||||
@RequestMapping("/user")
|
||||
public class UserController {
|
||||
|
||||
@Resource
|
||||
|
@ -7,8 +7,8 @@ spring:
|
||||
|
||||
server:
|
||||
port: 9090
|
||||
# servlet:
|
||||
# context-path: /xxl-job-admin
|
||||
servlet:
|
||||
context-path: /xxl-job-admin
|
||||
|
||||
# 日志文件配置。注意,如果 logging.file.name 不放在 bootstrap.yaml 配置文件,而是放在 application.yaml 中,会导致出现 LOG_FILE_IS_UNDEFINED 文件
|
||||
logging:
|
||||
|
@ -13,11 +13,12 @@
|
||||
|
||||
<name>${project.artifactId}</name>
|
||||
<description>
|
||||
ticket 模块,我们票务业务。
|
||||
例如说:设备管理等等
|
||||
sampling 模块,我们抽数模块。
|
||||
例如说:检票和售票的数据抽数等等
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
<!-- 定时任务 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>ludu-job-core</artifactId>
|
||||
|
@ -1,6 +1,8 @@
|
||||
package cn.iocoder.yudao.module.sampling.framework.rpc.config;
|
||||
|
||||
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 org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@ -8,6 +10,6 @@ import org.springframework.context.annotation.Configuration;
|
||||
* @Description TODO
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableFeignClients(clients = {TicketAssetApi.class})
|
||||
@EnableFeignClients(clients = {TicketAssetApi.class, TicketSaleDataApi.class, TicketCheckTicketApi.class})
|
||||
public class RpcConfiguration {
|
||||
}
|
||||
|
@ -1,33 +0,0 @@
|
||||
package cn.iocoder.yudao.module.sampling.job;
|
||||
|
||||
import com.xxl.job.core.biz.model.ReturnT;
|
||||
import com.xxl.job.core.handler.IJobHandler;
|
||||
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
*/
|
||||
@Component
|
||||
public class DemoJob extends IJobHandler {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
private final AtomicInteger counts = new AtomicInteger();
|
||||
@XxlJob("demoJob")
|
||||
public ReturnT<String> demoJobHandler(String param) throws Exception {
|
||||
logger.info("XXL-JOB, Hello World.");
|
||||
System.out.println("zxxxx");
|
||||
logger.info("XXL-JOB, Hello World end.");
|
||||
return ReturnT.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() throws Exception {
|
||||
|
||||
}
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
package cn.iocoder.yudao.module.sampling.service;
|
||||
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.xxl.job.core.context.XxlJobHelper;
|
||||
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* @Description 抽数服务
|
||||
*/
|
||||
@Component
|
||||
public class SamplingJob {
|
||||
private static Logger logger = LoggerFactory.getLogger(SamplingJob.class);
|
||||
@XxlJob("getSaleData")
|
||||
public void demoJobHandler() throws Exception {
|
||||
XxlJobHelper.log("XXL-JOB, Hello World.");
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
map.put("service", "apiSaleService");
|
||||
map.put("method", "SaleDetail");
|
||||
map.put("queryDate", "20240704");
|
||||
map.put("pageNumber", 1);
|
||||
map.put("pageSize", 2000);
|
||||
String str = HttpUtil.post("http://shinanlundu.pro.jiutianda.com/joytime-erp-eportal/console/openapi/handler", JSONUtil.toJsonStr(map));
|
||||
|
||||
/*System.out.println(str);
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
com.example.snlundu.domain.Test data = objectMapper.readValue(str, com.example.snlundu.domain.Test.class);
|
||||
// HeartbeatLog data = objectMapper.readValue(str, HeartbeatLog.class);
|
||||
for (Map<String, Object> stringObjectMap : data.getDataMapList()) {
|
||||
SaleData saleData=new SaleData();
|
||||
saleData.setDataId((String)stringObjectMap.get("dataId"));
|
||||
saleData.setSdno((String)stringObjectMap.get("sdno"));
|
||||
saleData.setTransactiontypeno((String)stringObjectMap.get("transactiontypeno"));
|
||||
saleData.setSddate((String)stringObjectMap.get("sddate"));
|
||||
saleData.setSdtime((String)stringObjectMap.get("sdtime"));
|
||||
BigDecimal amountString = new BigDecimal(stringObjectMap.get("amount").toString());
|
||||
saleData.setAmount(amountString);
|
||||
Integer quantity = (Integer) stringObjectMap.get("quantity");
|
||||
saleData.setQuantity(quantity);
|
||||
saleData.setCertificatetype((String)stringObjectMap.get("certificatetype"));
|
||||
saleData.setCertificateno((String)stringObjectMap.get("certificateno"));
|
||||
saleData.setProductbatchno((String)stringObjectMap.get("productbatchno"));
|
||||
saleData.setItem((String)stringObjectMap.get("item"));
|
||||
saleData.setItemtypename((String)stringObjectMap.get("itemtypename"));
|
||||
saleData.setItemtype((String)stringObjectMap.get("itemtype"));
|
||||
saleData.setItemname((String)stringObjectMap.get("itemname"));
|
||||
saleData.setSalepropetyvaluename((String)stringObjectMap.get("salepropetyvaluename"));
|
||||
saleDataRepository.save(saleData);
|
||||
}*/
|
||||
// default success
|
||||
}
|
||||
}
|
@ -0,0 +1,132 @@
|
||||
package cn.iocoder.yudao.module.sampling.service.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.sampling.service.ticketing.vo.TicketingSamplingReqVO;
|
||||
import cn.iocoder.yudao.module.sampling.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 com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.xxl.job.core.context.XxlJobHelper;
|
||||
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description 抽数服务
|
||||
*/
|
||||
@Component
|
||||
public class TicketingSamplingJob {
|
||||
private static Logger logger = LoggerFactory.getLogger(TicketingSamplingJob.class);
|
||||
|
||||
private static final int PAGE_SIZE = 500;
|
||||
@Resource
|
||||
private TicketSaleDataApi ticketSaleDataApi;
|
||||
|
||||
@Resource
|
||||
private TicketCheckTicketApi ticketCheckTicketApi;
|
||||
|
||||
@XxlJob("getSaleData")
|
||||
public void getSaleDataHandler() throws Exception {
|
||||
int failedCount = 0;
|
||||
int pageNumber = 1;
|
||||
XxlJobHelper.log("抽数服务:销售数据开始抽数...");
|
||||
// 准备请求参数
|
||||
TicketingSamplingReqVO ticketingSamplingReqVO = new TicketingSamplingReqVO();
|
||||
ticketingSamplingReqVO.setService("apiSaleService");
|
||||
ticketingSamplingReqVO.setMethod("SaleDetail");
|
||||
ticketingSamplingReqVO.setQueryDate(TickingDateUtils.getNowDayFormat());
|
||||
ticketingSamplingReqVO.setPageNumber(pageNumber);
|
||||
ticketingSamplingReqVO.setPageSize(PAGE_SIZE);
|
||||
// 先发起第一次请求
|
||||
String str = HttpUtil.post("http://shinanlundu.pro.jiutianda.com/joytime-erp-eportal/console/openapi/handler", JSONUtil.toJsonStr(ticketingSamplingReqVO));
|
||||
// 解析读取响应数据
|
||||
TicketingSamplingRespVO ticketingSamplingRespVO = new ObjectMapper().readValue(str, TicketingSamplingRespVO.class);
|
||||
// 如果访问失败则让调度中心重新调用
|
||||
if (!ticketingSamplingRespVO.isPassflag()) {
|
||||
// 让调度中心重新调用
|
||||
XxlJobHelper.log("抽数服务:销售数据抽数失败,返回消息:" + ticketingSamplingRespVO.getRtnMsg());
|
||||
XxlJobHelper.handleFail("销售数据抽数失败,请重试");
|
||||
return;
|
||||
}
|
||||
int totalRows = ticketingSamplingRespVO.getTotalRows();
|
||||
List<Map<String, Object>> mapList = ticketingSamplingRespVO.getDataMapList();
|
||||
// 总条数小于等于每页条数 则直接按照总条数进行插入即可
|
||||
if (totalRows <= PAGE_SIZE) {
|
||||
for (int i = 0; i < ticketingSamplingRespVO.getTotalRows(); i++) {
|
||||
Map<String, Object> currentMap = mapList.get(i);
|
||||
// 装配数据
|
||||
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);
|
||||
if (ticketSaleDataApi.createSaleData(saleData).getCode() != 0) {
|
||||
failedCount++;
|
||||
XxlJobHelper.log("第{}条数据插入失败,数据值为:{}", ((pageNumber - 1) * PAGE_SIZE + i + 1), currentMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO 由于小于大于都要执行第一次插入数据,只是长度不同,同时小于执行完直接return就行
|
||||
// 总条数大于每页条数 执行完第一次插入后根据返回的页数继续进行请求和插入
|
||||
for (int i = pageNumber; i <= totalRows; i++) {
|
||||
// 请求
|
||||
// 插入
|
||||
}
|
||||
|
||||
XxlJobHelper.log("抽数服务:销售数据抽数正常结束!总共:{}条数据,{}条数据插入失败!", totalRows, failedCount);
|
||||
}
|
||||
|
||||
@XxlJob("getCheckTicket")
|
||||
public void getCheckTicketHandler() throws Exception {
|
||||
XxlJobHelper.log("抽数服务:检票数据开始抽数");
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("service", "apiCheckService");
|
||||
map.put("method", "CheckDetail");
|
||||
map.put("queryDate", "20240707");
|
||||
map.put("pageNumber", 1);
|
||||
map.put("pageSize", 2000);
|
||||
String str = HttpUtil.post("http://shinanlundu.pro.jiutianda.com/joytime-erp-eportal/console/openapi/handler", JSONUtil.toJsonStr(map));
|
||||
TicketingSamplingRespVO ticketingSamplingRespVO = new ObjectMapper().readValue(str, TicketingSamplingRespVO.class);
|
||||
int successNum = 0;
|
||||
for (Map<String, Object> stringObjectMap : ticketingSamplingRespVO.getDataMapList()) {
|
||||
|
||||
CheckTicketSaveReqDTO checkTicket = new CheckTicketSaveReqDTO();
|
||||
checkTicket.setDataId((String) stringObjectMap.get("dataId"));
|
||||
checkTicket.setTicket((String) stringObjectMap.get("ticket"));
|
||||
checkTicket.setCheckticketdate((String) stringObjectMap.get("checkticketdate"));
|
||||
checkTicket.setChecktickettime((String) stringObjectMap.get("checktickettime"));
|
||||
checkTicket.setPersoncount((Integer) stringObjectMap.get("personcount"));
|
||||
checkTicket.setCheckstation((String) stringObjectMap.get("checkstation"));
|
||||
checkTicket.setCheckstationname((String) stringObjectMap.get("checkstationname"));
|
||||
checkTicket.setSdshipping((String) stringObjectMap.get("sdshipping"));
|
||||
checkTicket.setSalepropetyvaluename((String) stringObjectMap.get("salepropetyvaluename"));
|
||||
checkTicket.setTenant_id(1L);
|
||||
ticketCheckTicketApi.createCheckTicket(checkTicket);
|
||||
successNum++;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package cn.iocoder.yudao.module.sampling.service.ticketing.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Description 票务抽数请求实体类
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "票务抽数请求类")
|
||||
public class TicketingSamplingReqVO {
|
||||
@Schema(description = "服务名")
|
||||
private String service;
|
||||
@Schema(description = "方法名")
|
||||
private String method;
|
||||
@Schema(description = "查询日期")
|
||||
private String queryDate;
|
||||
@Schema(description = "分页,第几页")
|
||||
private Integer pageNumber;
|
||||
@Schema(description = "分页,每页多少条,每页最多2000条")
|
||||
private Integer pageSize;
|
||||
@Schema(description = "开始时间")
|
||||
private String startTime;
|
||||
@Schema(description = "结束时间")
|
||||
private String endTime;
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package cn.iocoder.yudao.module.sampling.service.ticketing.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description 票务抽数响应实体类
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "票务抽数响应类")
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class TicketingSamplingRespVO {
|
||||
@Schema(description = "接口访问是否成功")
|
||||
private boolean passflag;
|
||||
@Schema(description = "提示信息")
|
||||
private String rtnMsg;
|
||||
@Schema(description = "分页,第几页")
|
||||
private Integer pageNumber;
|
||||
@Schema(description = "分页,每页多少条,每页最多2000条")
|
||||
private Integer pageSize;
|
||||
@Schema(description = "总条数")
|
||||
private Integer totalRows;
|
||||
@Schema(description = "数据数组")
|
||||
private List<Map<String,Object>> dataMapList;
|
||||
}
|
@ -1,13 +1,18 @@
|
||||
package cn.iocoder.yudao.module.ticket.api.checkticket;
|
||||
|
||||
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;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
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.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -23,5 +28,7 @@ public interface TicketCheckTicketApi {
|
||||
@GetMapping(PREFIX + "/qushi/{day}")
|
||||
@Operation(summary = "获取日期当天各个时段的检票人数")
|
||||
public CommonResult<List<Map<String, String>>> findbytimetemp(@PathVariable("day") String day);
|
||||
|
||||
@PostMapping(PREFIX + "/create")
|
||||
@Operation(summary = "插入检票记录")
|
||||
public CommonResult<Long> createCheckTicket(@Valid @RequestBody CheckTicketSaveReqDTO checkTicketSaveReqDTO);
|
||||
}
|
||||
|
@ -0,0 +1,40 @@
|
||||
package cn.iocoder.yudao.module.ticket.api.checkticket.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 检票新增/修改 Request VO")
|
||||
@Data
|
||||
public class CheckTicketSaveReqDTO {
|
||||
@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;
|
||||
}
|
@ -1,13 +1,17 @@
|
||||
package cn.iocoder.yudao.module.ticket.api.saledata;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
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;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
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.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -60,4 +64,8 @@ public interface TicketSaleDataApi {
|
||||
@GetMapping(PREFIX + "/lastyear/nianjun")
|
||||
@Operation(summary = "查询去年年度售票平均金额")
|
||||
public CommonResult<BigDecimal> findmoneylastyear();
|
||||
|
||||
@PostMapping(PREFIX + "/create")
|
||||
@Operation(summary = "插入售票记录")
|
||||
public CommonResult<Long> createSaleData(@Valid @RequestBody SaleDataSaveReqDTO saleDataSaveReqDTO);
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package cn.iocoder.yudao.module.ticket.api.saledata.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
*/
|
||||
@Schema(description = "RPC 服务 - 销售数据 Request DTO")
|
||||
@Data
|
||||
public class SaleDataSaveReqDTO {
|
||||
@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;
|
||||
|
||||
}
|
@ -1,6 +1,9 @@
|
||||
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.service.checkticket.CheckTicketService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@ -28,4 +31,9 @@ public class TicketCheckTicketApiImpl implements TicketCheckTicketApi{
|
||||
public CommonResult<List<Map<String, String>>> findbytimetemp(String day) {
|
||||
return success(checkTicketService.findbytimetemp(day));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<Long> createCheckTicket(CheckTicketSaveReqDTO checkTicketSaveReqDTO) {
|
||||
return success(checkTicketService.createCheckTicket(BeanUtils.toBean(checkTicketSaveReqDTO, CheckTicketSaveReqVO.class)));
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,17 @@
|
||||
package cn.iocoder.yudao.module.ticket.api.saledata;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.ticket.api.saledata.dto.SaleDataSaveReqDTO;
|
||||
import cn.iocoder.yudao.module.ticket.controller.admin.saledata.vo.SaleDataSaveReqVO;
|
||||
import cn.iocoder.yudao.module.ticket.dal.dataobject.saledata.SaleDataDO;
|
||||
import cn.iocoder.yudao.module.ticket.service.saledata.SaleDataService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -91,4 +96,9 @@ public class TicketSaleDataApiImpl implements TicketSaleDataApi{
|
||||
public CommonResult<BigDecimal> findmoneylastyear() {
|
||||
return success(saleDataService.findyearJun(saleDataService.findEventsLastYear()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<Long> createSaleData(@Valid @RequestBody SaleDataSaveReqDTO saleDataSaveReqDTO) {
|
||||
return success(saleDataService.createSaleData(BeanUtils.toBean(saleDataSaveReqDTO, SaleDataSaveReqVO.class)));
|
||||
}
|
||||
}
|
||||
|
@ -35,4 +35,6 @@ public class CheckTicketSaveReqVO {
|
||||
@Schema(description = "销售特征名称(票种名称)", example = "张三")
|
||||
private String salepropetyvaluename;
|
||||
|
||||
@Schema(description = "租户编号")
|
||||
private Long tenant_id;
|
||||
}
|
@ -1,6 +1,8 @@
|
||||
package cn.iocoder.yudao.module.ticket.controller.admin.saledata.vo;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
@ -22,7 +24,7 @@ public class SaleDataPageReqVO extends PageParam {
|
||||
private String dataId;
|
||||
|
||||
@Schema(description = "金额")
|
||||
private Long amount;
|
||||
private BigDecimal amount;
|
||||
|
||||
@Schema(description = "证件号")
|
||||
private String certificateno;
|
||||
|
@ -2,6 +2,8 @@ package cn.iocoder.yudao.module.ticket.controller.admin.saledata.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.*;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
@ -21,7 +23,7 @@ public class SaleDataRespVO {
|
||||
|
||||
@Schema(description = "金额")
|
||||
@ExcelProperty("金额")
|
||||
private Long amount;
|
||||
private BigDecimal amount;
|
||||
|
||||
@Schema(description = "证件号")
|
||||
@ExcelProperty("证件号")
|
||||
|
@ -2,6 +2,8 @@ package cn.iocoder.yudao.module.ticket.controller.admin.saledata.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@ -14,7 +16,7 @@ public class SaleDataSaveReqVO {
|
||||
private String dataId;
|
||||
|
||||
@Schema(description = "金额")
|
||||
private Long amount;
|
||||
private BigDecimal amount;
|
||||
|
||||
@Schema(description = "证件号")
|
||||
private String certificateno;
|
||||
@ -55,4 +57,7 @@ public class SaleDataSaveReqVO {
|
||||
@Schema(description = "销售特征名称(票种名称)", example = "赵六")
|
||||
private String salepropetyvaluename;
|
||||
|
||||
@Schema(description = "租户编号")
|
||||
private Long tenant_id;
|
||||
|
||||
}
|
@ -46,12 +46,15 @@ public class AssetDO extends BaseDO {
|
||||
/**
|
||||
* 设备状态
|
||||
*
|
||||
* 枚举 {@link TODO asset_status_type 对应的类}
|
||||
* 枚举 {asset_status_type 对应的类}
|
||||
*/
|
||||
private String isOnline;
|
||||
/**
|
||||
* 最后一次反馈时间
|
||||
*/
|
||||
private Long lastfeedbacktime;
|
||||
|
||||
/**
|
||||
* 租户编号
|
||||
*/
|
||||
private Long tenant_id;
|
||||
}
|
@ -63,5 +63,8 @@ public class CheckTicketDO extends BaseDO {
|
||||
* 销售特征名称(票种名称)
|
||||
*/
|
||||
private String salepropetyvaluename;
|
||||
|
||||
/**
|
||||
* 租户编号
|
||||
*/
|
||||
private Long tenant_id;
|
||||
}
|
@ -90,4 +90,9 @@ public class SaleDataDO extends BaseDO {
|
||||
*/
|
||||
private String salepropetyvaluename;
|
||||
|
||||
/**
|
||||
* 租户编号
|
||||
*/
|
||||
private Long tenant_id;
|
||||
|
||||
}
|
1
pom.xml
1
pom.xml
@ -19,7 +19,6 @@
|
||||
<module>ludu-module-sampling</module>
|
||||
<module>ludu-module-sampling/ludu-module-sampling-api</module>
|
||||
<module>ludu-module-sampling/ludu-module-sampling-biz</module>
|
||||
<module>ludu-job-core</module>
|
||||
<module>ludu-job-admin</module>
|
||||
<module>ludu-job-admin/ludu-job-admin-biz</module>
|
||||
<!-- <module>yudao-module-bpm</module>-->
|
||||
|
@ -2,8 +2,8 @@
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>yudao</artifactId>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-framework</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<artifactId>ludu-job-core</artifactId>
|
@ -31,6 +31,7 @@
|
||||
<module>yudao-spring-boot-starter-biz-tenant</module>
|
||||
<module>yudao-spring-boot-starter-biz-data-permission</module>
|
||||
<module>yudao-spring-boot-starter-biz-ip</module>
|
||||
<module>ludu-job-core</module>
|
||||
</modules>
|
||||
|
||||
<artifactId>yudao-framework</artifactId>
|
||||
|
@ -0,0 +1,38 @@
|
||||
package cn.iocoder.yudao.framework.common.util.date;
|
||||
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Description 票务模块时间工具类
|
||||
*/
|
||||
public class TickingDateUtils {
|
||||
// yyyyMMdd
|
||||
public static final String timeFormat = DatePattern.PURE_DATE_PATTERN;
|
||||
|
||||
public static SimpleDateFormat simpleDateFormat = new SimpleDateFormat(timeFormat);
|
||||
|
||||
private TickingDateUtils() {
|
||||
}
|
||||
|
||||
public static Date parse(String time) {
|
||||
Date parseDate = null;
|
||||
try {
|
||||
parseDate = simpleDateFormat.parse(time);
|
||||
} catch (ParseException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return parseDate;
|
||||
}
|
||||
|
||||
public static String format(Date date){
|
||||
return simpleDateFormat.format(date);
|
||||
}
|
||||
|
||||
public static String getNowDayFormat(){
|
||||
return TickingDateUtils.format(new Date());
|
||||
}
|
||||
}
|
@ -148,6 +148,7 @@ public class YudaoWebSecurityConfigurerAdapter {
|
||||
// // ③:兜底规则,必须认证
|
||||
// .authorizeRequests()
|
||||
// .anyRequest().authenticated();
|
||||
// TODO 暂时先放行,用于调度中心后台查看
|
||||
httpSecurity.authorizeRequests().anyRequest().permitAll();
|
||||
|
||||
// 添加 Token Filter
|
||||
|
@ -24,6 +24,11 @@
|
||||
<artifactId>ludu-job-admin-api</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>ludu-job-core</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<!-- Spring Cloud 基础 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
@ -97,11 +102,7 @@
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-job</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>ludu-job-core</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- 消息队列相关 -->
|
||||
<dependency>
|
||||
|
@ -30,8 +30,8 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.error;
|
||||
@RequestMapping("/infra/job")
|
||||
@Validated
|
||||
public class JobController {
|
||||
@Resource
|
||||
private JobInfoApi jobInfoApi;
|
||||
/*@Resource
|
||||
private JobInfoApi jobInfoApi;*/
|
||||
|
||||
// private static final String XXL_JOB_URL = "http://127.0.0.1:9090/xxl-job-admin";
|
||||
// private static final String USERNAME = "admin"; // TODO 可以直接读取配置中的账号和密码
|
||||
@ -53,13 +53,13 @@ public class JobController {
|
||||
// TODO 如果登录失败,则不会有Set-Cookie的值,抛出异常,使用全局异常处理类
|
||||
}
|
||||
}*/
|
||||
|
||||
@GetMapping("/page")
|
||||
// TODO 出现未知错误 JobInfoApi 无法创建 bean
|
||||
/*@GetMapping("/page")
|
||||
@Operation(summary = "获得定时任务分页")
|
||||
@PreAuthorize("@ss.hasPermission('infra:job:query')")
|
||||
public CommonResult<PageResult<JobInfoRespDTO>> getJobPage(@RequestParam(value = "pageNo") Integer pageNo, @RequestParam(value = "pageSize") Integer pageSize, @RequestParam(required = false, value = "name") String name, @RequestParam(required = false, value = "status") Integer status, @RequestParam(required = false, value = "handlerName") String handlerName) {
|
||||
return jobInfoApi.getPage(pageNo, pageSize, name, status, handlerName);
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
package cn.iocoder.yudao.module.member.api.address;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.member.api.address.dto.MemberAddressRespDTO;
|
||||
import cn.iocoder.yudao.module.member.convert.address.MemberAddressApi;
|
||||
import cn.iocoder.yudao.module.member.convert.address.dto.MemberAddressRespDTO;
|
||||
import cn.iocoder.yudao.module.member.convert.address.AddressConvert;
|
||||
import cn.iocoder.yudao.module.member.service.address.AddressService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package cn.iocoder.yudao.module.member.convert.address;
|
||||
|
||||
import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils;
|
||||
import cn.iocoder.yudao.module.member.api.address.dto.MemberAddressRespDTO;
|
||||
import cn.iocoder.yudao.module.member.convert.address.dto.MemberAddressRespDTO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.address.vo.AddressRespVO;
|
||||
import cn.iocoder.yudao.module.member.controller.app.address.vo.AppAddressCreateReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.app.address.vo.AppAddressRespVO;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package cn.iocoder.yudao.module.member.api.address;
|
||||
package cn.iocoder.yudao.module.member.convert.address;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.member.api.address.dto.MemberAddressRespDTO;
|
||||
import cn.iocoder.yudao.module.member.convert.address.dto.MemberAddressRespDTO;
|
||||
import cn.iocoder.yudao.module.member.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
@ -1,4 +1,4 @@
|
||||
package cn.iocoder.yudao.module.member.api.address.dto;
|
||||
package cn.iocoder.yudao.module.member.convert.address.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
Loading…
Reference in New Issue
Block a user