You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
udi-wms-java/src/main/java/com/glxp/api/controller/TestController.java

143 lines
4.9 KiB
Java

package com.glxp.api.controller;
import cn.hutool.core.util.StrUtil;
import com.glxp.api.annotation.RepeatSubmit;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.constant.Constant;
import com.glxp.api.dao.thrsys.ThrConsumeMaterialCategoryMapper;
import com.glxp.api.entity.thrsys.ThrSystemDetailEntity;
import com.glxp.api.req.sync.BasicExportStatusRequest;
import com.glxp.api.res.chs.YbHcflEntityResponse;
import com.glxp.api.service.thrsys.ThrConsumeMaterialCategoryService;
import com.glxp.api.service.thrsys.ThrInvOrderService;
import com.glxp.api.service.thrsys.ThrProductsService;
import com.glxp.api.task.TestStatOrderService;
import com.glxp.api.util.MsDateUtil;
import com.glxp.api.util.RedisUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.text.ParseException;
import java.util.List;
@Slf4j
@RestController
public class TestController {
@Resource
TestStatOrderService statOrderService;
@Resource
ThrInvOrderService thrInvOrderService;
@Resource
ThrConsumeMaterialCategoryService thrConsumeMaterialCategoryService;
@Resource
ThrConsumeMaterialCategoryMapper thrConsumeMaterialCategoryMapper;
@GetMapping("/test/stat/order")
public BaseResponse getStatus(BasicExportStatusRequest basicExportStatusRequest) throws Exception {
long start = System.currentTimeMillis();
statOrderService.starGen(MsDateUtil.timeToStamp(basicExportStatusRequest.getToday()));
long end = System.currentTimeMillis();
return ResultVOUtils.success("生成成功!" + start + "=====" + end + "\n-------" + (start - end));
}
@GetMapping("/test/stat/genToday")
public BaseResponse genToday(BasicExportStatusRequest basicExportStatusRequest) {
if (StrUtil.isEmpty(basicExportStatusRequest.getToday())) {
return ResultVOUtils.error(500, "当前时间不能为空!");
}
long start = System.currentTimeMillis();
try {
statOrderService.genStat(MsDateUtil.parseDate(basicExportStatusRequest.getToday(), "yyyy-MM-dd"));
} catch (ParseException e) {
e.printStackTrace();
}
long end = System.currentTimeMillis();
return ResultVOUtils.success("生成成功!" + start + "=====" + end + "\n-------" + (start - end));
}
@RepeatSubmit()
@GetMapping("/test/repeat")
public BaseResponse testRepeat(String message) {
return ResultVOUtils.success("hello");
}
@Resource
public RedisUtil redisUtil;
@GetMapping("/test/redis")
public BaseResponse testRedis(String message) {
Boolean b = redisUtil.getBool(Constant.THIRD_ORDER_SUBMIT);
redisUtil.set(Constant.THIRD_ORDER_SUBMIT, true, 1 * 60);
return ResultVOUtils.success("hello");
}
@GetMapping("/test/downloadInvOrder")
public BaseResponse downloadInvOrder() {
ThrSystemDetailEntity thrSystemDetailEntity = new ThrSystemDetailEntity();
thrSystemDetailEntity.setThirdSysFk("thirdId");
thrInvOrderService.downloadInvSfOrder(thrSystemDetailEntity);
return ResultVOUtils.success("");
}
@GetMapping("/test/downloadInvGhOrder")
public BaseResponse downloadInvGhOrder() {
ThrSystemDetailEntity thrSystemDetailEntity = new ThrSystemDetailEntity();
thrSystemDetailEntity.setThirdSysFk("thirdId");
thrInvOrderService.downloadInvGhOrder(thrSystemDetailEntity);
return ResultVOUtils.success("");
}
@GetMapping("/test/downloadInvPhOrder")
public BaseResponse downloadInvPhOrder() {
ThrSystemDetailEntity thrSystemDetailEntity = new ThrSystemDetailEntity();
thrSystemDetailEntity.setThirdSysFk("thirdId");
thrInvOrderService.downloadInvPhOrder(thrSystemDetailEntity);
return ResultVOUtils.success("");
}
@GetMapping("/test/ybhcInit")
public BaseResponse ybhcInit() {
//获取分组全表数据
List<YbHcflEntityResponse> list = thrConsumeMaterialCategoryMapper.getYbhcListGroup();
list.forEach(item -> {
thrConsumeMaterialCategoryService.updateYbhcCategory(item);
});
return ResultVOUtils.success("");
}
@GetMapping("/test/sfck")
public BaseResponse shck() {
thrInvOrderService.scanInvSfOrderGenerateSfOrder();
return ResultVOUtils.success("");
}
/**
* 拉取视图测试
*/
@Resource
private ThrProductsService thrProductsService;
@GetMapping("/test/downloadThrPi")
public BaseResponse downloadThrPi() {
ThrSystemDetailEntity thrSystemDetailEntity = new ThrSystemDetailEntity();
thrSystemDetailEntity.setThirdSysFk("thirdId");
thrSystemDetailEntity.setProductType(2);
thrProductsService.downloadThrPi(thrSystemDetailEntity);
return ResultVOUtils.success("");
}
}