|
|
|
@ -4,15 +4,16 @@ import cn.chjyj.szwh.mapper.GoodsMapper; |
|
|
|
import cn.chjyj.szwh.mapper.OrderGoodsDetailMapper; |
|
|
|
import cn.chjyj.szwh.mapper.OrderMapper; |
|
|
|
import cn.chjyj.szwh.service.IndexService; |
|
|
|
import cn.chjyj.szwh.utils.SzwhApiUtils; |
|
|
|
import cn.chjyj.szwh.vo.GoodsDetailVo; |
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.Calendar; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
@Service |
|
|
|
public class IndexServiceImpl implements IndexService { |
|
|
|
@ -24,7 +25,7 @@ public class IndexServiceImpl implements IndexService { |
|
|
|
private OrderGoodsDetailMapper orderGoodsDetailMapper; |
|
|
|
|
|
|
|
@Override |
|
|
|
public Map<String, Object> getCountSys(String dateFlag) { |
|
|
|
public Map<String, Object> getCountSys(String leftDate,String rightDate,String saleRankingDate) { |
|
|
|
// 拼装查询结果
|
|
|
|
Map<String,Object> result = new HashMap<>(); |
|
|
|
|
|
|
|
@ -112,16 +113,33 @@ public class IndexServiceImpl implements IndexService { |
|
|
|
calendar.add(Calendar.YEAR,-1); |
|
|
|
String lastyear = sdf.format(calendar.getTime()); |
|
|
|
// 时刻跨度
|
|
|
|
String dtzone = ""; |
|
|
|
switch (dateFlag){ |
|
|
|
case "year":dtzone=last5years+" and "+nowtime;break; |
|
|
|
case "month":dtzone=lastyear+" and "+nowtime;break; |
|
|
|
default:dtzone=lastMonth+ " and "+nowtime;break; |
|
|
|
String[] dtzone=new String[2]; |
|
|
|
switch (rightDate){ |
|
|
|
case "year":dtzone[0]=last5years;dtzone[1]=nowtime;break; |
|
|
|
case "month":dtzone[0]=lastyear;dtzone[1]=nowtime;break; |
|
|
|
default:dtzone[0]=lastMonth;dtzone[1]=nowtime;break; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//委托方排名
|
|
|
|
result.put("entrust_ranking",goodsCount); |
|
|
|
List entrustRanking = new ArrayList(); |
|
|
|
List<GoodsDetailVo> tjgoods=goodsMapper.goodsUserIslicodeDtzone(dtzone[0],dtzone[1]); |
|
|
|
for(GoodsDetailVo gvo:tjgoods){ |
|
|
|
Map<String,Object> fmap =new HashMap<>(); |
|
|
|
// 查找对应的用户
|
|
|
|
String uislicode = gvo.getUser_islicode(); |
|
|
|
JSONObject userjson =SzwhApiUtils.getApiUser(uislicode); |
|
|
|
JSONArray ujsonArray = userjson.getJSONArray("data"); |
|
|
|
if(ujsonArray==null){ |
|
|
|
fmap.put("username",gvo.getUser_islicode()); |
|
|
|
}else { |
|
|
|
fmap.put("username",ujsonArray.get(1)); |
|
|
|
} |
|
|
|
fmap.put("count",gvo.getCcount()); |
|
|
|
entrustRanking.add(fmap); |
|
|
|
} |
|
|
|
result.put("entrust_ranking",entrustRanking); |
|
|
|
|
|
|
|
//委托方销售排序
|
|
|
|
result.put("entrust_sale_ranking",goodsCount); |
|
|
|
result.put("treeMap",goodsCount); |
|
|
|
result.put("label",goodsCount); |
|
|
|
|