Parcourir la source

登录接口调整

xubh il y a 5 ans
Parent
commit
be26f45b98

+ 36 - 11
src/main/java/com/minpay/common/action/LoginAction.java

@@ -5,6 +5,11 @@ import java.util.List;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpSession;
 
+import com.minpay.common.pay.bean.PrePay;
+import com.minpay.common.service.IPayOsService;
+import com.minpay.common.service.impl.PayOsServiceImpl;
+import com.minpay.db.table.mapper.VmEquipmentInfMapper;
+import com.minpay.db.table.model.*;
 import com.startup.minpay.frame.session.MINSession;
 import com.startup.minpay.frame.target.MINValidator;
 import org.apache.commons.lang.StringUtils;
@@ -31,10 +36,6 @@ import com.minpay.common.util.SmsAliSendUtil;
 import com.minpay.common.util.SmsSendUtil;
 import com.minpay.db.table.mapper.PubSendCodeMapper;
 import com.minpay.db.table.mapper.VmPersonInfMapper;
-import com.minpay.db.table.model.PubSendCode;
-import com.minpay.db.table.model.PubSendCodeExample;
-import com.minpay.db.table.model.VmPersonInf;
-import com.minpay.db.table.model.VmPersonInfExample;
 import com.minpay.db.table.own.mapper.SequenceMapper;
 import com.startup.minpay.frame.business.IMINAction;
 import com.startup.minpay.frame.business.MINHttpServletRequestContext;
