Merge #133 into master from cc_20260512_merge_fix

feat:上传租赁合同审批

* cc_20260512_merge_fix: (1 commits squashed)

  - feat:上传租赁合同审批

Signed-off-by: 正新 <accounts_6964c7bcd2a2c377c5bbd01b@mail.teambition.com>
Merged-by: 正新 <accounts_6964c7bcd2a2c377c5bbd01b@mail.teambition.com>

CR-link: https://codeup.aliyun.com/692ea314dec569489f6f167c/hangzhou/java/custom_zxjp/change/133
This commit is contained in:
正新
2026-05-12 10:14:59 +00:00
parent 8caf3b1a6a
commit 52cc142e81
9 changed files with 172 additions and 81 deletions

View File

@@ -360,8 +360,8 @@ public class ShopStageInfoDAO {
}
public List<ShopStageInfoDO> getOperationsConsultantStageInfo(List<Long> shopIds, Integer shopSubStage,
List<Integer> shopSubStageStatusList,
String investmentUserId, DeskRequest deskRequest) {
List<Integer> shopSubStageStatusList,
String investmentUserId, DeskRequest deskRequest) {
return shopStageInfoMapper.getOperationsConsultantStageInfo(shopIds, shopSubStage, shopSubStageStatusList, investmentUserId, deskRequest);
}

View File

@@ -52,15 +52,15 @@ public interface ShopStageInfoMapper extends Mapper<ShopStageInfoDO> {
Integer getCompletionCount(@Param("shopId") Long shopId);
/**
* 跟新店铺阶段信息
* @param shopId
* @param shopSubStage
* @param shopSubStageStatus
* @param isTerminated
* @param remark
* @return
*/
/**
* 跟新店铺阶段信息
* @param shopId
* @param shopSubStage
* @param shopSubStageStatus
* @param isTerminated
* @param remark
* @return
*/
Integer updateShopStageInfo(@Param("shopId") Long shopId, @Param("shopSubStage") Integer shopSubStage, @Param("shopSubStageStatus") Integer shopSubStageStatus,
@Param("isTerminated")boolean isTerminated, @Param("remark") String remark);
@@ -88,7 +88,7 @@ public interface ShopStageInfoMapper extends Mapper<ShopStageInfoDO> {
* @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);
@Param("isTerminated")boolean isTerminated, @Param("remark") String remark, @Param("auditId")Long auditId);
/**
* 获取子阶段信息
@@ -167,10 +167,10 @@ public interface ShopStageInfoMapper extends Mapper<ShopStageInfoDO> {
* @return
*/
List<ShopStageInfoDO> getOperationsConsultantStageInfo(@Param("shopIds") List<Long> shopIds,
@Param("shopSubStage") Integer shopSubStage,
@Param("shopSubStageStatusList") List<Integer> shopSubStageStatusList,
@Param("operationsConsultant") String operationsConsultant,
@Param("request") DeskRequest deskRequest);
@Param("shopSubStage") Integer shopSubStage,
@Param("shopSubStageStatusList") List<Integer> shopSubStageStatusList,
@Param("operationsConsultant") String operationsConsultant,
@Param("request") DeskRequest deskRequest);
@@ -206,9 +206,9 @@ public interface ShopStageInfoMapper extends Mapper<ShopStageInfoDO> {
List<ShopStageInfoDO> getShopSubStages(@Param("shopIds") List<Long> shopIds);
Integer dataUpdateStatus(@Param("list") List<Long> list, @Param("shopSubStage") Integer shopSubStage, @Param("shopSubStageStatus") Integer shopSubStageStatus,
@Param("isTerminated")boolean isTerminated, @Param("remark") String remark);
Integer dataUpdateAcceptanceStatus(@Param("list") List<Long> list, @Param("shopSubStage") Integer shopSubStage, @Param("shopSubStageStatus") Integer shopSubStageStatus,
@Param("isTerminated")boolean isTerminated, @Param("remark") String remark);
Integer dataUpdateAcceptanceStatus(@Param("list") List<Long> list, @Param("shopSubStage") Integer shopSubStage, @Param("shopSubStageStatus") Integer shopSubStageStatus,
@Param("isTerminated")boolean isTerminated, @Param("remark") String remark);
}

