ClassGradeController.java 23 KB

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