Commit ab449410 authored by chenzhao's avatar chenzhao

修改代码

parent 5a34a7e8
......@@ -131,7 +131,7 @@ public class CheckController extends AbstractBaseController {
param.setPageSize(commonPageable.getPageSize());
}
Page<CheckInfoVo> list = checkService.getCheckInfo(null,null,null,param);
Page<CheckInfoVo> list = checkService.getCheckInfoNew(null,null,null,param);
return CommonResponseUtil.success(list);
}
......
......@@ -30,6 +30,8 @@ public interface CheckMapper extends BaseMapper {
List<CheckInfoVo> getCheckInfo(CheckInfoPageParam param);
List<CheckInfoVo> getCheckInfoNew(CheckInfoPageParam param);
long getCheckInfoCount(CheckInfoPageParam param);
List<Map> queryUnqualifiedInputItem(@Param(value="checkId") int checkId);
......
......@@ -211,6 +211,60 @@ public class CheckServiceImpl implements ICheckService {
return new PageImpl<>(content, param, total);
}
public Page<CheckInfoVo> getCheckInfoNew(String toke,String product,String appKey,CheckInfoPageParam param) {
long total = checkMapper.getCheckInfoCount(param);
List<CheckInfoVo> content = Lists.newArrayList();
if (total == 0) {
return new PageImpl<>(content, param, total);
}
content = checkMapper.getCheckInfoNew(param);
if (!CollectionUtils.isEmpty(content)) {
Set<String> userIds = Sets.newHashSet(Lists.transform(content, CheckInfoVo::getUserId));
Set<String> deptIds = Sets.newHashSet(Lists.transform(content, CheckInfoVo::getDepId));
deptIds.remove("");
deptIds.remove(null);
String joinUserId="";
for (String userId:userIds) {
if(!ObjectUtils.isEmpty(userId)){
joinUserId=joinUserId+userId+",";
}
}
// 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));
// //deptMap = deptList.stream().collect(Collectors.toMap(DepartmentModel::getSequenceNbr, DepartmentModel::getDepartmentName));
//
// for (int i = 0; i < deptList.size(); i++) {
// deptMap.put(deptList.get(i).get("sequenceNbr").toString(), deptList.get(i).get("departmentName").toString());
// }
//
//
// }
// 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){
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));
// e.setDepartmentName(deptMapNew.get(e.getDepId()));
});
}
return new PageImpl<>(content, param, total);
}
@Override
@Transactional
public void saveCheckImg(List<CheckShot> imgList) {
......
......@@ -263,4 +263,6 @@ public interface ICheckService {
* @return
*/
List<HashMap<String,Object>> getEquipByCheckId(CheckDetailInputPageParam param);
Page<CheckInfoVo> getCheckInfoNew(String toke,String product,String appKey,CheckInfoPageParam param);
}
......@@ -198,6 +198,104 @@
</choose>
</select>
<select id="getCheckInfoNew" resultMap="checkInfoMap">
SELECT
a.id,
a.org_code,
a.point_id pointId,
b.name point_name,
b.is_fixed,
b.point_no pointNo,
a.user_id,
a.user_name,
a.dep_name department_name,
a.dep_id departmentId,
date_format(
`a`.`check_time`,
'%Y-%m-%d %H:%i:%s'
) AS `checkDate`,
date_format(
`a`.`upload_time`,
'%Y-%m-%d %H:%i:%s'
) AS `upload_time`,
(
CASE
WHEN `a`.`plan_task_detail_id` = 0 OR `a`.`plan_task_detail_id` is null
THEN '计划外完成'
WHEN `a`.`plan_task_detail_id` != 0 AND `a`.`is_ok` != 3
THEN '按时完成'
WHEN `a`.`is_ok` = 3
THEN '未执行'
END
) AS `Finish_Status`,
(
CASE
WHEN `a`.`is_ok` = 1
THEN '合格'
WHEN `a`.`is_ok` = 2
THEN '不合格'
WHEN `a`.`is_ok` = 3
THEN '漏检'
END
) as is_ok,
a.score,
d.`name` AS `route_name`,
a.check_mode,
e.`name` AS `plan_name`,
a.plan_task_id,
a.plan_id,
a.`route_id`,
b.`catalog_id`,
a.error,
a.remark
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 != ''">
and d.biz_org_code LIKE CONCAT(#{bizOrgCode},'%')
</if>
</trim>
order by ${orderBy}
<choose>
<when test="pageSize==-1"></when>
<when test="pageSize!=-1">limit #{offset},#{pageSize}</when>
</choose>
</select>
<select id="queryUnqualifiedInputItem" resultType="Map" parameterType="int">
SELECT
ii.name,
......
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