1. 平台简介
一个全新覆盖全行业,以直播、短视频带货,商家实体VR全景体验,多营销模式,分销分佣,多商家入驻,多端支持的大型新零售电商平台。
2. 平台清单
系统管理平台 + 商家端(PC+手机) + 消费端微服务 + 消费端(小程序/APP/公众号/H5) + 消息提醒
3. 平台模式
B2B2C多商家入驻通用版本: 标准多商户入驻+二级分销体系+满减、满送、优惠券、组合销售、平台礼包等营销活动)
B2B2C多商家入驻直播/短视频带货版本: 标准多商户入驻+直播、短视频带货+二级分销体系+满减、满送、优惠券、组合销售、平台礼包等营销活动
B2B2C多商家入驻VR全景版本: 标准多商户入驻+二级分销体系+满减、满送、优惠券、组合销售、平台礼包等营销活动)
4. 涉及营销方案
一、一县一特(一个县城,一个特色,集本地特产、特色、名胜、小吃、文化为一体的营销方案)
二、短距离配送(外卖、生鲜水果配送,解决1.5公里配送问题,接入第三方代跑腿服务)
三、酒店行业(酒店商家入驻,根据定位,可针对附近酒店,不同城酒店进行线上预定、下线核销等,参考去哪儿网酒店业务)
四、VR全景(商家入驻后,可以进行VR全景拍摄,VR店铺体验,全新购物方式,通过虚拟现实技术,线上线下打通,实现全新O2O,深度场景体验,感受另一个大千世界,让用户足不出户完美购物。通过VR让您的店铺曝光率更高,让天下没有难销的商品)
五、线下套餐体验(针对于实体行业,用户线上消费后生成核销码,用户到实体店铺体验套餐,可凭借核销码进行体验项目)
六、旅游业(周边游、本地游、异地游等,旅游景区和VR全景结合,用户足不出户先感受一下旅游项目、旅游攻略等,可线上订票、预定等)
七、供应求购(简易供应链供应、求购模式)
八、社交资讯(用户发布文章,可进行带货)
九、社交动态(个人信息、动态、视频,如:文字+图片、文字+视频,可进行带货;粉丝、关注、分享等)
十、异业联盟(不同行业的联盟销售,如:在某餐饮店面消费后可送附近健身卡优惠券,凭借优惠券可进行线下体验)
十一、一键代发营销(商家选择平台商品后放入自己店面销售,用户购买后商家可获取特殊分润提成,商家不需要发货,由平台厂家直接发货,并支持本店面自提)
十二、秒杀(通用方案)
十三、拼团(仿拼多多)
十四、限时折扣(通用方案,在活动时间范围内会员享受折扣价格)
十五、积分商城(纯积分兑换、积分+现金兑换)
十六、限时折扣(通用方案,在活动时间范围内会员享受折扣价格)
十七、活动商品(平台发布活动商品,如:可以进行0元领取,领取需要进行用户拉新,拉新后可进行现金奖励等)
5. 使用技术
开发工具:Idea、Eclipse
WEB容器:Tomcat、Jboss、Weblogic、webSphere
JDK版本:1.8+
系统支持:Docker、Window、Linux
数据库/数据源:MySQL、Alibaba Druid
服务框架:Spring Cloud、Spring Boot2、Mybatis、前后端分离、分布式、微服务
分布式中间件:RabbitMQ、Redis、ElasticSearch、OSS
前端架构:VUE、Uniapp、H5、CSS3
构建方式:Maven、Jenkins
涉及技术:Eureka、Config、Zuul、OAuth2、Security、OSS、Turbine、Zipkin、Feign、Monitor、Stream、ElasticSearch、Redis、RabbitMQ等
支持终端:小程序、APP(IOS/Android)、公众号、H5
6. 架构设计&思想
分布式、微服务、云架构、模块化、服务化、原子化、持续集成、中间件集成、云服务集成
7. 技术架构图
8. 微服务清单
honghu-activity:活动、honghu-advert:广告、honghu-brand: 品牌
honghu-cms: 内容发布、honghu-collect: 我的收藏、honghu-common: 系统通用服务
honghu-coupon: 优惠券、honghu-distribution: 分销、honghu-file: 文件
honghu-free: 试用、honghu-goodsc-lass: 商品分类、honghu-goods: 商品
honghu-group: 团购、honghu-home: 首页、honghu-integral: 积分商城
honghu-member: 会员、honghu-message: 消息、honghu-operate: 运营
honghu-order: 订单、honghu-pay: 支付、honghu-pin: 拼团
honghu-search: 搜索、honghu-social: 社交电商
honghu-sso: 单点登录、honghu-store: 店铺
@源码地址来源: https://minglisoft.cn/honghu/business.html
8. 演示截图
9. 相关源码
@源码地址来源: https://minglisoft.cn/honghu/business.html
package com.honghu.cloud.controller;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONException;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.honghu.cloud.bean.DaDaAppConfig;
import com.honghu.cloud.bean.DaDaService;
import com.honghu.cloud.bean.DadaApiResponse;
import com.honghu.cloud.bean.ShopAddModel;
import com.honghu.cloud.bean.Store;
import com.honghu.cloud.code.ResponseCode;
import com.honghu.cloud.dto.AreaDto;
import com.honghu.cloud.dto.CouponInfoDto;
import com.honghu.cloud.dto.EvaluateDto;
import com.honghu.cloud.dto.ExpressCompanyCommonDto;
import com.honghu.cloud.dto.ExpressCompanyDto;
import com.honghu.cloud.dto.ExpressInfoDto;
import com.honghu.cloud.dto.GoodsDto;
import com.honghu.cloud.dto.MessageDto;
import com.honghu.cloud.dto.OrderFormDto;
import com.honghu.cloud.dto.OrderFormLogDto;
import com.honghu.cloud.dto.RefundApplyFormDto;
import com.honghu.cloud.dto.ReturnGoodsLogDto;
import com.honghu.cloud.dto.ShipAddressDto;
import com.honghu.cloud.dto.SysConfigDto;
import com.honghu.cloud.dto.TransInfoDto;
import com.honghu.cloud.dto.UserDto;
import com.honghu.cloud.feign.AreaFeignClient;
import com.honghu.cloud.feign.CouponInfoFeignClient;
import com.honghu.cloud.feign.EvaluateFeignClient;
import com.honghu.cloud.feign.ExpressCompanyCommonFeignClient;
import com.honghu.cloud.feign.ExpressCompanyFeignClient;
import com.honghu.cloud.feign.ExpressInfoFeignClient;
import com.honghu.cloud.feign.GoodsFeignClient;
import com.honghu.cloud.feign.MessageFeignClient;
import com.honghu.cloud.feign.ModularClassFeignClient;
import com.honghu.cloud.feign.MsgToolsFeignClient;
import com.honghu.cloud.feign.OrderFormFeignClient;
import com.honghu.cloud.feign.OrderFormLogFeignClient;
import com.honghu.cloud.feign.OrderFormToolsFeignClient;
import com.honghu.cloud.feign.RefundApplyFormFeignClient;
import com.honghu.cloud.feign.ReturnGoodsLogFeignClient;
import com.honghu.cloud.feign.ShipAddressFeignClient;
import com.honghu.cloud.feign.ShipToolsFeignClient;
import com.honghu.cloud.feign.SysConfigFeignClient;
import com.honghu.cloud.feign.UserFeignClient;
import com.honghu.cloud.service.IStoreService;
import com.honghu.cloud.tools.DadaRequestClient;
import com.honghu.cloud.tools.JSONUtil;
import com.honghu.cloud.tools.QueryTools;
import com.honghu.cloud.tools.SecurityUserHolder;
import com.honghu.cloud.utils.CommUtil;
import com.honghu.cloud.utils.StringUtils;
import com.honghu.cloud.utils.tools.Md5Encrypt;
import lombok.extern.slf4j.Slf4j;
import net.sf.json.JSONObject;
@CrossOrigin(origins = "*", maxAge = 3600)
@Slf4j
@RestController
@RequestMapping(value = "/applet/storeOrder")
public class AppletStoreOrderController {
private final Logger logger = LoggerFactory.getLogger(AppletStoreOrderController.class);
@Autowired
private IStoreService storeService;
@Autowired
private OrderFormFeignClient orderFormFeignClient;
@Autowired
private UserFeignClient userFeignClient;
@Autowired
private GoodsFeignClient goodsFeignClient;
@Autowired
private QueryTools queryTools;
@Autowired
private RefundApplyFormFeignClient refundapplyformfeignclient;
@Autowired
private MessageFeignClient messagefeignclient;
@Autowired
private ReturnGoodsLogFeignClient returnGoodsLogFeignClient;
@Autowired
private ShipToolsFeignClient shipToolsFeignClient;
@Autowired
private OrderFormToolsFeignClient orderFormToolsFeignClient;
@Autowired
private OrderFormLogFeignClient orderFormLogFeignClient;
@Autowired
private MsgToolsFeignClient msgToolsFeignClient;
@Autowired
private ExpressCompanyCommonFeignClient companyCommonFeignClient;
@Autowired
private ShipAddressFeignClient shipAddressFeignClient;
@Autowired
private SysConfigFeignClient sysConfigFeignClient;
@Autowired
private ExpressInfoFeignClient expressInfoFeignClient;
@Autowired
private EvaluateFeignClient evaluateFeignClient;
@Autowired
private ExpressCompanyFeignClient expressCompanyFeignClient;
@Autowired
private ExpressCompanyCommonFeignClient expressCompanyCommonFeignClient;
@Autowired
private AreaFeignClient areaFeignClient;
@Autowired
private ModularClassFeignClient modularClassFeignClient;
@Autowired
private CouponInfoFeignClient couponInfoFeignClient;
/**
* 卖家订单列表
* @param request
* @param response
* @param currentPage
* @param order_status
* @param order_id
* @param beginTime
* @param endTime
* @param buyer_userName
* @return
*/
@RequestMapping( value = { "/order" } , method = RequestMethod.POST)
public Map<String,Object> order(HttpServletRequest request,
@RequestBody JSONObject json) {
String currentPage = json.optString("currentPage");
String order_status = json.optString("order_status");
String order_id = json.optString("order_id");
/*String beginTime = json.optString("beginTime");
String endTime = json.optString("endTime");*/
String order_id_userName = json.optString("order_id_userName");
Map<String,Object> maps= this.queryTools.getParams(currentPage,"addTime", "desc");
UserDto user = this.userFeignClient.selectByPrimaryKey(SecurityUserHolder.getCurrentUser(request).getId());
if(user == null){
return ResponseCode.buildReturnMap(ResponseCode.USER_DOES_NOT_EXIST, null);
}
if (user.getParent_id()!=null) {
user = this.userFeignClient.selectByPrimaryKey(user.getParent_id());
}
if(user.getStore_id() == null){
return ResponseCode.buildReturnMap(ResponseCode.FAILURE, null);
}
Store store = this.storeService.selectByPrimaryKey(CommUtil.null2Long(user
.getStore_id()));
if(store != null){
maps.put("store_id", store.getId());
}else{
return ResponseCode.buildReturnMap(ResponseCode.NOTSTORE, null);
}
/* maps.put("order_cat_no", 2);
*/ Map<String, Object> map = Maps.newHashMap();
if (!CommUtil.null2String(order_status).equals("")) {
if (order_status.equals("order_submit")) {//代付款
maps.put("order_status1", Integer.valueOf(10));
maps.put("order_status2", Integer.valueOf(16));
}
if (order_status.equals("order_pay")) { //代发货
maps.put("order_status1", Integer.valueOf(20));
maps.put("order_status2", Integer.valueOf(14));
}
if (order_status.equals("order_shipping")) {//待收货 已发货
//maps.put("order_status", Integer.valueOf(30));
maps.put("order_status_0", Integer.valueOf(30));
maps.put("order_status_1", Integer.valueOf(31));
maps.put("order_status_2", Integer.valueOf(32));
}
if (order_status.equals("order_evaluate")) {// 已收货 待评价
maps.put("order_status", Integer.valueOf(40));
}
if (order_status.equals("order_finish")) { //评论完
maps.put("order_status", Integer.valueOf(50));
}
if (order_status.equals("order_cancel")) {//订单取消
maps.put("order_status", Integer.valueOf(0));
}
if (order_status.equals("order_refund")) {//退款中
maps.put("order_status", Integer.valueOf(21));
}
}
if (!CommUtil.null2String(order_id).equals("")) {
maps.put("order_id_like", order_id);
}
/*if (!CommUtil.null2String(beginTime).equals("")) {
maps.put("add_Time_more_than_equal", CommUtil.formatDate(beginTime));
map.put("beginTime", beginTime);
}
if (!CommUtil.null2String(endTime).equals("")) {
String ends = endTime + " 23:59:59";
maps.put("add_Time_less_than_equal", CommUtil.formatDate(ends,"yyyy-MM-dd hh:mm:ss"));
map.put("endTime", endTime);
}*/
if (!CommUtil.null2String(order_id_userName).equals("")) {
maps.put("order_id_userName", order_id_userName);
}
Map<String, Object> list = this.orderFormFeignClient.list(maps);
map.putAll(list);
/*map.put("list", list);*/
map.put("order_id", order_id);
map.put("order_status", order_status == null ? "all" : order_status);
return ResponseCode.buildSuccessMap(map);
}
/**
* 卖家订单
* @param request
* @param response
* @param currentPage
* @param order_status
* @param order_id
* @param beginTime
* @param endTime
* @param buyer_userName
* @return
*/
@RequestMapping( value = { "/orderHome" } , method = RequestMethod.POST)
public Map<String,Object> orderHome(HttpServletRequest request) {
UserDto user = this.userFeignClient.selectByPrimaryKey(SecurityUserHolder.getCurrentUser(request).getId());
if(user == null){
return ResponseCode.buildReturnMap(ResponseCode.USER_DOES_NOT_EXIST, null);
}
if (user.getParent_id()!=null) {
user = this.userFeignClient.selectByPrimaryKey(user.getParent_id());
}
if(user.getStore_id() == null){
return ResponseCode.buildReturnMap(ResponseCode.NOTSTORE, null);
}
Store store = this.storeService.selectByPrimaryKey(CommUtil.null2Long(user
.getStore_id()));
if(store == null){
return ResponseCode.buildReturnMap(ResponseCode.NOTSTORE, null);
}
Map<String, Object> map = Maps.newHashMap();
map.put("store_id", store.getId());
//代付款1
map.put("order_status1", Integer.valueOf(10));
map.put("order_status2", Integer.valueOf(16));
Integer order_submit = this.orderFormFeignClient.selectCount(map);
//代发货1
map.clear();
map.put("store_id", store.getId());
map.put("order_status", Integer.valueOf(20));
Integer order_pay = this.orderFormFeignClient.selectCount(map);
//待收货 已发货 1
map.clear();
map.put("store_id", store.getId());
map.put("order_status", Integer.valueOf(30));
Integer order_shipping = this.orderFormFeignClient.selectCount(map);
// 已收货 待评价1
map.clear();
map.put("store_id", store.getId());
map.put("order_status", Integer.valueOf(40));
Integer order_evaluate = this.orderFormFeignClient.selectCount(map);
//退款中1
map.clear();
map.put("store_id", store.getId());
map.put("refundStatus", 1);
Integer order_refund = this.orderFormFeignClient.selectCount(map);
map.put("selectCount_refund", order_refund);
map.clear();
map.put("store_id", user.getStore_id());
int selectCount = this.returnGoodsLogFeignClient.selectCount(map);
if(order_refund == null){
order_refund = 0;
}
order_refund = order_refund + selectCount;
map.clear();
map.put("order_submit", order_submit);
map.put("order_pay", order_pay);
map.put("order_shipping", order_shipping);
map.put("order_evaluate", order_evaluate);
map.put("order_refund", order_refund);
return ResponseCode.buildSuccessMap(map);
}
/**订单详情
* @param request
* @param json
* @return
*/
@RequestMapping(value = { "/order_view" } , method = RequestMethod.POST)
public Map<String , Object> order_view(HttpServletRequest request,
@RequestBody JSONObject json) {
String id = json.optString("id");
OrderFormDto obj = this.orderFormFeignClient
.selectByPrimaryKey(CommUtil.null2Long(id));
UserDto user = this.userFeignClient.selectByPrimaryKey(SecurityUserHolder
.getCurrentUser(request).getId());
if(user == null){
return ResponseCode.buildReturnMap(ResponseCode.USER_DOES_NOT_EXIST, null);
}
if (user.getParent_id()!=null) {
user = this.userFeignClient.selectByPrimaryKey(user.getParent_id());
}
Store store = this.storeService.selectByPrimaryKey(CommUtil.null2Long(obj
.getStore_id()));
if(store == null){
return ResponseCode.buildReturnMap(ResponseCode.NOTSTORE, null);
}
if(user.getStore_id() == null){
return ResponseCode.buildReturnMap(ResponseCode.FAILURE, null);
}
if (user.getStore_id().equals(store.getId())) {
Map<String , Object> maps = Maps.newHashMap();
if(obj.getOrder_status() == 10){
SysConfigDto sys = this.sysConfigFeignClient.getSysConfig();
Integer auto_order_cancel = sys.getAuto_order_cancel();
Date addTime = obj.getAddTime();
Date date = new Date();
/*System.out.println(((addTime.getTime() - date.getTime()) / (24 * 60 * 60 * 1000))/ 365 + "年");
System.out.println((addTime.getTime() - date.getTime()) / (24 * 60 * 60 * 1000) + "天");
System.out.println((((addTime.getTime() - date.getTime()) / (60 * 60 * 1000)) % 24) + "小时");
System.out.println((((addTime.getTime() - date.getTime()) / 1000) % 60) + "分钟");
System.out.println(((addTime.getTime() - date.getTime()) / (60 * 1000)) % 60 + "秒");*/
maps.put("obj", obj);
maps.put("second", (((addTime.getTime() - date.getTime()) / 1000)) + auto_order_cancel*60*60);
}
maps.put("obj", obj);
return ResponseCode.buildSuccessMap(maps);
} else {
return ResponseCode.buildEnumMap(ResponseCode.FAILURE, null);
}
}
/**
* 卖家取消订单
* @param request
* @param response
* @param id
* @param currentPage
* @return
*/
@RequestMapping(value ={ "/order_cancel" } ,method = RequestMethod.POST)
public Map<String , Object> order_cancel(HttpServletRequest request , @RequestBody JSONObject jsonv) {
String id = jsonv.optString("id");
if (SecurityUserHolder.getCurrentUserId(request)==null) {
return ResponseCode.buildCodeMap("1111", "userid为空", null);
}
UserDto seller = this.userFeignClient.selectByPrimaryKey(SecurityUserHolder.getCurrentUser(request).getId());
OrderFormDto obj = this.orderFormFeignClient.selectByPrimaryKey(CommUtil.null2Long(id));
if(seller == null){
return ResponseCode.buildReturnMap(ResponseCode.USER_DOES_NOT_EXIST, null);
}
if (seller.getParent_id()!=null) {
seller = this.userFeignClient.selectByPrimaryKey(seller.getParent_id());
}
//user = user.getParent_id() == null ? user : user.getParent();
if(seller.getStore_id() == null){
return ResponseCode.buildReturnMap(ResponseCode.FAILURE, null);
}
//System.out.println("---------user--getStore_id-------------"+seller
//.getStore_id());
Store store = this.storeService.selectByPrimaryKey(seller
.getStore_id());
//System.out.println("---------user---------------"+seller.getId());
//System.out.println("------------obj-------------"+obj.getId());
//System.out.println("---------seller---------------"+seller.getStore_id());
if(store == null){
return ResponseCode.buildReturnMap(ResponseCode.NOTSTORE, null);
}
System.out.println("-----------store--------------"+store.getId());
if ((seller.getStore_id() != null)&& (CommUtil.null2String(obj.getStore_id()).equals(seller.getStore_id().toString()))) {
return ResponseCode.buildSuccessMap(obj);
} else {
return ResponseCode.buildReturnMap(ResponseCode.NOTSTORE, null);
}
}
/**
* 卖家取消订单保存
* @param request
* @param response
* @param id
* @param currentPage
* @return
*/
@RequestMapping(value ={ "/order_cancel_save" } ,method = RequestMethod.POST)
public Map<String , Object> order_cancel_save(HttpServletRequest request , @RequestBody JSONObject jsonv) {
String id = jsonv.optString("id");
String state_info = jsonv.optString("state_info");
String other_state_info = jsonv.optString("other_state_info");
UserDto seller = this.userFeignClient.selectByPrimaryKey(SecurityUserHolder.getCurrentUser(request).getId());
OrderFormDto obj = this.orderFormFeignClient.selectByPrimaryKey(CommUtil.null2Long(id));
if(seller == null){
return ResponseCode.buildReturnMap(ResponseCode.USER_DOES_NOT_EXIST, null);
}
if (seller.getParent_id()!=null) {
seller = this.userFeignClient.selectByPrimaryKey(seller.getParent_id());
}
//user = user.getParent_id() == null ? user : user.getParent();
if(seller.getStore_id() == null){
return ResponseCode.buildReturnMap(ResponseCode.FAILURE, null);
}
Store store = this.storeService.selectByPrimaryKey(CommUtil.null2Long(seller
.getStore_id()));
if(store == null){
return ResponseCode.buildReturnMap(ResponseCode.NOTSTORE, null);
}
Date nowDate = new Date();
if ((seller.getStore_id() != null)&& (CommUtil.null2String(obj.getStore_id()).equals(seller.getStore_id().toString()))) {
obj.setOrder_status(0);
if ((obj.getCoupon_info() != null)
&& (!"".equals(obj.getCoupon_info()))) {
Map m = JSON.parseObject(obj.getCoupon_info());
CouponInfoDto cpInfo = this.couponInfoFeignClient.selectByPrimaryKey(CommUtil
.null2Long(m.get("couponinfo_id")));
if (cpInfo != null) {
if (nowDate.before(cpInfo.getEndDate())) {
cpInfo.setStatus(0);
} else {
cpInfo.setStatus(-1);
}
}
}
orderFormFeignClient.updateById(obj);
OrderFormLogDto ofl = new OrderFormLogDto();
ofl.setAddTime(new Date());
ofl.setLog_info("取消订单");
ofl.setLog_user_id(seller.getId());
ofl.setLog_user_name(seller.getUserName());
ofl.setOf_id(obj.getId());
if (state_info.equals("其他原因")) {
ofl.setState_info(other_state_info);
} else {
ofl.setState_info(state_info);
}
this.orderFormLogFeignClient.saveEntity(ofl);
/* UserDto buyer = this.userFeignClient.selectByPrimaryKey(CommUtil.null2Long(obj
.getUser_id()));
Map<String, Object> map = Maps.newHashMap();
map.put("buyer_id", buyer.getId().toString());
map.put("seller_id", store.getUser_id());
map.put("order_id", obj.getId());
String json = JSON.toJSONString(map);*/
/*if (obj.getOrder_form() == 0) {
try {
this.msgToolsFeignClient.sendEmailCharge(CommUtil.getURL(request),
"email_tobuyer_order_cancel_notify", buyer.getEmail(),
json, null, obj.getStore_id());
this.msgToolsFeignClient.sendSmsCharge(CommUtil.getURL(request),
"sms_tobuyer_order_cancel_notify", buyer.getMobile(),
json, null, obj.getStore_id());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} else {
try {
this.msgToolsFeignClient.sendEmailFree(CommUtil.getURL(request),
"email_tobuyer_order_cancel_notify", buyer.getEmail(),
json, null);
this.msgToolsFeignClient.sendSmsFree(CommUtil.getURL(request),
"sms_tobuyer_order_cancel_notify", buyer.getMobile(),
json, null);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}*/
return ResponseCode.buildSuccessMap(null);
} else {
return ResponseCode.buildReturnMap(ResponseCode.NOTSTORE, null);
}
}
/**
* 订单退款申请单
* @param request
* @param response
* @param currentPage
* @param orderBy
* @param orderType
* @param status
* @return
*/
@RequestMapping(value = { "/refund_apply_form" } , method = RequestMethod.POST)
public Map<String,Object> refund_apply_form(HttpServletRequest request,
@RequestBody JSONObject json) {
String currentPage = json.optString("currentPage");
String orderType = json.optString("orderType");
String orderBy = json.optString("orderBy");
//状态 0:待审核 5:审核拒绝 10:审核通过待退款 15:已退款
String refundStatus = json.optString("refundStatus");
UserDto user = this.userFeignClient.selectByPrimaryKey(SecurityUserHolder.getCurrentUser(request).getId());
if(user == null){
return ResponseCode.buildReturnMap(ResponseCode.USER_DOES_NOT_EXIST, null);
}
if (user.getParent_id()!=null) {
user = this.userFeignClient.selectByPrimaryKey(user.getParent_id());
}
if(user.getStore_id() == null){
return ResponseCode.buildReturnMap(ResponseCode.FAILURE, null);
}
Store store = this.storeService.selectByPrimaryKey(CommUtil.null2Long(user
.getStore_id()));
Map<String,Object> maps= this.queryTools.getParams(currentPage, orderBy, orderType);
if ((refundStatus == null) || (refundStatus.equals(""))) {
maps.put("refundStatus", CommUtil.null2Int(Integer.valueOf(0)));
} else {
maps.put("refundStatus", CommUtil.null2Int(Integer.valueOf(refundStatus)));
}
if(store != null){
maps.put("store_id", store.getId());
}else{
return ResponseCode.buildReturnMap(ResponseCode.NOTSTORE, null);
}
Map<String, Object> data = this.orderFormFeignClient.refundApplyFormList(maps);
data.put("refundStatus", refundStatus);
return ResponseCode.buildSuccessMap(data);
}
/**
* 订单退款申请单详情
* @param request
* @param response
* @param order_id
* @return
*/
@RequestMapping(value = { "/refund_orderform_view" } , method = RequestMethod.POST)
public Map<String,Object> refund_orderform_view(HttpServletRequest request, @RequestBody JSONObject json) {
Map<Object, Object> map = Maps.newHashMap();
map.put("reason","");
if (StringUtils.isBlank(json.optString("order_id"))) {
return ResponseCode.buildReturnMap(ResponseCode.PARAM_ERROR, null);
}
String apply_from_id = json.optString("apply_from_id");
if (StringUtils.isBlank(apply_from_id)) {
return ResponseCode.buildReturnMap(ResponseCode.PARAM_ERROR, null);
}
OrderFormDto obj = this.orderFormFeignClient.selectByPrimaryKey(CommUtil.null2Long(json.optString("order_id")));
Store store = this.storeService.selectByPrimaryKey(CommUtil.null2Long(obj.getStore_id()));
UserDto user = this.userFeignClient.selectByPrimaryKey(SecurityUserHolder.getCurrentUser(request).getId());
if(user == null){
return ResponseCode.buildReturnMap(ResponseCode.USER_DOES_NOT_EXIST, null);
}
if (user.getParent_id()!=null) {
user = this.userFeignClient.selectByPrimaryKey(user.getParent_id());
}
RefundApplyFormDto RefundApplyFormDto = refundapplyformfeignclient.selectByPrimaryKey(CommUtil.null2Long(apply_from_id));
if(RefundApplyFormDto!=null){
map.put("reason",RefundApplyFormDto.getReturn_content()); //退款原因
}
//user = user.getParent_id() == null ? user : user.getParent();
if(user.getStore_id() == null){
return ResponseCode.buildReturnMap(ResponseCode.FAILURE, null);
}
if(store == null){
return ResponseCode.buildReturnMap(ResponseCode.REQUEST_FORBIDDEN, null);
}
if(!user.getStore_id().equals(store.getId()) ||store.getStore_status()!=15){ //验证是否是当前商家 , 并且正常营业
return ResponseCode.buildReturnMap(ResponseCode.REQUEST_FORBIDDEN, null);
}
if (obj != null) {
String temp = obj.getSpecial_invoice();
if ((temp != null) && (!"".equals(temp))) {
Map of_va = JSON.parseObject(temp);
map.put("of_va", of_va);
}
}
map.put("obj", obj);
String queryExInfo = this.queryExInfo(obj.getExpress_info(), "express_company_name");
map.put("store", store);
map.put("express_company_name", queryExInfo);
//map.put("express_company_name", this.orderFormTools.queryExInfo(obj.getExpress_info(), "express_company_name"));
ReturnGoodsLogDto returnGoodsLogDto = returnGoodsLogFeignClient.selectByOrderId(obj.getId());
map.put("returnGoodsLogDto", returnGoodsLogDto);
return ResponseCode.buildSuccessMap(map);
}
public String queryExInfo(String json, String key) {
Map<String, Object> map = Maps.newHashMap();
if ((json != null) && (!json.equals(""))) {
map = JSON.parseObject(json);
}
return CommUtil.null2String(map.get(key));
}
/**
* 订单退款申请单审核
* @param request
* @param result
* @param apply_form_id
* @param currentPage
* @return
*/
@RequestMapping({ "/refund_audit" })
public Map<String, Object> refund_audit(HttpServletRequest request, @RequestBody JSONObject json) {
UserDto user = SecurityUserHolder.getCurrentUser(request);
Store store = null ;
if(user == null){
return ResponseCode.buildReturnMap(ResponseCode.USER_DOES_NOT_EXIST, null);
}
if (user.getParent_id()!=null) {
user = this.userFeignClient.selectByPrimaryKey(user.getParent_id());
}
store = this.storeService.selectByPrimaryKey(CommUtil.null2Long(user
.getStore_id()));
if(store == null){
return ResponseCode.buildReturnMap(ResponseCode.NOTSTORE, null);
}
RefundApplyFormDto refundApplyForm = this.refundapplyformfeignclient
.selectByPrimaryKey(CommUtil.null2Long(json.optString("apply_from_id")));
//TODO
//Store store = (user.getParent() == null ? user : user.getParent()).getStore();
if ((store != null) && (store.getId().toString().equals(refundApplyForm.getStore_id()))&&refundApplyForm.getOrder_form_id()!=null) {
OrderFormDto orderForm = this.orderFormFeignClient.selectByPrimaryKey(refundApplyForm.getOrder_form_id());
refundApplyForm.setAudit_date(new Date());
refundApplyForm.setAudit_user_name(user.getUserName());
if (StringUtils.isNotBlank(json.optString("result"))) {
refundApplyForm.setStatus(10);
this.refundapplyformfeignclient.updateById(refundApplyForm);
orderForm.setOrder_status(22);
this.orderFormFeignClient.updateById(orderForm);
MessageDto msg = new MessageDto();
String msg_content = "您订单号为:" + orderForm.getOrder_id() + "的订单退款申请已通过,我们会尽快将" + "退款金额打入您的预存款中。";
msg.setAddTime(new Date());
msg.setStatus(0);
msg.setType(0);
msg.setContent(msg_content);
//msg.setFromu(user);
//msg.setToUser(this.userFeignClient.selectByPrimaryKey(CommUtil.null2Long(orderForm.getUser_id())));
msg.setFromUser_id(user.getId());
msg.setToUser_id(CommUtil.null2Long(orderForm.getUser_id()));
this.messagefeignclient.saveEntity(msg);
} else {
refundApplyForm.setStatus(5);
this.refundapplyformfeignclient.updateById(refundApplyForm);
orderForm.setOrder_status(20);
this.orderFormFeignClient.updateById(orderForm);
MessageDto msg = new MessageDto();
String msg_content = "您订单号为:" + orderForm.getOrder_id() + "的订单退款申请未通过。";
msg.setAddTime(new Date());
msg.setStatus(0);
msg.setType(0);
msg.setContent(msg_content);
msg.setFromUser(user);
msg.setToUser_id(CommUtil.null2Long(orderForm.getUser_id()));
this.messagefeignclient.saveEntity(msg);
}
}else {
//店铺不存在, 或者登录用户不为该订单商铺
return ResponseCode.buildReturnMap(ResponseCode.REQUEST_FORBIDDEN, null);
}
return ResponseCode.buildSuccessMap(null);
}
/**
* 退货列表
* @param request
* @param response
* @param currentPage
* @param orderBy
* @param orderType
* @param name
* @param user_name
* @param return_service_id
* @return
*/
@RequestMapping(value = { "/return" } , method = RequestMethod.POST)
public Map<String, Object> seller_return(HttpServletRequest request,@RequestBody JSONObject json) {
String currentPage = json.optString("currentPage");
String orderBy = json.optString("orderBy");
String orderType = json.optString("orderType");
String name = json.optString("name");
String user_name = json.optString("user_name");
String return_service_id = json.optString("return_service_id");
Map<String,Object> maps= this.queryTools.getParams(currentPage, "addTime", "desc");
maps.put("goods_type", 1);
if ((user_name != null) && (!user_name.equals(""))) {
maps.put("user_name", user_name);
}
if ((name != null) && (!name.equals(""))) {
maps.put("goods_name_like", name);
}
if ((return_service_id != null) && (!return_service_id.equals(""))) {
maps.put("return_service_id", return_service_id);
}
UserDto user = this.userFeignClient.selectByPrimaryKey(SecurityUserHolder.getCurrentUser(request).getId());
if(user == null){
return ResponseCode.buildReturnMap(ResponseCode.USER_DOES_NOT_EXIST, null);
}
if (user.getParent_id()!=null) {
user = this.userFeignClient.selectByPrimaryKey(user.getParent_id());
}
//user = user.getParent_id() == null ? user : user.getParent();
if(user.getStore_id() == null){
return ResponseCode.buildReturnMap(ResponseCode.FAILURE, null);
}
Store store = this.storeService.selectByPrimaryKey(CommUtil.null2Long(user
.getStore_id()));
if(store != null){
maps.put("store_id", store.getId());
}else{
return ResponseCode.buildReturnMap(ResponseCode.NOTSTORE, null);
}
maps.put("store_id", user.getStore_id());
Map<String , Object> data = this.returnGoodsLogFeignClient.list(maps);
data.put("name", name);
data.put("user_name", user_name);
data.put("return_service_id", return_service_id);
data.put("store", store);
return ResponseCode.buildSuccessMap(data);
}
/**
* 退货详情数据
* @param request
* @param response
* @param currentPage
* @param id
* @return
*/
@RequestMapping(value = { "/return_check" } , method = RequestMethod.POST)
public Map<String, Object> return_check(HttpServletRequest request,
@RequestBody JSONObject json) {
String id = json.optString("id");
ReturnGoodsLogDto obj = this.returnGoodsLogFeignClient.selectByPrimaryKey(CommUtil
.null2Long(id));
Map<String, Object> map = Maps.newHashMap();
if (obj.getGoods_return_status().equals("7")) {
TransInfoDto transInfo = this.shipToolsFeignClient.query_Ordership_getData(CommUtil.null2String(obj.getId()));
map.put("transInfo", transInfo);
Map<String, Object> mapa = JSON.parseObject(obj
.getReturn_express_info());
//物流名称
map.put("express_company_name",mapa.get("express_company_name"));
}
map.put("obj", obj);
return ResponseCode.buildSuccessMap(map);
}
/**
* 退货订单 审核or拒绝
* @param request
* @param id
* @param goods_return_status
* @param self_address
*/
@RequestMapping( value = { "/return_check_save" } , method = RequestMethod.POST)
public Map<String , Object> return_check_saveEntity(HttpServletRequest request,@RequestBody JSONObject jsonv) {
String id = jsonv.optString("id");
/*String currentPage = jsonv.optString("currentPage");*/
/*String cmd = jsonv.optString("cmd");*/
// 退货商品状态 -2为超过退货时间未能输入退货物流 -1为申请被拒绝 1为可以退货 5为退货申请中 6为审核通过可进行退货 7为退货中 10为退货完成,等待退款,11为平台退款完成
String goods_return_status = jsonv.optString("goods_return_status");
// 收货时向买家发送的收货地址,买家通过此将货物发送给卖家
String self_address = jsonv.optString("self_address");
UserDto seller = this.userFeignClient.selectByPrimaryKey(SecurityUserHolder.getCurrentUser(request).getId());
// UserDto seller = this.userFeignClient.selectByPrimaryKey(445L);
if(seller == null){
return ResponseCode.buildReturnMap(ResponseCode.USER_DOES_NOT_EXIST, null);
}
if (seller.getParent_id()!=null) {
seller = this.userFeignClient.selectByPrimaryKey(seller.getParent_id());
}
//user = user.getParent_id() == null ? user : user.getParent();
if(seller.getStore_id() == null){
return ResponseCode.buildReturnMap(ResponseCode.FAILURE, null);
}
Store store = this.storeService.selectByPrimaryKey(CommUtil.null2Long(seller
.getStore_id()));
// Store store = this.storeService.selectByPrimaryKey(CommUtil.null2Long(62));
if(store == null){
return ResponseCode.buildReturnMap(ResponseCode.NOTSTORE, null);
}
ReturnGoodsLogDto obj = this.returnGoodsLogFeignClient.selectByPrimaryKey(Long.valueOf(Long.parseLong(id)));
String message = "审核为未通过";
String code = "10001";
if ((seller.getStore_id() != null)&& (CommUtil.null2String(obj.getStore_id()).equals(seller.getStore_id().toString()))) {
obj.setGoods_return_status(goods_return_status);
obj.setSelf_address(self_address);
obj.setRefund_time(new Date()); //审核时间
this.returnGoodsLogFeignClient.updateById(obj);
UserDto user = this.userFeignClient.selectByPrimaryKey(obj.getUser_id());
String msg_content =null;
if (goods_return_status.equals("6")) {
message = "审核通过";
code = "10000";
msg_content = "退货申请审核通过,请在'退货/退款'-'查看返修/退换记录'中提交退货物流信息。";
} else {
/* OrderFormDto of = this.orderFormFeignClient.selectByPrimaryKey(Long.valueOf(obj.getReturn_order_id()));
of.setOrder_status(18); //申请未通过, 用户取消退款确认收货/人工仲裁
this.orderFormFeignClient.updateById(of);*/
message = "提交成功";
code = "10000";
msg_content = "订单号:" + obj.getReturn_service_id()
+ "退货申请审核未通过,请在'退货/退款'-'查看返修/退换记录'中提交退货物流信息。";
}
MessageDto msg = new MessageDto();
msg.setAddTime(new Date());
msg.setStatus(0);
msg.setType(0);
msg.setContent(msg_content);
msg.setFromUser(SecurityUserHolder.getCurrentUser(request));
msg.setToUser(user);
this.messagefeignclient.saveEntity(msg);
} else {
message = "信息有误";
code = "10001";
}
return ResponseCode.buildCodeMap(code,message, null);
}
/**
* 确认退货收货
* @param request
* @param response
* @param id
* @return
*/
@RequestMapping( value = { "/return_confirm" } , method = RequestMethod.POST)
public Map<String , Object> return_confirm(HttpServletRequest request , @RequestBody JSONObject jsonv) {
String id = jsonv.optString("id");
UserDto seller = this.userFeignClient.selectByPrimaryKey(SecurityUserHolder.getCurrentUser(request).getId());
ReturnGoodsLogDto obj = this.returnGoodsLogFeignClient.selectByPrimaryKey(Long.valueOf(Long.parseLong(id)));
if(seller == null){
return ResponseCode.buildReturnMap(ResponseCode.USER_DOES_NOT_EXIST, null);
}
if (seller.getParent_id()!=null) {
seller = this.userFeignClient.selectByPrimaryKey(seller.getParent_id());
}
//user = user.getParent_id() == null ? user : user.getParent();
if(seller.getStore_id() == null){
return ResponseCode.buildReturnMap(ResponseCode.FAILURE, null);
}
// Store store = this.storeService.selectByPrimaryKey(CommUtil.null2Long(seller
// .getStore_id()));
Store store = this.storeService.selectByPrimaryKey(seller.getStore_id());
if(store == null){
return ResponseCode.buildReturnMap(ResponseCode.NOTSTORE, null);
}
if ((seller.getStore_id() != null)&& (CommUtil.null2String(obj.getStore_id()).equals(seller.getStore_id().toString()))) {
obj.setGoods_return_status("10");
this.returnGoodsLogFeignClient.updateById(obj);
}
return ResponseCode.buildSuccessMap(null);
}
/**
* 卖家调整订单费用
* @param request
* @param response
* @param id
* @param currentPage
* @return
*/
@RequestMapping(value = { "/order_fee" } , method = RequestMethod.POST)
public Map<String , Object> order_fee(HttpServletRequest request,
@RequestBody JSONObject json) {
String id = json.optString("id");
OrderFormDto obj = this.orderFormFeignClient
.selectByPrimaryKey(CommUtil.null2Long(id));
UserDto user = this.userFeignClient.selectByPrimaryKey(SecurityUserHolder
.getCurrentUser(request).getId());
if(user == null){
return ResponseCode.buildReturnMap(ResponseCode.USER_DOES_NOT_EXIST, null);
}
if (user.getParent_id()!=null) {
user = this.userFeignClient.selectByPrimaryKey(user.getParent_id());
}
Store store = this.storeService.selectByPrimaryKey(CommUtil.null2Long(obj
.getStore_id()));
if(store == null){
return ResponseCode.buildReturnMap(ResponseCode.NOTSTORE, null);
}
//user = user.getParent_id() == null ? user : user.getParent();
if(user.getStore_id() == null){
return ResponseCode.buildReturnMap(ResponseCode.FAILURE, null);
}
if (user.getStore_id().equals(store.getId())) {
return ResponseCode.buildSuccessMap(obj);
} else {
return ResponseCode.buildEnumMap(ResponseCode.FAILURE, null);
}
}
/**
* 卖家调整订单费用保存
* @param request
* @param response
* @param id
* @param currentPage
* @param goods_amount
* @param ship_price
* @param totalPrice
* @return
* @throws Exception
*/
@RequestMapping( value = { "/order_fee_save" } , method = RequestMethod.POST)
public Map<String, Object> order_fee_saveEntity(HttpServletRequest request,@RequestBody JSONObject jsonv)
{
String id = jsonv.optString("id");
String goods_amount = jsonv.optString("goods_amount"); //商品总价格
String ship_price = jsonv.optString("ship_price"); // 配送价格
String totalPrice = jsonv.optString("totalPrice"); // 订单总价格
OrderFormDto obj = this.orderFormFeignClient
.selectByPrimaryKey(CommUtil.null2Long(id));
if (CommUtil.null2Double(obj.getCommission_amount()) <= CommUtil
.null2Double(goods_amount)) {
UserDto user = this.userFeignClient.selectByPrimaryKey(SecurityUserHolder
.getCurrentUser(request).getId());
if(user == null){
return ResponseCode.buildReturnMap(ResponseCode.USER_DOES_NOT_EXIST, null);
}
if (user.getParent_id()!=null) {
user = this.userFeignClient.selectByPrimaryKey(user.getParent_id());
}
if(user.getStore_id() == null){
return ResponseCode.buildReturnMap(ResponseCode.FAILURE,null);
}
Store store = this.storeService.selectByPrimaryKey(CommUtil.null2Long(user
.getStore_id()));
if(store == null){
return ResponseCode.buildReturnMap(ResponseCode.NOTSTORE,null);
}
//user = user.getParent_id() == null ? user : user.getParent();
if (user.getStore_id().toString().equals(store.getId().toString())) {
obj.setGoods_amount(BigDecimal.valueOf(CommUtil
.null2Double(goods_amount)));
obj.setShip_price(BigDecimal.valueOf(CommUtil
.null2Double(ship_price)));
obj.setTotalPrice(BigDecimal.valueOf(CommUtil
.null2Double(totalPrice)));
obj.setOperation_price_count(obj.getOperation_price_count() + 1);
this.orderFormFeignClient.updateById(obj);
OrderFormLogDto ofl = new OrderFormLogDto();
ofl.setAddTime(new Date());
ofl.setLog_info("调整订单费用");
ofl.setState_info("调整订单总金额为:" + totalPrice + ",调整运费金额为:"
+ ship_price);
ofl.setLog_user_id(SecurityUserHolder.getCurrentUser(request).getId());
ofl.setLog_user_name(SecurityUserHolder.getCurrentUser(request)
.getUserName());
ofl.setOf_id(obj.getId());
this.orderFormLogFeignClient.saveEntity(ofl);
/* UserDto buyer = this.userFeignClient.selectByPrimaryKey(CommUtil.null2Long(obj
.getUser_id()));
Map<String, Object> map = Maps.newHashMap();
map.put("buyer_id", buyer.getId().toString());
map.put("seller_id", store.getUser_id());
map.put("order_id", obj.getId());
String json = JSON.toJSONString(map);
if (obj.getOrder_form() == 0) {
this.msgToolsFeignClient.sendEmailCharge(CommUtil.getURL(request),
"email_tobuyer_order_update_fee_notify",
buyer.getEmail(), json, null, obj.getStore_id());
this.msgToolsFeignClient.sendSmsCharge(CommUtil.getURL(request),
"sms_tobuyer_order_fee_notify", buyer.getMobile(),
json, null, obj.getStore_id());
} else {
this.msgToolsFeignClient.sendEmailFree(CommUtil.getURL(request),
"email_tobuyer_order_update_fee_notify",
buyer.getEmail(), json, null);
this.msgToolsFeignClient.sendSmsFree(CommUtil.getURL(request),
"sms_tobuyer_order_fee_notify", buyer.getMobile(),
json, null);
}*/
}else{
return ResponseCode.buildReturnMap(ResponseCode.FAILURE,null);
}
}else{
return ResponseCode.buildReturnMap(ResponseCode.FAILURE,null);
}
return ResponseCode.buildSuccessMap(null);
}
/**
* 卖家发货
* @param request
* @param response
* @param id
* @param currentPage
* @param page_status
* @return
*/
@RequestMapping(value = { "/order_shipping" } , method = RequestMethod.POST)
public Map<String, Object> order_shipping(HttpServletRequest request,@RequestBody JSONObject json) {
String id = json.optString("id");
String page_status = json.optString("page_status");
OrderFormDto obj = this.orderFormFeignClient
.selectByPrimaryKey(CommUtil.null2Long(id));
UserDto user = this.userFeignClient.selectByPrimaryKey(SecurityUserHolder
.getCurrentUser(request).getId());
if(user == null){
return ResponseCode.buildReturnMap(ResponseCode.USER_DOES_NOT_EXIST, null);
}
Store store = this.storeService.selectByPrimaryKey(CommUtil.null2Long(obj
.getStore_id()));
if (user.getParent_id()!=null) {
user = this.userFeignClient.selectByPrimaryKey(user.getParent_id());
}
Store store1 = this.storeService.selectByPrimaryKey(CommUtil.null2Long(user
.getStore_id()));
if(store1 == null ||store == null){
return ResponseCode.buildReturnMap(ResponseCode.NOTSTORE, null);
}
//user = user.getParent_id() == null ? user : user.getParent();
if(user.getStore_id() == null){
return ResponseCode.buildReturnMap(ResponseCode.FAILURE, null);
}
Map<String, Object> map = Maps.newHashMap();
if (user.getStore_id().equals(store.getId())) {
map.put("obj", obj);
List<GoodsDto> list_goods = queryOfGoods(obj);
List<GoodsDto> deliveryGoods = Lists.newArrayList();
boolean physicalGoods = false;
for (GoodsDto g : list_goods) {
if (g.getGoods_choice_type() == 1) {
deliveryGoods.add(g);
} else {
physicalGoods = true;
}
}
Map<String, Object> params = Maps.newHashMap();
params.put("ecc_type", Integer.valueOf(0));
params.put("ecc_store_id", store.getId());
List<ExpressCompanyCommonDto> eccs = this.companyCommonFeignClient.queryPages(params);
params.clear();
params.put("sa_type", Integer.valueOf(0));
params.put("sa_user_id", user.getId());
params.put("orderBy", "obj.sa_default desc,obj.sa_sequence");
params.put("orderType", "asc");
List<ShipAddressDto> shipAddrs = this.shipAddressFeignClient.queryPages(params);
map.put("eccs", eccs);
map.put("shipAddrs", shipAddrs);
map.put("physicalGoods", Boolean.valueOf(physicalGoods));
map.put("deliveryGoods", deliveryGoods);
map.put("page_status", page_status);
//用改方法查询虚拟商品的数量
/*map.put("queryOfGoodsCount", this.queryOfGoodsCount);*/
} else {
return ResponseCode.buildEnumMap(ResponseCode.PARAM_ERROR, null);
}
return ResponseCode.buildSuccessMap(map);
}
/**
* 根据订单id和商品id查询该商品在该订单中的数量
* @param order_id
* @param goods_id
* @return
*/
public int queryOfGoodsCount(String order_id, String goods_id) {
int count = 0;
OrderFormDto of = this.orderFormFeignClient.selectByPrimaryKey(CommUtil
.null2Long(order_id));
List<Map> map_list = this.orderFormToolsFeignClient.queryGoodsInfo(of.getGoods_info());
for (Map map : map_list) {
if (CommUtil.null2String(map.get("goods_id")).equals(goods_id)) {
count = CommUtil.null2Int(map.get("goods_count"));
break;
}
}
if ((count == 0)
&& (!CommUtil.null2String(of.getChild_order_detail())
.equals(""))) { // 主订单无数量信息,继续从子订单中查询
List<Map> maps = this.orderFormToolsFeignClient.queryGoodsInfo(of.getChild_order_detail());
for (Map map : maps) {
OrderFormDto child_order = this.orderFormFeignClient
.selectByPrimaryKey(CommUtil.null2Long(map
.get("order_id")));
map_list.clear();
map_list = this.orderFormToolsFeignClient.queryGoodsInfo(child_order.getGoods_info());
for (Map map1 : map_list) {
if (CommUtil.null2String(map1.get("goods_id")).equals(
goods_id)) {
count = CommUtil.null2Int(map1.get("goods_count"));
break;
}
}
}
}
return count;
}
/**
* 根据订单id查询该订单中所有商品,包括子订单中的商品
* @param main_order
* @return
*/
public List<GoodsDto> queryOfGoods(OrderFormDto main_order) {
List<Map> map_list =this.orderFormToolsFeignClient.queryGoodsInfo(main_order.getGoods_info());
List<GoodsDto> goods_list = Lists.newArrayList();
for (Map map : map_list) {
GoodsDto goods = this.goodsFeignClient.selectByPrimaryKey(CommUtil
.null2Long(map.get("goods_id")));
if(goods != null){
goods_list.add(goods);
}
}
if (!CommUtil.null2String(main_order.getChild_order_detail())
.equals("")) {
List<Map> maps = this.orderFormToolsFeignClient.queryGoodsInfo(main_order.getChild_order_detail());
for (Map<String, Object> map : maps) {
OrderFormDto child_order = this.orderFormFeignClient
.selectByPrimaryKey(CommUtil.null2Long(map
.get("order_id")));
map_list.clear();
map_list =this.orderFormToolsFeignClient.queryGoodsInfo(child_order.getGoods_info());
for (Map map1 : map_list) {
GoodsDto good = this.goodsFeignClient.selectByPrimaryKey(CommUtil
.null2Long(map1.get("goods_id")));
goods_list.add(good);
}
}
}
return goods_list;
}
/**
* 卖家修改物流
* @param request
* @param response
* @param id
* @param currentPage
* @return
*/
@RequestMapping(value = { "/order_shipping_code" } , method = RequestMethod.POST)
public Map<String , Object> order_shipping_code(HttpServletRequest request,@RequestBody JSONObject json) {
String id = json.optString("id");
OrderFormDto obj = this.orderFormFeignClient
.selectByPrimaryKey(CommUtil.null2Long(id));
UserDto user = this.userFeignClient.selectByPrimaryKey(SecurityUserHolder
.getCurrentUser(request).getId());
if(user == null){
return ResponseCode.buildReturnMap(ResponseCode.USER_DOES_NOT_EXIST, null);
}
Store store = this.storeService.selectByPrimaryKey(CommUtil.null2Long(obj
.getStore_id()));
if (user.getParent_id()!=null) {
user = this.userFeignClient.selectByPrimaryKey(user.getParent_id());
}
//user = user.getParent_id() == null ? user : user.getParent();
if(user.getStore_id() == null){
return ResponseCode.buildReturnMap(ResponseCode.FAILURE, null);
}
Store store1 = this.storeService.selectByPrimaryKey(CommUtil.null2Long(user
.getStore_id()));
if(store1 == null || store == null){
return ResponseCode.buildReturnMap(ResponseCode.NOTSTORE, null);
}
if (user.getStore_id().equals(store.getId())) {
return ResponseCode.buildSuccessMap(obj);
} else {
return ResponseCode.buildEnumMap(ResponseCode.FAILURE, null);
}
}
/**
* 卖家修改物流保存
* @param request
* @param response
* @param id
* @param currentPage
* @param shipCode
* @param state_info
* @return
*/
@RequestMapping(value = { "/order_shipping_code_save" } , method = RequestMethod.POST)
public Map<String , Object> order_shipping_code_saveEntity(HttpServletRequest request,@RequestBody JSONObject json) {
String id = json.optString("id");
String shipCode = json.optString("shipCode");
String state_info = json.optString("state_info");
OrderFormDto obj = this.orderFormFeignClient
.selectByPrimaryKey(CommUtil.null2Long(id));
UserDto user = this.userFeignClient.selectByPrimaryKey(SecurityUserHolder
.getCurrentUser(request).getId());
if(user == null){
return ResponseCode.buildReturnMap(ResponseCode.USER_DOES_NOT_EXIST, null);
}
Store store = this.storeService.selectByPrimaryKey(CommUtil.null2Long(obj
.getStore_id()));
if (user.getParent_id()!=null) {
user = this.userFeignClient.selectByPrimaryKey(user.getParent_id());
}
Store store1 = this.storeService.selectByPrimaryKey(CommUtil.null2Long(user
.getStore_id()));
if(store1 == null || store == null){
return ResponseCode.buildReturnMap(ResponseCode.NOTSTORE, null);
}
//user = user.getParent_id() == null ? user : user.getParent();
if(user.getStore_id() == null){
return ResponseCode.buildReturnMap(ResponseCode.FAILURE, null);
}
Map<String, Object> map = Maps.newHashMap();
if (user.getStore_id().equals(store.getId())) {
obj.setShipCode(shipCode);
this.orderFormFeignClient.updateById(obj);
OrderFormLogDto ofl = new OrderFormLogDto();
ofl.setAddTime(new Date());
ofl.setLog_info("修改物流信息");
ofl.setState_info(state_info);
ofl.setLog_user_id(SecurityUserHolder.getCurrentUser(request).getId());
ofl.setLog_user_name(SecurityUserHolder.getCurrentUser(request)
.getUserName());
ofl.setOf(obj);
this.orderFormLogFeignClient.saveEntity(ofl);
if (this.sysConfigFeignClient.getSysConfig()