ClassGradeController.java 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677
  1. package com.zhongzheng.controller.grade;
  2. import java.io.FileOutputStream;
  3. import java.time.LocalDateTime;
  4. import java.time.format.DateTimeFormatter;
  5. import java.util.*;
  6. import java.util.concurrent.TimeUnit;
  7. import java.util.stream.Collectors;
  8. import cn.afterturn.easypoi.excel.ExcelExportUtil;
  9. import cn.afterturn.easypoi.excel.entity.ExportParams;
  10. import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
  11. import cn.hutool.core.bean.BeanUtil;
  12. import cn.hutool.core.lang.Validator;
  13. import com.github.pagehelper.PageInfo;
  14. import com.zhongzheng.common.core.domain.entity.SysRole;
  15. import com.zhongzheng.common.core.redis.RedisCache;
  16. import com.zhongzheng.common.utils.SecurityUtils;
  17. import com.zhongzheng.common.utils.ServletUtils;
  18. import com.zhongzheng.common.utils.ToolsUtils;
  19. import com.zhongzheng.modules.base.bo.UserProfileQueryBo;
  20. import com.zhongzheng.modules.base.vo.UserProfileExportGaiVo;
  21. import com.zhongzheng.modules.grade.bo.*;
  22. import com.zhongzheng.modules.grade.service.*;
  23. import com.zhongzheng.modules.grade.vo.*;
  24. import com.zhongzheng.modules.user.entity.ClientLoginUser;
  25. import io.swagger.models.auth.In;
  26. import lombok.RequiredArgsConstructor;
  27. import org.springframework.beans.BeanUtils;
  28. import org.springframework.boot.SpringBootVersion;
  29. import org.springframework.security.access.prepost.PreAuthorize;
  30. import org.springframework.beans.factory.annotation.Autowired;
  31. import org.springframework.web.bind.annotation.GetMapping;
  32. import org.springframework.web.bind.annotation.PostMapping;
  33. import org.springframework.web.bind.annotation.PutMapping;
  34. import org.springframework.web.bind.annotation.DeleteMapping;
  35. import org.springframework.web.bind.annotation.PathVariable;
  36. import org.springframework.web.bind.annotation.RequestBody;
  37. import org.springframework.web.bind.annotation.RequestMapping;
  38. import org.springframework.web.bind.annotation.RestController;
  39. import com.zhongzheng.common.annotation.Log;
  40. import com.zhongzheng.common.core.controller.BaseController;
  41. import com.zhongzheng.common.core.domain.AjaxResult;
  42. import com.zhongzheng.common.enums.BusinessType;
  43. import com.zhongzheng.common.utils.poi.ExcelUtil;
  44. import com.zhongzheng.common.core.page.TableDataInfo;
  45. import io.swagger.annotations.Api;
  46. import io.swagger.annotations.ApiOperation;
  47. import javax.servlet.ServletOutputStream;
  48. /**
  49. * 班级Controller
  50. *
  51. * @author ruoyi
  52. * @date 2021-11-10
  53. */
  54. @Api(value = "班级控制器", tags = {"班级管理"})
  55. @RequiredArgsConstructor(onConstructor_ = @Autowired)
  56. @RestController
  57. @RequestMapping("/grade/grade")
  58. public class ClassGradeController extends BaseController {
  59. private final IClassGradeService iClassGradeService;
  60. private final IClassGradeInterfaceService iClassGradeInterfaceService;
  61. private final IClassGradeSysService iClassGradeSysService;
  62. private final IClassGradeUserService iClassGradeUserService;
  63. private final IUserPeriodService iUserPeriodService;
  64. private final IUserPeriodStatusService userPeriodStatusService;
  65. private final RedisCache redisCache;
  66. /**
  67. * 查询班级列表
  68. */
  69. @ApiOperation("批量查询商品班级列表")
  70. @PreAuthorize("@ss.hasPermi('grade:grade:list')")
  71. @GetMapping("/listGoodsBatch/{ids}")
  72. public TableDataInfo<ClassGradeGoodsVo> listGoodsBatch(@PathVariable Long[] ids) {
  73. startPage();
  74. ClassGradeQueryBo bo = new ClassGradeQueryBo();
  75. bo.setGoodsIds(Arrays.asList(ids));
  76. List<ClassGradeGoodsVo> list = iClassGradeService.listGoodsBatch(bo);
  77. return getDataTable(list);
  78. }
  79. /**
  80. * 查询班级列表
  81. */
  82. @ApiOperation("查询商品班级列表")
  83. @GetMapping("/listGoods")
  84. public TableDataInfo<ClassGradeVo> listGoods(ClassGradeQueryBo bo) {
  85. startPage();
  86. bo.setStatus(new ArrayList<Integer>(Arrays.asList(1)));
  87. bo.setPastDue(1L);
  88. bo.setAtFull(1L);
  89. List<ClassGradeVo> list = iClassGradeService.queryList(bo);
  90. return getDataTable(list);
  91. }
  92. /**
  93. * 查询班级列表
  94. */
  95. @ApiOperation("查询班级列表")
  96. @PreAuthorize("@ss.hasPermi('grade:grade:list')")
  97. @GetMapping("/list")
  98. public TableDataInfo<ClassGradeVo> list(ClassGradeQueryBo bo) {
  99. startPage();
  100. List<ClassGradeVo> list = iClassGradeService.queryList(bo);
  101. return getDataTable(list);
  102. }
  103. /**
  104. * 查询其他平台班级详情
  105. */
  106. @ApiOperation("查询其他平台班级学员列表")
  107. @GetMapping("/other/Class/user")
  108. public AjaxResult<List<ClassNpUserInfoVo>> otherClassUserList(ClassNpUserInfoBo bo) {
  109. return AjaxResult.success(iClassGradeService.otherClassUserList(bo));
  110. }
  111. /**
  112. * 导出查询其他平台班级详情
  113. */
  114. @ApiOperation("查询其他平台班级学员列表")
  115. @GetMapping("/other/Class/user/export")
  116. public AjaxResult<List<ClassNpUserInfoVo>> otherClassUserListExport(ClassNpUserInfoBo bo) {
  117. List<ClassNpUserInfoVo> list = iClassGradeService.otherClassUserList(bo);
  118. List<ClassNpUserInfoExportVo> exportVos = list.stream().map(item -> BeanUtil.toBean(item,ClassNpUserInfoExportVo.class)).collect(Collectors.toList());
  119. ExcelUtil<ClassNpUserInfoExportVo> util = new ExcelUtil<ClassNpUserInfoExportVo>(ClassNpUserInfoExportVo.class);
  120. return util.exportExcel(exportVos, "班级学员列表");
  121. }
  122. /**
  123. * 查询班级列表
  124. */
  125. @ApiOperation("是否出现官方按钮选择 1官方信息推送 2官方学时推送 3账号开通 1,2,3 班级出现全部 学时审核出现学时推送 ")
  126. @PreAuthorize("@ss.hasPermi('grade:grade:select')")
  127. @GetMapping("/selectButton")
  128. public AjaxResult<Integer[]> selectButton(ClassGradeQueryBo bo) {
  129. ClassGradeVo classGradeVo = iClassGradeService.queryList(bo).get(0);
  130. List<Integer> integers = new ArrayList<>();
  131. Integer status =1;
  132. //判断字段是否填写,填写出现按钮
  133. if (classGradeVo.getInterfacePushId() != null ){
  134. integers.add(1);
  135. }
  136. if (classGradeVo.getInterfacePeriodId()!=null){
  137. integers.add(2);
  138. }
  139. if (classGradeVo.getInterfaceAccountId() != null ){
  140. integers.add(3);
  141. }
  142. if (classGradeVo.getNoInterfaceAccountId() != null ){
  143. integers.add(4);
  144. }
  145. //初始化需要得到的数组
  146. Integer[] array = new Integer[integers.size()];
  147. //使用for循环得到数组
  148. for(int i = 0; i < integers.size();i++){
  149. array[i] = integers.get(i);
  150. }
  151. return AjaxResult.success(array);
  152. }
  153. /**
  154. * 查询班级列表
  155. */
  156. @ApiOperation("查询班级学员列表")
  157. @PreAuthorize("@ss.hasPermi('grade:grade:list')")
  158. @GetMapping("/listGrade")
  159. public TableDataInfo<ClassGradeStudentVo> listGrade(ClassGradeUserQueryBo bo) {
  160. startPage();
  161. List<ClassGradeStudentVo> list = iClassGradeService.listGrade(bo);
  162. return getDataTable(list);
  163. }
  164. /**
  165. * 导出班级学员列表
  166. */
  167. @ApiOperation("导出班级学员列表")
  168. // @PreAuthorize("@ss.hasPermi('grade:grade:list')")
  169. @GetMapping("/exportListGrade")
  170. public AjaxResult exportListGrade(ClassGradeUserQueryBo bo) {
  171. List<ClassGradeStudentVo> list = iClassGradeService.listGrade(bo);
  172. List<ClassStudentExportVo> exportVos = list.stream().map(item -> ClassStudentExportVo.initEntity(item)).collect(Collectors.toList());
  173. ExcelUtil<ClassStudentExportVo> util = new ExcelUtil<ClassStudentExportVo>(ClassStudentExportVo.class);
  174. return util.exportExcel(exportVos, "班级学员列表");
  175. }
  176. /**
  177. * 学员进入新的班级
  178. */
  179. @ApiOperation("学员进入新的班级")
  180. @PreAuthorize("@ss.hasPermi('grade:grade:edit')")
  181. @Log(title = "班级", businessType = BusinessType.INSERT)
  182. @PostMapping("/addUserGrade")
  183. public AjaxResult<Void> editUserGrade(@RequestBody ClassGradeUserAddQueryBo bo) {
  184. return toAjax(iClassGradeService.editUserGrade(bo) ? 1 : 0);
  185. }
  186. /**
  187. * 查询学时学员记录列表
  188. */
  189. @ApiOperation("查询学员学时列表")
  190. @PreAuthorize("@ss.hasPermi('grade:user:list')")
  191. @GetMapping("/listUserPeriod")
  192. public TableDataInfo<ClassPeriodStudentVo> listUserPeriod(ClassGradeUserQueryBo bo) {
  193. startPage();
  194. List<ClassPeriodStudentVo> list = iClassGradeUserService.listUserPeriod(bo);
  195. return getDataTable(list);
  196. }
  197. /**
  198. * 查询学时学员记录列表
  199. */
  200. @ApiOperation("查询学员学时学习记录列表")
  201. @PreAuthorize("@ss.hasPermi('grade:user:list')")
  202. @GetMapping("/listUserPeriodRecord")
  203. public TableDataInfo<ClassPeriodStudentVo> listUserPeriodRecord(ClassGradeUserQueryBo bo) {
  204. startPage();
  205. List<ClassPeriodStudentVo> list = iClassGradeUserService.listUserPeriodRecord(bo);
  206. return getDataTable(list);
  207. }
  208. /**
  209. * 查询学时学员记录列表
  210. */
  211. @ApiOperation("查询学员学习记录列表")
  212. @PreAuthorize("@ss.hasPermi('grade:user:list')")
  213. @GetMapping("/listUserStudyRecord")
  214. public TableDataInfo<UserPeriodExportV2Vo> listUserStudyRecord(ClassGradeUserQueryBo bo) {
  215. startPage();
  216. List<UserPeriodExportV2Vo> list = iClassGradeUserService.listUserStudyRecordV2(bo);
  217. return getDataTable(list);
  218. }
  219. /**
  220. * 查询学时学员记录列表
  221. *//*
  222. @ApiOperation("查询学员学习记录列表")
  223. @PreAuthorize("@ss.hasPermi('grade:user:list')")
  224. @GetMapping("/listUserStudyRecord")
  225. public TableDataInfo<UserPeriodExportVo> listUserStudyRecord(ClassGradeUserQueryBo bo) {
  226. startPage();
  227. List<UserPeriodExportVo> list = iClassGradeUserService.listUserStudyRecord(bo);
  228. return getDataTable(list);
  229. }*/
  230. /**
  231. * 导出资料审核列表
  232. */
  233. @ApiOperation("导出学员学时列表")
  234. @PreAuthorize("@ss.hasPermi('system:profile:export')")
  235. @Log(title = "导出学员学时列表", businessType = BusinessType.EXPORT)
  236. @GetMapping("/export")
  237. public AjaxResult<Map<String,Object>> export(ClassGradeUserQueryBo bo) {
  238. String fileName = "";
  239. if(Validator.isEmpty(bo.getStudyStatus())){
  240. bo.setStudyStatus(0);
  241. fileName="全部";
  242. }else{
  243. if(bo.getStudyStatus()==0){
  244. fileName="全部";
  245. }
  246. if(bo.getStudyStatus()==1){
  247. fileName="未完成学习";
  248. }
  249. if(bo.getStudyStatus()==2){
  250. fileName="完成学习";
  251. }
  252. }
  253. bo.setUserPhoto(1);
  254. Map<String,Object> map = iClassGradeUserService.exportPo(bo);
  255. List<ClassPeriodStudentExportAllVo> list = (List<ClassPeriodStudentExportAllVo>)map.get("list");
  256. ExcelUtil<ClassPeriodStudentExportAllVo> util = new ExcelUtil<ClassPeriodStudentExportAllVo>(ClassPeriodStudentExportAllVo.class);
  257. ExportParams deptExportParams = new ExportParams();
  258. // 设置sheet得名称
  259. deptExportParams.setSheetName("表1");
  260. String timeStr= LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
  261. Map<String, Object> deptExportMap = new HashMap<>();
  262. deptExportMap.put("title", deptExportParams);
  263. deptExportMap.put("entity", ClassPeriodStudentExportAllVo.class);
  264. // sheet中要填充得数据
  265. deptExportMap.put("data", list);
  266. List<Map<String, Object>> sheetsList = new ArrayList<>();
  267. sheetsList.add(deptExportMap);
  268. String businessName = Validator.isNotEmpty(bo.getBusinessName())?bo.getBusinessName():"";
  269. map.put("excel",util.exportEasyExcel(sheetsList, businessName+"-"+fileName+"-学员学习记录-"+timeStr));
  270. map.remove("list");
  271. return AjaxResult.success(map);
  272. }
  273. /**
  274. * 查询学员学时信息列表
  275. */
  276. @ApiOperation("查询学员学时信息列表")
  277. @PreAuthorize("@ss.hasPermi('grade:user:list')")
  278. @GetMapping("/listPeriod")
  279. public TableDataInfo<ClassPeriodUserVo> listPeriod(ClassGradeUserQueryBo bo) {
  280. startPage();
  281. List<ClassPeriodUserVo> list = iClassGradeUserService.listPeriod(bo);
  282. return getDataTable(list);
  283. }
  284. /**
  285. * 学时审核
  286. */
  287. @ApiOperation("学时审核")
  288. @PreAuthorize("@ss.hasPermi('grade:user:list')")
  289. @GetMapping("/listPeriodAudit")
  290. public TableDataInfo<ClassPeriodVo> listPeriodAudit(ClassGradeUserQueryBo bo) {
  291. startPage();
  292. List<ClassPeriodVo> list = iClassGradeUserService.listPeriodAudit(bo);
  293. return getDataTable(list);
  294. }
  295. /**
  296. * 查询学员记录列表
  297. */
  298. @ApiOperation("查询学员记录列表")
  299. @PreAuthorize("@ss.hasPermi('grade:user:list')")
  300. @GetMapping("/listUser")
  301. public TableDataInfo<ClassGradeUserVo> list(ClassGradeUserQueryBo bo) {
  302. startPage();
  303. List<ClassGradeUserVo> list = iClassGradeUserService.queryList(bo);
  304. return getDataTable(list);
  305. }
  306. /**
  307. * 查询查询以往审核记录列表
  308. */
  309. @ApiOperation("查询以往审核记录")
  310. @PreAuthorize("@ss.hasPermi('grade:user:list')")
  311. @GetMapping("/listPeriodStatus")
  312. public TableDataInfo<UserPeriodStatusVo> list(UserPeriodQueryBo bo) {
  313. startPage();
  314. List<UserPeriodStatusVo> list = userPeriodStatusService.selectPeriodStatus(bo);
  315. return getDataTable(list);
  316. }
  317. /**
  318. * 查询班主任记录列表
  319. */
  320. @ApiOperation("查询班主任记录列表")
  321. @PreAuthorize("@ss.hasPermi('grade:sys:list')")
  322. @GetMapping("/listSys")
  323. public TableDataInfo<ClassGradeSysVo> list(ClassGradeSysQueryBo bo) {
  324. startPage();
  325. List<ClassGradeSysVo> list = iClassGradeSysService.queryList(bo);
  326. return getDataTable(list);
  327. }
  328. /**
  329. * 查询班级列表
  330. */
  331. @ApiOperation("是否出现官方接口选择")
  332. @PreAuthorize("@ss.hasPermi('grade:grade:select')")
  333. @GetMapping("/select")
  334. public AjaxResult<Integer> select(ClassGradeAddBo bo) {
  335. //自己公司的TenantId出现选择官方接口
  336. List<String> tenantIds = Arrays.asList("867735392558919680", "567735392758918520");
  337. // boolean tenantId = ServletUtils.getRequest().getHeader("TenantId").equals("867735392558919680");
  338. boolean tenantId = tenantIds.contains(ServletUtils.getRequest().getHeader("TenantId"));
  339. return AjaxResult.success(tenantId ? 1 : 0);
  340. }
  341. /**
  342. * 查询官方接口
  343. */
  344. @ApiOperation("查询官方接口")
  345. @PreAuthorize("@ss.hasPermi('grade:grade:list')")
  346. @GetMapping("/listInterfaceVo")
  347. public TableDataInfo<ClassGradeInterfaceVo> list(ClassGradeInterfaceQueryBo bo) {
  348. startPage();
  349. List<ClassGradeInterfaceVo> list = iClassGradeInterfaceService.queryList(bo);
  350. return getDataTable(list);
  351. }
  352. /* *//**
  353. * 导出班级列表
  354. *//*
  355. @ApiOperation("导出班级列表")
  356. @PreAuthorize("@ss.hasPermi('modules.grade:grade:export')")
  357. @Log(title = "班级", businessType = BusinessType.EXPORT)
  358. @GetMapping("/export")
  359. public AjaxResult<ClassGradeVo> export(ClassGradeQueryBo bo) {
  360. List<ClassGradeVo> list = iClassGradeService.queryList(bo);
  361. ExcelUtil<ClassGradeVo> util = new ExcelUtil<ClassGradeVo>(ClassGradeVo.class);
  362. return util.exportExcel(list, "班级");
  363. }*/
  364. /**
  365. * 获取班级详细信息
  366. */
  367. @ApiOperation("获取班级详细信息")
  368. @PreAuthorize("@ss.hasPermi('grade:grade:query')")
  369. @GetMapping("/{classId}")
  370. public AjaxResult<ClassGradeVo> getInfo(@PathVariable("classId") Long classId) {
  371. return AjaxResult.success(iClassGradeService.queryById(classId));
  372. }
  373. /**
  374. * 新增班级
  375. */
  376. @ApiOperation("新增班级")
  377. @PreAuthorize("@ss.hasPermi('grade:grade:add')")
  378. @Log(title = "班级", businessType = BusinessType.INSERT)
  379. @PostMapping()
  380. public AjaxResult<Void> add(@RequestBody ClassGradeAddBo bo) {
  381. return toAjax(iClassGradeService.insertByAddBo(bo) ? 1 : 0);
  382. }
  383. /**
  384. * 修改班级
  385. */
  386. @ApiOperation("修改班级")
  387. @PreAuthorize("@ss.hasPermi('grade:grade:edit')")
  388. @Log(title = "班级", businessType = BusinessType.UPDATE)
  389. @PostMapping("/edit")
  390. public AjaxResult<Void> edit(@RequestBody ClassGradeEditBo bo) {
  391. return toAjax(iClassGradeService.updateByEditBo(bo) ? 1 : 0);
  392. }
  393. /**
  394. * 修改【请填写功能名称】
  395. */
  396. @ApiOperation("更改审核状态")
  397. @PreAuthorize("@ss.hasPermi('grade:grade:edit')")
  398. @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
  399. @PostMapping("/editPeriod")
  400. public AjaxResult<Void> edit(@RequestBody UserPeriodEditBo bo) {
  401. return toAjax(iUserPeriodService.updateByEditBo(bo) ? 1 : 0);
  402. }
  403. /**
  404. * 更改批量待审核状态
  405. */
  406. @ApiOperation("更改批量待审核状态")
  407. @PreAuthorize("@ss.hasPermi('grade:grade:edit')")
  408. @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
  409. @PostMapping("/editPeriodAll")
  410. public AjaxResult<Void> editPeriodAll(@RequestBody UserPeriodEditBo bo) {
  411. return toAjax(iUserPeriodService.editPeriodAll(bo) ? 1 : 0);
  412. }
  413. /**
  414. * 学时通过确认
  415. */
  416. @ApiOperation("学时通过确认")
  417. @PreAuthorize("@ss.hasPermi('grade:grade:edit')")
  418. @Log(title = "学时通过确认", businessType = BusinessType.UPDATE)
  419. @PostMapping("/confirmPeriod")
  420. public AjaxResult<Void> confirmPeriod(@RequestBody UserPeriodEditBo bo) {
  421. return toAjax(iUserPeriodService.confirmPeriod(bo) ? 1 : 0);
  422. }
  423. /**
  424. * 修改学员记录
  425. */
  426. @ApiOperation("修改学员记录")
  427. @PreAuthorize("@ss.hasPermi('system:user:edit')")
  428. @Log(title = "学员记录", businessType = BusinessType.UPDATE)
  429. @PostMapping("/editGradeUser")
  430. public AjaxResult<Void> edit(@RequestBody ClassGradeUserEditBo bo) {
  431. return toAjax(iClassGradeUserService.updateByEditBo(bo) ? 1 : 0);
  432. }
  433. /**
  434. * 学时审核獲得商品節下面的審核記錄
  435. */
  436. @ApiOperation("学时审核獲得商品節下面的審核記錄")
  437. @PreAuthorize("@ss.hasPermi('grade:user:list')")
  438. @GetMapping("/listPeriodAuditStatus")
  439. public AjaxResult<ClassPeriodSectionVo> listPeriodAuditStatus(UserPeriodQueryBo bo) {
  440. startPage();
  441. ClassPeriodSectionVo list = iClassGradeUserService.listPeriodAuditStatus(bo);
  442. return AjaxResult.success(list);
  443. }
  444. /**
  445. * 新增订单
  446. */
  447. @ApiOperation("选新班")
  448. @PostMapping("/sysChangeGrade")
  449. public AjaxResult changeGrade(@RequestBody ClassGradeUserSysChangeBo bo) {
  450. return AjaxResult.success(iClassGradeUserService.sysChangeGrade(bo));
  451. }
  452. /**
  453. * 自由选新班
  454. */
  455. @ApiOperation("自由选新班")
  456. @PostMapping("/changeGradeFree")
  457. public AjaxResult changeGradeFree(@RequestBody ClassGradeUserChangeBo bo) {
  458. return AjaxResult.success(iClassGradeUserService.changeGradeFree(bo));
  459. }
  460. /**
  461. * 检查编辑数据是否有用户通过学时
  462. */
  463. @ApiOperation("检查编辑数据是否有用户通过学时")
  464. @PreAuthorize("@ss.hasPermi('grade:user:list')")
  465. @GetMapping("/checkGoodsChange")
  466. public AjaxResult<Long> checkGoodsChange(UserPeriodQueryBo bo) {
  467. return AjaxResult.success(iUserPeriodService.checkGoodsChange(bo));
  468. }
  469. /**
  470. * 检查编辑数据是否有用户通过学时
  471. */
  472. @ApiOperation("检查编辑数据是否有用户在学习")
  473. @PreAuthorize("@ss.hasPermi('grade:user:list')")
  474. @GetMapping("/checkGoodsStudy")
  475. public AjaxResult<Long> checkGoodsStudy(UserPeriodQueryBo bo) {
  476. return AjaxResult.success(iUserPeriodService.checkGoodsStudy(bo));
  477. }
  478. /**
  479. * 查询班级信息推送数量
  480. */
  481. @ApiOperation("查询班级信息推送数量")
  482. @PreAuthorize("@ss.hasPermi('grade:grade:list')")
  483. @GetMapping("/officialInfoCount")
  484. public AjaxResult<Map<String,Object>> officialInfoCount(ClassGradeUserQueryBo bo) {
  485. return AjaxResult.success(iClassGradeUserService.selectOfficialInfoCount(bo));
  486. }
  487. /**
  488. * 查询班级学时推送数量
  489. */
  490. @ApiOperation("查询班级学时推送数量")
  491. @PreAuthorize("@ss.hasPermi('grade:grade:list')")
  492. @GetMapping("/officialPeriodCount")
  493. public AjaxResult<Long> officialPeriodCount(ClassGradeUserQueryBo bo) {
  494. return AjaxResult.success(iClassGradeUserService.selectOfficialPeriodCount(bo));
  495. }
  496. /**
  497. * 批量打回待审核状态
  498. */
  499. @ApiOperation("批量打回待审核状态")
  500. @PreAuthorize("@ss.hasPermi('grade:grade:edit')")
  501. @Log(title = "批量打回待审核状态", businessType = BusinessType.UPDATE)
  502. @PostMapping("/rollbackPeriod")
  503. public AjaxResult<Void> rollbackPeriod(@RequestBody UserPeriodEditBo bo) {
  504. return toAjax(iUserPeriodService.rollbackPeriod(bo) ? 1 : 0);
  505. }
  506. /**
  507. * 锁定学时审核页面
  508. */
  509. @ApiOperation("锁定学时审核页面")
  510. @PreAuthorize("@ss.hasPermi('grade:grade:edit')")
  511. @Log(title = "锁定学时审核页面", businessType = BusinessType.UPDATE)
  512. @PostMapping("/lockPeriod")
  513. public AjaxResult<Void> lockPeriod(@RequestBody UserPeriodEditBo bo) {
  514. String key = "LockPeriod_"+bo.getGradeId()+"-"+bo.getUserId();
  515. redisCache.setCacheObject(key, SecurityUtils.getUsername(),15, TimeUnit.SECONDS);//15秒锁定
  516. return AjaxResult.success();
  517. }
  518. /**
  519. * 查看学时审核锁定状态
  520. */
  521. @ApiOperation("查看学时审核锁定状态")
  522. @PreAuthorize("@ss.hasPermi('grade:grade:edit')")
  523. @Log(title = "查看学时审核锁定状态", businessType = BusinessType.UPDATE)
  524. @PostMapping("/lockPeriodStatus")
  525. public AjaxResult<Void> lockPeriodStatus(@RequestBody UserPeriodEditBo bo) {
  526. String key = "LockPeriod_"+bo.getGradeId()+"-"+bo.getUserId();
  527. String username = redisCache.getCacheObject(key);
  528. if(SecurityUtils.getUsername().equals(username)){
  529. username = null;//同个用户不返回
  530. }
  531. return AjaxResult.success(username);
  532. }
  533. /**
  534. * 查询学习账号标记列表
  535. */
  536. @ApiOperation("查询学习账号标记列表")
  537. @PreAuthorize("@ss.hasPermi('grade:grade:list')")
  538. @GetMapping("/listStudyAccountStatus")
  539. public TableDataInfo<StudyAccountStatusVo> listStudyAccountStatus(StudyAccountStatusQueryBo bo) {
  540. List<StudyAccountStatusVo> list = iClassGradeUserService.listStudyAccountStatus(bo);
  541. return getDataTable(getPageInfo(bo.getPageNum(), bo.getPageSize(), list).getList());
  542. }
  543. /**
  544. * 导出学习账号标记列表
  545. */
  546. @ApiOperation("导出学习账号标记列表")
  547. @PreAuthorize("@ss.hasPermi('system:profile:export')")
  548. @Log(title = "导出学员学时列表", businessType = BusinessType.EXPORT)
  549. @GetMapping("/exportStudyAccount")
  550. public AjaxResult<Map<String,Object>> exportStudyAccount(ClassGradeUserQueryBo bo) {
  551. bo.setUserPhoto(1);
  552. Map<String,Object> map = new HashMap<>();
  553. List<ClassGradeStudentVo> list = iClassGradeService.listGrade(bo);
  554. List<StudyAccountStatusExportVo> newList = new ArrayList<>();
  555. for (ClassGradeStudentVo classGradeStudent : list) {
  556. StudyAccountStatusExportVo studyAccountStatusExportVo = new StudyAccountStatusExportVo();
  557. BeanUtils.copyProperties(classGradeStudent, studyAccountStatusExportVo);
  558. newList.add(studyAccountStatusExportVo);
  559. }
  560. map.put("list", newList);
  561. ExcelUtil<StudyAccountStatusExportVo> util = new ExcelUtil<>(StudyAccountStatusExportVo.class);
  562. return util.exportExcel(newList,"学习账号标记");
  563. /*ExportParams deptExportParams = new ExportParams();
  564. // 设置sheet得名称
  565. deptExportParams.setSheetName("表1");
  566. String timeStr= LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
  567. Map<String, Object> deptExportMap = new HashMap<>();
  568. deptExportMap.put("title", deptExportParams);
  569. deptExportMap.put("entity", StudyAccountStatusExportVo.class);
  570. // sheet中要填充得数据
  571. deptExportMap.put("data", list);
  572. List<Map<String, Object>> sheetsList = new ArrayList<>();
  573. sheetsList.add(deptExportMap);
  574. map.put("excel",util.exportEasyExcel(sheetsList, "学习账号标记"+timeStr));
  575. map.remove("list");
  576. return AjaxResult.success(map);*/
  577. }
  578. /**
  579. * 数据批量同步到官方系统
  580. */
  581. @ApiOperation("数据批量同步到官方系统")
  582. @PreAuthorize("@ss.hasPermi('grade:grade:edit')")
  583. @Log(title = "数据批量同步到官方系统", businessType = BusinessType.UPDATE)
  584. @PostMapping("/OpenQdyAccount")
  585. public AjaxResult<Void> OpenQdyAccount(@RequestBody OpenQdyAccountBo bo) {
  586. return toAjax(iClassGradeService.OpenQdyAccount(bo) ? 1 : 0);
  587. }
  588. /**
  589. * 发送验证码
  590. */
  591. @ApiOperation("发送验证码")
  592. @PostMapping("/sendCode")
  593. public AjaxResult<Void> OpenQdyAccount() {
  594. return toAjax(iClassGradeService.sendCode() ? 1 : 0);
  595. }
  596. @ApiOperation("二审打回重审")
  597. @PostMapping("/confirm/rollbackPeriod")
  598. public AjaxResult<Void> confirmRollbackPeriod(@RequestBody UserPeriodEditBo bo)
  599. {
  600. bo.setRollBackPlat(1);
  601. iUserPeriodService.confirmRollbackPeriod(bo);
  602. return AjaxResult.success();
  603. }
  604. @ApiOperation("获取官方班级人数")
  605. @Log(title = "获取官方班级人数", businessType = BusinessType.UPDATE)
  606. @GetMapping("/officialGradeCount")
  607. public AjaxResult<Integer> queryOfficialGradeCount(ClassGradeQueryBo bo) {
  608. return AjaxResult.success(iClassGradeService.queryOfficialGradeCount(bo));
  609. }
  610. }