Commit 7fcae706 authored by 曹盼盼's avatar 曹盼盼

修改

parent abf8023f
package com.yeejoin.amos.boot.module.ugp.api.Enum;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum CheckEnum {
符合("accord","符合"),
不符合("accord","不符合"),
有效("valid","有效"),
已过期("valid","已过期"),
合格期内("peopleStatus","合格期内"),
超期未检("peopleStatus","超期未检");
String key;
String name;
}
......@@ -15,9 +15,9 @@ import java.util.Map;
@AllArgsConstructor
public enum StageEnum {
焊前人员("","STAFF","人员"),
焊前人员("焊前确定","STAFF","人员"),
焊前设备("焊前确定","EQUIPMENT","设备"),
焊前管材质量("","BEFORE-WELDING","管材"),
焊前管材质量("焊前确定","BEFORE-WELDING","管材"),
焊接工艺("工艺确定","CRAFT","工艺"),
管道耐压("耐压确定","VOLTAGE","耐压"),
敷设质量("敷设确定","LAY","敷设"),
......@@ -26,7 +26,6 @@ public enum StageEnum {
private String name;
private String stage;
private String verifyName;
......
......@@ -15,6 +15,6 @@ public class OpenDto {
private String accord; //符合性
private String valid; //有效性
private String result;//结果
private Long detailId;//跳转id
private String detailId;//跳转id 或者管材编码
}
......@@ -112,5 +112,5 @@ public class SmartListDto extends BaseDto {
private Long welderId;
private Long weldingId;
private Long materialId;
private String materialCode;
}
......@@ -77,9 +77,15 @@
<select id="selectByWelder" resultType="com.yeejoin.amos.boot.module.ugp.api.entity.Verify">
SELECT * FROM tz_ugp_verify where
SELECT * FROM tz_ugp_verify
<where>
<if test="projectId !=null and projectId !=''">
project_id =#{projectId}
and target_info -> "$.welderId" = #{welderId}
</if>
<if test="welderId !=null and welderId !=''">
and
target_info -> "$.welderId" = #{welderId}
</if>
<if test="code !=null and code !=''">
and
target_info -> "$.code" =#{code}
......@@ -91,6 +97,7 @@
and
target_info -> "$.random" =#{random}
</if>
</where>
</select>
......
......@@ -230,4 +230,6 @@ public class MaterialController extends BaseController {
attachmentMapper.deleteBySourceId(sequenceNbr);
return ResponseHelper.buildResponse(materialServiceImpl.removeById(sequenceNbr));
}
}
......@@ -295,8 +295,18 @@ public class VerifyController extends BaseController {
page.setRecords(verifyServiceImpl.selectById(sequenceNbr));
return ResponseHelper.buildResponse(page);
}
/**
* cpp
* 耐压所属焊口查看
* @param
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/lookWeld")
@ApiOperation(httpMethod = "GET", value = "耐压所属焊口查看", notes = "耐压所属焊口查看")
public ResponseModel<JSONObject> lookWeld(@RequestParam Long sequenceNbr) {
return ResponseHelper.buildResponse(verifyServiceImpl.getWeldLook(sequenceNbr));
}
}
......
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.common.api.dto.OrgUsrFormDto;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.boot.module.ugp.api.Enum.StageEnum;
import com.yeejoin.amos.boot.module.ugp.api.dto.PercentOfPassDto;
import com.yeejoin.amos.boot.module.ugp.api.dto.WeldDto;
import com.yeejoin.amos.boot.module.ugp.api.entity.Project;
......@@ -27,6 +28,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* @Author cpp
......@@ -100,7 +102,6 @@ public class InstallationQualityImpl extends BaseService<PercentOfPassDto, Quali
for (PercentOfPassDto pr : list) {
//获取项目id
Long projectId = pr.getProjectId ( );
//通过项目id查询焊口数据
List<WeldDto> weldDtoList = weldService.getProjectId (projectId);
......@@ -108,24 +109,16 @@ public class InstallationQualityImpl extends BaseService<PercentOfPassDto, Quali
//获取焊口信息总条数
int sum = weldDtoList.size ( );
//焊口合格数
int qualifiedData = 0;
for (WeldDto weldDto : weldDtoList) {
String superInspecStatus = weldDto.getSuperInspecStatus ( );
if (superInspecStatus.equals ("合格")) {
qualifiedData++;
}
}
List<WeldDto> collect = weldDtoList.stream( ).filter(weld -> StageEnum.焊接工艺.getName( ).equals(weld.getSuperInspecStatus( ))).collect(Collectors.toList( ));
int qualifiedData = collect.size();
//合格率
BigDecimal sums = new BigDecimal (sum);
BigDecimal qualifiedDatas = new BigDecimal (qualifiedData);
Double pass = qualifiedDatas.divide (sums, 2, BigDecimal.ROUND_HALF_UP).multiply (new BigDecimal (100)).doubleValue ( );
//转换成百分比,生成合格率
String fpy = pass.toString ( ) + "%";
//将合格率赋值给数据集合
pr.setPercentOfPass (fpy);
//将数据添加到新集合里面
newsData.add (pr);
......
package com.yeejoin.amos.boot.module.ugp.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.ugp.api.Enum.ImageEnum;
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.constants.XJConstant;
import com.yeejoin.amos.boot.module.ugp.api.Enum.*;
import com.yeejoin.amos.boot.module.ugp.api.dto.*;
import com.yeejoin.amos.boot.module.ugp.api.entity.*;
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;
......@@ -32,6 +17,7 @@ import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.ValidationUtils;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
......@@ -50,8 +36,10 @@ import java.text.SimpleDateFormat;
import java.util.*;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
import static org.springframework.data.elasticsearch.annotations.DateFormat.year;
/**
......@@ -129,10 +117,9 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
* stage 阶段
* page 分页
*/
private static final String HEGE ="合格期内";
private static final String NOTHEGE ="超期未检";
public Page<SmartListDto> commonality(String stage,Page<SmartListDto> page,SmartListDto smartListDto){
public Page<SmartListDto> commonality(String stage, Page<SmartListDto> page, SmartListDto smartListDto){
//新加获取项目列表
List<Project> projectList = projectResourceService.getProjectList( );
List<Long> listId = new ArrayList<>( );
......@@ -143,7 +130,6 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
if (listId != null && listId.size()>0) {
verifyList = verifyMapper.commonality(stage,smartListDto,listId);
}
List<SmartListDto> dtoList =new ArrayList<>();
//进入焊前
if (verifyList !=null && verifyList.size() !=0){
......@@ -153,17 +139,6 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
dto.setProjectId(verify.getProjectId()); //项目id
dto.setName(verify.getProject().getName());//项目名称
dto.setProjectCode(verify.getProject().getCode());//项目编号
//检验检测单位id 检验负责人id 监检员id(后续需修改)
Long verifyUnitId = verify.getVerifyUnitId( );
Long chargerPersonId = verify.getChargerPersonId( );
Long inspectorId = verify.getInspectorId( );
if (inspectorId != null && chargerPersonId !=null && verifyUnitId!=null) {
dto.setCompanyName("检测单位");
dto.setUsrName("检验负责人");
dto.setInspector("监检员");
}
//检验状态
String status = verify.getStatus( );
if (status.equals(VerifyEnum.已通过.getStatus())) {
......@@ -173,13 +148,14 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
dto.setStatus(VerifyEnum.未通过.getName());
}
dto.setType(verify.getType());//检验方式
Date verifyTime = verify.getVerifyTime( );
dto.setSubmitTime(verify.getVerifyTime());//交检日期
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());//将阶段赋值
dto.setStage(String.valueOf(map.get(key)));//将阶段赋值
}
}
String targetInfo = verify.getTargetInfo();//app上传数据
......@@ -196,7 +172,6 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
if (!StringUtils.isEmpty(location)) {
dto.setPeopleLocation(location);
}
Long welderId = jsonObject.getLong("welderId");
if (welderId!=null) {
dto.setWelderId(welderId);
......@@ -210,24 +185,13 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
}
}
}
//人员持证判断
//人员持证判断 设备检定状态 管材质量许可
String peopleStatus = jsonObject.getString("peopleStatus");
if (!StringUtils.isEmpty(peopleStatus)) {
dto.setPeopleStatus(peopleStatus);
dto.setFacilityStatus(peopleStatus);
dto.setPermission(peopleStatus);
}
//设备检定状态
String facilityStatus = jsonObject.getString("peopleStatus");
if (!StringUtils.isEmpty(facilityStatus)) {
dto.setFacilityStatus(facilityStatus);
}
//焊接工艺时长
String duration = jsonObject.getString("peopleStatus");
if (!StringUtils.isEmpty(duration)) {
dto.setFacilityStatus(duration);
}
Long weldingId = jsonObject.getLong("weldingId");
if (weldingId !=null) {
dto.setWeldingId(weldingId);
......@@ -238,27 +202,26 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
dto.setFacilityNumber(equipmentDto.getCode());
}
}
Long materialId = jsonObject.getLong("materialId");
if (materialId!=null) {
dto.setMaterialId(materialId);
MaterialDto materialDto = materialService.queryBySeq(materialId);
if (materialDto != null) {
//管材厂家 生产编号
dto.setManufacturer(materialDto.getManufacturer());
dto.setBatchNumber(materialDto.getBatchNum());
}
String materiaCode = jsonObject.getString("materialId");
if (!ValidationUtil.isEmpty(materiaCode)) {
//管材编号
dto.setMaterialCode(materiaCode);
Material material = materialService.getMaterial(materiaCode);
if (material != null) {
//管材厂家 管材批号
dto.setManufacturer(material.getManufacturer());
dto.setBatchNumber(material.getCode());
}
String permission = jsonObject.getString("permission");
if (!StringUtils.isEmpty(permission)) {
dto.setPermission(permission);
}
//工艺
String craft = jsonObject.getString("craft");
if (!StringUtils.isEmpty(craft)) {
dto.setCraft(craft);
}
String duration = jsonObject.getString("duration");
if (!StringUtils.isEmpty(duration)) {
dto.setDuration(duration);
}
//耐压
Long pressureId = jsonObject.getLong("pressureId");
if (pressureId != null) {
......@@ -272,6 +235,10 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
if (!StringUtils.isEmpty(pressureTest)) {
dto.setMpa(pressureTest);
}
String pressureNumber = jsonObject.getString("pressureNumber");
if (!ValidationUtil.isEmpty(pressureNumber)) {
dto.setPressureNumber(pressureNumber);
}
//埋深
String depthType = jsonObject.getString("depthType");
if (!StringUtils.isEmpty(depthType)) {
......@@ -290,17 +257,7 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
if (!StringUtils.isEmpty(resuts)) {
dto.setResuts(resuts);
}
//这些后面只需要删除即可
dto.setPeopleStatus("合格期内");
dto.setFacilityStatus("合格期内");
dto.setDuration("6");
dto.setPressureNumber("1xm001");
dto.setResuts("合格");
dtoList.add(dto);
}
}
page.setRecords(dtoList);
......@@ -309,8 +266,6 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
return page ;
}
/** cpp
* 智能监检校验数据
* @param jsonObject
......@@ -337,10 +292,9 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
verify.setProjectId(projectId);//项目id
verify.setType(TYPE);//检验方式
verify.setVerifyTime(time);//获取当前时间
List<Verify> verifyList = verifyMapper.selectByWelder(projectId,welderId,null,null,random);/**这里json*/
List<Verify> verifyList = verifyMapper.selectByWelder(projectId,welderId,null,null,random);
//人员
if (stage.equals(StageEnum.焊前人员.getVerifyName())) {
verify.setStage(StageEnum.焊前人员.getStage()); //阶段
//人脸
//1.人脸识别校验
......@@ -348,12 +302,13 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
//3.证书是否和项目符合
//失败
//属性赋值
jsonObject.put("accord","符合");
jsonObject.put(CheckEnum.符合.getKey(),CheckEnum.符合.getName());//人脸
if (welderId != null) {
Map map = orgService.getdetialInfo(welderId.toString( ));
String certValidDate = String.valueOf(map.get("certValidDate"));
if (!ValidationUtil.isEmpty(certValidDate)) {
if (certValidDate!=null && !certValidDate.equals("")) {
Date vaildParse =null;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
......@@ -361,27 +316,24 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
} catch (ParseException e) {
e.printStackTrace( );
}
if (time.compareTo(vaildParse) <=0) {
jsonObject.put("valid","有效");
jsonObject.put(CheckEnum.有效.getKey(),CheckEnum.有效.getName());
jsonObject.put(CheckEnum.合格期内.getKey(),CheckEnum.合格期内.getName());
}else {
jsonObject.put("valid","已过期");
jsonObject.put(CheckEnum.已过期.getKey(),CheckEnum.已过期.getName());
jsonObject.put(CheckEnum.超期未检.getKey(),CheckEnum.超期未检.getName());
}
}
}
Boolean flag =true;
if (!"符合".equals(jsonObject.getString("accord")) || !"有效".equals(jsonObject.getString("valid"))) {
if (!CheckEnum.符合.getName().equals(jsonObject.getString(CheckEnum.符合.getKey())) ||
!CheckEnum.有效.getName().equals(jsonObject.getString(CheckEnum.有效.getKey()))) {
flag =false;
}
jsonObject.put("peopleStatus","合格");
String targetInfo = jsonObject.toString();
verify.setTargetInfo(targetInfo);//json信息
if (!flag) {
jsonObject.put("peopleStatus","不合格");
this.addFailData(verify,jsonObject,new QualityProblem(),null);
this.addFailData(verify,jsonObject,new QualityProblem());
return VerifyEnum.未通过.getName();
}
//成功
......@@ -389,67 +341,53 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
}
//管材
if (stage.equals(StageEnum.焊前管材质量.getVerifyName())){
//从图片中获取管材编号materialId
//管材未校验,进行效验步骤
// Long materialId = jsonObject.getLong("materialId");//管材id
//从图片中获取管材编号
String materialCode = jsonObject.getString("materialId");
//管材编号(暂时写死)
String materialCode = "1585520415743176365";
verify.setStage(StageEnum.焊前管材质量.getStage());
/**校验*/
Boolean flag =false;
if (!ValidationUtil.isEmpty(materialCode)) {
Material material = materialService.getMaterial(materialCode);
if (!ValidationUtil.isEmpty(material)) {
jsonObject.put("valid","有效");
jsonObject.put("accord","符合");
if (StringUtils.isNotEmpty(material.getManufacturer())) {
jsonObject.put(CheckEnum.有效.getKey(),CheckEnum.有效.getName());
jsonObject.put(CheckEnum.符合.getKey(),CheckEnum.符合.getName());
if (!ValidationUtil.isEmpty(material.getManufacturer())) {
jsonObject.put("manufacturer",material.getManufacturer());
}
if (StringUtils.isNotEmpty(material.getBatchNum())) {
if (!ValidationUtil.isEmpty(material.getBatchNum())) {
jsonObject.put("batchNumber",material.getBatchNum());
}
jsonObject.put("permission","合格期内");
jsonObject.put(CheckEnum.合格期内.getKey(),CheckEnum.合格期内.getName());
flag = true;
}else {
jsonObject.put("valid","已超期");
jsonObject.put("accord","不符合");
jsonObject.put("permission","不合格");
jsonObject.put(CheckEnum.已过期.getKey(),CheckEnum.已过期.getName());
jsonObject.put(CheckEnum.不符合.getKey(),CheckEnum.不符合.getName());
jsonObject.put(CheckEnum.超期未检.getKey(),CheckEnum.超期未检.getName());
}
}
String targetInfo = jsonObject.toString();
verify.setTargetInfo(targetInfo);//json信息
verify.setTargetInfo(targetInfo);
if (!flag) {
//不通过, 添加数据并返回未通过结果
this.addFailData(verify,jsonObject,new QualityProblem(),null);
this.addFailData(verify,jsonObject,new QualityProblem());
return VerifyEnum.未通过.getName();
}
//校验通过
this.addSuccessData(verify,null,jsonObject);
}
//设备
if (stage.equals(StageEnum.焊前设备.getVerifyName())){
verify.setStage(StageEnum.焊前设备.getStage());
Long weldingId = jsonObject.getLong("weldingId");
/**
* 效验假数据
*/
Boolean flag =false ;
//后面需要修改此处
if (!ValidationUtil.isEmpty(weldingId)) {
Equipment equipment = equipmentService.getEquipment(weldingId);
if (!ValidationUtil.isEmpty(equipment)) {
jsonObject.put("valid","有效");
jsonObject.put("accord","符合");
jsonObject.put("facilityStatus","合格期内");
jsonObject.put(CheckEnum.有效.getKey(),CheckEnum.有效.getName());
jsonObject.put(CheckEnum.符合.getKey(),CheckEnum.符合.getName());
jsonObject.put(CheckEnum.合格期内.getKey(),CheckEnum.合格期内.getName());
if (StringUtils.isNotEmpty(equipment.getName())) {
jsonObject.put("facilityName",equipment.getName());
......@@ -460,17 +398,16 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
flag=true;
}else{
jsonObject.put("valid","已超期");
jsonObject.put("accord","不符合");
jsonObject.put("facilityStatus","不合格");
jsonObject.put(CheckEnum.已过期.getKey(),CheckEnum.已过期.getName());
jsonObject.put(CheckEnum.不符合.getKey(),CheckEnum.不符合.getName());
jsonObject.put(CheckEnum.超期未检.getKey(),CheckEnum.超期未检.getName());
}
}
String targetInfo = jsonObject.toString();
verify.setTargetInfo(targetInfo);//json信息
if (!flag) {
//校验不通过
this.addFailData(verify,jsonObject,new QualityProblem(),null);
this.addFailData(verify,jsonObject,new QualityProblem());
return VerifyEnum.未通过.getName();
}
//效验通过
......@@ -507,41 +444,21 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
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();
}
}
}
}*/
//如果焊前效验已经通过进行效验步骤
Boolean flag =false;
verify.setStage(StageEnum.焊接工艺.getStage());
String result = jsonObject.getString("result");
if (VerifyEnum.已通过.getName().equals(result)) {
if ("ok".equals(result)) {
flag =true;
}
jsonObject.put("duration","前端传的时长");
jsonObject.put("facilityNumber","前端传的焊机编号");
jsonObject.put("duration","时长");
jsonObject.put("facilityNumber","焊机编号");
String targetInfo = jsonObject.toString();
verify.setTargetInfo(targetInfo);//json信息
verify.setCode(code);
if (!flag) {
//校验不通过
this.addFailData(verify,jsonObject,new QualityProblem(),null);
this.addFailData(verify,jsonObject,new QualityProblem());
return VerifyEnum.未通过.getName();
}
//效验通过
......@@ -570,42 +487,6 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
}
}
}
//管道耐压是否已经校验,获取头部和尾部焊口,耐压之测头部和尾部
/* 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();
}
}
}
}*/
//如果工艺效验已经通过进行耐压校验步骤,(特别注意,只需要效验头部和尾部耐压)
verify.setStage(StageEnum.管道耐压.getStage());
verify.setCode(manyCode);
......@@ -613,11 +494,19 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
* 效验假数据
*/
Boolean flag =true ;
Calendar calendar = Calendar.getInstance();
String year = String.valueOf(calendar.get(Calendar.YEAR));
int month = calendar.get(Calendar.MONTH) + 1;
int day = calendar.get(Calendar.DATE);
StringBuffer stringBuffer = new StringBuffer( );
stringBuffer.append(year).append(month).append(day).append("-")
.append(UUID.randomUUID().toString().substring(UUID.randomUUID().toString().length()-4));
jsonObject.put("pressureNumber",stringBuffer.toString());
String targetInfo = jsonObject.toString();
verify.setTargetInfo(targetInfo);//json信息
if (!flag) {
//校验不通过
this.addFailData(verify,jsonObject,new QualityProblem(),codeArray);
this.addFailData(verify,jsonObject,new QualityProblem());
return VerifyEnum.未通过.getName();
}
//效验通过
......@@ -625,7 +514,6 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
}
//埋深
if (stage.equals(StageEnum.敷设质量.getVerifyName())){
//查询耐压是否校验通过
String manyCode = jsonObject.getString("manyCode");//获取多个焊口编号
if (StringUtils.isEmpty(manyCode)) {
......@@ -640,17 +528,6 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
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);
......@@ -658,14 +535,12 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
* 效验假数据
*/
Boolean flag =true ;
jsonObject.put("facilityName","前端传的焊机名称");
String targetInfo = jsonObject.toString();
verify.setTargetInfo(targetInfo);//json信息
if (!flag) {
//校验不通过
String[] codeArray = manyCode.split(",");
this.addFailData(verify,jsonObject,new QualityProblem(),codeArray);
this.addFailData(verify,jsonObject,new QualityProblem());
return VerifyEnum.未通过.getName();
}
//效验通过
......@@ -688,16 +563,6 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
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);
......@@ -712,7 +577,7 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
//校验不通过
QualityProblem qp = new QualityProblem( );
String[] codeArray = manyCode.split(",");
this.addFailData(verify,jsonObject,qp,codeArray);
this.addFailData(verify,jsonObject,qp);
return VerifyEnum.未通过.getName();
}
//效验通过
......@@ -734,16 +599,6 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
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);
......@@ -756,8 +611,7 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
if (!flag) {
//校验不通过
QualityProblem qualityProblem = new QualityProblem( );
String[] codeArray = manyCode.split(",");
this.addFailData(verify,jsonObject,qualityProblem,codeArray);
this.addFailData(verify,jsonObject,qualityProblem);
return VerifyEnum.未通过.getName();
}
//效验通过
......@@ -769,51 +623,40 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
return VerifyEnum.已通过.getName();
}
/** cpp
* 校验失败需要添加的数据
* @param verify
* @param qualityProblem
*/
public void addFailData(Verify verify,JSONObject jsonObject,QualityProblem qualityProblem,String[] codeArray){
// 静态变量存储最大值
private static final AtomicInteger atomicNum = new AtomicInteger(1);
public void addFailData(Verify verify,JSONObject jsonObject,QualityProblem qualityProblem){
//校验不通过,存入校验信息,
verify.setStatus(VerifyEnum.未通过.getStatus());
try {
//智能监检管理表添加数据
boolean save = this.save(verify);
} catch (Exception e) {
e.printStackTrace();
}
//质量问题表添加数据
qualityProblem.setProjectId(verify.getProjectId());
qualityProblem.setSubmitDate(new Date());
//随机生成四位数
String random = String.valueOf((int) ((Math.random( ) * 9 + 1) * 1000));
if (codeArray ==null || codeArray.length==0) {
String code = jsonObject.getString("code");//获取焊口编码
if (StringUtils.isNotEmpty(code)) {
//焊前
qualityProblem.setCode(code+"-WT"+random);
}else {
qualityProblem.setCode(jsonObject.getLong("random")+"-WT"+random);
}
}
if (codeArray != null && codeArray.length>0) {
for (String code : codeArray) {
if (!StringUtils.isEmpty(jsonObject.getString(code))) {
qualityProblem.setCode(code+"-WT"+random);
}
}
}
Calendar calendar = Calendar.getInstance();
// 获取当前年
int year = calendar.get(Calendar.YEAR);
// 获取当前月
int month = calendar.get(Calendar.MONTH) + 1;
// 获取当前日
int day = calendar.get(Calendar.DATE);
StringBuffer stringBuffer = new StringBuffer( );
stringBuffer.append(year).append(month).append(day);
String date = stringBuffer.toString( );
//获取当前的值并自增
int newNum = atomicNum.incrementAndGet( );
String code =String.format(date+"-WT-"+"%05d", newNum);
qualityProblem.setCode(code);
String stage = jsonObject.getString("stage");//获取效验阶段
qualityProblem.setGenerateStage(stage);
qualityProblem.setProblemDescribe(stage+"不通过");
......@@ -824,10 +667,6 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
qualityProblemService.save(qualityProblem);
problemInitiationService.start(qualityProblem);
}
/** cpp
* 校验成功需要添加的数据
* @param verify
......@@ -836,9 +675,7 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
public void addSuccessData(Verify verify,String[] codeArray,JSONObject js){
//效验通过状态
verify.setStatus(VerifyEnum.已通过.getStatus());
try {
//智能监检管理表添加数据
this.save(verify);
} catch (Exception e) {
......@@ -871,7 +708,7 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
}
if (codeArray !=null && codeArray.length>0) {
for (String code : codeArray) {
if (!StringUtils.isEmpty(code)&& verify.getProjectId() !=null) {
if (!ValidationUtil.isEmpty(code)&& verify.getProjectId() !=null) {
Weld weld=weldMapper.getWeldByCodeAndProjectId(code, verify.getProjectId());
if (weld != null) {
//判断是哪一个阶段
......@@ -880,20 +717,13 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
//修改的值
String name = mapEnum.get(stage);
weld.setSuperInspecStatus(name);//更改监检状态
try {
//修改
int i = weldMapper.updateById(weld);
} catch (Exception e) {
e.printStackTrace( );
}
weldMapper.updateById(weld);
}
}
}
}
}
/**
* 弹窗
* @param sequenceNbr
......@@ -911,11 +741,10 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
if (!StringUtils.isEmpty(newPhoto)) {
openDto.setNewPhoto(newPhoto);
}
if (verify.getStatus().equals("0")) {
if (VerifyEnum.未通过.getStatus().equals(verify.getStatus())) {
openDto.setResult(VerifyEnum.未通过.getName());
}
if (verify.getStatus().equals("1")) {
if (VerifyEnum.已通过.getStatus().equals(verify.getStatus())) {
openDto.setResult(VerifyEnum.已通过.getName());
}
//有效性
......@@ -931,9 +760,8 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
if (StageEnum.焊前人员.getStage().equals(verify.getStage())) {
Long welderId = object.getLong("welderId");
if (welderId != null) {
openDto.setDetailId(welderId);
openDto.setDetailId(String.valueOf(welderId));
//焊工的老照片
Map map = orgService.getdetialInfo(welderId.toString( ));
if (!ValidationUtil.isEmpty(map)) {
String image =String.valueOf(map.get("image")) ;
......@@ -957,41 +785,40 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
if (StageEnum.焊前设备.getStage().equals(verify.getStage())) {
Long weldingId = object.getLong("weldingId");
if (weldingId != null) {
openDto.setDetailId(weldingId);
openDto.setDetailId(String.valueOf(weldingId));
String image = this.getImage(weldingId);
if (StringUtils.isNotEmpty(image)) {
if (!ValidationUtil.isEmpty(image)) {
openDto.setOldPhoto(image);
}
}
}
if (StageEnum.焊前管材质量.getStage().equals(verify.getStage())) {
Long materialId = object.getLong("materialId");
if (materialId != null) {
openDto.setDetailId(materialId);
String image = this.getImage(materialId);
if (StringUtils.isNotEmpty(image)) {
// 改为管材编号materialId
String materialCode = object.getString("materialId");
if (!ValidationUtil.isEmpty(materialCode)) {
openDto.setDetailId(materialCode);//管材的编号
Material material = materialService.getMaterial(materialCode);
if (!ValidationUtil.isEmpty(material)) {
Long sequenceNbr1 = material.getSequenceNbr( );//管材id
if (!ValidationUtil.isEmpty(sequenceNbr1)) {
String image = this.getImage(sequenceNbr1);
if (!ValidationUtil.isEmpty(image)) {
openDto.setOldPhoto(image);
}
}
}
}
}
}
ArrayList<OpenDto> list = new ArrayList<>( );
list.add(openDto);
return list ;
}
// 图片公共方法
public String getImage(Long id){
String oldPhoto =null;
if (id != null) {
AttachmentDto enuipment = attachmentService.getAttachment(id);
if (enuipment != null) {
String info = enuipment.getInfo( );
if (StringUtils.isNotEmpty(info)) {
......@@ -1004,7 +831,6 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
JSONObject object2 = JSONObject.parseObject(o1.toString( ));
oldPhoto= object2.getString("url");
if (StringUtils.isNotEmpty(oldPhoto)) {
String[] split = oldPhoto.split(".");
//不区分大小写.jpe .JPE,需要转换成小写写
String suffix = split[split.length - 1].toLowerCase( );
......@@ -1012,7 +838,6 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
suffix.contains(ImageEnum.JPG.getName()) || suffix.contains(ImageEnum.JPEG.getName()) ||
suffix.contains(ImageEnum.BMP.getName()) || suffix.contains(ImageEnum.PSD.getName())) {
return oldPhoto;
}
}
}
......@@ -1023,11 +848,77 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
return oldPhoto;
}
private static final String HEGE ="合格";
private static final String NOTHEGE ="不合格";
//耐压所属焊口查看
public JSONObject getWeldLook(Long sequenceNbr){
JSONObject object = new JSONObject( );
if (sequenceNbr != null) {
Verify verify = verifyMapper.selectById(sequenceNbr); //耐压信息
if (verify != null ) {
String codes = verify.getCode( );
if (!ValidationUtil.isEmpty(codes)) {
String[] codeArray = codes.split(",");
for (String code : codeArray) {
//查工艺
object.put("code",code);
String targetInfo = verify.getTargetInfo( );
if (!ValidationUtil.isEmpty(targetInfo)) {
List<Verify> verifyList = verifyMapper.selectByWelder(verify.getProjectId( ), null, code, StageEnum.焊接工艺.getStage( ), null);
Verify verify1 = verifyList.stream( ).max((d1, d2) -> d1.getVerifyTime( ).compareTo(d2.getVerifyTime( ))).orElse(null);
JSONObject craftInfo=null;
if (verify1 != null) {
String status = verify.getStatus( );
if (VerifyEnum.已通过.getStatus().equals(status)) {
object.put("craftStatus",HEGE);
}
if (VerifyEnum.未通过.getStatus().equals(status)) {
object.put("craftStatus",NOTHEGE);
}
String targetInfo1 = verify1.getTargetInfo( );
craftInfo= JSONObject.parseObject(targetInfo1);
String location = (String)craftInfo.get("location");
object.put("location",location);
}
List<Verify> verifyPeople = verifyMapper.selectByWelder(verify1.getProjectId( ), (Long) craftInfo.get("welderId"), null, StageEnum.焊前人员.getStage( ), (Long) craftInfo.get("random"));
List<Verify> verifyEquipment= verifyMapper.selectByWelder(verify1.getProjectId( ), (Long) craftInfo.get("welderId"), null, StageEnum.焊前设备.getStage( ), (Long) craftInfo.get("random"));
List<Verify> verifyMaterial= verifyMapper.selectByWelder(verify1.getProjectId( ), (Long) craftInfo.get("welderId"), null, StageEnum.焊前管材质量.getStage( ), (Long) craftInfo.get("random"));
Verify vp= verifyPeople.stream( ).max((d1, d2) -> d1.getVerifyTime( ).compareTo(d2.getVerifyTime( ))).orElse(null);
Verify ve= verifyEquipment.stream( ).max((d1, d2) -> d1.getVerifyTime( ).compareTo(d2.getVerifyTime( ))).orElse(null);
Verify vm= verifyMaterial.stream( ).max((d1, d2) -> d1.getVerifyTime( ).compareTo(d2.getVerifyTime( ))).orElse(null);
if (vp != null) {
String status = vp.getStatus();
if (VerifyEnum.已通过.getStatus().equals(status)) {
object.put("peopleStatus",HEGE);
}
if (VerifyEnum.未通过.getStatus().equals(status)) {
object.put("peopleStatus",NOTHEGE);
}
}
if (ve != null) {
String status = ve.getStatus();
if (VerifyEnum.已通过.getStatus().equals(status)) {
object.put("equipmentStatus",HEGE);
}
if (VerifyEnum.未通过.getStatus().equals(status)) {
object.put("equipmentStatus",NOTHEGE);
}
}
if (vm != null) {
String status = vm.getStatus();
if (VerifyEnum.已通过.getStatus().equals(status)) {
object.put("materialStatus",HEGE);
}
if (VerifyEnum.未通过.getStatus().equals(status)) {
object.put("materialStatus",NOTHEGE);
}
}
}
}
}
}
}
return object;
}
}
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