开业筹备阶段1.0

This commit is contained in:
shuo.wang
2024-04-25 20:03:27 +08:00
parent 54f4dc7f77
commit 1e170ebe7c
37 changed files with 657 additions and 320 deletions

View File

@@ -1,52 +0,0 @@
package com.cool.store.controller.webb;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.dto.openPreparation.FirstOrderDTO;
import com.cool.store.entity.FirstOrderDO;
import com.cool.store.mq.util.HttpRestTemplateService;
import com.cool.store.request.FirstOrderRequest;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.FirstOrderService;
import com.cool.store.utils.poi.constant.Constants;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
/**
* @Auther: WangShuo
* @Date: 2024/04/24/下午9:22
* @Version 1.0
* @注释:
*/
@RestController
@RequestMapping("/pc/firstOrder")
@Api(tags = "PC首批订货金")
@Slf4j
public class FirstOrderController {
@Resource
private FirstOrderService firstOrderService;
@GetMapping("/get")
public ResponseResult<FirstOrderDTO> get(@RequestParam("shopId") Long shopId) {
FirstOrderDTO order = firstOrderService.getOrder(shopId);
return ResponseResult.success(order);
}
@PostMapping("/submit")
public ResponseResult getSubmit(@RequestBody FirstOrderRequest request) {
FirstOrderDO firstOrderDO = new FirstOrderDO();
try {
BeanUtils.copyProperties(firstOrderDO,request );
firstOrderService.saveOrder(firstOrderDO);
return ResponseResult.success();
} catch (IllegalAccessException |InvocationTargetException e) {
throw new RuntimeException(e);
}
}
}

View File

@@ -0,0 +1,144 @@
package com.cool.store.controller.webb;
import com.alibaba.fastjson.JSONObject;
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.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.FirstOrderRequest;
import com.cool.store.request.OpeningOperationPlanAuditRequest;
import com.cool.store.request.OpeningOperationPlanRequest;
import com.cool.store.request.PlanListRequest;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.*;
import com.cool.store.vo.OpenPreparationFlushVO;
import com.cool.store.vo.OpeningOperationPlanListVO;
import com.cool.store.vo.OpeningOperationPlanVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
/**
* @Auther: WangShuo
* @Date: 2024/04/25/下午6:35
* @Version 1.0
* @注释:
*/
@RestController
@RequestMapping("/pc/OpenPreparation")
@Api(tags = "pc开业筹备")
@Slf4j
public class OpenPreparationController {
@Resource
private CoolStoreStartFlowService coolStoreStartFlowService;
@Resource
private ShopStageInfoDAO shopStageInfoDAO;
@Resource
private FirstOrderService firstOrderService;
@Resource
private ShopService shopService;
@Resource
private PreparationService preparationService;
@Resource
private OpeningOperationPlanService openingOperationPlanService;
@Resource
private OpeningOperationPlanAuditService openingOperationPlanAuditService;
@GetMapping("/flush")
public ResponseResult flush(@RequestParam("shopId") Long shopId) {
ShopStageInfoDO planStageInfo = shopStageInfoDAO.getShopSubStageInfo(shopId, ShopSubStageEnum.SHOP_STAGE_14);
log.info("flush shopStageInfo:{}", planStageInfo);
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();
String data = coolStoreStartFlowService.getFirstOrder(shopCode).getData().toString();
log.info("saveOrder,data:{}", data);
if (data == null) {
throw new ServiceException(ErrorCodeEnum.GET_FIRST_ORDER);
}
if (data.equals("true")) {
//更改子阶段状态
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:{}", orderStageInfo);
OpenPreparationFlushVO flushVO = new OpenPreparationFlushVO();
flushVO.setShopId(shopId);
flushVO.setOpenPlanState(planStageInfo.getShopSubStageStatus());
flushVO.setFirstOderState(firstOrderStageInfo.getShopSubStageStatus());
return ResponseResult.success(flushVO);
}
@PostMapping("/openingOperationPlan/submit")
@ApiOperation("提交开业运营方案")
public ResponseResult submitPlan(@RequestBody OpeningOperationPlanRequest request) {
openingOperationPlanService.savePlan(request);
return ResponseResult.success();
}
@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);
}
@PostMapping("/openingOperationPlan/audit")
@ApiOperation("审核运营方案")
public ResponseResult auditPlan(@RequestBody OpeningOperationPlanAuditRequest request) {
openingOperationPlanAuditService.auditPlan(request);
return ResponseResult.success();
}
@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);
}
@PostMapping("/firstOrder/submit")
@ApiOperation("提交订货金")
public ResponseResult submit(@RequestBody FirstOrderRequest request) {
FirstOrderDO firstOrderDO = new FirstOrderDO();
try {
BeanUtils.copyProperties(firstOrderDO, request);
firstOrderService.saveOrder(firstOrderDO);
return ResponseResult.success();
} catch (IllegalAccessException | InvocationTargetException e) {
throw new RuntimeException(e);
}
}
}

