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.
89 lines
3.5 KiB
Java
89 lines
3.5 KiB
Java
package com.glxp.api.controller.sync;
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.glxp.api.annotation.AuthRuleAnnotation;
|
|
import com.glxp.api.annotation.Log;
|
|
import com.glxp.api.common.res.BaseResponse;
|
|
import com.glxp.api.common.util.ResultVOUtils;
|
|
import com.glxp.api.constant.BusinessType;
|
|
import com.glxp.api.entity.sync.BasicDownloadStatusEntity;
|
|
import com.glxp.api.req.sync.BasicDownloadRequest;
|
|
import com.glxp.api.req.sync.SpsSyncDataRequest;
|
|
import com.glxp.api.req.system.DeleteRequest;
|
|
import com.glxp.api.res.PageSimpleResponse;
|
|
import com.glxp.api.service.sync.BasicDownloadService;
|
|
import com.glxp.api.util.RedisUtil;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import javax.annotation.Resource;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
|
|
@Slf4j
|
|
@RestController
|
|
public class SpsSyncDownloadStatusController {
|
|
|
|
@Resource
|
|
BasicDownloadService basicDownloadService;
|
|
@Resource
|
|
RedisUtil redisUtil;
|
|
|
|
|
|
@GetMapping("sps/sync/connect/test")
|
|
public BaseResponse connectTest(SpsSyncDataRequest spsSyncDataRequest) {
|
|
return ResultVOUtils.success("连接成功");
|
|
}
|
|
|
|
@AuthRuleAnnotation("")
|
|
@GetMapping("/spssync/download/basic/udiinfo/getStatus")
|
|
public BaseResponse getStatus(BasicDownloadRequest basicDownloadRequest) {
|
|
List<BasicDownloadStatusEntity> basicDownloadStatusEntities = basicDownloadService.filterDownloadStatus(basicDownloadRequest);
|
|
return ResultVOUtils.success(basicDownloadStatusEntities);
|
|
}
|
|
|
|
@AuthRuleAnnotation("")
|
|
@GetMapping("/spssync/download/basic/udiinfo/filter")
|
|
public BaseResponse filterStatus(BasicDownloadRequest basicDownloadRequest) {
|
|
List<BasicDownloadStatusEntity> basicDownloadStatusEntities = basicDownloadService.filterDownloadStatus(basicDownloadRequest);
|
|
PageInfo<BasicDownloadStatusEntity> pageInfo;
|
|
pageInfo = new PageInfo<>(basicDownloadStatusEntities);
|
|
PageSimpleResponse<BasicDownloadStatusEntity> pageSimpleResponse = new PageSimpleResponse<>();
|
|
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
|
pageSimpleResponse.setList(basicDownloadStatusEntities);
|
|
return ResultVOUtils.success(pageSimpleResponse);
|
|
}
|
|
|
|
@AuthRuleAnnotation("")
|
|
@PostMapping("/spssync/download/basic/udiinfo/deleteByStatus")
|
|
@Log(title = "定时任务", businessType = BusinessType.DELETE)
|
|
public BaseResponse deleteByStatus(@RequestBody DeleteRequest deleteRequest) {
|
|
|
|
boolean b = basicDownloadService.deleteById(deleteRequest.getId());
|
|
redisUtil.del(deleteRequest.getId());
|
|
if (b)
|
|
return ResultVOUtils.success("删除成功!");
|
|
else
|
|
return ResultVOUtils.error(500, "删除失败!");
|
|
}
|
|
|
|
@AuthRuleAnnotation("")
|
|
@PostMapping("/spssync/download/basic/udiinfo/updateStatus")
|
|
@Log(title = "定时任务", businessType = BusinessType.UPDATE)
|
|
public BaseResponse updateStatus(@RequestBody BasicDownloadStatusEntity basicDownloadStatusEntity) {
|
|
|
|
basicDownloadStatusEntity.setEndTime(new Date());
|
|
basicDownloadStatusEntity.setUpdateTime(new Date());
|
|
boolean b = basicDownloadService.updateDownloadStatus(basicDownloadStatusEntity);
|
|
if (b)
|
|
return ResultVOUtils.success("更新成功!");
|
|
else
|
|
return ResultVOUtils.error(500, "更新成功!");
|
|
}
|
|
|
|
|
|
}
|