Commit 9750df5d authored by chenzhao's avatar chenzhao

Merge remote-tracking branch 'origin/developer_bw' into developer_bw

parents 9adf432a 78303568
......@@ -154,40 +154,6 @@ public class PeasantHouseholdWxController extends BaseController {
throw new BadRequest("没有查询到注册的农户,请注册后在进行新增");
}
validatedPeasantHouseholdDto(peasantHouseholdDto);
peasantHouseholdDto.setPeasantHouseholdNo(peasantHouseholdServiceImpl.getPeasantHouseholdNo(peasantHouseholdDto.getRegionalCompaniesSeq()));
peasantHouseholdDto.setIsCertified(1);// 这里就实名认证
peasantHouseholdDto.setSurveyOrNot(0);
peasantHouseholdDto.setReview(0);
JSONArray regionName = getRegionName();
List<RegionModel> list = JSONArray.parseArray(regionName.toJSONString(), RegionModel.class);
// 处理项目地址
String area = "";
if (peasantHouseholdDto.getProjectAddress() != null && peasantHouseholdDto.getProjectAddress().size() != 0) {
for (Integer reg : peasantHouseholdDto.getProjectAddress())
for (RegionModel re : list) {
if (re.getRegionCode().equals(Integer.valueOf(reg))) {
area = area + re.getRegionName() + "/";
}
}
peasantHouseholdDto.setProjectAddressName(area.length() > 2 ? area.substring(0, area.length() - 1) : area);
if ("1".equals(peasantHouseholdDto.getIsPermanent()) || "true".equals(peasantHouseholdDto.getIsPermanent())) {
peasantHouseholdDto.setPermanentAddress(peasantHouseholdDto.getProjectAddress());
peasantHouseholdDto.setPermanentAddressDetail(peasantHouseholdDto.getProjectAddressDetail());
peasantHouseholdDto.setPermanentAddressName(area.length() > 2 ? area.substring(0, area.length() - 1) : area);
} else {
// 处理常住地址
String permanent = "";
if (peasantHouseholdDto.getPermanentAddress() != null && peasantHouseholdDto.getPermanentAddress().size() != 0) {
for (Integer reg : peasantHouseholdDto.getPermanentAddress())
for (RegionModel re : list) {
if (re.getRegionCode().equals(Integer.valueOf(reg))) {
permanent = permanent + re.getRegionName() + "/";
}
}
peasantHouseholdDto.setPermanentAddressName(permanent.length() > 2 ? permanent.substring(0, permanent.length() - 1) : permanent);
}
}
}
PeasantHouseholdDto result = peasantHouseholdServiceImpl.addNewPeasantHousehold(peasantHouseholdDto);
return ResponseHelper.buildResponse("success");
......@@ -202,51 +168,7 @@ public class PeasantHouseholdWxController extends BaseController {
log.info("微信农户注册, 入参 => {}", mobileLoginParam);
PeasantHouseholdDto model = mobileLoginParam.getPeasantHouseholdDto();
validatedPeasantHouseholdDto(model);
log.info("校验通过生成平台账号");
//注册并登录 生成农户信息表数据
PeasantHouseholdWxDto peasantHouseholdWxDto = peasantHouseholdServiceImpl.registerAndLogin(mobileLoginParam);
peasantHousehold = peasantHouseholdWxDto.getPeasantHousehold();
BeanDtoUtils.copyPropertiesAllNonNull(peasantHousehold, model);
log.info("生成农户属性");
model.setPeasantHouseholdNo(peasantHouseholdServiceImpl.getPeasantHouseholdNo(model.getRegionalCompaniesSeq()));
model.setIsCertified(1);// 这里就实名认证
model.setSurveyOrNot(0);
model.setReview(0);
JSONArray regionName = 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())) {
model.setPermanentAddress(model.getProjectAddress());
model.setPermanentAddressDetail(model.getProjectAddressDetail());
model.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() + "/";
}
}
model.setPermanentAddressName(permanent.length() > 2 ? permanent.substring(0, permanent.length() - 1) : permanent);
}
}
}
log.info("更新农户信息");
BeanDtoUtils.copyPropertiesAllNonNull(model, peasantHousehold);
PeasantHouseholdDto result = peasantHouseholdServiceImpl.savePeasantHousehold(model, null);
PeasantHouseholdWxDto peasantHouseholdWxDto = peasantHouseholdServiceImpl.savePeasantHousehold(model, mobileLoginParam,peasantHousehold);
peasantHouseholdWxDto.setPeasantHousehold(peasantHousehold);
return ResponseHelper.buildResponse(peasantHouseholdWxDto);
} catch (Exception e) {
......
......@@ -22,6 +22,7 @@ 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.boot.module.hygf.biz.vo.RouthPathVO;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
......@@ -153,7 +154,50 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
private UnitInfoServiceImpl unitInfoService;
@Transactional(rollbackFor = Exception.class)
public PeasantHouseholdDto savePeasantHousehold(PeasantHouseholdDto model, AgencyUserModel userInfo) {
public PeasantHouseholdWxDto savePeasantHousehold(PeasantHouseholdDto model, MobileLoginParamDto mobileLoginParam,PeasantHousehold household) {
log.info("校验通过生成平台账号");
//注册并登录 生成农户信息表数据
PeasantHouseholdWxDto peasantHouseholdWxDto = this.registerAndLogin(mobileLoginParam);
BeanDtoUtils.copyPropertiesAllNonNull(peasantHouseholdWxDto.getPeasantHousehold(), model);
log.info("生成农户属性");
model.setPeasantHouseholdNo(this.getPeasantHouseholdNo(model.getRegionalCompaniesSeq()));
model.setIsCertified(1);// 这里就实名认证
model.setSurveyOrNot(0);
model.setReview(0);
JSONArray regionName = 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())) {
model.setPermanentAddress(model.getProjectAddress());
model.setPermanentAddressDetail(model.getProjectAddressDetail());
model.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() + "/";
}
}
model.setPermanentAddressName(permanent.length() > 2 ? permanent.substring(0, permanent.length() - 1) : permanent);
}
}
}
log.info("更新农户信息");
BeanDtoUtils.copyPropertiesAllNonNull(model, household);
SurveyInformationDto surveyInformationDto = new SurveyInformationDto();
surveyInformationDto.setSurveyNumber(this.getkcNo(model.getRegionalCompaniesSeq()));
surveyInformationServiceImpl.createWithModel(surveyInformationDto);
......@@ -215,7 +259,7 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
String wxRouthPath1 = toDoTasksServiceImpl.getWxRouthPath(TaskTypeStationEnum.合同.getCode(), HygfRouthTypeEnum.HYGF_HTFQ.getCode(), routhPathVO1);
ToDoTasks toDoTasks1= new ToDoTasks (TaskTypeStationEnum.合同.getCode(), householdContract.getSequenceNbr(), householdContract.getPartyA()+"待合同发起",householdContract.getDealerCode(),routhPath1,wxRouthPath1);
toDoTasksServiceImpl.addToDoTasksByUserIds(todoUserIds,toDoTasks1);
return model;
return peasantHouseholdWxDto;
}
public boolean deletePeasantHouseholdBySequenceNbr(Long sequenceNbr){
......@@ -535,6 +579,7 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
PeasantHousehold peasantHousehold = peasantHouseholds.size() > 0 ? peasantHouseholds.get(0) : null;
if (null == peasantHousehold) {
peasantHousehold = new PeasantHousehold();
BeanUtils.copyProperties(wxDTO.getPeasantHouseholdDto(),peasantHousehold);
peasantHousehold.setIsCertified(0);
peasantHousehold.setSurveyOrNot(0);
peasantHousehold.setReview(0);
......@@ -947,7 +992,43 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
return this.getBaseMapper().selectList(queryWrapper);
}
@Transactional(rollbackFor = Exception.class)
public PeasantHouseholdDto addNewPeasantHousehold(PeasantHouseholdDto model) {
model.setPeasantHouseholdNo(this.getPeasantHouseholdNo(model.getRegionalCompaniesSeq()));
model.setIsCertified(1);// 这里就实名认证
model.setSurveyOrNot(0);
model.setReview(0);
JSONArray regionName = 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())) {
model.setPermanentAddress(model.getProjectAddress());
model.setPermanentAddressDetail(model.getProjectAddressDetail());
model.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() + "/";
}
}
model.setPermanentAddressName(permanent.length() > 2 ? permanent.substring(0, permanent.length() - 1) : permanent);
}
}
}
SurveyInformationDto surveyInformationDto = new SurveyInformationDto();
surveyInformationDto.setSurveyNumber(this.getkcNo(model.getRegionalCompaniesSeq()));
surveyInformationServiceImpl.createWithModel(surveyInformationDto);
......@@ -1001,7 +1082,6 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
ToDoTasks toDoTasks1= new ToDoTasks (TaskTypeStationEnum.合同.getCode(), householdContract.getSequenceNbr(), householdContract.getPartyA()+"待合同发起",householdContract.getDealerCode(),routhPath1,wxRouthPath1);
toDoTasksServiceImpl.addToDoTasksByUserIds(todoUserIds,toDoTasks1);
return model;
}
......
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