开业筹备阶段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.dto.openPreparation.OpeningOperationPlanDTO;
import com.cool.store.entity.OpeningOperationPlanDO; import com.cool.store.entity.OpeningOperationPlanDO;
import com.cool.store.mapper.OpeningOperationPlanMapper; import com.cool.store.mapper.OpeningOperationPlanMapper;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@@ -43,7 +45,9 @@ public class OpeningOperationPlanDAO {
return openingOperationPlanMapper.selectByShopId(shopId); 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); return openingOperationPlanMapper.selectPlanList( StartDate,EndDate,resultType);
} }

View File

@@ -140,8 +140,8 @@ public class ShopInfoDAO {
* @Date: 2024/4/24 * @Date: 2024/4/24
* @description: 开业运营方案根据shopname获取列表 * @description: 开业运营方案根据shopname获取列表
*/ */
public Page<OpenPlanShopInfoDTO> getOpenPlanShopListByShopName( List<Long> shopIdlist,String shopName, String bigName, String fightName, Integer pageNum, Integer pageSize){ public List<OpenPlanShopInfoDTO>getOpenPlanShopListByShopName( List<Long> shopIdlist,String shopName, String bigName, String fightName){
PageHelper.startPage(pageNum, pageSize);
return shopInfoMapper.getOpenPlanShopListByShopName(shopIdlist,shopName,bigName,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.dto.openPreparation.OpeningOperationPlanDTO;
import com.cool.store.entity.OpeningOperationPlanDO; import com.cool.store.entity.OpeningOperationPlanDO;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper; import tk.mybatis.mapper.common.Mapper;
@@ -12,9 +13,9 @@ public interface OpeningOperationPlanMapper extends Mapper<OpeningOperationPlanD
OpeningOperationPlanDO selectByShopId(@Param("shopId") Long shopId); OpeningOperationPlanDO selectByShopId(@Param("shopId") Long shopId);
List<OpeningOperationPlanDTO> selectPlanList( @Param("startDate") Date startDate, Page<OpeningOperationPlanDTO> selectPlanList(@Param("startDate") Date startDate,
@Param("endDate") Date endDate, @Param("endDate") Date endDate,
@Param("resultType") Integer resultType); @Param("resultType") Integer resultType);
Integer updateByShopId(@Param("shopId") Long shopId, @Param("audit") Long auditId, @Param("resulType") 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 * @Date: 2024/4/24
* @description: 开业运营方案根据shopname获取列表 * @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); @Param("bigName") String bigName, @Param("fightName") String fightName);
/** /**
* @Auther: wangshuo * @Auther: wangshuo

View File

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

View File

@@ -1,6 +1,7 @@
package com.cool.store.request; package com.cool.store.request;
import com.cool.store.entity.ShopAuditInfoDO; import com.cool.store.entity.ShopAuditInfoDO;
import com.cool.store.enums.AuditResultTypeEnum;
import com.cool.store.enums.AuditTypeEnum; import com.cool.store.enums.AuditTypeEnum;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@@ -33,7 +34,7 @@ public class OpeningOperationPlanAuditRequest {
shopAuditInfoDO.setShopId(shopId); shopAuditInfoDO.setShopId(shopId);
shopAuditInfoDO.setAuditType(AuditTypeEnum.OPENING_OPERATION_PLAN.getCode()); shopAuditInfoDO.setAuditType(AuditTypeEnum.OPENING_OPERATION_PLAN.getCode());
shopAuditInfoDO.setResultType(resultType); shopAuditInfoDO.setResultType(resultType);
if (resultType == 0 ) if (AuditResultTypeEnum.PASS.getCode().equals(resultType) )
shopAuditInfoDO.setPassReason(passReason); shopAuditInfoDO.setPassReason(passReason);
else else
shopAuditInfoDO.setRejectReason(rejectReason); shopAuditInfoDO.setRejectReason(rejectReason);

View File

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

View File

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

View File

@@ -1,5 +1,6 @@
package com.cool.store.service; package com.cool.store.service;
import com.cool.store.context.LoginUserInfo;
import com.cool.store.request.OpeningOperationPlanRequest; import com.cool.store.request.OpeningOperationPlanRequest;
import com.cool.store.request.PlanListRequest; import com.cool.store.request.PlanListRequest;
import com.cool.store.vo.OpeningOperationPlanListVO; import com.cool.store.vo.OpeningOperationPlanListVO;
@@ -20,7 +21,7 @@ public interface OpeningOperationPlanService {
* @Date: 2024/4/23 * @Date: 2024/4/23
* @description: 提交开业运营方案 * @description: 提交开业运营方案
*/ */
Long savePlan(OpeningOperationPlanRequest openingOperationPlanRequest); Long savePlan(OpeningOperationPlanRequest openingOperationPlanRequest, LoginUserInfo userInfo);
OpeningOperationPlanVO getPlanByShopId(Long ShopId); OpeningOperationPlanVO getPlanByShopId(Long ShopId);
/** /**
@@ -29,5 +30,5 @@ public interface OpeningOperationPlanService {
* @description: 根据条件查询方案列表 * @description: 根据条件查询方案列表
*/ */
List<OpeningOperationPlanListVO> getPlanListPage(PlanListRequest request); 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.alibaba.fastjson.JSONObject;
import com.cool.store.context.CurrentUserHolder; import com.cool.store.context.CurrentUserHolder;
import com.cool.store.context.LoginUserInfo;
import com.cool.store.dao.FirstOrderDAO; import com.cool.store.dao.FirstOrderDAO;
import com.cool.store.dao.ShopStageInfoDAO; import com.cool.store.dao.ShopStageInfoDAO;
import com.cool.store.dto.openPreparation.FirstOrderDTO; import com.cool.store.dto.openPreparation.FirstOrderDTO;
import com.cool.store.entity.FirstOrderDO; import com.cool.store.entity.FirstOrderDO;
import com.cool.store.entity.ShopInfoDO; import com.cool.store.entity.ShopInfoDO;
import com.cool.store.entity.ShopStageInfoDO;
import com.cool.store.enums.ErrorCodeEnum; import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.point.ShopSubStageEnum;
import com.cool.store.enums.point.ShopSubStageStatusEnum; import com.cool.store.enums.point.ShopSubStageStatusEnum;
import com.cool.store.exception.ServiceException; import com.cool.store.exception.ServiceException;
import com.cool.store.request.FirstOrderRequest; import com.cool.store.request.FirstOrderRequest;
@@ -48,8 +51,12 @@ public class FirstOrderServiceImp implements FirstOrderService {
private CoolStoreStartFlowService coolStoreStartFlowService; private CoolStoreStartFlowService coolStoreStartFlowService;
@Override @Override
public Integer saveOrder(FirstOrderRequest request) { public Integer saveOrder(FirstOrderRequest request, LoginUserInfo user) {
String userId = CurrentUserHolder.getUserId(); 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(); FirstOrderDO order = new FirstOrderDO();
try { try {
BeanUtils.copyProperties(order, request); BeanUtils.copyProperties(order, request);
@@ -58,22 +65,16 @@ public class FirstOrderServiceImp implements FirstOrderService {
} catch (InvocationTargetException e) { } catch (InvocationTargetException e) {
throw new RuntimeException(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()); FirstOrderDTO firstOrderDTO = firstOrderDAO.selectFirstOrderByShopId(order.getShopId());
if (firstOrderDTO == null) { if (firstOrderDTO == null) {
//第一次提交 //第一次提交
order.setCreateTime(new Date()); order.setCreateTime(new Date());
order.setUpdateTime(new Date());
order.setCreateUserId(userId); order.setCreateUserId(userId);
order.setUpdateUserId(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); Integer num = firstOrderDAO.insertFirstOrder(order);
//云立方同步 //云立方同步
if (num > 0) { if (num > 0) {
@@ -105,6 +106,37 @@ public class FirstOrderServiceImp implements FirstOrderService {
log.error("shopId/shopCode is null"); log.error("shopId/shopCode is null");
throw new ServiceException(ErrorCodeEnum.FIRST_ORDER_PARAM_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.alibaba.fastjson.JSONObject;
import com.cool.store.constants.CommonConstants; import com.cool.store.constants.CommonConstants;
import com.cool.store.context.CurrentUserHolder; import com.cool.store.context.CurrentUserHolder;
import com.cool.store.context.LoginUserInfo;
import com.cool.store.dao.*; import com.cool.store.dao.*;
import com.cool.store.dto.openPreparation.OpenPlanShopInfoDTO; import com.cool.store.dto.openPreparation.OpenPlanShopInfoDTO;
import com.cool.store.dto.openPreparation.OpeningOperationPlanDTO; import com.cool.store.dto.openPreparation.OpeningOperationPlanDTO;
import com.cool.store.dto.openPreparation.PlanLineDTO; import com.cool.store.dto.openPreparation.PlanLineDTO;
import com.cool.store.dto.openPreparation.UserNameDTO; import com.cool.store.dto.openPreparation.UserNameDTO;
import com.cool.store.entity.OpeningOperationPlanDO; 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.AuditStatusEnum;
import com.cool.store.enums.ErrorCodeEnum; import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.point.ShopSubStageEnum;
import com.cool.store.enums.point.ShopSubStageStatusEnum; import com.cool.store.enums.point.ShopSubStageStatusEnum;
import com.cool.store.exception.ServiceException; import com.cool.store.exception.ServiceException;
import com.cool.store.request.OpeningOperationPlanAuditRequest; import com.cool.store.request.OpeningOperationPlanAuditRequest;
import com.cool.store.request.OpeningOperationPlanRequest; import com.cool.store.request.OpeningOperationPlanRequest;
import com.cool.store.request.PlanListRequest; import com.cool.store.request.PlanListRequest;
import com.cool.store.service.AuditOpeningOperationPlanService; import com.cool.store.response.ResponseResult;
import com.cool.store.service.OpeningOperationPlanService; import com.cool.store.service.*;
import com.cool.store.utils.poi.StringUtils; import com.cool.store.utils.poi.StringUtils;
import com.cool.store.vo.OpeningOperationPlanListVO; import com.cool.store.vo.OpeningOperationPlanListVO;
import com.cool.store.vo.OpeningOperationPlanVO; import com.cool.store.vo.OpeningOperationPlanVO;
@@ -54,101 +58,84 @@ public class OpeningOperationPlanImpl implements OpeningOperationPlanService {
private LineInfoDAO lineInfoDAO; private LineInfoDAO lineInfoDAO;
@Resource @Resource
private ShopStageInfoDAO shopStageInfoDAO; private ShopStageInfoDAO shopStageInfoDAO;
@Resource
private ShopService shopService;
@Resource
private CoolStoreStartFlowService coolStoreStartFlowService;
@Resource
private PreparationService preparationService;
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Long savePlan(OpeningOperationPlanRequest request) { public Long savePlan(OpeningOperationPlanRequest request, LoginUserInfo userInfo) {
log.info("addNewPlan request:{}", JSONObject.toJSONString(request)); 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"); log.error("addNewPlan ActivityTheme length error");
throw new ServiceException(ErrorCodeEnum.ACTIVITY_THEME_LENGTH_FALSE); 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"); log.error("addNewPlan SurveyResult length error");
throw new ServiceException(ErrorCodeEnum.SURVEYRESULT_LENGTH_FALSE); throw new ServiceException(ErrorCodeEnum.SURVEYRESULT_LENGTH_FALSE);
} }
String userId = CurrentUserHolder.getUserId(); String userId = userInfo.getUserId();
try { 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 openingOperationPlanAuditRequest = new OpeningOperationPlanAuditRequest();
openingOperationPlanAuditRequest.setShopId(request.getShopId()); openingOperationPlanAuditRequest.setShopId(request.getShopId());
Long AuditId = auditOpeningOperationPlanService.addNewPlanAudit(openingOperationPlanAuditRequest); 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()); OpeningOperationPlanDO selectByShopId = openingOperationPlanDAO.selectByShopId(request.getShopId());
Long planId ; Long planId;
OpeningOperationPlanDO openingOperationPlanDO = request.toOpeningOperationPlanDO(); 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.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); planId = openingOperationPlanDAO.updateSelective(openingOperationPlanDO);
} } else {
else {
//新增 //新增
openingOperationPlanDO.setSubmissionTime(new Date()); openingOperationPlanDO.setSubmissionTime(new Date());
openingOperationPlanDO.setSubmittedUserId(userId); openingOperationPlanDO.setSubmittedUserId(userId);
openingOperationPlanDO.setCreateTime(new Date()); openingOperationPlanDO.setCreateTime(new Date());
openingOperationPlanDO.setCreateUserId(userId); openingOperationPlanDO.setCreateUserId(userId);
openingOperationPlanDO.setUpdateTime(new Date());
openingOperationPlanDO.setUpdateUserId(userId);
openingOperationPlanDO.setAuditId(AuditId); openingOperationPlanDO.setAuditId(AuditId);
openingOperationPlanDO.setResultType(AuditStatusEnum.TODO.getCode());
planId = openingOperationPlanDAO.insertSelective(openingOperationPlanDO); 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()); 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"); 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; return planId;
}catch (Exception e) { } catch (Exception e) {
log.error("addNewPlan Exception:{}", e); log.error("addNewPlan Exception:{}", e);
e.printStackTrace(); e.printStackTrace();
return null; return null;
} }
} }
@Override @Override
public OpeningOperationPlanVO getPlanByShopId(Long shopId) { public OpeningOperationPlanVO getPlanByShopId(Long shopId) {
log.info( "getPlanBy shopId:{}", shopId ); log.info("getPlanBy shopId:{}", shopId);
if (Objects.isNull(shopId)){ if (Objects.isNull(shopId)) {
log.error(" getPlanByShopId shopId is null"); log.error(" getPlanByShopId shopId is null");
throw new ServiceException(ErrorCodeEnum.SHOP_ID_IS_NULL); throw new ServiceException(ErrorCodeEnum.SHOP_ID_IS_NULL);
} }
OpeningOperationPlanVO openingOperationPlanVO = new OpeningOperationPlanVO(); OpeningOperationPlanVO openingOperationPlanVO = new OpeningOperationPlanVO();
OpeningOperationPlanDO openingOperationPlanDO = openingOperationPlanDAO.selectByShopId(shopId); OpeningOperationPlanDO openingOperationPlanDO = openingOperationPlanDAO.selectByShopId(shopId);
try { try {
if ((openingOperationPlanDO!=null)){ if (openingOperationPlanDO != null) {
String preparationUserIds = openingOperationPlanDO.getPreparationUserIds(); String preparationUserIds = openingOperationPlanDO.getPreparationUserIds();
List<String> stream = Arrays.stream(preparationUserIds.split(CommonConstants.COMMA)).collect(Collectors.toList()); List<String> stream = Arrays.stream(preparationUserIds.split(CommonConstants.COMMA)).collect(Collectors.toList());
List<UserNameDTO> nameByUserId = enterpriseUserDAO.getNameByUserId(stream); List<UserNameDTO> nameByUserId = enterpriseUserDAO.getNameByUserId(stream);
List<String> names = nameByUserId.stream() BeanUtils.copyProperties(openingOperationPlanDO, openingOperationPlanVO);
.map(UserNameDTO::getName) openingOperationPlanVO.setPreparationUsers(nameByUserId);
.collect(Collectors.toList()); return openingOperationPlanVO;
String preparationUserName = String.join(CommonConstants.COMMA, names); }
BeanUtils.copyProperties(openingOperationPlanDO, openingOperationPlanVO); } catch (IllegalAccessException | InvocationTargetException e) {
openingOperationPlanVO.setPreparationUsers(preparationUserName); e.printStackTrace();
return openingOperationPlanVO; return null;
} }
} catch (IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
return null;
}
return openingOperationPlanVO; return openingOperationPlanVO;
} }
@@ -156,11 +143,12 @@ public class OpeningOperationPlanImpl implements OpeningOperationPlanService {
public List<OpeningOperationPlanListVO> getPlanListPage(PlanListRequest request) { public List<OpeningOperationPlanListVO> getPlanListPage(PlanListRequest request) {
log.info("getPlanListPage request:{}", JSONObject.toJSONString(request)); log.info("getPlanListPage request:{}", JSONObject.toJSONString(request));
//shopId,提交时间,审核状态 //shopId,提交时间,审核状态
List<OpeningOperationPlanDTO> openingOperationPlanDTOS = openingOperationPlanDAO. Page<OpeningOperationPlanDTO> openingOperationPlanDTOS = openingOperationPlanDAO.
selectConditionPlanList(request.getPlanStartDate(),request.getPlanEndDate(),request.getResultType()); selectConditionPlanList(request.getPlanStartDate(), request.getPlanEndDate(),
log.info("getPlanListPage openingOperationPlanDTOS:{}",JSONObject.toJSONString(openingOperationPlanDTOS) ); request.getResultType(), request.getPageNum(), request.getPageSize());
//包装VO log.info("getPlanListPage openingOperationPlanDTOS:{}", JSONObject.toJSONString(openingOperationPlanDTOS));
List<OpeningOperationPlanListVO> openingOperationPlanListVOList = openingOperationPlanDTOS.stream().map(dto->{ //包装VO
List<OpeningOperationPlanListVO> openingOperationPlanListVOList = openingOperationPlanDTOS.stream().map(dto -> {
OpeningOperationPlanListVO vO = new OpeningOperationPlanListVO(); OpeningOperationPlanListVO vO = new OpeningOperationPlanListVO();
vO.setShopId(dto.getShopId()); vO.setShopId(dto.getShopId());
vO.setSubmissionTime(dto.getSubmissionTime()); vO.setSubmissionTime(dto.getSubmissionTime());
@@ -168,46 +156,48 @@ public class OpeningOperationPlanImpl implements OpeningOperationPlanService {
vO.setAuditId(dto.getAuditId()); vO.setAuditId(dto.getAuditId());
return vO; return vO;
}).collect(Collectors.toList()); }).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) List<Long> shopIdlist = openingOperationPlanDTOS.stream().map(OpeningOperationPlanDTO::getShopId)
.collect(Collectors.toList()); .collect(Collectors.toList());
log.info("getPlanListPage shopIdlist:{}",JSONObject.toJSONString(shopIdlist) ); log.info("getPlanListPage shopIdlist:{}", JSONObject.toJSONString(shopIdlist));
//根据ShopName等查询门店名字1门店代码1开店负责人id1督导id1,大区名称,战区名称,线索id //根据ShopName等查询门店名字1门店代码1开店负责人id1督导id1,大区名称,战区名称,线索id
Page<OpenPlanShopInfoDTO> openPlanShopList = shopInfoDAO. List<OpenPlanShopInfoDTO> openPlanShopList = shopInfoDAO.
getOpenPlanShopListByShopName(shopIdlist,request.getShopName(), request.getBigName(), request.getFightName(), getOpenPlanShopListByShopName(shopIdlist, request.getShopName(), request.getBigName(),
request.getPageNum(), request.getPageSize()); request.getFightName()
log.info("getPlanListPage openPlanShopList:{}",JSONObject.toJSONString(openPlanShopList) ); );
log.info("getPlanListPage openPlanShopList:{}", JSONObject.toJSONString(openPlanShopList));
Map<Long, OpenPlanShopInfoDTO> shopInfoMap = openPlanShopList.stream() Map<Long, OpenPlanShopInfoDTO> shopInfoMap = openPlanShopList.stream()
.collect(Collectors.toMap(OpenPlanShopInfoDTO::getShopId, vo -> vo)); .collect(Collectors.toMap(OpenPlanShopInfoDTO::getShopId, vo -> vo));
log.info("getPlanListPage shopInfoMap:{}", JSONObject.toJSONString(shopInfoMap) ); log.info("getPlanListPage shopInfoMap:{}", JSONObject.toJSONString(shopInfoMap));
//开店负责人name //开店负责人name
List<String> shopManagerUserIdList = openPlanShopList.stream() List<String> shopManagerUserIdList = openPlanShopList.stream()
.map(OpenPlanShopInfoDTO::getShopManagerUserId) .map(OpenPlanShopInfoDTO::getShopManagerUserId)
.collect(Collectors.toList()); .collect(Collectors.toList());
List<UserNameDTO> shopManagerList = enterpriseUserDAO.getNameByUserId(shopManagerUserIdList); 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() Map<Long, UserNameDTO> voManagerMap = shopManagerList.stream()
.collect(Collectors.toMap(UserNameDTO::getUserId, vo -> vo)); .collect(Collectors.toMap(UserNameDTO::getUserId, vo -> vo));
log.info("getPlanListPage voManagerMap:{}", JSONObject.toJSONString(voManagerMap) ); log.info("getPlanListPage voManagerMap:{}", JSONObject.toJSONString(voManagerMap));
//督导name //督导name
List<String> supervisorUserIdList = openPlanShopList.stream() List<String> supervisorUserIdList = openPlanShopList.stream()
.map(OpenPlanShopInfoDTO::getSupervisorUserId) .map(OpenPlanShopInfoDTO::getSupervisorUserId)
.collect(Collectors.toList()); .collect(Collectors.toList());
List<UserNameDTO> supervisorList = enterpriseUserDAO.getNameByUserId(supervisorUserIdList); 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() Map<Long, UserNameDTO> voSupervisorList = supervisorList.stream()
.collect(Collectors.toMap(UserNameDTO::getUserId, vo -> vo)); .collect(Collectors.toMap(UserNameDTO::getUserId, vo -> vo));
log.info("getPlanListPage openingOperationPlanVOList:{}", JSONObject.toJSONString(openingOperationPlanListVOList) ); log.info("getPlanListPage openingOperationPlanVOList:{}", JSONObject.toJSONString(openingOperationPlanListVOList));
//加盟商姓名,手机号,招商name //加盟商姓名,手机号,招商name
List<Long> lines = openPlanShopList.stream() List<Long> lines = openPlanShopList.stream()
.map(OpenPlanShopInfoDTO::getLineId) .map(OpenPlanShopInfoDTO::getLineId)
.collect(Collectors.toList()); .collect(Collectors.toList());
List<PlanLineDTO> getLines = lineInfoDAO.getLines(lines); List<PlanLineDTO> getLines = lineInfoDAO.getLines(lines);
log.info("getPlanListPage getLines:{}",JSONObject.toJSONString(getLines) ); log.info("getPlanListPage getLines:{}", JSONObject.toJSONString(getLines));
Map<Long,PlanLineDTO> linemap = getLines.stream() Map<Long, PlanLineDTO> linemap = getLines.stream()
.collect(Collectors.toMap(PlanLineDTO::getLineId, vo -> vo)); .collect(Collectors.toMap(PlanLineDTO::getLineId, vo -> vo));
log.info("getPlanListPage linemap:{}",JSONObject.toJSONString(linemap) ); log.info("getPlanListPage linemap:{}", JSONObject.toJSONString(linemap));
for (OpeningOperationPlanListVO vo:openingOperationPlanListVOList){ for (OpeningOperationPlanListVO vo : openingOperationPlanListVOList) {
vo.setLineId(shopInfoMap.get(vo.getShopId()).getLineId()); vo.setLineId(shopInfoMap.get(vo.getShopId()).getLineId());
vo.setShopName(shopInfoMap.get(vo.getShopId()).getShopName()); vo.setShopName(shopInfoMap.get(vo.getShopId()).getShopName());
vo.setShopCode(shopInfoMap.get(vo.getShopId()).getShopCode()); vo.setShopCode(shopInfoMap.get(vo.getShopId()).getShopCode());
@@ -222,6 +212,29 @@ public class OpeningOperationPlanImpl implements OpeningOperationPlanService {
return openingOperationPlanListVOList; 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; package com.cool.store.controller.webb;
import com.alibaba.fastjson.JSONObject; 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.dao.ShopStageInfoDAO;
import com.cool.store.dto.openPreparation.FirstOrderDTO; import com.cool.store.dto.openPreparation.FirstOrderDTO;
import com.cool.store.entity.FirstOrderDO; import com.cool.store.entity.FirstOrderDO;
@@ -55,74 +57,43 @@ public class OpenPreparationController {
@GetMapping("/flush") @GetMapping("/flush")
public ResponseResult<Boolean> flush(@RequestParam("shopId") Long shopId) { public ResponseResult<Boolean> flush(@RequestParam("shopId") Long shopId) {
ShopStageInfoDO orderStageInfo = shopStageInfoDAO.getShopSubStageInfo(shopId, ShopSubStageEnum.SHOP_STAGE_15); return ResponseResult.success(openingOperationPlanService.flush(shopId));
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);
} }
@PostMapping("/openingOperationPlan/submit") @PostMapping("/openingOperationPlan/submit")
@ApiOperation("提交开业运营方案") @ApiOperation("提交开业运营方案")
public ResponseResult submitPlan(@RequestBody OpeningOperationPlanRequest request) { public ResponseResult submitPlan(@RequestBody OpeningOperationPlanRequest request) {
openingOperationPlanService.savePlan(request); return ResponseResult.success(openingOperationPlanService.savePlan(request,CurrentUserHolder.getUser()));
return ResponseResult.success();
} }
@GetMapping("/openingOperationPlan/getPlan") @GetMapping("/openingOperationPlan/getPlan")
@ApiOperation("查询开业运营方案") @ApiOperation("查询开业运营方案")
public ResponseResult<OpeningOperationPlanVO> getPlan(@RequestParam("shopId") Long shopId) { public ResponseResult<OpeningOperationPlanVO> getPlan(@RequestParam("shopId") Long shopId) {
OpeningOperationPlanVO plan = openingOperationPlanService.getPlanByShopId(shopId); return ResponseResult.success(openingOperationPlanService.getPlanByShopId(shopId));
log.info("openingOperationPlan,getPlan:{}", JSONObject.toJSONString(plan));
return ResponseResult.success(plan);
} }
@PostMapping("/openingOperationPlan/audit") @PostMapping("/openingOperationPlan/audit")
@ApiOperation("审核运营方案") @ApiOperation("审核运营方案")
public ResponseResult auditPlan(@RequestBody OpeningOperationPlanAuditRequest request) { public ResponseResult auditPlan(@RequestBody OpeningOperationPlanAuditRequest request) {
auditOpeningOperationPlanService.auditPlan(request); return ResponseResult.success(auditOpeningOperationPlanService.auditPlan(request));
return ResponseResult.success();
} }
@GetMapping("/openingOperationPlan/planList") @GetMapping("/openingOperationPlan/planList")
@ApiOperation("查询运营方案列表") @ApiOperation("查询运营方案列表")
public ResponseResult<List<OpeningOperationPlanListVO>> planList(@RequestBody PlanListRequest request) { public ResponseResult<List<OpeningOperationPlanListVO>> planList(@RequestBody PlanListRequest request) {
openingOperationPlanService.getPlanListPage(request);
return ResponseResult.success(openingOperationPlanService.getPlanListPage(request)); return ResponseResult.success(openingOperationPlanService.getPlanListPage(request));
} }
@GetMapping("/firstOrder/get") @GetMapping("/firstOrder/get")
@ApiOperation("查询订货金") @ApiOperation("查询订货金")
public ResponseResult<FirstOrderDTO> get(@RequestParam("shopId") Long shopId) { public ResponseResult<FirstOrderDTO> get(@RequestParam("shopId") Long shopId) {
FirstOrderDTO order = firstOrderService.getOrder(shopId); return ResponseResult.success(firstOrderService.getOrder(shopId));
return ResponseResult.success(order);
} }
@PostMapping("/firstOrder/submit") @PostMapping("/firstOrder/submit")
@ApiOperation("提交订货金") @ApiOperation("提交订货金")
public ResponseResult submit(@RequestBody FirstOrderRequest request) { public ResponseResult submit(@RequestBody FirstOrderRequest request) {
FirstOrderDO firstOrderDO = new FirstOrderDO(); return ResponseResult.success(firstOrderService.saveOrder(request,CurrentUserHolder.getUser()));
try {
BeanUtils.copyProperties(firstOrderDO, request);
firstOrderService.saveOrder(request);
return ResponseResult.success();
} catch (IllegalAccessException | InvocationTargetException e) {
throw new RuntimeException(e);
}
} }
} }

View File

@@ -53,55 +53,21 @@ public class MiniOpenPreparationController {
@ApiOperation("查询开业运营方案") @ApiOperation("查询开业运营方案")
public ResponseResult<OpeningOperationPlanVO> getPlan(@RequestParam("shopId") Long shopId) { public ResponseResult<OpeningOperationPlanVO> getPlan(@RequestParam("shopId") Long shopId) {
OpeningOperationPlanVO plan = openingOperationPlanService.getPlanByShopId(shopId); OpeningOperationPlanVO plan = openingOperationPlanService.getPlanByShopId(shopId);
log.info("MiniOpeningOperationPlanController#getPlan:{}", JSONObject.toJSONString(plan)); if (AuditStatusEnum.PASS.getCode().equals(plan.getResultType())) {
if (plan == null) {
log.info("运营方案未上传");
return ResponseResult.success(null);
}
if (plan.getResultType().equals(AuditStatusEnum.PASS.getCode())) {
return ResponseResult.success(plan); return ResponseResult.success(plan);
} else {
log.info("运营方案待审核或未通过");
return ResponseResult.success(null);
} }
log.info("运营方案待审核或未通过");
return ResponseResult.success(null);
} }
@GetMapping("/firstOrder/get") @GetMapping("/firstOrder/get")
@ApiOperation("查询订货金") @ApiOperation("查询订货金")
public ResponseResult<FirstOrderDTO> get(@RequestParam("shopId") Long shopId) { public ResponseResult<FirstOrderDTO> get(@RequestParam("shopId") Long shopId) {
FirstOrderDTO order = firstOrderService.getOrder(shopId); return ResponseResult.success(firstOrderService.getOrder(shopId));
ShopStageInfoDO firstOrderStageInfo = shopStageInfoDAO.getShopSubStageInfo(shopId, ShopSubStageEnum.SHOP_STAGE_15);
order.setResultType(firstOrderStageInfo.getShopSubStageStatus());
return ResponseResult.success(order);
} }
@GetMapping("/firstOrder/flush") @GetMapping("/firstOrder/flush")
public ResponseResult<FirstOrderDTO> flush(@RequestParam Long shopId) { public ResponseResult<FirstOrderDTO> flush(@RequestParam Long shopId) {
ShopStageInfoDO orderStageInfo = shopStageInfoDAO.getShopSubStageInfo(shopId, ShopSubStageEnum.SHOP_STAGE_15); return ResponseResult.success( firstOrderService.flush(shopId));
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);
} }