Browse Source

房东信息保存逻辑

dev_power_axis
zhangyuan 3 years ago
parent
commit
af1a10e6e5
  1. 9
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/controller/RentContractInfoController.java
  2. 10
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/RentContractInfoService.java
  3. 10
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentContractInfoServiceImpl.java
  4. 18
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentTenantInfoServiceImpl.java

9
epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/controller/RentContractInfoController.java

@ -54,6 +54,15 @@ public class RentContractInfoController {
return new Result();
}
@NoRepeatSubmit
@PostMapping("review")
public Result review(@RequestBody RentContractInfoDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
rentContractInfoService.review(dto);
return new Result();
}
@NoRepeatSubmit
@PostMapping("update")
public Result update(@RequestBody RentContractInfoDTO dto){

10
epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/RentContractInfoService.java

@ -56,6 +56,16 @@ public interface RentContractInfoService extends BaseService<RentContractInfoEnt
*/
void save(RentContractInfoDTO dto);
/**
* 审核
*
* @param dto
* @return void
* @author generator
* @date 2022-04-22
*/
void review(RentContractInfoDTO dto);
/**
* 默认更新
*

10
epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentContractInfoServiceImpl.java

@ -145,6 +145,16 @@ public class RentContractInfoServiceImpl extends BaseServiceImpl<RentContractInf
updateTenantAndFile(entity.getId(), dto);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void review(RentContractInfoDTO dto) {
RentContractInfoEntity entity = ConvertUtils.sourceToTarget(dto, RentContractInfoEntity.class);
updateById(entity);
if(NumConstant.ONE_STR.equals(entity.getState())){
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(RentContractInfoDTO dto) {

18
epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentTenantInfoServiceImpl.java

@ -4,12 +4,16 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.plugin.power.dto.rent.RentTenantInfoDTO;
import com.epmet.plugin.power.modules.rent.dao.RentTenantInfoDao;
import com.epmet.plugin.power.modules.rent.entity.RentContractFileEntity;
import com.epmet.plugin.power.modules.rent.entity.RentTenantInfoEntity;
import com.epmet.plugin.power.modules.rent.redis.RentTenantInfoRedis;
import com.epmet.plugin.power.modules.rent.service.RentContractFileService;
import com.epmet.plugin.power.modules.rent.service.RentTenantInfoService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -32,6 +36,9 @@ public class RentTenantInfoServiceImpl extends BaseServiceImpl<RentTenantInfoDao
@Autowired
private RentTenantInfoRedis rentTenantInfoRedis;
@Autowired
private RentContractFileService rentContractFileService;
@Override
public PageData<RentTenantInfoDTO> page(Map<String, Object> params) {
IPage<RentTenantInfoEntity> page = baseDao.selectPage(
@ -72,6 +79,17 @@ public class RentTenantInfoServiceImpl extends BaseServiceImpl<RentTenantInfoDao
public void save(RentTenantInfoDTO dto) {
RentTenantInfoEntity entity = ConvertUtils.sourceToTarget(dto, RentTenantInfoEntity.class);
insert(entity);
// 处理头像
if (dto.getImgList().isEmpty()) {
throw new EpmetException("照片不能为空");
} else {
List<RentContractFileEntity> imgList = ConvertUtils.sourceToTarget(dto.getImgList(), RentContractFileEntity.class);
imgList.forEach(img -> {
img.setReferenceId(entity.getId());
img.setFileType(NumConstant.ZERO_STR);
});
rentContractFileService.insertBatch(imgList);
}
}
@Override

Loading…
Cancel
Save