|
|
|
package com.ruoyi.tc.controller;
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
|
import com.ruoyi.tc.entity.AssetCurrent;
|
|
|
|
import com.ruoyi.tc.entity.AssetTask;
|
|
|
|
import com.ruoyi.tc.entity.request.AssestTaskXqRequest;
|
|
|
|
import com.ruoyi.tc.entity.request.AssetTaskPageRequest;
|
|
|
|
import com.ruoyi.tc.entity.response.*;
|
|
|
|
import com.ruoyi.tc.service.*;
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.validation.Valid;
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 任务主表(AssetTask)表控制层
|
|
|
|
*
|
|
|
|
* @author makejava
|
|
|
|
* @since 2024-11-18 13:22:58
|
|
|
|
*/
|
|
|
|
@Api(tags = "任务主表")
|
|
|
|
@RestController
|
|
|
|
@RequestMapping("/unit/assetTask")
|
|
|
|
public class AssetTaskController extends BaseController {
|
|
|
|
/**
|
|
|
|
* 服务对象
|
|
|
|
*/
|
|
|
|
@Resource
|
|
|
|
private AssetTaskService assetTaskService;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
private AssetCurrentCpService assetCurrentCpService;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
private AssetBusinessFormCpService assetBusinessFormCpService;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
private AssetBasicNetworkCpService assetBasicNetworkCpService;
|
|
|
|
@Resource
|
|
|
|
private AssetSupplyChainCpService assetSupplyChainCpService;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
private UnitOtherConcatCpService unitOtherConcatCpService;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 分页查询
|
|
|
|
*
|
|
|
|
* @param assetTask 筛选条件
|
|
|
|
* @param pageRequest 分页对象
|
|
|
|
* @return 查询结果
|
|
|
|
*/
|
|
|
|
@ApiOperation(value = "分页查询", response = AssetTask.class)
|
|
|
|
@GetMapping("/page")
|
|
|
|
|
|
|
|
public AjaxResult queryByPage(Page<AssetTask> assetTask, AssetTaskPageRequest pageRequest) {
|
|
|
|
return AjaxResult.success(this.assetTaskService.queryByPage(assetTask, pageRequest));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 通过主键查询单条数据
|
|
|
|
*
|
|
|
|
* @param id 主键
|
|
|
|
* @return 单条数据
|
|
|
|
*/
|
|
|
|
@ApiOperation(value = "通过主键查询单条数据", response = AssetTaskIdResponse.class)
|
|
|
|
@GetMapping("{id}")
|
|
|
|
public AjaxResult queryById(@PathVariable("id") Integer id) {
|
|
|
|
return AjaxResult.success(this.assetTaskService.queryById(id));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 新增数据
|
|
|
|
*
|
|
|
|
* @param assetTask 实体
|
|
|
|
* @return 新增结果
|
|
|
|
*/
|
|
|
|
@ApiOperation(value = "新增数据")
|
|
|
|
@PostMapping("/add")
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
public AjaxResult add(@RequestBody @Valid AssetTask assetTask) {
|
|
|
|
assetTask.setTaskTime(LocalDateTime.now());
|
|
|
|
this.assetTaskService.insert(assetTask);
|
|
|
|
return AjaxResult.success();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 编辑数据
|
|
|
|
*
|
|
|
|
* @param assetTask 实体
|
|
|
|
* @return 编辑结果
|
|
|
|
*/
|
|
|
|
@ApiOperation(value = "编辑数据")
|
|
|
|
@PostMapping("/edit")
|
|
|
|
public AjaxResult edit(@RequestBody @Valid AssetTask assetTask) {
|
|
|
|
return AjaxResult.success(this.assetTaskService.update(assetTask));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 删除数据
|
|
|
|
*
|
|
|
|
* @param id 主键
|
|
|
|
* @return 删除是否成功
|
|
|
|
*/
|
|
|
|
@ApiOperation(value = "删除数据")
|
|
|
|
@PostMapping("/deleteById/{id}")
|
|
|
|
public AjaxResult deleteById(@PathVariable("id") Integer id) {
|
|
|
|
return AjaxResult.success(this.assetTaskService.deleteById(id));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 任务审核详情信息
|
|
|
|
*
|
|
|
|
* @param taskId 任务id
|
|
|
|
* @param assetId 资产id
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
@ApiOperation(value = "任务审核详情信息", response = AssetCurrent.class)
|
|
|
|
@GetMapping("/taskSh")
|
|
|
|
public AjaxResult taskSh(@RequestParam("taskId") int taskId, @RequestParam("assetId") int assetId) {
|
|
|
|
|
|
|
|
return AjaxResult.success(assetTaskService.taskSh(taskId, assetId));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 资产核查信息
|
|
|
|
*
|
|
|
|
* @param page 分页参数
|
|
|
|
* @param pageRequest 查询条件
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
@ApiOperation(value = "资产核查信息", response = AssestTaskXqresponse.class)
|
|
|
|
@GetMapping("/zcHc")
|
|
|
|
public AjaxResult zcHc(Page<AssestTaskXqresponse> page, AssestTaskXqRequest pageRequest) {
|
|
|
|
|
|
|
|
return AjaxResult.success(assetTaskService.zcHc(page, pageRequest));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 单位端暂存报废
|
|
|
|
*
|
|
|
|
* @param assetCurrent 现有资产复制表
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
@ApiOperation(value = "单位端暂存报废")
|
|
|
|
@PostMapping("/zc")
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
public AjaxResult zcHc(@RequestBody AssetCurrentResponse assetCurrent) {
|
|
|
|
//根据资产id和任务id删除五张表数据
|
|
|
|
assetCurrentCpService.deletByAssetIdandTaskId(assetCurrent.getId(), assetCurrent.getTaskId());
|
|
|
|
assetBusinessFormCpService.deletByAssetIdandTaskId(assetCurrent.getId(), assetCurrent.getTaskId());
|
|
|
|
assetSupplyChainCpService.deletByAssetIdandTaskId(assetCurrent.getId(), assetCurrent.getTaskId());
|
|
|
|
unitOtherConcatCpService.deletByAssetIdandTaskId(assetCurrent.getId(), assetCurrent.getTaskId());
|
|
|
|
assetBasicNetworkCpService.deletByAssetIdandTaskId(assetCurrent.getId(), assetCurrent.getTaskId());
|
|
|
|
assetCurrent.setGlym(String.join(",", assetCurrent.getGlymList()));
|
|
|
|
assetCurrent.setGlIp(String.join(",", assetCurrent.getGlIpList()));
|
|
|
|
assetCurrentCpService.save(assetCurrent);
|
|
|
|
//新增新监管业务形态
|
|
|
|
if (assetCurrent.getXjgywxt() != null) {
|
|
|
|
assetCurrent.getXjgywxt().setAssetId(assetCurrent.getId());
|
|
|
|
assetCurrent.getXjgywxt().setTaskId(assetCurrent.getTaskId());
|
|
|
|
assetBusinessFormCpService.save(assetCurrent.getXjgywxt());
|
|
|
|
}
|
|
|
|
if (!assetCurrent.getGylxxList().isEmpty()) {
|
|
|
|
for (AssetSupplyChainCpResponse items : assetCurrent.getGylxxList()) {
|
|
|
|
items.setAssetId(assetCurrent.getId());
|
|
|
|
items.setTaskId(assetCurrent.getTaskId());
|
|
|
|
}
|
|
|
|
//新增供应链
|
|
|
|
assetSupplyChainCpService.saveBatch(assetCurrent.getGylxxList());
|
|
|
|
}
|
|
|
|
if (!assetCurrent.getJcwlList().isEmpty()) {
|
|
|
|
for (AssetBasicNetworkCpResponse items : assetCurrent.getJcwlList()) {
|
|
|
|
items.setAssetId(assetCurrent.getId());
|
|
|
|
items.setTaskId(assetCurrent.getTaskId());
|
|
|
|
}
|
|
|
|
//新增基础网络
|
|
|
|
assetBasicNetworkCpService.saveBatch(assetCurrent.getJcwlList());
|
|
|
|
}
|
|
|
|
if (!assetCurrent.getOtherConcat().isEmpty()) {
|
|
|
|
for (UnitOtherConcatCpResponse items : assetCurrent.getOtherConcat()) {
|
|
|
|
items.setAssetId(assetCurrent.getId());
|
|
|
|
items.setTaskId(assetCurrent.getTaskId());
|
|
|
|
}
|
|
|
|
//新增其他联系人
|
|
|
|
unitOtherConcatCpService.saveBatch(assetCurrent.getOtherConcat());
|
|
|
|
}
|
|
|
|
return success();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 单位端提交
|
|
|
|
*
|
|
|
|
* @param assetCurrent 现有资产复制表
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
@ApiOperation(value = "单位端提交")
|
|
|
|
@PostMapping("/tj")
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
public AjaxResult tj(@RequestBody AssetCurrentResponse assetCurrent) {
|
|
|
|
|
|
|
|
return AjaxResult.success();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "管理端审核")
|
|
|
|
@PostMapping("/sh")
|
|
|
|
public AjaxResult sh(@RequestBody AssetCurrentResponse assetCurrent) {
|
|
|
|
|
|
|
|
|
|
|
|
return AjaxResult.success();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|