Commit 7a6fdd4f authored by zhangyingbin's avatar zhangyingbin

同步修改地图支持接口,修改焊口定位更新逻辑

parent 9c718f2d
......@@ -88,5 +88,17 @@ public class Weld extends BaseEntity {
@TableField("status")
private Integer status;
/**
*经度
*/
@TableField("voltage_longitude")
private String voltageLongitude;
/**
*纬度
*/
@TableField("voltage_latitude")
private String voltageLatitude;
}
......@@ -415,6 +415,17 @@ public class ProjectController extends BaseController {
return ResponseHelper.buildResponse(projectServiceImpl.getProjectLocation());
}
/**
* 根据项目id获取项目详情(包含经纬度信息)
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "根据项目id获取项目详情(包含经纬度信息)", notes = "根据项目id获取项目详情(包含经纬度信息)")
@GetMapping(value = "/getProjectLocationOne/{projectId}")
public ResponseModel<ProjectDto> getProjectLocationOne(@PathVariable String projectId){
return ResponseHelper.buildResponse(projectServiceImpl.getProjectLocationOne(projectId));
}
/**
* 资料详情
......
......@@ -18,6 +18,7 @@ import java.util.List;
import java.util.Map;
import com.yeejoin.amos.boot.module.ugp.biz.service.impl.WeldServiceImpl;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -230,8 +231,18 @@ public class WeldController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/getWeldList/{projectId}")
@ApiOperation(httpMethod = "GET", value = "获取焊口定位信息", notes = "获取焊口定位信息")
public ResponseModel<List<Weld>> getWeldList(@PathVariable( value = "projectId")String projectId){
return ResponseHelper.buildResponse(weldServiceImpl.list(new LambdaQueryWrapper<Weld>().eq(Weld::getProjectId,projectId)));
public ResponseModel<List<Weld>> getWeldList(@PathVariable( value = "projectId")String projectId,boolean isCraft){
List<Weld> weldList = weldServiceImpl.list(new LambdaQueryWrapper<Weld>().eq(Weld::getProjectId,projectId));
if(!isCraft){
if(!ValidationUtil.isEmpty(weldList)){
for(Weld weld : weldList){
weld.setLongitude(weld.getVoltageLongitude());
weld.setLatitude(weld.getVoltageLatitude());
}
}
}
return ResponseHelper.buildResponse(weldList);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
......@@ -244,15 +255,15 @@ public class WeldController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/getWeldCode/{projectId}")
@ApiOperation(httpMethod = "GET", value = "获取焊口定位信息List(只有经纬度信息)", notes = "获取焊口定位信息List(只有经纬度信息)")
public ResponseModel<List<List<Double>>> getWeldCode(@PathVariable String projectId){
return ResponseHelper.buildResponse(weldServiceImpl.getWeldCode(projectId));
public ResponseModel<List<List<Double>>> getWeldCode(@PathVariable String projectId,boolean isCraft){
return ResponseHelper.buildResponse(weldServiceImpl.getWeldCode(projectId,isCraft));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping(value = "/getWeldListByLocation")
@ApiOperation(httpMethod = "POST", value = "", notes = "")
public ResponseModel<List<ProjectDto>> getWeldListByLocation(@RequestBody Object obj){
return ResponseHelper.buildResponse(weldServiceImpl.getWeldListByLocation(obj));
public ResponseModel<List<ProjectDto>> getWeldListByLocation(@RequestBody Object obj,boolean isCraft){
return ResponseHelper.buildResponse(weldServiceImpl.getWeldListByLocation(obj,isCraft));
}
}
......@@ -649,6 +649,31 @@ public class ProjectServiceImpl extends BaseService<ProjectDto, Project, Project
return projectDtoList;
}
/**
* 获取当前登陆人所在单位下的项目的项目信息(包含经纬度信息)
* @return
*/
public ProjectDto getProjectLocationOne(String projectId){
Project project = this.getById(projectId);
ProjectDto projectDto = new ProjectDto();
if(!ValidationUtil.isEmpty(project)){
BeanUtils.copyProperties(project,projectDto);
List<Weld> weldList = weldServiceImpl.list(new LambdaQueryWrapper<Weld>().eq(Weld::getProjectId,project.getSequenceNbr()));
if(!ValidationUtil.isEmpty(weldList)){
for (Weld weld : weldList) {
String longitude = weld.getLongitude();
String latitude = weld.getLatitude();
if (!ValidationUtil.isEmpty(longitude) && !ValidationUtil.isEmpty(latitude)) {
projectDto.setLongitude(longitude);
projectDto.setLatitude(latitude);
break;
}
}
}
}
return projectDto;
}
public Map<String, Object> getInformationDetail(Long sequenceNbr){
LambdaQueryWrapper<Attachment> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(Attachment::getSourceId,sequenceNbr);
......
......@@ -240,7 +240,7 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
return page ;
}
public void weldUpdate(JSONObject jsonObject,Integer status){
public void weldUpdate(JSONObject jsonObject,Integer status, boolean isCraft){
Weld weld = weldService.getOne(new LambdaQueryWrapper<Weld>().eq(Weld::getCode,jsonObject.getString("code")));
String location = jsonObject.getString("location");
......@@ -248,12 +248,17 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
weld.setStatus(status);
}
if(!"4.9E-3244.9E-324".equals(location)) {
if(!"4.9E-3244.9E-324".equals(location) || "null,null".equals(location)) {
if (location.contains(",")) {
String longitude = location.substring(0, location.indexOf(","));
String latitude = location.substring(longitude.length() + 1);
weld.setLongitude(longitude);
weld.setLatitude(latitude);
if(isCraft) {
weld.setLongitude(longitude);
weld.setLatitude(latitude);
} else {
weld.setVoltageLongitude(longitude);
weld.setVoltageLatitude(latitude);
}
weldService.updateById(weld);
try {
emqKeeper.getMqttClient().publish(weldUpdate, weld.toString().getBytes(), 1, false);
......@@ -366,7 +371,7 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
//成功
this.addSuccessData(verify,null,jsonObject);
//更新weld焊口信息表中的经纬度信息
weldUpdate(jsonObject,null);
weldUpdate(jsonObject,null,true);
}
//管材
if (stage.equals(StageEnum.焊前管材质量.getVerifyName())){
......@@ -412,7 +417,7 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
}
this.addSuccessData(verify,null,jsonObject);
//更新weld焊口信息表中的经纬度信息
weldUpdate(jsonObject,null);
weldUpdate(jsonObject,null,true);
}
//设备
if (stage.equals(StageEnum.焊前设备.getVerifyName())){
......@@ -453,7 +458,7 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
//效验通过
this.addSuccessData(verify,null,jsonObject);
//更新weld焊口信息表中的经纬度信息
weldUpdate(jsonObject,null);
weldUpdate(jsonObject,null,true);
}
//工艺
if (stage.equals(StageEnum.焊接工艺.getVerifyName())){
......@@ -534,7 +539,7 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
v1.setSubmitTime(time);
this.addSuccessData(v1,null,object);
//更新weld焊口信息表中的经纬度信息,更新焊口状态 已完成
weldUpdate(jsonObject,WeldStatusEnum.已完成.getStatus());
weldUpdate(jsonObject,WeldStatusEnum.已完成.getStatus(),true);
}
//耐压
if (stage.equals(StageEnum.管道耐压.getVerifyName())){
......@@ -584,7 +589,7 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
//效验通过
this.addSuccessData(verify,codeArray,jsonObject);
//更新weld焊口信息表中的经纬度信息
weldUpdate(jsonObject,null);
weldUpdate(jsonObject,null,false);
}
//埋深
if (stage.equals(StageEnum.敷设质量.getVerifyName())){
......@@ -658,7 +663,7 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
String []codeArray =manyCode.split(",");
this.addSuccessData(verify,codeArray,jsonObject);
//更新weld焊口信息表中的经纬度信息
weldUpdate(jsonObject,null);
weldUpdate(jsonObject,null,false);
}
//回填
if (stage.equals(StageEnum.回填.getVerifyName())) {
......@@ -694,7 +699,7 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
String []codeArray =manyCode.split(",");
this.addSuccessData(verify,codeArray,jsonObject);
//更新weld焊口信息表中的经纬度信息
weldUpdate(jsonObject,null);
weldUpdate(jsonObject,null,false);
}
......
......@@ -441,7 +441,7 @@ class WeldServiceImpl extends BaseService<WeldDto, Weld, WeldMapper> implements
return page;
}
public List<List<Double>> getWeldCode(String projectId){
public List<List<Double>> getWeldCode(String projectId, boolean isCraft){
LambdaQueryWrapper<Weld> wrapper = new LambdaQueryWrapper();
wrapper.eq(Weld::getProjectId,projectId);
List<Weld> weldList = weldMapper.selectList(wrapper);
......@@ -449,9 +449,20 @@ class WeldServiceImpl extends BaseService<WeldDto, Weld, WeldMapper> implements
for(Weld weld : weldList){
if(!ValidationUtil.isEmpty(weld.getLatitude()) && !ValidationUtil.isEmpty(weld.getLongitude())) {
ArrayList<Double> objects = Lists.newArrayList();
objects.add(Double.valueOf(weld.getLongitude()));
objects.add(Double.valueOf(weld.getLatitude()));
list.add(objects);
if(isCraft) {
if (!ValidationUtil.isEmpty(weld.getLongitude()) && !ValidationUtil.isEmpty(weld.getLatitude())) {
objects.add(Double.valueOf(weld.getLongitude()));
objects.add(Double.valueOf(weld.getLatitude()));
}
} else {
if (!ValidationUtil.isEmpty(weld.getVoltageLongitude()) && !ValidationUtil.isEmpty(weld.getVoltageLatitude())) {
objects.add(Double.valueOf(weld.getVoltageLongitude()));
objects.add(Double.valueOf(weld.getVoltageLatitude()));
}
}
if(!ValidationUtil.isEmpty(objects)) {
list.add(objects);
}
}
}
return list;
......@@ -464,7 +475,7 @@ class WeldServiceImpl extends BaseService<WeldDto, Weld, WeldMapper> implements
* @return
*/
public List<ProjectDto> getWeldListByLocation(Object obj){
public List<ProjectDto> getWeldListByLocation(Object obj,boolean isCraft){
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(obj));
JSONObject left = jsonObject.getJSONObject("northeast");
JSONObject right = jsonObject.getJSONObject("southwest");
......@@ -486,8 +497,17 @@ class WeldServiceImpl extends BaseService<WeldDto, Weld, WeldMapper> implements
}
}
for(ProjectDto projectDto : projectDtos){
projectDto.setWeldList(this.list(new LambdaQueryWrapper<Weld>().eq(Weld::getProjectId,projectDto.getSequenceNbr())));
projectDto.setWeldLines(getWeldCode(String.valueOf(projectDto.getSequenceNbr())));
List<Weld> welds = this.list(new LambdaQueryWrapper<Weld>().eq(Weld::getProjectId,projectDto.getSequenceNbr()));
if(!isCraft){
if(!ValidationUtil.isEmpty(welds)){
for(Weld weld : welds){
weld.setLongitude(weld.getVoltageLongitude());
weld.setLatitude(weld.getVoltageLatitude());
}
}
}
projectDto.setWeldList(welds);
projectDto.setWeldLines(getWeldCode(String.valueOf(projectDto.getSequenceNbr()),isCraft));
}
return projectDtos;
}
......
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