bug修改

This commit is contained in:
huangzj
2023-04-17 09:28:29 +08:00
parent d7592e8b2b
commit 2be275027e
18 changed files with 184 additions and 30 deletions

View File

@@ -81,8 +81,8 @@ public class DevModelController extends BaseController {
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/queryEquipmentByProject")
@ApiOperation("通过项目查询出厂设备")
@ApiImplicitParam(name = "csDevModelQueryListParm", value = "项目信息", required = true)
@ApiOperation("设备模板列表查询")
@ApiImplicitParam(name = "csDevModelQueryListParm", value = "信息", required = true)
public HttpResult<List<CsDevModelPageVO>> queryEquipmentByProject(@RequestBody CsDevModelQueryListParm csDevModelQueryListParm){
String methodDescribe = getMethodDescribe("queryEquipmentByProject");

View File

@@ -1,7 +1,9 @@
package com.njcn.algorithm.controller.project;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.njcn.algorithm.pojo.param.CsEngineeringAddParm;
import com.njcn.algorithm.pojo.param.CsEngineeringAuditParm;
import com.njcn.algorithm.pojo.param.CsEngineeringQueryPageParm;
import com.njcn.algorithm.pojo.param.CsEngineeringQueryParm;
import com.njcn.algorithm.pojo.vo.CsEngineeringVO;
import com.njcn.algorithm.service.CsEngineeringService;
@@ -74,4 +76,15 @@ public class EngineeringController extends BaseController {
List<CsEngineeringVO> csEngineeringVOList = csEngineeringService.queryEngineering(csEngineeringQueryParm);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, csEngineeringVOList, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/queryEngineeringPage")
@ApiOperation("分页查询工程列表")
@ApiImplicitParam(name = "csEngineeringQueryPageParm", value = "修改项目参数", required = true)
public HttpResult<IPage<CsEngineeringVO>> queryEngineeringPage(@Validated @RequestBody CsEngineeringQueryPageParm csEngineeringQueryPageParm){
String methodDescribe = getMethodDescribe("queryEngineeringPage");
IPage<CsEngineeringVO> page = csEngineeringService.queryEngineeringPage(csEngineeringQueryPageParm);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
}
}

View File

@@ -29,8 +29,8 @@
<if test="csDevModelQueryParm.versionStartDate != null and csDevModelQueryParm.versionStartDate != ''">
AND a.version_date &gt;= #{csDevModelQueryParm.versionStartDate }
</if>
<if test="csDevModelQueryParm.versionendDate != null and csDevModelQueryParm.versionendDate != ''">
AND a.version_date &lt;= #{csDevModelQueryParm.versionendDate }
<if test="csDevModelQueryParm.versionEndDate != null and csDevModelQueryParm.versionEndDate != ''">
AND a.version_date &lt;= #{csDevModelQueryParm.versionEndDate }
</if>
<if test="csDevModelQueryParm.devName != null and csDevModelQueryParm.devName != ''">
@@ -49,8 +49,12 @@
<if test="csDevModelQueryListParm.versionStartDate != null and csDevModelQueryListParm.versionStartDate != ''">
AND a.version_date &gt;= #{csDevModelQueryListParm.versionStartDate }
</if>
<if test="csDevModelQueryListParm.versionendDate != null and csDevModelQueryListParm.versionendDate != ''">
AND a.version_date &lt;= #{csDevModelQueryListParm.versionendDate }
<if test="csDevModelQueryListParm.versionEndDate != null and csDevModelQueryListParm.versionEndDate != ''">
AND a.version_date &lt;= #{csDevModelQueryListParm.versionEndDate }
</if>
<if test="csDevModelQueryListParm.versionDate != null and csDevModelQueryListParm.versionDate != ''">
AND a.version_date = #{csDevModelQueryListParm.versionDate }
</if>
<if test="csDevModelQueryListParm.versionNo != null and csDevModelQueryListParm.versionNo != ''">

View File

@@ -32,15 +32,19 @@
</sql>
<select id="queryProjectEquipmentVO" resultType="com.njcn.algorithm.pojo.vo.ProjectEquipmentVO">
SELECT
a.engineering_id engineeringId,
d.name engineeringName,
a.id projectId,
a.name projectName,
b.id equipmentId,
b.name equipmentName
FROM cs_project a,
cs_equipment_delivery b,
cs_project_equipment c
cs_project_equipment c,
cs_engineering d
WHERE a.id = c.project_id
AND b.id = c.equipment_id
and a.engineering_id =d.id
<if test="projectEquipmentQueryParm!=null and projectEquipmentQueryParm.projectType != null and projectEquipmentQueryParm.projectType !=''">
AND a.project_type = #{projectEquipmentQueryParm.projectType}
</if>

View File

@@ -1,7 +1,9 @@
package com.njcn.algorithm.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.njcn.algorithm.pojo.param.CsEngineeringAddParm;
import com.njcn.algorithm.pojo.param.CsEngineeringAuditParm;
import com.njcn.algorithm.pojo.param.CsEngineeringQueryPageParm;
import com.njcn.algorithm.pojo.param.CsEngineeringQueryParm;
import com.njcn.algorithm.pojo.po.CsEngineeringPO;
import com.baomidou.mybatisplus.extension.service.IService;
@@ -38,4 +40,12 @@ public interface CsEngineeringService extends IService<CsEngineeringPO>{
* @Date: 2023/4/10
*/
List<CsEngineeringVO> queryEngineering(CsEngineeringQueryParm csEngineeringQueryParm);
}
/**
* @Description: 分页查询
* @Param: [csEngineeringQueryPageParm]
* @return: com.baomidou.mybatisplus.core.metadata.IPage<com.njcn.algorithm.pojo.vo.CsEngineeringVO>
* @Author: clam
* @Date: 2023/4/12
*/
IPage<CsEngineeringVO> queryEngineeringPage(CsEngineeringQueryPageParm csEngineeringQueryPageParm);
}

View File

@@ -1,14 +1,21 @@
package com.njcn.algorithm.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.algorithm.mapper.CsEngineeringMapper;
import com.njcn.algorithm.pojo.param.CsEngineeringAddParm;
import com.njcn.algorithm.pojo.param.CsEngineeringAuditParm;
import com.njcn.algorithm.pojo.param.CsEngineeringQueryPageParm;
import com.njcn.algorithm.pojo.param.CsEngineeringQueryParm;
import com.njcn.algorithm.pojo.po.CsEngineeringPO;
import com.njcn.algorithm.pojo.vo.CsEngineeringVO;
import com.njcn.algorithm.service.CsEngineeringService;
import com.njcn.redis.utils.RedisUtil;
import com.njcn.system.api.AreaFeignClient;
import com.njcn.system.pojo.po.Area;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
@@ -16,6 +23,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
/**
@@ -28,8 +36,12 @@ import java.util.stream.Collectors;
* @version V1.0.0
*/
@Service
@RequiredArgsConstructor
public class CsEngineeringServiceImpl extends ServiceImpl<CsEngineeringMapper, CsEngineeringPO> implements CsEngineeringService{
private final AreaFeignClient areaFeignClient;
private final RedisUtil redisUtil;
@Override
@Transactional(rollbackFor = {Exception.class})
public Boolean addEngineering(CsEngineeringAddParm csEngineeringAddParm) {
@@ -63,8 +75,47 @@ public class CsEngineeringServiceImpl extends ServiceImpl<CsEngineeringMapper, C
csEngineeringVOList = csEngineeringPOS.stream ().map (temp->{
CsEngineeringVO vo = new CsEngineeringVO();
BeanUtils.copyProperties (temp, vo);
vo.setProvinceName (this.getAreaById (vo.getProvince ()));
vo.setCityName (this.getAreaById (vo.getCity ()));
return vo;
}).collect(Collectors.toList());
return csEngineeringVOList;
}
@Override
public IPage<CsEngineeringVO> queryEngineeringPage(CsEngineeringQueryPageParm csEngineeringQueryPageParm) {
Page<CsEngineeringPO> tempPage = new Page<> (csEngineeringQueryPageParm.getCurrentPage ( ), csEngineeringQueryPageParm.getPageSize ( ));
Page<CsEngineeringVO> returnPage = new Page<> (csEngineeringQueryPageParm.getCurrentPage ( ), csEngineeringQueryPageParm.getPageSize ( ));
QueryWrapper<CsEngineeringPO> queryWrapper = new QueryWrapper<> ();
queryWrapper.eq (StringUtils.isNotBlank (csEngineeringQueryPageParm.getUserId ()),"user_id",csEngineeringQueryPageParm.getUserId ()).
eq (StringUtils.isNotBlank (csEngineeringQueryPageParm.getProvince ()),"province",csEngineeringQueryPageParm.getProvince ()).
eq (StringUtils.isNotBlank (csEngineeringQueryPageParm.getCity ()),"city",csEngineeringQueryPageParm.getCity ()).
eq ("status","1" ).
like (StringUtils.isNotBlank (csEngineeringQueryPageParm.getName ()),"name",csEngineeringQueryPageParm.getName ());
Page<CsEngineeringPO> csEngineeringPOPage = this.getBaseMapper ( ).selectPage (tempPage, queryWrapper);
List<CsEngineeringVO> collect = csEngineeringPOPage.getRecords ( ).stream ( ).map (temp -> {
CsEngineeringVO vo = new CsEngineeringVO ( );
BeanUtils.copyProperties (temp, vo);
vo.setProvinceName (this.getAreaById (vo.getProvince ()));
vo.setCityName (this.getAreaById (vo.getCity ()));
return vo;
}).collect (Collectors.toList ( ));
returnPage.setRecords (collect);
return returnPage;
}
public String getAreaById(String id){
String areaName =redisUtil.getStringByKey (id);
areaName =Optional.ofNullable (areaName).orElseGet (() ->{
Area data = areaFeignClient.selectIdArea (id).getData ( );
redisUtil.saveByKey (id,data.getName ());
return data.getName ();
});
return areaName;
}
}