Commit 3d461acf authored by tangwei's avatar tangwei

增加接口

parent 592577b1
......@@ -11,10 +11,13 @@ import java.util.Set;
import javax.servlet.http.HttpServletResponse;
import com.yeejoin.amos.patrol.business.feign.EquipFeign;
import com.yeejoin.amos.patrol.business.vo.PointInputItemNewVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.http.MediaType;
import org.springframework.scheduling.annotation.Async;
import org.springframework.util.ObjectUtils;
......@@ -79,6 +82,156 @@ public class PointController extends AbstractBaseController {
@Autowired
private RemoteSecurityService remoteSecurityService;
@Autowired
private EquipFeign equipFeign;
/**
*
* 新增接口
* **/
/**
* 查询巡检点的巡检项
*
* @param id
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "查询巡检点的巡检项", notes = "查询巡检点的巡检项")
@GetMapping(value = "/queryEquipPointInputItemNew", produces = "application/json;charset=UTF-8")
public CommonResponse queryEquipPointInputItemNew(@ApiParam(value = "巡检点id", required = true) @RequestParam Long pointId) {
try {
List<Map<String, Object>> pointInputItemList = iPointService.queryEquipPointInputItem(pointId);
Page<Map<String, Object>> pag =new PageImpl<Map<String, Object>>(pointInputItemList);
return CommonResponseUtil.success(pag);
} catch (Exception e) {
log.error(e.getMessage(), e);
return CommonResponseUtil.failure("查询巡检点的巡检项失败");
}
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "新增巡查对象", notes = "新增巡查对象")
@PostMapping(value = "/addPointXcdx", produces = "application/json;charset=UTF-8")
public CommonResponse addPointXcdx(@ApiParam(value = "新增巡查对象", required = true) @RequestBody PointInputItemNewVo pointClassify){
try {
AgencyUserModel user = getUserInfo();
PointClassify newPointClassify = new PointClassify();
newPointClassify.setEquipmentId(pointClassify.getEquipmentId());
newPointClassify.setName(pointClassify.getName());
newPointClassify.setInspectionSpecName(pointClassify.getInspectionName());
newPointClassify.setCreatorId(user.getUserId());
newPointClassify.setPointId(pointClassify.getPointId());
newPointClassify.setOrderNo(pointClassify.getOrderNo());
newPointClassify.setDataSourceCode(pointClassify.getDataSourceCode());
newPointClassify.setDataSourceName(pointClassify.getDataSourceName());
newPointClassify.setAddress(pointClassify.getAddress());
newPointClassify.setBuildingId(pointClassify.getBuildingId());
newPointClassify.setOriginalId(pointClassify.getOriginalId());
newPointClassify.setCategoryCode(pointClassify.getCategoryCode());
newPointClassify.setCategoryName(pointClassify.getCategoryName());
newPointClassify.setCode(pointClassify.getCode());
newPointClassify.setBuildingName(pointClassify.getBuildingName());
iPointService.addPointClassifyByPointId(newPointClassify);
return CommonResponseUtil.success();
} catch (Exception e) {
e.printStackTrace();
log.error(e.getMessage(), e);
return CommonResponseUtil.failure("新增巡查对象失败");
}
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "新增巡查对象", notes = "新增巡查对象")
@PostMapping(value = "/addPointXcdxList", produces = "application/json;charset=UTF-8")
public CommonResponse addPointXcdxList(@ApiParam(value = "新增巡查对象", required = true) @RequestBody List<PointInputItemNewVo> pointClassifys){
try {
AgencyUserModel user = getUserInfo();
for (PointInputItemNewVo pointClassify : pointClassifys) {
PointClassify newPointClassify = new PointClassify();
newPointClassify.setEquipmentId(pointClassify.getEquipmentId());
newPointClassify.setName(pointClassify.getName());
newPointClassify.setInspectionSpecName(pointClassify.getInspectionName());
newPointClassify.setCreatorId(user.getUserId());
newPointClassify.setPointId(pointClassify.getPointId());
newPointClassify.setOrderNo(pointClassify.getOrderNo());
newPointClassify.setDataSourceCode(pointClassify.getDataSourceCode());
newPointClassify.setDataSourceName(pointClassify.getDataSourceName());
newPointClassify.setAddress(pointClassify.getAddress());
newPointClassify.setBuildingId(pointClassify.getBuildingId());
newPointClassify.setOriginalId(pointClassify.getOriginalId());
newPointClassify.setCategoryCode(pointClassify.getCategoryCode());
newPointClassify.setCategoryName(pointClassify.getCategoryName());
newPointClassify.setCode(pointClassify.getCode());
newPointClassify.setBuildingName(pointClassify.getBuildingName());
iPointService.addPointClassifyByPointId(newPointClassify);
}
return CommonResponseUtil.success();
} catch (Exception e) {
e.printStackTrace();
log.error(e.getMessage(), e);
return CommonResponseUtil.failure("新增巡查对象失败");
}
}
/**
* 获取当前登录人,单位下建筑树
*
* */
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "获取当前登录人,单位下建筑树", notes = "获取当前登录人,单位下建筑树")
@GetMapping(value = "/gettreeWarehouse", produces = "application/json;charset=UTF-8")
public CommonResponse gettreeWarehouse() {
try {
ReginParams reginParams = getSelectedOrgInfo();
return CommonResponseUtil.success(equipFeign.gettreeWarehouse(reginParams.getPersonIdentity().getCompanyBizOrgCode()));
} catch (Exception e) {
log.error(e.getMessage(), e);
return CommonResponseUtil.failure("查询巡检点失败");
}
}
/**
*
* 新增接口
* **/
/**
* 增加巡检点
*
......
......@@ -37,5 +37,10 @@ public interface EquipFeign {
*/
@RequestMapping(value = "${equip.fegin.prefix}"+"/area/tree", method = RequestMethod.GET ,consumes="application/json")
LinkedHashMap<String,Object> getRegionTress();
@RequestMapping(value = "${equip.fegin.prefix}"+"/warehouse-structure/gettree/0", method = RequestMethod.GET ,consumes="application/json")
LinkedHashMap<String,Object> gettreeWarehouse(@RequestParam(value = "bizOrgCode", required = true) String bizOrgCode);
}
......@@ -124,6 +124,18 @@ public class PointServiceImpl implements IPointService {
}
@Override
public void addPointClassifyByPointId(PointClassify pointClassify) {
iPointClassifyDao.saveAndFlush(pointClassify);
}
@Override
public void addPointClassifyByPointIdList(List<PointClassify> pointClassify) {
iPointClassifyDao.saveAll(pointClassify);
}
@Override
public void addMovePoint(MovePointParam param) {
Point point = new Point();
BeanUtils.copyProperties(param, point);
......@@ -1521,6 +1533,7 @@ public class PointServiceImpl implements IPointService {
if(e.get("id")!=null && !StringUtils.isBlank(e.get("id").toString())){
List<PointInputItemVo> inputItems = inputItemMapper.queryCustomInputItemByPointId(e.get("id").toString());
e.put("equipIputDetailData",inputItems);
e.put("equipIputDetailDataNum",inputItems!=null?inputItems.size():0);
}
});
return content;
......
......@@ -35,6 +35,16 @@ public interface IPointService {
* @param point
*/
Point newAddPoint(NewPointParam point);
/**
*添加巡查对象
* */
void addPointClassifyByPointId(PointClassify pointClassify);
void addPointClassifyByPointIdList(List<PointClassify> pointClassify);
/**
* 删除巡检点。返回成功删除点的ID
*
......
......@@ -95,6 +95,16 @@ public class PointInputItemNewVo{
*/
private String originalId;
private Long pointId;
public Long getPointId() {
return pointId;
}
public void setPointId(Long pointId) {
this.pointId = pointId;
}
private List<PointInputItemVo> equipIputDetailData = new ArrayList<PointInputItemVo>();
public List<PointInputItemVo> getEquipIputDetailData() {
......
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