|
|
@@ -5,6 +5,8 @@ import java.util.List;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import javax.servlet.http.HttpSession;
|
|
|
|
|
|
+import com.startup.minpay.frame.session.MINSession;
|
|
|
+import com.startup.minpay.frame.target.MINValidator;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
|
|
|
import com.alipay.api.AlipayApiException;
|
|
|
@@ -50,7 +52,7 @@ import net.sf.json.JSONObject;
|
|
|
|
|
|
/**
|
|
|
* 登录处理类
|
|
|
- * @author Zhumq
|
|
|
+ * @author xu
|
|
|
*/
|
|
|
@MINComponent
|
|
|
public class LoginAction implements IMINAction {
|
|
|
@@ -134,14 +136,18 @@ public class LoginAction implements IMINAction {
|
|
|
Service.lookup(IMINDataBaseService.class).getMybatisMapper(PubSendCodeMapper.class).insert(sendDetail);
|
|
|
return res;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
- * 小程序获取用户OPENID,然后登陆
|
|
|
- * @param code 用户code
|
|
|
- * @param type 登录类型:WX微信AL支付宝
|
|
|
- * @param fapRequest
|
|
|
+ *小程序获取用户OPENID,然后登陆
|
|
|
+ * @param code 用户code
|
|
|
+ * @param type 登录类型:WX微信AL支付宝
|
|
|
+ * @param channel 渠道:售货机=V01
|
|
|
+ * @param equNo 售货机编号
|
|
|
+ * @param version 版本
|
|
|
+ * @param response
|
|
|
+ * @param request
|
|
|
* @return
|
|
|
- * @throws Exception
|
|
|
+ * @throws Exception
|
|
|
*/
|
|
|
@MINAction(value = LOGIN, session = false)
|
|
|
public MINActionResult login(
|
|
|
@@ -182,7 +188,7 @@ public class LoginAction implements IMINAction {
|
|
|
VmPersonInfExample personex = new VmPersonInfExample();
|
|
|
personex.createCriteria().andChannelEqualTo(channel).andTypeEqualTo(type).andOpenidEqualTo(result.get("openId"));
|
|
|
List<VmPersonInf> perLst = Service.lookup(IMINDataBaseService.class).getMybatisMapper(VmPersonInfMapper.class).selectByExample(personex);
|
|
|
- if(perLst.size() != 1) {
|
|
|
+ if(perLst.size() == 0) {
|
|
|
//获取用户主键
|
|
|
String perId = Service.lookup(IMINDataBaseService.class).getMybatisMapper(SequenceMapper.class).getSequence("VM_PERSON_INF_NO");
|
|
|
person.setId(perId);
|
|
|
@@ -206,7 +212,9 @@ public class LoginAction implements IMINAction {
|
|
|
service.addAccount(channel, perId, "01");
|
|
|
service.addAccount(channel, perId, "02");
|
|
|
service.addAccount(channel, perId, "03");
|
|
|
- }else{
|
|
|
+ }if(perLst.size() > 1) {
|
|
|
+ throw new MINBusinessException("数据异常");
|
|
|
+ }if(perLst.size() == 1) {
|
|
|
person = perLst.get(0);
|
|
|
person.setName(result.get("nickName"));
|
|
|
person.setHeadpath(result.get("headImgurl"));
|
|
|
@@ -221,8 +229,28 @@ public class LoginAction implements IMINAction {
|
|
|
res.set("headImgurl", result.get("headImgurl"));
|
|
|
return res;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+ @MINValidator(value = LOGIN)
|
|
|
+ public MINActionResult loginValidator(
|
|
|
+ @MINParam(key = "code" ) String code,
|
|
|
+ @MINParam(key = "type") String type,
|
|
|
+ @MINParam(key = "channel") String channel,
|
|
|
+ @MINParam(key = "equNo") String equNo,
|
|
|
+ @MINParam(key = "version") String version,
|
|
|
+ MINSession session) throws MINBusinessException {
|
|
|
+ MINActionResult res = new MINActionResult();
|
|
|
+ if(CommonUtil.isEmpty(code) ||
|
|
|
+ CommonUtil.isEmpty(type) ||
|
|
|
+ CommonUtil.isEmpty(channel) ||
|
|
|
+ CommonUtil.isEmpty(equNo) ||
|
|
|
+ CommonUtil.isEmpty(version)){
|
|
|
+ throw new MINBusinessException("参数为空或数据异常");
|
|
|
+ }
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/***
|
|
|
* 微信用户授权,获取用户信息
|
|
|
* @param code
|
|
|
@@ -271,6 +299,7 @@ public class LoginAction implements IMINAction {
|
|
|
res.set("openId", openId);
|
|
|
res.set("headImgurl", headImgurl);
|
|
|
res.set("nickName", nickName);
|
|
|
+
|
|
|
} catch (Exception e) {
|
|
|
throw new MINBusinessException("PAY10006", "微信获取openId失败!");
|
|
|
}
|