记得上下班打卡 | git大法好,push需谨慎

Commit e8b557d5 authored by 周焕's avatar 周焕

Merge branch 'pre' into 'master'

Pre

See merge request !199
parents 447ae015 a2f16442
...@@ -24,7 +24,7 @@ public interface IGoblinOrderAppService { ...@@ -24,7 +24,7 @@ public interface IGoblinOrderAppService {
ResponseDto<List<GoblinBackOrderVo>> refundDetails(String orderId); ResponseDto<List<GoblinBackOrderVo>> refundDetails(String orderId);
String huiFuSync(HttpServletRequest request); // String huiFuSync(HttpServletRequest request);
ResponseDto<List<GoblinMailVo>> getMail(String orderId, String mailId); ResponseDto<List<GoblinMailVo>> getMail(String orderId, String mailId);
} }
...@@ -8,6 +8,7 @@ import com.liquidnet.service.goblin.param.PayAgainParam; ...@@ -8,6 +8,7 @@ import com.liquidnet.service.goblin.param.PayAgainParam;
import com.liquidnet.service.goblin.param.RefundCallbackParam; import com.liquidnet.service.goblin.param.RefundCallbackParam;
import com.liquidnet.service.goblin.param.SyncOrderParam; import com.liquidnet.service.goblin.param.SyncOrderParam;
import javax.servlet.http.HttpServletRequest;
import java.util.List; import java.util.List;
public interface IGoblinOrderService { public interface IGoblinOrderService {
...@@ -24,4 +25,7 @@ public interface IGoblinOrderService { ...@@ -24,4 +25,7 @@ public interface IGoblinOrderService {
ResponseDto<Integer> checkOrderResultMaterCode(String materCode); ResponseDto<Integer> checkOrderResultMaterCode(String materCode);
String huiFuSync(HttpServletRequest request);
} }
...@@ -13,7 +13,7 @@ import java.util.HashMap; ...@@ -13,7 +13,7 @@ import java.util.HashMap;
public interface IGoblinStoreMoneyService { public interface IGoblinStoreMoneyService {
ResponseDto<HashMap<String,String>> money(String spuId); ResponseDto<HashMap<String,String>> money(String spuId,String st,String et);
ResponseDto<PageInfo<GoblinOrderLogVo>> getSpuList(String spuName, String st, String et, int page); ResponseDto<PageInfo<GoblinOrderLogVo>> getSpuList(String spuName, String st, String et, int page);
......
...@@ -76,6 +76,7 @@ public class GoblinSelfCategoryAdminController extends BaseController { ...@@ -76,6 +76,7 @@ public class GoblinSelfCategoryAdminController extends BaseController {
return AjaxResult.warn("无效参数"); return AjaxResult.warn("无效参数");
} }
queryWrapper.eq(GoblinSelfGoodsCategory::getGrade, grade); queryWrapper.eq(GoblinSelfGoodsCategory::getGrade, grade);
queryWrapper.eq(GoblinSelfGoodsCategory::getDelFlg, "0");
queryWrapper.select(GoblinSelfGoodsCategory::getCateId, GoblinSelfGoodsCategory::getName, GoblinSelfGoodsCategory::getIcon, GoblinSelfGoodsCategory::getNeIsbn); queryWrapper.select(GoblinSelfGoodsCategory::getCateId, GoblinSelfGoodsCategory::getName, GoblinSelfGoodsCategory::getIcon, GoblinSelfGoodsCategory::getNeIsbn);
queryWrapper.orderByAsc(GoblinSelfGoodsCategory::getCateId); queryWrapper.orderByAsc(GoblinSelfGoodsCategory::getCateId);
......
...@@ -102,6 +102,7 @@ global-auth: ...@@ -102,6 +102,7 @@ global-auth:
- ${liquidnet.info.context}/order/syncOrder - ${liquidnet.info.context}/order/syncOrder
- ${liquidnet.info.context}/goblin/syncOrder - ${liquidnet.info.context}/goblin/syncOrder
- ${liquidnet.info.context}/goblin/refundSyncOrder - ${liquidnet.info.context}/goblin/refundSyncOrder
- ${liquidnet.info.context}/goblin/paySuccess
# ----------------------------------------------------------- # -----------------------------------------------------------
# ----------------------------------------------------------- # -----------------------------------------------------------
......
...@@ -79,10 +79,10 @@ public class GoblinStoreZhengzaiController { ...@@ -79,10 +79,10 @@ public class GoblinStoreZhengzaiController {
return goblinOrderAppService.orderDetails(orderId, null); return goblinOrderAppService.orderDetails(orderId, null);
} }
@PostMapping("paySuccess") // @PostMapping("paySuccess")
@ApiOperation("汇付支付成功回调") // @ApiOperation("汇付支付成功回调")
@ResponseBody // @ResponseBody
public String refundDetails(HttpServletRequest request) { // public String refundDetails(HttpServletRequest request) {
return goblinOrderAppService.huiFuSync(request); // return goblinOrderAppService.huiFuSync(request);
} // }
} }
...@@ -280,7 +280,7 @@ public class GoblinStoreMgtGoodsController { ...@@ -280,7 +280,7 @@ public class GoblinStoreMgtGoodsController {
{// 标签处理 {// 标签处理
List<String> goodsTagIdList = storeMgtGoodsAddParam.getTagList(), List<String> goodsTagIdList = storeMgtGoodsAddParam.getTagList(),
goodsExtagIdList = storeMgtGoodsAddParam.getExtagList(), goodsExtagIdList = storeMgtGoodsAddParam.getExtagList(),
goodsArtagIdList = storeMgtGoodsAddParam.getExtagList(); goodsArtagIdList = storeMgtGoodsAddParam.getArtagList();
if (!CollectionUtils.isEmpty(goodsTagIdList)) { if (!CollectionUtils.isEmpty(goodsTagIdList)) {
List<GoblinSelfTagVo> selfGoodsTagVos = goblinRedisUtils.getSelfTagVos(); List<GoblinSelfTagVo> selfGoodsTagVos = goblinRedisUtils.getSelfTagVos();
List<GoblinGoodsTagVo> goodsTagVoList = ObjectUtil.getGoblinGoodsTagVoArrayList(); List<GoblinGoodsTagVo> goodsTagVoList = ObjectUtil.getGoblinGoodsTagVoArrayList();
......
...@@ -32,10 +32,14 @@ public class GoblinStoreMoneyController { ...@@ -32,10 +32,14 @@ public class GoblinStoreMoneyController {
@ApiOperation("商品资金总收入") @ApiOperation("商品资金总收入")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(type = "form", required = false, dataType = "String", name = "spuId", value = "spuId"), @ApiImplicitParam(type = "form", required = false, dataType = "String", name = "spuId", value = "spuId"),
@ApiImplicitParam(type = "form", required = false, dataType = "String", name = "st", value = "开始时间"),
@ApiImplicitParam(type = "form", required = false, dataType = "String", name = "et", value = "截至时间"),
}) })
@ApiResponse(code = 200, message = "接口返回对象参数") @ApiResponse(code = 200, message = "接口返回对象参数")
public ResponseDto<HashMap<String,String>> money(@RequestParam(value = "spuId", required = false) String spuId) { public ResponseDto<HashMap<String, String>> money(@RequestParam(value = "spuId", required = false) String spuId,
return goblinStoreMoneyService.money(spuId); @RequestParam(value = "st", required = false) String st,
@RequestParam(value = "et", required = false) String et) {
return goblinStoreMoneyService.money(spuId, st, et);
} }
@GetMapping("spu/list") @GetMapping("spu/list")
......
...@@ -520,7 +520,7 @@ public class GoblinFrontServiceImpl implements GoblinFrontService { ...@@ -520,7 +520,7 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
Pattern pattern = Pattern.compile("^.*"+name+".*$", Pattern.CASE_INSENSITIVE); Pattern pattern = Pattern.compile("^.*"+name+".*$", Pattern.CASE_INSENSITIVE);
query.addCriteria(Criteria.where("name").regex(pattern)); query.addCriteria(Criteria.where("name").regex(pattern));
} }
query.with(Sort.by(Sort.Direction.DESC, "count")); query.with(Sort.by(Sort.Direction.DESC, "shelvesAt"));
// 查询总数 // 查询总数
List<GoblinGoodsInfoVo> list = mongoTemplate.find(query, GoblinGoodsInfoVo.class, GoblinGoodsInfoVo.class.getSimpleName()); List<GoblinGoodsInfoVo> list = mongoTemplate.find(query, GoblinGoodsInfoVo.class, GoblinGoodsInfoVo.class.getSimpleName());
// 计算库存 // 计算库存
......
...@@ -25,13 +25,13 @@ public class GoblinStoreMoneyServiceImpl implements IGoblinStoreMoneyService { ...@@ -25,13 +25,13 @@ public class GoblinStoreMoneyServiceImpl implements IGoblinStoreMoneyService {
GoblinMongoUtils mongoUtils; GoblinMongoUtils mongoUtils;
@Override @Override
public ResponseDto<HashMap<String,String>> money(String spuId) { public ResponseDto<HashMap<String,String>> money(String spuId,String st,String et) {
String uid = CurrentUtil.getCurrentUid(); String uid = CurrentUtil.getCurrentUid();
GoblinStoreInfoVo vo = redisUtils.getStoreInfoVoByUid(uid); GoblinStoreInfoVo vo = redisUtils.getStoreInfoVoByUid(uid);
if (vo == null) { if (vo == null) {
return ResponseDto.failure("店铺不存在"); return ResponseDto.failure("店铺不存在");
} }
String data = mongoUtils.storeMoney(vo.getStoreId(), spuId); String data = mongoUtils.storeMoney(vo.getStoreId(), spuId,st,et);
String[] array = data.split(","); String[] array = data.split(",");
HashMap<String,String> map = CollectionUtil.mapStringString(); HashMap<String,String> map = CollectionUtil.mapStringString();
map.put("name",array[0]); map.put("name",array[0]);
......
...@@ -43,6 +43,8 @@ import java.util.List; ...@@ -43,6 +43,8 @@ import java.util.List;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.liquidnet.commons.lang.util.DateUtil.DTF_YMD_HMS;
@Component @Component
public class GoblinMongoUtils { public class GoblinMongoUtils {
@Autowired @Autowired
...@@ -445,6 +447,7 @@ public class GoblinMongoUtils { ...@@ -445,6 +447,7 @@ public class GoblinMongoUtils {
return mongoTemplate.findOne(Query.query(Criteria.where("storeId").is(storeId).and("name").is(name).and("delFlg").is("0")), return mongoTemplate.findOne(Query.query(Criteria.where("storeId").is(storeId).and("name").is(name).and("delFlg").is("0")),
GoblinGoodsInfoVo.class, GoblinGoodsInfoVo.class.getSimpleName()); GoblinGoodsInfoVo.class, GoblinGoodsInfoVo.class.getSimpleName());
} }
public long countMgtGoodsInfoVo(String name) { public long countMgtGoodsInfoVo(String name) {
return mongoTemplate.count(Query.query(Criteria.where("name").is(name).and("delFlg").is("0")), return mongoTemplate.count(Query.query(Criteria.where("name").is(name).and("delFlg").is("0")),
GoblinGoodsInfoVo.class.getSimpleName()); GoblinGoodsInfoVo.class.getSimpleName());
...@@ -806,9 +809,14 @@ public class GoblinMongoUtils { ...@@ -806,9 +809,14 @@ public class GoblinMongoUtils {
} }
//店铺总收入 //店铺总收入
public String storeMoney(String storeId, String spuId) { public String storeMoney(String storeId, String spuId, String st, String et) {
String spuName = "店铺总收入"; String spuName = "店铺总收入";
Criteria criteria = Criteria.where("status").in(GoblinStatusConst.Status.ORDER_LOG_STATUS_11.getValue(), GoblinStatusConst.Status.ORDER_LOG_STATUS_22.getValue(), GoblinStatusConst.Status.ORDER_LOG_STATUS_28.getValue()).and("storeId").is(storeId); Criteria criteria = Criteria.where("status").in(GoblinStatusConst.Status.ORDER_LOG_STATUS_11.getValue(), GoblinStatusConst.Status.ORDER_LOG_STATUS_22.getValue(), GoblinStatusConst.Status.ORDER_LOG_STATUS_28.getValue()).and("storeId").is(storeId);
if (st != null && et != null) {
LocalDateTime stDateTime = LocalDateTime.parse(st, DTF_YMD_HMS);
LocalDateTime etDateTime = LocalDateTime.parse(et, DTF_YMD_HMS);
criteria = criteria.and("createdAt").gte(stDateTime).lt(etDateTime);
}
Aggregation aggregation; Aggregation aggregation;
if (spuId != null) { if (spuId != null) {
criteria = criteria.and("spuId").is(spuId); criteria = criteria.and("spuId").is(spuId);
...@@ -857,10 +865,12 @@ public class GoblinMongoUtils { ...@@ -857,10 +865,12 @@ public class GoblinMongoUtils {
List<GoblinGoodsInfoVo> spuIdAndName = null; List<GoblinGoodsInfoVo> spuIdAndName = null;
Criteria criteria = Criteria.where("status").in(GoblinStatusConst.Status.ORDER_LOG_STATUS_11.getValue(), GoblinStatusConst.Status.ORDER_LOG_STATUS_22.getValue(), GoblinStatusConst.Status.ORDER_LOG_STATUS_28.getValue()).and("storeId").is(storeId); Criteria criteria = Criteria.where("status").in(GoblinStatusConst.Status.ORDER_LOG_STATUS_11.getValue(), GoblinStatusConst.Status.ORDER_LOG_STATUS_22.getValue(), GoblinStatusConst.Status.ORDER_LOG_STATUS_28.getValue()).and("storeId").is(storeId);
if (st != null && et != null) { if (st != null && et != null) {
criteria = criteria.and("createdAt").gte(st).lt(et); LocalDateTime stDateTime = LocalDateTime.parse(st, DTF_YMD_HMS);
LocalDateTime etDateTime = LocalDateTime.parse(et, DTF_YMD_HMS);
criteria = criteria.and("createdAt").gte(stDateTime).lt(etDateTime);
} }
//查询总数量 //查询总数量
Query countQuery = Query.query(criteria); Query countQuery = Query.query(criteria).with(Sort.by(Sort.Order.desc("createdAt")));
countQuery.fields().include("spuId"); countQuery.fields().include("spuId");
List<GoblinOrderLogVo> countList = mongoTemplate.find(countQuery, GoblinOrderLogVo.class, GoblinOrderLogVo.class.getSimpleName()); List<GoblinOrderLogVo> countList = mongoTemplate.find(countQuery, GoblinOrderLogVo.class, GoblinOrderLogVo.class.getSimpleName());
List<String> spuIdList = countList.stream().map(GoblinOrderLogVo::getSpuId).distinct().collect(Collectors.toList()); List<String> spuIdList = countList.stream().map(GoblinOrderLogVo::getSpuId).distinct().collect(Collectors.toList());
...@@ -870,7 +880,7 @@ public class GoblinMongoUtils { ...@@ -870,7 +880,7 @@ public class GoblinMongoUtils {
} }
if (spuName != null) { if (spuName != null) {
//根据spu名称查询spuId //根据spu名称查询spuId
Query query = Query.query(Criteria.where("name").regex(".*?" + spuName + ".*").and("storeId").is(storeId)); Query query = Query.query(Criteria.where("name").regex(".*?" + spuName + ".*").and("storeId").is(storeId)).with(Sort.by(Sort.Order.desc("createdAt")));
query.fields().include("spuId").include("name"); query.fields().include("spuId").include("name");
spuIdAndName = mongoTemplate.find(query, GoblinGoodsInfoVo.class, GoblinGoodsInfoVo.class.getSimpleName()); spuIdAndName = mongoTemplate.find(query, GoblinGoodsInfoVo.class, GoblinGoodsInfoVo.class.getSimpleName());
spuIdList = spuIdAndName.stream().map(GoblinGoodsInfoVo::getSpuId).collect(Collectors.toList()); spuIdList = spuIdAndName.stream().map(GoblinGoodsInfoVo::getSpuId).collect(Collectors.toList());
...@@ -878,7 +888,7 @@ public class GoblinMongoUtils { ...@@ -878,7 +888,7 @@ public class GoblinMongoUtils {
finalCount = spuIdList.size(); finalCount = spuIdList.size();
} }
} }
if(finalCount>0){ if (finalCount > 0) {
spuIdList = spuIdList.subList(skipCount, finalCount); spuIdList = spuIdList.subList(skipCount, finalCount);
} }
criteria = criteria.and("spuId").in(spuIdList); criteria = criteria.and("spuId").in(spuIdList);
...@@ -886,10 +896,12 @@ public class GoblinMongoUtils { ...@@ -886,10 +896,12 @@ public class GoblinMongoUtils {
//查询聚合数据 //查询聚合数据
Aggregation aggregation = Aggregation.newAggregation( Aggregation aggregation = Aggregation.newAggregation(
Aggregation.match(criteria), Aggregation.match(criteria),
Aggregation.project("spuId", "skuPriceActual"), Aggregation.project("spuId", "skuPriceActual","orderType"),
Aggregation.group("spuId") Aggregation.group("spuId")
.first("spuId").as("spuId") .first("spuId").as("spuId")
.sum("skuPriceActual").as("skuPriceActual") .first("orderType").as("orderType")
.sum("skuPriceActual").as("skuPriceActual"),
Aggregation.sort(Sort.by(Sort.Order.desc("spuId")))
); );
AggregationResults<GoblinOrderLogVo> outputType = mongoTemplate.aggregate(aggregation, GoblinOrderLogVo.class.getSimpleName(), GoblinOrderLogVo.class); AggregationResults<GoblinOrderLogVo> outputType = mongoTemplate.aggregate(aggregation, GoblinOrderLogVo.class.getSimpleName(), GoblinOrderLogVo.class);
List<GoblinOrderLogVo> dataList = new ArrayList(outputType.getMappedResults()); List<GoblinOrderLogVo> dataList = new ArrayList(outputType.getMappedResults());
...@@ -920,7 +932,9 @@ public class GoblinMongoUtils { ...@@ -920,7 +932,9 @@ public class GoblinMongoUtils {
int skipCount = ((page - 1) * size); int skipCount = ((page - 1) * size);
Criteria criteria = Criteria.where("spuId").is(spuId); Criteria criteria = Criteria.where("spuId").is(spuId);
if (st != null && et != null) { if (st != null && et != null) {
criteria = criteria.and("createdAt").gte(st).lt(et); LocalDateTime stDateTime = LocalDateTime.parse(st, DTF_YMD_HMS);
LocalDateTime etDateTime = LocalDateTime.parse(et, DTF_YMD_HMS);
criteria = criteria.and("createdAt").gte(stDateTime).lt(etDateTime);
} }
if (orderCode != null) { if (orderCode != null) {
criteria = criteria.and("orderCode").is(orderCode); criteria = criteria.and("orderCode").is(orderCode);
...@@ -940,7 +954,7 @@ public class GoblinMongoUtils { ...@@ -940,7 +954,7 @@ public class GoblinMongoUtils {
criteria = criteria.and("orderType").is("zhengzai").and("status").in(22, 28); criteria = criteria.and("orderType").is("zhengzai").and("status").in(22, 28);
break; break;
} }
}else{ } else {
criteria = criteria.and("status").in( criteria = criteria.and("status").in(
GoblinStatusConst.Status.ORDER_LOG_STATUS_11.getValue(), GoblinStatusConst.Status.ORDER_LOG_STATUS_11.getValue(),
GoblinStatusConst.Status.ORDER_LOG_STATUS_22.getValue(), GoblinStatusConst.Status.ORDER_LOG_STATUS_22.getValue(),
...@@ -1192,7 +1206,7 @@ public class GoblinMongoUtils { ...@@ -1192,7 +1206,7 @@ public class GoblinMongoUtils {
//根据艺人标签和演出查询商品 //根据艺人标签和演出查询商品
public List<GoblinGoodsInfoVo> getMusicTagPGoods(String musicTag, String performanceId) { public List<GoblinGoodsInfoVo> getMusicTagPGoods(String musicTag, String performanceId) {
Query query = Query.query(Criteria.where("extagVoList.tagName").is(musicTag) Query query = Query.query(Criteria.where("artagVoList.tagName").is(musicTag)
.and("delFlg").is("0").and("shelvesStatus").is("3")); .and("delFlg").is("0").and("shelvesStatus").is("3"));
return mongoTemplate.find(query, return mongoTemplate.find(query,
GoblinGoodsInfoVo.class, GoblinGoodsInfoVo.class,
......
...@@ -1216,9 +1216,9 @@ public class GoblinRedisUtils { ...@@ -1216,9 +1216,9 @@ public class GoblinRedisUtils {
// String rk = GoblinRedisConst.REDIS_ZZ_MUSIC_TAG.concat(musicTag + ":").concat(performanceId); // String rk = GoblinRedisConst.REDIS_ZZ_MUSIC_TAG.concat(musicTag + ":").concat(performanceId);
// Object obj = redisUtil.get(rk); // Object obj = redisUtil.get(rk);
// if (obj == null) { // if (obj == null) {
listVo = goblinMongoUtils.getMusicTagPGoods(musicTag, performanceId); listVo = goblinMongoUtils.getMusicTagPGoods(musicTag, performanceId);
// redisUtil.set(rk, listVo); // redisUtil.set(rk, listVo, 60 * 30);
return listVo; return listVo;
// } else { // } else {
// return (List<GoblinGoodsInfoVo>) obj; // return (List<GoblinGoodsInfoVo>) obj;
// } // }
......
...@@ -14,6 +14,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -14,6 +14,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid; import javax.validation.Valid;
@Slf4j @Slf4j
...@@ -53,6 +54,13 @@ public class GoblinOrderController { ...@@ -53,6 +54,13 @@ public class GoblinOrderController {
return goblinAppOrderService.refundSyncOrder(refundCallbackParam); return goblinAppOrderService.refundSyncOrder(refundCallbackParam);
} }
@PostMapping("paySuccess")
@ApiOperation("汇付支付成功回调")
@ResponseBody
public String refundDetails(HttpServletRequest request) {
return goblinAppOrderService.huiFuSync(request);
}
@PostMapping("payAgain") @PostMapping("payAgain")
@ApiOperation("再次支付") @ApiOperation("再次支付")
@ApiResponse(code = 200, message = "接口返回对象参数") @ApiResponse(code = 200, message = "接口返回对象参数")
......
package com.liquidnet.service.order.service.impl; package com.liquidnet.service.order.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import com.liquidnet.commons.lang.util.*; import com.liquidnet.commons.lang.util.*;
import com.liquidnet.service.base.ErrorMapping; import com.liquidnet.service.base.ErrorMapping;
...@@ -29,6 +30,7 @@ import org.springframework.stereotype.Service; ...@@ -29,6 +30,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap; import org.springframework.util.MultiValueMap;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
...@@ -37,8 +39,7 @@ import java.util.LinkedList; ...@@ -37,8 +39,7 @@ import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import static com.liquidnet.commons.lang.util.DateUtil.DTF_YMD_HMS; import static com.liquidnet.commons.lang.util.DateUtil.*;
import static com.liquidnet.commons.lang.util.DateUtil.getNowTime;
@Service @Service
@Slf4j @Slf4j
...@@ -385,7 +386,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService { ...@@ -385,7 +386,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
orderAttr.setOrderId(orderId); orderAttr.setOrderId(orderId);
if (!writeOffCode.equals("EMPTY")) { if (!writeOffCode.equals("EMPTY")) {
orderAttr.setExpressContacts(addressesVo.getName()); orderAttr.setExpressContacts(addressesVo.getName());
orderAttr.setExpressAddress(addressesVo.getProvince() + "," + addressesVo.getCounty() + "," + addressesVo.getCity()); orderAttr.setExpressAddress(addressesVo.getProvince() + " " + addressesVo.getCity() + " " + addressesVo.getCounty());
orderAttr.setExpressAddressDetail(addressesVo.getAddress()); orderAttr.setExpressAddressDetail(addressesVo.getAddress());
orderAttr.setExpressPhone(addressesVo.getPhone()); orderAttr.setExpressPhone(addressesVo.getPhone());
orderAttr.setExpressType(1); orderAttr.setExpressType(1);
...@@ -1033,4 +1034,135 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService { ...@@ -1033,4 +1034,135 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
} }
return "success"; return "success";
} }
@Override
public String huiFuSync(HttpServletRequest request) {
try {
// 验签请参data
String responseData = request.getParameter("resp_data");
// 验签请参sign
String sign = request.getParameter("sign");
// 使用汇付公钥验签
// if (!RsaUtils.verify(responseData, PUBLIC_KEY, sign)) {
// // 验签失败处理
// return "";
// }
JSONObject dataObj = JSON.parseObject(responseData);
String subRespCode = dataObj.getString("sub_resp_code");
String reqSeqId = dataObj.getString("req_seq_id");
String orderMasterCode = dataObj.getString("mer_ord_id");
String payCode = dataObj.getString("mer_ord_id");
String paymentType = dataObj.getString("trans_type");
String paymentId = dataObj.getString("hf_seq_id");
String paymentAt = dataObj.getString("end_time");
if ("00000000".equals(subRespCode)) {
log.debug("SYNC PARAM = " + responseData);
//支付时间
LocalDateTime now = LocalDateTime.now();
String[] array = redisUtils.getMasterCode(orderMasterCode);
String uid = "zhengzai";
BigDecimal priceActual = BigDecimal.ZERO;
for (String orderId : array) {
GoblinStoreOrderVo orderVo = redisUtils.getGoblinOrder(orderId);
if (orderVo.getStatus() == GoblinStatusConst.Status.ORDER_STATUS_4.getValue()) {
continue;
}
uid = orderVo.getUserId();
priceActual = priceActual.add(orderVo.getPriceActual());
if (orderVo == null) {
log.error("订单号:" + orderMasterCode + " 订单不存在");
return "fail";//订单不存在
}
LinkedList<String> sqls = CollectionUtil.linkedListString();
LinkedList<Object[]> sqlDataOrder = CollectionUtil.linkedListObjectArr();
LinkedList<Object[]> sqlDataSku = CollectionUtil.linkedListObjectArr();
GoblinStoreOrder storeOrder = GoblinStoreOrder.getNew();
storeOrder.setPaymentType(paymentType);
storeOrder.setPaymentId(paymentId);
storeOrder.setPayCode(payCode);
LocalDateTime payTime = LocalDateTime.parse(paymentAt, DTFYMDHMS);
storeOrder.setPayTime(payTime);
if (orderVo.getWriteOffCode().equals("EMPTY")) {
storeOrder.setWriteOffCode(IDGenerator.getWriteOffCode());
} else {
storeOrder.setWriteOffCode("");
}
storeOrder.setStatus(GoblinStatusConst.Status.ORDER_STATUS_4.getValue());
storeOrder.setUpdatedAt(now);
sqls.add(SqlMapping.get("goblin_order.pay.order"));
sqlDataOrder.add(new Object[]{
storeOrder.getPaymentType(), storeOrder.getPaymentId(), storeOrder.getPayCode(), storeOrder.getPayTime(), storeOrder.getWriteOffCode(), storeOrder.getStatus(), storeOrder.getUpdatedAt(),
orderId, now, now
});
sqls.add(SqlMapping.get("goblin_order.pay.sku"));
List<String> skuList = orderVo.getOrderSkuVoIds();
for (String orderSkuVoIds : skuList) {
GoblinOrderSkuVo orderSkuVo = redisUtils.getGoblinOrderSkuVo(orderSkuVoIds);
//增加销量
redisUtils.incrSkuSaleCount(orderSkuVo.getSpuId(), orderSkuVo.getSkuId(), orderSkuVo.getNum());
orderSkuVo.setStatus(GoblinStatusConst.Status.ORDER_STATUS_4.getValue());
//redis
redisUtils.setGoblinOrderSku(orderSkuVo.getOrderSkuId(), orderSkuVo);
//mongo
mongoUtils.updateGoblinOrderSkuVo(orderSkuVo.getOrderSkuId(), orderSkuVo);
//mongo 添加操作日志
GoblinOrderLogVo logVo = GoblinOrderLogVo.getNew();
logVo.setOrderId(orderVo.getOrderId());
logVo.setOrderCode(orderVo.getOrderCode());
logVo.setPayCode(orderVo.getPayCode());
logVo.setStoreId(orderVo.getStoreId());
if (orderSkuVo.getSkuId().indexOf(GoblinStatusConst.MarketPreStatus.MARKET_PRE_ZHENGZAI.getValue()) > 0) {
logVo.setOrderType("zhengzai");
} else {
logVo.setOrderType("order");
}
logVo.setSpuId(orderSkuVo.getSpuId());
logVo.setSkuId(orderSkuVo.getSkuId());
logVo.setSkuPriceActual(orderSkuVo.getSkuPriceActual().multiply(new BigDecimal(100)).longValue());
logVo.setStatus(GoblinStatusConst.Status.ORDER_LOG_STATUS_11.getValue());
logVo.setRemark(GoblinStatusConst.Status.ORDER_LOG_STATUS_11.getDesc());
logVo.setOperationId(uid);
logVo.setOperationName(orderVo.getUserName());
logVo.setOperationType(GoblinStatusConst.Type.OPERATION_TYPE_1.getValue());
logVo.setCreatedAt(LocalDateTime.now());
mongoUtils.insertGoblinOrderLogVo(logVo);
//mysql
sqlDataSku.add(new Object[]{
orderSkuVo.getStatus(), now,
orderSkuVo.getOrderSkuId(), now, now
});
}
//redis
orderVo.setPayCode(storeOrder.getPayCode());
orderVo.setPayTime(payTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
orderVo.setWriteOffCode(storeOrder.getWriteOffCode());
orderVo.setStatus(storeOrder.getStatus());
orderVo.setPaymentId(paymentId);
orderVo.setPaymentType(paymentType);
orderVo.setOrderSkuVoIds(skuList);
redisUtils.setGoblinOrder(orderId, orderVo);
redisUtils.setOffCode(orderVo.getWriteOffCode(), orderVo.getMasterOrderCode());
// //删除未支付订单
// redisUtils.removeGoblinOrder(orderVo.getRandomKey() + "", orderId);
//mongo
mongoUtils.updateGoblinStoreOrderVo(orderId, orderVo);
//mysql
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.GOBLIN_ORDER_CREATE_PAY.getKey(),
SqlMapping.gets(sqls, sqlDataOrder, sqlDataSku));
}
//加分
if (orderUtils.noZhengzaiOrder(uid)) {
orderUtils.doTask(uid, priceActual);
}
} else {
// 业务处理失败
log.info("处理失败");
}
return "RECV_ORD_ID_" + reqSeqId;
} catch (Exception e) {
log.info("异步回调开始,参数,request={},异常={}", request, e);
e.printStackTrace();
}
return "";
}
} }
...@@ -54,7 +54,7 @@ public class PlatformGoblinGoodsTaskController { ...@@ -54,7 +54,7 @@ public class PlatformGoblinGoodsTaskController {
try { try {
platformGoblinGoodsService.shelvesProcessing(spuIdList); platformGoblinGoodsService.shelvesProcessing(spuIdList);
} catch (Exception e) { } catch (Exception e) {
log.error("商品上架处理[totalCount={},spuIdList={}]", totalCount, JsonUtils.toJson(spuIdList)); log.error("Ex.商品上架处理[totalCount={},spuIdList={}],{}", totalCount, JsonUtils.toJson(spuIdList), e.getMessage());
return ResponseDto.failure(String.format("商品上架处理失败[totalCount=%s]", totalCount)); return ResponseDto.failure(String.format("商品上架处理失败[totalCount=%s]", totalCount));
} }
} }
......
...@@ -19,12 +19,12 @@ public class DataController { ...@@ -19,12 +19,12 @@ public class DataController {
private DataImpl data; private DataImpl data;
@PostMapping("phpGoodsOrder") // @PostMapping("phpGoodsOrder")
@ApiOperation("php今年订单迁移") // @ApiOperation("php今年订单迁移")
public ResponseDto<Boolean> fieldData() { // public ResponseDto<Boolean> fieldData() {
data.fieldData(); // data.fieldData();
return ResponseDto.success(); // return ResponseDto.success();
} // }
// @PostMapping("fieldData") // @PostMapping("fieldData")
// @ApiOperation("场地数据迁移") // @ApiOperation("场地数据迁移")
......
...@@ -51,9 +51,10 @@ public class PlatformGoblinGoodsService extends ServiceImpl<GoblinGoodsMapper, G ...@@ -51,9 +51,10 @@ public class PlatformGoblinGoodsService extends ServiceImpl<GoblinGoodsMapper, G
updateSkuWrapper.in(GoblinGoodsSku::getSpuId, spuIdList); updateSkuWrapper.in(GoblinGoodsSku::getSpuId, spuIdList);
updateSkuWrapper.eq(GoblinGoodsSku::getDelFlg, "0"); updateSkuWrapper.eq(GoblinGoodsSku::getDelFlg, "0");
LiquidnetServiceException liquidnetServiceException = new LiquidnetServiceException();
if (goblinGoodsSkuMapper.update(updateSku, updateSkuWrapper) > 0) { if (goblinGoodsSkuMapper.update(updateSku, updateSkuWrapper) > 0) {
UpdateResult updateSpuResult = mongoTemplate.getCollection(GoblinGoodsInfoVo.class.getSimpleName()).updateMany( UpdateResult updateSpuResult = mongoTemplate.getCollection(GoblinGoodsInfoVo.class.getSimpleName()).updateMany(
Query.query(Criteria.where("spuId").in(spuIdList).and("shelvesStatus").is("0").and("shelvesHandle").is("3")).getQueryObject(), Query.query(Criteria.where("spuId").in(spuIdList).and("shelvesStatus").in("0", "1").and("shelvesHandle").is("3")).getQueryObject(),
Update.update("shelvesStatus", "3").set("shelvesAt", now).getUpdateObject() Update.update("shelvesStatus", "3").set("shelvesAt", now).getUpdateObject()
); );
if (updateSpuResult.getModifiedCount() > 0) { if (updateSpuResult.getModifiedCount() > 0) {
...@@ -83,10 +84,15 @@ public class PlatformGoblinGoodsService extends ServiceImpl<GoblinGoodsMapper, G ...@@ -83,10 +84,15 @@ public class PlatformGoblinGoodsService extends ServiceImpl<GoblinGoodsMapper, G
Query.query(Criteria.where("spuId").in(spuIdList).and("shelvesAt").is(now)).getQueryObject(), Query.query(Criteria.where("spuId").in(spuIdList).and("shelvesAt").is(now)).getQueryObject(),
Update.update("shelvesStatus", "0").set("shelvesAt", of).getUpdateObject() Update.update("shelvesStatus", "0").set("shelvesAt", of).getUpdateObject()
); );
liquidnetServiceException.setMessage("更新失败:Mongo.GoblinGoodsSkuInfoVo");
} }
} else {
liquidnetServiceException.setMessage("更新失败:Mongo.GoblinGoodsInfoVo");
} }
} else {
liquidnetServiceException.setMessage("更新失败:Mysql.GoblinGoodsSku");
} }
throw new LiquidnetServiceException(); throw liquidnetServiceException;
} }
} }
} }
...@@ -9,6 +9,7 @@ import com.liquidnet.service.base.ResponseDto; ...@@ -9,6 +9,7 @@ import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.feign.stone.api.FeignStoneIntegralClient; import com.liquidnet.service.feign.stone.api.FeignStoneIntegralClient;
import com.liquidnet.service.goblin.constant.GoblinRedisConst; import com.liquidnet.service.goblin.constant.GoblinRedisConst;
import com.liquidnet.service.goblin.constant.GoblinStatusConst; import com.liquidnet.service.goblin.constant.GoblinStatusConst;
import com.liquidnet.service.goblin.dto.vo.GoblinMailVo;
import com.liquidnet.service.goblin.dto.vo.GoblinOrderAttrVo; import com.liquidnet.service.goblin.dto.vo.GoblinOrderAttrVo;
import com.liquidnet.service.goblin.dto.vo.GoblinOrderSkuVo; import com.liquidnet.service.goblin.dto.vo.GoblinOrderSkuVo;
import com.liquidnet.service.goblin.dto.vo.GoblinStoreOrderVo; import com.liquidnet.service.goblin.dto.vo.GoblinStoreOrderVo;
...@@ -74,7 +75,7 @@ public class DataImpl { ...@@ -74,7 +75,7 @@ public class DataImpl {
" m.matter_num as 'master_order_code',\n" + " m.matter_num as 'master_order_code',\n" +
" m.matter_num as 'order_code',\n" + " m.matter_num as 'order_code',\n" +
" m.out_trade_no as 'pay_code',\n" + " m.out_trade_no as 'pay_code',\n" +
" ifnull(user_id, user_id_new) as 'user_id',\n" + " m.user_id_new as 'user_id',\n" +
" m.matter_amount as 'price_total',\n" + " m.matter_amount as 'price_total',\n" +
" (m.matter_amount - m.coupon_type2_price) as 'price_actual',\n" + " (m.matter_amount - m.coupon_type2_price) as 'price_actual',\n" +
" m.price_send as 'price_express',\n" + " m.price_send as 'price_express',\n" +
...@@ -93,10 +94,14 @@ public class DataImpl { ...@@ -93,10 +94,14 @@ public class DataImpl {
" m.post_phone as 'express_phone',\n" + " m.post_phone as 'express_phone',\n" +
" m.post_address as 'express_address',\n" + " m.post_address as 'express_address',\n" +
" m.post_address as 'express_address_detail',\n" + " m.post_address as 'express_address_detail',\n" +
" m.created_at as 'created_at'\n" + " m.created_at as 'created_at',\n" +
"from matters as m\n" + " e.name as 'logistics_company',\n" +
" e.status as 'express_status',\n" +
" e.number as 'mail_no',\n" +
" e.created_at as 'delivery_time'\n" +
"from matters as m left join expresses as e on e.order_id = m.id and e.order_type = 'order_product'\n" +
"where m.status = 1\n" + "where m.status = 1\n" +
" and m.created_at >= '2022-01-01 00:00:00'"; " and m.created_at >= '2022-01-01 00:00:00' group by m.id;";
Connection connection = DriverManager.getConnection(SQL_URL, SQL_USER, SQL_PWD); Connection connection = DriverManager.getConnection(SQL_URL, SQL_USER, SQL_PWD);
//查询数据 //查询数据
PreparedStatement preparedStatement = connection.prepareStatement(sql); PreparedStatement preparedStatement = connection.prepareStatement(sql);
...@@ -107,7 +112,18 @@ public class DataImpl { ...@@ -107,7 +112,18 @@ public class DataImpl {
orderVo.setStoreId("dab4742921ba3555700896c4fafbee5b"); orderVo.setStoreId("dab4742921ba3555700896c4fafbee5b");
orderVo.setStoreName("摩登天空自营店"); orderVo.setStoreName("摩登天空自营店");
orderVo.setPayCountdownMinute(5); orderVo.setPayCountdownMinute(5);
orderVo.setStatus(GoblinStatusConst.Status.ORDER_STATUS_4.getValue()); //判断快递状态
String express_status = row.getString("express_status");
if (express_status == null) {
orderVo.setStatus(GoblinStatusConst.Status.ORDER_STATUS_2.getValue());
} else {
if (express_status.equals("3")) {
orderVo.setStatus(GoblinStatusConst.Status.ORDER_STATUS_4.getValue());
} else {
orderVo.setStatus(GoblinStatusConst.Status.ORDER_STATUS_3.getValue());
}
}
orderVo.setOrderId(row.getString("order_id")); orderVo.setOrderId(row.getString("order_id"));
orderVo.setMasterOrderCode(row.getString("master_order_code")); orderVo.setMasterOrderCode(row.getString("master_order_code"));
orderVo.setOrderCode(row.getString("order_code")); orderVo.setOrderCode(row.getString("order_code"));
...@@ -163,7 +179,7 @@ public class DataImpl { ...@@ -163,7 +179,7 @@ public class DataImpl {
while (rowSku.next()) { while (rowSku.next()) {
GoblinOrderSkuVo skuVo = GoblinOrderSkuVo.getNew(); GoblinOrderSkuVo skuVo = GoblinOrderSkuVo.getNew();
skuVo.setOrderId(orderVo.getOrderId()); skuVo.setOrderId(orderVo.getOrderId());
skuVo.setStatus(GoblinStatusConst.Status.ORDER_STATUS_4.getValue()); skuVo.setStatus(orderVo.getStatus());
skuVo.setOrderSkuId(rowSku.getString("order_sku_id")); skuVo.setOrderSkuId(rowSku.getString("order_sku_id"));
skuVo.setSpuId(rowSku.getString("spu_id")); skuVo.setSpuId(rowSku.getString("spu_id"));
skuVo.setSkuId(rowSku.getString("sku_id")); skuVo.setSkuId(rowSku.getString("sku_id"));
...@@ -172,15 +188,27 @@ public class DataImpl { ...@@ -172,15 +188,27 @@ public class DataImpl {
skuVo.setSkuPriceActual(rowSku.getBigDecimal("sku_price_actual")); skuVo.setSkuPriceActual(rowSku.getBigDecimal("sku_price_actual"));
skuVo.setSkuName(rowSku.getString("sku_specs")); skuVo.setSkuName(rowSku.getString("sku_specs"));
skuVo.setSkuImage(rowSku.getString("sku_image")); skuVo.setSkuImage(rowSku.getString("sku_image"));
skuVo.setSkuSpecs("[{\"specName\":\""+rowSku.getString("sku_name")+"\",\"specVname\":\""+rowSku.getString("sku_specs")+"\"}]");// skuVo.setSkuSpecs("[{\"specName\":\"" + rowSku.getString("sku_name") + "\",\"specVname\":\"" + rowSku.getString("sku_specs") + "\"}]");//
skuVo.setSpuName(rowSku.getString("spu_name")); skuVo.setSpuName(rowSku.getString("spu_name"));
skuVo.setCreatedAt(orderVo.getCreatedAt()); skuVo.setCreatedAt(orderVo.getCreatedAt());
setGoblinOrderSku(skuVo.getOrderSkuId(), skuVo); setGoblinOrderSku(skuVo.getOrderSkuId(), skuVo);
orderSkuIds.add(skuVo.getOrderSkuId()); orderSkuIds.add(skuVo.getOrderSkuId());
} }
//判断快递
if (express_status != null) {
GoblinMailVo mailVo = GoblinMailVo.getNew();
mailVo.setMailId(IDGenerator.nextTimeId2());
mailVo.setOrderId(orderVo.getOrderId());
mailVo.setMailNo(row.getString("mail_no"));
mailVo.setDeliveryTime(row.getString("delivery_time"));
mailVo.setLogisticsCompany(row.getString("logistics_company"));
mailVo.setOrderSkuVoIds(orderSkuIds);
setGoblinMail(orderVo.getOrderId(), mailVo);
}
orderVo.setOrderSkuVoIds(orderSkuIds); orderVo.setOrderSkuVoIds(orderSkuIds);
setGoblinOrder(orderVo.getOrderId(),orderVo); setGoblinOrder(orderVo.getOrderId(), orderVo);
addOrderList(orderVo.getUserId(),orderVo.getOrderId()); // addOrderList(orderVo.getUserId(), orderVo.getOrderId());
rowSku.close(); rowSku.close();
preparedStatementSku.close(); preparedStatementSku.close();
...@@ -227,4 +255,18 @@ public class DataImpl { ...@@ -227,4 +255,18 @@ public class DataImpl {
return (List<String>) obj; return (List<String>) obj;
} }
} }
// 赋值 快递vo
public void setGoblinMail(String orderId, GoblinMailVo vo) {
String redisKey = GoblinRedisConst.REDIS_GOBLIN_MAIL.concat(orderId);
List<GoblinMailVo> list = goblinMailVoList();
list.add(vo);
redisDataSourceUtil.getRedisKylinUtil().set(redisKey, list);
}
private static final ArrayList<GoblinMailVo> goblinMailVo = new ArrayList<>();
public static ArrayList<GoblinMailVo> goblinMailVoList() {
return (ArrayList<GoblinMailVo>) goblinMailVo.clone();
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment