Commit 352dcbb6 authored by suhuiguang's avatar suhuiguang

1.检验检测检验结果

parent 89f395c8
......@@ -16,4 +16,6 @@ public interface JyjcInspectionResultMapper extends BaseMapper<JyjcInspectionRes
Page<JyjcInspectionResultModel> selectJyjcInspectionResultpPage(@Param("page") Page<JyjcInspectionResultModel> page, @Param("jyjcInspectionResultModel") JyjcInspectionResultModel jyjcInspectionResultModel);
Page<JyjcInspectionResultModel> selectForPage(@Param("page") Page<JyjcInspectionResultModel> page, @Param("jyjcInspectionResultModel") JyjcInspectionResultModel jyjcInspectionResultModel,@Param("identity") String identity);
}
......@@ -35,8 +35,7 @@ public class JyjcInspectionResultModel extends BaseModel {
@ApiModelProperty(value = "报检单位编号")
private String applicationUnitCode;
//监管码
@ApiModelProperty(value = "设备唯一标识")
@ApiModelProperty(value = "设备唯一标识, 监管码")
private String equipUnicode;
@ApiModelProperty(value = "检验结果状态(已出2、未出1)")
......
......@@ -58,4 +58,69 @@
</where>
ORDER BY application_date DESC
</select>
<select id="selectForPage"
resultType="com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionResultModel">
select res.sequence_nbr, res.inspection_unit_code, res.application_no, res.application_unit_code,
res.equip_unicode, res.result_status, res.license_number, res.result_no, res.inspector, res.inner_person_code,
res.inspection_conclusion, res.inspection_date, res.next_inspection_date, res.inspection_start_date,
res.inspection_end_date, res.inspection_result_summary, res.non_conformance, res.remark,
res.rec_user_id, res.rec_date, res.biz_type,res.equ_category, res.inspection_type, res.inspection_type_name,
res.application_date,use_unit_name, use_unit_credit_code, province_name, city_name, county_name, street_name, equ_code, use_inner_code, ibjri.equ_list,
tec1.name equ_list_name, ibjri.equ_category , ibjoi.SUPERVISORY_CODE supervisoryCode
, use_org_code, res.equ_define, ibjui.ADDRESS equUseAddress, bei.use_unit inspectionUnitName, bei1.use_unit applicationUnitName, cdb.name inspectionTypeName
from tz_jyjc_inspection_result res
left join idx_biz_jg_other_info ibjoi on res.equip_unicode = ibjoi.record
left join idx_biz_jg_use_info ibjui on ibjui.record = res.equip_unicode
left join idx_biz_jg_register_info ibjri on ibjui.record = ibjri.record
left join tz_equipment_category tec on ibjri.equ_category = tec.code
left join tz_equipment_category tec1 on ibjri.equ_list = tec1.code
left join tz_base_enterprise_info bei on res.inspection_unit_code = bei.use_code
left join tz_base_enterprise_info bei1 on res.application_unit_code = bei1.use_code
left join cb_data_dictionary cdb on res.inspection_type = cdb.code
<where>
<if test="jyjcInspectionResultModel.applicationNo != '' and jyjcInspectionResultModel.applicationNo != null">
and res.application_no like concat('%',#{jyjcInspectionResultModel.applicationNo},'%')
</if>
<if test="jyjcInspectionResultModel.applicationUnitCode != '' and jyjcInspectionResultModel.applicationUnitCode != null">
and res.application_unit_code = #{jyjcInspectionResultModel.applicationUnitCode}
</if>
<if test="jyjcInspectionResultModel.useInnerCode != '' and jyjcInspectionResultModel.useInnerCode != null">
and use_inner_code like concat('%',#{jyjcInspectionResultModel.useInnerCode},'%')
</if>
<if test="jyjcInspectionResultModel.equCode != '' and jyjcInspectionResultModel.equCode != null">
and equ_code like concat('%',#{jyjcInspectionResultModel.equCode},'%')
</if>
<if test="jyjcInspectionResultModel.equipUnicode != '' and jyjcInspectionResultModel.equipUnicode != null">
and res.equip_unicode like concat('%',#{jyjcInspectionResultModel.equipUnicode},'%')
</if>
<if test="jyjcInspectionResultModel.equCategory != '' and jyjcInspectionResultModel.equCategory != null">
and ibjri.equ_category = #{jyjcInspectionResultModel.equCategory}
</if>
<if test="jyjcInspectionResultModel.inspectionType != '' and jyjcInspectionResultModel.inspectionType != null">
and res.inspection_type = #{jyjcInspectionResultModel.inspectionType}
</if>
<if test="jyjcInspectionResultModel.applicationDate!=null">
AND TO_DAYS(res.application_date) = TO_DAYS(#{jyjcInspectionResultModel.applicationDate})
</if>
<if test="jyjcInspectionResultModel.useUnitCreditCode != '' and jyjcInspectionResultModel.useUnitCreditCode != null">
and use_unit_credit_code like concat('%',#{jyjcInspectionResultModel.useUnitCreditCode},'%')
</if>
<choose>
<when test="identity == 'apply'">
and use_org_code like concat('%',#{jyjcInspectionResultModel.useOrgCode},'%')
</when>
<when test="identity == 'receive'">
and res.inspection_unit_code = #{jyjcInspectionResultModel.inspectionUnitCode}
</when>
<when test="identity == 'all'">
and (use_org_code like concat('%',#{jyjcInspectionResultModel.useOrgCode},'%') or es.inspection_unit_code = #{jyjcInspectionResultModel.inspectionUnitCode})
</when>
<otherwise>
1 = 2
</otherwise>
</choose>
</where>
ORDER BY application_date DESC
</select>
</mapper>
......@@ -136,7 +136,21 @@ public class JyjcInspectionResultController extends BaseController {
}
/**
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/page")
@ApiOperation(httpMethod = "POST", value = "列表页面(检验检测单位、使用单位共用)", notes = "列表页面(检验检测单位、使用单位共用)")
public ResponseModel<Page<JyjcInspectionResultModel>> pageList(
@RequestParam int current, @RequestParam int size,
@RequestBody JyjcInspectionResultModel model) {
Page<JyjcInspectionResultModel> page = new Page<>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(jyjcInspectionResultServiceImpl.queryForPageList(page, model));
}
/**
* 检验结果-上传结果和编辑结果
*
* @return
......
......@@ -110,14 +110,61 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
}
Page<JyjcInspectionResultModel> resultPage = resultMapper.selectJyjcInspectionResultpPage(page, model);
resultPage.getRecords().stream().forEach(v -> {
if (ResultStatusEnum.NO_RESULT.getCode().equals(v.getResultStatus()))
if (ResultStatusEnum.NO_RESULT.getCode().equals(v.getResultStatus())) {
v.setResultStatusName(ResultStatusEnum.NO_RESULT.getName());
if (ResultStatusEnum.YES_RESULT.getCode().equals(v.getResultStatus()))
}
if (ResultStatusEnum.YES_RESULT.getCode().equals(v.getResultStatus())) {
v.setResultStatusName(ResultStatusEnum.YES_RESULT.getName());
}
});
return resultPage;
}
public Page<JyjcInspectionResultModel> queryForPageList(Page<JyjcInspectionResultModel> page, JyjcInspectionResultModel model) {
ReginParams reginParams = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(),
RequestContext.getToken())).toString(), ReginParams.class);
if (ObjectUtils.isEmpty(model)) {
model = new JyjcInspectionResultModel();
}
// 判断当前登录人身份(报检机构、接收机构、即时报检又是接收机构、都不是(不存在此情况))
String identity= this.getCompanyIdentityByType(reginParams.getCompany().getCompanyType());
Page<JyjcInspectionResultModel> resultPage = resultMapper.selectForPage(page, model, identity);
resultPage.getRecords().forEach(v -> {
if (ResultStatusEnum.NO_RESULT.getCode().equals(v.getResultStatus())) {
v.setResultStatusName(ResultStatusEnum.NO_RESULT.getName());
}
if (ResultStatusEnum.YES_RESULT.getCode().equals(v.getResultStatus())) {
v.setResultStatusName(ResultStatusEnum.YES_RESULT.getName());
}
});
return resultPage;
}
private String getCompanyIdentityByType(String companyType){
// 可发起单位的单位类型(角色与单位类型已绑定,在业务系统增加的账号不会出现角色与的单位类型不匹配场景)
String[] applyIdentityDefine = {"使用单位", "安装改造维修单位"};
// 可进行检验检测申请接收的单位类型,在业务系统增加的账号不会出现角色与的单位类型不匹配场景
String[] receiveIdentityDefine = {"检验检测机构"};
boolean isApplyIdentityMatch = false;
boolean isReceiveIdentityMatch = false;
if(Arrays.stream(applyIdentityDefine).anyMatch(companyType::contains)){
isApplyIdentityMatch = true;
}
if(Arrays.stream(receiveIdentityDefine).anyMatch(companyType::contains)){
isReceiveIdentityMatch = true;
}
if(isApplyIdentityMatch && !isReceiveIdentityMatch){
return "apply";
}
if(!isApplyIdentityMatch && isReceiveIdentityMatch){
return "receive";
}
if(isApplyIdentityMatch){
return "all";
}
return "no";
}
@Transactional(rollbackFor = Exception.class)
public JyjcInspectionResultModel updateJyjcInspectionResult(Map<String, Map<String, Object>> tableModel) {
......
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