Compare commits
2 Commits
533b96fb6a
...
c7d4399e53
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c7d4399e53 | ||
|
|
2fae2ccac2 |
@@ -58,14 +58,14 @@ public class SupplierController extends AbstractFileUploadController implements
|
|||||||
|
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
@Operation(summary = "创建供应商")
|
@Operation(summary = "创建供应商")
|
||||||
@PreAuthorize("@ss.hasPermission('qms:supplier:create')")
|
// @PreAuthorize("@ss.hasPermission('qms:supplier:create')")
|
||||||
public CommonResult<SupplierRespVO> createSupplier(@Valid @RequestBody SupplierSaveReqVO createReqVO) {
|
public CommonResult<SupplierRespVO> createSupplier(@Valid @RequestBody SupplierSaveReqVO createReqVO) {
|
||||||
return success(supplierService.createSupplier(createReqVO));
|
return success(supplierService.createSupplier(createReqVO));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/update")
|
@PutMapping("/update")
|
||||||
@Operation(summary = "更新供应商")
|
@Operation(summary = "更新供应商")
|
||||||
@PreAuthorize("@ss.hasPermission('qms:supplier:update')")
|
// @PreAuthorize("@ss.hasPermission('qms:supplier:update')")
|
||||||
public CommonResult<Boolean> updateSupplier(@Valid @RequestBody SupplierSaveReqVO updateReqVO) {
|
public CommonResult<Boolean> updateSupplier(@Valid @RequestBody SupplierSaveReqVO updateReqVO) {
|
||||||
supplierService.updateSupplier(updateReqVO);
|
supplierService.updateSupplier(updateReqVO);
|
||||||
return success(true);
|
return success(true);
|
||||||
@@ -74,7 +74,7 @@ public class SupplierController extends AbstractFileUploadController implements
|
|||||||
@DeleteMapping("/delete")
|
@DeleteMapping("/delete")
|
||||||
@Operation(summary = "删除供应商")
|
@Operation(summary = "删除供应商")
|
||||||
@Parameter(name = "id", description = "编号", required = true)
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
@PreAuthorize("@ss.hasPermission('qms:supplier:delete')")
|
// @PreAuthorize("@ss.hasPermission('qms:supplier:delete')")
|
||||||
public CommonResult<Boolean> deleteSupplier(@RequestParam("id") Long id) {
|
public CommonResult<Boolean> deleteSupplier(@RequestParam("id") Long id) {
|
||||||
supplierService.deleteSupplier(id);
|
supplierService.deleteSupplier(id);
|
||||||
return success(true);
|
return success(true);
|
||||||
@@ -92,7 +92,7 @@ public class SupplierController extends AbstractFileUploadController implements
|
|||||||
@GetMapping("/get")
|
@GetMapping("/get")
|
||||||
@Operation(summary = "获得供应商")
|
@Operation(summary = "获得供应商")
|
||||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
@PreAuthorize("@ss.hasPermission('qms:supplier:query')")
|
// @PreAuthorize("@ss.hasPermission('qms:supplier:query')")
|
||||||
public CommonResult<SupplierExtendRespVO> getSupplier(@RequestParam("id") Long id) {
|
public CommonResult<SupplierExtendRespVO> getSupplier(@RequestParam("id") Long id) {
|
||||||
SupplierExtendRespVO supplier = supplierService.getSupplier(id);
|
SupplierExtendRespVO supplier = supplierService.getSupplier(id);
|
||||||
return success(supplier);
|
return success(supplier);
|
||||||
@@ -100,7 +100,7 @@ public class SupplierController extends AbstractFileUploadController implements
|
|||||||
|
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@Operation(summary = "获得供应商分页")
|
@Operation(summary = "获得供应商分页")
|
||||||
@PreAuthorize("@ss.hasPermission('qms:supplier:query')")
|
// @PreAuthorize("@ss.hasPermission('qms:supplier:query')")
|
||||||
public CommonResult<PageResult<SupplierRespVO>> getSupplierPage(@Valid SupplierPageReqVO pageReqVO) {
|
public CommonResult<PageResult<SupplierRespVO>> getSupplierPage(@Valid SupplierPageReqVO pageReqVO) {
|
||||||
PageResult<SupplierDO> pageResult = supplierService.getSupplierPage(pageReqVO);
|
PageResult<SupplierDO> pageResult = supplierService.getSupplierPage(pageReqVO);
|
||||||
return success(BeanUtils.toBean(pageResult, SupplierRespVO.class));
|
return success(BeanUtils.toBean(pageResult, SupplierRespVO.class));
|
||||||
|
|||||||
@@ -52,15 +52,18 @@ public class DeviceApplyController extends AbstractFileUploadController implemen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Resource
|
@Resource private DeviceApplyService deviceApplyService;
|
||||||
private DeviceApplyService deviceApplyService;
|
|
||||||
|
|
||||||
//todo 通过设备通用流程配置创建
|
@RequestMapping("/createTempData")
|
||||||
@PostMapping("/createTempData")
|
@Operation(summary = "创建临时数据")
|
||||||
@Operation(summary = "创建创建临时数据")
|
public CommonResult<DeviceApplyRespVO> createTempData(@RequestBody DeviceApplySaveReqVO createReqVO) {
|
||||||
// @PreAuthorize("@ss.hasPermission('qms:device-apply:create')")
|
return deviceApplyService.createTempData(createReqVO);
|
||||||
public CommonResult<DeviceApplyRespVO> createTempData(@Valid @RequestBody DeviceApplySaveReqVO createReqVO) {
|
}
|
||||||
return success(deviceApplyService.createTempData(createReqVO));
|
|
||||||
|
@RequestMapping("/saveDeviceApply")
|
||||||
|
@Operation(summary = "保存申请数据")
|
||||||
|
public CommonResult<Boolean> saveDeviceApply(@Valid @RequestBody DeviceApplySaveReqVO createReqVO) {
|
||||||
|
return deviceApplyService.saveDeviceApply(createReqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/update")
|
@PutMapping("/update")
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.zt.plat.module.qms.resource.device.controller.vo;
|
package com.zt.plat.module.qms.resource.device.controller.vo;
|
||||||
|
|
||||||
|
import com.zt.plat.module.qms.core.aspect.annotation.Dict;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
@@ -49,6 +50,7 @@ public class DeviceApplyRespVO {
|
|||||||
|
|
||||||
@Schema(description = "业务状态", example = "1")
|
@Schema(description = "业务状态", example = "1")
|
||||||
@ExcelProperty("业务状态")
|
@ExcelProperty("业务状态")
|
||||||
|
@Dict(dicCode = "flow_status")
|
||||||
private String businessStatus;
|
private String businessStatus;
|
||||||
|
|
||||||
@Schema(description = "借用人")
|
@Schema(description = "借用人")
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public class DeviceApplyDO extends BusinessBaseDO {
|
|||||||
* 申请部门ID
|
* 申请部门ID
|
||||||
*/
|
*/
|
||||||
@TableField("APL_DEPT")
|
@TableField("APL_DEPT")
|
||||||
private String applyDepartment;
|
private Long applyDepartment;
|
||||||
/**
|
/**
|
||||||
* 申请人
|
* 申请人
|
||||||
*/
|
*/
|
||||||
@@ -55,7 +55,7 @@ public class DeviceApplyDO extends BusinessBaseDO {
|
|||||||
* 申请人ID
|
* 申请人ID
|
||||||
*/
|
*/
|
||||||
@TableField("APL_USER")
|
@TableField("APL_USER")
|
||||||
private String applyUser;
|
private Long applyUser;
|
||||||
/**
|
/**
|
||||||
* 业务编码
|
* 业务编码
|
||||||
*/
|
*/
|
||||||
@@ -115,7 +115,7 @@ public class DeviceApplyDO extends BusinessBaseDO {
|
|||||||
* 表单模板ID
|
* 表单模板ID
|
||||||
*/
|
*/
|
||||||
@TableField("TMPL_ID")
|
@TableField("TMPL_ID")
|
||||||
private String templateId;
|
private Long templateId;
|
||||||
/**
|
/**
|
||||||
* 表单组件
|
* 表单组件
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.zt.plat.module.qms.resource.device.service;
|
|||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceApplyPageReqVO;
|
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceApplyPageReqVO;
|
||||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceApplyRespVO;
|
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceApplyRespVO;
|
||||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceApplySaveReqVO;
|
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceApplySaveReqVO;
|
||||||
@@ -25,7 +26,9 @@ public interface DeviceApplyService {
|
|||||||
DeviceApplyRespVO createDeviceApply(@Valid DeviceApplySaveReqVO createReqVO);
|
DeviceApplyRespVO createDeviceApply(@Valid DeviceApplySaveReqVO createReqVO);
|
||||||
|
|
||||||
//创建临时数据
|
//创建临时数据
|
||||||
DeviceApplyRespVO createTempData(@Valid DeviceApplySaveReqVO createReqVO);
|
CommonResult<DeviceApplyRespVO> createTempData(@Valid DeviceApplySaveReqVO createReqVO);
|
||||||
|
|
||||||
|
CommonResult<Boolean> saveDeviceApply(@Valid DeviceApplySaveReqVO updateReqVO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新设备通用流程,验收、降级、停用、报废、还原、启用
|
* 更新设备通用流程,验收、降级、停用、报废、还原、启用
|
||||||
@@ -34,6 +37,7 @@ public interface DeviceApplyService {
|
|||||||
*/
|
*/
|
||||||
void updateDeviceApply(@Valid DeviceApplySaveReqVO updateReqVO);
|
void updateDeviceApply(@Valid DeviceApplySaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除设备通用流程,验收、降级、停用、报废、还原、启用
|
* 删除设备通用流程,验收、降级、停用、报废、还原、启用
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,14 +1,31 @@
|
|||||||
package com.zt.plat.module.qms.resource.device.service;
|
package com.zt.plat.module.qms.resource.device.service;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.bean.copier.CopyOptions;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.alibaba.fastjson.parser.Feature;
|
||||||
|
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||||
|
import com.zt.plat.framework.security.core.LoginUser;
|
||||||
|
import com.zt.plat.framework.security.core.util.SecurityFrameworkUtils;
|
||||||
|
import com.zt.plat.module.qms.common.data.dal.dataobject.DataCollectionDO;
|
||||||
|
import com.zt.plat.module.qms.common.data.dal.dataobject.DataTemplateDO;
|
||||||
|
import com.zt.plat.module.qms.common.data.service.DataCollectionService;
|
||||||
|
import com.zt.plat.module.qms.common.data.service.DataTemplateService;
|
||||||
import com.zt.plat.module.qms.enums.QmsCommonConstant;
|
import com.zt.plat.module.qms.enums.QmsCommonConstant;
|
||||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceApplyPageReqVO;
|
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceApplyPageReqVO;
|
||||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceApplyRespVO;
|
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceApplyRespVO;
|
||||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceApplySaveReqVO;
|
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceApplySaveReqVO;
|
||||||
|
import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceConfigFlowDO;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.beanutils.PropertyUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.util.ObjectUtils;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceApplyDO;
|
import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceApplyDO;
|
||||||
@@ -28,10 +45,13 @@ import static com.zt.plat.module.qms.enums.ErrorCodeConstants.DEVICE_APPLY_NOT_E
|
|||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@Validated
|
@Validated
|
||||||
|
@Slf4j
|
||||||
public class DeviceApplyServiceImpl implements DeviceApplyService {
|
public class DeviceApplyServiceImpl implements DeviceApplyService {
|
||||||
|
|
||||||
@Resource
|
@Resource private DeviceApplyMapper deviceApplyMapper;
|
||||||
private DeviceApplyMapper deviceApplyMapper;
|
@Resource private DeviceConfigFlowService deviceConfigFlowService;
|
||||||
|
@Resource private DataCollectionService dataCollectionService;
|
||||||
|
@Resource private DataTemplateService dataTemplateService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DeviceApplyRespVO createDeviceApply(DeviceApplySaveReqVO createReqVO) {
|
public DeviceApplyRespVO createDeviceApply(DeviceApplySaveReqVO createReqVO) {
|
||||||
@@ -43,14 +63,71 @@ public class DeviceApplyServiceImpl implements DeviceApplyService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DeviceApplyRespVO createTempData(DeviceApplySaveReqVO createReqVO) {
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public CommonResult<DeviceApplyRespVO> createTempData(DeviceApplySaveReqVO createReqVO) {
|
||||||
|
String businessType = createReqVO.getBusinessCode();
|
||||||
|
if(ObjectUtils.isEmpty(businessType))
|
||||||
|
return CommonResult.error(DEVICE_APPLY_NOT_EXISTS.getCode(), "请选择业务类型");
|
||||||
|
DeviceConfigFlowDO config = deviceConfigFlowService.getByBusinessType(businessType);
|
||||||
|
if(ObjectUtils.isEmpty(config))
|
||||||
|
return CommonResult.error(DEVICE_APPLY_NOT_EXISTS.getCode(), "业务类型配置不存在("+businessType+"),请联系管理员处理");
|
||||||
DeviceApplyDO deviceApply = BeanUtils.toBean(createReqVO, DeviceApplyDO.class);
|
DeviceApplyDO deviceApply = BeanUtils.toBean(createReqVO, DeviceApplyDO.class);
|
||||||
|
if(!ObjectUtils.isEmpty(config.getTemplateKey())){
|
||||||
|
DataTemplateDO dataTemplate = dataTemplateService.getLatestDataByKey(config.getTemplateKey());
|
||||||
|
if(ObjectUtils.isEmpty(dataTemplate))
|
||||||
|
return CommonResult.error(DEVICE_APPLY_NOT_EXISTS.getCode(), "表单编辑器模板不存在("+config.getTemplateKey()+"),请联系管理员处理");
|
||||||
|
deviceApply.setTemplateId(dataTemplate.getId());
|
||||||
|
}
|
||||||
|
DataCollectionDO dataCollection = dataCollectionService.getLatestDataCollectionByKey(config.getDataCollectionKey());
|
||||||
|
if(ObjectUtils.isEmpty(dataCollection))
|
||||||
|
return CommonResult.error(DEVICE_APPLY_NOT_EXISTS.getCode(), "数据集不存在("+config.getDataCollectionKey()+"),请联系管理员处理");
|
||||||
|
deviceApply.setBusinessName(config.getBusinessName());
|
||||||
|
deviceApply.setDataCollectionId(dataCollection.getId());
|
||||||
|
//取当前用户
|
||||||
|
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||||
|
String nickName = SecurityFrameworkUtils.getLoginUserNickname();
|
||||||
|
deviceApply.setApplyUser(loginUser.getId());
|
||||||
|
deviceApply.setApplyUserName(nickName);
|
||||||
|
deviceApply.setApplyDepartment(loginUser.getVisitDeptId());
|
||||||
|
deviceApply.setApplyDepartmentName(loginUser.getVisitDeptName());
|
||||||
deviceApply.setBusinessStatus(QmsCommonConstant.TEMP_DATA_CODE);
|
deviceApply.setBusinessStatus(QmsCommonConstant.TEMP_DATA_CODE);
|
||||||
deviceApplyMapper.insert(deviceApply);
|
deviceApplyMapper.insert(deviceApply);
|
||||||
// 返回
|
// 返回
|
||||||
return BeanUtils.toBean(deviceApply, DeviceApplyRespVO.class);
|
return CommonResult.success(BeanUtils.toBean(deviceApply, DeviceApplyRespVO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//保存
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public CommonResult<Boolean> saveDeviceApply(DeviceApplySaveReqVO updateReqVO) {
|
||||||
|
|
||||||
|
// 校验存在
|
||||||
|
DeviceApplyDO backData = getDeviceApply(updateReqVO.getId());
|
||||||
|
if(backData == null)
|
||||||
|
throw exception(DEVICE_APPLY_NOT_EXISTS);
|
||||||
|
if(QmsCommonConstant.TEMP_DATA_CODE.equals(backData.getBusinessStatus())){
|
||||||
|
updateReqVO.setBusinessStatus(QmsCommonConstant.NOT_START);
|
||||||
|
}
|
||||||
|
//处理动态表单字段
|
||||||
|
String formData = updateReqVO.getFormData();
|
||||||
|
if(!ObjectUtils.isEmpty(formData)) {
|
||||||
|
assembleFormData(formData, updateReqVO);
|
||||||
|
}
|
||||||
|
// 更新
|
||||||
|
DeviceApplyDO updateObj = BeanUtils.toBean(updateReqVO, DeviceApplyDO.class);
|
||||||
|
deviceApplyMapper.updateById(updateObj);
|
||||||
|
return CommonResult.success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void assembleFormData(String formData, DeviceApplySaveReqVO updateReqVO){
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(formData);
|
||||||
|
DeviceApplySaveReqVO jsonVo = jsonObject.toJavaObject(DeviceApplySaveReqVO.class);
|
||||||
|
CopyOptions copyOptions = CopyOptions.create();
|
||||||
|
copyOptions.setIgnoreNullValue(true);
|
||||||
|
BeanUtil.copyProperties(jsonVo, updateReqVO, copyOptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateDeviceApply(DeviceApplySaveReqVO updateReqVO) {
|
public void updateDeviceApply(DeviceApplySaveReqVO updateReqVO) {
|
||||||
// 校验存在
|
// 校验存在
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ public interface DeviceConfigFlowService {
|
|||||||
|
|
||||||
List<DeviceConfigFlowDO> getEnableList(DeviceConfigFlowPageReqVO pageReqVO);
|
List<DeviceConfigFlowDO> getEnableList(DeviceConfigFlowPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
DeviceConfigFlowDO getByBusinessType(String code);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建设备通用流程配置
|
* 创建设备通用流程配置
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.zt.plat.module.qms.resource.device.service;
|
package com.zt.plat.module.qms.resource.device.service;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigFlowPageReqVO;
|
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigFlowPageReqVO;
|
||||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigFlowRespVO;
|
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigFlowRespVO;
|
||||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigFlowSaveReqVO;
|
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigFlowSaveReqVO;
|
||||||
@@ -37,6 +38,15 @@ public class DeviceConfigFlowServiceImpl implements DeviceConfigFlowService {
|
|||||||
return deviceConfigFlowMapper.selectList(pageReqVO);
|
return deviceConfigFlowMapper.selectList(pageReqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DeviceConfigFlowDO getByBusinessType(String code) {
|
||||||
|
LambdaQueryWrapper<DeviceConfigFlowDO> query = new LambdaQueryWrapper<>();
|
||||||
|
query.eq(DeviceConfigFlowDO::getBusinessType, code);
|
||||||
|
query.orderByDesc(DeviceConfigFlowDO::getUpdateTime);
|
||||||
|
query.last("limit 1");
|
||||||
|
return deviceConfigFlowMapper.selectOne(query);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DeviceConfigFlowRespVO createDeviceConfigFlow(DeviceConfigFlowSaveReqVO createReqVO) {
|
public DeviceConfigFlowRespVO createDeviceConfigFlow(DeviceConfigFlowSaveReqVO createReqVO) {
|
||||||
// 插入
|
// 插入
|
||||||
|
|||||||
Reference in New Issue
Block a user