|
@@ -3,6 +3,7 @@ package fcb.project.manager.core.controller;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import fcb.project.manager.base.entity.TmAudit;
|
|
|
import fcb.project.manager.base.entity.TmHouse;
|
|
|
+import fcb.project.manager.base.enums.HouseStatus;
|
|
|
import fcb.project.manager.base.service.impl.TmAuditServiceImpl;
|
|
|
import fcb.project.manager.base.service.impl.TmHouseServiceImpl;
|
|
|
import fcb.project.manager.base.utils.DataUtils;
|
|
@@ -19,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import java.time.LocalDateTime;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
|
|
@@ -66,11 +68,12 @@ public class AuditController {
|
|
|
@PostMapping("/doAudit")
|
|
|
@ApiOperation(value = "审核")
|
|
|
@ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name = "id", value = "审核记录ID", paramType = "query", required = false, dataType = "String"),
|
|
|
- @ApiImplicitParam(name = "auditStatus", value = "审核状态: 0->待审核;1->已审核;-1->不通过", paramType = "query", required = false, dataType = "Integer"),
|
|
|
+ @ApiImplicitParam(name = "id", value = "审核记录ID", paramType = "query", required = true, dataType = "String"),
|
|
|
+ @ApiImplicitParam(name = "auditStatus", value = "审核状态: 0->待审核;1->已审核;-1->不通过", paramType = "query", required = true, dataType = "Integer"),
|
|
|
+ @ApiImplicitParam(name = "auditRemark", value = "审核备注", paramType = "query", required = true, dataType = "String"),
|
|
|
})
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public Result<Object> audit(String id , Integer auditStatus){
|
|
|
+ public Result<Object> audit(String id , Integer auditStatus , String auditRemark){
|
|
|
|
|
|
if(StringUtils.isBlank(id) || null == auditStatus){
|
|
|
return Result.failure("审核记录ID或者审核结果不能为空");
|
|
@@ -93,16 +96,24 @@ public class AuditController {
|
|
|
return Result.failure("抢锁失败");
|
|
|
}
|
|
|
TmHouse dbHouse = tmHouseService.selectForUpdate(tmAudit.getVrId());
|
|
|
- if(null == tmAudit){
|
|
|
+ if(null == dbHouse){
|
|
|
log.info("更新审核状态环节,审核记录[{}]抢锁失败" , id);
|
|
|
return Result.failure("抢锁失败");
|
|
|
}
|
|
|
- //TODO:这里需要增加更新审核人
|
|
|
tmAudit.setAuditStatus(auditStatus);
|
|
|
+ tmAudit.setAuditRemark(auditRemark);
|
|
|
int update = tmAuditService.updateAudit(tmAudit);
|
|
|
if(update != 1){
|
|
|
throw new CommonBaseException(ResultCodeEnum.D101 , "更新审核记录失败");
|
|
|
}
|
|
|
+ dbHouse.setStatus(HouseStatus.AUDITED.getCode());
|
|
|
+ dbHouse.setAuditId(tmAudit.getId());
|
|
|
+ dbHouse.setAuditTime(LocalDateTime.now());
|
|
|
+ //TODO:这里需要增加更新审核人
|
|
|
+ dbHouse.setAuditorName("");
|
|
|
+ if(!tmHouseService.updateHouse(dbHouse)){
|
|
|
+ throw new CommonBaseException(ResultCodeEnum.D101 , "更新房源记录失败");
|
|
|
+ }
|
|
|
Map<String , Object> resMap = new HashMap<>();
|
|
|
resMap.put("auditId" , tmAudit.getId());
|
|
|
return Result.success("审核成功" , resMap);
|