Commit 31695c11 authored by zhangsen's avatar zhangsen

巡检相关bug机场同步

parent 6d19aa0e
...@@ -6,6 +6,7 @@ import javax.persistence.Lob; ...@@ -6,6 +6,7 @@ import javax.persistence.Lob;
import javax.persistence.NamedQuery; import javax.persistence.NamedQuery;
import javax.persistence.Table; import javax.persistence.Table;
import com.baomidou.mybatisplus.annotation.TableName;
import org.hibernate.annotations.Where; import org.hibernate.annotations.Where;
...@@ -16,6 +17,7 @@ import org.hibernate.annotations.Where; ...@@ -16,6 +17,7 @@ import org.hibernate.annotations.Where;
@Table(name = "p_input_item") @Table(name = "p_input_item")
@NamedQuery(name = "InputItem.findAll", query = "SELECT c FROM InputItem c") @NamedQuery(name = "InputItem.findAll", query = "SELECT c FROM InputItem c")
@Where(clause = "is_delete=0")//表示未删除的数据 @Where(clause = "is_delete=0")//表示未删除的数据
@TableName("p_input_item")
public class InputItem extends BasicEntity { public class InputItem extends BasicEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
package com.yeejoin.amos.patrol.dao.entity; package com.yeejoin.amos.patrol.dao.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.NamedQuery; import javax.persistence.NamedQuery;
...@@ -11,6 +13,7 @@ import javax.persistence.Table; ...@@ -11,6 +13,7 @@ import javax.persistence.Table;
*/ */
@Entity @Entity
@Table(name="p_point_inputitem") @Table(name="p_point_inputitem")
@TableName("p_point_inputitem")
@NamedQuery(name="PointInputItem.findAll", query="SELECT p FROM PointInputItem p") @NamedQuery(name="PointInputItem.findAll", query="SELECT p FROM PointInputItem p")
public class PointInputItem extends BasicEntity{ public class PointInputItem extends BasicEntity{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
...@@ -8,6 +8,7 @@ import javax.persistence.NamedQuery; ...@@ -8,6 +8,7 @@ import javax.persistence.NamedQuery;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Transient; import javax.persistence.Transient;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonBackReference; import com.fasterxml.jackson.annotation.JsonBackReference;
...@@ -17,6 +18,7 @@ import com.fasterxml.jackson.annotation.JsonBackReference; ...@@ -17,6 +18,7 @@ import com.fasterxml.jackson.annotation.JsonBackReference;
*/ */
@Entity @Entity
@Table(name="p_route_point_item") @Table(name="p_route_point_item")
@TableName("p_route_point_item")
@NamedQuery(name="RoutePointItem.findAll", query="SELECT r FROM RoutePointItem r") @NamedQuery(name="RoutePointItem.findAll", query="SELECT r FROM RoutePointItem r")
public class RoutePointItem extends BasicEntity { public class RoutePointItem extends BasicEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
package com.yeejoin.amos.patrol.business.controller; package com.yeejoin.amos.patrol.business.controller;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.patrol.business.dao.mapper.PointInputItemMapper;
import com.yeejoin.amos.patrol.business.dao.mapper.InputItemMapper;
import com.yeejoin.amos.patrol.business.dao.mapper.PointMapper; import com.yeejoin.amos.patrol.business.dao.mapper.PointMapper;
import com.yeejoin.amos.patrol.business.dao.mapper.RoutePointItemMapper;
import com.yeejoin.amos.patrol.business.dao.repository.*; import com.yeejoin.amos.patrol.business.dao.repository.*;
import com.yeejoin.amos.patrol.business.feign.EquipFeign; import com.yeejoin.amos.patrol.business.feign.EquipFeign;
import com.yeejoin.amos.patrol.business.feign.JcsFeignClient; import com.yeejoin.amos.patrol.business.feign.JcsFeignClient;
...@@ -22,6 +27,7 @@ import org.springframework.data.domain.PageImpl; ...@@ -22,6 +27,7 @@ import org.springframework.data.domain.PageImpl;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
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.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
...@@ -104,6 +110,16 @@ public class PointController extends AbstractBaseController { ...@@ -104,6 +110,16 @@ public class PointController extends AbstractBaseController {
@Autowired @Autowired
private IRoutePointItemDao iRoutePointItemDao; private IRoutePointItemDao iRoutePointItemDao;
@Autowired
private InputItemMapper inputItemMapper;
@Autowired
private PointInputItemMapper pointInputItemMapper;
@Autowired
private RoutePointItemMapper routePointItemMapper;
/** /**
* *
* 新增接口 * 新增接口
...@@ -181,7 +197,7 @@ public class PointController extends AbstractBaseController { ...@@ -181,7 +197,7 @@ public class PointController extends AbstractBaseController {
} }
@Transactional
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "新增巡查对象", notes = "新增巡查对象") @ApiOperation(value = "新增巡查对象", notes = "新增巡查对象")
@PostMapping(value = "/addPointXcdx", produces = "application/json;charset=UTF-8") @PostMapping(value = "/addPointXcdx", produces = "application/json;charset=UTF-8")
...@@ -191,9 +207,6 @@ public class PointController extends AbstractBaseController { ...@@ -191,9 +207,6 @@ public class PointController extends AbstractBaseController {
List<RoutePoint> routePointList = iRoutePointDao.queryByPointId(pointClassify.getPointId()); List<RoutePoint> routePointList = iRoutePointDao.queryByPointId(pointClassify.getPointId());
AgencyUserModel user = getUserInfo(); AgencyUserModel user = getUserInfo();
PointClassify newPointClassify = new PointClassify(); PointClassify newPointClassify = new PointClassify();
List<PointInputItemVo> customInputList = pointClassify.getEquipIputDetailData();//巡检项
if(pointClassify.getId()==null){
newPointClassify.setEquipmentId(pointClassify.getEquipmentId()); newPointClassify.setEquipmentId(pointClassify.getEquipmentId());
newPointClassify.setName(pointClassify.getName()); newPointClassify.setName(pointClassify.getName());
newPointClassify.setInspectionSpecName(pointClassify.getInspectionName()); newPointClassify.setInspectionSpecName(pointClassify.getInspectionName());
...@@ -204,7 +217,6 @@ public class PointController extends AbstractBaseController { ...@@ -204,7 +217,6 @@ public class PointController extends AbstractBaseController {
newPointClassify.setDataSourceName(pointClassify.getDataSourceName()); newPointClassify.setDataSourceName(pointClassify.getDataSourceName());
newPointClassify.setAddress(pointClassify.getAddress()); newPointClassify.setAddress(pointClassify.getAddress());
newPointClassify.setBuildingId(pointClassify.getBuildingId()); newPointClassify.setBuildingId(pointClassify.getBuildingId());
if(pointClassify.getBuildingName()==null){ if(pointClassify.getBuildingName()==null){
FeignClientResult responseModel = equipFeign.getBuildingTreeOne(pointClassify.getBuildingId()); FeignClientResult responseModel = equipFeign.getBuildingTreeOne(pointClassify.getBuildingId());
...@@ -225,14 +237,22 @@ public class PointController extends AbstractBaseController { ...@@ -225,14 +237,22 @@ public class PointController extends AbstractBaseController {
String uuid= UUID.randomUUID().toString().replace("-",""); String uuid= UUID.randomUUID().toString().replace("-","");
newPointClassify.setOriginalId(uuid.substring(0,16)); newPointClassify.setOriginalId(uuid.substring(0,16));
} }
if (null != pointClassify.getId()) {
newPointClassify.setId(pointClassify.getId());
}
newPointClassify.setCategoryCode(pointClassify.getCategoryCode()); newPointClassify.setCategoryCode(pointClassify.getCategoryCode());
newPointClassify.setCategoryName(pointClassify.getCategoryName()); newPointClassify.setCategoryName(pointClassify.getCategoryName());
newPointClassify.setCode(pointClassify.getCode()); newPointClassify.setCode(pointClassify.getCode());
List<PointInputItemVo> customInputList = pointClassify.getEquipIputDetailData();//巡检项
iPointService.addPointClassifyByPointId(newPointClassify); iPointService.addPointClassifyByPointId(newPointClassify);
List<PointInputItemVo> oldInputItemList = new ArrayList<>();
List<Long> collect = new ArrayList<>();
if(pointClassify.getId()==null){
pointClassify.setId(newPointClassify.getId());
}else{ }else{
newPointClassify.setId(pointClassify.getId()); newPointClassify.setId(pointClassify.getId());
List<PointInputItemVo> oldInputItemList =iPointService.queryOldPointInputItemNew(pointClassify.getPointId(),pointClassify.getId()); // 新的巡检项的补集,即需要删除的项 oldInputItemList =iPointService.queryOldPointInputItemNew(pointClassify.getPointId(),pointClassify.getId()); // 新的巡检项的补集,即需要删除的项
collect = oldInputItemList.stream().map(PointInputItemVo::getPointItemId).collect(Collectors.toList());
List<PointInputItemVo> newInputItemList = new ArrayList<>(); List<PointInputItemVo> newInputItemList = new ArrayList<>();
List<PointInputItemVo> classList = pointClassify.getEquipIputDetailData(); List<PointInputItemVo> classList = pointClassify.getEquipIputDetailData();
newInputItemList.addAll(classList); newInputItemList.addAll(classList);
...@@ -251,8 +271,9 @@ public class PointController extends AbstractBaseController { ...@@ -251,8 +271,9 @@ public class PointController extends AbstractBaseController {
} }
}); });
if (pItemIds.size() > 0) { if (pItemIds.size() > 0) {
iPointInputItemDao.delPointInputItemById(pItemIds); inputItemMapper.delPointInputItemById(pItemIds);
iRoutePointItemDao.delRoutePointItemByItemId(pItemIds);// 删除p_route_point_item中使用到该项的行 // iPointInputItemDao.delPointInputItemById(pItemIds);
inputItemMapper.delRoutePointItemByItemId(pItemIds);// 删除p_route_point_item中使用到该项的行
} }
} }
...@@ -264,31 +285,36 @@ public class PointController extends AbstractBaseController { ...@@ -264,31 +285,36 @@ public class PointController extends AbstractBaseController {
pointInputItem.setPointId(pointClassify.getPointId()); pointInputItem.setPointId(pointClassify.getPointId());
pointInputItem.setInputItemId(pItemVo.getId()); pointInputItem.setInputItemId(pItemVo.getId());
pointInputItem.setClassifyIds(Long.valueOf(newPointClassify.getId()).toString()); pointInputItem.setClassifyIds(Long.valueOf(newPointClassify.getId()).toString());
pointInputItem.setId(0); // pointInputItem.setId(0);
pointInputItem.setOrderNo(pItemVo.getpOrderNo()); pointInputItem.setOrderNo(pItemVo.getpOrderNo());
PointInputItem pointInputItemResult = iPointInputItemDao.save(pointInputItem); pointInputItemMapper.insert(pointInputItem);
// PointInputItem pointInputItemResult = iPointInputItemDao.save(pointInputItem);
//更新巡检路线 //更新巡检路线
if(routePointList.size()>0){ if(routePointList.size()>0){
Long classifyId=newPointClassify.getId(); Long classifyId=newPointClassify.getId();
for (RoutePoint routePoint :routePointList) { for (RoutePoint routePoint :routePointList) {
RoutePointItem routePointItem = new RoutePointItem(); RoutePointItem routePointItem = new RoutePointItem();
routePointItem.setPointClassifyId(classifyId); routePointItem.setPointClassifyId(classifyId);
routePointItem.setPointInputItemId(pointInputItemResult.getId()); routePointItem.setPointInputItemId(pointInputItem.getId());
routePointItem.setRoutePointId(routePoint.getId()); routePointItem.setRoutePointId(routePoint.getId());
iRoutePointItemDao.save(routePointItem); routePointItemMapper.insert(routePointItem);
// iRoutePointItemDao.save(routePointItem);
} }
} }
}else{ }else {
if (!collect.contains(pItemVo.getPointItemId())) {
pointInputItem.setId(pItemVo.getPointItemId()); pointInputItem.setId(pItemVo.getPointItemId());
pointInputItem.setInputItemId(pItemVo.getId()); pointInputItem.setInputItemId(pItemVo.getId());
pointInputItem.setPointId(pointClassify.getPointId()); pointInputItem.setPointId(pointClassify.getPointId());
pointInputItem.setClassifyIds(Long.valueOf(newPointClassify.getId()).toString()); pointInputItem.setClassifyIds(Long.valueOf(newPointClassify.getId()).toString());
pointInputItem.setId(pItemVo.getPointItemId()); pointInputItem.setId(pItemVo.getPointItemId());
pointInputItem.setOrderNo(pItemVo.getpOrderNo()); pointInputItem.setOrderNo(pItemVo.getpOrderNo());
iPointInputItemDao.save(pointInputItem); pointInputItemMapper.insert(pointInputItem);
// iPointInputItemDao.save(pointInputItem);
} }
} }
return CommonResponseUtil.success(); }
return CommonResponseUtil.success(pointClassify);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
...@@ -299,20 +325,6 @@ public class PointController extends AbstractBaseController { ...@@ -299,20 +325,6 @@ public class PointController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "新增巡查对象", notes = "新增巡查对象") @ApiOperation(value = "新增巡查对象", notes = "新增巡查对象")
@GetMapping(value = "/xcdxIsExits", produces = "application/json;charset=UTF-8")
public CommonResponse xcdxIsExits(Long pointId,String equipMentId){
List<PointClassify> pointClassifies = iPointClassifyDao.queryByPointIdAndEquipmentId(pointId,equipMentId);
if (pointClassifies.size() > 0){
return CommonResponseUtil.success(false);
}
return CommonResponseUtil.success(true);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "新增巡查对象", notes = "新增巡查对象")
@PostMapping(value = "/addPointXcdxList", produces = "application/json;charset=UTF-8") @PostMapping(value = "/addPointXcdxList", produces = "application/json;charset=UTF-8")
public CommonResponse addPointXcdxList(@ApiParam(value = "新增巡查对象", required = true) @RequestBody List<PointInputItemNewVo> pointClassifys){ public CommonResponse addPointXcdxList(@ApiParam(value = "新增巡查对象", required = true) @RequestBody List<PointInputItemNewVo> pointClassifys){
......
...@@ -4,6 +4,7 @@ import java.util.HashMap; ...@@ -4,6 +4,7 @@ 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.mapper.BaseMapper;
import com.yeejoin.amos.patrol.business.vo.PointInputItemVo; import com.yeejoin.amos.patrol.business.vo.PointInputItemVo;
import com.yeejoin.amos.patrol.dao.entity.PointInputItem; import com.yeejoin.amos.patrol.dao.entity.PointInputItem;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
...@@ -15,7 +16,8 @@ import com.yeejoin.amos.patrol.dao.entity.InputItem; ...@@ -15,7 +16,8 @@ import com.yeejoin.amos.patrol.dao.entity.InputItem;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@Repository @Repository
public interface InputItemMapper extends BaseMapper { @Mapper
public interface InputItemMapper extends BaseMapper<InputItem> {
/** /**
* 新接口 * 新接口
...@@ -62,4 +64,9 @@ public interface InputItemMapper extends BaseMapper { ...@@ -62,4 +64,9 @@ public interface InputItemMapper extends BaseMapper {
public List<PointInputItemVo> queryCustomInputItemByPointId(@Param("classifyId") String classifyId ); public List<PointInputItemVo> queryCustomInputItemByPointId(@Param("classifyId") String classifyId );
public PointInputItemVo getInputItemByEquipmentName(@Param("equipmentName") String equipmentName ); public PointInputItemVo getInputItemByEquipmentName(@Param("equipmentName") String equipmentName );
void delPointInputItemById(@Param("ids") List<Long> ids);
void delRoutePointItemByItemId(@Param("ids") List<Long> ids);
} }
package com.yeejoin.amos.patrol.business.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.patrol.dao.entity.PointInputItem;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface PointInputItemMapper extends BaseMapper<PointInputItem> {
}
package com.yeejoin.amos.patrol.business.dao.mapper; package com.yeejoin.amos.patrol.business.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.patrol.dao.entity.RoutePointItem; import com.yeejoin.amos.patrol.dao.entity.RoutePointItem;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
public interface RoutePointItemMapper extends BaseMapper{ @Mapper
public interface RoutePointItemMapper extends BaseMapper<RoutePointItem> {
public void updateRoutePointItem( RoutePointItem pointItem); public void updateRoutePointItem( RoutePointItem pointItem);
......
...@@ -134,7 +134,7 @@ public class PointServiceImpl implements IPointService { ...@@ -134,7 +134,7 @@ public class PointServiceImpl implements IPointService {
@Override @Override
public void addPointClassifyByPointId(PointClassify pointClassify) { public void addPointClassifyByPointId(PointClassify pointClassify) {
iPointClassifyDao.save(pointClassify); iPointClassifyDao.saveAndFlush(pointClassify);
} }
......
...@@ -446,4 +446,19 @@ ...@@ -446,4 +446,19 @@
<select id="getAllCategoryName" resultType="java.util.Map"> <select id="getAllCategoryName" resultType="java.util.Map">
select code, `name` from wl_equipment_category select code, `name` from wl_equipment_category
</select> </select>
<delete id="delPointInputItemById">
DELETE FROM p_point_inputitem WHERE id IN
<foreach collection="ids" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</delete>
<delete id="delRoutePointItemByItemId">
DELETE FROM p_route_point_item WHERE point_input_item_id IN
<foreach collection="ids" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</delete>
</mapper> </mapper>
\ No newline at end of file
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