jiangping
2024-07-16 5525627950c1b4f9d70acc202a9083fb7e4d45de
提交
已删除9个文件
已修改9个文件
847 ■■■■ 文件已修改
server/service/src/main/java/com/doumee/config/Jwt/WebMvcConfig.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/core/utils/Constants.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/core/utils/DateUtil.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/core/utils/GeneratePicUtil.java 86 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/core/utils/tyyun/TyyZosUtil.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/service/business/UsersService.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/service/business/impl/UsersServiceImpl.java 39 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/web/src/main/java/com/doumee/api/web/ApiController.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/web/src/main/java/com/doumee/api/web/PersonnelApi.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/web/src/main/java/com/doumee/config/shiro/ShiroAuthFilter.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/web/src/main/java/com/doumee/config/shiro/ShiroCache.java 113 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/web/src/main/java/com/doumee/config/shiro/ShiroCacheManager.java 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/web/src/main/java/com/doumee/config/shiro/ShiroConfig.java 110 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/web/src/main/java/com/doumee/config/shiro/ShiroCredentialsMatcher.java 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/web/src/main/java/com/doumee/config/shiro/ShiroRealm.java 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/web/src/main/java/com/doumee/config/shiro/ShiroSessionDAO.java 113 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/web/src/main/java/com/doumee/config/shiro/ShiroSessionManager.java 86 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/web/src/main/java/com/doumee/config/shiro/ShiroTokenManager.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/config/Jwt/WebMvcConfig.java
@@ -13,6 +13,7 @@
import io.jsonwebtoken.JwtException;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;
@@ -40,6 +41,12 @@
    @Autowired
    private RedisTemplate<String,Object> redisTemplate;
    /**
     * æ˜¯å¦å¼€å‘者
     */
    @Value("${debug_model}")
    private Boolean isDebug;
    /**
     * æ·»åŠ æ‹¦æˆªå™¨
@@ -121,6 +128,9 @@
    public Boolean checkPersonnelLogin(HttpServletRequest request, HttpServletResponse response){
        String token = request.getHeader(JwtTokenUtil.HEADER_KEY);
        try {
            if(isDebug){
                return  true;
            }
            //判断Token是否超时
            boolean expiration = JwtTokenUtil.isTokenExpired(token);
            if (expiration) {
server/service/src/main/java/com/doumee/core/utils/Constants.java
@@ -93,6 +93,9 @@
    public static final String ZBOM = "ZBOM" ;
    public static final String ZBOM_IAM_APPKEY = "ZBOM_IAM_APPKEY";
    public static final String ZBOM_IAM_APPID = "ZBOM_IAM_APPID";
    public static final String USER_CARD_HEADER_IMG ="USER_CARD_HEADER_IMG" ;
    public static final String USER_CARD_PHONE_IMG ="USER_CARD_PHONE_IMG" ;
    public static final String USER_CARD_ADDR_IMG ="USER_CARD_ADDR_IMG" ;
    public static Integer parseIntByStr(String idtOrgStatus) {
        try {
@@ -309,6 +312,8 @@
    public static final String ACCESS_KEY = "ACCESS_KEY";
    public static final String ENDPOINT = "ENDPOINT";
    public static final String RESOURCE_PATH = "RESOURCE_PATH";
    public static final String WEIXIN_DEFAULT_IMGS = "WEIXIN_DEFAULT_IMGS";
    public static final String USER_CARD_DEFAULT_IMG = "USER_CARD_DEFAULT_IMG";
    public static final String USERS_FILE = "USERS_FILE";
    public static final String NEWS_FILE = "NEWS_FILE";
    //发送会议开始  å®šæ—¶æå‰å¤šå°‘分钟发送
server/service/src/main/java/com/doumee/core/utils/DateUtil.java
@@ -356,7 +356,7 @@
     * @return String
     * @throws Exception
     */
    public static String getNowShortDate() throws Exception {
    public static String getNowShortDate() {
        String nowDate = "";
        try {
            java.sql.Date date = null;
@@ -364,7 +364,7 @@
            nowDate = sdfShort.format(date);
            return nowDate;
        } catch (Exception e) {
            throw e;
           return  "";
        }
    }
server/service/src/main/java/com/doumee/core/utils/GeneratePicUtil.java
@@ -4,6 +4,7 @@
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileItemFactory;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.lang3.StringUtils;
import org.springframework.http.MediaType;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
@@ -43,8 +44,8 @@
        System.out.println("结束:" + (System.currentTimeMillis() - starttime) / 1000);
    }
    private static final int width = 898;
    private static final int height = 1308;
    private static final int width = 750;
    private static final int height = 1140;
    /**
     * ç”Ÿæˆåˆ†äº«å›¾ç‰‡
@@ -195,7 +196,7 @@
        }
    }
    public static InputStream bufferedImageToInputStream(BufferedImage backgroundImage) throws IOException {
    public static InputStream bufferedImageToInputStream(BufferedImage backgroundImage) {
        return bufferedImageToInputStream(backgroundImage, "jpg");
    }
@@ -207,7 +208,7 @@
     * @return
     * @throws IOException
     */
    public static InputStream bufferedImageToInputStream(BufferedImage backgroundImage, String format) throws IOException {
    public static InputStream bufferedImageToInputStream(BufferedImage backgroundImage, String format)  {
        ByteArrayOutputStream bs = new ByteArrayOutputStream();
        try (
                ImageOutputStream
@@ -215,6 +216,8 @@
            ImageIO.write(backgroundImage, format, imOut);
            InputStream is = new ByteArrayInputStream(bs.toByteArray());
            return is;
        }catch (Exception e){
            return null;
        }
    }
@@ -265,8 +268,83 @@
        }
        return resMatrix;
    }
    public static InputStream generateUserCardImg(String imgurl, String qrcode, String name,String type, String phone, String shopaddr, String shopname,String phoneIcon,String addrIcon)  {
        BufferedImage bi =  new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
        //得到它的绘制环境(这张图片的笔)
        Graphics2D g2 = (Graphics2D) bi.getGraphics();
        g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
        g2.fillRect(0, 0, width, height);
        //背景图片
        BufferedImage img1 =getImgIO(imgurl);
        if(img1!=null){
            g2.drawImage(img1, 0, 0, 750, 700, null);
        }else{
            g2.setColor(new Color(102, 102, 102, 1));
            g2.drawRect( 0, 0, 750, 700);
        }
        //商品名称
        if(name.length()>5){
            name = name.substring(0,5)+"...";
        }
        g2.setColor(Color.black);
        g2.setFont(new Font("黑体", Font.PLAIN, 40));
        g2.drawString(name, 40, 990-242);
        int w = 40+ name.length()*40;
        g2.setColor(Color.GRAY);
        g2.setFont(new Font("黑体", Font.PLAIN, 30));
        g2.drawString(type, w, 990-242);
        if(StringUtils.isNotBlank(qrcode)){
            //个人二维码
            BufferedImage img2 = getImgIO(qrcode);
            if(img2!=null){
                g2.drawImage(img2, 522, 982-242, 188, 188, null);
            }
            g2.setColor(Color.GRAY);
            g2.setFont(new Font("黑体", Font.PLAIN, 24));
            g2.drawString("扫码添加好友", 544, 1186-242);
        }
        //手机号
        BufferedImage img4 = getImgIO(phoneIcon);
        if(img4!=null){
            g2.drawImage(img4, 40, 1072-28-242, 34, 36, null);
        }
        g2.setColor(Color.GRAY);
        g2.setFont(new Font("黑体", Font.PLAIN, 30));
        g2.drawString(phone, 94, 1072-242);
        BufferedImage img3 = getImgIO(addrIcon);
        if(img3!=null){
            g2.drawImage(img3, 40, 1142-28-242, 34, 36, null);
        }
        if(shopaddr.length()>12){
            shopaddr = shopaddr.substring(0,12)+"\n"+shopaddr.substring(12);
        }
        //地址
        g2.setColor(Color.GRAY);
        g2.setFont(new Font("黑体", Font.PLAIN, 30));
        g2.drawString(shopaddr, 94, 1142-242);
        //底部
        if(shopname.length()>15){
            shopname = shopname.substring(0,15)+"...";
        }
        g2.setColor(Color.GRAY);
        g2.setFont(new Font("黑体", Font.PLAIN, 30));
        g2.drawString(shopname, 180, 1300-242);
        InputStream inputStream = bufferedImageToInputStream(bi);
        return inputStream;
    }
    private static BufferedImage getImgIO(String imgurl) {
        try {
        return     ImageIO.read(new URL(imgurl));
        }catch (Exception e){
        }return null;
    }
}
server/service/src/main/java/com/doumee/core/utils/tyyun/TyyZosUtil.java
@@ -9,14 +9,19 @@
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
import com.amazonaws.services.s3.model.*;
import com.doumee.core.oss.FileContent;
import com.doumee.core.oss.FileModel;
import com.doumee.core.utils.FileDigest;
import java.io.*;
import java.net.URL;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import com.doumee.core.utils.ID;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.multipart.MultipartFile;
server/service/src/main/java/com/doumee/service/business/UsersService.java
@@ -2,6 +2,7 @@
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
import com.doumee.dao.business.model.Member;
import com.doumee.dao.business.model.Users;
import com.doumee.dao.web.response.AccountResponse;
import org.springframework.web.multipart.MultipartFile;
@@ -107,4 +108,6 @@
    String importBatch(MultipartFile file);
    Users usersDetail(Long userId);
    String getUserCard(Users users);
}
server/service/src/main/java/com/doumee/service/business/impl/UsersServiceImpl.java
@@ -1,6 +1,7 @@
package com.doumee.service.business.impl;
import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
import cn.hutool.core.date.DateUnit;
import com.doumee.biz.system.SystemDictDataBiz;
import com.doumee.biz.zbom.model.IamUserRoleModel;
import com.doumee.biz.zbom.model.IamUserTypeModel;
@@ -13,7 +14,10 @@
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
import com.doumee.core.utils.Constants;
import com.doumee.core.utils.DateUtil;
import com.doumee.core.utils.GeneratePicUtil;
import com.doumee.core.utils.Utils;
import com.doumee.core.utils.tyyun.TyyZosUtil;
import com.doumee.dao.admin.request.ShopImport;
import com.doumee.dao.admin.request.UserImport;
import com.doumee.dao.business.ShopMapper;
@@ -41,10 +45,8 @@
import org.springframework.util.CollectionUtils;
import org.springframework.web.multipart.MultipartFile;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.io.InputStream;
import java.util.*;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@@ -603,6 +605,35 @@
    @Override
    public     String getUserCard(Users users){
        String path = systemDictDataBiz.queryByCode(Constants.OBJCET_STORAGE, Constants.RESOURCE_PATH).getCode();
        String folder = systemDictDataBiz.queryByCode(Constants.OBJCET_STORAGE, Constants.USERS_FILE).getCode();
        String defualtHeader = systemDictDataBiz.queryByCode(Constants.WEIXIN_DEFAULT_IMGS, Constants.USER_CARD_HEADER_IMG).getCode();
        String defualtPhone = systemDictDataBiz.queryByCode(Constants.WEIXIN_DEFAULT_IMGS, Constants.USER_CARD_PHONE_IMG).getCode();
        String defualtAddr = systemDictDataBiz.queryByCode(Constants.WEIXIN_DEFAULT_IMGS, Constants.USER_CARD_ADDR_IMG).getCode();
        String imgurl =StringUtils.isNotBlank(users.getImgurl())?path+users.getImgurl():defualtHeader;
        String qrcode =StringUtils.isNotBlank(users.getQrcodeImg())?path+users.getQrcodeImg():null;
        InputStream inputStream = GeneratePicUtil.generateUserCardImg(
                imgurl
                ,qrcode
                ,StringUtils.defaultString(users.getName(),"-")
                ,"导购"
                ,StringUtils.defaultString(users.getPhone(),"-")
                ,StringUtils.defaultString(users.getShopAddress(),"-")
                ,"ZBOM志邦家居|"+ StringUtils.defaultString(users.getShopName(),"-")
                ,defualtPhone
                ,defualtAddr);
        TyyZosUtil obs = new TyyZosUtil( systemDictDataBiz.queryByCode(Constants.OBJCET_STORAGE, Constants.ENDPOINT).getCode(),
                systemDictDataBiz.queryByCode(Constants.OBJCET_STORAGE, Constants.ACCESS_ID).getCode(),
                systemDictDataBiz.queryByCode(Constants.OBJCET_STORAGE, Constants.ACCESS_KEY).getCode());
        String fileName =folder+ DateUtil.getNowShortDate()+"/"+UUID.randomUUID().toString() + ".jpg";
        if (obs.uploadInputstreamObject(inputStream,systemDictDataBiz.queryByCode(Constants.OBJCET_STORAGE, Constants.BUCKETNAME).getCode(), fileName)) {
            return  path+fileName;
        }
        return null;
    }
    @Override
    public Users usersDetail(Long userId){
        Users users = usersMapper.selectById(userId);
        if(Objects.isNull(users)){
server/web/src/main/java/com/doumee/api/web/ApiController.java
@@ -2,8 +2,13 @@
import com.doumee.config.Jwt.JwtTokenUtil;
import com.doumee.dao.business.model.Member;
import com.doumee.dao.business.model.Users;
import com.doumee.service.business.MemberService;
import com.doumee.service.business.UsersService;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.ptg.MemAreaPtg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
@@ -17,6 +22,15 @@
@Slf4j
public class ApiController {
    @Autowired
    UsersService usersService;
    @Autowired
    MemberService memberService;
    /**
     * æ˜¯å¦å¼€å‘者
     */
    @Value("${debug_model}")
    private Boolean isDebug;
    /**
     * å¾—到request对象
@@ -38,6 +52,29 @@
        Object obj = this.getRequest().getAttribute(JwtTokenUtil.UserId_Name);
        return obj != null ? (Long) obj : null;
    }
    protected Long getUserId() {
        if(isDebug){
            return 2L;
        }
        Object obj = this.getRequest().getAttribute(JwtTokenUtil.UserId_Name);
        return obj != null ? (Long) obj : null;
    }
    protected Users getLoginUserInfo() {
      Long userId = getUserId();
      if(userId== null){
          return null;
      }
        Users user = usersService.findById(userId);
      return user;
    }
    protected Member getLoginMemberInfo() {
      Long userId = getMemberId();
      if(userId== null){
          return null;
      }
        Member user = memberService.findById(userId);
      return user;
    }
    protected Long getUserType() {
server/web/src/main/java/com/doumee/api/web/PersonnelApi.java
@@ -15,10 +15,7 @@
import lombok.extern.slf4j.Slf4j;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
/**
 * Created by IntelliJ IDEA.
@@ -86,4 +83,11 @@
        return  ApiResponse.success("操作成功");
    }
    @ApiOperation(value = "获取个人名片", notes = "员工端小程序")
    @PostMapping("/getUserCard")
    public ApiResponse<String> getUserCard() {
        return  ApiResponse.success(usersService.getUserCard(this.getLoginUserInfo()));
    }
}
server/web/src/main/java/com/doumee/config/shiro/ShiroAuthFilter.java
ÎļþÒÑɾ³ý
server/web/src/main/java/com/doumee/config/shiro/ShiroCache.java
ÎļþÒÑɾ³ý
server/web/src/main/java/com/doumee/config/shiro/ShiroCacheManager.java
ÎļþÒÑɾ³ý
server/web/src/main/java/com/doumee/config/shiro/ShiroConfig.java
ÎļþÒÑɾ³ý
server/web/src/main/java/com/doumee/config/shiro/ShiroCredentialsMatcher.java
ÎļþÒÑɾ³ý
server/web/src/main/java/com/doumee/config/shiro/ShiroRealm.java
ÎļþÒÑɾ³ý
server/web/src/main/java/com/doumee/config/shiro/ShiroSessionDAO.java
ÎļþÒÑɾ³ý
server/web/src/main/java/com/doumee/config/shiro/ShiroSessionManager.java
ÎļþÒÑɾ³ý
server/web/src/main/java/com/doumee/config/shiro/ShiroTokenManager.java
ÎļþÒÑɾ³ý