Просмотр исходного кода

商学院增加已读接口
测试服环境

mac 2 лет назад
Родитель
Сommit
4dbf096d5b

+ 0 - 1
kxs-system/kxs-system-api/src/main/java/com/kxs/system/api/model/KxsSchoolStudy.java

@@ -54,7 +54,6 @@ public class KxsSchoolStudy extends Model<KxsSchoolStudy> implements Serializabl
      * 删除标记,0未删除,1已删除
      * 删除标记,0未删除,1已删除
      */
      */
     @Schema(description = "删除标记,0未删除,1已删除")
     @Schema(description = "删除标记,0未删除,1已删除")
-    @TableLogic
     @TableField(fill = FieldFill.INSERT)
     @TableField(fill = FieldFill.INSERT)
     private String delFlag;
     private String delFlag;
 
 

+ 14 - 4
kxs-system/kxs-system-biz/src/main/java/com/kxs/system/biz/controller/kxsapp/SchoolController.java

@@ -10,10 +10,7 @@ import com.kxs.system.biz.service.KxsSchoolMenuService;
 import com.kxs.system.biz.service.KxsSchoolStudyService;
 import com.kxs.system.biz.service.KxsSchoolStudyService;
 import lombok.RequiredArgsConstructor;
 import lombok.RequiredArgsConstructor;
 import org.springdoc.core.annotations.ParameterObject;
 import org.springdoc.core.annotations.ParameterObject;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 
 /**
 /**
  * 首页(School)控制层
  * 首页(School)控制层
@@ -60,6 +57,19 @@ public class SchoolController {
         return R.ok(kxsSchoolStudyService.schoolList(page,menuId));
         return R.ok(kxsSchoolStudyService.schoolList(page,menuId));
     }
     }
 
 
+    /**
+     * 商学院-增加已读数量
+     *
+     * @param param 商学院
+     * @return {@link R}
+     */
+    @PutMapping("/incrRead")
+    @Inner(value = false)
+    public R incrRead(@RequestBody KxsSchoolStudy param){
+
+        return R.ok(kxsSchoolStudyService.incrRead(param));
+    }
+
 
 
     /**
     /**
      * 商学院-创客学堂二级分类
      * 商学院-创客学堂二级分类

+ 11 - 1
kxs-system/kxs-system-biz/src/main/java/com/kxs/system/biz/service/KxsSchoolStudyService.java

@@ -1,8 +1,10 @@
 package com.kxs.system.biz.service;
 package com.kxs.system.biz.service;
 
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.kxs.system.api.model.KxsSchoolStudy;
 import com.kxs.system.api.model.KxsSchoolStudy;
+import com.kxs.system.api.vo.kxsapp.school.SchoolListVO;
 
 
 /**
 /**
  * 商学院创客学堂(KxsSchoolStudy)表服务接口
  * 商学院创客学堂(KxsSchoolStudy)表服务接口
@@ -13,6 +15,14 @@ import com.kxs.system.api.model.KxsSchoolStudy;
 public interface KxsSchoolStudyService extends IService<KxsSchoolStudy> {
 public interface KxsSchoolStudyService extends IService<KxsSchoolStudy> {
 
 
 
 
-    Object schoolList(Page<KxsSchoolStudy> page, Integer menuId);
+    IPage<SchoolListVO> schoolList(Page<KxsSchoolStudy> page, Integer menuId);
+
+    /**
+     * 增加已读数量
+     *
+     * @param param 商学院
+     * @return {@link Boolean}
+     */
+    Boolean incrRead(KxsSchoolStudy param);
 }
 }
 
 

+ 15 - 1
kxs-system/kxs-system-biz/src/main/java/com/kxs/system/biz/service/impl/KxsSchoolStudyServiceImpl.java

@@ -1,10 +1,13 @@
 package com.kxs.system.biz.service.impl;
 package com.kxs.system.biz.service.impl;
 
 
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.bean.BeanUtil;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.kxs.common.core.exception.GlobalCustomerException;
 import com.kxs.system.api.vo.kxsapp.school.SchoolListVO;
 import com.kxs.system.api.vo.kxsapp.school.SchoolListVO;
+import com.kxs.system.biz.constant.enums.SysErrorTypeEnum;
 import com.kxs.system.biz.mapper.KxsSchoolStudyMapper;
 import com.kxs.system.biz.mapper.KxsSchoolStudyMapper;
 import com.kxs.system.api.model.KxsSchoolStudy;
 import com.kxs.system.api.model.KxsSchoolStudy;
 import com.kxs.system.biz.service.KxsSchoolStudyService;
 import com.kxs.system.biz.service.KxsSchoolStudyService;
@@ -12,6 +15,7 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
 import java.util.ArrayList;
 import java.util.ArrayList;
