mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-14 05:42:06 +08:00
超管统计接口50%
This commit is contained in:
+1
-3
@@ -7,7 +7,5 @@ package com.cf.imes.module.manage.enums;
|
||||
*/
|
||||
public interface DictTypeConstants {
|
||||
|
||||
String SYNTHESIS_TYPE = "synthesisType";//加工组类型
|
||||
|
||||
String PLATE_TEXTURE = "product_manger_texture_type";// 板件纹路
|
||||
String PLATE_TEXTURE = "plate_texture_type";// 板件纹路
|
||||
}
|
||||
|
||||
+2
-2
@@ -66,7 +66,7 @@ public class RemainPlateController {
|
||||
@Operation(summary = "余料板批量核销")
|
||||
@PreAuthorize("@ss.hasPermission('placeorder:remain')")
|
||||
public CommonResult<Boolean> updateRemainPlate(@RequestBody RemainPlateUptReqVO updateReqVO) {
|
||||
remainPlateService.updateRemainPlateStatus(updateReqVO.getIds(),
|
||||
remainPlateService.updateRemainPlateStatus(updateReqVO.getId(),
|
||||
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.getIds(),updateReqVO.getStatus());
|
||||
remainPlateService.revertRemainPlateStatus(updateReqVO.getId(),updateReqVO.getStatus());
|
||||
return success(true);
|
||||
}
|
||||
|
||||
|
||||
+5
-1
@@ -1,5 +1,8 @@
|
||||
package com.cf.imes.module.manage.controller.admin.plate.vo.plate;
|
||||
|
||||
import com.cf.imes.framework.excel.core.annotations.DictFormat;
|
||||
import com.cf.imes.framework.excel.core.convert.DictConvert;
|
||||
import com.cf.imes.module.system.enums.DictTypeConstants;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
@@ -32,7 +35,8 @@ public class PlateRespVO {
|
||||
private String color;
|
||||
|
||||
@Schema(description = "纹理", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("纹理")
|
||||
@ExcelProperty(value = "纹理", converter = DictConvert.class)
|
||||
@DictFormat(DictTypeConstants.USER_SEX)
|
||||
private Boolean texture;
|
||||
|
||||
@Schema(description = "宽度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ import java.util.Set;
|
||||
public class RemainPlateUptReqVO {
|
||||
|
||||
@Schema(description = "余料板集", example = "16470")
|
||||
private Set<Long> ids;
|
||||
private Set<Long> id;
|
||||
|
||||
@Schema(description = "余料板状态,0未使用,1使用中", example = "1")
|
||||
private Integer status;
|
||||
|
||||
+46
-62
@@ -1,7 +1,5 @@
|
||||
package com.cf.imes.module.manage.service.plate;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.framework.organ.core.aop.OrganIgnore;
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
@@ -58,15 +56,10 @@ public class PlateServiceImpl implements PlateService {
|
||||
@OrganIgnore
|
||||
public Long createPlate(PlateSaveReqVO createReqVO) {
|
||||
PlateDO plate = BeanUtils.toBean(createReqVO, PlateDO.class);
|
||||
if (permissionApi.hasRoles(getLoginUser().getId(), BASE_PLATE_CREATE_PERMISSION).getData()){
|
||||
if (plate.getOrganId() != null && plate.getOrganId() != 0 ){
|
||||
validateOrganExists(plate.getOrganId());
|
||||
}
|
||||
} else {
|
||||
plate.setOrganId(OrganContextHolder.getOrganId());
|
||||
}
|
||||
|
||||
// 判断板材是否存在
|
||||
validateGoodExists(plate.getGoodsId(),plate.getOrganId());
|
||||
validateGoodExists(plate.getGoodsId(),
|
||||
getOrganId(BASE_PLATE_CREATE_PERMISSION, getLoginUser().getId(), plate.getOrganId()));
|
||||
|
||||
plateMapper.insert(plate);// 组织id未传输
|
||||
// 返回
|
||||
@@ -77,17 +70,9 @@ public class PlateServiceImpl implements PlateService {
|
||||
@OrganIgnore
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updatePlate(PlateSaveReqVO updateReqVO) {
|
||||
// 更新 判断是否有组织id
|
||||
if (permissionApi.hasRoles(getLoginUser().getId(), BASE_PLATE_UPDATE_PERMISSION).getData()){
|
||||
if (updateReqVO.getOrganId() != null && updateReqVO.getOrganId() != 0 ){
|
||||
validateOrganExists(updateReqVO.getOrganId());
|
||||
}
|
||||
} else {
|
||||
updateReqVO.setOrganId(OrganContextHolder.getOrganId());
|
||||
}
|
||||
|
||||
// 校验存在
|
||||
validatePlateExists(updateReqVO.getId(), updateReqVO.getOrganId());
|
||||
validatePlateExists(updateReqVO.getId(),
|
||||
getOrganId(BASE_PLATE_UPDATE_PERMISSION, getLoginUser().getId(), updateReqVO.getOrganId()));
|
||||
PlateDO updateObj = BeanUtils.toBean(updateReqVO, PlateDO.class);
|
||||
plateMapper.updateById(updateObj);
|
||||
}
|
||||
@@ -95,25 +80,16 @@ public class PlateServiceImpl implements PlateService {
|
||||
@Override
|
||||
@OrganIgnore
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deletePlate(Long id,Long organId) {
|
||||
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;
|
||||
}
|
||||
public void deletePlate(Long id, Long organId) {
|
||||
// 校验存在
|
||||
validatePlateExists(id,organIdDefault);
|
||||
validatePlateExists(id,
|
||||
getOrganId(BASE_PLATE_DELETE_PERMISSION, getLoginUser().getId(), organId));
|
||||
// 删除
|
||||
plateMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validatePlateExists(Long id,Long organId) {
|
||||
if (plateMapper.selectOneById(id,organId) == null) {
|
||||
private void validatePlateExists(Long id, Long organId) {
|
||||
if (plateMapper.selectOneById(id, organId) == null) {
|
||||
throw exception(PLATE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
@@ -126,22 +102,22 @@ public class PlateServiceImpl implements PlateService {
|
||||
|
||||
@Override
|
||||
public PlateDO getPlateGoods(String id, Long organId) {
|
||||
return plateMapper.selectByGoodID(id,organId);
|
||||
return plateMapper.selectByGoodID(id, organId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@OrganIgnore
|
||||
public PageResult<PlateDO> getPlatePage(PlatePageReqVO pageReqVO) {
|
||||
if (permissionApi.hasRoles(getLoginUser().getId(), BASE_PLATE_QUERY_PERMISSION).getData()){
|
||||
if (pageReqVO.getOrganId() != null && pageReqVO.getOrganId() != 0 ){
|
||||
validateOrganExists(pageReqVO.getOrganId());
|
||||
}
|
||||
} else {
|
||||
pageReqVO.setOrganId(OrganContextHolder.getOrganId());
|
||||
}
|
||||
if (pageReqVO.getOrganId() == null || pageReqVO.getOrganId() == 0){
|
||||
pageReqVO.setOrganId(OrganContextHolder.getOrganId());
|
||||
}
|
||||
// if (permissionApi.hasRoles(getLoginUser().getId(), BASE_PLATE_QUERY_PERMISSION).getData()) {
|
||||
// if (pageReqVO.getOrganId() != null && pageReqVO.getOrganId() != 0) {
|
||||
// validateOrganExists(pageReqVO.getOrganId());
|
||||
// }
|
||||
// } else {
|
||||
// pageReqVO.setOrganId(OrganContextHolder.getOrganId());
|
||||
// }
|
||||
// if (pageReqVO.getOrganId() == null || pageReqVO.getOrganId() == 0) {
|
||||
pageReqVO.setOrganId(getOrganId(BASE_PLATE_QUERY_PERMISSION, getLoginUser().getId(), pageReqVO.getOrganId()));
|
||||
// }
|
||||
return plateMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@@ -149,18 +125,10 @@ public class PlateServiceImpl implements PlateService {
|
||||
@Override
|
||||
@OrganIgnore
|
||||
@Transactional(rollbackFor = Exception.class) // 添加事务,异常则回滚所有导入
|
||||
public PlateImportRespVO importPlateList(List<PlateImportExcelVO> importPlates, boolean isUpdateSupport , Long organId) {
|
||||
// System.out.println(" importPlates " + importPlates);
|
||||
// if (CollUtil.isEmpty(importPlates)) {
|
||||
// throw ServiceExceptionUtil.exception(ErrorCodeConstants.PLATE_IMPORT_LIST_IS_EMPTY);
|
||||
// }
|
||||
if (permissionApi.hasRoles(getLoginUser().getId(), BASE_PLATE_IMPORT_PERMISSION).getData()){
|
||||
if (organId != null && organId != 0 ){
|
||||
validateOrganExists(organId);
|
||||
}
|
||||
} else {
|
||||
organId = OrganContextHolder.getOrganId();
|
||||
}
|
||||
public PlateImportRespVO importPlateList(List<PlateImportExcelVO> importPlates, boolean isUpdateSupport, Long organId) {
|
||||
|
||||
organId = getOrganId(BASE_PLATE_IMPORT_PERMISSION, getLoginUser().getId(), organId);
|
||||
|
||||
PlateImportRespVO respVO = PlateImportRespVO.builder().createPlateNames(new ArrayList<>())
|
||||
.updatePlateNames(new ArrayList<>()).failurePlateNames(new LinkedHashMap<>()).build();
|
||||
// 批量插入集合
|
||||
@@ -184,27 +152,43 @@ public class PlateServiceImpl implements PlateService {
|
||||
}
|
||||
});
|
||||
// 批量插入,批量更新
|
||||
if (insertList.size() > 0 && insertList != null) {
|
||||
if (insertList.size() > 0) {
|
||||
plateMapper.insertBatch(insertList);
|
||||
}
|
||||
if (updateList.size() > 0 && updateList != null) {
|
||||
if (updateList.size() > 0) {
|
||||
plateMapper.updateBatch(updateList);
|
||||
}
|
||||
return respVO;
|
||||
}
|
||||
|
||||
private void validateOrganExists(Long organId) {
|
||||
CommonResult<Boolean> index = organApi.validOrgan(organId);
|
||||
CommonResult<Boolean> index = organApi.validOrgan(organId);
|
||||
if (!index.isSuccess()) {
|
||||
throw exception(ErrorCodeConstants.ORGAN_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
// 当前组织中板材是否存在
|
||||
private void validateGoodExists(String goodsId ,Long organId) {
|
||||
if (plateMapper.selectByGoodID(goodsId ,organId) != null){
|
||||
private void validateGoodExists(String goodsId, Long organId) {
|
||||
if (plateMapper.selectByGoodID(goodsId, organId) != null) {
|
||||
throw exception(ErrorCodeConstants.PLATE_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
// 组织id返回
|
||||
private Long getOrganId(String type, Long userId, Long organId) {
|
||||
|
||||
boolean hasPermission = permissionApi.hasRoles(userId, type).getData();
|
||||
|
||||
Long organIdDefault = OrganContextHolder.getOrganId();
|
||||
|
||||
if (hasPermission && organId != null && organId != 0) {
|
||||
|
||||
validateOrganExists(organId);
|
||||
|
||||
organIdDefault = organId;
|
||||
}
|
||||
|
||||
return organIdDefault;
|
||||
}
|
||||
}
|
||||
+1
@@ -12,6 +12,7 @@
|
||||
color,
|
||||
width,
|
||||
height,
|
||||
texture,
|
||||
thickness,
|
||||
brand,
|
||||
spec,
|
||||
|
||||
Reference in New Issue
Block a user