Merge remote-tracking branch 'origin/div' into div
| | |
| | | beginDate = TimeUtil.parse(startTime);
|
| | | endDate = TimeUtil.parse(endTime);
|
| | | } else if (dateType == 2) {
|
| | | Calendar calendar=Calendar.getInstance(); |
| | | int currentYear = calendar.get(Calendar.YEAR);
|
| | | |
| | | calendar.clear();
|
| | | calendar.set(Calendar.YEAR, currentYear);
|
| | | beginDate =calendar.getTime();
|
| | | |
| | | Calendar calendar=Calendar.getInstance(); |
| | | int currentYear = calendar.get(Calendar.YEAR);
|
| | | if (!StringUtil.isNullOrEmpty(year)) {
|
| | | currentYear = Integer.parseInt(year);
|
| | | }
|
| | | |
| | | calendar.clear();
|
| | | calendar.set(Calendar.YEAR, currentYear);
|
| | | beginDate =calendar.getTime();
|
| | | |
| | | calendar.clear();
|
| | | calendar.set(Calendar.YEAR, currentYear);
|
| | | calendar.roll(Calendar.DAY_OF_YEAR, -1);
|
| | |
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | |
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | |
| | | import com.yeshi.fanli.entity.bus.homemodule.SwiperPicture;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | | import com.yeshi.fanli.entity.system.BusinessSystem;
|
| | | import com.yeshi.fanli.entity.system.SystemClientParams;
|
| | | import com.yeshi.fanli.exception.NotExistObjectException;
|
| | |
| | | * @throws IOException
|
| | | */
|
| | | @RequestMapping(value = "/listInviteFriendImg", method = RequestMethod.POST)
|
| | | public void listInviteFriendImg(AcceptData acceptData, Long uid, PrintWriter out)
|
| | | public void listInviteFriendImg(AcceptData acceptData, Long uid, PrintWriter out, HttpServletRequest request)
|
| | | throws NotExistObjectException, IOException {
|
| | | JSONObject data = new JSONObject();
|
| | | if (uid != null && !uid.equals("0")) {
|
| | | List<String> imgList = spreadUserImgService.getUserSpreadImg(uid);
|
| | | List<String> imgList = spreadUserImgService.getUserSpreadImg(uid, request);
|
| | | data.put("imgUrlList", JsonUtil.getSimpleGsonWithDate().toJson(imgList));
|
| | | }
|
| | |
|
| | |
| | | |
| | | |
| | | <select id="getRewardMoneyByDate" resultType="BigDecimal"> |
| | | SELECT COALESCE(SUM(v2.`hb_money`),0)AS totalmoney FROM ( |
| | | SELECT (COALESCE(SUM(v2.`hb_money`),0)- COALESCE(SUM(d.`wr_money`),0))AS totalmoney FROM ( |
| | | SELECT * FROM yeshi_ec_hongbao_v2 v |
| | | WHERE v.hb_state <![CDATA[<>]]> 4 AND v.`hb_uid`= #{uid} |
| | | <if test="type == 1"> <!-- 自购订单 --> |
| | |
| | | )v2 |
| | | LEFT JOIN yeshi_ec_hongbao_order ho ON ho.`ho_hongbao_id` = IF(v2.hb_pid IS NULL,v2.hb_id,v2.hb_pid) |
| | | LEFT JOIN yeshi_ec_common_order co ON co.`co_id` = ho.`ho_order_id` |
| | | LEFT JOIN yeshi_ec_user_order_weiquan_record d ON d.wr_trade_id = co.`co_trade_id` AND d.wr_source_type = co.`co_source_type` AND d.wr_uid = #{uid} |
| | | WHERE co.`co_state`<![CDATA[<>]]> 4 |
| | | <if test="day == 1"> <!-- 今天产生--> |
| | | AND TO_DAYS(co.`co_third_create_time`) = TO_DAYS(NOW()) |
| | |
| | | package com.yeshi.fanli.service.impl.dynamic;
|
| | |
|
| | | import java.io.InputStream;
|
| | | import java.lang.reflect.InvocationTargetException;
|
| | | import java.math.BigDecimal;
|
| | | import java.text.SimpleDateFormat;
|
| | |
| | | import org.springframework.stereotype.Service;
|
| | | import org.yeshi.utils.DateLunarUtil;
|
| | | import org.yeshi.utils.DateUtil;
|
| | | import org.yeshi.utils.HttpUtil;
|
| | | import org.yeshi.utils.taobao.TbImgUtil;
|
| | |
|
| | | import com.yeshi.fanli.dao.dynamic.DynamicInfoDao;
|
| | |
| | | size = inviteInfo.getSize();
|
| | | }
|
| | |
|
| | | InputStream asInputStream = HttpUtil.getAsInputStream(picUrl);
|
| | | |
| | | int index = picUrl.lastIndexOf("/");
|
| | | String newUrl = picUrl.substring(index + 1);
|
| | | String urlMd5 = newUrl.substring(0, newUrl.lastIndexOf("."));
|
| | | |
| | | // 图片
|
| | | String imgLink = qrCodeService.drawInviteQrCodeNew(picUrl, null, null, pX, pY, size, null);
|
| | | String imgLink = qrCodeService.drawInviteQrCodeNew(asInputStream, urlMd5, null, null, pX, pY, size, null);
|
| | | GoodsPicture p2 = new GoodsPicture();
|
| | | p2.setW(100);
|
| | | p2.setH(100);
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public String drawInviteQrCodeNew(String url, Long uid, String portrait, Integer pX, Integer pY, Integer size,
|
| | | public String drawInviteQrCodeNew(InputStream urlInputStream, String urlMd5, Long uid, String portrait, Integer pX, Integer pY, Integer size,
|
| | | String inviteCode) throws IOException {
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(url)) {
|
| | | if (urlInputStream == null) {
|
| | | return null;
|
| | | }
|
| | |
|
| | |
| | | String erCodeTempPath = null;
|
| | | InputStream erCodeInputStream = null; // 二维码
|
| | | InputStream portraitInputStream = null; // 头像
|
| | | InputStream urlInputStream = HttpUtil.getAsInputStream(url); // 背景
|
| | | // InputStream urlInputStream = HttpUtil.getAsInputStream(url); // 背景
|
| | |
|
| | | String uuid = UUID.randomUUID().toString().replace("-", "");
|
| | | if (uid == null) {
|
| | |
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | urlInputStream = HttpUtil.getAsInputStream(url); // 背景
|
| | | portraitInputStream = HttpUtil.getAsInputStream(portrait); // 头像
|
| | | erCodeInputStream = new FileInputStream(new File(erCodeTempPath)); // 二维码
|
| | | }
|
| | |
| | |
|
| | | // 上传文件相对位置
|
| | | if (new File(targetPath).exists() && new File(targetPath).length() > 0) {
|
| | | int index = url.lastIndexOf("/");
|
| | | String newUrl = url.substring(index + 1);
|
| | | String urlMd5 = newUrl.substring(0, newUrl.lastIndexOf("."));
|
| | | String fileUrl = null;
|
| | | if (uid == null) {
|
| | | fileUrl = "ercode/" + "ercode_" + uuid + "_" + System.currentTimeMillis() + "_" + urlMd5 + ".jpg";
|
| | |
| | | package com.yeshi.fanli.service.impl.user;
|
| | |
|
| | | import java.io.File;
|
| | | import java.io.FileInputStream;
|
| | | import java.io.IOException;
|
| | | import java.io.InputStream;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Collections;
|
| | | import java.util.Comparator;
|
| | |
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.yeshi.utils.HttpUtil;
|
| | | import org.yeshi.utils.ListUtil;
|
| | | import org.yeshi.utils.tencentcloud.COSManager;
|
| | |
|
| | |
| | | import com.yeshi.fanli.entity.bus.invite.SpreadImg;
|
| | | import com.yeshi.fanli.entity.bus.invite.SpreadUserImg;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | | import com.yeshi.fanli.service.inter.user.QrCodeService;
|
| | | import com.yeshi.fanli.service.inter.user.SpreadUserImgService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.FileUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | @Service
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public List<String> getUserSpreadImg(Long uid) {
|
| | | public List<String> getUserSpreadImg(Long uid, HttpServletRequest request) {
|
| | | List<String> imgList = new ArrayList<>();
|
| | |
|
| | | // 查询当前用户的推广图
|
| | |
| | | user = userInfoService.selectByPKey(uid);
|
| | |
|
| | | String inviteCode = userInfoExtraService.getInviteCodeByUid(uid);
|
| | | |
| | | // 缓存路径
|
| | | String rootPath = request.getSession().getServletContext().getRealPath("/").replace("\\", "/");
|
| | | String projectName = request.getContextPath(); |
| | | String path = rootPath.replace(projectName, "/temp");
|
| | | File f = new File(path);
|
| | | if (!f.exists())
|
| | | f.mkdirs();
|
| | | |
| | | // 添加原来没有的
|
| | | for (String md5 : dlist) {
|
| | | for (SpreadImg img : spreadImgList)
|
| | |
| | | portrait = Constant.systemCommonConfig.getDefaultPortrait();
|
| | | }
|
| | |
|
| | | String imgUrl = qrCodeService.drawInviteQrCodeNew(img.getUrl(), uid, portrait, null, null, null, inviteCode);
|
| | | // 背景图片缓存
|
| | | int index = img.getUrl().lastIndexOf("/");
|
| | | String fileName = img.getUrl().substring(index + 1);
|
| | |
|
| | | InputStream inputStream = null;
|
| | | String cachePath = path + fileName;
|
| | | File file = new File(cachePath);
|
| | | if (file.exists()) {
|
| | | inputStream = new FileInputStream(file);
|
| | | } else {
|
| | | // 网络下载
|
| | | InputStream input = HttpUtil.getAsInputStream(img.getUrl());
|
| | | // 缓存本地
|
| | | FileUtil.saveAsFile(input, cachePath);
|
| | | // 获取流
|
| | | inputStream = new FileInputStream(file);
|
| | | }
|
| | | |
| | | String imgUrl = qrCodeService.drawInviteQrCodeNew(inputStream, fileName, uid, portrait, null, null, null, inviteCode);
|
| | | if (!StringUtil.isNullOrEmpty(imgUrl)) {
|
| | | if (imgUrl != null) {
|
| | | addUserInviteImg(uid, imgUrl);
|
| | |
| | |
|
| | | @Override
|
| | | public String drawInviteQrCodeNew(String bgImg, Long uid, String portrait, Integer pX, Integer pY, Integer size, String inviteCode) throws Exception {
|
| | | return qrCodeService.drawInviteQrCodeNew(bgImg, uid, portrait, pX, pY, size, inviteCode);
|
| | | InputStream asInputStream = HttpUtil.getAsInputStream(bgImg);
|
| | | |
| | | int index = bgImg.lastIndexOf("/");
|
| | | String newUrl = bgImg.substring(index + 1);
|
| | | String urlMd5 = newUrl.substring(0, newUrl.lastIndexOf("."));
|
| | | |
| | | return qrCodeService.drawInviteQrCodeNew(asInputStream, urlMd5, uid, portrait, pX, pY, size, inviteCode);
|
| | | }
|
| | |
|
| | |
|
| | |
| | | public String getInviteImgToGreet(String bgImg, Long uid, String portrait, String inviteCode, String content, Date date) throws Exception {
|
| | | return qrCodeService.drawInviteToGreet(bgImg, uid,portrait, inviteCode, content, date);
|
| | | }
|
| | | |
| | | |
| | | private static String getProjectRootPath(){ |
| | | String rootPath=Thread.currentThread().getContextClassLoader().getResource("").getPath(); |
| | | rootPath = rootPath.substring(1,rootPath.indexOf("WEB-INF")); |
| | | return rootPath;
|
| | | }
|
| | | |
| | | }
|
| | |
| | | // 统计今日之前的
|
| | | if (betweenDays > 0) {
|
| | | for (int i = 1; i <= betweenDays; i++ ) {
|
| | | addUserActiveNumHistory(DateUtil.plusDay(i, history.getDay()));
|
| | | addUserActiveNumHistory(DateUtil.plusDay(i, lastDay));
|
| | | }
|
| | | }
|
| | | // 重新统计今日
|
| | |
| | | package com.yeshi.fanli.service.inter.user;
|
| | |
|
| | | import java.io.IOException;
|
| | | import java.io.InputStream;
|
| | | import java.util.Date;
|
| | |
|
| | | public interface QrCodeService {
|
| | |
| | | * @return
|
| | | * @throws IOException
|
| | | */
|
| | | public String drawInviteQrCodeNew(String url, Long uid, String portrait, Integer pX, Integer pY, Integer size, String inviteCode) throws IOException;
|
| | | public String drawInviteQrCodeNew(InputStream urlInputStream,String urlMd5, Long uid, String portrait, Integer pX, Integer pY, Integer size, String inviteCode) throws IOException;
|
| | | }
|
| | |
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | |
|
| | | public interface SpreadUserImgService {
|
| | |
|
| | | void addUserInviteImg(Long uid, String imgUrl);
|
| | |
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | List<String> getUserSpreadImg(Long uid);
|
| | | List<String> getUserSpreadImg(Long uid, HttpServletRequest request);
|
| | |
|
| | | /**
|
| | | * 用户分享图的数量
|