Merge remote-tracking branch 'origin/div' into 2.1.2
| | |
| | | if (VersionUtil.greaterThan_2_0_7(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | UserInviteLevelEnum level = null;
|
| | | // VIP预览信息
|
| | | if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | if (VersionUtil.greaterThan_2_1_1(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | String redisContent = previewInfoService.getRedisContent(uid, PreviewEnum.mineInfo);
|
| | | if (!StringUtil.isNullOrEmpty(redisContent)) {
|
| | | MineInfoVO vo = new Gson().fromJson(redisContent, MineInfoVO.class);
|
| | |
| | |
|
| | | }
|
| | |
|
| | | data.put("user", JsonUtil.getConvertBigDecimalToStringBuilder(gsonBuilder).create().toJson(userInfo));
|
| | |
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | |
|
| | | final UserInfo uuser = userInfo;
|
| | |
| | | import com.yeshi.fanli.util.annotation.RequestSerializableByKey;
|
| | | import com.yeshi.fanli.util.user.UserLevelUtil;
|
| | | import com.yeshi.fanli.util.wx.WXLoginUtil;
|
| | | import com.yeshi.fanli.vo.order.OrderRankingVO;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
| | | @RequestMapping(value = "countTeamNum")
|
| | | public void countTeamNum(String callback, AcceptData acceptData, Long uid, PrintWriter out) {
|
| | | try {
|
| | | |
| | | Date minDate = null;
|
| | | Date maxDate = null;
|
| | | long timeStamp = System.currentTimeMillis();
|
| | |
| | | }
|
| | |
|
| | |
|
| | | |
| | | /**
|
| | | * 邀请排行榜
|
| | | * @param callback
|
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param dateType
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getRanking")
|
| | | public void getRanking(String callback, AcceptData acceptData, Long uid, Integer dateType, PrintWriter out) {
|
| | | if (uid == null || dateType == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("参数缺失"));
|
| | | return;
|
| | | }
|
| | | |
| | | try {
|
| | | Date minDate = null;
|
| | | Date maxDate = null;
|
| | | long timeStamp = System.currentTimeMillis();
|
| | | Calendar calendar = Calendar.getInstance();
|
| | | calendar.setTimeInMillis(timeStamp);
|
| | | |
| | | if (dateType == 1) {
|
| | | // 今日
|
| | | calendar.add(Calendar.DAY_OF_YEAR, -1);
|
| | | minDate = new Date(TimeUtil.convertDateToTemp(TimeUtil.getGernalTime(timeStamp)));
|
| | | } else if (dateType == 2) {
|
| | | // 昨日
|
| | | calendar.add(Calendar.DAY_OF_YEAR, -1);
|
| | | maxDate = new Date(TimeUtil.convertDateToTemp(TimeUtil.getGernalTime(timeStamp)));
|
| | | minDate = DateUtil.reduceDay(1, maxDate);
|
| | | } else {
|
| | | // 本月
|
| | | maxDate = new Date(timeStamp);
|
| | | calendar = Calendar.getInstance();
|
| | | minDate = new Date(TimeUtil
|
| | | .convertToTimeTemp(calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) + 1), "yyyy-M"));
|
| | | calendar.add(Calendar.MONTH, -1);
|
| | | }
|
| | | |
| | | |
| | | List<OrderRankingVO> list = teamDailyRecordService.getRankingByFirstNum(uid, minDate, maxDate);
|
| | | if (list.size() > 0) {
|
| | | for (OrderRankingVO vo: list) {
|
| | | UserInfo user = userInfoService.getUserByIdWithMybatis(vo.getUid());
|
| | | vo.setNickName(user.getNickName());
|
| | | vo.setPortrait(user.getPortrait());
|
| | | }
|
| | | }
|
| | | |
| | | JSONObject json = new JSONObject();
|
| | | json.put("list", list);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(json));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("统计失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | }
|
| | |
| | | }
|
| | | try {
|
| | | previewInfoService.saveExtractRecord(uid, dayTime, money);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("保存成功"));
|
| | | } catch (PreviewInfoException e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
|
| | | }
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("保存成功"));
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "getExtractRecord")
|
| | |
| | | list = new ArrayList<>();
|
| | |
|
| | | JSONArray JSONArray = new JSONArray();
|
| | | |
| | | if (list.size() > 0) {
|
| | | for (Extract extract : list) {
|
| | | Date receiveTime = extract.getReceiveTime();
|
| | |
| | | @RequestMapping(value = "saveMoneyArrival")
|
| | | public void saveMoneyArrival(String callback, AcceptData acceptData, Long uid, BigDecimal money, String dayTime,
|
| | | String orderNo, PrintWriter out) {
|
| | | if (uid == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("用户未登录"));
|
| | | return;
|
| | | }
|
| | |
|
| | | try {
|
| | | String link = previewInfoService.saveMoneyArrival(uid, money, dayTime, orderNo);
|
| | | String link = previewInfoService.saveMoneyArrival(uid, money, dayTime, orderNo, acceptData.getPlatform());
|
| | | JSONObject object = new JSONObject();
|
| | | object.put("link", link);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(object));
|
| | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("保存失败"));
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("预览失败"));
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | import com.yeshi.fanli.vo.money.MoneyPredictVO;
|
| | | import com.yeshi.fanli.vo.money.MoneyStatisticVO;
|
| | | import com.yeshi.fanli.vo.money.TeamPredictVO;
|
| | | import com.yeshi.fanli.vo.order.OrderRankingVO;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
| | |
|
| | | private OrderMoneyDailyCount createVO(List<OrderMoneyDailyCount> list) {
|
| | | OrderMoneyDailyCount totalityRecord = new OrderMoneyDailyCount(0,0,0);
|
| | | |
| | | if (list != null && list.size() > 0) {
|
| | | for (OrderMoneyDailyCount record: list) {
|
| | | totalityRecord.setDirectOrderNum(totalityRecord.getDirectOrderNum() + record.getDirectOrderNum());
|
| | |
| | | totalityRecord.setBeyondOrderNum(totalityRecord.getBeyondOrderNum() + record.getBeyondOrderNum());
|
| | | }
|
| | | }
|
| | | |
| | | return totalityRecord;
|
| | | }
|
| | | |
| | | |
| | | |
| | | /**
|
| | | * 订单排行榜
|
| | | * @param callback
|
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param dateType
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getRanking")
|
| | | public void getRanking(String callback, AcceptData acceptData, Long uid, Integer dateType, PrintWriter out) {
|
| | | if (uid == null || dateType == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("参数缺失"));
|
| | | return;
|
| | | }
|
| | | |
| | | try {
|
| | | Date minDate = null;
|
| | | Date maxDate = null;
|
| | | long timeStamp = System.currentTimeMillis();
|
| | | |
| | | Calendar calendar = Calendar.getInstance();
|
| | | calendar.setTimeInMillis(timeStamp);
|
| | | |
| | | if (dateType == 1) {
|
| | | // 今日
|
| | | calendar.add(Calendar.DAY_OF_YEAR, -1);
|
| | | minDate = new Date(TimeUtil.convertDateToTemp(TimeUtil.getGernalTime(timeStamp)));
|
| | | } else if (dateType == 2) {
|
| | | // 昨日
|
| | | calendar.add(Calendar.DAY_OF_YEAR, -1);
|
| | | maxDate = new Date(TimeUtil.convertDateToTemp(TimeUtil.getGernalTime(timeStamp)));
|
| | | minDate = DateUtil.reduceDay(1, maxDate);
|
| | | } else {
|
| | | // 本月
|
| | | maxDate = new Date(timeStamp);
|
| | | calendar = Calendar.getInstance();
|
| | | minDate = new Date(TimeUtil
|
| | | .convertToTimeTemp(calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) + 1), "yyyy-M"));
|
| | | calendar.add(Calendar.MONTH, -1);
|
| | | }
|
| | | |
| | | List<OrderRankingVO> list = orderMoneyDailyCountService.getRankingByOrderNum(uid, minDate, maxDate);
|
| | | if (list.size() > 0) {
|
| | | for (OrderRankingVO vo: list) {
|
| | | UserInfo user = userInfoService.getUserByIdWithMybatis(vo.getUid());
|
| | | vo.setNickName(user.getNickName());
|
| | | vo.setPortrait(user.getPortrait());
|
| | | }
|
| | | }
|
| | | |
| | | JSONObject json = new JSONObject();
|
| | | json.put("list", list);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(json));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("统计失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | import java.util.Map;
|
| | |
|
| | | import org.springframework.data.domain.Sort;
|
| | | import org.springframework.data.mongodb.core.aggregation.Aggregation;
|
| | | import org.springframework.data.mongodb.core.aggregation.AggregationOperation;
|
| | | import org.springframework.data.mongodb.core.aggregation.AggregationResults;
|
| | | import org.springframework.data.mongodb.core.aggregation.LookupOperation;
|
| | | import org.springframework.data.mongodb.core.query.Criteria;
|
| | | import org.springframework.data.mongodb.core.query.Query;
|
| | | import org.springframework.data.mongodb.core.query.Update;
|
| | | import org.springframework.stereotype.Repository;
|
| | | import org.yeshi.utils.DateUtil;
|
| | |
|
| | | import com.mongodb.BasicDBList;
|
| | | import com.mongodb.BasicDBObject;
|
| | |
| | | import com.yeshi.fanli.dao.MongodbBaseDao;
|
| | | import com.yeshi.fanli.entity.order.OrderMoneyDailyCount;
|
| | | import com.yeshi.fanli.entity.order.OrderMoneyDailyCount.SourceTypeEnum;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.vo.order.OrderRankingVO;
|
| | |
|
| | | @Repository
|
| | | public class OrderMoneyDailyCountDao extends MongodbBaseDao<OrderMoneyDailyCount> {
|
| | |
| | | }
|
| | | return results;
|
| | | }
|
| | | |
| | | |
| | | |
| | | /**
|
| | | * 根据订单排行榜进行uid分组订单数量排序
|
| | | * @param uid
|
| | | * @param minDate
|
| | | * @param maxDate
|
| | | * @return
|
| | | */
|
| | | public List<OrderRankingVO> getRankingByOrderNum(Long uid, Date minDate, Date maxDate) {
|
| | | LookupOperation lookupToLots = LookupOperation.newLookup().
|
| | | from("order_money_daily_count").//关联表名,多方
|
| | | localField("workerUid").// 主表关联字段
|
| | | foreignField("uid").// 次表字段关联字段
|
| | | as("orders"); // 次表的别名
|
| | |
|
| | | // 查询条件
|
| | | List<Criteria> list = new ArrayList<Criteria>();
|
| | | list.add(Criteria.where("bossUid").is(uid));
|
| | | if (minDate != null) {
|
| | | minDate = DateUtil.reduceDay(minDate, 1);
|
| | | list.add(Criteria.where("orders.countDay").gt(minDate));
|
| | | }
|
| | | if (maxDate != null) {
|
| | | maxDate = DateUtil.reduceDay(maxDate, 1);
|
| | | list.add(Criteria.where("orders.countDay").lte(maxDate));
|
| | | }
|
| | | // 转换数组
|
| | | Criteria[] cas = new Criteria[list.size()];
|
| | | for (int i = 0; i < list.size(); i++)
|
| | | cas[i] = list.get(i);
|
| | | // 查询参数
|
| | | Criteria criteria = new Criteria().andOperator(cas);
|
| | | |
| | | |
| | | List<AggregationOperation> aggs = new ArrayList<>(); |
| | | // 左连接
|
| | | aggs.add(lookupToLots); |
| | | // 拆分子数组
|
| | | aggs.add(Aggregation.unwind("orders"));
|
| | | // 条件匹配
|
| | | aggs.add(Aggregation.match(criteria)); |
| | | // 需要返回的字段
|
| | | aggs.add(Aggregation.project().and("workerUid").as("workerUid").and("level").as("level")
|
| | | .and("orders.orderNum").as("number"));
|
| | | // 分组求和并返回
|
| | | aggs.add(Aggregation.group("workerUid").first("workerUid").as("workerUid").first("level").as("level")
|
| | | .sum("number").as("number")); |
| | | // 排序
|
| | | aggs.add(Aggregation.sort(new Sort(Sort.Direction.DESC, "number"))); |
| | | aggs.add(Aggregation.limit(10)); |
| | | |
| | | // 组织条件
|
| | | Aggregation agg = Aggregation.newAggregation(aggs); |
| | | // 执行查询
|
| | | AggregationResults<BasicDBObject> results = mongoTemplate.aggregate(agg, "threeSaleDetail", BasicDBObject.class);
|
| | | |
| | | // 返回结果处理
|
| | | List<BasicDBObject> livevideo = results.getMappedResults();
|
| | | |
| | | List<OrderRankingVO> resultList = new ArrayList<>();
|
| | | for (BasicDBObject obj : livevideo) {
|
| | | Object object = obj.get("workerUid");
|
| | | if (object == null) {
|
| | | continue;
|
| | | }
|
| | | |
| | | OrderRankingVO vo = new OrderRankingVO();
|
| | | vo.setUid(new BigDecimal(obj.get("workerUid").toString()).longValue());
|
| | | vo.setGrade(new BigDecimal(obj.get("level").toString()).intValue());
|
| | | vo.setNumber(new BigDecimal(obj.get("number").toString()).intValue());
|
| | | resultList.add(vo); |
| | | }
|
| | | return resultList;
|
| | | }
|
| | | }
|
| | |
| | | import java.util.Locale;
|
| | | import java.util.Map;
|
| | |
|
| | | import org.springframework.data.domain.Sort;
|
| | | import org.springframework.data.mongodb.core.aggregation.Aggregation;
|
| | | import org.springframework.data.mongodb.core.aggregation.AggregationOperation;
|
| | | import org.springframework.data.mongodb.core.aggregation.AggregationResults;
|
| | | import org.springframework.data.mongodb.core.aggregation.LookupOperation;
|
| | | import org.springframework.data.mongodb.core.query.Criteria;
|
| | | import org.springframework.data.mongodb.core.query.Query;
|
| | | import org.springframework.data.mongodb.core.query.Update;
|
| | | import org.springframework.stereotype.Repository;
|
| | | import org.yeshi.utils.DateUtil;
|
| | |
|
| | | import com.mongodb.BasicDBList;
|
| | | import com.mongodb.BasicDBObject;
|
| | |
| | | import com.mongodb.GroupCommand;
|
| | | import com.yeshi.fanli.dao.MongodbBaseDao;
|
| | | import com.yeshi.fanli.entity.bus.user.invite.TeamDailyRecord;
|
| | | import com.yeshi.fanli.vo.order.OrderRankingVO;
|
| | |
|
| | | @Repository
|
| | | public class TeamDailyRecordDao extends MongodbBaseDao<TeamDailyRecord> {
|
| | |
| | | }
|
| | | return results;
|
| | | }
|
| | | |
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 根据订单排行榜进行uid分组订单数量排序
|
| | | * @param uid
|
| | | * @param minDate
|
| | | * @param maxDate
|
| | | * @return
|
| | | */
|
| | | public List<OrderRankingVO> getRankingByFirstNum(Long uid, Date minDate, Date maxDate) {
|
| | | LookupOperation lookupToLots = LookupOperation.newLookup().
|
| | | from("teamDailyRecord").//关联表名,多方
|
| | | localField("workerUid").// 主表关联字段
|
| | | foreignField("uid").// 次表字段关联字段
|
| | | as("result"); // 次表的别名
|
| | |
|
| | | // 查询条件
|
| | | List<Criteria> list = new ArrayList<Criteria>();
|
| | | list.add(Criteria.where("bossUid").is(uid));
|
| | | if (minDate != null) {
|
| | | minDate = DateUtil.reduceDay(minDate, 1);
|
| | | list.add(Criteria.where("orders.countDay").gt(minDate));
|
| | | }
|
| | | if (maxDate != null) {
|
| | | maxDate = DateUtil.reduceDay(maxDate, 1);
|
| | | list.add(Criteria.where("orders.countDay").lte(maxDate));
|
| | | }
|
| | | |
| | | // 转换数组
|
| | | Criteria[] cas = new Criteria[list.size()];
|
| | | for (int i = 0; i < list.size(); i++)
|
| | | cas[i] = list.get(i);
|
| | | // 查询参数
|
| | | Criteria criteria = new Criteria().andOperator(cas);
|
| | | |
| | | |
| | | List<AggregationOperation> aggs = new ArrayList<>(); |
| | | // 左连接
|
| | | aggs.add(lookupToLots); |
| | | // 拆分子数组
|
| | | aggs.add(Aggregation.unwind("result"));
|
| | | // 条件匹配
|
| | | aggs.add(Aggregation.match(criteria)); |
| | | // 需要返回的字段
|
| | | aggs.add(Aggregation.project().and("workerUid").as("workerUid").and("level").as("level")
|
| | | .and("result.firstNum").as("number"));
|
| | | // 分组求和并返回
|
| | | aggs.add(Aggregation.group("workerUid").first("workerUid").as("workerUid").first("level").as("level")
|
| | | .sum("number").as("number")); |
| | | // 排序
|
| | | aggs.add(Aggregation.sort(new Sort(Sort.Direction.DESC, "number"))); |
| | | aggs.add(Aggregation.limit(10)); |
| | | |
| | | // 组织条件
|
| | | Aggregation agg = Aggregation.newAggregation(aggs); |
| | | // 执行查询
|
| | | AggregationResults<BasicDBObject> results = mongoTemplate.aggregate(agg, "threeSaleDetail", BasicDBObject.class);
|
| | | |
| | | // 返回结果处理
|
| | | List<BasicDBObject> livevideo = results.getMappedResults();
|
| | | |
| | | List<OrderRankingVO> resultList = new ArrayList<>();
|
| | | for (BasicDBObject obj : livevideo) {
|
| | | Object object = obj.get("workerUid");
|
| | | if (object == null) {
|
| | | continue;
|
| | | }
|
| | | |
| | | OrderRankingVO vo = new OrderRankingVO();
|
| | | vo.setUid(new BigDecimal(obj.get("workerUid").toString()).longValue());
|
| | | vo.setGrade(new BigDecimal(obj.get("level").toString()).intValue());
|
| | | vo.setNumber(new BigDecimal(obj.get("number").toString()).intValue());
|
| | | resultList.add(vo); |
| | | }
|
| | | return resultList;
|
| | | }
|
| | | }
|
| | |
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil; |
| | | import com.yeshi.fanli.util.RedisManager; |
| | | import com.yeshi.fanli.util.StringUtil; |
| | | import com.yeshi.fanli.util.TimeUtil; |
| | | import com.yeshi.fanli.util.cache.JDGoodsCacheUtil; |
| | | import com.yeshi.fanli.util.cache.PinDuoDuoCacheUtil; |
| | | import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory; |
| | |
| | | |
| | | try { |
| | | Date now = new Date(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | ConfigParamsDTO params = orderHongBaoMoneyComputeService.getShowComputeRate("android", "55"); |
| | | params.setBaseFanliRate(hongBaoManageService.getBaseFanliRate()); |
| | | for (GoodsEvaluate goodsEvaluate : list) { |
| | |
| | | if (commentInfoEnum != null && commentInfoEnum == CommentInfoEnum.currencyCoupon) { |
| | | String endTime = commentInfo.getEndTime(); |
| | | if (!StringUtil.isNullOrEmpty(endTime)) { |
| | | Date endDay = sdf.parse(endTime); |
| | | Date endDay = format.parse(endTime); |
| | | if (endDay.getTime() < now.getTime()) { |
| | | goodsEvaluate.setState(0); // 活动过期 |
| | | } |
| | |
| | | import com.yeshi.fanli.util.StringUtil; |
| | | import com.yeshi.fanli.util.TimeUtil; |
| | | import com.yeshi.fanli.util.annotation.RequestSerializableByKeyService; |
| | | import com.yeshi.fanli.vo.order.OrderRankingVO; |
| | | |
| | | @Service |
| | | public class OrderMoneyDailyCountServiceImpl implements OrderMoneyDailyCountService { |
| | |
| | | return orderMoneyDailyCountDao.sumTeamOrderNumGroupByUid(uid, minDay, maxDay); |
| | | } |
| | | |
| | | @Override |
| | | public List<OrderRankingVO> getRankingByOrderNum(Long uid, Date minDay, Date maxDay) { |
| | | return orderMoneyDailyCountDao.getRankingByOrderNum(uid, minDay, maxDay); |
| | | } |
| | | } |
| | |
| | | package com.yeshi.fanli.service.impl.user; |
| | | |
| | | import java.io.InputStream; |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.Comparator; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.springframework.stereotype.Service; |
| | | import org.yeshi.utils.entity.FileUploadResult; |
| | | import org.yeshi.utils.tencentcloud.COSManager; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.reflect.TypeToken; |
| | |
| | | import com.yeshi.fanli.service.inter.money.extract.BindingAccountService; |
| | | import com.yeshi.fanli.service.inter.user.PreviewInfoService; |
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleDetailService; |
| | | import com.yeshi.fanli.util.ImageUtil; |
| | | import com.yeshi.fanli.util.RedisManager; |
| | | import com.yeshi.fanli.util.StringUtil; |
| | | import com.yeshi.fanli.util.TimeUtil; |
| | |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public void save(Long createUid, Long preUid, PreviewEnum type, String content) { |
| | | String id = StringUtil.Md5(createUid + "#" + type.name()); |
| | |
| | | info.setUpdateTime(new Date()); |
| | | previewInfoDao.save(info); |
| | | |
| | | if (type == PreviewEnum.extractRecord) { |
| | | if (type == PreviewEnum.extractRecord || type == PreviewEnum.moneyArrival) { |
| | | return; |
| | | } |
| | | |
| | | // redis缓存 |
| | | if (StringUtil.isNullOrEmpty(content)) { |
| | | removePreview(preUid, type); |
| | | } else { |
| | | adddPreview(preUid, type, content); |
| | | } |
| | | |
| | | } |
| | | |
| | | // 缓存10分钟 |
| | |
| | | |
| | | |
| | | @Override |
| | | public String saveMoneyArrival(Long uid, BigDecimal money, String time,String orderNo) throws PreviewInfoException { |
| | | public String saveMoneyArrival(Long uid, BigDecimal money, String time,String orderNo, String platform) |
| | | throws PreviewInfoException,Exception { |
| | | if (uid == null ) |
| | | throw new PreviewInfoException(1, "请先登录"); |
| | | if (money == null ) |
| | | throw new PreviewInfoException(1, "请输入金额"); |
| | | if(StringUtil.isNullOrEmpty(time)) |
| | | if(StringUtil.isNullOrEmpty(orderNo)) |
| | | throw new PreviewInfoException(1, "请输入订单号"); |
| | | if(StringUtil.isNullOrEmpty(time)) |
| | | throw new PreviewInfoException(1, "请输入创建时间"); |
| | | Date parse = TimeUtil.parseDotCommon2(time); |
| | | if (parse == null) |
| | | Date date = TimeUtil.parseDotCommon2(time); |
| | | if (date == null) |
| | | throw new PreviewInfoException(1, "请输入正确的时间格式,如:2020.01.01 01:01"); |
| | | |
| | | // 转换格式 |
| | | time = TimeUtil.formatYMDHHMM(date); |
| | | |
| | | String content = ""; // TODO |
| | | // save(uid, PreviewEnum.moneyArrival, gson.toJson(infoVO)); |
| | | return content; |
| | | InputStream drawStream = null; |
| | | if ("ios".equalsIgnoreCase(platform)) { |
| | | drawStream = ImageUtil.drawAlipayIOS(money, orderNo, time); |
| | | } else { |
| | | drawStream = ImageUtil.drawAlipayAndroid(money, orderNo, time); |
| | | } |
| | | |
| | | if (drawStream == null) |
| | | throw new PreviewInfoException(1, "预览生成失败"); |
| | | |
| | | // 上传文件 |
| | | String uuid = UUID.randomUUID().toString().replace("-", ""); |
| | | String upPath = "/user/img/preview/" + uuid + "_" + System.currentTimeMillis() + ".png"; |
| | | FileUploadResult result = COSManager.getInstance().uploadInputStream(drawStream, upPath); |
| | | if (result == null) { |
| | | throw new PreviewInfoException(1, "预览生成失败"); |
| | | } |
| | | |
| | | // 保存信息 |
| | | save(uid, uid, PreviewEnum.moneyArrival, result.getUrl()); |
| | | |
| | | return result.getUrl(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.vo.order.OrderRankingVO;
|
| | |
|
| | | @Service
|
| | | public class TeamDailyRecordServiceImpl implements TeamDailyRecordService {
|
| | |
| | | return teamDailyRecordDao.sumTeamNumGroupByUid(uid, minDay, maxDay);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<OrderRankingVO> getRankingByFirstNum(Long uid, Date minDay, Date maxDay) {
|
| | | return teamDailyRecordDao.getRankingByFirstNum(uid, minDay, maxDay);
|
| | | }
|
| | | }
|
| | |
| | | import java.util.List; |
| | | |
| | | import com.yeshi.fanli.entity.order.OrderMoneyDailyCount; |
| | | import com.yeshi.fanli.vo.order.OrderRankingVO; |
| | | |
| | | public interface OrderMoneyDailyCountService { |
| | | |
| | |
| | | |
| | | public List<OrderMoneyDailyCount> sumTeamOrderNumGroupByUid(Long uid, Date minDay, Date maxDay); |
| | | |
| | | /** |
| | | * 我的订单排行榜 |
| | | * @param uid |
| | | * @param minDay |
| | | * @param maxDay |
| | | * @return |
| | | */ |
| | | public List<OrderRankingVO> getRankingByOrderNum(Long uid, Date minDay, Date maxDay); |
| | | |
| | | |
| | | } |
| | |
| | | * @param orderNo
|
| | | * @throws PreviewInfoException
|
| | | */
|
| | | public String saveMoneyArrival(Long uid, BigDecimal money, String time, String orderNo) throws PreviewInfoException;
|
| | | public String saveMoneyArrival(Long uid, BigDecimal money, String time, String orderNo, String platform) throws PreviewInfoException, Exception;
|
| | |
|
| | | public void saveMoneyInfo(Long uid, MoneyStatisticVO vo) throws PreviewInfoException;
|
| | |
|
| | |
| | | * @throws PreviewInfoException
|
| | | */
|
| | | public void previewExtractRecord(Long uid) throws PreviewInfoException;
|
| | |
|
| | | }
|
| | |
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.invite.TeamDailyRecord;
|
| | | import com.yeshi.fanli.exception.user.TeamDailyRecordException;
|
| | | import com.yeshi.fanli.vo.order.OrderRankingVO;
|
| | |
|
| | | public interface TeamDailyRecordService {
|
| | |
|
| | |
| | |
|
| | |
|
| | | public List<TeamDailyRecord> sumTeamNumGroupByUid(Long uid, Date minDay, Date maxDay);
|
| | |
|
| | | /**
|
| | | * 邀请排行榜
|
| | | * @param uid
|
| | | * @param minDay
|
| | | * @param maxDay
|
| | | * @return
|
| | | */
|
| | | public List<OrderRankingVO> getRankingByFirstNum(Long uid, Date minDay, Date maxDay);
|
| | | }
|
| | |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 安卓-支付宝画图 |
| | | * @param money |
| | | * @param orderNo |
| | | * @param time |
| | | * @param targetPath |
| | | * @return |
| | | * @throws IOException |
| | | */ |
| | | public static InputStream drawAlipayAndroid(BigDecimal money, String orderNo, String time) throws IOException { |
| | | String bgpic = "image/alipay/android.png"; |
| | | BufferedImage bgImage = ImageIO.read(ImageUtil.class.getClassLoader().getResourceAsStream(bgpic)); |
| | | |
| | | final BufferedImage targetImg = new BufferedImage(bgImage.getWidth(), bgImage.getHeight(), BufferedImage.TYPE_INT_RGB); |
| | | HashMap<Key, Object> mapH = new HashMap<Key, Object>(); |
| | | mapH.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);// 抗锯齿 (抗锯齿总开关) |
| | | mapH.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_GASP);// 文字抗锯齿 |
| | | |
| | | // 画 背景图片 |
| | | final Graphics2D g2d = targetImg.createGraphics(); |
| | | g2d.setRenderingHints(mapH); |
| | | g2d.drawImage(bgImage, 0, 0, bgImage.getWidth(), bgImage.getHeight(), null); |
| | | g2d.setBackground(Color.BLACK); |
| | | |
| | | // 字体 |
| | | String os = System.getProperty("os.name"); |
| | | String fontRob0to = "/usr/share/fonts/ROBOTO-REGULAR.TTF"; |
| | | String fontBahnschrift = "/usr/share/fonts/BAHNSCHRIFT.TTF"; |
| | | if (os.toLowerCase().startsWith("win")) { |
| | | fontRob0to = "D:/ROBOTO-REGULAR.TTF"; |
| | | fontBahnschrift = "D:/BAHNSCHRIFT.TTF"; |
| | | } |
| | | |
| | | // 字体大小 |
| | | Font font40 = null; |
| | | Font font42 = null; |
| | | Font font86 = null; |
| | | try { |
| | | font40 = Font.createFont(Font.PLAIN, new File(fontRob0to)).deriveFont(40.00f); |
| | | font42 = Font.createFont(Font.PLAIN, new File(fontBahnschrift)).deriveFont(42.00f); |
| | | font86 = Font.createFont(Font.PLAIN, new File(fontRob0to)).deriveFont(86.68f); |
| | | } catch (FontFormatException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | |
| | | /* 时间信息 */ |
| | | g2d.setFont(font42); |
| | | g2d.setColor(new Color(247, 247, 247)); |
| | | g2d.drawString(TimeUtil.formatHHMM_12H(new Date()), 134, 67); |
| | | |
| | | |
| | | /* 资金信息 */ |
| | | String moneyInfo = "+" + money.setScale(2); |
| | | // 计算长度 |
| | | FontMetrics fm = g2d.getFontMetrics(font86); |
| | | int textLength = fm.stringWidth(moneyInfo); |
| | | // 居中位置 |
| | | int x_money = (bgImage.getWidth() - textLength) / 2 ; |
| | | // 画金额 |
| | | g2d.setFont(font86); |
| | | g2d.setColor(new Color(51, 51, 51)); |
| | | g2d.drawString(moneyInfo, x_money, 420); |
| | | |
| | | |
| | | /* 创建时间信息 */ |
| | | FontMetrics fm2 = g2d.getFontMetrics(font40); |
| | | int l_time = fm2.stringWidth(time); |
| | | int x_time = bgImage.getWidth() - l_time -41 ; |
| | | g2d.setFont(font40); |
| | | g2d.setColor(new Color(51, 51, 51)); |
| | | g2d.drawString(time, x_time, 972); |
| | | |
| | | /* 创建时间信息 */ |
| | | int l_order = fm2.stringWidth(orderNo); |
| | | int x_order = bgImage.getWidth() - l_order -41 ; |
| | | g2d.setFont(font40); |
| | | g2d.setColor(new Color(51, 51, 51)); |
| | | g2d.drawString(orderNo, x_order, 1072); |
| | | g2d.dispose(); |
| | | |
| | | ByteArrayOutputStream aos = new ByteArrayOutputStream(); |
| | | ImageIO.write(targetImg, "png", aos); |
| | | |
| | | return new ByteArrayInputStream(aos.toByteArray()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * IOS 支付宝画图 |
| | | * @param money |
| | | * @param orderNo |
| | | * @param time |
| | | * @param targetPath |
| | | * @return |
| | | * @throws IOException |
| | | */ |
| | | public static InputStream drawAlipayIOS(BigDecimal money, String orderNo, String time) |
| | | throws IOException { |
| | | String bgpic = "image/alipay/ios.png"; |
| | | BufferedImage bgImage = ImageIO.read(ImageUtil.class.getClassLoader().getResourceAsStream(bgpic)); |
| | | |
| | | final BufferedImage targetImg = new BufferedImage(bgImage.getWidth(), bgImage.getHeight(), |
| | | BufferedImage.TYPE_INT_RGB); |
| | | HashMap<Key, Object> mapH = new HashMap<Key, Object>(); |
| | | mapH.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);// 抗锯齿 (抗锯齿总开关) |
| | | mapH.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_GASP);// 文字抗锯齿 |
| | | |
| | | // 画 背景图片 |
| | | final Graphics2D g2d = targetImg.createGraphics(); |
| | | g2d.setRenderingHints(mapH); |
| | | g2d.drawImage(bgImage, 0, 0, bgImage.getWidth(), bgImage.getHeight(), null); |
| | | g2d.setBackground(Color.BLACK); |
| | | |
| | | // 字体 |
| | | String os = System.getProperty("os.name"); |
| | | String fontHeiTi = "/usr/share/fonts/AdobeHeiTiStd.otf"; |
| | | String fontSquare = "/usr/share/fonts/SquareHeitiStd.TTF"; |
| | | if (os.toLowerCase().startsWith("win")) { |
| | | fontHeiTi = "D:/AdobeHeiTiStd.otf"; |
| | | fontSquare = "D:/SquareHeitiStd.TTF"; |
| | | } |
| | | |
| | | // 字体大小 |
| | | Font font40 = null; |
| | | Font font44 = null; |
| | | Font font92 = null; |
| | | try { |
| | | font44 = Font.createFont(Font.PLAIN, new File(fontHeiTi)).deriveFont(44.18f); |
| | | font40 = Font.createFont(Font.PLAIN, new File(fontSquare)).deriveFont(40.00f); |
| | | font92 = Font.createFont(Font.PLAIN, new File(fontSquare)).deriveFont(92.03f); |
| | | } catch (FontFormatException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | /* 时间信息 */ |
| | | g2d.setFont(font44); |
| | | g2d.setColor(new Color(16, 16, 16)); |
| | | MyDrawString(TimeUtil.formatHHMM_12H(new Date()), 82, 82, font44, g2d); |
| | | |
| | | |
| | | /* 资金信息 */ |
| | | String moneyInfo = "+" + money.setScale(2); |
| | | // 计算长度 |
| | | FontMetrics fm = g2d.getFontMetrics(font92); |
| | | int textLength = fm.stringWidth(moneyInfo); |
| | | // 居中位置 |
| | | int x_money = (bgImage.getWidth() - textLength) / 2; |
| | | // 画金额 |
| | | g2d.setFont(font92); |
| | | g2d.setColor(new Color(51, 51, 51)); |
| | | g2d.drawString(moneyInfo, x_money, 480); |
| | | |
| | | /* 创建时间信息 */ |
| | | FontMetrics fm2 = g2d.getFontMetrics(font40); |
| | | int l_time = fm2.stringWidth(time); |
| | | int x_time = bgImage.getWidth() - l_time - 41; |
| | | g2d.setFont(font40); |
| | | g2d.setColor(new Color(51, 51, 51)); |
| | | g2d.drawString(time, x_time, 1052); |
| | | |
| | | /* 创建时间信息 */ |
| | | int l_order = fm2.stringWidth(orderNo); |
| | | int x_order = bgImage.getWidth() - l_order - 41; |
| | | g2d.setFont(font40); |
| | | g2d.setColor(new Color(51, 51, 51)); |
| | | g2d.drawString(orderNo, x_order, 1160); |
| | | |
| | | g2d.dispose(); |
| | | |
| | | ByteArrayOutputStream aos = new ByteArrayOutputStream(); |
| | | ImageIO.write(targetImg, "png", aos); |
| | | return new ByteArrayInputStream(aos.toByteArray()); |
| | | } |
| | | |
| | | public static void MyDrawString(String str,int x,int y, Font font40, Graphics2D g2d){ |
| | | int i = 0; |
| | | int x_next = x; |
| | | String tempStr= null; |
| | | while(str.length()>0) |
| | | { |
| | | tempStr=str.substring(0, 1); |
| | | str=str.substring(1, str.length()); |
| | | g2d.drawString(tempStr, x_next, y); |
| | | |
| | | if (i == 1) { |
| | | x_next += 3 + 22; |
| | | } else if (i == 2) { |
| | | x_next += 10; |
| | | } else { |
| | | x_next += 0 + 22; |
| | | } |
| | | i++; |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | return date;
|
| | | }
|
| | |
|
| | | public static String formatHHMM_12H(Date time) {
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("hh:mm");
|
| | | String date = sdf.format(time);
|
| | | return date;
|
| | | }
|
| | | |
| | | public static String formatYMDHHMM(Date date) {
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
| | | try {
|
| | | return sdf.format(date);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | return null;
|
| | | }
|
| | | |
| | | |
| | | public static String formatDateAddT(Date date) {
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
|
| | | try {
|
New file |
| | |
| | | package com.yeshi.fanli.vo.order;
|
| | |
|
| | |
|
| | | public class OrderRankingVO {
|
| | | private Long uid;
|
| | | private String nickName;
|
| | | private String portrait;
|
| | | private Integer number; // 数量
|
| | | private Integer grade;// 第几级队员
|
| | |
|
| | | public Long getUid() {
|
| | | return uid;
|
| | | }
|
| | |
|
| | | public void setUid(Long uid) {
|
| | | this.uid = uid;
|
| | | }
|
| | |
|
| | | public String getNickName() {
|
| | | return nickName;
|
| | | }
|
| | |
|
| | | public void setNickName(String nickName) {
|
| | | this.nickName = nickName;
|
| | | }
|
| | |
|
| | | public String getPortrait() {
|
| | | return portrait;
|
| | | }
|
| | |
|
| | | public void setPortrait(String portrait) {
|
| | | this.portrait = portrait;
|
| | | }
|
| | | |
| | | public Integer getNumber() {
|
| | | return number;
|
| | | }
|
| | |
|
| | | public void setNumber(Integer number) {
|
| | | this.number = number;
|
| | | }
|
| | |
|
| | | public Integer getGrade() {
|
| | | return grade;
|
| | | }
|
| | |
|
| | | public void setGrade(Integer grade) {
|
| | | this.grade = grade;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | <org.hibernate.version>4.1.2</org.hibernate.version>
|
| | | <org.springframework-version>4.3.0.RELEASE</org.springframework-version>
|
| | | <mybatis.version>3.4.1</mybatis.version>
|
| | | <spring.mongodb.version>1.9.8.RELEASE</spring.mongodb.version>
|
| | | <!-- <spring.mongodb.version>1.9.8.RELEASE</spring.mongodb.version> -->
|
| | | <spring.mongodb.version>1.10.10.RELEASE</spring.mongodb.version>
|
| | | |
| | | |
| | | </properties>
|
| | | <profiles>
|
| | | <profile>
|
| | |
| | | return ca.getTime();
|
| | | }
|
| | |
|
| | | public static Date reduceDay(Date currdate, int num) {
|
| | | Calendar ca = Calendar.getInstance();
|
| | | ca.setTime(currdate);
|
| | | ca.add(Calendar.DATE, -num);
|
| | | return ca.getTime();
|
| | | }
|
| | | |
| | | /**
|
| | | * 指定日期减去天数后的日期
|
| | | *
|