上传租赁合同审批调整

This commit is contained in:
zhangchenbiao
2024-04-24 17:58:12 +08:00
parent 10bd82792d
commit 3e4962927d
10 changed files with 108 additions and 19 deletions

View File

@@ -7,6 +7,7 @@ public enum AuditTypeEnum {
LICENSE_APPROVAL(3, "证照审批"),
SYS_BUILD(4, "系统建店"),
SITE_SELECTION(5, "选址"),
UPLOAD_RENT_CONTRACT(6, "上传租赁合同"),
;
private Integer code;

View File

@@ -0,0 +1,55 @@
package com.cool.store.dao;
import com.cool.store.entity.ShopAuditInfoDO;
import com.cool.store.mapper.ShopAuditInfoMapper;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.util.List;
/**
* @author zhangchenbiao
* @FileName: ShopAuditInfoDAO
* @Description:
* @date 2024-04-24 17:30
*/
@Repository
public class ShopAuditInfoDAO {
@Resource
private ShopAuditInfoMapper shopAuditInfoMapper;
/**
* 新增审核信息
* @param auditInfo
* @return
*/
public Long addAuditInfo(ShopAuditInfoDO auditInfo) {
shopAuditInfoMapper.insertSelective(auditInfo);
return auditInfo.getId();
}
/**
* 获取单个审核信息
* @param auditId
* @return
*/
public ShopAuditInfoDO getAuditInfo(Long auditId) {
return shopAuditInfoMapper.selectByPrimaryKey(auditId);
}
/**
* 批量获取审核信息
* @param auditIds
* @return
*/
public List<ShopAuditInfoDO> getAuditInfoList(List<Long> auditIds) {
if(CollectionUtils.isEmpty(auditIds)){
return Lists.newArrayList();
}
return shopAuditInfoMapper.getAuditInfoList(auditIds);
}
}

View File

@@ -4,6 +4,10 @@ import com.cool.store.entity.ShopAuditInfoDO;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
public interface ShopAuditInfoMapper extends Mapper<ShopAuditInfoDO> {
ShopAuditInfoDO selectBykeyAndType(@Param("shopId") Long shopId);
List<ShopAuditInfoDO> getAuditInfoList(@Param("auditIds") List<Long> auditIds);
}

View File

@@ -26,4 +26,13 @@
and audit_type = 4
and deleted = 0
</select>
<select id="getAuditInfoList" resultType="com.cool.store.entity.ShopAuditInfoDO">
select *
from xfsg_shop_audit_info
where id in
<foreach collection="auditIds" item="auditId" open="(" separator="," close=")">
#{auditId}
</foreach>
</select>
</mapper>

View File

@@ -1,7 +1,9 @@
package com.cool.store.request;
import com.cool.store.entity.LineAuditInfoDO;
import com.cool.store.entity.ShopAuditInfoDO;
import com.cool.store.enums.AuditResultTypeEnum;
import com.cool.store.enums.AuditTypeEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -27,18 +29,24 @@ public class AuditRentContractRequest {
@ApiModelProperty("原因")
private String reason;
public static LineAuditInfoDO convert(AuditRentContractRequest request, String partnerId, Long lineId){
LineAuditInfoDO result = new LineAuditInfoDO();
result.setPartnerId(partnerId);
result.setLineId(lineId);
@ApiModelProperty(value = "操作人id", hidden = true)
private String operateUserId;
@ApiModelProperty(value = "操作人姓名", hidden = true)
private String operateUserName;
public static ShopAuditInfoDO convert(AuditRentContractRequest request, AuditTypeEnum auditType){
ShopAuditInfoDO result = new ShopAuditInfoDO();
result.setShopId(request.getShopId());
result.setAuditType(auditType.getCode());
result.setSubmittedUserId(request.getOperateUserId());
result.setSubmittedUserName(request.getOperateUserName());
result.setResultType(request.getResultType());
if(AuditResultTypeEnum.PASS.getCode().equals(request.getResultType())){
result.setResultType(AuditResultTypeEnum.PASS.getCode());
}else{
result.setPassReason(request.getReason());
result.setRejectRealReason(request.getReason());
result.setRejectReason(request.getReason());
}
result.setRejectPublicReason(request.getReason());
return result;
}

View File

@@ -1,6 +1,6 @@
package com.cool.store.vo;
import com.cool.store.entity.LineAuditInfoDO;
import com.cool.store.entity.ShopAuditInfoDO;
import com.cool.store.enums.AuditResultTypeEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -26,7 +26,13 @@ public class AuditInfoVO {
@ApiModelProperty("审批时间")
private Date createTime;
public static AuditInfoVO convertVO(LineAuditInfoDO auditInfo) {
@ApiModelProperty(value = "操作人id")
private String operateUserId;
@ApiModelProperty(value = "操作人姓名")
private String operateUserName;
public static AuditInfoVO convertVO(ShopAuditInfoDO auditInfo) {
if(Objects.isNull(auditInfo)){
return null;
}
@@ -36,8 +42,10 @@ public class AuditInfoVO {
if(AuditResultTypeEnum.PASS.getCode().equals(result.getResultType())){
result.setReason(auditInfo.getPassReason());
}else if(AuditResultTypeEnum.REJECT.getCode().equals(result.getResultType())){
result.setReason(auditInfo.getRejectRealReason());
result.setReason(auditInfo.getRejectReason());
}
result.setOperateUserId(auditInfo.getSubmittedUserId());
result.setOperateUserName(auditInfo.getSubmittedUserName());
result.setCertifyFile(auditInfo.getCertifyFile());
result.setCreateTime(auditInfo.getCreateTime());
return result;

View File

@@ -1,6 +1,7 @@
package com.cool.store.vo.shop;
import com.cool.store.entity.LineAuditInfoDO;
import com.cool.store.entity.ShopAuditInfoDO;
import com.cool.store.entity.ShopStageInfoDO;
import com.cool.store.vo.AuditInfoVO;
import com.cool.store.vo.LineAuditInfoVO;
@@ -54,15 +55,15 @@ public class ShopStageInfoVO {
}
public static List<ShopStageInfoVO> convertList(List<ShopStageInfoDO> stageList, List<LineAuditInfoDO> auditList){
public static List<ShopStageInfoVO> convertList(List<ShopStageInfoDO> stageList, List<ShopAuditInfoDO> auditList){
if(CollectionUtils.isEmpty(stageList)){
return Lists.newArrayList();
}
Map<Long, LineAuditInfoDO> auditMap = auditList.stream().collect(Collectors.toMap(LineAuditInfoDO::getId, Function.identity()));
Map<Long, ShopAuditInfoDO> auditMap = auditList.stream().collect(Collectors.toMap(ShopAuditInfoDO::getId, Function.identity()));
List<ShopStageInfoVO> resultList = new ArrayList<>();
for (ShopStageInfoDO stageInfo : stageList) {
ShopStageInfoVO shopStageInfo = new ShopStageInfoVO(stageInfo.getShopStage(), stageInfo.getShopSubStage(), stageInfo.getShopSubStageStatus(), stageInfo.getIsTerminated());
LineAuditInfoDO auditInfo = auditMap.get(stageInfo.getAuditId());
ShopAuditInfoDO auditInfo = auditMap.get(stageInfo.getAuditId());
AuditInfoVO auditInfoVO = AuditInfoVO.convertVO(auditInfo);
shopStageInfo.setAuditInfo(auditInfoVO);
shopStageInfo.setPlanCompleteTime(stageInfo.getPlanCompleteTime());

View File

@@ -78,7 +78,7 @@ public class PointServiceImpl implements PointService {
@Resource
private ShopRentInfoDAO shopRentInfoDAO;
@Resource
private LineAuditInfoDAO lineAuditInfoDAO;
private ShopAuditInfoDAO shopAuditInfoDAO;
@Resource
private SysRoleService sysRoleService;
@Value("${mybatis.configuration.variables.enterpriseId}")
@@ -824,7 +824,7 @@ public class PointServiceImpl implements PointService {
ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_23.getShopSubStageStatus().equals(shopSubStageInfo.getShopSubStageStatus());
if(Objects.nonNull(shopSubStageInfo.getAuditId()) && isAudit){
//当前是审核过的状态才获取原因
LineAuditInfoDO auditInfo = lineAuditInfoDAO.getAuditInfo(shopSubStageInfo.getAuditId());
ShopAuditInfoDO auditInfo = shopAuditInfoDAO.getAuditInfo(shopSubStageInfo.getAuditId());
result.setAuditInfo(AuditInfoVO.convertVO(auditInfo));
}
return result;
@@ -840,7 +840,7 @@ public class PointServiceImpl implements PointService {
if(!ShopStageEnum.SHOP_STAGE_1.getShopStage().equals(shopInfo.getShopStage())){
throw new ServiceException(ErrorCodeEnum.SHOP_STAGE_NOT_OPERATE);
}
Long auditId = lineAuditInfoDAO.addAuditInfo(AuditRentContractRequest.convert(request, shopInfo.getPartnerId(), shopInfo.getLineId()));
Long auditId = shopAuditInfoDAO.addAuditInfo(AuditRentContractRequest.convert(request, AuditTypeEnum.UPLOAD_RENT_CONTRACT));
ShopSubStageStatusEnum subStageStatus = AuditResultTypeEnum.PASS.getCode().equals(request.getResultType()) ? ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_23 : ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_22;
if(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_23.equals(subStageStatus)){
//审核通过铺位变为已签约

View File

@@ -6,6 +6,7 @@ import com.cool.store.entity.*;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.point.*;
import com.cool.store.exception.ServiceException;
import com.cool.store.mapper.ShopAuditInfoMapper;
import com.cool.store.request.AddShopRequest;
import com.cool.store.request.DeleteShopRequest;
import com.cool.store.service.ShopService;
@@ -39,7 +40,7 @@ public class ShopServiceImpl implements ShopService {
@Resource
private ShopStageInfoDAO shopStageInfoDAO;
@Resource
private LineAuditInfoDAO lineAuditInfoDAO;
private ShopAuditInfoDAO shopAuditInfoDAO;
@Resource
private LineInfoDAO lineInfoDAO;
@Resource
@@ -83,8 +84,8 @@ public class ShopServiceImpl implements ShopService {
}
}
List<ShopStageInfoDO> shopStageInfo = shopStageInfoDAO.getShopStageInfo(shopId, shopStage);
List<Long> auditIds = shopStageInfo.stream().map(ShopStageInfoDO::getAuditId).collect(Collectors.toList());
List<LineAuditInfoDO> auditList = lineAuditInfoDAO.getLineAuditInfoList(auditIds);
List<Long> auditIds = shopStageInfo.stream().filter(o->Objects.nonNull(o.getAuditId())).map(ShopStageInfoDO::getAuditId).distinct().collect(Collectors.toList());
List<ShopAuditInfoDO> auditList = shopAuditInfoDAO.getAuditInfoList(auditIds);
return ShopStageInfoVO.convertList(shopStageInfo, auditList);
}

View File

@@ -210,6 +210,8 @@ public class PointController {
@ApiOperation("租赁合同审核")
@PostMapping("/auditRentContract")
public ResponseResult<Integer> auditRentContract(@RequestBody @Validated AuditRentContractRequest request) {
request.setOperateUserId(CurrentUserHolder.getUserId());
request.setOperateUserName(CurrentUserHolder.getUser().getName());
return ResponseResult.success(pointService.auditRentContract(request));
}