开业筹备阶段4.0
This commit is contained in:
@@ -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()));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user