hz-zhhq-app-service/greenH5modul/.svn/pristine/88/885e42d18f27ca909505fae018f...

119 lines
4.4 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.text.SimpleDateFormat;
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.jdbc.core.BeanPropertyRowMapper;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
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.jysoft.weChat.util.Wechatconfig;
import com.jysoft.weChat.vo.ContentVo;
import com.nationalelectirc.Constant.Constant;
import com.nationalelectirc.utils.RestResult;
import com.nationalelectric.greenH5.bizc.BaseServiceImpl;
import com.nationalelectric.greenH5.bizc.IGreenGrantAuthBizc;
import com.nationalelectric.greenH5.po.GreenGrantAuth;
import com.nationalelectric.greenH5.po.GreenUserInfo;
import com.nationalelectric.greenH5.po.GreenUserRoleRel;
import com.sgcc.uap.persistence.IHibernateDao;
/**
* <b>概述</b><br>
* <p>
* <b>功能</b><br>
*
* @author chenweikang
*/
@Controller
@RequestMapping("/greenGrantAuth")
public class GreenGrantAuthController extends GreenBaseController {
@Autowired
private BaseServiceImpl BaseService;
/**
* 就餐登记service
*/
@Resource
private IGreenGrantAuthBizc greenGrantAuthBizc;
/**
* HibernateDao逻辑构件
*/
@Autowired
IHibernateDao hibernateDao;
@Autowired
private BaseServiceImpl baseService;
/**
* 查询跨区登记记录
* @param requestBody
* @return
*/
@RequestMapping(value = "/iOpenidGetUserInfo", method = RequestMethod.POST)
@ResponseBody
public RestResult iOpenidGetUserInfo(@RequestBody GreenUserInfo greenUserInfo) {
try {
String openId = greenUserInfo.getWxOpenId();
System.out.println("openIdopenIdopenId---->"+openId);
String sqlByOpenId = "select u.id as \"id\",u.wxOpenId as \"wxOpenId\", '' as \"wxProfile\",u.real_name as \"realName\",u.mobile as \"mobile\",u.face_Pic1 as \"face_Pic1\",u.identityAuth as \"identityAuth\",u.id_card as \"id_card\",u.userLevel as \"userLevel\",u.department_id as \"department_id\","
+ "u.department_name as \"departmentName\",u.org_name as \"orgName\" ,u.org_id as \"orgId\" ,u.gender as \"gender\",u.class_name as \"className\","
+ "u.is_inner as \"isInner\",u.user_status as \"userStatus\",r.role_id as \"role\", "
+ " u.dept_name_url as \"deptNameUrl\",u.dept_ID_url as \"deptIdUrl\" "
+ " from green_user_info u "
+ " left join green_user_role_rel r on u.id = r.user_id "
+ " where u.isc_id = '"+openId+"' AND u.IS_DELETED = 'N'";
List<Map<String,Object>> openIdList = hibernateDao.queryForListWithSql(sqlByOpenId.toString());
Map<String,Object> map =openIdList.get(0);
// if(openIdList.size()==0){
// map.put("role", "9");
// map.put("register", "0");//还未在系统内补全信息
// }else{
// map.put("register", "1");
// String uid = (String) map.get("id");
//
// // 是否待审核
// GreenUserInfo u = getUserInfo(uid);
// if ( u!= null && u.getUserStatus() != null && u.getUserStatus().equals("1")) {
// map.put("isCheck", 0);
// } else {
// map.put("isCheck", 1);
// }
// if(map.get("face_Pic1") != null){
// String picture1= (String)map.get("face_Pic1");
// map.put("face_Pic1", baseService.getImageBase64(picture1) );
// }
//
// }
return new RestResult(Constant.SUCCESS,"成功",map);
} catch (Exception e) {
e.printStackTrace();
return new RestResult(Constant.FAILED, "查询失败");
}
}
public static void main(String args[]){
String sqlByOpenId = "select u.id,u.wxOpenId, u.wx_profile as wxProfile,u.real_name as realName,u.mobile,u.face_Pic1,u.identityAuth,u.id_card,u.userLevel,u.department_id,"
+ "u.department_name as departmentName,u.org_name as orgName ,u.org_id as orgId ,u.gender,u.class_name as className,"
+ "u.is_inner as isInner,u.user_status as userStatus,r.role_id as role from green_user_info u "
+ "left join green_user_role_rel r on u.id = r.user_id "
+ "where u.wxopenid = '5k4YKLocesZQ536cyuF6g' AND u.IS_DELETED = 'N'";
System.out.println(sqlByOpenId);
}
}