fix (farm): 户主列表
-
This commit is contained in:
@@ -43,6 +43,6 @@ public class PlotInfoSaveReqVO {
|
|||||||
private Integer plotLeaseStatus;
|
private Integer plotLeaseStatus;
|
||||||
|
|
||||||
@Schema(description = "租赁人信息")
|
@Schema(description = "租赁人信息")
|
||||||
private PlotLesseeSaveReqVO plotLesseeSaveReqVO;
|
private PlotLesseeSaveReqVO plotLessee;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -61,6 +61,6 @@ public class PlotLesseeInfoRespVO {
|
|||||||
private String plotLeaseStatusName;
|
private String plotLeaseStatusName;
|
||||||
|
|
||||||
@Schema(description = "租赁人信息")
|
@Schema(description = "租赁人信息")
|
||||||
private PlotLesseeDetailsRespVO plotLesseeDetailsRespVO;
|
private PlotLesseeDetailsRespVO plotLessee;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -26,6 +26,8 @@ import org.springframework.validation.annotation.Validated;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUser;
|
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUser;
|
||||||
@@ -71,18 +73,24 @@ public class PlotInfoServiceImpl implements PlotInfoService {
|
|||||||
|
|
||||||
PlotLesseeSaveReqVO plotLesseeSaveReqVO = createReqVO.getPlotLesseeSaveReqVO();
|
PlotLesseeSaveReqVO plotLesseeSaveReqVO = createReqVO.getPlotLesseeSaveReqVO();
|
||||||
PlotLesseeDO plotLesseeDO = BeanUtils.toBean(plotLesseeSaveReqVO, PlotLesseeDO.class);
|
PlotLesseeDO plotLesseeDO = BeanUtils.toBean(plotLesseeSaveReqVO, PlotLesseeDO.class);
|
||||||
plotLesseeDO.setId(IdUtil.fastUUID());
|
insertLessee(plotLesseeDO, createReqVO.getBaseId(), plotInfo.getId(), plotInfo.getPlotName());
|
||||||
plotLesseeDO.setTenantId(String.valueOf(user.getTenantId()));
|
|
||||||
plotLesseeDO.setLeaseStatus(CommonConstants.YES_CODE);
|
|
||||||
plotLesseeDO.setBaseId(createReqVO.getBaseId());
|
|
||||||
plotLesseeDO.setPlotId(plotInfo.getId());
|
|
||||||
plotLesseeDO.setPlotName(plotInfo.getPlotName());
|
|
||||||
plotLesseeMapper.insert(plotLesseeDO);
|
|
||||||
|
|
||||||
// 返回
|
// 返回
|
||||||
return plotInfo.getId();
|
return plotInfo.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void insertLessee(PlotLesseeDO plotLesseeDO,String baseId,String plotId,String plotName) {
|
||||||
|
LoginUser user = getLoginUser();
|
||||||
|
|
||||||
|
plotLesseeDO.setId(IdUtil.fastUUID());
|
||||||
|
plotLesseeDO.setTenantId(String.valueOf(user.getTenantId()));
|
||||||
|
plotLesseeDO.setLeaseStatus(CommonConstants.YES_CODE);
|
||||||
|
plotLesseeDO.setBaseId(baseId);
|
||||||
|
plotLesseeDO.setPlotId(plotId);
|
||||||
|
plotLesseeDO.setPlotName(plotName);
|
||||||
|
plotLesseeMapper.insert(plotLesseeDO);
|
||||||
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public void updatePlotInfo(PlotInfoSaveReqVO updateReqVO) {
|
public void updatePlotInfo(PlotInfoSaveReqVO updateReqVO) {
|
||||||
@@ -91,19 +99,26 @@ public class PlotInfoServiceImpl implements PlotInfoService {
|
|||||||
// 校验地块面积
|
// 校验地块面积
|
||||||
validatePlotArea(updateReqVO.getBaseId(), updateReqVO.getId(), updateReqVO.getPlotArea());
|
validatePlotArea(updateReqVO.getBaseId(), updateReqVO.getId(), updateReqVO.getPlotArea());
|
||||||
// 更新
|
// 更新
|
||||||
PlotInfoDO updateObj = BeanUtils.toBean(updateReqVO, PlotInfoDO.class);
|
PlotInfoDO plotInfo = BeanUtils.toBean(updateReqVO, PlotInfoDO.class);
|
||||||
plotInfoMapper.updateById(updateObj);
|
plotInfoMapper.updateById(plotInfo);
|
||||||
|
|
||||||
// 重置所有租赁状态为: 未租
|
// 重置所有租赁状态为: 未租
|
||||||
List<PlotLesseeDO> doList = plotLesseeMapper.selectList("plot_id", updateReqVO.getId());
|
List<PlotLesseeDO> doList = plotLesseeMapper.selectList("plot_id", updateReqVO.getId());
|
||||||
doList.forEach(e -> e.setLeaseStatus(CommonConstants.NO_CODE));
|
doList.forEach(e -> e.setLeaseStatus(CommonConstants.NO_CODE));
|
||||||
plotLesseeMapper.updateBatch(doList);
|
plotLesseeMapper.updateBatch(doList);
|
||||||
|
Set<String> collect = doList.stream().map(e-> e.getLeaseIdCard()).collect(Collectors.toSet());
|
||||||
|
|
||||||
// 指定当前的租户状态为: 已租
|
// 指定当前的租户状态为: 已租
|
||||||
PlotLesseeSaveReqVO plotLesseeSaveReqVO = updateReqVO.getPlotLesseeSaveReqVO();
|
PlotLesseeSaveReqVO plotLesseeSaveReqVO = updateReqVO.getPlotLesseeSaveReqVO();
|
||||||
|
String idCard = plotLesseeSaveReqVO.getLeaseIdCard();
|
||||||
PlotLesseeDO plotLesseeDO = BeanUtils.toBean(plotLesseeSaveReqVO, PlotLesseeDO.class);
|
PlotLesseeDO plotLesseeDO = BeanUtils.toBean(plotLesseeSaveReqVO, PlotLesseeDO.class);
|
||||||
plotLesseeDO.setLeaseStatus(CommonConstants.YES_CODE);
|
if (collect.contains(idCard)) {
|
||||||
plotLesseeMapper.updateById(plotLesseeDO);
|
plotLesseeDO.setLeaseStatus(CommonConstants.YES_CODE);
|
||||||
|
plotLesseeMapper.updateById(plotLesseeDO);
|
||||||
|
} else {
|
||||||
|
insertLessee(plotLesseeDO, updateReqVO.getBaseId(), plotInfo.getId(), plotInfo.getPlotName());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user