任务模块编写

main
dongdingding 2 months ago
parent 1a36bc3da4
commit f36cdd51d1

@ -1,6 +1,5 @@
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.AssetLc;
@ -19,7 +18,7 @@ import javax.validation.Valid;
* @author makejava
* @since 2024-11-18 14:46:40
*/
@Api("任务流程")
@Api(tags = "任务流程")
@RestController
@RequestMapping("/unit/assetLc")
public class AssetLcController extends BaseController {
@ -30,16 +29,15 @@ public class AssetLcController extends BaseController {
private AssetLcService assetLcService;
/**
*
*
*
* @param assetLc
* @param req
* @param req
* @return
*/
@GetMapping("/page")
@ApiOperation(value = "分页查询", response = AssetLc.class)
public AjaxResult queryByPage(Page<AssetLc> assetLc, AssetLcRequest req) {
return AjaxResult.success(this.assetLcService.queryByPage(assetLc, req));
public AjaxResult queryByPage(AssetLcRequest req) {
return AjaxResult.success(this.assetLcService.queryByPage(req));
}
/**

@ -83,7 +83,6 @@ public class AssetTaskController extends BaseController {
*/
@ApiOperation(value = "分页查询", response = AssetTask.class)
@GetMapping("/page")
public AjaxResult queryByPage(Page<AssetTask> assetTask, AssetTaskPageRequest pageRequest) {
return AjaxResult.success(this.assetTaskService.queryByPage(assetTask, pageRequest));
}
@ -267,10 +266,10 @@ public class AssetTaskController extends BaseController {
assetLc.setTaskId(assetCurrent.getTaskId());
assetLc.setAssetName(assetCurrent.getXtmc());
//当审核状态为审核不通过 单位端重新提交
if (assetCurrent.getStatus().equals(4)){
if (assetCurrent.getStatus().equals(4)) {
assetLc.setTaskId(assetCurrent.getTaskId());
assetLc.setXfTime(LocalDateTime.now());
assetLc.setAssetName("单位重新核查提交时间"+assetCurrent.getXtmc());
assetLc.setAssetName("单位重新核查提交时间" + assetCurrent.getXtmc());
assetLcService.insert(assetLc);
}
@ -289,18 +288,16 @@ public class AssetTaskController extends BaseController {
b.append(",");
});
}
assetCurrent.setGlIp(b.toString());
assetCurrent.setStatus(1);
//当审核状态为带待核查
if(assetCurrent.getStatus().equals(1)){
if (assetCurrent.getStatus().equals(1)) {
assetLc.setXfTime(LocalDateTime.now());
assetLc.setTaskId(assetCurrent.getTaskId());
assetLc.setAssetName("单位核查完成提交"+assetCurrent.getXtmc());
assetLc.setAssetName("单位核查完成提交" + assetCurrent.getXtmc());
assetLcService.insert(assetLc);
}
assetCurrentJyService.save(assetCurrent);
//新增新监管业务形态
if (assetCurrent.getXjgywxt() != null) {
assetCurrent.getXjgywxt().setAssetId(assetCurrent.getId());
@ -331,6 +328,7 @@ public class AssetTaskController extends BaseController {
//新增其他联系人
unitOtherConcatJyservice.saveBatch(assetCurrent.getOtherConcat());
}
return success();
}
@ -348,20 +346,18 @@ public class AssetTaskController extends BaseController {
}
/**
* -
*
* @param req
* @return
*/
@ApiOperation(value = "管理端-单位核查情况",response =AssetdwHcResponse.class )
@PostMapping("/dwHc")
@ApiOperation(value = "管理端-单位核查情况", response = AssetdwHcResponse.class)
@GetMapping("/dwHc")
public AjaxResult dwHc(Page<AssetdwHcResponse> assetdwHcResponsePage, AssetdwHcRequest req) {
return AjaxResult.success(assetTaskService.dwHc(assetdwHcResponsePage,req));
return AjaxResult.success(assetTaskService.dwHc(assetdwHcResponsePage, req));
}
}

@ -54,10 +54,10 @@ public class AssetTask implements Serializable {
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime taskFinishTime;
/**
* 12345
* 123
*/
@ApiModelProperty("任务状态1进行中2正常完成3超期完成4正常完成5审核驳回")
private String taskStatus;
@ApiModelProperty("任务状态1进行中2正常完成3超期完成4审核驳回")
private Integer taskStatus=1;
/**
*
*/

@ -16,6 +16,12 @@ import java.time.LocalDateTime;
@ApiModel("任务主表分页请求类")
public class AssetTaskPageRequest {
/**
* id
*/
@ApiModelProperty("主键id")
private Integer id;
/**
*
*/

@ -0,0 +1,35 @@
package com.ruoyi.tc.entity.response;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
/**
* @author dong
* @since 2024/11/22 9:35
*/
@Data
@ApiModel("资产表状态时间详情类")
public class AssetTaskStatusResponse {
/**
*
*/
@ApiModelProperty("审核状态0待核查1待审批3审核通过4审核不通过5已报废")
private Integer status;
/**
*
*/
@ApiModelProperty("6已超期7未超期")
private Integer deadstatus;
}

@ -36,6 +36,13 @@ public class AssetdwHcResponse {
private Integer checked;
/**
*
*/
@ApiModelProperty("完成数量")
private Integer notChecked;
/**
*
*/

@ -36,4 +36,15 @@ public interface AssetBasicNetWorkCpMapper extends BaseMapper<AssetBasicNetworkC
@Delete("delete from asset_basic_network_cp where asset_id=#{assetId} and task_id =#{taskId} ")
void deletByAssetIdandTaskId(@Param("assetId") Long assetId, @Param("taskId") int taskId);
/**
* taskid
*
* @param taskId id
* @return
*/
@Select("select * from asset_basic_network_cp where task_id=#{taskId}")
List<AssetBasicNetworkCpPo> findByTaskId(int taskId);
}

@ -2,6 +2,7 @@ package com.ruoyi.tc.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.tc.entity.po.AssetBusinessFormCpPo;
import com.ruoyi.tc.entity.po.AssetCurrentCpPo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
@ -36,5 +37,16 @@ public interface AssetBusinessFormCpMapper extends BaseMapper<AssetBusinessFormC
@Delete("delete from asset_business_form_cp where asset_id=#{assetId} and task_id =#{taskId} ")
void deletByAssetIdandTaskId(@Param("assetId") Long assetId, @Param("taskId")int taskId);
/**
* taskid
*
* @param taskId id
* @return
*/
@Select("select * from asset_business_form_cp where task_id=#{taskId}")
List<AssetBusinessFormCpPo> findByTaskId(int taskId);
}

@ -4,6 +4,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.tc.entity.po.AssetCurrentCpPo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* (AssetCurrentResponse)访
@ -19,5 +22,18 @@ public interface AssetCurrentCpMapper extends BaseMapper<AssetCurrentCpPo> {
*/
@Delete("delete from asset_current_cp where id=#{assetId} and task_id =#{taskId} ")
void deletByAssetIdandTaskId(@Param("assetId") Long assetId, @Param("taskId")int taskId);
/**
* taskid
*
* @param taskId id
* @return
*/
@Select("select * from asset_current_cp where task_id=#{taskId}")
List<AssetCurrentCpPo> findByTaskId(int taskId);
}

@ -19,11 +19,11 @@ public interface AssetLcMapper {
/**
*
*
* @param page
* @param pageRequest
* @return
*/
Page<AssetLc> queryByPage(Page<AssetLc> page, @Param("req") AssetLcRequest pageRequest);
List<AssetLc> queryByPage( @Param("req") AssetLcRequest pageRequest);
/**

@ -1,6 +1,7 @@
package com.ruoyi.tc.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.tc.entity.po.AssetBasicNetworkCpPo;
import com.ruoyi.tc.entity.po.AssetSupplyChainCpPo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
@ -35,5 +36,17 @@ public interface AssetSupplyChainCpMapper extends BaseMapper<AssetSupplyChainCpP
*/
@Delete("delete from asset_supply_chain_cp where asset_id=#{assetId} and task_id =#{taskId} ")
void deletByAssetIdandTaskId(@Param("assetId") Long assetId, @Param("taskId")int taskId);
/**
* taskid
*
* @param taskId id
* @return
*/
@Select("select * from asset_supply_chain_cp where task_id=#{taskId}")
List<AssetSupplyChainCpPo> findByTaskId(int taskId);
}

@ -3,17 +3,19 @@ package com.ruoyi.tc.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.tc.entity.AssetTask;
import com.ruoyi.tc.entity.po.AssetCurrentCpPo;
import com.ruoyi.tc.entity.request.AssestTaskXqRequest;
import com.ruoyi.tc.entity.request.AssetCurrentShRequest;
import com.ruoyi.tc.entity.request.AssetTaskPageRequest;
import com.ruoyi.tc.entity.request.AssetdwHcRequest;
import com.ruoyi.tc.entity.response.AssestTaskXqresponse;
import com.ruoyi.tc.entity.po.AssetCurrentCpPo;
import com.ruoyi.tc.entity.response.AssetTaskResponse;
import com.ruoyi.tc.entity.response.AssetTaskStatusResponse;
import com.ruoyi.tc.entity.response.AssetdwHcResponse;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable;
import java.time.LocalDateTime;
import java.util.List;
/**
@ -139,13 +141,31 @@ public interface AssetTaskMapper extends BaseMapper<AssetTask> {
int sh(@Param("req") AssetCurrentShRequest req);
/**
* -
*
* @return
*/
Page<AssetdwHcResponse> dwHc(Page<AssetdwHcResponse> assetdwHcResponsePage, @Param("req") AssetdwHcRequest req);
/**
*
*
* @param taskId id
* @return
*/
List<AssetTaskStatusResponse> findByTaskId(Integer taskId);
/**
*
*
* @param taskStatus
* @param taskId id
* @return
*/
int updateByTaskId(@Param("taskStatus") Integer taskStatus, @Param("taskId") Integer taskId,@Param("finishTime") LocalDateTime finishTime );
}

@ -34,4 +34,15 @@ public interface UnitOtherConcatCpMapper extends BaseMapper<UnitOtherConcatCpPo>
*/
@Delete("delete from unit_other_contact_cp where asset_id=#{assetId} and task_id =#{taskId} ")
void deletByAssetIdandTaskId(@Param("assetId") Long assetId, @Param("taskId")int taskId);
/**
* taskid
*
* @param taskId id
* @return
*/
@Select("select * from unit_other_contact_cp where task_id=#{taskId}")
List<UnitOtherConcatCpPo> findByTaskId(int taskId);
}

@ -2,6 +2,7 @@ package com.ruoyi.tc.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.tc.entity.po.AssetBasicNetworkCpPo;
import com.ruoyi.tc.entity.po.AssetBusinessFormCpPo;
import java.util.List;
@ -30,4 +31,13 @@ public interface AssetBasicNetworkCpService extends IService<AssetBasicNetworkCp
* @param taskId id
*/
void deletByAssetIdandTaskId(Long assetId, int taskId);
/**
* taskid
*
* @param taskId id
* @return
*/
List<AssetBasicNetworkCpPo> findByTaskId(int taskId);
}

@ -2,6 +2,7 @@ package com.ruoyi.tc.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.tc.entity.po.AssetBusinessFormCpPo;
import com.ruoyi.tc.entity.po.AssetCurrentCpPo;
import java.util.List;
@ -30,5 +31,15 @@ public interface AssetBusinessFormCpService extends IService<AssetBusinessFormCp
*/
void deletByAssetIdandTaskId(Long assetId, int taskId);
/**
* taskid
*
* @param taskId id
* @return
*/
List<AssetBusinessFormCpPo> findByTaskId(int taskId);
}

