Commit ffca4df9 authored by chenzhao's avatar chenzhao

存量合同新增

parent cd5fd404
......@@ -9,6 +9,8 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
......@@ -21,10 +23,10 @@ import java.util.List;
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value="SurveyInformationDto", description="勘察信息")
public class SurveyInformationDto extends BaseDto {
@ApiModel(value = "SurveyInformationDto", description = "勘察信息")
public class SurveyInformationDto extends BaseDto {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "勘察编号")
......@@ -49,7 +51,7 @@ public class SurveyInformationDto extends BaseDto {
@ApiModelProperty(value = "制单人")
private String creator;
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "制单时间")
private Date creatorTime;
......@@ -81,12 +83,12 @@ public class SurveyInformationDto extends BaseDto {
private String permanentAddressDetail;
@ApiModelProperty(value = "项目地址code")
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<Integer> projectAddress;
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<Integer> projectAddress;
@ApiModelProperty(value = "项目地址文字")
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<String> projectAddressText;
@ApiModelProperty(value = "项目地址文字")
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<String> projectAddressText;
@ApiModelProperty(value = "项目地址")
private String projectAddressName;
......@@ -95,9 +97,9 @@ public class SurveyInformationDto extends BaseDto {
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<Integer> permanentAddress;
@ApiModelProperty(value = "常住地址文字")
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<String> permanentAddressText;
@ApiModelProperty(value = "常住地址文字")
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<String> permanentAddressText;
@ApiModelProperty(value = "常住是否相同")
private String isPermanent;
......@@ -106,4 +108,19 @@ public class SurveyInformationDto extends BaseDto {
@ApiModelProperty(value = "定金")
private Float deposit;
@ApiModelProperty(value = "区域公司id")
@NotNull(message = "区域公司id不能为空")
private Long regionalCompaniesSeq;
@ApiModelProperty(value = "农户id")
private Long peasantHouseholdId;
@ApiModelProperty(value = "身份证正面")
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<Object> idCardFront;
@ApiModelProperty(value = "身份证反面")
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<Object> idCardOpposite;
}
......@@ -183,6 +183,11 @@ public class PeasantHousehold extends BaseEntity {
* */
@TableField("amos_user_id")
private String amosUserId;
/*
* 是否历史电站
* */
@TableField("is_history")
private String isHistory;
@TableField(exist = false)
protected Long stationId;
......
......@@ -112,6 +112,7 @@ public class PowerStationEngineeringInfo extends BaseEntity {
@TableField(value = "completion_date",updateStrategy = FieldStrategy.IGNORED)
@JsonFormat(pattern="yyyy-MM-dd")
private Date completionDate;
......
......@@ -3,11 +3,13 @@ package com.yeejoin.amos.boot.module.hygf.api.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.joda.time.LocalDateTime;
import javax.validation.constraints.NotNull;
import java.util.Date;
/**
......
......@@ -29,8 +29,8 @@ public interface PeasantHouseholdMapper extends BaseMapper<PeasantHousehold> {
@Param("ids")String ids
);
@UserEmpower(field={},dealerField={"developer_code","regional_companies_code","developer_user_id"} ,fieldConditions ={"eq","in","eq"} ,relationship="and")
List<PeasantHousehold> queryForPage( String developerCode,String ownersName,Long developerId,Integer isCertified,String preparationMoneyState, String peasantHouseholdNo,String province);
@UserEmpower(field={"regional_companies_code"},dealerField={"developer_code","regional_companies_code","developer_user_id"} ,fieldConditions ={"eq","in","eq"} ,relationship="and")
List<PeasantHousehold> queryForPage( String developerCode,String ownersName,Long developerId,Integer isCertified,String preparationMoneyState, String peasantHouseholdNo,String province,String isHistory,String regionalCompaniesSeq);
List<Map<String,Object>> selectUserIsHouse(String telephone);
......@@ -52,5 +52,6 @@ public interface PeasantHouseholdMapper extends BaseMapper<PeasantHousehold> {
void deleteHhcByNo(String peasantHouseholdNo);
List<PeasantHousehold> getInfoByIds(@Param(value = "ids") List<String> ids);
List<PeasantHousehold> getInfoByIdsHistory(@Param(value = "ids") List<String> ids);
// String getHygfCommercialScale(Long surveyInformationId);
}
......@@ -17,4 +17,6 @@ public interface PowerStationEngineeringInfoMapper extends BaseMapper<PowerStati
String getRealScaleByPeasantHouseholdNo(String peasantHouseholdNumber);
List<Map<String,String>> getRealScaleByPeasantHouseholdNoList(@Param("list") List<String> peasantHouseholdNumberList);
String getRealScaleByPeasantHouseholdNoIsHisotry(String peasantHouseholdNumber);
}
......@@ -18,6 +18,7 @@
CONCAT(info.disbursement_money,'') as disbursementMoney,
hph.regional_companies_code,
hph.developer_code,
hph.is_history isHistory,
info.financing_companies_name financingCompaniesName
FROM
`hygf_peasant_household` hph
......@@ -28,9 +29,18 @@
<if test="params.ownersName != null and params.ownersName !=''">
and hph.owners_name like concat('%',#{params.ownersName},'%')
</if>
<if test="params.isHistory != null and params.isHistory !='' and params.type != 2 ">
and hph.is_history is not null
</if>
<if test="(params.isHistory == null or params.isHistory == '') and params.type != 2">
and hph.is_history is null
</if>
<if test="params.regionalCompaniesCode != null and params.regionalCompaniesCode !=''">
and hph.regional_companies_code = #{params.regionalCompaniesCode}
</if>
<if test="params.batchNo != null and params.batchNo !=''">
and info.batch_no = #{batchNo}
</if>
<if test="params.type == 2 ">
and info.status in ('待融资审核','审核通过','放款完成','已放款','审核不通过' ) and info.financing_companies_seq = #{params.financingCompaniesSeq}
</if>
......
......@@ -77,6 +77,15 @@ on hygf_document_station.preparation_money_id=hygf_preparation_money.sequence_nb
<if test="province != null and province != ''">
and project_address like concat(concat('%',#{province}),'%')
</if>
<if test="isHistory != null and isHistory != ''">
and is_history = '1'
</if>
<if test="regionalCompaniesSeq != null and regionalCompaniesSeq != ''">
and regional_companies_seq = #{regionalCompaniesSeq}
</if>
<if test="isHistory == null or isHistory == ''">
and is_history is null
</if>
ORDER BY creation_time DESC
</select>
<select id="selectUserIsHouse" resultType="java.util.Map">
......@@ -158,6 +167,26 @@ on hygf_document_station.preparation_money_id=hygf_preparation_money.sequence_nb
</where>
</select>
<select id="getInfoByIdsHistory" resultType="com.yeejoin.amos.boot.module.hygf.api.entity.PeasantHousehold">
SELECT
ph.sequence_nbr,
ph.owners_name,
concat( ph.project_address_name, ph.project_address_detail ) AS project_address_name,
(ei.component_quantity * ei.component_specification / 1000) as realScale
FROM
hygf_peasant_household ph
LEFT JOIN hygf_power_station_engineering_info ei ON ei.work_order_power_station_id= ph.sequence_nbr
<where>
ph.is_delete = 0
<if test="ids != null and ids.size()>0">
AND ph.sequence_nbr IN
<foreach collection="ids" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
</select>
<!-- <select id="getHygfCommercialScale" resultType="String">-->
<!-- select scale from hygf_commercial where survey_information_id=${surveyInformationId}-->
<!-- </select>-->
......
......@@ -27,4 +27,15 @@
#{peasantHouseholdNo}
</foreach>
</select>
<select id="getRealScaleByPeasantHouseholdNoIsHisotry" resultType="String">
select
hpsei.real_scale realScale
from
hygf_peasant_household hph,
hygf_power_station_engineering_info hpsei
where
hph.peasant_household_no = #{peasantHouseholdNo} and
hph.sequence_nbr = hpsei.work_order_power_station_id
</select>
</mapper>
......@@ -165,11 +165,12 @@ public class FinancingInfoController extends BaseController {
@RequestParam(value = "regionalCompaniesCode" ,required = false) String regionalCompaniesCode ,
@RequestParam(value = "region" ,required = false) String region ,
@RequestParam(value = "batchNo" ,required = false) String batchNo ,
@RequestParam(value = "isHistory" ,required = false) String isHistory ,
@RequestParam(value = "ownersName",required = false) String ownersName){
Page<Map<String, Object>> page = new Page<Map<String, Object>>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(financingInfoServiceImpl.queryForFinancingInfoPage(page,type,status,regionalCompaniesCode,ownersName, region,batchNo));
return ResponseHelper.buildResponse(financingInfoServiceImpl.queryForFinancingInfoPage(page,type,status,regionalCompaniesCode,ownersName, region,batchNo,isHistory));
}
/**
......
......@@ -9,6 +9,7 @@ import com.yeejoin.amos.boot.module.hygf.api.Enum.PeasantHouseholdEnum;
import com.yeejoin.amos.boot.module.hygf.api.config.UserEmpower;
import com.yeejoin.amos.boot.module.hygf.api.config.UserLimits;
import com.yeejoin.amos.boot.module.hygf.api.dto.PeasantHouseholdDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.PowerStationEngineeringInfoAllDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.SurveyInformationDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.UserUnitInformationDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.PeasantHousehold;
......@@ -209,7 +210,9 @@ public class PeasantHouseholdController extends BaseController {
@RequestParam(value = "size") int size,
@RequestParam(value = "ownersName",required = false)String ownersName,
@RequestParam(value = "preparationMoneyState",required = false)String preparationMoneyState,
@RequestParam(value = "isHistory",required = false)String isHistory,
@RequestParam(value = "developerId",required = false)Long developerId,
@RequestParam(value = "regionalCompaniesSeq",required = false)String regionalCompaniesSeq,
@RequestParam(value = "peasantHouseholdNo",required = false) String peasantHouseholdNo,
@RequestParam(value = "province",required = false) String province) {
Page<PeasantHousehold> page = new Page<PeasantHousehold>();
......@@ -224,7 +227,7 @@ public class PeasantHouseholdController extends BaseController {
// String orgCode = userUnitInformationDto.getAmosDealerOrgCode();
Integer isCertified = PeasantHouseholdEnum.已认证.getCode();
return ResponseHelper.buildResponse(peasantHouseholdServiceImpl.queryForPeasantHouseholdPage(page, null,ownersName,developerId,isCertified,preparationMoneyState, peasantHouseholdNo,province));
return ResponseHelper.buildResponse(peasantHouseholdServiceImpl.queryForPeasantHouseholdPage(page, null,ownersName,developerId,isCertified,preparationMoneyState, peasantHouseholdNo,province,isHistory,regionalCompaniesSeq));
}
/**
......@@ -281,6 +284,13 @@ public class PeasantHouseholdController extends BaseController {
return ResponseHelper.buildResponse(peasantHouseholdServiceImpl.getInfoByIds(ids));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "农户信息列表根据ids查询历史电站", notes = "农户信息列表根据ids查询历史电站")
@GetMapping(value = "/getInfoByIdsHistory")
public ResponseModel<List<PeasantHousehold>> getInfoByIdsHistory(String ids) {
return ResponseHelper.buildResponse(peasantHouseholdServiceImpl.getInfoByIdsHistory(ids));
}
/**
* 根据sequenceNbr和userId删除用户信息
......@@ -294,4 +304,31 @@ public class PeasantHouseholdController extends BaseController {
public ResponseModel<Boolean> deleteUser(@PathVariable String sequenceNbr, @PathVariable String peasantHouseholdNo) {
return ResponseHelper.buildResponse(peasantHouseholdServiceImpl.deleteUser(sequenceNbr, peasantHouseholdNo));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST",value = "更新详情信息", notes = "更新详情信息")
@PostMapping(value = "/saveHistory")
public ResponseModel updateDetail(@RequestBody PowerStationEngineeringInfoAllDto powerStationEngineeringInfoAllDto,@RequestParam(value = "operationType") String operationType) {
peasantHouseholdServiceImpl.saveHistoryPeasantHousehold(powerStationEngineeringInfoAllDto,operationType);
return ResponseHelper.buildResponse(null);
}
/**
* 批量删除
*
* @param sequenceNbrList 主键
* @return 返回结果
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/deleteBatch")
@ApiOperation(httpMethod = "DELETE", value = "批量删除", notes = "批量删除")
public ResponseModel<Boolean> batchDeleteBySequenceNbrList(@RequestParam List<Long> sequenceNbrList) {
for (Long aLong : sequenceNbrList) {
peasantHouseholdServiceImpl.deletePeasantHouseholdBySequenceNbr(aLong);
}
return ResponseHelper.buildResponse(null);
}
}
......@@ -136,6 +136,14 @@ public class PeasantHouseholdWxController extends BaseController {
return ResponseHelper.buildResponse(peasantHouseholdServiceImpl.getPeasantHousePage(peasantHouseholdPageDto));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/getPeasantHouseHistoryPage", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "分页获取农户", notes = "分页获取农户信息")
public ResponseModel<IPage<PeasantHousehold>> getPeasantHouseHistoryPage(@RequestBody PeasantHouseholdPageDto peasantHouseholdPageDto) {
return ResponseHelper.buildResponse(peasantHouseholdServiceImpl.getPeasantHouseHistoryPage(peasantHouseholdPageDto));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/addPeasantHousehold", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "新增农户", notes = "新增农户")
......
......@@ -2,12 +2,15 @@ package com.yeejoin.amos.boot.module.hygf.biz.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.hygf.api.dto.PowerStationEngineeringInfoAllDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.SurveyInfoAllDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.SurveyInformationDto;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.SurveyInformationServiceImpl;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.WorkOrderServiceImpl;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
......@@ -31,6 +34,8 @@ public class SurveyInformationController extends BaseController {
@Autowired
SurveyInformationServiceImpl surveyInformationServiceImpl;
@Autowired
WorkOrderServiceImpl workOrderService;
/**
* 新增勘察信息
......@@ -138,11 +143,18 @@ public class SurveyInformationController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "勘察信息编辑", notes = "勘察信息编辑")
@GetMapping(value = "/surveyQuery")
public ResponseModel<SurveyInfoAllDto> surveyQuery(@RequestParam(value = "surveyInformationId",required = false ) String surveyInformationId,
public ResponseModel<Object> surveyQuery(@RequestParam(value = "surveyInformationId",required = false ) String surveyInformationId,
@RequestParam(value = "peasantHouseholdId",required = false ) String peasantHouseholdId,
@RequestParam(value = "isHistory",required = false ) String isHistory,
@RequestParam(value = "processInstanceId",required = false)String processInstanceId) {
AgencyUserModel userInfo = getUserInfo();
SurveyInfoAllDto returnDto = surveyInformationServiceImpl.querySurveyInfo(surveyInformationId,peasantHouseholdId,processInstanceId,userInfo);
return ResponseHelper.buildResponse(returnDto);
if (StringUtils.isNotEmpty(isHistory)){
PowerStationEngineeringInfoAllDto powerStationEngineeringInfoHistory = workOrderService.getPowerStationEngineeringInfoHistory(Long.valueOf(peasantHouseholdId), processInstanceId);
return ResponseHelper.buildResponse(powerStationEngineeringInfoHistory);
}else {
SurveyInfoAllDto returnDto = surveyInformationServiceImpl.querySurveyInfo(surveyInformationId,peasantHouseholdId,processInstanceId,userInfo);
return ResponseHelper.buildResponse(returnDto);
}
}
}
......@@ -337,6 +337,15 @@ public class WorkOrderController extends BaseController {
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "完工登记详情", notes = "完工登记详情")
@GetMapping(value = "/getPowerStationEngineeringInfoHistory")
public ResponseModel<PowerStationEngineeringInfoAllDto> getPowerStationEngineeringInfoHistory(@RequestParam(value = "peasantHouseholdId")Long peasantHouseholdId , @RequestParam(value = "processInstanceId",required = false)String processInstanceId) {
PowerStationEngineeringInfoAllDto returnDto = workOrderServiceImpl.getPowerStationEngineeringInfoHistory(peasantHouseholdId,processInstanceId);
return ResponseHelper.buildResponse(returnDto);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "完工登记", notes = "完工登记")
@PostMapping (value = "/addPowerStationEngineeringInfo")
public ResponseModel<PowerStationEngineeringInfoAllDto> addPowerStationEngineeringInfo(
......
......@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
......@@ -13,6 +14,9 @@ import com.yeejoin.amos.boot.module.hygf.api.Enum.FlowStatusEnum;
import com.yeejoin.amos.boot.module.hygf.api.dto.TaskModelDto;
import com.yeejoin.amos.boot.module.hygf.api.util.JsonUtils;
import com.yeejoin.amos.boot.module.hygf.biz.feign.TaskV2FeignService;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import com.yeejoin.amos.feign.systemctl.model.TaskV2Model;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
......@@ -45,6 +49,10 @@ public class CommonServiceImpl {
@Value("classpath:/json/urlInfo.json")
private Resource urlInfo;
private static final String regionRedis = "app_region_redis";
@Autowired
RedisUtils redisUtil;
private static String toQueryParams2(JSONObject jsonObject) {
StringBuilder sb = new StringBuilder();
Set<String> keys = jsonObject.keySet();
......@@ -362,4 +370,37 @@ public class CommonServiceImpl {
return sb.length() > 0 ? sb.substring(0, sb.length() - 1) : "";
}
public JSONArray getRegionName() {
JSONArray jsonArray = new JSONArray();
if (redisUtil.hasKey(regionRedis)) {
jsonArray = JSONArray.parseArray(redisUtil.get(regionRedis).toString());
} else {
Collection<RegionModel> regionChild = new ArrayList<>();
RegionModel regionModel1 = new RegionModel();
regionChild.add(regionModel1);
FeignClientResult<Collection<RegionModel>> collectionFeignClientResult = Systemctl.regionClient.queryForTreeParent(null);
Collection<RegionModel> result = collectionFeignClientResult.getResult();
for (RegionModel regionModel : result) {
if (null != regionModel && null != regionModel.getChildren()) {
for (RegionModel child : regionModel.getChildren()) {
if (null != child && null != child.getChildren()) {
for (RegionModel childChild : child.getChildren()) {
jsonArray.add(childChild);
}
child.setChildren(regionChild);
jsonArray.add(child);
}
}
regionModel.setChildren(regionChild);
jsonArray.add(regionModel);
}else {
jsonArray.add(regionModel);
}
}
redisUtil.set(regionRedis, jsonArray);
}
return jsonArray;
}
}
\ No newline at end of file
......@@ -88,7 +88,7 @@ public class FinancingInfoServiceImpl extends BaseService<FinancingInfoDto, Fina
private RedisLockUtil redisLockUtil;
@UserLimits
public Page<Map<String, Object>> queryForFinancingInfoPage(Page<Map<String, Object>> page, String type, String status, String regionalCompaniesCode, String ownersName, String region,String batchNo) {
public Page<Map<String, Object>> queryForFinancingInfoPage(Page<Map<String, Object>> page, String type, String status, String regionalCompaniesCode, String ownersName, String region,String batchNo,String isHistory) {
StdUserEmpower orgCode = (StdUserEmpower) redisUtils.get("Emp_" + RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken()));
ReginParams reginParams = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
List<String> amosOrgCodes = orgCode.getAmosOrgCode();
......@@ -99,6 +99,8 @@ public class FinancingInfoServiceImpl extends BaseService<FinancingInfoDto, Fina
}
params.put("regionalCompaniesCode", regionalCompaniesCode);
params.put("type", type);
params.put("batchNo", batchNo);
params.put("isHistory", isHistory);
params.put("region", region);
// 1 投融人员 2.融资 3经销商管理员
switch (type) {
......@@ -115,8 +117,11 @@ public class FinancingInfoServiceImpl extends BaseService<FinancingInfoDto, Fina
List<Map<String, Object>> list = financingInfoMapper.getStationFinancingInfoList(params, amosOrgCodes);
list.forEach(e -> {
e.put("scale", householdContractMapper.getHygfCommercialScale((String) e.get("peasantHouseholdNo")));
e.put("realScale", powerStationEngineeringInfoMapper.getRealScaleByPeasantHouseholdNo((String) e.get("peasantHouseholdNo")));
if (e.containsKey("isHistory") && e.get("isHistory").toString().equals("1")){
e.put("realScale", powerStationEngineeringInfoMapper.getRealScaleByPeasantHouseholdNoIsHisotry((String) e.get("peasantHouseholdNo")));
}else {
e.put("realScale", powerStationEngineeringInfoMapper.getRealScaleByPeasantHouseholdNo((String) e.get("peasantHouseholdNo")));
}
e.put("regionName",e.get("projectAddress").toString().split("/")[0]);
if (null != e.get("instanceId") && e.get("instanceId").toString().contains(",")) {
String[] instanceIds = e.get("instanceId").toString().split(",");
......@@ -351,16 +356,28 @@ public class FinancingInfoServiceImpl extends BaseService<FinancingInfoDto, Fina
//标识对于整改待推送状态
if (params.containsKey("isZG")) {
financingInfo.setStatus("待推送");
} else {
}else {
financingInfo.setStatus(statusName);
}
if (params.containsKey("isHistory")) {
financingInfo.setStatus("退回建档");
}
this.updateById(financingInfo);
//节点为待整改时生成整改单
if (params.containsKey("isFlag") && params.get("isFlag").equals("1") && workflowResultDto.getNextNodeKey().equals(FinancingAuditEnum.待整改.getCode())) {
this.sendBack(financingInfo.getPeasantHouseholdId());
if (params.containsKey("isHistory")){
LambdaUpdateWrapper<PeasantHousehold> up = new LambdaUpdateWrapper<>();
up.set(PeasantHousehold::getPreparationMoneyState,"待提交");
up.eq(BaseEntity::getSequenceNbr,financingAuditing.getPeasantHouseholdId());
peasantHouseholdService.getBaseMapper().update(null,up);
}else if (!params.containsKey("isHistory")){
this.sendBack(financingInfo.getPeasantHouseholdId());
}
// LambdaQueryWrapper<FinancingRectificationOrder> queryWrapper = new LambdaQueryWrapper<>();
// queryWrapper.eq(FinancingRectificationOrder::getPeasantHouseholdId, financingInfo.getPeasantHouseholdId());
......
......@@ -2,12 +2,15 @@ package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.map.MapBuilder;
import cn.hutool.core.util.BooleanUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageHelper;
......@@ -25,12 +28,14 @@ import com.yeejoin.amos.boot.module.hygf.api.entity.*;
import com.yeejoin.amos.boot.module.hygf.api.mapper.*;
import com.yeejoin.amos.boot.module.hygf.api.service.IPeasantHouseholdService;
import com.yeejoin.amos.boot.module.hygf.api.service.IWxService;
import com.yeejoin.amos.boot.module.hygf.api.util.BeanDtoUtils;
import com.yeejoin.amos.boot.module.hygf.api.util.NumberUtil;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.component.robot.AmosRequestContext;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.*;
import com.yeejoin.amos.feign.privilege.util.DesUtil;
import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
......@@ -65,6 +70,8 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
@Autowired
SurveyInformationServiceImpl surveyInformationService;
@Autowired
private FinancingInfoServiceImpl financingInfoService;
@Autowired
SurveyDetailsServiceImpl surveyDetailsService;
@Autowired
InformationServiceImpl informationService;
......@@ -73,6 +80,8 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
@Autowired
CommercialServiceImpl commercialService;
@Autowired
DesignInformationServiceImpl designInformationService;
@Autowired
PeasantHouseholdMapper peasantHouseholdMapper;
@Autowired
HouseholdContractMapper householdContractMapper;
......@@ -93,7 +102,16 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
@Autowired
RegionalCompaniesMapper regionalCompaniesMapper;
private Long TOKEN_TIME = 1209600l;
@Autowired
CommonServiceImpl commonService;
@Autowired
HygfOnGridServiceImpl hygfOnGridService;
@Autowired
PowerStationConstructionDataServiceImpl powerStationConstructionDataService;
@Autowired
PowerStationEngineeringInfoServiceImpl powerStationEngineeringInfoService;
@Autowired
FinancingAuditingServiceImpl financingAuditingService;
@Value("${amos.system.user.product}")
private String product;
......@@ -133,6 +151,9 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
@Autowired
private IWxService wxService;
@Autowired
private UnitInfoServiceImpl unitInfoService;
@Transactional(rollbackFor = Exception.class)
public PeasantHouseholdDto savePeasantHousehold(PeasantHouseholdDto model, AgencyUserModel userInfo) {
SurveyInformationDto surveyInformationDto = new SurveyInformationDto();
......@@ -207,14 +228,29 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
QueryWrapper<Commercial> commercialDeleteWrapper = new QueryWrapper<>();
commercialDeleteWrapper.lambda().eq(Commercial::getSurveyInformationId,surveyInformationId);
commercialService.getBaseMapper().delete(commercialDeleteWrapper);
//删除资料归档信息
//删除资料归档信息
QueryWrapper<Information> informationDeleteWrapper = new QueryWrapper<>();
informationDeleteWrapper.lambda().eq(Information::getSurveyInformationId,surveyInformationId);
informationService.getBaseMapper().delete(informationDeleteWrapper);
QueryWrapper<PowerStationConstructionData> powerStationConstructionDataQueryWrapper = new QueryWrapper<>();
powerStationConstructionDataQueryWrapper.lambda().eq(PowerStationConstructionData::getWorkOrderPowerStationId,sequenceNbr);
powerStationConstructionDataService.getBaseMapper().delete(powerStationConstructionDataQueryWrapper);
QueryWrapper<HygfOnGrid> hygfOnGridQueryWrapper = new QueryWrapper<>();
hygfOnGridQueryWrapper.lambda().eq(HygfOnGrid::getPeasantHouseholdId,sequenceNbr);
hygfOnGridService.getBaseMapper().delete(hygfOnGridQueryWrapper);
QueryWrapper<DesignInformation> designInformationQueryWrapper = new QueryWrapper<>();
designInformationQueryWrapper.lambda().eq(DesignInformation::getPeasantHouseholdId,sequenceNbr);
designInformationService.getBaseMapper().delete(designInformationQueryWrapper);
QueryWrapper<PowerStationEngineeringInfo> powerStationEngineeringInfoQueryWrapper = new QueryWrapper<>();
powerStationEngineeringInfoQueryWrapper.lambda().eq(PowerStationEngineeringInfo::getWorkOrderPowerStationId,sequenceNbr);
powerStationEngineeringInfoService.getBaseMapper().delete(powerStationEngineeringInfoQueryWrapper);
//删除农户信息
return this.deleteBySeq(sequenceNbr);
}
public String getkcNo(Long sequenceNbr) {
RegionalCompanies da= regionalCompaniesMapper.selectRegionName(sequenceNbr);
if(da.getCompanyCode()==null||da.getCompanyCode().isEmpty()){
......@@ -231,12 +267,18 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
* 分页查询
*/
public Page<PeasantHousehold> queryForPeasantHouseholdPage(Page<PeasantHousehold> page,String developerCode, String ownersName,Long developerId, Integer isCertified,String preparationMoneyState, String peasantHouseholdNo,String province) {
public Page<PeasantHousehold> queryForPeasantHouseholdPage(Page<PeasantHousehold> page,String developerCode, String ownersName,Long developerId, Integer isCertified,String preparationMoneyState, String peasantHouseholdNo,String province,String isHistory,String regionalCompaniesSeq) {
int current = (int)page.getCurrent();
int size = (int)page.getSize();
PageHelper.startPage(current,size);
List<PeasantHousehold> records = peasantHouseholdMapper.queryForPage( developerCode,ownersName,developerId, isCertified,preparationMoneyState, peasantHouseholdNo,province);
if (null != developerId ){
UnitInfo unitInfo = unitInfoService.getBaseMapper().selectById(developerId);
developerId = unitInfo.getAmosCompanySeq();
}
List<PeasantHousehold> records = peasantHouseholdMapper.queryForPage( developerCode,ownersName,developerId, isCertified,preparationMoneyState, peasantHouseholdNo,province,isHistory,regionalCompaniesSeq);
PageInfo<PeasantHousehold> objectPageInfo = new PageInfo<PeasantHousehold>(records);
......@@ -278,10 +320,13 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
newRecords.forEach(e -> {
if(e.getPeasantHouseholdNo() != null) {
e.setScale(householdContractMapper.getHygfCommercialScale(e.getPeasantHouseholdNo()));
e.setRealScale(powerStationEngineeringInfoMapper.getRealScaleByPeasantHouseholdNo(e.getPeasantHouseholdNo()));
if ("1".equals(e.getIsHistory())){
e.setRealScale(powerStationEngineeringInfoMapper.getRealScaleByPeasantHouseholdNoIsHisotry(e.getPeasantHouseholdNo()));
}else {
e.setRealScale(powerStationEngineeringInfoMapper.getRealScaleByPeasantHouseholdNo(e.getPeasantHouseholdNo()));
}
}
});
}
pagenew.setRecords(newRecords);
......@@ -804,6 +849,12 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
}
public List<PeasantHousehold> getInfoByIdsHistory(String ids) {
List<String> strings = Arrays.asList(ids.split(","));
return this.getBaseMapper().getInfoByIdsHistory(strings);
}
@Override
public Boolean deleteUser(String sequenceNbr, String peasantHouseholdNo) {
// try {
......@@ -922,6 +973,7 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
queryWrapper.like(StrUtil.isNotEmpty(peasantHouseholdPageDto.getPeasantHouseholdNo()),"peasant_household_no", "%"+peasantHouseholdPageDto.getPeasantHouseholdNo()+"%");
queryWrapper.like(StrUtil.isNotEmpty(peasantHouseholdPageDto.getRegionalCompaniesName()),"regional_companies_name", "%"+peasantHouseholdPageDto.getRegionalCompaniesName()+"%");
queryWrapper.like(StrUtil.isNotEmpty(peasantHouseholdPageDto.getDeveloperName()),"developer_name", "%"+peasantHouseholdPageDto.getDeveloperName()+"%");
queryWrapper.isNull("is_history");
queryWrapper.orderByDesc("rec_date");
IPage<PeasantHousehold> peasantHouseholdIPage = this.baseMapper.selectPage(new Page<>(peasantHouseholdPageDto.getCurrent(), peasantHouseholdPageDto.getSize()), queryWrapper);
......@@ -938,4 +990,372 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
return peasantHouseholdIPage;
}
public IPage<PeasantHousehold> getPeasantHouseHistoryPage(PeasantHouseholdPageDto peasantHouseholdPageDto) {
QueryWrapper<PeasantHousehold> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("amos_user_id", peasantHouseholdPageDto.getNhUserId());
queryWrapper.like(StrUtil.isNotEmpty(peasantHouseholdPageDto.getPeasantHouseholdNo()),"peasant_household_no", "%"+peasantHouseholdPageDto.getPeasantHouseholdNo()+"%");
queryWrapper.like(StrUtil.isNotEmpty(peasantHouseholdPageDto.getRegionalCompaniesName()),"regional_companies_name", "%"+peasantHouseholdPageDto.getRegionalCompaniesName()+"%");
queryWrapper.like(StrUtil.isNotEmpty(peasantHouseholdPageDto.getDeveloperName()),"developer_name", "%"+peasantHouseholdPageDto.getDeveloperName()+"%");
queryWrapper.eq("is_history","1");
queryWrapper.orderByDesc("rec_date");
IPage<PeasantHousehold> peasantHouseholdIPage = this.baseMapper.selectPage(new Page<>(peasantHouseholdPageDto.getCurrent(), peasantHouseholdPageDto.getSize()), queryWrapper);
if(peasantHouseholdIPage.getRecords() != null && peasantHouseholdIPage.getRecords().size() > 0) {
peasantHouseholdIPage.getRecords().forEach(e -> {
if(e.getPeasantHouseholdNo() != null) {
e.setScale(householdContractMapper.getHygfCommercialScale(e.getPeasantHouseholdNo()));
e.setRealScale(powerStationEngineeringInfoMapper.getRealScaleByPeasantHouseholdNo(e.getPeasantHouseholdNo()));
}
});
}
return peasantHouseholdIPage;
}
public void saveHistoryPeasantHousehold(PowerStationEngineeringInfoAllDto surveyInfoAllDto,String operationType) {
SurveyInformationDto model = surveyInfoAllDto.getSurveyInformation();
if (null == model.getDeveloperId()|| null == model.getRegionalCompaniesSeq()){
throw new BadRequest("区域公司及经销商不可为空");
}
if (null == model.getTelephone()){
throw new BadRequest("联系电话不可为空");
}
if (null == model.getOwnersName()){
throw new BadRequest("业主姓名不可为空");
}
if (null == model.getIdCard()){
throw new BadRequest("身份证号码不可为空");
}
if (null == model.getIdCardFront()|| null == model.getIdCardOpposite()){
throw new BadRequest("身份证图片不可为空");
}
if (null == model.getPermanentAddress()){
throw new BadRequest("常住地址不可为空");
}
if ( null == model.getPermanentAddressDetail()){
throw new BadRequest("常住详细地址不可为空");
}
if (null == model.getProjectAddress()){
throw new BadRequest("项目地址不可为空");
}
if (null == model.getProjectAddressDetail()){
throw new BadRequest("项目详细地址不可为空");
}
List<String> ids = new ArrayList<>();
ids.add(String.valueOf(model.getDeveloperId()));
ids.add(String.valueOf(model.getRegionalCompaniesSeq()));
// MobileLoginParamDto mobileLoginParamDto = new MobileLoginParamDto();
// mobileLoginParamDto.setPhoneNo(model.getTelephone());
// // 机器人token
// RequestContext.setAppKey("AMOS_STUDIO");
// RequestContext.setProduct("AMOS_STUDIO_WEB");
// RequestContext.setToken(requestContext.getToken());
// AgencyUserModel registerUserModel = null;
// // region 判断有无在平台内部注册过用户 没有注册则去平台注册
// FeignClientResult<LoginInfoModel> loginInfo = Privilege.agencyUserClient.getLoginInfo(mobileLoginParamDto.getPhoneNo());
//
// if (loginInfo != null && 200 == loginInfo.getStatus()) {
// LoginInfoModel loginInfoModel = loginInfo.getResult();
// if (loginInfoModel == null || !StringUtils.isNotBlank(loginInfoModel.getLoginId())) {
// FeignClientResult<AgencyUserModel> registerUserModelRestult = doRegister(mobileLoginParamDto);
// if (registerUserModelRestult == null || registerUserModelRestult.getStatus() != 200) {
// log.error("用户手机号码 => " + mobileLoginParamDto.getPhoneNo() + " 调用平台创建用户信息失败: " + registerUserModelRestult.getDevMessage());
// throw new RuntimeException(registerUserModelRestult.getMessage());
// }
// registerUserModel = registerUserModelRestult.getResult();
// }
// }
// 更新勘察基本信息
//新增农户电站信息
SurveyInformation surveyInformation = BeanDtoUtils.convert(model,
SurveyInformation.class);
surveyInformation.setSurveyNumber(Optional.ofNullable(surveyInformation).map(SurveyInformation::getSurveyNumber).orElse(this.getkcNo(model.getRegionalCompaniesSeq())));
PeasantHousehold peasantHousehold = new PeasantHousehold();
if (model.getSequenceNbr() != null ){
peasantHousehold.setSequenceNbr(model.getPeasantHouseholdId());
}
if (model.getPeasantHouseholdNo() == null ){
peasantHousehold.setPeasantHouseholdNo(this.getPeasantHouseholdNo(model.getRegionalCompaniesSeq()));
}
surveyInformationServiceImpl.saveOrUpdate(surveyInformation);
peasantHousehold.setIsCertified(1);
peasantHousehold.setIsHistory("1");
peasantHousehold.setReview(2);
peasantHousehold.setSurveyInformationId(surveyInformation.getSequenceNbr());
if (operationType.equals("apply")){
peasantHousehold.setConstructionState("验收完成");
peasantHousehold.setPreparationMoneyState("建档完成");
if (peasantHousehold.getSequenceNbr() != null ){
//完成后需对投融数据进行处理。
LambdaUpdateWrapper<FinancingInfo> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(FinancingInfo::getPeasantHouseholdId,peasantHousehold.getSequenceNbr());
wrapper.set(FinancingInfo::getStatus,"待推送");
financingInfoService.update(null,wrapper);
LambdaQueryWrapper<FinancingAuditing> finQuery = new LambdaQueryWrapper<>();
finQuery.eq(FinancingAuditing::getPeasantHouseholdId,peasantHousehold.getSequenceNbr());
finQuery.orderByDesc(BaseEntity::getRecDate);
finQuery.last("limit 1");
FinancingAuditing financingAuditing = financingAuditingService.getBaseMapper().selectOne(finQuery);
if (!Objects.isNull(financingAuditing)){
financingInfoService.execueFlow(MapBuilder.<String,Object>create().put("instanceId",financingAuditing.getInstanceId()).put("approvalStatus","0").put("isZG","1").build());
}
}
}else {
if (null !=peasantHousehold.getSequenceNbr() ){
PeasantHousehold peasantHousehold1 = this.getBaseMapper().selectById(peasantHousehold.getSequenceNbr());
if (peasantHousehold1.getPreparationMoneyState().equals("待提交")){
}else {
peasantHousehold.setPreparationMoneyState("暂存中");
}
}else {
peasantHousehold.setPreparationMoneyState("暂存中");
}
}
// peasantHousehold.setAmosUserId(registerUserModel.getUserId());
peasantHousehold.setTelephone(model.getTelephone());
peasantHousehold.setCreationTime(new Date());
List<Map<String, Object>> maps = financingInfoService.getBaseMapper().selectCompany(ids);
UnitInfo unitInfo = unitInfoService.getBaseMapper().selectById(model.getDeveloperId());
if (unitInfo != null){
peasantHousehold.setDeveloperCode(unitInfo.getAmosCompanyCode());// 开发方code
peasantHousehold.setDeveloperId(unitInfo.getAmosCompanySeq());// 开发方id
peasantHousehold.setDeveloperName(unitInfo.getName());// 开发方名称
// peasantHousehold.setDeveloper();// 开发人
// peasantHousehold.setDeveloperUserId();
}
maps.stream().forEach(e->{
if (String.valueOf(e.get("SEQUENCE_NBR")) .equals(String.valueOf(model.getRegionalCompaniesSeq()))){
peasantHousehold.setRegionalCompaniesCode(e.get("ORG_CODE").toString());// 开发方code
peasantHousehold.setRegionalCompaniesSeq(model.getRegionalCompaniesSeq());// 开发方id
peasantHousehold.setRegionalCompaniesName(e.get("COMPANY_NAME").toString());// 开发方名称
}
});
// PeasantHouseholdDto peasantHouseholdDto = buildDefaultPeasantHouseholdDto(wxDTO.getAmosUserId(), wxDTO.getQrCodeType(), wxDTO.getPhoneNo());
//
// peasantHousehold.setRegionalCompaniesSeq(Optional.ofNullable(peasantHouseholdDto).map(PeasantHouseholdDto::getRegionalCompaniesSeq).orElse(null));
// peasantHousehold.setRegionalCompaniesCode(Optional.ofNullable(peasantHouseholdDto).map(PeasantHouseholdDto::getRegionalCompaniesCode).orElse(null));
// peasantHousehold.setRegionalCompaniesName(Optional.ofNullable(peasantHouseholdDto).map(PeasantHouseholdDto::getRegionalCompaniesName).orElse(null));
// peasantHousehold.setIsCertified(1);// 这里就实名认证
peasantHousehold.setSurveyOrNot(3);
peasantHousehold.setReview(2);
JSONArray regionName = commonService.getRegionName();
List<RegionModel> list = JSONArray.parseArray(regionName.toJSONString(), RegionModel.class);
// // 处理项目地址
// String area = "";
// if (model.getProjectAddress() != null && model.getProjectAddress().size() != 0) {
// for (Integer reg : model.getProjectAddress())
// for (RegionModel re : list) {
// if (re.getRegionCode().equals(Integer.valueOf(reg))) {
// area = area + re.getRegionName() + "/";
// }
// }
// model.setProjectAddressName(area.length() > 2 ? area.substring(0, area.length() - 1) : area);
// if ("1".equals(model.getIsPermanent()) || "true".equals(model.getIsPermanent())) {
// peasantHousehold.setPermanentAddress(model.getProjectAddress());
// peasantHousehold.setPermanentAddressDetail(model.getProjectAddressDetail());
// peasantHousehold.setPermanentAddressName(area.length() > 2 ? area.substring(0, area.length() - 1) : area);
// } else {
// // 处理常住地址
// String permanent = "";
// if (model.getPermanentAddress() != null && model.getPermanentAddress().size() != 0) {
// for (Integer reg : model.getPermanentAddress())
// for (RegionModel re : list) {
// if (re.getRegionCode().equals(Integer.valueOf(reg))) {
// permanent = permanent + re.getRegionName() + "/";
// }
// }
// peasantHousehold.setPermanentAddressName(permanent.length() > 2 ? permanent.substring(0, permanent.length() - 1) : permanent);
// }
// }
// }
surveyInformation.setReview(0);
surveyInformation.setCreatorTime(new Date());
surveyInformationServiceImpl.saveOrUpdate(surveyInformation);
// 更新扩展信息
ExtendedInformation extendedInformation = BeanDtoUtils.convert(surveyInfoAllDto.getExtendedInformation(),
ExtendedInformation.class);
extendedInformation.setSurveyInformationId(surveyInformation.getSequenceNbr());
// 避免生成多份数据
extendedInformationService.saveOrUpdate(extendedInformation, new LambdaQueryWrapper<ExtendedInformation>()
.eq(ExtendedInformation::getSurveyInformationId, surveyInformation.getSequenceNbr()));
// extendedInformationService.saveOrUpdate(extendedInformation);
// 更新勘察明细信息
SurveyDetailsDto oldSurveyDetails = surveyInfoAllDto.getSurveyDetails();
SurveyDetails surveyDetails = BeanDtoUtils.convert(oldSurveyDetails, SurveyDetails.class);
surveyDetails.setSurveyInformationId(surveyInformation.getSequenceNbr());
// 避免生成多份数据
surveyDetailsService.saveOrUpdate(surveyDetails, new LambdaQueryWrapper<SurveyDetails>()
.eq(SurveyDetails::getSurveyInformationId, surveyInformation.getSequenceNbr()));
// surveyDetailsService.saveOrUpdate(surveyDetails);
// 更新商务信息
CommercialDto oldCommercial = surveyInfoAllDto.getCommercial();
Commercial commercial = BeanDtoUtils.convert(oldCommercial, Commercial.class);
// 处理省市县
String paddressName = "";
if (null != surveyInfoAllDto.getSurveyInformation().getProjectAddress()){
for (Integer reg : surveyInfoAllDto.getSurveyInformation().getProjectAddress()) {
for (RegionModel re : list) {
if (re.getRegionCode().equals(Integer.valueOf(reg))) {
paddressName = paddressName + re.getRegionName() + "/";
}
}
}
commercial.setProjectAddressName(paddressName.substring(0, paddressName.length() - 1));
}
commercial.setSurveyInformationId(surveyInformation.getSequenceNbr());
// 避免生成多份数据
commercialService.saveOrUpdate(commercial, new LambdaQueryWrapper<Commercial>()
.eq(Commercial::getSurveyInformationId, surveyInformation.getSequenceNbr()));
// commercialService.saveOrUpdate(commercial);
// 勘察后,更新状态
// QueryWrapper<PeasantHousehold> peasantHouseholdQueryWrapper = new
// QueryWrapper<>();
// peasantHouseholdQueryWrapper.eq("survey_information_id",
// surveyInformation.getSequenceNbr());
// PeasantHousehold peasantHousehold =
// peasantHouseholdServiceImpl.getBaseMapper()
// .selectOne(peasantHouseholdQueryWrapper);
// 更新资料归档信息
Information information = BeanDtoUtils.convert(surveyInfoAllDto.getInformation(), Information.class);
information.setHouseProve(null == commercial ? null
: (CollectionUtil.isNotEmpty(commercial.getRealEstateLegal()) ? commercial.getRealEstateLegal()
: null));
information.setCardFile(null == commercial ? null
: (CollectionUtil.isNotEmpty(commercial.getIdCardCredit()) ? commercial.getIdCardCredit() : null));
information.setCardFile(commercial.getAgentLegal());
information
.setArchivesNumber(surveyInformationServiceImpl.getNo(CodeEnum.档案.getCode(), peasantHousehold.getRegionalCompaniesSeq()));
information.setFileNumber(surveyInformationServiceImpl.getNo(CodeEnum.文件.getCode(), peasantHousehold.getRegionalCompaniesSeq()));
information.setSurveyInformationId(surveyInformation.getSequenceNbr());
// 避免生成多份数据
informationService.saveOrUpdate(information, new LambdaQueryWrapper<Information>()
.eq(Information::getSurveyInformationId, surveyInformation.getSequenceNbr()));
// informationService.saveOrUpdate(information);
peasantHousehold.setOwnersName(surveyInfoAllDto.getSurveyInformation().getOwnersName());
peasantHousehold.setTelephone(surveyInfoAllDto.getSurveyInformation().getTelephone());
peasantHousehold.setIdCard(surveyInfoAllDto.getSurveyInformation().getIdCard());
peasantHousehold.setIdCardFront(model.getIdCardFront());
peasantHousehold.setIdCardOpposite(model.getIdCardOpposite());
peasantHousehold.setMailbox(surveyInfoAllDto.getSurveyInformation().getMailbox());
peasantHousehold.setProjectAddress(surveyInfoAllDto.getSurveyInformation().getProjectAddress());
peasantHousehold.setProjectAddressDetail(surveyInfoAllDto.getSurveyInformation().getProjectAddressDetail());
peasantHousehold.setPermanentAddress(surveyInfoAllDto.getSurveyInformation().getPermanentAddress());
peasantHousehold
.setPermanentAddressDetail(surveyInfoAllDto.getSurveyInformation().getPermanentAddressDetail());
peasantHousehold
.setPermanentAddressDetail(surveyInfoAllDto.getSurveyInformation().getPermanentAddressDetail());
// 处理项目地址
String projectAddressName = "";
if (null != surveyInfoAllDto.getSurveyInformation().getProjectAddress()){
for (Integer reg : surveyInfoAllDto.getSurveyInformation().getProjectAddress()) {
for (RegionModel re : list) {
if (re.getRegionCode().equals(Integer.valueOf(reg))) {
projectAddressName = projectAddressName + re.getRegionName() + "/";
}
}
}
peasantHousehold.setProjectAddressName(projectAddressName.substring(0, projectAddressName.length() - 1));
}
if (null != surveyInfoAllDto.getSurveyInformation().getPermanentAddress()){
// 常住地址
String permanentAddressName = "";
for (Integer reg : surveyInfoAllDto.getSurveyInformation().getPermanentAddress()) {
for (RegionModel re : list) {
if (re.getRegionCode().equals(Integer.valueOf(reg))) {
permanentAddressName = permanentAddressName + re.getRegionName() + "/";
}
}
}
peasantHousehold
.setPermanentAddressName(permanentAddressName.substring(0, permanentAddressName.length() - 1));
}
this.saveOrUpdate(peasantHousehold);
//更新施工信息
PowerStationConstructionData powerStationConstructionData = surveyInfoAllDto.getPowerStationConstructionData();
LambdaUpdateWrapper<PowerStationConstructionData> powerStationConstructionDataWrapper1 = new LambdaUpdateWrapper<>();
powerStationConstructionDataWrapper1.eq(PowerStationConstructionData::getWorkOrderPowerStationId, peasantHousehold.getSequenceNbr());
PowerStationConstructionData data = powerStationConstructionDataService.getBaseMapper().selectOne(powerStationConstructionDataWrapper1);
if(Objects.isNull(data)){
powerStationConstructionData.setWorkOrderPowerStationId(peasantHousehold.getSequenceNbr());
powerStationConstructionDataService.saveOrUpdate(powerStationConstructionData);
}
//更新工程
PowerStationEngineeringInfo powerStationEngineeringInfo = surveyInfoAllDto.getPowerStationEngineeringInfo();
if(Objects.nonNull(powerStationEngineeringInfo)){
powerStationEngineeringInfo.setWorkOrderPowerStationId(peasantHousehold.getSequenceNbr());
powerStationEngineeringInfoService.saveOrUpdate(powerStationEngineeringInfo);
//更新施工组件信息
LambdaUpdateWrapper<PowerStationConstructionData> powerStationConstructionDataWrapper = new LambdaUpdateWrapper<>();
powerStationConstructionDataWrapper.set(PowerStationConstructionData::getConstructionComponentInfo, JSONArray.toJSONString(powerStationEngineeringInfo.getConstructionComponentInfo()));
powerStationConstructionDataWrapper.set(PowerStationConstructionData::getConstructionInverterInfo,JSONArray.toJSONString(powerStationEngineeringInfo.getConstructionInverterInfo()));
powerStationConstructionDataWrapper.set(PowerStationConstructionData::getConstructionCollectorBoxInfo,JSONArray.toJSONString(powerStationEngineeringInfo.getConstructionCollectorBoxInfo()));
powerStationConstructionDataWrapper.set(PowerStationConstructionData::getConstructionGridBoxInfo,JSONArray.toJSONString(powerStationEngineeringInfo.getConstructionGridBoxInfo()));
powerStationConstructionDataWrapper.eq(PowerStationConstructionData::getWorkOrderPowerStationId, peasantHousehold.getSequenceNbr());
powerStationConstructionDataWrapper.eq(PowerStationConstructionData::getSequenceNbr, powerStationConstructionData.getSequenceNbr());
powerStationConstructionDataService.update(null,powerStationConstructionDataWrapper);
}
//更新并网信息
HygfOnGrid hygfOnGrid = surveyInfoAllDto.getHygfOnGrid();
if(Objects.nonNull(hygfOnGrid)){
hygfOnGrid.setPeasantHouseholdId( peasantHousehold.getSequenceNbr());
hygfOnGridService.saveOrUpdate(hygfOnGrid);
}
//更新设计信息
DesignInformationDto designInformationDto = surveyInfoAllDto.getDesignInformation();
if(Objects.nonNull(designInformationDto)){
DesignInformation designInformation = BeanDtoUtils.convert(designInformationDto,
DesignInformation.class);
designInformation.setPeasantHouseholdId(String.valueOf(peasantHousehold.getSequenceNbr()));
designInformationService.saveOrUpdate(designInformation);
}
}
}
\ No newline at end of file
......@@ -121,7 +121,8 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto, WorkOrder, W
BasicGridRecordServiceImpl basicGridRecordService;
@Autowired
WorkflowFeignClient workflowFeignClient;
@Autowired
UnitInfoServiceImpl unitInfoService;
@Autowired
PeasantHouseholdMapper peasantHouseholdMapper;
@Autowired
......@@ -1570,4 +1571,213 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto, WorkOrder, W
}
}
}
public PowerStationEngineeringInfoAllDto getPowerStationEngineeringInfoHistory(Long peasantHouseholdId ,
String processInstanceId) {
PowerStationEngineeringInfoAllDto surveyInfoAllDto = new PowerStationEngineeringInfoAllDto();
PeasantHousehold peasantHousehold = new PeasantHousehold();
LambdaQueryWrapper<PeasantHousehold> peasantHouseholdWrapper = new LambdaQueryWrapper<>();
peasantHouseholdWrapper.eq(PeasantHousehold::getSequenceNbr, peasantHouseholdId);
peasantHousehold = peasantHouseholdServiceImpl.getBaseMapper().selectOne(peasantHouseholdWrapper);
String surveyInformationId = String.valueOf(peasantHousehold.getSurveyInformationId());
// 勘察基本信息
LambdaQueryWrapper<SurveyInformation> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SurveyInformation::getSequenceNbr, surveyInformationId);
SurveyInformation surveyInformation = surveyInformationMapper.selectOne(queryWrapper);
SurveyInformationDto surveyInformationDto = BeanDtoUtils.convert(surveyInformation, SurveyInformationDto.class);
surveyInformationDto.setPeasantHouseholdId(peasantHousehold.getSequenceNbr());
surveyInfoAllDto.setSurveyInformation(surveyInformationDto);
// 农户信息
// 获取用户所在经销商单位
LambdaQueryWrapper<UnitInfo> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(UnitInfo::getAmosCompanySeq,peasantHousehold.getDeveloperId());
UnitInfo unitInfo = unitInfoService.getBaseMapper().selectOne(wrapper);
BeanUtils.copyProperties(peasantHousehold, surveyInfoAllDto.getSurveyInformation());
surveyInfoAllDto.getSurveyInformation().setDeveloperName(peasantHousehold.getDeveloperName());
surveyInfoAllDto.getSurveyInformation().setDeveloperCode(peasantHousehold.getDeveloperCode());
surveyInfoAllDto.getSurveyInformation().setDeveloperId(unitInfo.getSequenceNbr());
if (!StringUtils.isEmpty(peasantHousehold.getProjectAddressName())) {
surveyInfoAllDto.getSurveyInformation()
.setProjectAddressText(Arrays.asList(peasantHousehold.getProjectAddressName().split("/")));
}
if (!StringUtils.isEmpty(peasantHousehold.getPermanentAddressName())) {
surveyInfoAllDto.getSurveyInformation()
.setPermanentAddressText(Arrays.asList(peasantHousehold.getPermanentAddressName().split("/")));
}
if (peasantHousehold.getPermanentAddress() == null) {
surveyInfoAllDto.getSurveyInformation().setPermanentAddress(peasantHousehold.getProjectAddress());
surveyInfoAllDto.getSurveyInformation().setIsPermanent("1");
}
surveyInfoAllDto.getSurveyInformation().setSequenceNbr(surveyInformation.getSequenceNbr());
QueryWrapper<SurveyDetails> surveyDetailsQueryWrapper = new QueryWrapper<>();
surveyDetailsQueryWrapper.eq("survey_information_id", surveyInformationId);
SurveyDetails surveyDetails = surveyDetailsService.getBaseMapper().selectOne(surveyDetailsQueryWrapper);
if (surveyDetails == null) {
surveyInfoAllDto.setSurveyDetails(new SurveyDetailsDto());
} else {
surveyInfoAllDto.setSurveyDetails(BeanDtoUtils.convert(surveyDetails, SurveyDetailsDto.class));
}
// 商务信息
QueryWrapper<Commercial> commercialQueryWrapper = new QueryWrapper<>();
commercialQueryWrapper.eq("survey_information_id", surveyInformationId);
Commercial commercial = commercialService.getBaseMapper().selectOne(commercialQueryWrapper);
if (commercial == null) {
commercial = new Commercial();
}
commercial.setApplicant(peasantHousehold.getOwnersName());
commercial.setIdCard(peasantHousehold.getIdCard());
commercial.setTelephone(peasantHousehold.getTelephone());
commercial.setProjectAddress(peasantHousehold.getProjectAddress());
commercial.setProjectAddressName(peasantHousehold.getProjectAddressName());
commercial.setProjectAddressDetail(peasantHousehold.getProjectAddressDetail());
commercial.setLegalContactTelephone(peasantHousehold.getTelephone());
List<Object> list = new ArrayList<>();
if (null != surveyDetails) {
if (CollectionUtil.isNotEmpty(surveyDetails.getSurroundingHouseSurvey())) {
list.addAll(surveyDetails.getSurroundingHouseSurvey());
}
if (CollectionUtil.isNotEmpty(surveyDetails.getOverallHousingSurvey())) {
list.addAll(surveyDetails.getOverallHousingSurvey());
}
if (CollectionUtil.isNotEmpty(surveyDetails.getPanoramaSurvey())) {
list.addAll(surveyDetails.getPanoramaSurvey());
}
if (CollectionUtil.isNotEmpty(surveyDetails.getPlanSketchSurvey())) {
list.addAll(surveyDetails.getPlanSketchSurvey());
}
if (CollectionUtil.isNotEmpty(surveyDetails.getAzimuthSurvey())) {
list.addAll(surveyDetails.getAzimuthSurvey());
}
}
commercial.setSurveyPhotosWeb(list);
// 资料归档
QueryWrapper<Information> informationQueryWrapper = new QueryWrapper<>();
informationQueryWrapper.eq("survey_information_id", surveyInformationId);
Information information = informationService.getBaseMapper().selectOne(informationQueryWrapper);
if (information == null) {
surveyInfoAllDto.setInformation(new InformationDto());
} else {
// 将商务信息的房产证明文件数据赋值给资料归档的房产证明文件
information.setCardFile(commercial.getIdCardCredit());
surveyInfoAllDto.setInformation(BeanDtoUtils.convert(information, InformationDto.class));
}
if (information == null) {
CommercialDto commercialDto = BeanDtoUtils.convert(commercial, CommercialDto.class);
commercialDto.setType("zrr");
commercialDto.setLegalType("zjdnhw");
surveyInfoAllDto.setCommercial(commercialDto);
} else {
surveyInfoAllDto.setCommercial(BeanDtoUtils.convert(commercial, CommercialDto.class));
if (commercial != null && !StringUtils.isEmpty(commercial.getProjectAddressName())) {
surveyInfoAllDto.getCommercial()
.setProjectAddressText(Arrays.asList(commercial.getProjectAddressName().split("/")));
}
}
QueryWrapper<ExtendedInformation> extendedInformationQueryWrapper = new QueryWrapper<>();
extendedInformationQueryWrapper.eq("survey_information_id", surveyInformationId);
ExtendedInformation extendedInformation = extendedInformationService.getBaseMapper()
.selectOne(extendedInformationQueryWrapper);
if (information == null) {
surveyInfoAllDto.setExtendedInformation(new ExtendedInformationDto());
} else {
surveyInfoAllDto
.setExtendedInformation(BeanDtoUtils.convert(extendedInformation, ExtendedInformationDto.class));
}
QueryWrapper<DesignInformation> designInformationQueryWrapper = new QueryWrapper<>();
designInformationQueryWrapper.eq("peasant_household_id", peasantHousehold.getSequenceNbr());
DesignInformation designInformation = designInformationService.getBaseMapper()
.selectOne(designInformationQueryWrapper);
if (designInformation == null) {
surveyInfoAllDto.setDesignInformation(new DesignInformationDto());
} else {
surveyInfoAllDto.setDesignInformation(BeanDtoUtils.convert(designInformation, DesignInformationDto.class));
}
// 施工信息
LambdaQueryWrapper<PowerStationConstructionData> up2 = new LambdaQueryWrapper();
up2.eq(PowerStationConstructionData::getWorkOrderPowerStationId, peasantHouseholdId);
PowerStationConstructionData powerStationConstructionData = powerStationConstructionDataMapper.selectOne(up2);
// 工程信息
LambdaQueryWrapper<PowerStationEngineeringInfo> up3 = new LambdaQueryWrapper();
up3.eq(PowerStationEngineeringInfo::getWorkOrderPowerStationId, peasantHouseholdId);
PowerStationEngineeringInfo powerStationEngineeringInfo = powerStationEngineeringInfoMapper.selectOne(up3);
if (powerStationConstructionData != null) {
powerStationEngineeringInfo = powerStationEngineeringInfo != null ? powerStationEngineeringInfo
: new PowerStationEngineeringInfo();
powerStationEngineeringInfo
.setConstructionComponentInfo(powerStationConstructionData.getConstructionComponentInfo());
powerStationEngineeringInfo
.setConstructionInverterInfo(powerStationConstructionData.getConstructionInverterInfo());
powerStationEngineeringInfo
.setConstructionCollectorBoxInfo(powerStationConstructionData.getConstructionCollectorBoxInfo());
powerStationEngineeringInfo
.setConstructionGridBoxInfo(powerStationConstructionData.getConstructionGridBoxInfo());
}
// 并网信息
LambdaQueryWrapper<HygfOnGrid> up4 = new LambdaQueryWrapper<HygfOnGrid>();
up4.eq(HygfOnGrid::getPeasantHouseholdId, peasantHouseholdId);
HygfOnGrid hygfOnGrid = hygfOnGridMapper.selectOne(up4);
surveyInfoAllDto.setHygfOnGrid(hygfOnGrid != null ? hygfOnGrid : new HygfOnGrid());
surveyInfoAllDto.setPowerStationConstructionData(powerStationConstructionData);
surveyInfoAllDto.setPowerStationEngineeringInfo(powerStationEngineeringInfo);
if (!StringUtils.isEmpty(processInstanceId)) {
try {
Map<String, Object> flowLoggerMap = workflowFeignClient.getFlowLogger(processInstanceId).getResult();
List<LinkedHashMap> flowLogger = (List<LinkedHashMap>) flowLoggerMap.get("flowLogger");
if (flowLogger.size() > 0) {
Collections.reverse(flowLogger);
}
List<LinkedHashMap> flowLoggernew = new ArrayList<>();
for (LinkedHashMap linkedHashMap : flowLogger) {
if (linkedHashMap.get("operateDate") != null
&& !linkedHashMap.get("operateDate").toString().isEmpty()) {
LinkedHashMap linke = new LinkedHashMap();
linke.put("approvalStatue", linkedHashMap.get("approvalStatue").toString());
// 审核意见
List<LinkedHashMap> approvalSuggestion = (List<LinkedHashMap>) linkedHashMap
.get("approvalSuggestion");
if (approvalSuggestion != null && !approvalSuggestion.isEmpty()) {
linke.put("approvalSuggestion", approvalSuggestion.get(0).get("message"));
}
linke.put("taskName", linkedHashMap.get("taskName").toString());
linke.put("operator", linkedHashMap.get("operator").toString());
linke.put("operateDate", linkedHashMap.get("operateDate").toString());
flowLoggernew.add(linke);
}
}
LoggerDto loggerDto = new LoggerDto();
loggerDto.setLogger(flowLoggernew);
surveyInfoAllDto.setOrderTracking(loggerDto);
} catch (Exception e) {
e.printStackTrace();
}
}
return surveyInfoAllDto;
}
}
\ 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