feat:标准物质期间核查配置列表
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
package com.zt.plat.module.qms.resource.material.controller.admin;
|
package com.zt.plat.module.qms.resource.material.controller.admin;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.zt.plat.framework.apilog.core.annotation.ApiAccessLog;
|
import com.zt.plat.framework.apilog.core.annotation.ApiAccessLog;
|
||||||
import com.zt.plat.framework.business.annotation.FileUploadController;
|
import com.zt.plat.framework.business.annotation.FileUploadController;
|
||||||
import com.zt.plat.framework.business.controller.AbstractFileUploadController;
|
import com.zt.plat.framework.business.controller.AbstractFileUploadController;
|
||||||
@@ -11,6 +13,10 @@ import com.zt.plat.framework.common.pojo.vo.BatchDeleteReqVO;
|
|||||||
import com.zt.plat.framework.common.util.object.BeanUtils;
|
import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||||
import com.zt.plat.framework.datapermission.core.annotation.DeptDataPermissionIgnore;
|
import com.zt.plat.framework.datapermission.core.annotation.DeptDataPermissionIgnore;
|
||||||
import com.zt.plat.framework.excel.core.util.ExcelUtils;
|
import com.zt.plat.framework.excel.core.util.ExcelUtils;
|
||||||
|
import com.zt.plat.module.qms.core.constant.DataTypeConstant;
|
||||||
|
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigBusinessRulePageReqVO;
|
||||||
|
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigBusinessRuleRespVO;
|
||||||
|
import com.zt.plat.module.qms.resource.device.service.DeviceConfigBusinessRuleService;
|
||||||
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialProductPageReqVO;
|
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialProductPageReqVO;
|
||||||
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialProductRespVO;
|
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialProductRespVO;
|
||||||
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialProductSaveReqVO;
|
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialProductSaveReqVO;
|
||||||
@@ -29,6 +35,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||||
import static com.zt.plat.framework.common.pojo.CommonResult.success;
|
import static com.zt.plat.framework.common.pojo.CommonResult.success;
|
||||||
@@ -48,8 +55,8 @@ public class MaterialProductController extends AbstractFileUploadController impl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Resource
|
@Resource private MaterialProductService materialProductService;
|
||||||
private MaterialProductService materialProductService;
|
@Resource private DeviceConfigBusinessRuleService deviceConfigBusinessRuleService;
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/save-category")
|
@PostMapping("/save-category")
|
||||||
@@ -143,4 +150,51 @@ public class MaterialProductController extends AbstractFileUploadController impl
|
|||||||
BeanUtils.toBean(list, MaterialProductRespVO.class));
|
BeanUtils.toBean(list, MaterialProductRespVO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 查询标准物质的分类树、业务配置状态*/
|
||||||
|
@GetMapping("/getProductTreeDataWithRuleStatus")
|
||||||
|
@Operation(summary = "获取分类和产品树_含规则配置状态")
|
||||||
|
public CommonResult<JSONArray> getProductTreeDataWithRuleStatus() {
|
||||||
|
MaterialProductPageReqVO reqVO = new MaterialProductPageReqVO();
|
||||||
|
//查询标准物质根分类
|
||||||
|
reqVO.setParentId(0L);
|
||||||
|
reqVO.setStandardMaterialFlag(1);
|
||||||
|
reqVO.setNodeType(DataTypeConstant.DATA_TYPE_CATEGORY);
|
||||||
|
List<MaterialProductDO> rootCategoryList = materialProductService.selectListWithCustomSql(reqVO);
|
||||||
|
if(rootCategoryList == null ||rootCategoryList.isEmpty())
|
||||||
|
return success(new JSONArray());
|
||||||
|
reqVO = new MaterialProductPageReqVO();
|
||||||
|
reqVO.setRootIdList(rootCategoryList.stream().map(MaterialProductDO::getId).toList());
|
||||||
|
List<MaterialProductDO> list = materialProductService.selectListWithCustomSql(reqVO);
|
||||||
|
JSONArray jsonArray = new JSONArray();
|
||||||
|
for (MaterialProductDO item : list) {
|
||||||
|
jsonArray.add(item);
|
||||||
|
}
|
||||||
|
List<Long> productIdList = list.stream().filter(item -> item.getNodeType().equals(DataTypeConstant.DATA_TYPE_DATA)).map(MaterialProductDO::getId).toList();
|
||||||
|
DeviceConfigBusinessRulePageReqVO ruleReqVO = new DeviceConfigBusinessRulePageReqVO();
|
||||||
|
ruleReqVO.setProductIdList(productIdList);
|
||||||
|
ruleReqVO.setPageNo(1);
|
||||||
|
ruleReqVO.setPageSize(-1);
|
||||||
|
String[] allDomain = {"dailyCheck","period","maintain","calibration"};
|
||||||
|
List<DeviceConfigBusinessRuleRespVO> ruleList = deviceConfigBusinessRuleService.getDeviceConfigBusinessRulePage(ruleReqVO).getList();
|
||||||
|
for(MaterialProductDO product: list){
|
||||||
|
Long id = product.getId();
|
||||||
|
JSONObject jsonObject = jsonArray.getJSONObject(jsonArray.indexOf(product));
|
||||||
|
for(String domain: allDomain){
|
||||||
|
jsonObject.put(domain + "_on", "0");
|
||||||
|
jsonObject.put(domain + "_count", 0);
|
||||||
|
}
|
||||||
|
for(DeviceConfigBusinessRuleRespVO rule: ruleList){
|
||||||
|
Long productId = rule.getProductId();
|
||||||
|
String businessDomain = rule.getBusinessDomain();
|
||||||
|
if(Objects.equals(productId, id)){
|
||||||
|
jsonObject.put(businessDomain + "_on", "1");
|
||||||
|
jsonObject.put(businessDomain + "_count", rule.getItemCount());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
jsonArray.set(jsonArray.indexOf(product), jsonObject);
|
||||||
|
}
|
||||||
|
return success(jsonArray);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -34,6 +34,9 @@ public class MaterialProductPageReqVO extends PageParam {
|
|||||||
@Schema(description = "id路径")
|
@Schema(description = "id路径")
|
||||||
private String idPath;
|
private String idPath;
|
||||||
|
|
||||||
|
@Schema(description = "数据类型")
|
||||||
|
private String nodeType;
|
||||||
|
|
||||||
@Schema(description = "编码,原始数据编码")
|
@Schema(description = "编码,原始数据编码")
|
||||||
private String code;
|
private String code;
|
||||||
|
|
||||||
@@ -122,4 +125,8 @@ public class MaterialProductPageReqVO extends PageParam {
|
|||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
private LocalDateTime[] createTime;
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
|
||||||
|
//============扩展字段===========
|
||||||
|
List<Long> rootIdList;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -12,6 +12,7 @@ import com.zt.plat.module.qms.core.constant.DataTypeConstant;
|
|||||||
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialProductPageReqVO;
|
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialProductPageReqVO;
|
||||||
import com.zt.plat.module.qms.resource.material.dal.dataobject.*;
|
import com.zt.plat.module.qms.resource.material.dal.dataobject.*;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -143,4 +144,6 @@ public interface MaterialProductMapper extends BaseMapperX<MaterialProductDO> {
|
|||||||
.in(MaterialProductDO::getId, pdtIds);
|
.in(MaterialProductDO::getId, pdtIds);
|
||||||
return this.exists(wrapperX);
|
return this.exists(wrapperX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<MaterialProductDO> selectListWithCustomSql(@Param("param") MaterialProductPageReqVO reqVO);
|
||||||
}
|
}
|
||||||
@@ -7,6 +7,7 @@ import com.zt.plat.module.qms.resource.material.controller.vo.MaterialProductSav
|
|||||||
import com.zt.plat.module.qms.resource.material.controller.vo.query.MaterialProductQueryVO;
|
import com.zt.plat.module.qms.resource.material.controller.vo.query.MaterialProductQueryVO;
|
||||||
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialProductDO;
|
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialProductDO;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -182,4 +183,7 @@ public interface MaterialProductService {
|
|||||||
* @return 物料数据
|
* @return 物料数据
|
||||||
*/
|
*/
|
||||||
List<MaterialProductDO> getProductListByCodeAndSpec(List<String> codes, List<String> specifications);
|
List<MaterialProductDO> getProductListByCodeAndSpec(List<String> codes, List<String> specifications);
|
||||||
|
|
||||||
|
|
||||||
|
List<MaterialProductDO> selectListWithCustomSql(MaterialProductPageReqVO reqVO);
|
||||||
}
|
}
|
||||||
@@ -519,4 +519,8 @@ public class MaterialProductServiceImpl implements MaterialProductService {
|
|||||||
.in(MaterialProductDO::getSpecification, specifications));
|
.in(MaterialProductDO::getSpecification, specifications));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<MaterialProductDO> selectListWithCustomSql(MaterialProductPageReqVO reqVO) {
|
||||||
|
return materialProductMapper.selectListWithCustomSql(reqVO);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -9,4 +9,67 @@
|
|||||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
<resultMap id="MaterialProductMap" type="com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialProductDO">
|
||||||
|
<id column="id" property="id"/>
|
||||||
|
<result column="PRN_ID" property="parentId"/>
|
||||||
|
<result column="ID_PATH" property="idPath"/>
|
||||||
|
<result column="NDE_TP" property="nodeType"/>
|
||||||
|
<result column="ORIG_MTRL_ID" property="originalMaterialId"/>
|
||||||
|
<result column="CD" property="code"/>
|
||||||
|
<result column="NAME" property="name"/>
|
||||||
|
<result column="CST_CFG" property="customConfig"/>
|
||||||
|
<result column="CST_FORM" property="customForm"/>
|
||||||
|
<result column="CST_DAT" property="customData"/>
|
||||||
|
<result column="TAG" property="tag"/>
|
||||||
|
<result column="LBL_TMPL_KY" property="labelTemplateKey"/>
|
||||||
|
<result column="MDL_NO" property="modelNo"/>
|
||||||
|
<result column="SPEC" property="specification"/>
|
||||||
|
<result column="PRM" property="parameter"/>
|
||||||
|
<result column="STD_CPY" property="standardCapacity"/>
|
||||||
|
<result column="MFR" property="manufacturer"/>
|
||||||
|
<result column="UNT" property="unit"/>
|
||||||
|
<result column="SMP_IDS" property="sampleIds"/>
|
||||||
|
<result column="ENB_PRTL" property="enablePartial"/>
|
||||||
|
<result column="DUE" property="due"/>
|
||||||
|
<result column="OPN_DUE_FLG" property="openDueFlag"/>
|
||||||
|
<result column="OPN_DUE_AFT" property="openDueAfter"/>
|
||||||
|
<result column="HZRD" property="hazardous"/>
|
||||||
|
<result column="STD_SOL_FLG" property="standardSolutionFlag"/>
|
||||||
|
<result column="STD_MTRL_FLG" property="standardMaterialFlag"/>
|
||||||
|
<result column="RVW_DUE" property="reviewDue"/>
|
||||||
|
<result column="SRT_NO" property="sortNo"/>
|
||||||
|
<result column="CNL_FLG" property="cancelFlag"/>
|
||||||
|
<result column="ASY_FLG" property="assayFlag"/>
|
||||||
|
<result column="INVT_ALM_FLG" property="inventoryAlarmFlag"/>
|
||||||
|
<result column="INVT_ALM_LVL" property="inventoryAlarmLevel"/>
|
||||||
|
<result column="INVT_ALM_RNG" property="inventoryAlarmRange"/>
|
||||||
|
<result column="SYS_DEPT_CD" property="systemDepartmentCode"/>
|
||||||
|
<result column="RMK" property="remark"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<select id="selectListWithCustomSql" resultMap="MaterialProductMap">
|
||||||
|
SELECT *
|
||||||
|
FROM T_MTRL_PDT
|
||||||
|
<where>
|
||||||
|
<if test="param.rootIdList != null and param.rootIdList.size > 0">
|
||||||
|
and (
|
||||||
|
<foreach collection="param.rootIdList" item="id" open="(" close=")" separator="OR">
|
||||||
|
ID_PATH LIKE CONCAT('%', #{id}, '%') ESCAPE '/'
|
||||||
|
</foreach>
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
<if test="param.nodeType != null and param.nodeType != ''">
|
||||||
|
and NDE_TP = #{param.nodeType}
|
||||||
|
</if>
|
||||||
|
<if test="param.standardMaterialFlag != null ">
|
||||||
|
and STD_MTRL_FLG = #{param.standardMaterialFlag}
|
||||||
|
</if>
|
||||||
|
<if test="param.parentId != null ">
|
||||||
|
and PRN_ID = #{param.parentId}
|
||||||
|
</if>
|
||||||
|
and DELETED = 0
|
||||||
|
</where>
|
||||||
|
order by SRT_NO asc
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
Reference in New Issue
Block a user