Commit e7299805 authored by suhuiguang's avatar suhuiguang

1.检验检测大屏接口接口开发

parent 4994c46c
package com.yeejoin.amos.boot.module.jyjc.api.dto;
import lombok.Data;
/**
* 机构进行检验时效统计对象
*
* @author Administrator
*/
@Data
public class InspectionTimelinesDto {
private String city;
private String name;
private String unitCode;
private Long count;
}
package com.yeejoin.amos.boot.module.jyjc.api.dto;
import lombok.Data;
/**
* 检验机构公示
*
* @author Administrator
*/
@Data
public class PublicityInspectOrgInfoDto {
/**
* 单位名称
*/
private String unitName;
/**
* 单位编码
*/
private String unitCode;
/**
* 核准代码
*/
private String approvalNumber;
/**
* 核准有效期
*/
private String aapprovalDeadline;
/**
* 业务有限期
*/
private String businessDeadline;
}
...@@ -219,6 +219,12 @@ public class JyjcInspectionApplication extends BaseEntity { ...@@ -219,6 +219,12 @@ public class JyjcInspectionApplication extends BaseEntity {
private JSONObject planData; private JSONObject planData;
/** /**
* 计划下发日期,统计办理时效使用
*/
@TableField(value = "plan_create_date")
private Date planCreateDate;
/**
* 是否必须处理: true-必须处理,false-可不予受理 * 是否必须处理: true-必须处理,false-可不予受理
*/ */
@TableField(value = "is_must_accept") @TableField(value = "is_must_accept")
......
...@@ -215,4 +215,11 @@ public class JyjcInspectionResult extends BaseEntity { ...@@ -215,4 +215,11 @@ public class JyjcInspectionResult extends BaseEntity {
*/ */
@TableField(value = "safety_level") @TableField(value = "safety_level")
private String safetyLevel; private String safetyLevel;
/**
* 计划下发日期,,统计办理时效使用"
*/
@TableField(value = "plan_create_date")
private Date planCreateDate;
} }
...@@ -19,12 +19,12 @@ public enum JYJCTypeEnum { ...@@ -19,12 +19,12 @@ public enum JYJCTypeEnum {
/** /**
* 检验检测类型 * 检验检测类型
*/ */
DTJC("DTJC", "电梯检测", "jc", BizTypeEnum.DETECTION.getCode()), AZJDJY("AZJDJY", "安装监督检验", "jy", BizTypeEnum.SUPERVISE.getCode()),
DQJY("DQJY", "定期检验", "jy", BizTypeEnum.FIRST_INSPECTION.getCode()),
SCJY("SCJY", "首次检验", "jy", BizTypeEnum.FIRST_INSPECTION.getCode()),
WXJDJY("WXJDJY", "维修监督检验", "jy", BizTypeEnum.SUPERVISE.getCode()),
GZJDJY("GZJDJY", "改造监督检验", "jy", BizTypeEnum.SUPERVISE.getCode()), GZJDJY("GZJDJY", "改造监督检验", "jy", BizTypeEnum.SUPERVISE.getCode()),
AZJDJY("AZJDJY", "安装监督检验", "jy", BizTypeEnum.SUPERVISE.getCode()); WXJDJY("WXJDJY", "维修监督检验", "jy", BizTypeEnum.SUPERVISE.getCode()),
SCJY("SCJY", "首次检验", "jy", BizTypeEnum.FIRST_INSPECTION.getCode()),
DQJY("DQJY", "定期检验", "jy", BizTypeEnum.FIRST_INSPECTION.getCode()),
DTJC("DTJC", "电梯检测", "jc", BizTypeEnum.DETECTION.getCode());
private final String code; private final String code;
private final String name; private final String name;
......
...@@ -42,4 +42,6 @@ public interface JyjcBaseMapper { ...@@ -42,4 +42,6 @@ public interface JyjcBaseMapper {
List<TzsUserInfoDto> selectUserByCompanyCodes(@Param("companyCodes") List<String> companyCodes); List<TzsUserInfoDto> selectUserByCompanyCodes(@Param("companyCodes") List<String> companyCodes);
CompanyModel selectOneCompanyByCode(String companyCode); CompanyModel selectOneCompanyByCode(String companyCode);
String getOrgCodeByCompanyCode(String companyCode);
} }
...@@ -2,11 +2,13 @@ package com.yeejoin.amos.boot.module.jyjc.api.mapper; ...@@ -2,11 +2,13 @@ package com.yeejoin.amos.boot.module.jyjc.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.dto.CountDto;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionApplication; import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionApplication;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionApplicationEquipDto; import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionApplicationEquipDto;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionApplicationEquipModel; import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionApplicationEquipModel;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionApplicationModel; import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionApplicationModel;
import org.springframework.data.repository.query.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
...@@ -44,5 +46,23 @@ public interface JyjcInspectionApplicationMapper extends BaseMapper<JyjcInspecti ...@@ -44,5 +46,23 @@ public interface JyjcInspectionApplicationMapper extends BaseMapper<JyjcInspecti
* @param equips 需要判断的设备 * @param equips 需要判断的设备
* @return 在流程中的设备records * @return 在流程中的设备records
*/ */
List<String> queryRecordListInFlowing(@org.apache.ibatis.annotations.Param("equips") List<JyjcInspectionApplicationEquipDto> equips); List<String> queryRecordListInFlowing(@Param("equips") List<JyjcInspectionApplicationEquipDto> equips);
/**
* 按照检验类型、机构、时间统计检验数量(流程中及已完成的)
*
* @param orgCode 区域对应公司orgCode
* @param dpFilterParamDto 过滤条件
* @return 统计信息
*/
List<CountDto> queryAllFlowingAndFinishedInspectApp(@Param("orgCode") String orgCode, @Param("dto") DPFilterParamDto dpFilterParamDto);
/**
* 查询待出结果的报检单据数量
*
* @param orgCode 区域对应公司orgCode
* @param dpFilterParamDto 过滤条件
* @return 统计信息
*/
List<CountDto> queryAllPendingResultInspectApp(@Param("orgCode") String orgCode, @Param("dto") DPFilterParamDto dpFilterParamDto);
} }
...@@ -2,10 +2,14 @@ package com.yeejoin.amos.boot.module.jyjc.api.mapper; ...@@ -2,10 +2,14 @@ package com.yeejoin.amos.boot.module.jyjc.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto;
import com.yeejoin.amos.boot.module.jyjc.api.dto.InspectionTimelinesDto;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResult; import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcInspectionResult;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionResultModel; import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcInspectionResultModel;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* 业务开通申请表 Mapper 接口 * 业务开通申请表 Mapper 接口
* *
...@@ -18,4 +22,5 @@ public interface JyjcInspectionResultMapper extends BaseMapper<JyjcInspectionRes ...@@ -18,4 +22,5 @@ public interface JyjcInspectionResultMapper extends BaseMapper<JyjcInspectionRes
Page<JyjcInspectionResultModel> selectForPage(@Param("page") Page<JyjcInspectionResultModel> page, @Param("jyjcInspectionResultModel") JyjcInspectionResultModel jyjcInspectionResultModel,@Param("identity") String identity); Page<JyjcInspectionResultModel> selectForPage(@Param("page") Page<JyjcInspectionResultModel> page, @Param("jyjcInspectionResultModel") JyjcInspectionResultModel jyjcInspectionResultModel,@Param("identity") String identity);
List<InspectionTimelinesDto> queryInspectionTimelinessTopXX(@Param("top") String top,@Param("orgCode") String orgCode);
} }
package com.yeejoin.amos.boot.module.jyjc.api.mapper; package com.yeejoin.amos.boot.module.jyjc.api.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jyjc.api.dto.PublicityInspectOrgInfoDto;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcOpeningApplicationModel; import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcOpeningApplicationModel;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcOpeningApplication; import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcOpeningApplication;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
...@@ -26,4 +27,11 @@ public interface JyjcOpeningApplicationMapper extends BaseMapper<JyjcOpeningAppl ...@@ -26,4 +27,11 @@ public interface JyjcOpeningApplicationMapper extends BaseMapper<JyjcOpeningAppl
void updatePromoter(@Param("id") Long id); void updatePromoter(@Param("id") Long id);
List<Long> selectOverdueData(); List<Long> selectOverdueData();
/**
* 检验机构公示
* @param orgCode 区域对应的orgCode
* @return List<PublicityInspectOrgInfoDto>
*/
List<PublicityInspectOrgInfoDto> queryInspectionOrgListForPublicity(String orgCode);
} }
...@@ -166,6 +166,9 @@ public class JyjcInspectionApplicationModel extends BaseModel { ...@@ -166,6 +166,9 @@ public class JyjcInspectionApplicationModel extends BaseModel {
@ApiModelProperty(value = "是否已经进行计划排期") @ApiModelProperty(value = "是否已经进行计划排期")
private Boolean isExistPlanData; private Boolean isExistPlanData;
@ApiModelProperty(value = "计划下发日期,统计办理时效使用,来源JyjcInspectionApplication.planCreateDate")
private Date planCreateDate;
/** /**
* 是否必须处理: true-必须处理,false-可不予受理 * 是否必须处理: true-必须处理,false-可不予受理
*/ */
......
...@@ -150,6 +150,11 @@ public class JyjcInspectionResultModel extends BaseModel { ...@@ -150,6 +150,11 @@ public class JyjcInspectionResultModel extends BaseModel {
@ApiModelProperty(value = "监管码") @ApiModelProperty(value = "监管码")
private String supervisoryCode; private String supervisoryCode;
@ApiModelProperty(value = "计划下发日期,统计办理时效使用")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date planCreateDate;
/** /**
* 校验检验系统唯一流水号,排查问题,跟踪问题使用 * 校验检验系统唯一流水号,排查问题,跟踪问题使用
*/ */
......
...@@ -85,6 +85,9 @@ ...@@ -85,6 +85,9 @@
WHERE WHERE
c.company_code =#{companyCode} c.company_code =#{companyCode}
</select> </select>
<select id="getOrgCodeByCompanyCode" resultType="java.lang.String">
select org_code from privilege_company where company_code = #{companyCode} limit 1
</select>
</mapper> </mapper>
...@@ -216,4 +216,32 @@ ...@@ -216,4 +216,32 @@
UPDATE tz_jyjc_inspection_application set promoter = null UPDATE tz_jyjc_inspection_application set promoter = null
where sequence_nbr = #{id} where sequence_nbr = #{id}
</update> </update>
<select id="queryAllFlowingAndFinishedInspectApp" resultType="com.yeejoin.amos.boot.biz.common.dto.CountDto">
SELECT
count(1) as longValue,
a.inspection_type as keyStr
FROM
"tz_jyjc_inspection_application" a,
tz_base_enterprise_info b
where
a.inspection_unit_code= b.use_unit_code
and b.supervise_org_code like CONCAT(#{orgCode}, '%')
and a.status != '6610' and a.status != '6615'
and date_ge(CAST(a.application_date as date),#{dto.beginDate})
and date_le(CAST(a.application_date as date),#{dto.endDate})
group by a.inspection_type
</select>
<select id="queryAllPendingResultInspectApp" resultType="com.yeejoin.amos.boot.biz.common.dto.CountDto">
SELECT
count(1) as longValue,
a.inspection_type as keyStr
FROM
tz_jyjc_inspection_application a,
tz_base_enterprise_info b
where
a.inspection_unit_code= b.use_unit_code
and b.supervise_org_code like CONCAT(#{orgCode}, '%') and a.status = '6616'
and EXISTS (select 1 from tz_jyjc_inspection_result r where r.result_status='1' and a.application_no = r.application_no)
and date_ge(CAST(a.application_date as date),#{dto.beginDate}) and date_le(CAST(a.application_date as date),#{dto.endDate})
</select>
</mapper> </mapper>
...@@ -157,4 +157,28 @@ ...@@ -157,4 +157,28 @@
</where> </where>
ORDER BY res.sequence_nbr DESC ORDER BY res.sequence_nbr DESC
</select> </select>
<select id="queryInspectionTimelinessTopXX" resultType="com.yeejoin.amos.boot.module.jyjc.api.dto.InspectionTimelinesDto">
select
a1.avgtime as count,
a1.inspection_unit_code as unitCode,
b1.use_unit as name,
b1.city
from
(SELECT
ROUND(avg(EXTRACT(EPOCH FROM ( r.rec_date - r.plan_create_date)) / 60),0) as avgtime,
r.inspection_unit_code
FROM
tz_jyjc_inspection_result r,
tz_base_enterprise_info b
where
r.result_status ='2'
and r.inspection_unit_code= b.use_unit_code
AND b.supervise_org_code like CONCAT(#{orgCode}, '%')
GROUP BY r.inspection_unit_code ORDER BY avgtime
limit #{top}
) a1,
tz_base_enterprise_info b1
WHERE
a1.inspection_unit_code = b1.use_unit_code
</select>
</mapper> </mapper>
...@@ -50,4 +50,36 @@ ...@@ -50,4 +50,36 @@
UPDATE tz_jyjc_opening_application set promoter = null UPDATE tz_jyjc_opening_application set promoter = null
where sequence_nbr = #{id} where sequence_nbr = #{id}
</update> </update>
<select id="queryInspectionOrgListForPublicity" resultType="com.yeejoin.amos.boot.module.jyjc.api.dto.PublicityInspectOrgInfoDto">
select
b.use_unit as unitName,
l.cert_no as approvalNumber,
l.expiry_date as aapprovalDeadline,
b.use_code as unitCode,
a.expiry_date as businessDeadline,
a.licenceType
from
(SELECT
unit_code,
expiry_date,
unit_code_name,
case when
open_biz_type = 'jy' then '1233-1'
when
open_biz_type = 'jc' then '1233-2'
end as open_biz_type,
open_biz_type as licenceType
FROM
"tz_jyjc_opening_application"
where
status = '6616') a,
tz_base_enterprise_info b,
(select cert_no, min(expiry_date) as expiry_date, unit_code, cert_type_code from tz_base_unit_licence GROUP BY cert_no,unit_code,cert_type_code) l
where
a.unit_code= b.use_unit_code
and a.unit_code=l.unit_code
and l.cert_type_code = a.open_biz_type
and b.supervise_org_code like CONCAT(#{orgCode}, '%')
ORDER BY unitName
</select>
</mapper> </mapper>
package com.yeejoin.amos.boot.module.jyjc.biz.controller; package com.yeejoin.amos.boot.module.jyjc.biz.controller;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto; import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto;
import com.yeejoin.amos.boot.module.jyjc.api.dto.InspectionTimelinesDto;
import com.yeejoin.amos.boot.module.jyjc.api.dto.PublicityInspectOrgInfoDto;
import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.DPStatisticsServiceImpl; import com.yeejoin.amos.boot.module.jyjc.biz.service.impl.DPStatisticsServiceImpl;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
import org.springframework.validation.FieldError; import org.springframework.validation.FieldError;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
...@@ -42,8 +41,8 @@ public class DPStatisticsController { ...@@ -42,8 +41,8 @@ public class DPStatisticsController {
@PostMapping(value = "/inspectTime/count/byEquListAndInspectType") @PostMapping(value = "/inspectTime/count/byEquListAndInspectType")
public ResponseModel<Map<String, Object>> inspectTimeCountByTypeAndEquList(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) { public ResponseModel<Map<String, Object>> inspectTimeCountByTypeAndEquList(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) {
List<FieldError> fieldErrors = result.getFieldErrors(); List<FieldError> fieldErrors = result.getFieldErrors();
if(!fieldErrors.isEmpty()){ if (!fieldErrors.isEmpty()) {
throw new BadRequest(fieldErrors.get(0).getDefaultMessage()); throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
} }
return ResponseHelper.buildResponse(statisticsService.inspectTimeCountByTypeAndEquList(dpFilterParamDto)); return ResponseHelper.buildResponse(statisticsService.inspectTimeCountByTypeAndEquList(dpFilterParamDto));
} }
...@@ -53,10 +52,66 @@ public class DPStatisticsController { ...@@ -53,10 +52,66 @@ public class DPStatisticsController {
@PostMapping(value = "/inspectTimeCount") @PostMapping(value = "/inspectTimeCount")
public ResponseModel<Map<String, Object>> inspectTimeCount(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) { public ResponseModel<Map<String, Object>> inspectTimeCount(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) {
List<FieldError> fieldErrors = result.getFieldErrors(); List<FieldError> fieldErrors = result.getFieldErrors();
if(!fieldErrors.isEmpty()){ if (!fieldErrors.isEmpty()) {
throw new BadRequest(fieldErrors.get(0).getDefaultMessage()); throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
} }
return ResponseHelper.buildResponse(statisticsService.inspectTimeCount(dpFilterParamDto)); return ResponseHelper.buildResponse(statisticsService.inspectTimeCount(dpFilterParamDto));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "大屏-检验检测-左侧检验检测人员统计", notes = "大屏-检验检测-左侧检验检测人员统计")
@PostMapping(value = "/jy/person/count")
public ResponseModel<Map<String, Object>> inspectPersonCount(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) {
List<FieldError> fieldErrors = result.getFieldErrors();
if (!fieldErrors.isEmpty()) {
throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
}
return ResponseHelper.buildResponse(statisticsService.inspectPersonCount(dpFilterParamDto));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "大屏-检验检测-各检验类型业务数量统计", notes = "大屏-检验检测-各检验类型业务数量统计")
@PostMapping(value = "/jy/allApp/countByType")
public ResponseModel<Map<String, Object>> inspectBizNumCountByType(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) {
List<FieldError> fieldErrors = result.getFieldErrors();
if (!fieldErrors.isEmpty()) {
throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
}
return ResponseHelper.buildResponse(statisticsService.queryAllFlowingAndFinishedInspectApp(dpFilterParamDto));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "大屏-检验检测-各检验类型待检数量统计", notes = "大屏-检验检测-各检验类型待检数量统计")
@PostMapping(value = "/jy/pendingApp/countByType")
public ResponseModel<Map<String, Object>> queryAllFlowingAndFinishedInspectApp(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) {
List<FieldError> fieldErrors = result.getFieldErrors();
if (!fieldErrors.isEmpty()) {
throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
}
return ResponseHelper.buildResponse(statisticsService.queryAllPendingResultInspectApp(dpFilterParamDto));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "大屏-检验检测-按机构进行检验时效统计Top10排名", notes = "大屏-检验检测-按机构进行检验时效统计Top10排名")
@PostMapping(value = "/jy/timeliness/top")
public ResponseModel<List<InspectionTimelinesDto>> inspectionTimelinessTopXX(@RequestParam(required = false, defaultValue = "10") String top, @Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) {
List<FieldError> fieldErrors = result.getFieldErrors();
if (!fieldErrors.isEmpty()) {
throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
}
return ResponseHelper.buildResponse(statisticsService.queryInspectionTimelinessTopXX(top, dpFilterParamDto));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "大屏-检验检测-检验检测机构公示", notes = "大屏-检验检测-检验检测机构公示")
@PostMapping(value = "/jy/inspectionOrgList/publicity")
public ResponseModel<List<PublicityInspectOrgInfoDto>> inspectionOrgListForPublicity(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) {
List<FieldError> fieldErrors = result.getFieldErrors();
if (!fieldErrors.isEmpty()) {
throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
}
return ResponseHelper.buildResponse(statisticsService.queryInspectionOrgListForPublicity(dpFilterParamDto));
}
} }
...@@ -12,6 +12,7 @@ import org.springframework.stereotype.Service; ...@@ -12,6 +12,7 @@ import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.orm.entity.BaseEntity; import org.typroject.tyboot.core.rdbms.orm.entity.BaseEntity;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
...@@ -25,13 +26,16 @@ public class InspectionPlanServiceImpl { ...@@ -25,13 +26,16 @@ public class InspectionPlanServiceImpl {
private JyjcInspectionApplicationEquipServiceImpl applicationEquipService; private JyjcInspectionApplicationEquipServiceImpl applicationEquipService;
private JyjcInspectionResultServiceImpl inspectionResultService;
private ESEquipmentCategory esEquipmentCategory; private ESEquipmentCategory esEquipmentCategory;
public InspectionPlanServiceImpl(JyjcInspectionApplicationServiceImpl inspectionApplicationService, public InspectionPlanServiceImpl(JyjcInspectionApplicationServiceImpl inspectionApplicationService,
JyjcInspectionApplicationEquipServiceImpl applicationEquipService, JyjcInspectionApplicationEquipServiceImpl applicationEquipService,
ESEquipmentCategory esEquipmentCategory) { JyjcInspectionResultServiceImpl inspectionResultService, ESEquipmentCategory esEquipmentCategory) {
this.inspectionApplicationService = inspectionApplicationService; this.inspectionApplicationService = inspectionApplicationService;
this.applicationEquipService = applicationEquipService; this.applicationEquipService = applicationEquipService;
this.inspectionResultService = inspectionResultService;
this.esEquipmentCategory = esEquipmentCategory; this.esEquipmentCategory = esEquipmentCategory;
} }
...@@ -40,15 +44,23 @@ public class InspectionPlanServiceImpl { ...@@ -40,15 +44,23 @@ public class InspectionPlanServiceImpl {
LambdaUpdateWrapper<JyjcInspectionApplication> updateWrapper = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<JyjcInspectionApplication> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.set(JyjcInspectionApplication::getPlanData, JSONObject.toJSONString(model)); updateWrapper.set(JyjcInspectionApplication::getPlanData, JSONObject.toJSONString(model));
updateWrapper.eq(BaseEntity::getSequenceNbr, applicationSeq); updateWrapper.eq(BaseEntity::getSequenceNbr, applicationSeq);
updateWrapper.set(JyjcInspectionApplication::getPlanCreateDate, new Date());
inspectionApplicationService.update(updateWrapper); inspectionApplicationService.update(updateWrapper);
// 异步写入计划排期日期,统计办理时效使用
this.updatePlanCreateDate(applicationSeq);
return model; return model;
} }
private void updatePlanCreateDate(String applicationSeq) {
JyjcInspectionApplication inspectionApplication = inspectionApplicationService.getById(applicationSeq);
inspectionResultService.updatePlanCreateDateByAppNo(inspectionApplication.getApplicationNo());
}
public JSONObject getDetail(String applicationSeq) { public JSONObject getDetail(String applicationSeq) {
JyjcInspectionApplication inspectionApplication = inspectionApplicationService.getById(applicationSeq); JyjcInspectionApplication inspectionApplication = inspectionApplicationService.getById(applicationSeq);
// 初始时查询设备地址关联设备表 // 初始时查询设备地址关联设备表
JSONObject jsonObject = inspectionApplication.getPlanData(); JSONObject jsonObject = inspectionApplication.getPlanData();
if(jsonObject == null){ if (jsonObject == null) {
jsonObject = new JSONObject(); jsonObject = new JSONObject();
String address = this.getOneEquipAddress(applicationSeq); String address = this.getOneEquipAddress(applicationSeq);
jsonObject.put("address", address); jsonObject.put("address", address);
...@@ -61,10 +73,10 @@ public class InspectionPlanServiceImpl { ...@@ -61,10 +73,10 @@ public class InspectionPlanServiceImpl {
List<JyjcInspectionApplicationEquip> applicationEquips = applicationEquipService.list(new LambdaQueryWrapper<JyjcInspectionApplicationEquip>().eq(JyjcInspectionApplicationEquip::getApplicationSeq, applicationSeq)); List<JyjcInspectionApplicationEquip> applicationEquips = applicationEquipService.list(new LambdaQueryWrapper<JyjcInspectionApplicationEquip>().eq(JyjcInspectionApplicationEquip::getApplicationSeq, applicationSeq));
// 拼接地址 // 拼接地址
List<String> allAddress = new ArrayList<>(); List<String> allAddress = new ArrayList<>();
applicationEquips.forEach(e->{ applicationEquips.forEach(e -> {
String record = e.getEquipUnicode(); String record = e.getEquipUnicode();
Optional<ESEquipmentCategoryDto> optional = esEquipmentCategory.findById(record); Optional<ESEquipmentCategoryDto> optional = esEquipmentCategory.findById(record);
if(optional.isPresent()){ if (optional.isPresent()) {
ESEquipmentCategoryDto esEquipmentCategoryDto = optional.get(); ESEquipmentCategoryDto esEquipmentCategoryDto = optional.get();
allAddress.add(this.concatDetailAddress(esEquipmentCategoryDto)); allAddress.add(this.concatDetailAddress(esEquipmentCategoryDto));
} }
...@@ -77,6 +89,6 @@ public class InspectionPlanServiceImpl { ...@@ -77,6 +89,6 @@ public class InspectionPlanServiceImpl {
String usePlace = esEquipmentCategoryDto.getUSE_PLACE(); String usePlace = esEquipmentCategoryDto.getUSE_PLACE();
// 详细地址 // 详细地址
String address = esEquipmentCategoryDto.getADDRESS(); String address = esEquipmentCategoryDto.getADDRESS();
return String.format("%s%s",usePlace, address); return String.format("%s%s", usePlace, address);
} }
} }
...@@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONArray; ...@@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Sequence; import com.baomidou.mybatisplus.core.toolkit.Sequence;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
...@@ -39,6 +40,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -39,6 +40,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
...@@ -504,4 +506,12 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR ...@@ -504,4 +506,12 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
String group = getPersonIdentityByType(selectedOrgInfo.getCompany().getCompanyType()); String group = getPersonIdentityByType(selectedOrgInfo.getCompany().getCompanyType());
return JyjcInspectionApplicationServiceImpl.getDictionarieModels(group); return JyjcInspectionApplicationServiceImpl.getDictionarieModels(group);
} }
@Async
public void updatePlanCreateDateByAppNo(String appNo) {
LambdaUpdateWrapper<JyjcInspectionResult> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(JyjcInspectionResult::getApplicationNo, appNo);
updateWrapper.set(JyjcInspectionResult::getPlanCreateDate, new Date());
this.update(updateWrapper);
}
} }
\ 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