hz-zhhq-app-service/greenH5modul/.svn/pristine/4d/4d3946fa15585913a546dd9e696...

86 lines
2.5 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package com.nationalelectric.greenH5;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.beans.factory.annotation.Autowired;
import com.nationalelectirc.Constant.Constant;
import com.nationalelectirc.utils.RestResult;
import com.nationalelectirc.utils.Utils;
import com.nationalelectric.greenH5.bizc.BaseServiceImpl;
import com.nationalelectric.greenH5.po.GreenPersonElecAcc;
import com.nationalelectric.greenH5.po.GreenUserInfo;
import com.nationalelectric.greenH5.po.GreenUserRoleRel;
import com.nationalelectric.greenH5.utils.GetTokenUtil;
import com.sgcc.uap.mdd.model.utils.StringUtil;
import com.sgcc.uap.persistence.IHibernateDao;
import com.alibaba.fastjson.JSONObject;
import com.jysoft.unipush.AliasManage;
import org.springframework.web.bind.annotation.RequestMapping;
import java.net.URLDecoder;
import java.util.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
/**
* <b>概述</b><br>
* TODO
* <p>
* <b>功能</b><br>
* TODO
*
* @author niguang
*/
@Controller
@RequestMapping("/appupdate")
public class AppUpdateController {
@Autowired
IHibernateDao hibernateDao;
@Autowired
private BaseServiceImpl baseService;
@Autowired
private GreenDictionaryInfoController greenDictionaryInfoController;
/**
* 注册
*/
@SuppressWarnings("unchecked")
@RequestMapping(value = "/getAppUpdateInfo", method = RequestMethod.POST)
public @ResponseBody RestResult getAppUpdateInfo(Map<String, Object> map) {
try {
String versionCode = (String) map.get("versionCode");
String versionName = (String) map.get("versionName");
String type = (String) map.get("type");
String getNewestInfoSql = "select version_code as versionCode,version_name as versionName,"
+ " type,version_info as versionInfo,force_update as forceUpdate, "
+ " downloadurl as downloadUrl from app_update "
+ " where latest ='Y' AND version_code !=? and type=?";
List<Map<String,Object>> list = hibernateDao.queryForListWithSql(getNewestInfoSql,new Object[]{versionCode,type});
if(list.size()==0){
return new RestResult(Constant.FAILED,"查询失败!");
}
Map<String,Object> appInfoMap = list.get(0);
return new RestResult(Constant.SUCCESS,"查询成功",appInfoMap);
} catch (Exception e) {
e.printStackTrace();
return new RestResult(Constant.FAILED,"查询失败!");
}
}
}