This commit is contained in:
zhangchenbiao
2024-04-16 17:08:51 +08:00
parent b00ee1ad8a
commit bc0cc2155c
12 changed files with 285 additions and 35 deletions

View File

@@ -1,5 +1,6 @@
package com.cool.store.dao;
import com.cool.store.constants.CommonConstants;
import com.cool.store.entity.ShopRentInfoDO;
import com.cool.store.mapper.ShopRentInfoMapper;
import com.cool.store.vo.point.ShopRentInfoVO;
@@ -31,4 +32,11 @@ public class ShopRentInfoDAO {
}
return shopRentInfoMapper.getRentContractByShopId(shopId);
}
public Integer updateRentContract(ShopRentInfoDO shopRentInfo) {
if(Objects.isNull(shopRentInfo.getId())){
return CommonConstants.ZERO;
}
return shopRentInfoMapper.updateByPrimaryKeySelective(shopRentInfo);
}
}

View File

@@ -86,28 +86,28 @@ public class ShopStageInfoDAO {
return shopStageInfoMapper.getShopSubStageInfo(shopId, shopSubStageEnum.getShopSubStage());
}
/**
* 更新店铺阶段状态
* @param shopId
* @param shopStageInfo
* @return
*/
public Integer updateShopStageInfo(Long shopId, ShopSubStageStatusEnum shopStageInfo, Long auditId) {
if(Objects.isNull(shopId) || Objects.isNull(shopStageInfo)){
return CommonConstants.ZERO;
}
String remark = shopStageInfo.getShopSubStageName() + CommonConstants.PATH_BAR +shopStageInfo.getShopSubStageStatusName();
boolean isTerminated = shopStageInfo.isTerminated();
return shopStageInfoMapper.updateShopStageInfo(shopId, shopStageInfo.getShopSubStageEnum().getShopSubStage(), shopStageInfo.getShopSubStageStatus(), isTerminated, remark, auditId);
}
public Integer updateShopStageInfo(Long shopId, ShopSubStageStatusEnum shopStageInfo) {
if(Objects.isNull(shopId) || Objects.isNull(shopStageInfo)){
return CommonConstants.ZERO;
}
String remark = shopStageInfo.getShopSubStageName() + CommonConstants.PATH_BAR +shopStageInfo.getShopSubStageStatusName();
boolean isTerminated = shopStageInfo.isTerminated();
return shopStageInfoMapper.updateShopStageInfo(shopId, shopStageInfo.getShopSubStageEnum().getShopSubStage(), shopStageInfo.getShopSubStageStatus(), isTerminated, remark, null);
return shopStageInfoMapper.updateShopStageInfo(shopId, shopStageInfo.getShopSubStageEnum().getShopSubStage(), shopStageInfo.getShopSubStageStatus(), isTerminated, remark);
}
/**
* 更新店铺阶段状态及审核信息
* @param shopId
* @param shopStageInfo
* @return
*/
public Integer updateShopStageAndAuditInfo(Long shopId, ShopSubStageStatusEnum shopStageInfo, Long auditId) {
if(Objects.isNull(shopId) || Objects.isNull(shopStageInfo)){
return CommonConstants.ZERO;
}
String remark = shopStageInfo.getShopSubStageName() + CommonConstants.PATH_BAR +shopStageInfo.getShopSubStageStatusName();
boolean isTerminated = shopStageInfo.isTerminated();
return shopStageInfoMapper.updateShopStageAndAuditInfo(shopId, shopStageInfo.getShopSubStageEnum().getShopSubStage(), shopStageInfo.getShopSubStageStatus(), isTerminated, remark, auditId);
}
}

View File

@@ -33,6 +33,19 @@ public interface ShopStageInfoMapper extends Mapper<ShopStageInfoDO> {
* @return
*/
Integer updateShopStageInfo(@Param("shopId") Long shopId, @Param("shopSubStage") Integer shopSubStage, @Param("shopSubStageStatus") Integer shopSubStageStatus,
@Param("isTerminated")boolean isTerminated, @Param("remark") String remark);
/**
* 更新阶段及审核信息
* @param shopId
* @param shopSubStage
* @param shopSubStageStatus
* @param isTerminated
* @param remark
* @param auditId
* @return
*/
Integer updateShopStageAndAuditInfo(@Param("shopId") Long shopId, @Param("shopSubStage") Integer shopSubStage, @Param("shopSubStageStatus") Integer shopSubStageStatus,
@Param("isTerminated")boolean isTerminated, @Param("remark") String remark, @Param("auditId")Long auditId);
/**

View File

@@ -95,8 +95,8 @@
#{item}
</foreach>
</if>
<if test="request.areaPath != null">
and b.want_shop_area_id in (select id from xfsg_open_area_info where area_path like concat(#{request.areaPath}, '%'))
<if test="areaPath != null">
and b.want_shop_area_id in (select id from xfsg_open_area_info where area_path like concat(#{areaPath}, '%'))
</if>
</select>

View File

@@ -65,4 +65,17 @@
shop_id = #{shopId} and shop_sub_stage = #{shopSubStage} and deleted = 0
</select>
<update id="updateShopStageAndAuditInfo">
update
xfsg_shop_stage_info
set
shop_sub_stage_status = #{shopSubStageStatus},
is_terminated = #{isTerminated},
remark = #{remark},
actual_complete_time = if(is_terminated, now(), null),
audit_id = #{auditId}
where
shop_id = #{shopId} and shop_sub_stage = #{shopSubStage}
</update>
</mapper>

View File

@@ -22,7 +22,7 @@ import java.util.Objects;
* @date 2024-04-16 11:38
*/
@Data
public class UploadRentContractRequest {
public class AddRentContractRequest {
@ApiModelProperty("店铺id")
private Long shopId;
@@ -101,7 +101,7 @@ public class UploadRentContractRequest {
return true;
}
public static ShopRentInfoDO convertDO(UploadRentContractRequest param){
public static ShopRentInfoDO convertDO(AddRentContractRequest param){
if(Objects.isNull(param)){
return null;
}

View File

@@ -0,0 +1,135 @@
package com.cool.store.request;
import com.alibaba.fastjson.JSONObject;
import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils;
import com.cool.store.entity.ShopRentInfoDO;
import com.cool.store.enums.RentTypeEnum;
import com.cool.store.enums.ShopRentTypeEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.collections4.CollectionUtils;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Date;
import java.util.List;
import java.util.Objects;
/**
* @author zhangchenbiao
* @FileName: UploadRentContractRequest
* @Description:上传租赁合同
* @date 2024-04-16 11:38
*/
@Data
public class UpdateRentContractRequest {
@NotNull
@ApiModelProperty("租赁id")
private Long rentId;
@NotNull
@ApiModelProperty("店铺id")
private Long shopId;
@NotNull
@ApiModelProperty("铺位id")
private Long pointId;
@NotNull
@ApiModelProperty("租赁类型 1铺位直租 2自有铺位")
private Integer rentType;
@ApiModelProperty("签约日期")
private Date signTime;
@ApiModelProperty("合同开始日期")
private Date contractStartTime;
@ApiModelProperty("签约年限")
private Integer contractMonths;
@ApiModelProperty("店铺租金 1固定租金 2非固定租金")
private Integer shopRentType;
@ApiModelProperty("月租金")
private String monthRent;
@ApiModelProperty("第一年月租金")
private String firstYearMonthRent;
@ApiModelProperty("第二年月租金")
private String secondYearMonthRent;
@ApiModelProperty("第三年月租金")
private String thirdYearMonthRent;
@Size(max = 3, message = "最多上传三张租赁合同")
@ApiModelProperty("合同图片")
private List<String> contractPic;
@Size(max = 3, message = "最多上传三张房产证明")
@ApiModelProperty("房产证明")
private List<String> houseCertificatePic;
@ApiModelProperty(value = "当前线索id", hidden = true)
private Long curLineId;
public boolean check(){
if(Objects.isNull(rentId)){
return false;
}
if(Objects.isNull(shopId) || Objects.isNull(pointId)){
return false;
}
if(RentTypeEnum.OWN.getCode().equals(rentType)){
if(CollectionUtils.isEmpty(houseCertificatePic) || houseCertificatePic.size() > 3){
return false;
}
return true;
}
if(Objects.isNull(signTime) || Objects.isNull(contractStartTime)){
return false;
}
if(Objects.isNull(contractMonths) || Objects.isNull(shopRentType)){
return false;
}
if(ShopRentTypeEnum.FIXED.getCode().equals(shopRentType)){
if(StringUtils.isBlank(monthRent)){
return false;
}
}
if(ShopRentTypeEnum.NOT_FIXED.getCode().equals(shopRentType)){
if(StringUtils.isAnyBlank(firstYearMonthRent, secondYearMonthRent, thirdYearMonthRent)){
return false;
}
}
if(CollectionUtils.isEmpty(contractPic) || contractPic.size() > 3){
return false;
}
return true;
}
public static ShopRentInfoDO convertDO(UpdateRentContractRequest param){
if(Objects.isNull(param)){
return null;
}
ShopRentInfoDO shopRentInfoDO = new ShopRentInfoDO();
shopRentInfoDO.setId(param.getRentId());
shopRentInfoDO.setShopId(param.getShopId());
shopRentInfoDO.setPointId(param.getPointId());
shopRentInfoDO.setRentType(param.getRentType());
shopRentInfoDO.setSignTime(param.getSignTime());
shopRentInfoDO.setContractStartTime(param.getContractStartTime());
shopRentInfoDO.setContractMonths(param.getContractMonths());
shopRentInfoDO.setShopRentType(param.getShopRentType());
shopRentInfoDO.setMonthRent(param.getMonthRent());
shopRentInfoDO.setFirstYearMonthRent(param.getFirstYearMonthRent());
shopRentInfoDO.setSecondYearMonthRent(param.getSecondYearMonthRent());
shopRentInfoDO.setThirdYearMonthRent(param.getThirdYearMonthRent());
shopRentInfoDO.setContractPic(JSONObject.toJSONString(param.getContractPic()));
shopRentInfoDO.setHouseCertificatePic(JSONObject.toJSONString(param.getHouseCertificatePic()));
return shopRentInfoDO;
}
}

View File

@@ -0,0 +1,45 @@
package com.cool.store.vo;
import com.cool.store.entity.LineAuditInfoDO;
import com.cool.store.enums.AuditResultTypeEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.Objects;
@Data
public class AuditInfoVO {
@ApiModelProperty("审核id")
private Long auditId;
@ApiModelProperty("结果类型 0通过,1拒绝,2结束跟进")
private Integer resultType;
@ApiModelProperty("原因")
private String reason;
@ApiModelProperty("明文件或凭证")
private String certifyFile;
@ApiModelProperty("审批时间")
private Date createTime;
public static AuditInfoVO convertVO(LineAuditInfoDO auditInfo) {
if(Objects.isNull(auditInfo)){
return null;
}
AuditInfoVO result = new AuditInfoVO();
result.setAuditId(auditInfo.getId());
result.setResultType(auditInfo.getResultType());
if(AuditResultTypeEnum.PASS.getCode().equals(result.getResultType())){
result.setReason(auditInfo.getPassReason());
}else if(AuditResultTypeEnum.REJECT.getCode().equals(result.getResultType())){
result.setReason(auditInfo.getRejectRealReason());
}
result.setCertifyFile(auditInfo.getCertifyFile());
result.setCreateTime(auditInfo.getCreateTime());
return result;
}
}

View File

@@ -3,13 +3,10 @@ package com.cool.store.vo.point;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.entity.ShopRentInfoDO;
import com.cool.store.enums.RentTypeEnum;
import com.cool.store.vo.AuditInfoVO;
import com.cool.store.vo.LineAuditInfoVO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.Instant;
import java.time.LocalDate;
import java.time.ZoneId;
@@ -25,6 +22,9 @@ import java.util.List;
@Data
public class ShopRentInfoVO {
@ApiModelProperty("租赁id")
private Long rentId;
@ApiModelProperty("店铺id")
private Long shopId;
@@ -71,10 +71,11 @@ public class ShopRentInfoVO {
private Integer status;
@ApiModelProperty("审核信息")
private LineAuditInfoVO auditInfo;
private AuditInfoVO auditInfo;
public static ShopRentInfoVO build(ShopRentInfoDO shopRentInfo) {
ShopRentInfoVO result = new ShopRentInfoVO();
result.setRentId(shopRentInfo.getId());
result.setShopId(shopRentInfo.getShopId());
result.setPointId(shopRentInfo.getPointId());
result.setRentType(shopRentInfo.getRentType());

View File

@@ -227,7 +227,7 @@ public interface PointService {
* @param request
* @return
*/
Integer uploadRentContract(UploadRentContractRequest request);
Integer uploadRentContract(AddRentContractRequest request);
/**
* 获取租赁合同详情
@@ -242,4 +242,11 @@ public interface PointService {
* @return
*/
Integer auditRentContract(AuditRentContractRequest request);
/**
* 更新租赁合同
* @param request
* @return
*/
Integer updateRentContract(UpdateRentContractRequest request);
}

View File

@@ -16,6 +16,7 @@ import com.cool.store.service.PointService;
import com.cool.store.service.UserAuthMappingService;
import com.cool.store.utils.RedisUtilPool;
import com.cool.store.utils.poi.StringUtils;
import com.cool.store.vo.AuditInfoVO;
import com.cool.store.vo.LineAuditInfoVO;
import com.cool.store.vo.LinePointBaseInfoVO;
import com.cool.store.vo.point.*;
@@ -666,7 +667,7 @@ public class PointServiceImpl implements PointService {
}
@Override
public Integer uploadRentContract(UploadRentContractRequest request){
public Integer uploadRentContract(AddRentContractRequest request){
if(!request.check()){
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
}
@@ -679,7 +680,7 @@ public class PointServiceImpl implements PointService {
PointInfoDO pointInfo = pointInfoDAO.getPointInfoById(pointId);
shopId = pointInfo.getShopId();
}
ShopRentInfoDO shopRentInfo = UploadRentContractRequest.convertDO(request);
ShopRentInfoDO shopRentInfo = AddRentContractRequest.convertDO(request);
shopRentInfo.setShopId(shopId);
shopRentInfo.setPointId(pointId);
shopRentInfoDAO.addShopRentInfo(shopRentInfo);
@@ -692,9 +693,12 @@ public class PointServiceImpl implements PointService {
ShopRentInfoVO result = ShopRentInfoVO.build(rentContract);
ShopStageInfoDO shopSubStageInfo = shopStageInfoDAO.getShopSubStageInfo(shopId, ShopSubStageEnum.SHOP_STAGE_2);
result.setStatus(shopSubStageInfo.getShopSubStageStatus());
if(Objects.nonNull(shopSubStageInfo.getAuditId())){
boolean isAudit = ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_4.getShopSubStageStatus().equals(shopSubStageInfo.getShopSubStageStatus()) ||
ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_5.getShopSubStageStatus().equals(shopSubStageInfo.getShopSubStageStatus());
if(Objects.nonNull(shopSubStageInfo.getAuditId()) && isAudit){
//当前是审核过的状态才获取原因
LineAuditInfoDO auditInfo = lineAuditInfoDAO.getAuditInfo(shopSubStageInfo.getAuditId());
result.setAuditInfo(LineAuditInfoVO.convertVO(auditInfo));
result.setAuditInfo(AuditInfoVO.convertVO(auditInfo));
}
return result;
}
@@ -703,10 +707,28 @@ public class PointServiceImpl implements PointService {
public Integer auditRentContract(AuditRentContractRequest request) {
Long shopId = request.getShopId();
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(request.getShopId());
ShopRentInfoDO rentContract = shopRentInfoDAO.getRentContractByShopId(shopId);
if(Objects.isNull(shopInfo)){
throw new ServiceException(ErrorCodeEnum.SHOP_NOT_EXIST);
}
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()));
ShopSubStageStatusEnum subStageStatus = AuditResultTypeEnum.PASS.getCode().equals(request.getResultType()) ? ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_5 : ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_4;
return shopStageInfoDAO.updateShopStageInfo(shopId, subStageStatus, auditId);
return shopStageInfoDAO.updateShopStageAndAuditInfo(shopId, subStageStatus, auditId);
}
@Override
public Integer updateRentContract(UpdateRentContractRequest request){
if(!request.check()){
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
}
ShopRentInfoDO shopRentInfo = UpdateRentContractRequest.convertDO(request);
ShopStageInfoDO shopSubStageInfo = shopStageInfoDAO.getShopSubStageInfo(request.getShopId(), ShopSubStageEnum.SHOP_STAGE_2);
if(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_4.getShopSubStageStatus().equals(shopSubStageInfo.getShopSubStageStatus())){
shopStageInfoDAO.updateShopStageAndAuditInfo(shopRentInfo.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_3, null);
}
return shopRentInfoDAO.updateRentContract(shopRentInfo);
}
public List<AuditNodeDTO> dealAuditNode(AuditSettingVO auditSetting, Long regionId, String operateUserId, String developmentManager) {

View File

@@ -1,6 +1,5 @@
package com.cool.store.controller.webc;
import com.cool.store.context.CurrentUserHolder;
import com.cool.store.context.PartnerUserHolder;
import com.cool.store.request.*;
import com.cool.store.response.ResponseResult;
@@ -8,7 +7,6 @@ import com.cool.store.service.PointService;
import com.cool.store.service.ShopService;
import com.cool.store.vo.point.MiniPointPageVO;
import com.cool.store.vo.point.PointDetailVO;
import com.cool.store.vo.point.PointPageVO;
import com.cool.store.vo.point.ShopRentInfoVO;
import com.cool.store.vo.shop.MiniShopPageVO;
import com.cool.store.vo.shop.ShopStageInfoVO;
@@ -97,7 +95,7 @@ public class MiniShopController {
@ApiOperation("上传租赁合同")
@PostMapping("/uploadRentContract")
public ResponseResult<Integer> uploadRentContract(@RequestBody @Validated UploadRentContractRequest request) {
public ResponseResult<Integer> uploadRentContract(@RequestBody @Validated AddRentContractRequest request) {
Long lineId = PartnerUserHolder.getUser().getLineId();
request.setCurLineId(lineId);
return ResponseResult.success(pointService.uploadRentContract(request));
@@ -109,5 +107,13 @@ public class MiniShopController {
return ResponseResult.success(pointService.getRentContractDetail(shopId));
}
@ApiOperation("更新租赁合同")
@PostMapping("/updateRentContract")
public ResponseResult<Integer> updateRentContract(@RequestBody @Validated UpdateRentContractRequest request) {
Long lineId = PartnerUserHolder.getUser().getLineId();
request.setCurLineId(lineId);
return ResponseResult.success(pointService.updateRentContract(request));
}
}