Commit 8907ebd3 authored by litengwei's avatar litengwei

勘察提交

parent b42529bc
package com.yeejoin.amos.boot.module.hygf.api.dto;
import io.swagger.annotations.ApiModel;
import lombok.Data;
@Data
@ApiModel(value="SurveyInfoAllDto", description="勘察信息提交")
public class SurveyInfoAllDto {
// 资料归档
InformationDto information;
// 勘察信息详情
SurveyDetailsDto surveyDetails;
// 勘察信息
SurveyInformationDto surveyInformation;
// 扩展信息
ExtendedInformationDto extendedInformation;
// 商务信息
CommercialDto commercial;
}
...@@ -34,8 +34,7 @@ public class SurveyInformationDto extends BaseDto { ...@@ -34,8 +34,7 @@ public class SurveyInformationDto extends BaseDto {
private String developerCode; private String developerCode;
@ApiModelProperty(value = " 业务员id") @ApiModelProperty(value = " 业务员id")
private String salesman private String salesmanId;
Id;
@ApiModelProperty(value = "业务员名称") @ApiModelProperty(value = "业务员名称")
private String salesman; private String salesman;
......
...@@ -23,6 +23,12 @@ public class Commercial extends BaseEntity { ...@@ -23,6 +23,12 @@ public class Commercial extends BaseEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* 勘察表id
*/
@TableField("survey_information_id")
private Long surveyInformationId;
/**
* 商务类型 * 商务类型
*/ */
@TableField("type") @TableField("type")
......
...@@ -23,6 +23,12 @@ public class SurveyDetails extends BaseEntity { ...@@ -23,6 +23,12 @@ public class SurveyDetails extends BaseEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* 勘察表id
*/
@TableField("survey_information_id")
private Long surveyInformationId;
/**
* 勘察时间 * 勘察时间
*/ */
@TableField("surveyor_time") @TableField("surveyor_time")
......
...@@ -49,10 +49,8 @@ public class SurveyInformation extends BaseEntity { ...@@ -49,10 +49,8 @@ public class SurveyInformation extends BaseEntity {
/** /**
* 业务员id * 业务员id
*/ */
@TableField("salesman @TableField("salesman _id")
_id") private String salesmanId;
private String salesman
Id;
/** /**
* 业务员名称 * 业务员名称
......
package com.yeejoin.amos.boot.module.hygf.api.util;
import org.springframework.beans.BeanUtils;
public class BeanDtoUtils {
/**
* Dot ,Vo ,Entity 相互转换
*
* @param source 原数据
* @param targetClass 目标类
* @param <T> 泛型类
* @return 转换返回值
*/
public static <T> T convert(Object source, Class<T> targetClass) {
// 判断source是否为空
if (source == null) {
return null;
}
// 判断targetClass是否为空
if (targetClass == null) {
return null;
}
try {
// 创建新的对象实例
T target = targetClass.newInstance();
// 把原对象数据拷贝到新对象
BeanUtils.copyProperties(source, target);
// 返回新对象
return target;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
}
package com.yeejoin.amos.boot.module.hygf.biz.controller; package com.yeejoin.amos.boot.module.hygf.biz.controller;
import com.yeejoin.amos.boot.module.hygf.api.dto.SurveyInfoAllDto;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -113,4 +114,17 @@ public class SurveyInformationController extends BaseController { ...@@ -113,4 +114,17 @@ public class SurveyInformationController extends BaseController {
public ResponseModel<List<SurveyInformationDto>> selectForList() { public ResponseModel<List<SurveyInformationDto>> selectForList() {
return ResponseHelper.buildResponse(surveyInformationServiceImpl.queryForSurveyInformationList()); return ResponseHelper.buildResponse(surveyInformationServiceImpl.queryForSurveyInformationList());
} }
/**
* 列表全部数据查询
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST",value = "勘察信息数据提交", notes = "勘察信息列表全部数据查询")
@PostMapping(value = "/survey")
public ResponseModel<SurveyInfoAllDto> survey(@RequestBody SurveyInfoAllDto surveyInfoAllDto ) {
SurveyInfoAllDto returnDto = surveyInformationServiceImpl.saveSurveyInfo(surveyInfoAllDto);
return ResponseHelper.buildResponse(returnDto);
}
} }
package com.yeejoin.amos.boot.module.hygf.biz.service.impl; package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import com.yeejoin.amos.boot.module.hygf.api.entity.SurveyInformation; 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.SurveyInformationMapper; import com.yeejoin.amos.boot.module.hygf.api.mapper.SurveyInformationMapper;
import com.yeejoin.amos.boot.module.hygf.api.service.ISurveyInformationService; import com.yeejoin.amos.boot.module.hygf.api.service.ISurveyInformationService;
import com.yeejoin.amos.boot.module.hygf.api.dto.SurveyInformationDto; import com.yeejoin.amos.boot.module.hygf.api.util.BeanDtoUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
...@@ -17,6 +19,22 @@ import java.util.List; ...@@ -17,6 +19,22 @@ import java.util.List;
*/ */
@Service @Service
public class SurveyInformationServiceImpl extends BaseService<SurveyInformationDto,SurveyInformation,SurveyInformationMapper> implements ISurveyInformationService { public class SurveyInformationServiceImpl extends BaseService<SurveyInformationDto,SurveyInformation,SurveyInformationMapper> implements ISurveyInformationService {
@Autowired
SurveyDetailsServiceImpl surveyDetailsService;
@Autowired
InformationServiceImpl informationService;
@Autowired
ExtendedInformationServiceImpl extendedInformationService;
@Autowired
CommercialServiceImpl commercialService;
/** /**
* 分页查询 * 分页查询
*/ */
...@@ -30,4 +48,25 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD ...@@ -30,4 +48,25 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
public List<SurveyInformationDto> queryForSurveyInformationList() { public List<SurveyInformationDto> queryForSurveyInformationList() {
return this.queryForList("" , false); return this.queryForList("" , false);
} }
public SurveyInfoAllDto saveSurveyInfo(SurveyInfoAllDto surveyInfoAllDto) {
SurveyInformation surveyInformation = BeanDtoUtils.convert(surveyInfoAllDto.getSurveyInformation(), SurveyInformation.class);
this.save(surveyInformation);
SurveyDetails surveyDetails = BeanDtoUtils.convert(surveyInfoAllDto.getSurveyDetails(), SurveyDetails.class);
surveyDetailsService.save(surveyDetails.setSurveyInformationId(surveyInformation.getSequenceNbr()));
Information information = BeanDtoUtils.convert(surveyInfoAllDto.getInformation(), Information.class);
informationService.save(information.setSurveyInformationId(surveyInformation.getSequenceNbr()));
Commercial commercial = BeanDtoUtils.convert(surveyInfoAllDto.getCommercial(), Commercial.class);
commercialService.save(commercial.setSurveyInformationId(surveyInformation.getSequenceNbr()));
ExtendedInformation extendedInformation = BeanDtoUtils.convert(surveyInfoAllDto.getExtendedInformation(), ExtendedInformation.class);
extendedInformationService.save(extendedInformation.setSurveyInformationId(surveyInformation.getSequenceNbr()));
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