feat(system): 添加专家信息管理功能
- 新增专家信息管理相关的实体类、Mapper、Service和Controller - 实现专家信息的添加、编辑、删除、查询等功能- 添加专家信息的导入导出功能
正在显示
11 个修改的文件
包含
477 行增加
和
27 行删除
... | @@ -4,6 +4,9 @@ import com.skua.tool.util.DateUtils; | ... | @@ -4,6 +4,9 @@ import com.skua.tool.util.DateUtils; |
4 | import io.swagger.annotations.ApiModelProperty; | 4 | import io.swagger.annotations.ApiModelProperty; |
5 | import lombok.Data; | 5 | import lombok.Data; |
6 | 6 | ||
7 | import java.time.LocalDate; | ||
8 | import java.time.format.DateTimeFormatter; | ||
9 | |||
7 | @Data | 10 | @Data |
8 | public class DateVO { | 11 | public class DateVO { |
9 | 12 | ||
... | @@ -57,28 +60,38 @@ public class DateVO { | ... | @@ -57,28 +60,38 @@ public class DateVO { |
57 | public DateVO(String currentDate) { | 60 | public DateVO(String currentDate) { |
58 | this.nowMonth = DateUtils.dateformat(currentDate,"yyyy-MM"); | 61 | this.nowMonth = DateUtils.dateformat(currentDate,"yyyy-MM"); |
59 | this.nowMonthStartDate = nowMonth+"-01"; | 62 | this.nowMonthStartDate = nowMonth+"-01"; |
60 | this.nowMonthEndDate = nowMonth+"-31"; | 63 | // 获取当前日期 |
61 | this.nowYearStartDate = nowYear + "-01-01"; | 64 | LocalDate now = LocalDate.now(); |
62 | this.nowYearEndDate = nowYear + "-12-31"; | 65 | String currentMonth = now.format(DateTimeFormatter.ofPattern("yyyy-MM")); |
66 | // 判断是否为当前年月 | ||
67 | if (this.nowMonth.equals(currentMonth)) { | ||
68 | this.nowMonthEndDate = now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); | ||
69 | } else { | ||
70 | this.nowMonthEndDate = nowMonth + "-31"; | ||
71 | } | ||
63 | 72 | ||
64 | this.nowYear = Integer.parseInt(DateUtils.dateformat(currentDate,"yyyy")); | 73 | this.nowYear = Integer.parseInt(DateUtils.dateformat(currentDate,"yyyy")); |
74 | this.nowYearStartDate = nowYear + "-01-01"; | ||
75 | // 判断是否为当前年 | ||
76 | int currentYear = now.getYear(); | ||
77 | if (this.nowYear == currentYear) { | ||
78 | this.nowYearEndDate = now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); | ||
79 | } else { | ||
80 | this.nowYearEndDate = nowYear + "-12-31"; | ||
81 | } | ||
82 | |||
65 | //同比时间 | 83 | //同比时间 |
66 | this.lastYear = nowYear -1 ;//去年 | 84 | this.lastYear = nowYear -1 ; |
67 | this.lastYearMonth = DateUtils.getTbMonth(this.nowMonth); | 85 | this.lastYearMonth = DateUtils.getTbMonth(this.nowMonth); |
68 | //System.out.println(" lastYearMonth "+lastYearMonth); | ||
69 | this.lastYearMonthStartTime = lastYearMonth+"-01"; | 86 | this.lastYearMonthStartTime = lastYearMonth+"-01"; |
70 | this.lastYearMonthEndTime = lastYearMonth+"-31"; | 87 | this.lastYearMonthEndTime = lastYearMonth+"-31"; |
71 | this.lastYearStartDate = this.lastYear+"-01-01"; | 88 | this.lastYearStartDate = this.lastYear+"-01-01"; |
72 | this.lastYearEndDate = this.lastYear+"-12-31"; | 89 | this.lastYearEndDate = this.lastYear+"-12-31"; |
73 | 90 | ||
74 | //环比时间 | 91 | //环比时间 |
75 | this.lastMonth = DateUtils.getHbMonth(this.nowMonth);// | 92 | this.lastMonth = DateUtils.getHbMonth(this.nowMonth); |
76 | //System.out.println(" lastMonth "+lastMonth); | ||
77 | this.lastMonthStartTime = lastMonth+"-01"; | 93 | this.lastMonthStartTime = lastMonth+"-01"; |
78 | this.lastMonthEndTime = lastMonth+"-31"; | 94 | this.lastMonthEndTime = lastMonth+"-31"; |
79 | |||
80 | //this.lastYearStartTime = lastYear+"-01"; | ||
81 | // this.lastYearEndTime = lastYear +"-31"; | ||
82 | } | 95 | } |
83 | } | 96 | } |
84 | 97 | ... | ... |
... | @@ -302,6 +302,7 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa | ... | @@ -302,6 +302,7 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa |
302 | return list; | 302 | return list; |
303 | } | 303 | } |
304 | //节能环保 大屏展示 | 304 | //节能环保 大屏展示 |
305 | @Override | ||
305 | public JnhbLargeScreenVO jnhbLargeScreenShow(String departIds,String time){ | 306 | public JnhbLargeScreenVO jnhbLargeScreenShow(String departIds,String time){ |
306 | DateVO dateVO = new DateVO(time); | 307 | DateVO dateVO = new DateVO(time); |
307 | JnhbLargeScreenVO largeScreenVO = new JnhbLargeScreenVO(); | 308 | JnhbLargeScreenVO largeScreenVO = new JnhbLargeScreenVO(); | ... | ... |
... | @@ -63,7 +63,10 @@ public class WorkAnalysisController { | ... | @@ -63,7 +63,10 @@ public class WorkAnalysisController { |
63 | } | 63 | } |
64 | endTime = DateUtils.checkDateByCurrentDate(endTime);//判断是否当前月,然后与当前时间对比 | 64 | endTime = DateUtils.checkDateByCurrentDate(endTime);//判断是否当前月,然后与当前时间对比 |
65 | 65 | ||
66 | String sql = "select d.id 'depart_id' , d.depart_name , (DATEDIFF('"+endTime+"', '"+startTime+"') +"+index+") 'day_num' , (month('"+endTime+"') - month('"+startTime+"')+"+index+" ) month_num,ifnull(aaa.count,0) 'nh_num' ,ifnull(bbb.count,0) 'szsl_num' ,ifnull(ccc.count,0) 'hy_num' ,ifnull(ddd.count,0) 'yy_month_num',ifnull(fff.count,0) 'df_month_num' ,ifnull(ggg.count,0) 'year_target_num' from sys_depart d "; | 66 | String sql = "select d.id 'depart_id' , d.depart_name , (DATEDIFF('"+endTime+"', '"+startTime+"') +"+index+") 'day_num' , " + |
67 | "(month('"+endTime+"') - month('"+startTime+"')+"+index+" ) month_num,ifnull(aaa.count,0) 'nh_num' ," + | ||
68 | "ifnull(bbb.count,0) 'szsl_num' ,ifnull(ccc.count,0) 'hy_num' ,ifnull(fff.count,0) 'yy_month_num'," + | ||
69 | "ifnull(ddd.count,0) 'df_month_num' ,ifnull(ggg.count,0) 'year_target_num' from sys_depart d "; | ||
67 | sql += getWorkProgressSql(departIds, startTime, endTime, month); | 70 | sql += getWorkProgressSql(departIds, startTime, endTime, month); |
68 | sql += " where d.depart_type =1 "; | 71 | sql += " where d.depart_type =1 "; |
69 | if(StringUtils.isNotEmpty(departIds)){ | 72 | if(StringUtils.isNotEmpty(departIds)){ |
... | @@ -341,7 +344,7 @@ public class WorkAnalysisController { | ... | @@ -341,7 +344,7 @@ public class WorkAnalysisController { |
341 | view2119Sql_where += " and bb.CSTN is not null and bb.CSTN <> '' and bb.CSZL is not null and bb.CSZL <> '' "; | 344 | view2119Sql_where += " and bb.CSTN is not null and bb.CSTN <> '' and bb.CSZL is not null and bb.CSZL <> '' "; |
342 | view2119Sql_where += " and bb.JSCOD is not null and bb.JSCOD <> '' and bb.CSCOD is not null and bb.CSCOD <> '' and bb.CSPH is not null and bb.CSPH <> '' "; | 345 | view2119Sql_where += " and bb.JSCOD is not null and bb.JSCOD <> '' and bb.CSCOD is not null and bb.CSCOD <> '' and bb.CSPH is not null and bb.CSPH <> '' "; |
343 | 346 | ||
344 | sql += " left join ( select bb.depart_id ,count(1) 'count' from "+view2119Sql+ " bb " +view2119Sql_where+ " group by bb.depart_id )bbb on bbb.depart_id = d.id"; | 347 | sql += " left join ( select bb.depart_id ,count(1) 'count' from "+view2119Sql+ " bb " +view2119Sql_where+ " group by bb.depart_id ) bbb on bbb.depart_id = d.id"; |
345 | //水质水量日报 及时天数 | 348 | //水质水量日报 及时天数 |
346 | sql += " left join ( select bb.depart_id ,count(1) 'count' from "+view2119Sql+ " bb " +view2119Sql_where+ " and DATEDIFF(bb.create_time , bb.time) < 2 group by bb.depart_id )bbbHH on bbbHH.depart_id = d.id"; | 349 | sql += " left join ( select bb.depart_id ,count(1) 'count' from "+view2119Sql+ " bb " +view2119Sql_where+ " and DATEDIFF(bb.create_time , bb.time) < 2 group by bb.depart_id )bbbHH on bbbHH.depart_id = d.id"; |
347 | 350 | ||
... | @@ -351,11 +354,11 @@ public class WorkAnalysisController { | ... | @@ -351,11 +354,11 @@ public class WorkAnalysisController { |
351 | viewbffaSql_where += " and cc.JSZLHY is not null and cc.JSZLHY <> '' and cc.CSZLHY is not null and cc.CSZLHY <> '' and cc.CSTNHY is not null and cc.CSTNHY <> '' and cc.JSZDHY is not null and cc.JSZDHY <> '' "; | 354 | viewbffaSql_where += " and cc.JSZLHY is not null and cc.JSZLHY <> '' and cc.CSZLHY is not null and cc.CSZLHY <> '' and cc.CSTNHY is not null and cc.CSTNHY <> '' and cc.JSZDHY is not null and cc.JSZDHY <> '' "; |
352 | viewbffaSql_where += " and cc.JSADHY is not null and cc.JSADHY <> '' and cc.CSADHY is not null and cc.CSADHY <> '' "; | 355 | viewbffaSql_where += " and cc.JSADHY is not null and cc.JSADHY <> '' and cc.CSADHY is not null and cc.CSADHY <> '' "; |
353 | 356 | ||
354 | sql += " left join (select cc.depart_id ,count(1) 'count' from "+viewbffaSql+ " cc "+ viewbffaSql_where +" group by cc.depart_id )ccc on ccc.depart_id = d.id "; | 357 | sql += " left join (select cc.depart_id ,count(1) 'count' from "+viewbffaSql+ " cc "+ viewbffaSql_where +" group by cc.depart_id )ccc on ccc.depart_id = d.id "; |
355 | sql += " left join (select cc.depart_id ,count(1) 'count' from "+viewbffaSql+ " cc "+ viewbffaSql_where +" and DATEDIFF(cc.create_time , cc.time) < 2 group by cc.depart_id )cccHH on cccHH.depart_id = d.id "; | 358 | sql += " left join (select cc.depart_id ,count(1) 'count' from "+viewbffaSql+ " cc "+ viewbffaSql_where +" and DATEDIFF(cc.create_time , cc.time) < 2 group by cc.depart_id )cccHH on cccHH.depart_id = d.id "; |
356 | 359 | ||
357 | //电费月报 | 360 | //电费月报 |
358 | sql += " left join( select ec.depart_id , count(1) 'count' from report_electric_cost ec where ec.month = '"+month+"' and ec.cost is not null and ec.cost <> '' group by ec.depart_id ) ddd on ddd.depart_id = d.id "; | 361 | sql += " left join( select ec.depart_id , count(1) 'count' from report_electric_cost ec where ec.month = '"+month+"' and ec.cost is not null and ec.cost <> '' group by ec.depart_id ) ddd on ddd.depart_id = d.id "; |
359 | 362 | ||
360 | //生产运营月报表:月收费水量、月药费 | 363 | //生产运营月报表:月收费水量、月药费 |
361 | String view4411Sql = ReportViewUtil.buildView(ReportConstant.view4411,"yyf,ysfsl",departIds,startTime,endTime); | 364 | String view4411Sql = ReportViewUtil.buildView(ReportConstant.view4411,"yyf,ysfsl",departIds,startTime,endTime); | ... | ... |
... | @@ -275,8 +275,19 @@ | ... | @@ -275,8 +275,19 @@ |
275 | 275 | ||
276 | order by aaa.end_time desc | 276 | order by aaa.end_time desc |
277 | </select> | 277 | </select> |
278 | <select id="getList" resultType="java.util.HashMap"> | ||
279 | 278 | ||
279 | <select id="getList" resultType="java.util.HashMap"> | ||
280 | SELECT | ||
281 | t.maintain_plan_name AS taskName, | ||
282 | u.id AS userId, | ||
283 | u.cid AS cid | ||
284 | FROM | ||
285 | equipment_maintain_task t | ||
286 | LEFT JOIN sys_user u ON u.id = t.maintainer_id | ||
287 | WHERE | ||
288 | t.results_enforcement IN ( '1' ) | ||
289 | AND DATE_FORMAT(t.start_time,'%Y-%m-%d %H:%i:%s') >= #{startTime} | ||
290 | AND DATE_FORMAT(t.start_time,'%Y-%m-%d %H:%i:%s') <= #{endTime} | ||
280 | </select> | 291 | </select> |
281 | 292 | ||
282 | </mapper> | 293 | </mapper> | ... | ... |
1 | package com.skua.modules.equipment.quartz; | 1 | package com.skua.modules.equipment.quartz; |
2 | 2 | ||
3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||
4 | import com.google.common.collect.Lists; | ||
5 | import com.skua.core.util.push.MessageEntity; | 3 | import com.skua.core.util.push.MessageEntity; |
6 | import com.skua.modules.alarmtmp.entity.AlarmRecordHistory; | ||
7 | import com.skua.modules.equipment.entity.EquipmentMaintainTask; | ||
8 | import com.skua.modules.equipment.service.IEquipmentInfoService; | ||
9 | import com.skua.modules.equipment.service.IEquipmentMaintainTaskService; | 4 | import com.skua.modules.equipment.service.IEquipmentMaintainTaskService; |
10 | import com.skua.modules.system.service.WebNoticePushServiceExt; | 5 | import com.skua.modules.system.service.WebNoticePushServiceExt; |
11 | import lombok.extern.slf4j.Slf4j; | 6 | import lombok.extern.slf4j.Slf4j; |
... | @@ -48,8 +43,6 @@ public class TaskRemindJob implements Job { | ... | @@ -48,8 +43,6 @@ public class TaskRemindJob implements Job { |
48 | LocalDateTime oneHourLater = now.plus(1, ChronoUnit.HOURS); | 43 | LocalDateTime oneHourLater = now.plus(1, ChronoUnit.HOURS); |
49 | String startTime = now.format(formatter); | 44 | String startTime = now.format(formatter); |
50 | String endTime = oneHourLater.format(formatter); | 45 | String endTime = oneHourLater.format(formatter); |
51 | startTime = "2025-04-07 00:00:00"; | ||
52 | endTime = "2025-04-08 23:59:59"; | ||
53 | List<Map<String, Object>> wbList = getWbList(startTime,endTime); | 46 | List<Map<String, Object>> wbList = getWbList(startTime,endTime); |
54 | //推送维保消息 | 47 | //推送维保消息 |
55 | pushWbMessage(wbList); | 48 | pushWbMessage(wbList); |
... | @@ -60,13 +53,17 @@ public class TaskRemindJob implements Job { | ... | @@ -60,13 +53,17 @@ public class TaskRemindJob implements Job { |
60 | private boolean pushWbMessage(List<Map<String, Object>> wbList) { | 53 | private boolean pushWbMessage(List<Map<String, Object>> wbList) { |
61 | for (Map<String, Object> wbMap : wbList) { | 54 | for (Map<String, Object> wbMap : wbList) { |
62 | //获取用户列表后做消息推送 | 55 | //获取用户列表后做消息推送 |
56 | List<String> userIds = new ArrayList<>(); | ||
57 | userIds.add(wbMap.get("userId").toString()); | ||
58 | List<String> userCIds = new ArrayList<>(); | ||
59 | userCIds.add(wbMap.get("cid").toString()); | ||
63 | MessageEntity messageEntity = new MessageEntity(); | 60 | MessageEntity messageEntity = new MessageEntity(); |
64 | messageEntity.setMessageTitle("流程审批消息"); | 61 | messageEntity.setMessageTitle("任务提醒消息"); |
65 | messageEntity.setMessageBody("您有一条【" + wbMap.get("taskName") + "】维保任务需要完成,请及时处理"); | 62 | messageEntity.setMessageBody("您有一条【" + wbMap.get("taskName") + "】维保任务需要完成,请及时处理"); |
66 | messageEntity.setReceiveUser(null); | 63 | messageEntity.setReceiveUser(userIds); |
67 | messageEntity.setReceiveUserCid(null); | 64 | messageEntity.setReceiveUserCid(userCIds); |
68 | messageEntity.setSendUser("系统"); | 65 | messageEntity.setSendUser("系统"); |
69 | messageEntity.setForwardTag("maintain"); | 66 | messageEntity.setForwardTag("2"); |
70 | webNoticePushServiceExt.pushMessage(messageEntity, "maintain", "M"); | 67 | webNoticePushServiceExt.pushMessage(messageEntity, "maintain", "M"); |
71 | } | 68 | } |
72 | return true; | 69 | return true; | ... | ... |
sk-module-system/src/main/java/com/skua/modules/system/controller/SysFactoryExpertController.java
0 → 100644
1 | package com.skua.modules.system.controller; | ||
2 | |||
3 | import java.util.Arrays; | ||
4 | import java.util.List; | ||
5 | import java.util.Map; | ||
6 | import java.io.IOException; | ||
7 | import java.io.UnsupportedEncodingException; | ||
8 | import java.net.URLDecoder; | ||
9 | import javax.servlet.http.HttpServletRequest; | ||
10 | import javax.servlet.http.HttpServletResponse; | ||
11 | import com.skua.core.api.vo.Result; | ||
12 | import com.skua.core.aspect.annotation.AutoLog; | ||
13 | import com.skua.core.query.QueryGenerator; | ||
14 | import com.skua.core.util.ConvertUtils; | ||
15 | import com.skua.modules.system.entity.SysFactoryExpert; | ||
16 | import com.skua.modules.system.service.ISysFactoryExpertService; | ||
17 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||
18 | import com.baomidou.mybatisplus.core.metadata.IPage; | ||
19 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||
20 | import lombok.extern.slf4j.Slf4j; | ||
21 | |||
22 | import org.jeecgframework.poi.excel.ExcelImportUtil; | ||
23 | import org.jeecgframework.poi.excel.def.NormalExcelConstants; | ||
24 | import org.jeecgframework.poi.excel.entity.ExportParams; | ||
25 | import org.jeecgframework.poi.excel.entity.ImportParams; | ||
26 | import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; | ||
27 | |||
28 | import org.springframework.beans.factory.annotation.Autowired; | ||
29 | import org.springframework.web.bind.annotation.*; | ||
30 | import org.springframework.web.multipart.MultipartFile; | ||
31 | import org.springframework.web.multipart.MultipartHttpServletRequest; | ||
32 | import org.springframework.web.servlet.ModelAndView; | ||
33 | import com.alibaba.fastjson.JSON; | ||
34 | import io.swagger.annotations.Api; | ||
35 | import io.swagger.annotations.ApiOperation; | ||
36 | |||
37 | /** | ||
38 | * <pre> | ||
39 | * 专家信息管理 | ||
40 | * </pre> | ||
41 | * @author zhanglei | ||
42 | * @version V0.1, 2025-04-09 12:11:01 | ||
43 | */ | ||
44 | @Slf4j | ||
45 | @Api(tags="专家信息管理") | ||
46 | @RestController | ||
47 | @RequestMapping("/system/factoryExpert") | ||
48 | public class SysFactoryExpertController { | ||
49 | @Autowired | ||
50 | private ISysFactoryExpertService sysFactoryExpertService; | ||
51 | |||
52 | /** | ||
53 | * <pre> | ||
54 | * 分页列表查询 | ||
55 | * </pre> | ||
56 | * @param sysFactoryExpert | ||
57 | * @param pageNo | ||
58 | * @param pageSize | ||
59 | * @param req | ||
60 | * @return | ||
61 | * @author 开发者姓名, 开发时间 | ||
62 | * @Description: TODO(这里描述这个方法的需求变更情况) | ||
63 | */ | ||
64 | |||
65 | @AutoLog(value = "专家信息管理-分页列表查询") | ||
66 | @ApiOperation(value="专家信息管理-分页列表查询", notes="专家信息管理-分页列表查询") | ||
67 | @GetMapping(value = "/list") | ||
68 | public Result<IPage<SysFactoryExpert>> queryPageList(SysFactoryExpert sysFactoryExpert, | ||
69 | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | ||
70 | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | ||
71 | HttpServletRequest req) { | ||
72 | Result<IPage<SysFactoryExpert>> result = new Result<IPage<SysFactoryExpert>>(); | ||
73 | QueryWrapper<SysFactoryExpert> queryWrapper = QueryGenerator.initQueryWrapper(sysFactoryExpert, req.getParameterMap()); | ||
74 | Page<SysFactoryExpert> page = new Page<SysFactoryExpert>(pageNo, pageSize); | ||
75 | IPage<SysFactoryExpert> pageList = sysFactoryExpertService.page(page, queryWrapper); | ||
76 | result.setSuccess(true); | ||
77 | result.setResult(pageList); | ||
78 | return result; | ||
79 | } | ||
80 | |||
81 | /** | ||
82 | * <pre> | ||
83 | * 添加 | ||
84 | * </pre> | ||
85 | * @param sysFactoryExpert | ||
86 | * @return | ||
87 | * @author 开发者姓名, 开发时间 | ||
88 | * @Description: TODO(这里描述这个方法的需求变更情况) | ||
89 | */ | ||
90 | @AutoLog(value = "专家信息管理-添加") | ||
91 | @ApiOperation(value="专家信息管理-添加", notes="专家信息管理-添加") | ||
92 | @PostMapping(value = "/add") | ||
93 | public Result<SysFactoryExpert> add(@RequestBody SysFactoryExpert sysFactoryExpert) { | ||
94 | Result<SysFactoryExpert> result = new Result<SysFactoryExpert>(); | ||
95 | try { | ||
96 | sysFactoryExpertService.save(sysFactoryExpert); | ||
97 | result.success("添加成功!"); | ||
98 | } catch (Exception e) { | ||
99 | log.error(e.getMessage(),e); | ||
100 | result.error500("操作失败"); | ||
101 | } | ||
102 | return result; | ||
103 | } | ||
104 | /** | ||
105 | * <pre> | ||
106 | * 编辑 | ||
107 | * </pre> | ||
108 | * @param sysFactoryExpert | ||
109 | * @return | ||
110 | * @author 开发者姓名, 开发时间 | ||
111 | * @Description: TODO(这里描述这个方法的需求变更情况) | ||
112 | */ | ||
113 | @AutoLog(value = "专家信息管理-编辑") | ||
114 | @ApiOperation(value="专家信息管理-编辑", notes="专家信息管理-编辑") | ||
115 | @PutMapping(value = "/edit") | ||
116 | public Result<SysFactoryExpert> edit(@RequestBody SysFactoryExpert sysFactoryExpert) { | ||
117 | Result<SysFactoryExpert> result = new Result<SysFactoryExpert>(); | ||
118 | SysFactoryExpert sysFactoryExpertEntity = sysFactoryExpertService.getById(sysFactoryExpert.getId()); | ||
119 | if(sysFactoryExpertEntity==null) { | ||
120 | result.error500("未找到对应实体"); | ||
121 | }else { | ||
122 | boolean ok = sysFactoryExpertService.updateById(sysFactoryExpert); | ||
123 | if(ok) { | ||
124 | result.success("修改成功!"); | ||
125 | } | ||
126 | } | ||
127 | |||
128 | return result; | ||
129 | } | ||
130 | /** | ||
131 | * <pre> | ||
132 | * 通过id删除 | ||
133 | * </pre> | ||
134 | * @param id | ||
135 | * @return | ||
136 | * @author 开发者姓名, 开发时间 | ||
137 | * @Description: TODO(这里描述这个方法的需求变更情况) | ||
138 | */ | ||
139 | @AutoLog(value = "专家信息管理-通过id删除") | ||
140 | @ApiOperation(value="专家信息管理-通过id删除", notes="专家信息管理-通过id删除") | ||
141 | @DeleteMapping(value = "/delete") | ||
142 | public Result<?> delete(@RequestParam(name="id",required=true) String id) { | ||
143 | try { | ||
144 | sysFactoryExpertService.removeById(id); | ||
145 | } catch (Exception e) { | ||
146 | log.error("删除失败",e.getMessage()); | ||
147 | return Result.error("删除失败!"); | ||
148 | } | ||
149 | return Result.ok("删除成功!"); | ||
150 | } | ||
151 | |||
152 | /** | ||
153 | * <pre> | ||
154 | * 批量删除 | ||
155 | * </pre> | ||
156 | * @param ids | ||
157 | * @return | ||
158 | * @author 开发者姓名, 开发时间 | ||
159 | * @Description: TODO(这里描述这个方法的需求变更情况) | ||
160 | */ | ||
161 | @AutoLog(value = "专家信息管理-批量删除") | ||
162 | @ApiOperation(value="专家信息管理-批量删除", notes="专家信息管理-批量删除") | ||
163 | @DeleteMapping(value = "/deleteBatch") | ||
164 | public Result<SysFactoryExpert> deleteBatch(@RequestParam(name="ids",required=true) String ids) { | ||
165 | Result<SysFactoryExpert> result = new Result<SysFactoryExpert>(); | ||
166 | if(ids==null || "".equals(ids.trim())) { | ||
167 | result.error500("参数不识别!"); | ||
168 | }else { | ||
169 | this.sysFactoryExpertService.removeByIds(Arrays.asList(ids.split(","))); | ||
170 | result.success("删除成功!"); | ||
171 | } | ||
172 | return result; | ||
173 | } | ||
174 | /** | ||
175 | * <pre> | ||
176 | * 通过id查询 | ||
177 | * </pre> | ||
178 | * @param id | ||
179 | * @return | ||
180 | * @author 开发者姓名, 开发时间 | ||
181 | * @Description: TODO(这里描述这个方法的需求变更情况) | ||
182 | */ | ||
183 | @AutoLog(value = "专家信息管理-通过id查询") | ||
184 | @ApiOperation(value="专家信息管理-通过id查询", notes="专家信息管理-通过id查询") | ||
185 | @GetMapping(value = "/queryById") | ||
186 | public Result<SysFactoryExpert> queryById(@RequestParam(name="id",required=true) String id) { | ||
187 | Result<SysFactoryExpert> result = new Result<SysFactoryExpert>(); | ||
188 | SysFactoryExpert sysFactoryExpert = sysFactoryExpertService.getById(id); | ||
189 | if(sysFactoryExpert==null) { | ||
190 | result.error500("未找到对应实体"); | ||
191 | }else { | ||
192 | result.setResult(sysFactoryExpert); | ||
193 | result.setSuccess(true); | ||
194 | } | ||
195 | return result; | ||
196 | } | ||
197 | |||
198 | @AutoLog(value = "专家信息管理-通过userId查询") | ||
199 | @ApiOperation(value="专家信息管理-通过userId查询", notes="专家信息管理-通过userId查询") | ||
200 | @GetMapping(value = "/queryByUser") | ||
201 | public Result<SysFactoryExpert> queryByUser(@RequestParam(name="userId",required=true) String userId) { | ||
202 | Result<SysFactoryExpert> result = new Result<SysFactoryExpert>(); | ||
203 | SysFactoryExpert sysFactoryExpert = sysFactoryExpertService.queryByUser(userId); | ||
204 | if(sysFactoryExpert==null) { | ||
205 | result.setResult(new SysFactoryExpert()); | ||
206 | }else { | ||
207 | result.setResult(sysFactoryExpert); | ||
208 | } | ||
209 | result.setSuccess(true); | ||
210 | return result; | ||
211 | } | ||
212 | |||
213 | /** | ||
214 | * <pre> | ||
215 | * 导出excel | ||
216 | * </pre> | ||
217 | * @param request | ||
218 | * @param response | ||
219 | * @return | ||
220 | * @author 开发者姓名, 开发时间 | ||
221 | * @Description: TODO(这里描述这个方法的需求变更情况) | ||
222 | */ | ||
223 | |||
224 | @RequestMapping(value = "/exportXls") | ||
225 | public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) { | ||
226 | // Step.1 组装查询条件 | ||
227 | QueryWrapper<SysFactoryExpert> queryWrapper = null; | ||
228 | try { | ||
229 | String paramsStr = request.getParameter("paramsStr"); | ||
230 | if (ConvertUtils.isNotEmpty(paramsStr)) { | ||
231 | String deString = URLDecoder.decode(paramsStr, "UTF-8"); | ||
232 | SysFactoryExpert sysFactoryExpert = JSON.parseObject(deString, SysFactoryExpert.class); | ||
233 | queryWrapper = QueryGenerator.initQueryWrapper(sysFactoryExpert, request.getParameterMap()); | ||
234 | } | ||
235 | } catch (UnsupportedEncodingException e) { | ||
236 | e.printStackTrace(); | ||
237 | } | ||
238 | |||
239 | //Step.2 AutoPoi 导出Excel | ||
240 | ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); | ||
241 | List<SysFactoryExpert> pageList = sysFactoryExpertService.list(queryWrapper); | ||
242 | //导出文件名称 | ||
243 | mv.addObject(NormalExcelConstants.FILE_NAME, "专家信息管理列表"); | ||
244 | mv.addObject(NormalExcelConstants.CLASS, SysFactoryExpert.class); | ||
245 | mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("专家信息管理列表数据", "导出人:Jeecg", "导出信息")); | ||
246 | mv.addObject(NormalExcelConstants.DATA_LIST, pageList); | ||
247 | return mv; | ||
248 | } | ||
249 | |||
250 | /** | ||
251 | * <pre> | ||
252 | * 通过excel导入数据 | ||
253 | * </pre> | ||
254 | * @param request | ||
255 | * @param response | ||
256 | * @return | ||
257 | * @author 开发者姓名, 开发时间 | ||
258 | * @Description: TODO(这里描述这个方法的需求变更情况) | ||
259 | */ | ||
260 | @RequestMapping(value = "/importExcel", method = RequestMethod.POST) | ||
261 | public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { | ||
262 | MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; | ||
263 | Map<String, MultipartFile> fileMap = multipartRequest.getFileMap(); | ||
264 | for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { | ||
265 | MultipartFile file = entity.getValue();// 获取上传文件对象 | ||
266 | ImportParams params = new ImportParams(); | ||
267 | params.setTitleRows(2); | ||
268 | params.setHeadRows(1); | ||
269 | params.setNeedSave(true); | ||
270 | try { | ||
271 | List<SysFactoryExpert> listSysFactoryExperts = ExcelImportUtil.importExcel(file.getInputStream(), SysFactoryExpert.class, params); | ||
272 | sysFactoryExpertService.saveBatch(listSysFactoryExperts); | ||
273 | return Result.ok("文件导入成功!数据行数:" + listSysFactoryExperts.size()); | ||
274 | } catch (Exception e) { | ||
275 | log.error(e.getMessage(),e); | ||
276 | return Result.error("文件导入失败:"+e.getMessage()); | ||
277 | } finally { | ||
278 | try { | ||
279 | file.getInputStream().close(); | ||
280 | } catch (IOException e) { | ||
281 | e.printStackTrace(); | ||
282 | } | ||
283 | } | ||
284 | } | ||
285 | return Result.ok("文件导入失败!"); | ||
286 | } | ||
287 | |||
288 | } |
1 | package com.skua.modules.system.entity; | ||
2 | |||
3 | import com.baomidou.mybatisplus.annotation.IdType; | ||
4 | import com.baomidou.mybatisplus.annotation.TableId; | ||
5 | import com.baomidou.mybatisplus.annotation.TableName; | ||
6 | import com.skua.core.aspect.annotation.Dict; | ||
7 | import io.swagger.annotations.ApiModel; | ||
8 | import io.swagger.annotations.ApiModelProperty; | ||
9 | import lombok.Data; | ||
10 | import lombok.EqualsAndHashCode; | ||
11 | import lombok.experimental.Accessors; | ||
12 | import org.jeecgframework.poi.excel.annotation.Excel; | ||
13 | |||
14 | /** | ||
15 | * 专家信息管理 | ||
16 | */ | ||
17 | @Data | ||
18 | @TableName("sys_factory_expert") | ||
19 | @EqualsAndHashCode(callSuper = false) | ||
20 | @Accessors(chain = true) | ||
21 | @ApiModel(value="sys_factory_expert对象", description="专家信息管理") | ||
22 | public class SysFactoryExpert { | ||
23 | |||
24 | /**主键*/ | ||
25 | @TableId(type = IdType.ID_WORKER_STR) | ||
26 | @ApiModelProperty(value = "主键") | ||
27 | private String id; | ||
28 | /**对应的系统用户id*/ | ||
29 | @Excel(name = "对应的系统用户id", width = 15) | ||
30 | @ApiModelProperty(value = "对应的系统用户id") | ||
31 | private String userId; | ||
32 | /**专家等级*/ | ||
33 | @Excel(name = "专家等级", width = 15) | ||
34 | @ApiModelProperty(value = "专家等级") | ||
35 | @Dict(dicCode = "expertLevel") | ||
36 | private String expertLevel; | ||
37 | /**专家类型*/ | ||
38 | @Excel(name = "专家类型", width = 15) | ||
39 | @ApiModelProperty(value = "专家类型") | ||
40 | @Dict(dicCode = "expertType") | ||
41 | private String expertType; | ||
42 | /**专家特长*/ | ||
43 | @Excel(name = "专家特长", width = 15) | ||
44 | @ApiModelProperty(value = "专家特长") | ||
45 | private String expertTc; | ||
46 | /**专家工作经历*/ | ||
47 | @Excel(name = "专家工作经历", width = 15) | ||
48 | @ApiModelProperty(value = "专家工作经历") | ||
49 | private String expertGzjl; | ||
50 | /**附件*/ | ||
51 | @Excel(name = "附件", width = 15) | ||
52 | @ApiModelProperty(value = "附件") | ||
53 | private String expertFile; | ||
54 | /**备注*/ | ||
55 | @Excel(name = "备注", width = 15) | ||
56 | @ApiModelProperty(value = "备注") | ||
57 | private String remark; | ||
58 | /**创建时间*/ | ||
59 | @Excel(name = "创建时间", width = 15) | ||
60 | @ApiModelProperty(value = "创建时间") | ||
61 | private String createTime; | ||
62 | /**创建人*/ | ||
63 | @Excel(name = "创建人", width = 15) | ||
64 | @ApiModelProperty(value = "创建人") | ||
65 | private String createBy; | ||
66 | /**修改时间*/ | ||
67 | @Excel(name = "修改时间", width = 15) | ||
68 | @ApiModelProperty(value = "修改时间") | ||
69 | private String updateTime; | ||
70 | /**修改人*/ | ||
71 | @Excel(name = "修改人", width = 15) | ||
72 | @ApiModelProperty(value = "修改人") | ||
73 | private String updateBy; | ||
74 | /**标识*/ | ||
75 | @Excel(name = "标识", width = 15) | ||
76 | @ApiModelProperty(value = "标识") | ||
77 | private String delFlag; | ||
78 | } |
sk-module-system/src/main/java/com/skua/modules/system/mapper/SysFactoryExpertMapper.java
0 → 100644
1 | package com.skua.modules.system.mapper; | ||
2 | |||
3 | import com.skua.modules.system.entity.SysFactoryExpert; | ||
4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
5 | import io.lettuce.core.dynamic.annotation.Param; | ||
6 | |||
7 | /** | ||
8 | * 专家信息管理 | ||
9 | */ | ||
10 | public interface SysFactoryExpertMapper extends BaseMapper<SysFactoryExpert> { | ||
11 | |||
12 | SysFactoryExpert queryByUser(@Param("userId") String userId); | ||
13 | } |
sk-module-system/src/main/java/com/skua/modules/system/mapper/xml/SysFactoryExpertMapper.xml
0 → 100644
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
3 | <mapper namespace="com.skua.modules.system.mapper.SysFactoryExpertMapper"> | ||
4 | |||
5 | <select id="queryByUser" resultType="com.skua.modules.system.entity.SysFactoryExpert"> | ||
6 | select * from sys_factory_expert where user_id = #{userId} limit 1 | ||
7 | </select> | ||
8 | |||
9 | </mapper> |
sk-module-system/src/main/java/com/skua/modules/system/service/ISysFactoryExpertService.java
0 → 100644
1 | package com.skua.modules.system.service; | ||
2 | |||
3 | import com.skua.modules.system.entity.SysFactoryExpert; | ||
4 | import com.baomidou.mybatisplus.extension.service.IService; | ||
5 | |||
6 | /** | ||
7 | * 专家信息管理 | ||
8 | */ | ||
9 | public interface ISysFactoryExpertService extends IService<SysFactoryExpert> { | ||
10 | |||
11 | SysFactoryExpert queryByUser(String userId); | ||
12 | } |
sk-module-system/src/main/java/com/skua/modules/system/service/impl/SysFactoryExpertServiceImpl.java
0 → 100644
1 | package com.skua.modules.system.service.impl; | ||
2 | |||
3 | import com.skua.modules.system.entity.SysFactoryExpert; | ||
4 | import com.skua.modules.system.mapper.SysFactoryExpertMapper; | ||
5 | import com.skua.modules.system.service.ISysFactoryExpertService; | ||
6 | import org.springframework.beans.factory.annotation.Autowired; | ||
7 | import org.springframework.stereotype.Service; | ||
8 | |||
9 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ||
10 | |||
11 | /** | ||
12 | * 专家信息管理 | ||
13 | */ | ||
14 | @Service | ||
15 | public class SysFactoryExpertServiceImpl extends ServiceImpl<SysFactoryExpertMapper, SysFactoryExpert> implements ISysFactoryExpertService { | ||
16 | |||
17 | @Autowired | ||
18 | private SysFactoryExpertMapper sysFactoryExpertMapper; | ||
19 | |||
20 | @Override | ||
21 | public SysFactoryExpert queryByUser(String userId) { | ||
22 | SysFactoryExpert sysFactoryExpert = sysFactoryExpertMapper.queryByUser(userId); | ||
23 | return sysFactoryExpert; | ||
24 | } | ||
25 | } |
-
请 注册 或 登录 后发表评论