Commit f90def4c authored by tianyiming's avatar tianyiming

两员配备-设备查询(可绑定、可解绑、所有)

parent 5e604e3e
package com.yeejoin.amos.boot.module.tcm.api.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* 用户信息
*/
@Data
@ApiModel(value = "TzsEquipLis", description = "设备列表(可绑定、可解绑)")
public class TzsEquipListDto {
@ApiModelProperty(value = "id")
private String id;
@ApiModelProperty(value = "内部编号")
private String innerCode ;
@ApiModelProperty(value = "所属单位")
private String unitName;
@ApiModelProperty(value = "使用登记证编号")
private String useOrgCode;
@ApiModelProperty(value = "设备种类")
private String equipType;
@ApiModelProperty(value = "监管码")
private String supervisorCode;
@ApiModelProperty(value = "96333码")
private String code96333;
@ApiModelProperty(value = "是否绑定")
private String isNotBind;
@ApiModelProperty(value = "安全员")
private String safety;
@ApiModelProperty(value = "安全员id")
private String userSeq;
}
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.tcm.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tcm.api.dto.TzsEquipListDto;
import com.yeejoin.amos.boot.module.tcm.api.dto.TzsUserInfoDto;
import com.yeejoin.amos.boot.module.tcm.api.entity.TzsUserInfo;
import org.apache.ibatis.annotations.Mapper;
......@@ -13,4 +14,10 @@ public interface TzsUserInfoMapper extends BaseMapper<TzsUserInfo> {
Page<TzsUserInfoDto> selectPageMessage(@Param("page") Page<TzsUserInfoDto> page, @Param("dto") TzsUserInfoDto dto);
Map<String, Integer> getArrangementStatistic(String companyCode);
Page<TzsEquipListDto> getAllEquipList(@Param("page") Page<TzsEquipListDto> page,
@Param("type") String type,
@Param("companyCode") String companyCode,
@Param("userSeq") String userSeq,
@Param("dto") TzsEquipListDto dto);
}
package com.yeejoin.amos.boot.module.tcm.api.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.amos.boot.module.tcm.api.dto.TzsEquipListDto;
import com.yeejoin.amos.boot.module.tcm.api.dto.TzsUserInfoDto;
import com.yeejoin.amos.boot.module.tcm.api.entity.TzsUserInfo;
import com.yeejoin.amos.boot.module.tcm.api.entity.TzsUserQualifications;
......@@ -29,4 +31,6 @@ public interface ITzsUserInfoService extends IService<TzsUserInfo> {
Map<String,Integer> getArrangementStatistic(String companyCode);
Map<String,Object> getCompanyType();
Page<TzsEquipListDto> getEquipList(String type,String userSeq,TzsEquipListDto dto, Page<TzsEquipListDto> page);
}
......@@ -66,4 +66,65 @@
AND "CLAIM_STATUS" = '已认领'
AND ibjui."SEQUENCE_NBR" NOT IN ( SELECT DISTINCT equip_id FROM tzs_user_equip WHERE credit_code = #{companyCode} )) notBindSum;
</select>
<select id="getAllEquipList" resultType="com.yeejoin.amos.boot.module.tcm.api.dto.TzsEquipListDto">
SELECT
"USE_INNER_CODE" innerCode,
"USE_UNIT_NAME" unitName,
"USE_ORG_CODE" useOrgCode,
tec.NAME equipType,
"SUPERVISORY_CODE" supervisorCode,
"CODE96333" code96333 ,
case when (SELECT count(1) FROM tzs_user_equip t1 LEFT JOIN tzs_user_info t2 on t1.user_seq = t2.sequence_nbr where equip_id = ibjui."SEQUENCE_NBR") >0 THEN 1 ELSE 0 end isNotBind,
(SELECT GROUP_CONCAT(t2.name) from tzs_user_equip t1 LEFT JOIN tzs_user_info t2 on t1.user_seq = t2.sequence_nbr where equip_id = ibjui."SEQUENCE_NBR") "safety"
FROM
"idx_biz_jg_use_info" ibjui
LEFT JOIN idx_biz_jg_other_info ibjoi ON ibjui."RECORD" = ibjoi."RECORD"
LEFT JOIN idx_biz_jg_register_info ibjri ON ibjui."RECORD" = ibjri."RECORD"
LEFT JOIN amos_tzs_biz.tz_equipment_category tec ON ibjri."EQU_LIST" = tec.code
WHERE
"USE_UNIT_CREDIT_CODE" = #{companyCode}
AND "CLAIM_STATUS" = '已认领'
<if test="type != '' and type != null and type == 'bind'">
AND ibjui."SEQUENCE_NBR" NOT IN (SELECT DISTINCT
equip_id
FROM
tzs_user_equip
WHERE
credit_code = #{companyCode}
AND user_seq = #{userSeq} UNION
( SELECT
equip_id
FROM
( SELECT COUNT ( equip_id ), equip_id FROM tzs_user_equip WHERE credit_code = #{companyCode} GROUP BY equip_id )
WHERE
COUNT =2 ))
</if>
<if test="type != '' and type != null and type == 'untie'">
AND ibjui."SEQUENCE_NBR" IN (SELECT DISTINCT equip_id
FROM tzs_user_equip
WHERE credit_code = #{companyCode} AND user_seq = #{userSeq})
</if>
<if test="dto.innerCode != '' and dto.innerCode != null">
and "USE_INNER_CODE" like concat('%',#{dto.innerCode},'%')
</if>
<if test="dto.useOrgCode != '' and dto.useOrgCode != null">
and "USE_ORG_CODE" like concat('%',#{dto.useOrgCode},'%')
</if>
<if test="dto.equipType != '' and dto.equipType != null">
and "EQU_LIST" = #{dto.equipType}
</if>
<if test="dto.supervisorCode != '' and dto.supervisorCode != null">
and "SUPERVISORY_CODE" like concat('%',#{dto.supervisorCode},'%')
</if>
<if test="dto.code96333 != '' and dto.code96333 != null">
and "CODE96333" like concat('%',#{dto.code96333},'%')
</if>
<if test="dto.isNotBind != '' and dto.isNotBind != null and dto.isNotBind == 1">
AND ibjui."SEQUENCE_NBR" IN ( SELECT DISTINCT equip_id FROM tzs_user_equip WHERE credit_code = #{companyCode} )
</if>
<if test="dto.isNotBind != '' and dto.isNotBind != null and dto.isNotBind == 0">
AND ibjui."SEQUENCE_NBR" NOT IN (SELECT DISTINCT equip_id FROM tzs_user_equip WHERE credit_code = #{companyCode} )
</if>
</select>
</mapper>
\ No newline at end of file
......@@ -8,6 +8,7 @@ import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.tcm.api.dto.TzsEquipListDto;
import com.yeejoin.amos.boot.module.tcm.api.dto.TzsUserInfoDto;
import com.yeejoin.amos.boot.module.tcm.api.entity.TzsUserInfo;
import com.yeejoin.amos.boot.module.tcm.api.entity.TzsUserQualifications;
......@@ -189,4 +190,19 @@ public class TzsUserInfoController extends BaseController {
return ResponseHelper.buildResponse(tzsUserInfoService.getCompanyType());
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getEquipList")
@ApiOperation(httpMethod = "GET", value = "设备查询(可绑定、可解绑)", notes = "设备查询(可绑定、可解绑)")
public ResponseModel<IPage<TzsEquipListDto>> getEquipList(@RequestParam(value = "type") String type,
@RequestParam(value = "userSeq") String userSeq,
@RequestParam(value = "current") String current,
@RequestParam(value = "size") String size,
TzsEquipListDto dto) {
Page<TzsEquipListDto> page = new Page<>();
page.setCurrent(Long.parseLong(current));
page.setSize(Long.parseLong(size));
return ResponseHelper.buildResponse(tzsUserInfoService.getEquipList(type, userSeq, dto, page));
}
}
......@@ -5,12 +5,12 @@ import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.CompanyBo;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.tcm.api.dto.TzsEquipListDto;
import com.yeejoin.amos.boot.module.tcm.api.dto.TzsUserInfoDto;
import com.yeejoin.amos.boot.module.tcm.api.entity.*;
import com.yeejoin.amos.boot.module.tcm.api.enums.EquipmentClassifityEnum;
......@@ -336,4 +336,16 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
result.put("companyType",companyType);
return result;
}
@Override
public Page<TzsEquipListDto> getEquipList(String type,String userSeq,TzsEquipListDto dto, Page<TzsEquipListDto> page) {
List<CompanyModel> companyModels = FeignUtil.remoteCall(()->Privilege.companyClient.queryListByChild(RequestContext.getExeUserId()));
if(companyModels.isEmpty()){
throw new BadRequest("未指定人员归属单位信息");
}
String companyCode = companyModels.get(0).getCompanyCode();
Page<TzsEquipListDto> tzsUserInfoDtoPage;
tzsUserInfoDtoPage = tzsUserInfoMapper.getAllEquipList(page, type, companyCode, userSeq, dto);
return tzsUserInfoDtoPage;
}
}
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