Explorar o código

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

# Conflicts:
#	business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/XzzxEntranceService.java
#	svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/XzzxCotroller.java
wangzhinan %!s(int64=4) %!d(string=hai) anos
pai
achega
8552e801e3

+ 11 - 10
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/wechat/WechatMenuController.java

@ -7,29 +7,28 @@ import com.yihu.jw.wechat.service.WxAccessTokenService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
/**
 * Created by chenweida on 2017/8/4.
 */
@RestController
@Controller
@RequestMapping(value = "/wechat/menu", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "微信菜单相关管理")
public class WechatMenuController extends EnvelopRestEndpoint {
    private static String wechat_token ="xAeQrX7uOD0OusIZ5JUQzrLPYIQBlqbS" ;
    @Autowired
    private HttpUtil httpUtil;
    private Logger logger= LoggerFactory.getLogger(WechatMenuController.class);
    @Autowired
    private WxAccessTokenService wxAccessTokenService;
    @Value("${wechat.id}")
@ -45,9 +44,9 @@ public class WechatMenuController extends EnvelopRestEndpoint {
    public String createMenuTest() {
        try {
            WxAccessTokenDO wxAccessTokenDO = wxAccessTokenService.getWxAccessTokenById(wechatId);
            String filePath = WechatCoreController.class.getResource("/").getPath() +
                    File.separator + "wechat" + File.separator + "weixin_menu.txt";
            String url = " https://api.weixin.qq.com/cgi-bin/menu/create?access_token=" + wxAccessTokenDO.getAccessToken();
            String filePath = "/usr/local/hospital/weixin_menu.txt";
            logger.info("filePath"+filePath);
            String url = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token=" + wxAccessTokenDO.getAccessToken();
            // 读取微信菜单配置文件
            InputStreamReader reader = new InputStreamReader(new FileInputStream(filePath), "utf-8");
            BufferedReader bufferedReader = new BufferedReader(reader);
@ -62,7 +61,9 @@ public class WechatMenuController extends EnvelopRestEndpoint {
            bufferedReader.close();
            reader.close();
            // 请求微信接口创建菜单
            String jsonStr = httpUtil.sendPost(url, params);
            String jsonStr = HttpUtil.sendPost(url, params);
            logger.info("日志"+jsonStr);
            JSONObject result = new JSONObject(jsonStr);
            if (result != null && result.get("errcode").toString().equals("0") && result.getString("errmsg").equals("ok")) {
                return  "创建成功!";