feat:供应商管理
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
package com.zt.plat.module.qms.enums;
|
||||
|
||||
public interface QmsSupplierConstant {
|
||||
|
||||
String OPERATING_ITEMS_KEY = "operatingItems";
|
||||
// 供应商属性资质key
|
||||
String CERTIFICATION_KEY = "certification";
|
||||
// 评价流程key
|
||||
String EVALUATION_FLOW_KEY= "OFFICE_SUPPLIER_EVALUATION";
|
||||
}
|
||||
@@ -93,9 +93,9 @@ public class SupplierController extends AbstractFileUploadController implements
|
||||
@Operation(summary = "获得供应商")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('qms:supplier:query')")
|
||||
public CommonResult<SupplierRespVO> getSupplier(@RequestParam("id") Long id) {
|
||||
SupplierDO supplier = supplierService.getSupplier(id);
|
||||
return success(BeanUtils.toBean(supplier, SupplierRespVO.class));
|
||||
public CommonResult<SupplierExtendRespVO> getSupplier(@RequestParam("id") Long id) {
|
||||
SupplierExtendRespVO supplier = supplierService.getSupplier(id);
|
||||
return success(supplier);
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.zt.plat.module.qms.office.supplier.controller.admin;
|
||||
|
||||
import com.zt.plat.module.qms.business.reportdoc.controller.vo.ReportDocumentMainRespVO;
|
||||
import com.zt.plat.module.qms.business.reportdoc.controller.vo.ReportDocumentMainSaveReqVO;
|
||||
import com.zt.plat.module.qms.office.supplier.controller.vo.SupplierEvaluationPageReqVO;
|
||||
import com.zt.plat.module.qms.office.supplier.controller.vo.SupplierEvaluationRespVO;
|
||||
import com.zt.plat.module.qms.office.supplier.controller.vo.SupplierEvaluationSaveReqVO;
|
||||
@@ -57,14 +59,14 @@ public class SupplierEvaluationController extends AbstractFileUploadController i
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建供应商评价")
|
||||
@PreAuthorize("@ss.hasPermission('qms:supplier-evaluation:create')")
|
||||
// @PreAuthorize("@ss.hasPermission('qms:supplier-evaluation:create')")
|
||||
public CommonResult<SupplierEvaluationRespVO> createSupplierEvaluation(@Valid @RequestBody SupplierEvaluationSaveReqVO createReqVO) {
|
||||
return success(supplierEvaluationService.createSupplierEvaluation(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新供应商评价")
|
||||
@PreAuthorize("@ss.hasPermission('qms:supplier-evaluation:update')")
|
||||
// @PreAuthorize("@ss.hasPermission('qms:supplier-evaluation:update')")
|
||||
public CommonResult<Boolean> updateSupplierEvaluation(@Valid @RequestBody SupplierEvaluationSaveReqVO updateReqVO) {
|
||||
supplierEvaluationService.updateSupplierEvaluation(updateReqVO);
|
||||
return success(true);
|
||||
@@ -73,7 +75,7 @@ public class SupplierEvaluationController extends AbstractFileUploadController i
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除供应商评价")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('qms:supplier-evaluation:delete')")
|
||||
// @PreAuthorize("@ss.hasPermission('qms:supplier-evaluation:delete')")
|
||||
public CommonResult<Boolean> deleteSupplierEvaluation(@RequestParam("id") Long id) {
|
||||
supplierEvaluationService.deleteSupplierEvaluation(id);
|
||||
return success(true);
|
||||
@@ -82,7 +84,7 @@ public class SupplierEvaluationController extends AbstractFileUploadController i
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@Operation(summary = "批量删除供应商评价")
|
||||
@PreAuthorize("@ss.hasPermission('qms:supplier-evaluation:delete')")
|
||||
// @PreAuthorize("@ss.hasPermission('qms:supplier-evaluation:delete')")
|
||||
public CommonResult<Boolean> deleteSupplierEvaluationList(@RequestBody BatchDeleteReqVO req) {
|
||||
supplierEvaluationService.deleteSupplierEvaluationListByIds(req.getIds());
|
||||
return success(true);
|
||||
@@ -91,7 +93,7 @@ public class SupplierEvaluationController extends AbstractFileUploadController i
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得供应商评价")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('qms:supplier-evaluation:query')")
|
||||
// @PreAuthorize("@ss.hasPermission('qms:supplier-evaluation:query')")
|
||||
public CommonResult<SupplierEvaluationRespVO> getSupplierEvaluation(@RequestParam("id") Long id) {
|
||||
SupplierEvaluationDO supplierEvaluation = supplierEvaluationService.getSupplierEvaluation(id);
|
||||
return success(BeanUtils.toBean(supplierEvaluation, SupplierEvaluationRespVO.class));
|
||||
@@ -99,10 +101,16 @@ public class SupplierEvaluationController extends AbstractFileUploadController i
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得供应商评价分页")
|
||||
@PreAuthorize("@ss.hasPermission('qms:supplier-evaluation:query')")
|
||||
// @PreAuthorize("@ss.hasPermission('qms:supplier-evaluation:query')")
|
||||
public CommonResult<PageResult<SupplierEvaluationRespVO>> getSupplierEvaluationPage(@Valid SupplierEvaluationPageReqVO pageReqVO) {
|
||||
PageResult<SupplierEvaluationDO> pageResult = supplierEvaluationService.getSupplierEvaluationPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, SupplierEvaluationRespVO.class));
|
||||
PageResult<SupplierEvaluationRespVO> pageResult = supplierEvaluationService.getSupplierEvaluationPage(pageReqVO);
|
||||
return success(pageResult);
|
||||
}
|
||||
|
||||
@PostMapping("/createProcessInstance")
|
||||
@Operation(summary = "发起流程")
|
||||
public CommonResult<SupplierEvaluationRespVO> createProcessInstance(@Valid @RequestBody SupplierEvaluationSaveReqVO createReqVO) {
|
||||
return supplierEvaluationService.createProcessInstance(createReqVO);
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@@ -112,7 +120,7 @@ public class SupplierEvaluationController extends AbstractFileUploadController i
|
||||
public void exportSupplierEvaluationExcel(@Valid SupplierEvaluationPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<SupplierEvaluationDO> list = supplierEvaluationService.getSupplierEvaluationPage(pageReqVO).getList();
|
||||
List<SupplierEvaluationRespVO> list = supplierEvaluationService.getSupplierEvaluationPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "供应商评价.xls", "数据", SupplierEvaluationRespVO.class,
|
||||
BeanUtils.toBean(list, SupplierEvaluationRespVO.class));
|
||||
|
||||
@@ -57,14 +57,14 @@ public class SupplierPropertiesController extends AbstractFileUploadController i
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建供应商属性")
|
||||
@PreAuthorize("@ss.hasPermission('qms:supplier-properties:create')")
|
||||
// @PreAuthorize("@ss.hasPermission('qms:supplier-properties:create')")
|
||||
public CommonResult<SupplierPropertiesRespVO> createSupplierProperties(@Valid @RequestBody SupplierPropertiesSaveReqVO createReqVO) {
|
||||
return success(supplierPropertiesService.createSupplierProperties(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新供应商属性")
|
||||
@PreAuthorize("@ss.hasPermission('qms:supplier-properties:update')")
|
||||
// @PreAuthorize("@ss.hasPermission('qms:supplier-properties:update')")
|
||||
public CommonResult<Boolean> updateSupplierProperties(@Valid @RequestBody SupplierPropertiesSaveReqVO updateReqVO) {
|
||||
supplierPropertiesService.updateSupplierProperties(updateReqVO);
|
||||
return success(true);
|
||||
@@ -73,7 +73,7 @@ public class SupplierPropertiesController extends AbstractFileUploadController i
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除供应商属性")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('qms:supplier-properties:delete')")
|
||||
// @PreAuthorize("@ss.hasPermission('qms:supplier-properties:delete')")
|
||||
public CommonResult<Boolean> deleteSupplierProperties(@RequestParam("id") Long id) {
|
||||
supplierPropertiesService.deleteSupplierProperties(id);
|
||||
return success(true);
|
||||
@@ -91,7 +91,7 @@ public class SupplierPropertiesController extends AbstractFileUploadController i
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得供应商属性")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('qms:supplier-properties:query')")
|
||||
// @PreAuthorize("@ss.hasPermission('qms:supplier-properties:query')")
|
||||
public CommonResult<SupplierPropertiesRespVO> getSupplierProperties(@RequestParam("id") Long id) {
|
||||
SupplierPropertiesDO supplierProperties = supplierPropertiesService.getSupplierProperties(id);
|
||||
return success(BeanUtils.toBean(supplierProperties, SupplierPropertiesRespVO.class));
|
||||
@@ -99,7 +99,7 @@ public class SupplierPropertiesController extends AbstractFileUploadController i
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得供应商属性分页")
|
||||
@PreAuthorize("@ss.hasPermission('qms:supplier-properties:query')")
|
||||
// @PreAuthorize("@ss.hasPermission('qms:supplier-properties:query')")
|
||||
public CommonResult<PageResult<SupplierPropertiesRespVO>> getSupplierPropertiesPage(@Valid SupplierPropertiesPageReqVO pageReqVO) {
|
||||
PageResult<SupplierPropertiesDO> pageResult = supplierPropertiesService.getSupplierPropertiesPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, SupplierPropertiesRespVO.class));
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.zt.plat.module.qms.office.supplier.controller.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.zt.plat.framework.common.pojo.PageParam;
|
||||
@@ -50,4 +51,12 @@ public class SupplierEvaluationPageReqVO extends PageParam {
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
//==============扩展字段===============
|
||||
@Schema(description = "供应商名称")
|
||||
private String supplierName;
|
||||
|
||||
@Schema(description = "审批签名")
|
||||
private String signatureInfo;
|
||||
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.zt.plat.module.qms.office.supplier.controller.vo;
|
||||
|
||||
import com.zt.plat.module.qms.core.aspect.annotation.Dict;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
@@ -45,6 +46,7 @@ public class SupplierEvaluationRespVO {
|
||||
|
||||
@Schema(description = "流程审批状态", example = "2")
|
||||
@ExcelProperty("流程审批状态")
|
||||
@Dict(dicCode = "flow_status")
|
||||
private String flowStatus;
|
||||
|
||||
@Schema(description = "流程实例id", example = "24931")
|
||||
@@ -63,4 +65,13 @@ public class SupplierEvaluationRespVO {
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
//==============扩展字段===============
|
||||
@Schema(description = "供应商名称")
|
||||
private String supplierName;
|
||||
|
||||
@Schema(description = "审批签名")
|
||||
@ExcelProperty("审批签名")
|
||||
private String signatureInfo;
|
||||
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.zt.plat.module.qms.office.supplier.controller.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
@@ -45,4 +46,7 @@ public class SupplierEvaluationSaveReqVO {
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "审批签名")
|
||||
private String signatureInfo;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.zt.plat.module.qms.office.supplier.controller.vo;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.zt.plat.module.qms.office.supplier.dal.dataobject.SupplierPropertiesDO;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@Data
|
||||
public class SupplierExtendRespVO extends SupplierRespVO {
|
||||
|
||||
private String certification;
|
||||
|
||||
public String getCertification() {
|
||||
if (CollUtil.isNotEmpty(this.supplierPropertiesList)) {
|
||||
return this.supplierPropertiesList.stream().map(m -> m.getSubitemCode()).collect(Collectors.joining("、"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private List<SupplierPropertiesDO> supplierPropertiesList;
|
||||
|
||||
|
||||
}
|
||||
@@ -21,6 +21,12 @@ public class SupplierPageReqVO extends PageParam {
|
||||
@Schema(description = "类型", example = "1")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "统一社会信用代码")
|
||||
private String creditCode;
|
||||
|
||||
@Schema(description = "注册日期")
|
||||
private LocalDateTime registerDate;
|
||||
|
||||
@Schema(description = "地址")
|
||||
private String address;
|
||||
|
||||
|
||||
@@ -29,6 +29,9 @@ public class SupplierPropertiesPageReqVO extends PageParam {
|
||||
@Schema(description = "名称", example = "王五")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "说明")
|
||||
private String content;
|
||||
|
||||
@Schema(description = "有效期开始")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] startDate;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.zt.plat.module.qms.office.supplier.controller.vo;
|
||||
|
||||
import com.zt.plat.module.qms.core.aspect.annotation.Dict;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
@@ -30,12 +31,17 @@ public class SupplierPropertiesRespVO {
|
||||
|
||||
@Schema(description = "子业务编码")
|
||||
@ExcelProperty("子业务编码")
|
||||
@Dict(dicCode = "")
|
||||
private String subitemCode;
|
||||
|
||||
@Schema(description = "名称", example = "王五")
|
||||
@ExcelProperty("名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "说明")
|
||||
@ExcelProperty("说明")
|
||||
private String content;
|
||||
|
||||
@Schema(description = "有效期开始")
|
||||
@ExcelProperty("有效期开始")
|
||||
private LocalDateTime startDate;
|
||||
|
||||
@@ -28,6 +28,9 @@ public class SupplierPropertiesSaveReqVO {
|
||||
@Schema(description = "名称", example = "王五")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "说明")
|
||||
private String content;
|
||||
|
||||
@Schema(description = "有效期开始")
|
||||
private LocalDateTime startDate;
|
||||
|
||||
|
||||
@@ -27,6 +27,14 @@ public class SupplierRespVO {
|
||||
@ExcelProperty("类型")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "统一社会信用代码")
|
||||
@ExcelProperty("统一社会信用代码")
|
||||
private String creditCode;
|
||||
|
||||
@Schema(description = "注册日期")
|
||||
@ExcelProperty("注册日期")
|
||||
private LocalDateTime registerDate;
|
||||
|
||||
@Schema(description = "地址")
|
||||
@ExcelProperty("地址")
|
||||
private String address;
|
||||
@@ -58,5 +66,4 @@ public class SupplierRespVO {
|
||||
@Schema(description = "创建时间")
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@@ -1,8 +1,11 @@
|
||||
package com.zt.plat.module.qms.office.supplier.controller.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 供应商新增/修改 Request VO")
|
||||
@Data
|
||||
public class SupplierSaveReqVO {
|
||||
@@ -19,6 +22,12 @@ public class SupplierSaveReqVO {
|
||||
@Schema(description = "类型", example = "1")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "统一社会信用代码")
|
||||
private String creditCode;
|
||||
|
||||
@Schema(description = "注册日期")
|
||||
private LocalDateTime registerDate;
|
||||
|
||||
@Schema(description = "地址")
|
||||
private String address;
|
||||
|
||||
|
||||
@@ -3,6 +3,9 @@ package com.zt.plat.module.qms.office.supplier.dal.dataobject;
|
||||
import lombok.*;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.zt.plat.framework.mybatis.core.dataobject.BusinessBaseDO;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 供应商 DO
|
||||
*
|
||||
@@ -44,6 +47,16 @@ public class SupplierDO extends BusinessBaseDO {
|
||||
@TableField("TP")
|
||||
private String type;
|
||||
/**
|
||||
* 统一社会信用代码
|
||||
*/
|
||||
@TableField("CRDT_CD")
|
||||
private String creditCode;
|
||||
/**
|
||||
* 注册日期
|
||||
*/
|
||||
@TableField("REG_DT")
|
||||
private LocalDateTime registerDate;
|
||||
/**
|
||||
* 地址
|
||||
*/
|
||||
@TableField("ADR")
|
||||
|
||||
@@ -77,6 +77,11 @@ public class SupplierEvaluationDO extends BusinessBaseDO {
|
||||
@TableField("FLW_INSC_ID")
|
||||
private String flowInstanceId;
|
||||
/**
|
||||
* 签名信息
|
||||
*/
|
||||
@TableField("SIG_INF")
|
||||
private String signatureInfo;
|
||||
/**
|
||||
* 所属部门
|
||||
*/
|
||||
@TableField("SYS_DEPT_CD")
|
||||
|
||||
@@ -57,6 +57,11 @@ public class SupplierPropertiesDO extends BusinessBaseDO {
|
||||
*/
|
||||
@TableField("NAME")
|
||||
private String name;
|
||||
/**
|
||||
* 说明
|
||||
*/
|
||||
@TableField("CNTT")
|
||||
private String content;
|
||||
/**
|
||||
* 有效期开始
|
||||
*/
|
||||
|
||||
@@ -3,6 +3,9 @@ package com.zt.plat.module.qms.office.supplier.dal.mapper;
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.zt.plat.framework.mybatis.core.query.MPJLambdaWrapperX;
|
||||
import com.zt.plat.module.qms.office.supplier.controller.vo.SupplierEvaluationRespVO;
|
||||
import com.zt.plat.module.qms.office.supplier.dal.dataobject.SupplierDO;
|
||||
import com.zt.plat.module.qms.office.supplier.dal.dataobject.SupplierEvaluationDO;
|
||||
import com.zt.plat.module.qms.office.supplier.controller.vo.SupplierEvaluationPageReqVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
@@ -15,8 +18,11 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
@Mapper
|
||||
public interface SupplierEvaluationMapper extends BaseMapperX<SupplierEvaluationDO> {
|
||||
|
||||
default PageResult<SupplierEvaluationDO> selectPage(SupplierEvaluationPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<SupplierEvaluationDO>()
|
||||
default PageResult<SupplierEvaluationRespVO> selectPage(SupplierEvaluationPageReqVO reqVO) {
|
||||
return selectJoinPage(reqVO,SupplierEvaluationRespVO.class, new MPJLambdaWrapperX<SupplierEvaluationDO>()
|
||||
.leftJoin(SupplierDO.class,SupplierDO::getId, SupplierEvaluationDO::getSupplierId)
|
||||
.selectAll(SupplierEvaluationDO.class)
|
||||
.selectAs(SupplierDO::getName, SupplierEvaluationRespVO::getSupplierName)
|
||||
.eqIfPresent(SupplierEvaluationDO::getSupplierId, reqVO.getSupplierId())
|
||||
.eqIfPresent(SupplierEvaluationDO::getFormId, reqVO.getFormId())
|
||||
.eqIfPresent(SupplierEvaluationDO::getContent, reqVO.getContent())
|
||||
@@ -29,7 +35,10 @@ public interface SupplierEvaluationMapper extends BaseMapperX<SupplierEvaluation
|
||||
.eqIfPresent(SupplierEvaluationDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
|
||||
.eqIfPresent(SupplierEvaluationDO::getRemark, reqVO.getRemark())
|
||||
.betweenIfPresent(SupplierEvaluationDO::getCreateTime, reqVO.getCreateTime())
|
||||
.likeIfPresent(SupplierDO::getName, reqVO.getSupplierName())
|
||||
.orderByDesc(SupplierEvaluationDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -3,10 +3,16 @@ package com.zt.plat.module.qms.office.supplier.dal.mapper;
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.zt.plat.framework.mybatis.core.query.MPJLambdaWrapperX;
|
||||
import com.zt.plat.module.qms.enums.QmsSupplierConstant;
|
||||
import com.zt.plat.module.qms.office.supplier.controller.vo.SupplierExtendRespVO;
|
||||
import com.zt.plat.module.qms.office.supplier.dal.dataobject.SupplierDO;
|
||||
import com.zt.plat.module.qms.office.supplier.controller.vo.SupplierPageReqVO;
|
||||
import com.zt.plat.module.qms.office.supplier.dal.dataobject.SupplierPropertiesDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 供应商 Mapper
|
||||
*
|
||||
@@ -21,6 +27,8 @@ public interface SupplierMapper extends BaseMapperX<SupplierDO> {
|
||||
.eqIfPresent(SupplierDO::getCode, reqVO.getCode())
|
||||
.eqIfPresent(SupplierDO::getType, reqVO.getType())
|
||||
.eqIfPresent(SupplierDO::getAddress, reqVO.getAddress())
|
||||
.eqIfPresent(SupplierDO::getCreditCode, reqVO.getCreditCode())
|
||||
.eqIfPresent(SupplierDO::getRegisterDate, reqVO.getRegisterDate())
|
||||
.eqIfPresent(SupplierDO::getContact, reqVO.getContact())
|
||||
.eqIfPresent(SupplierDO::getMobile, reqVO.getMobile())
|
||||
.eqIfPresent(SupplierDO::getBusinessScope, reqVO.getBusinessScope())
|
||||
@@ -30,4 +38,16 @@ public interface SupplierMapper extends BaseMapperX<SupplierDO> {
|
||||
.orderByDesc(SupplierDO::getId));
|
||||
}
|
||||
|
||||
default SupplierExtendRespVO selectOneWithCertifications(Long id) {
|
||||
return selectJoinOne(SupplierExtendRespVO.class,
|
||||
new MPJLambdaWrapperX<SupplierDO>()
|
||||
.selectAll(SupplierDO.class)
|
||||
.selectCollection(SupplierPropertiesDO.class, SupplierExtendRespVO::getSupplierPropertiesList)
|
||||
.leftJoin(SupplierPropertiesDO.class, SupplierPropertiesDO::getSupplierId, SupplierDO::getId)
|
||||
.eq(SupplierDO::getId, id)
|
||||
.eq(SupplierPropertiesDO::getBusinessType, QmsSupplierConstant.CERTIFICATION_KEY)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.zt.plat.module.qms.office.supplier.dal.mapper;
|
||||
|
||||
import java.util.*;
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
|
||||
@@ -22,6 +23,7 @@ public interface SupplierPropertiesMapper extends BaseMapperX<SupplierProperties
|
||||
.eqIfPresent(SupplierPropertiesDO::getBusinessCode, reqVO.getBusinessCode())
|
||||
.eqIfPresent(SupplierPropertiesDO::getSubitemCode, reqVO.getSubitemCode())
|
||||
.likeIfPresent(SupplierPropertiesDO::getName, reqVO.getName())
|
||||
.eqIfPresent(SupplierPropertiesDO::getContent, reqVO.getContent())
|
||||
.betweenIfPresent(SupplierPropertiesDO::getStartDate, reqVO.getStartDate())
|
||||
.betweenIfPresent(SupplierPropertiesDO::getEndDate, reqVO.getEndDate())
|
||||
.eqIfPresent(SupplierPropertiesDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
|
||||
@@ -29,5 +31,13 @@ public interface SupplierPropertiesMapper extends BaseMapperX<SupplierProperties
|
||||
.betweenIfPresent(SupplierPropertiesDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(SupplierPropertiesDO::getId));
|
||||
}
|
||||
default List<SupplierPropertiesDO> selectList(SupplierPropertiesPageReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<SupplierPropertiesDO>()
|
||||
.eqIfPresent(SupplierPropertiesDO::getSupplierId, reqVO.getSupplierId())
|
||||
.eqIfPresent(SupplierPropertiesDO::getBusinessType, reqVO.getBusinessType())
|
||||
.eqIfPresent(SupplierPropertiesDO::getBusinessCode, reqVO.getBusinessCode())
|
||||
.eqIfPresent(SupplierPropertiesDO::getSubitemCode, reqVO.getSubitemCode())
|
||||
.orderByDesc(SupplierPropertiesDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,6 +2,9 @@ package com.zt.plat.module.qms.office.supplier.service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||
import com.zt.plat.module.qms.business.reportdoc.controller.vo.ReportDocumentMainRespVO;
|
||||
import com.zt.plat.module.qms.business.reportdoc.controller.vo.ReportDocumentMainSaveReqVO;
|
||||
import com.zt.plat.module.qms.office.supplier.controller.vo.SupplierEvaluationPageReqVO;
|
||||
import com.zt.plat.module.qms.office.supplier.controller.vo.SupplierEvaluationRespVO;
|
||||
import com.zt.plat.module.qms.office.supplier.controller.vo.SupplierEvaluationSaveReqVO;
|
||||
@@ -59,6 +62,9 @@ public interface SupplierEvaluationService {
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 供应商评价分页
|
||||
*/
|
||||
PageResult<SupplierEvaluationDO> getSupplierEvaluationPage(SupplierEvaluationPageReqVO pageReqVO);
|
||||
PageResult<SupplierEvaluationRespVO> getSupplierEvaluationPage(SupplierEvaluationPageReqVO pageReqVO);
|
||||
|
||||
|
||||
//发起流程
|
||||
CommonResult<SupplierEvaluationRespVO> createProcessInstance(SupplierEvaluationSaveReqVO entity);
|
||||
}
|
||||
@@ -1,13 +1,37 @@
|
||||
package com.zt.plat.module.qms.office.supplier.service;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
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.bpm.api.task.BpmProcessInstanceApi;
|
||||
import com.zt.plat.module.bpm.api.task.BpmTaskApi;
|
||||
import com.zt.plat.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
|
||||
import com.zt.plat.module.bpm.api.task.dto.BpmTaskApproveReqDTO;
|
||||
import com.zt.plat.module.bpm.api.task.dto.BpmTaskRespDTO;
|
||||
import com.zt.plat.module.qms.api.task.BMPCallbackInterface;
|
||||
import com.zt.plat.module.qms.api.task.dto.QmsBpmDTO;
|
||||
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigUserSignatureDO;
|
||||
import com.zt.plat.module.qms.business.config.service.ConfigUserSignatureService;
|
||||
import com.zt.plat.module.qms.business.reportdoc.controller.vo.ReportDocumentMainRespVO;
|
||||
import com.zt.plat.module.qms.business.reportdoc.dal.dataobject.ReportDocumentMainDO;
|
||||
import com.zt.plat.module.qms.common.data.service.DataKeyCheckService;
|
||||
import com.zt.plat.module.qms.enums.QmsBpmConstant;
|
||||
import com.zt.plat.module.qms.enums.QmsCommonConstant;
|
||||
import com.zt.plat.module.qms.enums.QmsSupplierConstant;
|
||||
import com.zt.plat.module.qms.office.supplier.controller.vo.SupplierEvaluationPageReqVO;
|
||||
import com.zt.plat.module.qms.office.supplier.controller.vo.SupplierEvaluationRespVO;
|
||||
import com.zt.plat.module.qms.office.supplier.controller.vo.SupplierEvaluationSaveReqVO;
|
||||
import org.springframework.stereotype.Service;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
|
||||
import com.zt.plat.module.qms.office.supplier.dal.dataobject.SupplierEvaluationDO;
|
||||
@@ -17,25 +41,32 @@ import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||
import com.zt.plat.module.qms.office.supplier.dal.mapper.SupplierEvaluationMapper;
|
||||
|
||||
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception0;
|
||||
import static com.zt.plat.framework.common.util.collection.CollectionUtils.convertList;
|
||||
import static com.zt.plat.module.qms.enums.ErrorCodeConstants.*;
|
||||
import static com.zt.plat.module.qms.enums.QmsBpmConstant.BPM_CALLBACK_BEAN_NAME;
|
||||
|
||||
/**
|
||||
* 供应商评价 Service 实现类
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
@Service
|
||||
@Service("supplierEvaluationService")
|
||||
@Validated
|
||||
public class SupplierEvaluationServiceImpl implements SupplierEvaluationService {
|
||||
public class SupplierEvaluationServiceImpl implements SupplierEvaluationService, BMPCallbackInterface {
|
||||
|
||||
@Resource
|
||||
private SupplierEvaluationMapper supplierEvaluationMapper;
|
||||
@Resource private SupplierEvaluationMapper supplierEvaluationMapper;
|
||||
@Resource private BpmProcessInstanceApi bpmProcessInstanceApi;
|
||||
@Resource private BpmTaskApi bpmTaskApi;
|
||||
@Resource private ConfigUserSignatureService configUserSignatureService;
|
||||
@Resource private DataKeyCheckService dataKeyCheckService;
|
||||
|
||||
@Override
|
||||
public SupplierEvaluationRespVO createSupplierEvaluation(SupplierEvaluationSaveReqVO createReqVO) {
|
||||
|
||||
// 插入
|
||||
SupplierEvaluationDO supplierEvaluation = BeanUtils.toBean(createReqVO, SupplierEvaluationDO.class);
|
||||
supplierEvaluation.setFlowStatus(QmsCommonConstant.NOT_START);
|
||||
supplierEvaluationMapper.insert(supplierEvaluation);
|
||||
// 返回
|
||||
return BeanUtils.toBean(supplierEvaluation, SupplierEvaluationRespVO.class);
|
||||
@@ -85,8 +116,166 @@ public class SupplierEvaluationServiceImpl implements SupplierEvaluationService
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<SupplierEvaluationDO> getSupplierEvaluationPage(SupplierEvaluationPageReqVO pageReqVO) {
|
||||
public PageResult<SupplierEvaluationRespVO> getSupplierEvaluationPage(SupplierEvaluationPageReqVO pageReqVO) {
|
||||
return supplierEvaluationMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<SupplierEvaluationRespVO> createProcessInstance(SupplierEvaluationSaveReqVO param) {
|
||||
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
//当前登录用户昵称
|
||||
String nickName = SecurityFrameworkUtils.getLoginUserNickname();
|
||||
Long id = param.getId();
|
||||
SupplierEvaluationDO entity = getSupplierEvaluation(id);
|
||||
String flowInsId = entity.getFlowInstanceId();
|
||||
|
||||
if(!ObjectUtils.isEmpty(flowInsId)){
|
||||
CommonResult<List<BpmTaskRespDTO>> taskRet = bpmTaskApi.getTaskListByProcessInstanceId(flowInsId);
|
||||
List<BpmTaskRespDTO> taskList = taskRet.getData();
|
||||
if(taskList.isEmpty())
|
||||
throw exception0(ERROR_CODE_MODULE_COMMON, "流程任务查询失败,请联系管理员处理");
|
||||
String taskId = taskList.get(taskList.size() - 1).getId();
|
||||
//驳回后重新提交
|
||||
BpmTaskApproveReqDTO reqVO = new BpmTaskApproveReqDTO();
|
||||
reqVO.setId(taskId);
|
||||
CommonResult<Boolean> result = bpmProcessInstanceApi.approveTask(reqVO);
|
||||
if(!result.isSuccess()){
|
||||
throw exception0(ERROR_CODE_MODULE_COMMON, result.getMsg());
|
||||
}
|
||||
entity.setFlowStatus(QmsCommonConstant.IN_PROGRESS);
|
||||
//todo 生成报告编号 documentCode
|
||||
supplierEvaluationMapper.updateById(entity);
|
||||
SupplierEvaluationRespVO respVO = BeanUtils.toBean(entity, SupplierEvaluationRespVO.class);
|
||||
return CommonResult.success(respVO);
|
||||
}
|
||||
JSONObject formData = new JSONObject();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
formData.put("mainId", id);
|
||||
formData.put("applyUser", nickName);
|
||||
formData.put("applyUserId", loginUser.getId());
|
||||
formData.put("applyDepartment", loginUser.getVisitDeptName());
|
||||
formData.put("applyDepartmentId", loginUser.getVisitDeptId());
|
||||
formData.put("applyTime", sdf.format(new Date()));
|
||||
Map<String, Object> variables = formData.toJavaObject(Map.class);
|
||||
variables.put(BPM_CALLBACK_BEAN_NAME, "supplierEvaluationService"); //流程回调时使用的service
|
||||
BpmProcessInstanceCreateReqDTO reqDTO = new BpmProcessInstanceCreateReqDTO();
|
||||
reqDTO.setBusinessKey(String.valueOf(id));
|
||||
reqDTO.setProcessDefinitionKey(QmsSupplierConstant.EVALUATION_FLOW_KEY);
|
||||
reqDTO.setVariables(variables);
|
||||
CommonResult<String> result = bpmProcessInstanceApi.createProcessInstance(loginUser.getId(), reqDTO);
|
||||
if(!result.isSuccess()){
|
||||
throw exception0(ERROR_CODE_MODULE_COMMON, result.getMsg());
|
||||
}
|
||||
String wfInsId = result.getData();
|
||||
entity.setFlowInstanceId(wfInsId);
|
||||
entity.setFlowStatus(QmsCommonConstant.IN_PROGRESS);
|
||||
entity.setEvaluationDate(LocalDateTime.now());
|
||||
entity.setEvaluator(nickName);
|
||||
supplierEvaluationMapper.updateById(entity);
|
||||
SupplierEvaluationRespVO respVO = BeanUtils.toBean(entity, SupplierEvaluationRespVO.class);
|
||||
return CommonResult.success(respVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<JSONObject> callback(QmsBpmDTO reqDTO) {
|
||||
|
||||
JSONObject variables = reqDTO.getVariables();
|
||||
String processInsId = variables.getString(QmsBpmConstant.BPM_PROCESS_INS_ID);
|
||||
String currentActivityInsId = variables.getString(QmsBpmConstant.BPM_CUR_ACTIVITY_INS_ID);
|
||||
String returnFlag = variables.getString(QmsBpmConstant.BPM_REJECT_TO_FIRST_FLAG); //退回标识。在任务监听中设置
|
||||
//同一个节点实例只触发一次
|
||||
String checkKey = currentActivityInsId;
|
||||
if(ObjectUtils.isEmpty(currentActivityInsId))
|
||||
checkKey = processInsId + "-create";
|
||||
if("1".equals(returnFlag))
|
||||
checkKey += "-reject";
|
||||
try{
|
||||
dataKeyCheckService.create(checkKey, this.getClass().getName());
|
||||
}catch (Exception e){
|
||||
// e.printStackTrace();
|
||||
|
||||
return CommonResult.success(new JSONObject());
|
||||
}
|
||||
//流程状态 1-提交(含退回) 4-取消流程
|
||||
String PROCESS_STATUS = variables.getString(QmsBpmConstant.PROCESS_INSTANCE_VARIABLE_STATUS);
|
||||
String mainId = variables.getString("mainId");
|
||||
JSONArray fieldExtensions = new JSONArray();
|
||||
if(variables.containsKey(QmsBpmConstant.BPM_FIELD_EXTENSIONS)){
|
||||
fieldExtensions = variables.getJSONArray(QmsBpmConstant.BPM_FIELD_EXTENSIONS);
|
||||
}
|
||||
SupplierEvaluationDO entity = getSupplierEvaluation(Long.valueOf(mainId));
|
||||
|
||||
String currentActivityId = variables.getString(QmsBpmConstant.BPM_CALLBACK_ACTIVITY_ID);
|
||||
|
||||
//判断是否最后一个节点
|
||||
String lastActivityFlag = "0";
|
||||
String firstActivityFlag = "0";
|
||||
if(!fieldExtensions.isEmpty()){
|
||||
for(int i = 0; i < fieldExtensions.size(); i++){
|
||||
JSONObject fieldExtension = fieldExtensions.getJSONObject(i);
|
||||
if(fieldExtension.getString("fieldName").equalsIgnoreCase(QmsBpmConstant.BPM_LAST_ACTIVITY_FLAG)){
|
||||
lastActivityFlag = "1";
|
||||
}
|
||||
if(fieldExtension.getString("fieldName").equalsIgnoreCase(QmsBpmConstant.BPM_FIRST_ACTIVITY_FLAG)){
|
||||
firstActivityFlag = "1";
|
||||
}
|
||||
}
|
||||
}
|
||||
//"RETURN_FLAG_Activity_001": true 标识驳回到发起环节
|
||||
if(("1").equals(returnFlag)){
|
||||
//驳回。流程需要配置退回到发起节点
|
||||
entity.setFlowStatus(QmsCommonConstant.REJECTED);
|
||||
entity.setSignatureInfo("");
|
||||
}else if("4".equals(PROCESS_STATUS)){
|
||||
//作废
|
||||
entity.setFlowStatus(QmsCommonConstant.VOID);
|
||||
entity.setSignatureInfo("");
|
||||
}else if("1".equals(PROCESS_STATUS)){
|
||||
//通过
|
||||
assembleSignature(currentActivityId, entity);
|
||||
if("1".equals(firstActivityFlag))
|
||||
entity.setFlowStatus(QmsCommonConstant.IN_PROGRESS); //驳回后重新提交
|
||||
if("1".equals(lastActivityFlag))
|
||||
entity.setFlowStatus(QmsCommonConstant.COMPLETED); //结束审批
|
||||
}
|
||||
|
||||
supplierEvaluationMapper.updateById(entity);
|
||||
|
||||
// try {
|
||||
// reportDocumentAssistService.updateDocFileAndCreateIWorkflow( variables, entity);
|
||||
// } catch (IOException e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
|
||||
JSONObject ret = new JSONObject();
|
||||
return CommonResult.success(ret);
|
||||
}
|
||||
|
||||
private void assembleSignature(String currentActivityId, SupplierEvaluationDO entity){
|
||||
if(ObjectUtils.isEmpty(currentActivityId) || "null".equals(currentActivityId))
|
||||
return;
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String sign = entity.getSignatureInfo();
|
||||
JSONObject signObj = new JSONObject();
|
||||
if(!ObjectUtils.isEmpty( sign))
|
||||
signObj = JSONObject.parseObject(sign);
|
||||
if(signObj.containsKey(currentActivityId))
|
||||
return;
|
||||
JSONObject obj = new JSONObject();
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
Long userId = loginUser.getId();
|
||||
//当前登录用户昵称
|
||||
String nickName = SecurityFrameworkUtils.getLoginUserNickname();
|
||||
ConfigUserSignatureDO configUserSignatureDO = configUserSignatureService.getByUserId(userId);
|
||||
obj.put("signatureId", "");
|
||||
if(configUserSignatureDO != null)
|
||||
obj.put("signatureId", configUserSignatureDO.getId());
|
||||
obj.put("userId", userId);
|
||||
obj.put("userName", nickName);
|
||||
obj.put("signTime", sdf.format(new Date()));
|
||||
signObj.put(currentActivityId, obj);
|
||||
entity.setSignatureInfo(signObj.toJSONString());
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.zt.plat.module.qms.office.supplier.service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.zt.plat.module.qms.office.supplier.controller.vo.SupplierExtendRespVO;
|
||||
import com.zt.plat.module.qms.office.supplier.controller.vo.SupplierPageReqVO;
|
||||
import com.zt.plat.module.qms.office.supplier.controller.vo.SupplierRespVO;
|
||||
import com.zt.plat.module.qms.office.supplier.controller.vo.SupplierSaveReqVO;
|
||||
@@ -51,7 +52,7 @@ public interface SupplierService {
|
||||
* @param id 编号
|
||||
* @return 供应商
|
||||
*/
|
||||
SupplierDO getSupplier(Long id);
|
||||
SupplierExtendRespVO getSupplier(Long id);
|
||||
|
||||
/**
|
||||
* 获得供应商分页
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.zt.plat.module.qms.office.supplier.service;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.zt.plat.module.qms.office.supplier.controller.vo.SupplierExtendRespVO;
|
||||
import com.zt.plat.module.qms.office.supplier.controller.vo.SupplierPageReqVO;
|
||||
import com.zt.plat.module.qms.office.supplier.controller.vo.SupplierRespVO;
|
||||
import com.zt.plat.module.qms.office.supplier.controller.vo.SupplierSaveReqVO;
|
||||
@@ -80,8 +81,8 @@ public class SupplierServiceImpl implements SupplierService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SupplierDO getSupplier(Long id) {
|
||||
return supplierMapper.selectById(id);
|
||||
public SupplierExtendRespVO getSupplier(Long id) {
|
||||
return supplierMapper.selectOneWithCertifications(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user