Commit ed344b0e authored by chenzhao's avatar chenzhao

修改代码

parent 3d461acf
...@@ -43,6 +43,14 @@ public class Point extends BasicEntity { ...@@ -43,6 +43,14 @@ public class Point extends BasicEntity {
*/ */
private String coordinates; private String coordinates;
public String getIsSccreen() {
return isSccreen;
}
public void setIsSccreen(String isSccreen) {
this.isSccreen = isSccreen;
}
/** /**
* 创建用户id * 创建用户id
*/ */
...@@ -228,6 +236,9 @@ public class Point extends BasicEntity { ...@@ -228,6 +236,9 @@ public class Point extends BasicEntity {
private String ue4Location; private String ue4Location;
//bizOrgCode是否筛选字段,默认是1 为0时代表是前端传递进来的 数据库字段取值为eq 同级查找
private String isSccreen = "1";
/** /**
* ue4旋转 * ue4旋转
*/ */
......
...@@ -11,6 +11,7 @@ import java.util.Set; ...@@ -11,6 +11,7 @@ import java.util.Set;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.patrol.business.feign.EquipFeign; import com.yeejoin.amos.patrol.business.feign.EquipFeign;
import com.yeejoin.amos.patrol.business.vo.PointInputItemNewVo; import com.yeejoin.amos.patrol.business.vo.PointInputItemNewVo;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -21,6 +22,7 @@ import org.springframework.data.domain.PageImpl; ...@@ -21,6 +22,7 @@ import org.springframework.data.domain.PageImpl;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
...@@ -63,6 +65,7 @@ import com.yeejoin.amos.patrol.feign.RemoteSecurityService; ...@@ -63,6 +65,7 @@ import com.yeejoin.amos.patrol.feign.RemoteSecurityService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
@RestController @RestController
@RequestMapping(value = "/api/point") @RequestMapping(value = "/api/point")
...@@ -1052,4 +1055,70 @@ public class PointController extends AbstractBaseController { ...@@ -1052,4 +1055,70 @@ public class PointController extends AbstractBaseController {
return CommonResponseUtil.success(iPointService.getRegionTress()); return CommonResponseUtil.success(iPointService.getRegionTress());
} }
/*********新增接口************/
/**
* 增加巡检点
*
* @param
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "新增巡检点", notes = "新增巡检点")
@PostMapping(value = "/addPointNew", produces = "application/json;charset=UTF-8")
public CommonResponse AddPointNew(@ApiParam(value = "巡检点", required = true) @RequestBody Point point){
AgencyUserModel user = getUserInfo();
if (ObjectUtils.isEmpty(user)) {
return CommonResponseUtil.failure("用户session过期");
}
try {
ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getOrgCode(reginParams);
point.setOrgCode(loginOrgCode); //点归属于公司
point.setCreatorId(user.getUserId());
point.setBizOrgCode(reginParams.getPersonIdentity().getBizOrgCode());
point.setBizOrgName(reginParams.getPersonIdentity().getCompanyName());
iPointService.addPointNew(point);
return CommonResponseUtil.success();
} catch (Exception e) {
e.printStackTrace();
log.error(e.getMessage(), e);
return CommonResponseUtil.failure("巡检点新增失败");
}
}
/**
* 查询巡检点信息
*
* @param point
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "查询巡检点信息", notes = "查询巡检点信息")
@PostMapping(value = "/listNew", produces = "application/json;charset=UTF-8")
public CommonResponse listPointNew(
@ApiParam(value = "查询条件", required = false) @RequestBody(required = false) Point point,
@RequestParam(value = "pageNumber", defaultValue = "1") int current,
@RequestParam(value = "pageSize", defaultValue = "10") int size) {
ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getOrgCode(reginParams);
String roleTypeName = getRoleTypeName(reginParams);
if (ObjectUtils.isEmpty(reginParams)) {
return CommonResponseUtil.failure("用户session过期");
}
try {
if (!StringUtils.isEmpty(point.getBizOrgCode())){
point.setIsSccreen("0");
}else {
point.setBizOrgCode(reginParams.getPersonIdentity().getCompanyBizOrgCode());
}
IPage<PointVo> pointList = iPointService.queryPointInfoNew(point, current,size, loginOrgCode);
return CommonResponseUtil.success(pointList);
} catch (Exception e) {
e.printStackTrace();
log.error(e.getMessage(), e);
return CommonResponseUtil.failure("查询巡检点信息失败");
}
}
} }
...@@ -4,7 +4,11 @@ import java.util.HashMap; ...@@ -4,7 +4,11 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.patrol.business.vo.PointInputItemNewVo; import com.yeejoin.amos.patrol.business.vo.PointInputItemNewVo;
import com.yeejoin.amos.patrol.core.common.request.CommonPageable;
import com.yeejoin.amos.patrol.dao.entity.Point;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import com.yeejoin.amos.patrol.business.entity.mybatis.CheckPtListBo; import com.yeejoin.amos.patrol.business.entity.mybatis.CheckPtListBo;
...@@ -48,6 +52,11 @@ public interface PointMapper extends BaseMapper { ...@@ -48,6 +52,11 @@ public interface PointMapper extends BaseMapper {
List<PointInputItemVo> getPointClassInputItemById(@Param(value = "pointId") Long pointId); List<PointInputItemVo> getPointClassInputItemById(@Param(value = "pointId") Long pointId);
List<Point> listByParams(Point pointParams, Page page);
int listByParamsCount(Point pointParams);
/** /**
* 根据点ID获取点图片信息 * 根据点ID获取点图片信息
* *
......
...@@ -3,6 +3,7 @@ package com.yeejoin.amos.patrol.business.service.impl; ...@@ -3,6 +3,7 @@ package com.yeejoin.amos.patrol.business.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
...@@ -65,6 +66,9 @@ public class PointServiceImpl implements IPointService { ...@@ -65,6 +66,9 @@ public class PointServiceImpl implements IPointService {
private IPointDao iPointDao; private IPointDao iPointDao;
@Autowired @Autowired
PointMapper pointMapper;
@Autowired
private IPointClassifyDao iPointClassifyDao; private IPointClassifyDao iPointClassifyDao;
@Autowired @Autowired
...@@ -82,8 +86,6 @@ public class PointServiceImpl implements IPointService { ...@@ -82,8 +86,6 @@ public class PointServiceImpl implements IPointService {
@Autowired @Autowired
private IRoutePointItemDao iRoutePointItemDao; private IRoutePointItemDao iRoutePointItemDao;
@Resource
private PointMapper pointMapper;
@Resource @Resource
private RouteMapper routeMapper; private RouteMapper routeMapper;
...@@ -136,6 +138,16 @@ public class PointServiceImpl implements IPointService { ...@@ -136,6 +138,16 @@ public class PointServiceImpl implements IPointService {
} }
@Override @Override
@Transactional
public Point addPointNew(Point point) {
// 保存点基本信息
point.setIsDelete(false);
iPointDao.saveAndFlush(point);
return point;
}
@Override
public void addMovePoint(MovePointParam param) { public void addMovePoint(MovePointParam param) {
Point point = new Point(); Point point = new Point();
BeanUtils.copyProperties(param, point); BeanUtils.copyProperties(param, point);
...@@ -1705,4 +1717,33 @@ public class PointServiceImpl implements IPointService { ...@@ -1705,4 +1717,33 @@ public class PointServiceImpl implements IPointService {
String[] result = new String[emptyNames.size()]; String[] result = new String[emptyNames.size()];
return emptyNames.toArray(result); return emptyNames.toArray(result);
} }
/*13迭代新增列表方法*/
public IPage<PointVo> queryPointInfoNew(Point pointParams, int current ,int size, String loginOrgCode) {
com.baomidou.mybatisplus.extension.plugins.pagination.Page<Object> page = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(current, size);
List<Point> pointPage = pointMapper.listByParams(pointParams,page);
int num = pointMapper.listByParamsCount(pointParams);
List<PointVo> pointVoList = new ArrayList<>();
for (Point point : pointPage) {
PointVo pointVo = new PointVo();
BeanUtils.copyProperties(point, pointVo);
pointVo.setShotNumber(point.getShotMinNumber() + "-" + point.getShotMaxNumber());
List<String> classifyNameList = new ArrayList<>();
List<PointClassify> pointClassifys = iPointClassifyDao.getPointClassifyByPointId(point.getId());
for (PointClassify pointClassify : pointClassifys) {
classifyNameList.add(pointClassify.getName());
}
String classifynames = StringUtils.join(classifyNameList.toArray(), ",");
pointVo.setClassifyName(classifynames);
pointVoList.add(pointVo);
}
IPage<PointVo> pointVo = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>();
pointVo.setRecords(pointVoList);
pointVo.setTotal(num);
pointVo.setCurrent(current);
pointVo.setSize(size);
return pointVo;
}
} }
package com.yeejoin.amos.patrol.business.service.intfc; package com.yeejoin.amos.patrol.business.service.intfc;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.patrol.business.entity.mybatis.CheckPtListBo; import com.yeejoin.amos.patrol.business.entity.mybatis.CheckPtListBo;
import com.yeejoin.amos.patrol.business.param.*; import com.yeejoin.amos.patrol.business.param.*;
import com.yeejoin.amos.patrol.business.util.DaoCriteria; import com.yeejoin.amos.patrol.business.util.DaoCriteria;
...@@ -29,6 +30,14 @@ public interface IPointService { ...@@ -29,6 +30,14 @@ public interface IPointService {
*/ */
Point addPoint(PointParam point); Point addPoint(PointParam point);
/**
*
* 新增列表接口
*
*/
IPage<PointVo> queryPointInfoNew(Point pointParams,int current,int size, String loginOrgCode);
/** /**
* 添加巡检点 * 添加巡检点
* *
...@@ -45,6 +54,8 @@ public interface IPointService { ...@@ -45,6 +54,8 @@ public interface IPointService {
void addPointClassifyByPointIdList(List<PointClassify> pointClassify); void addPointClassifyByPointIdList(List<PointClassify> pointClassify);
Point addPointNew(Point point);
/** /**
* 删除巡检点。返回成功删除点的ID * 删除巡检点。返回成功删除点的ID
* *
......
...@@ -16,6 +16,25 @@ public class PointVo { ...@@ -16,6 +16,25 @@ public class PointVo {
@Excel(name="路线", orderNum="4") @Excel(name="路线", orderNum="4")
private String routeName; private String routeName;
private String bizOrgCode;
private String bizOrgName;
public String getBizOrgCode() {
return bizOrgCode;
}
public void setBizOrgCode(String bizOrgCode) {
this.bizOrgCode = bizOrgCode;
}
public String getBizOrgName() {
return bizOrgName;
}
public void setBizOrgName(String bizOrgName) {
this.bizOrgName = bizOrgName;
}
private long classifyId; private long classifyId;
@Excel(name="扩展分类", orderNum="5") @Excel(name="扩展分类", orderNum="5")
......
...@@ -246,7 +246,7 @@ ...@@ -246,7 +246,7 @@
and a.catalog_id in <foreach collection="catalogIds" item="catalogId" index="index" open="(" separator="," close=")" >#{catalogId}</foreach> and a.catalog_id in <foreach collection="catalogIds" item="catalogId" index="index" open="(" separator="," close=")" >#{catalogId}</foreach>
</if> </if>
<if test="bizOrgCode!=null and bizOrgCode!=''"> <if test="bizOrgCode!=null and bizOrgCode!=''">
and #{bizOrgCode} LIKE CONCAT (a.biz_org_code ,'%') and a.biz_org_codeLIKE CONCAT (#{bizOrgCode} ,'%')
</if> </if>
<choose> <choose>
<when test="level == '-0' ">and a.level is null</when> <when test="level == '-0' ">and a.level is null</when>
...@@ -281,7 +281,7 @@ ...@@ -281,7 +281,7 @@
and a.catalog_id in <foreach collection="catalogIds" item="catalogId" index="index" open="(" separator="," close=")" >#{catalogId}</foreach> and a.catalog_id in <foreach collection="catalogIds" item="catalogId" index="index" open="(" separator="," close=")" >#{catalogId}</foreach>
</if> </if>
<if test="bizOrgCode!=null and bizOrgCode!=''"> <if test="bizOrgCode!=null and bizOrgCode!=''">
and #{bizOrgCode} LIKE CONCAT (a.biz_org_code ,'%') and a.biz_org_codeLIKE CONCAT (#{bizOrgCode} ,'%')
</if> </if>
<choose> <choose>
<when test="level == '-0' ">and a.level is null</when> <when test="level == '-0' ">and a.level is null</when>
......
...@@ -80,6 +80,61 @@ ...@@ -80,6 +80,61 @@
pi.order_no pi.order_no
</select> </select>
<select id="listByParams" resultType="com.yeejoin.amos.patrol.dao.entity.Point">
select
p.*
from p_point p
<where>
1=1
<if test="pointParams.pointNo != null and pointParams.pointNo != ''">
and p.point_no LIKE CONCAT ('%',#{pointParams.pointNo},'%')
</if>
<if test="pointParams.name != null and pointParams.name != ''">
and p.name LIKE CONCAT ('%',#{pointParams.name},'%')
</if>
<if test="pointParams.isFixed != null and pointParams.isFixed != ''">
and p.is_fixed = #{pointParams.isFixed}
</if>
<if test="pointParams.catalogId != null and pointParams.catalogId != ''">
and p.catalog_id = #{pointParams.catalogId}
</if>
<if test="pointParams.bizOrgCode != null and pointParams.bizOrgCode != '' and pointParams.isSccreen == '0'">
and p.biz_org_code = #{pointParams.bizOrgCode}
</if>
<if test="pointParams.bizOrgCode != null and pointParams.bizOrgCode != '' and pointParams.isSccreen == '1'">
and p.biz_org_code LIKE CONCAT (#{pointParams.bizOrgCode} ,'%')
</if>
</where>
ORDER BY p.id DESC
</select>
<select id="listByParamsCount" resultType="int">
select
count(*) as number
from p_point
<where>
1=1
<if test="pointNo != null and pointNo != ''">
and point_no LIKE CONCAT ('%',#{pointNo},'%')
</if>
<if test="name != null and name != ''">
and name LIKE CONCAT ('%',#{name},'%')
</if>
<if test="isFixed != null and isFixed != ''">
and is_fixed = #{isFixed}
</if>
<if test="catalogId != null and catalogId != ''">
and catalog_id = #{catalogId}
</if>
<if test="bizOrgCode != null and bizOrgCode != '' and isSccreen == '0'">
and biz_org_code = #{bizOrgCode}
</if>
<if test="bizOrgCode != null and bizOrgCode != '' and isSccreen == '1'">
and biz_org_code LIKE CONCAT (#{bizOrgCode} ,'%')
</if>
</where>
</select>
<select id="getPointInputItemById" resultType="com.yeejoin.amos.patrol.business.vo.PointInputItemVo"> <select id="getPointInputItemById" resultType="com.yeejoin.amos.patrol.business.vo.PointInputItemVo">
SELECT SELECT
p.*, temp.id pointItemId, temp.order_no pOrderNo p.*, temp.id pointItemId, temp.order_no pOrderNo
......
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