Browse Source

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

LiTaohong 6 years ago
parent
commit
b033db5f1e
57 changed files with 169 additions and 5251 deletions
  1. 3 3
      common/common-entity/src/main/java/com/yihu/jw/entity/base/role/RoleDO.java
  2. 12 0
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/role/RoleEndpoint.java
  3. 16 26
      svr/svr-base/src/main/java/com/yihu/jw/base/service/user/UserService.java
  4. 42 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/wx/WechatService.java
  5. 90 0
      svr/svr-base/src/main/java/com/yihu/jw/base/useragent/UserAgent.java
  6. 0 116
      svr/svr-base/src/main/java/com/yihu/jw/business/login/contorller/LoginController.java
  7. 0 27
      svr/svr-base/src/main/java/com/yihu/jw/business/login/dao/BaseLoginAccountDao.java
  8. 0 11
      svr/svr-base/src/main/java/com/yihu/jw/business/login/dao/BaseLoginLogDao.java
  9. 0 75
      svr/svr-base/src/main/java/com/yihu/jw/business/login/service/BaseLoginAccountService.java
  10. 0 129
      svr/svr-base/src/main/java/com/yihu/jw/business/login/service/LoginService.java
  11. 0 128
      svr/svr-base/src/main/java/com/yihu/jw/business/sms/controller/SmsGatewayController.java
  12. 0 18
      svr/svr-base/src/main/java/com/yihu/jw/business/sms/dao/SmsDao.java
  13. 0 20
      svr/svr-base/src/main/java/com/yihu/jw/business/sms/dao/SmsGatewayDao.java
  14. 0 68
      svr/svr-base/src/main/java/com/yihu/jw/business/sms/service/SmsGatewayService.java
  15. 0 188
      svr/svr-base/src/main/java/com/yihu/jw/business/sms/service/SmsService.java
  16. 0 49
      svr/svr-base/src/main/java/com/yihu/jw/business/sms/vo/SMSHttpVo.java
  17. 0 95
      svr/svr-base/src/main/java/com/yihu/jw/business/user/contorller/BaseMenuController.java
  18. 0 231
      svr/svr-base/src/main/java/com/yihu/jw/business/user/contorller/BaseRoleController.java
  19. 0 198
      svr/svr-base/src/main/java/com/yihu/jw/business/user/contorller/EmployController.java
  20. 0 28
      svr/svr-base/src/main/java/com/yihu/jw/business/user/contorller/PatientController.java
  21. 0 32
      svr/svr-base/src/main/java/com/yihu/jw/business/user/dao/BaseMenuDao.java
  22. 0 31
      svr/svr-base/src/main/java/com/yihu/jw/business/user/dao/BaseRoleDao.java
  23. 0 26
      svr/svr-base/src/main/java/com/yihu/jw/business/user/dao/BaseRoleMenuDao.java
  24. 0 27
      svr/svr-base/src/main/java/com/yihu/jw/business/user/dao/EmployDao.java
  25. 0 24
      svr/svr-base/src/main/java/com/yihu/jw/business/user/dao/EmployRoleDao.java
  26. 0 137
      svr/svr-base/src/main/java/com/yihu/jw/business/user/service/BaseMenuService.java
  27. 0 154
      svr/svr-base/src/main/java/com/yihu/jw/business/user/service/BaseRoleMenuService.java
  28. 0 182
      svr/svr-base/src/main/java/com/yihu/jw/business/user/service/BaseRoleService.java
  29. 0 152
      svr/svr-base/src/main/java/com/yihu/jw/business/user/service/EmployRoleService.java
  30. 0 154
      svr/svr-base/src/main/java/com/yihu/jw/business/user/service/EmployService.java
  31. 0 125
      svr/svr-base/src/main/java/com/yihu/jw/business/version/controller/UserVersionController.java
  32. 0 14
      svr/svr-base/src/main/java/com/yihu/jw/business/version/dao/BaseUserVersionDao.java
  33. 0 41
      svr/svr-base/src/main/java/com/yihu/jw/business/version/service/BaseUserVersionService.java
  34. 0 644
      svr/svr-base/src/main/java/com/yihu/jw/business/wx/WechatResponse.java
  35. 0 138
      svr/svr-base/src/main/java/com/yihu/jw/business/wx/controller/WechatConfigController.java
  36. 0 182
      svr/svr-base/src/main/java/com/yihu/jw/business/wx/controller/WechatCoreController.java
  37. 0 47
      svr/svr-base/src/main/java/com/yihu/jw/business/wx/controller/WxAccessTokenController.java
  38. 0 164
      svr/svr-base/src/main/java/com/yihu/jw/business/wx/controller/WxGraphicMessageController.java
  39. 0 220
      svr/svr-base/src/main/java/com/yihu/jw/business/wx/controller/WxMenuController.java
  40. 0 178
      svr/svr-base/src/main/java/com/yihu/jw/business/wx/controller/WxTemplateController.java
  41. 0 29
      svr/svr-base/src/main/java/com/yihu/jw/business/wx/dao/WechatDao.java
  42. 0 17
      svr/svr-base/src/main/java/com/yihu/jw/business/wx/dao/WxAccessTokenDao.java
  43. 0 15
      svr/svr-base/src/main/java/com/yihu/jw/business/wx/dao/WxGraphicMessageDao.java
  44. 0 15
      svr/svr-base/src/main/java/com/yihu/jw/business/wx/dao/WxGraphicSceneGroupDao.java
  45. 0 20
      svr/svr-base/src/main/java/com/yihu/jw/business/wx/dao/WxMenuDao.java
  46. 0 13
      svr/svr-base/src/main/java/com/yihu/jw/business/wx/dao/WxMenuJsonDao.java
  47. 0 18
      svr/svr-base/src/main/java/com/yihu/jw/business/wx/dao/WxReplySceneDao.java
  48. 0 15
      svr/svr-base/src/main/java/com/yihu/jw/business/wx/dao/WxTemplateConfigDao.java
  49. 0 21
      svr/svr-base/src/main/java/com/yihu/jw/business/wx/dao/WxTemplateDao.java
  50. 0 353
      svr/svr-base/src/main/java/com/yihu/jw/business/wx/service/WechatCoreService.java
  51. 0 94
      svr/svr-base/src/main/java/com/yihu/jw/business/wx/service/WechatFansService.java
  52. 0 13
      svr/svr-base/src/main/java/com/yihu/jw/business/wx/service/WechatService.java
  53. 0 157
      svr/svr-base/src/main/java/com/yihu/jw/business/wx/service/WxAccessTokenService.java
  54. 0 177
      svr/svr-base/src/main/java/com/yihu/jw/business/wx/service/WxGraphicMessageService.java
  55. 0 50
      svr/svr-base/src/main/java/com/yihu/jw/business/wx/service/WxMenuService.java
  56. 0 156
      svr/svr-base/src/main/java/com/yihu/jw/business/wx/service/WxTemplateService.java
  57. 6 6
      svr/svr-base/src/main/resources/application.yml

+ 3 - 3
common/common-entity/src/main/java/com/yihu/jw/entity/base/role/RoleDO.java