View File

@@ -1,60 +0,0 @@
package com.cool.store.controller.webb;
import com.cool.store.mapper.OpeningOperationPlanMapper;
import com.cool.store.request.OpeningOperationPlanAuditRequest;
import com.cool.store.request.OpeningOperationPlanRequest;
import com.cool.store.request.PlanListRequest;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.OpeningOperationPlanAuditService;
import com.cool.store.service.OpeningOperationPlanService;
import com.cool.store.vo.OpeningOperationPlanListVO;
import com.cool.store.vo.OpeningOperationPlanVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* @Auther: WangShuo
* @Date: 2024/04/22/下午5:28
* @Version 1.0
* @注释:
*/
@RestController
@RequestMapping("pc/openingOperationPlan")
@Api(tags = "开业运营方案")
public class OpeningOperationPlanController {
@Resource
private OpeningOperationPlanService openingOperationPlanService;
@Resource
private OpeningOperationPlanAuditService openingOperationPlanAuditService;
@PostMapping("/submit")
@ApiOperation("提交开业运营方案")
public ResponseResult submitPlan(@RequestBody OpeningOperationPlanRequest request){
Long planId = openingOperationPlanService.savePlan(request);
return ResponseResult.success();
}
@GetMapping("/getPlan")
@ApiOperation("查询开业运营方案")
public ResponseResult<OpeningOperationPlanVO> getPlan(@RequestParam Long planId){
OpeningOperationPlanVO plan = openingOperationPlanService.getPlanById(planId);
return ResponseResult.success(plan);
}
@PostMapping("/audit")
@ApiOperation("审核运营方案")
public ResponseResult auditPlan(@RequestBody OpeningOperationPlanAuditRequest request){
openingOperationPlanAuditService.auditPlan(request);
return ResponseResult.success();
}
@GetMapping("/planList")
@ApiOperation("查询运营方案列表")
public ResponseResult<List<OpeningOperationPlanListVO>> planList(@RequestBody PlanListRequest request){
openingOperationPlanService.getPlanListPage(request);
return ResponseResult.success(openingOperationPlanService.getPlanListPage(request));
}
}

View File

@@ -0,0 +1,112 @@
package com.cool.store.controller.webc;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.dao.ShopStageInfoDAO;
import com.cool.store.dto.openPreparation.FirstOrderDTO;
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.response.ResponseResult;
import com.cool.store.service.*;
import com.cool.store.vo.OpenPreparationFlushVO;
import com.cool.store.vo.OpeningOperationPlanVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.Objects;
/**
* @Auther: WangShuo
* @Date: 2024/04/25/下午7:07
* @Version 1.0
* @注释:
*/
@RestController
@RequestMapping("/mini/OpenPreparation")
@Api(tags = "mini开业筹备")
@Slf4j
public class MiniOpenPreparationController {
@Resource
private OpeningOperationPlanService openingOperationPlanService;
@Resource
private OpeningOperationPlanAuditService openingOperationPlanAuditService;
@Resource
private CoolStoreStartFlowService coolStoreStartFlowService;
@Resource
private ShopStageInfoDAO shopStageInfoDAO;
@Resource
private FirstOrderService firstOrderService;
@Resource
private ShopService shopService;
@Resource
private PreparationService preparationService;
@GetMapping("/openingOperationPlan/getPlan")
@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())) {
return ResponseResult.success(plan);
} else {
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);
}
@GetMapping("/firstOrder/flush")
public ResponseResult 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();
String data = coolStoreStartFlowService.getFirstOrder(shopCode).getData().toString();
log.info("saveOrder,data:{}", data);
if (data == null) {
throw new ServiceException(ErrorCodeEnum.GET_FIRST_ORDER);
}
if (data.equals("true")) {
//更改子阶段状态
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);
OpenPreparationFlushVO flushVO = new OpenPreparationFlushVO();
flushVO.setShopId(shopId);
flushVO.setFirstOderState(firstOrderStageInfo.getShopSubStageStatus());
return ResponseResult.success(flushVO);
}
}

View File

