建店阶段审批流

This commit is contained in:
shuo.wang
2025-04-17 16:36:42 +08:00
parent b301d5375c
commit 80500fd6a6
23 changed files with 363 additions and 106 deletions

View File

@@ -15,7 +15,8 @@ public enum AuditTypeEnum {
MEI_TUAN_TUAN_GOU(11,"美团团购"),
E_LE_ME(12,"饿了么"),
MEI_TUAN_WAI_MAI(13,"美团外卖"),
YING_ZHANG_TONG(14,"营帐通");
YING_ZHANG_TONG(14,"营帐通"),
BUILDINFORMATION(15,"建店资料信息")
;
private Integer code;

View File

@@ -79,6 +79,7 @@ public enum MessageEnum {
MESSAGE_51("您有一个加盟商提交了铺位,请查收","铺位名称:${pointName}\n加盟商姓名${partnerUsername}\n加盟商手机号码${partnerMobile}\n"),
MESSAGE_52("您有一个门店建店资料的订货信息待提交,请查收","门店名称:${storeName}\n加盟商姓名${partnerUsername}\n加盟商手机号码${partnerMobile}\n"),
MESSAGE_53("您有一个门店建店资料的总部订货收款账户信息待提交,请查收","门店名称:${storeName}\n加盟商姓名${partnerUsername}\n加盟商手机号码${partnerMobile}\n"),
MESSAGE_54("您有一个门店建店资料待审核,请查收","门店名称:${storeName}\n加盟商姓名${partnerUsername}\n加盟商手机号码${partnerMobile}\n"),
;

View File

@@ -48,8 +48,11 @@ public enum UserRoleEnum {
REGION_OFFICE(410000000L,"大区内勤"),
FINANCE(1735895867344L,"财务"),
CHUAN_XIAO_MEI_MANAGER(1731635078802L,"串小妹大区执行总经理"),
REGIONAL_MANAGER(420000000L,"大区经理"),
LOGISTICS(430000000L,"物流")
REGIONAL_MANAGER(1716252923436L,"大区经理"),
LOGISTICS(430000000L,"物流"),
HEAD_OF_DIVISION(40000000L,"分部负责人"),
PRESIDENT(1715882476902L,"总裁"),
VICE_PRESIDENT_IN_CHARGE(440000000L,"分管副总裁")
;
private Long code;

View File

@@ -79,7 +79,10 @@ public enum ShopSubStageStatusEnum {
SHOP_SUB_STAGE_STATUS_150(ShopSubStageEnum.SHOP_STAGE_15, 1500, "待提交", Boolean.FALSE),
SHOP_SUB_STAGE_STATUS_151(ShopSubStageEnum.SHOP_STAGE_15, 1510, "待总部填写仓配信息", Boolean.TRUE),
SHOP_SUB_STAGE_STATUS_152(ShopSubStageEnum.SHOP_STAGE_15, 1520, "待总部提交订货收款信息",Boolean.TRUE),
SHOP_SUB_STAGE_STATUS_153(ShopSubStageEnum.SHOP_STAGE_15, 1530, "已完成", Boolean.TRUE),
SHOP_SUB_STAGE_STATUS_153(ShopSubStageEnum.SHOP_STAGE_15, 1530, "待分部总监审批",Boolean.TRUE),
SHOP_SUB_STAGE_STATUS_154(ShopSubStageEnum.SHOP_STAGE_15, 1540, "待分部副总裁审批",Boolean.TRUE),
SHOP_SUB_STAGE_STATUS_155(ShopSubStageEnum.SHOP_STAGE_15, 1550, "待分部总裁审批",Boolean.TRUE),
SHOP_SUB_STAGE_STATUS_156(ShopSubStageEnum.SHOP_STAGE_15, 1560, "已完成", Boolean.TRUE),
//POS
SHOP_SUB_STAGE_STATUS_160(ShopSubStageEnum.SHOP_STAGE_16, 1600, "待提交", Boolean.FALSE),
@@ -178,4 +181,13 @@ public enum ShopSubStageStatusEnum {
public boolean isTerminated() {
return isTerminated;
}
public static ShopSubStageStatusEnum getShopSubStageStatusEnum(Integer shopSubStageStatus) {
for (ShopSubStageStatusEnum stageStatusEnum : ShopSubStageStatusEnum.values()) {
if (Objects.nonNull(stageStatusEnum.getShopSubStageStatus()) && stageStatusEnum.getShopSubStageStatus().equals(shopSubStageStatus)) {
return stageStatusEnum;
}
}
return null;
}
}

View File

@@ -25,7 +25,8 @@
a.first_year_end_time as firstYearEndTime,
a.first_year_fee as firstYearFee,
a.performance_bond as performanceBond,
b.pay_user_name as payUserName
b.pay_user_name as payUserName,
a.discount_reason as discountReason
from xfsg_franchise_fee a
LEFT JOIN xfsg_line_pay b ON b.id = a.pay_id
where a.shop_id in

View File

@@ -289,7 +289,8 @@
a.create_time as createTime,
a.join_mode as joinMode,
a.franchise_brand as franchiseBrand,
a.shop_status as shopStatus
a.shop_status as shopStatus,
a.detail_address as shopAddress
from xfsg_shop_info a left join xfsg_line_info b on a.line_id = b.id
where a.deleted = 0
<if test="request.partnerKeyword != null and request.partnerKeyword != ''">

View File

@@ -26,6 +26,10 @@ public class ExportBranchShopDTO {
@ColumnWidth(30)
private String shopName;
@ExcelProperty(value = "加盟签约店铺地址",order = 4)
@ColumnWidth(40)
private String shopAddress;
@ExcelProperty(value = "门店编号",order = 4)
@ColumnWidth(30)
private String shopCode;
@@ -77,9 +81,11 @@ public class ExportBranchShopDTO {
@ExcelProperty(value = "缴纳加盟费/保证金",order =15)
@ColumnWidth(30)
private String franchiseFeeStageStatus;
@ExcelProperty(value = "加盟合同签约",order =16)
@ColumnWidth(30)
private String signFranchiseStageStatus ;
@ExcelProperty(value = "签约时间",order =17)
@ColumnWidth(30)
private String signTime ;
@@ -100,91 +106,95 @@ public class ExportBranchShopDTO {
@ColumnWidth(30)
private String totalAmountContributions;
@ExcelProperty(value = "加盟费(取自账单)",order = 20)
@ExcelProperty(value = "加盟费优惠原因",order = 20)
@ColumnWidth(40)
private String discountReason;
@ExcelProperty(value = "加盟费(取自账单)",order = 21)
@ColumnWidth(30)
private String franchiseFeeBill;
@ExcelProperty(value = "加盟费(含税金额)",order = 21)
@ExcelProperty(value = "加盟费(含税金额)",order = 22)
@ColumnWidth(30)
private String franchiseFeeTax;
@ExcelProperty(value = "加盟费(不含税金额)",order = 22)
@ExcelProperty(value = "加盟费(不含税金额)",order = 23)
@ColumnWidth(30)
private String franchiseFee;
@ExcelProperty(value = "保证金(取自账单)",order = 23)
@ExcelProperty(value = "保证金(取自账单)",order = 24)
@ColumnWidth(30)
private String loanMargin;
@ExcelProperty(value = "第一年度管理费(取自账单)",order = 24)
@ExcelProperty(value = "第一年度管理费(取自账单)",order = 25)
@ColumnWidth(30)
private String firstYearManagementFeeBill;
@ExcelProperty(value = "第一年度管理费(含税金额)",order = 25)
@ExcelProperty(value = "第一年度管理费(含税金额)",order = 26)
@ColumnWidth(30)
private String firstYearManagementFeeTax;
@ExcelProperty(value = "第一年度管理费(不含税金额)",order = 26)
@ExcelProperty(value = "第一年度管理费(不含税金额)",order = 27)
@ColumnWidth(30)
private String firstYearManagementFee;
@ExcelProperty(value = "第一年度品牌费(取自账单)",order = 27)
@ExcelProperty(value = "第一年度品牌费(取自账单)",order = 28)
@ColumnWidth(30)
private String firstYearBrandingFeeBill;
@ExcelProperty(value = "第一年度品牌费(含税金额)",order = 28)
@ExcelProperty(value = "第一年度品牌费(含税金额)",order = 29)
@ColumnWidth(30)
private String firstYearBrandingFeeTax;
@ExcelProperty(value = "第一年度品牌费(不含税金额)",order = 29)
@ExcelProperty(value = "第一年度品牌费(不含税金额)",order = 30)
@ColumnWidth(30)
private String firstYearBrandingFee;
@ExcelProperty(value = "设计费(取自账单)",order = 30)
@ExcelProperty(value = "设计费(取自账单)",order = 31)
@ColumnWidth(30)
private String performanceBondBill;
@ExcelProperty(value = "设计费(含税金额)",order = 31)
@ExcelProperty(value = "设计费(含税金额)",order = 32)
@ColumnWidth(30)
private String designFeeTax;
@ExcelProperty(value = "设计费(不含税金额)",order = 32)
@ExcelProperty(value = "设计费(不含税金额)",order = 33)
@ColumnWidth(30)
private String designFee;
@ExcelProperty(value = "缴款人",order = 33)
@ExcelProperty(value = "缴款人",order = 34)
@ColumnWidth(30)
private String payUserName;
@ExcelProperty(value = "第1次缴纳时间",order = 33)
@ExcelProperty(value = "第1次缴纳时间",order = 35)
@ColumnWidth(30)
private String firstPayTime;
@ExcelProperty(value = "第2次缴纳时间",order = 34)
@ExcelProperty(value = "第2次缴纳时间",order = 36)
@ColumnWidth(30)
private String secondPayTime;
@ExcelProperty(value = "第3次缴纳时间",order = 35)
@ExcelProperty(value = "第3次缴纳时间",order = 37)
@ColumnWidth(30)
private String thirdPayTime;
@ExcelProperty(value = "第4次缴纳时间",order = 36)
@ExcelProperty(value = "第4次缴纳时间",order = 38)
@ColumnWidth(30)
private String fourthPayTime;
@ExcelProperty(value = "当前进度",order = 37)
@ExcelProperty(value = "当前进度",order = 39)
@ColumnWidth(30)
private String currentProgress;
@ExcelProperty(value = "状态",order = 38)
@ExcelProperty(value = "状态",order = 40)
@ColumnWidth(30)
private String shopStatus;
@ExcelProperty(value = "计划开店时间",order = 39)
@ExcelProperty(value = "计划开店时间",order = 41)
@ColumnWidth(30)
private String planOpenTime;
@ExcelProperty(value = "开店时长(天)",order =40)
@ExcelProperty(value = "开店时长(天)",order =42)
@ColumnWidth(30)
private String openDuration;

View File

@@ -15,6 +15,8 @@ import java.util.List;
*/
@Data
public class FranchiseFeeDTO {
private String discountReason;
private Long shopId;
//缴费时间
private Date payTime;

View File

@@ -13,6 +13,8 @@ import java.util.Date;
@Data
public class PreparationDTO {
private String shopAddress;
private Long id;
private Long wantShopAreaId;

View File

@@ -1,5 +1,6 @@
package com.cool.store.entity;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@@ -54,4 +55,8 @@ public class FranchiseFeeDO {
@Column(name = "update_time")
private Date updateTime;
@ApiModelProperty("加盟费优惠原因")
@Column(name = "discount_reason")
private String discountReason;
}

View File

@@ -0,0 +1,53 @@
package com.cool.store.request;
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;
import javax.validation.constraints.NotNull;
/**
* @Author: WangShuo
* @Date: 2025/04/17/13:36
* @Version 1.0
* @注释:
*/
@Data
public class AuditRequest {
@NotNull
private Long shopId;
@ApiModelProperty(value = "当前阶段状态")
@NotNull(message = "当前阶段状态不能为空")
private Integer shopSubStageStatus;
@ApiModelProperty(value = "审核结果,0通过1拒绝")
@NotNull(message = "审核结果不能为空")
private Integer resultType;
@ApiModelProperty(value = "审核原因")
private String reason;
@ApiModelProperty(value = "操作人id", hidden = true)
private String operateUserId;
@ApiModelProperty(value = "操作人姓名", hidden = true)
private String operateUserName;
public static ShopAuditInfoDO convert(AuditRequest 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.setPassReason(request.getReason());
} else {
result.setRejectReason(request.getReason());
}
return result;
}
}

View File

@@ -41,6 +41,8 @@ public class FranchiseFeeRequest {
private String thirdYearFee;
@ApiModelProperty("履约保证金")
private String performanceBond;
@ApiModelProperty("加盟费优惠原因")
private String discountReason;
public FranchiseFeeDO toFranchiseFeeDO() {
@@ -60,6 +62,7 @@ public class FranchiseFeeRequest {
franchiseFeeDO.setThirdYearEndTime(this.thirdYearEndTime);
franchiseFeeDO.setThirdYearFee(this.thirdYearFee);
franchiseFeeDO.setPerformanceBond(this.performanceBond);
franchiseFeeDO.setDiscountReason(this.discountReason);
return franchiseFeeDO;
}
}

View File

@@ -35,6 +35,8 @@ public class AuditInfoResponse {
private String annex;
@ApiModelProperty("实际操作人id")
private String actualUserId;
@ApiModelProperty("阶段状态")
private Integer shopSubStageStatus;
@Data
@Builder
@NoArgsConstructor

View File

@@ -1,5 +1,7 @@
package com.cool.store.response;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -23,6 +25,7 @@ public class BranchShopResponse {
private String mobile;
@ApiModelProperty("门店名称")
private String shopName;
private String shopAddress;
@ApiModelProperty("门店编号")
private String shopCode;
@ApiModelProperty("所属大区")

View File

@@ -43,6 +43,8 @@ public class FranchiseFeeResponse {
private String performanceBond;
private Date createTime;
private Date updateTime;
@ApiModelProperty("加盟费优惠原因")
private String discountReason;
private LinePay linePayDO;
@@ -177,6 +179,7 @@ public class FranchiseFeeResponse {
franchiseFeeResponse.setCreateTime(franchiseFeeDO.getCreateTime());
franchiseFeeResponse.setUpdateTime(franchiseFeeDO.getUpdateTime());
franchiseFeeResponse.setFirstYearManageFee(franchiseFeeDO.getFirstYearManageFee());
franchiseFeeResponse.setDiscountReason(franchiseFeeDO.getDiscountReason());
return franchiseFeeResponse;
}
}

View File

@@ -1,5 +1,7 @@
package com.cool.store.service;
import com.cool.store.context.LoginUserInfo;
import com.cool.store.request.AuditRequest;
import com.cool.store.request.OrderSysInfoRequest;
import io.swagger.annotations.ApiModelProperty;
@@ -12,5 +14,7 @@ import io.swagger.annotations.ApiModelProperty;
public interface OrderSysInfoService {
Integer updateByShopId(OrderSysInfoRequest request,String userId);
Integer updateByShopId(OrderSysInfoRequest request, LoginUserInfo user);
Integer audit(AuditRequest request ,LoginUserInfo user);
}

View File

@@ -3,6 +3,7 @@ package com.cool.store.service;
import com.cool.store.dto.GetAccessTokenDTO;
import com.cool.store.dto.ModifyPasswordDTO;
import com.cool.store.dto.XgjOrganizationDTO;
import com.cool.store.request.AuditRequest;
import com.cool.store.request.ZxjpApiRequest;
import java.util.List;

View File

@@ -497,7 +497,9 @@ public class DeskServiceImpl implements DeskService {
@Override
public PageInfo<PreparationCommonPendingVO> buildInformationPendingList(Integer pageNum, Integer pageSize, LoginUserInfo user) {
List<Long> userRoleIds = enterpriseUserRoleMapper.getUserRoleIds(user.getUserId());
List<Integer> subStageStatusList = new ArrayList<>();
if (userRoleIds.contains(UserRoleEnum.LOGISTICS.getCode())){
subStageStatusList.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_151.getShopSubStageStatus());
return commonPlatformBuild(pageNum, pageSize, user, Arrays.asList(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_151.getShopSubStageStatus()));
}
if (userRoleIds.contains(UserRoleEnum.FINANCE.getCode())){

View File

@@ -139,6 +139,7 @@ public class ExportRealizeServiceImpl implements ExportRealizeService {
}
for (BranchShopResponse response : list) {
ExportBranchShopDTO dto = new ExportBranchShopDTO();
dto.setShopAddress(response.getShopAddress());
FranchiseFeeDTO franchiseFeeDTO = franchiseFeeDTOMap.get(response.getShopId());
if (ObjectUtils.isNotEmpty(franchiseFeeDTO)) {
dto.setFirstYearStartTime(DateUtils.parseDateToStr(SPECIAL_DATE_START_1, franchiseFeeDTO.getFirstYearStartTime()));
@@ -154,6 +155,7 @@ public class ExportRealizeServiceImpl implements ExportRealizeService {
dto.setFirstYearManagementFeeBill(franchiseFeeDTO.getFirstYearManagementFee());
dto.setFirstYearBrandingFeeBill(franchiseFeeDTO.getFirstYearFee());
dto.setPayUserName(franchiseFeeDTO.getPayUserName());
dto.setDiscountReason(franchiseFeeDTO.getDiscountReason());
}
dto.setUserName(response.getUsername());
dto.setMobile(response.getMobile());

View File

@@ -91,6 +91,7 @@ public class OperationLogServiceImpl implements OperationLogService {
List<AuditInfoResponse> responses = new ArrayList<>();
List<OperationLogDO> logList = operationLogDAO.getByShopSubStage(shopId, shopSubStageList, 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();
@@ -98,6 +99,8 @@ public class OperationLogServiceImpl implements OperationLogService {
List<String> userIds = new ArrayList<>();
Long auditId = null;
Integer operationType = 0;
OperationLogDO operationLog = operations.get(0);
auditInfoResponse.setShopSubStageStatus(operationLog.getShopSubStageStatus());
for (OperationLogDO operationLogDO : operations) {
//提交时候只会有一个人
if (operationLogDO.getType().equals(OperationTypeEnum.OPERATION_TYPE_0.getCode())) {
@@ -142,6 +145,7 @@ public class OperationLogServiceImpl implements OperationLogService {
}
}
}
//处理审批人信息
if (operationType.equals(OperationTypeEnum.OPERATION_TYPE_1.getCode())) {
Map<String, EnterpriseUserDO> userInfoMap = enterpriseUserDAO.getUserInfoMap(userIds);
for (EnterpriseUserDO enterpriseUserDO : userInfoMap.values()) {
@@ -152,6 +156,7 @@ public class OperationLogServiceImpl implements OperationLogService {
list.add(user);
}
auditInfoResponse.setList(list);
//处理审批结果
if (Objects.nonNull(auditId)) {
ShopAuditInfoDO auditInfo = shopAuditInfoDAO.getAuditInfo(auditId);
if (Objects.nonNull(auditInfo)) {

View File

@@ -1,27 +1,31 @@
package com.cool.store.service.impl;
import com.cool.store.dao.LineInfoDAO;
import com.cool.store.dao.OrderSysInfoDAO;
import com.cool.store.dao.ShopInfoDAO;
import com.cool.store.dao.ShopStageInfoDAO;
import com.cool.store.context.LoginUserInfo;
import com.cool.store.dao.*;
import com.cool.store.entity.*;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.MessageEnum;
import com.cool.store.enums.OrderSysTypeEnum;
import com.cool.store.enums.UserRoleEnum;
import com.cool.store.enums.*;
import com.cool.store.enums.point.ShopSubStageEnum;
import com.cool.store.enums.point.ShopSubStageStatusEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.mapper.FranchiseFeeMapper;
import com.cool.store.request.AuditRequest;
import com.cool.store.request.OrderSysInfoRequest;
import com.cool.store.service.OperationLogService;
import com.cool.store.service.OrderSysInfoService;
import com.cool.store.service.UserAuthMappingService;
import com.cool.store.utils.poi.StringUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static com.cool.store.enums.UserRoleEnum.PRESIDENT;
import static com.cool.store.enums.UserRoleEnum.VICE_PRESIDENT_IN_CHARGE;
import static com.cool.store.enums.point.ShopSubStageStatusEnum.*;
/**
* @Author: WangShuo
@@ -32,6 +36,11 @@ import java.util.stream.Collectors;
@Service
public class OrderSysInfoServiceImpl implements OrderSysInfoService {
@Resource
FranchiseFeeMapper franchiseFeeMapper;
@Resource
private OperationLogDAO operationLogDAO;
@Resource
private OrderSysInfoDAO orderSysInfoDAO;
@Resource
@@ -46,17 +55,24 @@ public class OrderSysInfoServiceImpl implements OrderSysInfoService {
private ShopInfoDAO shopInfoDAO;
@Resource
private LineInfoDAO lineInfoDAO;
@Resource
private OperationLogService operationLogService;
@Resource
private ShopAuditInfoDAO shopAuditInfoDAO;
@Override
@Transactional(rollbackFor = Exception.class)
public Integer updateByShopId(OrderSysInfoRequest request, String userId) {
public Integer updateByShopId(OrderSysInfoRequest request, LoginUserInfo user) {
//当前登录用户
String curUserId = user.getUserId();
String curName = user.getName();
//参数校验
if (!request.check()){
if (!request.check()) {
throw new ServiceException(ErrorCodeEnum.THE_DATA_IS_NOT_FILLED);
}
OrderSysInfoDO orderSysInfoDO = orderSysInfoDAO.selectByShopId(request.getShopId());
if (Objects.isNull(orderSysInfoDO)){
if (Objects.isNull(orderSysInfoDO)) {
orderSysInfoDO = new OrderSysInfoDO();
}
ShopStageInfoDO shopSubStageInfo = shopStageInfoDAO.getShopSubStageInfo(request.getShopId(), ShopSubStageEnum.SHOP_STAGE_15);
@@ -74,56 +90,167 @@ public class OrderSysInfoServiceImpl implements OrderSysInfoService {
orderSysInfoDO.setWarehouseDeliveryDate(request.getWarehouseDeliveryDate());
if (shopSubStageInfo.getShopSubStageStatus().equals(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_151.getShopSubStageStatus())) {
orderSysInfoDO.setOrderCreateTime(new Date());
orderSysInfoDO.setOrderCreateUser(userId);
shopStageInfoDAO.updateShopStageInfo(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_152);
orderSysInfoDO.setOrderCreateUser(curUserId);
shopStageInfoDAO.updateShopStageInfo(request.getShopId(), SHOP_SUB_STAGE_STATUS_152);
ShopInfoDO shopInfoDO = shopInfoDAO.getShopInfo(request.getShopId());
LineInfoDO lineInfoDO = lineInfoDAO.getLineInfo(shopInfoDO.getLineId());
HashMap<String, String> map = new HashMap<>();
map.put("partnerUsername",lineInfoDO.getUsername());
map.put("partnerMobile",lineInfoDO.getMobile());
map.put("storeName",shopInfoDO.getShopName());
map.put("partnerUsername", lineInfoDO.getUsername());
map.put("partnerMobile", lineInfoDO.getMobile());
map.put("storeName", shopInfoDO.getShopName());
List<EnterpriseUserDO> itList = userAuthMappingService.getAllUserByRoleEnumAndRegionId(UserRoleEnum.FINANCE, shopInfoDO.getRegionId());
List<String> itUsers = new ArrayList<>();
if (Objects.nonNull(itList)){
if (Objects.nonNull(itList)) {
itUsers.addAll(itList.stream().map(EnterpriseUserDO::getUserId).collect(Collectors.toList()));
}
commonService.sendQWMessage(itUsers,
MessageEnum.MESSAGE_53,
map);
return orderSysInfoDAO.updateByShopId(orderSysInfoDO);
}else{
} else {
orderSysInfoDO.setOrderUpdateTime(new Date());
orderSysInfoDO.setOrderUpdateUser(userId);
orderSysInfoDO.setOrderUpdateUser(curUserId);
return orderSysInfoDAO.updateByShopId(orderSysInfoDO);
}
}
if (request.getType().equals(OrderSysTypeEnum.ORDER_SYS_TYPE_2.getType())) {
shopInfoDAO.updateShopCode(request.getShopCode(),request.getShopId());
shopInfoDAO.updateShopCode(request.getShopCode(), request.getShopId());
orderSysInfoDO.setReceivingFirmName(request.getReceivingFirmName());
orderSysInfoDO.setReceivingMsBankAccount(request.getReceivingMsBankAccount());
orderSysInfoDO.setReceivingMsBankBranch(request.getReceivingMsBankBranch());
orderSysInfoDO.setBankUnionPayAccount(request.getBankUnionPayAccount());
if (shopSubStageInfo.getShopSubStageStatus().equals(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_152.getShopSubStageStatus())) {
if (shopSubStageInfo.getShopSubStageStatus().equals(SHOP_SUB_STAGE_STATUS_152.getShopSubStageStatus())) {
if (orderSysInfoDO.getReceivingCreateTime() == null) {
orderSysInfoDO.setReceivingCreateTime(new Date());
orderSysInfoDO.setReceivingCreateUser(userId);
orderSysInfoDO.setReceivingCreateUser(curUserId);
} else {
orderSysInfoDO.setReceivingUpdateTime(new Date());
orderSysInfoDO.setReceivingUpdateUser(curUserId);
}
shopStageInfoDAO.updateShopStageInfo(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_153);
//初始化数据
preparationService.licenseCompleted(request.getShopId());
preparationService.sysStoreCompleted(request.getShopId());
preparationService.buildStoreAndDecorationComplete(request.getShopId());
preparationService.selectSiteAndBuildStoreComplete(request.getShopId());
preparationService.buildStoreComplete(request.getShopId());
//审批流
operationLogService.addOperationLog(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_152, curUserId, curName,
OperationTypeEnum.OPERATION_TYPE_0, "建店资料财务提交审批", OperationStatusEnum.PROCESSED);
List<EnterpriseUserDO>directorList = new ArrayList<>();
List<EnterpriseUserDO> headUser = userAuthMappingService.getAllUserByRoleEnumAndRegionId(UserRoleEnum.HEAD_OF_DIVISION, shopInfoDAO.getShopInfo(request.getShopId()).getRegionId());
if (CollectionUtils.isNotEmpty(headUser)){
directorList.addAll(headUser);
}
List<EnterpriseUserDO> manager = userAuthMappingService.getAllUserByRoleEnumAndRegionId(UserRoleEnum.REGIONAL_MANAGER, shopInfoDAO.getShopInfo(request.getShopId()).getRegionId());
if (CollectionUtils.isNotEmpty(manager)){
directorList.addAll(manager);
}
operationLogService.addOperationLog(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_153,
curUserId, directorList,
OperationTypeEnum.OPERATION_TYPE_1, "建店资料分管总监审批", OperationStatusEnum.NOT_PROCESSED);
List<String> userIds = directorList.stream().map(EnterpriseUserDO::getUserId).collect(Collectors.toList());
sendSms(request.getShopId(),userIds);
return orderSysInfoDAO.updateByShopId(orderSysInfoDO);
} else {
orderSysInfoDO.setReceivingUpdateTime(new Date());
orderSysInfoDO.setReceivingUpdateUser(curUserId);
return orderSysInfoDAO.updateByShopId(orderSysInfoDO);
}
}
return null;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Integer audit(AuditRequest request, LoginUserInfo user) {
String curUserId = user.getUserId();
request.setOperateUserId(user.getUserId());
request.setOperateUserName(user.getName());
ShopStageInfoDO shopSubStageInfo = shopStageInfoDAO.getShopSubStageInfo(request.getShopId(), ShopSubStageEnum.SHOP_STAGE_15);
if (!shopSubStageInfo.getShopSubStageStatus().equals(request.getShopSubStageStatus()) || shopSubStageInfo.getShopSubStageStatus().equals(SHOP_SUB_STAGE_STATUS_156.getShopSubStageStatus())) {
throw new ServiceException(ErrorCodeEnum.WORK_FLOW_STAGE_PASS_ERROR);
}
ShopSubStageStatusEnum nowStatus = ShopSubStageStatusEnum.getShopSubStageStatusEnum(request.getShopSubStageStatus());
if (nowStatus == null) {
throw new ServiceException(ErrorCodeEnum.SHOP_STAGE_ERROR);
}
FranchiseFeeDO franchiseFeeDO = franchiseFeeMapper.selectByShopId(request.getShopId());
ShopAuditInfoDO shopAuditInfoDO = AuditRequest.convert(request, AuditTypeEnum.BUILDINFORMATION);
Long auditId = shopAuditInfoDAO.addAuditInfo(shopAuditInfoDO);
//更新操作记录
List<OperationLogDO> operationLogs = operationLogDAO.getBySubStageStatusEnumAndsStatus(request.getShopId(), nowStatus, OperationTypeEnum.OPERATION_TYPE_1.getCode());
operationLogService.batchUpdateProcessed(operationLogs, auditId, request.getOperateUserId(), request.getReason());
//下一阶段
ShopSubStageStatusEnum nextStatus;
switch (nowStatus) {
case SHOP_SUB_STAGE_STATUS_153:
nextStatus = SHOP_SUB_STAGE_STATUS_154;
List<EnterpriseUserDO> users = userAuthMappingService.getAllUserByRoleEnumAndRegionId(VICE_PRESIDENT_IN_CHARGE, shopInfoDAO.getShopInfo(request.getShopId()).getRegionId());
List<String> userIds = users.stream().map(EnterpriseUserDO::getUserId).collect(Collectors.toList());
sendSms(request.getShopId(),userIds);
operationLogService.addOperationLog(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_154,
curUserId,users,
OperationTypeEnum.OPERATION_TYPE_1, "建店资料分管副总裁审批", OperationStatusEnum.NOT_PROCESSED);
break;
case SHOP_SUB_STAGE_STATUS_154:
nextStatus = ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_155;
if (StringUtils.isNotBlank(franchiseFeeDO.getDiscountReason())){
List<EnterpriseUserDO> users1 = userAuthMappingService.getAllUserByRoleEnumAndRegionId(PRESIDENT, shopInfoDAO.getShopInfo(request.getShopId()).getRegionId());
List<String> userIds1 = users1.stream().map(EnterpriseUserDO::getUserId).collect(Collectors.toList());
sendSms(request.getShopId(),userIds1);
operationLogService.addOperationLog(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_155,
curUserId, users1,
OperationTypeEnum.OPERATION_TYPE_1, "建店资料总裁审批", OperationStatusEnum.NOT_PROCESSED);}
break;
case SHOP_SUB_STAGE_STATUS_155:
nextStatus = SHOP_SUB_STAGE_STATUS_156;
break;
default:
return null;
}
//
if (AuditResultTypeEnum.REJECT.getCode().equals(request.getResultType())) {
//回退
return shopStageInfoDAO.updateShopStageInfo(request.getShopId(), SHOP_SUB_STAGE_STATUS_152);
}
if (AuditResultTypeEnum.PASS.getCode().equals(request.getResultType())) {
//如果加盟费没有优惠阶段直接完成不用总裁审批
if (StringUtils.isNull(franchiseFeeDO.getDiscountReason()) && SHOP_SUB_STAGE_STATUS_154.equals(nowStatus)) {
stageCompletion(request.getShopId());
return shopStageInfoDAO.updateShopStageInfo(request.getShopId(), SHOP_SUB_STAGE_STATUS_156);
ShopInfoDO shopInfoDO = shopInfoDAO.getShopInfo(request.getShopId());
} else {
if (SHOP_SUB_STAGE_STATUS_156.equals(nextStatus)){
stageCompletion(request.getShopId());
}
return shopStageInfoDAO.updateShopStageInfo(request.getShopId(), nextStatus);
}
}
return 0;
}
void sendSms(Long shopId,List<String> userIds){
ShopInfoDO shopInfoDO = shopInfoDAO.getShopInfo(shopId);
LineInfoDO lineInfoDO = lineInfoDAO.getLineInfo(shopInfoDO.getLineId());
HashMap<String, String> map = new HashMap<>();
map.put("partnerUsername",lineInfoDO.getUsername());
map.put("partnerMobile",lineInfoDO.getMobile());
map.put("storeName",shopInfoDO.getShopName());
map.put("partnerUsername", lineInfoDO.getUsername());
map.put("partnerMobile", lineInfoDO.getMobile());
map.put("storeName", shopInfoDO.getShopName());
commonService.sendQWMessage(userIds,
MessageEnum.MESSAGE_54,
map);
}
void stageCompletion(Long shopId){
//初始化数据
preparationService.licenseCompleted(shopId);
preparationService.sysStoreCompleted(shopId);
preparationService.buildStoreAndDecorationComplete(shopId);
preparationService.selectSiteAndBuildStoreComplete(shopId);
preparationService.buildStoreComplete(shopId);
ShopInfoDO shopInfoDO = shopInfoDAO.getShopInfo(shopId);
LineInfoDO lineInfoDO = lineInfoDAO.getLineInfo(shopInfoDO.getLineId());
HashMap<String, String> map = new HashMap<>();
map.put("partnerUsername", lineInfoDO.getUsername());
map.put("partnerMobile", lineInfoDO.getMobile());
map.put("storeName", shopInfoDO.getShopName());
List<EnterpriseUserDO> itList = userAuthMappingService.getAllUserByRoleEnumAndRegionId(UserRoleEnum.IT_EMPLOYEE, shopInfoDO.getRegionId());
List<String> itUsers = new ArrayList<>();
if (Objects.nonNull(itList)){
if (Objects.nonNull(itList)) {
itUsers.addAll(itList.stream().map(EnterpriseUserDO::getUserId).collect(Collectors.toList()));
}
commonService.sendQWMessage(itUsers,
@@ -131,15 +258,15 @@ public class OrderSysInfoServiceImpl implements OrderSysInfoService {
map);
List<EnterpriseUserDO> posList = userAuthMappingService.getAllUserByRoleEnumAndRegionId(UserRoleEnum.HUO_MA_EMPLOYEE, shopInfoDO.getRegionId());
List<String> posUsers = new ArrayList<>();
if (Objects.nonNull(posList)){
posUsers.addAll( posList.stream().map(EnterpriseUserDO::getUserId).collect(Collectors.toList()));
if (Objects.nonNull(posList)) {
posUsers.addAll(posList.stream().map(EnterpriseUserDO::getUserId).collect(Collectors.toList()));
}
commonService.sendQWMessage(posUsers,
MessageEnum.MESSAGE_38,
map);
List<EnterpriseUserDO> xfList = userAuthMappingService.getAllUserByRoleEnumAndRegionId(UserRoleEnum.XIN_FA_SYS_CUSTOMER, shopInfoDO.getRegionId());
List<String> xfUsers = new ArrayList<>();
if(Objects.nonNull(xfList)){
if (Objects.nonNull(xfList)) {
xfUsers.addAll(xfList.stream().map(EnterpriseUserDO::getUserId).collect(Collectors.toList()));
}
commonService.sendQWMessage(xfUsers,
@@ -147,19 +274,11 @@ public class OrderSysInfoServiceImpl implements OrderSysInfoService {
map);
List<EnterpriseUserDO> zxtList = userAuthMappingService.getAllUserByRoleEnumAndRegionId(UserRoleEnum.TENT_PASS_CUSTOMER, shopInfoDO.getRegionId());
List<String> zxtUsers = new ArrayList<>();
if(Objects.nonNull(zxtList)){
if (Objects.nonNull(zxtList)) {
zxtUsers.addAll(zxtList.stream().map(EnterpriseUserDO::getUserId).collect(Collectors.toList()));
}
commonService.sendQWMessage(zxtUsers,
MessageEnum.MESSAGE_41,
map);
return orderSysInfoDAO.updateByShopId(orderSysInfoDO);
}else{
orderSysInfoDO.setReceivingUpdateTime(new Date());
orderSysInfoDO.setReceivingUpdateUser(userId);
return orderSysInfoDAO.updateByShopId(orderSysInfoDO);
}
}
return null;
}
}

View File

@@ -503,6 +503,7 @@ public class ShopServiceImpl implements ShopService {
Map<Long, ShopStageInfoDO> openActivityStageMap = openActivityActualCompletionTime.stream().collect(Collectors.toMap(ShopStageInfoDO::getShopId, x -> x));
for (PreparationDTO dto : preparations) {
BranchShopResponse response = new BranchShopResponse();
response.setShopAddress(dto.getShopAddress());
response.setShopId(dto.getId());
response.setLineId(dto.getLineId());
response.setUsername(dto.getUsername());

View File

@@ -3,8 +3,13 @@ package com.cool.store.controller.webb;
import com.cool.store.context.CurrentUserHolder;
import com.cool.store.dto.XgjOrganizationDTO;
import com.cool.store.enums.OrderSysTypeEnum;
import com.cool.store.enums.point.ShopSubStageEnum;
import com.cool.store.enums.point.ShopSubStageStatusEnum;
import com.cool.store.request.AuditRequest;
import com.cool.store.request.OrderSysInfoRequest;
import com.cool.store.response.AuditInfoResponse;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.OperationLogService;
import com.cool.store.service.OrderSysInfoService;
import com.cool.store.service.PushService;
import io.swagger.annotations.Api;
@@ -13,6 +18,8 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
@@ -30,19 +37,21 @@ public class PCOrderSysInfoController {
private OrderSysInfoService orderSysInfoService;
@Resource
private PushService pushService;
@Resource
private OperationLogService operationLogService;
@PostMapping("/submitOrderInfo")
@ApiOperation("物流提交订货信息")
public ResponseResult<Integer> submitOrderInfo(@RequestBody @Validated OrderSysInfoRequest request){
request.setType(OrderSysTypeEnum.ORDER_SYS_TYPE_1.getType());
return ResponseResult.success(orderSysInfoService.updateByShopId(request, CurrentUserHolder.getUserId()));
return ResponseResult.success(orderSysInfoService.updateByShopId(request, CurrentUserHolder.getUser()));
}
@PostMapping("/submitReceiving")
@ApiOperation("财务提交总部订货收款账户")
public ResponseResult<Integer> submitReceiving(@RequestBody @Validated OrderSysInfoRequest request){
request.setType(OrderSysTypeEnum.ORDER_SYS_TYPE_2.getType());
return ResponseResult.success(orderSysInfoService.updateByShopId(request, CurrentUserHolder.getUserId()));
return ResponseResult.success(orderSysInfoService.updateByShopId(request, CurrentUserHolder.getUser()));
}
@GetMapping("/getXgjOrganization")
@@ -51,4 +60,16 @@ public class PCOrderSysInfoController {
return ResponseResult.success(pushService.getXgjOrganization(parentId));
}
@PostMapping("/audit")
@ApiOperation("审核")
public ResponseResult<Integer> audit(@RequestBody @Validated AuditRequest request){
return ResponseResult.success(orderSysInfoService.audit(request, CurrentUserHolder.getUser()));
}
@GetMapping("/auditInfo")
@ApiOperation("获取审批流")
public ResponseResult<List<AuditInfoResponse>> auditInfo(@RequestParam("shopId") Long shopId){
return ResponseResult.success(operationLogService.getAuditInfo(shopId, Collections.singletonList(ShopSubStageEnum.SHOP_STAGE_15.getShopSubStage())));
}
}