@ -3,6 +3,8 @@ package com.ruoyi.tc.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.tc.entity.po.AssetCurrentCpPo;
import java.util.List;
/**
* (AssetCurrentResponse)
*
@ -19,5 +21,14 @@ public interface AssetCurrentCpService extends IService<AssetCurrentCpPo> {
*/
void deletByAssetIdandTaskId(Long assetId, int taskId);
/**
* taskid
*
* @param taskId id
* @return
*/
List<AssetCurrentCpPo> findByTaskId(int taskId);
}

@ -3,7 +3,9 @@ package com.ruoyi.tc.service;
import com.ruoyi.tc.entity.AssetLc;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.tc.entity.request.AssetLcRequest;
import com.ruoyi.tc.entity.response.AssetTaskStatusResponse;
import java.util.List;
/**
* (AssetLc)
*
@ -27,7 +29,7 @@ public interface AssetLcService {
* @param pageRequest
* @return
*/
Page<AssetLc> queryByPage(Page<AssetLc>assetLc, AssetLcRequest pageRequest);
List<AssetLc> queryByPage( AssetLcRequest pageRequest);
/**
*

@ -1,6 +1,7 @@
package com.ruoyi.tc.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.tc.entity.po.AssetBasicNetworkCpPo;
import com.ruoyi.tc.entity.po.AssetSupplyChainCpPo;
import java.util.List;
@ -22,6 +23,15 @@ public interface AssetSupplyChainCpService extends IService<AssetSupplyChainCpPo
List<AssetSupplyChainCpPo> findByassetId(Long assetId);
/**
* taskid
*
* @param taskId id
* @return
*/
List<AssetSupplyChainCpPo> findByTaskId(int taskId);
/**

@ -1,6 +1,7 @@
package com.ruoyi.tc.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.tc.entity.po.AssetSupplyChainCpPo;
import com.ruoyi.tc.entity.po.UnitOtherConcatCpPo;
import com.ruoyi.tc.entity.po.UnitOtherConcatJyPo;
@ -29,4 +30,14 @@ public interface UnitOtherConcatCpService extends IService<UnitOtherConcatCpPo>
* @param taskId id
*/
void deletByAssetIdandTaskId(Long assetId, int taskId);
/**
* taskid
*
* @param taskId id
* @return
*/
List<UnitOtherConcatCpPo> findByTaskId(int taskId);
}

@ -31,5 +31,10 @@ public class AssetBasicNetworkCpServiceImpl extends ServiceImpl<AssetBasicNetWor
assetBasicNetWorkCpMapper.deletByAssetIdandTaskId(assetId, taskId);
}
@Override
public List<AssetBasicNetworkCpPo> findByTaskId(int taskId) {
return assetBasicNetWorkCpMapper.findByTaskId(taskId);
}
}

@ -30,5 +30,10 @@ public class AssetBusinessFormCpServiceImpl extends ServiceImpl<AssetBusinessFor
public void deletByAssetIdandTaskId(Long assetId, int taskId) {
assetBusinessFormCpMapper.deletByAssetIdandTaskId(assetId,taskId);
}
@Override
public List<AssetBusinessFormCpPo> findByTaskId(int taskId) {
return assetBusinessFormCpMapper.findByTaskId(taskId);
}
}

@ -7,6 +7,7 @@ import com.ruoyi.tc.service.*;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* (AssetCurrentResponse)
@ -23,5 +24,10 @@ public class AssetCurrentCpServiceImpl extends ServiceImpl<AssetCurrentCpMapper,
public void deletByAssetIdandTaskId(Long assetId,int taskId) {
assetCurrentCpMapper.deletByAssetIdandTaskId(assetId,taskId);
}
@Override
public List<AssetCurrentCpPo> findByTaskId(int taskId) {
return assetCurrentCpMapper.findByTaskId(taskId);
}
}

@ -8,7 +8,7 @@ import com.ruoyi.tc.service.AssetLcService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import javax.annotation.Resource;
import java.util.List;
/**
* (AssetLc)
*
@ -34,15 +34,15 @@ public class AssetLcServiceImpl implements AssetLcService {
}
/**
*
*
*
* @param assetLc
* @param pageRequest
* @param
* @param pageRequest
* @return
*/
@Override
public Page<AssetLc> queryByPage(Page<AssetLc> assetLc, AssetLcRequest pageRequest) {
return assetLcDao.queryByPage(assetLc, pageRequest);
public List<AssetLc> queryByPage( AssetLcRequest pageRequest) {
return assetLcDao.queryByPage( pageRequest);
}

@ -1,6 +1,7 @@
package com.ruoyi.tc.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.tc.entity.po.AssetBasicNetworkCpPo;
import com.ruoyi.tc.entity.po.AssetSupplyChainCpPo;
import com.ruoyi.tc.mapper.AssetSupplyChainCpMapper;
import com.ruoyi.tc.service.AssetSupplyChainCpService;
@ -25,6 +26,11 @@ public class AssetSupplyChainCpServiceImpl extends ServiceImpl<AssetSupplyChainC
return assetSupplyChainCpMapper.findByassetId(assetId);
}
@Override
public List<AssetSupplyChainCpPo> findByTaskId(int taskId) {
return assetSupplyChainCpMapper.findByTaskId(taskId);
}
@Override
public void deletByAssetIdandTaskId(Long assetId, int taskId) {
assetSupplyChainCpMapper.deletByAssetIdandTaskId(assetId,taskId);

@ -2,12 +2,13 @@ package com.ruoyi.tc.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.tc.entity.AssetLc;
import com.ruoyi.tc.entity.AssetTask;
import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.tc.entity.*;
import com.ruoyi.tc.entity.po.*;
import com.ruoyi.tc.entity.request.*;
import com.ruoyi.tc.entity.response.AssestTaskXqresponse;
import com.ruoyi.tc.entity.response.AssetTaskResponse;
import com.ruoyi.tc.entity.response.AssetTaskStatusResponse;
import com.ruoyi.tc.entity.response.AssetdwHcResponse;
import com.ruoyi.tc.mapper.AssetTaskMapper;
import com.ruoyi.tc.service.*;
@ -18,6 +19,7 @@ import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
* (AssetTask)
@ -50,6 +52,22 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
@Resource
private AssetLcService assetLcService;
@Resource
private AssetCurrentService assetCurrentService;
@Resource
private AssetBusinessFormService assetBusinessFormService;
@Resource
private AssetBasicNetworkService assetBasicNetworkService;
@Resource
private AssetSupplyChainService assetSupplyChainService;
@Resource
private UnitOtherConcatService unitOtherConcatService;
/**
* ID
*
@ -205,24 +223,135 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
@Override
public int sh(AssetCurrentShRequest req) {
AssetLc assetLc = new AssetLc();
if (req.getStatus()==3) {
int taskStatus = 0;
if (req.getStatus() == 3) {
assetLc.setTaskId(req.getTaskId());
assetLc.setXfTime(LocalDateTime.now());
assetLc.setAssetName("管理员审核通过");
assetLcService.insert(assetLc);
} else if (req.getStatus()==4) {
} else if (req.getStatus() == 4) {
assetLc.setTaskId(req.getTaskId());
assetLc.setAssetName("管理员审核不通过");
assetLc.setXfTime(LocalDateTime.now());
assetLcService.insert(assetLc);
}
int a = assetTaskDao.sh(req);
//单位端资产审核,更新任务表状态
//查询当前任务下的所有资产状态和完成时间
List<AssetTaskStatusResponse> list = assetTaskDao.findByTaskId(req.getTaskId());
// 检查状态
boolean hasPendingApproval = list.stream().anyMatch(item -> item.getStatus() == 0 || item.getStatus() == 1);
boolean allApproved = list.stream().allMatch(item -> item.getStatus() == 3);
boolean hasExpired = list.stream().anyMatch(item -> item.getDeadstatus() == 6);
boolean hasRejected = list.stream().anyMatch(item -> item.getStatus() == 4);
LocalDateTime finishTime = null;
if (hasPendingApproval) {
// 资产状态存在待审批,任务状态为进行中
taskStatus = 1;
} else if (allApproved && !hasPendingApproval && !hasRejected && !hasExpired) {
// 资产状态全部为已通过中并且全部资产完成时间在任务期限之前
taskStatus = 2;
finishTime = LocalDateTime.now();
taskSaveOrDelete(req);
} else if (allApproved && !hasPendingApproval && !hasRejected && hasExpired) {
// 资产状态全部为已通过,资产完成时间有超期的为超期完成
taskStatus = 3;
finishTime = LocalDateTime.now();
taskSaveOrDelete(req);
} else if (hasRejected) {
// 审核不通过
taskStatus = 4;
}
//修改主表任务状态
assetTaskDao.updateByTaskId(taskStatus, req.getTaskId(), finishTime);
return a;
}
return assetTaskDao.sh(req);
private void taskSaveOrDelete(AssetCurrentShRequest req) {
// 根据taskid查询五张数据
List<AssetCurrentCpPo> currentList = assetCurrentCpService.findByTaskId(req.getTaskId());
List<Long> idList = currentList.stream()
.map(AssetCurrentCpPo::getId)
.collect(Collectors.toList());
//删除原有数据
assetCurrentService.removeBatchByIds(idList);
//将子表数据复制到主表中
List<AssetCurrent> currentNewList = currentList.stream()
.map(cpPo -> {
AssetCurrent current = new AssetCurrent();
BeanUtils.copyProperties(cpPo, current); // 复制属性
return current; // 返回新对象
})
.collect(Collectors.toList()); // 收集到列表中
assetCurrentService.saveBatch(currentNewList);
//AssetBusinessFormCpPo
List<AssetBusinessFormCpPo> bussinessList = assetBusinessFormCpService.findByTaskId(req.getTaskId());
List<Long> bussinessidList = bussinessList.stream()
.map(AssetBusinessFormCpPo::getAssetId)
.collect(Collectors.toList());
//删除原有数据
assetBusinessFormService.removeBatchByIds(bussinessidList);
//将子表数据复制到主表中
List<AssetBusinessForm> bussinessNewList = bussinessList.stream()
.map(cpPo -> {
AssetBusinessForm businessForm = new AssetBusinessForm();
BeanUtils.copyProperties(cpPo, businessForm); // 复制属性
return businessForm; // 返回新对象
})
.collect(Collectors.toList()); // 收集到列表中
assetBusinessFormService.saveBatch(bussinessNewList);
//AssetBasicNetworkCpPo
List<AssetBasicNetworkCpPo> netWorkList = assetBasicNetworkCpService.findByTaskId(req.getTaskId());
List<Long> netWorkidList = netWorkList.stream()
.map(AssetBasicNetworkCpPo::getAssetId)
.collect(Collectors.toList());
//删除原有数据
assetBasicNetworkService.removeBatchByIds(netWorkidList);
//将子表数据复制到主表中
List<AssetBasicNetwork> netWorkNewList = netWorkList.stream()
.map(cpPo -> {
AssetBasicNetwork network = new AssetBasicNetwork();
BeanUtils.copyProperties(cpPo, network); // 复制属性
return network; // 返回新对象
})
.collect(Collectors.toList()); // 收集到列表中
assetBasicNetworkService.saveBatch(netWorkNewList);
//AssetSupplyChainCpPo
List<AssetSupplyChainCpPo> SupplyChainList = assetSupplyChainCpService.findByTaskId(req.getTaskId());
List<Long> SupplyChainidList = SupplyChainList.stream()
.map(AssetSupplyChainCpPo::getAssetId)
.collect(Collectors.toList());
//删除原有数据
assetSupplyChainService.removeBatchByIds(SupplyChainidList);
List<AssetSupplyChain> SupplyChainNewList = SupplyChainList.stream()
.map(cpPo -> {
AssetSupplyChain supplyChain = new AssetSupplyChain();
BeanUtils.copyProperties(cpPo, supplyChain); // 复制属性
return supplyChain; // 返回新对象
})
.collect(Collectors.toList());
assetSupplyChainService.saveBatch(SupplyChainNewList);
//UnitOtherConcatCpPo
List<UnitOtherConcatCpPo> UnitOtherConcatList = unitOtherConcatCpService.findByTaskId(req.getTaskId());
List<Long> UnitOtherConcatidList = UnitOtherConcatList.stream()
.map(UnitOtherConcatCpPo::getAssetId)
.collect(Collectors.toList());
//删除原有数据
unitOtherConcatService.removeBatchByIds(UnitOtherConcatidList);
List<UnitOtherConcat> UnitOtherConcatNewList = UnitOtherConcatList.stream()
.map(cpPo -> {
UnitOtherConcat unitOtherConcat = new UnitOtherConcat();
BeanUtils.copyProperties(cpPo, unitOtherConcat); // 复制属性
return unitOtherConcat; // 返回新对象
})
.collect(Collectors.toList());
assetSupplyChainService.saveBatch(SupplyChainNewList);
unitOtherConcatService.saveBatch(UnitOtherConcatNewList);
}
@Override
public Page<AssetdwHcResponse> dwHc(Page<AssetdwHcResponse> assetdwHcResponsePage,AssetdwHcRequest req) {
public Page<AssetdwHcResponse> dwHc(Page<AssetdwHcResponse> assetdwHcResponsePage, AssetdwHcRequest req) {
return assetTaskDao.dwHc(assetdwHcResponsePage,req);
return assetTaskDao.dwHc(assetdwHcResponsePage, req);
}
}

@ -29,4 +29,9 @@ public class UnitOtherConcatCpServiceImpl extends ServiceImpl<UnitOtherConcatCpM
public void deletByAssetIdandTaskId(Long assetId, int taskId) {
unitOtherConcatCpMapper.deletByAssetIdandTaskId(assetId,taskId);
}
@Override
public List<UnitOtherConcatCpPo> findByTaskId(int taskId) {
return unitOtherConcatCpMapper.findByTaskId(taskId);
}
}

@ -0,0 +1,61 @@
# 数据源配置
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
druid:
# 主库数据源
master:
url: jdbc:mysql://localhost:3306/tc-asset-verification?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: adminadmin
# 从库数据源
slave:
# 从数据源开关/默认关闭
enabled: false
url:
username:
password:
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置连接超时时间
connectTimeout: 30000
# 配置网络超时时间
socketTimeout: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-username: ruoyi
login-password: 123456
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true

@ -52,7 +52,7 @@ spring:
# 国际化资源文件路径
basename: i18n/messages
profiles:
active: druid
active: test
# 文件上传
servlet:
multipart:

@ -166,18 +166,14 @@
</select>
<select id="queryByPage" resultType="com.ruoyi.tc.entity.AssetLc">
select
id,task_id,xf_time,dept_id,create_id,create_by,create_time,update_id,update_by,update_time,version,remark,assetName
id,task_id,xf_time,dept_id,create_id,create_by,create_time,update_id,update_by,update_time,version,remark,asset_name
from asset_lc
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="taskId != null">
and task_id = #{taskId}
</if>
<if test="xfTime != null">
and xf_time = #{xfTime}
<if test="req.taskId != null">
and task_id = #{req.taskId}
</if>
</where>
</select>

@ -186,6 +186,9 @@
and task_status = #{req.taskStatus}
</if>
<if test="req.id != null ">
and id = #{req.id}
</if>
</where>
</select>
<select id="findByDwmcAssetCurrent" resultType="com.ruoyi.tc.entity.po.AssetCurrentCpPo">
@ -231,28 +234,47 @@
</select>
<select id="dwHc" resultType="com.ruoyi.tc.entity.response.AssetdwHcResponse">
SELECT
dwmc,
COUNT(*) AS total,
SUM(CASE WHEN status = 0 THEN 1 ELSE 0 END) AS notChecked,
SUM(CASE WHEN status = 1 THEN 1 ELSE 0 END) AS checked,
ROUND(
CASE
WHEN COUNT(*) > 0 THEN
SUM(CASE WHEN status = 0 THEN 1 ELSE 0 END) * 1.0 / COUNT(*)
ELSE 0
END, 2) AS checkedRatio
dwmc,
COUNT(*) AS total,
SUM(CASE WHEN status = 0 THEN 1 ELSE 0 END) AS notChecked,
SUM(CASE WHEN status = 1 THEN 1 ELSE 0 END) AS checked,
ROUND(
CASE
WHEN COUNT(*) > 0 THEN
SUM(CASE WHEN status = 0 THEN 1 ELSE 0 END) * 100 / COUNT(*)
ELSE 0
END, 2) AS checkedRatio
FROM
asset_current_cp
asset_current_cp
<where>
<if test="req.dwmc!=null and req.dwmc!='' ">
and dwmc = #{req.dwmc}
and dwmc like concat('%',#{req.dwmc},'%')
</if>
</where>
GROUP BY
dwmc
dwmc
</select>
<select id="findByTaskId" resultType="com.ruoyi.tc.entity.response.AssetTaskStatusResponse">
SELECT
a.status,
CASE
WHEN DATE(a.update_time) > STR_TO_DATE(IFNULL(b.task_deadline, '1970-01-01'), '%Y-%m-%d') THEN '6'
ELSE '7'
END AS deadstatus
FROM
asset_current_cp a
LEFT JOIN
asset_task b ON a.task_id = b.id
<where>
<if test="taskId!=null ">
and a.task_id =#{taskId}
</if>
</where>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into asset_task(task_name, task_time, task_deadline, task_finish_time, task_status, dwmc,
@ -347,11 +369,26 @@
<update id="sh" parameterType="com.ruoyi.tc.entity.request.AssetCurrentShRequest">
update asset_current_cp
<set>
<if test="req.status != null ">
<if test="req.status != null ">
status = #{req.status},
</if>
update_time=now()
</set>
where id = #{req.assetId} and task_id = #{req.taskId}
</update>
<update id="updateByTaskId">
update asset_task
<set>
<if test="taskStatus != null ">
task_status=#{taskStatus},
</if>
<if test="finishTime != null ">
task_finish_time=#{finishTime}
</if>
</set>
where id = #{req.assetId} and task_id = #{req.taskId}
where id =#{taskId}
</update>
<!--通过主键删除-->

@ -115,7 +115,7 @@ public class SecurityConfig
// 静态资源,可匿名访问
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
.antMatchers("/unit/assetTask/**","/tc/**").permitAll()
.antMatchers("/unit/assetTask/**","/tc/**","/unit/assetLc/**").permitAll()
// 除上面外的所有请求全部需要鉴权认证
.anyRequest().authenticated();
})

Loading…
Cancel
Save