@@ -1,39 +0,0 @@
package com.cool.store.controller.webc;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.OpeningOperationPlanAuditService;
import com.cool.store.service.OpeningOperationPlanService;
import com.cool.store.vo.OpeningOperationPlanVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* @Auther: WangShuo
* @Date: 2024/04/24/下午7:32
* @Version 1.0
* @注释:
*/
@RestController
@RequestMapping("/mini/openingOperationPlan")
@Api(tags = "开业运营方案操作")
@Slf4j
public class MiniOpeningOperationPlanController {
@Resource
private OpeningOperationPlanService openingOperationPlanService;
@Resource
private OpeningOperationPlanAuditService openingOperationPlanAuditService;
@GetMapping("/getPlan")
@ApiOperation("查询开业运营方案")
public ResponseResult<OpeningOperationPlanVO> getPlan(@RequestParam Long planId){
OpeningOperationPlanVO plan = openingOperationPlanService.getPlanById(planId);
return ResponseResult.success(plan);
}
}

View File

@@ -1,23 +1,29 @@
package com.cool.store.job;
import com.cool.store.dao.LineInfoDAO;
import com.cool.store.dao.LineInterviewDAO;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.dao.*;
import com.cool.store.dto.openPreparation.OpenPlanShopInfoDTO;
import com.cool.store.entity.LeaseBaseInfoDO;
import com.cool.store.entity.LineInterviewDO;
import com.cool.store.enums.InterviewStatusEnum;
import com.cool.store.enums.WorkflowStageEnum;
import com.cool.store.enums.WorkflowSubStageEnum;
import com.cool.store.enums.WorkflowSubStageStatusEnum;
import com.cool.store.enums.*;
import com.cool.store.enums.point.ShopSubStageStatusEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.mapper.LineInfoMapper;
import com.cool.store.mapper.TrainingExperienceMapper;
import com.cool.store.mq.util.HttpRestTemplateService;
import com.cool.store.service.PreparationService;
import com.cool.store.utils.poi.constant.Constants;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Slf4j
@@ -27,15 +33,24 @@ public class XxlJobHandler {
@Resource
TrainingExperienceMapper trainingExperienceMapper;
@Value("${xfsg.url}")
private String xfsgUrl;
@Resource
private HttpRestTemplateService httpRestTemplateService;
@Resource
LineInfoMapper lineInfoMapper;
@Resource
private PreparationService preparationService;
@Resource
private LineInterviewDAO lineInterviewDAO;
@Resource
private LineInfoDAO lineInfoDAO;
@Resource
private ShopInfoDAO shopInfoDAO;
@Resource
private ShopStageInfoDAO shopStageInfoDAO;
@Resource
private OpeningOperationPlanAuditDAO openingOperationPlanAuditDAO;
/**
* 每天都将待体验门店信息变更到体验中
*/
@@ -72,4 +87,41 @@ public class XxlJobHandler {
lineInterviewDAO.batchUpdateInterviewStatus(interviewIds, InterviewStatusEnum.WAIT_AUDIT);
XxlJobHelper.handleSuccess();
}
/**
* @Auther: wangshuo
* @Date: 2024/4/25
* @description:每天查询更新订货金
*/
@XxlJob("updateFirstOrder")
public void updateFirstOrder() {
log.info("----查询更新订货金----");
List<Long> shopIdListByStage = shopInfoDAO.queryShopIdListByStage();
if (CollectionUtils.isEmpty(shopIdListByStage)) {
log.info("------今日没有待更新数据------");
return;
}
List<Long> shopIdListByStageStatus = shopStageInfoDAO.getShopIdListByStageStatus(shopIdListByStage);
List<OpenPlanShopInfoDTO> openPlanShopInfoDTOS = shopInfoDAO.queryShopCodeListByid(shopIdListByStageStatus);
Map<Long, String> map = openPlanShopInfoDTOS.stream().
collect(Collectors.toMap(OpenPlanShopInfoDTO::getShopId, OpenPlanShopInfoDTO::getShopCode));
for (Long shopId : map.keySet()){
String shopCode = map.get(shopId);
try {
String url = xfsgUrl + Constants.FIRST_ORDER + "?storeCode=" + shopCode;
JSONObject jsonObject = httpRestTemplateService.getForObject(url, JSONObject.class, new HashMap<>());
log.info("updateFirstOrder url:{},jsonObject:{}",url,jsonObject);
String string = jsonObject.getString("data");
if (string == null) {
throw new ServiceException(ErrorCodeEnum.GET_FIRST_ORDER);
}
if (string.equals("true")) {
shopStageInfoDAO.updateShopStageAndAuditInfo(shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_151, null);
preparationService.whetherToOpenForAcceptance(shopId);
}
}catch (Exception e) {
log.error("获取鲜丰订货金异常",e);
}
}
}
}

View File

@@ -1,5 +1,5 @@
spring.application.name=hsay-partner-web
spring.profiles.active=@profileActive@
spring.profiles.active=test
server.port=40000
server.servlet.context-path=/xfsg