Commit 98d4ed3d authored by chenzhao's avatar chenzhao

验收优化

parent 340e2c4a
......@@ -54,4 +54,6 @@ public class AcceptanceCheckDto extends BaseDto {
private String acceptanceTime;
private String isAudit;
}
package com.yeejoin.amos.boot.module.hygf.api.mapper;
import com.yeejoin.amos.boot.module.hygf.api.dto.AcceptanceCheckDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.AcceptanceCheck;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
import java.util.Map;
/**
* 并网验收节点 Mapper 接口
*
......@@ -11,4 +15,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface AcceptanceCheckMapper extends BaseMapper<AcceptanceCheck> {
List<AcceptanceCheckDto> selectPageList(Map<String, Object> map);
}
......@@ -2,4 +2,75 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.hygf.api.mapper.AcceptanceCheckMapper">
<select id="selectPageList" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.AcceptanceCheckDto">
SELECT
hogaa.sequence_nbr fonGridId,
hbga.sequence_nbr sequenceNbr,
hbga.work_order_id workOrderId,
hbga.work_order_power_station_id workOrderPowerStationId,
hbga.peasant_household_id peasantHouseholdId,
hbga.basic_grid_node basicGridNode,
hbga.grid_time gridTime,
hbga.power_station_area_status powerStationAreaStatus,
hbga.power_station_design_status powerStationDesignStatus,
hbga.rectification_status rectificationStatus,
hbga.power_station_engineering_status powerStationEngineeringStatus,
hbga.instance_id instanceId,
hph.developer_name as serviceAgent,
hph.regional_companies_name AS regionalCompaniesName,
hph.owners_name AS ownersName,
hph.peasant_household_no peasantHouseholdNo,
hph.project_address_name projectAddressName,
DATE_FORMAT(hogaa.grid_connection_time, '%Y-%m-%d %H:%i:%S') AS gridConnectionTime,
CASE WHEN hbga.grid_status = '1' THEN '待登记'
WHEN hbga.grid_status = '2' THEN '经销商管理员待审核'
WHEN hbga.grid_status = '3' THEN '已完成'
WHEN hbga.grid_status = '4' THEN '未通过'
WHEN hbga.grid_status = '5' THEN '设计待审核'
WHEN hbga.grid_status = '6' THEN '设计待审核/工程待审核'
WHEN hbga.grid_status = '7' THEN '片区运营待审核'
WHEN hbga.grid_status = '8' THEN '工程待审核'
WHEN hbga.grid_status = '9' THEN '整改待审核'
ELSE '待整改' END AS gridStatus
FROM
hygf_basic_grid_record hbga
LEFT JOIN hygf_peasant_household hph ON hph.sequence_nbr = hbga.peasant_household_id
LEFT JOIN hygf_on_grid_and_acceptance hogaa ON hogaa.work_order_power_station_id = hbga.work_order_power_station_id
LEFT JOIN hygf_work_order ON hygf_work_order.sequence_nbr = hbga.work_order_id
<where>
hbga.is_delete = 0
<if test="map.amosDealerId!=null and map.amosDealerId!=''">
and hygf_work_order.amos_dealer_id = #{map.amosDealerId}
</if>
<if test="map.regionCompanyId!=null and map.regionCompanyId!=''">
and hygf_work_order.region_company_id =#{map.regionCompanyId}
</if>
<if test="map.formType != null and map.formType!=''">
AND hbga.grid_status IN ('2', '3', '4')
</if>
<if test="map.projectAddress != null and map.projectAddress!=''">
AND hph.project_address_name LIKE concat(concat('%', #{map.projectAddress}), '%')
</if>
<if test="map.type != null">
and ( hbga.basic_grid_node is not null
or hbga.basic_grid_node = 'all'
or hbga.power_station_area_status is not null
or hbga.power_station_design_status is not null
or hbga.power_station_engineering_status is not null
)
</if>
<if test="map.ownersName != null and map.ownersName !=''">
AND hph.owners_name LIKE concat(concat('%', #{map.ownersName}), '%')
</if>
<if test="map.gridStatus != null and map.gridStatus !=''">
AND hbga.grid_status = #{map.gridStatus}
</if>
<if test="map.gridConnectionTime != null">
AND DATE_FORMAT(hogaa.grid_connection_time, '%Y-%m-%d') = #{map.gridConnectionTime}
</if>
</where>
ORDER BY hbga.sequence_nbr desc
</select>
</mapper>
......@@ -67,13 +67,13 @@
hygf_work_order_power_station.power_station_engineering_status powerStationEngineeringStatus,
(select hygf_rectification_order.rectification_history from hygf_rectification_order
where hygf_rectification_order.peasant_househole_id = hygf_work_order_power_station.peasant_household_id
and hygf_rectification_order.rectification_status = '待整改' and hygf_rectification_order.rectification_source = hygf_work_order_power_station.work_order_power_station_node ) as auditIdea,
and hygf_rectification_order.rectification_status = '待整改' and hygf_rectification_order.rectification_source = hygf_work_order_power_station.work_order_power_station_node and hygf_rectification_order.rectification_source in ('area','engineering','design') ) as auditIdea,
(select hygf_rectification_order.sequence_nbr from hygf_rectification_order
where hygf_rectification_order.peasant_househole_id = hygf_work_order_power_station.peasant_household_id
and hygf_rectification_order.rectification_status = '已作废' and hygf_rectification_order.rectification_source = hygf_work_order_power_station.work_order_power_station_node order by rec_date desc limit 1) as rollbackOrderId,
and hygf_rectification_order.rectification_status = '已作废' and hygf_rectification_order.rectification_source = hygf_work_order_power_station.work_order_power_station_node and hygf_rectification_order.rectification_source in ('area','engineering','design')order by rec_date desc limit 1) as rollbackOrderId,
(select hygf_rectification_order.sequence_nbr from hygf_rectification_order
where hygf_rectification_order.peasant_househole_id = hygf_work_order_power_station.peasant_household_id
and hygf_rectification_order.rectification_status in ('待整改','待提交','整改中','整改待审核','待审核')) as rectificationNum
and hygf_rectification_order.rectification_status in ('待整改','待提交','整改中','整改待审核','待审核') and hygf_rectification_order.rectification_source in ('area','engineering','design')) as rectificationNum
from hygf_work_order_power_station LEFT join hygf_work_order
on hygf_work_order.sequence_nbr=hygf_work_order_power_station.work_order_id
LEFT JOIN hygf_peasant_household on hygf_peasant_household.sequence_nbr=hygf_work_order_power_station.peasant_household_id
......
package com.yeejoin.amos.boot.module.hygf.biz.controller;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.module.hygf.api.config.UserLimits;
import com.yeejoin.amos.boot.module.hygf.api.dto.BasicGridRecordDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.HygfRectificationOrder;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -7,6 +10,8 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
......@@ -178,4 +183,67 @@ public class AcceptanceCheckController extends BaseController {
return acceptanceCheckServiceImpl.rollback(sequenceNbr);
}
/**
* 经销商端列表分页查询
*
* @param current 当前页
* @param current 每页大小
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET",value = "分页查询", notes = "分页查询")
@UserLimits
public ResponseModel<Page<AcceptanceCheckDto>> queryForPage(@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size,
@RequestParam(required = false,value = "projectAddress") String projectAddress,
@RequestParam(required = false,value = "powerStationCode") String powerStationCode,
@RequestParam(required = false,value = "ownersName") String ownersName,
@RequestParam(required = false,value = "gridStatus") String gridStatus,
@RequestParam(required = false,value = "type") String type,
@RequestParam(required = false,value = "gridConnectionTime") String gridConnectionTime) throws Exception {
//当前登录人所属场站
// UserUnitInformationDto userUnitInformationDto=personnelBusinessMapper.getUserUnitInformationDto( getUserInfo().getUserId());
ReginParams reginParams = getSelectedOrgInfo();
List<String> basicGridNodes = new ArrayList<>();
List<Long> roleIds = new ArrayList<>();
for (Long aLong : reginParams.getUserModel().getOrgRoleSeqs().keySet()) {
List<Long> longs = reginParams.getUserModel().getOrgRoleSeqs().get(aLong);
roleIds.addAll(longs);
if (longs.contains(areaId)) {
basicGridNodes.add("bw-area");
}
if (longs.contains(engineeringId)) {
basicGridNodes.add("bw-engineering");
}
if (longs.contains(designId)) {
basicGridNodes.add("bw-design");
}
if (longs.contains(delerAdminId)) {
basicGridNodes.add("bw-design");
basicGridNodes.add("bw-engineering");
basicGridNodes.add("bw-area");
}
}
Page<AcceptanceCheckDto> page = acceptanceCheckServiceImpl.selectPage(null,null,current, size, projectAddress, powerStationCode, ownersName, gridStatus, gridConnectionTime, "",basicGridNodes,type);
//根据角色及当前节点判断是否有操作权限
if (basicGridNodes != null){
for (AcceptanceCheckDto e : page.getRecords()) {
for (String g : basicGridNodes) {
if (null != e.getBasicGridNode() && e.getBasicGridNode().contains(g) && (roleIds.contains(areaId) ||roleIds.contains(designId) || roleIds.contains(engineeringId))){
e.setIsAudit("0");
break;
}else {
e.setIsAudit("1");
}
}
}
}
return ResponseHelper.buildResponse(page);
}
}
......@@ -3,18 +3,17 @@ package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.module.hygf.api.Enum.ArrivalStateeEnum;
import com.yeejoin.amos.boot.module.hygf.api.Enum.GridStatusEnum;
import com.yeejoin.amos.boot.module.hygf.api.Enum.WorkOrderEnum;
import com.yeejoin.amos.boot.module.hygf.api.dto.AcceptanceCheckAuditingDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.BasicGridAuditingDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.WorkflowResultDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.*;
import com.yeejoin.amos.boot.module.hygf.api.entity.*;
import com.yeejoin.amos.boot.module.hygf.api.mapper.AcceptanceCheckMapper;
import com.yeejoin.amos.boot.module.hygf.api.mapper.PeasantHouseholdMapper;
import com.yeejoin.amos.boot.module.hygf.api.service.IAcceptanceCheckService;
import com.yeejoin.amos.boot.module.hygf.api.dto.AcceptanceCheckDto;
import com.yeejoin.amos.boot.module.hygf.api.util.CommonResponseNewUtil;
import com.yeejoin.amos.component.robot.BadRequest;
import com.yeejoin.amos.feign.workflow.model.ActWorkflowBatchDTO;
......@@ -53,6 +52,36 @@ public class AcceptanceCheckServiceImpl extends BaseService<AcceptanceCheckDto,A
PeasantHouseholdMapper peasantHouseholdMapper;
public Page<AcceptanceCheckDto> selectPage(Long regionCompanyId, Long amosDealerId, int current, int size,
String projectAddress, String powerStationCode, String ownersName, String gridStatus,
String gridConnectionTime, String formType, List<String> basicGridNodes, String type) throws Exception {
PageHelper.startPage(current, size);
Map<String, Object> map = new HashMap<>();
Date date = null;
// if (StringUtils.isNotEmpty(gridConnectionTime)) {
// date = DateUtil.formatStringToDate(gridConnectionTime, "yyyy-MM-dd HH:mm:ss");
// }
map.put("projectAddress", projectAddress);
map.put("powerStationCode", powerStationCode);
map.put("ownersName", ownersName);
map.put("gridStatus", gridStatus);
map.put("gridConnectionTime", gridConnectionTime);
map.put("formType", formType);
map.put("regionCompanyId", regionCompanyId);
map.put("amosDealerId", amosDealerId);
map.put("basicGridNodes",basicGridNodes);
map.put("type",type);
List<AcceptanceCheckDto> list = this.getBaseMapper().selectPageList(map);
PageInfo<AcceptanceCheckDto> page = new PageInfo(list);
Page<AcceptanceCheckDto> pageNew = new Page<>();
pageNew.setCurrent(current);
pageNew.setTotal(page.getTotal());
pageNew.setSize(size);
pageNew.setRecords(page.getList());
return pageNew;
}
/**
* 分页查询
*/
......
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