@ -35,7 +35,7 @@ public class RoleDO extends UuidIdentityEntityWithOperator {
	/**
	 * 1.系统管理员,2.saas管理员,3.机构管理员
     */
	private String type;
	private Integer type;
	/**
	 * 备注
	 */
@ -86,11 +86,11 @@ public class RoleDO extends UuidIdentityEntityWithOperator {
	}
	@Column(name = "type")
	public String getType() {
	public Integer getType() {
		return type;
	}
	public void setType(String type) {
	public void setType(Integer type) {
		this.type = type;
	}

+ 12 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/role/RoleEndpoint.java

@ -40,6 +40,15 @@ public class RoleEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "json_data", value = "Json数据", required = true)
            @RequestBody String jsonData) throws Exception {
        RoleDO roleDO = toEntity(jsonData, RoleDO.class);
        if(roleDO.getId()!=null){
            roleDO.setUpdateUser(getUID());
            roleDO.setUpdateUserName(getUNAME());
        }else{
            roleDO.setUpdateUser(getUID());
            roleDO.setUpdateUserName(getUNAME());
            roleDO.setCreateUser(getUID());
            roleDO.setCreateUserName(getUNAME());
        }
        roleDO = roleService.save(roleDO);
        return success(roleDO, RoleVO.class);
    }
@ -70,6 +79,9 @@ public class RoleEndpoint extends EnvelopRestEndpoint {
        RoleDO roleDO = toEntity(jsonData, RoleDO.class);
        if (null == roleDO.getId()) {
            return failed("ID不能为空", Envelop.class);
        }else{
            roleDO.setUpdateUser(getUID());
            roleDO.setUpdateUserName(getUNAME());
        }
        roleDO = roleService.save(roleDO);
        return success(roleDO);

+ 16 - 26
svr/svr-base/src/main/java/com/yihu/jw/base/service/user/UserService.java

@ -168,36 +168,28 @@ public class UserService extends BaseJpaService<UserDO, UserDao> {
            userinfo.put("name", user.getName());
            role = roleDao.findOne(user.getRoleId());
        }
        //获取角色
        if (role != null) {
            userinfo.put("role", role.getId());
            userinfo.put("roleCode", role.getCode());
            userinfo.put("system", role.getSystem());
            if (RoleDO.BaseRoleType.admin.toString().equals(role.getType())) {
                if (RoleDO.BaseRoleType.admin.toString().equals(role.getCode())) {
                } else if (RoleDO.BaseRoleType.saasAdmin.toString().equals(role.getType())) {
                    if (org.apache.commons.lang3.StringUtils.isNotBlank(user.getId())) {
                        SaasDO saas = saasDao.findOne(user.getSaasId());
                        Map<String, Object> ss = new HashedMap();
                        ss.put("id", saas.getId());
                        ss.put("name", saas.getName());
                        userinfo.put("saas", ss);
                    }
                    if (org.apache.commons.lang3.StringUtils.isNotBlank(user.getId())) {
                        SaasDO saas = saasDao.findOne(user.getSaasId());
                        Map<String, Object> ss = new HashedMap();
                        ss.put("id", saas.getId());
                        ss.put("name", saas.getName());
                        userinfo.put("saas", ss);
                    }
            if (role.getType()==1) {
                //平台管理员信息获取
            } else if (role.getType()==2) {
                //saas平台管理员信息获取
                if (org.apache.commons.lang3.StringUtils.isNotBlank(user.getId())) {
                    SaasDO saas = saasDao.findOne(user.getSaasId());
                    Map<String, Object> ss = new HashedMap();
                    ss.put("id", saas.getId());
                    ss.put("name", saas.getName());
                    userinfo.put("saas", ss);
                }
                } else if (RoleDO.BaseRoleType.hosAdmin.toString().equals(role.getType())) {
                    String sql = "SELECT " +
            } else if (role.getType()==3) {
                //機構管理員信息獲取
                String sql = "SELECT " +
                            " g.code AS orgCode, " +
                            " g.province_code AS provinceCode, " +
                            " g.province_name AS privinceName, " +
@ -220,12 +212,10 @@ public class UserService extends BaseJpaService<UserDO, UserDao> {
                    } else {
                        userinfo.put("org", null);
                    }
                }
            }
        }
            return userinfo;
        return userinfo;
    }

+ 42 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/wx/WechatService.java

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.base.dao.wx.*;
import com.yihu.jw.base.useragent.UserAgent;
import com.yihu.jw.entity.base.wx.*;
import com.yihu.jw.restmodel.base.wx.*;
import com.yihu.jw.restmodel.web.Envelop;
@ -22,6 +23,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
@ -53,6 +55,8 @@ public class WechatService {
    private WxTemplateConfigDao wxTemplateConfigDao;
    @Autowired
    private WxAccessTokenService wxAccessTokenService;
    @Autowired
    private UserAgent userAgent;
    //====================微信与租户管理=======================
@ -153,6 +157,10 @@ public class WechatService {
    public Envelop saveWxAndSaas(WxWechatDO wxWechatDO, List<WxWechatSaasDO> wxWechatSaasDOs){
        wxWechatDO.setCreateUser(userAgent.getUID());
        wxWechatDO.setCreateUserName(userAgent.getUNAME());
        wxWechatDO.setUpdateUser(userAgent.getUID());
        wxWechatDO.setUpdateUserName(userAgent.getUNAME());
        WxWechatDO wechat = wechatDao.save(wxWechatDO);
        if(wxWechatSaasDOs!=null&&wxWechatSaasDOs.size()>0){
@ -171,6 +179,9 @@ public class WechatService {
    }
    public Envelop updateWxAndSaas(WxWechatDO wxWechatDO, List<WxWechatSaasDO> wxWechatSaasDOs) {
        //设置更新人
        wxWechatDO.setUpdateUser(userAgent.getUID());
        wxWechatDO.setUpdateUserName(userAgent.getUNAME());
        wechatDao.save(wxWechatDO);
        //删除该微信所以SaaS关联关系
@ -298,6 +309,16 @@ public class WechatService {
    }
    public Envelop saveImg(WxGraphicMessageDO wxGraphicMessageDO){
        if(wxGraphicMessageDO.getId()!=null){
            wxGraphicMessageDO.setUpdateUser(userAgent.getUID());
            wxGraphicMessageDO.setUpdateUserName(userAgent.getUNAME());
        }else{
            wxGraphicMessageDO.setCreateUser(userAgent.getUID());
            wxGraphicMessageDO.setCreateUser(userAgent.getUNAME());
            wxGraphicMessageDO.setUpdateUser(userAgent.getUID());
            wxGraphicMessageDO.setUpdateUserName(userAgent.getUNAME());
        }
        wxGraphicMessageDao.save(wxGraphicMessageDO);
        return Envelop.getSuccess(BaseRequestMapping.WeChat.api_success);
    }
@ -495,6 +516,17 @@ public class WechatService {
    //===================模板消息==========================================
    public Envelop saveWxTemp(WxTemplateDO wxTemplateDO){
        if(wxTemplateDO.getId()!=null){
            wxTemplateDO.setUpdateUser(userAgent.getUID());
            wxTemplateDO.setUpdateUserName(userAgent.getUNAME());
        }else{
            wxTemplateDO.setCreateUser(userAgent.getUID());
            wxTemplateDO.setCreateUserName(userAgent.getUNAME());
            wxTemplateDO.setUpdateUser(userAgent.getUID());
            wxTemplateDO.setUpdateUserName(userAgent.getUNAME());
        }
        wxTemplateDao.save(wxTemplateDO);
        return Envelop.getSuccess(BaseRequestMapping.WeChat.api_success);
    }
@ -566,6 +598,16 @@ public class WechatService {
    }
    public Envelop saveWxTempConfig(WxTemplateConfigDO wxTemplateConfigDO){
        if(wxTemplateConfigDO.getId()!=null){
            wxTemplateConfigDO.setUpdateUser(userAgent.getUID());
            wxTemplateConfigDO.setUpdateUserName(userAgent.getUNAME());
        }else{
            wxTemplateConfigDO.setCreateUser(userAgent.getUID());
            wxTemplateConfigDO.setUpdateUserName(userAgent.getUNAME());
            wxTemplateConfigDO.setUpdateUser(userAgent.getUID());
            wxTemplateConfigDO.setUpdateUserName(userAgent.getUNAME());
        }
        wxTemplateConfigDao.save(wxTemplateConfigDO);
        return Envelop.getSuccess(BaseRequestMapping.WeChat.api_success);
    }

+ 90 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/useragent/UserAgent.java

@ -0,0 +1,90 @@
package com.yihu.jw.base.useragent;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
/**
 * 用户头部信息获取
 * Created by Trick on 2018/10/30.
 */
@Component
public class UserAgent {
    /**
     * 获取当前登录人ID
     * @return
     */
    public String getUID() {
        try {
            HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
            String userAgent = request.getHeader("userAgent");
            if (StringUtils.isEmpty(userAgent)) {
                userAgent = request.getHeader("User-Agent");
            }
            JSONObject json = JSON.parseObject(userAgent);
            return json.getString("uid");
        } catch (Exception e) {
            return null;
        }
    }
    /**
     * 获取登录人姓名
     * @return
     */
    public String getUNAME(){
        try {
            HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
            String userAgent = request.getHeader("userAgent");
            if (StringUtils.isEmpty(userAgent)) {
                userAgent = request.getHeader("User-Agent");
            }
            JSONObject json = JSON.parseObject(userAgent);
            String info = json.getString("uname");
            String uname = java.net.URLDecoder.decode(info,"UTF-8");
            return uname;
        } catch (Exception e) {
            return null;
        }
    }
    /**
     * 获取角色ID
     * @return
     */
    public String getROLEID() {
        try {
            HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
            String userAgent = request.getHeader("userAgent");
            if (StringUtils.isEmpty(userAgent)) {
                userAgent = request.getHeader("User-Agent");
            }
            JSONObject json = JSON.parseObject(userAgent);
            return json.getString("roleid");
        } catch (Exception e) {
            return null;
        }
    }
    public JSONObject getUserAgent(){
        try{
            HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
            String userAgent = request.getHeader("userAgent");
            JSONObject user = JSON.parseObject(userAgent);
            return user;
        }catch (Exception e){
            return null;
        }
    }
}

+ 0 - 116
svr/svr-base/src/main/java/com/yihu/jw/business/login/contorller/LoginController.java

@ -1,116 +0,0 @@
//package com.yihu.jw.business.login.contorller;
//
////import com.yihu.base.security.properties.SecurityProperties;
////import com.yihu.base.security.sms.mobile.MobileCheck;
////import com.yihu.base.security.sms.process.SmsValidateCodeProcessor;
//import com.yihu.jw.base.user.BaseEmployDO;
//import com.yihu.jw.business.login.service.LoginService;
//import com.yihu.jw.business.user.dao.EmployDao;
//import com.yihu.jw.business.user.service.EmployService;
//import com.yihu.jw.exception.ApiException;
//import com.yihu.jw.fegin.common.security.LoginSmsFeign;
//import com.yihu.jw.restmodel.common.Envelop;
//import com.yihu.jw.restmodel.common.EnvelopRestController;
//import com.yihu.jw.restmodel.common.base.BaseEnvelop;
//import com.yihu.jw.rm.base.BaseLoginRequestMapping;
//import com.yihu.jw.rm.base.BaseUserRequestMapping;
//import com.yihu.jw.util.common.ConvertToSpellUtils;
//import com.yihu.jw.util.security.MD5;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import io.swagger.annotations.ApiParam;
//import org.bouncycastle.util.encoders.Base64;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.http.HttpEntity;
//import org.springframework.http.HttpHeaders;
//import org.springframework.http.MediaType;
//import org.springframework.util.LinkedMultiValueMap;
//import org.springframework.util.MultiValueMap;
//import org.springframework.util.StringUtils;
//import org.springframework.web.bind.annotation.*;
//import org.springframework.web.client.RestTemplate;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.io.IOException;
//import java.net.InetAddress;
//import java.util.UUID;
//
///**
// * Created by 刘文彬 on 2018/4/11.
// */
//@RestController
//@RequestMapping(BaseLoginRequestMapping.api_common)
//@Api(description = "注册账户(医生端、微信端、用户端)")
//public class LoginController extends EnvelopRestController {
//
//    @Autowired
//    private LoginService loginService;
//
//
//    @PostMapping(value = BaseLoginRequestMapping.BaseLoginAccount.api_checkoutInfo, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
//    @ApiOperation(value = "注册校验信息", notes = "注册校验姓名、身份证、医保卡号信息")
//    public BaseEnvelop checkoutInfo(@ApiParam(name = "ssc", value = "医保卡号", required = true) @RequestParam(value = "ssc", required = true) String ssc,
//                                    @ApiParam(name = "idcard", value = "身份证", required = true) @RequestParam(value = "idcard", required = true) String idcard) throws ApiException{
//
//        //校验姓名、身份证以及医保卡号信息是否正确
////        throw new IOException();
//        return null;
//    }
//
//    /**
//     * 注册账号-提交
//     * @param mobilePhone
//     * @param saasId
//     * @param type
//     * @param captcha
//     * @param name
//     * @param password
//     * @param idcard
//     * @param ssc
//     * @return
//     */
//    @PostMapping(value = BaseLoginRequestMapping.BaseLoginAccount.api_accountSub, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
//    @ApiOperation(value = "注册账号", notes = "注册账号")
//    public Envelop register(
//            @ApiParam(name = "mobilePhone", value = "电话号码(账号)", required = true) @RequestParam(value = "mobilePhone", required = true) String mobilePhone,
//            @ApiParam(name = "saasId", value = "saasID", required = true) @RequestParam(value = "saasId", required = true) String saasId,
//            @ApiParam(name = "type", value = "1微信端注册,2微信端找回密码,3医生端找回密码,4患者登录,5医生登录", required = true) @RequestParam(value = "type", required = true) int type,
//            @ApiParam(name = "captcha", value = "短信验证码", required = true) @RequestParam(value = "captcha", required = true) String captcha,
//            @ApiParam(name = "name", value = "姓名", required = true) @RequestParam(value = "name", required = true) String name,
//            @ApiParam(name = "password", value = "账户密码", required = true) @RequestParam(value = "password", required = true) String password,
//            @ApiParam(name = "idcard", value = "身份证", required = true) @RequestParam(value = "idcard", required = true) String idcard,
//            @ApiParam(name = "ssc", value = "医保卡号", required = true) @RequestParam(value = "ssc", required = true) String ssc) throws Exception{
//        //判断验证码是否正确
//        Envelop envelop = new Envelop();//smsService.checkSms(mobilePhone,saasId,type,captcha);
//        if(true){//if(envelop.getStatus()==200){
//            return loginService.register(mobilePhone,password,saasId,name,idcard,ssc);
//        }else{
//            return envelop;
//        }
//    }
//
//    @PostMapping(value = BaseLoginRequestMapping.BaseLoginAccount.api_login, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
//    public Envelop login(@ApiParam(name = "mobilePhone", value = "电话号码(账号)", required = false) @RequestParam(value = "mobilePhone", required = false) String mobilePhone,
//                      @ApiParam(name = "password", value = "password", required = false) @RequestParam(value = "password", required = false) String password,
//                      @ApiParam(name = "saasId", value = "saasID", required = true) @RequestParam(value = "saasId", required = true) String saasId,
//                         @ApiParam(name = "captcha", value = "短信验证码", required = false) @RequestParam(value = "captcha", required = false) String captcha) throws ApiException,Exception{
//
//        return loginService.login(mobilePhone,password,saasId,captcha);
//    }
//
////    @PostMapping("/logout")
////    public Envelop logout(){
////        HttpHeaders headers = new HttpHeaders();
////        headers.add("Accept", "*/*");
////        headers.add("Cache-Control", "no-cache");
////        RestTemplate restTemplate = new RestTemplate();
////        MultiValueMap<String, String> params= new LinkedMultiValueMap<String, String>();
////        //设置http请求实体
////        HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<MultiValueMap<String, String>>(params, headers);
////        restTemplate.postForObject("http://localhost:8088/logout", requestEntity, String.class);
////        return new Envelop();
////    }
//
//}

+ 0 - 27
svr/svr-base/src/main/java/com/yihu/jw/business/login/dao/BaseLoginAccountDao.java

@ -1,27 +0,0 @@
//package com.yihu.jw.business.login.dao;
//
//import com.yihu.jw.base.login.BaseLoginAccountDO;
//import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
//import org.springframework.data.jpa.repository.Query;
//import org.springframework.data.repository.PagingAndSortingRepository;
//
///**
// * Created by LiTaohong on 2017/12/05.
// * 账户表,识别用户类型,医生,行政人员等
// */
//public interface BaseLoginAccountDao extends PagingAndSortingRepository<BaseLoginAccountDO, String>, JpaSpecificationExecutor<BaseLoginAccountDO> {
//
//    /**
//     * 删除用户账号
//     * @param id
//     */
//    @Query("update BaseLoginAccountDO ba set ba.accountStatus = -1 where ba.id = ?1")
//    void deleteAccount(String id);
//
//    /**
//     * 锁定用户账号
//     * @param id
//     */
//    @Query("update BaseLoginAccountDO ba set ba.accountStatus = -2 where ba.id = ?1")
//    void updateAccount(String id);
//}

+ 0 - 11
svr/svr-base/src/main/java/com/yihu/jw/business/login/dao/BaseLoginLogDao.java

@ -1,11 +0,0 @@
//package com.yihu.jw.business.login.dao;
//
//import com.yihu.jw.base.login.BaseLoginLogDO;
//import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
//import org.springframework.data.repository.PagingAndSortingRepository;
//
///**
// * Created by chenweida on 2017/6/20.
// */
//public interface BaseLoginLogDao extends PagingAndSortingRepository<BaseLoginLogDO, String>, JpaSpecificationExecutor<BaseLoginLogDO> {
//}

+ 0 - 75
svr/svr-base/src/main/java/com/yihu/jw/business/login/service/BaseLoginAccountService.java

@ -1,75 +0,0 @@
//package com.yihu.jw.business.login.service;
//
//import com.yihu.base.mysql.query.BaseJpaService;
//import com.yihu.jw.base.login.BaseLoginAccountDO;
//import com.yihu.jw.business.login.dao.BaseLoginAccountDao;
//import com.yihu.jw.exception.ApiException;
//import com.yihu.jw.exception.code.ExceptionCode;
//import com.yihu.jw.rm.base.BaseUserRequestMapping;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//import org.springframework.transaction.annotation.Transactional;
//import org.springframework.util.StringUtils;
//
///**
// * Created by LiTaohong on 2017/12/5.
// * 用户账户功能
// */
//@Service
//public class BaseLoginAccountService extends BaseJpaService<BaseLoginAccountDO,BaseLoginAccountDao> {
//
//    @Autowired
//    private BaseLoginAccountDao baseLoginAccountDao;
//
//    /**
//     * 创建账户
//     * @param baseLoginAccountDO
//     * @return
//     */
//    @Transactional
//    public BaseLoginAccountDO createBaseLoginAccount(BaseLoginAccountDO baseLoginAccountDO){
//        if (StringUtils.isEmpty(baseLoginAccountDO.getId())) {
//            throw new ApiException(BaseUserRequestMapping.BaseMenu.message_fail_id_is_null, ExceptionCode.common_error_params_code);
//        }
//        if (StringUtils.isEmpty(baseLoginAccountDO.getLeaderCode())) {
//            throw new ApiException(BaseUserRequestMapping.BaseMenu.message_fail_saasId_is_null, ExceptionCode.common_error_params_code);
//        }
//        return this.baseLoginAccountDao.save(baseLoginAccountDO);
//    }
//
//
//    /**
//     * 修改账户
//     * @param baseLoginAccountDO
//     * @return
//     */
//    @Transactional
//    public BaseLoginAccountDO updateBaseLoginAccount(BaseLoginAccountDO baseLoginAccountDO){
//        return this.baseLoginAccountDao.save(baseLoginAccountDO);
//    }
//
//
//    /**
//     * 锁定账户
//     * @param id
//     * @return
//     */
//    @Transactional
//    public void lockBaseLoginAccount(String id){
//         this.baseLoginAccountDao.updateAccount(id);
//    }
//
//    /**
//     * 删除账户
//     * @param id
//     * @return
//     */
//    @Transactional
//    public void deleteBaseLoginAccount(String id){
//         this.baseLoginAccountDao.deleteAccount(id);
//    }
//
//
//
//
//}

+ 0 - 129
svr/svr-base/src/main/java/com/yihu/jw/business/login/service/LoginService.java

@ -1,129 +0,0 @@
//package com.yihu.jw.business.login.service;
//
//import com.yihu.base.mysql.query.BaseJpaService;
//import com.yihu.jw.base.login.BaseLoginAccountDO;
//import com.yihu.jw.base.user.BaseEmployDO;
//import com.yihu.jw.business.user.dao.EmployDao;
//import com.yihu.jw.business.user.service.EmployService;
//import com.yihu.jw.exception.ApiException;
//import com.yihu.jw.restmodel.common.Envelop;
//import com.yihu.jw.restmodel.common.base.BaseEnvelop;
//import com.yihu.jw.rm.base.BaseLoginRequestMapping;
//import com.yihu.jw.util.common.ConvertToSpellUtils;
//import com.yihu.jw.util.security.MD5;
//import io.swagger.annotations.ApiParam;
//import org.bouncycastle.util.encoders.Base64;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.http.HttpEntity;
//import org.springframework.http.HttpHeaders;
//import org.springframework.http.MediaType;
//import org.springframework.stereotype.Service;
//import org.springframework.transaction.annotation.Transactional;
//import org.springframework.util.LinkedMultiValueMap;
//import org.springframework.util.MultiValueMap;
//import org.springframework.util.StringUtils;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestParam;
//import org.springframework.web.client.RestTemplate;
//
//import java.beans.Transient;
//import java.util.UUID;
//
///**
// * Created by 刘文彬 on 2018/4/26.
// */
//@Service
//public class LoginService  extends BaseJpaService<BaseEmployDO,EmployDao> {
//
//    @Autowired
//    private EmployDao employDao;
//    @Autowired
//    private EmployService employService;
//
//    @Value("${server.web-gateway-port}")
//    private String port;
//    public BaseEnvelop checkoutInfo(){
//
//        //校验姓名、身份证以及医保卡号信息是否正确
//
//        return null;
//    }
//
//    @Transactional
//    public Envelop register(String mobilePhone,String password,String saasId,String name,String idcard,String ssc) throws Exception {
//
//        //判断账号是否重复
//        BaseEmployDO baseEmployDO = employService.findByPhoneAndSaasId(mobilePhone,saasId);
//        if(baseEmployDO!=null){
//            return Envelop.getError("该手机号已注册!");
//        }
//
//        //保存账户基础信息
//        BaseEmployDO employeeDO = new BaseEmployDO();
//        employeeDO.setId(UUID.randomUUID().toString().replaceAll("-", ""));
//        employeeDO.setLeaderCode(saasId);
//        employeeDO.setName(name);
//        employeeDO.setPyCode(ConvertToSpellUtils.changeToInitialPinYin(name));
//        employeeDO.setIdcard(idcard);
//        employeeDO.setSsc(ssc);
//        employeeDO.setPhone(mobilePhone);
//        String salt= UUID.randomUUID().toString().replace("-","");
//        employeeDO.setSalt(salt);
//        employeeDO.setPassword(MD5.GetMD5Code(password + salt));
//        employService.createBaseEmployDO(employeeDO);
//
//        return login(employeeDO.getPhone(),employeeDO.getPassword(),saasId,"");
//    }
//
//
//    public Envelop login(String mobilePhone,String password,String saasId,String captcha) throws Exception{
//        BaseEmployDO baseEmployDO = employService.findByPhoneAndSaasId(mobilePhone,saasId);
//        HttpHeaders headers = new HttpHeaders();
//        headers.add("Accept", "*/*");
//        headers.add("Cache-Control", "no-cache");
//        //client_id:client_securt
//        byte[] a = Base64.encode((saasId+":").getBytes());
//        String client_id = new String(a);
//        headers.add("Authorization","Basic "+client_id);//MTox
//        String token = "";
//        //传参数JSON格式
//        //  封装参数,千万不要替换为Map与HashMap,否则参数无法传递
//        MultiValueMap<String, String> params= new LinkedMultiValueMap<String, String>();
//        //判断是短信登录还是账号密码登录
//        if(StringUtils.isEmpty(captcha)){
//
//            //  也支持中文
//            params.add("username", mobilePhone+","+saasId);
//            params.add("password", MD5.GetMD5Code(password+baseEmployDO.getSalt()));
//            //设置http请求实体
//            HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<MultiValueMap<String, String>>(params, headers);
//            RestTemplate restTemplate = new RestTemplate();
//            token = restTemplate.postForObject("http://localhost:"+port+"/authentication/form", requestEntity, String.class);
//        }else{
//            params.add("mobile", mobilePhone+","+saasId);
//            params.add("sms", captcha);
//            //设置http请求实体
//            HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<MultiValueMap<String, String>>(params, headers);
//            RestTemplate restTemplate = new RestTemplate();
//            token = restTemplate.postForObject("http://localhost:"+port+"/authentication/mobile", requestEntity, String.class);
//        }
//
//        if(!StringUtils.isEmpty(token)){
//            return Envelop.getSuccess("登录成功!",token);
//        }else{
//            return Envelop.getError("登录失败!");
//        }
//    }
//
////    public Envelop logout(){
////        HttpHeaders headers = new HttpHeaders();
////        headers.add("Accept", "*/*");
////        headers.add("Cache-Control", "no-cache");
////        RestTemplate restTemplate = new RestTemplate();
////        MultiValueMap<String, String> params= new LinkedMultiValueMap<String, String>();
////        //设置http请求实体
////        HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<MultiValueMap<String, String>>(params, headers);
////        restTemplate.postForObject("http://localhost:"+port+"/logout", requestEntity, String.class);
////    }
//}

+ 0 - 128
svr/svr-base/src/main/java/com/yihu/jw/business/sms/controller/SmsGatewayController.java

@ -1,128 +0,0 @@
//package com.yihu.jw.business.sms.controller;
//
//import com.yihu.jw.base.sms.BaseSmsGatewayDO;
//import com.yihu.jw.business.sms.service.SmsGatewayService;
//import com.yihu.jw.exception.ApiException;
//import com.yihu.jw.restmodel.base.sms.SmsGatewayVO;
//import com.yihu.jw.restmodel.common.Envelop;
//import com.yihu.jw.restmodel.common.EnvelopRestController;
//import com.yihu.jw.rm.base.BaseSmsRequestMapping;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import io.swagger.annotations.ApiParam;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.http.MediaType;
//import org.springframework.web.bind.annotation.*;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.util.ArrayList;
//import java.util.List;
//
///**
// * Created by chenweida on 2017/5/19.
// */
//@RestController
//@RequestMapping(BaseSmsRequestMapping.api_common)
//@Api(value = "功能模块", description = "功能模块接口管理")
//public class SmsGatewayController extends EnvelopRestController {
//    @Autowired
//    private SmsGatewayService smsGatewayService;
//
//    @PostMapping(value = BaseSmsRequestMapping.SmsGateway.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
//    @ApiOperation(value = "创建功能", notes = "创建单个功能")
//    public Envelop createSmsGateway(
//            @ApiParam(name = "json_data", value = "", defaultValue = "")
//            @RequestBody String jsonData) {
//        try {
//            BaseSmsGatewayDO smsGateway = toEntity(jsonData, BaseSmsGatewayDO.class);
//            return Envelop.getSuccess(BaseSmsRequestMapping.SmsGateway.message_success_create, smsGatewayService.createSmsGateway(smsGateway));
//        } catch (ApiException e) {
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
//    }
//
//    @PutMapping(value = BaseSmsRequestMapping.SmsGateway.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
//    @ApiOperation(value = "修改功能", notes = "修改功能")
//    public Envelop updateSmsGateway(
//            @ApiParam(name = "json_data", value = "", defaultValue = "")
//            @RequestBody String jsonData) {
//        try {
//            BaseSmsGatewayDO smsGateway = toEntity(jsonData, BaseSmsGatewayDO.class);
//            return Envelop.getSuccess(BaseSmsRequestMapping.SmsGateway.message_success_update, smsGatewayService.updateSmsGateway(smsGateway));
//        } catch (ApiException e) {
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
//    }
//    @DeleteMapping(value = BaseSmsRequestMapping.SmsGateway.api_delete, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
//    @ApiOperation(value = "删除功能", notes = "删除功能")
//    public Envelop deleteSmsGateway(
//            @ApiParam(name = "id", value = "id")
//            @RequestParam(value = "id", required = true) String id) {
//        try {
//            smsGatewayService.deleteSmsGateway(id);
//            return Envelop.getSuccess(BaseSmsRequestMapping.SmsGateway.message_success_delete );
//        } catch (ApiException e) {
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
//    }
//
//    @GetMapping(value = BaseSmsRequestMapping.SmsGateway.api_getById, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
//    @ApiOperation(value = "根据code查找功能", notes = "根据code查找功能")
//    public Envelop findById(
//            @ApiParam(name = "id", value = "id")
//            @RequestParam(value = "id", required = true) String id
//    ) {
//        try {
//            return Envelop.getSuccess(BaseSmsRequestMapping.SmsGateway.message_success_find, smsGatewayService.findById(id));
//        } catch (ApiException e) {
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
//    }
//
//
//    @RequestMapping(value = BaseSmsRequestMapping.SmsGateway.api_getSmsGateways, method = RequestMethod.GET)
//    @ApiOperation(value = "获取功能列表(分页)")
//    public Envelop getSmsGateways(
//            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "code,name,saasId,parentCode,remark")
//            @RequestParam(value = "fields", required = false) String fields,
//            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
//            //code like 1,name大于aa ,code 等于1 , defaultValue = "code?1;name>aa;code=1"
//            @RequestParam(value = "filters", required = false) String filters,
//            @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "+name,+createTime")
//            @RequestParam(value = "sorts", required = false) String sorts,
//            @ApiParam(name = "size", value = "分页大小", defaultValue = "15")
//            @RequestParam(value = "size", required = false) int size,
//            @ApiParam(name = "page", value = "页码", defaultValue = "1")
//            @RequestParam(value = "page", required = false) int page,
//            HttpServletRequest request,
//            HttpServletResponse response) throws Exception {
//        //得到list数据
//        List<BaseSmsGatewayDO> list = smsGatewayService.search(fields, filters, sorts, page, size);
//        //获取总数
//        long count=smsGatewayService.getCount(filters);
//        //封装头信息
//        pagedResponse(request, response, count, page, size);
//        //封装返回格式
//        List<SmsGatewayVO> mSmsGateways = convertToModels(list, new ArrayList<>(list.size()), SmsGatewayVO.class, fields);
//
//        return Envelop.getSuccessListWithPage(BaseSmsRequestMapping.SmsGateway.message_success_find_SmsGateways,mSmsGateways, page, size,count);
//    }
//
//
//    @GetMapping(value = BaseSmsRequestMapping.SmsGateway.api_getSmsGatewaysNoPage)
//    @ApiOperation(value = "获取功能列表,不分页")
//    public Envelop getAppsNoPage(
//            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "code,name,saasId,parentCode,remark")
//            @RequestParam(value = "fields", required = false) String fields,
//            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
//            @RequestParam(value = "filters", required = false) String filters,
//            @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "+name,+createTime")
//            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
//        //得到list数据
//        List<BaseSmsGatewayDO> list = smsGatewayService.search(fields,filters,sorts);
//        //封装返回格式
//        List<SmsGatewayVO> mSmsGateways = convertToModels(list, new ArrayList<>(list.size()), SmsGatewayVO.class, fields);
//        return Envelop.getSuccessList(BaseSmsRequestMapping.SmsGateway.message_success_find_SmsGateways,mSmsGateways);
//    }
//}

+ 0 - 18
svr/svr-base/src/main/java/com/yihu/jw/business/sms/dao/SmsDao.java

@ -1,18 +0,0 @@
//package com.yihu.jw.business.sms.dao;
//
//import com.yihu.jw.base.sms.BaseSmsDO;
//import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
//import org.springframework.data.jpa.repository.Query;
//import org.springframework.data.repository.PagingAndSortingRepository;
//
//import java.util.Date;
//import java.util.List;
//
//public interface SmsDao extends PagingAndSortingRepository<BaseSmsDO, String>, JpaSpecificationExecutor<BaseSmsDO> {
//
//    @Query("select count(a.id) from BaseSmsDO a where a.mobile = ?1 and a.createTime  between ?2 and ?3 ")
//    int countByMobile(String mobile,Date begin, Date end);
//
//    @Query("select a from BaseSmsDO a where a.mobile = ?1 and a.type = ?2 and a.saasId= ?3 order by a.createTime desc")
//    List<BaseSmsDO> findByMobileType(String mobile, int type,String saasId);
//}

+ 0 - 20
svr/svr-base/src/main/java/com/yihu/jw/business/sms/dao/SmsGatewayDao.java

@ -1,20 +0,0 @@
//package com.yihu.jw.business.sms.dao;
//
//import com.yihu.jw.base.sms.BaseSmsGatewayDO;
//import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
//import org.springframework.data.jpa.repository.Query;
//import org.springframework.data.repository.PagingAndSortingRepository;
//
///**
// * Created by chenweida on 2017/5/22.
// */
//public interface SmsGatewayDao extends PagingAndSortingRepository<BaseSmsGatewayDO, String>, JpaSpecificationExecutor<BaseSmsGatewayDO> {
//    @Query("from BaseSmsGatewayDO f where f.name=?1 and f.status=1")
//    BaseSmsGatewayDO findByName(String name);
//
//    @Query("from BaseSmsGatewayDO f where f.name=?1 and f.status=1 and f.id != ?2")
//    BaseSmsGatewayDO findByNameExcludeCode(String name, String code);
//
//    @Query("from BaseSmsGatewayDO f where f.id=?1 and f.status=1")
//    BaseSmsGatewayDO findById(String id);
//}

+ 0 - 68
svr/svr-base/src/main/java/com/yihu/jw/business/sms/service/SmsGatewayService.java

@ -1,68 +0,0 @@
//package com.yihu.jw.business.sms.service;
//
//import com.yihu.jw.base.sms.BaseSmsGatewayDO;
//import com.yihu.jw.business.sms.dao.SmsGatewayDao;
//import com.yihu.jw.exception.ApiException;
//import com.yihu.jw.exception.code.ExceptionCode;
//import com.yihu.base.mysql.query.BaseJpaService;
//import com.yihu.jw.rm.base.BaseSmsRequestMapping;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//import org.springframework.transaction.annotation.Transactional;
//import org.springframework.util.StringUtils;
//
///**
// * Created by chenweida on 2017/5/22.
// */
//@Service
//public class SmsGatewayService extends BaseJpaService<BaseSmsGatewayDO, SmsGatewayDao> {
//    @Autowired
//    private SmsGatewayDao smsGatewayDao;
//
//    @Transactional
//    public BaseSmsGatewayDO createSmsGateway(BaseSmsGatewayDO smsGateway) throws ApiException {
//        if (StringUtils.isEmpty(smsGateway.getId())) {
//            throw new ApiException(BaseSmsRequestMapping.SmsGateway.message_fail_id_is_null, ExceptionCode.common_error_params_code);
//        }
//        if (StringUtils.isEmpty(smsGateway.getName())) {
//            throw new ApiException(BaseSmsRequestMapping.SmsGateway.message_fail_name_is_null, ExceptionCode.common_error_params_code);
//        }
//        BaseSmsGatewayDO smsGatewayTmp = smsGatewayDao.findByName(smsGateway.getName());
//        if (smsGatewayTmp != null) {
//            throw new ApiException(BaseSmsRequestMapping.SmsGateway.message_fail_name_exist, ExceptionCode.common_error_params_code);
//        }
//        return smsGatewayDao.save(smsGateway);
//    }
//
//    @Transactional
//    public BaseSmsGatewayDO updateSmsGateway(BaseSmsGatewayDO smsGateway) {
//        if (StringUtils.isEmpty(smsGateway.getName())) {
//            throw new ApiException(BaseSmsRequestMapping.SmsGateway.message_fail_name_is_null, ExceptionCode.common_error_params_code);
//        }
//        if (StringUtils.isEmpty(smsGateway.getId())) {
//            throw new ApiException(BaseSmsRequestMapping.SmsGateway.message_fail_id_is_null, ExceptionCode.common_error_params_code);
//        }
//        BaseSmsGatewayDO smsGatewayTmp = smsGatewayDao.findByNameExcludeCode(smsGateway.getName(), smsGateway.getId());
//        if (smsGatewayTmp != null) {
//            throw new ApiException(BaseSmsRequestMapping.SmsGateway.message_fail_name_exist, ExceptionCode.common_error_params_code);
//        }
//        return smsGatewayDao.save(smsGateway);
//    }
//
//    public BaseSmsGatewayDO findById(String id) {
//        BaseSmsGatewayDO smsGateway = smsGatewayDao.findById(id);
//        if (smsGateway == null) {
//            throw new ApiException(BaseSmsRequestMapping.SmsGateway.message_fail_id_no_exist, ExceptionCode.common_error_params_code);
//        }
//        return smsGateway;
//    }
//
//    @Transactional
//    public void deleteSmsGateway(String id) {
//        BaseSmsGatewayDO smsGateway = smsGatewayDao.findById(id);
//        if (smsGateway == null) {
//            throw new ApiException(BaseSmsRequestMapping.SmsGateway.message_fail_id_no_exist, ExceptionCode.common_error_params_code);
//        }
//        smsGateway.setStatus(-1);
//    }
//}

+ 0 - 188
svr/svr-base/src/main/java/com/yihu/jw/business/sms/service/SmsService.java

@ -1,188 +0,0 @@
//package com.yihu.jw.business.sms.service;
//
//import com.yihu.jw.base.sms.BaseSmsDO;
//import com.yihu.jw.business.sms.dao.SmsDao;
//import com.yihu.jw.business.sms.vo.SMSHttpVo;
//import com.yihu.jw.exception.ApiException;
//import com.yihu.jw.restmodel.common.Envelop;
//import com.yihu.jw.restmodel.common.base.BaseEnvelop;
//import com.yihu.jw.util.common.SmsValidateCodeUtils;
//import com.yihu.jw.util.date.DateUtil;
//import com.yihu.jw.vo.ValidateCode;
//import com.yihu.mysql.query.BaseJpaService;
//import org.apache.http.NameValuePair;
//import org.apache.http.message.BasicNameValuePair;
//import org.json.JSONObject;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.data.domain.Page;
//import org.springframework.data.domain.PageRequest;
//import org.springframework.data.domain.Sort;
//import org.springframework.stereotype.Service;
//import org.springframework.transaction.annotation.Transactional;
//import org.springframework.util.LinkedMultiValueMap;
//import org.springframework.util.MultiValueMap;
//import org.springframework.web.client.RestTemplate;
//
//import java.text.ParseException;
//import java.text.SimpleDateFormat;
//import java.time.LocalDateTime;
//import java.util.ArrayList;
//import java.util.Date;
//import java.util.List;
//
///**
// * Created by chenweida on 2017/5/22.
// */
//@Service
//public class SmsService  extends BaseJpaService<BaseSmsDO, SmsDao> {
//    @Autowired
//    private SmsDao smsDao;
//    @Autowired
//    private SMSHttpVo smsHttpVo;
//
//
////    @Transactional
////    public BaseSmsDO createSms(BaseSmsDO sms) throws ApiException {
////
////        return smsDao.save(sms);
////    }
////
////    @Transactional
////    public BaseSmsDO updateSms(BaseSmsDO sms) {
////        return smsDao.save(sms);
////    }
//
//
//    /**
//     * 发送验证码(不走权限判断,包括:注册、找回密码)
//     * @param mobile
//     * @param ip
//     * @param type
//     * @return
//     * @throws Exception
//     */
//    @Transactional
//    public BaseEnvelop send(String mobile, String ip, int type,String saasId) throws Exception {
//        // 1、同一手机一天不允许超过5条短信
//        //1.1获取一天的开始和结束时间
//        String today = DateUtil.getStringDateShort();
//        Date begin = DateUtil.strToDate(today + " 00:00:00", DateUtil.YYYY_MM_DD_HH_MM_SS);
//        Date end = DateUtil.strToDate(today + " 23:59:59", DateUtil.YYYY_MM_DD_HH_MM_SS);
//        int smsCount = smsDao.countByMobile(mobile,begin,end);
//        if(smsCount>=5){
//            return Envelop.getError("您的验证码次数已用完,请明天再尝试!",-1);
//        }
//        // 2、60秒之内不允许重复发送
////        PageRequest pageRequest = new PageRequest(0, 1, new Sort(Sort.Direction.DESC, "id"));
//        List<BaseSmsDO> page = smsDao.findByMobileType(mobile,type,saasId);
//        if (page.size()>0) {
////            for (BaseSmsDO sms : page) {
////                if (sms == null) {
////                    continue;
////                }
//                // 计算间隔时间
//                Date temp = DateUtil.getNextMin(page.get(0).getCreateTime(), 1);
//                long leftTime = (temp.getTime() - System.currentTimeMillis()) / 1000;
//                if (leftTime > 0) {
//                    return BaseEnvelop.getError("发送短信验证码间隔时间为:60秒!");
//                }
////            }
//        }
//        //3、生成验证码
//        ValidateCode vc = SmsValidateCodeUtils.generate(6,1);
//
//        //4、保存验证码(1微信端注册,2微信端找回密码,3医生端找回密码,4患者登录,5医生登录)
//        BaseSmsDO sms = new BaseSmsDO();
//        sms.setMobile(mobile);
//        sms.setIp(ip);
//        sms.setType(type);
//        sms.setCaptcha(vc.getCode());
//        switch (type){
//            case 1:sms.setContent("您的注册验证码为:"+vc.getCode());break;
//            case 2:sms.setContent("您找回密码验证码为:"+vc.getCode());break;
//            case 3:sms.setContent("您找回密码验证码为:"+vc.getCode());break;
//        }
//        SimpleDateFormat s = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS");
//        sms.setDeadline(s.parse(vc.getCreateTimeString()));
//        sms.setStatus(1);
//        sms.setLeaderCode(saasId);
//        //5、 调用发送信息的接口
////        String result = httpClientUtil.post(smsHttpVo.getUrl(), buildSmsParams(sms.getContent(), mobile), "GBK");
////        JSONObject json = toJson(result);
////        if (json == null) {
////            // 发送失败
////            return BaseEnvelop.getError("短信接口请求失败!");
////        } else if (json.getInt("result") != 0) {
////            return BaseEnvelop.getError(json.getString("description"));
////        } else {
////            //发送成功,保存到数据库
////        }
//        smsDao.save(sms);
//        if(smsCount>=2&&smsCount<=5){
//           return  BaseEnvelop.getSuccess("今日可重发验证码剩余"+(5-smsCount)+"次,请尽快完成验证。!");
//        }
//        return BaseEnvelop.getSuccess("验证码发送成功!");
//    }
//
//    //封装发送短信的参数
//    public  List<NameValuePair> buildSmsParams(String content, String mobile) {
//        List<NameValuePair> params = new ArrayList<NameValuePair>();
//        params.add(new BasicNameValuePair("SpCode", smsHttpVo.getCode()));
//        params.add(new BasicNameValuePair("LoginName", smsHttpVo.getName()));
//        params.add(new BasicNameValuePair("Password", smsHttpVo.getPassword()));
//        params.add(new BasicNameValuePair("MessageContent", content));
//        params.add(new BasicNameValuePair("UserNumber", mobile));
//        params.add(new BasicNameValuePair("SerialNumber", String.valueOf(System.currentTimeMillis())));
//        params.add(new BasicNameValuePair("ScheduleTime", ""));
//        params.add(new BasicNameValuePair("f", "1"));
//        return params;
//    }
//
//    //校验验证码是否正确
//    public Envelop checkSms(String mobile,String saasId,int type,String captcha){
//        PageRequest pageRequest = new PageRequest(0, 1, new Sort(Sort.Direction.DESC, "id"));
//        List<BaseSmsDO> page = smsDao.findByMobileType(mobile,type,saasId);
////        if (page != null) {
////            for (BaseSmsDO sms : page) {
//                BaseSmsDO sms = page.get(0);
//                String toCaptcha = sms.getCaptcha();
//                Date deadline = sms.getDeadline();
//                if(new Date().before(deadline)){
//                    //对比校验码是否正确
//                    if(captcha.equals(toCaptcha)){
//                        Envelop.getSuccess("验证码校验成功!");
//                    }else{
//                        return Envelop.getError("验证码错误!");
//                    }
//                }else{
//                    //过期
//                    return Envelop.getError("验证码过期!");
//                }
//
////            }
////        }
//        return Envelop.getError("未发送验证码!");
//    }
//
//    //解析短信返回的json数据
//    public JSONObject toJson(String result) {
//        JSONObject json = new JSONObject();
//        try {
//            String[] temps = result.split("&");
//            for (String temp : temps) {
//                if (temp.split("=").length != 2) {
//                    continue;
//                }
//                String key = temp.split("=")[0];
//                String value = temp.split("=")[1];
//                json.put(key, value);
//            }
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//        return json;
//    }
//
//
//}

+ 0 - 49
svr/svr-base/src/main/java/com/yihu/jw/business/sms/vo/SMSHttpVo.java

@ -1,49 +0,0 @@
//package com.yihu.jw.business.sms.vo;
//
//import org.springframework.boot.context.properties.ConfigurationProperties;
//import org.springframework.stereotype.Component;
//
///**
// * Created by 刘文彬 on 2018/4/13.
// */
//@Component
//@ConfigurationProperties(prefix = "jw.sms")
//public class SMSHttpVo {
//
//    private String url;
//    private String code;
//    private String name;
//    private String password;
//
//    public String getUrl() {
//        return url;
//    }
//
//    public void setUrl(String url) {
//        this.url = url;
//    }
//
//    public String getCode() {
//        return code;
//    }
//
//    public void setCode(String code) {
//        this.code = code;
//    }
//
//    public String getName() {
//        return name;
//    }
//
//    public void setName(String name) {
//        this.name = name;
//    }
//
//    public String getPassword() {
//        return password;
//    }
//
//    public void setPassword(String password) {
//        this.password = password;
//    }
//}

+ 0 - 95
svr/svr-base/src/main/java/com/yihu/jw/business/user/contorller/BaseMenuController.java

@ -1,95 +0,0 @@
//package com.yihu.jw.business.user.contorller;
//
//import com.yihu.jw.base.user.BaseMenuDO;
//import com.yihu.jw.base.user.BaseRoleDO;
//import com.yihu.jw.business.user.service.BaseMenuService;
//import com.yihu.jw.exception.ApiException;
//import com.yihu.jw.restmodel.common.Envelop;
//import com.yihu.jw.restmodel.common.EnvelopRestController;
//import com.yihu.jw.rm.base.BaseUserRequestMapping;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import io.swagger.annotations.ApiParam;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.http.MediaType;
//import org.springframework.web.bind.annotation.*;
//
///**
// * Created by LiTaohong on 2017/11/28.
// */
//@RestController
//@RequestMapping(BaseUserRequestMapping.api_user_common)
//@Api(description = "基础菜单")
//public class BaseMenuController extends EnvelopRestController {
//
//    @Autowired
//    private BaseMenuService baseMenuService;
//
//    @PostMapping(value = BaseUserRequestMapping.BaseMenu.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
//    @ApiOperation(value = "创建菜单", notes = "创建单个菜单")
//    public Envelop createBaseMenu(@ApiParam(name = "json_data", value = "", defaultValue = "") @RequestBody String jsonData){
//        try{
//            BaseMenuDO baseMenuDO = toEntity(jsonData,BaseMenuDO.class);
//            return Envelop.getSuccess(BaseUserRequestMapping.BaseMenu.message_success_create,baseMenuService.createBaseMenu(baseMenuDO));
//        } catch (ApiException e){
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
//    }
//
//    @PostMapping(value = BaseUserRequestMapping.BaseMenu.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
//    @ApiOperation(value = "修改菜单", notes = "修改菜单")
//    public Envelop updateBaseMenu(@ApiParam(name = "json_data", value = "", defaultValue = "") @RequestBody String jsonData){
//        try{
//            BaseMenuDO baseMenuDO = toEntity(jsonData,BaseMenuDO.class);
//            return Envelop.getSuccess(BaseUserRequestMapping.BaseMenu.message_success_update,baseMenuService.updateBaseMenuDO(baseMenuDO));
//        } catch (ApiException e){
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
//    }
//
//    @PostMapping(value = BaseUserRequestMapping.BaseMenu.api_getOne, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
//    @ApiOperation(value = "查询单个菜单", notes = "根据菜单id查询菜单信息")
//    public Envelop getOneMenuById(@ApiParam(name = "json_data", value = "", defaultValue = "") @RequestBody String jsonData){
//        try{
//            BaseMenuDO baseMenuDO = toEntity(jsonData,BaseMenuDO.class);
//            return Envelop.getSuccess(BaseUserRequestMapping.BaseMenu.message_success_find,baseMenuService.findById(baseMenuDO.getId()));
//        } catch (ApiException e){
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
//    }
//
//    @PostMapping(value = BaseUserRequestMapping.BaseMenu.api_getchildren, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
//    @ApiOperation(value = "查询单个菜单的所有子菜单信息", notes = "根据平台和菜单名称查询菜单信息")
//    public Envelop getChlidrenMenuList(@ApiParam(name = "saasId", value = "", defaultValue = "") @RequestParam String saasId,
//                                       @ApiParam(name = "parentId", value = "", defaultValue = "") @RequestParam String parentId){
//        try{
//            return Envelop.getSuccess(BaseUserRequestMapping.BaseMenu.message_success_find,baseMenuService.getChlidrenMenuList(saasId,parentId));
//        } catch (ApiException e){
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
//    }
//
//    @PostMapping(value = BaseUserRequestMapping.BaseMenu.api_getList, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
//    @ApiOperation(value = "查询多个菜单", notes = "根据平台saasId查询所有菜单信息")
//    public Envelop getMenuListBySaasId(@ApiParam(name = "json_data", value = "", defaultValue = "") @RequestBody String jsonData){
//        try{
//            BaseMenuDO baseMenuDO = toEntity(jsonData,BaseMenuDO.class);
//            return Envelop.getSuccess(BaseUserRequestMapping.BaseMenu.message_success_find,baseMenuService.findAllBySaasId(baseMenuDO.getLeaderCode()));
//        } catch (ApiException e){
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
//    }
//
//    @PostMapping(value = BaseUserRequestMapping.BaseMenu.api_delete, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
//    @ApiOperation(value = "批量删除菜单", notes = "删除某一平台saasId下所有菜单信息")
//    public Envelop deleteMenusBySaasId(@ApiParam(name = "json_data", value = "", defaultValue = "") @RequestBody String jsonData){
//        try{
//            BaseMenuDO baseMenuDO = toEntity(jsonData,BaseMenuDO.class);
//            baseMenuService.deleteBaseMenusBySaasId(baseMenuDO.getLeaderCode());
//            return Envelop.getSuccess(BaseUserRequestMapping.BaseMenu.message_success_delete);
//        } catch (ApiException e){
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
//    }
//
//}

+ 0 - 231
svr/svr-base/src/main/java/com/yihu/jw/business/user/contorller/BaseRoleController.java

@ -1,231 +0,0 @@
//package com.yihu.jw.business.user.contorller;
//
//import com.yihu.jw.base.user.BaseEmployRoleDO;
//import com.yihu.jw.base.user.BaseMenuDO;
//import com.yihu.jw.base.user.BaseRoleDO;
//import com.yihu.jw.base.user.BaseRoleMenuDO;
//import com.yihu.jw.business.user.service.BaseRoleService;
//import com.yihu.jw.exception.ApiException;
//import com.yihu.jw.exception.code.ExceptionCode;
//import com.yihu.jw.restmodel.base.user.BaseEmployVO;
//import com.yihu.jw.restmodel.base.user.BaseRoleVO;
//import com.yihu.jw.restmodel.common.Envelop;
//import com.yihu.jw.restmodel.common.EnvelopRestController;
//import com.yihu.jw.rm.base.BaseUserRequestMapping;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import io.swagger.annotations.ApiParam;
//import org.apache.commons.lang.StringUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.http.MediaType;
//import org.springframework.web.bind.annotation.*;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.text.ParseException;
//import java.util.ArrayList;
//import java.util.List;
//
///**
// * Created by LiTaohong on 2017/11/28.
// */
//@RestController
//@RequestMapping(BaseUserRequestMapping.api_user_common)
//@Api(description = "基础角色")
//public class BaseRoleController extends EnvelopRestController {
//
//    @Autowired
//    private BaseRoleService baseRoleService;
//
////    @Autowired
////    private BaseRoleMenuService baseRoleMenuService;
//
////    @PostMapping(value = BaseUserRequestMapping.BaseRole.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
////    @ApiOperation(value = "创建角色", notes = "创建单个角色")
////    public Envelop createRole(@ApiParam(name = "json_data", value = "", defaultValue = "") @RequestBody String jsonData){
////        try{
////            BaseRoleDO baseRoleDO = toEntity(jsonData,BaseRoleDO.class);
////            return Envelop.getSuccess(BaseUserRequestMapping.BaseRole.message_success_create,baseRoleService.createBaseRole(baseRoleDO));
////        } catch (ApiException e){
////            return Envelop.getError(e.getMessage(), e.getErrorCode());
////        }
////    }
//
////    @PostMapping(value = BaseUserRequestMapping.BaseRole.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
////    @ApiOperation(value = "修改角色", notes = "修改角色")
////    public Envelop updateBaseRole(@ApiParam(name = "json_data", value = "", defaultValue = "") @RequestBody String jsonData){
////        try{
////            BaseRoleDO baseRoleDO = toEntity(jsonData,BaseRoleDO.class);
////            return Envelop.getSuccess(BaseUserRequestMapping.BaseRole.message_success_update,baseRoleService.updateBaseRole(baseRoleDO));
////        } catch (ApiException e){
////            return Envelop.getError(e.getMessage(), e.getErrorCode());
////        }
////    }
//
////    @PostMapping(value = BaseUserRequestMapping.BaseRole.api_getById, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
////    @ApiOperation(value = "查询单个角色", notes = "根据角色id查询角色信息")
////    public Envelop getOneRoleById(@ApiParam(name = "json_data", value = "", defaultValue = "") @RequestBody String jsonData){
////        try{
////            BaseRoleDO baseRoleDO = toEntity(jsonData,BaseRoleDO.class);
////            return Envelop.getSuccess(BaseUserRequestMapping.BaseRole.message_success_find,baseRoleService.findById(baseRoleDO.getId()));
////        } catch (ApiException e){
////            return Envelop.getError(e.getMessage(), e.getErrorCode());
////        }
////    }
//
////    @PostMapping(value = BaseUserRequestMapping.BaseRole.api_getOne, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
////    @ApiOperation(value = "查询单个角色", notes = "根据平台和角色名称查询角色信息")
////    public Envelop getOneRoleBySaasIdAndName(@ApiParam(name = "json_data", value = "", defaultValue = "") @RequestBody String jsonData){
////        try{
////            BaseRoleDO baseRoleDO = toEntity(jsonData,BaseRoleDO.class);
////            return Envelop.getSuccess(BaseUserRequestMapping.BaseRole.message_success_find,baseRoleService.findBySaasIdAndName(baseRoleDO.getName(),baseRoleDO.getLeaderCode()));
////        } catch (ApiException e){
////            return Envelop.getError(e.getMessage(), e.getErrorCode());
////        }
////    }
//
////    @PostMapping(value = BaseUserRequestMapping.BaseRole.api_getlistNoPage, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
////    @ApiOperation(value = "查询多个角色", notes = "根据平台id查询所有角色信息,不分页")
////    public Envelop getRoleListBySaasId(@ApiParam(name = "json_data", value = "", defaultValue = "") @RequestBody String jsonData){
////        try{
////            BaseRoleDO baseRoleDO = toEntity(jsonData,BaseRoleDO.class);
////            return Envelop.getSuccessList(BaseUserRequestMapping.BaseRole.message_success_find,baseRoleService.findAllBySaasId(baseRoleDO.getLeaderCode()));
////        } catch (ApiException e){
////            return Envelop.getError(e.getMessage(), e.getErrorCode());
////        }
////    }
//
//    @ApiOperation(value = "根据指定条件查询所有角色列表,分页")
//    @GetMapping(value = BaseUserRequestMapping.BaseRole.api_getListPage)
//    public Envelop getRoleListPage(@ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,name,remark") @RequestParam(value = "fields", required = false) String fields,
//                                              @ApiParam(name = "filters", value = "过滤器,为空检索所有条件") @RequestParam(value = "filters", required = false) String filters,
//                                              @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "+name,+createTime") @RequestParam(value = "sorts", required = false) String sorts,
//                                              @ApiParam(name = "size", value = "分页大小", defaultValue = "15") @RequestParam(value = "size", required = false) int size,
//                                              @ApiParam(name = "page", value = "页码", defaultValue = "1") @RequestParam(value = "page", required = false) int page,
//                                              HttpServletRequest request, HttpServletResponse response) throws ParseException {
//        if (StringUtils.isBlank(filters)) {
//            return Envelop.getError(BaseUserRequestMapping.BaseRole.message_fail_params_not_present, ExceptionCode.common_error_params_code);
//        } else {
//            filters = "status<>-1;" + filters;
//        }
//        if (StringUtils.isBlank(sorts)) {
//            sorts = "-updateTime";
//        }
//
//        //得到list数据
//        List<BaseRoleVO> list = baseRoleService.search(fields, filters, sorts, page, size);
//
//        //获取总数
//        long count = baseRoleService.getCount(filters);
//        //封装头信息
//        pagedResponse(request, response, count, page, size);
//        //封装返回格式
//        List<BaseRoleVO> mFunctions = convertToModels(list, new ArrayList<>(list.size()), BaseRoleVO.class, fields);
//
//        return Envelop.getSuccessListWithPage(BaseUserRequestMapping.BaseRole.message_success_find, mFunctions, page, size, count);
//    }
//
//
////    @PostMapping(value = BaseUserRequestMapping.BaseRole.api_delete, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
////    @ApiOperation(value = "删除角色", notes = "根据角色id删除角色")
////    public Envelop deleteRole(@ApiParam(name = "json_data", value = "", defaultValue = "") @RequestBody String jsonData){
////        try{
////            BaseRoleDO baseRoleDO = toEntity(jsonData,BaseRoleDO.class);
////            baseRoleService.deleteBaseRole(baseRoleDO);
////            return Envelop.getSuccess(BaseUserRequestMapping.BaseRole.message_success_delete);
////        } catch (ApiException e){
////            return Envelop.getError(e.getMessage(), e.getErrorCode());
////        }
////    }
//
////    @PostMapping(value = BaseUserRequestMapping.BaseRole.api_deleteBySaasId, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
////    @ApiOperation(value = "批量删除角色", notes = "删除某一平台下所有角色信息")
////    public Envelop deleteRolesBySaasId(@ApiParam(name = "json_data", value = "", defaultValue = "") @RequestBody String jsonData){
////        try{
////            BaseRoleDO baseRoleDO = toEntity(jsonData,BaseRoleDO.class);
////            baseRoleService.deleteBaseRolesBySaasId(baseRoleDO.getLeaderCode());
////            return Envelop.getSuccess(BaseUserRequestMapping.BaseRole.message_success_delete);
////        } catch (ApiException e){
////            return Envelop.getError(e.getMessage(), e.getErrorCode());
////        }
////    }
//
//    @PostMapping(value = BaseUserRequestMapping.BaseRole.api_getRoleByPhoneAndSaasId, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
//    @ApiOperation(value = "根据phone和saasid获取role", notes = "根据phone和saasid获取role")
//    public Envelop getPhoneAndSaasId(@ApiParam(name = "phone", value = "电话号码(账号)") @RequestParam(value = "phone", required = true) String phone,
//                                     @ApiParam(name = "saasId", value = "saasId") @RequestParam(value = "saasId", required = true) String saasId){
//        try{
//            List<BaseRoleDO> result = baseRoleService.findByPhoneAndSaasId(phone,saasId);
//            return Envelop.getSuccess("获取数据成功!",result);
//        } catch (ApiException e){
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
//    }
//
////    @ApiOperation(value = "給角色添加菜单", notes = "給角色添加菜单")
////    @PostMapping(value = BaseUserRequestMapping.BaseRoleMenu.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
////    public Envelop addMenuForRole(@ApiParam(name = "roleId", value = "", defaultValue = "") @RequestBody String roleId,
////                                  @ApiParam(name = "menuIds", value = "", defaultValue = "") @RequestBody String menuIds){
////        try{
////            String[] menuIdArray = menuIds.split(",");
////            List<BaseRoleMenuDO> list = new ArrayList<>();
////            for(String menuId:menuIdArray){
////                BaseRoleMenuDO baseRoleMenuDO = new BaseRoleMenuDO();
////                baseRoleMenuDO.setRoleId(roleId);
////                baseRoleMenuDO.setRoleId(menuId);
////            }
////            if(menuIdArray.length < 1){
////                return Envelop.getSuccess(BaseUserRequestMapping.BaseMenu.message_success_create,this.baseRoleMenuService.createBaseRoleMenuDO(list.get(0)));
////            }else{
////                return Envelop.getSuccess(BaseUserRequestMapping.BaseMenu.message_success_create,this.baseRoleMenuService.createBatchBaseRoleMenuDO(list));
////            }
////        } catch (ApiException e){
////            return Envelop.getError(e.getMessage(), e.getErrorCode());
////        }
////    }
////
////
////    @ApiOperation(value = "修改角色菜单")
////    @GetMapping(value = BaseUserRequestMapping.BaseRoleMenu.api_update)
////    public Envelop updateMenuForRole(@ApiParam(name = "employId", value = "employId", required = true) @RequestParam(value = "employId", required = true) String id,
////                                    @ApiParam(name = "newMenuId", value = "newMenuId", required = true) @RequestParam(value = "roleId", required = true) String newMenuId) {
////        try {
////            BaseRoleMenuDO baseEmployRoleDO = new BaseRoleMenuDO();
////            baseEmployRoleDO.setId(id);
////            baseEmployRoleDO.setMenuId(newMenuId);
////            return Envelop.getSuccess(BaseUserRequestMapping.BaseEmploy.message_success_delete, this.baseRoleMenuService.updateBaseEmployRoleDO(baseEmployRoleDO));
////        } catch (ApiException e) {
////            return Envelop.getError(e.getMessage(), e.getErrorCode());
////        }
////    }
////
////    @ApiOperation(value = "查看角色菜单列表,不分页")
////    @GetMapping(value = BaseUserRequestMapping.BaseRoleMenu.api_getListNoPage)
////    public Envelop findMenuListForRole(@ApiParam(name = "roleId", value = "roleId", required = true) @RequestParam(value = "roleId", required = true) String roleId) {
////        try {
////            return Envelop.getSuccessList(BaseUserRequestMapping.BaseEmploy.message_success_delete, this.baseRoleMenuService.findAllByRoleId(roleId));
////        } catch (ApiException e) {
////            return Envelop.getError(e.getMessage(), e.getErrorCode());
////        }
////    }
////
////
////    @ApiOperation(value = "删除角色菜单", notes = "删除角色菜单")
////    @PostMapping(value = BaseUserRequestMapping.BaseRoleMenu.api_delete, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
////    public Envelop deleteMenuForRole(@ApiParam(name = "roleId", value = "", defaultValue = "") @RequestBody String roleId,
////                                  @ApiParam(name = "menuIds", value = "", defaultValue = "") @RequestBody String menuIds){
////        try{
////            String[] menuIdArray = menuIds.split(",");
////            if(menuIdArray.length < 1){
////                this.baseRoleMenuService.deleteBaseRoleMenuDO(roleId,menuIds);
////                return Envelop.getSuccess(BaseUserRequestMapping.BaseMenu.message_success_delete,"删除角色单个菜单信息");
////            }else{
////                this.baseRoleMenuService.deleteBatchBaseRoleMenuDO(roleId,menuIds);
////                return Envelop.getSuccess(BaseUserRequestMapping.BaseMenu.message_success_delete,"删除角色多个菜单信息");
////            }
////        } catch (ApiException e){
////            return Envelop.getError(e.getMessage(), e.getErrorCode());
////        }
////    }
//
//}

+ 0 - 198
svr/svr-base/src/main/java/com/yihu/jw/business/user/contorller/EmployController.java

@ -1,198 +0,0 @@
//package com.yihu.jw.business.user.contorller;
//
//import com.yihu.jw.base.base.FunctionDO;
//import com.yihu.jw.base.user.BaseEmployDO;
//import com.yihu.jw.base.user.BaseEmployRoleDO;
//import com.yihu.jw.business.user.service.EmployService;
//import com.yihu.jw.exception.ApiException;
//import com.yihu.jw.exception.code.ExceptionCode;
//import com.yihu.jw.restmodel.base.user.BaseEmployVO;
//import com.yihu.jw.restmodel.common.Envelop;
//import com.yihu.jw.restmodel.common.EnvelopRestController;
//import com.yihu.jw.rm.base.BaseRequestMapping;
//import com.yihu.jw.rm.base.BaseUserRequestMapping;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import io.swagger.annotations.ApiParam;
//import org.apache.commons.lang.StringUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.http.MediaType;
//import org.springframework.web.bind.annotation.*;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.text.ParseException;
//import java.util.ArrayList;
//import java.util.List;
//
///**
// * Created by chenweida on 2017/5/11.
// */
//@RestController
//@RequestMapping(BaseUserRequestMapping.api_user_common)
//@Api(description = "医生,行政人员等非患者用户(基础用户)")
//public class EmployController extends EnvelopRestController {
//    @Autowired
//    private EmployService employService;
//
//    @PostMapping(value = BaseUserRequestMapping.BaseEmploy.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
//    @ApiOperation(value = "创建用户", notes = "创建单个用户")
//    public Envelop createBaseEmployDO(@ApiParam(name = "json_data", value = "", defaultValue = "") @RequestBody String jsonData){
//        try{
//            BaseEmployDO baseEmployDO = toEntity(jsonData,BaseEmployDO.class);
//            return Envelop.getSuccess(BaseUserRequestMapping.BaseEmploy.message_success_create,employService.createBaseEmployDO(baseEmployDO));
//        } catch (Exception e){
//            return Envelop.getError(e.getMessage());
//        }
//    }
//
////    @PostMapping(value = BaseUserRequestMapping.BaseEmploy.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
////    @ApiOperation(value = "修改用户", notes = "修改用户")
////    public Envelop updateBaseEmployDO(@ApiParam(name = "json_data", value = "", defaultValue = "") @RequestBody String jsonData){
////        try{
////            BaseEmployDO baseEmployDO = toEntity(jsonData,BaseEmployDO.class);
////            return Envelop.getSuccess(BaseUserRequestMapping.BaseEmploy.message_success_update,employService.updateBaseEmployDO(baseEmployDO));
////        } catch (ApiException e){
////            return Envelop.getError(e.getMessage(), e.getErrorCode());
////        }
////    }
//
//    @ApiOperation(value = "根据id查找用户")
//    @GetMapping(value = BaseUserRequestMapping.BaseEmploy.api_getById)
//    public Envelop getEmployeeById(@ApiParam(name = "id", value = "id", required = true) @RequestParam(value = "id", required = true) String id) {
//        try{
//            return Envelop.getSuccess(BaseUserRequestMapping.BaseEmploy.message_success_find,this.employService.findById(id));
//        } catch (ApiException e){
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
//    }
//
//    @ApiOperation(value = "根据saasId查找所有用户")
//    @GetMapping(value = BaseUserRequestMapping.BaseEmploy.api_getListBySaasId)
//    public Envelop getAllEmployeeBySaasId(@ApiParam(name = "saasId", value = "saasId", required = true) @RequestParam(value = "saasId", required = true) String saasId) {
//        try{
//            return Envelop.getSuccessList(BaseUserRequestMapping.BaseEmploy.message_success_find,this.employService.findAllBySaasId(saasId));
//        } catch (ApiException e){
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
//    }
//
//
//    @ApiOperation(value = "根据手机号和saasId查找用户")
//    @GetMapping(value = BaseUserRequestMapping.BaseEmploy.api_getByPhone)
//    public Envelop getEmployeeByPhoneAndSaasId(@ApiParam(name = "phone", value = "phone", required = true) @RequestParam(value = "phone", required = true) String phone,
//                                               @ApiParam(name = "saasId", value = "saasId", required = true) @RequestParam(value = "saasId", required = true) String saasId) {
//        try {
//            return Envelop.getSuccess(BaseUserRequestMapping.BaseEmploy.message_success_find, this.employService.findByPhoneAndSaasId(phone,saasId));
//        } catch (ApiException e) {
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
//    }
//
//    @ApiOperation(value = "根据name模糊查询某saasId平台下的所有用户")
//    @GetMapping(value = BaseUserRequestMapping.BaseEmploy.api_getListByName)
//    public Envelop getListByNameAndSaasId(@ApiParam(name = "saasId", value = "saasId", required = true) @RequestParam(value = "saasId", required = true) String saasId,
//                                          @ApiParam(name = "name", value = "name", required = true) @RequestParam(value = "name", required = true) String name) {
//        try{
//            return Envelop.getSuccessList(BaseUserRequestMapping.BaseEmploy.message_success_find,this.employService.findAllByNameAndSaasId(name,saasId));
//        } catch (ApiException e){
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
//    }
//
//    @ApiOperation(value = "根据指定条件查询用户列表,分页")
//    @GetMapping(value = BaseUserRequestMapping.BaseEmploy.api_getListNoPage)
//    public Envelop getListPageByNameAndSaasId(@ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,name,sex,photo,skill,email,phone,family_tel,introduction,jxzc,lczc,xlzc,xzzc") @RequestParam(value = "fields", required = false) String fields,
//                                              @ApiParam(name = "filters", value = "过滤器,为空检索所有条件") @RequestParam(value = "filters", required = false) String filters,
//                                              @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "+name,+createTime") @RequestParam(value = "sorts", required = false) String sorts,
//                                              @ApiParam(name = "size", value = "分页大小", defaultValue = "15") @RequestParam(value = "size", required = false) int size,
//                                              @ApiParam(name = "page", value = "页码", defaultValue = "1") @RequestParam(value = "page", required = false) int page,
//                                              HttpServletRequest request, HttpServletResponse response) throws ParseException {
//        if (StringUtils.isBlank(filters)) {
//            return Envelop.getError(BaseUserRequestMapping.BaseEmploy.message_fail_params_not_present, ExceptionCode.common_error_params_code);
//        } else {
//            filters = "status<>-1;" + filters;
//        }
//        if (StringUtils.isBlank(sorts)) {
//            sorts = "-updateTime";
//        }
//
//        //得到list数据
//        List<BaseEmployVO> list = employService.search(fields, filters, sorts, page, size);
//
//        //获取总数
//        long count = employService.getCount(filters);
//        //封装头信息
//        pagedResponse(request, response, count, page, size);
//        //封装返回格式
//        List<BaseEmployVO> mFunctions = convertToModels(list, new ArrayList<>(list.size()), BaseEmployVO.class, fields);
//
//        return Envelop.getSuccessListWithPage(BaseUserRequestMapping.BaseEmploy.message_success_find, mFunctions, page, size, count);
//    }
//
//
////    @ApiOperation(value = "给某一用户新增角色")
////    @GetMapping(value = BaseUserRequestMapping.BaseEmployRole.api_create)
////    public Envelop createEmployRoles(@ApiParam(name = "employId", value = "employId", required = true) @RequestParam(value = "employId", required = true) String employId,
////                                     @ApiParam(name = "roleIds", value = "roleIds", required = true) @RequestParam(value = "roleIds", required = true) String roleIds) {
////        try {
////            String[] roleIdArray = roleIds.split(",");
////            List<BaseEmployRoleDO> list = new ArrayList<>();
////            for (String roleId : roleIdArray) {
////                BaseEmployRoleDO baseEmployRoleDO = new BaseEmployRoleDO();
////                baseEmployRoleDO.setEmployId(employId);
////                baseEmployRoleDO.setRoleId(roleId);
////                list.add(baseEmployRoleDO);
////            }
////            if (roleIdArray.length < 1) {
////                return Envelop.getSuccess(BaseUserRequestMapping.BaseEmploy.message_success_find, this.employRoleService.createBaseEmployRoleDO(list.get(0)));
////            }else{
////                return Envelop.getSuccess(BaseUserRequestMapping.BaseEmploy.message_success_find, this.employRoleService.createBatchBaseEmployRoleDO(list));
////            }
////        } catch (ApiException e) {
////            return Envelop.getError(e.getMessage(), e.getErrorCode());
////        }
////    }
//
////    @ApiOperation(value = "修改用户角色")
////    @GetMapping(value = BaseUserRequestMapping.BaseEmployRole.api_update)
////    public Envelop updateEmployRole(@ApiParam(name = "employId", value = "employId", required = true) @RequestParam(value = "employId", required = true) String id,
////                                    @ApiParam(name = "roleId", value = "roleId", required = true) @RequestParam(value = "roleId", required = true) String newRoleId) {
////        try {
////            BaseEmployRoleDO baseEmployRoleDO = new BaseEmployRoleDO();
////            baseEmployRoleDO.setId(id);
////            baseEmployRoleDO.setRoleId(newRoleId);
////            return Envelop.getSuccess(BaseUserRequestMapping.BaseEmploy.message_success_delete, this.employRoleService.updateBaseEmployRoleDO(baseEmployRoleDO));
////        } catch (ApiException e) {
////            return Envelop.getError(e.getMessage(), e.getErrorCode());
////        }
////    }
//
////    @ApiOperation(value = "查看用户角色列表,不分页")
////    @GetMapping(value = BaseUserRequestMapping.BaseEmployRole.api_getListNoPage)
////    public Envelop findEmployRoleList(@ApiParam(name = "employId", value = "employId", required = true) @RequestParam(value = "employId", required = true) String employId) {
////        try {
////            return Envelop.getSuccessList(BaseUserRequestMapping.BaseEmploy.message_success_delete, this.employRoleService.findAllByEmployId(employId));
////        } catch (ApiException e) {
////            return Envelop.getError(e.getMessage(), e.getErrorCode());
////        }
////    }
//
////    @ApiOperation(value = "删除用户角色")
////    @GetMapping(value = BaseUserRequestMapping.BaseEmployRole.api_delete)
////    public Envelop deleteEmployRoles(@ApiParam(name = "employId", value = "employId", required = true) @RequestParam(value = "employId", required = true) String employId,
////                                     @ApiParam(name = "roleIds", value = "roleIds", required = true) @RequestParam(value = "roleIds", required = true) String roleIds) {
////        try {
////            String[] idArray = roleIds.split(",");
////            if (idArray.length < 1) {
////                this.employRoleService.deleteBaseEmployRoleDO(employId,roleIds);
////                return Envelop.getSuccess(BaseUserRequestMapping.BaseEmploy.message_success_delete,"删除单个角色");
////            }else{
////                this.employRoleService.deleteBatchBaseEmployRoleDO(employId,roleIds);
////                return Envelop.getSuccess(BaseUserRequestMapping.BaseEmploy.message_success_delete, "删除多个角色");
////            }
////        } catch (ApiException e) {
////            return Envelop.getError(e.getMessage(), e.getErrorCode());
////        }
////    }
//}

+ 0 - 28
svr/svr-base/src/main/java/com/yihu/jw/business/user/contorller/PatientController.java

@ -1,28 +0,0 @@
//package com.yihu.jw.business.user.contorller;
//
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import io.swagger.annotations.ApiParam;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.cloud.sleuth.Tracer;
//import org.springframework.web.bind.annotation.*;
//
///**
// * Created by chenweida on 2017/5/10.
// */
//@RestController
//@RequestMapping("/patient")
//@Api(description = "患者")
//public class PatientController {
//    @Autowired
//    private Tracer tracer;
//
//
//    @ApiOperation(value = "根据code查找患者")
//    @GetMapping(value = "findByCode")
//    public String findByCode(
//            @ApiParam(name = "code", value = "患者code", required = true)@RequestParam(value = "code", required = true) String code) {
//      tracer.getCurrentSpan().logEvent("进入微服务查询患者");
//       return "调用根据code查找患者";
//    }
//}

+ 0 - 32
svr/svr-base/src/main/java/com/yihu/jw/business/user/dao/BaseMenuDao.java

@ -1,32 +0,0 @@
//package com.yihu.jw.business.user.dao;
//
//import com.yihu.jw.base.user.BaseMenuDO;
//import com.yihu.jw.base.user.BaseMenuDO;
//import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
//import org.springframework.data.jpa.repository.Query;
//import org.springframework.data.repository.PagingAndSortingRepository;
//
//import java.util.List;
//
///**
// * Created by LiTaohong on 2017/12/05.
// */
//public interface BaseMenuDao extends PagingAndSortingRepository<BaseMenuDO, String>, JpaSpecificationExecutor<BaseMenuDO> {
//
//    //角色与saasId为一对多关系
//    @Query("from BaseMenuDO b where b.saasId = ?1")
//    List<BaseMenuDO> findAllBySaasId(String saasId);
//
//    @Query("from BaseMenuDO b where b.saasId = ?1 and b.name = ?2")
//    BaseMenuDO findOneBySaasIdAndName(String saasId, String name);
//
//    @Query("from BaseMenuDO b where b.name like %?1%")
//    List<BaseMenuDO> findAllByName(String name);
//
//    @Query("from BaseMenuDO b where b.saasId = ?1 and b.parentId = ?2")
//    List<BaseMenuDO> getChildrenMenuList(String saasId,String parentId);
//
//
//
//
//}

+ 0 - 31
svr/svr-base/src/main/java/com/yihu/jw/business/user/dao/BaseRoleDao.java

@ -1,31 +0,0 @@
//package com.yihu.jw.business.user.dao;
//
//import com.yihu.jw.base.user.BaseRoleDO;
//import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
//import org.springframework.data.jpa.repository.Query;
//import org.springframework.data.repository.PagingAndSortingRepository;
//
//import java.util.List;
//
///**
// * Created by LiTaohong on 2017/11/28.
// */
//public interface BaseRoleDao extends PagingAndSortingRepository<BaseRoleDO, String>, JpaSpecificationExecutor<BaseRoleDO> {
//
//
//    @Query("from BaseRoleDO b where b.id = ?1")
//    BaseRoleDO findOneById(String id);
//
//    //角色与saasId为一对多关系
//    @Query("from BaseRoleDO b where b.saasId = ?1")
//    List<BaseRoleDO> findAllBySaasId(String saasId);
//
//    @Query("from BaseRoleDO b where b.saasId = ?1 and b.name = ?2")
//    BaseRoleDO findOneBySaasIdAndName(String saasId,String name);
//
//    @Query("from BaseRoleDO b where b.name like %?1%")
//    List<BaseRoleDO> findAllByName(String name);
//
//    @Query(value="select b.* from base_role b,base_employ e,base_employ_role r where r.role_id=b.id and r.employ_id=e.id and e.phone= ?1 and e.saas_id= ?2",nativeQuery = true)
//    List<BaseRoleDO> findByPhoneAndSaasId(String phone,String saasId);
//}

+ 0 - 26
svr/svr-base/src/main/java/com/yihu/jw/business/user/dao/BaseRoleMenuDao.java

@ -1,26 +0,0 @@
//package com.yihu.jw.business.user.dao;
//
//import com.yihu.jw.base.user.BaseEmployRoleDO;
//import com.yihu.jw.base.user.BaseRoleDO;
//import com.yihu.jw.base.user.BaseRoleMenuDO;
//import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
//import org.springframework.data.jpa.repository.Query;
//import org.springframework.data.repository.PagingAndSortingRepository;
//
//import java.util.List;
//
///**
// * Created by LiTaohong on 2017/11/28.
// */
//public interface BaseRoleMenuDao extends PagingAndSortingRepository<BaseRoleMenuDO, String>, JpaSpecificationExecutor<BaseRoleMenuDO> {
//
//
//    @Query("from BaseRoleMenuDO ba where ba.roleId = ?1")
//    List<BaseRoleMenuDO> findRoleMenuListByRoleId(String employId);
//
//    @Query("delete from BaseRoleMenuDO ba where ba.roleId = ?1 and ba.menuId = ?2")
//    int deleteOneByRoleIdAndMenuId(String roleId,String menuId);
//
//    @Query("delete from BaseRoleMenuDO ba where ba.roleId = ?1 and ba.menuId in (?2)")
//    int deleteManyByRoleIdAndMenuIds(String roleId,String menuIds);
//}

+ 0 - 27
svr/svr-base/src/main/java/com/yihu/jw/business/user/dao/EmployDao.java

@ -1,27 +0,0 @@
//package com.yihu.jw.business.user.dao;
//
//import com.yihu.jw.base.user.BaseEmployDO;
//import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
//import org.springframework.data.jpa.repository.Query;
//import org.springframework.data.repository.PagingAndSortingRepository;
//
//import java.util.List;
//
///**
// * Created by chenweida on 2017/11/28.
// */
//
///**
// * 基础用户类接口
// */
//public interface EmployDao extends PagingAndSortingRepository<BaseEmployDO, String>, JpaSpecificationExecutor<BaseEmployDO> {
//
//    @Query("from BaseEmployDO ba where ba.saasId = ?1")
//    List<BaseEmployDO> findAllBySaasId(String saasId);
//
//    @Query("from BaseEmployDO ba where ba.name like ?1 and ba.saasId = ?2")
//    List<BaseEmployDO> findAllByNameAndSaasId(String name,String saasId);
//
//    @Query("from BaseEmployDO ba where ba.phone = ?1 and ba.saasId = ?2")
//    BaseEmployDO findByPhoneAndSaasId(String phone,String saasId);
//}

+ 0 - 24
svr/svr-base/src/main/java/com/yihu/jw/business/user/dao/EmployRoleDao.java

@ -1,24 +0,0 @@
//package com.yihu.jw.business.user.dao;
//
//import com.yihu.jw.base.user.BaseEmployRoleDO;
//import com.yihu.jw.base.user.BaseRoleDO;
//import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
//import org.springframework.data.jpa.repository.Query;
//import org.springframework.data.repository.PagingAndSortingRepository;
//
//import java.util.List;
//
///**
// * Created by LiTaohong on 2017/11/28.
// */
//public interface EmployRoleDao extends PagingAndSortingRepository<BaseEmployRoleDO, String>, JpaSpecificationExecutor<BaseEmployRoleDO> {
//
//    @Query("from BaseEmployRoleDO ba where ba.employId = ?1")
//    List<BaseEmployRoleDO> findRoleListByEmployId(String employId);
//
//    @Query("delete from BaseEmployRoleDO ba where ba.employId = ?1 and ba.roleId = ?2")
//    int deleteOneByEmployIdAndRoleId(String employId,String roleId);
//
//    @Query("delete from BaseEmployRoleDO ba where ba.employId = ?1 and ba.roleId in (?2)")
//    int deleteManyByEmployIdAndRoleIds(String employId,String roleIds);
//}

+ 0 - 137
svr/svr-base/src/main/java/com/yihu/jw/business/user/service/BaseMenuService.java

@ -1,137 +0,0 @@
//package com.yihu.jw.business.user.service;
//
//import com.yihu.base.mysql.query.BaseJpaService;
//import com.yihu.jw.base.user.BaseMenuDO;
//import com.yihu.jw.base.user.BaseMenuDO;
//import com.yihu.jw.business.user.dao.BaseMenuDao;
//import com.yihu.jw.exception.ApiException;
//import com.yihu.jw.exception.code.ExceptionCode;
//import com.yihu.jw.rm.base.BaseUserRequestMapping;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//import org.springframework.transaction.annotation.Transactional;
//import org.springframework.util.StringUtils;
//
//import java.util.List;
//
///**
// * Created by LiTaohong on 2017/12/5.
// * 基础菜单功能
// */
//@Service
//public class BaseMenuService extends BaseJpaService<BaseMenuDO,BaseMenuDao>{
//    @Autowired
//    private BaseMenuDao baseMenuDao;
//
//    /**
//     * 创建菜单
//     * @param baseMenuDO
//     * @return
//     */
//    @Transactional
//    public BaseMenuDO createBaseMenu(BaseMenuDO baseMenuDO){
//        if (StringUtils.isEmpty(baseMenuDO.getId())) {
//            throw new ApiException(BaseUserRequestMapping.BaseMenu.message_fail_id_is_null, ExceptionCode.common_error_params_code);
//        }
//        if (StringUtils.isEmpty(baseMenuDO.getLeaderCode())) {
//            throw new ApiException(BaseUserRequestMapping.BaseMenu.message_fail_saasId_is_null, ExceptionCode.common_error_params_code);
//        }
//        return this.baseMenuDao.save(baseMenuDO);
//    }
//
//    /**
//     * 更新菜单
//     * @param baseMenuDO
//     * @return
//     */
//    @Transactional
//    public BaseMenuDO updateBaseMenuDO(BaseMenuDO baseMenuDO){
//        if (StringUtils.isEmpty(baseMenuDO.getId())) {
//            throw new ApiException(BaseUserRequestMapping.BaseMenu.message_fail_id_is_null, ExceptionCode.common_error_params_code);
//        }
//        if (StringUtils.isEmpty(baseMenuDO.getLeaderCode())) {
//            throw new ApiException(BaseUserRequestMapping.BaseMenu.message_fail_saasId_is_null, ExceptionCode.common_error_params_code);
//        }
//        return this.baseMenuDao.save(baseMenuDO);
//    }
//
//    /**
//     * 根据Id查询菜单
//     * @param id
//     * @return
//     */
//    public BaseMenuDO findById(String id){
//        if (StringUtils.isEmpty(id)) {
//            throw new ApiException(BaseUserRequestMapping.BaseMenu.message_fail_id_is_null,ExceptionCode.common_error_params_code);
//        }
//        BaseMenuDO baseRoleDO = this.baseMenuDao.findOne(id);
//        if (null == baseRoleDO) {
//            throw new ApiException(BaseUserRequestMapping.BaseMenu.message_fail_id_no_exist,ExceptionCode.common_error_params_code);
//        }
//        return baseRoleDO;
//    }
//
//    /**
//     * 查询某要saasId平台下的所有菜单
//     * @param saasId
//     * @return
//     */
//    public List<BaseMenuDO> findAllBySaasId(String saasId){
//        if (StringUtils.isEmpty(saasId)) {
//            throw new ApiException(BaseUserRequestMapping.BaseMenu.message_fail_saasId_is_null,ExceptionCode.common_error_params_code);
//        }
//        List<BaseMenuDO> list = this.baseMenuDao.findAllBySaasId(saasId);
//        if (null == list || list.size() == 0) {
//            throw new ApiException(BaseUserRequestMapping.BaseMenu.message_fail_saasId_no_exist,ExceptionCode.common_error_params_code);
//        }
//        return list;
//    }
//
//    /**
//     * 根据Id删除菜单
//     * @param baseMenuDO
//     */
//    @Transactional
//    public void deleteBaseMenu(BaseMenuDO baseMenuDO){
//        if (StringUtils.isEmpty(baseMenuDO.getId())) {
//            throw new ApiException(BaseUserRequestMapping.BaseMenu.message_fail_id_is_null, ExceptionCode.common_error_params_code);
//        }
//        if (StringUtils.isEmpty(baseMenuDO.getLeaderCode())) {
//            throw new ApiException(BaseUserRequestMapping.BaseMenu.message_fail_saasId_is_null, ExceptionCode.common_error_params_code);
//        }
//        baseMenuDO.setStatus(-1);
//        this.baseMenuDao.save(baseMenuDO);
//    }
//
//    /**
//     * 删除某一saasId相关的所有菜单
//     * @param saasId
//     */
//    @Transactional
//    public void deleteBaseMenusBySaasId(String saasId){
//        if (StringUtils.isEmpty(saasId)) {
//            throw new ApiException(BaseUserRequestMapping.BaseMenu.message_fail_saasId_is_null, ExceptionCode.common_error_params_code);
//        }
//        List<BaseMenuDO> list = this.baseMenuDao.findAllBySaasId(saasId);
//        for(BaseMenuDO baseMenuDO:list){
//            baseMenuDO.setStatus(-1);
//        }
//        this.baseMenuDao.save(list);
//    }
//
//    /**
//     * 获取某一平台下某一父级菜单的所有子菜单
//     * @param saasId
//     * @param parentId
//     * @return
//     */
//    public List<BaseMenuDO> getChlidrenMenuList(String saasId,String parentId){
//        if (StringUtils.isEmpty(saasId)) {
//            throw new ApiException(BaseUserRequestMapping.BaseMenu.message_param_saasid_is_null, ExceptionCode.common_error_params_code);
//        }
//        if (StringUtils.isEmpty(parentId)) {
//            throw new ApiException(BaseUserRequestMapping.BaseMenu.message_param_parentId_is_null, ExceptionCode.common_error_params_code);
//        }
//        return this.baseMenuDao.getChildrenMenuList(saasId,parentId);
//    }
//}

+ 0 - 154
svr/svr-base/src/main/java/com/yihu/jw/business/user/service/BaseRoleMenuService.java

@ -1,154 +0,0 @@
//package com.yihu.jw.business.user.service;
//
//import com.yihu.base.mysql.query.BaseJpaService;
//import com.yihu.jw.base.user.BaseMenuDO;
//import com.yihu.jw.base.user.BaseRoleMenuDO;
//import com.yihu.jw.business.user.dao.BaseMenuDao;
//import com.yihu.jw.business.user.dao.BaseRoleMenuDao;
//import com.yihu.jw.exception.ApiException;
//import com.yihu.jw.exception.code.ExceptionCode;
//import com.yihu.jw.rm.base.BaseUserRequestMapping;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//import org.springframework.transaction.annotation.Transactional;
//import org.springframework.util.StringUtils;
//
//import java.util.ArrayList;
//import java.util.List;
//
///**
// * Created by LiTaohong on 2017/12/05.
// * 基础角色菜单功能
// */
//@Service
//public class BaseRoleMenuService extends BaseJpaService<BaseRoleMenuDO,BaseRoleMenuDao> {
//
//    @Autowired
//    private BaseRoleMenuDao baseRoleMenuDao;
//
//    @Autowired
//    private BaseMenuDao baseMenuDao;
//
//    /**
//     * 新增角色菜单
//     * @param baseRoleMenuDO
//     * @return
//     */
//    @Transactional
//    public BaseRoleMenuDO createBaseRoleMenuDO(BaseRoleMenuDO baseRoleMenuDO){
//        if (StringUtils.isEmpty(baseRoleMenuDO.getRoleId())) {
//            throw new ApiException(BaseUserRequestMapping.BaseEmployRole.message_fail_roleId_is_null, ExceptionCode.common_error_params_code);
//        }
//        return this.baseRoleMenuDao.save(baseRoleMenuDO);
//    }
//
//    /**
//     * 批量新增角色菜单,一个角色拥有多个菜单的权限
//     * @param list
//     * @return
//     */
//    @Transactional
//    public Iterable<BaseRoleMenuDO> createBatchBaseRoleMenuDO(List<BaseRoleMenuDO> list){
//        return this.baseRoleMenuDao.save(list);
//    }
//
//    /**
//     * 修改角色菜单信息
//     * @param baseRoleMenuDO
//     * @return
//     */
//    @Transactional
//    public BaseRoleMenuDO updateBaseEmployRoleDO(BaseRoleMenuDO baseRoleMenuDO){
//        BaseRoleMenuDO OldbaseRoleMenuDO = this.baseRoleMenuDao.findOne(baseRoleMenuDO.getId());
//        if(null == OldbaseRoleMenuDO){
//            throw new ApiException(BaseUserRequestMapping.BaseRoleMenu.message_fail_baseRoleMenu_no_exist, ExceptionCode.common_error_params_code);
//        }
//        //菜单id一样,表示菜单没有变,则不修改
//        if (baseRoleMenuDO.getMenuId().equals(OldbaseRoleMenuDO.getMenuId())) {
//            throw new ApiException(BaseUserRequestMapping.BaseRoleMenu.message_fail_same_menuId, ExceptionCode.common_error_params_code);
//        }
//        baseRoleMenuDO.setRoleId(OldbaseRoleMenuDO.getRoleId());
//        return this.baseRoleMenuDao.save(baseRoleMenuDO);
//    }
//
//
//    /**
//     * 查询某一角色的菜单列表(角色与菜单为一对多关系)
//     * @param roleId
//     * @return
//     */
//    public List<BaseMenuDO> findAllByRoleId(String roleId){
//        if (StringUtils.isEmpty(roleId)) {
//            throw new ApiException(BaseUserRequestMapping.BaseRoleMenu.message_fail_roleId_is_null, ExceptionCode.common_error_params_code);
//        }
//        List<BaseRoleMenuDO> list = this.baseRoleMenuDao.findRoleMenuListByRoleId(roleId);
//        if (null == list || list.size() == 0) {
//            throw new ApiException(BaseUserRequestMapping.BaseRoleMenu.message_fail_baseRoleMenu_no_exist,ExceptionCode.common_error_params_code);
//        }
//        List<String> ids = new ArrayList<>();
//        for(BaseRoleMenuDO baseRoleMenuDO:list){
//            ids.add(baseRoleMenuDO.getMenuId());
//        }
//        Iterable<String> iterable = (Iterable<String>)ids.iterator();
//        List<BaseMenuDO> result = (List<BaseMenuDO>)baseMenuDao.findAll(iterable);
//        return result;
//    }
//
//
//    /**
//     * 根据id删除角色菜单
//     * @param id
//     * @return
//     */
//    @Transactional
//    public void deleteBaseRoleMenuDO(String id){
//        try{
//            this.baseRoleMenuDao.delete(id);
//        }
//        catch (ApiException e){
//            throw new ApiException(BaseUserRequestMapping.BaseRoleMenu.message_fail_id_is_null,ExceptionCode.common_error_params_code);
//        }
//
//    }
//
//    /**
//     * 根据roleId和menuId删除角色菜单
//     * @param roleId
//     * @param menuId
//     * @return
//     */
//    @Transactional
//    public void deleteBaseRoleMenuDO(String roleId,String menuId){
//        try{
//            this.baseRoleMenuDao.deleteOneByRoleIdAndMenuId(roleId,menuId);
//        }
//        catch (ApiException e){
//            throw new ApiException(BaseUserRequestMapping.BaseRoleMenu.message_fail_id_is_null,ExceptionCode.common_error_params_code);
//        }
//    }
//
//    /**
//     * 根据roleId和menuId删除角色菜单
//     * @param roleId
//     * @param menuIds
//     * @return
//     */
//    @Transactional
//    public void deleteBatchBaseRoleMenuDO(String roleId,String menuIds){
//        try{
//            this.baseRoleMenuDao.deleteManyByRoleIdAndMenuIds(roleId,menuIds);
//        }
//        catch (ApiException e){
//            throw new ApiException(BaseUserRequestMapping.BaseRoleMenu.message_fail_id_is_null,ExceptionCode.common_error_params_code);
//        }
//    }
//
//
//
//
//
//
//
//
//
//}

+ 0 - 182
svr/svr-base/src/main/java/com/yihu/jw/business/user/service/BaseRoleService.java

@ -1,182 +0,0 @@
//package com.yihu.jw.business.user.service;
//
//import com.yihu.jw.base.user.BaseRoleDO;
//import com.yihu.jw.business.user.dao.BaseRoleDao;
//import com.yihu.jw.exception.ApiException;
//import com.yihu.jw.exception.code.ExceptionCode;
//import com.yihu.jw.rm.base.BaseUserRequestMapping;
//import com.yihu.mysql.query.BaseJpaService;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//import org.springframework.transaction.annotation.Transactional;
//import org.springframework.util.StringUtils;
//
//import java.util.List;
//
///**
// * Created by LiTaohong on 2017/11/28.
// * 基础角色功能
// */
//@Service
//public class BaseRoleService extends BaseJpaService<BaseRoleDO,BaseRoleDao> {
//    @Autowired
//    private BaseRoleDao baseRoleDao;
//
//    /**
//     * 创建role
//     * @param baseRoleDO
//     * @return
//     */
//    @Transactional
//    public BaseRoleDO createBaseRole(BaseRoleDO baseRoleDO){
//        if (StringUtils.isEmpty(baseRoleDO.getId())) {
//            throw new ApiException(BaseUserRequestMapping.BaseRole.message_fail_id_is_null, ExceptionCode.common_error_params_code);
//        }
//        if (StringUtils.isEmpty(baseRoleDO.getLeaderCode())) {
//            throw new ApiException(BaseUserRequestMapping.BaseRole.message_fail_saasid_is_null, ExceptionCode.common_error_params_code);
//        }
//        if (StringUtils.isEmpty(baseRoleDO.getName())) {
//            throw new ApiException(BaseUserRequestMapping.BaseRole.message_fail_name_is_null, ExceptionCode.common_error_params_code);
//        }
//        return this.baseRoleDao.save(baseRoleDO);
//    }
//
//    /**
//     * 更新role
//     * @param baseRoleDO
//     * @return
//     */
//    @Transactional
//    public BaseRoleDO updateBaseRole(BaseRoleDO baseRoleDO){
//        if (StringUtils.isEmpty(baseRoleDO.getId())) {
//            throw new ApiException(BaseUserRequestMapping.BaseRole.message_fail_id_is_null, ExceptionCode.common_error_params_code);
//        }
//        if (StringUtils.isEmpty(baseRoleDO.getLeaderCode())) {
//            throw new ApiException(BaseUserRequestMapping.BaseRole.message_fail_saasid_is_null, ExceptionCode.common_error_params_code);
//        }
//        return this.baseRoleDao.save(baseRoleDO);
//    }
//
//    /**
//     * 根据roleId查询role
//     * @param id
//     * @return
//     */
//    public BaseRoleDO findById(String id){
//        if (StringUtils.isEmpty(id)) {
//            throw new ApiException(BaseUserRequestMapping.BaseRole.message_fail_id_is_null,ExceptionCode.common_error_params_code);
//        }
//        BaseRoleDO baseRoleDO = this.baseRoleDao.findOneById(id);
//        if (null == baseRoleDO) {
//            throw new ApiException(BaseUserRequestMapping.BaseRole.message_fail_id_no_exist,ExceptionCode.common_error_params_code);
//        }
//        return baseRoleDO;
//    }
//
//    /**
//     * 查询某要saasId平台下的所有role
//     * @param saasId
//     * @return
//     */
//    public List<BaseRoleDO> findAllBySaasId(String saasId){
//        if (StringUtils.isEmpty(saasId)) {
//            throw new ApiException(BaseUserRequestMapping.BaseRole.message_param_saasid_is_null,ExceptionCode.common_error_params_code);
//        }
//        List<BaseRoleDO> list = this.baseRoleDao.findAllBySaasId(saasId);
//        if (null == list || list.size() == 0) {
//            throw new ApiException(BaseUserRequestMapping.BaseRole.message_fail_saasid_no_exist,ExceptionCode.common_error_params_code);
//        }
//        return list;
//    }
//
//    /**
//     * 查找某一平台下某一个role
//     * @param saasId
//     * @param name
//     * @return
//     */
//    public BaseRoleDO findBySaasIdAndName(String saasId,String name){
//        if (StringUtils.isEmpty(saasId)) {
//            throw new ApiException(BaseUserRequestMapping.BaseRole.message_param_saasid_is_null,ExceptionCode.common_error_params_code);
//        }
//        if (StringUtils.isEmpty(name)) {
//            throw new ApiException(BaseUserRequestMapping.BaseRole.message_fail_name_is_null,ExceptionCode.common_error_params_code);
//        }
//        BaseRoleDO baseRoleDO = this.baseRoleDao.findOneBySaasIdAndName(name,saasId);
//        if (null == baseRoleDO) {
//            throw new ApiException(BaseUserRequestMapping.BaseRole.message_fail_role_no_exist,ExceptionCode.common_error_params_code);
//        }
//        return baseRoleDO;
//    }
//
//    /**
//     * 根据name查询所有的role,包括不同平台saasid的
//     * @param name
//     * @return
//     */
//    public List<BaseRoleDO> getRoleListByName(String name){
//        if (StringUtils.isEmpty(name)) {
//            throw new ApiException(BaseUserRequestMapping.BaseRole.message_param_name_is_null,ExceptionCode.common_error_params_code);
//        }
//        List<BaseRoleDO> list = this.baseRoleDao.findAllByName(name);
//        if (null == list || list.size() == 0) {
//            throw new ApiException(BaseUserRequestMapping.BaseRole.message_fail_role_no_exist,ExceptionCode.common_error_params_code);
//        }
//        return list;
//    }
//
//
//    /**
//     * 根据roleId删除role
//     * @param baseRoleDO
//     */
//    @Transactional
//    public void deleteBaseRole(BaseRoleDO baseRoleDO){
//        if (StringUtils.isEmpty(baseRoleDO.getId())) {
//            throw new ApiException(BaseUserRequestMapping.BaseRole.message_fail_id_is_null, ExceptionCode.common_error_params_code);
//        }
//        if (StringUtils.isEmpty(baseRoleDO.getLeaderCode())) {
//            throw new ApiException(BaseUserRequestMapping.BaseRole.message_fail_saasid_is_null, ExceptionCode.common_error_params_code);
//        }
//        baseRoleDO.setStatus(-1);
//        this.baseRoleDao.save(baseRoleDO);
//    }
//
//    /**
//     * 删除某一saasId相关的所有role
//     * @param saasId
//     */
//    @Transactional
//    public void deleteBaseRolesBySaasId(String saasId){
//        if (StringUtils.isEmpty(saasId)) {
//            throw new ApiException(BaseUserRequestMapping.BaseRole.message_fail_saasid_is_null, ExceptionCode.common_error_params_code);
//        }
//        List<BaseRoleDO> list = this.baseRoleDao.findAllBySaasId(saasId);
//        for(BaseRoleDO baseRoleDO:list){
//            baseRoleDO.setStatus(-1);
//        }
//        this.baseRoleDao.save(list);
//    }
//
//    /**
//     * 根据saasId和name删除角色
//     * @param saasId
//     * @param name
//     */
//    @Transactional
//    public void deleteBaseRoleByNameAndSaasId(String saasId,String name){
//        BaseRoleDO baseRoleDO = this.findBySaasIdAndName(saasId,name);
//        baseRoleDO.setStatus(-1);
//        this.baseRoleDao.save(baseRoleDO);
//    }
//
//    /**
//     * 根据phone(账号)和saasId查询角色列表
//     * @param phone
//     * @param saasId
//     * @return
//     */
//    public List<BaseRoleDO> findByPhoneAndSaasId(String phone,String saasId){
//        return this.baseRoleDao.findByPhoneAndSaasId(phone,saasId);
//    }
//}

+ 0 - 152
svr/svr-base/src/main/java/com/yihu/jw/business/user/service/EmployRoleService.java

@ -1,152 +0,0 @@
//package com.yihu.jw.business.user.service;
//
//import com.yihu.base.mysql.query.BaseJpaService;
//import com.yihu.jw.base.user.BaseEmployDO;
//import com.yihu.jw.base.user.BaseEmployRoleDO;
//import com.yihu.jw.base.user.BaseRoleDO;
//import com.yihu.jw.business.user.dao.BaseRoleDao;
//import com.yihu.jw.business.user.dao.EmployRoleDao;
//import com.yihu.jw.exception.ApiException;
//import com.yihu.jw.exception.code.ExceptionCode;
//import com.yihu.jw.rm.base.BaseUserRequestMapping;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.data.jpa.repository.Query;
//import org.springframework.stereotype.Service;
//import org.springframework.transaction.annotation.Transactional;
//import org.springframework.util.StringUtils;
//
//import java.util.ArrayList;
//import java.util.List;
//
///**
// * Created by chenweida on 2017/5/11.
// * 用户角色表功能
// */
//@Service
//public class EmployRoleService extends BaseJpaService<BaseEmployRoleDO,EmployRoleDao> {
//
//    @Autowired
//    private EmployRoleDao employRoleDao;
//
//    @Autowired
//    private BaseRoleDao baseRoleDao;
//
//    /**
//     * 新增用户角色
//     * @param baseEmployRoleDO
//     * @return
//     */
//    @Transactional
//    public BaseEmployRoleDO createBaseEmployRoleDO(BaseEmployRoleDO baseEmployRoleDO){
//        if (StringUtils.isEmpty(baseEmployRoleDO.getRoleId())) {
//            throw new ApiException(BaseUserRequestMapping.BaseEmployRole.message_fail_roleId_is_null, ExceptionCode.common_error_params_code);
//        }
//        if (StringUtils.isEmpty(baseEmployRoleDO.getEmployId())) {
//            throw new ApiException(BaseUserRequestMapping.BaseEmployRole.message_fail_employId_is_null, ExceptionCode.common_error_params_code);
//        }
//        return this.employRoleDao.save(baseEmployRoleDO);
//    }
//
//    /**
//     * 批量新增用户角色,一个用户可能有多个角色
//     * @param list
//     * @return
//     */
//    @Transactional
//    public Iterable<BaseEmployRoleDO> createBatchBaseEmployRoleDO(List<BaseEmployRoleDO> list){
//       return this.employRoleDao.save(list);
//    }
//
//    /**
//     * 修改用户角色
//     * @param baseEmployRoleDO
//     * @return
//     */
//    @Transactional
//    public BaseEmployRoleDO updateBaseEmployRoleDO(BaseEmployRoleDO baseEmployRoleDO){
//        BaseEmployRoleDO OldbaseEmployRoleDO = this.employRoleDao.findOne(baseEmployRoleDO.getId());
//        if(null == OldbaseEmployRoleDO){
//            throw new ApiException(BaseUserRequestMapping.BaseEmployRole.message_fail_employeeRole_no_exist, ExceptionCode.common_error_params_code);
//        }
//        if (baseEmployRoleDO.getRoleId().equals(OldbaseEmployRoleDO.getRoleId())) {
//            throw new ApiException(BaseUserRequestMapping.BaseEmployRole.message_fail_same_roleId, ExceptionCode.common_error_params_code);
//        }
//        baseEmployRoleDO.setEmployId(OldbaseEmployRoleDO.getEmployId());
//        return this.employRoleDao.save(baseEmployRoleDO);
//    }
//
//
//    /**
//     * 查询某一用户的角色列表(用户与角色为一对多关系)
//     * @param employId
//     * @return
//     */
//    public List<BaseRoleDO> findAllByEmployId(String employId){
//        if (StringUtils.isEmpty(employId)) {
//            throw new ApiException(BaseUserRequestMapping.BaseEmployRole.message_fail_employId_is_null, ExceptionCode.common_error_params_code);
//        }
//        List<BaseEmployRoleDO> list = this.employRoleDao.findRoleListByEmployId(employId);
//        if (null == list || list.size() == 0) {
//            throw new ApiException(BaseUserRequestMapping.BaseEmployRole.message_fail_employeeRole_no_exist,ExceptionCode.common_error_params_code);
//        }
//        List ids = new ArrayList<>();
//        for(BaseEmployRoleDO baseEmployRoleDO:list){
//            ids.add(baseEmployRoleDO.getRoleId());
//        }
//        Iterable iterable = (Iterable)ids.iterator();
//        List<BaseRoleDO> result = (List<BaseRoleDO>)baseRoleDao.findAll(iterable);
//        return result;
//    }
//
//
//    /**
//     * 根据Id删除用户角色
//     * @param id
//     * @return
//     */
//    @Transactional
//    public void deleteBaseEmployRoleDO(String id){
//        try{
//            this.employRoleDao.delete(id);
//        }
//        catch (ApiException e){
//            throw new ApiException(BaseUserRequestMapping.BaseEmployRole.message_fail_id_is_null,ExceptionCode.common_error_params_code);
//        }
//
//    }
//
//    /**
//     * 根据用户Id和角色id删除用户角色
//     * @param employId
//     * @param roleIds
//     * @return
//     */
//    @Transactional
//    public void deleteBaseEmployRoleDO(String employId,String roleIds){
//        try{
//            this.employRoleDao.deleteOneByEmployIdAndRoleId(employId,roleIds);
//        }
//        catch (ApiException e){
//            throw new ApiException(BaseUserRequestMapping.BaseEmployRole.message_fail_id_is_null,ExceptionCode.common_error_params_code);
//        }
//
//    }
//
//    /**
//     * 批量删除用户角色
//     * @param employId
//     * @param roleIds
//     * @return
//     */
//    @Transactional
//    public void deleteBatchBaseEmployRoleDO(String employId,String roleIds){
//        try{
//            this.employRoleDao.deleteManyByEmployIdAndRoleIds(employId,roleIds);
//        }
//        catch (ApiException e){
//            throw new ApiException(BaseUserRequestMapping.BaseEmployRole.message_fail_id_is_null,ExceptionCode.common_error_params_code);
//        }
//
//    }
//
//}

+ 0 - 154
svr/svr-base/src/main/java/com/yihu/jw/business/user/service/EmployService.java

@ -1,154 +0,0 @@
//package com.yihu.jw.business.user.service;
//
//import com.yihu.jw.base.user.BaseEmployDO;
//import com.yihu.jw.base.user.BaseRoleDO;
//import com.yihu.jw.business.user.dao.EmployDao;
//import com.yihu.jw.exception.ApiException;
//import com.yihu.jw.exception.code.ExceptionCode;
//import com.yihu.jw.restmodel.common.base.BaseEnvelopStatus;
//import com.yihu.jw.rm.base.BaseUserRequestMapping;
//import com.yihu.mysql.query.BaseJpaService;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.cache.annotation.*;
//import org.springframework.http.HttpEntity;
//import org.springframework.http.HttpHeaders;
//import org.springframework.stereotype.Service;
//import org.springframework.transaction.annotation.Transactional;
//import org.springframework.util.LinkedMultiValueMap;
//import org.springframework.util.MultiValueMap;
//import org.springframework.util.StringUtils;
//
//import javax.servlet.Servlet;
//import java.util.List;
//
///**
// * Created by chenweida on 2017/5/11.
// * 用户信息功能
// */
//
//@Service
//@EnableCaching
//@CacheConfig(cacheNames = "employ")
//public class EmployService extends BaseJpaService<BaseEmployDO,EmployDao> {
//    @Autowired
//    private EmployDao employDao;
//
//    /**
//     * 创建用户
//     * @param employeeDO
//     * @return
//     */
//    @Cacheable(value = "employ#600#300")
//    @Transactional
//    public BaseEmployDO createBaseEmployDO(BaseEmployDO employeeDO){
//        if (StringUtils.isEmpty(employeeDO.getId())) {
//            throw new ApiException(BaseUserRequestMapping.BaseEmploy.message_fail_id_is_null, ExceptionCode.common_error_params_code);
//        }
//        if (StringUtils.isEmpty(employeeDO.getLeaderCode())) {
//            throw new ApiException(BaseUserRequestMapping.BaseEmploy.message_fail_saasid_is_null, ExceptionCode.common_error_params_code);
//        }
//        return this.employDao.save(employeeDO);
//    }
//
//    /**
//     * 更新用户
//     * @param employeeDO
//     * @return
//     */
//    @CachePut(value = "employ#600#300",key = "#employeeDO.id")
//    @Transactional
//    public BaseEmployDO updateBaseEmployDO(BaseEmployDO employeeDO){
//        if (StringUtils.isEmpty(employeeDO.getId())) {
//            throw new ApiException(BaseUserRequestMapping.BaseEmploy.message_fail_id_is_null, ExceptionCode.common_error_params_code);
//        }
//        if (StringUtils.isEmpty(employeeDO.getLeaderCode())) {
//            throw new ApiException(BaseUserRequestMapping.BaseEmploy.message_fail_saasid_is_null, ExceptionCode.common_error_params_code);
//        }
//        return this.employDao.save(employeeDO);
//    }
//
//    /**
//     * 根据Id查询用户
//     * @param id
//     * @return
//     */
////    @Cacheable(value = "employ#600#300",key = "#employeeDO.id")
//    public BaseEmployDO findById(String id){
//        if (StringUtils.isEmpty(id)) {
//            throw new ApiException(BaseUserRequestMapping.BaseEmploy.message_fail_id_is_null,ExceptionCode.common_error_params_code);
//        }
//        BaseEmployDO BaseEmployDO = this.employDao.findOne(id);
//        if (null == BaseEmployDO) {
//            throw new ApiException(BaseUserRequestMapping.BaseEmploy.message_fail_id_no_exist,ExceptionCode.common_error_params_code);
//        }
//        return BaseEmployDO;
//    }
//
//
//    /**
//     * 根据手机号和saasId查询用户,一个用户可能注册多个saas平台,所以根据手机号查找要限定saasId
//     * @param phone
//     * @param saasId
//     * @return
//     */
//    public BaseEmployDO findByPhoneAndSaasId(String phone,String saasId) throws ApiException{
//        BaseEmployDO BaseEmployDO = this.employDao.findByPhoneAndSaasId(phone,saasId);
//        if (null == BaseEmployDO) {
//            throw new ApiException(BaseEnvelopStatus.status_10100.getName(), BaseEnvelopStatus.status_10100.getCode());
//        }
//        return BaseEmployDO;
//    }
//
//    /**
//     * 查询某saasId平台下的所有用户
//     * @param saasId
//     * @return
//     */
//    @Cacheable(value = "employ#600#300",key = "#employeeDO.id")
//    public List<BaseEmployDO> findAllBySaasId(String saasId){
//        if (StringUtils.isEmpty(saasId)) {
//            throw new ApiException(BaseUserRequestMapping.BaseEmploy.message_param_saasid_is_null,ExceptionCode.common_error_params_code);
//        }
//        List<BaseEmployDO> list = this.employDao.findAllBySaasId(saasId);
//        if (null == list || list.size() == 0) {
//            throw new ApiException(BaseUserRequestMapping.BaseEmploy.message_fail_saasid_no_exist,ExceptionCode.common_error_params_code);
//        }
//        return list;
//    }
//
//    /**
//     * 查询name模糊查询某saasId平台下的所有用户
//     * @param saasId
//     * @return
//     */
//    @Cacheable(value = "employ#600#300",key = "#employeeDO.id")
//    public List<BaseEmployDO> findAllByNameAndSaasId(String name,String saasId){
//        if (StringUtils.isEmpty(saasId)) {
//            throw new ApiException(BaseUserRequestMapping.BaseEmploy.message_param_saasid_is_null,ExceptionCode.common_error_params_code);
//        }
//        List<BaseEmployDO> list = this.employDao.findAllByNameAndSaasId(name,saasId);
//        if (null == list || list.size() == 0) {
//            throw new ApiException(BaseUserRequestMapping.BaseEmploy.message_fail_saasid_no_exist,ExceptionCode.common_error_params_code);
//        }
//        return list;
//    }
//
//
//    /**
//     * 根据Id删除用户
//     * @param employDO
//     */
//    @CacheEvict(key = "#employDO.id")
//    @Transactional
//    public void deleteBaseEmploy(BaseEmployDO employDO){
//        if (StringUtils.isEmpty(employDO.getId())) {
//            throw new ApiException(BaseUserRequestMapping.BaseEmploy.message_fail_id_is_null, ExceptionCode.common_error_params_code);
//        }
//        if (StringUtils.isEmpty(employDO.getLeaderCode())) {
//            throw new ApiException(BaseUserRequestMapping.BaseEmploy.message_fail_saasid_is_null, ExceptionCode.common_error_params_code);
//        }
//        employDO.setStatus(-1);
//        this.employDao.save(employDO);
//    }
//
//}

+ 0 - 125
svr/svr-base/src/main/java/com/yihu/jw/business/version/controller/UserVersionController.java

@ -1,125 +0,0 @@
//package com.yihu.jw.business.version.controller;
//
//import com.yihu.jw.base.version.BaseUserVersionDO;
//import com.yihu.jw.business.version.service.BaseUserVersionService;
//import com.yihu.jw.exception.ApiException;
//import com.yihu.jw.restmodel.common.Envelop;
//import com.yihu.jw.restmodel.common.EnvelopRestController;
//import com.yihu.jw.rm.base.BaseVersionRequestMapping;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import io.swagger.annotations.ApiParam;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.http.MediaType;
//import org.springframework.web.bind.annotation.*;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import javax.ws.rs.PathParam;
//import java.util.ArrayList;
//import java.util.List;
//
///**
// * Created by chenweida on 2017/11/10.
// */
//@RestController
//@RequestMapping(BaseVersionRequestMapping.api_common)
//@Api(description = "灰度发布,用户版本信息")
//public class UserVersionController extends EnvelopRestController {
//    @Autowired
//    private BaseUserVersionService baseEmployeeVersionService;
//
//
//    @PostMapping(value = BaseVersionRequestMapping.UserVersion.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
//    @ApiOperation(value = "给用户添加灰度发布版本信息", notes = "给用户添加灰度发布版本信息")
//    public Envelop createUserVersion(
//            @ApiParam(name = "json_data", value = "", defaultValue = "")
//            @RequestBody String jsonData) {
//        try {
//            BaseUserVersionDO baseUserVersion = toEntity(jsonData, BaseUserVersionDO.class);
//            return Envelop.getSuccess(BaseVersionRequestMapping.UserVersion.message_success_create, baseEmployeeVersionService.createUserVersion(baseUserVersion));
//        } catch (ApiException e) {
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
//    }
//
//    @DeleteMapping(value = BaseVersionRequestMapping.UserVersion.api_delete, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
//    @ApiOperation(value = "删除用户灰度发布版本信息", notes = "删除用户灰度发布版本信息")
//    public Envelop deleteUsersVersion(
//            @ApiParam(name = "ids", value = "ids")
//            @RequestParam(value = "ids", required = true) String ids) {
//        try {
//            baseEmployeeVersionService.deleteUserVersion(ids);
//            return Envelop.getSuccess(BaseVersionRequestMapping.UserVersion.message_success_delete);
//        } catch (ApiException e) {
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
//    }
//
//    @GetMapping(value = BaseVersionRequestMapping.UserVersion.api_getByUserId, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
//    @ApiOperation(value = "根据用户和saadId获取用户的灰度发布版本信息", notes = "根据用户获取用户的灰度发布版本信息")
//    public Envelop getUserVersionByUserId(
//            @ApiParam(name = "userId", value = "userId")
//            @PathParam(value = "userId") String userId) {
//        try {
//            return Envelop.getSuccess(BaseVersionRequestMapping.UserVersion.message_success_find, baseEmployeeVersionService.getUserVersionByUserId(userId));
//        } catch (ApiException e) {
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
//    }
//    @GetMapping(value = BaseVersionRequestMapping.UserVersion.api_getById, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
//    @ApiOperation(value = "根据ID获取用户的灰度发布版本信息", notes = "根据ID获取用户的灰度发布版本信息")
//    public Envelop getUserVersion(
//            @ApiParam(name = "id", value = "id")
//            @RequestParam(value = "id", required = true) String id) {
//        try {
//            return Envelop.getSuccess(BaseVersionRequestMapping.UserVersion.message_success_find, baseEmployeeVersionService.getUserVersion(id));
//        } catch (ApiException e) {
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
//    }
//    @RequestMapping(value = BaseVersionRequestMapping.UserVersion.api_getList, method = RequestMethod.GET)
//    @ApiOperation(value = "获取用户的灰度发布版本信息(分页)", notes = "根据用户获取用户的灰度发布版本信息")
//    public Envelop getSmsGateways(
//            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "code,name,saasId,parentCode,remark")
//            @RequestParam(value = "fields", required = false) String fields,
//            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
//            //code like 1,name大于aa ,code 等于1 , defaultValue = "code?1;name>aa;code=1"
//            @RequestParam(value = "filters", required = false) String filters,
//            @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "+name,+createTime")
//            @RequestParam(value = "sorts", required = false) String sorts,
//            @ApiParam(name = "size", value = "分页大小", defaultValue = "15")
//            @RequestParam(value = "size", required = false) int size,
//            @ApiParam(name = "page", value = "页码", defaultValue = "1")
//            @RequestParam(value = "page", required = false) int page,
//            HttpServletRequest request,
//            HttpServletResponse response) throws Exception {
//        //得到list数据
//        List<BaseUserVersionDO> list = baseEmployeeVersionService.search(fields, filters, sorts, page, size);
//        //获取总数
//        long count=baseEmployeeVersionService.getCount(filters);
//        //封装头信息
//        pagedResponse(request, response, count, page, size);
//        //封装返回格式
//        List<BaseUserVersionDO> baseUserVersions = convertToModels(list, new ArrayList<>(list.size()), BaseUserVersionDO.class, fields);
//
//        return Envelop.getSuccessListWithPage(BaseVersionRequestMapping.UserVersion.message_success_find,baseUserVersions, page, size,count);
//    }
//
//
//    @GetMapping(value =BaseVersionRequestMapping.UserVersion.api_getListNoPage)
//    @ApiOperation(value = "获取用户的灰度发布版本信息,不分页")
//    public Envelop getAppsNoPage(
//            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "code,name,saasId,parentCode,remark")
//            @RequestParam(value = "fields", required = false) String fields,
//            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
//            @RequestParam(value = "filters", required = false) String filters,
//            @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "+name,+createTime")
//            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
//        //得到list数据
//        List<BaseUserVersionDO> list = baseEmployeeVersionService.search(fields,filters,sorts);
//        //封装返回格式
//        List<BaseUserVersionDO> baseUserVersions = convertToModels(list, new ArrayList<>(list.size()), BaseUserVersionDO.class, fields);
//        return Envelop.getSuccessList(BaseVersionRequestMapping.UserVersion.message_success_find,baseUserVersions);
//    }
//}

+ 0 - 14
svr/svr-base/src/main/java/com/yihu/jw/business/version/dao/BaseUserVersionDao.java

@ -1,14 +0,0 @@
//package com.yihu.jw.business.version.dao;
//
//import com.yihu.jw.base.version.BaseUserVersionDO;
//import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
//import org.springframework.data.jpa.repository.Query;
//import org.springframework.data.repository.PagingAndSortingRepository;
//
///**
// * Created by chenweida on 2017/11/13.
// */
//public interface BaseUserVersionDao extends PagingAndSortingRepository<BaseUserVersionDO, String>, JpaSpecificationExecutor<BaseUserVersionDO> {
//    @Query("from BaseUserVersionDO where userId=?1")
//    BaseUserVersionDO getUserVersionByUserId(String userId);
//}

+ 0 - 41
svr/svr-base/src/main/java/com/yihu/jw/business/version/service/BaseUserVersionService.java

@ -1,41 +0,0 @@
//package com.yihu.jw.business.version.service;
//
//import com.yihu.base.mysql.query.BaseJpaService;
//import com.yihu.jw.base.version.BaseUserVersionDO;
//import com.yihu.jw.business.sms.dao.SmsGatewayDao;
//import com.yihu.jw.business.version.dao.BaseUserVersionDao;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//import org.springframework.transaction.annotation.Transactional;
//
//import java.util.Arrays;
//
///**
// * Created by chenweida on 2017/11/10.
// */
//@Service
//public class BaseUserVersionService extends BaseJpaService<BaseUserVersionDO, BaseUserVersionDao> {
//    @Autowired
//    private BaseUserVersionDao baseUserVersionDao;
//
//    @Transactional
//    public BaseUserVersionDO createUserVersion(BaseUserVersionDO baseUserVersion) {
//        return baseUserVersionDao.save(baseUserVersion);
//    }
//
//    @Transactional
//    public void deleteUserVersion(String ids) {
//        String[] idStr = ids.split(",");
//        for (String id : idStr) {
//            baseUserVersionDao.delete(id);
//        }
//    }
//
//    public BaseUserVersionDO getUserVersionByUserId(String userId) {
//        return baseUserVersionDao.getUserVersionByUserId(userId);
//    }
//
//    public BaseUserVersionDO getUserVersion(String id) {
//        return baseUserVersionDao.findOne(id);
//    }
//}

+ 0 - 644
svr/svr-base/src/main/java/com/yihu/jw/business/wx/WechatResponse.java

@ -1,644 +0,0 @@
//package com.yihu.jw.business.wx;
//
///**
// * Created by Administrator on 2017/5/27 0027.
// */
//public class WechatResponse {
//    /**
//     * 微信返回值
//     * 具体见   https://mp.weixin.qq.com/wiki
//     *  -1       系统繁忙,此时请开发者稍候再试
//     *  0        请求成功
//     *  40001    获取access_token时AppSecret错误,或者access_token无效。请开发者认真比对AppSecret的正确性,或查看是否正在为恰当的公众号调用接口
//     *  40002    不合法的凭证类型
//     *  40003    不合法的OpenID,请开发者确认OpenID(该用户)是否已关注公众号,或是否是其他公众号的OpenID
//     *  40004    不合法的媒体文件类型
//     *  40005    不合法的文件类型
//     *  40006    不合法的文件大小
//     *  40007    不合法的媒体文件id
//     *  40008    不合法的消息类型
//     *  40009    不合法的图片文件大小
//     *  40010    不合法的语音文件大小
//     *  40011    不合法的视频文件大小
//     *  40012    不合法的缩略图文件大小
//     *  40013    不合法的AppID,请开发者检查AppID的正确性,避免异常字符,注意大小写
//     *  40014    不合法的access_token,请开发者认真比对access_token的有效性(如是否过期),或查看是否正在为恰当的公众号调用接口
//     *  40015    不合法的菜单类型
//     *  40016    不合法的按钮个数
//     *  40017    不合法的按钮个数
//     *  40018    不合法的按钮名字长度
//     *  40019    不合法的按钮KEY长度
//     *  40020    不合法的按钮URL长度
//     *  40021    不合法的菜单版本号
//     *  40022    不合法的子菜单级数
//     *  40023    不合法的子菜单按钮个数
//     *  40024    不合法的子菜单按钮类型
//     *  40025    不合法的子菜单按钮名字长度
//     *  40026    不合法的子菜单按钮KEY长度
//     *  40027    不合法的子菜单按钮URL长度
//     *  40028    不合法的自定义菜单使用用户
//     *  40029    不合法的oauth_code
//     *  40030    不合法的refresh_token
//     *  40031    不合法的openid列表
//     *  40032    不合法的openid列表长度
//     *  40033    不合法的请求字符,不能包含\  uxxxx格式的字符
//     *  40035    不合法的参数
//     *  40038    不合法的请求格式
//     *  40039    不合法的URL长度
//     *  40050    不合法的分组id
//     *  40051    分组名字不合法
//     *  40060    删除单篇图文时,指定的 article_idx 不合法
//     *  40117    分组名字不合法
//     *  40118    media_id大小不合法
//     *  40119    button类型错误
//     *  40120    button类型错误
//     *  40121    不合法的media_id类型
//     *  40132    微信号不合法
//     *  40137    不支持的图片格式
//     *  40155    请勿添加其他公众号的主页链接
//     *  41001    缺少access_token参数
//     *  41002    缺少appid参数
//     *  41003    缺少refresh_token参数
//     *  41004    缺少secret参数
//     *  41005    缺少多媒体文件数据
//     *  41006    缺少media_id参数
//     *  41007    缺少子菜单数据
//     *  41008    缺少oauth code
//     *  41009    缺少openid
//     *  42001    access_token超时,请检查access_token的有效期,请参考基础支持-获取access_token中,对access_token的详细机制说明
//     *  42002    refresh_token超时
//     *  42003    oauth_code超时
//     *  42007    用户修改微信密码,accesstoken和refreshtoken失效,需要重新授权
//     *  43001    需要GET请求
//     *  43002    需要POST请求
//     *  43003    需要HTTPS请求
//     *  43004    需要接收者关注
//     *  43005    需要好友关系
//     *  43019    需要将接收者从黑名单中移除
//     *  44001    多媒体文件为空
//     *  44002    POST的数据包为空
//     *  44003    图文消息内容为空
//     *  44004    文本消息内容为空
//     *  45001    多媒体文件大小超过限制
//     *  45002    消息内容超过限制
//     *  45003    标题字段超过限制
//     *  45004    描述字段超过限制
//     *  45005    链接字段超过限制
//     *  45006    图片链接字段超过限制
//     *  45007    语音播放时间超过限制
//     *  45008    图文消息超过限制
//     *  45009    接口调用超过限制
//     *  45010    创建菜单个数超过限制
//     *  45011    API调用太频繁,请稍候再试
//     *  45015    回复时间超过限制
//     *  45016    系统分组,不允许修改
//     *  45017    分组名字过长
//     *  45018    分组数量超过上限
//     *  45047    客服接口下行条数超过上限
//     *  46001    不存在媒体数据
//     *  46002    不存在的菜单版本
//     *  46003    不存在的菜单数据
//     *  46004    不存在的用户
//     *  47001    解析JSON/XML内容错误
//     *  48001    api功能未授权,请确认公众号已获得该接口,可以在公众平台官网-开发者中心页中查看接口权限
//     *  48002    粉丝拒收消息(粉丝在公众号选项中,关闭了“接收消息”)
//     *  48004    api接口被封禁,请登录mp.weixin.qq.com查看详情
//     *  48005    api禁止删除被自动回复和自定义菜单引用的素材
//     *  48006    api禁止清零调用次数,因为清零次数达到上限
//     *  50001    用户未授权该api
//     *  50002    用户受限,可能是违规后接口被封禁
//     *  61451    参数错误(invalid parameter)
//     *  61452    无效客服账号(invalid kf_account)
//     *  61453    客服帐号已存在(kf_account exsited)
//     *  61454    客服帐号名长度超过限制(仅允许10个英文字符,不包括@及@后的公众号的微信号)(invalid   kf_acount length)
//     *  61455    客服帐号名包含非法字符(仅允许英文+数字)(illegal character in     kf_account)
//     *  61456    客服帐号个数超过限制(10个客服账号)(kf_account count exceeded)
//     *  61457    无效头像文件类型(invalid   file type)
//     *  61450    系统错误(system error)
//     *  61500    日期格式错误
//     *  65301    不存在此menuid对应的个性化菜单
//     *  65302    没有相应的用户
//     *  65303    没有默认菜单,不能创建个性化菜单
//     *  65304    MatchRule信息为空
//     *  65305    个性化菜单数量受限
//     *  65306    不支持个性化菜单的帐号
//     *  65307    个性化菜单信息为空
//     *  65308    包含没有响应类型的button
//     *  65309    个性化菜单开关处于关闭状态
//     *  65310    填写了省份或城市信息,国家信息不能为空
//     *  65311    填写了城市信息,省份信息不能为空
//     *  65312    不合法的国家信息
//     *  65313    不合法的省份信息
//     *  65314    不合法的城市信息
//     *  65316    该公众号的菜单设置了过多的域名外跳(最多跳转到3个域名的链接)
//     *  65317    不合法的URL
//     *  9001001    POST数据参数不合法
//     *  9001002    远端服务不可用
//     *  9001003    Ticket不合法
//     *  9001004    获取摇周边用户信息失败
//     *  9001005    获取商户信息失败
//     *  9001006    获取OpenID失败
//     *  9001007    上传文件缺失
//     *  9001008    上传素材的文件类型不合法
//     *  9001009    上传素材的文件尺寸不合法
//     *  9001010    上传失败
//     *  9001020    帐号不合法
//     *  9001021    已有设备激活率低于50%,不能新增设备
//     *  9001022    设备申请数不合法,必须为大于0的数字
//     *  9001023    已存在审核中的设备ID申请
//     *  9001024    一次查询设备ID数量不能超过50
//     *  9001025    设备ID不合法
//     *  9001026    页面ID不合法
//     *  9001027    页面参数不合法
//     *  9001028    一次删除页面ID数量不能超过10
//     *  9001029    页面已应用在设备中,请先解除应用关系再删除
//     *  9001030    一次查询页面ID数量不能超过50
//     *  9001031    时间区间不合法
//     *  9001032    保存设备与页面的绑定关系参数错误
//     *  9001033    门店ID不合法
//     *  9001034    设备备注信息过长
//     *  9001035    设备申请参数不合法
//     *  9001036    查询起始值begin不合法
//     */
//    private Integer resultCode;
//
//    /** 返回码对应信息 ***/
//    private String msg;
//
//    public Integer getResultCode() {
//        return resultCode;
//    }
//
//    public void setResultCode(Integer resultCode) {
//        this.resultCode = resultCode;
//    }
//
//    public WechatResponse(Integer resultCode) {
//        this.resultCode = resultCode;
//    }
//
//    public String getMsg() {
//        switch (resultCode) {
//        case -1:
//            msg="系统繁忙,此时请开发者稍候再试";
//            break;
//        case 0:
//            msg="请求成功";
//            break;
//        case 40001:
//            msg="获取access_token时AppSecret错误,或者access_token无效。请开发者认真比对AppSecret的正确性,或查看是否正在为恰当的公众号调用接口";
//            break;
//        case 40002:
//            msg="不合法的凭证类型";
//            break;
//        case 40003:
//            msg="不合法的OpenID,请开发者确认OpenID(该用户)是否已关注公众号,或是否是其他公众号的OpenID";
//            break;
//        case 40004:
//            msg="不合法的媒体文件类型";
//            break;
//        case 40005:
//            msg="不合法的文件类型";
//            break;
//        case 40006:
//            msg="不合法的文件大小";
//            break;
//        case 40007:
//            msg="不合法的媒体文件id";
//            break;
//        case 40008:
//            msg="不合法的消息类型";
//            break;
//        case 40009:
//            msg="不合法的图片文件大小";
//            break;
//        case 40010:
//            msg="不合法的语音文件大小";
//            break;
//        case 40011:
//            msg="不合法的视频文件大小";
//            break;
//        case 40012:
//            msg="不合法的缩略图文件大小";
//            break;
//        case 40013:
//            msg="不合法的AppID,请开发者检查AppID的正确性,避免异常字符,注意大小写";
//            break;
//        case 40014:
//            msg="不合法的access_token,请开发者认真比对access_token的有效性(如是否过期),或查看是否正在为恰当的公众号调用接口";
//            break;
//        case 40015:
//            msg="不合法的菜单类型";
//            break;
//        case 40016:
//            msg="不合法的按钮个数";
//            break;
//        case 40017:
//            msg="不合法的按钮个数";
//            break;
//        case 40018:
//            msg="不合法的按钮名字长度";
//            break;
//        case 40019:
//            msg="不合法的按钮KEY长度";
//            break;
//        case 40020:
//            msg="不合法的按钮URL长度";
//            break;
//        case 40021:
//            msg="不合法的菜单版本号";
//            break;
//        case 40022:
//            msg="不合法的子菜单级数";
//            break;
//        case 40023:
//            msg="不合法的子菜单按钮个数";
//            break;
//        case 40024:
//            msg="不合法的子菜单按钮类型";
//            break;
//        case 40025:
//            msg="不合法的子菜单按钮名字长度";
//            break;
//        case 40026:
//            msg="不合法的子菜单按钮KEY长度";
//            break;
//        case 40027:
//            msg="不合法的子菜单按钮URL长度";
//            break;
//        case 40028:
//            msg="不合法的自定义菜单使用用户";
//            break;
//        case 40029:
//            msg="不合法的oauth_code";
//            break;
//        case 40030:
//            msg="不合法的refresh_token";
//            break;
//        case 40031:
//            msg="不合法的openid列表";
//            break;
//        case 40032:
//            msg="不合法的openid列表长度";
//            break;
//        case 40033:
//            msg="不合法的请求字符,不能包含\\uxxxx格式的字符";
//            break;
//        case 40035:
//            msg="不合法的参数";
//            break;
//        case 40038:
//            msg="不合法的请求格式";
//            break;
//        case 40039:
//            msg="不合法的URL长度";
//            break;
//        case 40050:
//            msg="不合法的分组id";
//            break;
//        case 40051:
//            msg="分组名字不合法";
//            break;
//        case 40060:
//            msg="删除单篇图文时,指定的 article_idx 不合法";
//            break;
//        case 40117:
//            msg="分组名字不合法";
//            break;
//        case 40118:
//            msg="media_id大小不合法";
//            break;
//        case 40119:
//            msg="button类型错误";
//            break;
//        case 40120:
//            msg="button类型错误";
//            break;
//        case 40121:
//            msg="不合法的media_id类型";
//            break;
//        case 40132:
//            msg="微信号不合法";
//            break;
//        case 40137:
//            msg="不支持的图片格式";
//            break;
//        case 40155:
//            msg="请勿添加其他公众号的主页链接";
//            break;
//        case 41001:
//            msg="缺少access_token参数";
//            break;
//        case 41002:
//            msg="缺少appid参数";
//            break;
//        case 41003:
//            msg="缺少refresh_token参数";
//            break;
//        case 41004:
//            msg="缺少secret参数";
//            break;
//        case 41005:
//            msg="缺少多媒体文件数据";
//            break;
//        case 41006:
//            msg="缺少media_id参数";
//            break;
//        case 41007:
//            msg="缺少子菜单数据";
//            break;
//        case 41008:
//            msg="缺少oauth code";
//            break;
//        case 41009:
//            msg="缺少openid";
//            break;
//        case 42001:
//            msg="access_token超时,请检查access_token的有效期,请参考基础支持-获取access_token中,对access_token的详细机制说明";
//            break;
//        case 42002:
//            msg="refresh_token超时";
//            break;
//        case 42003:
//            msg="oauth_code超时";
//            break;
//        case 42007:
//            msg="用户修改微信密码,accesstoken和refreshtoken失效,需要重新授权";
//            break;
//        case 43001:
//            msg="需要GET请求";
//            break;
//        case 43002:
//            msg="需要POST请求";
//            break;
//        case 43003:
//            msg="需要HTTPS请求";
//            break;
//        case 43004:
//            msg="需要接收者关注";
//            break;
//        case 43005:
//            msg="需要好友关系";
//            break;
//        case 43019:
//            msg="需要将接收者从黑名单中移除";
//            break;
//        case 44001:
//            msg="多媒体文件为空";
//            break;
//        case 44002:
//            msg="POST的数据包为空";
//            break;
//        case 44003:
//            msg="图文消息内容为空";
//            break;
//        case 44004:
//            msg="文本消息内容为空";
//            break;
//        case 45001:
//            msg="多媒体文件大小超过限制";
//            break;
//        case 45002:
//            msg="消息内容超过限制";
//            break;
//        case 45003:
//            msg="标题字段超过限制";
//            break;
//        case 45004:
//            msg="描述字段超过限制";
//            break;
//        case 45005:
//            msg="链接字段超过限制";
//            break;
//        case 45006:
//            msg="图片链接字段超过限制";
//            break;
//        case 45007:
//            msg="语音播放时间超过限制";
//            break;
//        case 45008:
//            msg="图文消息超过限制";
//            break;
//        case 45009:
//            msg="接口调用超过限制";
//            break;
//        case 45010:
//            msg="创建菜单个数超过限制";
//            break;
//        case 45011:
//            msg="API调用太频繁,请稍候再试";
//            break;
//        case 45015:
//            msg="回复时间超过限制";
//            break;
//        case 45016:
//            msg="系统分组,不允许修改";
//            break;
//        case 45017:
//            msg="分组名字过长";
//            break;
//        case 45018:
//            msg="分组数量超过上限";
//            break;
//        case 45047:
//            msg="客服接口下行条数超过上限";
//            break;
//        case 46001:
//            msg="不存在媒体数据";
//            break;
//        case 46002:
//            msg="不存在的菜单版本";
//            break;
//        case 46003:
//            msg="不存在的菜单数据";
//            break;
//        case 46004:
//            msg="不存在的用户";
//            break;
//        case 47001:
//            msg="解析JSON/XML内容错误";
//            break;
//        case 48001:
//            msg="api功能未授权,请确认公众号已获得该接口,可以在公众平台官网-开发者中心页中查看接口权限";
//            break;
//        case 48002:
//            msg="粉丝拒收消息(粉丝在公众号选项中,关闭了“接收消息”)";
//            break;
//        case 48004:
//            msg="api接口被封禁,请登录mp.weixin.qq.com查看详情";
//            break;
//        case 48005:
//            msg="api禁止删除被自动回复和自定义菜单引用的素材";
//            break;
//        case 48006:
//            msg="api禁止清零调用次数,因为清零次数达到上限";
//            break;
//        case 50001:
//            msg="用户未授权该api";
//            break;
//        case 50002:
//            msg="用户受限,可能是违规后接口被封禁";
//            break;
//        case 61451:
//            msg="参数错误(invalid parameter)";
//            break;
//        case 61452:
//            msg="无效客服账号(invalid kf_account)";
//            break;
//        case 61453:
//            msg="客服帐号已存在(kf_account exsited)";
//            break;
//        case 61454:
//            msg="客服帐号名长度超过限制(仅允许10个英文字符,不包括@及@后的公众号的微信号)(invalid kf_acount length)";
//            break;
//        case 61455:
//            msg="客服帐号名包含非法字符(仅允许英文+数字)(illegal character in kf_account)";
//            break;
//        case 61456:
//            msg="客服帐号个数超过限制(10个客服账号)(kf_account count exceeded)";
//            break;
//        case 61457:
//            msg="无效头像文件类型(invalid file type)";
//            break;
//        case 61450:
//            msg="系统错误(system error)";
//            break;
//        case 61500:
//            msg="日期格式错误";
//            break;
//        case 65301:
//            msg="不存在此menuid对应的个性化菜单";
//            break;
//        case 65302:
//            msg="没有相应的用户";
//            break;
//        case 65303:
//            msg="没有默认菜单,不能创建个性化菜单";
//            break;
//        case 65304:
//            msg="MatchRule信息为空";
//            break;
//        case 65305:
//            msg="个性化菜单数量受限";
//            break;
//        case 65306:
//            msg="不支持个性化菜单的帐号";
//            break;
//        case 65307:
//            msg="个性化菜单信息为空";
//            break;
//        case 65308:
//            msg="包含没有响应类型的button";
//            break;
//        case 65309:
//            msg="个性化菜单开关处于关闭状态";
//            break;
//        case 65310:
//            msg="填写了省份或城市信息,国家信息不能为空";
//            break;
//        case 65311:
//            msg="填写了城市信息,省份信息不能为空";
//            break;
//        case 65312:
//            msg="不合法的国家信息";
//            break;
//        case 65313:
//            msg="不合法的省份信息";
//            break;
//        case 65314:
//            msg="不合法的城市信息";
//            break;
//        case 65316:
//            msg="该公众号的菜单设置了过多的域名外跳(最多跳转到3个域名的链接)";
//            break;
//        case 65317:
//            msg="不合法的URL";
//            break;
//        case 9001001:
//            msg="POST数据参数不合法";
//            break;
//        case 9001002:
//            msg="远端服务不可用";
//            break;
//        case 9001003:
//            msg="Ticket不合法";
//            break;
//        case 9001004:
//            msg="获取摇周边用户信息失败";
//            break;
//        case 9001005:
//            msg="获取商户信息失败";
//            break;
//        case 9001006:
//            msg="获取OpenID失败";
//            break;
//        case 9001007:
//            msg="上传文件缺失";
//            break;
//        case 9001008:
//            msg="上传素材的文件类型不合法";
//            break;
//        case 9001009:
//            msg="上传素材的文件尺寸不合法";
//            break;
//        case 9001010:
//            msg="上传失败";
//            break;
//        case 9001020:
//            msg="帐号不合法";
//            break;
//        case 9001021:
//            msg="已有设备激活率低于50%,不能新增设备";
//            break;
//        case 9001022:
//            msg="设备申请数不合法,必须为大于0的数字";
//            break;
//        case 9001023:
//            msg="已存在审核中的设备ID申请";
//            break;
//        case 9001024:
//            msg="一次查询设备ID数量不能超过50";
//            break;
//        case 9001025:
//            msg="设备ID不合法";
//            break;
//        case 9001026:
//            msg="页面ID不合法";
//            break;
//        case 9001027:
//            msg="页面参数不合法";
//            break;
//        case 9001028:
//            msg="一次删除页面ID数量不能超过10";
//            break;
//        case 9001029:
//            msg="页面已应用在设备中,请先解除应用关系再删除";
//            break;
//        case 9001030:
//            msg="一次查询页面ID数量不能超过50";
//            break;
//        case 9001031:
//            msg="时间区间不合法";
//            break;
//        case 9001032:
//            msg="保存设备与页面的绑定关系参数错误";
//            break;
//        case 9001033:
//            msg="门店ID不合法";
//            break;
//        case 9001034:
//            msg="设备备注信息过长";
//            break;
//        case 9001035:
//            msg="设备申请参数不合法";
//            break;
//        case 9001036:
//            msg="查询起始值begin不合法";
//            break;
//        default:
//            msg = resultCode+":其他错误";
//            break;
//        }
//        return msg;
//    }
//}

+ 0 - 138
svr/svr-base/src/main/java/com/yihu/jw/business/wx/controller/WechatConfigController.java

@ -1,138 +0,0 @@
//package com.yihu.jw.business.wx.controller;
//
//import com.yihu.jw.base.wx.WxWechatDO;
//import com.yihu.jw.business.wx.service.WechatService;
//import com.yihu.jw.exception.ApiException;
//import com.yihu.jw.restmodel.common.Envelop;
//import com.yihu.jw.restmodel.common.EnvelopRestController;
//import com.yihu.jw.restmodel.base.wx.WxWechatVO;
//import com.yihu.jw.rm.base.WechatRequestMapping;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import io.swagger.annotations.ApiParam;
//import org.apache.commons.lang.StringUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.http.MediaType;
//import org.springframework.web.bind.annotation.*;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.util.ArrayList;
//import java.util.List;
//
///**
// * Created by chenweida on 2017/5/11.
// */
//@RestController
//@RequestMapping(WechatRequestMapping.api_common)
//@Api(value = "微信相关操作", description = "微信相关操作")
//public class WechatConfigController extends EnvelopRestController {
//    @Autowired
//    private WechatService wechatService;
//
//    @PostMapping(value = WechatRequestMapping.WxConfig.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
//    @ApiOperation(value = "创建微信配置", notes = "创建微信配置")
//    public Envelop createWechat(
//            @ApiParam(name = "json_data", value = "", defaultValue = "")
//            @RequestBody String jsonData) {
//        try {
//            WxWechatDO wechat = toEntity(jsonData, WxWechatDO.class);
//            return Envelop.getSuccess(WechatRequestMapping.WxConfig.message_success_create, wechatService.createWechat(wechat));
//        } catch (ApiException e) {
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
//    }
//
//    @PutMapping(value = WechatRequestMapping.WxConfig.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
//    @ApiOperation(value = "修改微信配置", notes = "修改微信配置")
//    public Envelop updateWechat(
//            @ApiParam(name = "json_data", value = "", defaultValue = "")
//            @RequestBody String jsonData) {
//        try {
//            WxWechatDO wechat = toEntity(jsonData, WxWechatDO.class);
//            return Envelop.getSuccess(WechatRequestMapping.WxConfig.message_success_update, wechatService.updateWxchat(wechat));
//        } catch (ApiException e) {
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
//    }
//
//
//    @DeleteMapping(value = WechatRequestMapping.WxConfig.api_delete)
//    @ApiOperation(value = "删除微信配置", notes = "删除微信配置")
//    public Envelop deleteWechat(
//            @ApiParam(name = "ids", value = "ids")
//            @RequestParam(value = "ids", required = true) String ids,
//            @ApiParam(name = "userId", value = "userId")
//            @RequestParam(value = "userId", required = true) String userId,
//            @ApiParam(name = "userName", value = "userName")
//            @RequestParam(value = "userName", required = true) String userName
//            ) {
//        try {
//            wechatService.deleteWechat(ids,userId,userName);
//            return Envelop.getSuccess(WechatRequestMapping.WxConfig.message_success_delete );
//        } catch (ApiException e) {
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
//    }
//
//    @GetMapping(value = WechatRequestMapping.WxConfig.api_getById)
//    @ApiOperation(value = "根据Id查找微信配置", notes = "根据code查找微信配置")
//    public Envelop findById(
//            @ApiParam(name = "id", value = "id")
//            @RequestParam(value = "id", required = true) String id
//    ) {
//        try {
//            return Envelop.getSuccess(WechatRequestMapping.WxConfig.message_success_find, wechatService.findById(id));
//        } catch (ApiException e) {
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
//    }
//
//    @RequestMapping(value = WechatRequestMapping.WxConfig.api_getWechats, method = RequestMethod.GET)
//    @ApiOperation(value = "获取微信配置列表(分页)")
//    public Envelop getWechats(
//            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
//            @RequestParam(value = "fields", required = false) String fields,
//            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
//            @RequestParam(value = "filters", required = false) String filters,
//            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
//            @RequestParam(value = "sorts", required = false) String sorts,
//            @ApiParam(name = "size", value = "分页大小", defaultValue = "15")
//            @RequestParam(value = "size", required = false) int size,
//            @ApiParam(name = "page", value = "页码", defaultValue = "1")
//            @RequestParam(value = "page", required = false) int page,
//            HttpServletRequest request,
//            HttpServletResponse response) throws Exception {
//        if(StringUtils.isBlank(sorts)){
//            sorts = "-updateTime";
//        }
//        //得到list数据
//        List<WxWechatDO> list = wechatService.search(fields, filters, sorts, page, size);
//        //获取总数
//        long count=wechatService.getCount(filters);
//        //封装头信息
//        pagedResponse(request, response, count, page, size);
//        //封装返回格式
//        List<WxWechatVO> WxWechatVOs = convertToModels(list, new ArrayList<>(list.size()), WxWechatVO.class, fields);
//
//        return Envelop.getSuccessListWithPage(WechatRequestMapping.WxConfig.message_success_find_functions,WxWechatVOs, page, size,count);
//    }
//
//
//    @GetMapping(value = WechatRequestMapping.WxConfig.api_getWechatNoPage)
//    @ApiOperation(value = "获取微信列表配置,不分页")
//    public Envelop getWechatNoPage(
//            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,name,saasId,appId,appSecret,baseUrl,remark")
//            @RequestParam(value = "fields", required = false) String fields,
//            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
//            @RequestParam(value = "filters", required = false) String filters,
//            @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "+name,+createTime")
//            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
//        //得到list数据
//        List<WxWechatDO> list = wechatService.search(fields,filters,sorts);
//        //封装返回格式
//        List<WxWechatVO> WxWechatVOs = convertToModels(list, new ArrayList<>(list.size()), WxWechatVO.class, fields);
//        return Envelop.getSuccessList(WechatRequestMapping.WxConfig.message_success_find_functions,WxWechatVOs);
//    }
//
//}

+ 0 - 182
svr/svr-base/src/main/java/com/yihu/jw/business/wx/controller/WechatCoreController.java

@ -1,182 +0,0 @@
//package com.yihu.jw.business.wx.controller;
//
//import com.yihu.jw.business.wx.service.WechatCoreService;
//import com.yihu.jw.entity.base.wx.WxWechatDO;
//import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
//import com.yihu.jw.rm.base.BaseRequestMapping;
//import com.yihu.jw.rm.base.WechatRequestMapping;
//import io.swagger.annotations.Api;
//import org.apache.commons.lang3.StringUtils;
//import org.json.JSONObject;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestMethod;
//import org.springframework.web.bind.annotation.ResponseBody;
//import org.springframework.web.bind.annotation.RestController;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.security.MessageDigest;
//import java.security.NoSuchAlgorithmException;
//import java.util.Arrays;
//import java.util.List;
//
///**
// * Created by Trick on 2018/8/16.
// */
//@RestController
//@RequestMapping(BaseRequestMapping.WeChat.PREFIX)
//@Api(value = "微信回调及事件处理", description = "微信回调及事件处理")
//public class WechatCoreController extends EnvelopRestEndpoint {
//
//    private Logger logger = LoggerFactory.getLogger(WechatCoreController.class);
//
//    @Autowired
//    private WechatCoreService wechatCoreService;
//
//    /**
//     * 微信接口验证
//     *
//     * @param request
//     * @param response
//     */
//    @RequestMapping(method = RequestMethod.GET)
//    @ResponseBody
//    public void checkSignature(HttpServletRequest request, HttpServletResponse response) throws Exception {
//        String signature = request.getParameter("signature").toString();
//        String timestamp = request.getParameter("timestamp").toString();
//        String nonce = request.getParameter("nonce").toString();
//        String echostr = request.getParameter("echostr").toString();
//
//        if (validate(signature, timestamp, nonce)) {
//            // 验证成功,返回验证码
//            response.getWriter().print(echostr);
//        } else {
//            // 验证失败
//            response.setStatus(401);
//        }
//
//    }
//
//    /**
//     * 接收居民微信回复的消息
//     *
//     * @return
//     */
//    @RequestMapping(method = RequestMethod.POST)
//    @ResponseBody
//    public void receiveMessages(HttpServletRequest request, HttpServletResponse response) throws Exception{
//
//        String signature = request.getParameter("signature").toString();
//        String timestamp = request.getParameter("timestamp").toString();
//        String nonce = request.getParameter("nonce").toString();
//
//        if (validate(signature, timestamp, nonce)) {
//            String xmlStr = wechatCoreService.messageProcess(request);
//            // 判断返回值是xml、json格式(取关是空串)
//            Boolean flag = wechatCoreService.isXML(xmlStr);
//            if (xmlStr == "error") {
//                // 服务器错误
//                response.setStatus(500);
//            } else if (!flag && StringUtils.isNotEmpty(xmlStr)) {
//                JSONObject json = new JSONObject(xmlStr);
////                    if (json.has("openId")) {
////                        if (StringUtils.isNotEmpty(json.getString("openId")) && !("undefined".equals(json.getString("openId")))) {
////                            pushMsgTask.putWxMsg(getAccessToken(), json.getInt("type"), json.getString("openId"), null, json);
////                        }
////                    }
//            } else {
//                // 返回消息(图文消息)
//                response.setHeader("Content-type", "text/html;charset=UTF-8");
//                //这句话的意思,是告诉servlet用UTF-8转码,而不是用默认的ISO8859
//                response.setCharacterEncoding("UTF-8");
//
//                logger.info(xmlStr);
//
//                response.getWriter().print(xmlStr);
//            }
//        } else {
//            // 验证失败
//            response.setStatus(401);
//        }
//
//    }
//
//
//    /**
//     * 微信推送消息验证
//     *
//     * @param signature
//     * @param timestamp
//     * @param nonce
//     * @return
//     * @throws NoSuchAlgorithmException
//     */
//    private boolean validate(String signature, String timestamp, String nonce) throws NoSuchAlgorithmException {
//
//        //查询平台所有微信token
//        List<WxWechatDO> wxs =  wechatCoreService.findAll();
//
//        if(wxs!=null&&wxs.size()>0){
//
//            for(WxWechatDO wx :wxs){
//
//                String token = wx.getToken();
//                // 字典序排序
//                String[] array = new String[]{token, timestamp, nonce};
//                Arrays.sort(array);
//                //连接字典序排序后字符串
//                String content = "";
//                for (String str : array) {
//                    content += str;
//                }
//                // 解析
//                MessageDigest md = MessageDigest.getInstance("SHA-1");
//                String decodeStr = "";
//                byte[] bytes = md.digest(content.getBytes());
//                decodeStr = byteToStr(bytes);
//                //验证
//                if (StringUtils.isNotEmpty(decodeStr) && decodeStr.equals(signature.toUpperCase())) {
//                    return true;
//                }
//            }
//        }
//        return false;
//    }
//    /**
//     * 将字节转换为字符
//     *
//     * @param mByte
//     * @return
//     */
//    private static String byteToHexStr(byte mByte) {
//        char[] Digit = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
//        char[] tempArr = new char[2];
//        tempArr[0] = Digit[(mByte >>> 4) & 0X0F];
//        tempArr[1] = Digit[mByte & 0X0F];
//        String s = new String(tempArr);
//        return s;
//    }
//
//    /**
//     * 将字节数组转换为字符串
//     *
//     * @param byteArray
//     * @return
//     */
//    private static String byteToStr(byte[] byteArray) {
//        String strDigest = "";
//        for (int i = 0; i < byteArray.length; i++) {
//            strDigest += byteToHexStr(byteArray[i]);
//        }
//        return strDigest;
//    }
//
//    @RequestMapping(value ="test", method = RequestMethod.POST)
//    @ResponseBody
//    public String  testProcess() throws Exception{
//        return wechatCoreService.testProcess();
//    }
//}

+ 0 - 47
svr/svr-base/src/main/java/com/yihu/jw/business/wx/controller/WxAccessTokenController.java

@ -1,47 +0,0 @@
//package com.yihu.jw.business.wx.controller;
//
//import com.yihu.jw.base.wx.WxAccessTokenDO;
//import com.yihu.jw.business.wx.service.WxAccessTokenService;
//import com.yihu.jw.exception.ApiException;
//import com.yihu.jw.restmodel.common.Envelop;
//import com.yihu.jw.restmodel.common.EnvelopRestController;
//import com.yihu.jw.rm.base.WechatRequestMapping;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import io.swagger.annotations.ApiParam;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestParam;
//import org.springframework.web.bind.annotation.RestController;
//
///**
// * Created by cyx on 2017/5/11.
// */
//@RestController
//@RequestMapping(WechatRequestMapping.api_common)
//@Api(value = "微信token模块", description = "微信token模块接口管理")
//public class WxAccessTokenController extends EnvelopRestController {
//
//    @Autowired
//    private WxAccessTokenService wxAccessTokenService;
//
//    /**
//     * 根据wechatCode获取WxAccessToken
//     * @param wechatId
//     * @return MWxAccessToken
//     * @throws Exception
//     */
//    @GetMapping(value = WechatRequestMapping.WxAccessToken.api_get)
//    @ApiOperation(value = "根据wechatId获取最新的WxAccessToken")
//    public Envelop getWxAccessToken(
//            @ApiParam(name = "wechatId", value = "wechatId")
//            @RequestParam(value = "wechatId") String wechatId) {
//        try {
//            WxAccessTokenDO wxAccessToken = wxAccessTokenService.getWxAccessTokenById(wechatId);
//            return Envelop.getSuccess(WechatRequestMapping.WxAccessToken.message_success_get, wxAccessToken);
//        }catch (ApiException e) {
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
//    }
//}

+ 0 - 164
svr/svr-base/src/main/java/com/yihu/jw/business/wx/controller/WxGraphicMessageController.java

@ -1,164 +0,0 @@
//package com.yihu.jw.business.wx.controller;
//
//import com.yihu.jw.base.wx.WxGraphicMessageDO;
//import com.yihu.jw.business.wx.service.WxGraphicMessageService;
//import com.yihu.jw.exception.ApiException;
//import com.yihu.jw.restmodel.common.Envelop;
//import com.yihu.jw.restmodel.common.EnvelopRestController;
//import com.yihu.jw.restmodel.base.wx.WxGraphicMessageVO;
//import com.yihu.jw.rm.base.WechatRequestMapping;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import io.swagger.annotations.ApiParam;
//import org.apache.commons.lang.StringUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.http.MediaType;
//import org.springframework.web.bind.annotation.*;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.util.ArrayList;
//import java.util.List;
//
///**
// *   2017/5/11.
// */
//@RestController
//@RequestMapping(WechatRequestMapping.api_common)
//@Api(value = "微信图文相关操作", description = "微信图文相关操作")
//public class WxGraphicMessageController extends EnvelopRestController {
//    @Autowired
//    private WxGraphicMessageService wxGraphicMessageService;
//
//    @PostMapping(value = WechatRequestMapping.WxGraphicMessage.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
//    @ApiOperation(value = "创建微信图文消息", notes = "创建微信图文消息")
//    public Envelop createWxGraphicMessage(
//            @ApiParam(name = "json_data", value = "", defaultValue = "")
//            @RequestBody String jsonData) {
//        try {
//            WxGraphicMessageDO WxGraphicMessage = toEntity(jsonData, WxGraphicMessageDO.class);
//            return Envelop.getSuccess(WechatRequestMapping.WxGraphicMessage.message_success_create, wxGraphicMessageService.createWxGraphicMessage(WxGraphicMessage));
//        } catch (ApiException e) {
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
//    }
//
//
//    @PutMapping(value = WechatRequestMapping.WxGraphicMessage.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
//    @ApiOperation(value = "修改微信图文消息", notes = "修改微信图文消息")
//    public Envelop updateWxGraphicMessage(
//            @ApiParam(name = "json_data", value = "", defaultValue = "")
//            @RequestBody String jsonData) {
//        try {
//            WxGraphicMessageDO WxGraphicMessage = toEntity(jsonData, WxGraphicMessageDO.class);
//            return Envelop.getSuccess(WechatRequestMapping.WxGraphicMessage.message_success_update, wxGraphicMessageService.updateWxGraphicMessage(WxGraphicMessage));
//        } catch (ApiException e) {
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
//    }
//
//
//    @DeleteMapping(value = WechatRequestMapping.WxGraphicMessage.api_delete)
//    @ApiOperation(value = "删除微信图文消息", notes = "删除微信图文消息")
//    public Envelop deleteWxGraphicMessage(
//            @ApiParam(name = "codes", value = "codes")
//            @RequestParam(value = "codes", required = true) String codes,
//            @ApiParam(name = "userCode", value = "userCode")
//            @RequestParam(value = "userCode", required = true) String userCode,
//            @ApiParam(name = "userName", value = "userName")
//            @RequestParam(value = "userName", required = true) String userName
//    ) {
//        try {
//            wxGraphicMessageService.deleteWxGraphicMessage(codes, userCode, userName);
//            return Envelop.getSuccess(WechatRequestMapping.WxGraphicMessage.message_success_delete );
//        } catch (ApiException e) {
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
//    }
//
//    @GetMapping(value = WechatRequestMapping.WxGraphicMessage.api_getById)
//    @ApiOperation(value = "根据code查找微信图文消息", notes = "根据code查找微信图文消息")
//    public Envelop findByCode(
//            @ApiParam(name = "id", value = "id")
//            @RequestParam(value = "id", required = true) String id
//    ) {
//        try {
//            return Envelop.getSuccess(WechatRequestMapping.WxGraphicMessage.message_success_find, wxGraphicMessageService.findById(id));
//        } catch (ApiException e) {
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
//    }
//
//    @RequestMapping(value = WechatRequestMapping.WxGraphicMessage.api_getWxGraphicMessages, method = RequestMethod.GET)
//    @ApiOperation(value = "获取微信图文消息列表(分页)")
//    public Envelop getWxGraphicMessages(
//            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,title,description,url,pic_url,remark,status")
//            @RequestParam(value = "fields", required = false) String fields,
//            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
//            @RequestParam(value = "filters", required = false) String filters,
//            @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "+title,+createTime")
//            @RequestParam(value = "sorts", required = false) String sorts,
//            @ApiParam(name = "size", value = "分页大小", defaultValue = "15")
//            @RequestParam(value = "size", required = false) int size,
//            @ApiParam(name = "page", value = "页码", defaultValue = "1")
//            @RequestParam(value = "page", required = false) int page,
//            HttpServletRequest request,
//            HttpServletResponse response) throws Exception {
//        if(StringUtils.isBlank(sorts)){
//            sorts = "-updateTime";
//        }
//        //得到list数据
//        List<WxGraphicMessageDO> list = wxGraphicMessageService.search(fields, filters, sorts, page, size);
//        //获取总数
//        long count=wxGraphicMessageService.getCount(filters);
//        //封装头信息
//        pagedResponse(request, response, count, page, size);
//        //封装返回格式
//        List<WxGraphicMessageVO> WxGraphicMessageVOs = convertToModels(list, new ArrayList<>(list.size()), WxGraphicMessageVO.class, fields);
//
//        return Envelop.getSuccessListWithPage(WechatRequestMapping.WxGraphicMessage.message_success_find_functions,WxGraphicMessageVOs, page, size,count);
//    }
//
//
//    @GetMapping(value = WechatRequestMapping.WxGraphicMessage.api_getWxGraphicMessageNoPage)
//    @ApiOperation(value = "获取图文消息列表,不分页")
//    public Envelop getWxGraphicMessageNoPage(
//            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,title,description,url,pic_url,remark,status")
//            @RequestParam(value = "fields", required = false) String fields,
//            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
//            @RequestParam(value = "filters", required = false) String filters,
//            @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "+title,+createTime")
//            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
//        //得到list数据
//        List<WxGraphicMessageDO> list = wxGraphicMessageService.search(fields,filters,sorts);
//        //封装返回格式
//        List<WxGraphicMessageVO> WxGraphicMessageVOs = convertToModels(list, new ArrayList<>(list.size()), WxGraphicMessageVO.class, fields);
//        return Envelop.getSuccessList(WechatRequestMapping.WxGraphicMessage.message_success_find_functions,WxGraphicMessageVOs);
//    }
//
//    //@GetMapping(value = WlyyContants.WxGraphicMessage.api_sendGraphicMessages)
//    //@ApiOperation(value = "发送图文消息")
//    //public Envelop sendGraphicMessages(
//    //        @ApiParam(name = "codes", value = "根据code发送微信图文消息,多个code用,分割")
//    //        @RequestParam(value = "codes", required = true) String codes,HttpServletRequest request) throws Exception {
//    //    String messages = wxGraphicMessageService.sendGraphicMessages(codes, request);
//    //    return Envelop.getSuccess("成功",messages);
//    //}
//
//    @GetMapping(value = WechatRequestMapping.WxGraphicMessage.api_sendGraphicMessages)
//    @ApiOperation(value = "发送图文消息")
//    @ResponseBody
//    public String sendGraphicMessages(
//            @ApiParam(name = "ids", value = "根据code发送微信图文消息,多个code用,分割")
//            @RequestParam(value = "ids", required = true) String ids,
//            @ApiParam(name = "fromUserName", value = "用户openid")
//            @RequestParam(value = "fromUserName", required = true) String fromUserName,
//            @ApiParam(name = "toUserName", value = "公众号")
//            @RequestParam(value = "toUserName", required = true) String toUserName
//            ) throws Exception {
//        String messages = wxGraphicMessageService.sendGraphicMessages(ids, fromUserName,toUserName);
//        return messages;
//    }
//
//
//}

+ 0 - 220
svr/svr-base/src/main/java/com/yihu/jw/business/wx/controller/WxMenuController.java

@ -1,220 +0,0 @@
//package com.yihu.jw.business.wx.controller;
//
//import com.yihu.jw.business.wx.service.WechatService;
//import com.yihu.jw.business.wx.service.WxMenuService;
//import com.yihu.jw.exception.ApiException;
//import com.yihu.jw.restmodel.web.MixEnvelop;
//import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
//import com.yihu.jw.rm.base.WechatRequestMapping;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import io.swagger.annotations.ApiParam;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.http.MediaType;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestParam;
//import org.springframework.web.bind.annotation.RestController;
//
///**
// * Created by Administrator on 2017/5/19 0019.
// */
//@RestController
//@RequestMapping(WechatRequestMapping.api_common)
//@Api(value = "微信菜单相关操作", description = "微信菜单相关操作")
//public class WxMenuController extends EnvelopRestEndpoint {
//
//    @Autowired
//    private WxMenuService wxMenuService;
//
//    @Autowired
//    private WechatService wechatService;
//
//    @PostMapping(value = WechatRequestMapping.WxMenu.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
//    @ApiOperation(value = "添加微信菜单", notes = "添加微信菜单")
//    public MixEnvelop createWxMenu(@ApiParam(name = "wxId", value = "微信id")
//                                    @RequestParam(value = "wxId", required = false)String wxId) throws Exception{
//        return wxMenuService.createWxMenu(wxId);
//    }
//
////    @PutMapping(value = WechatRequestMapping.WxMenu.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
////    @ApiOperation(value = "修改微信菜单", notes = "修改微信菜单")
////    public Envelop updateWxMenu(
////            @ApiParam(name = "json_data", value = "", defaultValue = "")
////            @RequestBody String jsonData) {
////        try {
////            WxMenuDO wxMenu = toEntity(jsonData, WxMenuDO.class);
////            return Envelop.getSuccess(WechatRequestMapping.WxMenu.message_success_update, wxMenuService.updateWxMenu(wxMenu));
////        } catch (ApiException e) {
////            return Envelop.getError(e.getMessage(), e.getErrorCode());
////        }
////    }
//
//
////    @DeleteMapping(value = WechatRequestMapping.WxMenu.api_delete)
////    @ApiOperation(value = "删除微信菜单", notes = "删除微信菜单")
////    public Envelop deleteWxMenu(
////            @ApiParam(name = "ids", value = "ids")
////            @RequestParam(value = "ids", required = true) String ids,
////            @ApiParam(name = "userId", value = "userId")
////            @RequestParam(value = "userId", required = true) String userId,
////            @ApiParam(name = "userName", value = "userName")
////            @RequestParam(value = "userName", required = true) String userName
////    ) {
////        try {
////            wxMenuService.deleteWxMenu(ids, userId, userName);
////            return Envelop.getSuccess(WechatRequestMapping.WxMenu.message_success_delete );
////        } catch (ApiException e) {
////            return Envelop.getError(e.getMessage(), e.getErrorCode());
////        }
////    }
////
////    @GetMapping(value = WechatRequestMapping.WxMenu.api_getById)
////    @ApiOperation(value = "根据code查找微信菜单", notes = "根据code查找微信菜单")
////    public Envelop findByCode(
////            @ApiParam(name = "id", value = "id")
////            @RequestParam(value = "id", required = true) String id
////    ) {
////        try {
////            return Envelop.getSuccess(WechatRequestMapping.WxMenu.message_success_find, wxMenuService.findById(id));
////        } catch (ApiException e) {
////            return Envelop.getError(e.getMessage(), e.getErrorCode());
////        }
////    }
////
////    @RequestMapping(value = WechatRequestMapping.WxMenu.api_getWxMenus, method = RequestMethod.GET)
////    @ApiOperation(value = "获取微信菜单列表(分页)")
////    public Envelop getWxMenus(
////            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,name,saasId,appId,appSecret,baseUrl,remark")
////            @RequestParam(value = "fields", required = false) String fields,
////            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
////            @RequestParam(value = "filters", required = false) String filters,
////            @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "+name,+createTime")
////            @RequestParam(value = "sorts", required = false) String sorts,
////            @ApiParam(name = "size", value = "分页大小", defaultValue = "15")
////            @RequestParam(value = "size", required = false) int size,
////            @ApiParam(name = "page", value = "页码", defaultValue = "1")
////            @RequestParam(value = "page", required = false) int page,
////            HttpServletRequest request,
////            HttpServletResponse response) throws Exception {
////        if(StringUtils.isBlank(sorts)){
////            sorts = "-updateTime";
////        }
////
////        //得到微信列表数据
////        List<WxWechatDO> wechats = wechatService.search(fields, filters, sorts, page, size);
////        for(WxWechatDO wechat:wechats){
////            List<WxMenuDO> parentMenus = wxMenuService.findParentMenuByWechatCode(wechat.getId());
////            if (parentMenus.size()>0){
////                wechat.setState("closed");
////            }else{
////                wechat.setState("open");
////            }
////        }
////        //获取总数
////        long count=wechatService.getCount(filters);
////        //封装头信息
////        pagedResponse(request, response, count, page, size);
////        //封装返回格式
////        List<WxWechatVO> mwechats = convertToModels(wechats, new ArrayList<>(wechats.size()), WxWechatVO.class, fields);
////        return Envelop.getSuccessListWithPage(WechatRequestMapping.WxMenu.message_success_find_functions,mwechats, page, size,count);
////    }
////
////
////    @GetMapping(value = WechatRequestMapping.WxMenu.api_getWxMenuNoPage)
////    @ApiOperation(value = "获取微信菜单列表,不分页")
////    public Envelop getWxMenuNoPage(
////            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,name,saasId,appId,appSecret,baseUrl,remark")
////            @RequestParam(value = "fields", required = false) String fields,
////            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
////            @RequestParam(value = "filters", required = false) String filters,
////            @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "+name,+createTime")
////            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
////        if(filters!=null){
////            filters = "supMenucode=0;"+filters;
////        }else{
////            filters = "supMenucode=0;";
////        }
////        //得到list数据
////        List<WxMenuDO> list = wxMenuService.search(fields,filters,sorts);
////        for(WxMenuDO wxMenu:list){
////            List<WxMenuDO> childMenus = wxMenuService.findChildMenus(wxMenu.getId());
////            wxMenu.setChildren(childMenus);
////        }
////        //封装返回格式
////        List<WxMenuVO> WxMenuVOs = convertToModels(list, new ArrayList<>(list.size()), WxMenuVO.class, fields);
////        Map<String, String> map = wechatService.getAllWechatConfig();
////        for(WxMenuVO menu:WxMenuVOs){
////            menu.setWechatName(map.get(menu.getWechatCode()));
////        }
////        return Envelop.getSuccessList(WechatRequestMapping.WxMenu.message_success_find_functions,WxMenuVOs);
////    }
////
////    /**
////     * 创建微信公众号菜单
////     *
////     * @return
////     */
////    @ApiOperation(value = "创建微信公众号菜单", notes = "创建微信公众号菜单")
////    @RequestMapping(value = WechatRequestMapping.WxMenu.api_createMenu ,method = RequestMethod.GET)
////    public Envelop createWechatMenu(
////            @ApiParam(name = "wechatId", value = "", defaultValue = "")
////            @RequestParam(value = "wechatId", required = true)String wechatId){
////        try{
////            JSONObject result = wxMenuService.createWechatMenu(wechatId);
////            String errcode = result.get("errcode").toString();
////            WechatResponse wechatResponse = new WechatResponse(Integer.valueOf(errcode));
////            String msg = wechatResponse.getMsg();
////            return Envelop.getSuccess("成功",msg);
////        }catch (Exception e){
////            return Envelop.getSuccess("创建失败",e );
////        }
////    }
////
////    /**
////     * 根据微信code查找父菜单
////     * @param wechatId
////     * @return
////     */
////    @GetMapping(value = WechatRequestMapping.WxMenu.api_getParentMenu)
////    @ApiOperation(value = "根据微信code查找父菜单", notes = "根据微信code查找父菜单")
////    public Envelop getParentMenu(
////            @ApiParam(name = "wechatId", value = "wechatId")
////            @PathVariable(value = "wechatId", required = true) String wechatId
////    ) {
////        try {
////            List<WxMenuDO> parentMenus = wxMenuService.findParentMenuByWechatCode(wechatId);
////            for(WxMenuDO parentMenu:parentMenus){
////                List<WxMenuDO> childMenus = wxMenuService.findChildMenus(parentMenu.getId());
////                if (childMenus.size()>0){
////                    parentMenu.setState("closed");
////                }else{
////                    parentMenu.setState("open");
////                }
////            }
////            return Envelop.getSuccess(WechatRequestMapping.WxMenu.message_success_find, parentMenus);
////        } catch (ApiException e) {
////            return Envelop.getError(e.getMessage(), e.getErrorCode());
////        }
////    }
////
////
////    /**
////     * 根据父级菜单code查找子菜单
////     * @param parentCode
////     * @return
////     */
////    @GetMapping(value = WechatRequestMapping.WxMenu.api_getChildMenus)
////    @ApiOperation(value = "根据父级菜单code查找子菜单", notes = "根据父级菜单code查找子菜单")
////    public Envelop getChildMenus(
////            @ApiParam(name = "parentCode", value = "parentCode")
////            @PathVariable(value = "parentCode", required = true) String parentCode
////    ) {
////        try {
////            return Envelop.getSuccess(WechatRequestMapping.WxMenu.message_success_find, wxMenuService.findChildMenus(parentCode));
////        } catch (ApiException e) {
////            return Envelop.getError(e.getMessage(), e.getErrorCode());
////        }
////    }
//
//}

+ 0 - 178
svr/svr-base/src/main/java/com/yihu/jw/business/wx/controller/WxTemplateController.java

@ -1,178 +0,0 @@
//package com.yihu.jw.business.wx.controller;
//
//import com.yihu.jw.business.wx.service.WxTemplateService;
//import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
//import com.yihu.jw.rm.base.WechatRequestMapping;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.http.MediaType;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
///**
// * Created by Administrator on 2017/5/19 0019.
// */
//@RestController
//@RequestMapping(WechatRequestMapping.api_common)
//@Api(value = "微信模版相关操作", description = "微信模版相关操作")
//public class WxTemplateController extends EnvelopRestEndpoint {
//
//    @Autowired
//    private WxTemplateService wxTemplateService;
//
//    @PostMapping(value = WechatRequestMapping.WxTemplate.api_test_template, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
//    @ApiOperation(value = "测试发送微信模板", notes = "测试发送微信模板")
//    public String sendWeTempMesTest(String wechatId,String openid)throws Exception{
//        return wxTemplateService.sendWeTempMesTest(wechatId,openid);
//    }
//
//
////    @PostMapping(value = WechatRequestMapping.WxTemplate.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
////    @ApiOperation(value = "创建微信模版", notes = "创建微信模版")
////    public Envelop createWxTemplate(
////            @ApiParam(name = "json_data", value = "微信模版json字符串")
////            @RequestBody String jsonData) {
////        try {
////            WxTemplateDO WxTemplate = toEntity(jsonData, WxTemplateDO.class);
////            return Envelop.getSuccess(WechatRequestMapping.WxTemplate.message_success_create, wxTemplateService.createWxTemplate(WxTemplate));
////        } catch (ApiException e) {
////            return Envelop.getError(e.getMessage(), e.getErrorCode());
////        }
////    }
////
////    @PutMapping(value = WechatRequestMapping.WxTemplate.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
////    @ApiOperation(value = "修改微信模版", notes = "修改微信模版")
////    public Envelop updateWxTemplate(
////            @ApiParam(name = "json_data", value = "", defaultValue = "")
////            @RequestBody String jsonData) {
////        try {
////            WxTemplateDO WxTemplate = toEntity(jsonData, WxTemplateDO.class);
////            return Envelop.getSuccess(WechatRequestMapping.WxTemplate.message_success_update, wxTemplateService.updateWxTemplate(WxTemplate));
////        } catch (ApiException e) {
////            return Envelop.getError(e.getMessage(), e.getErrorCode());
////        }
////    }
////
////    @DeleteMapping(value = WechatRequestMapping.WxTemplate.api_delete)
////    @ApiOperation(value = "删除微信模版", notes = "删除微信模版")
////    public Envelop deleteWxTemplate(
////            @ApiParam(name = "codes", value = "codes")
////            @RequestParam(value = "codes", required = true) String codes,
////            @ApiParam(name = "userCode", value = "userCode")
////            @RequestParam(value = "userCode", required = true) String userCode,
////            @ApiParam(name = "userName", value = "userName")
////            @RequestParam(value = "userName", required = true) String userName
////    ) {
////        try {
////            wxTemplateService.deleteWxTemplate(codes, userCode, userName);
////            return Envelop.getSuccess(WechatRequestMapping.WxTemplate.message_success_delete );
////        } catch (ApiException e) {
////            return Envelop.getError(e.getMessage(), e.getErrorCode());
////        }
////    }
////
////    @GetMapping(value = WechatRequestMapping.WxTemplate.api_getById)
////    @ApiOperation(value = "根据code查找微信模版", notes = "根据code查找微信模版")
////    public Envelop findById(
////            @ApiParam(name = "id", value = "id")
////            @RequestParam(value = "id", required = true) String id
////    ) {
////        try {
////            return Envelop.getSuccess(WechatRequestMapping.WxTemplate.message_success_find, wxTemplateService.findById(id));
////        } catch (ApiException e) {
////            return Envelop.getError(e.getMessage(), e.getErrorCode());
////        }
////    }
////
////    @RequestMapping(value = WechatRequestMapping.WxTemplate.api_getWxTemplates, method = RequestMethod.GET)
////    @ApiOperation(value = "获取微信模版列表(分页)")
////    public Envelop getWechats(
////            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,title,wechatCode,templateId,content,remark,status")
////            @RequestParam(value = "fields", required = false) String fields,
////            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
////            @RequestParam(value = "filters", required = false) String filters,
////            @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "+title,+createTime")
////            @RequestParam(value = "sorts", required = false) String sorts,
////            @ApiParam(name = "size", value = "分页大小", defaultValue = "15")
////            @RequestParam(value = "size", required = false) int size,
////            @ApiParam(name = "page", value = "页码", defaultValue = "1")
////            @RequestParam(value = "page", required = false) int page,
////            HttpServletRequest request,
////            HttpServletResponse response) throws Exception {
////        if(StringUtils.isBlank(sorts)){
////            sorts = "-updateTime";
////        }
////
////        //得到微信列表数据
////        List<WxWechatDO> wechats = wechatService.search(fields, filters, sorts, page, size);
////        for(WxWechatDO wechat:wechats){
////            List<WxTemplateDO> wxTemplates = wxTemplateService.findByWxId(wechat.getId());
////            if (wxTemplates.size()>0){
////                wechat.setState("closed");
////            }else{
////                wechat.setState("open");
////            }
////        }
////        //获取总数
////        long count=wechatService.getCount(filters);
////        //封装头信息
////        pagedResponse(request, response, count, page, size);
////        //封装返回格式
////        List<WxWechatVO> mwechats = convertToModels(wechats, new ArrayList<>(wechats.size()), WxWechatVO.class, fields);
////        return Envelop.getSuccessListWithPage(WechatRequestMapping.WxMenu.message_success_find_functions,mwechats, page, size,count);
////
////    }
////
////
////    @GetMapping(value = WechatRequestMapping.WxTemplate.api_getWxTemplatesNoPage)
////    @ApiOperation(value = "获取微信模版列表(不分页)")
////    public Envelop getList(
////            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,title,wechatCode,templateId,content,remark,status")
////            @RequestParam(value = "fields", required = false) String fields,
////            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
////            @RequestParam(value = "filters", required = false) String filters,
////            @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "+title,+createTime")
////            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
////        //得到list数据
////        List<WxTemplateDO> list = wxTemplateService.search(fields,filters,sorts);
////        //封装返回格式
////        List<WxTemplateVO> mWxTemplateVOs = convertToModels(list, new ArrayList<>(list.size()), WxTemplateVO.class, fields);
////        return Envelop.getSuccessList(WechatRequestMapping.WxTemplate.message_success_find_functions,mWxTemplateVOs);
////    }
////
////    @GetMapping(value = WechatRequestMapping.WxTemplate.api_sendTemplateMessage)
////    @ApiOperation(value = "发送微信模板消息")
////    @ResponseBody
////    public Envelop sendTemplateMessage(
////            @ApiParam(name="openid",value="微信用户的openid")
////            @RequestParam String openid,
////            @ApiParam(name="templateCode",value = "模板code")
////            @RequestParam String templateCode,
////            @ApiParam(name="url",value="模板跳转链接")
////            @RequestParam(required = false) String url,
////            @ApiParam(name="appid",value="所需跳转到的小程序appid(该小程序appid必须与发模板消息的公众号是绑定关联关系)")
////            @RequestParam(required = false) String appid,
////            @ApiParam(name="pagepath",value="所需跳转到小程序的具体页面路径,支持带参数,(示例index?foo=bar)")
////            @RequestParam(required = false) String pagepath,
////            @ApiParam(name="data",value="json字符串")
////            @RequestParam String data
////    ){
////        try {
////            Miniprogram miniprogram = null;
////            if(StringUtils.isNotBlank(appid)&&StringUtils.isNotBlank(pagepath)){
////                miniprogram = new Miniprogram();
////                miniprogram.setAppid(appid);
////                miniprogram.setPagepath(pagepath);
////            }
////            JSONObject jsonObject = wxTemplateService.sendTemplateMessage(openid, templateCode, url, data, miniprogram);
////            String errcode = jsonObject.get("errcode").toString();
////            WechatResponse wechatResponse = new WechatResponse(Integer.valueOf(errcode));
////            String msg = wechatResponse.getMsg();
////            return Envelop.getSuccess("成功",msg);
////        }catch (Exception exception) {
////            return Envelop.getSuccess("error", exception);
////        }
////    }
//}

+ 0 - 29
svr/svr-base/src/main/java/com/yihu/jw/business/wx/dao/WechatDao.java

@ -1,29 +0,0 @@
//package com.yihu.jw.business.wx.dao;
//
//import com.yihu.jw.entity.base.wx.WxWechatDO;
//import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
//import org.springframework.data.jpa.repository.Query;
//import org.springframework.data.repository.PagingAndSortingRepository;
//
//import java.util.List;
//
///**
// * Created by Administrator on 2017/5/20 0020.
// */
//public interface WechatDao extends PagingAndSortingRepository<WxWechatDO, String>, JpaSpecificationExecutor<WxWechatDO> {
//
//    @Query("from WxWechatDO w where w.appId = ?1 and w.status!=-1")
//    WxWechatDO findByAppId(String appId);
//
//    @Query("from WxWechatDO w where w.appId = ?1 and w.id!= ?2 and w.status!=-1")
//    WxWechatDO findByAppIdExcludeId(String appId, String id);
//
//    @Query("from WxWechatDO w where w.id = ?1 and w.status!=-1")
//    WxWechatDO findById(String id);
//
//    @Query("from WxWechatDO w where w.status!=-1")
//    List<WxWechatDO> findAll();
//
//    @Query("from WxWechatDO w where w.appOriginId = ?1 and w.status!=-1")
//    WxWechatDO findByAppOriginId(String appOriginId);
//}

+ 0 - 17
svr/svr-base/src/main/java/com/yihu/jw/business/wx/dao/WxAccessTokenDao.java

@ -1,17 +0,0 @@
//package com.yihu.jw.business.wx.dao;
//
//import com.yihu.jw.entity.base.wx.WxAccessTokenDO;
//import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
//import org.springframework.data.jpa.repository.Query;
//import org.springframework.data.repository.PagingAndSortingRepository;
//
//import java.util.List;
//
///**
// * Created by Administrator on 2017/5/18 0018.
// */
//public interface WxAccessTokenDao extends PagingAndSortingRepository<WxAccessTokenDO, String>, JpaSpecificationExecutor<WxAccessTokenDO> {
//
//    @Query("from WxAccessTokenDO w where w.wechatId =?1 order by w.addTimestamp desc")
//    List<WxAccessTokenDO> getWxAccessTokenById(String wechatId);
//}

+ 0 - 15
svr/svr-base/src/main/java/com/yihu/jw/business/wx/dao/WxGraphicMessageDao.java

@ -1,15 +0,0 @@
//package com.yihu.jw.business.wx.dao;
//
//import com.yihu.jw.base.wx.WxGraphicMessageDO;
//import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
//import org.springframework.data.jpa.repository.Query;
//import org.springframework.data.repository.PagingAndSortingRepository;
//
///**
// * Created by Administrator on 2017/5/20 0020.
// */
//public interface WxGraphicMessageDao extends PagingAndSortingRepository<WxGraphicMessageDO, String>, JpaSpecificationExecutor<WxGraphicMessageDO> {
//
//    @Query("from WxGraphicMessageDO w where w.id =?1 and w.status!=-1")
//    WxGraphicMessageDO findById(String id);
//}

+ 0 - 15
svr/svr-base/src/main/java/com/yihu/jw/business/wx/dao/WxGraphicSceneGroupDao.java

@ -1,15 +0,0 @@
//package com.yihu.jw.business.wx.dao;
//
//import com.yihu.jw.entity.base.wx.WxGraphicSceneGroupDO;
//import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
//import org.springframework.data.repository.PagingAndSortingRepository;
//
//import java.util.List;
//
///**
// * Created by Trick on 2018/8/16.
// */
//public interface WxGraphicSceneGroupDao extends PagingAndSortingRepository<WxGraphicSceneGroupDO, String>, JpaSpecificationExecutor<WxGraphicSceneGroupDO> {
//
//    List<WxGraphicSceneGroupDO> findByWechatIdAndScene(String wechatId,String scene);
//}

+ 0 - 20
svr/svr-base/src/main/java/com/yihu/jw/business/wx/dao/WxMenuDao.java

@ -1,20 +0,0 @@
//package com.yihu.jw.business.wx.dao;
//
//import com.yihu.jw.entity.base.wx.WxMenuDO;
//import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
//import org.springframework.data.jpa.repository.Query;
//import org.springframework.data.repository.PagingAndSortingRepository;
//
//import java.util.List;
//
///**
// * Created by Administrator on 2017/5/19 0019.
// */
//public interface WxMenuDao  extends PagingAndSortingRepository<WxMenuDO, String>, JpaSpecificationExecutor<WxMenuDO> {
//
//    @Query("FROM WxMenuDO w WHERE w.wechatId =?1 AND w.status ='1' AND w.supMenuid IS NULL ORDER BY w.sort ASC")
//    List<WxMenuDO> findParentRootByWechatId(String wechatId);
//
//    @Query("FROM WxMenuDO w WHERE w.wechatId =?1 AND w.status ='1' AND w.supMenuid IS NOT NULL ORDER BY w.sort ASC")
//    List<WxMenuDO> findChilrenByWechatId(String wechatId);
//}

+ 0 - 13
svr/svr-base/src/main/java/com/yihu/jw/business/wx/dao/WxMenuJsonDao.java

@ -1,13 +0,0 @@
//package com.yihu.jw.business.wx.dao;
//
//import com.yihu.jw.entity.base.wx.WxMenuJsonDO;
//import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
//import org.springframework.data.repository.PagingAndSortingRepository;
//
///**
// * Created by Trick on 2018/8/13.
// */
//public interface WxMenuJsonDao extends PagingAndSortingRepository<WxMenuJsonDO, String>, JpaSpecificationExecutor<WxMenuJsonDO> {
//
//    WxMenuJsonDO findByWechatIdAndStatus(String wechatId,Integer status);
//}

+ 0 - 18
svr/svr-base/src/main/java/com/yihu/jw/business/wx/dao/WxReplySceneDao.java

@ -1,18 +0,0 @@
//package com.yihu.jw.business.wx.dao;
//
//import com.yihu.jw.entity.base.wx.WxReplySceneDO;
//import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
//import org.springframework.data.repository.PagingAndSortingRepository;
//
//import java.util.List;
//
///**
// * Created by Trick on 2018/8/16.
// */
//public interface WxReplySceneDao extends PagingAndSortingRepository<WxReplySceneDO, String>, JpaSpecificationExecutor<WxReplySceneDO> {
//
//
//    List<WxReplySceneDO> findByAppOriginIdAndMsgTypeAndStatus(String appOriginId,String msgType,Integer status);
//
//    List<WxReplySceneDO> findByAppOriginIdAndMsgTypeAndEventAndStatus(String appOriginId,String msgType,String event,Integer status);
//}

+ 0 - 15
svr/svr-base/src/main/java/com/yihu/jw/business/wx/dao/WxTemplateConfigDao.java

@ -1,15 +0,0 @@
//package com.yihu.jw.business.wx.dao;
//
//
//import com.yihu.jw.entity.base.wx.WxTemplateConfigDO;
//import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
//import org.springframework.data.repository.PagingAndSortingRepository;
//
///**
// * Created by Trick on 2018/8/21.
// */
//public interface WxTemplateConfigDao extends PagingAndSortingRepository<WxTemplateConfigDO, String>, JpaSpecificationExecutor<WxTemplateConfigDO> {
//
//    WxTemplateConfigDO findByWechatIdAndTemplateNameAndScene(String wechatId,String templateName,String scene);
//
//}

+ 0 - 21
svr/svr-base/src/main/java/com/yihu/jw/business/wx/dao/WxTemplateDao.java

@ -1,21 +0,0 @@
//package com.yihu.jw.business.wx.dao;
//
//import com.yihu.jw.base.wx.WxTemplateDO;
//import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
//import org.springframework.data.jpa.repository.Query;
//import org.springframework.data.repository.PagingAndSortingRepository;
//
//import java.util.List;
//
///**
// * Created by Administrator on 2017/5/20 0020.
// */
//public interface WxTemplateDao extends PagingAndSortingRepository<WxTemplateDO, String>, JpaSpecificationExecutor<WxTemplateDO> {
//
//
//    @Query("from WxTemplateDO w where w.id = ?1 and w.status =1")
//    WxTemplateDO findById(String id);
//
//    @Query("from WxTemplateDO w where w.wechatId = ?1 and w.status =1")
//    List<WxTemplateDO> findByWxId(String wechatId);
//}

+ 0 - 353
svr/svr-base/src/main/java/com/yihu/jw/business/wx/service/WechatCoreService.java

@ -1,353 +0,0 @@
//package com.yihu.jw.business.wx.service;
//
//import com.yihu.jw.base.dao.wx.WechatDao;
//import com.yihu.jw.base.dao.wx.WxReplySceneDao;
//import com.yihu.jw.entity.base.wx.WxReplySceneDO;
//import com.yihu.jw.entity.base.wx.WxWechatDO;
//import com.yihu.jw.util.wechat.WeiXinMessageReplyUtils;
//import com.yihu.jw.util.wechat.WeiXinMessageUtils;
//import org.apache.commons.lang3.StringUtils;
//import org.dom4j.Document;
//import org.dom4j.DocumentException;
//import org.dom4j.DocumentHelper;
//import org.dom4j.Element;
//import org.dom4j.io.SAXReader;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.jdbc.core.JdbcTemplate;
//import org.springframework.stereotype.Service;
//
//import javax.servlet.http.HttpServletRequest;
//import java.io.InputStream;
//import java.util.ArrayList;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//
///**
// * Created by Trick on 2018/8/16.
// */
//@Service
//public class WechatCoreService {
//
//    private Logger logger = LoggerFactory.getLogger(WechatCoreService.class);
//
//    @Autowired
//    private WechatDao wechatDao;
//
//    @Autowired
//    private WxAccessTokenService wxAccessTokenService;
//
//    @Autowired
//    private WxReplySceneDao wxReplySceneDao;
//
//    @Autowired
//    private JdbcTemplate jdbcTemplate;
//
//    /**
//     * 微信推送消息处理
//     *
//     * @param request
//     */
//    public String messageProcess(HttpServletRequest request) {
//        try {
//            String returnStr = "";
//            // 将解析结果存储在HashMap中
//            Map<String, String> message = new HashMap();
//
//            // 从request中取得输入流
//            InputStream inputStream = request.getInputStream();
//            // 读取输入流
//            SAXReader reader = new SAXReader();
//            Document document = reader.read(inputStream);
//            // 得到xml根元素
//            Element root = document.getRootElement();
//            // 得到根元素的所有子节点
//            List elementList = root.elements();
//
//            // 遍历所有子节点
//            for (Object e : elementList) {
//                Element ele = (Element) e;
//                message.put(ele.getName(), ele.getText());
//            }
//            logger.info("weixin  event:" + message.toString());
//            // 释放资源
//            inputStream.close();
//            // 消息处理
//            returnStr = messageProcess(message);
//
//            return returnStr;
//        } catch (Exception e) {
//            e.printStackTrace();
//            return "error";
//        }
//    }
//
//    public String  testProcess() throws Exception{
//        String returnStr = "";
//
//        Map<String, String> message = new HashMap();
//        message.put("Event","subscribe");
//        message.put("CreateTime","1534495338");
//        message.put("ToUserName","gh_73959f6e996b");
//        message.put("FromUserName","oVH-2uJdhNrcAMt0Jhp3PMarDdaM");
//        message.put("MsgType","event");
//
//        returnStr = messageProcess(message);
//
//        return returnStr;
//    }
//
//
//    /**
//     * 对接收到的消息进行处理
//     *
//     * @param message
//     * @return
//     */
//    private String messageProcess(Map<String, String> message) throws Exception {
//        String msgType = message.get("MsgType");
//        String result = "";
//
//        switch (msgType) {
//            case WeiXinMessageUtils.REQ_MESSAGE_TYPE_EVENT:  // 事件消息
//                logger.info("MsgType:event");
//                result = eventProcess(message);
//                break;
//            case WeiXinMessageUtils.RESP_MESSAGE_TYPE_TEXT:  // 回复文本消息
//                //回复文本消息 处理
//                logger.info("MsgType:text");
//                result = textProcess(message);
//                break;
//            default:
//                break;
//        }
//
//        return result;
//    }
//
//    /**
//     * 事件细分处理:
//     * 1.扫描二维码事件
//     * 2.订阅事件
//     * 3.取消订阅事件
//     * 4.菜单点击
//     * @param message
//     * @return
//     */
//    public String eventProcess(Map<String, String> message) throws Exception{
//        String result = "";
//        String event = message.get("Event");
//
//        switch (event) {
//            case WeiXinMessageUtils.EVENT_TYPE_SCAN: // 扫描二维码事件
//                result = scanEventProcess(message);
//                break;
//            case WeiXinMessageUtils.EVENT_TYPE_SUBSCRIBE: // 订阅事件
//                if (message.containsKey("EventKey") && StringUtils.isNotEmpty(message.get("EventKey")) && message.containsKey("Ticket")
//                        && StringUtils.isNotEmpty(message.get("Ticket"))) {
//                    result = scanEventProcess(message);
//                } else {
//                    result = subscribeEventProcess(message);
//                }
//                break;
//            case WeiXinMessageUtils.EVENT_TYPE_UNSUBSCRIBE: // 取消订阅事件
//                result = unsubscribeEventProcess(message);
//                break;
//            case WeiXinMessageUtils.EVENT_TYPE_CLICK: //菜单点击
//                result = this.clickProcess(message);
//            default:
//                break;
//        }
//
//        return result;
//    }
//
//    /**
//     * 扫描二维码事件
//     * 1. 用户未关注时,进行关注后的事件推送
//     * <xml><ToUserName>< ![CDATA[toUser] ]></ToUserName><FromUserName>< ![CDATA[FromUser] ]></FromUserName><CreateTime>123456789</CreateTime><MsgType>< ![CDATA[event] ]></MsgType><Event>< ![CDATA[subscribe] ]></Event><EventKey>< ![CDATA[qrscene_123123] ]></EventKey><Ticket>< ![CDATA[TICKET] ]></Ticket></xml>
//     * 2. 用户已关注时的事件推送
//     * <xml> <ToUserName>< ![CDATA[toUser] ]></ToUserName> <FromUserName>< ![CDATA[FromUser] ]></FromUserName> <CreateTime>123456789</CreateTime> <MsgType>< ![CDATA[event] ]></MsgType> <Event>< ![CDATA[SCAN] ]></Event> <EventKey>< ![CDATA[SCENE_VALUE] ]></EventKey> <Ticket>< ![CDATA[TICKET] ]></Ticket> </xml>
//     * @param message
//     * @return
//     */
//    public String scanEventProcess(Map<String, String> message) throws Exception{
//        //获取原始id
//        String toUserName = message.get("ToUserName");
//        //如果为已经关注,EventKey值为带参二维码值,如果是未关注 qrscene_为前缀,后面为二维码的参数值
//        String eventKey = message.get("EventKey");
//        //查询需要对应匹配的带参二维码事件值
//        List<WxReplySceneDO> scenes = wxReplySceneDao.findByAppOriginIdAndMsgTypeAndEventAndStatus(toUserName,WeiXinMessageUtils.REQ_MESSAGE_TYPE_EVENT,WeiXinMessageUtils.EVENT_TYPE_SCAN,1);
//        if(scenes!=null&&scenes.size()>0){
//            for(WxReplySceneDO scene:scenes){
//                //判断带参二维码中前缀是否包该场景值
//                if(StringUtils.isNotBlank(scene.getScene())&&eventKey.indexOf(scene.getScene())!=-1){
//                    return getGraphicXMl(scene.getScene(),scene.getWechatId(),message);
//                }
//            }
//        }
//
//        return "";
//    }
//
//    /**
//     * 搜索关注事件
//     * @param message
//     * @return
//     */
//    public String subscribeEventProcess(Map<String, String> message) throws Exception{
//        //获取原始id
//        String toUserName = message.get("ToUserName");
//        List<WxReplySceneDO> scenes = wxReplySceneDao.findByAppOriginIdAndMsgTypeAndEventAndStatus(toUserName,WeiXinMessageUtils.REQ_MESSAGE_TYPE_EVENT,WeiXinMessageUtils.EVENT_TYPE_SUBSCRIBE,1);
//        if(scenes!=null&&scenes.size()>0){
//            WxReplySceneDO scene = scenes.get(0);
//            if(StringUtils.isNotBlank(scene.getScene())){
//                return getGraphicXMl(scene.getScene(),scene.getWechatId(),message);
//            }
//        }
//        return "";
//    }
//
//    /**
//     * 取消关注事件,根据需求开发
//     * @param message
//     * @return
//     */
//    public String unsubscribeEventProcess(Map<String, String> message){
//        return "";
//    }
//
//    /**
//     * 点击事件,根据需求开发
//     * @param message
//     * @return
//     */
//    public String clickProcess(Map<String, String> message){
//        return "";
//    }
//
//
//    /**
//     * 文本消息动态生成图文消息
//     * @param message
//     * @return
//     * @throws Exception
//     */
//    public String  textProcess(Map<String, String> message) throws Exception{
//        String toUserName = message.get("ToUserName");
//        String content = message.get("Content");
//        List<WxReplySceneDO> scenes = wxReplySceneDao.findByAppOriginIdAndMsgTypeAndStatus(toUserName,WeiXinMessageUtils.RESP_MESSAGE_TYPE_TEXT,1);
//
//        if(scenes!=null&&scenes.size()>0){
//            for(WxReplySceneDO scene:scenes){
//                if(StringUtils.isNotBlank(scene.getContent())
//                        &&content.equals(scene.getContent())
//                        &&StringUtils.isNotBlank(scene.getScene())){
//                    //根据场景值,动态生成图文消息回复文斌
//                    return getGraphicXMl(scene.getScene(),scene.getWechatId(),message);
//                }
//            }
//        }
//
//        return null;
//    }
//
//    /**
//     * 构造图文消息XML
//     * @param secene
//     * @param wxId
//     * @param message
//     * @return
//     * @throws Exception
//     */
//    public String getGraphicXMl(String secene,String wxId,Map<String, String> message)throws Exception{
//        List<Map<String,Object>> group = getGraphicGroupByScene(secene,wxId);
//        String result = "";
//        String eventKey = message.get("EventKey");
//        if(group!=null&&group.size()>0){
//            List<Map<String, String>> articles = new ArrayList<>();
//
//            for(Map<String,Object> graphic : group){
//                // 图文信息
//                Map<String, String> article = new HashMap<>();
//                String url = (String)graphic.get("url");
//                String baseUrl = (String)graphic.get("baseUrl");
//                String appId = (String)graphic.get("appId");
//                String title = (String)graphic.get("title");
//                String description = (String)graphic.get("description");
//                String picUrl = (String)graphic.get("picUrl");
//
//                if(url.indexOf("{server}")!=-1){
//                    url = url.replace("{server}",baseUrl);
//                }
//                if(url.indexOf("{appId}")!=-1){
//                    url = url.replace("{appId}",appId);
//                }
//                //传递带参二维码给前端页面
//                if(url.indexOf("{EventKey}")!=-1){
//                    if(eventKey.indexOf("qrscene_")!=-1){
//                        eventKey = eventKey.replace("qrscene_","");
//                    }
//                    url = url.replace("{EventKey}",eventKey);
//                }
//
//                article.put("Url", url);
//                article.put("Title", title);
//                article.put("Description", description);
//                article.put("PicUrl", picUrl);
//
//                articles.add(article);
//            }
//            result = WeiXinMessageReplyUtils.replyNewsMessage(message.get("FromUserName"), message.get("ToUserName"), articles);
//        }
//        return result;
//    }
//
//    /**
//     * 获取指定场景下所有图文消息分组
//     * @param secene
//     * @param wxId
//     * @return
//     */
//    public List<Map<String,Object>> getGraphicGroupByScene(String secene,String wxId) {
//        String sql = "SELECT " +
//                " m.title, " +
//                " m.description, " +
//                " m.url, " +
//                " m.pic_url AS picUrl," +
//                " w.app_id AS appId," +
//                " w.base_url AS baseUrl" +
//                " FROM " +
//                " wx_graphic_scene_group g " +
//                " JOIN wx_graphic_message m ON g.graphic_id = m.id " +
//                " JOIN wx_wechat w ON w.id = g.wechat_id" +
//                " WHERE " +
//                " m.wechat_id = '"+wxId+"' " +
//                " AND g.wechat_id = '"+wxId+"' " +
//                " AND g.scene = '"+secene+"' " +
//                " AND m.`status` = 1 " +
//                " ORDER BY g.sort ASC";
//        List<Map<String,Object>> group = jdbcTemplate.queryForList(sql);
//        return group;
//    }
//
//    /**
//     * 判断是否是xml结构
//     */
//    public boolean isXML(String value) {
//        try {
//            DocumentHelper.parseText(value);
//        } catch (DocumentException e) {
//            return false;
//        }
//        return true;
//    }
//
//    public List<WxWechatDO> findAll(){
//        return wechatDao.findAll();
//    }
//
//
//}

+ 0 - 94
svr/svr-base/src/main/java/com/yihu/jw/business/wx/service/WechatFansService.java

@ -1,94 +0,0 @@
//package com.yihu.jw.business.wx.service;
//
//import com.yihu.jw.util.wechat.wxhttp.HttpUtil;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//
///**
// * 微信粉丝管理
// * Created by Trick on 2018/8/22.
// */
//@Service
//public class WechatFansService {
//
//    @Autowired
//    private WxAccessTokenService wxAccessTokenService;
//
//    /**
//     * 创建分组
//     * @param wxId
//     * @param param
//     * @return
//     */
//    public String createWxTag(String wxId,String param){
//        String url = "https://api.weixin.qq.com/cgi-bin/tags/create?access_token="+wxAccessTokenService.getWxAccessTokenById(wxId).getAccessToken();
//        return HttpUtil.sendPost(url,param);
//    }
//
//    /**
//     * 查询分组
//     * @param wxId
//     * @return
//     */
//    public String findWxTag(String wxId){
//        String url = "https://api.weixin.qq.com/cgi-bin/tags/get?access_token="+wxAccessTokenService.getWxAccessTokenById(wxId).getAccessToken();
//        return HttpUtil.sendGet(url);
//    }
//
//    /**
//     * 更新分组
//     * @param wxId
//     * @param param
//     * @return
//     */
//    public String updateWxTag(String wxId,String param){
//        String url = "https://api.weixin.qq.com/cgi-bin/tags/update?access_token="+wxAccessTokenService.getWxAccessTokenById(wxId).getAccessToken();
//        return HttpUtil.sendPost(url,param);
//    }
//
//    /**
//     * 删除分组
//     * @param wxId
//     * @param param
//     * @return
//     */
//    public String deleteWxTag(String wxId,String param){
//        String url = "https://api.weixin.qq.com/cgi-bin/tags/delete?access_token="+wxAccessTokenService.getWxAccessTokenById(wxId).getAccessToken();
//        return HttpUtil.sendPost(url,param);
//    }
//
//    /**
//     *  批量为用户打标签
//     * @param wxId
//     * @param param
//     * @return
//     */
//    public String createBatchtagging(String wxId,String param){
//        String url = "https://api.weixin.qq.com/cgi-bin/tags/members/batchtagging?access_token="+wxAccessTokenService.getWxAccessTokenById(wxId).getAccessToken();
//        return HttpUtil.sendPost(url,param);
//    }
//
//    /**
//     * 批量为用户取消标签
//     * @param wxId
//     * @param param
//     * @return
//     */
//    public String cancelBatchuntagging(String wxId,String param){
//        String url = "https://api.weixin.qq.com/cgi-bin/tags/members/batchuntagging?access_token="+wxAccessTokenService.getWxAccessTokenById(wxId).getAccessToken();
//        return HttpUtil.sendPost(url,param);
//    }
//
//    /**
//     * 获取用户身上的标签列表
//     * @param wxId
//     * @param param
//     * @return
//     */
//    public String getidlist(String wxId,String param){
//        String url = "https://api.weixin.qq.com/cgi-bin/tags/getidlist?access_token="+wxAccessTokenService.getWxAccessTokenById(wxId).getAccessToken();
//        return HttpUtil.sendPost(url,param);
//    }
//
//
//}

+ 0 - 13
svr/svr-base/src/main/java/com/yihu/jw/business/wx/service/WechatService.java

@ -1,13 +0,0 @@
//package com.yihu.jw.business.wx.service;
//
//import org.springframework.stereotype.Service;
//import org.springframework.transaction.annotation.Transactional;
//
///**
// * Created by Administrator on 2017/5/20 0020.
// */
//@Service
//@Transactional
//public class WechatService {
//
//}

+ 0 - 157
svr/svr-base/src/main/java/com/yihu/jw/business/wx/service/WxAccessTokenService.java

@ -1,157 +0,0 @@
//package com.yihu.jw.business.wx.service;
//
//import com.yihu.jw.business.wx.dao.WechatDao;
//import com.yihu.jw.business.wx.dao.WxAccessTokenDao;
//import com.yihu.jw.entity.base.wx.WxAccessTokenDO;
//import com.yihu.jw.entity.base.wx.WxWechatDO;
//import com.yihu.jw.exception.ApiException;
//import com.yihu.jw.exception.code.ExceptionCode;
//import com.yihu.jw.rm.base.WechatRequestMapping;
//import com.yihu.mysql.query.BaseJpaService;
//import com.yihu.utils.network.HttpUtils;
//import org.json.JSONObject;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//import org.springframework.util.StringUtils;
//
//import java.util.*;
//
///**
// * Created by Administrator on 2017/5/18 0018.
// */
//@Service
//public class WxAccessTokenService extends BaseJpaService<WxAccessTokenDO, WxAccessTokenDao> {
//
//
//    private Logger logger= LoggerFactory.getLogger(WxAccessTokenService.class);
//
//    @Autowired
//    private WxAccessTokenDao wxAccessTokenDao;
//
//    @Autowired
//    private WechatDao wechatDao;
//
//    /**
//     * 根据原始id查找
//     * @param appOriginId
//     * @return
//     */
//    public WxAccessTokenDO getWxAccessTokenByOriginId(String appOriginId) {
//        try {
//            //根据wechatCode查找出appid和appSecret
//            WxWechatDO wxWechat = wechatDao.findByAppOriginId(appOriginId);
//            if(wxWechat==null){
//                throw new ApiException(WechatRequestMapping.WxConfig.message_fail_wxWechat_is_no_exist, ExceptionCode.common_error_params_code);
//            }
//            List<WxAccessTokenDO> wxAccessTokens =  wxAccessTokenDao.getWxAccessTokenById(wxWechat.getId());
//            if(wxAccessTokens!=null&&wxAccessTokens.size()>0){
//                for (WxAccessTokenDO accessToken : wxAccessTokens) {
//                    if ((System.currentTimeMillis() - accessToken.getAddTimestamp()) < (accessToken.getExpiresIn() * 500)) {
//                        return accessToken;
//                    } else {
//                        wxAccessTokenDao.delete(accessToken);
//                        break;
//                    }
//                }
//            }
//            String token_url = "https://api.weixin.qq.com/cgi-bin/token";
//            String appId="";
//            String appSecret="";
//            appId = wxWechat.getAppId();
//            appSecret = wxWechat.getAppSecret();
//            if (StringUtils.isEmpty(appId)){
//                throw new ApiException(WechatRequestMapping.WxConfig.message_fail_appId_is_null, ExceptionCode.common_error_params_code);
//            }
//            if (StringUtils.isEmpty(appSecret)){
//                throw new ApiException(WechatRequestMapping.WxConfig.message_fail_appSecret_is_null, ExceptionCode.common_error_params_code);
//            }
//            /*String params = "grant_type=client_credential&appid=" + appId + "&secret=" + appSecret;
//            String result = HttpUtil.sendGet(token_url, params);*/
//            Map<String, Object> params = new HashMap<>();
//            params.put("grant_type", "client_credential");
//            params.put("appid", appId);
//            params.put("secret", appSecret);
//            String result = HttpUtils.doGet(token_url, params).getContent();
//            logger.info("--------------wechat token return :"+result+"---------------");
//            JSONObject json = new JSONObject(result);
//            if (json.has("access_token")) {
//                String token = json.get("access_token").toString();
//                String expires_in = json.get("expires_in").toString();
//                WxAccessTokenDO newaccessToken = new WxAccessTokenDO();
//                newaccessToken.setAccessToken(token);
//                newaccessToken.setExpiresIn(Long.parseLong(expires_in));
//                newaccessToken.setAddTimestamp(System.currentTimeMillis());
//                newaccessToken.setCzrq(new Date());
//                newaccessToken.setCode(UUID.randomUUID().toString().replace("-",""));
//                newaccessToken.setWechatId(wxWechat.getId());
//                wxAccessTokenDao.save(newaccessToken);
//                return newaccessToken;
//            } else {
//                return null;
//            }
//        } catch (Exception e) {
//            e.printStackTrace();
//            return null;
//        }
//    }
//
//
//    public WxAccessTokenDO getWxAccessTokenById(String wechatId) {
//        try {
//            //根据wechatCode查找出appid和appSecret
//            WxWechatDO wxWechat = wechatDao.findById(wechatId);
//            if(wxWechat==null){
//                throw new ApiException(WechatRequestMapping.WxConfig.message_fail_wxWechat_is_no_exist, ExceptionCode.common_error_params_code);
//            }
//            List<WxAccessTokenDO> wxAccessTokens =  wxAccessTokenDao.getWxAccessTokenById(wechatId);
//            if(wxAccessTokens!=null&&wxAccessTokens.size()>0){
//                for (WxAccessTokenDO accessToken : wxAccessTokens) {
//                    if ((System.currentTimeMillis() - accessToken.getAddTimestamp()) < (accessToken.getExpiresIn() * 500)) {
//                        return accessToken;
//                    } else {
//                        wxAccessTokenDao.delete(accessToken);
//                        break;
//                    }
//                }
//            }
//            String token_url = "https://api.weixin.qq.com/cgi-bin/token";
//            String appId="";
//            String appSecret="";
//            appId = wxWechat.getAppId();
//            appSecret = wxWechat.getAppSecret();
//            if (StringUtils.isEmpty(appId)){
//                throw new ApiException(WechatRequestMapping.WxConfig.message_fail_appId_is_null, ExceptionCode.common_error_params_code);
//            }
//            if (StringUtils.isEmpty(appSecret)){
//                throw new ApiException(WechatRequestMapping.WxConfig.message_fail_appSecret_is_null, ExceptionCode.common_error_params_code);
//            }
//            Map<String, Object> params = new HashMap<>();
//            params.put("grant_type", "client_credential");
//            params.put("appid", appId);
//            params.put("secret", appSecret);
//            String result = HttpUtils.doGet(token_url, params).getContent();
//            logger.info("--------------wechat token return:"+result+"---------------");
//            JSONObject json = new JSONObject(result);
//            if (json.has("access_token")) {
//                String token = json.get("access_token").toString();
//                String expires_in = json.get("expires_in").toString();
//                WxAccessTokenDO newaccessToken = new WxAccessTokenDO();
//                newaccessToken.setAccessToken(token);
//                newaccessToken.setExpiresIn(Long.parseLong(expires_in));
//                newaccessToken.setAddTimestamp(System.currentTimeMillis());
//                newaccessToken.setCzrq(new Date());
//                newaccessToken.setCode(UUID.randomUUID().toString().replace("-",""));
//                newaccessToken.setWechatId(wechatId);
//                wxAccessTokenDao.save(newaccessToken);
//                return newaccessToken;
//            } else {
//                return null;
//            }
//        } catch (Exception e) {
//            e.printStackTrace();
//            return null;
//        }
//    }
//}

+ 0 - 177
svr/svr-base/src/main/java/com/yihu/jw/business/wx/service/WxGraphicMessageService.java

@ -1,177 +0,0 @@
//package com.yihu.jw.business.wx.service;
//
//import com.yihu.jw.base.wx.WxGraphicMessageDO;
//import com.yihu.jw.business.wx.dao.WxGraphicMessageDao;
//import com.yihu.jw.exception.ApiException;
//import com.yihu.jw.exception.code.ExceptionCode;
//import com.yihu.base.mysql.query.BaseJpaService;
//import com.yihu.jw.rm.base.WechatRequestMapping;
//import com.yihu.jw.base.util.MessageUtil;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//import org.springframework.util.StringUtils;
//
//import javax.persistence.Transient;
//import javax.servlet.http.HttpServletRequest;
//import java.util.*;
//
///**
// * Created by Administrator on 2017/5/20 0020.
// */
//@Service
//public class WxGraphicMessageService extends BaseJpaService<WxGraphicMessageDO, WxGraphicMessageDao> {
//
//    @Autowired
//    private WxGraphicMessageDao wxGraphicMessageDao;
//
//    @Transient
//    public WxGraphicMessageDO createWxGraphicMessage(WxGraphicMessageDO wxGraphicMessage) {
//        String code = UUID.randomUUID().toString().replaceAll("-", "");
//        wxGraphicMessage.setId(code);
//        if (StringUtils.isEmpty(wxGraphicMessage.getStatus())) {
//            throw new ApiException(WechatRequestMapping.WxGraphicMessage.message_fail_status_is_null, ExceptionCode.common_error_params_code);
//        }
//        if (StringUtils.isEmpty(wxGraphicMessage.getTitle())) {
//            throw new ApiException(WechatRequestMapping.WxGraphicMessage.message_fail_title_is_null, ExceptionCode.common_error_params_code);
//        }
//        WxGraphicMessageDO wxGraphicMessageTem = wxGraphicMessageDao.findById(wxGraphicMessage.getId());
//        if (wxGraphicMessageTem != null) {
//            throw new ApiException(WechatRequestMapping.WxGraphicMessage.message_fail_id_exist, ExceptionCode.common_error_params_code);
//        }
//        return wxGraphicMessageDao.save(wxGraphicMessage);
//    }
//
//    @Transient
//    public WxGraphicMessageDO updateWxGraphicMessage(WxGraphicMessageDO wxGraphicMessage) {
//        if (StringUtils.isEmpty(wxGraphicMessage.getId())) {
//            throw new ApiException(WechatRequestMapping.WxGraphicMessage.message_fail_id_is_null, ExceptionCode.common_error_params_code);
//        }
//        if (StringUtils.isEmpty(wxGraphicMessage.getStatus())) {
//            throw new ApiException(WechatRequestMapping.WxGraphicMessage.message_fail_status_is_null, ExceptionCode.common_error_params_code);
//        }
//
//        //根据id查找
//        WxGraphicMessageDO wxGraphicMessage1 = findById(wxGraphicMessage.getId());
//        if(wxGraphicMessage1==null){
//            throw new ApiException(WechatRequestMapping.WxGraphicMessage.message_fail_wxGraphicMessage_is_no_exist, ExceptionCode.common_error_params_code);
//        }
//        return wxGraphicMessageDao.save(wxGraphicMessage);
//    }
//
//    public WxGraphicMessageDO findById(String id) {
//      return wxGraphicMessageDao.findById(id);
//    }
//
//    @Transient
//    public void deleteWxGraphicMessage(String codes, String userCode, String userName) {
//        if(!StringUtils.isEmpty(codes)){
//            String[] codeArray = codes.split(",");
//            for(String code:codeArray){
//                WxGraphicMessageDO wxGraphicMessage = findById(code);
//                wxGraphicMessage.setStatus(-1);
//                wxGraphicMessage.setUpdateUser(userCode);
//                wxGraphicMessage.setUpdateUserName(userName);
//                wxGraphicMessageDao.save(wxGraphicMessage);
//            }
//        }
//    }
//
//
//
//    private String replyNewsMessage(String toUser,String fromUser,List<Map<String,String>> articles) throws Exception {
//        if(articles == null || articles.size() < 1){
//            throw new Exception("图文信息不能为空!");
//        }
//
//        StringBuilder result = new StringBuilder();
//        result.append("<xml>");
//        result.append("<ToUserName>" + toUser + "</ToUserName>");
//        result.append("<FromUserName>" + fromUser + "</FromUserName>");
//        result.append("<CreateTime>" + new Date().getTime() + "</CreateTime>");
//        result.append("<MsgType>news</MsgType>");
//        result.append("<ArticleCount>" + articles.size() + "</ArticleCount>");
//        result.append("<Articles>");
//
//        for(Map<String,String>  article : articles){
//            result.append("<item>");
//            result.append("<Title>" +  article.get("Title") +"</Title>");
//            result.append("<Description>" + article.get("Description") + "</Description>");
//            result.append("<PicUrl>" + article.get("PicUrl") + "</PicUrl>");
//            result.append("<Url>" + article.get("Url") + "</Url>");
//            result.append("</item>");
//        }
//
//        result.append("</Articles>");
//        result.append("</xml>");
//
//        return result.toString();
//    }
//
//    /**
//     * 发送图文消息
//     * @param codes
//     * @param request
//     * @return
//     */
//    public String sendGraphicMessages(String codes, HttpServletRequest request) {
//        try {
//            // xml请求解析
//            Map<String, String> requestMap = MessageUtil.parseXml(request);
//            //用户openid
//            String fromUserName = requestMap.get("FromUserName");
//            //微信公众号
//            String toUserName = requestMap.get("ToUserName");
//            // 图文信息
//            List<Map<String,String>> articles =  new ArrayList<>();
//            if(codes!=null){
//                String[] codeArray = codes.split(",");
//                for(String code: codeArray){
//                    WxGraphicMessageDO graphicMessage = findById(code);
//                    Map<String,String> article = new HashMap<>();
//                    article.put("Url",graphicMessage.getUrl());
//                    article.put("Title", graphicMessage.getTitle());
//                    article.put("Description",graphicMessage.getDescription());
//                    article.put("PicUrl",graphicMessage.getPicUrl());
//                    articles.add(article);
//                }
//            }
//            // 构建回复消息XML
//            return replyNewsMessage(fromUserName, toUserName, articles);
//        } catch (Exception e) {
//            e.printStackTrace();
//            return e.getMessage();
//        }
//    }
//
//    /**
//     * 发送图文消息
//     * @param ids
//     * @param fromUserName   用户的openId
//     * @param toUserName
//     * @return
//     */
//    public String sendGraphicMessages(String ids, String fromUserName,String toUserName) {
//        try {
//        // 图文信息
//            List<Map<String,String>> articles =  new ArrayList<>();
//            if(ids!=null){
//                String[] codeArray = ids.split(",");
//                for(String id: codeArray){
//                    WxGraphicMessageDO graphicMessage = findById(id);
//                    Map<String,String> article = new HashMap<>();
//                    article.put("Url",graphicMessage.getUrl());
//                    article.put("Title", graphicMessage.getTitle());
//                    article.put("Description",graphicMessage.getDescription());
//                    article.put("PicUrl",graphicMessage.getPicUrl());
//                    articles.add(article);
//                }
//            }
//            // 构建回复消息XML
//            return replyNewsMessage(fromUserName, toUserName, articles);
//        } catch (Exception e) {
//            e.printStackTrace();
//            return e.getMessage();
//        }
//    }
//
//}

+ 0 - 50
svr/svr-base/src/main/java/com/yihu/jw/business/wx/service/WxMenuService.java

@ -1,50 +0,0 @@
//package com.yihu.jw.business.wx.service;
//
//import com.yihu.jw.base.util.HttpUtil;
//import com.yihu.jw.entity.base.wx.WxMenuDO;
//import com.yihu.jw.entity.base.wx.WxMenuJsonDO;
//import com.yihu.jw.business.wx.dao.WechatDao;
//import com.yihu.jw.business.wx.dao.WxMenuDao;
//import com.yihu.jw.business.wx.dao.WxMenuJsonDao;
//import com.yihu.jw.entity.base.wx.WxWechatDO;
//import com.yihu.jw.restmodel.web.MixEnvelop;
//import com.yihu.jw.rm.base.WechatRequestMapping;
//import com.yihu.mysql.query.BaseJpaService;
//import org.json.JSONObject;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//
///**
// * Created by Administrator on 2017/5/19 0019.
// */
//@Service
//public class WxMenuService extends BaseJpaService<WxMenuDO, WxMenuDao>{
//
//    @Autowired
//    private WxAccessTokenService wxAccessTokenService;
//    @Autowired
//    private WxMenuJsonDao wxMenuJsonDao;
//    @Autowired
//    private WechatDao wechatDao;
//
//    public MixEnvelop createWxMenu(String wxId){
//
////        String url = "https://api.weixin.qq.com/cgi-bin/menu/addconditional?access_token=" ;
//        String url ="https://api.weixin.qq.com/cgi-bin/menu/create?access_token="+ wxAccessTokenService.getWxAccessTokenById(wxId).getAccessToken();
//        WxMenuJsonDO wxMenuJsonDO = wxMenuJsonDao.findByWechatIdAndStatus(wxId,1);
//        String params = wxMenuJsonDO.getContent();
//        WxWechatDO wechatDO =  wechatDao.findById(wxId);
//        // 替换服务器地址、APPID
//        params = params.replaceAll("server_url", wechatDO.getBaseUrl());
//        params = params.replaceAll("appId", wechatDO.getAppId());
//
//        String jsonStr = HttpUtil.sendPost(url, params);
//        JSONObject result = new JSONObject(jsonStr);
//        if (result != null && result.get("errcode").toString().equals("0") && result.getString("errmsg").equals("ok")) {
//            MixEnvelop.getSuccess(WechatRequestMapping.WxMenu.message_success_update);
//        }
//        return MixEnvelop.getError(result.toString());
//
//    }
//
//}

+ 0 - 156
svr/svr-base/src/main/java/com/yihu/jw/business/wx/service/WxTemplateService.java

@ -1,156 +0,0 @@
//package com.yihu.jw.business.wx.service;
//
//import com.yihu.jw.business.wx.dao.WxTemplateConfigDao;
//import com.yihu.jw.entity.base.wx.WxTemplateConfigDO;
//import com.yihu.jw.util.wechat.WeixinMessagePushUtils;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//
///**
// * Created by Administrator on 2017/5/19 0019.
// */
//@Service
//public class WxTemplateService {
//
//    private Logger logger= LoggerFactory.getLogger(WxTemplateService.class);
//
//    @Autowired
//    private WxTemplateConfigDao wxTemplateConfigDao;
//
//    @Autowired
//    private WxAccessTokenService wxAccessTokenService;
//
//    @Autowired
//    private WeixinMessagePushUtils weixinMessagePushUtils;
//
//    public String sendWeTempMesTest(String wechatId,String openid)throws Exception{
//        WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndScene(wechatId,"template_survey","test");
//        config.setFirst(config.getFirst().replace("key1","小明"));
//        config.setKeyword2("2018-08-21");
//        weixinMessagePushUtils.putWxMsg(wxAccessTokenService.getWxAccessTokenById(wechatId).getAccessToken(),openid,config);
//        return "success";
//    }
//
//
////    public WxTemplateDO createWxTemplate(WxTemplateDO wxTemplate) {
////        if (StringUtils.isEmpty(wxTemplate.getTemplateId())) {
////            throw new ApiException(WechatRequestMapping.WxTemplate.message_fail_templateid_is_null, ExceptionCode.common_error_params_code);
////        }
////        String content = wxTemplate.getContent().replace(" ","");
////        if (StringUtils.isEmpty(content)) {
////            throw new ApiException(WechatRequestMapping.WxTemplate.message_fail_content_is_null, ExceptionCode.common_error_params_code);
////        }
////        if(!content.matches("\\{\\{.+\\.DATA\\}\\}")){//content必须还有 "{{.DATA}}"
////            throw new ApiException(WechatRequestMapping.WxTemplate.message_fail_content_format_is_not_right, ExceptionCode.common_error_params_code);
////        }
////        return wxTemplateDao.save(wxTemplate);
////    }
////
////    public WxTemplateDO updateWxTemplate(WxTemplateDO wxTemplate) {
////        if (StringUtils.isEmpty(wxTemplate.getTemplateId())) {
////            throw new ApiException(WechatRequestMapping.WxTemplate.message_fail_templateid_is_null, ExceptionCode.common_error_params_code);
////        }
////        String content = wxTemplate.getContent().replace(" ","");
////        if (StringUtils.isEmpty(content)) {
////            throw new ApiException(WechatRequestMapping.WxTemplate.message_fail_content_is_null, ExceptionCode.common_error_params_code);
////        }
////        String id = wxTemplate.getId();
////        if (StringUtils.isEmpty(id)) {
////            throw new ApiException(WechatRequestMapping.WxConfig.message_fail_id_is_null, ExceptionCode.common_error_params_code);
////        }
////        WxTemplateDO wxTemplate1 = findById(id);
////        if(wxTemplate1==null){
////            throw new ApiException(WechatRequestMapping.WxTemplate.message_fail_template_is_no_exist, ExceptionCode.common_error_params_code);
////        }
////        wxTemplate.setCreateTime(wxTemplate1.getCreateTime());
////        wxTemplate.setUpdateTime(new Date());
////        if(!content.matches("\\{\\{.+\\.DATA\\}\\}")){//content必须还有 "{{.DATA}}"
////            throw new ApiException(WechatRequestMapping.WxTemplate.message_fail_content_format_is_not_right, ExceptionCode.common_error_params_code);
////        }
////        return wxTemplateDao.save(wxTemplate);
////    }
////
////    public void deleteWxTemplate(String codes, String userCode, String userName) {
////        if(!StringUtils.isEmpty(codes)) {
////            String[] codeArray = codes.split(",");
////            for (String code : codeArray) {
////                WxTemplateDO wxTemplate = wxTemplateDao.findById(code);
////                if (wxTemplate == null) {
////                    throw new ApiException(WechatRequestMapping.WxTemplate.message_fail_id_no_exist, ExceptionCode.common_error_params_code);
////                }
////                wxTemplate.setStatus(-1);
////                wxTemplate.setUpdateUser(userCode);
////                wxTemplate.setUpdateUserName(userName);
////                wxTemplateDao.save(wxTemplate);
////            }
////        }
////    }
////
////
////    public WxTemplateDO findById(String id) {
////        WxTemplateDO wxTemplate = wxTemplateDao.findById(id);
////        return wxTemplate;
////    }
////
////    public JSONObject sendTemplateMessage(String openid, String templateId, String url, String data,Miniprogram miniprogram) {
////        try {
////            //首先根据wechatTemplate获取微信模版
////            WxTemplateDO wxTemplate = findById(templateId);
////            if(wxTemplate==null){
////                throw new ApiException(WechatRequestMapping.WxTemplate.message_fail_template_is_no_exist, ExceptionCode.common_error_params_code);
////            }
////            String wechatCode =  wxTemplate.getWechatId();
////            String content = wxTemplate.getContent().replaceAll(" ", "");//{{result.DATA}}领奖金额:{{withdrawMoney.DATA}   }领奖  时间:{ {withdrawTime.DATA} }银行信息:{ {cardInfo.DATA} }到账时间:{{arrivedTime.DATA}}{{remark.DATA}}
////            String[] contentArray = content.split("\\{\\{");
////
////            //将result,withdrawMoney,withdrawTime,cardInfo,arrivedTime等字符串放入contentList中
////            List<String> contentList = new ArrayList<>();
////            for(int i=1;i<contentArray.length;i++){
////                contentList.add(contentArray[i].substring(0,contentArray[i].indexOf(".")));
////            }
////
////            ObjectMapper mapper = new ObjectMapper();
////            ////将data转为对象
////            Map<String, WechatTemplateDataDO> dataMap = mapper.readValue(data, new TypeReference<LinkedHashMap<String, WechatTemplateDataDO>>() {});
////            Map<String, WechatTemplateDataDO> newDataMap = new LinkedHashMap<String, WechatTemplateDataDO>();
////            int j = 0;
////            for (Map.Entry<String, WechatTemplateDataDO> entry : dataMap.entrySet()) {//(keyword1,WechatTemplateData)
////                String key = entry.getKey();//keyword1   转为result
////                newDataMap.put(contentList.get(j),entry.getValue());
////                j++;
////            }
////
////            //将数据封装在WechatTemplate对象中
////            WechatTemplateDO wechatTemplate = new WechatTemplateDO();
////            wechatTemplate.setTouser(openid);
////            wechatTemplate.setUrl(url);
////            wechatTemplate.setTemplate_id(wxTemplate.getTemplateId());
////            if(miniprogram!=null){
////                wechatTemplate.setMiniprogram(miniprogram);
////            }
////            wechatTemplate.setData(newDataMap);
////
////            String params = mapper.writeValueAsString(wechatTemplate);
////            logger.info("----------------------模版消息json字符串:"+params+"------------------");
////
////            WxAccessTokenDO wxAccessTokenByCode = wxAccessTokenService.getWxAccessTokenById(wechatCode);
////            String token = wxAccessTokenByCode.getAccessToken();
////            String token_url = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + token;
////            String result = HttpUtil.sendPost(token_url, params);
////            logger.info("------------------------发送模板消息,微信返回结果:"+result+"-----------------------");
////
////            JSONObject jsonResult = new JSONObject(result);
////            return jsonResult;
////        } catch (Exception e) {
////            e.printStackTrace();
////            JSONObject jsonResult = new JSONObject();
////            return jsonResult;
////        }
////    }
////
////    public List<WxTemplateDO> findByWxId(String code) {
////        return wxTemplateDao.findByWxId(code);
////    }
//}

+ 6 - 6
svr/svr-base/src/main/resources/application.yml

@ -106,12 +106,12 @@ jw:
spring:
  profiles: jwtest
  datasource:
#    url: jdbc:mysql://172.17.110.160/base?useUnicode:true&amp;characterEncoding=utf-8&amp;autoReconnect=true
#    username: ssgg
#    password: ssgg
    url: jdbc:mysql://172.19.103.77/base?useUnicode:true&characterEncoding=utf-8&autoReconnect=true
    username: root
    password: 123456
    url: jdbc:mysql://172.17.110.160/base?useUnicode:true&amp;characterEncoding=utf-8&amp;autoReconnect=true
    username: ssgg
    password: ssgg
#    url: jdbc:mysql://172.19.103.77/base?useUnicode:true&characterEncoding=utf-8&autoReconnect=true
#    username: root
#    password: 123456
  elasticsearch:
    cluster-name: jkzl #集群名 默认elasticsearch
    cluster-nodes: 172.19.103.45:9300,172.19.103.68:9300 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode