Commit 2788379f authored by 曹盼盼's avatar 曹盼盼

修改校验,以及依赖的更新

parent bd4c94d9
......@@ -15,13 +15,14 @@ import java.util.Map;
@AllArgsConstructor
public enum StageEnum {
焊前人员("人员确定","STAFF","人员"),
焊前设备("设备确定","EQUIPMENT","设备"),
焊前管材质量("管材确定","BEFORE-WELDING","管材"),
焊前人员("","STAFF","人员"),
焊前设备("焊前确定","EQUIPMENT","设备"),
焊前管材质量("","BEFORE-WELDING","管材"),
焊接工艺("工艺确定","CRAFT","工艺"),
管道耐压("耐压确定","VOLTAGE","耐压"),
敷设质量("敷设确定","LAY","敷设"),
定位("定位确定","LOTCATION","定位");
定位("定位确定","LOTCATION","定位"),
回填("回填确定","BACKFILL","回填");
private String name;
private String stage;
......@@ -32,11 +33,11 @@ public enum StageEnum {
public static Map<String,String> getNameByNameMap = new HashMap<>();
public static Map<String,String> getStageByNameMap = new HashMap<>();
public static Map<String,String> getStatusByVerifyNameMap = new HashMap<>();
static {
for(StageEnum enums:StageEnum.values()){
getNameByNameMap.put(enums.stage,enums.name);
getStageByNameMap.put(enums.stage,enums.name);
getStatusByVerifyNameMap.put(enums.stage, enums.verifyName);
}
}
......
......@@ -6,8 +6,6 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* @Author cpp
* @Description
......@@ -32,7 +30,6 @@ public class AcceptDto extends BaseDto {
private String userId;
@ApiModelProperty(value = "阶段检验")
private String stage;
//设备
@ApiModelProperty(value = "设备id")
private String facilityId;
......@@ -45,6 +42,8 @@ public class AcceptDto extends BaseDto {
private String materialId;
@ApiModelProperty(value = "管材图片信息")
private String materialPhoto;
@ApiModelProperty(value = "管材校验需要数据")
private TubingCheck tubingCheck;
//工艺
@ApiModelProperty(value = "焊接工艺")
......@@ -58,8 +57,6 @@ public class AcceptDto extends BaseDto {
private String depthType;
@ApiModelProperty(value = "埋深")
private String depth;
@ApiModelProperty(value = "埋深定位信息")
private String depthLocation;
@ApiModelProperty(value = "埋深图片信息")
private String depthPhoto;
......@@ -68,8 +65,7 @@ public class AcceptDto extends BaseDto {
private String pressureId;
@ApiModelProperty(value = "压力测试")
private String pressureTest;
@ApiModelProperty(value = "耐压测试定位信息")
private String pressureLocation;
@ApiModelProperty(value = "耐压图片信息")
private String pressurePhoto;
//定位
......
package com.yeejoin.amos.boot.module.ugp.api.dto;
import lombok.Data;
/**
* @Author cpp
* @Description
* @Date 2022/10/27
*/
@Data
public class OpenDto {
private String oldPhoto; //原照片
private String newPhoto; //新照片对比
private String accord; //符合性
private String valid; //有效性
private String result;//结果
}
......@@ -58,16 +58,12 @@ public class SmartListDto extends BaseDto {
private String permission;
@ApiModelProperty(value = "焊工编号")
private String personWeld;
@ApiModelProperty(value = "管材定位信息")
private String tubularlocatingInformation;
//设备
@ApiModelProperty(value = "焊机编号")
private String facilityNumber;
@ApiModelProperty(value = "焊机名称")
private String facilityName;
@ApiModelProperty(value = "焊机定位信息")
private String facilityLocation;
@ApiModelProperty(value = "检定状态")
private String facilityStatus;
......@@ -78,7 +74,7 @@ public class SmartListDto extends BaseDto {
private String peopleName;
@ApiModelProperty(value = "持证状态")
private String peopleStatus;
@ApiModelProperty(value = "焊接定位信息")
@ApiModelProperty(value = "定位信息")
private String peopleLocation;
// 工艺
......@@ -97,14 +93,17 @@ public class SmartListDto extends BaseDto {
private String pressureCode;
@ApiModelProperty(value = "测试压力Mpa")
private String mpa;
@ApiModelProperty(value = "耐压测试定位")
private String pressureLocation;
//敷设位置标定检验
//定位检验
@ApiModelProperty(value = "焊口精确定位方式")
private String preciseWeldingPosition;
@ApiModelProperty(value = "位置标定检验结果")
private String resuts;
//埋深
@ApiModelProperty(value = "埋深检测方式")
private String detectionMethod;
@ApiModelProperty(value = "埋深m")
private String burialDepth;
@ApiModelProperty(value = "检验检测阶段")
......
package com.yeejoin.amos.boot.module.ugp.api.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Author cpp
* @Description
* @Date 2022/10/25
*/
@Data
public class TubingCheck {
private static final long serialVersionUID = 1L;
private String comboxType;//焊后热处理
private Double materialAthickness; //第一个管材a厚度
private Double materialBthickness;//第一个管材b厚度
private String ifBend; //是否弯曲
private Double wpsmaterialAthickness; //第二个管材a厚度
private Double wpsmaterialBthickness; //第二个管材b厚度
}
......@@ -9,7 +9,7 @@ import java.util.List;
public interface IInstallationQualityMapper extends BaseMapper<QualityInfo> {
List<QualityInfo> findss();
List<QualityInfo> findss(PercentOfPassDto dto);
......
......@@ -4,6 +4,7 @@ import com.yeejoin.amos.boot.module.ugp.api.dto.SmartListDto;
import com.yeejoin.amos.boot.module.ugp.api.entity.Verify;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;
......@@ -24,4 +25,11 @@ public interface VerifyMapper extends BaseMapper<Verify> {
List<Verify> commonality(String stage,SmartListDto smartListDto);
@Select("select * from tz_ugp_verify where target_info = #{targetInfo}")
Verify selectByTargetInfo(String targetInfo);
//
List<Verify> selectByWelder(Long projectId,Long welderId,String code,String stage,Long random);
Verify selectByCode(String code,Long projectId,String stage,Long random);
}
......@@ -25,7 +25,7 @@
<select id="findss" resultMap="result">
<select id="findss" resultMap="result">
select
pt.name ,
pt.address ,
......@@ -49,6 +49,10 @@
qy.is_delete =0
and
pt.is_delete=0
<if test="name !='' and name != null">
and
pt.name like concat( '%',#{name},'%')
</if>
</select>
......
......@@ -64,4 +64,34 @@
</select>
<select id="selectByWelder" resultType="com.yeejoin.amos.boot.module.ugp.api.entity.Verify">
SELECT * FROM tz_ugp_verify where
project_id =#{projectId}
and target_info -> "$.welderId" = #{welderId}
<if test="code !=null and code !=''">
and
target_info -> "$.code" =#{code}
</if>
<if test="stage !=null and stage !=''">
and stage =#{stage}
</if>
<if test="random !=null and random !=''">
and
target_info -> "$.random" =#{random}
</if>
</select>
<select id="selectByCode" resultType="com.yeejoin.amos.boot.module.ugp.api.entity.Verify">
SELECT * FROM tz_ugp_verify where
code =#{code}
and project_id =#{projectId}
and stage =#{stage}
<if test="random !=null and random !=''">
and
target_info -> "$.random" =#{random}
</if>
</select>
</mapper>
......@@ -34,19 +34,8 @@
<dependency>
<groupId>fakepath</groupId>
<artifactId>ugp-welding-evaluation-inspection-sdk</artifactId>
<version>1.0</version>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.36.0.3</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
<version>7.10.0.Final</version>
</dependency>
</dependencies>
<build>
......
......@@ -45,7 +45,7 @@ private WeldServiceImpl weld;
@GetMapping(value = "/find")
@ApiOperation(httpMethod = "GET", value = "质量问题闭环管理-安装质量监检信息-质量监检信息", notes = "质量问题闭环管理-安装质量监检信息-质量监检信息")
public ResponseModel<Page<PercentOfPassDto>> find(@RequestParam(value = "current") int current, @RequestParam
(value = "size") int size,PercentOfPassDto percentOfPassDto) {
(value = "size") int size, PercentOfPassDto percentOfPassDto) {
Page<PercentOfPassDto> page = new Page<>();
page.setCurrent(current);
page.setSize(size);
......
......@@ -13,6 +13,7 @@ import com.yeejoin.amos.boot.module.ugp.api.dto.WelderEquipmentDto;
import com.yeejoin.amos.boot.module.ugp.api.entity.Attachment;
import com.yeejoin.amos.boot.module.ugp.api.entity.Project;
import com.yeejoin.amos.boot.module.ugp.biz.service.impl.*;
import io.swagger.annotations.ApiModel;
import org.springframework.beans.BeanUtils;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
......
......@@ -3,13 +3,19 @@ package com.yeejoin.amos.boot.module.ugp.biz.controller;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.module.ugp.api.Enum.StageEnum;
import com.yeejoin.amos.boot.module.ugp.api.dto.*;
import com.yeejoin.amos.boot.module.ugp.api.entity.Verify;
import com.yeejoin.amos.boot.module.ugp.api.service.IVerifyService;
import netscape.javascript.JSObject;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.yeejoin.amos.boot.module.ugp.biz.service.impl.VerifyServiceImpl;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
......@@ -220,9 +226,28 @@ public class VerifyController extends BaseController {
return ResponseHelper.buildResponse(service.commonality(StageEnum.管道耐压.getStage(),page,smartListDto));
}
/**
* 敷设质量
* @param current
* @param size
* @param smartListDto
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/depth")
@ApiOperation(httpMethod = "GET", value = "敷设质量", notes = "敷设质量")
public ResponseModel<Page<SmartListDto>> depth(@RequestParam(value = "current") int current, @RequestParam
(value = "size") int size,SmartListDto smartListDto) {
Page<SmartListDto> page = new Page<>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(service.commonality(StageEnum.敷设质量.getStage(),page, smartListDto));
}
/** cpp
*
*敷设位置标定检验列表
*位置标定检验列表
* @param current
* @param size
* @return
......@@ -242,17 +267,39 @@ public class VerifyController extends BaseController {
/**
* cpp
* 校验
* @param dto
* @param jsonObject
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@PostMapping(value = "/checks")
@ApiOperation(httpMethod = "POST", value = "校验app上传数据", notes = "校验app上传数据")
public ResponseModel<String> checks(@RequestBody AcceptDto dto) {
return ResponseHelper.buildResponse(verifyServiceImpl.checks(dto));
public ResponseModel<String> checks(@RequestBody JSONObject jsonObject) {
return ResponseHelper.buildResponse(verifyServiceImpl.checks(jsonObject));
}
/**
* cpp
* 主键id查询verity表
* @param
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "/selectById")
@ApiOperation(httpMethod = "GET", value = "主键id查询verity表", notes = "主键id查询verity表")
public ResponseModel<OpenDto> selectById(@RequestParam Long sequenceNbr ) {
return ResponseHelper.buildResponse(verifyServiceImpl.selectById(sequenceNbr));
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "/photo")
@ApiOperation(httpMethod = "GET", value = "获取图片", notes = "获取图片")
public ResponseModel<Map> photo(@RequestParam Long sequenceNbr ) {
Map map =new HashMap<>();
map.put("newPhoto","https://img2.baidu.com/it/u=806791452,2765805606&fm=253&fmt=auto&app=138&f=JPEG?w=350&h=500");
return ResponseHelper.buildResponse(map);
}
......@@ -299,14 +346,29 @@ public class VerifyController extends BaseController {
}
/**
*焊口敷设位置标定检验
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "POST", value = "焊口敷设位置标定检验", notes = "焊口敷设位置标定检验")
@PostMapping(value = "/positionEffect")
public ResponseModel<String> positionEffect(@RequestBody JSONObject jsonObject) {
return ResponseHelper.buildResponse(verifyServiceImpl.positionEffect(jsonObject));
@PostMapping(value = "/postadd")
public ResponseModel<String> postadd(@RequestBody JSONObject jsonObject) {
String code = jsonObject.getString("code");
Long projectId = jsonObject.getLong("projectId");
jsonObject.getString("userId");
Verify verify = new Verify( );
verify.setProjectId(projectId);
verify.setTargetInfo(code);
boolean save = verifyServiceImpl.save(verify);
if (!save) {
//
return ResponseHelper.buildResponse("新增失败");
}
return ResponseHelper.buildResponse("成功");
}
}
......@@ -46,9 +46,7 @@ public class InstallationQualityImpl extends BaseService<PercentOfPassDto, Quali
@Override
public Page<PercentOfPassDto> find(Page<PercentOfPassDto> page,PercentOfPassDto pd) {
String name = pd.getName( );
List<QualityInfo> qfList = mapper.findss ( );
List<QualityInfo> qfList = mapper.findss ( pd);
List<PercentOfPassDto> list = new ArrayList<> ( );
for (QualityInfo qualityInfo : qfList) {
......@@ -118,22 +116,12 @@ public class InstallationQualityImpl extends BaseService<PercentOfPassDto, Quali
}
}
//name不为空走条件筛选
if (!StringUtils.isEmpty(name)) {
//进行数据筛选
List<PercentOfPassDto> collect = newsData.stream ( ).filter (b -> b.getName ( ).equals (name)).collect (Collectors.toList ( ));
page.setRecords (collect);
page.setTotal (collect.size ());
return page;
}else {
//如果条件name为空的,直接查询全部
page.setRecords (newsData);
page.setTotal (newsData.size ());
return page;
}
}
return page;
}
......
package com.yeejoin.amos.boot.module.ugp.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.mao.demo1.TestWeldingRules;
import com.mao.demo1.material.MyPqr;
import com.mao.demo1.material.MyWps;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.mao.expertSystem.WeldingQualification;
import com.mao.expertSystem.material.MyPqr;
import com.mao.expertSystem.material.MyWps;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.ugp.api.Enum.StageEnum;
import com.yeejoin.amos.boot.module.ugp.api.Enum.VerifyEnum;
import com.yeejoin.amos.boot.module.ugp.api.Enum.VerifyTypeEnum;
import com.yeejoin.amos.boot.module.ugp.api.dto.*;
import com.yeejoin.amos.boot.module.ugp.api.entity.QualityProblem;
import com.yeejoin.amos.boot.module.ugp.api.entity.Verify;
import com.yeejoin.amos.boot.module.ugp.api.entity.Weld;
import com.yeejoin.amos.boot.module.ugp.api.mapper.VerifyMapper;
import com.yeejoin.amos.boot.module.ugp.api.mapper.WeldMapper;
import com.yeejoin.amos.boot.module.ugp.api.service.IVerifyService;
import org.springframework.beans.BeanUtils;
import com.yeejoin.amos.boot.module.ugp.biz.framework.BusinessIdentify;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.*;
import java.util.stream.Collectors;
/**
* 智能监检管理表服务实现类
*
* @author system_generator
* @date 2022-09-22
*/
@Service
public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper> implements IVerifyService {
@Autowired
InstallNoticeServiceImpl installNoticeService;
@Autowired
WeldServiceImpl weldService;
@Autowired
WeldMapper weldMapper;
@Autowired
OrgServiceImpl orgService;
@Autowired
private MaterialServiceImpl materialService;
@Autowired
VerifyMapper verifyMapper;
VerifyMapper verifyMapper;
@Autowired
private EquipmentServiceImpl equipmentService;
@Autowired
QualityProblemServiceImpl qualityProblemService;
/**
* 分页查询
*/
public Page<VerifyDto> queryForVerifyPage(Page<VerifyDto> page) {
return this.queryForPage(page, null, false);
}
/**
* 列表查询 示例
*/
public List<VerifyDto> queryForVerifyList() {
return this.queryForList("" , false);
}
}
/** cpp
* 智能监检共用查询方法
* stage 阶段
* page 分页
*/
private static final String HEGE ="合格期内";
private static final String NOTHEGE ="超期未检";
public Page<SmartListDto> commonality(String stage,Page<SmartListDto> page,SmartListDto smartListDto){
List<Verify> verifyList = verifyMapper.commonality(stage,smartListDto);
List<SmartListDto> dtoList =new ArrayList<>();
......@@ -81,32 +135,31 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
for (Verify verify : verifyList) {
SmartListDto dto = new SmartListDto( );
dto.setSequenceNbr(verify.getSequenceNbr());//智能监检表id
dto.setProjectId(verify.getProjectId()); //项目id
dto.setName(verify.getProject().getName());//项目名称
dto.setProjectCode(verify.getProject().getCode());//项目编号
//检验状态
String status = verify.getStatus( );
if (status.equals("1")) {
dto.setStatus(VerifyEnum.已通过.getName());//检验状态
dto.setPeopleStatus("合格期内");//持证状态
if (status.equals(VerifyEnum.已通过.getStatus())) {
dto.setStatus(VerifyEnum.已通过.getName());
}
if (status.equals("0")) {
dto.setStatus(VerifyEnum.未通过.getName());//检验状态
dto.setPeopleStatus("超期未检");//持证状态
if (status.equals(VerifyEnum.未通过.getStatus())) {
dto.setStatus(VerifyEnum.未通过.getName());
}
dto.setType(verify.getType());//检验方式
dto.setSubmitTime(verify.getSubmitTime());//交检日期
dto.setVerifyTime(verify.getVerifyTime());//检验时间
String stage1 = verify.getStage( );//检验检测阶段
Map<String, String> map = StageEnum.getStatusByVerifyNameMap;
for (String key:map.keySet()){
if (key.equals(stage1)) {
dto.setStage(map.get(key).toString());//将阶段赋值
}
}
String targetInfo = verify.getTargetInfo();//app上传数据
Map mapInfo = JSON.parseObject(targetInfo, Map.class);
for (Object o:mapInfo.keySet()){
......@@ -114,7 +167,6 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
//获取焊口编号
String code = (String)mapInfo.get(o.toString( ));
dto.setCode(code);
}
if (o.toString().equals("peopleLocation")) {
......@@ -122,18 +174,130 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
String peopleLocation = (String)mapInfo.get(o.toString( ));
dto.setPeopleLocation(peopleLocation);
}
if (o.toString().equals("userId")) {
//获取焊工信息
String userId = (String)mapInfo.get(o.toString( ));
OrgUsr orgUsr = orgService.getOrgUsrById(userId);
dto.setPeopleName(orgUsr.getBizOrgName());//焊工姓名
dto.setPeopleName(orgUsr.getCode());//焊工编号
//人员
if (o.toString().equals("userId")) {
//获取焊工信息
String userId = mapInfo.get(o.toString( )).toString();
if (userId != null) {
OrgUsr orgUsr = orgService.getOrgUsrById(userId);
dto.setPeopleName(orgUsr.getBizOrgName());//焊工姓名
dto.setPersonWeld(orgUsr.getCode());//焊工编号
}
}
//持证判断
//设备
if (o.toString().equals("facilityId")) {
//设备id
Long eId = Long.valueOf(mapInfo.get(o.toString( )).toString());
if (eId != null) {
//获取设备
EquipmentDto equipmentDto = equipmentService.queryBySeq(eId);
if (equipmentDto != null) {
//设备名 设备编号
dto.setFacilityName(equipmentDto.getName());
dto.setFacilityNumber(equipmentDto.getCode());
}
}
}
//管材
if (o.toString().equals("materialId")) {
//管材id
Long mId = Long.valueOf(mapInfo.get(o.toString( )).toString());
if (mId != null) {
MaterialDto materialDto = materialService.queryBySeq(mId);
if (materialDto != null) {
//管材厂家 生产编号
dto.setManufacturer(materialDto.getManufacturer());
dto.setBatchNumber(materialDto.getBatchNum());
//生产日期需要判断(加判断)是否在有效期内
Date manufactureDate = materialDto.getManufactureDate( );
//将判断结果
dto.setPermission(HEGE);
}
}
}
//工艺
if (o.toString().equals("craft")) {
//获取焊接工艺
String craft = mapInfo.get(o.toString( )).toString();
if (!StringUtils.isEmpty(craft)) {
dto.setCraft(craft);
}
}
if (o.toString().equals("weldingId")) {
//设备id
Long eId = Long.valueOf(mapInfo.get(o.toString( )).toString());
if (eId != null) {
//获取设备
EquipmentDto equipmentDto = equipmentService.queryBySeq(eId);
if (!StringUtils.isEmpty(equipmentDto.getCode())) {
// 焊机编号
dto.setFacilityNumber(equipmentDto.getCode());
}
}
}
//耐压
if (o.toString().equals("pressureId")) {
Long pressureId = Long.valueOf(mapInfo.get(o.toString( )).toString());
if (pressureId !=null) {
EquipmentDto equipmentDto = equipmentService.queryBySeq(pressureId);
if (equipmentDto != null && !StringUtils.isEmpty(equipmentDto.getName()) &&!StringUtils.isEmpty(equipmentDto.getCode())) {
dto.setPressureName(equipmentDto.getName());
dto.setPressureCode(equipmentDto.getCode());
}
}
}
if (o.toString().equals("pressureTest")) {
String mpa = mapInfo.get(o.toString( )).toString();
if (!StringUtils.isEmpty(mpa)) {
dto.setMpa(mpa);
}
}
//埋深 埋深检测方式
if (o.toString().equals("depthType")) {
String depthType = mapInfo.get(o.toString( )).toString();
if (!StringUtils.isEmpty(depthType)) {
dto.setDetectionMethod(depthType);
}
}
}
if (o.toString().equals("depth")) {
String depth = mapInfo.get(o.toString( )).toString();
if (!StringUtils.isEmpty(depth)) {
dto.setBurialDepth(depth);
}
}
//位置标定
if (o.toString().equals("locationType")) {
String locationType = mapInfo.get(o.toString( )).toString();
if (!StringUtils.isEmpty(locationType)) {
dto.setPreciseWeldingPosition(locationType);
}
}
//判断标定检验结果 getResuts
}
dtoList.add(dto);
}
}
page.setRecords(dtoList);
......@@ -142,278 +306,457 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
return page ;
}
/** cpp
* 智能监检校验数据 人员 设备 管材
* @param dto
* @return
* 智能监检校验数据
* @param jsonObject
* @return String
*/
private static final String TYPE="智能检验";
public String checks(AcceptDto dto) {
if (dto == null) {
return "未上传数据,请上传";
//@BusinessIdentify
public String checks(JSONObject jsonObject) {
if (jsonObject == null || jsonObject.size() ==0) {
return VerifyEnum.未通过.getName();
}
//通过userid和projectId来对应
Long random = jsonObject.getLong("random");//随机值
Long projectId= jsonObject.getLong("projectId");//项目id
Long welderId = jsonObject.getLong("welderId"); //用户id
String location = jsonObject.getString("location");//焊接定位信息
String stage = jsonObject.getString("stage");//阶段检验
Date time = new Date();// //获取当前校验时间
String photo = jsonObject.getString("photo");//图片
Verify verify = new Verify( );
//获取公共属性信息
Long projectId = dto.getProjectId( );//项目id
String code = dto.getCode( );//焊口编号
String peopleLocation = dto.getPeopleLocation( );//焊接定位信息
String stage = dto.getStage( ); //阶段检验
//获取当前校验时间
Date time = new Date();
//属性赋值
String targetInfo = jsonObject.toString();
verify.setTargetInfo(targetInfo);//json信息
verify.setProjectId(projectId);//项目id
verify.setType(TYPE);//检验方式
verify.setVerifyTime(time);//获取当前时间
List<Verify> verifyList = verifyMapper.selectByWelder(projectId,welderId,null,null,random);/**这里json*/
//人员
if (stage.equals(StageEnum.焊前人员.getVerifyName())&&dto.getPeoplePhoto() !=null && !dto.getPeoplePhoto().equals("")) {
//获取焊接人员校验信息
String peoplePhoto = dto.getPeoplePhoto( ); //人脸识别图片信息
String userId = dto.getUserId( );//人员id
HashMap<String, String> map = new HashMap<>( );
map.put("peoplePhoto",peoplePhoto);
map.put("code",code);
map.put("peopleLocation",peopleLocation);
map.put("userId",userId);
String targetInfo= JSON.toJSONString(map, SerializerFeature.WriteMapNullValue); //焊口编号 人脸识别图片信息 焊接定位信息 人员id
verify.setSequenceNbr(new Date().getTime());
verify.setProjectId(projectId);
if (stage.equals(StageEnum.焊前人员.getVerifyName())) {
verify.setStage(StageEnum.焊前人员.getStage()); //阶段
verify.setType(TYPE);
verify.setTargetInfo(targetInfo);
verify.setVerifyTime(time);
//数据校验
Boolean falg =false; /**假设*/
if (!falg) {
/* //校验不通过,存入校验信息,
verify.setStatus(VerifyEnum.未通过.getStatus());
try {
int insert = verifyMapper.insert(verify);
} catch (Exception e) {
e.printStackTrace();
}
//将出现问题的哪一个阶段存入tz_ugp_quality_problem表中,返回失败
QualityProblem qualityProblem = new QualityProblem();
qualityProblem.setSequenceNbr(new Date().getTime());
qualityProblem.setProjectId(projectId);
//随机生成四位数
String s = String.valueOf((int) ((Math.random( ) * 9 + 1) * 1000));
qualityProblem.setCode(code+"-WT"+s);
qualityProblem.setGenerateStage(stage);
qualityProblem.setProblemDescribe(stage+"不通过");
qualityProblem.setStageVerifyId(verify.getSequenceNbr());
qualityProblemService.save(qualityProblem);
return VerifyEnum.未通过.getName();*/
this.addFailData(verify,new QualityProblem());
/**写死*/
Boolean flag =true;
//1.人脸识别校验
//2.焊工资质有效期判断,查询焊工信息获取
//失败
if (!flag) {
this.addFailData(verify,jsonObject,new QualityProblem());
return VerifyEnum.未通过.getName();
}
//成功
this.addSuccessData(verify,null,jsonObject);
}
//管材
if (stage.equals(StageEnum.焊前管材质量.getVerifyName())){
//校验通过
/*//这个是判断过后需要存的状态
verify.setStatus(VerifyEnum.已通过.getStatus());
try {
//智能监检管理表添加数据
int insert = verifyMapper.insert(verify);
} catch (Exception e) {
e.printStackTrace( );
//管材未校验,进行效验步骤
Long materialId = jsonObject.getLong("materialId");//管材id
verify.setStage(StageEnum.焊前管材质量.getStage());
/**校验*/
Boolean flag = true;
if (!flag) {
//不通过, 添加数据并返回未通过结果
this.addFailData(verify,jsonObject,new QualityProblem());
return VerifyEnum.未通过.getName();
}
//焊口表存更改状态
Weld weld = weldMapper.getWeldByCodeAndProjectId(code, projectId);
weld.setSuperInspecStatus(stage);
LambdaQueryWrapper<Weld> wrapper = new LambdaQueryWrapper<>( );
wrapper.eq(Weld::getCode ,weld.getCode());
weldMapper.update(weld,wrapper);*/
this.addSuccessData(verify);
//校验通过
this.addSuccessData(verify,null,jsonObject);
}
//设备
if (stage.equals(StageEnum.焊前设备.getVerifyName())&&dto.getFacilityPhoto() !=null && !dto.getFacilityPhoto().equals("")){
//获取校验设备信息
String facilityId = dto.getFacilityId( ); //设备id
String calibrationStatus = dto.getCalibrationStatus( );//检定状态
String facilityPhoto = dto.getFacilityPhoto( );//设备图片
HashMap<String, String> mapfacilty = new HashMap<>( );
mapfacilty.put("code",code);//焊口编号
mapfacilty.put("peopleLocation",peopleLocation);//焊接定位信息
mapfacilty.put("calibrationStatus",calibrationStatus);
mapfacilty.put("facilityPhoto",facilityPhoto);
mapfacilty.put("facilityId",facilityId);
String targetInfo= JSON.toJSONString(mapfacilty, SerializerFeature.WriteMapNullValue);
verify.setSequenceNbr(new Date().getTime());//主键
verify.setProjectId(projectId);
verify.setStage(StageEnum.焊前设备.getStage());
verify.setTargetInfo(targetInfo);
verify.setType(TYPE);
verify.setVerifyTime(time);
//数据校验
Boolean flag =false;
if (stage.equals(StageEnum.焊前设备.getVerifyName())){
verify.setStage(StageEnum.焊前设备.getStage());
/**
* 效验假数据
*/
Boolean flag =true ;
if (!flag) {
//校验不通过
this.addFailData(verify,new QualityProblem());
this.addFailData(verify,jsonObject,new QualityProblem());
return VerifyEnum.未通过.getName();
}
//效验通过
this.addSuccessData(verify);
this.addSuccessData(verify,null,jsonObject);
}
//工艺效验
if (stage.equals(StageEnum.焊接工艺.getVerifyName())){
//判断人员是否效验通过
List<Verify> welderList = verifyList.stream( ).filter(b -> b.getStage( ).equals(StageEnum.焊前人员.getStage( ))).collect(Collectors.toList( ));
//判断管材是否效验通过
List<Verify> materialList = verifyList.stream( ).filter(b -> b.getStage( ).equals(StageEnum.焊前管材质量.getStage( ))).collect(Collectors.toList( ));
//判断设备是否校验通过
List<Verify> facilityList = verifyList.stream( ).filter(b -> b.getStage( ).equals(StageEnum.焊前设备.getStage( ))).collect(Collectors.toList( ));
if (welderList ==null ||materialList ==null || facilityList ==null || welderList.size()==0 || materialList.size()==0 || facilityList.size()==0) {
return VerifyEnum.未通过.getName();
}
for (Verify v1 : welderList) {
if (v1.getStatus().equals(VerifyEnum.未通过.getStatus())) {
return VerifyEnum.未通过.getName();
}
}
for (Verify v2 : materialList) {
if (v2.getStatus().equals(VerifyEnum.未通过.getStatus())) {
return VerifyEnum.未通过.getName();
}
}
for (Verify v3 : facilityList) {
if (v3.getStatus().equals(VerifyEnum.未通过.getStatus())) {
return VerifyEnum.未通过.getName();
}
}
//判断这个工艺是否已经校验
//获取前端传的焊口编号(工艺阶段焊口编号必传)
/* String code = jsonObject.getString("code");//焊口编号
if (StringUtils.isEmpty(code)) {
return VerifyEnum.未通过.getName();
}
//通过项目id 用户id 焊口编号来确定工艺阶段
List<Verify> list= verifyMapper.selectByWelder(projectId, welderId, code,null);
List<Verify> collect = list.stream( ).filter(b -> b.getStage( ).equals(StageEnum.焊接工艺.getStage( ))).collect(Collectors.toList( ));
if (collect != null && collect.size()>0) {
for (Verify v1 : collect) {
if (v1 != null) {
if (v1.getStatus().equals(VerifyEnum.未通过.getStatus())) {
return VerifyEnum.未通过.getName();
}
if (v1.getStatus().equals(VerifyEnum.已通过.getStatus())) {
return VerifyEnum.已通过.getName();
}
}
}
}*/
//如果焊前效验已经通过进行效验步骤
verify.setStage(StageEnum.焊接工艺.getStage());
/**
* 效验假数据
*/
Boolean flag =true ;
if (!flag) {
//校验不通过
this.addFailData(verify,jsonObject,new QualityProblem());
return VerifyEnum.未通过.getName();
}
//效验通过
this.addSuccessData(verify,null,jsonObject);
}
//耐压
if (stage.equals(StageEnum.管道耐压.getVerifyName())){
//查询工艺是否校验通过(可能有好几个焊口码)
//获取前端传的焊口编号(工艺阶段焊口编号必传)
String manyCode = jsonObject.getString("manyCode");//获取多个焊口编号
String[] codeArray = manyCode.split(",");
//工艺的效验
for (String code : codeArray) {
List<Verify> verifyList1 = verifyMapper.selectByWelder(projectId, welderId, code,StageEnum.焊接工艺.getStage(),random);
for (Verify verify1 : verifyList1) {
//工艺阶段未效验
if (verify1 == null) {
return VerifyEnum.未通过.getName();
}
//工艺已校验
if (!StringUtils.isEmpty(verify1.getStatus())&&verify1.getStatus().equals(VerifyEnum.未通过.getStatus())) {
return VerifyEnum.未通过.getName();
}
}
}
//管道耐压是否已经校验,获取头部和尾部焊口,耐压之测头部和尾部
/* Verify v = verifyMapper.selectByCode(manyCode, projectId, StageEnum.管道耐压.getStage());
if (v !=null && v.getStatus().equals(VerifyEnum.未通过.getStatus())) {
return VerifyEnum.未通过.getName();
}
if (v !=null && v.getStatus().equals(VerifyEnum.已通过.getStatus())) {
return VerifyEnum.已通过.getName();
}*/
/* if (codeArray !=null && codeArray.length>=2) {
String startCode=codeArray[0] ;
String endCode = codeArray[codeArray.length-1];
List<Verify> startList = verifyMapper.selectByWelder(projectId, welderId, startCode,StageEnum.管道耐压.getStage());
List<Verify> endList = verifyMapper.selectByWelder(projectId, welderId, endCode,StageEnum.管道耐压.getStage());
if (startList !=null &&endList != null &&startList.size()>0 && endList.size()>0 ) {
for (Verify startVerity : startList) {
if (startVerity.getStatus().equals(VerifyEnum.未通过.getStatus())) {
return VerifyEnum.未通过.getName();
}
if (startVerity.getStatus().equals(VerifyEnum.已通过.getStatus())) {
return VerifyEnum.已通过.getName();
}
}
for (Verify endVerity : endList) {
if (endVerity.getStatus().equals(VerifyEnum.未通过.getStatus())) {
return VerifyEnum.未通过.getName();
}
if (endVerity.getStatus().equals(VerifyEnum.已通过.getStatus())) {
return VerifyEnum.已通过.getName();
}
}
}
}*/
//管材
if (stage.equals(StageEnum.焊前管材质量.getVerifyName())&&dto.getMaterialPhoto() !=null && !dto.getMaterialPhoto().equals("")){
String materialId = dto.getMaterialId( ); //管材id
String materialPhoto = dto.getMaterialPhoto( );//管材图片信息
HashMap<String, String> mapMaterial = new HashMap<>( );
mapMaterial.put("code",code);
mapMaterial.put("materialId",materialId);
mapMaterial.put("materialPhoto",materialPhoto);
mapMaterial.put("peopleLocation",peopleLocation);
String targetInfo= JSON.toJSONString(mapMaterial, SerializerFeature.WriteMapNullValue);
verify.setTargetInfo(targetInfo);
verify.setSequenceNbr(new Date().getTime());
verify.setStage(StageEnum.焊前管材质量.getStage());
verify.setType(TYPE);
verify.setVerifyTime(time);
verify.setProjectId(projectId);
//如果工艺效验已经通过进行耐压校验步骤,(特别注意,只需要效验头部和尾部耐压)
verify.setStage(StageEnum.管道耐压.getStage());
verify.setCode(manyCode);
/**
* 效验假数据
*/
Boolean flag =true ;
if (!flag) {
//校验不通过
jsonObject.put("code",manyCode);
this.addFailData(verify,jsonObject,new QualityProblem());
return VerifyEnum.未通过.getName();
}
//效验通过
this.addSuccessData(verify,codeArray,jsonObject);
}
//埋深
if (stage.equals(StageEnum.敷设质量.getVerifyName())){
//查询耐压是否校验通过
String manyCode = jsonObject.getString("manyCode");//获取多个焊口编号
Verify verify1 = verifyMapper.selectByCode(manyCode, projectId, StageEnum.管道耐压.getStage( ),random);
//耐压没有效验数据
if (verify1 == null) {
return VerifyEnum.未通过.getName();
}
//耐压有效验数据,但是不通过
if (verify1 != null && verify1.getStatus().equals(VerifyEnum.未通过.getStatus())) {
return VerifyEnum.未通过.getName();
}
//数据校验
//耐压校验已经通过,埋深是否已经校验
/*Verify v = verifyMapper.selectByCode(manyCode, projectId, StageEnum.敷设质量.getStage());
if (v != null) {
if (v.getStatus().equals(VerifyEnum.未通过.getStatus())) {
return VerifyEnum.未通过.getName();
}
if (v.getStatus().equals(VerifyEnum.已通过.getStatus())) {
return VerifyEnum.已通过.getName();
}
}*/
//耐压校验已经通过,进行埋深校验
verify.setStage(StageEnum.敷设质量.getStage());
verify.setCode(manyCode);
/**
* 效验假数据
*/
Boolean flag =true ;
MyPqr pqr = new MyPqr( );
pqr.setCombox_type("高于上转变温度进行焊后热处理(如正火)");
pqr.setMaterial_a_thickness("1.4");
pqr.setMaterial_b_thickness("5");
pqr.setIf_bend("lateral_bending");
if (!flag) {
//校验不通过
jsonObject.put("code",manyCode);
this.addFailData(verify,jsonObject,new QualityProblem());
return VerifyEnum.未通过.getName();
}
//效验通过
String []codeArray =manyCode.split(",");
this.addSuccessData(verify,codeArray,jsonObject);
}
//定位
if (stage.equals(StageEnum.定位.getVerifyName())){
//查询埋深是否校验通过
String manyCode = jsonObject.getString("manyCode");
Verify v1 = verifyMapper.selectByCode(manyCode, projectId, StageEnum.敷设质量.getStage( ),random);
//埋深没有效验数据
if (v1 == null) {
return VerifyEnum.未通过.getName();
}
//埋深有效验数据,但是不通过
if (v1 != null && v1.getStatus().equals(VerifyEnum.未通过.getStatus())) {
return VerifyEnum.未通过.getName();
}
/*//埋深校验已经通过,定位是否已经校验
Verify v = verifyMapper.selectByCode(manyCode, projectId, StageEnum.定位.getStage());
if (v != null) {
if (v.getStatus().equals(VerifyEnum.未通过.getStatus())) {
return VerifyEnum.未通过.getName();
}
if (v.getStatus().equals(VerifyEnum.已通过.getStatus())) {
return VerifyEnum.已通过.getName();
}
}*/
//耐压校验已经通过,没有埋深数据,进行埋深校验
verify.setStage(StageEnum.定位.getStage());
verify.setCode(manyCode);
/**
* 效验假数据
*/
Boolean flag =true ;
if (!flag) {
//校验不通过
jsonObject.put("code",manyCode);
QualityProblem qp = new QualityProblem( );
this.addFailData(verify,jsonObject,qp);
return VerifyEnum.未通过.getName();
}
//效验通过
String []codeArray =manyCode.split(",");
this.addSuccessData(verify,codeArray,jsonObject);
}
//回填
if (stage.equals(StageEnum.回填.getVerifyName())) {
String manyCode = jsonObject.getString("manyCode");
Verify v1 = verifyMapper.selectByCode(manyCode, projectId, StageEnum.定位.getStage( ),random);
//判断定位没有校验数据
if (v1 == null) {
return VerifyEnum.未通过.getName();
}
//定位有效验数据,但是不通过
if (v1 != null && v1.getStatus().equals(VerifyEnum.未通过.getStatus())) {
return VerifyEnum.未通过.getName();
}
/* //定位校验已经通过,回填是否已经校验
Verify v2 = verifyMapper.selectByCode(manyCode, projectId, StageEnum.回填.getStage());
if (v2 != null) {
if (v2.getStatus().equals(VerifyEnum.未通过.getStatus())) {
return VerifyEnum.未通过.getName();
}
if (v2.getStatus().equals(VerifyEnum.已通过.getStatus())) {
return VerifyEnum.已通过.getName();
}
}*/
//定位校验已经通过,没有回填数据,进行回填校验
verify.setStage(StageEnum.回填.getStage());
verify.setCode(manyCode);
/**
* 效验假数据
*/
Boolean flag =false ;
MyWps wps = new MyWps( );
wps.setMaterial_a_thickness("1.5");
wps.setMaterial_b_thickness("1.4");
HashMap<String, String> stringStringHashMap = new TestWeldingRules( ).droolsTest(pqr, wps);
Boolean flag =false;
if (!flag) {
//不通过, 添加数据并返回未通过结果
this.addFailData(verify,new QualityProblem());
//校验不通过
jsonObject.put("code",manyCode);
QualityProblem qualityProblem = new QualityProblem( );
this.addFailData(verify,jsonObject,qualityProblem);
return VerifyEnum.未通过.getName();
}
//效验通过
String []codeArray =manyCode.split(",");
this.addSuccessData(verify,codeArray,jsonObject);
//校验通过
this.addSuccessData(verify);
}
return VerifyEnum.已通过.getName();
}
/** cpp
* 校验失败需要添加的数据
* @param verify
* @param qualityProblem
*/
public void addFailData(Verify verify,QualityProblem qualityProblem){
public void addFailData(Verify verify,JSONObject jsonObject,QualityProblem qualityProblem){
//校验不通过,存入校验信息,
verify.setStatus(VerifyEnum.未通过.getStatus());
try {
//智能监检管理表添加数据
int insert = verifyMapper.insert(verify);
boolean save = this.save(verify);
} catch (Exception e) {
e.printStackTrace();
}
//
//质量问题表添加数据
qualityProblem.setSequenceNbr(new Date().getTime());
qualityProblem.setProjectId(verify.getProjectId());
qualityProblem.setSubmitDate(new Date());
//随机生成四位数
String s = String.valueOf((int) ((Math.random( ) * 9 + 1) * 1000));
String targetInfo = verify.getTargetInfo( );
Map map = JSON.parseObject(targetInfo, Map.class);
for (Object o:map.keySet()){
if (o.toString().equals("code")) {
String code = (String) map.get(o.toString( ));
qualityProblem.setCode(code+"-WT"+s);//获取焊口编码
}
String random = String.valueOf((int) ((Math.random( ) * 9 + 1) * 1000));
if (!StringUtils.isEmpty(jsonObject.getString("code"))) {
String code = jsonObject.getString("code");//获取焊口编码
qualityProblem.setCode(code+"-WT"+random);
}
qualityProblem.setGenerateStage(verify.getStage());
qualityProblem.setProblemDescribe(verify.getStage()+"不通过");
qualityProblem.setStageVerifyId(verify.getSequenceNbr());
String stage = jsonObject.getString("stage");//获取效验阶段
qualityProblem.setGenerateStage(stage);
qualityProblem.setProblemDescribe(stage+"不通过");
//获取智能监检表id
Verify verify1 = verifyMapper.selectByTargetInfo(verify.getTargetInfo( ));
Long sequenceNbr = verify1.getSequenceNbr( );
qualityProblem.setStageVerifyId(sequenceNbr);
qualityProblemService.save(qualityProblem);
}
/** cpp
* 校验成功需要添加的数据
* @param verify
* @param
*/
public void addSuccessData(Verify verify){
public void addSuccessData(Verify verify,String[] codeArray,JSONObject js){
//效验通过状态
verify.setStatus(VerifyEnum.已通过.getStatus());
try {
//智能监检管理表添加数据
int insert = verifyMapper.insert(verify);
this.save(verify);
} catch (Exception e) {
e.printStackTrace( );
}
//焊口表存更改状态
String targetInfo = verify.getTargetInfo( );
String code =null;
Map map = JSON.parseObject(targetInfo, Map.class);
for (Object o:map.keySet()){
if (o.toString().equals("code")) {
code=(String) map.get(o.toString( ));
//焊口表修改状态
if (codeArray ==null || codeArray.length==0) {
String targetInfo = verify.getTargetInfo( );
JSONObject jsonObject = JSONObject.parseObject(targetInfo);
String code = jsonObject.getString("code");//获取焊口编号
// 通过焊口码和项目id查询
if (!StringUtils.isEmpty(code)&& verify.getProjectId() !=null) {
Weld weld=weldMapper.getWeldByCodeAndProjectId(code, verify.getProjectId());
if (weld != null) {
//判断是哪一个阶段
String stage = verify.getStage( );
Map<String, String> mapEnum = StageEnum.getStageByNameMap;
//修改的值
String name = mapEnum.get(stage);
weld.setSuperInspecStatus(name);//更改监检状态
try {
//修改
int i = weldMapper.updateById(weld);
} catch (Exception e) {
e.printStackTrace( );
}
}
}
}
Weld weld = weldMapper.getWeldByCodeAndProjectId(code, verify.getProjectId());
if (weld != null) {
//判断是哪一个阶段
String stage = verify.getStage( );
Map<String, String> mapEnum = StageEnum.getNameByNameMap;
for (String s:mapEnum.keySet()){
if (stage.equals(s)) {
String name = mapEnum.get(s);//获取监检状态
weld.setSuperInspecStatus(name);
if (codeArray !=null && codeArray.length>0) {
for (String code : codeArray) {
if (!StringUtils.isEmpty(code)&& verify.getProjectId() !=null) {
Weld weld=weldMapper.getWeldByCodeAndProjectId(code, verify.getProjectId());
if (weld != null) {
//判断是哪一个阶段
String stage = verify.getStage( );
Map<String, String> mapEnum = StageEnum.getStageByNameMap;
//修改的值
String name = mapEnum.get(stage);
weld.setSuperInspecStatus(name);//更改监检状态
try {
//修改
int i = weldMapper.updateById(weld);
} catch (Exception e) {
e.printStackTrace( );
}
}
}
}
LambdaQueryWrapper<Weld> wrapper = new LambdaQueryWrapper<>( );
wrapper.eq(Weld::getCode ,weld.getCode()).
eq(Weld::getProjectId,weld.getProjectId());
weldMapper.update(weld,wrapper);
}
}
......@@ -421,392 +764,665 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
private String 效验状态 = "已存在";
private final String 问题编码="-WT";
/**
* 公共效验接口
*/
public String effect(JSONObject jsonObject,Integer 效验数量,Boolean i) {
// String 效验状态 = "已存在";
Verify verify = new Verify();
//添加筛选条件
LambdaQueryWrapper<Verify> wrapper = new LambdaQueryWrapper<>();
//获取target_info
JSONObject targetInfo = jsonObject.getJSONObject("target_info");
String code = targetInfo.getString("code");
//筛选出本焊口监检数
wrapper.eq(Verify::getCode, code);
//改焊口焊前数据
Integer verifyCount = verifyMapper.selectCount(wrapper);
if (verifyCount == 效验数量) {
wrapper.eq(Verify::getStatus, VerifyEnum.已通过.getStatus());
//该焊口焊前效验通过数据
Integer integer = verifyMapper.selectCount(wrapper);
//判断入库数量
if (integer == 效验数量) {
verify.setProjectId(jsonObject.getLong("projectId"));
verify.setCode(jsonObject.getString("code"));
verify.setTargetInfo(jsonObject.getString("target_info"));
verify.setSubmitTime(new Date());
verify.setVerifyTime(new Date());
verify.setType(VerifyTypeEnum.智能检验.getStatus());
//获取操作阶段
String stage = targetInfo.getString("stage");
verify.setStage(stage);
//获取效验接口
if (i) {
verify.setStatus(VerifyEnum.已通过.getStatus());
//添加筛选条件
LambdaQueryWrapper<Weld> wrapperWeld = new LambdaQueryWrapper<>();
wrapperWeld.eq(Weld::getCode, jsonObject.getString("code"));
Weld weld = weldMapper.selectOne(wrapperWeld);
weld.setSuperInspecStatus(stage);
weldService.updateById(weld);
效验状态 = "已通过";
this.save(verify);
} else {
int math= (int) ((Math.random() * 9 + 1)*1000);
verify.setStatus(VerifyEnum.未通过.getStatus());
this.save(verify);
LambdaQueryWrapper<Verify> wrapperVerify=new LambdaQueryWrapper<>();
wrapperVerify.eq(Verify::getCode,jsonObject.getString("code"));
wrapperVerify.eq(Verify::getStage,stage);
Verify verifyId = verifyMapper.selectOne(wrapperVerify);
QualityProblem qualityProblem = new QualityProblem();
//生成问题编码
qualityProblem.setStageVerifyId(verifyId.getSequenceNbr());
qualityProblem.setCode(jsonObject.getString("code")+问题编码+math);
qualityProblem.setProjectId(jsonObject.getLong("projectId"));
qualityProblem.setGenerateStage(stage);
qualityProblem.setSubmitDate(new Date());
qualityProblemService.save(qualityProblem);
效验状态 = "未通过";
效验状态 = "未通过";
}
}
}
return 效验状态;
}
/**
* 焊接工艺效验
*/
private final Integer 焊前效验数量 = 3;
public String weldEffect(JSONObject jsonObject) {
// Verify verify = new Verify();
// //添加筛选条件
// LambdaQueryWrapper<Verify> wrapper = new LambdaQueryWrapper<>();
// JSONObject targetInfo = jsonObject.getJSONObject("target_info");
// String code = targetInfo.getString("code");
// //筛选出本焊口监检数
// wrapper.eq(Verify::getCode, code);
// //改焊口焊前数据
// Integer verifyCount = verifyMapper.selectCount(wrapper);
// if (verifyCount == 焊前效验数量) {
// wrapper.eq(Verify::getStatus, VerifyEnum.已通过.getStatus());
// //该焊口焊前效验通过数据
// Integer integer = verifyMapper.selectCount(wrapper);
// //判断前三次已经入库
// if (integer == 焊前效验数量) {
// //获取效验接口
// Boolean i = false;
//
//
// verify.setProjectId(jsonObject.getLong("projectId"));
// verify.setCode(jsonObject.getString("code"));
// verify.setTargetInfo(jsonObject.getString("target_info"));
// verify.setSubmitTime(new Date());
// verify.setStage(StageEnum.焊接工艺.getStage());
// if (i) {
// verify.setStatus(VerifyEnum.已通过.getStatus());
// //添加筛选条件
// LambdaQueryWrapper<Weld> wrapperWeld = new LambdaQueryWrapper<>();
// wrapperWeld.eq(Weld::getCode, jsonObject.getString("code"));
// Weld weld = weldMapper.selectOne(wrapperWeld);
// weld.setSuperInspecStatus(StageEnum.焊接工艺.getStage());
//
// weldService.updateById(weld);
//
// 效验状态 = "已通过";
// this.save(verify);
// } else {
// int math= (int) (Math.random()*10000);
// verify.setStatus(VerifyEnum.未通过.getStatus());
// this.save(verify);
// LambdaQueryWrapper<Verify> wrapperVerify=new LambdaQueryWrapper<>();
// wrapperVerify.eq(Verify::getCode,jsonObject.getString("code"));
// wrapperVerify.eq(Verify::getStage,StageEnum.焊接工艺.getStage());
// Verify verifyId = verifyMapper.selectOne(wrapperVerify);
// QualityProblem qualityProblem = new QualityProblem();
// //生成问题编码
// qualityProblem.setStageVerifyId(verifyId.getSequenceNbr());
// qualityProblem.setCode(jsonObject.getString("code")+问题编码+math);
// qualityProblem.setProjectId(jsonObject.getLong("projectId"));
// qualityProblem.setGenerateStage(StageEnum.焊接工艺.getStage());
// qualityProblem.setSubmitDate(new Date());
// qualityProblemService.save(qualityProblem);
// 效验状态 = "未通过";
//
// }
//
// }
//
//
//
// }
//
return effect(jsonObject,焊前效验数量,true);
return effect(jsonObject,焊前效验数量,true);
}
/**
* 管道耐压效验
*/
private final Integer 管道耐压前效验数量 = 4;
public String materialEffect(JSONObject jsonObject){
// Verify verify = new Verify();
// //添加筛选条件
// LambdaQueryWrapper<Verify> wrapper = new LambdaQueryWrapper<>();
// //筛选出本焊口监检数
// wrapper.eq(Verify::getCode, jsonObject.getString("code"));
// //该焊口焊前数据
// Integer verifyCount = verifyMapper.selectCount(wrapper);
// if (verifyCount == 管道耐压前效验数量) {
// wrapper.eq(Verify::getStatus, VerifyEnum.已通过.getStatus());
// //该焊口焊前效验通过数据
// Integer integer = verifyMapper.selectCount(wrapper);
// //判断前四次已经入库
// if (integer == 管道耐压前效验数量) {
// //获取效验接口
// Boolean i = true;
//
//
// verify.setProjectId(jsonObject.getLong("projectId"));
// verify.setCode(jsonObject.getString("code"));
// verify.setTargetInfo(jsonObject.getString("target_info"));
// verify.setSubmitTime(new Date());
// verify.setStage(StageEnum.焊前管材质量.getStage());
// if (i) {
// verify.setStatus(VerifyEnum.已通过.getStatus());
// //添加筛选条件
// LambdaQueryWrapper<Weld> wrapperWeld = new LambdaQueryWrapper<>();
// wrapperWeld.eq(Weld::getCode, jsonObject.getString("code"));
// Weld weld = weldMapper.selectOne(wrapperWeld);
// weld.setSuperInspecStatus(StageEnum.焊前管材质量.getStage());
//
// weldService.updateById(weld);
//
// 效验状态 = "已通过";
// } else {
// int math= (int) (Math.random()*10000);
// verify.setStatus(VerifyEnum.未通过.getStatus());
// this.save(verify);
// LambdaQueryWrapper<Verify> wrapperVerify=new LambdaQueryWrapper<>();
// wrapperVerify.eq(Verify::getCode,jsonObject.getString("code"));
// wrapperVerify.eq(Verify::getStage,StageEnum.焊前管材质量.getStage());
// Verify verifyId = verifyMapper.selectOne(wrapperVerify);
// QualityProblem qualityProblem = new QualityProblem();
// //生成问题编码
// qualityProblem.setStageVerifyId(verifyId.getSequenceNbr());
// qualityProblem.setCode(jsonObject.getString("code")+问题编码+math);
// qualityProblem.setProjectId(jsonObject.getLong("projectId"));
// qualityProblem.setGenerateStage(StageEnum.焊前管材质量.getStage());
// qualityProblem.setSubmitDate(new Date());
// qualityProblemService.save(qualityProblem);
// 效验状态 = "未通过";
//
// }
//
// }
//
// save(verify);
//
// }
//
return effect(jsonObject,管道耐压前效验数量,true);
}
/**
* 敷设效验
*/
private final Integer 敷设效验数量 = 5;
public String layEffect(JSONObject jsonObject){
//
// Verify verify = new Verify();
// //添加筛选条件
// LambdaQueryWrapper<Verify> wrapper = new LambdaQueryWrapper<>();
// //筛选出本焊口监检数
// wrapper.eq(Verify::getCode, jsonObject.getString("code"));
// //该焊口焊前数据
// Integer verifyCount = verifyMapper.selectCount(wrapper);
// if (verifyCount == 管道耐压前效验数量) {
// wrapper.eq(Verify::getStatus, VerifyEnum.已通过.getStatus());
// //该焊口焊前效验通过数据
// Integer integer = verifyMapper.selectCount(wrapper);
// //判断前四次已经入库
// if (integer == 管道耐压前效验数量) {
// //获取效验接口
// Boolean i = true;
//
//
// verify.setProjectId(jsonObject.getLong("projectId"));
// verify.setCode(jsonObject.getString("code"));
// verify.setTargetInfo(jsonObject.getString("target_info"));
// verify.setSubmitTime(new Date());
// verify.setStage(StageEnum.敷设质量.getStage());
// if (i) {
// verify.setStatus(VerifyEnum.已通过.getStatus());
// //添加筛选条件
// LambdaQueryWrapper<Weld> wrapperWeld = new LambdaQueryWrapper<>();
// wrapperWeld.eq(Weld::getCode, jsonObject.getString("code"));
// Weld weld = weldMapper.selectOne(wrapperWeld);
// weld.setSuperInspecStatus(StageEnum.敷设质量.getStage());
//
// weldService.updateById(weld);
//
// 效验状态 = "已通过";
// } else {
// int math= (int) (Math.random()*10000);
// verify.setStatus(VerifyEnum.未通过.getStatus());
// this.save(verify);
// LambdaQueryWrapper<Verify> wrapperVerify=new LambdaQueryWrapper<>();
// wrapperVerify.eq(Verify::getCode,jsonObject.getString("code"));
// wrapperVerify.eq(Verify::getStage,StageEnum.敷设质量.getStage());
// Verify verifyId = verifyMapper.selectOne(wrapperVerify);
// QualityProblem qualityProblem = new QualityProblem();
// //生成问题编码
// qualityProblem.setStageVerifyId(verifyId.getSequenceNbr());
// qualityProblem.setCode(jsonObject.getString("code")+问题编码+math);
// qualityProblem.setProjectId(jsonObject.getLong("projectId"));
// qualityProblem.setGenerateStage(StageEnum.敷设质量.getStage());
// qualityProblem.setSubmitDate(new Date());
// qualityProblemService.save(qualityProblem);
// 效验状态 = "未通过";
//
// }
//
// }
//
// save(verify);
//
// }
return effect(jsonObject,敷设效验数量,false);
}
/**
* 定位效验
* 主键id查询
* @param sequenceNbr
* @return
*/
private final Integer 定位效验数量 = 6;
public String positionEffect(JSONObject jsonObject){
public OpenDto selectById(Long sequenceNbr){
Verify verify = verifyMapper.selectById(sequenceNbr);
OpenDto openDto = new OpenDto( );
if (verify !=null && !StringUtils.isEmpty( verify.getStatus())) {
String targetInfo= verify.getTargetInfo();
//获取照片
openDto.setNewPhoto("https://img2.baidu.com/it/u=806791452,2765805606&fm=253&fmt=auto&app=138&f=JPEG?w=350&h=500");
openDto.setOldPhoto("https://img2.baidu.com/it/u=1534411088,173440019&fm=253&app=138&size=w931&n=0&f=JPEG&fmt=auto?sec=1666976400&t=3e985017d01fe1c0cfe639335abc2fe8");
if (verify.getStatus().equals("0")) {
openDto.setResult(VerifyEnum.未通过.getName());
}
if (verify.getStatus().equals("1")) {
openDto.setResult(VerifyEnum.已通过.getName());
}
//符合性
openDto.setAccord("符合");
//有效性
openDto.setValid("有效");
}
// Verify verify = new Verify();
// //添加筛选条件
// LambdaQueryWrapper<Verify> wrapper = new LambdaQueryWrapper<>();
// //筛选出本焊口监检数
// wrapper.eq(Verify::getCode, jsonObject.getString("code"));
// //该焊口焊前数据
// Integer verifyCount = verifyMapper.selectCount(wrapper);
// if (verifyCount == 管道耐压前效验数量) {
// wrapper.eq(Verify::getStatus, VerifyEnum.已通过.getStatus());
// //该焊口焊前效验通过数据
// Integer integer = verifyMapper.selectCount(wrapper);
// //判断前四次已经入库
// if (integer == 管道耐压前效验数量) {
// //获取效验接口
// Boolean i = true;
//
//
// verify.setProjectId(jsonObject.getLong("projectId"));
// verify.setCode(jsonObject.getString("code"));
// verify.setTargetInfo(jsonObject.getString("target_info"));
// verify.setSubmitTime(new Date());
// verify.setStage(StageEnum.定位.getStage());
// if (i) {
// verify.setStatus(VerifyEnum.已通过.getStatus());
// //添加筛选条件
// LambdaQueryWrapper<Weld> wrapperWeld = new LambdaQueryWrapper<>();
// wrapperWeld.eq(Weld::getCode, jsonObject.getString("code"));
//
// Weld weld = weldMapper.selectOne(wrapperWeld);
// weld.setSuperInspecStatus(StageEnum.定位.getStage());
//
// weldService.updateById(weld);
//
// 效验状态 = "已通过";
// } else {
// int math= (int) (Math.random()*10000);
// verify.setStatus(VerifyEnum.未通过.getStatus());
// this.save(verify);
// LambdaQueryWrapper<Verify> wrapperVerify=new LambdaQueryWrapper<>();
// wrapperVerify.eq(Verify::getCode,jsonObject.getString("code"));
// wrapperVerify.eq(Verify::getStage,StageEnum.定位.getStage());
// Verify verifyId = verifyMapper.selectOne(wrapperVerify);
// QualityProblem qualityProblem = new QualityProblem();
// //生成问题编码
// qualityProblem.setStageVerifyId(verifyId.getSequenceNbr());
// qualityProblem.setCode(jsonObject.getString("code")+问题编码+math);
// qualityProblem.setProjectId(jsonObject.getLong("projectId"));
// qualityProblem.setGenerateStage(StageEnum.定位.getStage());
// qualityProblem.setSubmitDate(new Date());
// qualityProblemService.save(qualityProblem);
// 效验状态 = "未通过";
//
// }
//
// }
//
// save(verify);
//
// }
return effect(jsonObject,定位效验数量,true);
}
return openDto ;
}
/**
* 测试
* @param args
* 参数校验的公共方法
* @return
*/
public static void main(String[] args) {
private static final String CONFORM ="符合";
private static final String NOTCONFORM ="不符合";
public Boolean checkMehtod(JSONObject jsonObject) {
/**
* 初步的是工艺的效验方法
*/
//数据校验
MyPqr pqr = new MyPqr( );
pqr.setCombox_type("高于上转变温度进行焊后热处理(如正火)");
pqr.setMaterial_a_thickness("1.4");//厚度
pqr.setMaterial_b_thickness("5");//厚度
pqr.setIf_bend("lateral_bending"); //弯度
MyWps wps = new MyWps( );
// 初始化
Boolean flag = false;
HashMap<String, String> stringStringHashMap = null;
String stage = jsonObject.getString("stage");
if (!StringUtils.isEmpty(stage)) {
//数据
pqr.setMaterial_a_thickness(1.4);
pqr.setMaterial_b_thickness(5);
pqr.setIf_bend("lateral_bending");
wps.setMaterial_a_thickness(1.5);
wps.setMaterial_b_thickness(1.4);
}
stringStringHashMap = new WeldingQualification( ).equipmentWeldingQualification(pqr, wps);
MyWps wps = new MyWps( );
wps.setMaterial_a_thickness("1.5");
wps.setMaterial_b_thickness("1.4");
HashMap<String, String> stringStringHashMap = new TestWeldingRules( ).droolsTest(pqr, wps);
System.out.println(stringStringHashMap );
ArrayList<String> list = new ArrayList<>( );
for(String key:stringStringHashMap.keySet()){
String vaule = stringStringHashMap.get(key);
//如果不是空串
if (vaule !=null&&!vaule.equals("")) {
list.add(vaule);
}
}
// 获取不符合的
List<String> notconform = list.stream( ).filter(b -> b.equals(NOTCONFORM)).collect(Collectors.toList( ));
if (notconform ==null && notconform.size()==0) {
//没有不符合的,更改状态
flag =true;
}
return flag;
}
}
\ No newline at end of file
}
......@@ -80,14 +80,14 @@ class WeldServiceImpl extends BaseService<WeldDto, Weld, WeldMapper> implements
//获取登录人信息
OrgUsr orgUsr = orgService.getOrgUsr();
//获取登录人企业下的所有焊口
if (orgUsr.getOrgExpandAttr1() == 安装单位) {
if (orgUsr.getOrgExpandAttr1().equals(安装单位)) {
List<WeldDto> L = weldDtoPage.getRecords().stream().filter(b -> b.getInstallCompany().equals(orgUsr.getParentId())).collect(Collectors.toList());
weldDtoPage.setRecords(L);
}
//根据 所在地 筛选焊口
if (orgUsr.getOrgExpandAttr1() == 监察单位) {
if (orgUsr.getOrgExpandAttr1().equals(监察单位)) {
LambdaQueryWrapper<SuperviseRule> wrapper = new LambdaQueryWrapper<>();
LambdaQueryWrapper<SuperviseRule> eq = wrapper.eq(SuperviseRule::getSuperviseDeptId, orgUsr.getParentId());
......@@ -171,11 +171,15 @@ class WeldServiceImpl extends BaseService<WeldDto, Weld, WeldMapper> implements
}
/**
* 通过项目多个id获取数据
* 通过项目id获取数据
* @param projectId
* @return
*/
public List<WeldDto> getProjectId(Long projectId){
return weldMapper.select(projectId);
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment