Kaynağa Gözat

1:修复公司账户注册问题;
2:添加手机号作为登录账号。

李天标 5 yıl önce
ebeveyn
işleme
7aeef64123

+ 19 - 0
app-api/src/main/java/com/hboxs/control/api/equipment/IndexController.java

@@ -547,7 +547,26 @@ public class IndexController extends BaseController {
         equipmentService.update(equipment);
         return JsonMessage.success("修改成功");
     }
+    /**
+     * 新修改设备状态
+     *
+     * @param clientId
+     * @param eqeStatus 设备状态1开 0关
+     * @return
+     */
+    @RequestMapping(value = "/updateEqeStatusNew", method = RequestMethod.POST)
+    @ResponseBody
+    public JsonMessage updateEqeStatusNew(String clientId, Integer eqeStatus,String network) {
+        Equipment equipment = equipmentService.findByClientId(clientId);
+        if (equipment == null) {
 
+            return JsonMessage.error("该设备不存在");
+        }
+        equipment.setNetwork(network);
+        equipment.setEqeStatus(eqeStatus);
+        equipmentService.update(equipment);
+        return JsonMessage.success("修改成功");
+    }
     /**
      * 修改设备锁定状态
      *

+ 5 - 2
app-api/src/main/java/com/hboxs/control/api/order/OrderController.java

@@ -986,9 +986,12 @@ public class OrderController extends BaseController {
             kindData.put("sn" , order.getSn());
             kindData.put("productName" , order.getProductName());
 
+            Equipment byClientId = equipmentService.findByClientId(order.getClientId());
+            String gtClientId = byClientId.getGtClientId();
 
-            PushUtils.push(equipmentService.findByClientId(order.getClientId()).getGtClientId(), "支付成功", "您的订单支付成功", PushUtils.buildJson("pay_success", kindData.toString()).toString());
-            order.setNote(equipmentService.findByClientId(order.getClientId()).getGtClientId()+"已推送");
+            PushUtils.push(gtClientId, "支付成功", "您的订单支付成功", PushUtils.buildJson("pay_success", kindData.toString()).toString());
+//            PushUtils.push(equipmentService.findByClientId(order.getClientId()).getGtClientId(), "支付成功", "您的订单支付成功", PushUtils.buildJson("pay_success", kindData.toString()).toString());
+            order.setNote(gtClientId+"已推送");
             orderService.update(order);
             return "success";
         }

+ 65 - 1
app-backend-myshiro/src/main/java/com/hboxs/myshiro/AuthenticationRealm.java

@@ -31,7 +31,7 @@ import java.util.List;
 
 
 /**
- * 权限认证
+ * 权限认证 登录
  */
 public class AuthenticationRealm extends AuthorizingRealm {
 
@@ -117,7 +117,71 @@ public class AuthenticationRealm extends AuthorizingRealm {
                 }
 
             }
