Browse Source

代码重构

chenweida 7 years ago
parent
commit
954aa51454
33 changed files with 117 additions and 204 deletions
  1. 1 1
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/wx/WechatRequestMapping.java
  2. 2 2
      svr/svr-base/src/main/java/com/yihu/jw/business/base/controller/FunctionController.java
  3. 1 1
      svr/svr-base/src/main/java/com/yihu/jw/business/base/controller/ModuleController.java
  4. 6 6
      svr/svr-base/src/main/java/com/yihu/jw/business/base/service/FunctionService.java
  5. 5 5
      svr/svr-base/src/main/java/com/yihu/jw/business/base/service/ModuleService.java
  6. 3 3
      svr/svr-base/src/main/java/com/yihu/jw/business/base/service/SaasService.java
  7. 3 3
      svr/svr-base/src/main/java/com/yihu/jw/business/sms/service/SmsGatewayService.java
  8. 6 6
      svr/svr-base/src/main/java/com/yihu/jw/business/wx/controller/WechatConfigController.java
  9. 10 10
      svr/svr-base/src/main/java/com/yihu/jw/business/wx/controller/WxMenuController.java
  10. 1 1
      svr/svr-base/src/main/java/com/yihu/jw/business/wx/controller/WxTemplateController.java
  11. 3 6
      svr/svr-base/src/main/java/com/yihu/jw/business/wx/dao/WechatDao.java
  12. 1 3
      svr/svr-base/src/main/java/com/yihu/jw/business/wx/dao/WxGraphicMessageDao.java
  13. 1 3
      svr/svr-base/src/main/java/com/yihu/jw/business/wx/dao/WxMenuDao.java
  14. 2 4
      svr/svr-base/src/main/java/com/yihu/jw/business/wx/dao/WxTemplateDao.java
  15. 7 15
      svr/svr-base/src/main/java/com/yihu/jw/business/wx/service/WechatService.java
  16. 2 2
      svr/svr-base/src/main/java/com/yihu/jw/business/wx/service/WxAccessTokenService.java
  17. 7 10
      svr/svr-base/src/main/java/com/yihu/jw/business/wx/service/WxGraphicMessageService.java
  18. 22 26
      svr/svr-base/src/main/java/com/yihu/jw/business/wx/service/WxMenuService.java
  19. 6 22
      svr/svr-base/src/main/java/com/yihu/jw/business/wx/service/WxTemplateService.java
  20. 1 1
      svr/svr-manage/src/main/java/com/yihu/jw/manage/controller/wechat/WechatConfigController.java
  21. 1 5
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/dao/agreement/WlyyAgreementDao.java
  22. 1 5
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/dao/agreement/WlyyAgreementKpiDao.java
  23. 2 2
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/dao/agreement/WlyyAgreementKpiLogDao.java
  24. 2 2
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/dao/agreement/WlyySignFamilyDao.java
  25. 4 4
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/dao/doctor/DoctorDao.java
  26. 1 3
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/dao/patient/AdvertisementDao.java
  27. 1 4
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/service/agreement/WlyyAgreementKpiLogService.java
  28. 2 15
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/service/agreement/WlyyAgreementKpiService.java
  29. 2 13
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/service/agreement/WlyyAgreementService.java
  30. 1 4
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/service/agreement/WlyySignFamilyService.java
  31. 4 4
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/service/doctor/DoctorService.java
  32. 5 12
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/service/patient/AdvertisementService.java
  33. 1 1
      web-gateway/src/main/java/com/yihu/jw/feign/base/wx/WechatFeign.java

+ 1 - 1
common/common-request-mapping/src/main/java/com/yihu/jw/rm/wx/WechatRequestMapping.java

