任务模块编写

main
dongdingding 2 months ago
parent 1912b34d3a
commit 044e41bbe7

@ -34,6 +34,7 @@ import java.time.LocalDateTime;
*/ */
@Api(tags = "任务主表") @Api(tags = "任务主表")
@RestController @RestController
@Transactional(rollbackFor = Exception.class)
@RequestMapping("/unit/assetTask") @RequestMapping("/unit/assetTask")
public class AssetTaskController extends BaseController { public class AssetTaskController extends BaseController {
/** /**

@ -2,6 +2,7 @@ package com.ruoyi.tc.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.tc.entity.AssetBasicNetwork; import com.ruoyi.tc.entity.AssetBasicNetwork;
import org.apache.ibatis.annotations.Param;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
@ -27,7 +28,7 @@ public interface AssetBasicNetWorkMapper extends BaseMapper<AssetBasicNetwork> {
* *
* @param idList * @param idList
*/ */
void deleteIdList(List<Long> idList); void deleteIdList(@Param("idList") List<Long> idList);
} }

@ -2,6 +2,7 @@ package com.ruoyi.tc.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.tc.entity.AssetBusinessForm; import com.ruoyi.tc.entity.AssetBusinessForm;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
@ -22,6 +23,6 @@ public interface AssetBusinessFormMapper extends BaseMapper<AssetBusinessForm> {
* *
* @param idList * @param idList
*/ */
void deleteIdList(List<Long> idList); void deleteIdList(@Param("idList") List<Long> idList);
} }

@ -40,6 +40,6 @@ public interface AssetCurrentMapper extends BaseMapper<AssetCurrent> {
* *
* @param idList * @param idList
*/ */
void deleteIdList(List<Long> idList); void deleteIdList(@Param("idList") List<Long> idList);
} }

@ -2,6 +2,7 @@ package com.ruoyi.tc.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.tc.entity.AssetSupplyChain; import com.ruoyi.tc.entity.AssetSupplyChain;
import org.apache.ibatis.annotations.Param;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
@ -35,6 +36,6 @@ public interface AssetSupplyChainMapper extends BaseMapper<AssetSupplyChain> {
* *
* @param idList * @param idList
*/ */
void deleteIdList(List<Long> idList); void deleteIdList(@Param("idList") List<Long> idList);
} }

@ -2,6 +2,7 @@ package com.ruoyi.tc.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.tc.entity.UnitOtherConcat; import com.ruoyi.tc.entity.UnitOtherConcat;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
@ -26,5 +27,5 @@ public interface UnitOtherConcatMapper extends BaseMapper<UnitOtherConcat>
* *
* @param idList * @param idList
*/ */
void deleteIdList(List<Long> idList); void deleteIdList(@Param("idList") List<Long> idList);
} }

