Commit 774d21e9 authored by tangwei's avatar tangwei

Merge branch 'develop_dl_plan6_temp' of…

Merge branch 'develop_dl_plan6_temp' of http://39.98.45.134:8090/moa/amos-boot-biz into develop_dl_plan6_temp
parents 4e91364f da768e2c
......@@ -339,7 +339,7 @@ public class RouteServiceImpl implements IRouteService {
routePointItem.setPointInputItemId(pointInputItem.getId());
routePointItem.setRoutePointId(routePointId);
routePointItem.setRoutePoint(routePoint);
routePointItem.setPointClassifyId(Long.valueOf(pointInputItem.getClassifyIds()));
routePointList.add(routePointItem);
}
iRoutePointItemDao.saveAll(routePointList);
......
......@@ -79,10 +79,8 @@ public class InputItemController extends AbstractBaseController {
@ApiParam(value = "组合查询条件", required = false, defaultValue = "[]") @RequestBody(required = false) InputItemPageParam criterias,
@ApiParam(value = "分页参数", required = false, defaultValue = "current=0&pageSize=10或pageNumber0&pageSize=10") CommonPageable pageable) {
ReginParams reginParams = getSelectedOrgInfo();
ResponseModel<Object> companyByBizOrgCodeList = jcsFeignClient.getCompanyByBizOrgCodeList(reginParams.getPersonIdentity().getBizOrgCode());
//登录人可看到单位级别下的所有检查项
//查询向上查询所属单位的bizOrgCode
String bizOrgCode = ((Map<String, Object>) companyByBizOrgCodeList.getResult()).get("bizOrgCode").toString();
String bizOrgCode = reginParams.getPersonIdentity().getCompanyBizOrgCode();
criterias.setBizOrgCode(bizOrgCode);
if (pageable != null) {
criterias.setPageNumber(pageable.getPageNumber()-1);
......
......@@ -1280,6 +1280,16 @@ public class PointController extends AbstractBaseController {
return CommonResponseUtil.success(iPointService.queryItemList4RoutePoint(pointId, classifyId));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "新*查询巡检点对应设备列表新", notes = "新*查询巡检点对应设备列表新")
@GetMapping(value = "/newQueryByIds", produces = "application/json;charset=UTF-8")
public CommonResponse queryItemList4RoutePointNew(
@ApiParam(value = "巡检点ID") @RequestParam(value = "pointId") Long pointId,
@ApiParam(value = "设备ID") @RequestParam(value = "classifyId") Long classifyId,
@ApiParam(value = "路线ID") @RequestParam(value = "routeId") Long routeId) {
return CommonResponseUtil.success(iPointService.queryItemList4RoutePointNew(routeId,pointId, classifyId));
}
/**
* 更新巡检点
*
......
......@@ -30,6 +30,8 @@ public interface CheckMapper extends BaseMapper {
List<CheckInfoVo> getCheckInfo(CheckInfoPageParam param);
long getCheckInfoCount(CheckInfoPageParam param);
List<Map> queryUnqualifiedInputItem(@Param(value="checkId") int checkId);
List<Map> queryCheckPointInputItem(@Param(value="planTaskId") int planTaskId, @Param(value="pointId") int pointId);
......
......@@ -51,4 +51,7 @@ public interface IPointInputItemDao extends BaseDao<PointInputItem, Long> {
@Transactional
@Query(value = "DELETE FROM p_point_inputitem WHERE classify_ids IN (?1)", nativeQuery = true)
void deleteClassifyId(Long classifyId);
@Query(value = "SELECT input_item_id FROM p_point_inputitem WHERE id IN (?1) ", nativeQuery = true)
List<String> selectItemIdByid(List<String> ids);
}
......@@ -52,5 +52,8 @@ public interface IRoutePointItemDao extends BaseDao<RoutePointItem, Long> {
@Query(value = "SELECT prpi.* FROM p_route_point_item prpi LEFT JOIN p_route_point prp ON prp.id = prpi.route_point_id WHERE prp.point_id = ?1", nativeQuery = true)
List<RoutePointItem> getRoutePointItemByPointId(Long pointId);
@Modifying
@Transactional
@Query(value = "SELECT point_input_item_id from p_route_point_item WHERE route_point_id in (?1)", nativeQuery = true)
List<String> selectByroutePointIds(List<String> routePointIds);
}
......@@ -19,6 +19,7 @@ import com.alibaba.fastjson.JSON;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.MessageModel;
import com.yeejoin.amos.patrol.business.feign.JcsFeignClient;
import com.yeejoin.amos.patrol.dao.entity.Plan;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
......@@ -121,6 +122,8 @@ public class CheckServiceImpl implements ICheckService {
IPlanTaskDao planTaskDao;
@Autowired
PlanTaskMapper planTaskMapper;
@Autowired
JcsFeignClient jcsFeignClient;
@Autowired
IInputItemDao inputItemDao;
......@@ -155,7 +158,7 @@ public class CheckServiceImpl implements ICheckService {
@Override
public Page<CheckInfoVo> getCheckInfo(String toke,String product,String appKey,CheckInfoPageParam param) {
long total = checkMapper.countCheckInfoData(param);
long total = checkMapper.getCheckInfoCount(param);
List<CheckInfoVo> content = Lists.newArrayList();
if (total == 0) {
return new PageImpl<>(content, param, total);
......@@ -173,7 +176,7 @@ public class CheckServiceImpl implements ICheckService {
joinUserId=joinUserId+userId+",";
}
}
List<AgencyUserModel> userModels = remoteSecurityService.listUserByUserIds( toke, product, appKey,joinUserId);
// List<AgencyUserModel> userModels = remoteSecurityService.listUserByUserIds( toke, product, appKey,joinUserId);
Map<String, String> deptMap = new HashMap<String,String>();
// if(!CollectionUtils.isEmpty(deptIds)){
// List<LinkedHashMap> deptList = remoteSecurityService.listDepartmentByDeptIds( toke, product, appKey,Joiner.on(",").join(deptIds));
......@@ -185,15 +188,20 @@ public class CheckServiceImpl implements ICheckService {
//
//
// }
Map<String,String> userModelMap = userModels.stream().collect(Collectors.toMap(AgencyUserModel::getUserId,AgencyUserModel::getRealName ,(k1,k2)->k2));
// Map<String,String> userModelMap = userModels.stream().collect(Collectors.toMap(AgencyUserModel::getUserId,AgencyUserModel::getRealName ,(k1,k2)->k2));
Map<String, String> deptMapNew= deptMap;
List<String> userNames = new ArrayList<>();
content.forEach(e -> {
userNames.clear();
List<String> userIds1 = Arrays.asList(e.getUserId().split(","));
for(String userId : userIds1){
userNames.add(userModelMap.get(userId));
FeignClientResult result = jcsFeignClient.selectById(userId);
Object result1 = result.getResult();
String personName = ((Map<String, Object>) result1).get("personName").toString();
userNames.add(personName);
}
userNames.remove(null);
e.setUserName(Joiner.on(",").join(userNames));
......
......@@ -789,6 +789,32 @@ public class PointServiceImpl implements IPointService {
}
@Override
public List queryItemList4RoutePointNew(Long routeId,Long pointId, Long classifyId) {
if (pointId == null || classifyId == null) {
throw new RuntimeException("查询条件有误");
}
List<Map<String, Object>> resList = pointMapper.queryItemList4RoutePoint(pointId, classifyId);
//给前端返回是否绑定标识
Long[] longs = new Long[]{pointId};
List<RoutePoint> list = iRoutePointDao.queryRoutePoint(routeId, longs);
List<String> rouPonintId = new ArrayList<>();
list.forEach(e->rouPonintId.add(String.valueOf(e.getId())));
List<String> strings = iRoutePointItemDao.selectByroutePointIds(rouPonintId);
String ids = StringUtils.join(strings.toArray(), ",");
resList.forEach(e->{
if (ids.contains(e.get("itemId").toString())){
e.put("checked",false);
}else {
e.put("checked",true);
}
});
return resList;
}
@Override
public Page<List<Point>> queryPointInfoPage(List<DaoCriteria> criterias) {
// TODO Auto-generated method stub
return null;
......
......@@ -98,6 +98,8 @@ public interface IPointService {
*/
Point queryPointById(Long id);
List queryItemList4RoutePointNew(Long routeId, Long pointId, Long classifyId);
/**
* 查询巡检点信息
*/
......
......@@ -62,6 +62,53 @@
</trim>
</select>
<!--记录查询 -->
<select id="getCheckInfoCount" resultType="long">
SELECT
count(a.id)
FROM
`p_check` `a`
LEFT JOIN `p_point` `b` ON `a`.`point_id` = `b`.`id`
LEFT JOIN `p_route` `d` ON `a`.`route_id` = `d`.`id`
LEFT JOIN `p_plan` `e` ON `a`.`plan_id` = `e`.`id`
<if test="dangerId != null and dangerId != ''">
LEFT JOIN ( SELECT check_id, GROUP_CONCAT( latent_danger_id ) dangerIds FROM p_latent_danger_patrol GROUP BY check_id ) t ON t.check_id = a.id
</if>
<trim prefix="WHERE" prefixOverrides="AND ">
<if test="beginDate!=null and endDate!=null">and a.check_time BETWEEN #{beginDate} and #{endDate}</if>
<!-- <if test="endDate!=null"> and #{endDate} <![CDATA[>=]]> a.check_time </if> -->
<if test="userName!=null">and a.user_name like concat(concat("%",#{userName}),"%")</if>
<if test="pointName!=null">and b.name like concat(concat("%",#{pointName}),"%")</if>
<if test="pointNo!=null">and b.point_no like concat('%',#{pointNo},'%')</if>
<if test="isFixed!=null">and b.is_fixed = #{isFixed}</if>
<if test="isOK!=null">and a.is_OK = #{isOK}</if>
<if test="planId!=null">and a.plan_Id = #{planId}</if>
<if test="planTaskId!=null">and a.plan_task_id = #{planTaskId}</if>
<if test="userId!=null">and find_in_set(#{userId}, a.user_id) > 0</if>
<if test="routeId!=null">and a.route_Id = #{routeId}</if>
<if test="catalogId!=null">and b.Catalog_Id = #{catalogId}</if>
<if test="orgCode!=null">and (a.org_Code like concat (#{orgCode},"-%")or a.org_Code= #{orgCode})</if>
<if test="pointId!=null">and a.point_id = #{pointId}</if>
<if test="checkTime!=null">and TO_DAYS(a.check_time) = TO_DAYS('${checkTime}')</if>
<if test="departmentId!=null and departmentId!='-1'"> and find_in_set(#{departmentId}, a.dep_id) > 0</if>
<if test="checkType == '计划检查'">and a.plan_task_id &gt; 0</if>
<if test="checkType == '无计划检查'">and a.plan_task_id &lt;= 0</if>
<choose>
<when test="finishStatus == 0">and (`a`.`plan_task_detail_id` = 0 OR `a`.`plan_task_detail_id` is
null)
</when>
<when test="finishStatus == 1">and (`a`.`plan_task_detail_id` != 0 AND `a`.`is_ok` != 3)</when>
<when test="finishStatus == 2">and `a`.`is_ok` = 3</when>
</choose>
<if test="dangerId != null and dangerId != ''">
and FIND_IN_SET(#{dangerId}, t.dangerIds)
</if>
<if test="bizOrgCode != null and bizOrgCode != ''">
d.biz_org_code LIKE CONCAT(#{bizOrgCode},'%')
</if>
</trim>
</select>
<select id="getCheckInfo" resultMap="checkInfoMap">
SELECT
a.id,
......@@ -140,6 +187,9 @@
<if test="dangerId != null and dangerId != ''">
and FIND_IN_SET(#{dangerId}, t.dangerIds)
</if>
<if test="bizOrgCode != null and bizOrgCode != ''">
d.biz_org_code LIKE CONCAT(#{bizOrgCode},'%')
</if>
</trim>
order by ${orderBy}
<choose>
......
......@@ -402,6 +402,6 @@
</select>
<select id="queryRoutesByOrgCode" resultType="com.yeejoin.amos.patrol.dao.entity.Route">
SELECT * FROM p_route r where r.is_delete = 0 and r.biz_org_code like CONCAT( #{orgCode}, '%'))
SELECT * FROM p_route r where r.is_delete = 0 and r.biz_org_code like CONCAT( #{orgCode}, '%')
</select>
</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