Merge branch 'refs/heads/master' into cc_20250529_franchise_fee
This commit is contained in:
@@ -32,4 +32,8 @@ public interface DataHandlerServer {
|
||||
Boolean dataHandlerV20241012(List<Map<String, Object>> dataMapList, String originalFilename, LoginUserInfo user,
|
||||
ImportTaskDO task);
|
||||
Integer JingDongStageHandler();
|
||||
|
||||
//处理测量 设计 施工 验收 完成
|
||||
Boolean dataHandlerV2025029(List<Map<String, Object>> dataMapList, String originalFilename, LoginUserInfo user,
|
||||
ImportTaskDO task);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.cool.store.service;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2025/5/29 16:34
|
||||
* @Version 1.0
|
||||
*/
|
||||
public interface EnterpriseService {
|
||||
|
||||
|
||||
/**
|
||||
* 通过手机号获取登录token
|
||||
* @param mobile
|
||||
* @return
|
||||
*/
|
||||
String getAccessToken(String mobile);
|
||||
|
||||
|
||||
}
|
||||
@@ -954,6 +954,95 @@ public class DataHandlerServerImpl implements DataHandlerServer {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean dataHandlerV2025029(List<Map<String, Object>> dataMapList, String originalFilename, LoginUserInfo user, ImportTaskDO task) {
|
||||
|
||||
List<ImportOaOldShopDataDTO> list = new ArrayList<>();
|
||||
List<ImportOaOldShopDataErrorDTO> errorList = new ArrayList<>();
|
||||
ListUtils.emptyIfNull(dataMapList)
|
||||
.forEach(data -> {
|
||||
try {
|
||||
ImportOaOldShopDataDTO importOaOldShopDataDTO = new ImportOaOldShopDataDTO();
|
||||
importOaOldShopDataDTO.setShopCode(String.valueOf(data.get("门店编码")));
|
||||
list.add(importOaOldShopDataDTO);
|
||||
} catch (Exception e) {
|
||||
log.info("dataHandlerV2025029 转化dto error:{}", JSONObject.toJSONString(data));
|
||||
}
|
||||
});
|
||||
log.info("导入数据条数:{}", list.size());
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
log.info("导入数据转化为空");
|
||||
return false;
|
||||
}
|
||||
List<String> shopCodeList = list.stream().map(ImportOaOldShopDataDTO::getShopCode).collect(Collectors.toList());
|
||||
List<ShopInfoDO> shopInfoList = shopInfoDAO.selectByShopCodeList(shopCodeList);
|
||||
if (CollectionUtils.isEmpty(shopInfoList)) {
|
||||
log.info("导入数据根据shopCode 未找到数据");
|
||||
}
|
||||
List<Long> shopIds = shopInfoList.stream().map(ShopInfoDO::getId).collect(Collectors.toList());
|
||||
Map<String, List<ShopInfoDO>> shopMapByCode = shopInfoList.stream().collect(Collectors.groupingBy(ShopInfoDO::getShopCode));
|
||||
//装修验收数据
|
||||
List<AcceptanceInfoDO> acceptanceInfoDOList = acceptanceInfoDAO.selectByShopIds(shopIds);
|
||||
Map<Long, AcceptanceInfoDO> acceptanceInfoMap = acceptanceInfoDOList.stream().collect(Collectors.toMap(AcceptanceInfoDO::getShopId, item -> item));
|
||||
//合同阶段
|
||||
List<ShopStageInfoDO> signFranchiseStageList = shopStageInfoDAO.getSubStageList(shopIds, ShopSubStageEnum.SHOP_STAGE_8.getShopSubStage());
|
||||
Map<Long, ShopStageInfoDO> signFranchiseStageMap = signFranchiseStageList.stream().collect(Collectors.toMap(ShopStageInfoDO::getShopId, Function.identity()));
|
||||
//装修阶段需要变更的shopId
|
||||
List<Long> fitmentFhopIdList = new ArrayList<>();
|
||||
//装修验收表需要初始化的门店
|
||||
List<Long> initFitmentShopIdList = new ArrayList<>();
|
||||
for (ImportOaOldShopDataDTO dto : list) {
|
||||
String shopCode = dto.getShopCode();
|
||||
List<ShopInfoDO> shopInfoDOS = shopMapByCode.get(shopCode);
|
||||
if (CollectionUtils.isEmpty(shopInfoDOS)){
|
||||
errorList.add(new ImportOaOldShopDataErrorDTO(dto.getShopCode(), "门店编码未找到"));
|
||||
continue;
|
||||
}
|
||||
if (shopInfoDOS.size() > 1){
|
||||
errorList.add(new ImportOaOldShopDataErrorDTO(dto.getShopCode(), "门店编码重复"));
|
||||
continue;
|
||||
}
|
||||
ShopInfoDO shopInfoDO = shopInfoDOS.get(0);
|
||||
Long shopId = shopInfoDO.getId();
|
||||
ShopStageInfoDO signFranchiseStage = signFranchiseStageMap.get(shopId);
|
||||
if (!signFranchiseStage.getShopSubStageStatus().equals(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_84.getShopSubStageStatus())){
|
||||
errorList.add(new ImportOaOldShopDataErrorDTO(dto.getShopCode(), "合同阶段未完成"));
|
||||
continue;
|
||||
}
|
||||
AcceptanceInfoDO acceptanceInfoDO = acceptanceInfoMap.get(shopId);
|
||||
if (Objects.isNull(acceptanceInfoDO)){
|
||||
initFitmentShopIdList.add(shopId);
|
||||
}
|
||||
fitmentFhopIdList.add(shopId);
|
||||
}
|
||||
//装修stage
|
||||
shopStageInfoDAO.dataUpdateStatus(fitmentFhopIdList, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_863);
|
||||
shopStageInfoDAO.dataUpdateStatus(fitmentFhopIdList, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_91);
|
||||
shopStageInfoDAO.dataUpdateStatus(fitmentFhopIdList, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_112);
|
||||
shopStageInfoDAO.dataUpdateStatus(fitmentFhopIdList, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_123);
|
||||
//装修表初始化
|
||||
acceptanceInfoDAO.initAcceptanceInfo(initFitmentShopIdList);
|
||||
if (!errorList.isEmpty()) {
|
||||
task.setStatus(ImportTaskStatusEnum.ERROR.getCode());
|
||||
String url = null;
|
||||
try {
|
||||
url = easyExcelUtil.exportExcel(ImportOaOldShopDataErrorDTO.class, errorList, null,
|
||||
FileTypeEnum.IMPORT_FITMENT_SHOP_STAGE_DATA_ERROR_LIST.getDesc() + DateUtils.parseDateToStr(SPECIAL_DATE_START_1, new Date()),
|
||||
FileTypeEnum.IMPORT_FITMENT_SHOP_STAGE_DATA_ERROR_LIST.getDesc() + DateUtils.parseDateToStr(SPECIAL_DATE_START_1, new Date()));
|
||||
} catch (Exception e) {
|
||||
log.info("导出失败列表失败 errorList:{}", JSONObject.toJSONString(errorList));
|
||||
}
|
||||
task.setFileUrl(url);
|
||||
} else {
|
||||
task.setStatus(ImportTaskStatusEnum.SUCCESS.getCode());
|
||||
}
|
||||
task.setTotalNum(dataMapList.size());
|
||||
task.setSuccessNum(dataMapList.size() - errorList.size());
|
||||
importTaskMapper.update(eid, task);
|
||||
return null;
|
||||
}
|
||||
|
||||
private static @NotNull ShopStageInfoDO getShopStageInfoDO(ShopSubStageEnum shopSubStageEnum, ShopStageInfoDO shopStageInfoDO, ShopSubStageStatusEnum shopSubStageStatus) {
|
||||
ShopStageEnum shopStageEnum = shopSubStageEnum.getShopStageEnum();
|
||||
ShopStageInfoDO shopStageInfo = new ShopStageInfoDO();
|
||||
|
||||
@@ -698,6 +698,7 @@ public class DeskServiceImpl implements DeskService {
|
||||
SignFranchiseDO signFranchiseDO = signTypeMap.get(x.getShopId());
|
||||
if (signFranchiseDO != null) {
|
||||
preparationCommonPendingVO.setSignType(signFranchiseDO.getSignType());
|
||||
preparationCommonPendingVO.setPartnershipSignatorySecond(signFranchiseDO.getPartnershipSignatorySecond());
|
||||
}
|
||||
preparationCommonPendingVO.setShopCode(shopInfoDO.getShopCode());
|
||||
preparationCommonPendingVO.setJoinMode(shopInfoDO.getJoinMode());
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
package com.cool.store.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.cool.store.constants.RedisConstant;
|
||||
import com.cool.store.dao.EnterpriseUserDAO;
|
||||
import com.cool.store.entity.EnterpriseUserDO;
|
||||
import com.cool.store.entity.SysRoleDO;
|
||||
import com.cool.store.enums.ErrorCodeEnum;
|
||||
import com.cool.store.enums.Role;
|
||||
import com.cool.store.enums.UserStatusEnum;
|
||||
import com.cool.store.exception.ServiceException;
|
||||
import com.cool.store.mapper.SysRoleMapper;
|
||||
import com.cool.store.service.EnterpriseService;
|
||||
import com.cool.store.userholder.CurrentUser;
|
||||
import com.cool.store.utils.RedisUtilPool;
|
||||
import com.cool.store.utils.poi.DateUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.crypto.RandomNumberGenerator;
|
||||
import org.apache.shiro.crypto.SecureRandomNumberGenerator;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.text.ParseException;
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2025/5/29 16:34
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class EnterpriseServiceImpl implements EnterpriseService {
|
||||
|
||||
@Resource
|
||||
EnterpriseUserDAO enterpriseUserDAO;
|
||||
|
||||
@Resource
|
||||
SysRoleMapper sysRoleMapper;
|
||||
|
||||
@Resource
|
||||
RedisUtilPool redisUtilPool;
|
||||
|
||||
@Value("${mybatis.configuration.variables.enterpriseId}")
|
||||
private String eid;
|
||||
|
||||
@Override
|
||||
public String getAccessToken(String mobile) {
|
||||
CurrentUser currentUser = new CurrentUser();
|
||||
EnterpriseUserDO enterpriseUser = enterpriseUserDAO.selectByMobile(mobile);
|
||||
if (Objects.isNull(enterpriseUser)){
|
||||
throw new ServiceException(ErrorCodeEnum.MOBILE_NOT_EXIST);
|
||||
}
|
||||
if(UserStatusEnum.WAIT_AUDIT.getCode().equals(enterpriseUser.getUserStatus())){
|
||||
throw new ServiceException(ErrorCodeEnum.USER_ACCOUNT_WAIT_AUDIT);
|
||||
}
|
||||
//账号冻结
|
||||
if(UserStatusEnum.FREEZE.getCode().equals(enterpriseUser.getUserStatus())){
|
||||
throw new ServiceException(ErrorCodeEnum.USER_FREEZE);
|
||||
}
|
||||
SysRoleDO sysRoleDoByUserId = sysRoleMapper.getHighestPrioritySysRoleDoByUserId(enterpriseUser.getUserId());
|
||||
if(sysRoleDoByUserId==null){
|
||||
// 如果没有最高优先级的,给未分配的角色
|
||||
sysRoleDoByUserId = sysRoleMapper.getRoleByRoleEnum(Role.EMPLOYEE.getRoleEnum());
|
||||
}
|
||||
currentUser.setId(enterpriseUser.getId());
|
||||
currentUser.setUserId(enterpriseUser.getUserId());
|
||||
currentUser.setAccount(enterpriseUser.getUserId());
|
||||
currentUser.setDbName("coolcollege_intelligent_10027");
|
||||
currentUser.setDepartmentIds(enterpriseUser.getDepartments());
|
||||
currentUser.setRoles(enterpriseUser.getRoles());
|
||||
currentUser.setLanguage(enterpriseUser.getLanguage());
|
||||
currentUser.setIsAdmin(enterpriseUser.getIsAdmin());
|
||||
|
||||
//设置当前登录人使用的企业相关信息
|
||||
currentUser.setRoleAuth(sysRoleDoByUserId.getRoleAuth());
|
||||
currentUser.setSysRoleDO(sysRoleDoByUserId);
|
||||
currentUser.setEnterpriseId(eid);
|
||||
currentUser.setEnterpriseName("正新集团");
|
||||
currentUser.setEnterpriseLogo("https://oss-store.coolcollege.cn/eid/214ac5a3a517472a87268e02a2e6410a/2405/79049713395952825.jpg");
|
||||
currentUser.setActive(enterpriseUser.getActive());
|
||||
// 企业开通时间
|
||||
try {
|
||||
currentUser.setOpenTime(DateUtils.parseDate("2024-05-09 18:54:28",DateUtils.YYYY_MM_DD_HH_MM_SS));
|
||||
} catch (ParseException e) {
|
||||
log.error("时间转换异常");
|
||||
}
|
||||
currentUser.setAvatar(enterpriseUser.getAvatar());
|
||||
currentUser.setEmail(enterpriseUser.getEmail());
|
||||
// 水印增加员工工号
|
||||
if (StringUtils.isNotEmpty(enterpriseUser.getJobnumber())) {
|
||||
currentUser.setJobnumber(enterpriseUser.getJobnumber());
|
||||
}
|
||||
// 水印增加员工职位
|
||||
if (StringUtils.isNotEmpty(enterpriseUser.getPosition())) {
|
||||
currentUser.setPosition(enterpriseUser.getPosition());
|
||||
}
|
||||
currentUser.setMobile(enterpriseUser.getMobile());
|
||||
currentUser.setName(enterpriseUser.getName());
|
||||
|
||||
currentUser.setDingCorpId("wpayJeDAAAklx_q1jGhyGUd4yEh8vV_g");
|
||||
|
||||
currentUser.setAccessToken(getToken());
|
||||
currentUser.setAppType("qw_self_dkf");
|
||||
currentUser.setUnionid(enterpriseUser.getUnionid());
|
||||
currentUser.setUserType(enterpriseUser.getUserType());
|
||||
redisUtilPool.setString(RedisConstant.ACCESS_TOKEN_PREFIX + currentUser.getAccessToken(), JSON.toJSONString(currentUser), 24 * 60 * 60);
|
||||
return currentUser.getAccessToken();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
System.out.println(DateUtils.parseDate("2024-05-09 18:54:28",DateUtils.YYYY_MM_DD_HH_MM_SS));
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public String getToken() {
|
||||
RandomNumberGenerator randomNumberGenerator = new SecureRandomNumberGenerator();
|
||||
return randomNumberGenerator.nextBytes().toHex();
|
||||
}
|
||||
}
|
||||
@@ -4,22 +4,28 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.cool.store.context.LoginUserInfo;
|
||||
import com.cool.store.dao.LineAuditInfoDAO;
|
||||
import com.cool.store.dao.LineInfoDAO;
|
||||
import com.cool.store.dao.ShopInfoDAO;
|
||||
import com.cool.store.entity.LineAuditInfoDO;
|
||||
import com.cool.store.entity.LineInfoDO;
|
||||
import com.cool.store.entity.ShopInfoDO;
|
||||
import com.cool.store.enums.AuditResultTypeEnum;
|
||||
import com.cool.store.enums.ErrorCodeEnum;
|
||||
import com.cool.store.enums.LineStatusEnum;
|
||||
import com.cool.store.enums.WorkflowSubStageEnum;
|
||||
import com.cool.store.enums.point.ShopStatusEnum;
|
||||
import com.cool.store.exception.ServiceException;
|
||||
import com.cool.store.request.AuditCloseRequest;
|
||||
import com.cool.store.request.AuditPassRequest;
|
||||
import com.cool.store.request.AuditRejectRequest;
|
||||
import com.cool.store.request.LineFollowLogRequest;
|
||||
import com.cool.store.service.LineFollowService;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhangchenbiao
|
||||
@@ -36,6 +42,8 @@ public abstract class LineFlowService {
|
||||
private LineInfoDAO lineInfoDAO;
|
||||
@Resource
|
||||
private LineFollowService lineFollowService;
|
||||
@Resource
|
||||
private ShopInfoDAO shopInfoDAO;
|
||||
|
||||
/**
|
||||
* 审核通过
|
||||
@@ -89,6 +97,11 @@ public abstract class LineFlowService {
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean auditClose(AuditCloseRequest request, LoginUserInfo user){
|
||||
List<ShopInfoDO> shopInfoDOS = shopInfoDAO.selectByShopStatus(request.getLineId(), Arrays.asList(ShopStatusEnum.DONE.getCode(), ShopStatusEnum.ING.getCode()));
|
||||
if (CollectionUtils.isNotEmpty(shopInfoDOS)){
|
||||
throw new ServiceException(ErrorCodeEnum.SHOP_HAVE_NOT_OVER_ACCORDING);
|
||||
}
|
||||
|
||||
LineInfoDO lineInfo = lineInfoDAO.getLineInfo(request.getLineId());
|
||||
String partnerId = lineInfo.getPartnerId();
|
||||
LineAuditInfoDO auditInfo = new LineAuditInfoDO();
|
||||
|
||||
@@ -883,7 +883,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.setRegionId(pointInfo.getRegionId());
|
||||
shopInfoDAO.updateShopInfo(updateShop);
|
||||
@@ -971,7 +971,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();
|
||||
|
||||
@@ -279,6 +279,10 @@ public class SyncDataServiceImpl implements SyncDataService {
|
||||
return null;
|
||||
}
|
||||
String shopCode = shopInfoDO.getShopCode().trim();
|
||||
if (Objects.isNull(signFranchiseDO)){
|
||||
log.info("合同阶段暂未完成");
|
||||
return "";
|
||||
}
|
||||
Boolean partnershipSignatorySecondIsNull = StringUtils.isBlank(signFranchiseDO.getPartnershipSignatorySecond());
|
||||
if (String.valueOf(FranchiseBrandEnum.ZXJP.getCode()).equals(shopInfoDO.getFranchiseBrand())) {
|
||||
//M10001
|
||||
|
||||
Reference in New Issue
Block a user