hz-zhhq-app-service/greenH5modul/.svn/pristine/65/6548d4a67a645bd23123c249476...

110 lines
3.3 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 java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import javax.annotation.Resource;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.type.TypeReference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.nationalelectirc.Constant.Constant;
import com.nationalelectirc.utils.RestResult;
import com.nationalelectric.greenH5.bizc.BaseServiceImpl;
import com.nationalelectric.greenH5.bizc.IGreenOperateLogBizc;
import com.nationalelectric.greenH5.bizc.IGreenUserInfoBizc;
import com.nationalelectric.greenH5.po.GreenUserInfo;
import com.nationalelectric.greenH5.utils.DateTime;
import com.nationalelectric.greenH5.utils.DateUtil;
import com.sgcc.uap.persistence.IHibernateDao;
import okhttp3.Call;
import okhttp3.FormBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
/**
* <b>概述</b><br>
* <p>
* <b>功能</b><br>
*
* @author chenweikang
*/
@Controller
@RequestMapping("/greenEnterprise")
public class GreenEnterpriseController extends GreenBaseController {
/**
* 字典表controller
*/
@Resource
private GreenDictionaryInfoController greenDictionaryInfoController;
@Resource
private IGreenOperateLogBizc greenOperateLogBizc;
/**
* HibernateDao逻辑构件
*/
@Autowired
IHibernateDao hibernateDao;
@Autowired
private BaseServiceImpl baseService;
/**
* 获取大客户列表
*
* @param stime
* @param etime
* @return
*/
@SuppressWarnings({ "unchecked", "unused" })
@RequestMapping(value = "/getEnterpriseNames", method = RequestMethod.POST)
public @ResponseBody RestResult getEnterpriseNames(@RequestBody Object requestBody) {
try {
// Map<String, Object> map = new ObjectMapper().convertValue(requestBody, new TypeReference<Map<String, Object>>(){});
// String userId = map.get("userId") == null || "".equals(map.get("userId")) ? null : map.get("userId").toString();
// GreenUserInfo info = getUserInfo(userId);
// if (info == null) {
// return new RestResult(Constant.FAILED, "非法用户");
// }
// HashMap<String, Object> content = new HashMap<String, Object>();
// String now = DateUtil.dateToStr(new Date(), "yyyy-MM-dd");
List<Map<String, Object>> dictionaryInfo = greenDictionaryInfoController.getDictionaryInfo("enterpriseName");
List<Map<String, Object>> enterpriseNames = new ArrayList<Map<String,Object>>();
for(int i=0; i<dictionaryInfo.size(); i++){
Map<String, Object> map = new HashMap<String,Object>();
map.put("name", dictionaryInfo.get(i).get("data_value"));
enterpriseNames.add(map);
}
HashMap<String, Object> rMap = new HashMap<String, Object>();
rMap.put("enterpriseNames", enterpriseNames);
return new RestResult(Constant.SUCCESS, "请求成功",rMap);
} catch (Exception e) {
e.printStackTrace();
return new RestResult(Constant.FAILED, "请求失败");
}
}
}