@@ -204,7 +205,7 @@ public class LoginAction implements IMINAction {
 			person.setCreateTime(nowTime);
 			person.setModifyUser(perId);
 			person.setModifyTime(nowTime);
-			Service.lookup(IMINDataBaseService.class).getMybatisMapper(VmPersonInfMapper.class).insert(person);
+			Service.lookup(IMINDataBaseService.class).getMybatisMapper(VmPersonInfMapper.class).insertSelective(person);
 			
 			// 创建用户基本账户
 			IAccountService service = Service.lookup(IAccountService.class);
@@ -216,6 +217,17 @@ public class LoginAction implements IMINAction {
 			throw new MINBusinessException("数据异常");
 		}if(perLst.size() == 1) {
 			person = perLst.get(0);
+			if(!person.getStatus().equals("00")){
+				throw new MINBusinessException("账号异常,请联系管理员");
+			}
+			res.set("isMerchants","0");
+			if("1".equals(person.getIsUser())){
+				VmEquipmentInf vmEquipmentInf = Service.lookup(IMINDataBaseService.class).getMybatisMapper(VmEquipmentInfMapper.class).selectByPrimaryKey(equNo);
+				if(vmEquipmentInf.getBranchid().equals(person.getUserId())){
+					res.set("isMerchants",person.getIsUser());  //是本机器的商户(是否管理员)
+					res.set("role",person.getRole());
+				}
+			}
 			person.setName(result.get("nickName"));
 			person.setHeadpath(result.get("headImgurl"));
 			person.setModifyTime(nowTime);
@@ -277,7 +289,7 @@ public class LoginAction implements IMINAction {
 		paramStr.append("&grant_type=authorization_code");
 		try {
 			//发送请求
-			/*String jsonObj = HttpPostUtil.sendPost(openUrl, paramStr.toString());
+			String jsonObj = HttpPostUtil.sendPost(openUrl, paramStr.toString());
 			JSONObject js = JSONObject.fromObject(jsonObj);
 			//获取openId
 			String openId = js.getString("openid");//用户唯一标识,请注意,在未关注公众号时,用户访问公众号的网页,也会产生一个用户和公众号唯一的OpenID
@@ -298,11 +310,7 @@ public class LoginAction implements IMINAction {
 			String headImgurl = js2.getString("headimgurl");
 	    	res.set("openId", openId);
 	    	res.set("headImgurl", headImgurl);
-	    	res.set("nickName", nickName);*/
-
-			res.set("nickName","大头");
-			res.set("headImgurl","baidu.com");
-			res.set("openId","123456");
+	    	res.set("nickName", nickName);
 
 		} catch (Exception e) {
 			throw new MINBusinessException("PAY10006", "微信获取openId失败!"); 
@@ -392,4 +400,21 @@ public class LoginAction implements IMINAction {
 //	    	System.out.println(response.getAlipayUserId());
 //	    }
 //	}
+@MINAction(value = "test" , session = false)
+public MINActionResult test(
+		MINSession session ) throws MINBusinessException{
+	MINActionResult res = new MINActionResult();
+	PrePay prePay = new PrePay();
+	IPayOsService IPayOsService = new PayOsServiceImpl();
+	prePay.setBody("大头");
+	try {
+		IPayOsService.prePay(prePay);
+	} catch (MINBusinessException e) {
+		e.printStackTrace();
+	}
+
+	return res;
+}
+
+
 }

+ 2 - 2
src/main/java/com/minpay/common/action/TestMain.java

@@ -33,7 +33,7 @@ public class TestMain {
         }
         form.put("DeviceCreateIp", "127.0.0.1");
         form.put("SettleType", "T1");
-        form.put("SubAppId", MyConfig.newAppid);
+        form.put("SubAppId", MyConfig.oldAppid);
 
         //可选参数
         form.put("GoodsTag", "test");
@@ -50,7 +50,7 @@ public class TestMain {
         form.put("ReqTime", new Timestamp(System.currentTimeMillis()).toString());
         //reqMsgId每次报文必须都不一样
 //        form.put("ReqMsgId", UUID.randomUUID().toString());
-        form.put("ReqMsgId", "12321312");
+        form.put("ReqMsgId", "12321313");
 
         //封装报文
         String param = xmlUtil.format(form, function);

+ 32 - 0
src/main/java/com/minpay/db/table/model/VmPersonInf.java

@@ -116,6 +116,14 @@ public class VmPersonInf extends AbstractMINBean {
     private String status;
 
     /**
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column vm_person_inf.VCI_ROLE
+     *
+     * @mbggenerated
+     */
+    private String role;
+
+    /**
      * This method was generated by MyBatis Generator.
      * This method returns the value of the database column vm_person_inf.VCI_ID
      *
@@ -450,4 +458,28 @@ public class VmPersonInf extends AbstractMINBean {
     public void setStatus(String status) {
         this.status = status == null ? null : status.trim();
     }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column vm_person_inf.VCI_ROLE
+     *
+     * @return the value of vm_person_inf.VCI_ROLE
+     *
+     * @mbggenerated
+     */
+    public String getRole() {
+        return role;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column vm_person_inf.VCI_ROLE
+     *
+     * @param role the value for vm_person_inf.VCI_ROLE
+     *
+     * @mbggenerated
+     */
+    public void setRole(String role) {
+        this.role = role == null ? null : role.trim();
+    }
 }

+ 78 - 0
src/main/java/com/minpay/db/table/model/VmPersonInfExample.java

@@ -1281,6 +1281,84 @@ public class VmPersonInfExample {
             addCriterion("VCI_STATUS not between", value1, value2, "status");
             return (Criteria) this;
         }
+
+        public Criteria andRoleIsNull() {
+            addCriterion("VCI_ROLE is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoleIsNotNull() {
+            addCriterion("VCI_ROLE is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoleEqualTo(String value) {
+            if(value == null ){
+                andRoleIsNull();
+            } else {
+                addCriterion("VCI_ROLE =", value, "role");
+            }
+            return (Criteria) this;
+        }
+
+        public Criteria andRoleNotEqualTo(String value) {
+            if(value == null ){
+                andRoleIsNotNull();
+            } else {
+                addCriterion("VCI_ROLE <>", value, "role");
+            }
+            return (Criteria) this;
+        }
+
+        public Criteria andRoleGreaterThan(String value) {
+            addCriterion("VCI_ROLE >", value, "role");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoleGreaterThanOrEqualTo(String value) {
+            addCriterion("VCI_ROLE >=", value, "role");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoleLessThan(String value) {
+            addCriterion("VCI_ROLE <", value, "role");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoleLessThanOrEqualTo(String value) {
+            addCriterion("VCI_ROLE <=", value, "role");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoleLike(String value) {
+            addCriterion("VCI_ROLE like", value, "role");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoleNotLike(String value) {
+            addCriterion("VCI_ROLE not like", value, "role");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoleIn(List<String> values) {
+            addCriterion("VCI_ROLE in", values, "role");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoleNotIn(List<String> values) {
+            addCriterion("VCI_ROLE not in", values, "role");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoleBetween(String value1, String value2) {
+            addCriterion("VCI_ROLE between", value1, value2, "role");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoleNotBetween(String value1, String value2) {
+            addCriterion("VCI_ROLE not between", value1, value2, "role");
+            return (Criteria) this;
+        }
     }
 
     /**

+ 20 - 5
src/main/resources/com/minpay/db/table/mapper/VmPersonInfMapper.xml

@@ -20,6 +20,7 @@
     <result column="VCI_MODIFY_USER" jdbcType="VARCHAR" property="modifyUser" />
     <result column="VCI_MODIFY_TIME" jdbcType="VARCHAR" property="modifyTime" />
     <result column="VCI_STATUS" jdbcType="CHAR" property="status" />
+    <result column="VCI_ROLE" jdbcType="VARCHAR" property="role" />
   </resultMap>
   <sql id="Example_Where_Clause">
     <!--
@@ -94,7 +95,7 @@
     -->
     VCI_ID, VCI_CHANNEL, VCI_NAME, VCI_TYPE, VCI_PHONE, VCI_OPENID, VCI_HEADPATH, VCI_IS_USER, 
     VCI_USER_ID, VCI_CREATE_USER, VCI_CREATE_TIME, VCI_MODIFY_USER, VCI_MODIFY_TIME, 
-    VCI_STATUS
+    VCI_STATUS, VCI_ROLE
   </sql>
   <select id="selectByExample" parameterType="com.minpay.db.table.model.VmPersonInfExample" resultMap="BaseResultMap">
     <!--
@@ -151,12 +152,12 @@
       VCI_TYPE, VCI_PHONE, VCI_OPENID, VCI_HEADPATH, 
       VCI_IS_USER, VCI_USER_ID, VCI_CREATE_USER, 
       VCI_CREATE_TIME, VCI_MODIFY_USER, VCI_MODIFY_TIME, 
-      VCI_STATUS)
+      VCI_STATUS, VCI_ROLE)
     values (#{id,jdbcType=VARCHAR}, #{channel,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, 
       #{type,jdbcType=CHAR}, #{phone,jdbcType=VARCHAR}, #{openid,jdbcType=VARCHAR}, #{headpath,jdbcType=VARCHAR}, 
       #{isUser,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR}, 
       #{createTime,jdbcType=VARCHAR}, #{modifyUser,jdbcType=VARCHAR}, #{modifyTime,jdbcType=VARCHAR}, 
-      #{status,jdbcType=CHAR})
+      #{status,jdbcType=CHAR}, #{role,jdbcType=VARCHAR})
   </insert>
   <insert id="insertSelective" parameterType="com.minpay.db.table.model.VmPersonInf">
     <!--
@@ -207,6 +208,9 @@
       <if test="status != null">
         VCI_STATUS,
       </if>
+      <if test="role != null">
+        VCI_ROLE,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="id != null">
@@ -251,6 +255,9 @@
       <if test="status != null">
         #{status,jdbcType=CHAR},
       </if>
+      <if test="role != null">
+        #{role,jdbcType=VARCHAR},
+      </if>
     </trim>
   </insert>
   <select id="countByExample" parameterType="com.minpay.db.table.model.VmPersonInfExample" resultType="java.lang.Integer">
@@ -312,6 +319,9 @@
       <if test="record.status != null">
         VCI_STATUS = #{record.status,jdbcType=CHAR},
       </if>
+      <if test="record.role != null">
+        VCI_ROLE = #{record.role,jdbcType=VARCHAR},
+      </if>
     </set>
     <if test="_parameter != null">
       <include refid="Update_By_Example_Where_Clause" />
@@ -336,7 +346,8 @@
       VCI_CREATE_TIME = #{record.createTime,jdbcType=VARCHAR},
       VCI_MODIFY_USER = #{record.modifyUser,jdbcType=VARCHAR},
       VCI_MODIFY_TIME = #{record.modifyTime,jdbcType=VARCHAR},
-      VCI_STATUS = #{record.status,jdbcType=CHAR}
+      VCI_STATUS = #{record.status,jdbcType=CHAR},
+      VCI_ROLE = #{record.role,jdbcType=VARCHAR}
     <if test="_parameter != null">
       <include refid="Update_By_Example_Where_Clause" />
     </if>
@@ -387,6 +398,9 @@
       <if test="status != null">
         VCI_STATUS = #{status,jdbcType=CHAR},
       </if>
+      <if test="role != null">
+        VCI_ROLE = #{role,jdbcType=VARCHAR},
+      </if>
     </set>
     where VCI_ID = #{id,jdbcType=VARCHAR}
   </update>
@@ -408,7 +422,8 @@
       VCI_CREATE_TIME = #{createTime,jdbcType=VARCHAR},
       VCI_MODIFY_USER = #{modifyUser,jdbcType=VARCHAR},
       VCI_MODIFY_TIME = #{modifyTime,jdbcType=VARCHAR},
-      VCI_STATUS = #{status,jdbcType=CHAR}
+      VCI_STATUS = #{status,jdbcType=CHAR},
+      VCI_ROLE = #{role,jdbcType=VARCHAR}
     where VCI_ID = #{id,jdbcType=VARCHAR}
   </update>
 </mapper>