+            //手机号登陆
+            if (admin == null) {
+                // 平台管理员登陆
+                if ("admin".equals(type)) {
+
+                    try {
+                        List<Admin> admins= adminService.findByPhone(username, Admin.Type.admin);
+                        if(admins.size()==1){
+                            admin = admins.get(0);
+                        }
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+
+                    // 代理商登陆
+                } else if ("agency".equals(type)) {
+
+                    try {
+                        List<Admin> admins = adminService.findByPhone(username, Admin.Type.agency);
+                        if(admins.size()==1){
+                            admin = admins.get(0);
+                        }
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+
+                    // 供应商登陆
+                }else if ("merchant".equals(type)) {
+
+                    if (StringUtils.isEmpty(p)) {
+                        throw new UnknownAccountException();
+                    }
+
+                    Long pId = AdminUtils.decrypt(true , p);
+
+
 
+                    try {
+                        List<Admin> admins = adminService.findByPhone(username, Admin.Type.merchant , pId);
+                        if(admins.size()==1){
+                            admin = admins.get(0);
+                        }
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+
+                }else if ("personage".equals(type)) {
+
+                    if (StringUtils.isEmpty(p)) {
+                        throw new UnknownAccountException();
+                    }
+
+                    Long pId = AdminUtils.decrypt(true , p);
+
+                    try {
+                        List<Admin> admins = adminService.findByPhone(username, Admin.Type.personage , pId);
+                        if(admins.size()==1){
+                            admin = admins.get(0);
+                        }
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+
+                }
+            }
             if (admin == null) {
                 throw new UnknownAccountException();
             }

+ 26 - 0
app-backend-web/src/main/java/com/hboxs/control/admin/JoinPayMchController.java

@@ -202,6 +202,32 @@ public class JoinPayMchController extends BaseController {
         }
 
     }
+
+    /**
+     * 发送商业账户身份证等证件
+     */
+    @RequestMapping(value = "/sendCardBusiness", method = RequestMethod.POST)
+    @ResponseBody
+    public JsonMessage sendCardBusiness(Long id,String cardPositive,String cardNegative,String tradeLicence,String openAccountLicence) {
+        adminService.getCurrent().getId();
+        Mch mch = mchService.getUniqueness(id);
+        if(cardPositive==null||cardNegative==null||tradeLicence==null||openAccountLicence==null){
+            return JsonMessage.success("图片不能为空");
+        }
+//        String[] string1 = cardPositive.split("\\.");
+//        String[] string2 = cardNegative.split("\\.");
+//        if(string1.length<2||string2.length<2){
+//            return JsonMessage.success("图片地址不规范,留意是否加入后缀名");
+//        }
+        // 如果分销商商户状态 不为空,则要远程请求刷一下当前的用户order_status
+        if (!StringUtils.isBlank(mch.getOrder_status())) {
+            String str = mchService.sendCardBusiness(mch,cardPositive,cardNegative,tradeLicence,openAccountLicence);
+            return JsonMessage.success(str);
+        } else {
+            return JsonMessage.success("分销商商户状态为空");
+        }
+
+    }
     /**
      * 查询身份证照片审核状态
      */

+ 85 - 3
app-backend-web/src/main/webapp/WEB-INF/template/admin/joinpay/mch/edit.ftl

@@ -81,6 +81,7 @@ $().ready(function() {
 	[/#if]
 
 });
+
 </script>
 </head>
 <body>
@@ -134,7 +135,7 @@ $().ready(function() {
 [#--                    <input type="text"  id="card_positive"  style="width: 300px"/>--]
 [#--                </td>     --]
                 <td >
-                    <input type="file" accept="image/*" onchange="showImg(this)" />
+                    <input type="file" accept="image/*" onchange="showImg(this)" multiple="multiple"/>
                     <img src="" alt="" id="card_positive" style="height: 150px">
                 </td>
             </tr>
@@ -144,12 +145,37 @@ $().ready(function() {
                 </th>
                 <td >
 [#--                    <input type="text"   id="card_negative"  style="width: 300px">--]
-                    <input type="file" accept="image/*" onchange="showImg2(this)" />
+                    <input type="file" accept="image/*" onchange="showImg2(this)" multiple="multiple"/>
                     <img src="" alt="" id="card_negative" value="" style="height: 150px" >
-
+                    [#if mch.alt_merchant_type!='12']
                     &nbsp &nbsp <button type="button" id="sendCard" >上传</button>
+                    [#else ]
+                    &nbsp &nbsp <button type="button" id="sendCardBusiness" >上传</button>
+                    [/#if]
+                </td>
+            </tr>
+            [#if mch.alt_merchant_type=='12']
+            <tr>
+                <th>
+                    营业执照:
+                </th>
+                <td >
+                    <input type="file" accept="image/*" onchange="showImg3(this)"/>
+                    <img src="" alt="" id="trade_licence" value="" style="height: 150px" >
+
+                </td>
+            </tr>
+            <tr>
+                <th>
+                    开户许可证:
+                </th>
+                <td >
+                    <input type="file" accept="image/*" onchange="showImg4(this)"/>
+                    <img src="" alt="" id="open_account_licence" value="" style="height: 150px" >
+
                 </td>
             </tr>
+            [/#if]
             <tr>
                 <th>
                     身份证审核情况:
@@ -331,6 +357,27 @@ $().ready(function() {
             }
         })
     });
+    $('#sendCardBusiness').click(function(){
+        var id = document.getElementById("adminId").value;
+        var cardPositive = document.getElementById("card_positive").value;
+        var cardNegative = document.getElementById("card_negative").value;
+        var tradeLicence = document.getElementById("trade_licence").value;
+        var openAccountLicence = document.getElementById("open_account_licence").value;
+        $.ajax({
+            url:"/asl-admin/joinPayMch/sendCardBusiness.htm",
+            type:"POST",
+            data:{
+                "id":id,
+                "cardPositive":cardPositive,
+                "cardNegative":cardNegative,
+                "tradeLicence":tradeLicence,
+                "openAccountLicence":openAccountLicence
+            },
+            success: function(data){
+                layer.msg(data.data);
+            }
+        })
+    });
     $('#searchApprove').click(function(){
         var id=	document.getElementById("adminId").value;
         $.ajax({
@@ -376,5 +423,40 @@ $().ready(function() {
             alert("上传失败");
         }
     }
+
+    function showImg3(obj) {
+        var file=$(obj)[0].files[0];    //获取文件信息
+        var imgdata='';
+        if(file)
+        {
+            var reader=new FileReader();  //调用FileReader
+            reader.readAsDataURL(file); //将文件读取为 DataURL(base64)
+            reader.onload=function(evt){
+                //读取操作完成时触发。
+                $("#trade_licence").attr('src',evt.target.result);  //将img标签的src绑定为DataURL
+                $("#trade_licence").attr('value',evt.target.result);
+            };
+        }
+        else{
+            alert("上传失败");
+        }
+    }
+    function showImg4(obj) {
+        var file=$(obj)[0].files[0];    //获取文件信息
+        var imgdata='';
+        if(file)
+        {
+            var reader=new FileReader();  //调用FileReader
+            reader.readAsDataURL(file); //将文件读取为 DataURL(base64)
+            reader.onload=function(evt){
+                //读取操作完成时触发。
+                $("#open_account_licence").attr('src',evt.target.result);  //将img标签的src绑定为DataURL
+                $("#open_account_licence").attr('value',evt.target.result);
+            };
+        }
+        else{
+            alert("上传失败");
+        }
+    }
 </script>
 </html>

+ 1 - 1
app-backend-web/src/main/webapp/asl-admin/login.jsp

@@ -251,7 +251,7 @@
             <ul>
                 <li>
                     <label>账 号</label>
-                    <input type="text" id="username" name="username" class="t" placeholder="请输入管理员账号" value="" required/>
+                    <input type="text" id="username" name="username" class="t" placeholder="请输入账号/手机号" value="" required/>
                 </li>
                 <li>
                     <label>密 码</label>

+ 7 - 2
app-common/src/main/java/com/hboxs/common/utils/PushUtils.java

@@ -1,5 +1,6 @@
 package com.hboxs.common.utils;
 
+import com.gexin.rp.sdk.base.IPushResult;
 import com.gexin.rp.sdk.base.impl.SingleMessage;
 import com.gexin.rp.sdk.base.impl.Target;
 import com.gexin.rp.sdk.base.payload.APNPayload;
@@ -26,6 +27,8 @@ public class PushUtils {
 
     public final static String host = "http://sdk.open.api.igexin.com/apiex.htm";
 
+//    public  static IPushResult rets =null;
+
     public static String test_clientId = "c69869085580f3b77f2972403fbdd5b3";
     public static String test_clientId2 = "200cb24ae7af3c4096cc2c46569ed530";
 
@@ -62,10 +65,12 @@ public class PushUtils {
             try {
 
                 new Thread(new Runnable() {
-
+//                    IPushResult ret = null;
                     @Override
                     public void run() {
-                        push.pushMessageToSingle(iMessage, target);
+//                        ret = push.pushMessageToSingle(iMessage, target);
+                         push.pushMessageToSingle(iMessage, target);
+//                        rets = ret;
                     }
 
 

+ 9 - 0
app-dao/src/main/java/com/hboxs/dao/AdminDao.java

@@ -61,4 +61,13 @@ public interface AdminDao extends BaseDao<Admin, Long> {
      * @return
      */
     List<AdminStatisticsDTO> findByTime(Date begin, Date end, Integer type, Integer unit, Long[] adminids);
+    /**
+     * 根据手机号查找管理员
+     *
+     * @param phone 用户名(忽略大小写)
+     * @return 管理员,若不存在则返回null
+     */
+    List<Admin> findByPhone(String phone, Admin.Type type);
+
+    List<Admin> findByPhone(String phone, Admin.Type type, Long pId);
 }

+ 45 - 0
app-dao/src/main/java/com/hboxs/dao/impl/AdminDaoImpl.java

@@ -86,7 +86,52 @@ public class AdminDaoImpl extends BaseDaoImpl<Admin, Long> implements AdminDao {
             return null;
         }
     }
+    /**
+     * 根据手机号查找管理员
+     *
+     * @param phone 用户名(忽略大小写)
+     * @return 管理员,若不存在则返回null
+     */
+    @Override
+    public List<Admin> findByPhone(String phone, Admin.Type type) {
+        if (phone == null) {
+            return null;
+        }
+        try {
+            String jpql = "select admin from Admin admin where lower(admin.phone) = lower(:phone) and admin.type = :type ";
+            return entityManager.createQuery(jpql, Admin.class).setFlushMode(FlushModeType.COMMIT)
+                    .setParameter("phone", phone).setParameter("type" , type).getResultList();
+        } catch (NoResultException e) {
+            return null;
+        }
+    }
+
+    @Override
+    public List<Admin> findByPhone(String phone, Admin.Type type, Long pId) {
+        if (phone == null) {
+            return null;
+        }
+        try {
+
+            if(type==Admin.Type.personage){
+
+                String jpql = "select admin from Admin admin where lower(admin.phone) = lower(:phone) and admin.type = :type and admin.merchantId = :merchantId ";
+                return entityManager.createQuery(jpql, Admin.class).setFlushMode(FlushModeType.COMMIT).setParameter("phone", phone).setParameter("type" , type).setParameter("merchantId" , pId).
+                        getResultList();
+
+            }else {
+
+                String jpql = "select admin from Admin admin where lower(admin.phone) = lower(:phone) and admin.type = :type and admin.agencyId = :agencyId ";
+                return entityManager.createQuery(jpql, Admin.class).setFlushMode(FlushModeType.COMMIT).setParameter("phone", phone).setParameter("type" , type).setParameter("agencyId" , pId).
+                        getResultList();
 
+            }
+
+
+        } catch (NoResultException e) {
+            return null;
+        }
+    }
     /**
      * 根据时间段统计商家增长数量
      *

+ 12 - 1
app-entity/src/main/java/com/hboxs/entity/Equipment.java

@@ -106,7 +106,10 @@ public class Equipment extends BaseEntity {
      * 设备联系方式
      */
     private String contactPhone;
-
+    /**
+     * 远程开关机的时间戳
+     */
+    private String network;
     /**
      * 地区完整名称
      */
@@ -669,4 +672,12 @@ public class Equipment extends BaseEntity {
     public void setAdvancedParameters(String advancedParameters) {
         this.advancedParameters = advancedParameters;
     }
+
+    public String getNetwork() {
+        return network;
+    }
+
+    public void setNetwork(String network) {
+        this.network = network;
+    }
 }

+ 9 - 0
app-service/src/main/java/com/hboxs/service/AdminService.java

@@ -108,4 +108,13 @@ public interface AdminService extends BaseService<Admin, Long> {
 
 
     public List<AdminStatisticsDTO> findByTime(Date begin, Date end, Integer type, Integer unit, Long[] adminId);
+    /**
+     * 根据手机号查找管理员
+     *
+     * @param phone 用户名(忽略大小写)
+     * @return 管理员,若不存在则返回null
+     */
+    List<Admin> findByPhone(String phone, Admin.Type type);
+
+    List<Admin> findByPhone(String phone, Admin.Type type, Long pId);
 }

+ 4 - 0
app-service/src/main/java/com/hboxs/service/MchService.java

@@ -78,4 +78,8 @@ public interface MchService extends BaseService<Mch, Long> {
      * 查询身份证照片审核状态
      */
     String searchApprove(Mch mch);
+    /**
+     * 发送商业账户身份证等证件
+     */
+    String sendCardBusiness(Mch mch, String cardPositive, String cardNegative, String tradeLicence, String openAccountLicence);
 }

+ 15 - 0
app-service/src/main/java/com/hboxs/service/impl/AdminServiceImpl.java

@@ -218,6 +218,21 @@ public class AdminServiceImpl extends BaseServiceImpl<Admin, Long> implements Ad
         Collections.sort(list1);
         return list1;
     }
+    /**
+     * 根据手机号查找管理员
+     *
+     * @param phone 用户名(忽略大小写)
+     * @return 管理员,若不存在则返回null
+     */
+    @Override
+    public List<Admin> findByPhone(String phone, Admin.Type type) {
+        return adminDao.findByPhone(phone, type);
+    }
+
+    @Override
+    public List<Admin> findByPhone(String phone, Admin.Type type, Long pId) {
+        return adminDao.findByPhone(phone , type , pId);
+    }
 
     @Override
     @Transactional

+ 98 - 3
app-service/src/main/java/com/hboxs/service/impl/MchServiceImpl.java

@@ -78,7 +78,8 @@ public class MchServiceImpl extends BaseServiceImpl<Mch, Long> implements MchSer
         mch.setLogin_name(login_name);
 
 //        String alt_mch_name = "test1_" + adminId  + "@mianhuatang.com";
-        String alt_mch_name = mch.getLegal_person();
+//        String alt_mch_name = mch.getLegal_person();
+        String alt_mch_name = mch.getBank_account_name();
         mch.setAlt_mch_name(alt_mch_name);
         mch.setAlt_mch_short_name("");
 
@@ -221,6 +222,10 @@ public class MchServiceImpl extends BaseServiceImpl<Mch, Long> implements MchSer
             // 企业用对公账户
             requestData.put("bank_account_type",  JoinpayConstant.bank_account_type4);
             mch.setBank_account_type(JoinpayConstant.bank_account_type4);
+            String alt_mch_name = bank_account_name;
+            requestData.put("alt_mch_name", alt_mch_name);
+//            requestData.put("alt_mch_name", AESUtil.encrypt(alt_mch_name, aes_key1 ,  aes_key2 ));
+
         }else if(JoinpayConstant.alt_merchant_type1== alt_merchant_type){
             // 个人用借记卡
             requestData.put("bank_account_type",  JoinpayConstant.bank_account_type1);
@@ -237,8 +242,10 @@ public class MchServiceImpl extends BaseServiceImpl<Mch, Long> implements MchSer
         mch.setBank_account_name(bank_account_name);
         mch.setBank_account_no(bank_account_no);
         mch.setBank_channel_no(bank_channel_no);
-
-
+        if(alt_merchant_type==12){
+            String alt_mch_name = bank_account_name;
+            mch.setAlt_mch_name(alt_mch_name);
+        }
         JSONObject requestJson = new JSONObject(new TreeMap<String, Object>());
         requestJson.put("method", "altmch.modify");
         requestJson.put("version", "1.0");
@@ -768,6 +775,94 @@ public class MchServiceImpl extends BaseServiceImpl<Mch, Long> implements MchSer
 
         return back;
     }
+    /**
+     * 传送身份证图片
+     * @param
+     * @return
+     */
+    @Override
+    public String sendCardBusiness(Mch mch, String cardPositive, String cardNegative, String tradeLicence, String openAccountLicence) {
+
+//        String url = "https://www.joinpay.com/allocFunds";
+        String url = "https://upload.joinpay.com/allocFunds";
+
+        if(StringUtils.isEmpty(mch.getAlt_mch_no())){
+            return "找不到商家编号";
+        }
+//        String card_positive = ImageToBase64ByLocal(cardPositive);
+        String card_positive = cardPositive;
+//        String card_negative = ImageToBase64ByLocal(cardNegative);
+        String card_negative = cardNegative;
+        String trade_licence = tradeLicence;
+        String open_account_licence = openAccountLicence;
+
+        JSONObject requestData = new JSONObject(new LinkedHashMap());
+        requestData.put("alt_mch_no" , mch.getAlt_mch_no());
+        requestData.put("card_positive" , card_positive);
+        requestData.put("card_negative" , card_negative);
+        requestData.put("trade_licence" , trade_licence);
+        requestData.put("open_account_licence" , open_account_licence);
+
+        JSONObject requestJson = new JSONObject(new TreeMap<String, Object>());
+        requestJson.put("method", "altMchPics.uploadPic");
+        requestJson.put("version", "1.0");
+        requestJson.put("data", requestData);
+        // 32位随机字符串
+        String uuid = UUID.randomUUID().toString().trim().replaceAll("-", "");
+        requestJson.put("rand_str", uuid);
+        requestJson.put("sign_type", JoinpayConstant.sign_type_MD5);
+        requestJson.put("mch_no", JoinpayConstant.mch_no);
+
+        String sign = createMD5Sign(requestJson , JoinpayConstant.key);
+        requestJson.put("sign", sign.toUpperCase());
+        logger.info("请求参数:" + requestJson);
+        String back=null;
+        org.json.JSONObject jsonObject;
+        try {
+
+            jsonObject = HttpClientUtils.postJson(url, requestJson.toString());
+            logger.info("响应参数:" + jsonObject);
+
+            // 判断请求是否正确,受理成功
+            if(jsonObject.has("resp_code")){
+                String resp_code = jsonObject.getString("resp_code");
+                mch.setResp_code(resp_code);
+            }else{
+                return "请求失败";
+            }
+            // 处理data
+            if(jsonObject.has("data")){
+                org.json.JSONObject data = jsonObject.getJSONObject("data");
+                String biz_code = data.getString("biz_code");
+                if(biz_code.equals("B100000")){
+                    String approve_status = "审核中";
+                    mch.setApprove_status(approve_status);
+                    mch.setApprove_note("");
+                    back = approve_status;
+                }
+                if(biz_code.equals("B100002")){
+                    String approve_status = "上传失败";
+                    String approve_note = data.getString("biz_msg");
+                    mch.setApprove_note(approve_note);
+                    mch.setApprove_status(approve_status);
+                    back = approve_status;
+                }
+                if(biz_code.equals("B101017")){
+                    String approve_status = "上传失败";
+                    String approve_note = data.getString("biz_msg");
+                    mch.setApprove_note(approve_note);
+                    mch.setApprove_status(approve_status);
+                    back = approve_status;
+                }
+                update(mch);
+            }
+
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+
+        return back;
+    }
 
     /**
      * 查询身份证照片审核状态