移动破删除调整
This commit is contained in:
parent
85e077feed
commit
8160b5c0a6
|
|
@ -14,6 +14,7 @@ import com.nflg.product.bomnew.excel.ExportDeviceHelper;
|
||||||
import com.nflg.product.bomnew.excel.PreviewProduceExcelExportHelper;
|
import com.nflg.product.bomnew.excel.PreviewProduceExcelExportHelper;
|
||||||
import com.nflg.product.bomnew.excel.PreviewTmpExcelExportHelper;
|
import com.nflg.product.bomnew.excel.PreviewTmpExcelExportHelper;
|
||||||
import com.nflg.product.bomnew.pojo.dto.*;
|
import com.nflg.product.bomnew.pojo.dto.*;
|
||||||
|
import com.nflg.product.bomnew.pojo.entity.OptionalEbomConfigEntity;
|
||||||
import com.nflg.product.bomnew.pojo.query.OptionalEbomConfigListQuery;
|
import com.nflg.product.bomnew.pojo.query.OptionalEbomConfigListQuery;
|
||||||
import com.nflg.product.bomnew.pojo.query.OptionalEbomImportChildQuery;
|
import com.nflg.product.bomnew.pojo.query.OptionalEbomImportChildQuery;
|
||||||
import com.nflg.product.bomnew.pojo.query.OptionalEbomMainListQuery;
|
import com.nflg.product.bomnew.pojo.query.OptionalEbomMainListQuery;
|
||||||
|
|
@ -200,9 +201,16 @@ public class OptionalEbomApi extends BaseApi {
|
||||||
}
|
}
|
||||||
if(Objects.equals(dto.getPartType() , OptionalBomConstant.PartTypeEnum.PART_TYPE_CHECBOX.getValue())){
|
if(Objects.equals(dto.getPartType() , OptionalBomConstant.PartTypeEnum.PART_TYPE_CHECBOX.getValue())){
|
||||||
dto.setParentRowId(null);
|
dto.setParentRowId(null);
|
||||||
|
OptionalEbomConfigEntity entity= optionalEbomConfigService.getById(dto.getRootRowId());
|
||||||
|
|
||||||
|
if(entity!=null){
|
||||||
|
dto.setRootRowId(entity.getParentRowId());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if (this.optionalEbomImportChildService.insertOption(dto)) {
|
if (this.optionalEbomImportChildService.insertOption(dto)) {
|
||||||
return ResultVO.success(true);
|
return ResultVO.success(true);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -263,7 +271,7 @@ public class OptionalEbomApi extends BaseApi {
|
||||||
@GetMapping("tmpOptionTree")
|
@GetMapping("tmpOptionTree")
|
||||||
@ApiOperation("获取暂存数据选项")
|
@ApiOperation("获取暂存数据选项")
|
||||||
public ResultVO<OptionalEbomConfigTmpAggregVO> tmpOptionTree(@ApiParam("暂存id") @RequestParam("rowId") Long rowId) {
|
public ResultVO<OptionalEbomConfigTmpAggregVO> tmpOptionTree(@ApiParam("暂存id") @RequestParam("rowId") Long rowId) {
|
||||||
return ResultVO.success(aggregOptionConfigService.tmpOptionTree(rowId));
|
return ResultVO.success(aggregOptionConfigService.tmpOptionInfoList(rowId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping ("submitTmpOptionTree")
|
@PostMapping ("submitTmpOptionTree")
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,12 @@ public interface OptionalEbomConfigMapper extends BaseMapper<OptionalEbomConfigE
|
||||||
|
|
||||||
List<OptionalEbomImportChildVO> getTmpOptionList(@Param("rowId") Long rowId);
|
List<OptionalEbomImportChildVO> getTmpOptionList(@Param("rowId") Long rowId);
|
||||||
|
|
||||||
|
|
||||||
List<OptionalEbomImportChildVO> getPreviewOptionList(@Param("rowId") Long rowId);
|
List<OptionalEbomImportChildVO> getPreviewOptionList(@Param("rowId") Long rowId);
|
||||||
|
|
||||||
|
List<OptionalEbomImportChildVO> getTmpOptionInfoList(@Param("rowId") Long rowId);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ import com.nflg.product.bomnew.mapper.master.OptionalEbomImportChildMapper;
|
||||||
import com.nflg.product.bomnew.pojo.dto.OptionalEbomImportChildAddDTO;
|
import com.nflg.product.bomnew.pojo.dto.OptionalEbomImportChildAddDTO;
|
||||||
import com.nflg.product.bomnew.pojo.dto.OptionalEbomImportChildDTO;
|
import com.nflg.product.bomnew.pojo.dto.OptionalEbomImportChildDTO;
|
||||||
import com.nflg.product.bomnew.pojo.dto.OptionalEbomMainDelDTO;
|
import com.nflg.product.bomnew.pojo.dto.OptionalEbomMainDelDTO;
|
||||||
|
import com.nflg.product.bomnew.pojo.entity.OptionalEbomConfigREntity;
|
||||||
import com.nflg.product.bomnew.pojo.entity.OptionalEbomImportChildEntity;
|
import com.nflg.product.bomnew.pojo.entity.OptionalEbomImportChildEntity;
|
||||||
import com.nflg.product.bomnew.pojo.entity.OptionalEbomImportEntity;
|
import com.nflg.product.bomnew.pojo.entity.OptionalEbomImportEntity;
|
||||||
import com.nflg.product.bomnew.pojo.query.OptionalEbomImportChildQuery;
|
import com.nflg.product.bomnew.pojo.query.OptionalEbomImportChildQuery;
|
||||||
|
|
@ -197,12 +198,12 @@ public class OptionalEbomImportChildService extends ServiceImpl<OptionalEbomImpo
|
||||||
List<Long> optionIdList=list.stream().map(OptionalEbomConfigRVO::getOptionRowId).collect(Collectors.toList());
|
List<Long> optionIdList=list.stream().map(OptionalEbomConfigRVO::getOptionRowId).collect(Collectors.toList());
|
||||||
|
|
||||||
//交集 相同
|
//交集 相同
|
||||||
List<Long> intersectionList2= CollectionUtil.intersection(longIds, optionIdList).stream().collect(Collectors.toList());
|
// List<Long> intersectionList2= CollectionUtil.intersection(longIds, optionIdList).stream().collect(Collectors.toList());
|
||||||
//差 第一个list 不同部分
|
//差 第一个list 不同部分
|
||||||
List<Long> subList2= CollectionUtil.subtract(longIds, optionIdList).stream().collect(Collectors.toList());
|
List<Long> subList2= CollectionUtil.subtract(longIds, optionIdList).stream().collect(Collectors.toList());
|
||||||
if(CollectionUtil.isNotEmpty(intersectionList2)){
|
// if(CollectionUtil.isNotEmpty(intersectionList2)){
|
||||||
intersectionList.addAll(intersectionList2);
|
// intersectionList.addAll(intersectionList2);
|
||||||
}
|
// }
|
||||||
if(CollectionUtil.isNotEmpty(subList2)){
|
if(CollectionUtil.isNotEmpty(subList2)){
|
||||||
subList.addAll(subList2);
|
subList.addAll(subList2);
|
||||||
}
|
}
|
||||||
|
|
@ -210,19 +211,20 @@ public class OptionalEbomImportChildService extends ServiceImpl<OptionalEbomImpo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (CollectionUtil.isNotEmpty(intersectionList)) {
|
// if (CollectionUtil.isNotEmpty(intersectionList)) {
|
||||||
updateDelStatusByRowId(intersectionList);
|
// updateDelStatusByRowId(intersectionList);
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CollectionUtil.isNotEmpty(subList)) {
|
|
||||||
|
|
||||||
deleteByRowId(subList);
|
|
||||||
}
|
|
||||||
//
|
//
|
||||||
// String rowIds = longIds.stream().map(Object::toString)
|
// }
|
||||||
// .collect(Collectors.joining(","));
|
|
||||||
// return getBaseMapper().deleteByRowId(rowIds) > 0;
|
//删除未发布的选配 及暂存的选配
|
||||||
|
if (CollectionUtil.isNotEmpty(subList)) {
|
||||||
|
deleteByRowId(subList);
|
||||||
|
QueryWrapper<OptionalEbomConfigREntity> delOptionWrapper= new QueryWrapper();
|
||||||
|
delOptionWrapper.lambda().in(OptionalEbomConfigREntity::getOptionRowId,subList);
|
||||||
|
SpringUtil.getBean(OptionalEbomConfigRService.class).remove(delOptionWrapper);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ import com.nflg.product.bomnew.mapper.master.OptionalEbomMainMapper;
|
||||||
import com.nflg.product.bomnew.pojo.dto.OptionalEbomMainDTO;
|
import com.nflg.product.bomnew.pojo.dto.OptionalEbomMainDTO;
|
||||||
import com.nflg.product.bomnew.pojo.dto.OptionalEbomMainDelDTO;
|
import com.nflg.product.bomnew.pojo.dto.OptionalEbomMainDelDTO;
|
||||||
import com.nflg.product.bomnew.pojo.entity.OptionalEbomConfigEntity;
|
import com.nflg.product.bomnew.pojo.entity.OptionalEbomConfigEntity;
|
||||||
|
import com.nflg.product.bomnew.pojo.entity.OptionalEbomConfigREntity;
|
||||||
import com.nflg.product.bomnew.pojo.entity.OptionalEbomImportEntity;
|
import com.nflg.product.bomnew.pojo.entity.OptionalEbomImportEntity;
|
||||||
import com.nflg.product.bomnew.pojo.entity.OptionalEbomMainEntity;
|
import com.nflg.product.bomnew.pojo.entity.OptionalEbomMainEntity;
|
||||||
import com.nflg.product.bomnew.pojo.query.OptionalEbomMainListQuery;
|
import com.nflg.product.bomnew.pojo.query.OptionalEbomMainListQuery;
|
||||||
|
|
@ -76,7 +77,9 @@ public class OptionalEbomMainService extends ServiceImpl<OptionalEbomMainMapper,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除机型
|
* 删除机型
|
||||||
* 1.如果没有已发布的就全删 (机型 选项 暂存),存在发布的 只删掉机型,选项并打删除标签
|
* 1.如果没有已发布的就全删 (机型 选项 暂存),
|
||||||
|
* 2.删掉暂存数据
|
||||||
|
* 存在发布的 只删掉机型,
|
||||||
*
|
*
|
||||||
* @param dto
|
* @param dto
|
||||||
* @return
|
* @return
|
||||||
|
|
@ -96,11 +99,15 @@ public class OptionalEbomMainService extends ServiceImpl<OptionalEbomMainMapper,
|
||||||
List<OptionalEbomConfigEntity> configList = SpringUtil.getBean(OptionalEbomConfigService.class).list(queryWrapper);
|
List<OptionalEbomConfigEntity> configList = SpringUtil.getBean(OptionalEbomConfigService.class).list(queryWrapper);
|
||||||
List<OptionalEbomConfigEntity> publishList = configList.stream().filter(item -> item.getEditStatus().equals(OptionalBomConstant.PublishEnum.PUBLISH.getValue())).collect(Collectors.toList());
|
List<OptionalEbomConfigEntity> publishList = configList.stream().filter(item -> item.getEditStatus().equals(OptionalBomConstant.PublishEnum.PUBLISH.getValue())).collect(Collectors.toList());
|
||||||
List<OptionalEbomConfigEntity> tmpList = configList.stream().filter(item -> item.getEditStatus().equals(OptionalBomConstant.PublishEnum.TMP.getValue())).collect(Collectors.toList());
|
List<OptionalEbomConfigEntity> tmpList = configList.stream().filter(item -> item.getEditStatus().equals(OptionalBomConstant.PublishEnum.TMP.getValue())).collect(Collectors.toList());
|
||||||
|
|
||||||
|
|
||||||
if (CollectionUtil.isNotEmpty(publishList)) {
|
if (CollectionUtil.isNotEmpty(publishList)) {
|
||||||
updateList.add(rowId);
|
updateList.add(rowId);
|
||||||
} else {
|
} else {
|
||||||
delList.add(rowId);
|
delList.add(rowId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (CollectionUtil.isNotEmpty(tmpList)) {
|
if (CollectionUtil.isNotEmpty(tmpList)) {
|
||||||
delTmpList.addAll(tmpList.stream().map(OptionalEbomConfigEntity::getRowId).collect(Collectors.toList()));
|
delTmpList.addAll(tmpList.stream().map(OptionalEbomConfigEntity::getRowId).collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
|
|
@ -109,19 +116,26 @@ public class OptionalEbomMainService extends ServiceImpl<OptionalEbomMainMapper,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//无发布把选配数据删掉
|
||||||
if (CollectionUtil.isNotEmpty(delList)) {
|
if (CollectionUtil.isNotEmpty(delList)) {
|
||||||
optionalEbomImportService.deleteByRootId(delList);
|
optionalEbomImportService.deleteByRootId(delList);
|
||||||
optionalEbomImportChildService.deleteByRootId(delList);
|
optionalEbomImportChildService.deleteByRootId(delList);
|
||||||
}
|
}
|
||||||
if (CollectionUtil.isNotEmpty(updateList)) {
|
|
||||||
optionalEbomImportService.updateDelStatusByRooId(updateList);
|
// if (CollectionUtil.isNotEmpty(updateList)) {
|
||||||
optionalEbomImportChildService.updateDelStatusByRootId(updateList);
|
// optionalEbomImportService.updateDelStatusByRooId(updateList);
|
||||||
}
|
// optionalEbomImportChildService.updateDelStatusByRootId(updateList);
|
||||||
|
// }
|
||||||
//操作删除或更新
|
//操作删除或更新
|
||||||
deleteByRowIds(dto.getRowIdList());
|
deleteByRowIds(dto.getRowIdList());
|
||||||
|
|
||||||
|
//联动删除机型下选配数据
|
||||||
if (CollectionUtil.isNotEmpty(delTmpList)) {
|
if (CollectionUtil.isNotEmpty(delTmpList)) {
|
||||||
SpringUtil.getBean(OptionalEbomConfigService.class).deleteByIds(delTmpList);
|
SpringUtil.getBean(OptionalEbomConfigService.class).deleteByIds(delTmpList);
|
||||||
|
QueryWrapper<OptionalEbomConfigREntity> delOptionWrapper= new QueryWrapper();
|
||||||
|
delOptionWrapper.lambda().in(OptionalEbomConfigREntity::getParentRowId,delTmpList);
|
||||||
|
SpringUtil.getBean(OptionalEbomConfigRService.class).remove(delOptionWrapper);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -205,6 +205,28 @@ public class AggregOptionConfigService {
|
||||||
return tmpVo;
|
return tmpVo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 暂存
|
||||||
|
* @param rowId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public OptionalEbomConfigTmpAggregVO tmpOptionInfoList(Long rowId) {
|
||||||
|
OptionalEbomConfigEntity optionalEbomConfigEntity = optionalEbomConfigService.getById(rowId);
|
||||||
|
OptionalEbomConfigTmpAggregVO tmpVo = new OptionalEbomConfigTmpAggregVO();
|
||||||
|
if (optionalEbomConfigEntity != null) {
|
||||||
|
OptionalEbomConfigVO optionalEbomConfigVO = Convert.convert(new TypeReference<OptionalEbomConfigVO>() {
|
||||||
|
}, optionalEbomConfigEntity);
|
||||||
|
|
||||||
|
tmpVo.setDeviceInfo(optionalEbomConfigVO);
|
||||||
|
List<OptionalEbomImportVO> listParent = optionalEbomImportService.getByRootIdList(optionalEbomConfigEntity.getParentRowId());
|
||||||
|
List<OptionalEbomImportChildVO> listChild = optionalEbomConfigService.getBaseMapper().getTmpOptionInfoList(rowId);
|
||||||
|
OptionalEbomConfigAggregVO optionalEbomConfigAggregVO= filterTree(listParent,listChild);
|
||||||
|
tmpVo.setSingleList(optionalEbomConfigAggregVO.getSingleList());
|
||||||
|
tmpVo.setMulList(optionalEbomConfigAggregVO.getMulList());
|
||||||
|
}
|
||||||
|
return tmpVo;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编辑暂存数据
|
* 编辑暂存数据
|
||||||
|
|
|
||||||
|
|
@ -52,8 +52,8 @@ public class PublishMaterialService {
|
||||||
* 2.更改状态
|
* 2.更改状态
|
||||||
* 3.上传sap
|
* 3.上传sap
|
||||||
*
|
*
|
||||||
* @param rowId
|
*
|
||||||
*/
|
|
||||||
|
|
||||||
public void publish(Long rowId) {
|
public void publish(Long rowId) {
|
||||||
|
|
||||||
|
|
@ -73,7 +73,7 @@ public class PublishMaterialService {
|
||||||
|
|
||||||
System.out.println(result);
|
System.out.println(result);
|
||||||
System.out.println(signMd5);
|
System.out.println(signMd5);
|
||||||
}
|
} */
|
||||||
|
|
||||||
|
|
||||||
public ResultVO<String> publishWork(OptionalEbomPublishAddDTO optionalEbomPublishAddDTO) {
|
public ResultVO<String> publishWork(OptionalEbomPublishAddDTO optionalEbomPublishAddDTO) {
|
||||||
|
|
@ -218,7 +218,7 @@ public class PublishMaterialService {
|
||||||
*/
|
*/
|
||||||
private void genVirtualPackMachineLevel2(List<OptionalMbomMaterialEntity> materialList, List<OptionalEbomImportChildVO> optionList, Long rootRowId, Long parentId, String desc) throws NflgBusinessException {
|
private void genVirtualPackMachineLevel2(List<OptionalMbomMaterialEntity> materialList, List<OptionalEbomImportChildVO> optionList, Long rootRowId, Long parentId, String desc) throws NflgBusinessException {
|
||||||
|
|
||||||
List<Long> materialNoList = optionList.stream().map(OptionalEbomImportChildVO::getMaterialNo).map(Long::parseLong).collect(Collectors.toList());
|
List<Long> materialNoList = optionList.stream().filter(u-> u.getPartType().equals(OptionalBomConstant.PartTypeEnum.PART_TYPE_RADIO.getValue()) ).map(OptionalEbomImportChildVO::getMaterialNo).map(Long::parseLong).collect(Collectors.toList());
|
||||||
Collections.sort(materialNoList);
|
Collections.sort(materialNoList);
|
||||||
String result = materialNoList.stream().map(String::valueOf).collect(Collectors.joining(","));
|
String result = materialNoList.stream().map(String::valueOf).collect(Collectors.joining(","));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,9 +52,22 @@
|
||||||
order by created_time desc
|
order by created_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="getTmpOptionInfoList" resultType="com.nflg.product.bomnew.pojo.vo.OptionalEbomImportChildVO" >
|
||||||
|
|
||||||
|
SELECT t1.*, IFNULL(t2.choose_status, 0) as option_status from ( SELECT t1.* from t_optional_ebom_import_child t1 where t1.root_row_id in ( select parent_row_id FROM t_optional_ebom_config where row_id=#{rowId}) and t1.is_enable=1 ) as t1
|
||||||
|
|
||||||
|
left JOIN t_optional_ebom_config_r as t2 on t1.row_id=t2.option_row_id WHERE t2.parent_row_id=#{rowId}
|
||||||
|
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!--查询指定行数据-->
|
<!--查询指定行数据-->
|
||||||
<select id="getTmpOptionList" resultType="com.nflg.product.bomnew.pojo.vo.OptionalEbomImportChildVO" >
|
<select id="getTmpOptionList" resultType="com.nflg.product.bomnew.pojo.vo.OptionalEbomImportChildVO" >
|
||||||
|
|
||||||
|
|
||||||
SELECT t1.row_id,
|
SELECT t1.row_id,
|
||||||
t1.parent_row_id,
|
t1.parent_row_id,
|
||||||
t1.root_row_id,
|
t1.root_row_id,
|
||||||
|
|
@ -75,6 +88,10 @@
|
||||||
t_optional_ebom_config_r as t2 LEFT JOIN t_optional_ebom_import_child as t1 on t2.option_row_id=t1.row_id
|
t_optional_ebom_config_r as t2 LEFT JOIN t_optional_ebom_import_child as t1 on t2.option_row_id=t1.row_id
|
||||||
where t1.is_enable=1 and t2.parent_row_id=#{rowId}
|
where t1.is_enable=1 and t2.parent_row_id=#{rowId}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue