Commit 14fbc593 authored by root's avatar root

Merge remote-tracking branch 'origin/meiteng' into meiteng

parents cebee36d c16bccbb
......@@ -33,10 +33,7 @@ import org.rcisoft.sys.role.dao.SysRoleRepository;
import org.rcisoft.sys.user.bean.CurUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
......@@ -116,7 +113,7 @@ public class BChapterController extends PaginationController<BChapter> {
}
@ApiOperation(value = "205 查询章节带进度", notes = "根据lessonId查询章节带进度", response = QueryChapterListResDTO.class)
@GetMapping(value = "/queryBChaptersWithProgress")
public Result queryBChaptersWithProgress(CurUser curUser,@Valid String lessonId,BindingResult br) {
public Result queryBChaptersWithProgress(CurUser curUser, @RequestParam String lessonId, BindingResult br) {
Map<String, Object> map = new HashedMap();
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
......
......@@ -40,6 +40,7 @@ import java.io.*;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
......@@ -98,16 +99,31 @@ public class BChapterServiceImpl implements BChapterService {
model.setLessonId(lessonId);
model.setStudentId(curUser.getUserId());
List<QueryChapterListResDTO> queryChapterListResDTOS = queryChapterListResDTO(model, curUser.getCorpId());
queryChapterListResDTOS.stream().forEach(queryChapterListResDTO -> {
queryChapterListResDTO.getChildList().stream().forEach(childList -> {
int i = 0;
int percent = 0;
for (QueryChapterListResDTO queryChapterListResDTO: queryChapterListResDTOS){
for (QueryChapterListResDTO childList: queryChapterListResDTO.getChildList()){
List<BRStudentChapter> brStudentChapterList = brStudentChapterRepository.queryByStuIdAndChapter(childList.getBusinessId(), curUser.getUserId());
if (null != brStudentChapterList && brStudentChapterList.size() > 0) {
childList.setProgress(brStudentChapterList.get(0).getProgress());
String temp = brStudentChapterList.get(0).getProgress().substring(0,brStudentChapterList.get(0).getProgress().length()-1);
percent += Float.valueOf(temp);
}
});
});
i++;
}
}
// queryChapterListResDTOS.stream().forEach(queryChapterListResDTO -> {
// queryChapterListResDTO.getChildList().stream().forEach(childList -> {
// List<BRStudentChapter> brStudentChapterList = brStudentChapterRepository.queryByStuIdAndChapter(childList.getBusinessId(), curUser.getUserId());
// if (null != brStudentChapterList && brStudentChapterList.size() > 0) {
// childList.setProgress(brStudentChapterList.get(0).getProgress());
// }
// });
// });
Map map = new HashMap();
DecimalFormat df=new DecimalFormat("0.00");//设置保留位数
map.put("chapterList", queryChapterListResDTOS);
map.put("totalProgress", df.format((float)percent/i) + "%");
map.put("lessonInfo", bLessonRepository.selectByPrimaryKey(model.getLessonId()));
return map;
}
......
package org.rcisoft.business.brstudentchapter.dao;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.rcisoft.business.brstudentchapter.dto.BRStudentChapterDto;
import org.rcisoft.core.base.BaseMapper;
import org.rcisoft.business.brstudentchapter.entity.BRStudentChapter;
......@@ -38,5 +39,12 @@ public interface BRStudentChapterRepository extends BaseMapper<BRStudentChapter>
+ "</script>")
@ResultMap(value = "BRStudentChapterResultMap" )
List<BRStudentChapter> queryByStuIdAndChapter(@Param("chapterId") String chapterId,@Param("studentId") String studentId);
@Update("UPDATE b_r_student_chapter " +
"SET progress = #{progress} " +
"WHERE " +
" business_id = #{businessId} ")
@ResultMap(value = "BRStudentChapterResultMap" )
int updateById(BRStudentChapter brStudentChapter);
}
......@@ -44,16 +44,16 @@ public class BRStudentChapterServiceImpl implements BRStudentChapterService {
public PersistModel save(BRStudentChapterDto brStudentChapterDto){
int line = 0;
List<BRStudentChapter> brStudentChapterList = bRStudentChapterRepository.queryByStuIdAndChapter(brStudentChapterDto.getChapterId(),brStudentChapterDto.getStudentId());
DecimalFormat df=new DecimalFormat("0.00");//设置保留位数
if (null != brStudentChapterList && brStudentChapterList.size() >0){
// DecimalFormat df=new DecimalFormat("0.00");//设置保留位数
// df.format((float)brStudentChapterDto.getCurrent()/brStudentChapterDto.getDuration());
BRStudentChapter brStudentChapter = brStudentChapterList.get(0);
if (brStudentChapterDto.getCurrent() == brStudentChapterDto.getDuration()){
// who finish
brStudentChapter.setProgress("100%");
}else
brStudentChapter.setProgress(brStudentChapterDto.getCurrent()/brStudentChapterDto.getDuration()*100+"%");
line = bRStudentChapterRepository.updateByPrimaryKey(brStudentChapter);
}else{
brStudentChapter.setProgress(df.format((float)brStudentChapterDto.getCurrent()/brStudentChapterDto.getDuration()*100)+ "%");
}
line = bRStudentChapterRepository.updateById(brStudentChapter);
}else {
BRStudentChapter brStudentChapter = new BRStudentChapter();
brStudentChapter.setBusinessId(IdGen.uuid());
......@@ -66,7 +66,7 @@ public class BRStudentChapterServiceImpl implements BRStudentChapterService {
}else {
brStudentChapter.setIsComplete("0");
// brStudentChapter.setAutomatic("0");
brStudentChapter.setProgress(brStudentChapterDto.getCurrent()/brStudentChapterDto.getDuration()*100+"%");
brStudentChapter.setProgress(df.format(brStudentChapterDto.getCurrent()/brStudentChapterDto.getDuration()*100)+"%");
}
line = bRStudentChapterRepository.insertSelective(brStudentChapter);
}
......
......@@ -3,8 +3,6 @@ package org.rcisoft.common.util.feignClient;
import org.rcisoft.core.result.Ret;
import org.rcisoft.common.util.feignDto.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;
......@@ -13,7 +11,7 @@ import java.util.List;
/**
* 通讯录客户端接口
*/
@Component
@Service
@FeignClient(value = "ZX-CONTACT")
public interface ContactFeignClient {
......
......@@ -41,7 +41,7 @@ public class MTCotactApiRequestClient {
@Autowired
private ContactFeignClient contactFeignClient;
//@Autowired
@Autowired
private GateWayFeignClient gateWayFeignClient;
/**
......
......@@ -36,8 +36,8 @@ public class SysRoleController extends PaginationController<SysRole> {
@ApiOperation(value="1001 分页查询角色", notes="分页查询角色")
@GetMapping(value = "/queryRoles")
public GridModel queryRolesByPagination(CurUser curUser, @Valid FindRolePaginDTO findRolePaginDTO, BindingResult bindingResult){
sysRoleServiceImpl.queryRolesByPagination(getPaginationUtility(), findRolePaginDTO);
public GridModel queryRolesByPagination(CurUser curUser){
sysRoleServiceImpl.queryRolesByPagination(getPaginationUtility(), curUser.getCorpId());
GridModel gridModel = getGridModelResponse();
return gridModel;
}
......@@ -48,7 +48,7 @@ public class SysRoleController extends PaginationController<SysRole> {
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
sysRoleServiceImpl.queryRolesAll());
sysRoleServiceImpl.queryRolesAll(curUser.getCorpId()));
}
......
......@@ -29,10 +29,11 @@ public interface SysRoleRepository extends BaseMapper<SysRole> {
*/
@Select("<script>select * from tm_admin_role " +
"where r_status = 1 " +
"and r_id not in ('主管理员','子管理员') " +
"and r_name not in ('主管理员','子管理员') " +
"and corp_id = #{corpId} " +
" order by r_name desc </script>")
@ResultMap(value = "SelectAllAndUserNum")
List<SysRole> queryRoles();
List<SysRole> queryRoles(@Param("corpId") String corpId);
//获得此角色的用户数
int countUserNum(String roleId);
......
......@@ -7,6 +7,7 @@ import org.rcisoft.core.model.PersistModel;
import org.rcisoft.sys.dept.entity.DeptRole;
import org.rcisoft.sys.role.dto.*;
import org.rcisoft.sys.role.entity.SysRole;
import org.rcisoft.sys.user.bean.CurUser;
import java.util.List;
......@@ -39,13 +40,13 @@ public interface SysRoleService {
/**
* 分页查询角色
* @param pageUtil
* @param findRolePaginDTO
* @param corpId
* @return
*/
List<SysRole> queryRolesByPagination(PageUtil pageUtil, FindRolePaginDTO findRolePaginDTO);
List<SysRole> queryRolesByPagination(PageUtil pageUtil, String corpId);
List<SysRole> queryRolesAll();
List<SysRole> queryRolesAll(String corpId);
//select
List<SysRole> queryRolesSelect(SysRole sysRole);
......
......@@ -13,6 +13,7 @@ import org.rcisoft.sys.role.dao.SysRoleRepository;
import org.rcisoft.sys.role.dto.*;
import org.rcisoft.sys.role.entity.SysRole;
import org.rcisoft.sys.role.service.SysRoleService;
import org.rcisoft.sys.user.bean.CurUser;
import org.rcisoft.sys.user.dao.SysUserMapper;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -89,21 +90,21 @@ public class SysRoleServiceImpl implements SysRoleService {
}
@Override
public List<SysRole> queryRolesByPagination(PageUtil pageUtil, FindRolePaginDTO findRolePaginDTO) {
public List<SysRole> queryRolesByPagination(PageUtil pageUtil, String corpId) {
// SysRole sysRole = new SysRole();
// BeanUtils.copyProperties(findRolePaginDTO,sysRole);
// sysRole.setNotDeleted();
// sysRole.setStart();
return sysRoleRepository.queryRoles();
return sysRoleRepository.queryRoles(corpId);
}
@Override
public List<SysRole> queryRolesAll() {
public List<SysRole> queryRolesAll(String corpId) {
// SysRole sysRole = new SysRole();
// BeanUtils.copyProperties(findRolePaginDTO,sysRole);
// sysRole.setNotDeleted();
// sysRole.setStart();
return sysRoleRepository.queryRoles();
return sysRoleRepository.queryRoles(corpId);
}
@Override
......
......@@ -49,7 +49,6 @@ public class SysUser extends IdEntity<SysUser> {
private String gitLabId; //gitLab账号id
private String gitLabUsername; //gitLab账号
private String gitLabImpressionToken; //gitLab账号模拟令牌
@Transient
private String depart;
@Transient
......
......@@ -120,10 +120,7 @@ public class SysUserServiceImpl implements SysUserService {
userRoles.add(userRole);
}
}
result += sysUserMapper.insertUserRoleById(userRoles);
if (result > 0) {
return 1;
}
result = sysUserMapper.insertUserRoleById(userRoles);
}
return 0;
}
......@@ -174,7 +171,28 @@ public class SysUserServiceImpl implements SysUserService {
@Override
public List<QueryMenuResDTO> queryMenusById(String corpId, String id, String modelId) {
return sysUserMapper.queryMenus(corpId, id, modelId);
List<QueryMenuResDTO> menus = sysUserMapper.queryMenus(corpId, id, modelId);
String[] strings = new String[]{"题库管理", "试卷管理", "统计分析"};
QueryMenuResDTO newMenu = new QueryMenuResDTO();
newMenu.setMenuName("在线考试");
newMenu.setHref("newTest");
newMenu.setMenuId("000");
int size = menus.size();
for (String str : strings) {
for (QueryMenuResDTO menu : menus) {
if (menu.getMenuName().equals(str)) {
menus.add(newMenu);
break;
}
}
if(size < menus.size()){
break;
}
}
return menus;
}
@Override
......@@ -263,7 +281,7 @@ public class SysUserServiceImpl implements SysUserService {
}
String updateTime = df.format(synchronizationTime.getSynchronizationTime());
List<GetAllRspDTO> userGetRspDTOList = mtCotactApiRequestClient.accountGetMyInfoList(corpId, updateTime);
if (null == userGetRspDTOList){
if (null == userGetRspDTOList) {
throw new ServiceException(ResultServiceEnums.ZX_FAILED);
}
List<SysUser> personnelsList = new ArrayList<>();
......@@ -295,7 +313,7 @@ public class SysUserServiceImpl implements SysUserService {
@Override
public MyInfoDTO queryMyInfo(CurUser curUser) {
MyInfoDTO myInfoDTOCount = sysUserMapper.queryMyLessonCount(curUser);
MyInfoDTO myInfoDTO = sysUserMapper.queryMyInfo(curUser);
MyInfoDTO myInfoDTO = sysUserMapper.queryMyInfo(curUser);
myInfoDTO.setLessonCount(myInfoDTOCount.getLessonCount());
myInfoDTO.setTrainCount(myInfoDTOCount.getTrainCount());
myInfoDTO.setNotFinishedExam(myInfoDTOCount.getNotFinishedExam());
......
......@@ -5,7 +5,7 @@ server:
servlet:
context-path: /
#uri-encoding: UTF-8
type: dev1
type: dev
maxHttpHeaderSize: 102400
#logging:
......@@ -14,22 +14,20 @@ server:
# org.springframework.web: DEBUG
druid:
url: jdbc:mysql://127.0.0.1:3307/edu_db2?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false
url: jdbc:mysql://127.0.0.1:3306/mt?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false
# url: jdbc:mysql://10.96.131.16:55558/edu_db?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false
#url: jdbc:mysql://120.52.179.75:13318/edu_db?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false
username: root
# password: 91isoft
password: 123456
password: root
initial-size: 1
min-idle: 1
max-active: 20
test-on-borrow: true
mybatis:
mapper-locations: classpath:mapper/**/**/*.xml
mapper:
mappers:
- org.rcisoft.core.base.BaseMapper
......@@ -60,6 +58,8 @@ spring:
multipart:
max-file-size: 100MB
max-request-size: 100MB
application:
name: zx-education
global:
lk:
......@@ -91,6 +91,7 @@ libreoffice:
ip: 192.168.1.125
port: 10188
mt:
# api: http://192.168.5.41/api/
api: http://221.239.114.20:6789/api/
......
......@@ -99,4 +99,4 @@ eureka:
register-with-eureka: true
fetch-registry: true
service-url:
defaultZone: http://zx:zgiot@192.168.5.48:7001/eureka/
\ No newline at end of file
defaultZone: http://zx:zgiot@192.168.5.48:7001/eureka
spring:
profiles:
# active: dev
active: prod
# active: prod
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