Commit bb47f29b authored by luzhuang's avatar luzhuang

新增设置程课培训积分接口

parent 1e992948
package org.rcisoft.business.bexternallink.dto;
import lombok.Data;
@Data
public class MenuDTO {
public String menuName;
public String href;
public String url;
public String logo;
}
......@@ -5,8 +5,10 @@ package org.rcisoft.business.bpersonvalue.controller;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.rcisoft.business.bbanner.entity.BBanner;
import org.rcisoft.common.controller.PaginationController;
import org.rcisoft.common.model.GridModel;
import org.rcisoft.sys.user.bean.CurUser;
import org.springframework.validation.BindingResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
......@@ -36,16 +38,15 @@ public class BPersonValueController extends PaginationController<BPersonValue> {
private BPersonValueService bPersonValueServiceImpl;
@ApiOperation(value="添加", notes="添加")
//@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = false, dataType = "varchar")})
@PostMapping(value = "/add")
public Result add(@Valid BPersonValue bPersonValue, BindingResult bindingResult) {
PersistModel data = bPersonValueServiceImpl.save(bPersonValue);
return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
bPersonValue);
@ApiOperation(value = "1601 明细", notes = "明细", response = BBanner.class)
@GetMapping(value = "/queryByPagination")
public Result queryByPagination(CurUser curUser,String businessId) {
bPersonValueServiceImpl.queryByPagination(getPaginationUtility(), curUser.getCorpId(),businessId);
GridModel gridModel = getGridModelResponse();
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
gridModel);
}
}
......@@ -21,6 +21,7 @@ import java.util.List;
public class BPersonValue extends IdEntity<BPersonValue> {
private String userId;
private String event;
......@@ -28,6 +29,5 @@ public class BPersonValue extends IdEntity<BPersonValue> {
private String type;
}
......@@ -11,12 +11,6 @@ import java.util.List;
*/
public interface BPersonValueService {
/**
* 保存
* @param bPersonValue
* @return
*/
PersistModel save(BPersonValue bPersonValue);
List<BPersonValue> queryByPagination(PageUtil pageUtil,String corpId,String businessId);
}
......@@ -31,7 +31,7 @@ public class BPersonValueServiceImpl implements BPersonValueService {
@Override
public PersistModel save(BPersonValue bPersonValue) {
public List<BPersonValue> queryByPagination(PageUtil pageUtil, String corpId, String businessId) {
return null;
}
}
......@@ -74,4 +74,44 @@ public class BReleaseValueController extends PaginationController<BReleaseValue>
MessageConstant.MESSAGE_ALERT_ERROR,
businessId);
}
@ApiOperation(value="1504 分页查询课程、培训积分设置页面", notes="分页查询课程、培训积分设置页面")
@ApiImplicitParams({@ApiImplicitParam(name = "keyWord", value = "模糊查询关键字", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "type", value = "0课程 1培训", required = true, dataType = "varchar")})
@GetMapping(value = "/queryLessonValue")
public Result queryLessonValue(CurUser curUser, String keyWord,String type ) {
bReleaseValueServiceImpl.queryLessonValueByPagination(getPaginationUtility(),keyWord,curUser.getCorpId(),type);
GridModel gridModel = getGridModelResponse();
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
gridModel);
}
@ApiOperation(value="1505 编辑课程、培训积分", notes="编辑课程、培训积分")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "主键id", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "valueConsume", value = "课程、培训 消耗积分", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "valueGain", value = "课程、培训 获得积分", required = true, dataType = "varchar")})
@PostMapping(value = "/updateLessonValue")
public Result updateLessonValue(CurUser curUser, String businessId,String valueConsume,String valueGain) {
PersistModel data = bReleaseValueServiceImpl.updateLessonValue(businessId,valueConsume,valueGain);
return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
businessId);
}
@ApiOperation(value="1504 分页查询 用户积分设置页面", notes="分页查询 用户积分设置页面")
@ApiImplicitParams({@ApiImplicitParam(name = "name", value = "模糊查询关键字", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "dept", value = "部门id", required = true, dataType = "varchar")})
@GetMapping(value = "/queryUserValue")
public Result queryUserValue(CurUser curUser, String name,String dept) {
bReleaseValueServiceImpl.queryUserValueByPagination(getPaginationUtility(),name,curUser.getCorpId(),dept);
GridModel gridModel = getGridModelResponse();
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
gridModel);
}
}
package org.rcisoft.business.breleasevalue.dao;
import org.apache.ibatis.annotations.*;
import org.rcisoft.business.breleasevalue.dto.LessonValueDto;
import org.rcisoft.business.breleasevalue.dto.UserValueDto;
import org.rcisoft.business.breleasevalue.entity.BReleaseValueSon;
import org.rcisoft.core.base.BaseMapper;
import org.rcisoft.business.breleasevalue.entity.BReleaseValue;
......@@ -23,7 +25,11 @@ public interface BReleaseValueRepository extends BaseMapper<BReleaseValue> {
@ResultMap(value = "BaseResultMap" )
List<BReleaseValue> queryBReleaseValues(String corpId);
/**
* 插入子表
* @param list
* @return
*/
@Insert("<script>" +
"insert into b_release_value_son (business_id,release_id,user_id) VALUES " +
"<foreach collection=\"list\" item=\"item\" separator=\",\">" +
......@@ -34,17 +40,89 @@ public interface BReleaseValueRepository extends BaseMapper<BReleaseValue> {
@Update("update b_release_value set del_flag= 1 where business_id = #{releaseId} and corp_id = #{corpId}")
int remove(@Param("releaseId") String releaseId,@Param("corpId") String corpId);
/**
* 根据用户名删除子表中相关数据
* @param userId
* @return
*/
@Delete("<script><foreach collection=\"userId\" item=\"item\" separator=\";\">" +
" delete from b_release_value_son where user_id = #{item}" +
"</foreach></script>")
int deleteSonForUserId(@Param("userId") String[] userId);
/**
* 根据releaseId删除子表中相关数据
* @param releaseId
* @return
*/
@Delete("delete from b_release_value_son where release_id = #{releaseId}")
int deleteSonForReleaseId(@Param("releaseId") String releaseId);
/**
* xml中查询关联用
* @param releaseId
* @return
*/
@Select(" select su.name " +
" from b_release_value_son rvs " +
" left join s_user su on su.business_id = rvs.user_id " +
" where rvs.release_id = #{releaseId} ")
List<String> getNameforReleaseId(@Param("releaseId")String releaseId);
/**
* 查询课程或培训积分设置
* @param keyWord
* @param corpId
* @param type
* @return
*/
@Select("<script> select bl.business_id businessId,bl.lesson_name lessonName,su.name name,bl.value_consume valueConsume,bl.value_gain valueGain " +
" from b_lesson bl " +
" left join s_user su on su.business_id = bl.lecturer_id " +
" where bl.del_flag !=1 and bl.flag = 1 " +
"<if test=\"keyWord!=null and keyWord != ''\"> " +
" and bl.lesson_name like concat('%',#{keyWord},'%') or su.name like concat('%',#{keyWord},'%') </if>" +
" and bl.corp_id = #{corpId} " +
"and bl.lesson_type = #{type}</script>")
List<LessonValueDto> getLessonValue(@Param("keyWord") String keyWord, @Param("corpId")String corpId, @Param("type")String type);
/**
* 设置课程或培训 积分
* @param businessId
* @param valueConsume
* @param valueGain
* @return
*/
@Update("update b_lesson set value_consume = #{valueConsume} ,value_gain = #{valueGain} where business_id = #{businessId}")
int updateLessonValue(@Param("businessId") String businessId,@Param("valueConsume") String valueConsume,@Param("valueGain") String valueGain);
/**
* 查询用户积分信息
* @param name
* @param corpId
* @param userList
* @return
*/
@Select("<script>select business_id, name , `value` " +
" from s_user " +
" where 1=1 " +
" and del_flag !=1 " +
" and flag = 1 " +
" and corp_id = #{corpId} " +
"<if test=\"name!=null and name != ''\"> and name like concat('%',#{name},'%')</if>" +
"<if test=\"userList!=null and userList.size() > 0 \"> " +
" and business_id in <foreach item='item' index='index' collection='userList' open='(' separator=',' close=')'> #{item} </foreach>" +
"</if>" +
" </script>")
@ResultMap(value = "UserValueDtoMap")
List<UserValueDto> getUserValue(@Param("name") String name, @Param("corpId")String corpId, @Param("userList")List<String> userList);
/**
* xml中引用
* @param businessId
* @return
*/
@Select("select sum(value) valueConsume from b_person_value where type = 1 and del_flag !=1 and flag = 1 and user_id = #{businessId}")
String getValueConsume(@Param("businessId")String businessId);
}
package org.rcisoft.business.breleasevalue.dto;
import lombok.Data;
@Data
public class LessonValueDto {
public String businessId;
public String lessonName;
public String name;
public String valueConsume;
public String valueGain;
}
package org.rcisoft.business.breleasevalue.dto;
import lombok.Data;
@Data
public class UserValueDto {
public String businessId;
public String dept;
public String name;
public String value;
public String valueConsume;
}
......@@ -3,6 +3,8 @@ package org.rcisoft.business.breleasevalue.service;
import org.rcisoft.business.bbanner.dto.FindBannerPaginDTO;
import org.rcisoft.business.bbanner.entity.BBanner;
import org.rcisoft.business.breleasevalue.dto.BReleaseValueDto;
import org.rcisoft.business.breleasevalue.dto.LessonValueDto;
import org.rcisoft.business.breleasevalue.dto.UserValueDto;
import org.rcisoft.business.breleasevalue.entity.BReleaseValue;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.aop.PageUtil;
......@@ -20,4 +22,9 @@ public interface BReleaseValueService {
PersistModel delete (String businessId ,String corpId);
List<LessonValueDto> queryLessonValueByPagination(PageUtil pageUtil,String keyWord,String corpId,String LessonType );
PersistModel updateLessonValue (String businessId, String valueConsume,String valueGain);
List<UserValueDto> queryUserValueByPagination(PageUtil pageUtil, String name, String corpId, String dept);
}
package org.rcisoft.business.breleasevalue.service.impl;
import org.rcisoft.business.breleasevalue.dto.BReleaseValueDto;
import org.rcisoft.business.breleasevalue.dto.LessonValueDto;
import org.rcisoft.business.breleasevalue.dto.UserValueDto;
import org.rcisoft.business.breleasevalue.entity.BReleaseValueSon;
import org.rcisoft.common.util.feignDto.MTUserGetsReqDTO;
import org.rcisoft.common.util.feignDto.MTUserInfoRspDTO;
import org.rcisoft.common.util.outClient.MTCotactApiRequestClient;
import org.rcisoft.core.util.IdGen;
import org.rcisoft.core.util.UserUtil;
import org.rcisoft.core.aop.PageUtil;
......@@ -11,6 +16,7 @@ import org.rcisoft.business.breleasevalue.entity.BReleaseValue;
import org.rcisoft.business.breleasevalue.service.BReleaseValueService;
import org.rcisoft.sys.user.entity.SysUser;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -20,7 +26,10 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import lombok.extern.slf4j.Slf4j;
/**
......@@ -34,6 +43,9 @@ public class BReleaseValueServiceImpl implements BReleaseValueService {
@Autowired
private BReleaseValueRepository bReleaseValueRepository;
@Autowired
MTCotactApiRequestClient mtCotactApiRequestClient;
@Override
public PersistModel save(BReleaseValueDto bReleaseValueDto) {
......@@ -73,6 +85,64 @@ public class BReleaseValueServiceImpl implements BReleaseValueService {
return new PersistModel(line);
}
@Override
public List<LessonValueDto> queryLessonValueByPagination(PageUtil pageUtil,String keyWord, String corpId, String LessonType) {
return bReleaseValueRepository.getLessonValue(keyWord, corpId, LessonType);
}
@Override
public PersistModel updateLessonValue(String businessId, String valueConsume, String valueGain) {
int line = bReleaseValueRepository.updateLessonValue(businessId, valueConsume, valueGain);
return new PersistModel(line);
}
@Override
public List<UserValueDto> queryUserValueByPagination(PageUtil pageUtil, String name, String corpId, String dept) {
List<String> deptList = new ArrayList<>();
if(dept!=null){
Set<String> deptSets = new HashSet<>();
deptSets.add(dept);
deptList= mtCotactApiRequestClient.getSubUserIdsByDeptIds(corpId, deptSets);
}
List<UserValueDto> users = bReleaseValueRepository.getUserValue(name, corpId, deptList);
List<String> list = new ArrayList<>();
for (UserValueDto user : users) {
list.add(user.getBusinessId());
}
MTUserGetsReqDTO mtUserGetsReqDTO = new MTUserGetsReqDTO();
mtUserGetsReqDTO.setCorpId(corpId);
mtUserGetsReqDTO.setIds(list);
List<MTUserInfoRspDTO> depart = mtCotactApiRequestClient.userGets(mtUserGetsReqDTO);
if (depart != null) {
StringBuffer sb = new StringBuffer();
for (UserValueDto dto : users) {
for (MTUserInfoRspDTO mtUserInfoRspDTO : depart) {
if (dto.getBusinessId().equals(mtUserInfoRspDTO.getId())) {
if (mtUserInfoRspDTO.getDepts() != null) {
for (MTUserInfoRspDTO.DeptsBean deptsBean : mtUserInfoRspDTO.getDepts()) {
for (MTUserInfoRspDTO.DeptsBean.PathBean pathBean : deptsBean.getPath()) {
if (null != pathBean)
sb.append(pathBean.getName() + "-");
}
}
}
if (!sb.toString().equals("")) {
String string = sb.toString().substring(0, sb.toString().length() - 1);
if(string.indexOf("-") != -1){
string = string.substring(string.indexOf("-")+1);
}
dto.setDept(string);
}
sb = new StringBuffer();
}
}
}
}
return users;
}
/**
* 去掉子表中已有用户信息,插入新的数据
* @param userIds
......
......@@ -2,6 +2,7 @@ package org.rcisoft.sys.menu.dao;
import org.apache.ibatis.annotations.*;
import org.rcisoft.business.bexternallink.dto.MenuDTO;
import org.rcisoft.core.base.BaseMapper;
import org.rcisoft.sys.menu.entity.MenuDto;
import org.rcisoft.sys.menu.entity.SysMenu;
......
......@@ -140,11 +140,11 @@ public class SysUserController extends PaginationController<SysUser> {
@ApiOperation(value = "706 根据userId 查询菜单", notes = "userId 和 modelId查询 menu")
@ApiImplicitParam(name = "modelId", value = "前台菜单10 后台菜单20", required = true, dataType = "varchar", paramType = "path")
@GetMapping("/queryMenuById")
public Result queryMenu(CurUser curUser,String modelId) {
public Result queryMenu(CurUser curUser,String modelId,String type) {
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
userServiceImpl.queryMenusById(curUser,modelId));
userServiceImpl.queryMenusById(curUser,modelId,type));
}
/**
......
......@@ -3,6 +3,7 @@ package org.rcisoft.sys.user.dao;
import org.apache.ibatis.annotations.*;
import org.rcisoft.business.bdictionary.entity.BDictionary;
import org.rcisoft.business.bexternallink.dto.MenuDTO;
import org.rcisoft.business.blesson.dto.RoleTypeDepartDTO;
import org.rcisoft.core.base.BaseMapper;
import org.rcisoft.sys.user.bean.CurUser;
......@@ -296,4 +297,12 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
@Select("select count(0) from s_user where del_flag != 1 and flag = 1 and corp_id = #{corpId} and business_id = #{userId}")
int getUserflag (CurUser curUser);
@Select("<script>select title menuName,external_url url,logo from b_external_link where 1=1 " +
"<if test=\"type !=null \"> and type != 2 </if>" +
" and corp_id = #{corpId} " +
" and del_flag !=1 and flag = 1 ORDER BY sort </script>")
List<MenuDTO> getReadingMenu(@Param("type") String type, @Param("corpId") String corpId);
}
......@@ -36,7 +36,7 @@ public interface SysUserService {
List<SysMenu> queryUserMenus(CurUser user);
Object queryMenusById(CurUser curUser, String modelId);
Object queryMenusById(CurUser curUser, String modelId,String type);
SysUser getUserState(String id);
......
......@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang.StringUtils;
import org.rcisoft.business.bexternallink.dto.MenuDTO;
import org.rcisoft.business.synchronizationtime.entity.SynchronizationTime;
import org.rcisoft.business.synchronizationtime.service.SynchronizationTimeService;
import org.rcisoft.common.component.Global;
......@@ -58,6 +59,8 @@ public class SysUserServiceImpl implements SysUserService {
@Autowired
MTCotactApiRequestClient mtCotactApiRequestClient;
@Autowired
private Global global;
......@@ -225,7 +228,7 @@ public class SysUserServiceImpl implements SysUserService {
}
@Override
public Object queryMenusById(CurUser curUser, String modelId) {
public Object queryMenusById(CurUser curUser, String modelId,String type) {
//查询登录人启用状态
int x = sysUserMapper.getUserflag(curUser);
if(x < 1){
......@@ -234,6 +237,13 @@ public class SysUserServiceImpl implements SysUserService {
map.put("code",400);
return map;
}
if("10".equals(modelId)){
List<MenuDTO> list = sysUserMapper.getReadingMenu(type,curUser.getCorpId());
for(int i = 0;i < list.size();i++){
list.get(i).setHref("a"+(i+1));
}
return list;
}
List<QueryMenuResDTO> menus = sysUserMapper.queryMenus(curUser.getCorpId(), curUser.getUserId(), modelId);
String[] strings = new String[]{"题库管理", "试卷管理", "统计分析"};
......
......@@ -20,5 +20,16 @@
</collection>
</resultMap>
<resultMap id="UserValueDtoMap" type="org.rcisoft.business.breleasevalue.dto.UserValueDto">
<id column="business_id" jdbcType="VARCHAR" property="businessId"/>
<result column="dept" jdbcType="INTEGER" property="dept"/>
<result column="name" jdbcType="INTEGER" property="name"/>
<result column="value" jdbcType="VARCHAR" property="value"/>
<collection property="valueConsume" ofType="org.rcisoft.business.breleasevalue.dto.UserValueDto"
javaType="String" select="org.rcisoft.business.breleasevalue.dao.BReleaseValueRepository.getValueConsume"
column="business_id">
</collection>
</resultMap>
<!--<cache type="${corePackag!}.util.RedisCache"/>-->
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment