Commit 6be70214 authored by tangwei's avatar tangwei

施工自审

parent 6a462d9c
...@@ -42,4 +42,7 @@ public class ConstructionRecordsDto extends BaseDto { ...@@ -42,4 +42,7 @@ public class ConstructionRecordsDto extends BaseDto {
@ApiModelProperty(value = "农户id") @ApiModelProperty(value = "农户id")
private Long peasantHouseholdId; private Long peasantHouseholdId;
@ApiModelProperty(value = "备注")
private String notes;
} }
package com.yeejoin.amos.boot.module.hygf.api.dto; package com.yeejoin.amos.boot.module.hygf.api.dto;
import com.yeejoin.amos.boot.module.hygf.api.entity.HygfOnGrid; import com.yeejoin.amos.boot.module.hygf.api.entity.*;
import com.yeejoin.amos.boot.module.hygf.api.entity.PowerStationConstructionData;
import com.yeejoin.amos.boot.module.hygf.api.entity.PowerStationEngineeringInfo;
import com.yeejoin.amos.boot.module.hygf.api.entity.WorkOrder;
import lombok.Data; import lombok.Data;
/** /**
...@@ -14,10 +11,12 @@ import lombok.Data; ...@@ -14,10 +11,12 @@ import lombok.Data;
@Data @Data
public class PowerStationEngineeringInfoAllDto { public class PowerStationEngineeringInfoAllDto {
// 基本信息 //自审信息
SurveyInformationDto surveyInformation;
ConstructionRecords constructionRecords;
// 基本信息
SurveyInformationDto surveyInformation;
Long workOrderPowerStationId; Long workOrderPowerStationId;
...@@ -28,7 +27,6 @@ public class PowerStationEngineeringInfoAllDto { ...@@ -28,7 +27,6 @@ public class PowerStationEngineeringInfoAllDto {
SurveyDetailsDto surveyDetails; SurveyDetailsDto surveyDetails;
// 扩展信息 // 扩展信息
ExtendedInformationDto extendedInformation; ExtendedInformationDto extendedInformation;
......
...@@ -3,10 +3,12 @@ package com.yeejoin.amos.boot.module.hygf.api.entity; ...@@ -3,10 +3,12 @@ package com.yeejoin.amos.boot.module.hygf.api.entity;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity; import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* 施工日志 * 施工日志
...@@ -64,4 +66,28 @@ public class ConstructionRecords extends BaseEntity { ...@@ -64,4 +66,28 @@ public class ConstructionRecords extends BaseEntity {
@TableField("peasant_household_id") @TableField("peasant_household_id")
private Long peasantHouseholdId; private Long peasantHouseholdId;
@TableField("notes")
private String notes;
public ConstructionRecords(String operator, String operationContent, Date operationTime, String operationResults, Long workOrderId, Long workOrderPowerStationId, Long peasantHouseholdId, String notes) {
this.operator = operator;
this.operationContent = operationContent;
this.operationTime = operationTime;
this.operationResults = operationResults;
this.workOrderId = workOrderId;
this.workOrderPowerStationId = workOrderPowerStationId;
this.peasantHouseholdId = peasantHouseholdId;
this.notes = notes;
}
public ConstructionRecords() {
}
@TableField(exist = false)
List<ConstructionRecords> constructionRecordsList;
} }
...@@ -21,7 +21,7 @@ import java.util.List; ...@@ -21,7 +21,7 @@ import java.util.List;
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@Accessors(chain = true) @Accessors(chain = true)
@TableName(value ="hygf_on_grid",autoResultMap = true) @TableName(value ="hygf_on_grid_and_acceptance",autoResultMap = true)
public class HygfOnGrid extends BaseEntity { public class HygfOnGrid extends BaseEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.hygf.biz.controller; ...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.hygf.biz.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.module.hygf.api.dto.*; import com.yeejoin.amos.boot.module.hygf.api.dto.*;
import com.yeejoin.amos.boot.module.hygf.api.entity.ConstructionRecords;
import com.yeejoin.amos.boot.module.hygf.api.entity.PeasantHousehold; import com.yeejoin.amos.boot.module.hygf.api.entity.PeasantHousehold;
import com.yeejoin.amos.boot.module.hygf.api.entity.PowerStationConstructionData; import com.yeejoin.amos.boot.module.hygf.api.entity.PowerStationConstructionData;
import com.yeejoin.amos.boot.module.hygf.api.entity.WorkOrder; import com.yeejoin.amos.boot.module.hygf.api.entity.WorkOrder;
...@@ -272,9 +273,26 @@ public class WorkOrderController extends BaseController { ...@@ -272,9 +273,26 @@ public class WorkOrderController extends BaseController {
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "完工登记审核详情", notes = "完工登记审核详情")
@GetMapping(value = "/getConstructionRecords")
public ResponseModel<PowerStationEngineeringInfoAllDto> getConstructionRecords(@RequestParam(value = "workOrderPowerStationId")Long workOrderPowerStationId) {
PowerStationEngineeringInfoAllDto returnDto = workOrderServiceImpl.getConstructionRecords(workOrderPowerStationId,getUserInfo().getRealName());
return ResponseHelper.buildResponse(returnDto);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "完工登记审核", notes = "完工登记审核")
@PostMapping(value = "/addConstructionRecords")
public ResponseModel<ConstructionRecords> addConstructionRecords( @RequestBody PowerStationEngineeringInfoAllDto constructionRecords) {
ConstructionRecords da= constructionRecords.getConstructionRecords();
da.setWorkOrderPowerStationId(constructionRecords.getWorkOrderPowerStationId());
ConstructionRecords returnDto = workOrderServiceImpl.addConstructionRecords(da);
return ResponseHelper.buildResponse(returnDto);
}
......
...@@ -81,7 +81,10 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor ...@@ -81,7 +81,10 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor
@Autowired @Autowired
HygfOnGridMapper hygfOnGridMapper; HygfOnGridMapper hygfOnGridMapper;
@Autowired
ConstructionRecordsServiceImpl constructionRecordsServiceImpl;
@Autowired
ConstructionRecordsMapper constructionRecordsMapper;
/** /**
* 分页查询 * 分页查询
*/ */
...@@ -99,7 +102,7 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor ...@@ -99,7 +102,7 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor
@Transactional
public WorkOrder saveWorkOrder (WorkOrder model, UserUnitInformationDto userUnitInformationDto) { public WorkOrder saveWorkOrder (WorkOrder model, UserUnitInformationDto userUnitInformationDto) {
//保存派工单 //保存派工单
RegionalCompanies regionalCompanies= regionalCompaniesMapper.selectRegionName(model.getRegionCompanyId()); RegionalCompanies regionalCompanies= regionalCompaniesMapper.selectRegionName(model.getRegionCompanyId());
...@@ -117,6 +120,8 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor ...@@ -117,6 +120,8 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor
workOrderMapper.insert(model); workOrderMapper.insert(model);
//保存派工单 电站信息 //保存派工单 电站信息
List<PeasantHousehold> peasantHouseholdId=model.getPeasantHouseholdId(); List<PeasantHousehold> peasantHouseholdId=model.getPeasantHouseholdId();
List<ConstructionRecords> constructionRecordlist=new ArrayList<>();
List<WorkOrderPowerStation> li=new ArrayList<>(); List<WorkOrderPowerStation> li=new ArrayList<>();
for (PeasantHousehold peasantHousehold : peasantHouseholdId) { for (PeasantHousehold peasantHousehold : peasantHouseholdId) {
WorkOrderPowerStation workOrderPowerStation=new WorkOrderPowerStation(); WorkOrderPowerStation workOrderPowerStation=new WorkOrderPowerStation();
...@@ -124,11 +129,30 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor ...@@ -124,11 +129,30 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor
workOrderPowerStation.setWorkOrderId(model.getSequenceNbr()); workOrderPowerStation.setWorkOrderId(model.getSequenceNbr());
workOrderPowerStation.setPowerStationConstructionStatus(WorkOrderEnum.待施工.getCode()); workOrderPowerStation.setPowerStationConstructionStatus(WorkOrderEnum.待施工.getCode());
li.add(workOrderPowerStation); li.add(workOrderPowerStation);
} }
workOrderPowerStationServiceImpl.saveBatch(li); workOrderPowerStationServiceImpl.saveBatch(li);
return model;
for (WorkOrderPowerStation workOrderPowerStation : li) {
//增加操作日志
ConstructionRecords da=new ConstructionRecords(
workOrderPowerStation.getRecUserName(),
"新建派工单",
new Date(),
"",
workOrderPowerStation.getWorkOrderId(),
workOrderPowerStation.getSequenceNbr(),
workOrderPowerStation.getPeasantHouseholdId(),
"");
constructionRecordlist.add(da);
} }
constructionRecordsServiceImpl.saveBatch(constructionRecordlist);
return model;
}
@Transactional
public WorkOrder updateWorkOrder (WorkOrder model, UserUnitInformationDto userUnitInformationDto) { public WorkOrder updateWorkOrder (WorkOrder model, UserUnitInformationDto userUnitInformationDto) {
//保存派工单 //保存派工单
RegionalCompanies regionalCompanies= regionalCompaniesMapper.selectRegionName(model.getRegionCompanyId()); RegionalCompanies regionalCompanies= regionalCompaniesMapper.selectRegionName(model.getRegionCompanyId());
...@@ -155,6 +179,25 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor ...@@ -155,6 +179,25 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor
li.add(workOrderPowerStation); li.add(workOrderPowerStation);
} }
workOrderPowerStationServiceImpl.saveBatch(li); workOrderPowerStationServiceImpl.saveBatch(li);
List<ConstructionRecords> constructionRecordlist=new ArrayList<>();
for (WorkOrderPowerStation workOrderPowerStation : li) {
//增加操作日志
ConstructionRecords da=new ConstructionRecords(
workOrderPowerStation.getRecUserName(),
"编辑派工单",
new Date(),
"",
workOrderPowerStation.getWorkOrderId(),
workOrderPowerStation.getSequenceNbr(),
workOrderPowerStation.getPeasantHouseholdId(),
"");
constructionRecordlist.add(da);
}
constructionRecordsServiceImpl.saveBatch(constructionRecordlist);
return model; return model;
} }
...@@ -255,6 +298,38 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor ...@@ -255,6 +298,38 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor
powerStationConstructionDataService.saveOrUpdate(powerStationConstructionData); powerStationConstructionDataService.saveOrUpdate(powerStationConstructionData);
//增加操作日志
if(powerStationConstructionData.getSequenceNbr()!=null){
ConstructionRecords da=new ConstructionRecords(
powerStationConstructionData.getRecUserName(),
"编辑施工资料",
new Date(),
"",
powerStationConstructionData.getWorkOrderId(),
powerStationConstructionData.getWorkOrderPowerStationId(),
null,
"");
constructionRecordsServiceImpl.save(da);
}else{
ConstructionRecords da=new ConstructionRecords(
powerStationConstructionData.getRecUserName(),
"新增施工资料",
new Date(),
"",
powerStationConstructionData.getWorkOrderId(),
powerStationConstructionData.getWorkOrderPowerStationId(),
null,
"");
constructionRecordsServiceImpl.save(da);
}
// }else{ // }else{
// //修改施工电站状态 // //修改施工电站状态
// LambdaUpdateWrapper<WorkOrderPowerStation> up=new LambdaUpdateWrapper(); // LambdaUpdateWrapper<WorkOrderPowerStation> up=new LambdaUpdateWrapper();
...@@ -592,6 +667,15 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor ...@@ -592,6 +667,15 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor
surveyInfoAllDto.setPowerStationEngineeringInfo(powerStationEngineeringInfo); surveyInfoAllDto.setPowerStationEngineeringInfo(powerStationEngineeringInfo);
surveyInfoAllDto.setWorkOrder(workOrder); surveyInfoAllDto.setWorkOrder(workOrder);
//施工自审
LambdaQueryWrapper<ConstructionRecords> up5=new LambdaQueryWrapper();
up5.eq(ConstructionRecords::getWorkOrderId,workOrderId);
up5.eq(ConstructionRecords::getWorkOrderPowerStationId,workOrderPowerStationId);
up5.orderByDesc(ConstructionRecords::getRecDate);
List<ConstructionRecords> li=constructionRecordsMapper.selectList(up5);
ConstructionRecords data=new ConstructionRecords();
data.setConstructionRecordsList(li);
surveyInfoAllDto.setConstructionRecords(data);
return surveyInfoAllDto; return surveyInfoAllDto;
// LambdaQueryWrapper<PeasantHousehold> peasantHouseholdWrapper = new LambdaQueryWrapper<>(); // LambdaQueryWrapper<PeasantHousehold> peasantHouseholdWrapper = new LambdaQueryWrapper<>();
// peasantHouseholdWrapper.eq(PeasantHousehold::getSequenceNbr, peasantHouseholdId); // peasantHouseholdWrapper.eq(PeasantHousehold::getSequenceNbr, peasantHouseholdId);
...@@ -662,7 +746,6 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor ...@@ -662,7 +746,6 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor
@Transactional @Transactional
public PowerStationEngineeringInfoAllDto addPowerStationEngineeringInfo(PowerStationEngineeringInfoAllDto powerStationEngineeringInfoAllDto){ public PowerStationEngineeringInfoAllDto addPowerStationEngineeringInfo(PowerStationEngineeringInfoAllDto powerStationEngineeringInfoAllDto){
LambdaQueryWrapper<WorkOrderPowerStation> qu=new LambdaQueryWrapper(); LambdaQueryWrapper<WorkOrderPowerStation> qu=new LambdaQueryWrapper();
qu.eq(WorkOrderPowerStation::getSequenceNbr,powerStationEngineeringInfoAllDto.getWorkOrderPowerStationId()); qu.eq(WorkOrderPowerStation::getSequenceNbr,powerStationEngineeringInfoAllDto.getWorkOrderPowerStationId());
WorkOrderPowerStation workOrderPowerStation=workOrderPowerStationMapper.selectOne(qu); WorkOrderPowerStation workOrderPowerStation=workOrderPowerStationMapper.selectOne(qu);
...@@ -684,12 +767,90 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor ...@@ -684,12 +767,90 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto,WorkOrder,Wor
upq.set(WorkOrder::getWorkOrderStatus,WorkOrderEnum.登记中.getCode()); upq.set(WorkOrder::getWorkOrderStatus,WorkOrderEnum.登记中.getCode());
workOrderMapper.update(null,upq); workOrderMapper.update(null,upq);
} }
//新增完工登记 //新增完工登记
PowerStationEngineeringInfo powerStationEngineeringInfo= powerStationEngineeringInfoAllDto.getPowerStationEngineeringInfo(); PowerStationEngineeringInfo powerStationEngineeringInfo= powerStationEngineeringInfoAllDto.getPowerStationEngineeringInfo();
powerStationEngineeringInfo.setWorkOrderId(workOrderPowerStation.getWorkOrderId()); powerStationEngineeringInfo.setWorkOrderId(workOrderPowerStation.getWorkOrderId());
powerStationEngineeringInfo.setWorkOrderPowerStationId(powerStationEngineeringInfoAllDto.getWorkOrderPowerStationId()); powerStationEngineeringInfo.setWorkOrderPowerStationId(powerStationEngineeringInfoAllDto.getWorkOrderPowerStationId());
powerStationEngineeringInfoMapper.insert(powerStationEngineeringInfo); powerStationEngineeringInfoMapper.insert(powerStationEngineeringInfo);
//增加操作日志
ConstructionRecords da=new ConstructionRecords(
powerStationEngineeringInfo.getRecUserName(),
"完工登记",
new Date(),
"",
workOrderPowerStation.getWorkOrderId(),
workOrderPowerStation.getSequenceNbr(),
workOrderPowerStation.getPeasantHouseholdId(),
"");
constructionRecordsServiceImpl.save(da);
return powerStationEngineeringInfoAllDto; return powerStationEngineeringInfoAllDto;
} }
public PowerStationEngineeringInfoAllDto getConstructionRecords(Long workOrderPowerStationId,String rename) {
LambdaQueryWrapper<WorkOrderPowerStation> qu=new LambdaQueryWrapper();
qu.eq(WorkOrderPowerStation::getSequenceNbr,workOrderPowerStationId);
WorkOrderPowerStation workOrderPowerStation=workOrderPowerStationMapper.selectOne(qu);
Long peasantHouseholdId=workOrderPowerStation.getPeasantHouseholdId();
Long workOrderId=workOrderPowerStation.getWorkOrderId();
PowerStationEngineeringInfoAllDto surveyInfoAllDto = new PowerStationEngineeringInfoAllDto();
//施工自审
LambdaQueryWrapper<ConstructionRecords> up5=new LambdaQueryWrapper();
up5.eq(ConstructionRecords::getWorkOrderId,workOrderId);
up5.eq(ConstructionRecords::getWorkOrderPowerStationId,workOrderPowerStationId);
up5.orderByDesc(ConstructionRecords::getRecDate);
List<ConstructionRecords> li=constructionRecordsMapper.selectList(up5);
ConstructionRecords data=new ConstructionRecords();
data.setConstructionRecordsList(li);
data.setOperationTime(new Date());
data.setOperator(rename);
surveyInfoAllDto.setConstructionRecords(data);
return surveyInfoAllDto;
}
@Transactional
public ConstructionRecords addConstructionRecords(ConstructionRecords constructionRecords){
LambdaQueryWrapper<WorkOrderPowerStation> qu=new LambdaQueryWrapper();
qu.eq(WorkOrderPowerStation::getSequenceNbr,constructionRecords.getWorkOrderPowerStationId());
WorkOrderPowerStation workOrderPowerStation=workOrderPowerStationMapper.selectOne(qu);
if(constructionRecords.getOperationResults().equals("通过")){
//修改电站状态
workOrderPowerStation.setPowerStationConstructionStatus(WorkOrderEnum.已完工.getCode());
}else{
//修改电站状态
workOrderPowerStation.setPowerStationConstructionStatus(WorkOrderEnum.未通过.getCode());
}
workOrderPowerStationMapper.updateById(workOrderPowerStation);
//修改派工单状态
LambdaQueryWrapper<WorkOrderPowerStation> qu1=new LambdaQueryWrapper();
qu1.eq(WorkOrderPowerStation::getWorkOrderId,workOrderPowerStation.getWorkOrderId());
List<String> d=new ArrayList<>();
d.add(WorkOrderEnum.施工中.getCode());
d.add(WorkOrderEnum.待施工.getCode());
d.add(WorkOrderEnum.待登记.getCode());
d.add(WorkOrderEnum.待审核.getCode());
qu1.in(WorkOrderPowerStation::getPowerStationConstructionStatus,d);
List<WorkOrderPowerStation> list=workOrderPowerStationMapper.selectList(qu1);
LambdaUpdateWrapper<WorkOrder> upq=new LambdaUpdateWrapper();
upq.eq(WorkOrder::getSequenceNbr,workOrderPowerStation.getWorkOrderId());
if(list==null&&list.isEmpty()){
upq.set(WorkOrder::getWorkOrderStatus,WorkOrderEnum.已完工.getCode());
workOrderMapper.update(null,upq);
}
//增加操作日志
constructionRecords.setWorkOrderId(workOrderPowerStation.getWorkOrderId());
constructionRecords.setWorkOrderPowerStationId(workOrderPowerStation.getSequenceNbr());
constructionRecords.setPeasantHouseholdId(workOrderPowerStation.getPeasantHouseholdId());
constructionRecordsServiceImpl.save(constructionRecords);
return constructionRecords;
}
} }
\ 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