springmvc请求参数格式json

 @RequestMapping(value = "/sendNoteMessege", method = RequestMethod.POST)
    public Result sendNoteMessege(@RequestParam(value = "flag", required = false) String flag,
                                  @RequestParam(value = "list",required = false)  String list) {
        Result result = new Result();
        try {
           /* boolean isLimit = LimitVisitTimeUtil.limitVisit(WTOIP_YUN_APP_PORTAL_MINUTES_NOTE_NOTIFY,"1",1,TimeUnit.MINUTES);
            if (isLimit){
                result.setCode(1);
                result.setMessage("请您稍等一分钟再发短信");
                result.setObject(0);
                return result;
            }*/
          int sum = 0;
            JSONArray array = JSONArray.fromObject(list);
            for (int i =0 ;i < array.size();i++){
                String phone = (String)array.getJSONObject(i).get("phone");
                String enterpriseId = (String)array.getJSONObject(i).get("enterpriseId");
                if("1".equals(flag)) {//自动发短信
                    Map maptemp = new HashMap();
                    maptemp.put("enterpriseId", enterpriseId);
                    List pohoneList = YunTrustPatentService.getPatentPhoneByEnterpriseId(maptemp);
                    if (pohoneList.size() == 0) continue;
                    Map tempMap = (Map) pohoneList.get(0);
                    String companyName = (String) tempMap.get("companyName");
                    int count = YunTrustPatentService.sendNoteMessege(companyName, phone, enterpriseId);
                    sum += count;

                }else {
                    Map map = new HashMap();
                    map.put("enterpriseId", enterpriseId);
                    List pohoneList = YunTrustPatentService.getPatentPhoneByEnterpriseId(map);
                    if (pohoneList.size() == 0) continue;
                    Map tempMap = (Map) pohoneList.get(0);
                    String companyName = (String) tempMap.get("companyName");
                    phone = (String) tempMap.get("phone");
                    String mobile = (String) tempMap.get("mobile");
                    if (null== phone || "".equals(phone)) {
                        if (mobile.indexOf(",") > 0) {
                            String mobiles[] = mobile.split(",");
                            phone = mobiles[0];
                        }else {
                            phone = mobile;
                        }
                    } else {
                        if (phone.indexOf(",") > 0) {
                            String phones[] = phone.split(",");
                            phone = phones[0];
                        }
                    }
                    int count = YunTrustPatentService.sendNoteMessege(companyName, phone, enterpriseId);
                    sum += count;
                }
            }
            result.setCode(1);
            result.setMessage("发短信信息成功");
            result.setObject(sum);
        } catch (Exception e) {
            logger.error("发短信信息" + e.getMessage());
        }

        return result;
    }

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值