@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;
}