开业筹备阶段4.0

This commit is contained in:
shuo.wang
2024-04-26 14:14:44 +08:00
parent 46c3f61aa6
commit a5ca7a3a63
13 changed files with 179 additions and 185 deletions

View File

@@ -3,6 +3,8 @@ package com.cool.store.dao;
import com.cool.store.dto.openPreparation.OpeningOperationPlanDTO;
import com.cool.store.entity.OpeningOperationPlanDO;
import com.cool.store.mapper.OpeningOperationPlanMapper;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
@@ -43,7 +45,9 @@ public class OpeningOperationPlanDAO {
return openingOperationPlanMapper.selectByShopId(shopId);
}
public List<OpeningOperationPlanDTO> selectConditionPlanList(Date StartDate,Date EndDate,Integer resultType){
public Page<OpeningOperationPlanDTO> selectConditionPlanList(Date StartDate, Date EndDate, Integer resultType,
Integer pageNum,Integer pageSize){
PageHelper.startPage(pageNum,pageSize);
return openingOperationPlanMapper.selectPlanList( StartDate,EndDate,resultType);
}

View File

@@ -140,8 +140,8 @@ public class ShopInfoDAO {
* @Date: 2024/4/24
* @description: 开业运营方案根据shopname获取列表
*/
public Page<OpenPlanShopInfoDTO> getOpenPlanShopListByShopName( List<Long> shopIdlist,String shopName, String bigName, String fightName, Integer pageNum, Integer pageSize){
PageHelper.startPage(pageNum, pageSize);
public List<OpenPlanShopInfoDTO>getOpenPlanShopListByShopName( List<Long> shopIdlist,String shopName, String bigName, String fightName){
return shopInfoMapper.getOpenPlanShopListByShopName(shopIdlist,shopName,bigName,fightName);
}

View File

@@ -2,6 +2,7 @@ package com.cool.store.mapper;
import com.cool.store.dto.openPreparation.OpeningOperationPlanDTO;
import com.cool.store.entity.OpeningOperationPlanDO;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;
@@ -12,9 +13,9 @@ public interface OpeningOperationPlanMapper extends Mapper<OpeningOperationPlanD
OpeningOperationPlanDO selectByShopId(@Param("shopId") Long shopId);
List<OpeningOperationPlanDTO> selectPlanList( @Param("startDate") Date startDate,
@Param("endDate") Date endDate,
@Param("resultType") Integer resultType);
Page<OpeningOperationPlanDTO> selectPlanList(@Param("startDate") Date startDate,
@Param("endDate") Date endDate,
@Param("resultType") Integer resultType);
Integer updateByShopId(@Param("shopId") Long shopId, @Param("audit") Long auditId, @Param("resulType") Integer resultType);
}

View File

@@ -68,7 +68,7 @@ public interface ShopInfoMapper extends Mapper<ShopInfoDO> {
* @Date: 2024/4/24
* @description: 开业运营方案根据shopname获取列表
*/
Page<OpenPlanShopInfoDTO> getOpenPlanShopListByShopName(@Param("shopIdlist")List<Long> shopIdlist, @Param("shopName") String shopName,
List<OpenPlanShopInfoDTO> getOpenPlanShopListByShopName(@Param("shopIdlist")List<Long> shopIdlist, @Param("shopName") String shopName,
@Param("bigName") String bigName, @Param("fightName") String fightName);
/**
* @Auther: wangshuo

View File

@@ -48,16 +48,17 @@
op.audit_id as auditId
FROM xfsg_opening_operation_plan op
where
<if test="openingOperationPlanDTO.planStartDate != null">
op.create_time >= #{startDate}
</if>
<if test="openingOperationPlanDTO.planEndDate != null">
<![CDATA[AND op.create_time <= #{endDate}]]>
</if>
<if test="openingOperationPlanDTO.resultType != null">
and op.result_type = #{resultType}
</if>
<if test="openingOperationPlanDTO.planStartDate != null">
op.create_time >= #{startDate}
</if>
<if test="openingOperationPlanDTO.planEndDate != null">
<![CDATA[AND op.create_time <= #{endDate}]]>
</if>
<if test="openingOperationPlanDTO.resultType != null">
and op.result_type = #{resultType}
</if>
</select>
</select>
</mapper>

View File

@@ -1,6 +1,7 @@
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;
@@ -33,7 +34,7 @@ public class OpeningOperationPlanAuditRequest {
shopAuditInfoDO.setShopId(shopId);
shopAuditInfoDO.setAuditType(AuditTypeEnum.OPENING_OPERATION_PLAN.getCode());
shopAuditInfoDO.setResultType(resultType);
if (resultType == 0 )
if (AuditResultTypeEnum.PASS.getCode().equals(resultType) )
shopAuditInfoDO.setPassReason(passReason);
else
shopAuditInfoDO.setRejectReason(rejectReason);

View File

@@ -1,9 +1,11 @@
package com.cool.store.vo;
import com.cool.store.dto.openPreparation.UserNameDTO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* @Auther: WangShuo
@@ -27,7 +29,7 @@ public class OpeningOperationPlanVO {
private String activityThemeUrl;
@ApiModelProperty("筹备人员name")
private String preparationUsers;
private List<UserNameDTO> preparationUsers;
@ApiModelProperty("是否完成排车路线")
private Byte routeCompleted;

View File

@@ -1,5 +1,6 @@
package com.cool.store.service;
import com.cool.store.context.LoginUserInfo;
import com.cool.store.dto.openPreparation.FirstOrderDTO;
import com.cool.store.entity.FirstOrderDO;
import com.cool.store.request.FirstOrderRequest;
@@ -12,7 +13,8 @@ import com.cool.store.request.FirstOrderRequest;
*/
public interface FirstOrderService {
Integer saveOrder(FirstOrderRequest request);
Integer saveOrder(FirstOrderRequest request, LoginUserInfo user);
FirstOrderDTO getOrder(Long shopId);
FirstOrderDTO flush(Long shopId);
}

View File

@@ -1,5 +1,6 @@
package com.cool.store.service;
import com.cool.store.context.LoginUserInfo;
import com.cool.store.request.OpeningOperationPlanRequest;
import com.cool.store.request.PlanListRequest;
import com.cool.store.vo.OpeningOperationPlanListVO;
@@ -20,7 +21,7 @@ public interface OpeningOperationPlanService {
* @Date: 2024/4/23
* @description: 提交开业运营方案
*/
Long savePlan(OpeningOperationPlanRequest openingOperationPlanRequest);
Long savePlan(OpeningOperationPlanRequest openingOperationPlanRequest, LoginUserInfo userInfo);
OpeningOperationPlanVO getPlanByShopId(Long ShopId);
/**
@@ -29,5 +30,5 @@ public interface OpeningOperationPlanService {
* @description: 根据条件查询方案列表
*/
List<OpeningOperationPlanListVO> getPlanListPage(PlanListRequest request);
Boolean flush(Long shopId);
}

View File

@@ -2,12 +2,15 @@ package com.cool.store.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.context.CurrentUserHolder;
import com.cool.store.context.LoginUserInfo;
import com.cool.store.dao.FirstOrderDAO;
import com.cool.store.dao.ShopStageInfoDAO;
import com.cool.store.dto.openPreparation.FirstOrderDTO;
import com.cool.store.entity.FirstOrderDO;
import com.cool.store.entity.ShopInfoDO;
import com.cool.store.entity.ShopStageInfoDO;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.point.ShopSubStageEnum;
import com.cool.store.enums.point.ShopSubStageStatusEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.request.FirstOrderRequest;
@@ -48,8 +51,12 @@ public class FirstOrderServiceImp implements FirstOrderService {
private CoolStoreStartFlowService coolStoreStartFlowService;
@Override
public Integer saveOrder(FirstOrderRequest request) {
String userId = CurrentUserHolder.getUserId();
public Integer saveOrder(FirstOrderRequest request, LoginUserInfo user) {
log.info("save order:{}", JSONObject.toJSONString(request));
if (request == null) {
throw new ServiceException(ErrorCodeEnum.FIRST_ORDER_PARAM_NULL);
}
String userId = user.getUserId();
FirstOrderDO order = new FirstOrderDO();
try {
BeanUtils.copyProperties(order, request);
@@ -58,22 +65,16 @@ public class FirstOrderServiceImp implements FirstOrderService {
} catch (InvocationTargetException e) {
throw new RuntimeException(e);
}
log.info("save order:{}", JSONObject.toJSONString(order));
if (order == null) {
throw new ServiceException(ErrorCodeEnum.FIRST_ORDER_PARAM_NULL);
}
FirstOrderDTO firstOrderDTO = firstOrderDAO.selectFirstOrderByShopId(order.getShopId());
if (firstOrderDTO == null) {
//第一次提交
order.setCreateTime(new Date());
order.setUpdateTime(new Date());
order.setCreateUserId(userId);
order.setUpdateUserId(userId);
} else {
//修改提交
order.setUpdateTime(new Date());
order.setUpdateUserId(userId);
}
//修改只更新下面2个
order.setUpdateTime(new Date());
order.setUpdateUserId(userId);
Integer num = firstOrderDAO.insertFirstOrder(order);
//云立方同步
if (num > 0) {
@@ -105,6 +106,37 @@ public class FirstOrderServiceImp implements FirstOrderService {
log.error("shopId/shopCode is null");
throw new ServiceException(ErrorCodeEnum.FIRST_ORDER_PARAM_NULL);
}
return firstOrderDAO.selectFirstOrderByShopId(shopId);
FirstOrderDTO order = firstOrderDAO.selectFirstOrderByShopId(shopId);
ShopStageInfoDO firstOrderStageInfo = shopStageInfoDAO.
getShopSubStageInfo(shopId, ShopSubStageEnum.SHOP_STAGE_15);
order.setResultType(firstOrderStageInfo.getShopSubStageStatus());
return order;
}
@Override
public FirstOrderDTO flush(Long shopId) {
ShopStageInfoDO orderStageInfo = shopStageInfoDAO.getShopSubStageInfo(shopId, ShopSubStageEnum.SHOP_STAGE_15);
try {
if (!orderStageInfo.getShopSubStageStatus().
equals(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_151.getShopSubStageStatus())) {
ShopInfoDO shopInfo = shopService.getShopInfo(shopId);
String shopCode = shopInfo.getShopCode();
Boolean flag = coolStoreStartFlowService.getFirstOrder(shopCode);
log.info("saveOrder,flag:{}", flag);
if (flag == null) {
throw new ServiceException(ErrorCodeEnum.GET_FIRST_ORDER);
}
if (flag) {
//更改子阶段状态
shopStageInfoDAO.updateShopStageAndAuditInfo(shopId,
ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_151, null);
preparationService.whetherToOpenForAcceptance(shopId);
}
}
} catch (Exception e) {
log.error("获取鲜丰订货金异常", e);
}
FirstOrderDTO order = getOrder(shopId);
return order;
}
}

View File

@@ -3,21 +3,25 @@ package com.cool.store.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.constants.CommonConstants;
import com.cool.store.context.CurrentUserHolder;
import com.cool.store.context.LoginUserInfo;
import com.cool.store.dao.*;
import com.cool.store.dto.openPreparation.OpenPlanShopInfoDTO;
import com.cool.store.dto.openPreparation.OpeningOperationPlanDTO;
import com.cool.store.dto.openPreparation.PlanLineDTO;
import com.cool.store.dto.openPreparation.UserNameDTO;
import com.cool.store.entity.OpeningOperationPlanDO;
import com.cool.store.entity.ShopInfoDO;
import com.cool.store.entity.ShopStageInfoDO;
import com.cool.store.enums.AuditStatusEnum;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.point.ShopSubStageEnum;
import com.cool.store.enums.point.ShopSubStageStatusEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.request.OpeningOperationPlanAuditRequest;
import com.cool.store.request.OpeningOperationPlanRequest;
import com.cool.store.request.PlanListRequest;
import com.cool.store.service.AuditOpeningOperationPlanService;
import com.cool.store.service.OpeningOperationPlanService;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.*;
import com.cool.store.utils.poi.StringUtils;
import com.cool.store.vo.OpeningOperationPlanListVO;
import com.cool.store.vo.OpeningOperationPlanVO;
@@ -54,101 +58,84 @@ public class OpeningOperationPlanImpl implements OpeningOperationPlanService {
private LineInfoDAO lineInfoDAO;
@Resource
private ShopStageInfoDAO shopStageInfoDAO;
@Resource
private ShopService shopService;
@Resource
private CoolStoreStartFlowService coolStoreStartFlowService;
@Resource
private PreparationService preparationService;
@Override
@Transactional(rollbackFor = Exception.class)
public Long savePlan(OpeningOperationPlanRequest request) {
public Long savePlan(OpeningOperationPlanRequest request, LoginUserInfo userInfo) {
log.info("addNewPlan request:{}", JSONObject.toJSONString(request));
if (request.getActivityTheme().length() > CommonConstants.MAX_LENGTH_ONE_HUNDRED){
if (request.getActivityTheme().length() > CommonConstants.MAX_LENGTH_ONE_HUNDRED) {
log.error("addNewPlan ActivityTheme length error");
throw new ServiceException(ErrorCodeEnum.ACTIVITY_THEME_LENGTH_FALSE);
}
if (request.getSurveyResult().length() >CommonConstants.MAX_LENGTH_ONE_HUNDRED){
if (request.getSurveyResult().length() > CommonConstants.MAX_LENGTH_ONE_HUNDRED) {
log.error("addNewPlan SurveyResult length error");
throw new ServiceException(ErrorCodeEnum.SURVEYRESULT_LENGTH_FALSE);
}
String userId = CurrentUserHolder.getUserId();
String userId = userInfo.getUserId();
try {
String userName = enterpriseUserDAO.getUserName(userId);
if (StringUtils.isBlank(userName)){
log.error("addNewPlan userName is null");
throw new ServiceException(ErrorCodeEnum.USER_NOT_EXIST);
}
OpeningOperationPlanAuditRequest openingOperationPlanAuditRequest = new OpeningOperationPlanAuditRequest();
openingOperationPlanAuditRequest.setShopId(request.getShopId());
Long AuditId = auditOpeningOperationPlanService.addNewPlanAudit(openingOperationPlanAuditRequest);
if (Objects.isNull(AuditId) ){
log.error("addNewPlan AuditId is null");
throw new ServiceException(ErrorCodeEnum.INSERT_OPENING_OPERATION_PLAN_AUDIT_FALSE);
}
OpeningOperationPlanDO selectByShopId = openingOperationPlanDAO.selectByShopId(request.getShopId());
Long planId ;
Long planId;
OpeningOperationPlanDO openingOperationPlanDO = request.toOpeningOperationPlanDO();
if (!Objects.isNull(selectByShopId)){
openingOperationPlanDO.setUpdateTime(new Date());
openingOperationPlanDO.setUpdateUserId(userId);
openingOperationPlanDO.setResultType(AuditStatusEnum.TODO.getCode());
if (!Objects.isNull(selectByShopId)) {
//提交修改
openingOperationPlanDO.setId(selectByShopId.getId());
openingOperationPlanDO.setSubmissionTime(new Date());
openingOperationPlanDO.setSubmittedUserId(userId);
openingOperationPlanDO.setUpdateTime(new Date());
openingOperationPlanDO.setUpdateUserId(userId);
openingOperationPlanDO.setResultType(AuditStatusEnum.TODO.getCode());
planId = openingOperationPlanDAO.updateSelective(openingOperationPlanDO);
}
else {
} else {
//新增
openingOperationPlanDO.setSubmissionTime(new Date());
openingOperationPlanDO.setSubmittedUserId(userId);
openingOperationPlanDO.setCreateTime(new Date());
openingOperationPlanDO.setCreateUserId(userId);
openingOperationPlanDO.setUpdateTime(new Date());
openingOperationPlanDO.setUpdateUserId(userId);
openingOperationPlanDO.setAuditId(AuditId);
openingOperationPlanDO.setResultType(AuditStatusEnum.TODO.getCode());
planId = openingOperationPlanDAO.insertSelective(openingOperationPlanDO);
}
if (Objects.isNull(planId)){
log.error("addNewPlan PlanId is null");
throw new ServiceException(ErrorCodeEnum.INSERT_OPENING_OPERATION_PLAN_FALSE);
}
Integer Stage = shopStageInfoDAO.updateShopStageAndAuditInfo(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_141, request.getShopId());
if (Objects.isNull(Stage)){
if (Objects.isNull(Stage) || Stage == CommonConstants.ZERO) {
log.error("auditPlan stage is null");
throw new ServiceException(ErrorCodeEnum.UPDATE_SHOP_SUB_STAGE_STATUS_FALSE);
throw new ServiceException(ErrorCodeEnum.UPDATE_SHOP_SUB_STAGE_STATUS_FALSE);
}
return planId;
}catch (Exception e) {
} catch (Exception e) {
log.error("addNewPlan Exception:{}", e);
e.printStackTrace();
return null;
return null;
}
}
@Override
public OpeningOperationPlanVO getPlanByShopId(Long shopId) {
log.info( "getPlanBy shopId:{}", shopId );
if (Objects.isNull(shopId)){
log.info("getPlanBy shopId:{}", shopId);
if (Objects.isNull(shopId)) {
log.error(" getPlanByShopId shopId is null");
throw new ServiceException(ErrorCodeEnum.SHOP_ID_IS_NULL);
}
OpeningOperationPlanVO openingOperationPlanVO = new OpeningOperationPlanVO();
OpeningOperationPlanDO openingOperationPlanDO = openingOperationPlanDAO.selectByShopId(shopId);
try {
if ((openingOperationPlanDO!=null)){
String preparationUserIds = openingOperationPlanDO.getPreparationUserIds();
List<String> stream = Arrays.stream(preparationUserIds.split(CommonConstants.COMMA)).collect(Collectors.toList());
List<UserNameDTO> nameByUserId = enterpriseUserDAO.getNameByUserId(stream);
List<String> names = nameByUserId.stream()
.map(UserNameDTO::getName)
.collect(Collectors.toList());
String preparationUserName = String.join(CommonConstants.COMMA, names);
BeanUtils.copyProperties(openingOperationPlanDO, openingOperationPlanVO);
openingOperationPlanVO.setPreparationUsers(preparationUserName);
return openingOperationPlanVO;
}
} catch (IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
return null;
}
try {
if (openingOperationPlanDO != null) {
String preparationUserIds = openingOperationPlanDO.getPreparationUserIds();
List<String> stream = Arrays.stream(preparationUserIds.split(CommonConstants.COMMA)).collect(Collectors.toList());
List<UserNameDTO> nameByUserId = enterpriseUserDAO.getNameByUserId(stream);
BeanUtils.copyProperties(openingOperationPlanDO, openingOperationPlanVO);
openingOperationPlanVO.setPreparationUsers(nameByUserId);
return openingOperationPlanVO;
}
} catch (IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
return null;
}
return openingOperationPlanVO;
}
@@ -156,11 +143,12 @@ public class OpeningOperationPlanImpl implements OpeningOperationPlanService {
public List<OpeningOperationPlanListVO> getPlanListPage(PlanListRequest request) {
log.info("getPlanListPage request:{}", JSONObject.toJSONString(request));
//shopId,提交时间,审核状态
List<OpeningOperationPlanDTO> openingOperationPlanDTOS = openingOperationPlanDAO.
selectConditionPlanList(request.getPlanStartDate(),request.getPlanEndDate(),request.getResultType());
log.info("getPlanListPage openingOperationPlanDTOS:{}",JSONObject.toJSONString(openingOperationPlanDTOS) );
//包装VO
List<OpeningOperationPlanListVO> openingOperationPlanListVOList = openingOperationPlanDTOS.stream().map(dto->{
Page<OpeningOperationPlanDTO> openingOperationPlanDTOS = openingOperationPlanDAO.
selectConditionPlanList(request.getPlanStartDate(), request.getPlanEndDate(),
request.getResultType(), request.getPageNum(), request.getPageSize());
log.info("getPlanListPage openingOperationPlanDTOS:{}", JSONObject.toJSONString(openingOperationPlanDTOS));
//包装VO
List<OpeningOperationPlanListVO> openingOperationPlanListVOList = openingOperationPlanDTOS.stream().map(dto -> {
OpeningOperationPlanListVO vO = new OpeningOperationPlanListVO();
vO.setShopId(dto.getShopId());
vO.setSubmissionTime(dto.getSubmissionTime());
@@ -168,46 +156,48 @@ public class OpeningOperationPlanImpl implements OpeningOperationPlanService {
vO.setAuditId(dto.getAuditId());
return vO;
}).collect(Collectors.toList());
log.info("getPlanListPage openingOperationPlanVOList:{}", JSONObject.toJSONString(openingOperationPlanListVOList) );
log.info("getPlanListPage openingOperationPlanVOList:{}",
JSONObject.toJSONString(openingOperationPlanListVOList));
List<Long> shopIdlist = openingOperationPlanDTOS.stream().map(OpeningOperationPlanDTO::getShopId)
.collect(Collectors.toList());
log.info("getPlanListPage shopIdlist:{}",JSONObject.toJSONString(shopIdlist) );
log.info("getPlanListPage shopIdlist:{}", JSONObject.toJSONString(shopIdlist));
//根据ShopName等查询门店名字1门店代码1开店负责人id1督导id1,大区名称,战区名称,线索id
Page<OpenPlanShopInfoDTO> openPlanShopList = shopInfoDAO.
getOpenPlanShopListByShopName(shopIdlist,request.getShopName(), request.getBigName(), request.getFightName(),
request.getPageNum(), request.getPageSize());
log.info("getPlanListPage openPlanShopList:{}",JSONObject.toJSONString(openPlanShopList) );
List<OpenPlanShopInfoDTO> openPlanShopList = shopInfoDAO.
getOpenPlanShopListByShopName(shopIdlist, request.getShopName(), request.getBigName(),
request.getFightName()
);
log.info("getPlanListPage openPlanShopList:{}", JSONObject.toJSONString(openPlanShopList));
Map<Long, OpenPlanShopInfoDTO> shopInfoMap = openPlanShopList.stream()
.collect(Collectors.toMap(OpenPlanShopInfoDTO::getShopId, vo -> vo));
log.info("getPlanListPage shopInfoMap:{}", JSONObject.toJSONString(shopInfoMap) );
log.info("getPlanListPage shopInfoMap:{}", JSONObject.toJSONString(shopInfoMap));
//开店负责人name
List<String> shopManagerUserIdList = openPlanShopList.stream()
.map(OpenPlanShopInfoDTO::getShopManagerUserId)
.collect(Collectors.toList());
List<UserNameDTO> shopManagerList = enterpriseUserDAO.getNameByUserId(shopManagerUserIdList);
log.info("getPlanListPage hopManagerList :{}",JSONObject.toJSONString(shopManagerList) );
log.info("getPlanListPage hopManagerList :{}", JSONObject.toJSONString(shopManagerList));
Map<Long, UserNameDTO> voManagerMap = shopManagerList.stream()
.collect(Collectors.toMap(UserNameDTO::getUserId, vo -> vo));
log.info("getPlanListPage voManagerMap:{}", JSONObject.toJSONString(voManagerMap) );
log.info("getPlanListPage voManagerMap:{}", JSONObject.toJSONString(voManagerMap));
//督导name
List<String> supervisorUserIdList = openPlanShopList.stream()
.map(OpenPlanShopInfoDTO::getSupervisorUserId)
.collect(Collectors.toList());
List<UserNameDTO> supervisorList = enterpriseUserDAO.getNameByUserId(supervisorUserIdList);
log.info("getPlanListPage supervisorList :{}",JSONObject.toJSONString(supervisorList) );
log.info("getPlanListPage supervisorList :{}", JSONObject.toJSONString(supervisorList));
Map<Long, UserNameDTO> voSupervisorList = supervisorList.stream()
.collect(Collectors.toMap(UserNameDTO::getUserId, vo -> vo));
log.info("getPlanListPage openingOperationPlanVOList:{}", JSONObject.toJSONString(openingOperationPlanListVOList) );
log.info("getPlanListPage openingOperationPlanVOList:{}", JSONObject.toJSONString(openingOperationPlanListVOList));
//加盟商姓名,手机号,招商name
List<Long> lines = openPlanShopList.stream()
.map(OpenPlanShopInfoDTO::getLineId)
.collect(Collectors.toList());
List<PlanLineDTO> getLines = lineInfoDAO.getLines(lines);
log.info("getPlanListPage getLines:{}",JSONObject.toJSONString(getLines) );
Map<Long,PlanLineDTO> linemap = getLines.stream()
log.info("getPlanListPage getLines:{}", JSONObject.toJSONString(getLines));
Map<Long, PlanLineDTO> linemap = getLines.stream()
.collect(Collectors.toMap(PlanLineDTO::getLineId, vo -> vo));
log.info("getPlanListPage linemap:{}",JSONObject.toJSONString(linemap) );
for (OpeningOperationPlanListVO vo:openingOperationPlanListVOList){
log.info("getPlanListPage linemap:{}", JSONObject.toJSONString(linemap));
for (OpeningOperationPlanListVO vo : openingOperationPlanListVOList) {
vo.setLineId(shopInfoMap.get(vo.getShopId()).getLineId());
vo.setShopName(shopInfoMap.get(vo.getShopId()).getShopName());
vo.setShopCode(shopInfoMap.get(vo.getShopId()).getShopCode());
@@ -222,6 +212,29 @@ public class OpeningOperationPlanImpl implements OpeningOperationPlanService {
return openingOperationPlanListVOList;
}
@Override
public Boolean flush(Long shopId) {
ShopStageInfoDO orderStageInfo = shopStageInfoDAO.getShopSubStageInfo(shopId, ShopSubStageEnum.SHOP_STAGE_15);
try {
if (orderStageInfo.getShopSubStageStatus().
equals(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_152.getShopSubStageStatus())) {
ShopInfoDO shopInfo = shopService.getShopInfo(shopId);
String shopCode = shopInfo.getShopCode();
Boolean firstOrder = coolStoreStartFlowService.getFirstOrder(shopCode);
log.info("saveOrder,flag:{}", firstOrder);
if (firstOrder) {
//更改子阶段状态
shopStageInfoDAO.updateShopStageAndAuditInfo(shopId,
ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_151, null);
preparationService.whetherToOpenForAcceptance(shopId);
}
}
} catch (Exception e) {
log.error("获取鲜丰订货金异常", e);
return Boolean.FALSE;
}
return Boolean.TRUE;
}
}

View File

@@ -1,6 +1,8 @@
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.dao.ShopStageInfoDAO;
import com.cool.store.dto.openPreparation.FirstOrderDTO;
import com.cool.store.entity.FirstOrderDO;
@@ -55,74 +57,43 @@ public class OpenPreparationController {
@GetMapping("/flush")
public ResponseResult<Boolean> flush(@RequestParam("shopId") Long shopId) {
ShopStageInfoDO orderStageInfo = shopStageInfoDAO.getShopSubStageInfo(shopId, ShopSubStageEnum.SHOP_STAGE_15);
try {
if (orderStageInfo.getShopSubStageStatus().
equals(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_152.getShopSubStageStatus())) {
ShopInfoDO shopInfo = shopService.getShopInfo(shopId);
String shopCode = shopInfo.getShopCode();
Boolean firstOrder = coolStoreStartFlowService.getFirstOrder(shopCode);
log.info("saveOrder,flag:{}", firstOrder);
if (firstOrder) {
//更改子阶段状态
shopStageInfoDAO.updateShopStageAndAuditInfo(shopId,
ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_151, null);
preparationService.whetherToOpenForAcceptance(shopId);
}
}
} catch (Exception e) {
log.error("获取鲜丰订货金异常", e);
}
return ResponseResult.success(Boolean.TRUE);
return ResponseResult.success(openingOperationPlanService.flush(shopId));
}
@PostMapping("/openingOperationPlan/submit")
@ApiOperation("提交开业运营方案")
public ResponseResult submitPlan(@RequestBody OpeningOperationPlanRequest request) {
openingOperationPlanService.savePlan(request);
return ResponseResult.success();
return ResponseResult.success(openingOperationPlanService.savePlan(request,CurrentUserHolder.getUser()));
}
@GetMapping("/openingOperationPlan/getPlan")
@ApiOperation("查询开业运营方案")
public ResponseResult<OpeningOperationPlanVO> getPlan(@RequestParam("shopId") Long shopId) {
OpeningOperationPlanVO plan = openingOperationPlanService.getPlanByShopId(shopId);
log.info("openingOperationPlan,getPlan:{}", JSONObject.toJSONString(plan));
return ResponseResult.success(plan);
return ResponseResult.success(openingOperationPlanService.getPlanByShopId(shopId));
}
@PostMapping("/openingOperationPlan/audit")
@ApiOperation("审核运营方案")
public ResponseResult auditPlan(@RequestBody OpeningOperationPlanAuditRequest request) {
auditOpeningOperationPlanService.auditPlan(request);
return ResponseResult.success();
return ResponseResult.success(auditOpeningOperationPlanService.auditPlan(request));
}
@GetMapping("/openingOperationPlan/planList")
@ApiOperation("查询运营方案列表")
public ResponseResult<List<OpeningOperationPlanListVO>> planList(@RequestBody PlanListRequest request) {
openingOperationPlanService.getPlanListPage(request);
return ResponseResult.success(openingOperationPlanService.getPlanListPage(request));
}
@GetMapping("/firstOrder/get")
@ApiOperation("查询订货金")
public ResponseResult<FirstOrderDTO> get(@RequestParam("shopId") Long shopId) {
FirstOrderDTO order = firstOrderService.getOrder(shopId);
return ResponseResult.success(order);
return ResponseResult.success(firstOrderService.getOrder(shopId));
}
@PostMapping("/firstOrder/submit")
@ApiOperation("提交订货金")
public ResponseResult submit(@RequestBody FirstOrderRequest request) {
FirstOrderDO firstOrderDO = new FirstOrderDO();
try {
BeanUtils.copyProperties(firstOrderDO, request);
firstOrderService.saveOrder(request);
return ResponseResult.success();
} catch (IllegalAccessException | InvocationTargetException e) {
throw new RuntimeException(e);
}
return ResponseResult.success(firstOrderService.saveOrder(request,CurrentUserHolder.getUser()));
}
}

View File

@@ -53,55 +53,21 @@ public class MiniOpenPreparationController {
@ApiOperation("查询开业运营方案")
public ResponseResult<OpeningOperationPlanVO> getPlan(@RequestParam("shopId") Long shopId) {
OpeningOperationPlanVO plan = openingOperationPlanService.getPlanByShopId(shopId);
log.info("MiniOpeningOperationPlanController#getPlan:{}", JSONObject.toJSONString(plan));
if (plan == null) {
log.info("运营方案未上传");
return ResponseResult.success(null);
}
if (plan.getResultType().equals(AuditStatusEnum.PASS.getCode())) {
if (AuditStatusEnum.PASS.getCode().equals(plan.getResultType())) {
return ResponseResult.success(plan);
} else {
log.info("运营方案待审核或未通过");
return ResponseResult.success(null);
}
log.info("运营方案待审核或未通过");
return ResponseResult.success(null);
}
@GetMapping("/firstOrder/get")
@ApiOperation("查询订货金")
public ResponseResult<FirstOrderDTO> get(@RequestParam("shopId") Long shopId) {
FirstOrderDTO order = firstOrderService.getOrder(shopId);
ShopStageInfoDO firstOrderStageInfo = shopStageInfoDAO.getShopSubStageInfo(shopId, ShopSubStageEnum.SHOP_STAGE_15);
order.setResultType(firstOrderStageInfo.getShopSubStageStatus());
return ResponseResult.success(order);
return ResponseResult.success(firstOrderService.getOrder(shopId));
}
@GetMapping("/firstOrder/flush")
public ResponseResult<FirstOrderDTO> flush(@RequestParam Long shopId) {
ShopStageInfoDO orderStageInfo = shopStageInfoDAO.getShopSubStageInfo(shopId, ShopSubStageEnum.SHOP_STAGE_15);
try {
if (!orderStageInfo.getShopSubStageStatus().
equals(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_151.getShopSubStageStatus())) {
ShopInfoDO shopInfo = shopService.getShopInfo(shopId);
String shopCode = shopInfo.getShopCode();
Boolean flag = coolStoreStartFlowService.getFirstOrder(shopCode);
log.info("saveOrder,flag:{}", flag);
if (flag == null) {
throw new ServiceException(ErrorCodeEnum.GET_FIRST_ORDER);
}
if (flag) {
//更改子阶段状态
shopStageInfoDAO.updateShopStageAndAuditInfo(shopId,
ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_151, null);
preparationService.whetherToOpenForAcceptance(shopId);
}
}
} catch (Exception e) {
log.error("获取鲜丰订货金异常", e);
}
ShopStageInfoDO firstOrderStageInfo = shopStageInfoDAO.getShopSubStageInfo(shopId, ShopSubStageEnum.SHOP_STAGE_15);
log.info("flush orderStageInfo:{}", firstOrderStageInfo);
FirstOrderDTO order = firstOrderService.getOrder(shopId);
order.setResultType(firstOrderStageInfo.getShopSubStageStatus());
return ResponseResult.success(order);
return ResponseResult.success( firstOrderService.flush(shopId));
}