ClassGradeController.java 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893
  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.baomidou.mybatisplus.core.toolkit.ObjectUtils;
  14. import com.baomidou.mybatisplus.core.toolkit.StringUtils;
  15. import com.github.pagehelper.PageInfo;
  16. import com.zhongzheng.common.core.domain.entity.SysRole;
  17. import com.zhongzheng.common.core.redis.RedisCache;
  18. import com.zhongzheng.common.utils.SecurityUtils;
  19. import com.zhongzheng.common.utils.ServletUtils;
  20. import com.zhongzheng.common.utils.ToolsUtils;
  21. import com.zhongzheng.modules.base.bo.UserProfileQueryBo;
  22. import com.zhongzheng.modules.base.vo.UserProfileExportGaiVo;
  23. import com.zhongzheng.modules.goods.service.IGoodsService;
  24. import com.zhongzheng.modules.goods.vo.GoodsVo;
  25. import com.zhongzheng.modules.grade.bo.*;
  26. import com.zhongzheng.modules.grade.domain.ClassGrade;
  27. import com.zhongzheng.modules.grade.service.*;
  28. import com.zhongzheng.modules.grade.vo.*;
  29. import com.zhongzheng.modules.order.bo.OrderQueryBo;
  30. import com.zhongzheng.modules.order.vo.OrderListExportVo;
  31. import com.zhongzheng.modules.user.bo.UserQueryBo;
  32. import com.zhongzheng.modules.user.entity.ClientLoginUser;
  33. import io.swagger.models.auth.In;
  34. import lombok.RequiredArgsConstructor;
  35. import org.springframework.beans.BeanUtils;
  36. import org.springframework.boot.SpringBootVersion;
  37. import org.springframework.security.access.prepost.PreAuthorize;
  38. import org.springframework.beans.factory.annotation.Autowired;
  39. import org.springframework.web.bind.annotation.GetMapping;
  40. import org.springframework.web.bind.annotation.PostMapping;
  41. import org.springframework.web.bind.annotation.PutMapping;
  42. import org.springframework.web.bind.annotation.DeleteMapping;
  43. import org.springframework.web.bind.annotation.PathVariable;
  44. import org.springframework.web.bind.annotation.RequestBody;
  45. import org.springframework.web.bind.annotation.RequestMapping;
  46. import org.springframework.web.bind.annotation.RestController;
  47. import com.zhongzheng.common.annotation.Log;
  48. import com.zhongzheng.common.core.controller.BaseController;
  49. import com.zhongzheng.common.core.domain.AjaxResult;
  50. import com.zhongzheng.common.enums.BusinessType;
  51. import com.zhongzheng.common.utils.poi.ExcelUtil;
  52. import com.zhongzheng.common.core.page.TableDataInfo;
  53. import io.swagger.annotations.Api;
  54. import io.swagger.annotations.ApiOperation;
  55. import javax.servlet.ServletOutputStream;
  56. /**
  57. * 班级Controller
  58. *
  59. * @author ruoyi
  60. * @date 2021-11-10
  61. */
  62. @Api(value = "班级控制器", tags = {"班级管理"})
  63. @RequiredArgsConstructor(onConstructor_ = @Autowired)
  64. @RestController
  65. @RequestMapping("/grade/grade")
  66. public class ClassGradeController extends BaseController {
  67. private final IClassGradeService iClassGradeService;
  68. private final IClassGradeInterfaceService iClassGradeInterfaceService;
  69. private final IClassGradeSysService iClassGradeSysService;
  70. private final IClassGradeUserService iClassGradeUserService;
  71. private final IUserPeriodService iUserPeriodService;
  72. private final IUserPeriodStatusService userPeriodStatusService;
  73. private final RedisCache redisCache;
  74. private final IGoodsService iGoodsService;
  75. /**
  76. * 查询班级列表
  77. */
  78. @ApiOperation("批量查询商品班级列表")
  79. @PreAuthorize("@ss.hasPermi('grade:grade:list')")
  80. @GetMapping("/listGoodsBatch/{ids}")
  81. public TableDataInfo<ClassGradeGoodsVo> listGoodsBatch(@PathVariable Long[] ids) {
  82. startPage();
  83. ClassGradeQueryBo bo = new ClassGradeQueryBo();
  84. bo.setGoodsIds(Arrays.asList(ids));
  85. List<ClassGradeGoodsVo> list = iClassGradeService.listGoodsBatch(bo);
  86. return getDataTable(list);
  87. }
  88. /**
  89. * 查询班级列表
  90. */
  91. @ApiOperation("查询商品班级列表")
  92. @GetMapping("/listGoods")
  93. public TableDataInfo<ClassGradeVo> listGoods(ClassGradeQueryBo bo) {
  94. startPage();
  95. bo.setStatus(new ArrayList<Integer>(Arrays.asList(1)));
  96. bo.setPastDue(1L);
  97. bo.setAtFull(1L);
  98. List<ClassGradeVo> list = iClassGradeService.queryList(bo);
  99. return getDataTable(list);
  100. }
  101. /**
  102. * 查询班级列表
  103. */
  104. @ApiOperation("查询班级列表")
  105. @PreAuthorize("@ss.hasPermi('grade:grade:list')")
  106. @GetMapping("/list")
  107. public TableDataInfo<ClassGradeVo> list(ClassGradeQueryBo bo) {
  108. startPage();
  109. List<ClassGradeVo> list = iClassGradeService.queryList(bo);
  110. return getDataTable(list);
  111. }
  112. /**
  113. * 查询班级列表(新)
  114. */
  115. @ApiOperation("查询班级列表(新)")
  116. @GetMapping("/search/list")
  117. public TableDataInfo<ClassGradeVo> searchGradeList(ClassGradeQueryBo bo) {
  118. startPage();
  119. List<ClassGradeVo> list = iClassGradeService.searchGradeList(bo);
  120. return getDataTable(list);
  121. }
  122. /**
  123. * 查询其他平台班级详情
  124. */
  125. @ApiOperation("查询其他平台班级学员列表")
  126. @GetMapping("/other/Class/user")
  127. public AjaxResult<List<ClassNpUserInfoVo>> otherClassUserList(ClassNpUserInfoBo bo) {
  128. return AjaxResult.success(iClassGradeService.otherClassUserList(bo));
  129. }
  130. /**
  131. * 导出查询其他平台班级详情
  132. */
  133. @ApiOperation("查询其他平台班级学员列表")
  134. @GetMapping("/other/Class/user/export")
  135. public AjaxResult<List<ClassNpUserInfoVo>> otherClassUserListExport(ClassNpUserInfoBo bo) {
  136. List<ClassNpUserInfoVo> list = iClassGradeService.otherClassUserList(bo);
  137. List<ClassNpUserInfoExportVo> exportVos = list.stream().map(item -> BeanUtil.toBean(item,ClassNpUserInfoExportVo.class)).collect(Collectors.toList());
  138. ExcelUtil<ClassNpUserInfoExportVo> util = new ExcelUtil<ClassNpUserInfoExportVo>(ClassNpUserInfoExportVo.class);
  139. return util.exportExcel(exportVos, "班级学员列表");
  140. }
  141. /**
  142. * 查询班级列表
  143. */
  144. @ApiOperation("是否出现官方按钮选择 1官方信息推送 2官方学时推送 3账号开通 1,2,3 班级出现全部 学时审核出现学时推送 ")
  145. @PreAuthorize("@ss.hasPermi('grade:grade:select')")
  146. @GetMapping("/selectButton")
  147. public AjaxResult<Integer[]> selectButton(ClassGradeQueryBo bo) {
  148. ClassGradeVo classGradeVo = iClassGradeService.queryList(bo).get(0);
  149. List<Integer> integers = new ArrayList<>();
  150. Integer status =1;
  151. //判断字段是否填写,填写出现按钮
  152. if (classGradeVo.getInterfacePushId() != null ){
  153. integers.add(1);
  154. }
  155. if (classGradeVo.getInterfacePeriodId()!=null){
  156. integers.add(2);
  157. }
  158. if (classGradeVo.getInterfaceAccountId() != null ){
  159. integers.add(3);
  160. }
  161. if (classGradeVo.getNoInterfaceAccountId() != null ){
  162. integers.add(4);
  163. }
  164. //初始化需要得到的数组
  165. Integer[] array = new Integer[integers.size()];
  166. //使用for循环得到数组
  167. for(int i = 0; i < integers.size();i++){
  168. array[i] = integers.get(i);
  169. }
  170. return AjaxResult.success(array);
  171. }
  172. /**
  173. * 查询班级列表
  174. */
  175. @ApiOperation("查询班级学员列表")
  176. @PreAuthorize("@ss.hasPermi('grade:grade:list')")
  177. @GetMapping("/listGrade")
  178. public TableDataInfo<ClassGradeStudentVo> listGrade(ClassGradeUserQueryBo bo) {
  179. ClassGrade gradeGrade = iClassGradeService.getById(bo.getGradeId());
  180. if (StringUtils.isNotBlank(gradeGrade.getSevenCode())){
  181. bo.setSevenCode(gradeGrade.getSevenCode());
  182. }
  183. startPage();
  184. List<ClassGradeStudentVo> list = iClassGradeService.listGrade(bo);
  185. return getDataTable(list);
  186. }
  187. /**
  188. * 统计班级学员学时推送数量
  189. */
  190. @ApiOperation("统计班级学员学时推送数量")
  191. @GetMapping("/count/periodPlush")
  192. public AjaxResult getPeriodPlush(ClassGradeUserQueryBo bo) {
  193. HashMap<String, Object> plush = iClassGradeService.getPlush(bo);
  194. return AjaxResult.success(plush);
  195. }
  196. /**
  197. * 查询所有班级用户列表
  198. */
  199. @ApiOperation("查询所有班级用户列表")
  200. @PreAuthorize("@ss.hasPermi('grade:grade:list')")
  201. @GetMapping("/listGradeAll")
  202. public TableDataInfo<ClassGradeStudentVo> listGradeAll(ClassGradeUserQueryBo bo) {
  203. startPage();
  204. List<ClassGradeStudentVo> list = iClassGradeService.listGradeAll(bo);
  205. return getDataTable(list);
  206. }
  207. @ApiOperation("导出所有班级用户列表")
  208. @PreAuthorize("@ss.hasPermi('grade:grade:list')")
  209. @GetMapping("/listGradeAllExport")
  210. public AjaxResult<ClassGradeStudentAllExportVo> listGradeAllExport(ClassGradeUserQueryBo bo) {
  211. List<ClassGradeStudentAllExportVo> list = iClassGradeService.listGradeAllExport(bo);
  212. ExcelUtil<ClassGradeStudentAllExportVo> util = new ExcelUtil<>(ClassGradeStudentAllExportVo.class);
  213. return util.exportExcel(list,"报班学员记录");
  214. }
  215. /**
  216. * 导出班级学员列表
  217. */
  218. @ApiOperation("导出班级学员列表")
  219. // @PreAuthorize("@ss.hasPermi('grade:grade:list')")
  220. @GetMapping("/exportListGrade")
  221. public AjaxResult exportListGrade(ClassGradeUserQueryBo bo) {
  222. List<ClassGradeStudentVo> list = iClassGradeService.listGrade(bo);
  223. List<ClassStudentExportVo> exportVos = list.stream().map(item -> ClassStudentExportVo.initEntity(item)).collect(Collectors.toList());
  224. ExcelUtil<ClassStudentExportVo> util = new ExcelUtil<ClassStudentExportVo>(ClassStudentExportVo.class);
  225. return util.exportExcel(exportVos, "班级学员列表");
  226. }
  227. /**
  228. * 学员进入新的班级
  229. */
  230. @ApiOperation("学员进入新的班级")
  231. @PreAuthorize("@ss.hasPermi('grade:grade:edit')")
  232. @Log(title = "班级", businessType = BusinessType.INSERT)
  233. @PostMapping("/addUserGrade")
  234. public AjaxResult<Void> editUserGrade(@RequestBody ClassGradeUserAddQueryBo bo) {
  235. return toAjax(iClassGradeService.editUserGrade(bo) ? 1 : 0);
  236. }
  237. /**
  238. * 查询学时学员记录列表
  239. */
  240. @ApiOperation("查询学员学时列表")
  241. @PreAuthorize("@ss.hasPermi('grade:user:list')")
  242. @GetMapping("/listUserPeriod")
  243. public TableDataInfo<ClassPeriodStudentVo> listUserPeriod(ClassGradeUserQueryBo bo) {
  244. startPage();
  245. List<ClassPeriodStudentVo> list = iClassGradeUserService.listUserPeriod(bo);
  246. return getDataTable(list);
  247. }
  248. /**
  249. * 查询学时学员记录列表
  250. */
  251. @ApiOperation("查询学员学时列表")
  252. @PreAuthorize("@ss.hasPermi('grade:user:list')")
  253. @GetMapping("/listUserPeriod/manage")
  254. public TableDataInfo<ClassPeriodStudentVo> listUserPeriodManage(ClassGradeUserQueryBo bo) {
  255. startPage();
  256. List<ClassPeriodStudentVo> list = iClassGradeUserService.listUserPeriodManage(bo);
  257. return getDataTable(list);
  258. }
  259. /**
  260. * 查询学时学员记录统计
  261. */
  262. @ApiOperation("查询学时学员记录统计")
  263. @GetMapping("/listUserPeriod/total")
  264. public AjaxResult<UserPeriodTotalVo> listUserPeriodTotal(ClassGradeUserQueryBo bo) {
  265. return AjaxResult.success(iClassGradeUserService.listUserPeriodTotal(bo));
  266. }
  267. /**
  268. * 查询学时学员记录列表(新)
  269. */
  270. @ApiOperation("查询学员学时列表(新)")
  271. @GetMapping("/listUserPeriod/new")
  272. public TableDataInfo<ClassPeriodStudentNewVo> listUserPeriodNew(ClassGradeUserQueryBo bo) {
  273. startPage();
  274. List<ClassPeriodStudentNewVo> list = iClassGradeUserService.listUserPeriodNew(bo);
  275. return getDataTable(list);
  276. }
  277. /**
  278. * 查询学时学员记录列表
  279. */
  280. @ApiOperation("查询学员学时学习记录列表")
  281. @PreAuthorize("@ss.hasPermi('grade:user:list')")
  282. @GetMapping("/listUserPeriodRecord")
  283. public TableDataInfo<ClassPeriodStudentVo> listUserPeriodRecord(ClassGradeUserQueryBo bo) {
  284. startPage();
  285. List<ClassPeriodStudentVo> list = iClassGradeUserService.listUserPeriodRecord(bo);
  286. return getDataTable(list);
  287. }
  288. @ApiOperation("导出学员学时学习记录列表")
  289. @GetMapping("/exportListUserPeriodRecord")
  290. public AjaxResult<ClassPeriodStudentExportProcessVo> exportListUserPeriodRecord(ClassGradeUserQueryBo bo) {
  291. List<ClassPeriodStudentExportProcessVo> list = iClassGradeUserService.exportListUserPeriodRecord(bo);
  292. ExcelUtil<ClassPeriodStudentExportProcessVo> util = new ExcelUtil<>(ClassPeriodStudentExportProcessVo.class);
  293. return util.exportExcel(list,"学员学时学习记录列表");
  294. }
  295. /**
  296. * 导出审核不通过记录
  297. */
  298. @ApiOperation("导出审核不通过记录")
  299. @GetMapping("/export/noPass/record")
  300. public AjaxResult<ClassNoPassExportVo> exportNoPassRecord() {
  301. List<ClassNoPassExportVo> list = iClassGradeUserService.exportNoPassRecord();
  302. ExcelUtil<ClassNoPassExportVo> util = new ExcelUtil<>(ClassNoPassExportVo.class);
  303. return util.exportExcel(list,"学时不通过记录");
  304. }
  305. /**
  306. * 导出审核不通过重学记录
  307. */
  308. @ApiOperation("导出审核不通过重学记录")
  309. @GetMapping("/export/restart/record")
  310. public AjaxResult<ClassNoPassExportVo> exportRestartRecord() {
  311. List<ClassNoPassExportVo> list = iClassGradeUserService.exportRestartRecord();
  312. ExcelUtil<ClassNoPassExportVo> util = new ExcelUtil<>(ClassNoPassExportVo.class);
  313. return util.exportExcel(list,"学时不通过重学记录");
  314. }
  315. /**
  316. * 班级管理列表
  317. */
  318. @ApiOperation("班级管理列表")
  319. @GetMapping("/listUserPeriodRecord/new")
  320. public TableDataInfo<ClassPeriodStudentVo> listUserPeriodRecordNew(ClassGradeUserQueryBo bo) {
  321. startPage();
  322. List<ClassPeriodStudentVo> list = iClassGradeUserService.listUserPeriodRecordNew(bo);
  323. return getDataTable(list);
  324. }
  325. @ApiOperation("按周查询学员学时学习记录列表")
  326. @PreAuthorize("@ss.hasPermi('grade:user:list')")
  327. @GetMapping("/listUserPeriodWeekRecord")
  328. public TableDataInfo<ClassPeriodStudentVo> listUserPeriodWeekRecord(ClassGradeUserQueryBo bo) {
  329. startPage();
  330. List<ClassPeriodStudentVo> list = iClassGradeUserService.listUserPeriodWeekRecord(bo);
  331. return getDataTable(list);
  332. }
  333. @ApiOperation("查询学员视频学习记录列表")
  334. @PreAuthorize("@ss.hasPermi('grade:user:list')")
  335. @GetMapping("/listUserVideoRecord")
  336. public TableDataInfo<ClassPeriodStudentVo> listUserVideoRecord(ClassGradeUserQueryBo bo) {
  337. startPage();
  338. List<ClassPeriodStudentVo> list = iClassGradeUserService.listUserVideoRecord(bo);
  339. return getDataTable(list);
  340. }
  341. @ApiOperation("查询学员视频学习记录列表")
  342. @GetMapping("/listUserVideoRecord/new")
  343. public TableDataInfo<ClassPeriodStudentVo> listUserVideoRecordNew(ClassGradeUserQueryBo bo) {
  344. startPage();
  345. List<ClassPeriodStudentVo> list = iClassGradeUserService.listUserVideoRecordNew(bo);
  346. return getDataTable(list);
  347. }
  348. /**
  349. * 查询学时学员记录列表
  350. */
  351. @ApiOperation("查询学员学习记录列表")
  352. @PreAuthorize("@ss.hasPermi('grade:user:list')")
  353. @GetMapping("/listUserStudyRecord")
  354. public TableDataInfo<UserPeriodExportV2Vo> listUserStudyRecord(ClassGradeUserQueryBo bo) {
  355. startPage();
  356. List<UserPeriodExportV2Vo> list = iClassGradeUserService.listUserStudyRecordV2(bo);
  357. return getDataTable(list);
  358. }
  359. @ApiOperation("周查询学员学习记录列表")
  360. @PreAuthorize("@ss.hasPermi('grade:user:list')")
  361. @GetMapping("/listUserStudyRecordV2Week")
  362. public TableDataInfo<UserPeriodExportV2Vo> listUserStudyRecordV2Week(ClassGradeUserQueryBo bo) {
  363. startPage();
  364. List<UserPeriodExportV2Vo> list = iClassGradeUserService.listUserStudyRecordV2Week(bo);
  365. return getDataTable(list);
  366. }
  367. /**
  368. * 查询学时学员记录列表
  369. *//*
  370. @ApiOperation("查询学员学习记录列表")
  371. @PreAuthorize("@ss.hasPermi('grade:user:list')")
  372. @GetMapping("/listUserStudyRecord")
  373. public TableDataInfo<UserPeriodExportVo> listUserStudyRecord(ClassGradeUserQueryBo bo) {
  374. startPage();
  375. List<UserPeriodExportVo> list = iClassGradeUserService.listUserStudyRecord(bo);
  376. return getDataTable(list);
  377. }*/
  378. /**
  379. * 导出资料审核列表
  380. */
  381. @ApiOperation("导出学员学时列表")
  382. @PreAuthorize("@ss.hasPermi('system:profile:export')")
  383. @Log(title = "导出学员学时列表", businessType = BusinessType.EXPORT)
  384. @GetMapping("/export")
  385. public AjaxResult<Map<String,Object>> export(ClassGradeUserQueryBo bo) {
  386. String fileName = "";
  387. if(Validator.isEmpty(bo.getStudyStatus())){
  388. bo.setStudyStatus(0);
  389. fileName="全部";
  390. }else{
  391. if(bo.getStudyStatus()==0){
  392. fileName="全部";
  393. }
  394. if(bo.getStudyStatus()==1){
  395. fileName="未完成学习";
  396. }
  397. if(bo.getStudyStatus()==2){
  398. fileName="完成学习";
  399. }
  400. }
  401. bo.setUserPhoto(1);
  402. Map<String,Object> map = iClassGradeUserService.exportPo(bo);
  403. List<ClassPeriodStudentExportAllVo> list = (List<ClassPeriodStudentExportAllVo>)map.get("list");
  404. ExcelUtil<ClassPeriodStudentExportAllVo> util = new ExcelUtil<ClassPeriodStudentExportAllVo>(ClassPeriodStudentExportAllVo.class);
  405. ExportParams deptExportParams = new ExportParams();
  406. // 设置sheet得名称
  407. deptExportParams.setSheetName("表1");
  408. String timeStr= LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
  409. Map<String, Object> deptExportMap = new HashMap<>();
  410. deptExportMap.put("title", deptExportParams);
  411. deptExportMap.put("entity", ClassPeriodStudentExportAllVo.class);
  412. // sheet中要填充得数据
  413. deptExportMap.put("data", list);
  414. List<Map<String, Object>> sheetsList = new ArrayList<>();
  415. sheetsList.add(deptExportMap);
  416. String businessName = Validator.isNotEmpty(bo.getBusinessName())?bo.getBusinessName():"";
  417. map.put("excel",util.exportEasyExcel(sheetsList, businessName+"-"+fileName+"-学员学习记录-"+timeStr));
  418. map.remove("list");
  419. return AjaxResult.success(map);
  420. }
  421. @ApiOperation("周导出学员学时列表")
  422. @PreAuthorize("@ss.hasPermi('system:profile:export')")
  423. @Log(title = "周导出学员学时列表", businessType = BusinessType.EXPORT)
  424. @PostMapping("/exportWeek")
  425. public AjaxResult<Map<String,Object>> exportWeek(@RequestBody ClassGradeUserQueryBo bo) {
  426. String fileName = "";
  427. if(Validator.isEmpty(bo.getStudyStatus())){
  428. bo.setStudyStatus(0);
  429. fileName="全部";
  430. }else{
  431. if(bo.getStudyStatus()==0){
  432. fileName="全部";
  433. }
  434. if(bo.getStudyStatus()==1){
  435. fileName="未完成学习";
  436. }
  437. if(bo.getStudyStatus()==2){
  438. fileName="完成学习";
  439. }
  440. }
  441. bo.setUserPhoto(1);
  442. Map<String,Object> map = iClassGradeUserService.exportWeekPo(bo);
  443. List<ClassPeriodStudentExportWeekAllVo> list = (List<ClassPeriodStudentExportWeekAllVo>)map.get("list");
  444. ExcelUtil<ClassPeriodStudentExportWeekAllVo> util = new ExcelUtil<ClassPeriodStudentExportWeekAllVo>(ClassPeriodStudentExportWeekAllVo.class);
  445. ExportParams deptExportParams = new ExportParams();
  446. // 设置sheet得名称
  447. deptExportParams.setSheetName("表1");
  448. String timeStr= LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
  449. Map<String, Object> deptExportMap = new HashMap<>();
  450. deptExportMap.put("title", deptExportParams);
  451. deptExportMap.put("entity", ClassPeriodStudentExportWeekAllVo.class);
  452. // sheet中要填充得数据
  453. deptExportMap.put("data", list);
  454. List<Map<String, Object>> sheetsList = new ArrayList<>();
  455. sheetsList.add(deptExportMap);
  456. String businessName = Validator.isNotEmpty(bo.getBusinessName())?bo.getBusinessName():"";
  457. map.put("excel",util.exportEasyExcel(sheetsList, businessName+"-"+fileName+"-学员学习记录-"+timeStr));
  458. map.remove("list");
  459. return AjaxResult.success(map);
  460. }
  461. /**
  462. * 查询学员学时信息列表
  463. */
  464. @ApiOperation("查询学员学时信息列表")
  465. @PreAuthorize("@ss.hasPermi('grade:user:list')")
  466. @GetMapping("/listPeriod")
  467. public TableDataInfo<ClassPeriodUserVo> listPeriod(ClassGradeUserQueryBo bo) {
  468. startPage();
  469. List<ClassPeriodUserVo> list = iClassGradeUserService.listPeriod(bo);
  470. return getDataTable(list);
  471. }
  472. /**
  473. * 学时审核
  474. */
  475. @ApiOperation("学时审核")
  476. @PreAuthorize("@ss.hasPermi('grade:user:list')")
  477. @GetMapping("/listPeriodAudit")
  478. public TableDataInfo<ClassPeriodVo> listPeriodAudit(ClassGradeUserQueryBo bo) {
  479. startPage();
  480. List<ClassPeriodVo> list = iClassGradeUserService.listPeriodAudit(bo);
  481. return getDataTable(list);
  482. }
  483. /**
  484. * 查询学员记录列表
  485. */
  486. @ApiOperation("查询学员记录列表")
  487. @PreAuthorize("@ss.hasPermi('grade:user:list')")
  488. @GetMapping("/listUser")
  489. public TableDataInfo<ClassGradeUserVo> list(ClassGradeUserQueryBo bo) {
  490. startPage();
  491. List<ClassGradeUserVo> list = iClassGradeUserService.queryList(bo);
  492. return getDataTable(list);
  493. }
  494. /**
  495. * 查询查询以往审核记录列表
  496. */
  497. @ApiOperation("查询以往审核记录")
  498. @PreAuthorize("@ss.hasPermi('grade:user:list')")
  499. @GetMapping("/listPeriodStatus")
  500. public TableDataInfo<UserPeriodStatusVo> list(UserPeriodQueryBo bo) {
  501. startPage();
  502. List<UserPeriodStatusVo> list = userPeriodStatusService.selectPeriodStatus(bo);
  503. return getDataTable(list);
  504. }
  505. /**
  506. * 查询班主任记录列表
  507. */
  508. @ApiOperation("查询班主任记录列表")
  509. @PreAuthorize("@ss.hasPermi('grade:sys:list')")
  510. @GetMapping("/listSys")
  511. public TableDataInfo<ClassGradeSysVo> list(ClassGradeSysQueryBo bo) {
  512. startPage();
  513. List<ClassGradeSysVo> list = iClassGradeSysService.queryList(bo);
  514. return getDataTable(list);
  515. }
  516. /**
  517. * 查询班级列表
  518. */
  519. @ApiOperation("是否出现官方接口选择")
  520. @PreAuthorize("@ss.hasPermi('grade:grade:select')")
  521. @GetMapping("/select")
  522. public AjaxResult<Integer> select(ClassGradeAddBo bo) {
  523. //自己公司的TenantId出现选择官方接口
  524. // boolean tenantId = ServletUtils.getRequest().getHeader("TenantId").equals("867735392558919680");
  525. // return AjaxResult.success(tenantId ? 1 : 0);
  526. return AjaxResult.success(1);
  527. }
  528. /**
  529. * 查询官方接口
  530. */
  531. @ApiOperation("查询官方接口")
  532. @PreAuthorize("@ss.hasPermi('grade:grade:list')")
  533. @GetMapping("/listInterfaceVo")
  534. public TableDataInfo<ClassGradeInterfaceVo> list(ClassGradeInterfaceQueryBo bo) {
  535. startPage();
  536. List<ClassGradeInterfaceVo> list = iClassGradeInterfaceService.queryList(bo);
  537. return getDataTable(list);
  538. }
  539. /* *//**
  540. * 导出班级列表
  541. *//*
  542. @ApiOperation("导出班级列表")
  543. @PreAuthorize("@ss.hasPermi('modules.grade:grade:export')")
  544. @Log(title = "班级", businessType = BusinessType.EXPORT)
  545. @GetMapping("/export")
  546. public AjaxResult<ClassGradeVo> export(ClassGradeQueryBo bo) {
  547. List<ClassGradeVo> list = iClassGradeService.queryList(bo);
  548. ExcelUtil<ClassGradeVo> util = new ExcelUtil<ClassGradeVo>(ClassGradeVo.class);
  549. return util.exportExcel(list, "班级");
  550. }*/
  551. /**
  552. * 获取班级详细信息
  553. */
  554. @ApiOperation("获取班级详细信息")
  555. @PreAuthorize("@ss.hasPermi('grade:grade:query')")
  556. @GetMapping("/{classId}")
  557. public AjaxResult<ClassGradeVo> getInfo(@PathVariable("classId") Long classId) {
  558. return AjaxResult.success(iClassGradeService.queryById(classId));
  559. }
  560. /**
  561. * 新增班级
  562. */
  563. @ApiOperation("新增班级")
  564. @PreAuthorize("@ss.hasPermi('grade:grade:add')")
  565. @Log(title = "班级", businessType = BusinessType.INSERT)
  566. @PostMapping()
  567. public AjaxResult<Void> add(@RequestBody ClassGradeAddBo bo) {
  568. return toAjax(iClassGradeService.insertByAddBo(bo) ? 1 : 0);
  569. }
  570. /**
  571. * 修改班级
  572. */
  573. @ApiOperation("修改班级")
  574. @PreAuthorize("@ss.hasPermi('grade:grade:edit')")
  575. @Log(title = "班级", businessType = BusinessType.UPDATE)
  576. @PostMapping("/edit")
  577. public AjaxResult<Void> edit(@RequestBody ClassGradeEditBo bo) {
  578. return toAjax(iClassGradeService.updateByEditBo(bo) ? 1 : 0);
  579. }
  580. /**
  581. * 修改【请填写功能名称】
  582. */
  583. @ApiOperation("更改审核状态")
  584. @PreAuthorize("@ss.hasPermi('grade:grade:edit')")
  585. @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
  586. @PostMapping("/editPeriod")
  587. public AjaxResult<Void> edit(@RequestBody UserPeriodEditBo bo) {
  588. return toAjax(iUserPeriodService.updateByEditBo(bo) ? 1 : 0);
  589. }
  590. /**
  591. * 更改批量待审核状态
  592. */
  593. @ApiOperation("更改批量待审核状态")
  594. @PreAuthorize("@ss.hasPermi('grade:grade:edit')")
  595. @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
  596. @PostMapping("/editPeriodAll")
  597. public AjaxResult<Void> editPeriodAll(@RequestBody UserPeriodEditBo bo) {
  598. return toAjax(iUserPeriodService.editPeriodAll(bo) ? 1 : 0);
  599. }
  600. /**
  601. * 学时通过确认
  602. */
  603. @ApiOperation("学时通过确认")
  604. @PreAuthorize("@ss.hasPermi('grade:grade:edit')")
  605. @Log(title = "学时通过确认", businessType = BusinessType.UPDATE)
  606. @PostMapping("/confirmPeriod")
  607. public AjaxResult<Void> confirmPeriod(@RequestBody UserPeriodEditBo bo) {
  608. return toAjax(iUserPeriodService.confirmPeriod(bo) ? 1 : 0);
  609. }
  610. /**
  611. * 修改学员记录
  612. */
  613. @ApiOperation("修改学员记录")
  614. @PreAuthorize("@ss.hasPermi('system:user:edit')")
  615. @Log(title = "学员记录", businessType = BusinessType.UPDATE)
  616. @PostMapping("/editGradeUser")
  617. public AjaxResult<Void> edit(@RequestBody ClassGradeUserEditBo bo) {
  618. return toAjax(iClassGradeUserService.updateByEditBo(bo) ? 1 : 0);
  619. }
  620. /**
  621. * 学时审核獲得商品節下面的審核記錄
  622. */
  623. @ApiOperation("学时审核獲得商品節下面的審核記錄")
  624. @PreAuthorize("@ss.hasPermi('grade:user:list')")
  625. @GetMapping("/listPeriodAuditStatus")
  626. public AjaxResult<ClassPeriodSectionVo> listPeriodAuditStatus(UserPeriodQueryBo bo) {
  627. startPage();
  628. ClassPeriodSectionVo list = iClassGradeUserService.listPeriodAuditStatus(bo);
  629. return AjaxResult.success(list);
  630. }
  631. /**
  632. * 新增订单
  633. */
  634. @ApiOperation("选新班")
  635. @PostMapping("/sysChangeGrade")
  636. public AjaxResult changeGrade(@RequestBody ClassGradeUserSysChangeBo bo) {
  637. return AjaxResult.success(iClassGradeUserService.sysChangeGrade(bo));
  638. }
  639. /**
  640. * 自由选新班
  641. */
  642. @ApiOperation("自由选新班")
  643. @PostMapping("/changeGradeFree")
  644. public AjaxResult changeGradeFree(@RequestBody ClassGradeUserChangeBo bo) {
  645. return AjaxResult.success(iClassGradeUserService.changeGradeFree(bo));
  646. }
  647. /**
  648. * 检查编辑数据是否有用户通过学时
  649. */
  650. @ApiOperation("检查编辑数据是否有用户通过学时")
  651. @PreAuthorize("@ss.hasPermi('grade:user:list')")
  652. @GetMapping("/checkGoodsChange")
  653. public AjaxResult<Long> checkGoodsChange(UserPeriodQueryBo bo) {
  654. return AjaxResult.success(iUserPeriodService.checkGoodsChange(bo));
  655. }
  656. /**
  657. * 检查编辑数据是否有用户通过学时
  658. */
  659. @ApiOperation("检查编辑数据是否有用户在学习")
  660. @PreAuthorize("@ss.hasPermi('grade:user:list')")
  661. @GetMapping("/checkGoodsStudy")
  662. public AjaxResult<Long> checkGoodsStudy(UserPeriodQueryBo bo) {
  663. return AjaxResult.success(iUserPeriodService.checkGoodsStudy(bo));
  664. }
  665. /**
  666. * 查询班级信息推送数量
  667. */
  668. @ApiOperation("查询班级信息推送数量")
  669. @PreAuthorize("@ss.hasPermi('grade:grade:list')")
  670. @GetMapping("/officialInfoCount")
  671. public AjaxResult<Map<String,Object>> officialInfoCount(ClassGradeUserQueryBo bo) {
  672. return AjaxResult.success(iClassGradeUserService.selectOfficialInfoCount(bo));
  673. }
  674. /**
  675. * 查询班级学时推送数量
  676. */
  677. @ApiOperation("查询班级学时推送数量")
  678. @PreAuthorize("@ss.hasPermi('grade:grade:list')")
  679. @GetMapping("/officialPeriodCount")
  680. public AjaxResult<Long> officialPeriodCount(ClassGradeUserQueryBo bo) {
  681. return AjaxResult.success(iClassGradeUserService.selectOfficialPeriodCount(bo));
  682. }
  683. /**
  684. * 批量打回待审核状态
  685. */
  686. @ApiOperation("批量打回待审核状态")
  687. @PreAuthorize("@ss.hasPermi('grade:grade:edit')")
  688. @Log(title = "批量打回待审核状态", businessType = BusinessType.UPDATE)
  689. @PostMapping("/rollbackPeriod")
  690. public AjaxResult<Void> rollbackPeriod(@RequestBody UserPeriodEditBo bo) {
  691. return toAjax(iUserPeriodService.rollbackPeriod(bo) ? 1 : 0);
  692. }
  693. /**
  694. * 锁定学时审核页面
  695. */
  696. @ApiOperation("锁定学时审核页面")
  697. @PreAuthorize("@ss.hasPermi('grade:grade:edit')")
  698. @PostMapping("/lockPeriod")
  699. public AjaxResult<Void> lockPeriod(@RequestBody UserPeriodEditBo bo) {
  700. String key = "LockPeriod_"+bo.getGradeId()+"-"+bo.getUserId();
  701. redisCache.setCacheObject(key, SecurityUtils.getUsername(),15, TimeUnit.SECONDS);//15秒锁定
  702. return AjaxResult.success();
  703. }
  704. /**
  705. * 查看学时审核锁定状态
  706. */
  707. @ApiOperation("查看学时审核锁定状态")
  708. @PreAuthorize("@ss.hasPermi('grade:grade:edit')")
  709. @Log(title = "查看学时审核锁定状态", businessType = BusinessType.UPDATE)
  710. @PostMapping("/lockPeriodStatus")
  711. public AjaxResult<Void> lockPeriodStatus(@RequestBody UserPeriodEditBo bo) {
  712. String key = "LockPeriod_"+bo.getGradeId()+"-"+bo.getUserId();
  713. String username = redisCache.getCacheObject(key);
  714. if(SecurityUtils.getUsername().equals(username)){
  715. username = null;//同个用户不返回
  716. }
  717. return AjaxResult.success(username);
  718. }
  719. /**
  720. * 查询学习账号标记列表
  721. */
  722. @ApiOperation("查询学习账号标记列表")
  723. @PreAuthorize("@ss.hasPermi('grade:grade:list')")
  724. @GetMapping("/listStudyAccountStatus")
  725. public TableDataInfo<StudyAccountStatusVo> listStudyAccountStatus(StudyAccountStatusQueryBo bo) {
  726. List<StudyAccountStatusVo> list = iClassGradeUserService.listStudyAccountStatus(bo);
  727. return getDataTable(getPageInfo(bo.getPageNum(), bo.getPageSize(), list).getList());
  728. }
  729. /**
  730. * 导出学习账号标记列表
  731. */
  732. @ApiOperation("导出学习账号标记列表")
  733. @PreAuthorize("@ss.hasPermi('system:profile:export')")
  734. @Log(title = "导出学员学时列表", businessType = BusinessType.EXPORT)
  735. @GetMapping("/exportStudyAccount")
  736. public AjaxResult<Map<String,Object>> exportStudyAccount(ClassGradeUserQueryBo bo) {
  737. bo.setUserPhoto(1);
  738. Map<String,Object> map = new HashMap<>();
  739. List<ClassGradeStudentVo> list = iClassGradeService.listGrade(bo);
  740. List<StudyAccountStatusExportVo> newList = new ArrayList<>();
  741. for (ClassGradeStudentVo classGradeStudent : list) {
  742. StudyAccountStatusExportVo studyAccountStatusExportVo = new StudyAccountStatusExportVo();
  743. BeanUtils.copyProperties(classGradeStudent, studyAccountStatusExportVo);
  744. newList.add(studyAccountStatusExportVo);
  745. }
  746. map.put("list", newList);
  747. ExcelUtil<StudyAccountStatusExportVo> util = new ExcelUtil<>(StudyAccountStatusExportVo.class);
  748. return util.exportExcel(newList,"学习账号标记");
  749. /*ExportParams deptExportParams = new ExportParams();
  750. // 设置sheet得名称
  751. deptExportParams.setSheetName("表1");
  752. String timeStr= LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
  753. Map<String, Object> deptExportMap = new HashMap<>();
  754. deptExportMap.put("title", deptExportParams);
  755. deptExportMap.put("entity", StudyAccountStatusExportVo.class);
  756. // sheet中要填充得数据
  757. deptExportMap.put("data", list);
  758. List<Map<String, Object>> sheetsList = new ArrayList<>();
  759. sheetsList.add(deptExportMap);
  760. map.put("excel",util.exportEasyExcel(sheetsList, "学习账号标记"+timeStr));
  761. map.remove("list");
  762. return AjaxResult.success(map);*/
  763. }
  764. /**
  765. * 数据批量同步到官方系统
  766. */
  767. @ApiOperation("数据批量同步到官方系统")
  768. @PreAuthorize("@ss.hasPermi('grade:grade:edit')")
  769. @Log(title = "数据批量同步到官方系统", businessType = BusinessType.UPDATE)
  770. @PostMapping("/OpenQdyAccount")
  771. public AjaxResult<Void> OpenQdyAccount(@RequestBody OpenQdyAccountBo bo) {
  772. return toAjax(iClassGradeService.OpenQdyAccount(bo) ? 1 : 0);
  773. }
  774. /**
  775. * 发送验证码
  776. */
  777. @ApiOperation("发送验证码")
  778. @PostMapping("/sendCode")
  779. public AjaxResult<Void> OpenQdyAccount() {
  780. return toAjax(iClassGradeService.sendCode() ? 1 : 0);
  781. }
  782. @ApiOperation("二审打回重审")
  783. @PostMapping("/confirm/rollbackPeriod")
  784. public AjaxResult<Void> confirmRollbackPeriod(@RequestBody UserPeriodEditBo bo)
  785. {
  786. bo.setRollBackPlat(1);
  787. iUserPeriodService.confirmRollbackPeriod(bo);
  788. return AjaxResult.success();
  789. }
  790. @ApiOperation("获取官方班级人数")
  791. @Log(title = "获取官方班级人数", businessType = BusinessType.UPDATE)
  792. @GetMapping("/officialGradeCount")
  793. public AjaxResult<Integer> queryOfficialGradeCount(ClassGradeQueryBo bo) {
  794. return AjaxResult.success(iClassGradeService.queryOfficialGradeCount(bo));
  795. }
  796. @ApiOperation("导出商品的课程结构")
  797. @GetMapping("/exportGoodsMenuExcel")
  798. public AjaxResult<List<ClassNpUserInfoVo>> exportGoodsMenuExcel(UserPeriodEditBo bo) {
  799. GoodsVo goodsVo = iGoodsService.queryById(bo.getGoodsId());
  800. List<SyncUserChapterExport> list = iUserPeriodService.exportGoodsMenuExcel(bo);
  801. List<SyncUserChapterExport> exportVos = list.stream().map(item -> BeanUtil.toBean(item,SyncUserChapterExport.class)).collect(Collectors.toList());
  802. ExcelUtil<SyncUserChapterExport> util = new ExcelUtil<SyncUserChapterExport>(SyncUserChapterExport.class);
  803. return util.exportExcel(exportVos, goodsVo.getGoodsName());
  804. }
  805. }