@ -89,7 +89,7 @@ public class WechatRequestMapping {
        public static final String api_delete="/wechatConfig/{codes}";
        public static final String api_getWechatNoPage="/wechatConfig/listNoPage";
        public static final String api_getWechats="/wechatConfig/list";
        public static final String api_getByCode="/wechatConfig/{code}";
        public static final String api_getById="/wechatConfig/{id}";
        public static final String message_success_create="wechat create success";
        public static final String message_success_update="wechat update success";

+ 2 - 2
svr/svr-base/src/main/java/com/yihu/jw/business/base/controller/FunctionController.java

@ -115,7 +115,7 @@ public class FunctionController extends EnvelopRestController {
        List<Function> list = functionService.search(fields, filters, sorts, page, size);
        if(list!=null){
            for(Function func:list){//循环遍历,设置是否有子节点
                List<Function> children = functionService.getChildren(func.getCode());
                List<Function> children = functionService.getChildren(func.getId());
                func.setChildren(children);
            }
        }
@ -145,7 +145,7 @@ public class FunctionController extends EnvelopRestController {
        List<Object> functions = new ArrayList<>();
        if(list!=null){
            for(Function func:list){
                String code = func.getCode();
                String code = func.getId();
                func = functionService.getAllChildren(code);
                functions.add(func);
            }

+ 1 - 1
svr/svr-base/src/main/java/com/yihu/jw/business/base/controller/ModuleController.java

@ -113,7 +113,7 @@ public class ModuleController extends EnvelopRestController {
        if(list!=null){
            for(Module module:list){//循环遍历,设置是否有子节点
                List<Module> children = moduleService.getChildren(module.getCode());
                List<Module> children = moduleService.getChildren(module.getId());
                //children长度为0时    state  “open”表示是子节点,“closed”表示为父节点;
                // children长度>0时,  state   “open,closed”表示是节点的打开关闭
                if (children.size()>0){

+ 6 - 6
svr/svr-base/src/main/java/com/yihu/jw/business/base/service/FunctionService.java

@ -36,7 +36,7 @@ public class FunctionService extends BaseJpaService<Function, FunctionDao> {
    @Transactional
    public Function createFunction(Function function) throws ApiException {
        if (StringUtils.isEmpty(function.getCode())) {
        if (StringUtils.isEmpty(function.getId())) {
            throw new ApiException(BaseRequestMapping.Function.message_fail_code_is_null, ExceptionCode.common_error_params_code);
        }
        if (StringUtils.isEmpty(function.getName())) {
@ -51,7 +51,7 @@ public class FunctionService extends BaseJpaService<Function, FunctionDao> {
    @Transactional
    public Function updateFunction(Function function) {
        if (StringUtils.isEmpty(function.getCode())) {
        if (StringUtils.isEmpty(function.getId())) {
            throw new ApiException(BaseRequestMapping.Function.message_fail_code_is_null, ExceptionCode.common_error_params_code);
        }
        if (StringUtils.isEmpty(function.getName())) {
@ -60,7 +60,7 @@ public class FunctionService extends BaseJpaService<Function, FunctionDao> {
        if (StringUtils.isEmpty(function.getId())) {
            throw new ApiException(BaseRequestMapping.Function.message_fail_id_is_null, ExceptionCode.common_error_params_code);
        }
        Function functionTmp = functionDao.findByNameExcludeCode(function.getName(), function.getCode());
        Function functionTmp = functionDao.findByNameExcludeCode(function.getName(), function.getId());
        if (functionTmp != null) {
            throw new ApiException(BaseRequestMapping.Function.message_fail_name_exist, ExceptionCode.common_error_params_code);
        }
@ -113,7 +113,7 @@ public class FunctionService extends BaseJpaService<Function, FunctionDao> {
    public List<Function> getChildren(String code){
        List<Function> childrens = functionDao.getChildren(code);
        for(Function children:childrens){
            List<Function> children1 = functionDao.getChildren(children.getCode());//判断子节点是否有孙节点
            List<Function> children1 = functionDao.getChildren(children.getId());//判断子节点是否有孙节点
            children.setChildren(children1);
        }
        return childrens;
@ -132,7 +132,7 @@ public class FunctionService extends BaseJpaService<Function, FunctionDao> {
        Map<String, String> map = new HashMap<>();
        if(null!=functions){
            for(Function function: functions){
                map.put(function.getCode(),function.getName());
                map.put(function.getId(),function.getName());
            }
        }
        return map;
@ -147,7 +147,7 @@ public class FunctionService extends BaseJpaService<Function, FunctionDao> {
        Function function = functionDao.findByCode(code);
        List<Function> childrens = functionDao.getChildren(code);
        for(Function children:childrens){
            getAllChildren(children.getCode());
            getAllChildren(children.getId());
        }
        function.setChildren(childrens);
        return function;

+ 5 - 5
svr/svr-base/src/main/java/com/yihu/jw/business/base/service/ModuleService.java

@ -35,7 +35,7 @@ public class ModuleService extends BaseJpaService<Module, ModuleDao> {
    @Transactional
    public Module createModule(Module module) throws ApiException {
        if (StringUtils.isEmpty(module.getCode())) {
        if (StringUtils.isEmpty(module.getId())) {
            throw new ApiException(BaseRequestMapping.Module.message_fail_code_is_null, ExceptionCode.common_error_params_code);
        }
        if (StringUtils.isEmpty(module.getName())) {
@ -53,7 +53,7 @@ public class ModuleService extends BaseJpaService<Module, ModuleDao> {
    @Transactional
    public Module updateModule(Module module) {
        if (StringUtils.isEmpty(module.getCode())) {
        if (StringUtils.isEmpty(module.getId())) {
            throw new ApiException(BaseRequestMapping.Module.message_fail_code_is_null, ExceptionCode.common_error_params_code);
        }
        if (StringUtils.isEmpty(module.getName())) {
@ -62,7 +62,7 @@ public class ModuleService extends BaseJpaService<Module, ModuleDao> {
        if (StringUtils.isEmpty(module.getId())) {
            throw new ApiException(BaseRequestMapping.Module.message_fail_id_is_null, ExceptionCode.common_error_params_code);
        }
        Module moduleTmp = moduleDao.findByNameExcludeCode(module.getName(), module.getCode());
        Module moduleTmp = moduleDao.findByNameExcludeCode(module.getName(), module.getId());
        if (moduleTmp != null) {
            throw new ApiException(BaseRequestMapping.Module.message_fail_name_exist, ExceptionCode.common_error_params_code);
        }
@ -110,7 +110,7 @@ public class ModuleService extends BaseJpaService<Module, ModuleDao> {
    public List<Module> getChildren(String code){
        List<Module> childrens = moduleDao.getChildren(code);
        for(Module children:childrens){
            List<Module> children1 = moduleDao.getChildren(children.getCode());//判断子节点是否有孙节点
            List<Module> children1 = moduleDao.getChildren(children.getId());//判断子节点是否有孙节点
            //没有children    state
            //“open”表示是子节点,“closed”表示为父节点;
            if (children1.size()>0){
@ -135,7 +135,7 @@ public class ModuleService extends BaseJpaService<Module, ModuleDao> {
        Map<String, String> map = new HashMap<>();
        if(null!=modules){
            for(Module module: modules){
                map.put(module.getCode(),module.getName());
                map.put(module.getId(),module.getName());
            }
        }
        return map;

+ 3 - 3
svr/svr-base/src/main/java/com/yihu/jw/business/base/service/SaasService.java

@ -21,7 +21,7 @@ public class SaasService extends BaseJpaService<Saas, SaasDao> {
    @Transactional
    public Saas createSaas(Saas saas) throws ApiException {
        if (StringUtils.isEmpty(saas.getCode())) {
        if (StringUtils.isEmpty(saas.getId())) {
            throw new ApiException(BaseRequestMapping.Saas.message_fail_code_is_null, ExceptionCode.common_error_params_code);
        }
        if (StringUtils.isEmpty(saas.getName())) {
@ -36,7 +36,7 @@ public class SaasService extends BaseJpaService<Saas, SaasDao> {
    @Transactional
    public Saas updateSaas(Saas saas) {
        if (StringUtils.isEmpty(saas.getCode())) {
        if (StringUtils.isEmpty(saas.getId())) {
            throw new ApiException(BaseRequestMapping.Saas.message_fail_code_is_null, ExceptionCode.common_error_params_code);
        }
        if (StringUtils.isEmpty(saas.getName())) {
@ -45,7 +45,7 @@ public class SaasService extends BaseJpaService<Saas, SaasDao> {
        if (StringUtils.isEmpty(saas.getId())) {
            throw new ApiException(BaseRequestMapping.Saas.message_fail_id_is_null, ExceptionCode.common_error_params_code);
        }
        Saas saasTmp = saasDao.findByNameExcludeCode(saas.getName(), saas.getCode());
        Saas saasTmp = saasDao.findByNameExcludeCode(saas.getName(), saas.getId());
        if (saasTmp != null) {
            throw new ApiException(BaseRequestMapping.Saas.message_fail_name_exist, ExceptionCode.common_error_params_code);
        }

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

@ -21,7 +21,7 @@ public class SmsGatewayService extends BaseJpaService<BaseSmsGateway, SmsGateway
    @Transactional
    public BaseSmsGateway createSmsGateway(BaseSmsGateway smsGateway) throws ApiException {
        if (StringUtils.isEmpty(smsGateway.getCode())) {
        if (StringUtils.isEmpty(smsGateway.getId())) {
            throw new ApiException(BaseSmsRequestMapping.SmsGateway.message_fail_code_is_null, ExceptionCode.common_error_params_code);
        }
        if (StringUtils.isEmpty(smsGateway.getName())) {
@ -36,7 +36,7 @@ public class SmsGatewayService extends BaseJpaService<BaseSmsGateway, SmsGateway
    @Transactional
    public BaseSmsGateway updateSmsGateway(BaseSmsGateway smsGateway) {
        if (StringUtils.isEmpty(smsGateway.getCode())) {
        if (StringUtils.isEmpty(smsGateway.getId())) {
            throw new ApiException(BaseSmsRequestMapping.SmsGateway.message_fail_code_is_null, ExceptionCode.common_error_params_code);
        }
        if (StringUtils.isEmpty(smsGateway.getName())) {
@ -45,7 +45,7 @@ public class SmsGatewayService extends BaseJpaService<BaseSmsGateway, SmsGateway
        if (StringUtils.isEmpty(smsGateway.getId())) {
            throw new ApiException(BaseSmsRequestMapping.SmsGateway.message_fail_id_is_null, ExceptionCode.common_error_params_code);
        }
        BaseSmsGateway smsGatewayTmp = smsGatewayDao.findByNameExcludeCode(smsGateway.getName(), smsGateway.getCode());
        BaseSmsGateway smsGatewayTmp = smsGatewayDao.findByNameExcludeCode(smsGateway.getName(), smsGateway.getId());
        if (smsGatewayTmp != null) {
            throw new ApiException(BaseSmsRequestMapping.SmsGateway.message_fail_name_exist, ExceptionCode.common_error_params_code);
        }

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

@ -75,14 +75,14 @@ public class WechatConfigController extends EnvelopRestController {
        }
    }
    @GetMapping(value = WechatRequestMapping.WxConfig.api_getByCode)
    @ApiOperation(value = "根据code查找微信配置", notes = "根据code查找微信配置")
    public Envelop findByCode(
            @ApiParam(name = "code", value = "code")
            @RequestParam(value = "code", required = true) String code
    @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.findByCode(code));
            return Envelop.getSuccess(WechatRequestMapping.WxConfig.message_success_find, wechatService.findById(id));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }

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

@ -120,7 +120,7 @@ public class WxMenuController extends EnvelopRestController {
        //得到微信列表数据
        List<WxWechat> wechats = wechatService.search(fields, filters, sorts, page, size);
        for(WxWechat wechat:wechats){
            List<WxMenu> parentMenus = wxMenuService.findParentMenuByWechatCode(wechat.getCode());
            List<WxMenu> parentMenus = wxMenuService.findParentMenuByWechatCode(wechat.getId());
            if (parentMenus.size()>0){
                wechat.setState("closed");
            }else{
@ -154,7 +154,7 @@ public class WxMenuController extends EnvelopRestController {
        //得到list数据
        List<WxMenu> list = wxMenuService.search(fields,filters,sorts);
        for(WxMenu wxMenu:list){
            List<WxMenu> childMenus = wxMenuService.findChildMenus(wxMenu.getCode());
            List<WxMenu> childMenus = wxMenuService.findChildMenus(wxMenu.getId());
            wxMenu.setChildren(childMenus);
        }
        //封装返回格式
@ -174,10 +174,10 @@ public class WxMenuController extends EnvelopRestController {
    @ApiOperation(value = "创建微信公众号菜单", notes = "创建微信公众号菜单")
    @RequestMapping(value = WechatRequestMapping.WxMenu.api_createMenu ,method = RequestMethod.GET)
    public Envelop createWechatMenu(
            @ApiParam(name = "wechatCode", value = "", defaultValue = "")
            @RequestParam(value = "wechatCode", required = true)String wechatCode){
            @ApiParam(name = "wechatId", value = "", defaultValue = "")
            @RequestParam(value = "wechatId", required = true)String wechatId){
        try{
            JSONObject result = wxMenuService.createWechatMenu(wechatCode);
            JSONObject result = wxMenuService.createWechatMenu(wechatId);
            String errcode = result.get("errcode").toString();
            WechatResponse wechatResponse = new WechatResponse(Integer.valueOf(errcode));
            String msg = wechatResponse.getMsg();
@ -189,19 +189,19 @@ public class WxMenuController extends EnvelopRestController {
    /**
     * 根据微信code查找父菜单
     * @param wechatCode
     * @param wechatId
     * @return
     */
    @GetMapping(value = WechatRequestMapping.WxMenu.api_getParentMenu)
    @ApiOperation(value = "根据微信code查找父菜单", notes = "根据微信code查找父菜单")
    public Envelop getParentMenu(
            @ApiParam(name = "wechatCode", value = "wechatCode")
            @PathVariable(value = "wechatCode", required = true) String wechatCode
            @ApiParam(name = "wechatId", value = "wechatId")
            @PathVariable(value = "wechatId", required = true) String wechatId
    ) {
        try {
            List<WxMenu> parentMenus = wxMenuService.findParentMenuByWechatCode(wechatCode);
            List<WxMenu> parentMenus = wxMenuService.findParentMenuByWechatCode(wechatId);
            for(WxMenu parentMenu:parentMenus){
                List<WxMenu> childMenus = wxMenuService.findChildMenus(parentMenu.getCode());
                List<WxMenu> childMenus = wxMenuService.findChildMenus(parentMenu.getId());
                if (childMenus.size()>0){
                    parentMenu.setState("closed");
                }else{

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

@ -118,7 +118,7 @@ public class WxTemplateController extends EnvelopRestController {
        //得到微信列表数据
        List<WxWechat> wechats = wechatService.search(fields, filters, sorts, page, size);
        for(WxWechat wechat:wechats){
            List<WxTemplate> wxTemplates = wxTemplateService.findByWxCode(wechat.getCode());
            List<WxTemplate> wxTemplates = wxTemplateService.findByWxCode(wechat.getId());
            if (wxTemplates.size()>0){
                wechat.setState("closed");
            }else{

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

@ -16,14 +16,11 @@ public interface WechatDao extends PagingAndSortingRepository<WxWechat, Long>, J
    WxWechat findByAppId(String appId);
    @Query("from WxWechat w where w.appId = ?1 and w.code!= ?2 and w.status!=-1")
    WxWechat findByAppIdExcludeCode(String appId, String code);
    @Query("from WxWechat w where w.code =?1 and w.status!=-1")
    WxWechat findByCode(String code);
    @Query("from WxWechat w where w.appId = ?1 and w.id!= ?2 and w.status!=-1")
    WxWechat findByAppIdExcludeId(String appId, String code);
    @Query("from WxWechat w where w.id = ?1 and w.status!=-1")
    WxWechat findById(Long id);
    WxWechat findById(String id);
    @Query("from WxWechat w where w.status!=-1")
    List<WxWechat> findAll();

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

@ -17,9 +17,7 @@ public interface WxGraphicMessageDao extends PagingAndSortingRepository<WxGraphi
    @Query("from WxWechat w where w.appId = ?1 and w.code!= ?2 and w.status!=-1")
    WxGraphicMessage findByAppIdExcludeCode(String appId, String code);
    @Query("from WxGraphicMessage w where w.code =?1 and w.status!=-1")
    WxGraphicMessage findByCode(String code);
    @Query("from WxGraphicMessage w where w.id =?1 and w.status!=-1")
    WxGraphicMessage findById(Long id);
    WxGraphicMessage findById(String id);
}

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

@ -12,11 +12,9 @@ import java.util.List;
 */
public interface WxMenuDao  extends PagingAndSortingRepository<WxMenu, Long>, JpaSpecificationExecutor<WxMenu> {
    @Query("from WxMenu m where m.code = ?1 and m.status = 1")
    WxMenu findByCode(String code);
    @Query("from WxMenu m where m.id = ?1 and m.status = 1")
    WxMenu findById(Long id);
    WxMenu findById(String id);
    @Query("from WxMenu m where m.wechatCode =?1 and m.status = 1 order  by m.supMenucode ,m.sort")
    List<WxMenu> findByWechatCode(String wechatCode);

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

@ -12,12 +12,10 @@ import java.util.List;
 */
public interface WxTemplateDao extends PagingAndSortingRepository<WxTemplate, Long>, JpaSpecificationExecutor<WxTemplate> {
    @Query("from WxTemplate w where w.code = ?1 and w.status =1")
    WxTemplate findByCode(String code);
    @Query("from WxTemplate w where w.id = ?1 and w.status =1")
    WxTemplate findById(Long id);
    WxTemplate findById(String id);
    @Query("from WxTemplate w where w.wechatCode = ?1 and w.status =1")
    @Query("from WxTemplate w where w.wechatId = ?1 and w.status =1")
    List<WxTemplate> findByWxCode(String code);
}

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

@ -25,7 +25,7 @@ public class WechatService extends BaseJpaService<WxWechat, WechatDao> {
    @Transient
    public WxWechat createWechat(WxWechat wechat) {
        String code = UUID.randomUUID().toString().replaceAll("-", "");
        wechat.setCode(code);
        wechat.setId(code);
        if (StringUtils.isEmpty(wechat.getSaasId())) {
            throw new ApiException(WechatRequestMapping.WxConfig.message_fail_saasId_is_null, ExceptionCode.common_error_params_code);
        }
@ -47,7 +47,7 @@ public class WechatService extends BaseJpaService<WxWechat, WechatDao> {
    @Transient
    public WxWechat updateWxchat(WxWechat wechat) {
        if (StringUtils.isEmpty(wechat.getCode())) {
        if (StringUtils.isEmpty(wechat.getId())) {
            throw new ApiException(WechatRequestMapping.WxConfig.message_fail_code_is_null, ExceptionCode.common_error_params_code);
        }
        if (StringUtils.isEmpty(wechat.getSaasId())) {
@ -62,27 +62,19 @@ public class WechatService extends BaseJpaService<WxWechat, WechatDao> {
        if (StringUtils.isEmpty(wechat.getName())) {
            throw new ApiException(WechatRequestMapping.WxConfig.message_fail_name_is_null, ExceptionCode.common_error_params_code);
        }
        Long id = wechat.getId();
        if (StringUtils.isEmpty(id)) {
            throw new ApiException(WechatRequestMapping.WxConfig.message_fail_id_is_null, ExceptionCode.common_error_params_code);
        }
        WxWechat wechat1 = findById(id);
        WxWechat wechat1 = findById(wechat.getId());
        if (wechat1 == null) {
            throw new ApiException(WechatRequestMapping.WxConfig.message_fail_wxWechat_is_no_exist, ExceptionCode.common_error_params_code);
        }
        WxWechat wechatTem = wechatDao.findByAppIdExcludeCode(wechat.getAppId(), wechat.getCode());
        WxWechat wechatTem = wechatDao.findByAppIdExcludeId(wechat.getAppId(), wechat.getId());
        if (wechatTem != null) {
            throw new ApiException(WechatRequestMapping.WxConfig.message_fail_appId_exist, ExceptionCode.common_error_params_code);
        }
        return wechatDao.save(wechat);
    }
    public WxWechat findByCode(String code) {
        WxWechat wxWechat = wechatDao.findByCode(code);
        return wxWechat;
    }
    public WxWechat findById(Long id) {
    public WxWechat findById(String id) {
        return wechatDao.findById(id);
    }
@ -91,7 +83,7 @@ public class WechatService extends BaseJpaService<WxWechat, WechatDao> {
        if (!StringUtils.isEmpty(codes)) {
            String[] codeArray = codes.split(",");
            for (String code : codeArray) {
                WxWechat wxWechat = wechatDao.findByCode(code);
                WxWechat wxWechat = wechatDao.findById(code);
                if (wxWechat == null) {
                    throw new ApiException(WechatRequestMapping.WxConfig.message_fail_code_no_exist, ExceptionCode.common_error_params_code);
                }
@ -117,7 +109,7 @@ public class WechatService extends BaseJpaService<WxWechat, WechatDao> {
        Map<String, String> map = new HashMap<>();
        if (null != wechats) {
            for (WxWechat wx : wechats) {
                map.put(wx.getCode(), wx.getName());
                map.put(wx.getId(), wx.getName());
            }
        }
        return map;

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

@ -43,7 +43,7 @@ public class WxAccessTokenService extends BaseJpaService<WxAccessToken, WxAccess
    public WxAccessToken getWxAccessTokenByCode(String wechatCode) {
        try {
            //根据wechatCode查找出appid和appSecret
            WxWechat wxWechat = wechatDao.findByCode(wechatCode);
            WxWechat wxWechat = wechatDao.findById(wechatCode);
            if(wxWechat==null){
                throw new ApiException(WechatRequestMapping.WxConfig.message_fail_wxWechat_is_no_exist, ExceptionCode.common_error_params_code);
            }
@ -82,7 +82,7 @@ public class WxAccessTokenService extends BaseJpaService<WxAccessToken, WxAccess
                newaccessToken.setAddTimestamp(System.currentTimeMillis());
                newaccessToken.setCzrq(new Date());
                newaccessToken.setCode(UUID.randomUUID().toString().replace("-",""));
                newaccessToken.setWechatCode(wechatCode);
                newaccessToken.setWechatId(wechatCode);
                wxAccessTokenDao.save(newaccessToken);
                return newaccessToken;
            } else {

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

@ -27,14 +27,14 @@ public class WxGraphicMessageService extends BaseJpaService<WxGraphicMessage, Wx
    @Transient
    public WxGraphicMessage createWxGraphicMessage(WxGraphicMessage wxGraphicMessage) {
        String code = UUID.randomUUID().toString().replaceAll("-", "");
        wxGraphicMessage.setCode(code);
        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);
        }
        WxGraphicMessage wxGraphicMessageTem = wxGraphicMessageDao.findByCode(wxGraphicMessage.getCode());
        WxGraphicMessage wxGraphicMessageTem = wxGraphicMessageDao.findById(wxGraphicMessage.getId());
        if (wxGraphicMessageTem != null) {
            throw new ApiException(WechatRequestMapping.WxGraphicMessage.message_fail_code_exist, ExceptionCode.common_error_params_code);
        }
@ -43,18 +43,15 @@ public class WxGraphicMessageService extends BaseJpaService<WxGraphicMessage, Wx
    @Transient
    public WxGraphicMessage updateWxGraphicMessage(WxGraphicMessage wxGraphicMessage) {
        if (StringUtils.isEmpty(wxGraphicMessage.getCode())) {
        if (StringUtils.isEmpty(wxGraphicMessage.getId())) {
            throw new ApiException(WechatRequestMapping.WxGraphicMessage.message_fail_code_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);
        }
        Long id = wxGraphicMessage.getId();
        if (StringUtils.isEmpty(id)) {
            throw new ApiException(WechatRequestMapping.WxConfig.message_fail_id_is_null, ExceptionCode.common_error_params_code);
        }
        //根据id查找
        WxGraphicMessage wxGraphicMessage1 = findById(id);
        WxGraphicMessage wxGraphicMessage1 = findById(wxGraphicMessage.getId());
        if(wxGraphicMessage1==null){
            throw new ApiException(WechatRequestMapping.WxGraphicMessage.message_fail_wxGraphicMessage_is_no_exist, ExceptionCode.common_error_params_code);
        }
@ -62,11 +59,11 @@ public class WxGraphicMessageService extends BaseJpaService<WxGraphicMessage, Wx
    }
    public WxGraphicMessage findByCode(String code) {
        WxGraphicMessage WxGraphicMessage = wxGraphicMessageDao.findByCode(code);
        WxGraphicMessage WxGraphicMessage = wxGraphicMessageDao.findById(code);
        return WxGraphicMessage;
    }
    public WxGraphicMessage findById(Long id) {
    public WxGraphicMessage findById(String id) {
      return wxGraphicMessageDao.findById(id);
    }

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

@ -46,7 +46,7 @@ public class WxMenuService extends BaseJpaService<WxMenu, WxMenuDao> {
     */
    public WxMenu createWxMenu(WxMenu wxMenu) {
        String code = UUID.randomUUID().toString().replaceAll("-", "");
        wxMenu.setCode(code);
        wxMenu.setId(code);
        if(canSaveOrUpata(wxMenu)){
            return wxMenuDao.save(wxMenu);
        }
@ -55,15 +55,11 @@ public class WxMenuService extends BaseJpaService<WxMenu, WxMenuDao> {
    @Transient
    public WxMenu updateWxMenu(WxMenu wxMenu) {
        if (StringUtils.isEmpty(wxMenu.getCode())) {
        if (StringUtils.isEmpty(wxMenu.getId())) {
            throw new ApiException(WechatRequestMapping.WxMenu.message_fail_code_is_null, ExceptionCode.common_error_params_code);
        }
        if(canSaveOrUpata(wxMenu)){
            Long id = wxMenu.getId();
            if (StringUtils.isEmpty(id)) {
                throw new ApiException(WechatRequestMapping.WxConfig.message_fail_id_is_null, ExceptionCode.common_error_params_code);
            }
            WxMenu wxMenu1 = findById(id);
            WxMenu wxMenu1 = findById(wxMenu.getId());
            if(wxMenu1==null){
                throw new ApiException(WechatRequestMapping.WxMenu.message_fail_WxMenu_is_no_exist, ExceptionCode.common_error_params_code);
            }
@ -78,13 +74,13 @@ public class WxMenuService extends BaseJpaService<WxMenu, WxMenuDao> {
            String[] codeArray = codes.split(",");
            Date date = new Date();
            for (String code : codeArray) {
                WxMenu wxMenu = wxMenuDao.findByCode(code);
                WxMenu wxMenu = wxMenuDao.findById(code);
                if (wxMenu == null) {
                    continue;
                }
                String supMenucode = wxMenu.getSupMenucode();
                String supMenucode = wxMenu.getSupMenuid();
                if (StringUtils.isEmpty(supMenucode)) {//如果是空,则为父菜单
                    List<WxMenu> childMenus = findChildMenus(wxMenu.getWechatCode(), wxMenu.getCode());
                    List<WxMenu> childMenus = findChildMenus(wxMenu.getWechatId(), wxMenu.getId());
                    if (childMenus != null) {
                        for (WxMenu wxmenu : childMenus) {
                            wxmenu.setStatus(-1);
@ -107,13 +103,13 @@ public class WxMenuService extends BaseJpaService<WxMenu, WxMenuDao> {
        if(!StringUtils.isEmpty(codes)) {
            String[] codeArray = codes.split(",");
            for (String code : codeArray) {
                WxMenu wxMenu = wxMenuDao.findByCode(code);
                WxMenu wxMenu = wxMenuDao.findById(code);
                if (wxMenu == null) {
                    continue;
                }
                String supMenucode = wxMenu.getSupMenucode();
                String supMenucode = wxMenu.getSupMenuid();
                if (StringUtils.isEmpty(supMenucode)) {//如果是空,则为父菜单
                    List<WxMenu> childMenus = findChildMenus(wxMenu.getWechatCode(), wxMenu.getCode());
                    List<WxMenu> childMenus = findChildMenus(wxMenu.getWechatId(), wxMenu.getId());
                    if (childMenus != null) {
                        for (WxMenu wxmenu : childMenus) {
                            wxmenu.setStatus(-1);
@ -131,10 +127,10 @@ public class WxMenuService extends BaseJpaService<WxMenu, WxMenuDao> {
    public WxMenu findByCode(String code) {
        return wxMenuDao.findByCode(code);
        return wxMenuDao.findById(code);
    }
    public WxMenu findById(Long id) {
    public WxMenu findById(String id) {
        return wxMenuDao.findById(id);
    }
@ -163,7 +159,7 @@ public class WxMenuService extends BaseJpaService<WxMenu, WxMenuDao> {
     * @return JSONObject
     */
    public JSONObject createWechatMenu(String wechatCode) {
        WxWechat wechat = wechatService.findByCode(wechatCode);
        WxWechat wechat = wechatService.findById(wechatCode);
        if(wechat==null){
            throw new ApiException(WechatRequestMapping.WxConfig.message_fail_wxWechat_is_no_exist, ExceptionCode.common_error_params_code);
        }
@ -190,7 +186,7 @@ public class WxMenuService extends BaseJpaService<WxMenu, WxMenuDao> {
        if(menus!=null){
            menuJsonStr = "{\"button\":[{";
            for(WxMenu wxMenu:menus){
                if(StringUtils.isEmpty(wxMenu.getSupMenucode())){//说明是父菜单
                if(StringUtils.isEmpty(wxMenu.getSupMenuid())){//说明是父菜单
                    parentMenus.add(wxMenu);
                }
            }
@ -204,7 +200,7 @@ public class WxMenuService extends BaseJpaService<WxMenu, WxMenuDao> {
            }
            menuJsonStr = getString(menuJsonStr, menu);
            //查找是否有子菜单
            List<WxMenu> childMenus = findChildMenus(wechatCode, menu.getCode());
            List<WxMenu> childMenus = findChildMenus(wechatCode, menu.getId());
            if(childMenus!=null){
                int i =0;
                menuJsonStr += ",\"sub_button\":[{";
@ -262,12 +258,12 @@ public class WxMenuService extends BaseJpaService<WxMenu, WxMenuDao> {
    }
    private boolean canSaveOrUpata(WxMenu wxMenu){
        String wechatCode = wxMenu.getWechatCode();
        String supMenucode = wxMenu.getSupMenucode();
        String wechatCode = wxMenu.getWechatId();
        String supMenucode = wxMenu.getSupMenuid();
        if(StringUtils.isEmpty(wechatCode)){
            WxMenu parentMenuCode = findByCode(supMenucode);
            wechatCode = parentMenuCode.getWechatCode();
            wxMenu.setWechatCode(wechatCode);
            wechatCode = parentMenuCode.getWechatId();
            wxMenu.setWechatId(wechatCode);
        }
        String name = wxMenu.getName();
        if (StringUtils.isEmpty(name)) {
@ -280,7 +276,7 @@ public class WxMenuService extends BaseJpaService<WxMenu, WxMenuDao> {
            throw new ApiException(WechatRequestMapping.WxMenu.message_fail_sort_is_null, ExceptionCode.common_error_params_code);
        }
        //根据wechatCode查找是否存在微信配置
        WxWechat wxWechat = wechatService.findByCode(wechatCode);
        WxWechat wxWechat = wechatService.findById(wechatCode);
        if(wxWechat==null){
            throw new ApiException(WechatRequestMapping.WxConfig.message_fail_wxWechat_is_no_exist, ExceptionCode.common_error_params_code);
        }
@ -361,11 +357,11 @@ public class WxMenuService extends BaseJpaService<WxMenu, WxMenuDao> {
            }
        }
        WxMenu wxMenuTemp = null;
        if(StringUtils.isEmpty(wxMenu.getSupMenucode())){//如果是空,则为父菜单
        if(StringUtils.isEmpty(wxMenu.getSupMenuid())){//如果是空,则为父菜单
            //判断sort是否重复
            wxMenuTemp = wxMenuDao.findByWechatCodeExcludeSortFromParent(wxMenu.getWechatCode(), wxMenu.getSort(),wxMenu.getCode());
            wxMenuTemp = wxMenuDao.findByWechatCodeExcludeSortFromParent(wxMenu.getWechatId(), wxMenu.getSort(),wxMenu.getId());
        }else{//子菜单
            wxMenuTemp = wxMenuDao.findByWechatCodeExcludeSortFromChild(wxMenu.getWechatCode(), wxMenu.getSort(), wxMenu.getSupMenucode(), wxMenu.getCode());
            wxMenuTemp = wxMenuDao.findByWechatCodeExcludeSortFromChild(wxMenu.getWechatId(), wxMenu.getSort(), wxMenu.getSupMenuid(), wxMenu.getId());
        }
        if(null!=wxMenuTemp){
            throw new ApiException(WechatRequestMapping.WxMenu.message_fail_sort_is_repeat, ExceptionCode.common_error_params_code);

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

@ -36,16 +36,6 @@ public class WxTemplateService extends BaseJpaService<WxTemplate, WxTemplateDao>
    private WechatService wechatService;
    public WxTemplate createWxTemplate(WxTemplate wxTemplate) {
        String code = UUID.randomUUID().toString().replaceAll("-", "");
        wxTemplate.setCode(code);
        if (StringUtils.isEmpty(wxTemplate.getWechatCode())) {
            throw new ApiException(WechatRequestMapping.WxTemplate.message_fail_wechatCode_is_null, ExceptionCode.common_error_params_code);
        }
        //根据wechatCode查找是否存在微信配置
        WxWechat wxWechat = wechatService.findByCode(wxTemplate.getWechatCode());
        if(wxWechat==null){
            throw new ApiException(WechatRequestMapping.WxConfig.message_fail_wxWechat_is_no_exist, ExceptionCode.common_error_params_code);
        }
        if (StringUtils.isEmpty(wxTemplate.getTemplateId())) {
            throw new ApiException(WechatRequestMapping.WxTemplate.message_fail_templateid_is_null, ExceptionCode.common_error_params_code);
        }
@ -60,12 +50,6 @@ public class WxTemplateService extends BaseJpaService<WxTemplate, WxTemplateDao>
    }
    public WxTemplate updateWxTemplate(WxTemplate wxTemplate) {
        if (StringUtils.isEmpty(wxTemplate.getCode())) {
            throw new ApiException(WechatRequestMapping.WxTemplate.message_fail_code_is_null, ExceptionCode.common_error_params_code);
        }
        if (StringUtils.isEmpty(wxTemplate.getWechatCode())) {
            throw new ApiException(WechatRequestMapping.WxTemplate.message_fail_wechatCode_is_null, ExceptionCode.common_error_params_code);
        }
        if (StringUtils.isEmpty(wxTemplate.getTemplateId())) {
            throw new ApiException(WechatRequestMapping.WxTemplate.message_fail_templateid_is_null, ExceptionCode.common_error_params_code);
        }
@ -73,7 +57,7 @@ public class WxTemplateService extends BaseJpaService<WxTemplate, WxTemplateDao>
        if (StringUtils.isEmpty(content)) {
            throw new ApiException(WechatRequestMapping.WxTemplate.message_fail_content_is_null, ExceptionCode.common_error_params_code);
        }
        Long id = wxTemplate.getId();
        String id = wxTemplate.getId();
        if (StringUtils.isEmpty(id)) {
            throw new ApiException(WechatRequestMapping.WxConfig.message_fail_id_is_null, ExceptionCode.common_error_params_code);
        }
@ -93,7 +77,7 @@ public class WxTemplateService extends BaseJpaService<WxTemplate, WxTemplateDao>
        if(!StringUtils.isEmpty(codes)) {
            String[] codeArray = codes.split(",");
            for (String code : codeArray) {
                WxTemplate wxTemplate = wxTemplateDao.findByCode(code);
                WxTemplate wxTemplate = wxTemplateDao.findById(code);
                if (wxTemplate == null) {
                    throw new ApiException(WechatRequestMapping.WxTemplate.message_fail_code_no_exist, ExceptionCode.common_error_params_code);
                }
@ -106,13 +90,13 @@ public class WxTemplateService extends BaseJpaService<WxTemplate, WxTemplateDao>
    }
    public WxTemplate findByCode(String code) {
        WxTemplate wxTemplate = wxTemplateDao.findByCode(code);
        WxWechat wechat = wechatService.findByCode(wxTemplate.getWechatCode());
        WxTemplate wxTemplate = wxTemplateDao.findById(code);
        WxWechat wechat = wechatService.findById(wxTemplate.getWechatId());
        wxTemplate.setWechatName(wechat.getName());
        return wxTemplate;
    }
    public WxTemplate findById(Long id) {
    public WxTemplate findById(String id) {
        WxTemplate wxTemplate = wxTemplateDao.findById(id);
        return wxTemplate;
    }
@ -124,7 +108,7 @@ public class WxTemplateService extends BaseJpaService<WxTemplate, WxTemplateDao>
            if(wxTemplate==null){
                throw new ApiException(WechatRequestMapping.WxTemplate.message_fail_template_is_no_exist, ExceptionCode.common_error_params_code);
            }
            String wechatCode =  wxTemplate.getWechatCode();
            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("\\{\\{");

+ 1 - 1
svr/svr-manage/src/main/java/com/yihu/jw/manage/controller/wechat/WechatConfigController.java

@ -62,7 +62,7 @@ public class WechatConfigController {
        return envelop;
    }
    @GetMapping(value = WechatRequestMapping.WxConfig.api_getByCode)
    @GetMapping(value = WechatRequestMapping.WxConfig.api_getById)
    @ApiOperation(value = "根据code查找微信配置", notes = "根据code查找微信配置")
    public Envelop findByCode(
            @ApiParam(name = "code", value = "code")

+ 1 - 5
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/dao/agreement/WlyyAgreementDao.java

@ -10,12 +10,8 @@ import org.springframework.data.repository.PagingAndSortingRepository;
 */
public interface WlyyAgreementDao extends PagingAndSortingRepository<WlyyAgreement, Long>, JpaSpecificationExecutor<WlyyAgreement> {
    @Query("from WlyyAgreement w where w.code =?1 and w.status!=-1")
    WlyyAgreement findByCode(String code);
    @Query("from WlyyAgreement w where w.id=?1 and w.status !=-1")
    WlyyAgreement findById(Long id);
    WlyyAgreement findById(String id);
    @Query("from WlyyAgreement w where w.id!=?2 and w.code = ?1 and w.status !=-1")
    WlyyAgreement findCodeExcludeId(String code, Long id);
}

+ 1 - 5
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/dao/agreement/WlyyAgreementKpiDao.java

@ -10,12 +10,8 @@ import org.springframework.data.repository.PagingAndSortingRepository;
 */
public interface WlyyAgreementKpiDao extends PagingAndSortingRepository<WlyyAgreementKpi, Long>, JpaSpecificationExecutor<WlyyAgreementKpi> {
    @Query("from WlyyAgreementKpi w where w.code =?1 and w.status!=-1")
    WlyyAgreementKpi findByCode(String code);
    @Query("from WlyyAgreementKpi w where w.id=?1 and w.status !=-1")
    WlyyAgreementKpi findById(Long id);
    WlyyAgreementKpi findById(String id);
    @Query("from WlyyAgreementKpi w where w.id!=?2 and w.code = ?1 and w.status !=-1")
    WlyyAgreementKpi findCodeExcludeId(String code, Long id);
}

+ 2 - 2
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/dao/agreement/WlyyAgreementKpiLogDao.java

@ -10,6 +10,6 @@ import org.springframework.data.repository.PagingAndSortingRepository;
 */
public interface WlyyAgreementKpiLogDao  extends PagingAndSortingRepository<WlyyAgreementKpiLog, Long>, JpaSpecificationExecutor<WlyyAgreementKpiLog> {
    @Query("from WlyyAgreementKpiLog w where w.code =?1")
    WlyyAgreementKpiLog findByCode(String code);
    @Query("from WlyyAgreementKpiLog w where w.id =?1")
    WlyyAgreementKpiLog findById(String code);
}

+ 2 - 2
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/dao/agreement/WlyySignFamilyDao.java

@ -12,8 +12,8 @@ import java.util.List;
 */
public interface WlyySignFamilyDao  extends PagingAndSortingRepository<WlyySignFamily, Long>, JpaSpecificationExecutor<WlyySignFamily> {
    @Query("from WlyySignFamily w where w.code = ?1")
    WlyySignFamily findByCode(String code);
    @Query("from WlyySignFamily w where w.id = ?1")
    WlyySignFamily findById(String code);
    @Query("from WlyySignFamily w where w.patient = ?1 and w.status = ?2")
    List<WlyySignFamily> findByPatientCode(String patientCode, Integer status);

+ 4 - 4
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/dao/doctor/DoctorDao.java

@ -1,6 +1,6 @@
package com.yihu.jw.wlyy.dao.doctor;
import com.yihu.jw.wlyy.doctor.Doctors;
import com.yihu.jw.wlyy.doctor.BaseDoctors;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
@ -8,8 +8,8 @@ import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Administrator on 2017/6/7 0007.
 */
public interface DoctorDao extends PagingAndSortingRepository<Doctors, Long>, JpaSpecificationExecutor<Doctors> {
public interface DoctorDao extends PagingAndSortingRepository<BaseDoctors, Long>, JpaSpecificationExecutor<BaseDoctors> {
    @Query("from Doctors d where d.code = ?1 and d.status !=-1")
    Doctors findByCode(String code);
    @Query("from BaseDoctors d where d.id = ?1 and d.status !=-1")
    BaseDoctors findById(String code);
}

+ 1 - 3
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/dao/patient/AdvertisementDao.java

@ -12,11 +12,9 @@ import java.util.List;
 */
public interface AdvertisementDao extends PagingAndSortingRepository<WlyyAdvertisement, Long>, JpaSpecificationExecutor<WlyyAdvertisement> {
    @Query("from WlyyAdvertisement w where w.code =?1 and w.status!=-1")
    WlyyAdvertisement findByCode(String code);
    @Query("from WlyyAdvertisement w where w.id=?1 and w.status !=-1")
    WlyyAdvertisement findById(Long id);
    WlyyAdvertisement findById(String id);
    //根据saasCode查询广告
    @Query("from WlyyAdvertisement w where w.saasId=?1 and w.status !=-1 order by w.sort")

+ 1 - 4
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/service/agreement/WlyyAgreementKpiLogService.java

@ -50,9 +50,6 @@ public class WlyyAgreementKpiLogService extends BaseJpaService<WlyyAgreementKpiL
        if (StringUtils.isEmpty(wlyyAgreementKpiLog.getKpiName())) {
            throw new ApiException(WlyyRequestMapping.AgreementKpi.message_fail_kpiName_is_null, ExceptionCode.common_error_params_code);
        }
        if (StringUtils.isEmpty(wlyyAgreementKpiLog.getCode())) {
            throw new ApiException(WlyyRequestMapping.AgreementKpi.message_fail_code_is_null, ExceptionCode.common_error_params_code);
        }
        //设置创建时间
        Date date = new Date();
        wlyyAgreementKpiLog.setCreateTime(date);
@ -61,6 +58,6 @@ public class WlyyAgreementKpiLogService extends BaseJpaService<WlyyAgreementKpiL
    public WlyyAgreementKpiLog findByCode(String code) {
        return wlyyAgreementKpiLogDao.findByCode(code);
        return wlyyAgreementKpiLogDao.findById(code);
    }
}

+ 2 - 15
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/service/agreement/WlyyAgreementKpiService.java

@ -31,9 +31,6 @@ public class WlyyAgreementKpiService extends BaseJpaService<WlyyAgreementKpi, Wl
    @Transient
    public WlyyAgreementKpi create(WlyyAgreementKpi wlyyAgreementKpi) {
        if (StringUtils.isEmpty(wlyyAgreementKpi.getCode())) {
            throw new ApiException(WlyyRequestMapping.AgreementKpi.message_fail_code_is_null, ExceptionCode.common_error_params_code);
        }
        String saasId = wlyyAgreementKpi.getSaasId();
        if (StringUtils.isEmpty(saasId)) {
            throw new ApiException(WlyyRequestMapping.Agreement.message_fail_saasId_is_null, ExceptionCode.common_error_params_code);
@ -63,16 +60,11 @@ public class WlyyAgreementKpiService extends BaseJpaService<WlyyAgreementKpi, Wl
        //设置创建时间和修改时间
        Date date = new Date();
        wlyyAgreementKpi.setCreateTime(date);
        wlyyAgreementKpi.setUpdaateTime(date);
        return wlyyAgreementKpiDao.save(wlyyAgreementKpi);
    }
    @Transient
    public WlyyAgreementKpi update(WlyyAgreementKpi wlyyAgreementKpi) {
        String code = wlyyAgreementKpi.getCode();
        if (StringUtils.isEmpty(code)) {
            throw new ApiException(WlyyRequestMapping.AgreementKpi.message_fail_code_is_null, ExceptionCode.common_error_params_code);
        }
        String saasId = wlyyAgreementKpi.getSaasId();
        if (StringUtils.isEmpty(saasId)) {
            throw new ApiException(WlyyRequestMapping.Agreement.message_fail_saasId_is_null, ExceptionCode.common_error_params_code);
@ -99,7 +91,7 @@ public class WlyyAgreementKpiService extends BaseJpaService<WlyyAgreementKpi, Wl
        if (StringUtils.isEmpty(wlyyAgreementKpi.getStatus())) {
            throw new ApiException(WlyyRequestMapping.AgreementKpi.message_fail_status_is_null, ExceptionCode.common_error_params_code);
        }
        Long id = wlyyAgreementKpi.getId();
        String id = wlyyAgreementKpi.getId();
        if (StringUtils.isEmpty(id)) {
            throw new ApiException(WlyyRequestMapping.Agreement.message_fail_id_is_null, ExceptionCode.common_error_params_code);
        }
@ -110,17 +102,12 @@ public class WlyyAgreementKpiService extends BaseJpaService<WlyyAgreementKpi, Wl
        //设置创建时间和修改时间
        Date date = new Date();
        wlyyAgreementKpi.setCreateTime(wlyyAgreementKpi1.getCreateTime());
        wlyyAgreementKpi.setUpdaateTime(date);
        wlyyAgreementKpi1 = wlyyAgreementKpiDao.findCodeExcludeId(code,id);
        if(wlyyAgreementKpi1 !=null){
            throw new ApiException(WlyyRequestMapping.Agreement.message_fail_code_exist, ExceptionCode.common_error_params_code);
        }
        return wlyyAgreementKpiDao.save(wlyyAgreementKpi);
    }
    public WlyyAgreementKpi findByCode(String code) {
        return wlyyAgreementKpiDao.findByCode(code);
        return wlyyAgreementKpiDao.findById(code);
    }
    @Transient

+ 2 - 13
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/service/agreement/WlyyAgreementService.java

@ -27,9 +27,6 @@ public class WlyyAgreementService extends BaseJpaService<WlyyAgreement, WlyyAgre
    @Transient
    public WlyyAgreement create(WlyyAgreement wlyyAgreement) {
        if (StringUtils.isEmpty(wlyyAgreement.getCode())) {
            throw new ApiException(WlyyRequestMapping.Agreement.message_fail_code_is_null, ExceptionCode.common_error_params_code);
        }
        String saasId = wlyyAgreement.getSaasId();
        if (StringUtils.isEmpty(saasId)) {
            throw new ApiException(WlyyRequestMapping.Agreement.message_fail_saasId_is_null, ExceptionCode.common_error_params_code);
@ -56,10 +53,6 @@ public class WlyyAgreementService extends BaseJpaService<WlyyAgreement, WlyyAgre
    @Transient
    public WlyyAgreement update(WlyyAgreement wlyyAgreement) {
        String code = wlyyAgreement.getCode();
        if (StringUtils.isEmpty(code)) {
            throw new ApiException(WlyyRequestMapping.Agreement.message_fail_code_is_null, ExceptionCode.common_error_params_code);
        }
        String saasId = wlyyAgreement.getSaasId();
        if (StringUtils.isEmpty(saasId)) {
            throw new ApiException(WlyyRequestMapping.Agreement.message_fail_saasId_is_null, ExceptionCode.common_error_params_code);
@ -77,7 +70,7 @@ public class WlyyAgreementService extends BaseJpaService<WlyyAgreement, WlyyAgre
        if (StringUtils.isEmpty(wlyyAgreement.getStatus())) {
            throw new ApiException(WlyyRequestMapping.Agreement.message_fail_status_is_null, ExceptionCode.common_error_params_code);
        }
        Long id = wlyyAgreement.getId();
        String id = wlyyAgreement.getId();
        if (StringUtils.isEmpty(id)) {
            throw new ApiException(WlyyRequestMapping.Agreement.message_fail_id_is_null, ExceptionCode.common_error_params_code);
        }
@ -90,15 +83,11 @@ public class WlyyAgreementService extends BaseJpaService<WlyyAgreement, WlyyAgre
        wlyyAgreement.setCreateTime(wlyyAgreement1.getCreateTime());
        wlyyAgreement.setUpdateTime(date);
        wlyyAgreement1 = wlyyAgreementDao.findCodeExcludeId(code,id);
        if(wlyyAgreement1 !=null){
            throw new ApiException(WlyyRequestMapping.Agreement.message_fail_code_exist, ExceptionCode.common_error_params_code);
        }
        return wlyyAgreementDao.save(wlyyAgreement);
    }
    public WlyyAgreement findByCode(String code) {
        WlyyAgreement wlyyAgreement = wlyyAgreementDao.findByCode(code);
        WlyyAgreement wlyyAgreement = wlyyAgreementDao.findById(code);
        return wlyyAgreement;
    }

+ 1 - 4
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/service/agreement/WlyySignFamilyService.java

@ -50,13 +50,10 @@ public class WlyySignFamilyService extends BaseJpaService<WlyySignFamily, WlyySi
    }
    public WlyySignFamily findByCode(String code) {
        return wlyySignFamilyDao.findByCode(code);
        return wlyySignFamilyDao.findById(code);
    }
    private boolean canSaveOrUpdate(WlyySignFamily wlyySignFamily) throws ParseException {
        if (StringUtils.isEmpty(wlyySignFamily.getCode())) {
            throw new ApiException(WlyyRequestMapping.SignFamily.message_fail_code_is_null, ExceptionCode.common_error_params_code);
        }
        String saasId = wlyySignFamily.getSaasId();
        if (StringUtils.isEmpty(saasId)) {
            throw new ApiException(WlyyRequestMapping.Agreement.message_fail_saasId_is_null, ExceptionCode.common_error_params_code);

+ 4 - 4
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/service/doctor/DoctorService.java

@ -2,7 +2,7 @@ package com.yihu.jw.wlyy.service.doctor;
import com.yihu.base.mysql.query.BaseJpaService;
import com.yihu.jw.wlyy.dao.doctor.DoctorDao;
import com.yihu.jw.wlyy.doctor.Doctors;
import com.yihu.jw.wlyy.doctor.BaseDoctors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -10,13 +10,13 @@ import org.springframework.stereotype.Service;
 * Created by Administrator on 2017/6/7 0007.
 */
@Service
public class DoctorService extends BaseJpaService<Doctors, DoctorDao> {
public class DoctorService extends BaseJpaService<BaseDoctors, DoctorDao> {
    @Autowired
    private DoctorDao doctorDao;
    public Doctors findByCode(String code){
        return doctorDao.findByCode(code);
    public BaseDoctors findById(String code){
        return doctorDao.findById(code);
    }

+ 5 - 12
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/service/patient/AdvertisementService.java

@ -47,9 +47,6 @@ public class AdvertisementService extends BaseJpaService<WlyyAdvertisement, Adve
    @Transient
     public WlyyAdvertisement create(WlyyAdvertisement advertisement) {
        if (StringUtils.isEmpty(advertisement.getCode())) {
            throw new ApiException(WlyyRequestMapping.Advertisement.message_fail_code_is_null, ExceptionCode.common_error_params_code);
        }
        if (StringUtils.isEmpty(advertisement.getSaasId())) {
            throw new ApiException(WlyyRequestMapping.Advertisement.message_fail_saasid_is_null, ExceptionCode.common_error_params_code);
        }
@ -71,10 +68,6 @@ public class AdvertisementService extends BaseJpaService<WlyyAdvertisement, Adve
    @Transient
    public WlyyAdvertisement update(WlyyAdvertisement advertisement) {
        String code = advertisement.getCode();
        if (StringUtils.isEmpty(code)) {
            throw new ApiException(WlyyRequestMapping.Advertisement.message_fail_code_is_null, ExceptionCode.common_error_params_code);
        }
        if (StringUtils.isEmpty(advertisement.getSaasId())) {
            throw new ApiException(WlyyRequestMapping.Advertisement.message_fail_saasid_is_null, ExceptionCode.common_error_params_code);
        }
@ -87,7 +80,7 @@ public class AdvertisementService extends BaseJpaService<WlyyAdvertisement, Adve
        if (StringUtils.isEmpty(advertisement.getStatus())) {
            throw new ApiException(WlyyRequestMapping.Advertisement.message_fail_status_is_null, ExceptionCode.common_error_params_code);
        }
        Long id = advertisement.getId();
        String id = advertisement.getId();
        if (StringUtils.isEmpty(id)) {
            throw new ApiException(WlyyRequestMapping.Advertisement.message_fail_picture_is_null, ExceptionCode.common_error_params_code);
        }
@ -103,12 +96,12 @@ public class AdvertisementService extends BaseJpaService<WlyyAdvertisement, Adve
        return advertisementDao.save(advertisement);
    }
    public WlyyAdvertisement findById(Long id) {
    public WlyyAdvertisement findById(String id) {
        return advertisementDao.findById(id);
    }
    public WlyyAdvertisement findByCode(String code) {
        return advertisementDao.findByCode(code);
        return advertisementDao.findById(code);
    }
    @Transient
@ -189,7 +182,7 @@ public class AdvertisementService extends BaseJpaService<WlyyAdvertisement, Adve
                if(saas==null){//如果还是为空,则展示默认广告
                    return  getDefaultList();
                }
                String saasCode = saas.getCode();
                String saasCode = saas.getId();
                return getListBySaasCode(saasCode);
            }
@ -224,7 +217,7 @@ public class AdvertisementService extends BaseJpaService<WlyyAdvertisement, Adve
                if(saas==null){//如果还是为空,则展示默认广告
                    return  getDefaultList();
                }
                String saasCode = saas.getCode();
                String saasCode = saas.getId();
                return getListBySaasCode(saasCode);
            }

+ 1 - 1
web-gateway/src/main/java/com/yihu/jw/feign/base/wx/WechatFeign.java

@ -29,7 +29,7 @@ public interface WechatFeign {
    @RequestMapping(value = WechatRequestMapping.WxConfig.api_delete,method = RequestMethod.DELETE)
    Envelop deleteWechat(@RequestParam(value = "codes") String codes,@RequestParam(value = "userCode") String userCode,@RequestParam(value = "userName") String userName) throws JiWeiException;
    @RequestMapping(value = WechatRequestMapping.WxConfig.api_getByCode,method = RequestMethod.GET)
    @RequestMapping(value = WechatRequestMapping.WxConfig.api_getById,method = RequestMethod.GET)
    Envelop findByCode(@RequestParam(value = "code") String code) throws JiWeiException;
    @RequestMapping(value = WechatRequestMapping.WxConfig.api_getWechats ,method = RequestMethod.GET)