mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
新增用户配置
This commit is contained in:
+5
@@ -266,6 +266,7 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode THE_CURRENT_PACKAGE_HAS_AN_UNSEALED_PACKAGE = new ErrorCode(1_002_038_666, "当前包裹还有未封包包裹");
|
||||
ErrorCode THE_CURRENT_PACKAGE_TYPE_IS_INCORRECT = new ErrorCode(1_002_038_777, "当前包裹类型错误");
|
||||
ErrorCode FAILED_TO_MODIFY_THE_STATUS_OF_THE_CURRENT_PRODUCTION_ORDER = new ErrorCode(1_002_038_778, "修改当前生产单的工序状态和生产单的状态失败");
|
||||
ErrorCode NO_OPTIMIZATION_INFORMATION_AVAILABLE = new ErrorCode(1_002_038_779, "当前订单无优化信息");
|
||||
|
||||
|
||||
//=========== 应用信息 1-002-037-000 ============
|
||||
@@ -278,4 +279,8 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode REMAIN_PLATE_STATUS_NO_USED = new ErrorCode(1_002_038_002, "余料板未使用");
|
||||
ErrorCode REMAIN_PLATE_USR_TYPE = new ErrorCode(1_002_038_003, "余料板使用类型为不可核销类型");
|
||||
ErrorCode REMAIN_PLATE_ID_NOT_EXISTS = new ErrorCode(1_002_038_004, "未选中余料板,请选择余料板");
|
||||
|
||||
|
||||
//=========== 用户的系统配置 1-002-039-000 ============
|
||||
ErrorCode CURRENTLY_NO_CONFIGURATION_AVAILABLE = new ErrorCode(1_002_039_001, "当前没有配置信息,请前往设置配置");
|
||||
}
|
||||
|
||||
+1
-1
@@ -24,6 +24,6 @@ public class DataSourceApiImpl implements DataSourceApi {
|
||||
if(Objects.isNull(dataSourceDO)) {
|
||||
throw exception(new ErrorCode(2133,"数据源不存在"));
|
||||
}
|
||||
return CommonResult.success(dataSourceDO.getSqlStr()) ;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
package com.cf.imes.module.system.controller.admin.setting;
|
||||
|
||||
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.module.system.controller.admin.datasource.vo.DataSourceFiledReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.setting.vo.PackageConfigReqVO;
|
||||
import com.cf.imes.module.system.service.setting.SettingService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
|
||||
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 系统配置")
|
||||
@RestController
|
||||
@RequestMapping("/system/setting")
|
||||
@Validated
|
||||
public class SettingController {
|
||||
|
||||
|
||||
@Resource
|
||||
private SettingService settingService;
|
||||
|
||||
|
||||
|
||||
@PutMapping("/insert")
|
||||
@Operation(summary = "新增系统配置")
|
||||
//@PreAuthorize("@ss.hasPermission('system:data-source:query')")
|
||||
public CommonResult<Long> insertSetting( @RequestBody PackageConfigReqVO reqVO ) {
|
||||
|
||||
return success(settingService.insertSetting(reqVO));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@PostMapping("/update")
|
||||
@Operation(summary = "更新系统配置")
|
||||
//@PreAuthorize("@ss.hasPermission('system:data-source:query')")
|
||||
public CommonResult<Long> updateSetting( @RequestBody PackageConfigReqVO reqVO ) {
|
||||
|
||||
return success(settingService.updateSetting(reqVO));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/select")
|
||||
@Operation(summary = "查看当前用户的配置信息")
|
||||
@Parameter(name = "type", description = "配置类型", required = true)
|
||||
public CommonResult<PackageConfigReqVO> selectSetting( @RequestParam("type") Integer type ) {
|
||||
|
||||
return success(settingService.selectSetting(type));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package com.cf.imes.module.system.dal.mysql.setting;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.module.system.controller.admin.machine.vo.MachinePageReqVO;
|
||||
import com.cf.imes.module.system.dal.dataobject.machinetemplate.MachineTemplateDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.setting.PackageConfigDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
|
||||
@Mapper
|
||||
public interface SettingMapper extends BaseMapperX<PackageConfigDO> {
|
||||
|
||||
|
||||
|
||||
default PackageConfigDO selectSetting(Integer type, Long id, Long organId) {
|
||||
return selectOne( new LambdaQueryWrapperX<PackageConfigDO>()
|
||||
.eqIfPresent(PackageConfigDO::getOrganId,organId)
|
||||
.eqIfPresent(PackageConfigDO::getUserId,id)
|
||||
.eqIfPresent(PackageConfigDO::getType,type));
|
||||
}
|
||||
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package com.cf.imes.module.system.service.setting;
|
||||
|
||||
|
||||
import com.cf.imes.module.system.controller.admin.setting.vo.PackageConfigReqVO;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
public interface SettingService {
|
||||
|
||||
|
||||
|
||||
Long insertSetting(PackageConfigReqVO reqVO);
|
||||
|
||||
Long updateSetting(PackageConfigReqVO reqVO);
|
||||
|
||||
PackageConfigReqVO selectSetting(Integer type);
|
||||
}
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
package com.cf.imes.module.system.service.setting;
|
||||
|
||||
|
||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.security.core.LoginUser;
|
||||
import com.cf.imes.module.system.controller.admin.setting.vo.PackageConfigReqVO;
|
||||
import com.cf.imes.module.system.dal.dataobject.setting.PackageConfigDO;
|
||||
import com.cf.imes.module.system.dal.mysql.setting.SettingMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getLoginUser;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
||||
|
||||
|
||||
@Service
|
||||
@Validated
|
||||
public class SettingServiceImpl implements SettingService{
|
||||
|
||||
|
||||
@Resource
|
||||
private SettingMapper settingMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public Long insertSetting(PackageConfigReqVO reqVO) {
|
||||
|
||||
LoginUser loginUser = getLoginUser();
|
||||
PackageConfigDO packageConfigDO = PackageConfigDO.builder()
|
||||
.userId(loginUser.getId())
|
||||
.organId(loginUser.getOrganId())
|
||||
.setting(JsonUtils.zipString(reqVO.getSetting().toJSONString()))
|
||||
.type(reqVO.getType())
|
||||
.build();
|
||||
|
||||
settingMapper.insert(packageConfigDO);
|
||||
|
||||
|
||||
return packageConfigDO.getId();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Long updateSetting(PackageConfigReqVO reqVO) {
|
||||
|
||||
// 更新
|
||||
PackageConfigDO packageConfigDO = settingMapper.selectById(reqVO.getId());
|
||||
if (packageConfigDO == null) {
|
||||
throw exception(CURRENTLY_NO_CONFIGURATION_AVAILABLE);
|
||||
}
|
||||
if(reqVO.getSetting() != null) {
|
||||
packageConfigDO.setSetting(JsonUtils.zipString(reqVO.getSetting().toJSONString()));
|
||||
}
|
||||
settingMapper.updateById(packageConfigDO);
|
||||
|
||||
return packageConfigDO.getId();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public PackageConfigReqVO selectSetting(Integer type) {
|
||||
|
||||
LoginUser loginUser = getLoginUser();
|
||||
|
||||
PackageConfigDO packageConfigDO = settingMapper.selectSetting(type, loginUser.getId(), loginUser.getOrganId());
|
||||
|
||||
if (packageConfigDO == null) {
|
||||
throw exception(CURRENTLY_NO_CONFIGURATION_AVAILABLE);
|
||||
}
|
||||
|
||||
packageConfigDO.setSetting(JsonUtils.unzipString(packageConfigDO.getSetting()));
|
||||
|
||||
return BeanUtils.toBean(packageConfigDO,PackageConfigReqVO.class);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user