View File

@@ -63,31 +63,31 @@
<select id="getPreparationProcess" resultType="com.cool.store.vo.Preparation.PreparationProcessVO">
select
max(plan_complete_time) as planStartTime,
sum(if(is_terminated = 1, 1, 0)) as finishCount
max(plan_complete_time) as planStartTime,
sum(if(is_terminated = 1, 1, 0)) as finishCount
from xfsg_shop_stage_info where shop_id = #{shopId}
</select>
<select id="getAllCompletionCount" resultType="java.lang.Integer">
select
count(1)
count(1)
from
xfsg_shop_stage_info
xfsg_shop_stage_info
where
shop_id = #{shopId} and deleted = 0 and is_terminated = 1
and shop_sub_stage in (60,40,120,140,150)
shop_id = #{shopId} and deleted = 0 and is_terminated = 1
and shop_sub_stage in (60,40,120,140,150)
</select>
<update id="updateShopStageInfo">
update
xfsg_shop_stage_info
xfsg_shop_stage_info
set
shop_sub_stage_status = #{shopSubStageStatus},
is_terminated = #{isTerminated},
remark = #{remark},
actual_complete_time = if(is_terminated, now(), null)
shop_sub_stage_status = #{shopSubStageStatus},
is_terminated = #{isTerminated},
remark = #{remark},
actual_complete_time = if(is_terminated, now(), null)
where
shop_id = #{shopId} and shop_sub_stage = #{shopSubStage}
shop_id = #{shopId} and shop_sub_stage = #{shopSubStage}
</update>
@@ -116,28 +116,28 @@
<update id="updateShopStageAndAuditInfo">
update
xfsg_shop_stage_info
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}
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}
shop_id = #{shopId} and shop_sub_stage = #{shopSubStage}
</update>
<update id="updateShopStageToNotStarted">
update
xfsg_shop_stage_info
xfsg_shop_stage_info
set
shop_sub_stage_status = -100,
is_terminated = 0,
remark = '未开始',
actual_complete_time = null,
audit_id = null
shop_sub_stage_status = -100,
is_terminated = 0,
remark = '未开始',
actual_complete_time = null,
audit_id = null
where
shop_id = #{shopId} and shop_sub_stage = #{shopSubStage}
shop_id = #{shopId} and shop_sub_stage = #{shopSubStage}
</update>
<update id="updateByShopId">
update xfsg_shop_stage_info
@@ -244,9 +244,9 @@
inner join xfsg_line_info b on a.line_id = b.id
left join xfsg_shop_info c on a.shop_id = c.id
where c.deleted=0
and a.shop_sub_stage = #{shopSubStage}
and a.deleted = 0
and b.deleted = 0
and a.shop_sub_stage = #{shopSubStage}
and a.deleted = 0
and b.deleted = 0
<if test="shopSubStageStatusList != null and shopSubStageStatusList.size() > 0">
and a.shop_sub_stage_status in
<foreach collection="shopSubStageStatusList" item="shopSubStageStatus" index="index" open="(" separator="," close=")">
@@ -307,12 +307,12 @@
</select>
<select id="getShopContractIncompletion" resultType="java.lang.Long">
SELECT
shop_id
shop_id
FROM
xfsg_shop_stage_info
xfsg_shop_stage_info
WHERE
shop_sub_stage = 110
AND (shop_sub_stage_status = 1100 OR shop_sub_stage_status = 1110)
shop_sub_stage = 110
AND (shop_sub_stage_status = 1100 OR shop_sub_stage_status = 1110)
</select>
@@ -320,7 +320,7 @@
select
*
from xfsg_shop_stage_info a
left join xfsg_shop_info si on a.shop_id = si.id
left join xfsg_shop_info si on a.shop_id = si.id
<if test="request.signTypes != null and request.signTypes.size() >0">
left join xfsg_sign_franchise sign on a.shop_id = sign.shop_id
</if>
@@ -334,9 +334,9 @@
</if>
<if test="shopSubStage!=null">
and a.shop_sub_stage = #{shopSubStage}
<if test = "shopSubStage == 86 or shopSubStage == 90 or shopSubStage == 110 or shopSubStage == 120">
and (si.hqt_shop_id is null or si.hqt_shop_id = '')
</if>
<if test = "shopSubStage == 86 or shopSubStage == 90 or shopSubStage == 110 or shopSubStage == 120">
and (si.hqt_shop_id is null or si.hqt_shop_id = '')
</if>
</if>
<if test="shopSubStageStatusList != null and shopSubStageStatusList.size() > 0">
and a.shop_sub_stage_status in
@@ -510,7 +510,7 @@
<select id="getShopCountByLineIdAndStageStatus" resultType="integer">
select count(1) from xfsg_shop_stage_info where shop_stage = #{shopStage} and shop_sub_stage = #{shopSubStage}
and shop_sub_stage_status = #{shopSubStageStatus} and line_id = #{lineId}
and shop_sub_stage_status = #{shopSubStageStatus} and line_id = #{lineId}
</select>
<select id="getSubStageListBySubStageStatus" resultType="com.cool.store.entity.ShopStageInfoDO">
select *
@@ -600,22 +600,22 @@
</select>
<select id="getScheduleAll" resultType="com.cool.store.dto.Preparation.ScheduleDTO">
select
shop_id as shopId,
max(plan_complete_time) as planCompleteTime,
count(1)-1 as totalColumn,
sum(if(is_terminated = 1 and shop_sub_stage!=85, 1, 0)) as completionColumn
shop_id as shopId,
max(plan_complete_time) as planCompleteTime,
count(1)-1 as totalColumn,
sum(if(is_terminated = 1 and shop_sub_stage!=85, 1, 0)) as completionColumn
from xfsg_shop_stage_info where shop_stage = 2 and
shop_id = #{shopId}
shop_id = #{shopId}
</select>
<select id="getCompletionCount" resultType="java.lang.Integer">
select
count(1)
count(1)
from
xfsg_shop_stage_info
xfsg_shop_stage_info
where
shop_id = #{shopId} and deleted = 0 and is_terminated = 1 and shop_stage in (1,2)
shop_id = #{shopId} and deleted = 0 and is_terminated = 1 and shop_stage in (1,2)
</select>
<select id="getShopSubStages" resultType="com.cool.store.entity.ShopStageInfoDO">
select shop_id as shopId,

