Commit da768e2c authored by chenzhao's avatar chenzhao

修改巡检记录列表接口

parent 4687dce0
......@@ -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);
......
......@@ -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);
......
......@@ -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));
......
......@@ -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>
......
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