admin
2019-12-14 1261c227e7ad47607ee651bbd017ea80eb6d044a
Merge remote-tracking branch 'origin/div' into div
9个文件已修改
97 ■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/admin/UserInfoAdminController.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/InviteGetMoneyController.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/hongbao/HongBaoV2CountMapper.xml 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/DynamicInfoServiceImpl.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/QrCodeServiceImpl.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/SpreadUserImgServiceImpl.java 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserActiveLogServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/QrCodeService.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/SpreadUserImgService.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/admin/UserInfoAdminController.java
@@ -1256,6 +1256,9 @@
            } else if (dateType == 2) {
               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);
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/InviteGetMoneyController.java
@@ -7,6 +7,7 @@
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;
@@ -18,7 +19,6 @@
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;
@@ -171,11 +171,11 @@
     * @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));
        }
fanli/src/main/java/com/yeshi/fanli/mapping/hongbao/HongBaoV2CountMapper.xml
@@ -418,7 +418,7 @@
    
    
    <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"> <!-- 自购订单 -->
@@ -449,6 +449,7 @@
        )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())
fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/DynamicInfoServiceImpl.java
@@ -1,5 +1,6 @@
package com.yeshi.fanli.service.impl.dynamic;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
@@ -18,6 +19,7 @@
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;
@@ -715,8 +717,14 @@
                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);
fanli/src/main/java/com/yeshi/fanli/service/impl/user/QrCodeServiceImpl.java
@@ -134,10 +134,9 @@
    }
    @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;
        }
@@ -145,7 +144,7 @@
        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) {
@@ -169,8 +168,6 @@
            } catch (Exception e) {
                e.printStackTrace();
            }
            urlInputStream = HttpUtil.getAsInputStream(url); // 背景
            portraitInputStream = HttpUtil.getAsInputStream(portrait); // 头像
            erCodeInputStream = new FileInputStream(new File(erCodeTempPath)); // 二维码
        }
@@ -189,9 +186,6 @@
        // 上传文件相对位置
        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";
fanli/src/main/java/com/yeshi/fanli/service/impl/user/SpreadUserImgServiceImpl.java
@@ -1,6 +1,9 @@
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;
@@ -8,8 +11,10 @@
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;
@@ -18,12 +23,12 @@
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
@@ -90,7 +95,7 @@
    }
    @Override
    public List<String> getUserSpreadImg(Long uid) {
    public List<String> getUserSpreadImg(Long uid, HttpServletRequest request) {
        List<String> imgList = new ArrayList<>();
        // 查询当前用户的推广图
@@ -173,6 +178,15 @@
            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)
@@ -184,7 +198,25 @@
                            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);
@@ -250,7 +282,13 @@
    
    @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);
    }
    
    
@@ -258,4 +296,12 @@
    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;
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserActiveLogServiceImpl.java
@@ -94,7 +94,7 @@
            // 统计今日之前的
            if (betweenDays > 0) {
                for (int i = 1; i <= betweenDays; i++ ) {
                    addUserActiveNumHistory(DateUtil.plusDay(i, history.getDay()));
                    addUserActiveNumHistory(DateUtil.plusDay(i, lastDay));
                }
            }
            // 重新统计今日
fanli/src/main/java/com/yeshi/fanli/service/inter/user/QrCodeService.java
@@ -1,6 +1,7 @@
package com.yeshi.fanli.service.inter.user;
import java.io.IOException;
import java.io.InputStream;
import java.util.Date;
public interface QrCodeService {
@@ -62,5 +63,5 @@
     * @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;
}
fanli/src/main/java/com/yeshi/fanli/service/inter/user/SpreadUserImgService.java
@@ -3,6 +3,8 @@
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
public interface SpreadUserImgService {
    void addUserInviteImg(Long uid, String imgUrl);
@@ -19,7 +21,7 @@
     * @param uid
     * @return
     */
    List<String> getUserSpreadImg(Long uid);
    List<String> getUserSpreadImg(Long uid, HttpServletRequest request);
    /**
     * 用户分享图的数量