@ -1,5 +1,6 @@
package com.ruoyi.tc.service.impl; package com.ruoyi.tc.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.bean.BeanUtils; import com.ruoyi.common.utils.bean.BeanUtils;
@ -13,11 +14,13 @@ import com.ruoyi.tc.entity.response.AssetdwHcResponse;
import com.ruoyi.tc.mapper.AssetTaskMapper; import com.ruoyi.tc.mapper.AssetTaskMapper;
import com.ruoyi.tc.service.*; import com.ruoyi.tc.service.*;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -296,7 +299,10 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
.map(AssetCurrentCpPo::getId) .map(AssetCurrentCpPo::getId)
.collect(Collectors.toList()); .collect(Collectors.toList());
//删除原有数据 //删除原有数据
assetCurrentService.deleteIdList(idList); if (CollectionUtil.isNotEmpty(idList)) {
assetCurrentService.deleteIdList(idList);
}
//将子表数据复制到主表中 //将子表数据复制到主表中
List<AssetCurrent> currentNewList = currentList.stream() List<AssetCurrent> currentNewList = currentList.stream()
.map(cpPo -> { .map(cpPo -> {
@ -312,7 +318,10 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
.map(AssetBusinessFormCpPo::getAssetId) .map(AssetBusinessFormCpPo::getAssetId)
.collect(Collectors.toList()); .collect(Collectors.toList());
//删除原有数据 //删除原有数据
assetBusinessFormService.deleteIdList(bussinessidList); if (CollectionUtil.isNotEmpty(bussinessidList)) {
assetBusinessFormService.deleteIdList(bussinessidList);
}
//将子表数据复制到主表中 //将子表数据复制到主表中
List<AssetBusinessForm> bussinessNewList = bussinessList.stream() List<AssetBusinessForm> bussinessNewList = bussinessList.stream()
.map(cpPo -> { .map(cpPo -> {
@ -328,7 +337,10 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
.map(AssetBasicNetworkCpPo::getAssetId) .map(AssetBasicNetworkCpPo::getAssetId)
.collect(Collectors.toList()); .collect(Collectors.toList());
//删除原有数据 //删除原有数据
assetBasicNetworkService.deleteIdList(netWorkidList); if (CollectionUtil.isNotEmpty(netWorkidList)) {
assetBasicNetworkService.deleteIdList(netWorkidList);
}
//将子表数据复制到主表中 //将子表数据复制到主表中
List<AssetBasicNetwork> netWorkNewList = netWorkList.stream() List<AssetBasicNetwork> netWorkNewList = netWorkList.stream()
.map(cpPo -> { .map(cpPo -> {
@ -344,7 +356,10 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
.map(AssetSupplyChainCpPo::getAssetId) .map(AssetSupplyChainCpPo::getAssetId)
.collect(Collectors.toList()); .collect(Collectors.toList());
//删除原有数据 //删除原有数据
assetSupplyChainService.deleteIdList(SupplyChainidList); if (CollectionUtil.isNotEmpty(SupplyChainidList)) {
assetSupplyChainService.deleteIdList(SupplyChainidList);
}
List<AssetSupplyChain> SupplyChainNewList = SupplyChainList.stream() List<AssetSupplyChain> SupplyChainNewList = SupplyChainList.stream()
.map(cpPo -> { .map(cpPo -> {
AssetSupplyChain supplyChain = new AssetSupplyChain(); AssetSupplyChain supplyChain = new AssetSupplyChain();
@ -360,7 +375,9 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
.map(UnitOtherConcatCpPo::getAssetId) .map(UnitOtherConcatCpPo::getAssetId)
.collect(Collectors.toList()); .collect(Collectors.toList());
//删除原有数据 //删除原有数据
unitOtherConcatService.deleteIdList(UnitOtherConcatidList); if (CollectionUtil.isNotEmpty(UnitOtherConcatidList)) {
unitOtherConcatService.deleteIdList(UnitOtherConcatidList);
}
List<UnitOtherConcat> UnitOtherConcatNewList = UnitOtherConcatList.stream() List<UnitOtherConcat> UnitOtherConcatNewList = UnitOtherConcatList.stream()
.map(cpPo -> { .map(cpPo -> {
UnitOtherConcat unitOtherConcat = new UnitOtherConcat(); UnitOtherConcat unitOtherConcat = new UnitOtherConcat();

@ -6,7 +6,7 @@
</update> </update>
<delete id="deleteIdList"> <delete id="deleteIdList">
DELETE FROM asset_supply_chain DELETE FROM asset_supply_chain
WHERE id IN WHERE asset_id IN
<foreach item="id" index="index" collection="idList" open="(" separator="," close=")"> <foreach item="id" index="index" collection="idList" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>

@ -12,7 +12,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update> </update>
<delete id="deleteIdList"> <delete id="deleteIdList">
DELETE FROM unit_other_contact DELETE FROM unit_other_contact
WHERE id IN WHERE asset_id IN
<foreach item="id" index="index" collection="idList" open="(" separator="," close=")"> <foreach item="id" index="index" collection="idList" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>

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

Loading…
Cancel
Save