二版更新-定时任务50%

This commit is contained in:
lym
2024-08-09 09:37:52 +08:00
parent 689bf93cca
commit 4ce3b17212
41 changed files with 1500 additions and 1127 deletions
@@ -4,6 +4,7 @@ import com.cf.imes.framework.common.pojo.CommonResult;
import com.cf.imes.module.manage.enums.ApiConstants;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
@@ -17,11 +18,19 @@ public interface PlateApi {
@GetMapping(PREFIX +"/get")
@Operation(summary = "获得板材信息表")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
CommonResult<Boolean> getPlate(@RequestParam("id") Long id);
@Parameters({
@Parameter(name = "id", description = "编号", required = true, example = "1024"),
@Parameter(name = "organId", description = "板材所属组织ID", required = true, example = "1024")
})
CommonResult<Boolean> getPlate(@RequestParam("id") Long id,
@RequestParam("organId") Long organId);
@GetMapping(PREFIX +"/getGoodsId")
@Operation(summary = "判断板材是否存在")
@Parameter(name = "id", description = "客户的商品编号", required = true, example = "1024")
CommonResult<Long> getPlateGoods(@RequestParam("id") Long goodsId);
@Parameters({
@Parameter(name = "id", description = "客户的商品编号", required = true, example = "1024"),
@Parameter(name = "organId", description = "板材所属组织ID", required = true, example = "1024")
})
CommonResult<Long> getPlateGoods(@RequestParam("id") String goodsId,
@RequestParam("organId") Long organId);
}
@@ -8,14 +8,14 @@ import javax.annotation.Resource;
import static com.cf.imes.framework.common.pojo.CommonResult.success;
public class PlateServiceImpl implements PlateApi{
public class PlateServiceApiImpl implements PlateApi{
@Resource
private PlateService plateService;
@Override
public CommonResult<Boolean> getPlate(Long id) {
PlateDO plateDO = plateService.getPlate(id);
public CommonResult<Boolean> getPlate(Long id, Long organId) {
PlateDO plateDO = plateService.getPlate(id, organId);
if (plateDO == null) {
return success(false);
}
@@ -23,11 +23,11 @@ public class PlateServiceImpl implements PlateApi{
}
@Override
public CommonResult<Long> getPlateGoods(Long goodsId) {
public CommonResult<Long> getPlateGoods(String goodsId, Long organId) {
if (goodsId == null) {
return success(0L);
}
PlateDO plateDO = plateService.getPlateGoods(goodsId);
PlateDO plateDO = plateService.getPlateGoods(goodsId, organId);
if (plateDO == null) {
return success(0L);
}
@@ -68,18 +68,22 @@ public class PlateController {
// @PreAuthorize("@ss.hasPermission('manage:plate:delete')")
@PreAuthorize("@ss.hasAnyPermissions('manage:plate:delete','base:plate:delete')")
public CommonResult<Boolean> deletePlate(@RequestParam("id") Long id,
@RequestParam(value = "organId",required = false) Long organId) {
@RequestParam(value = "organId",required = false, defaultValue = "0") Long organId) {
plateService.deletePlate(id,organId);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得板材信息")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@Parameters({
@Parameter(name = "id", description = "编号", required = true, example = "1024"),
@Parameter(name = "organId", description = "板材所属组织ID", required = true, example = "1024")
})
// @PreAuthorize("@ss.hasPermission('manage:plate:query')")
@PreAuthorize("@ss.hasAnyPermissions('manage:plate:query','base:plate:query')")
public CommonResult<PlateRespVO> getPlate(@RequestParam("id") Long id) {
PlateDO plate = plateService.getPlate(id);
public CommonResult<PlateRespVO> getPlate(@RequestParam("id") Long id,
@RequestParam("organId") Long organId) {
PlateDO plate = plateService.getPlate(id, organId);
return success(BeanUtils.toBean(plate, PlateRespVO.class));
}
@@ -66,7 +66,7 @@ public class RemainPlateController {
@Operation(summary = "余料板批量核销")
@PreAuthorize("@ss.hasPermission('placeorder:remain')")
public CommonResult<Boolean> updateRemainPlate(@RequestBody RemainPlateUptReqVO updateReqVO) {
remainPlateService.updateRemainPlateStatus(updateReqVO.getId(),
remainPlateService.updateRemainPlateStatus(updateReqVO.getIds(),
updateReqVO.getStatus(),
updateReqVO.getUseType(),
updateReqVO.getPlanId());
@@ -77,7 +77,7 @@ public class RemainPlateController {
@Operation(summary = "余料板批量释放")
@PreAuthorize("@ss.hasPermission('placeorder:remain')")
public CommonResult<Boolean> revertRemainPlate(@RequestBody RemainPlateUptReqVO updateReqVO) {
remainPlateService.revertRemainPlateStatus(updateReqVO.getId(),updateReqVO.getStatus());
remainPlateService.revertRemainPlateStatus(updateReqVO.getIds(),updateReqVO.getStatus());
return success(true);
}
@@ -10,7 +10,7 @@ import java.util.Set;
public class RemainPlateUptReqVO {
@Schema(description = "余料板集", example = "16470")
private Set<Long> id;
private Set<Long> ids;
@Schema(description = "余料板状态,0未使用,1使用中", example = "1")
private Integer status;
@@ -46,7 +46,7 @@ public interface PlateService {
* @param id 编号
* @return 板材信息表 plate_{N}
*/
PlateDO getPlate(Long id);
PlateDO getPlate(Long id, Long organId);
/**
* 获得板材信息表 plate_{N}
@@ -54,7 +54,7 @@ public interface PlateService {
* @param id 编号
* @return 板材信息表 plate_{N}
*/
PlateDO getPlateGoods(Long id);
PlateDO getPlateGoods(String id, Long organId);
/**
* 获得板材信息表 plate_{N}分页
@@ -96,16 +96,18 @@ public class PlateServiceImpl implements PlateService {
@OrganIgnore
@Transactional(rollbackFor = Exception.class)
public void deletePlate(Long id,Long organId) {
if (permissionApi.hasRoles(getLoginUser().getId(), BASE_PLATE_DELETE_PERMISSION).getData()){
if (organId != null && organId != 0 ){
validateOrganExists(organId);
}
} else {
organId = OrganContextHolder.getOrganId();
}
boolean hasPermission = permissionApi.hasRoles(getLoginUser().getId(), BASE_PLATE_DELETE_PERMISSION).getData();
Long organIdDefault = OrganContextHolder.getOrganId();
if (hasPermission && organId != null && organId != 0) {
validateOrganExists(organId);
organIdDefault = organId;
}
// 校验存在
validatePlateExists(id,organId);
validatePlateExists(id,organIdDefault);
// 删除
plateMapper.deleteById(id);
}
@@ -118,13 +120,13 @@ public class PlateServiceImpl implements PlateService {
@Override
@OrganIgnore
public PlateDO getPlate(Long id) {
return plateMapper.selectById(id);
public PlateDO getPlate(Long id, Long organId) {
return plateMapper.selectOneById(id, organId);
}
@Override
public PlateDO getPlateGoods(Long id) {
return plateMapper.selectOne(PlateDO::getGoodsId,id);
public PlateDO getPlateGoods(String id, Long organId) {
return plateMapper.selectByGoodID(id,organId);
}
@Override
@@ -68,6 +68,8 @@ public class RemainPlateServiceImpl implements RemainPlateService {
@Override
@Transactional(rollbackFor = Exception.class)
public void updateRemainPlateStatus(Set<Long> ids, Integer status, Integer useType, Long planId) {
// 余料存在判断
validateRemainPlateExists(ids);
if (useType != RemainPlateUseTypeEnum.TYPE_ONE.getStatus() && useType != RemainPlateUseTypeEnum.TYPE_ZERO.getStatus()) { //余料使用状态为2或3
// 判断该排单是否存在以使用的余料
if (remainPlateMapper.selectRemainPlatesByPlanId(planId, RemainPlateStatusEnum.IN_USE.getStatus(),
@@ -127,6 +129,8 @@ public class RemainPlateServiceImpl implements RemainPlateService {
if (ids == null) {
throw exception(REMAIN_PLATE_ID_NOT_EXISTS);
}
// 余料存在判断
validateRemainPlateExists(ids);
// 判断余料的状态是否存在使用中
validateRemainPlateStatus(ids, RemainPlateStatusEnum.IN_USE.getStatus());
// 删除
@@ -150,7 +154,11 @@ public class RemainPlateServiceImpl implements RemainPlateService {
throw exception(REMAIN_PLATE_NOT_EXISTS);
}
}
private void validateRemainPlateExists(Set<Long> id) {
if (remainPlateMapper.selectBatchIds(id).isEmpty()) {
throw exception(REMAIN_PLATE_NOT_EXISTS);
}
}
private RemainPlateDO validateRemainPlateIsCutting(Long id) {
return remainPlateMapper.selectById(id);
}