+import java.util.Optional;
 
 
 /**
 /**
  * 商学院创客学堂(KxsSchoolStudy)表服务实现类
  * 商学院创客学堂(KxsSchoolStudy)表服务实现类
@@ -23,7 +27,7 @@ import java.util.ArrayList;
 public class KxsSchoolStudyServiceImpl extends ServiceImpl<KxsSchoolStudyMapper, KxsSchoolStudy> implements KxsSchoolStudyService {
 public class KxsSchoolStudyServiceImpl extends ServiceImpl<KxsSchoolStudyMapper, KxsSchoolStudy> implements KxsSchoolStudyService {
 
 
     @Override
     @Override
-    public Object schoolList(Page<KxsSchoolStudy> page, Integer menuId) {
+    public IPage<SchoolListVO> schoolList(Page<KxsSchoolStudy> page, Integer menuId) {
         //根据创建时间获取数据
         //根据创建时间获取数据
         Page<KxsSchoolStudy> kxsSchoolStudyPage = page(page, Wrappers.<KxsSchoolStudy>lambdaQuery().eq(KxsSchoolStudy::getMenuId, menuId).orderByDesc(KxsSchoolStudy::getCreateTime));
         Page<KxsSchoolStudy> kxsSchoolStudyPage = page(page, Wrappers.<KxsSchoolStudy>lambdaQuery().eq(KxsSchoolStudy::getMenuId, menuId).orderByDesc(KxsSchoolStudy::getCreateTime));
         ArrayList<SchoolListVO> schoolListVOS = new ArrayList<>();
         ArrayList<SchoolListVO> schoolListVOS = new ArrayList<>();
@@ -46,5 +50,15 @@ public class KxsSchoolStudyServiceImpl extends ServiceImpl<KxsSchoolStudyMapper,
         schoolListVOPage.setRecords(schoolListVOS);
         schoolListVOPage.setRecords(schoolListVOS);
         return schoolListVOPage;
         return schoolListVOPage;
     }
     }
+
+    @Override
+    public Boolean incrRead(KxsSchoolStudy param) {
+
+        KxsSchoolStudy schoolStudy = getById(param.getId());
+        Optional.ofNullable(schoolStudy).orElseThrow(() -> new GlobalCustomerException(SysErrorTypeEnum.NOT_DATA.getDescription()));
+
+        schoolStudy.setStudyPerson(schoolStudy.getStudyPerson() + 1);
+        return updateById(schoolStudy);
+    }
 }
 }
 
 

+ 12 - 3
kxs-user/kxs-user-biz/src/main/java/com/kxs/user/biz/service/impl/KxsUserServiceImpl.java

@@ -50,6 +50,7 @@ import io.seata.spring.annotation.GlobalTransactional;
 import lombok.RequiredArgsConstructor;
 import lombok.RequiredArgsConstructor;
 import org.checkerframework.checker.units.qual.K;
 import org.checkerframework.checker.units.qual.K;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.cache.CacheManager;
 import org.springframework.cache.CacheManager;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.data.redis.core.RedisTemplate;
@@ -104,6 +105,8 @@ public class KxsUserServiceImpl extends ServiceImpl<KxsUserMapper, KxsUser> impl
 
 
     private final KxsUserPresetLogMapper kxsUserPresetLogMapper;
     private final KxsUserPresetLogMapper kxsUserPresetLogMapper;
     private final RemoteKxsProductService remoteKxsProductService;
     private final RemoteKxsProductService remoteKxsProductService;
+    @Value("${spring.profiles.active}")
+    private String active;
 
 
     private static final PasswordEncoder ENCODER = new BCryptPasswordEncoder();
     private static final PasswordEncoder ENCODER = new BCryptPasswordEncoder();
     
     
@@ -276,11 +279,17 @@ public class KxsUserServiceImpl extends ServiceImpl<KxsUserMapper, KxsUser> impl
         if (ObjectUtil.isNotEmpty(codeObj)) {
         if (ObjectUtil.isNotEmpty(codeObj)) {
             throw new ValidateCodeException(UserErrorTypeEnum.CODE_NOT_EX.getDescription());
             throw new ValidateCodeException(UserErrorTypeEnum.CODE_NOT_EX.getDescription());
         }
         }
-
-        String code = RandomUtil.randomNumbers(Integer.parseInt(UserConstants.CODE_SIZE));
+        String code;
+        if("dev".equals(active) || "test".equals(active)){
+            code = "111111";
+        }else{
+            code = RandomUtil.randomNumbers(Integer.parseInt(UserConstants.CODE_SIZE));
+        }
         redisTemplate.opsForValue().set(key, code, UserConstants.CODE_TIME, TimeUnit.SECONDS);
         redisTemplate.opsForValue().set(key, code, UserConstants.CODE_TIME, TimeUnit.SECONDS);
         //发送短信
         //发送短信
-        SmsUtils.sendCode(mobile, code);
+        if("prod".equals(active)){
+            SmsUtils.sendCode(mobile, code);
+        }
         return Boolean.TRUE;
         return Boolean.TRUE;
     }
     }