Ver código fonte

Merge remote-tracking branch 'origin/master'

yumeng 4 anos atrás
pai
commit
73b881d616

+ 15 - 15
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/MaterialReportOverViewMapper.xml

@@ -88,7 +88,7 @@
                 #{item}
             </foreach>
         </if>
-        AND stat_datetime >= #{startDate}
+        AND stat_datetime &gt;= #{startDate}
         AND stat_datetime &lt;= #{endDate}
     </select>
 
@@ -106,7 +106,7 @@
                 #{item}
             </foreach>
         </if>
-        AND stat_date >= #{startDate}
+        AND stat_date &gt;= #{startDate}
         AND stat_date &lt;= #{endDate}
     </select>
 
@@ -122,7 +122,7 @@
                 #{item}
             </foreach>
         </if>
-        AND DATE_FORMAT(create_time, '%Y-%m-%d')>= #{startDate}
+        AND DATE_FORMAT(create_time, '%Y-%m-%d')&gt;= #{startDate}
         AND DATE_FORMAT(create_time, '%Y-%m-%d')&lt;= #{endDate}
     </select>
 
@@ -155,7 +155,7 @@
                 #{item}
             </foreach>
         </if>
-        AND stat_datetime >= #{startDate}
+        AND stat_datetime &gt;= #{startDate}
         AND stat_datetime &lt;= #{endDate}
         group by stat_datetime
         order by stat_datetime
@@ -176,7 +176,7 @@
                 #{item}
             </foreach>
         </if>
-        AND stat_datetime >= #{startDate}
+        AND stat_datetime &gt; #{startDate}
         AND stat_datetime &lt;= #{endDate}
         group by DATE_FORMAT(stat_datetime, '%Y-%m')
         order by stat_datetime asc
@@ -197,7 +197,7 @@
                 #{item}
             </foreach>
         </if>
-        AND stat_date >= #{startDate}
+        AND stat_date &gt;= #{startDate}
         AND stat_date &lt;= #{endDate}
         group by stat_date
         order by stat_date
@@ -218,7 +218,7 @@
                 #{item}
             </foreach>
         </if>
-        AND stat_date >= #{startDate}
+        AND stat_date &gt; #{startDate}
         AND stat_date &lt;= #{endDate}
         group by DATE_FORMAT(stat_date, '%Y-%m')
         order by stat_date
@@ -242,7 +242,7 @@
                 #{item}
             </foreach>
         </if>
-        AND stat_datetime >= #{startDate}
+        AND stat_datetime &gt; #{startDate}
         AND stat_datetime &lt;= #{endDate}
         AND md5!=''
         GROUP BY md5
@@ -274,7 +274,7 @@
                 #{item}
             </foreach>
         </if>
-        AND stat_datetime >= #{startDate}
+        AND stat_datetime &gt;= #{startDate}
         AND stat_datetime &lt;= #{endDate}
         GROUP BY t1.md5
         ORDER BY ${target} ${order}
@@ -298,7 +298,7 @@
                 #{item}
             </foreach>
         </if>
-        AND stat_datetime >= #{startDate}
+        AND stat_datetime &gt;= #{startDate}
         AND stat_datetime &lt;= #{endDate}
         GROUP BY t1.md5) t
     </select>
@@ -323,7 +323,7 @@
                 #{item}
             </foreach>
         </if>
-        AND t1.stat_date >= #{startDate}
+        AND t1.stat_date &gt;= #{startDate}
         AND t1.stat_date &lt;= #{endDate}
         GROUP BY t1.signature
         ORDER BY charge desc
@@ -357,7 +357,7 @@
                 #{item}
             </foreach>
         </if>
-        AND t1.stat_date >= #{startDate}
+        AND t1.stat_date &gt;= #{startDate}
         AND t1.stat_date &lt;= #{endDate}
         GROUP BY t1.signature
         ) t1
@@ -388,7 +388,7 @@
                 #{item}
             </foreach>
         </if>
-        AND t1.stat_date >= #{startDate}
+        AND t1.stat_date &gt;= #{startDate}
         AND t1.stat_date &lt;= #{endDate}
         GROUP BY t1.signature
         ) t1
@@ -418,7 +418,7 @@
         FROM
         etl_design_daily_report,(SELECT @i:=0) i
         where
-        stat_date >= #{startDate}
+        stat_date &gt;= #{startDate}
         AND stat_date &lt;= #{endDate}
         AND user_id IN
         <foreach collection="userIds" item="item" separator=","
@@ -441,7 +441,7 @@
         FROM
         etl_design_daily_report
         where
-        stat_date >= #{startDate}
+        stat_date &gt;= #{startDate}
         AND stat_date &lt;= #{endDate}
         AND user_id IN
         <foreach collection="userIds" item="item" separator=","

+ 67 - 62
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/LoginController.java

@@ -4,10 +4,7 @@ import cn.com.ctop.common.module.entity.CorpFeishuUser;
 import cn.com.ctop.common.module.entity.CtopCorpWexinUser;
 import cn.com.ctop.common.module.entity.SysDepart;
 import cn.com.ctop.common.module.entity.SysUser;
-import cn.com.ctop.common.module.service.ICorpFeishuUserService;
-import cn.com.ctop.common.module.service.ICtopCorpWexinUserService;
-import cn.com.ctop.common.module.service.ISysDepartService;
-import cn.com.ctop.common.module.service.ISysUserService;
+import cn.com.ctop.common.module.service.*;
 import cn.com.ctop.common.module.utils.AesEncryptUtil;
 import cn.com.ctop.common.module.utils.ResultMapUtils;
 import cn.com.ctop.common.module.utils.StatusCode;
@@ -31,14 +28,12 @@ import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.constant.CacheConstant;
 import org.jeecg.common.constant.CommonConstant;
-import cn.com.ctop.common.module.service.ISysBaseApi;
 import org.jeecg.common.system.util.JwtUtil;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.util.*;
 import org.jeecg.common.util.encryption.EncryptedString;
 import org.jeecg.modules.shiro.vo.DefContants;
 import org.jeecg.modules.system.model.SysLoginModel;
-import cn.com.ctop.common.module.service.ISysDictService;
 import org.jeecg.modules.system.service.ISysLogService;
 import org.jeecg.modules.system.util.RandImageUtil;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -55,7 +50,7 @@ import java.util.*;
  */
 @RestController
 @RequestMapping("/sys")
