Browse Source

Merge branch 'master' of http://47.100.37.243:10080/wutt/manHourHousekeeper

ggooalice 2 years ago
parent
commit
1a8f5b2858

+ 9 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/WeiXinCorpController.java

@@ -3283,6 +3283,8 @@ public class WeiXinCorpController {
             }
             companyMapper.updateById(newCompany);
             System.out.println("已成功变更版本,版本号为:"+edition_id);
+            //开通模块和权限
+            rootRole(wxCorpInfo.getCompanyId());
         }else {
             System.out.println("++++++++++++++++++++++"+"版本变更失败!"+"++++++++++++++++++++++++");
         }
@@ -3510,10 +3512,12 @@ public class WeiXinCorpController {
     //为超级管理员角色赋予模块权限
     private void rootRole (Integer companyId){
         Company company = companyMapper.selectById(companyId);
-        if (company.getPackageOa().equals(1) || company.getPackageCustomer().equals(1) || company.getPackageEngineering().equals(1)){
+        System.out.println("#############################公司信息为:" + company.toString());
+        if (company.getPackageOa().equals(1) || company.getPackageCustomer().equals(1) || company.getPackageEngineering().equals(1) || company.getPackageProvider().equals(1)){
             System.err.println("##############################为超级管理员开通模块及权限");
             SysRole sysRole = sysRoleMapper.selectOne(new QueryWrapper<SysRole>().eq("company_id", companyId).eq("rolename", "超级管理员"));
             QueryWrapper<SysModule> sysModuleQueryWrapper = new QueryWrapper<>();
+            //请假出差
             if (company.getPackageOa().equals(1)){
                 sysModuleQueryWrapper.or().eq("package_oa", 1);
             }
@@ -3525,6 +3529,10 @@ public class WeiXinCorpController {
             if (company.getPackageEngineering().equals(1)){
                 sysModuleQueryWrapper.or().eq("package_engineering", 1);
             }
+            //供应商模块
+            if (company.getPackageProvider().equals(1)){
+                sysModuleQueryWrapper.or().eq("Package_provider", 1);
+            }
             List<SysModule> sysModules = sysModuleMapper.selectList(sysModuleQueryWrapper);
             //过滤掉已开通的模块
             List<SysRoleModule> modular = sysRoleModuleMapper.selectList(new QueryWrapper<SysRoleModule>().eq("role_id", sysRole.getId()));

+ 19 - 9
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/WxCorpInfoServiceImpl.java

@@ -100,6 +100,9 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
     @Value(value = "${configEnv.isDev}")
     private boolean isDev;
 
+    @Value(value = "${configEnv.isPrivateDeploy}")
+    private boolean isPrivateDeploy;
+
     @Autowired
     RestTemplate restTemplate;
 
@@ -276,17 +279,25 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
         try {
             if (isDev) return;
             String accessToken = getCorpAccessToken(corpInfo);
-            String url = URL_SEND_WXCORP_MSG.replaceAll("ACCESS_TOKEN", accessToken);
+            String url=URL_SEND_WXCORP_MSG.replaceAll("ACCESS_TOKEN", accessToken);
             HttpHeaders headers = new HttpHeaders();
             headers.setContentType(MediaType.APPLICATION_JSON);
             JSONObject reqParam = new JSONObject();
-            reqParam.put("touser", corpUserid);
-            reqParam.put("toparty", "");
-            reqParam.put("totag", "");
-            reqParam.put("msgtype", "template_msg");
-            reqParam.put("agentid", corpInfo.getAgentid());
-            reqParam.put("template_msg", msg);
-
+            if(isPrivateDeploy){
+                reqParam.put("touser", corpUserid);
+                reqParam.put("toparty", "");
+                reqParam.put("totag", "");
+                reqParam.put("msgtype", "text");
+                reqParam.put("agentid", corpInfo.getAgentid());
+                reqParam.put("text", msg);
+            }else {
+                reqParam.put("touser", corpUserid);
+                reqParam.put("toparty", "");
+                reqParam.put("totag", "");
+                reqParam.put("msgtype", "template_msg");
+                reqParam.put("agentid", corpInfo.getAgentid());
+                reqParam.put("template_msg", msg);
+            }
             HttpEntity<String> requestEntity = new HttpEntity<String>(reqParam.toJSONString(), headers);
             ResponseEntity<String> responseEntity = this.restTemplate.exchange(url,
                     HttpMethod.POST, requestEntity, String.class);
@@ -303,7 +314,6 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
             } else {
                 System.err.println("发送失败:" + responseEntity.getStatusCode() + ", " + responseEntity.getBody());
             }
-
         } catch (Exception e) {
             e.printStackTrace();
         }

+ 14 - 6
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/task/TimingTask.java

@@ -382,9 +382,13 @@ public class TimingTask {
                     jsonObj.put("key", "待审核数量");
                     jsonObj.put("value",StringUtils.isEmpty(map.get("num"))?"":map.get("num"));
                     dataJson.add(jsonObj);
-                    json.put("template_id","tty9TkCAAAuPvPjabDdQXGocnG0K24EQ");
-                    json.put("url","https://open.weixin.qq.com/connect/oauth2/authorize?appid=ww4e237fd6abb635af&redirect_uri=http://worktime.ttkuaiban.com/api/corpWXAuth&response_type=code&scope=snsapi_base&state=review#wechat_redirect");
-                    json.put("content_item",dataJson);
+                    if(isPrivateDeploy){
+                        json.put("content","待审核数量: "+(StringUtils.isEmpty(map.get("num"))?"":map.get("num"))+"\\n<a href=\\\"https://open.weixin.qq.com/connect/oauth2/authorize?appid=ww4e237fd6abb635af&redirect_uri=http://worktime.ttkuaiban.com/api/corpWXAuth&response_type=code&scope=snsapi_base&state=0#wechat_redirect\\\">去审核</a>");
+                    }else {
+                        json.put("template_id","tty9TkCAAAuPvPjabDdQXGocnG0K24EQ");
+                        json.put("url","https://open.weixin.qq.com/connect/oauth2/authorize?appid=ww4e237fd6abb635af&redirect_uri=http://worktime.ttkuaiban.com/api/corpWXAuth&response_type=code&scope=snsapi_base&state=review#wechat_redirect");
+                        json.put("content_item",dataJson);
+                    }
                     wxCorpInfoService.sendWXCorpTemplateMsg(wxCorpInfo, corpwxUserid, json);
                     }
                 }
@@ -626,9 +630,13 @@ public class TimingTask {
                         jsonObj.put("key", "提示");
                         jsonObj.put("value", StringUtils.isEmpty(t.getAlertMsg())?"":t.getAlertMsg());
                         dataJson.add(jsonObj);
-                        json.put("template_id","tty9TkCAAAYoevY-40ciWD5lDncDfR5w");
-                        json.put("url", "https://open.weixin.qq.com/connect/oauth2/authorize?appid=ww4e237fd6abb635af&redirect_uri=http://worktime.ttkuaiban.com/api/corpWXAuth&response_type=code&scope=snsapi_base&state=0#wechat_redirect");
-                        json.put("content_item",dataJson);
+                        if(isPrivateDeploy){
+                            json.put("content",StringUtils.isEmpty(t.getAlertMsg())?"":t.getAlertMsg()+"\\n<a href=\\\"https://open.weixin.qq.com/connect/oauth2/authorize?appid=ww4e237fd6abb635af&redirect_uri=http://worktime.ttkuaiban.com/api/corpWXAuth&response_type=code&scope=snsapi_base&state=0#wechat_redirect\\\">去填写</a>");
+                        }else {
+                            json.put("template_id","tty9TkCAAAYoevY-40ciWD5lDncDfR5w");
+                            json.put("url", "https://open.weixin.qq.com/connect/oauth2/authorize?appid=ww4e237fd6abb635af&redirect_uri=http://worktime.ttkuaiban.com/api/corpWXAuth&response_type=code&scope=snsapi_base&state=0#wechat_redirect");
+                            json.put("content_item",dataJson);
+                        }
                         if (cpList.size() > 0) {
                             wxCorpInfoService.sendWXCorpTemplateMsg(cpList.get(0), corpUid, json);
                         }