View File

@@ -21,4 +21,13 @@ public interface OperationLogService {
List<AuditInfoResponse> getAuditInfo(Long shopId,List<Integer> shopSubStageList);
Boolean batchUpdateProcessed( List<OperationLogDO> operationLogs,Long audit , String userId, String reason);
/**
* 后期新增的阶段数据 对于处在阶段中的数据 可能没有提前生成审批记录 直接插入数据 且是审批完成状态
* @param subStageStatusEnum
* @param audit
* @param userId
* @param reason
*/
Boolean handleApproveTimeNoDate(Long shopId,ShopSubStageStatusEnum subStageStatusEnum,Long audit , String userId, String reason);
}

View File

@@ -304,7 +304,7 @@ public interface PointService {
* @param request
* @return
*/
Integer uploadRentContract(AddRentContractRequest request);
Integer uploadRentContract(AddRentContractRequest request,String userId,String userName);
/**
* 获取租赁合同详情

View File

@@ -100,7 +100,7 @@ public class OperationLogServiceImpl implements OperationLogService {
return null;
}
Map<Date, List<OperationLogDO>> operationLogMap = logList.stream().collect(Collectors.groupingBy(OperationLogDO::getCreateTime));
//根据时间分组
//根据时间分组
for (Date date : operationLogMap.keySet()) {
List<OperationLogDO> operations = operationLogMap.get(date);
AuditInfoResponse auditInfoResponse = new AuditInfoResponse();
@@ -230,11 +230,35 @@ public class OperationLogServiceImpl implements OperationLogService {
operationLogDO.setCreateTime(createTime);
operationLogDO.setUpdateTime(updateTime);
operationLogDO.setCreateUserId(userId);
operationLogDAO.addOperationLog(operationLogDO);
operationLogDAO.addOperationLog(operationLogDO);
}
return operationLogDAO.batchUpdateByPrimaryKeySelective(operationLogList);
}
@Override
public Boolean handleApproveTimeNoDate(Long shopId,ShopSubStageStatusEnum subStageStatusEnum, Long audit, String userId, String reason) {
OperationLogDO operationLogDO = new OperationLogDO();
operationLogDO.setOperator(userId);
operationLogDO.setAuditResultId(audit);
operationLogDO.setRemarks(reason);
operationLogDO.setShopId(shopId);
operationLogDO.setShopSubStage(subStageStatusEnum.getShopSubStageEnum().getShopSubStage());
operationLogDO.setShopSubStageStatus(subStageStatusEnum.getShopSubStageStatus());
operationLogDO.setStatus(OperationStatusEnum.PROCESSED.getCode());
operationLogDO.setType(OperationTypeEnum.OPERATION_TYPE_1.getCode());
String userName = enterpriseUserDAO.getUserName(userId);
if (StringUtils.isNotBlank(userName)) {
operationLogDO.setOperatorName(userName);
}
Date createTime = new Date();
Date updateTime = new Date();
operationLogDO.setCreateTime(createTime);
operationLogDO.setUpdateTime(updateTime);
operationLogDO.setCreateUserId(userId);
operationLogDAO.addOperationLog(operationLogDO);
return Boolean.TRUE;
}
}

View File

@@ -51,8 +51,7 @@ import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import static com.cool.store.enums.point.ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_21;
import static com.cool.store.enums.point.ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_21_5;
import static com.cool.store.enums.point.ShopSubStageStatusEnum.*;
/**
* @author zhangchenbiao
@@ -106,6 +105,10 @@ public class PointServiceImpl implements PointService {
private String enterpriseId;
@Resource
SysRoleMapper sysRoleMapper;
@Resource
OperationLogService operationLogService;
@Resource
OperationLogDAO operationLogDAO;
@Resource
PointFinancialDataDAO pointFinancialDataDAO;
@@ -125,7 +128,7 @@ public class PointServiceImpl implements PointService {
String userId = user.getUserId();
PointInfoDO pointInfo = AddPointDetailRequest.convertPointDO(shopPointDetailRequest);
if (shopId != null) {
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(shopId);
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(shopId);
if (Objects.isNull(shopInfo)){
throw new ServiceException(ErrorCodeEnum.SHOP_ID_NOT_EXIST);
}
@@ -329,7 +332,7 @@ public class PointServiceImpl implements PointService {
//租赁合同回到未开始
Integer result = shopStageInfoDAO.updateShopStageToNotStarted(shopId, ShopSubStageEnum.SHOP_STAGE_2);
if (result > CommonConstants.ZERO) {
//删除租赁合同
//删除租赁合同
shopRentInfoDAO.deleteRentContractByShopId(shopId);
}
}
@@ -1031,7 +1034,7 @@ public class PointServiceImpl implements PointService {
pointInfoDAO.updatePointInfo(updatePoint);
ShopInfoDO updateShop = new ShopInfoDO();
updateShop.setId(shopId);
// updateShop.setShopName(pointInfo.getPointName());
// updateShop.setShopName(pointInfo.getPointName());
updateShop.setPointId(pointId);
updateShop.setInvestRegionId(pointInfo.getRegionId());
shopInfoDAO.updateShopInfo(updateShop);
@@ -1126,7 +1129,7 @@ public class PointServiceImpl implements PointService {
Long pointId = pointInfoDAO.addPointInfo(pointInfo);
pointDetailInfo.setPointId(pointId);
pointDetailInfoDAO.addPointDetailInfo(pointDetailInfo);
// shopInfo.setShopName(pointInfo.getPointName());
// shopInfo.setShopName(pointInfo.getPointName());
shopInfo.setPointId(pointId);
shopInfoDAO.updateShopInfo(shopInfo);
PointRecommendDO pointRecommendDO = new PointRecommendDO();
@@ -1195,14 +1198,13 @@ public class PointServiceImpl implements PointService {
}
@Override
public Integer uploadRentContract(AddRentContractRequest request) {
public Integer uploadRentContract(AddRentContractRequest request,String userId,String userName) {
if (!request.check()) {
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
}
Long pointId = request.getPointId(), shopId = request.getShopId();
ShopInfoDO shopInfo = null;
ShopInfoDO shopInfo = shopInfo = shopInfoDAO.getShopInfo(shopId);;
if (Objects.isNull(pointId) && Objects.nonNull(shopId)) {
shopInfo = shopInfoDAO.getShopInfo(shopId);
pointId = shopInfo.getPointId();
}
if (Objects.nonNull(pointId) && Objects.isNull(shopId)) {
@@ -1239,6 +1241,13 @@ public class PointServiceImpl implements PointService {
MessageEnum.MESSAGE_15,
map);
}
// 审批记录
operationLogService.addOperationLog(shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_20, userId, userName,
OperationTypeEnum.OPERATION_TYPE_0, "加盟商上传租赁合同", OperationStatusEnum.PROCESSED);
List<EnterpriseUserDO> userDOList = userAuthMappingService.getAllUserByRoleEnumAndRegionId(UserRoleEnum.REGION_MANAGER, shopInfo.getInvestRegionId());
operationLogService.addOperationLog(shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_21,
userId, userDOList,
OperationTypeEnum.OPERATION_TYPE_1, "招商片区老总审核", OperationStatusEnum.NOT_PROCESSED);
return shopStageInfoDAO.updateShopStageInfo(shopId, SHOP_SUB_STAGE_STATUS_21);
}
@@ -1286,6 +1295,8 @@ public class PointServiceImpl implements PointService {
Long auditId = shopAuditInfoDAO.addAuditInfo(AuditRentContractRequest.convert(request, AuditTypeEnum.UPLOAD_RENT_CONTRACT));
ShopSubStageStatusEnum subStageStatus = null;
Integer current = shopStageInfo.getShopSubStageStatus();
ShopSubStageStatusEnum currentShopSubStageStatusEnum = getShopSubStageStatusEnum(current);
if (AuditResultTypeEnum.PASS.getCode().equals(request.getResultType())){
if (shopStageInfo.getShopSubStageStatus().equals(SHOP_SUB_STAGE_STATUS_21.getShopSubStageStatus())){
subStageStatus = SHOP_SUB_STAGE_STATUS_21_5;
@@ -1296,6 +1307,16 @@ public class PointServiceImpl implements PointService {
}else {
subStageStatus = ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_22;
}
//处理审批
handleApprove(shopId,AuditTypeEnum.UPLOAD_RENT_CONTRACT,request.getOperateUserId(),request.getOperateUserName(),
request.getResultType(),currentShopSubStageStatusEnum,request.getReason());
//如果有下一级
if (SHOP_SUB_STAGE_STATUS_21.getShopSubStageStatus().equals(currentShopSubStageStatusEnum.getShopSubStageStatus())){
List<EnterpriseUserDO> userDOList = userAuthMappingService.getAllUserByRoleEnumAndRegionId(UserRoleEnum.BRANCH_OFFICE, shopInfo.getInvestRegionId());
operationLogService.addOperationLog(shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_21_5,
request.getOperateUserId(), userDOList,
OperationTypeEnum.OPERATION_TYPE_1, "分部内勤审核", OperationStatusEnum.NOT_PROCESSED);
}
if (ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_23.equals(subStageStatus)) {
//审核通过铺位变为已签约
@@ -1324,6 +1345,41 @@ public class PointServiceImpl implements PointService {
return CommonConstants.ONE;
}
/**
* 处理审批
* @param shopId
* @param auditTypeEnum
* @param userId
* @param userName
* @param resultType
* @param currentStatusEnum
* @param cause
* @return
*/
private Boolean handleApprove(Long shopId,AuditTypeEnum auditTypeEnum,String userId,String userName,Integer resultType,ShopSubStageStatusEnum currentStatusEnum,String cause){
ShopAuditInfoDO shopAuditInfoDO = new ShopAuditInfoDO();
shopAuditInfoDO.setShopId(shopId);
shopAuditInfoDO.setAuditType(auditTypeEnum.getCode());
shopAuditInfoDO.setSubmittedUserId(userId);
shopAuditInfoDO.setSubmittedUserName(userName);
shopAuditInfoDO.setResultType(resultType);
if (AuditResultTypeEnum.PASS.getCode().equals(shopAuditInfoDO.getResultType())) {
shopAuditInfoDO.setPassReason(cause);
} else {
shopAuditInfoDO.setRejectReason(cause);
}
Long auditId = shopAuditInfoDAO.addAuditInfo(shopAuditInfoDO);
//更新操作记录
List<OperationLogDO> operationLogs = operationLogDAO.getBySubStageStatusEnumAndsStatus(shopId, currentStatusEnum, OperationTypeEnum.OPERATION_TYPE_1.getCode());
if (CollectionUtils.isNotEmpty(operationLogs)){
operationLogService.batchUpdateProcessed(operationLogs, auditId, userId, cause);
}else {
operationLogService.handleApproveTimeNoDate(shopId,currentStatusEnum,auditId, userId, cause);
}
return true;
}
@Override
public Integer updateRentContract(UpdateRentContractRequest request) {
if (!request.check()) {

View File

@@ -2,6 +2,7 @@ package com.cool.store.controller.webb;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.context.CurrentUserHolder;
import com.cool.store.context.LoginUserInfo;
import com.cool.store.context.PartnerUserHolder;
import com.cool.store.dto.point.PointStatisticsDTO;
import com.cool.store.dto.point.ShopPointDTO;
@@ -283,7 +284,8 @@ public class PointController {
@ApiOperation("上传租赁合同")
@PostMapping("/uploadRentContract")
public ResponseResult<Integer> uploadRentContract(@RequestBody @Validated AddRentContractRequest request) {
return ResponseResult.success(pointService.uploadRentContract(request));
LoginUserInfo user = CurrentUserHolder.getUser();
return ResponseResult.success(pointService.uploadRentContract(request,user.getUserId(),user.getName()));
}
@ApiOperation("保存点位测算 V3.0 新增")

View File

@@ -97,9 +97,9 @@ public class MiniShopController {
@ApiOperation("上传租赁合同")
@PostMapping("/uploadRentContract")
public ResponseResult<Integer> uploadRentContract(@RequestBody @Validated AddRentContractRequest request) {
Long lineId = PartnerUserHolder.getUser().getLineId();
request.setCurLineId(lineId);
return ResponseResult.success(pointService.uploadRentContract(request));
PartnerUserInfoVO user = PartnerUserHolder.getUser();
request.setCurLineId(user.getLineId());
return ResponseResult.success(pointService.uploadRentContract(request,user.getPartnerId(),user.getUsername()));
}
@ApiOperation("获取租赁合同详情")