|
@@ -1,23 +1,25 @@
|
|
|
package com.minpay.shouhuo;
|
|
|
|
|
|
+import com.google.zxing.WriterException;
|
|
|
+import com.min.util.OffSetUtil;
|
|
|
import com.minpay.common.bean.User;
|
|
|
import com.minpay.common.constant.ServConstant;
|
|
|
import com.minpay.common.format.IFormatService;
|
|
|
import com.minpay.common.service.ILogService;
|
|
|
+import com.minpay.common.service.IPropertiesService;
|
|
|
import com.minpay.common.service.IPublicService;
|
|
|
-import com.minpay.common.util.CommonUtil;
|
|
|
-import com.minpay.common.util.DateUtil;
|
|
|
-import com.minpay.common.util.EmojiFilter;
|
|
|
-import com.minpay.common.util.HttpPostUtil;
|
|
|
+import com.minpay.common.util.*;
|
|
|
import com.minpay.db.table.mapper.VmPersonInfMapper;
|
|
|
import com.minpay.db.table.model.VmPersonInf;
|
|
|
import com.minpay.db.table.model.VmPersonInfExample;
|
|
|
import com.minpay.db.table.own.mapper.PersonManageMapper;
|
|
|
import com.minpay.db.table.own.mapper.SequenceMapper;
|
|
|
+import com.minpay.huicai.util.EquCodeCreateUtil;
|
|
|
import com.startup.minpay.frame.business.IMINAction;
|
|
|
import com.startup.minpay.frame.business.MINHttpServletRequestContext;
|
|
|
import com.startup.minpay.frame.business.res.MINActionResult;
|
|
|
import com.startup.minpay.frame.constant.IMINBusinessConstant;
|
|
|
+import com.startup.minpay.frame.constant.IMINTransactionEnum;
|
|
|
import com.startup.minpay.frame.data.format.MINCopyFormat;
|
|
|
import com.startup.minpay.frame.exception.MINBusinessException;
|
|
|
import com.startup.minpay.frame.jdbc.MINRowBounds;
|
|
@@ -30,6 +32,7 @@ import com.startup.minpay.frame.target.MINParam;
|
|
|
import net.sf.json.JSONObject;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.io.*;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@@ -52,6 +55,9 @@ public class PersManageAction implements IMINAction {
|
|
|
|
|
|
/**解冻*/
|
|
|
private final static String PERSON_THAW = "personThaw";
|
|
|
+
|
|
|
+ /** 生成包含字符串信息的二维码图片**/
|
|
|
+ public static final String CREATE_QRCODE = "createQrCode";
|
|
|
|
|
|
/**
|
|
|
* 用户查询
|
|
@@ -265,6 +271,62 @@ public class PersManageAction implements IMINAction {
|
|
|
throw new MINBusinessException("PAY10006", "微信获取openId失败!");
|
|
|
}
|
|
|
return res;
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 生成包含字符串信息的二维码图片
|
|
|
+ * @param flash 是否刷新
|
|
|
+ */
|
|
|
+ @MINAction(value = CREATE_QRCODE, transaction = IMINTransactionEnum.CMT)
|
|
|
+ public static MINActionResult createQrCode(
|
|
|
+ @MINParam(key = "flash") String flash,
|
|
|
+ @MINParam(key = "role") String role,
|
|
|
+ MINSession session)throws MINBusinessException, FileNotFoundException, WriterException, IOException {
|
|
|
+ MINActionResult res = new MINActionResult();
|
|
|
+ //获取当前用户信息
|
|
|
+ User u = session.getUser();
|
|
|
+ //获取用户id
|
|
|
+ String userId = u.getBranchId();
|
|
|
+ //刷新,生成
|
|
|
+ //开发环境修改配置
|
|
|
+ String basePath = "/home/images/"+ userId+".jpg"; //与nginx配置相同
|
|
|
+ String os = System.getProperty("os.name");
|
|
|
+ if(os.toLowerCase().startsWith("win")){
|
|
|
+ System.out.println(os + " can't gunzip");
|
|
|
+ basePath = "D:/images/"+ userId+".jpg"; //与nginx配置相同
|
|
|
+ }
|
|
|
+
|
|
|
+ File file = new File(basePath);
|
|
|
+ //获取父目录
|
|
|
+ File fileParent = file.getParentFile();
|
|
|
+ //判断是否存在
|
|
|
+ if (!fileParent.exists()) {
|
|
|
+ fileParent.mkdirs();
|
|
|
+ }
|
|
|
+ //获取渠道号
|
|
|
+ String channel = u.getChannel();
|
|
|
+ String address = Service.lookup(IPropertiesService.class)
|
|
|
+ .getSystemProperties().get(channel+"_TO_MACHINE_ERWERMA").getKey();// 为nginx根路径
|
|
|
+ // 加密客户号
|
|
|
+ OutputStream outputStream = new FileOutputStream(file);
|
|
|
+ // 生成二维码图片到本地
|
|
|
+ try {
|
|
|
+ EquCodeCreateUtil.createQrCode(outputStream,address+"/"+userId+"/"+role,900,"JPEG");
|
|
|
+ } catch (com.google.zxing.WriterException e) {
|
|
|
+ // TODO Auto-generated catch block
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ outputStream.close();
|
|
|
+ // 上传图片到服务器
|
|
|
+ InputStream inputSteam = new FileInputStream(file);
|
|
|
+ String url = UpLoadFile.uploadImg(inputSteam,"jpg",channel,"00");
|
|
|
+
|
|
|
+ inputSteam.close();
|
|
|
+ // 删除本地图片
|
|
|
+ file.delete();
|
|
|
+ res.set("url", url);
|
|
|
+ return res;
|
|
|
}
|
|
|
|
|
|
|