Commit 9522d1bb authored by zhangyingbin's avatar zhangyingbin

修改tzs问题

parent 210696b9
package com.yeejoin.amos.boot.module.tzs.flc.api.mapper; package com.yeejoin.amos.boot.module.tzs.flc.api.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderInfoDto; import com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderInfoDto;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
...@@ -78,4 +79,6 @@ public interface CylinderInfoMapper extends BaseMapper<CylinderInfo> { ...@@ -78,4 +79,6 @@ public interface CylinderInfoMapper extends BaseMapper<CylinderInfo> {
* @return * @return
*/ */
List<CylinderInfoDto> listWithRegionCode(Integer regionCode); List<CylinderInfoDto> listWithRegionCode(Integer regionCode);
Page<CylinderInfoDto> cyinderInfoList(Page<CylinderInfoDto> page, CylinderInfoDto cylinderInfoDto, String sort, List<String> appids);
} }
...@@ -100,4 +100,91 @@ ...@@ -100,4 +100,91 @@
WHERE WHERE
cu.region_code LIKE CONCAT("%", #{regionCode}, "%") cu.region_code LIKE CONCAT("%", #{regionCode}, "%")
</select> </select>
<select id="cyinderInfoList" resultType="com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderInfoDto">
SELECT
`ci`.`sequence_nbr` AS `sequence_nbr`,
`ci`.`unit_name` AS `unit_name`,
`ci`.`factory_num` AS `factory_num`,
`ci`.`cylinder_status` AS `cylinder_status`,
`ci`.`cylinder_variety` AS `cylinder_variety`,
`ci`.`volume` AS `volume`,
`ci`.`manufacturing_date` AS `manufacturing_date`,
`ci`.`manufacturing_unit` AS `manufacturing_unit`,
`ci`.`unit_inner_code` AS `unit_inner_code`,
`ci`.`sequence_code` AS `sequence_code`,
`ci`.`early_warning_level` AS `early_warning_level`,
`ci`.`early_warning_level_cal_date` AS `early_warning_level_cal_date`,
`ci`.`end_custom_code` AS `end_custom_code`,
`ci`.`rec_date` AS `rec_date`,
`ci`.`rec_user_id` AS `rec_user_id`,
`ci`.`sync_date` AS `sync_date`,
`ci`.`sync_state` AS `sync_state`,
`ci`.`app_id` AS `app_id`,
`ci`.`integrity` AS `integrity`,
`ci`.`longitude` AS `longitude`,
`ci`.`latitude` AS `latitude`,
`ci`.`credit_code` AS `credit_code`,
`ci`.`filling_media` AS `filling_media`,
`ci`.`product_name` AS `product_name`,
`ci`.`product_qualified` AS `product_qualified`,
`ci`.`proof_quality` AS `proof_quality`,
`ci`.`supervision_inspec` AS `supervision_inspec`,
`ci`.`type_experiments` AS `type_experiments`,
`ci`.`valve_manufactur_unit` AS `valve_manufactur_unit`,
`ci`.`nominal_work_pressure` AS `nominal_work_pressure`,
d1.`name` AS filling_media_name,
d2.`name` AS cylinder_variety_name,
d3.`name` AS cylinder_status_str,
ct.qrCode,
ct.electronic_label_code
FROM
tz_cylinder_info AS ci
LEFT JOIN cb_data_dictionary AS d1 ON d1.type = 'CZJZMC' AND d1.code = ci.filling_media
LEFT JOIN cb_data_dictionary AS d2 ON d2.sequence_nbr = ci.cylinder_variety
LEFT JOIN cb_data_dictionary AS d3 ON d3.sequence_nbr = ci.cylinder_status
LEFT JOIN tz_cylinder_tags AS ct ON ct.sequence_code = ci.sequence_code
<where>
<if test="appids != null and appids.size > 0 ">
and ci.app_id in
<foreach collection="appids" index="index" item="item" close=")" open="(" separator=",">
#{item}
</foreach>
</if>
<if test="cylinderInfoDto.appId != null and cylinderInfoDto.appId != '' ">
and ci.app_id = #{cylinderInfoDto.appId}
</if>
<if test="cylinderInfoDto.unitName != null and cylinderInfoDto.unitName != '' ">
and ci.unit_name like concat("%",#{cylinderInfoDto.unitName},"%")
</if>
<if test="cylinderInfoDto.factoryNum != null and cylinderInfoDto.factoryNum != '' ">
and ci.factory_num like concat("%",#{cylinderInfoDto.factoryNum},"%")
</if>
<if test="cylinderInfoDto.cylinderVariety != null and cylinderInfoDto.cylinderVariety != '' ">
and ci.cylinder_variety = #{cylinderInfoDto.cylinderVariety}
</if>
<if test="cylinderInfoDto.sequenceCode != null and cylinderInfoDto.sequenceCode != '' ">
and ci.sequence_code like concat("%",#{cylinderInfoDto.sequenceCode},"%")
</if>
<if test="cylinderInfoDto.unitInnerCode != null and cylinderInfoDto.unitInnerCode != '' ">
and ci.unit_inner_code like concat("%",#{cylinderInfoDto.unitInnerCode},"%")
</if>
<if test="cylinderInfoDto.cylinderStatus != null and cylinderInfoDto.cylinderStatus != '' ">
and ci.cylinder_status = #{cylinderInfoDto.cylinderStatus}
</if>
<if test="cylinderInfoDto.manufacturingUnit != null and cylinderInfoDto.manufacturingUnit != '' ">
and ci.manufacturing_unit like concat("%",#{cylinderInfoDto.manufacturingUnit},"%")
</if>
<if test="cylinderInfoDto.creditCode != null and cylinderInfoDto.creditCode != '' ">
and ci.credit_code like concat("%",#{cylinderInfoDto.creditCode},"%")
</if>
<if test="cylinderInfoDto.qrCode != null and cylinderInfoDto.qrCode != '' ">
and ct.qrCode like concat("%",#{cylinderInfoDto.qrCode},"%")
</if>
<if test="cylinderInfoDto.electronicLabelCode != null and cylinderInfoDto.electronicLabelCode != '' ">
and ct.electronic_label_code like concat("%",#{cylinderInfoDto.electronicLabelCode},"%")
</if>
ORDER BY ci.sync_date DESC
</where>
</select>
</mapper> </mapper>
...@@ -13,6 +13,7 @@ import com.yeejoin.amos.boot.biz.common.bo.ReginParams; ...@@ -13,6 +13,7 @@ import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.module.tzs.api.dto.TzBaseEnterpriseInfoDto; import com.yeejoin.amos.boot.module.tzs.api.dto.TzBaseEnterpriseInfoDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.BaseUnitLicence; import com.yeejoin.amos.boot.module.tzs.api.entity.BaseUnitLicence;
import com.yeejoin.amos.boot.module.tzs.api.entity.TzBaseEnterpriseInfo; import com.yeejoin.amos.boot.module.tzs.api.entity.TzBaseEnterpriseInfo;
import com.yeejoin.amos.boot.module.tzs.biz.action.WarningMsgAction;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.BaseUnitLicenceServiceImpl; import com.yeejoin.amos.boot.module.tzs.biz.service.impl.BaseUnitLicenceServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.TzBaseEnterpriseInfoServiceImpl; import com.yeejoin.amos.boot.module.tzs.biz.service.impl.TzBaseEnterpriseInfoServiceImpl;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
...@@ -504,6 +505,7 @@ public class CylinderInfoController extends BaseController { ...@@ -504,6 +505,7 @@ public class CylinderInfoController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "获取登陆人所在气瓶基本信息", notes = "获取登陆人所在气瓶基本信息") @ApiOperation(httpMethod = "GET", value = "获取登陆人所在气瓶基本信息", notes = "获取登陆人所在气瓶基本信息")
public ResponseModel<IPage<CylinderInfoDto>> cyinderInfoList(@RequestParam(value = "pageNum") String pageNum, public ResponseModel<IPage<CylinderInfoDto>> cyinderInfoList(@RequestParam(value = "pageNum") String pageNum,
@RequestParam(value = "pageSize") String pageSize, String sort, CylinderInfoDto cylinderInfoDto) { @RequestParam(value = "pageSize") String pageSize, String sort, CylinderInfoDto cylinderInfoDto) {
List<String> appids = new ArrayList<>();
FeignClientResult<AgencyUserModel> result1= Privilege.agencyUserClient.getme(); FeignClientResult<AgencyUserModel> result1= Privilege.agencyUserClient.getme();
if(result1.getResult()!=null) { if(result1.getResult()!=null) {
List<CompanyModel> list = result1.getResult().getCompanys(); List<CompanyModel> list = result1.getResult().getCompanys();
...@@ -519,7 +521,6 @@ public class CylinderInfoController extends BaseController { ...@@ -519,7 +521,6 @@ public class CylinderInfoController extends BaseController {
} }
QueryWrapper<CylinderInfo> cylinderInfoQueryWrapper = new QueryWrapper<>(); QueryWrapper<CylinderInfo> cylinderInfoQueryWrapper = new QueryWrapper<>();
if (StringUtils.isNotEmpty(cylinderInfoDto.getRegionCode())) { if (StringUtils.isNotEmpty(cylinderInfoDto.getRegionCode())) {
List<String> appids = new ArrayList<>();
List<CylinderUnit> unitList = cylinderUnitServiceImpl.list(new LambdaQueryWrapper<CylinderUnit>() List<CylinderUnit> unitList = cylinderUnitServiceImpl.list(new LambdaQueryWrapper<CylinderUnit>()
.like(CylinderUnit::getRegionCode, cylinderInfoDto.getRegionCode())); .like(CylinderUnit::getRegionCode, cylinderInfoDto.getRegionCode()));
unitList.forEach(u -> { unitList.forEach(u -> {
...@@ -530,39 +531,44 @@ public class CylinderInfoController extends BaseController { ...@@ -530,39 +531,44 @@ public class CylinderInfoController extends BaseController {
} }
cylinderInfoDto.setAppIds(appids); cylinderInfoDto.setAppIds(appids);
} }
setQueryWrapper(cylinderInfoQueryWrapper, cylinderInfoDto, sort);
Page<CylinderInfo> pageBean;
// setQueryWrapper(cylinderInfoQueryWrapper, cylinderInfoDto, sort);
Page<CylinderInfoDto> pageBean;
if (StringUtils.isBlank(pageNum) || StringUtils.isBlank(pageSize)) { if (StringUtils.isBlank(pageNum) || StringUtils.isBlank(pageSize)) {
pageBean = new Page<>(0, Long.MAX_VALUE); pageBean = new Page<>(0, Long.MAX_VALUE);
} else { } else {
pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize)); pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
} }
IPage<CylinderInfo> page; pageBean = cylinderInfoServiceImpl.cyinderInfoList(pageBean,cylinderInfoDto,sort,appids);
if (cylinderInfoDto.getIsWarn() == 0) { return ResponseHelper.buildResponse(pageBean);
page = cylinderInfoServiceImpl.page(pageBean, cylinderInfoQueryWrapper); // IPage<CylinderInfo> page;
} else { // if (cylinderInfoDto.getIsWarn() == 0) {
page = cylinderInspectionServiceImpl.queryOutOfDateCylinder(pageBean, cylinderInfoDto.getAppId()); // page = cylinderInfoServiceImpl.page(pageBean, cylinderInfoQueryWrapper);
} // } else {
// int num = cylinderInfoServiceImpl.count(cylinderInfoQueryWrapper); // page = cylinderInspectionServiceImpl.queryOutOfDateCylinder(pageBean, cylinderInfoDto.getAppId());
// pageBean.setTotal(num); // }
//// int num = cylinderInfoServiceImpl.count(cylinderInfoQueryWrapper);
IPage<CylinderInfoDto> result = BeanDtoVoUtils.cyinderInfoIPageDto(page); //// pageBean.setTotal(num);
result.getRecords().forEach(i -> { //
DataDictionary fillingMedia = iDataDictionaryService.getOne(new LambdaQueryWrapper<DataDictionary>() // IPage<CylinderInfoDto> result = BeanDtoVoUtils.cyinderInfoIPageDto(page);
.eq(DataDictionary::getCode, i.getFillingMedia()).eq(DataDictionary::getType, "CZJZMC")); // result.getRecords().forEach(i -> {
i.setFillingMediaName(fillingMedia != null ? fillingMedia.getName() : null); // DataDictionary fillingMedia = iDataDictionaryService.getOne(new LambdaQueryWrapper<DataDictionary>()
DataDictionary cylinderVariety = iDataDictionaryService.getOne(new LambdaQueryWrapper<DataDictionary>() // .eq(DataDictionary::getCode, i.getFillingMedia()).eq(DataDictionary::getType, "CZJZMC"));
.eq(DataDictionary::getSequenceNbr, i.getCylinderVariety())); // i.setFillingMediaName(fillingMedia != null ? fillingMedia.getName() : null);
i.setCylinderVarietyName(cylinderVariety != null ? cylinderVariety.getName() : null); // DataDictionary cylinderVariety = iDataDictionaryService.getOne(new LambdaQueryWrapper<DataDictionary>()
DataDictionary cylinderStatus = iDataDictionaryService.getOne( // .eq(DataDictionary::getSequenceNbr, i.getCylinderVariety()));
new LambdaQueryWrapper<DataDictionary>().eq(DataDictionary::getSequenceNbr, i.getCylinderStatus())); // i.setCylinderVarietyName(cylinderVariety != null ? cylinderVariety.getName() : null);
i.setCylinderStatusStr(cylinderStatus != null ? cylinderStatus.getName() : null); // DataDictionary cylinderStatus = iDataDictionaryService.getOne(
CylinderTags cylinderTags = cylinderTagsServiceImpl.getOne( // new LambdaQueryWrapper<DataDictionary>().eq(DataDictionary::getSequenceNbr, i.getCylinderStatus()));
new LambdaQueryWrapper<CylinderTags>().eq(CylinderTags::getSequenceCode, i.getSequenceCode())); // i.setCylinderStatusStr(cylinderStatus != null ? cylinderStatus.getName() : null);
i.setQrCode(cylinderTags != null ? cylinderTags.getQrCode() : null); // CylinderTags cylinderTags = cylinderTagsServiceImpl.getOne(
i.setElectronicLabelCode(cylinderTags != null ? cylinderTags.getElectronicLabelCode() : null); // new LambdaQueryWrapper<CylinderTags>().eq(CylinderTags::getSequenceCode, i.getSequenceCode()));
}); // i.setQrCode(cylinderTags != null ? cylinderTags.getQrCode() : null);
return ResponseHelper.buildResponse(result); // i.setElectronicLabelCode(cylinderTags != null ? cylinderTags.getElectronicLabelCode() : null);
// });
// return ResponseHelper.buildResponse(result);
} }
private QueryWrapper<CylinderInfo> setQueryWrapper(QueryWrapper<CylinderInfo> queryWrapper, private QueryWrapper<CylinderInfo> setQueryWrapper(QueryWrapper<CylinderInfo> queryWrapper,
......
...@@ -148,6 +148,9 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind ...@@ -148,6 +148,9 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
@Autowired @Autowired
StartPlatformTokenService startPlatformTokenService; StartPlatformTokenService startPlatformTokenService;
@Autowired
CylinderInfoMapper cylinderInfoMapper;
/** /**
* 分页查询 * 分页查询
*/ */
...@@ -840,4 +843,8 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind ...@@ -840,4 +843,8 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
cylinderInfos.forEach(this::touchRuleToCalLevel); cylinderInfos.forEach(this::touchRuleToCalLevel);
return Boolean.TRUE; return Boolean.TRUE;
} }
public Page<CylinderInfoDto> cyinderInfoList(Page<CylinderInfoDto> page, CylinderInfoDto cylinderInfoDto, String sort,List<String> appids){
return cylinderInfoMapper.cyinderInfoList(page,cylinderInfoDto,sort,appids);
}
} }
\ No newline at end of file
...@@ -14,8 +14,10 @@ import com.yeejoin.amos.boot.module.tzs.flc.api.service.ITzCylinderService; ...@@ -14,8 +14,10 @@ import com.yeejoin.amos.boot.module.tzs.flc.api.service.ITzCylinderService;
import com.yeejoin.amos.feign.privilege.Privilege; import com.yeejoin.amos.feign.privilege.Privilege;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -49,8 +51,14 @@ public class TzCylinderServiceImpl extends BaseService<TzCylinderInfoDto, Cylind ...@@ -49,8 +51,14 @@ public class TzCylinderServiceImpl extends BaseService<TzCylinderInfoDto, Cylind
@Override @Override
public TzCylinderTraceDto getCylinderTraceDto(String sequenceNbr) { public TzCylinderTraceDto getCylinderTraceDto(String sequenceNbr) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
String orgCode = tzCylinderMapper.getSequencCode(sequenceNbr); String orgCode = tzCylinderMapper.getSequencCode(sequenceNbr);
TzCylinderProduceDto tzCylinderProduceDto = tzCylinderMapper.getTzCylinderProduceDto(orgCode); TzCylinderProduceDto tzCylinderProduceDto = tzCylinderMapper.getTzCylinderProduceDto(orgCode);
if(!ValidationUtil.isEmpty(tzCylinderProduceDto.getManufacturingDate())) {
if(tzCylinderProduceDto.getManufacturingDate().length()>10) {
tzCylinderProduceDto.setManufacturingDate(tzCylinderProduceDto.getManufacturingDate().substring(0,10));
}
}
TzCylinderInfoDto tzCylinderInfoDto = tzCylinderMapper.getTzCylinderInfoDto(sequenceNbr); TzCylinderInfoDto tzCylinderInfoDto = tzCylinderMapper.getTzCylinderInfoDto(sequenceNbr);
DataDictionary data1 = iDataDictionaryService.getOne(new LambdaQueryWrapper<DataDictionary>() DataDictionary data1 = iDataDictionaryService.getOne(new LambdaQueryWrapper<DataDictionary>()
.eq(DataDictionary::getSequenceNbr, tzCylinderInfoDto.getCylinderVariety())); .eq(DataDictionary::getSequenceNbr, tzCylinderInfoDto.getCylinderVariety()));
......
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