开业运营方案
This commit is contained in:
@@ -176,8 +176,8 @@ public enum ErrorCodeEnum {
|
|||||||
UPDATE_PLAN_FALSE(103008,"修改PLAN失败",null),
|
UPDATE_PLAN_FALSE(103008,"修改PLAN失败",null),
|
||||||
UPDATE_SHOP_SUB_STAGE_STATUS_FALSE(103009,"修改开业运营方案阶段状态失败",null),
|
UPDATE_SHOP_SUB_STAGE_STATUS_FALSE(103009,"修改开业运营方案阶段状态失败",null),
|
||||||
SHOP_ID_NOT_EXIST(103010,"shopId不存在",null),
|
SHOP_ID_NOT_EXIST(103010,"shopId不存在",null),
|
||||||
FIRST_ORDER_PARAM_NULL(103020,"首批订货金参数为空",null)
|
FIRST_ORDER_PARAM_NULL(103020,"首批订货金参数为空",null),
|
||||||
|
XFSG_SERVICE_ERROR(103099,"鲜丰服务调用失败",null),
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,18 @@ public interface CoolStoreStartFlowService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ResponseResult franchiseAgreement(FranchiseAgreementRequest request,Integer type);
|
ResponseResult franchiseAgreement(FranchiseAgreementRequest request,Integer type);
|
||||||
|
/**
|
||||||
|
* @Auther: wangshuo
|
||||||
|
* @Date: 2024/4/25
|
||||||
|
* @description:项目列表
|
||||||
|
*/
|
||||||
|
ResponseResult getProjectList(Long shopId);
|
||||||
|
/**
|
||||||
|
* @Auther: wangshuo
|
||||||
|
* @Date: 2024/4/25
|
||||||
|
* @description:项目详情
|
||||||
|
* @Param projectId:项目主键,clientCode:客户编号,pCode:项目编号
|
||||||
|
*/
|
||||||
|
ResponseResult getStoreDetail(Long projectId,String clientCode,String pCode);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,6 +74,57 @@ public class CoolStoreStartFlowServiceImpl implements CoolStoreStartFlowService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseResult getProjectList(Long shopId) {
|
||||||
|
log.info("getProjectList param:{}", shopId);
|
||||||
|
if (Objects.isNull(shopId)) {
|
||||||
|
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
|
||||||
|
}
|
||||||
|
String url = String.format(Constants.GET_PROJECT_LIST, shopId);
|
||||||
|
log.info("CoolStoreStartFlowServiceImpl#getOrder, url:{}",url);
|
||||||
|
try {
|
||||||
|
JSONObject jsonObject = httpRestTemplateService.getForObject(url, JSONObject.class, new HashMap<>());
|
||||||
|
log.info("CoolStoreStartFlowServiceImpl#getOrder,jsonObject:{}",jsonObject.toJSONString());
|
||||||
|
if (jsonObject.get("status").equals(Constants.SUCCESS)) {
|
||||||
|
return new ResponseResult(200,jsonObject.get("data").toString(),jsonObject.get("msg").toString());
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
return new ResponseResult(500,jsonObject.get("msg").toString());
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
log.info("调用鲜丰服务异常,getProjectList error:{}",e);
|
||||||
|
throw new ServiceException(ErrorCodeEnum.XFSG_SERVICE_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseResult getStoreDetail(Long projectId, String clientCode, String pCode) {
|
||||||
|
log.info("getStoreList projectId:{},clientCode:{},pCode:{}", projectId,clientCode,pCode);
|
||||||
|
if (Objects.isNull(projectId)&&Objects.isNull(clientCode)&&Objects.isNull(pCode)) {
|
||||||
|
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
|
||||||
|
}
|
||||||
|
HashMap requestMap = new HashMap();
|
||||||
|
requestMap.put("projectId", projectId);
|
||||||
|
requestMap.put("clientCode", clientCode);
|
||||||
|
requestMap.put("pCode", pCode);
|
||||||
|
try {
|
||||||
|
JSONObject jsonObject = httpRestTemplateService.getForObject(Constants.GET_PROJECT_DETAIL, JSONObject.class, requestMap);
|
||||||
|
log.info("FirstOrderServiceImp#getStoreDetail, jsonObject:{}",jsonObject.toJSONString());
|
||||||
|
if (jsonObject.get("status").equals(Constants.SUCCESS)) {
|
||||||
|
return new ResponseResult(200,jsonObject.get("data").toString(),jsonObject.get("msg").toString());
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
return new ResponseResult(500,jsonObject.get("msg").toString());
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
log.info("调用鲜丰服务异常,getProjectList error:{}",e);
|
||||||
|
throw new ServiceException(ErrorCodeEnum.XFSG_SERVICE_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void fillSignatureInfo(Map<String, Object> requestMap) {
|
private void fillSignatureInfo(Map<String, Object> requestMap) {
|
||||||
long timestamp = System.currentTimeMillis();
|
long timestamp = System.currentTimeMillis();
|
||||||
String signature = SecureUtil.getSignature(timestamp);
|
String signature = SecureUtil.getSignature(timestamp);
|
||||||
|
|||||||
@@ -6,13 +6,18 @@ import com.cool.store.dto.openPreparation.FirstOrderDTO;
|
|||||||
import com.cool.store.entity.FirstOrderDO;
|
import com.cool.store.entity.FirstOrderDO;
|
||||||
import com.cool.store.enums.ErrorCodeEnum;
|
import com.cool.store.enums.ErrorCodeEnum;
|
||||||
import com.cool.store.exception.ServiceException;
|
import com.cool.store.exception.ServiceException;
|
||||||
|
import com.cool.store.response.ResponseResult;
|
||||||
|
import com.cool.store.service.CoolStoreStartFlowService;
|
||||||
import com.cool.store.service.FirstOrderService;
|
import com.cool.store.service.FirstOrderService;
|
||||||
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Auther: WangShuo
|
* @Auther: WangShuo
|
||||||
* @Date: 2024/04/24/下午8:53
|
* @Date: 2024/04/24/下午8:53
|
||||||
@@ -24,6 +29,8 @@ import java.util.Date;
|
|||||||
public class FirstOrderServiceImp implements FirstOrderService {
|
public class FirstOrderServiceImp implements FirstOrderService {
|
||||||
@Resource
|
@Resource
|
||||||
private FirstOrderDAO firstOrderDAO;
|
private FirstOrderDAO firstOrderDAO;
|
||||||
|
@Resource
|
||||||
|
CoolStoreStartFlowService coolStoreStartFlowService;
|
||||||
@Override
|
@Override
|
||||||
public Integer saveOrder(FirstOrderDO order) {
|
public Integer saveOrder(FirstOrderDO order) {
|
||||||
String userId = CurrentUserHolder.getUserId();
|
String userId = CurrentUserHolder.getUserId();
|
||||||
@@ -41,8 +48,33 @@ public class FirstOrderServiceImp implements FirstOrderService {
|
|||||||
order.setUpdateTime(new Date());
|
order.setUpdateTime(new Date());
|
||||||
order.setUpdateUserId(userId);
|
order.setUpdateUserId(userId);
|
||||||
}
|
}
|
||||||
firstOrderDAO.insertFirstOrder(order);
|
ResponseResult projectList = coolStoreStartFlowService.getProjectList(order.getShopId());
|
||||||
return 0;
|
String data = projectList.getData().toString();
|
||||||
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
|
try {
|
||||||
|
JsonNode rootNode = mapper.readTree(data);
|
||||||
|
ArrayNode rowsNode = (ArrayNode) rootNode.get("rows");
|
||||||
|
Long projectId;
|
||||||
|
String clientCode;
|
||||||
|
String pCode;
|
||||||
|
for (JsonNode rowNode : rowsNode) {
|
||||||
|
//todo
|
||||||
|
if ()
|
||||||
|
{ projectId = rowNode.get("projectId").asLong();
|
||||||
|
clientCode = rowNode.get("clientCode").asText();
|
||||||
|
pCode = rowNode.get(" pCode").asText();
|
||||||
|
ResponseResult storeDetail = coolStoreStartFlowService.getStoreDetail(projectId, clientCode, pCode);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.info("saveOrder,error:{}",e.getMessage());
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
Integer result = firstOrderDAO.insertFirstOrder(order);
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -53,6 +85,5 @@ public class FirstOrderServiceImp implements FirstOrderService {
|
|||||||
throw new ServiceException(ErrorCodeEnum.FIRST_ORDER_PARAM_NULL);
|
throw new ServiceException(ErrorCodeEnum.FIRST_ORDER_PARAM_NULL);
|
||||||
}
|
}
|
||||||
return firstOrderDAO.selectFirstOrderByShopId(shopId);
|
return firstOrderDAO.selectFirstOrderByShopId(shopId);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -188,9 +188,8 @@ public class Constants
|
|||||||
|
|
||||||
public static final String TIME_STAMP_FLAG = "yyyy-MM-dd";
|
public static final String TIME_STAMP_FLAG = "yyyy-MM-dd";
|
||||||
|
|
||||||
|
public static final String GET_PROJECT_LIST = "https://hzly.cloudcubic.net/ajaxHandle/synchronization/JCallBackSynchronizationHandler.ashx?action=app&controller=GetProjectByCustomLable&remark=%s";
|
||||||
|
public static final String GET_PROJECT_DETAIL= "https://hzly.cloudcubic.net/ajaxHandle/synchronization/JCallBackSynchronizationHandler.ashx?action=app&controller=GetProjectDetails";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
package com.cool.store.controller.webb;
|
package com.cool.store.controller.webb;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
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.mq.util.HttpRestTemplateService;
|
||||||
import com.cool.store.request.FirstOrderRequest;
|
import com.cool.store.request.FirstOrderRequest;
|
||||||
import com.cool.store.response.ResponseResult;
|
import com.cool.store.response.ResponseResult;
|
||||||
import com.cool.store.service.FirstOrderService;
|
import com.cool.store.service.FirstOrderService;
|
||||||
|
import com.cool.store.utils.poi.constant.Constants;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.beanutils.BeanUtils;
|
import org.apache.commons.beanutils.BeanUtils;
|
||||||
@@ -12,6 +15,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Auther: WangShuo
|
* @Auther: WangShuo
|
||||||
|
|||||||
Reference in New Issue
Block a user