Commit 4d6ad98c authored by wanglong's avatar wanglong

更新接口

parent c3b55f7b
......@@ -143,8 +143,8 @@ public class EquipmentController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "设备数据名称查询", notes = "设备数据名称查询")
@GetMapping(value = "/selectName")
public ResponseModel<List<JSONObject>> selectName(@RequestParam(value = "unitId")String installationUnitId) {
return ResponseHelper.buildResponse(equipmentServiceImpl.selectName(installationUnitId));
public ResponseModel<List<JSONObject>> selectName(@RequestParam(value = "code")String code) {
return ResponseHelper.buildResponse(equipmentServiceImpl.selectName(code));
}
/**
......
package com.yeejoin.amos.boot.module.ugp.biz.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.ugp.api.dto.WelderDto;
import com.yeejoin.amos.boot.module.ugp.api.entity.Project;
import com.yeejoin.amos.boot.module.ugp.api.mapper.ProjectMapper;
import com.yeejoin.amos.boot.module.ugp.biz.service.impl.OrgServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -24,6 +27,8 @@ import java.util.stream.Collectors;
public class WelderController extends BaseController {
@Autowired
OrgServiceImpl orgService;
@Autowired
ProjectMapper projectMapper;
/**
......@@ -47,10 +52,20 @@ public class WelderController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "/selectWelder")
@ApiOperation(httpMethod = "GET", value = "新增焊工信息", notes = "新增焊工信息")
public ResponseModel<List<Map>> selectWelder(@RequestParam("unitId") String companyId) {
List<Map> info = orgService.getInfo(companyId);
public ResponseModel<List<JSONObject>> selectWelder(@RequestParam("code") String code) {
List<JSONObject> jsonObjectList=new ArrayList<>();
LambdaQueryWrapper<Project> wrapper=new LambdaQueryWrapper<>();
wrapper.eq(Project::getCode,code);
Project project = projectMapper.selectOne(wrapper);
List<Map> info = orgService.getInfo(String.valueOf(project.getCompanyId()));
for (Map<String,Object> map:info){
JSONObject jsonObject=new JSONObject();
jsonObject.put("name",map.get("name"));
jsonObject.put("sequenceNbr",map.get("sequenceNbr"));
jsonObjectList.add(jsonObject);
}
return ResponseHelper.buildResponse(info);
return ResponseHelper.buildResponse(jsonObjectList);
}
}
package com.yeejoin.amos.boot.module.ugp.biz.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.module.ugp.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.ugp.api.entity.Equipment;
import com.yeejoin.amos.boot.module.ugp.api.entity.Project;
import com.yeejoin.amos.boot.module.ugp.api.mapper.EquipmentMapper;
import com.yeejoin.amos.boot.module.ugp.api.mapper.ProjectMapper;
import com.yeejoin.amos.boot.module.ugp.api.service.IEquipmentService;
import com.yeejoin.amos.boot.module.ugp.api.dto.EquipmentDto;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -31,6 +34,8 @@ import java.util.stream.Collectors;
public class EquipmentServiceImpl extends BaseService<EquipmentDto, Equipment, EquipmentMapper> implements IEquipmentService {
@Autowired
EquipmentMapper equipmentMapper;
@Autowired
ProjectMapper projectMapper;
@Autowired
AttachmentServiceImpl attachmentServiceImpl;
......@@ -57,13 +62,19 @@ public class EquipmentServiceImpl extends BaseService<EquipmentDto, Equipment, E
*
* @return
*/
public List<JSONObject> selectName(String installationUnitId) {
public List<JSONObject> selectName(String code) {
List<JSONObject> names = new ArrayList<>();
//添加查询条件
QueryWrapper<Equipment> wrapper = new QueryWrapper<>();
wrapper.eq("company_id", installationUnitId);
List<Equipment> equipment = equipmentMapper.selectList(wrapper);
// QueryWrapper<Equipment> wrapper = new QueryWrapper<>();
// wrapper.eq("company_id", installationUnitId);
//获取项目的安装单位id
LambdaQueryWrapper<Project> wrapper=new LambdaQueryWrapper<>();
wrapper.eq(Project::getCode,code);
Project project = projectMapper.selectOne(wrapper);
//获取项目的安装单位id进行查询
QueryWrapper<Equipment> wrapperEquipment= new QueryWrapper<>();
wrapperEquipment.eq("company_id", project.getInstallationUnitId());
List<Equipment> equipment = equipmentMapper.selectList(wrapperEquipment);
for (Equipment i : equipment) {
JSONObject name = new JSONObject();
......
......@@ -130,8 +130,9 @@ public class ProjectResourceServiceImpl extends BaseService<ProjectResourceDto,P
// if (!jsonObject.getString("sequenceNbr").isEmpty()){
// jsonObject.getString("sequenceNbr");
// }
String SequenceNbr = jsonObject.getString("SequenceNbr");
Long SequenceNbr = Long.valueOf(jsonObject.getString("sequenceNbr"));
String type = jsonObject.getString("type");
//判断资源类型并插入
if (type.equals(设备资源.getStatus())) {
projectResource.setType(设备资源.getState());
}
......@@ -141,7 +142,7 @@ public class ProjectResourceServiceImpl extends BaseService<ProjectResourceDto,P
if (type.equals(管材资源.getStatus())) {
projectResource.setType(管材资源.getState());
}
projectResource.setProjectId(Long.valueOf(SequenceNbr));
projectResource.setProjectId(SequenceNbr);
projectResource.setResourceId(Long.valueOf(select));
this.save(projectResource);
......
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