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

Commit 4c74b669 authored by 胡佳晨's avatar 胡佳晨

提交 资金模块时间搜索

parent b41d7ef0
...@@ -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);
......
...@@ -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")
......
...@@ -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
...@@ -807,9 +809,14 @@ public class GoblinMongoUtils { ...@@ -807,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);
...@@ -858,7 +865,9 @@ public class GoblinMongoUtils { ...@@ -858,7 +865,9 @@ 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);
...@@ -921,6 +930,8 @@ public class GoblinMongoUtils { ...@@ -921,6 +930,8 @@ 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) {
LocalDateTime stDateTime = LocalDateTime.parse(st, DTF_YMD_HMS);
LocalDateTime etDateTime = LocalDateTime.parse(et, DTF_YMD_HMS);
criteria = criteria.and("createdAt").gte(st).lt(et); criteria = criteria.and("createdAt").gte(st).lt(et);
} }
if (orderCode != null) { if (orderCode != null) {
......
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