-@Api(tags="用户登录")
+@Api(tags = "用户登录")
 @Slf4j
 public class LoginController {
     @Autowired
@@ -75,12 +70,13 @@ public class LoginController {
     @Autowired
     private ICtopCorpWexinUserService ctopCorpWexinUserService;
     private static final String BASE_CHECK_CODES = "qwertyuiplkjhgfdsazxcvbnmQWERTYUPLKJHGFDSAZXCVBNM1234567890";
+
     @GetMapping("feishu/url")
-    public Map<String,Object> getUrl(){
-        Map<String,Object>result = new HashMap<>();
+    public Map<String, Object> getUrl() {
+        Map<String, Object> result = new HashMap<>();
         try {
             String url = AuthProvider.getAuthUrl("");
-            result.put("url",url);
+            result.put("url", url);
             ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
             return result;
         } catch (Exception e) {
@@ -89,19 +85,20 @@ public class LoginController {
             return result;
         }
     }
+
     @GetMapping("/feishu/auth")
     public Result<JSONObject> feishuAuth(HttpServletRequest request,
                                          HttpServletResponse response,
-                                         @RequestParam(name = "code",defaultValue = "code") String code,
-                                         @RequestParam(name = "state",defaultValue = "_t") String state) throws IOException {
+                                         @RequestParam(name = "code", defaultValue = "code") String code,
+                                         @RequestParam(name = "state", defaultValue = "_t") String state) throws IOException {
         Result<JSONObject> result = new Result<>();
         //1:根据code值获取用户飞书信息
         try {
-            if("code".equals(code.trim())){
+            if ("code".equals(code.trim())) {
                 JSONObject setData = new JSONObject();
                 String url = AuthProvider.getAuthUrl("");
-                setData.put("url",url);
-                setData.put("type",1);
+                setData.put("url", url);
+                setData.put("type", 1);
                 result.setResult(setData);
                 result.success("重定向");
                 return result;
@@ -113,14 +110,14 @@ public class LoginController {
             JSONObject userData = AuthProvider.getUserInfo(accessToken);
             JSONObject dataObject = userData.getJSONObject("data");
             String email = dataObject.getString("email");
-            if(null == email|| "".equals(email.trim())){
+            if (null == email || "".equals(email.trim())) {
                 return result.error500(StatusCode.CTOP_FEISHU_EMAIL_NOT_EXIST.getDesc());
             }
             SysUser sysUser = sysUserService.getUserByEmail(email);
             if (sysUser == null) {
                 return result.error500(StatusCode.CTOP_FEISHU_ACCOUNT_NOT_EXIST.getDesc());
             }
-            if(sysUser.getStatus() != 1){
+            if (sysUser.getStatus() != 1) {
                 return result.error500(StatusCode.CTOP_FEISHU_ACCOUNT_NOT_EXIST.getDesc());
             }
             String departId = sysDepartService.selectIdByOrdCode(sysUser.getOrgCode());
@@ -160,11 +157,11 @@ public class LoginController {
     public Result<JSONObject> wxlogin(@RequestParam(name = "code") String code) throws Exception {
         Result<JSONObject> result = new Result<>();
         val configStorage = new WxCpDefaultConfigImpl();
-        configStorage.setCorpId("wwef2e51064c0ac897");
+        configStorage.setCorpId("ww24b8a47826f5875f");
         configStorage.setAgentId(1000002);
-        configStorage.setCorpSecret("ieoVDAIurCOMdLrvktyQNCqWvTPqdphmXSFdk57NZ1k");
-       /* configStorage.setToken("hcst2019");
-        configStorage.setAesKey("hcst2019");*/
+        configStorage.setCorpSecret("MJIlySADGPlgvADnkFQPUpfZD4yV-4WN6066OgNnb0s");
+        configStorage.setToken("hcst2019");
+        configStorage.setAesKey("hcst2019");
         val service = new WxCpServiceImpl();
 
         service.setWxCpConfigStorage(configStorage);
@@ -180,7 +177,7 @@ public class LoginController {
                     result.error500("该用户未注册系统账户,请联系管理员");
                     return result;
                 }
-                if(sysUser.getStatus() != 1){
+                if (sysUser.getStatus() != 1) {
                     result.error500("该用户已冻结,请联系管理员");
                     return result;
                 }
@@ -303,22 +300,23 @@ public class LoginController {
 
     /**
      * 退出登录
+     *
      * @param request
      * @param response
      * @return
      */
     @RequestMapping(value = "/logout")
-    public Result<Object> logout(HttpServletRequest request,HttpServletResponse response) {
+    public Result<Object> logout(HttpServletRequest request, HttpServletResponse response) {
         //用户退出逻辑
         String token = request.getHeader(DefContants.X_ACCESS_TOKEN);
-        if(oConvertUtils.isEmpty(token)) {
+        if (oConvertUtils.isEmpty(token)) {
             return Result.error("退出登录失败!");
         }
         String username = JwtUtil.getUsername(token);
         LoginUser sysUser = sysBaseApi.getUserByName(username);
-        if(sysUser!=null) {
-            sysBaseApi.addLog("用户名: "+sysUser.getRealname()+",退出成功!", CommonConstant.LOG_TYPE_1, null);
-            log.info(" 用户名:  "+sysUser.getRealname()+",退出成功! ");
+        if (sysUser != null) {
+            sysBaseApi.addLog("用户名: " + sysUser.getRealname() + ",退出成功!", CommonConstant.LOG_TYPE_1, null);
+            log.info(" 用户名:  " + sysUser.getRealname() + ",退出成功! ");
             //清空用户登录Token缓存
             redisUtil.del(CommonConstant.PREFIX_USER_TOKEN + token);
             //清空用户登录Shiro权限缓存
@@ -328,13 +326,14 @@ public class LoginController {
             //调用shiro的logout
             SecurityUtils.getSubject().logout();
             return Result.ok("退出登录成功!");
-        }else {
+        } else {
             return Result.error("Token无效!");
         }
     }
 
     /**
      * 获取访问量
+     *
      * @return
      */
     @GetMapping("loginfo")
@@ -354,9 +353,9 @@ public class LoginController {
         // 获取系统访问记录
         Long totalVisitCount = logService.findTotalVisitCount();
         obj.put("totalVisitCount", totalVisitCount);
-        Long todayVisitCount = logService.findTodayVisitCount(dayStart,dayEnd);
+        Long todayVisitCount = logService.findTodayVisitCount(dayStart, dayEnd);
         obj.put("todayVisitCount", todayVisitCount);
-        Long todayIp = logService.findTodayIp(dayStart,dayEnd);
+        Long todayIp = logService.findTodayIp(dayStart, dayEnd);
         //update-end--Author:zhangweijian  Date:20190428 for:传入开始时间,结束时间参数
         obj.put("todayIp", todayIp);
         result.setResult(obj);
@@ -366,21 +365,22 @@ public class LoginController {
 
     /**
      * 获取访问量
+     *
      * @return
      */
     @GetMapping("visitInfo")
-    public Result<List<Map<String,Object>>> visitInfo() {
-        Result<List<Map<String,Object>>> result = new Result<List<Map<String,Object>>>();
+    public Result<List<Map<String, Object>>> visitInfo() {
+        Result<List<Map<String, Object>>> result = new Result<List<Map<String, Object>>>();
         Calendar calendar = new GregorianCalendar();
-        calendar.set(Calendar.HOUR_OF_DAY,0);
-        calendar.set(Calendar.MINUTE,0);
-        calendar.set(Calendar.SECOND,0);
-        calendar.set(Calendar.MILLISECOND,0);
+        calendar.set(Calendar.HOUR_OF_DAY, 0);
+        calendar.set(Calendar.MINUTE, 0);
+        calendar.set(Calendar.SECOND, 0);
+        calendar.set(Calendar.MILLISECOND, 0);
         calendar.add(Calendar.DAY_OF_MONTH, 1);
         Date dayEnd = calendar.getTime();
         calendar.add(Calendar.DAY_OF_MONTH, -7);
         Date dayStart = calendar.getTime();
-        List<Map<String,Object>> list = logService.findVisitCount(dayStart, dayEnd);
+        List<Map<String, Object>> list = logService.findVisitCount(dayStart, dayEnd);
         result.setResult(oConvertUtils.toLowerCasePageList(list));
         return result;
     }
@@ -388,6 +388,7 @@ public class LoginController {
 
     /**
      * 登陆成功选择用户当前部门
+     *
      * @param user
      * @return
      */
@@ -395,11 +396,11 @@ public class LoginController {
     public Result<JSONObject> selectDepart(@RequestBody SysUser user) {
         Result<JSONObject> result = new Result<JSONObject>();
         String username = user.getUsername();
-        if(oConvertUtils.isEmpty(username)) {
-            LoginUser sysUser = (LoginUser)SecurityUtils.getSubject().getPrincipal();
+        if (oConvertUtils.isEmpty(username)) {
+            LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
             username = sysUser.getUsername();
         }
-        String orgCode= user.getOrgCode();
+        String orgCode = user.getOrgCode();
         this.sysUserService.updateUserDepart(username, orgCode);
         SysUser sysUser = sysUserService.getUserByName(username);
         JSONObject obj = new JSONObject();
@@ -419,9 +420,9 @@ public class LoginController {
         Result<String> result = new Result<String>();
         String mobile = jsonObject.get("mobile").toString();
         //手机号模式 登录模式: "2"  注册模式: "1"
-        String smsmode=jsonObject.get("smsmode").toString();
+        String smsmode = jsonObject.get("smsmode").toString();
         log.info(mobile);
-        if(oConvertUtils.isEmpty(mobile)){
+        if (oConvertUtils.isEmpty(mobile)) {
             result.setMessage("手机号不允许为空!");
             result.setSuccess(false);
             return result;
@@ -442,17 +443,17 @@ public class LoginController {
             //注册模板
             if (CommonConstant.SMS_TPL_TYPE_1.equals(smsmode)) {
                 SysUser sysUser = sysUserService.getUserByPhone(mobile);
-                if(sysUser!=null) {
+                if (sysUser != null) {
                     result.error500(" 手机号已经注册,请直接登录!");
                     sysBaseApi.addLog("手机号已经注册,请直接登录!", CommonConstant.LOG_TYPE_1, null);
                     return result;
                 }
                 b = DySmsHelper.sendSms(mobile, obj, DySmsEnum.REGISTER_TEMPLATE_CODE);
-            }else {
+            } else {
                 //登录模式,校验用户有效性
                 SysUser sysUser = sysUserService.getUserByPhone(mobile);
                 result = sysUserService.checkUserIsEffective(sysUser);
-                if(!result.isSuccess()) {
+                if (!result.isSuccess()) {
                     return result;
                 }
 
@@ -462,7 +463,7 @@ public class LoginController {
                 if (CommonConstant.SMS_TPL_TYPE_0.equals(smsmode)) {
                     //登录模板
                     b = DySmsHelper.sendSms(mobile, obj, DySmsEnum.LOGIN_TEMPLATE_CODE);
-                } else if(CommonConstant.SMS_TPL_TYPE_2.equals(smsmode)) {
+                } else if (CommonConstant.SMS_TPL_TYPE_2.equals(smsmode)) {
                     //忘记密码模板
                     b = DySmsHelper.sendSms(mobile, obj, DySmsEnum.FORGET_PASSWORD_TEMPLATE_CODE);
                 }
@@ -504,7 +505,7 @@ public class LoginController {
         //校验用户有效性
         SysUser sysUser = sysUserService.getUserByPhone(phone);
         result = sysUserService.checkUserIsEffective(sysUser);
-        if(!result.isSuccess()) {
+        if (!result.isSuccess()) {
             return result;
         }
 
@@ -537,7 +538,7 @@ public class LoginController {
         String token = JwtUtil.sign(username, syspassword);
         // 设置token缓存有效时间
         redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token);
-        redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME*2 / 1000);
+        redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME * 2 / 1000);
 
         // 获取用户部门信息
         JSONObject obj = new JSONObject();
@@ -561,29 +562,31 @@ public class LoginController {
 
     /**
      * 获取加密字符串
+     *
      * @return
      */
     @GetMapping(value = "/getEncryptedString")
-    public Result<Map<String,String>> getEncryptedString(){
-        Result<Map<String,String>> result = new Result<>();
-        Map<String,String> map = new HashMap<>();
+    public Result<Map<String, String>> getEncryptedString() {
+        Result<Map<String, String>> result = new Result<>();
+        Map<String, String> map = new HashMap<>();
         map.put("key", EncryptedString.key);
-        map.put("iv",EncryptedString.iv);
+        map.put("iv", EncryptedString.iv);
         result.setResult(map);
         return result;
     }
 
     /**
      * 后台生成图形验证码 :有效
+     *
      * @param response
      * @param key
      */
     @ApiOperation("获取验证码")
     @GetMapping(value = "/randomImage/{key}")
-    public Result<String> randomImage(HttpServletResponse response,@PathVariable String key){
+    public Result<String> randomImage(HttpServletResponse response, @PathVariable String key) {
         Result<String> res = new Result<String>();
         try {
-            String code = RandomUtil.randomString(BASE_CHECK_CODES,4);
+            String code = RandomUtil.randomString(BASE_CHECK_CODES, 4);
             String lowerCaseCode = code.toLowerCase();
             String realKey = MD5Util.getMd5(lowerCaseCode);
             redisUtil.set(realKey, lowerCaseCode, 60);
@@ -591,7 +594,7 @@ public class LoginController {
             res.setSuccess(true);
             res.setResult(base64);
         } catch (Exception e) {
-            res.error500("获取验证码出错"+e.getMessage());
+            res.error500("获取验证码出错" + e.getMessage());
             e.printStackTrace();
         }
         return res;
@@ -599,6 +602,7 @@ public class LoginController {
 
     /**
      * app登录
+     *
      * @param sysLoginModel
      * @return
      * @throws Exception
@@ -612,7 +616,7 @@ public class LoginController {
         //1. 校验用户是否有效
         SysUser sysUser = sysUserService.getUserByName(username);
         result = sysUserService.checkUserIsEffective(sysUser);
-        if(!result.isSuccess()) {
+        if (!result.isSuccess()) {
             return result;
         }
 
@@ -625,7 +629,7 @@ public class LoginController {
         }
 
         String orgCode = sysUser.getOrgCode();
-        if(oConvertUtils.isEmpty(orgCode)) {
+        if (oConvertUtils.isEmpty(orgCode)) {
             //如果当前用户无选择部门 查看部门关联信息
             List<SysDepart> departs = sysDepartService.queryUserDeparts(sysUser.getId());
             if (departs == null || departs.size() == 0) {
@@ -644,7 +648,7 @@ public class LoginController {
         String token = JwtUtil.sign(username, syspassword);
         // 设置超时时间
         redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token);
-        redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME*2 / 1000);
+        redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME * 2 / 1000);
         //token 信息
         obj.put("token", token);
         result.setResult(obj);
@@ -656,20 +660,21 @@ public class LoginController {
 
     /**
      * 图形验证码
+     *
      * @param sysLoginModel
      * @return
      */
     @RequestMapping(value = "/checkCaptcha", method = RequestMethod.POST)
-    public Result<?> checkCaptcha(@RequestBody SysLoginModel sysLoginModel){
+    public Result<?> checkCaptcha(@RequestBody SysLoginModel sysLoginModel) {
         String captcha = sysLoginModel.getCaptcha();
         String checkKey = sysLoginModel.getCheckKey();
-        if(captcha==null){
+        if (captcha == null) {
             return Result.error("验证码无效");
         }
         String lowerCaseCaptcha = captcha.toLowerCase();
-        String realKey = MD5Util.getMd5(lowerCaseCaptcha+checkKey);
+        String realKey = MD5Util.getMd5(lowerCaseCaptcha + checkKey);
         Object checkCode = redisUtil.get(realKey);
-        if(checkCode==null || !checkCode.equals(lowerCaseCaptcha)) {
+        if (checkCode == null || !checkCode.equals(lowerCaseCaptcha)) {
             return Result.error("验证码错误");
         }
         return Result.ok();

+ 2 - 2
jeecg-boot-module-system/src/main/resources/application-dev.yml

@@ -1,5 +1,5 @@
 server:
-  port: 8805
+  port: 8080
   tomcat:
     max-swallow-size: -1
   servlet:
@@ -135,7 +135,7 @@ spring:
         connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
       datasource:
         master:
-          url: jdbc:mysql://139.186.27.96:4000/jiaoyang?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+          url: jdbc:mysql://139.186.27.96:4000/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
           username: data
           password: hcst@2021
           driver-class-name: com.mysql.jdbc.Driver

+ 4 - 4
module-common/src/main/java/cn/com/ctop/common/module/utils/CorpWexinUtils.java

@@ -20,11 +20,11 @@ public class CorpWexinUtils {
 
     public static void initService() {
         val configStorage = new WxCpDefaultConfigImpl();
-        configStorage.setCorpId("wwef2e51064c0ac897");
+        configStorage.setCorpId("ww24b8a47826f5875f");
         configStorage.setAgentId(1000002);
-        configStorage.setCorpSecret("ieoVDAIurCOMdLrvktyQNCqWvTPqdphmXSFdk57NZ1k");
-/*        configStorage.setToken("hcst2019");
-        configStorage.setAesKey("hcst2019");*/
+        configStorage.setCorpSecret("MJIlySADGPlgvADnkFQPUpfZD4yV-4WN6066OgNnb0s");
+        configStorage.setToken("hcst2019");
+        configStorage.setAesKey("hcst2019");
         wxCpService = new WxCpServiceImpl();
         wxCpService.setWxCpConfigStorage(configStorage);
     }

+ 16 - 9
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouCreateCreativeServiceImpl.java

@@ -96,10 +96,11 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         if (null != singleAppid && singleAppid == 0) {
             //多应用
             JSONArray appIdArray = JSONArray.parseArray(strategy.getAppIdArray());
-            String replaceString = KuaishouCreativeMatTypeEnum.getNameByType(strategy.getUnitType().toString() + createType.toString());
             if (strategy.getMultipleBids() == 0) { // 非多应用多出价
                 if (null != appIdArray && !appIdArray.isEmpty()) {
                     for (int i = 0; i < appIdArray.size(); i++) {
+                        String replaceString = KuaishouCreativeMatTypeEnum.getNameByType(strategy.getUnitType().toString() + createType.toString());
+
                         AiKuaiShouAppInfo appInfo = appInfoService.getByParams(strategy.getAccountId(), appIdArray.getLong(i));
                         if (null == appInfo) {
                             log.info("账户:{},appid({}) 数据不存在", accountId, appIdArray.getLong(i));
@@ -166,6 +167,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                     }
                 }
             } else if (strategy.getMultipleBids() == 1) { //  多应用多出价
+                String replaceString = KuaishouCreativeMatTypeEnum.getNameByType(strategy.getUnitType().toString() + createType.toString());
                 List<KuaiShouVideoGet> allVideos = getVideosByParams(strategy, startTime, endTime, null, createType, videoCnt);
                 if (Check.isNull(allVideos)) {
                     return videoCnt;
@@ -351,7 +353,6 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         String key = token.getAccountId() + "_ProgramCreative" + "_" + nowDate;
         JSONArray appIdArray = JSON.parseArray(strategy.getAppIdArray());
         if (null != singleAppid && singleAppid == 0) {
-            String replaceString = KuaishouCreativeMatTypeEnum.getNameByType(strategy.getUnitType().toString() + createType.toString());
             if (strategy.getMultipleBids() == 0) { //  非多应用多出价
                 //多应用
                 if (null != appIdArray && !appIdArray.isEmpty()) {
@@ -361,6 +362,8 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                             log.info("账户:{},appid({}) 数据不存在", accountId, appIdArray.getLong(i));
                             continue;
                         }
+                        String replaceString = KuaishouCreativeMatTypeEnum.getNameByType(strategy.getUnitType().toString() + createType.toString());
+
                         //判定是否通用监测链接
                         if (null != strategy.getGeneralTrack() && strategy.getGeneralTrack() == 0) {
                             strategy.setClickTrackUrl(appInfo.getTrackUrl());
@@ -427,6 +430,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                 if (Check.isNull(allVideos)) {
                     return;
                 }
+                String replaceString = KuaishouCreativeMatTypeEnum.getNameByType(strategy.getUnitType().toString() + createType.toString());
                 List<List<KuaiShouVideoGet>> splitVideos = Lists.partition(allVideos, 1);
                 for (int j = 1; j < splitVideos.size() + 1; j++) {
                     List<KuaiShouVideoGet> kuaiShouVideoGets = splitVideos.get(j);
@@ -1095,14 +1099,17 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                 targetJsonObject.put("filter_converted_level", strategy.getFilterConvertedLevel());
             }
         }
-        JSONArray appInterest = JSONArray.parseArray(strategy.getAppInterest());
-        if (!Check.isNull(appInterest)) {
-            targetJsonObject.put("app_interest", appInterest);
-        }
+
         // APP行为-按APP名称
-        JSONArray appIds = JSONArray.parseArray(strategy.getAppIds());
-        if (!Check.isNull(appIds)) {
-            targetJsonObject.put("app_ids", appIds);
+        if (sceneId != 5) {
+            JSONArray appIds = JSONArray.parseArray(strategy.getAppIds());
+            if (!Check.isNull(appIds)) {
+                targetJsonObject.put("app_ids", appIds);
+            }
+            JSONArray appInterest = JSONArray.parseArray(strategy.getAppInterest());
+            if (!Check.isNull(appInterest)) {
+                targetJsonObject.put("app_interest", appInterest);
+            }
         }
         // 人群包定向
         JSONArray populationString = JSONArray.parseArray(strategy.getPopulation());

+ 4 - 4
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouGroupTemplateServiceImpl.java

@@ -503,10 +503,10 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
             target.put("paid_audience", JSONArray.parseArray(templateTarget.getPaidAudience()));
         }
         //-------------兴趣行为定向
-        JSONObject behaviorInterest = new JSONObject();
+    /*    JSONObject behaviorInterest = new JSONObject();
         JSONObject behavior = new JSONObject();
-        JSONObject interest = new JSONObject();
-        if (!Check.isNull(templateTarget.getKeyword())) {
+        JSONObject interest = new JSONObject();*/
+ /*       if (!Check.isNull(templateTarget.getKeyword())) {
             behavior.put("keyword", JSONArray.parseArray(templateTarget.getKeyword()));
         }
         if (!Check.isNull(templateTarget.getLabel())) {
@@ -532,7 +532,7 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
         }
         if (!Check.isNull(behaviorInterest)) {
             target.put("behavior_interest", behaviorInterest);
-        }
+        }*/
         returnJson.put("target", target);
         returnJson.put("code", 0);
         return returnJson;