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:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -304,7 +304,7 @@ public interface PointService {
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
Integer uploadRentContract(AddRentContractRequest request);
|
||||
Integer uploadRentContract(AddRentContractRequest request,String userId,String userName);
|
||||
|
||||
/**
|
||||
* 获取租赁合同详情
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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()) {
|
||||
|
||||
Reference in New Issue
Block a user