4bf97960 张雷

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

2 个父辈 e8716608 07f4477f
正在显示 16 个修改的文件 包含 1028 行增加1 行删除
1 package com.skua.modules.ajh.controller;
2
3 import java.util.ArrayList;
4 import java.util.Arrays;
5 import java.util.List;
6 import java.util.Map;
7 import java.io.IOException;
8 import java.io.UnsupportedEncodingException;
9 import java.net.URLDecoder;
10 import java.util.stream.Collectors;
11 import javax.servlet.http.HttpServletRequest;
12 import javax.servlet.http.HttpServletResponse;
13
14 import cn.hutool.core.bean.BeanUtil;
15 import com.skua.core.api.vo.Result;
16 import com.skua.core.aspect.annotation.AutoLog;
17 import com.skua.core.query.QueryGenerator;
18 import com.skua.core.util.ConvertUtils;
19 import com.skua.modules.ajh.entity.AjhEduTrainingRecord;
20 import com.skua.modules.ajh.service.IAjhEduTrainingRecordService;
21 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
22 import com.baomidou.mybatisplus.core.metadata.IPage;
23 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
24 import com.skua.modules.biz.IBusinessService;
25 import lombok.extern.slf4j.Slf4j;
26
27 import org.jeecgframework.poi.excel.ExcelImportUtil;
28 import org.jeecgframework.poi.excel.def.NormalExcelConstants;
29 import org.jeecgframework.poi.excel.entity.ExportParams;
30 import org.jeecgframework.poi.excel.entity.ImportParams;
31 import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
32
33 import org.springframework.beans.factory.annotation.Autowired;
34 import org.springframework.web.bind.annotation.*;
35 import org.springframework.web.multipart.MultipartFile;
36 import org.springframework.web.multipart.MultipartHttpServletRequest;
37 import org.springframework.web.servlet.ModelAndView;
38 import com.alibaba.fastjson.JSON;
39 import io.swagger.annotations.Api;
40 import io.swagger.annotations.ApiOperation;
41
42 /**
43 * <pre>
44 * 培训记录补录
45 * </pre>
46 *
47 * @author 开发者姓名
48 * @version V0.1, 开发时间
49 */
50 @Slf4j
51 @Api(tags = "培训记录补录")
52 @RestController
53 @RequestMapping("/ajh/ajhEduTrainingRecord")
54 public class AjhEduTrainingRecordController {
55 @Autowired
56 private IAjhEduTrainingRecordService ajhEduTrainingRecordService;
57 @Autowired
58 private IBusinessService businessService;
59
60 /**
61 * <pre>
62 * 分页列表查询
63 * </pre>
64 *
65 * @param ajhEduTrainingRecord
66 * @param pageNo
67 * @param pageSize
68 * @param req
69 * @return
70 * @author 开发者姓名, 开发时间
71 * @Description: TODO(这里描述这个方法的需求变更情况)
72 */
73
74 @AutoLog(value = "培训记录补录-分页列表查询")
75 @ApiOperation(value = "培训记录补录-分页列表查询", notes = "培训记录补录-分页列表查询")
76 @GetMapping(value = "/list")
77 public Result<Object> queryPageList(AjhEduTrainingRecord ajhEduTrainingRecord,
78 @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
79 @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
80 HttpServletRequest req) {
81 Result<Object> result = new Result<>();
82 QueryWrapper<AjhEduTrainingRecord> queryWrapper = QueryGenerator.initQueryWrapper(ajhEduTrainingRecord, req.getParameterMap());
83 Page<AjhEduTrainingRecord> page = new Page<>(pageNo, pageSize);
84 IPage<AjhEduTrainingRecord> pageList = ajhEduTrainingRecordService.page(page, queryWrapper);
85 // 翻译
86 Map<String, String> sysUserDictMap = businessService.dictMap("sys_user", null);
87 Map<String, String> eduTraLxDictMap = businessService.dictMap("edu_tra_lx", null);
88 // 封装结果
89 IPage<Map<String, Object>> mapIPage = new Page<>(pageNo, pageSize);
90 mapIPage.setTotal(pageList.getTotal());
91 mapIPage.setRecords(pageList.getRecords().stream().map(item -> {
92 Map<String, Object> map = BeanUtil.beanToMap(item);
93 List<String> joinUserNameList = new ArrayList<>();
94 if (item.getJoinUser() != null) {
95 String[] joinUserIds = item.getJoinUser().split(",");
96 for (String userId : joinUserIds) {
97 String userName = sysUserDictMap.get(userId);
98 if (userName != null) {
99 joinUserNameList.add(userName);
100 }
101 }
102 }
103 map.put("joinUser_dictText", String.join(",", joinUserNameList));
104 map.put("eduTraLx_dictText", eduTraLxDictMap.get(item.getEduTraLx()));
105 return map;
106 }).collect(Collectors.toList()));
107 result.setSuccess(true);
108 result.setResult(mapIPage);
109 return result;
110 }
111
112 /**
113 * <pre>
114 * 添加
115 * </pre>
116 *
117 * @param ajhEduTrainingRecord
118 * @return
119 * @author 开发者姓名, 开发时间
120 * @Description: TODO(这里描述这个方法的需求变更情况)
121 */
122 @AutoLog(value = "培训记录补录-添加")
123 @ApiOperation(value = "培训记录补录-添加", notes = "培训记录补录-添加")
124 @PostMapping(value = "/add")
125 public Result<AjhEduTrainingRecord> add(@RequestBody AjhEduTrainingRecord ajhEduTrainingRecord) {
126 Result<AjhEduTrainingRecord> result = new Result<AjhEduTrainingRecord>();
127 try {
128 ajhEduTrainingRecordService.save(ajhEduTrainingRecord);
129 result.success("添加成功!");
130 } catch (Exception e) {
131 log.error(e.getMessage(), e);
132 result.error500("操作失败");
133 }
134 return result;
135 }
136
137 /**
138 * <pre>
139 * 编辑
140 * </pre>
141 *
142 * @param ajhEduTrainingRecord
143 * @return
144 * @author 开发者姓名, 开发时间
145 * @Description: TODO(这里描述这个方法的需求变更情况)
146 */
147 @AutoLog(value = "培训记录补录-编辑")
148 @ApiOperation(value = "培训记录补录-编辑", notes = "培训记录补录-编辑")
149 @PutMapping(value = "/edit")
150 public Result<AjhEduTrainingRecord> edit(@RequestBody AjhEduTrainingRecord ajhEduTrainingRecord) {
151 Result<AjhEduTrainingRecord> result = new Result<AjhEduTrainingRecord>();
152 AjhEduTrainingRecord ajhEduTrainingRecordEntity = ajhEduTrainingRecordService.getById(ajhEduTrainingRecord.getId());
153 if (ajhEduTrainingRecordEntity == null) {
154 result.error500("未找到对应实体");
155 } else {
156 boolean ok = ajhEduTrainingRecordService.updateById(ajhEduTrainingRecord);
157 //TODO 返回false说明什么?
158 if (ok) {
159 result.success("修改成功!");
160 }
161 }
162
163 return result;
164 }
165
166 /**
167 * <pre>
168 * 通过id删除
169 * </pre>
170 *
171 * @param id
172 * @return
173 * @author 开发者姓名, 开发时间
174 * @Description: TODO(这里描述这个方法的需求变更情况)
175 */
176 @AutoLog(value = "培训记录补录-通过id删除")
177 @ApiOperation(value = "培训记录补录-通过id删除", notes = "培训记录补录-通过id删除")
178 @DeleteMapping(value = "/delete")
179 public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
180 try {
181 ajhEduTrainingRecordService.removeById(id);
182 } catch (Exception e) {
183 log.error("删除失败", e.getMessage());
184 return Result.error("删除失败!");
185 }
186 return Result.ok("删除成功!");
187 }
188
189 /**
190 * <pre>
191 * 批量删除
192 * </pre>
193 *
194 * @param ids
195 * @return
196 * @author 开发者姓名, 开发时间
197 * @Description: TODO(这里描述这个方法的需求变更情况)
198 */
199 @AutoLog(value = "培训记录补录-批量删除")
200 @ApiOperation(value = "培训记录补录-批量删除", notes = "培训记录补录-批量删除")
201 @DeleteMapping(value = "/deleteBatch")
202 public Result<AjhEduTrainingRecord> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
203 Result<AjhEduTrainingRecord> result = new Result<AjhEduTrainingRecord>();
204 if (ids == null || "".equals(ids.trim())) {
205 result.error500("参数不识别!");
206 } else {
207 this.ajhEduTrainingRecordService.removeByIds(Arrays.asList(ids.split(",")));
208 result.success("删除成功!");
209 }
210 return result;
211 }
212
213 /**
214 * <pre>
215 * 通过id查询
216 * </pre>
217 *
218 * @param id
219 * @return
220 * @author 开发者姓名, 开发时间
221 * @Description: TODO(这里描述这个方法的需求变更情况)
222 */
223 @AutoLog(value = "培训记录补录-通过id查询")
224 @ApiOperation(value = "培训记录补录-通过id查询", notes = "培训记录补录-通过id查询")
225 @GetMapping(value = "/queryById")
226 public Result<AjhEduTrainingRecord> queryById(@RequestParam(name = "id", required = true) String id) {
227 Result<AjhEduTrainingRecord> result = new Result<AjhEduTrainingRecord>();
228 AjhEduTrainingRecord ajhEduTrainingRecord = ajhEduTrainingRecordService.getById(id);
229 if (ajhEduTrainingRecord == null) {
230 result.error500("未找到对应实体");
231 } else {
232 result.setResult(ajhEduTrainingRecord);
233 result.setSuccess(true);
234 }
235 return result;
236 }
237
238 /**
239 * <pre>
240 * 导出excel
241 * </pre>
242 *
243 * @param request
244 * @param response
245 * @return
246 * @author 开发者姓名, 开发时间
247 * @Description: TODO(这里描述这个方法的需求变更情况)
248 */
249
250 @RequestMapping(value = "/exportXls")
251 public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
252 // Step.1 组装查询条件
253 QueryWrapper<AjhEduTrainingRecord> queryWrapper = null;
254 try {
255 String paramsStr = request.getParameter("paramsStr");
256 if (ConvertUtils.isNotEmpty(paramsStr)) {
257 String deString = URLDecoder.decode(paramsStr, "UTF-8");
258 AjhEduTrainingRecord ajhEduTrainingRecord = JSON.parseObject(deString, AjhEduTrainingRecord.class);
259 queryWrapper = QueryGenerator.initQueryWrapper(ajhEduTrainingRecord, request.getParameterMap());
260 }
261 } catch (UnsupportedEncodingException e) {
262 e.printStackTrace();
263 }
264
265 //Step.2 AutoPoi 导出Excel
266 ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
267 List<AjhEduTrainingRecord> pageList = ajhEduTrainingRecordService.list(queryWrapper);
268 //导出文件名称
269 mv.addObject(NormalExcelConstants.FILE_NAME, "培训记录补录列表");
270 mv.addObject(NormalExcelConstants.CLASS, AjhEduTrainingRecord.class);
271 mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("培训记录补录列表数据", "导出人:Jeecg", "导出信息"));
272 mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
273 return mv;
274 }
275
276 /**
277 * <pre>
278 * 通过excel导入数据
279 * </pre>
280 *
281 * @param request
282 * @param response
283 * @return
284 * @author 开发者姓名, 开发时间
285 * @Description: TODO(这里描述这个方法的需求变更情况)
286 */
287 @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
288 public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
289 MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
290 Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
291 for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
292 MultipartFile file = entity.getValue();// 获取上传文件对象
293 ImportParams params = new ImportParams();
294 params.setTitleRows(2);
295 params.setHeadRows(1);
296 params.setNeedSave(true);
297 try {
298 List<AjhEduTrainingRecord> listAjhEduTrainingRecords = ExcelImportUtil.importExcel(file.getInputStream(), AjhEduTrainingRecord.class, params);
299 ajhEduTrainingRecordService.saveBatch(listAjhEduTrainingRecords);
300 return Result.ok("文件导入成功!数据行数:" + listAjhEduTrainingRecords.size());
301 } catch (Exception e) {
302 log.error(e.getMessage(), e);
303 return Result.error("文件导入失败:" + e.getMessage());
304 } finally {
305 try {
306 file.getInputStream().close();
307 } catch (IOException e) {
308 e.printStackTrace();
309 }
310 }
311 }
312 return Result.ok("文件导入失败!");
313 }
314
315 }
1 package com.skua.modules.ajh.entity;
2
3 import java.io.Serializable;
4 import java.util.Date;
5
6 import com.baomidou.mybatisplus.annotation.IdType;
7 import com.baomidou.mybatisplus.annotation.TableId;
8 import com.baomidou.mybatisplus.annotation.TableName;
9 import com.baomidou.mybatisplus.annotation.TableField;
10 import com.skua.core.aspect.annotation.Dict;
11 import io.swagger.annotations.ApiModel;
12 import io.swagger.annotations.ApiModelProperty;
13 import lombok.Data;
14 import lombok.EqualsAndHashCode;
15 import lombok.experimental.Accessors;
16 import com.fasterxml.jackson.annotation.JsonFormat;
17 import org.springframework.format.annotation.DateTimeFormat;
18 import org.jeecgframework.poi.excel.annotation.Excel;
19
20 /**
21 * 培训记录补录
22 */
23 @Data
24 @TableName("ajh_edu_training_record")
25 @EqualsAndHashCode(callSuper = false)
26 @Accessors(chain = true)
27 @ApiModel(value = "ajh_edu_training_record对象", description = "培训记录补录")
28 public class AjhEduTrainingRecord {
29
30 /**
31 * 主键
32 */
33 @TableId(type = IdType.ID_WORKER_STR)
34 @ApiModelProperty(value = "主键")
35 private String id;
36 /**
37 * 培训时间
38 */
39 @Excel(name = "培训时间", width = 15)
40 @ApiModelProperty(value = "培训时间")
41 private String eduTraDate;
42 /**
43 * 培训类型
44 */
45 @Excel(name = "培训类型", width = 15)
46 @ApiModelProperty(value = "培训类型")
47 @Dict(dicCode = "edu_tra_lx")
48 private String eduTraLx;
49 /**
50 * 培训内容
51 */
52 @Excel(name = "培训内容", width = 15)
53 @ApiModelProperty(value = "培训内容")
54 private String eduTraContent;
55 /**
56 * 参与人数
57 */
58 @Excel(name = "参与人数", width = 15)
59 @ApiModelProperty(value = "参与人数")
60 private String joinCount;
61 /**
62 * 参与人员
63 */
64 @Excel(name = "参与人员", width = 15)
65 @ApiModelProperty(value = "参与人员")
66 private String joinUser;
67 /**
68 * 附件
69 */
70 @Excel(name = "附件", width = 15)
71 @ApiModelProperty(value = "附件")
72 private Object attachments;
73 /**
74 * 备注
75 */
76 @Excel(name = "备注", width = 15)
77 @ApiModelProperty(value = "备注")
78 private String remark;
79 /**
80 * 创建人
81 */
82 @Excel(name = "创建人", width = 15)
83 @ApiModelProperty(value = "创建人")
84 private String createBy;
85 /**
86 * 创建日期
87 */
88 @Excel(name = "创建日期", width = 20, format = "yyyy-MM-dd HH:mm:ss")
89 @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
90 @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
91 @ApiModelProperty(value = "创建日期")
92 private Date createTime;
93 /**
94 * 更新人
95 */
96 @Excel(name = "更新人", width = 15)
97 @ApiModelProperty(value = "更新人")
98 private String updateBy;
99 /**
100 * 更新日期
101 */
102 @Excel(name = "更新日期", width = 20, format = "yyyy-MM-dd HH:mm:ss")
103 @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
104 @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
105 @ApiModelProperty(value = "更新日期")
106 private Date updateTime;
107 /**
108 * 排序字段
109 */
110 @Excel(name = "排序字段", width = 15)
111 @ApiModelProperty(value = "排序字段")
112 private Integer orderNum;
113 /**
114 * 删除状态(0正常;1已删除)
115 */
116 @Excel(name = "删除状态(0正常;1已删除)", width = 15)
117 @ApiModelProperty(value = "删除状态(0正常;1已删除)")
118 private String delFlag;
119 }
1 package com.skua.modules.ajh.mapper;
2
3 import com.skua.modules.ajh.entity.AjhEduTrainingRecord;
4 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
6 /**
7 * 培训记录补录
8 */
9 public interface AjhEduTrainingRecordMapper extends BaseMapper<AjhEduTrainingRecord> {
10
11 }
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.ajh.mapper.AjhEduTrainingRecordMapper">
4
5 </mapper>
...\ No newline at end of file ...\ No newline at end of file
1 package com.skua.modules.ajh.service;
2
3 import com.skua.modules.ajh.entity.AjhEduTrainingRecord;
4 import com.baomidou.mybatisplus.extension.service.IService;
5
6 /**
7 * 培训记录补录
8 */
9 public interface IAjhEduTrainingRecordService extends IService<AjhEduTrainingRecord> {
10
11 }
1 package com.skua.modules.ajh.service.impl;
2
3 import com.skua.modules.ajh.entity.AjhEduTrainingRecord;
4 import com.skua.modules.ajh.mapper.AjhEduTrainingRecordMapper;
5 import com.skua.modules.ajh.service.IAjhEduTrainingRecordService;
6 import org.springframework.stereotype.Service;
7
8 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
9
10 /**
11 * 培训记录补录
12 */
13 @Service
14 public class AjhEduTrainingRecordServiceImpl extends ServiceImpl<AjhEduTrainingRecordMapper, AjhEduTrainingRecord> implements IAjhEduTrainingRecordService {
15
16 }
1 package com.skua.modules.safe.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
12 import cn.hutool.core.bean.BeanUtil;
13 import com.skua.core.api.vo.Result;
14 import com.skua.core.aspect.annotation.AutoLog;
15 import com.skua.core.context.BaseContextHandler;
16 import com.skua.core.query.QueryGenerator;
17 import com.skua.core.service.ISequenceService;
18 import com.skua.core.util.ConvertUtils;
19 import com.skua.modules.biz.IBusinessService;
20 import com.skua.modules.safe.dto.SafetyEnvironmentFeeDTO;
21 import com.skua.modules.safe.entity.SafetyEnvironmentFee;
22 import com.skua.modules.safe.service.ISafetyEnvironmentFeeService;
23
24 import java.util.Date;
25 import java.util.stream.Collectors;
26
27 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
28 import com.baomidou.mybatisplus.core.metadata.IPage;
29 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
30 import lombok.extern.slf4j.Slf4j;
31
32 import org.apache.commons.lang3.StringUtils;
33 import org.jeecgframework.poi.excel.ExcelImportUtil;
34 import org.jeecgframework.poi.excel.def.NormalExcelConstants;
35 import org.jeecgframework.poi.excel.entity.ExportParams;
36 import org.jeecgframework.poi.excel.entity.ImportParams;
37 import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
38
39 import org.springframework.beans.factory.annotation.Autowired;
40 import org.springframework.web.bind.annotation.*;
41 import org.springframework.web.multipart.MultipartFile;
42 import org.springframework.web.multipart.MultipartHttpServletRequest;
43 import org.springframework.web.servlet.ModelAndView;
44 import com.alibaba.fastjson.JSON;
45 import io.swagger.annotations.Api;
46 import io.swagger.annotations.ApiOperation;
47
48 /**
49 * <pre>
50 * 安全环保费用
51 * </pre>
52 *
53 * @author 开发者姓名
54 * @version V0.1, 开发时间
55 */
56 @Slf4j
57 @Api(tags = "安全环保费用")
58 @RestController
59 @RequestMapping("/safe/safetyEnvironmentFee")
60 public class SafetyEnvironmentFeeController {
61 @Autowired
62 private ISafetyEnvironmentFeeService safetyEnvironmentFeeService;
63 @Autowired
64 private IBusinessService businessService;
65
66 /**
67 * <pre>
68 * 分页列表查询
69 * </pre>
70 *
71 * @param safetyEnvironmentFee
72 * @param pageNo
73 * @param pageSize
74 * @param req
75 * @return
76 * @author 开发者姓名, 开发时间
77 * @Description: TODO(这里描述这个方法的需求变更情况)
78 */
79
80 @AutoLog(value = "安全环保费用-分页列表查询")
81 @ApiOperation(value = "安全环保费用-分页列表查询", notes = "安全环保费用-分页列表查询")
82 @GetMapping(value = "/list")
83 public Result<IPage<SafetyEnvironmentFee>> queryPageList(SafetyEnvironmentFee safetyEnvironmentFee,
84 @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
85 @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
86 HttpServletRequest req) {
87 Result<IPage<SafetyEnvironmentFee>> result = new Result<IPage<SafetyEnvironmentFee>>();
88 QueryWrapper<SafetyEnvironmentFee> queryWrapper = QueryGenerator.initQueryWrapper(safetyEnvironmentFee, req.getParameterMap());
89 Page<SafetyEnvironmentFee> page = new Page<SafetyEnvironmentFee>(pageNo, pageSize);
90 IPage<SafetyEnvironmentFee> pageList = safetyEnvironmentFeeService.page(page, queryWrapper);
91 result.setSuccess(true);
92 result.setResult(pageList);
93 return result;
94 }
95
96 @GetMapping(value = "/query/{type}")
97 public Result<Object> queryTypeCtrl(@PathVariable String type, SafetyEnvironmentFeeDTO safetyEnvironmentFeeDTO) {
98 Result<Object> result = new Result<>();
99 // 请求参数
100 String departId = safetyEnvironmentFeeDTO.getDepartId();
101 String feeDict = safetyEnvironmentFeeDTO.getFeeDict();
102 String feeType = safetyEnvironmentFeeDTO.getFeeType();
103 String startTime = safetyEnvironmentFeeDTO.getStartTime();
104 String endTime = safetyEnvironmentFeeDTO.getEndTime();
105 Long pageNo = safetyEnvironmentFeeDTO.getPageNo();
106 Long pageSize = safetyEnvironmentFeeDTO.getPageSize();
107 if (StringUtils.isEmpty(feeDict)) {
108 return Result.error("费用字典不能为空");
109 }
110 // 查询条件
111 QueryWrapper<SafetyEnvironmentFee> queryWrapper0 = new QueryWrapper<>();
112 queryWrapper0.eq(StringUtils.isNotEmpty(departId), "depart_id", departId)
113 .eq("fee_dict", feeDict)
114 .eq(StringUtils.isNotEmpty(feeType), "fee_type", feeType)
115 .ge(StringUtils.isNotEmpty(startTime), "fee_time", startTime)
116 .le(StringUtils.isNotEmpty(endTime), "fee_time", endTime);
117 if ("page".equals(type)) {
118 IPage<SafetyEnvironmentFee> safetyEnvironmentFeeIPage = safetyEnvironmentFeeService.page(new Page<>(pageNo, pageSize), queryWrapper0);
119 // 翻译
120 Map<String, String> sysDepartDictMap = businessService.dictMap("sys_depart", null);
121 Map<String, String> safetyEnvironmentProtectionFeeDictMap = businessService.dictMap("safety_environment_protection_fee", null);
122 Map<String, String> energyEnvironmentProtectionFeeDictMap = businessService.dictMap("energy_environment_protection_fee", null);
123 // 封装结果
124 IPage<Map<String, Object>> mapIPage = new Page<>(pageNo, pageSize);
125 mapIPage.setTotal(safetyEnvironmentFeeIPage.getTotal());
126 mapIPage.setRecords(safetyEnvironmentFeeIPage.getRecords().stream().map(item -> {
127 Map<String, Object> entityMap = BeanUtil.beanToMap(item);
128 entityMap.put("departName", sysDepartDictMap.get(item.getDepartId()));
129 // 安全环保费
130 if ("1".equals(feeDict)) {
131 entityMap.put("feeType_dictText", safetyEnvironmentProtectionFeeDictMap.get(item.getFeeType()));
132 } else if ("2".equals(feeDict)) {
133 // 节能环保费
134 entityMap.put("feeType_dictText", energyEnvironmentProtectionFeeDictMap.get(item.getFeeType()));
135 }
136 return entityMap;
137 }).collect(Collectors.toList()));
138 result.setResult(mapIPage);
139 } else if ("statistics".equals(type)) {
140 queryWrapper0.select("sum(fee_value) as feeValueSum");
141 Map<String, Object> queryMap0 = safetyEnvironmentFeeService.getMap(queryWrapper0);
142 result.setResult(queryMap0);
143 }
144 return result;
145 }
146
147 /**
148 * <pre>
149 * 添加
150 * </pre>
151 *
152 * @param safetyEnvironmentFee
153 * @return
154 * @author 开发者姓名, 开发时间
155 * @Description: TODO(这里描述这个方法的需求变更情况)
156 */
157 @AutoLog(value = "安全环保费用-添加")
158 @ApiOperation(value = "安全环保费用-添加", notes = "安全环保费用-添加")
159 @PostMapping(value = "/add")
160 public Result<SafetyEnvironmentFee> add(@RequestBody SafetyEnvironmentFee safetyEnvironmentFee) {
161 Result<SafetyEnvironmentFee> result = new Result<SafetyEnvironmentFee>();
162 try {
163 safetyEnvironmentFeeService.save(safetyEnvironmentFee);
164 result.success("添加成功!");
165 } catch (Exception e) {
166 log.error(e.getMessage(), e);
167 result.error500("操作失败");
168 }
169 return result;
170 }
171
172 /**
173 * <pre>
174 * 编辑
175 * </pre>
176 *
177 * @param safetyEnvironmentFee
178 * @return
179 * @author 开发者姓名, 开发时间
180 * @Description: TODO(这里描述这个方法的需求变更情况)
181 */
182 @AutoLog(value = "安全环保费用-编辑")
183 @ApiOperation(value = "安全环保费用-编辑", notes = "安全环保费用-编辑")
184 @PutMapping(value = "/edit")
185 public Result<SafetyEnvironmentFee> edit(@RequestBody SafetyEnvironmentFee safetyEnvironmentFee) {
186 Result<SafetyEnvironmentFee> result = new Result<SafetyEnvironmentFee>();
187 SafetyEnvironmentFee safetyEnvironmentFeeEntity = safetyEnvironmentFeeService.getById(safetyEnvironmentFee.getId());
188 if (safetyEnvironmentFeeEntity == null) {
189 result.error500("未找到对应实体");
190 } else {
191 boolean ok = safetyEnvironmentFeeService.updateById(safetyEnvironmentFee);
192 //TODO 返回false说明什么?
193 if (ok) {
194 result.success("修改成功!");
195 }
196 }
197
198 return result;
199 }
200
201 /**
202 * <pre>
203 * 通过id删除
204 * </pre>
205 *
206 * @param id
207 * @return
208 * @author 开发者姓名, 开发时间
209 * @Description: TODO(这里描述这个方法的需求变更情况)
210 */
211 @AutoLog(value = "安全环保费用-通过id删除")
212 @ApiOperation(value = "安全环保费用-通过id删除", notes = "安全环保费用-通过id删除")
213 @DeleteMapping(value = "/delete")
214 public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
215 try {
216 safetyEnvironmentFeeService.removeById(id);
217 } catch (Exception e) {
218 log.error("删除失败", e.getMessage());
219 return Result.error("删除失败!");
220 }
221 return Result.ok("删除成功!");
222 }
223
224 /**
225 * <pre>
226 * 批量删除
227 * </pre>
228 *
229 * @param ids
230 * @return
231 * @author 开发者姓名, 开发时间
232 * @Description: TODO(这里描述这个方法的需求变更情况)
233 */
234 @AutoLog(value = "安全环保费用-批量删除")
235 @ApiOperation(value = "安全环保费用-批量删除", notes = "安全环保费用-批量删除")
236 @DeleteMapping(value = "/deleteBatch")
237 public Result<SafetyEnvironmentFee> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
238 Result<SafetyEnvironmentFee> result = new Result<SafetyEnvironmentFee>();
239 if (ids == null || "".equals(ids.trim())) {
240 result.error500("参数不识别!");
241 } else {
242 this.safetyEnvironmentFeeService.removeByIds(Arrays.asList(ids.split(",")));
243 result.success("删除成功!");
244 }
245 return result;
246 }
247
248 /**
249 * <pre>
250 * 通过id查询
251 * </pre>
252 *
253 * @param id
254 * @return
255 * @author 开发者姓名, 开发时间
256 * @Description: TODO(这里描述这个方法的需求变更情况)
257 */
258 @AutoLog(value = "安全环保费用-通过id查询")
259 @ApiOperation(value = "安全环保费用-通过id查询", notes = "安全环保费用-通过id查询")
260 @GetMapping(value = "/queryById")
261 public Result<SafetyEnvironmentFee> queryById(@RequestParam(name = "id", required = true) String id) {
262 Result<SafetyEnvironmentFee> result = new Result<SafetyEnvironmentFee>();
263 SafetyEnvironmentFee safetyEnvironmentFee = safetyEnvironmentFeeService.getById(id);
264 if (safetyEnvironmentFee == null) {
265 result.error500("未找到对应实体");
266 } else {
267 result.setResult(safetyEnvironmentFee);
268 result.setSuccess(true);
269 }
270 return result;
271 }
272
273 /**
274 * <pre>
275 * 导出excel
276 * </pre>
277 *
278 * @param request
279 * @param response
280 * @return
281 * @author 开发者姓名, 开发时间
282 * @Description: TODO(这里描述这个方法的需求变更情况)
283 */
284
285 @RequestMapping(value = "/exportXls")
286 public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
287 // Step.1 组装查询条件
288 QueryWrapper<SafetyEnvironmentFee> queryWrapper = null;
289 try {
290 String paramsStr = request.getParameter("paramsStr");
291 if (ConvertUtils.isNotEmpty(paramsStr)) {
292 String deString = URLDecoder.decode(paramsStr, "UTF-8");
293 SafetyEnvironmentFee safetyEnvironmentFee = JSON.parseObject(deString, SafetyEnvironmentFee.class);
294 queryWrapper = QueryGenerator.initQueryWrapper(safetyEnvironmentFee, request.getParameterMap());
295 }
296 } catch (UnsupportedEncodingException e) {
297 e.printStackTrace();
298 }
299
300 //Step.2 AutoPoi 导出Excel
301 ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
302 List<SafetyEnvironmentFee> pageList = safetyEnvironmentFeeService.list(queryWrapper);
303 //导出文件名称
304 mv.addObject(NormalExcelConstants.FILE_NAME, "安全环保费用列表");
305 mv.addObject(NormalExcelConstants.CLASS, SafetyEnvironmentFee.class);
306 mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("安全环保费用列表数据", "导出人:Jeecg", "导出信息"));
307 mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
308 return mv;
309 }
310
311 /**
312 * <pre>
313 * 通过excel导入数据
314 * </pre>
315 *
316 * @param request
317 * @param response
318 * @return
319 * @author 开发者姓名, 开发时间
320 * @Description: TODO(这里描述这个方法的需求变更情况)
321 */
322 @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
323 public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
324 MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
325 Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
326 for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
327 MultipartFile file = entity.getValue();// 获取上传文件对象
328 ImportParams params = new ImportParams();
329 params.setTitleRows(2);
330 params.setHeadRows(1);
331 params.setNeedSave(true);
332 try {
333 List<SafetyEnvironmentFee> listSafetyEnvironmentFees = ExcelImportUtil.importExcel(file.getInputStream(), SafetyEnvironmentFee.class, params);
334 safetyEnvironmentFeeService.saveBatch(listSafetyEnvironmentFees);
335 return Result.ok("文件导入成功!数据行数:" + listSafetyEnvironmentFees.size());
336 } catch (Exception e) {
337 log.error(e.getMessage(), e);
338 return Result.error("文件导入失败:" + e.getMessage());
339 } finally {
340 try {
341 file.getInputStream().close();
342 } catch (IOException e) {
343 e.printStackTrace();
344 }
345 }
346 }
347 return Result.ok("文件导入失败!");
348 }
349
350 }
1 package com.skua.modules.safe.dto;
2
3 import com.skua.modules.safe.entity.SafetyEnvironmentFee;
4 import lombok.Data;
5
6 /**
7 * @Author:sonin
8 * @Date:2025/4/7 11:12
9 */
10 @Data
11 public class SafetyEnvironmentFeeDTO extends SafetyEnvironmentFee {
12
13 private Long pageNo = 1L;
14
15 private Long pageSize = 10L;
16
17 private String startTime;
18
19 private String endTime;
20 }
1 package com.skua.modules.safe.entity;
2
3 import java.util.Date;
4
5 import com.baomidou.mybatisplus.annotation.IdType;
6 import com.baomidou.mybatisplus.annotation.TableId;
7 import com.baomidou.mybatisplus.annotation.TableName;
8 import io.swagger.annotations.ApiModel;
9 import io.swagger.annotations.ApiModelProperty;
10 import lombok.Data;
11 import lombok.EqualsAndHashCode;
12 import lombok.experimental.Accessors;
13 import com.fasterxml.jackson.annotation.JsonFormat;
14 import org.springframework.format.annotation.DateTimeFormat;
15 import org.jeecgframework.poi.excel.annotation.Excel;
16
17 /**
18 * 安全环保费用
19 */
20 @Data
21 @TableName("safety_environment_fee")
22 @EqualsAndHashCode(callSuper = false)
23 @Accessors(chain = true)
24 @ApiModel(value = "safety_environment_fee对象", description = "安全环保费用")
25 public class SafetyEnvironmentFee {
26
27 /**
28 * 主键
29 */
30 @TableId(type = IdType.ID_WORKER_STR)
31 @ApiModelProperty(value = "主键")
32 private String id;
33 /**
34 * 水厂
35 */
36 @Excel(name = "水厂", width = 15)
37 @ApiModelProperty(value = "水厂")
38 private String departId;
39 /**
40 * 费用字典(安全环保费:1、节能环保费:2)
41 */
42 @Excel(name = "费用字典(安全环保费:1、节能环保费:2)", width = 15)
43 @ApiModelProperty(value = "费用字典(安全环保费:1、节能环保费:2)")
44 private String feeDict;
45 /**
46 * 费用类别属性
47 */
48 @Excel(name = "费用类别属性", width = 15)
49 @ApiModelProperty(value = "费用类别属性")
50 private String feeType;
51 /**
52 * 费用名称
53 */
54 @Excel(name = "费用名称", width = 15)
55 @ApiModelProperty(value = "费用名称")
56 private String feeName;
57 /**
58 * 时间(日)
59 */
60 @Excel(name = "时间(日)", width = 15)
61 @ApiModelProperty(value = "时间(日)")
62 private String feeTime;
63 /**
64 * 费用(元)
65 */
66 @Excel(name = "费用(元)", width = 15)
67 @ApiModelProperty(value = "费用(元)")
68 private String feeValue;
69 /**
70 * 是否预算内(是、否)
71 */
72 @Excel(name = "是否预算内(是、否)", width = 15)
73 @ApiModelProperty(value = "是否预算内(是、否)")
74 private String budgetFlag;
75 /**
76 * 用途
77 */
78 @Excel(name = "用途", width = 15)
79 @ApiModelProperty(value = "用途")
80 private String feeUsage;
81 /**
82 * 使用部门
83 */
84 @Excel(name = "使用部门", width = 15)
85 @ApiModelProperty(value = "使用部门")
86 private String useDepartment;
87 /**
88 * 备注
89 */
90 @Excel(name = "备注", width = 15)
91 @ApiModelProperty(value = "备注")
92 private String remark;
93 /**
94 * 创建人
95 */
96 @Excel(name = "创建人", width = 15)
97 @ApiModelProperty(value = "创建人")
98 private String createBy;
99 /**
100 * 创建日期
101 */
102 @Excel(name = "创建日期", width = 20, format = "yyyy-MM-dd HH:mm:ss")
103 @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
104 @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
105 @ApiModelProperty(value = "创建日期")
106 private Date createTime;
107 /**
108 * 更新人
109 */
110 @Excel(name = "更新人", width = 15)
111 @ApiModelProperty(value = "更新人")
112 private String updateBy;
113 /**
114 * 更新日期
115 */
116 @Excel(name = "更新日期", width = 20, format = "yyyy-MM-dd HH:mm:ss")
117 @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
118 @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
119 @ApiModelProperty(value = "更新日期")
120 private Date updateTime;
121 /**
122 * 排序字段
123 */
124 @Excel(name = "排序字段", width = 15)
125 @ApiModelProperty(value = "排序字段")
126 private Integer orderNum;
127 /**
128 * 删除状态(0正常;1已删除)
129 */
130 @Excel(name = "删除状态(0正常;1已删除)", width = 15)
131 @ApiModelProperty(value = "删除状态(0正常;1已删除)")
132 private String delFlag;
133 }
1 package com.skua.modules.safe.mapper;
2
3 import com.skua.modules.safe.entity.SafetyEnvironmentFee;
4 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
6 /**
7 * 安全环保费用
8 */
9 public interface SafetyEnvironmentFeeMapper extends BaseMapper<SafetyEnvironmentFee> {
10
11 }
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.safe.mapper.SafetyEnvironmentFeeMapper">
4
5 </mapper>
...\ No newline at end of file ...\ No newline at end of file
1 package com.skua.modules.safe.service;
2
3 import com.skua.modules.safe.entity.SafetyEnvironmentFee;
4 import com.baomidou.mybatisplus.extension.service.IService;
5
6 /**
7 * 安全环保费用
8 */
9 public interface ISafetyEnvironmentFeeService extends IService<SafetyEnvironmentFee> {
10
11 }
1 package com.skua.modules.safe.service.impl;
2
3 import com.skua.modules.safe.entity.SafetyEnvironmentFee;
4 import com.skua.modules.safe.mapper.SafetyEnvironmentFeeMapper;
5 import com.skua.modules.safe.service.ISafetyEnvironmentFeeService;
6 import org.springframework.stereotype.Service;
7
8 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
9
10 /**
11 * 安全环保费用
12 */
13 @Service
14 public class SafetyEnvironmentFeeServiceImpl extends ServiceImpl<SafetyEnvironmentFeeMapper, SafetyEnvironmentFee> implements ISafetyEnvironmentFeeService {
15
16 }
...@@ -571,6 +571,7 @@ public class EquipmentController { ...@@ -571,6 +571,7 @@ public class EquipmentController {
571 Map<String, String> maintenanceCycleUnitVal2KeyMap = key2ValueService.dictKey2Val("loop_unit", false); 571 Map<String, String> maintenanceCycleUnitVal2KeyMap = key2ValueService.dictKey2Val("loop_unit", false);
572 Map<String, String> installVal2KeyMap = key2ValueService.dictKey2Val("equipment-installWay", false); 572 Map<String, String> installVal2KeyMap = key2ValueService.dictKey2Val("equipment-installWay", false);
573 Map<String, String> healthVal2KeyMap = key2ValueService.dictKey2Val("equipment_health_status", false); 573 Map<String, String> healthVal2KeyMap = key2ValueService.dictKey2Val("equipment_health_status", false);
574 Map<String, String> sysStructDictMap = key2ValueService.dictKey2Val("sysStructDict", false);
574 // 封装结果 575 // 封装结果
575 Page<Map<String, Map<String, Object>>> resPage = new Page<>(equipmentDTO.getPageNo(), equipmentDTO.getPageSize()); 576 Page<Map<String, Map<String, Object>>> resPage = new Page<>(equipmentDTO.getPageNo(), equipmentDTO.getPageSize());
576 resPage.setTotal(mapPage.getTotal()); 577 resPage.setTotal(mapPage.getTotal());
...@@ -604,6 +605,8 @@ public class EquipmentController { ...@@ -604,6 +605,8 @@ public class EquipmentController {
604 resMap.get(keys[0]).put(keys[1] + "_dictText", installVal2KeyMap.get(ConvertUtils.getString(value))); 605 resMap.get(keys[0]).put(keys[1] + "_dictText", installVal2KeyMap.get(ConvertUtils.getString(value)));
605 } else if ("equipmentHealthStatus".equals(keys[1])) { 606 } else if ("equipmentHealthStatus".equals(keys[1])) {
606 resMap.get(keys[0]).put(keys[1] + "_dictText", healthVal2KeyMap.get(ConvertUtils.getString(value))); 607 resMap.get(keys[0]).put(keys[1] + "_dictText", healthVal2KeyMap.get(ConvertUtils.getString(value)));
608 } else if ("structures".equals(keys[1])) {
609 resMap.get(keys[0]).put(keys[1] + "_dictText", sysStructDictMap.get(ConvertUtils.getString(value)));
607 } 610 }
608 } 611 }
609 resPage.getRecords().add(resMap); 612 resPage.getRecords().add(resMap);
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
22 emt.real_start_time AS realStartTime, 22 emt.real_start_time AS realStartTime,
23 emt.real_end_time AS realEndTime, 23 emt.real_end_time AS realEndTime,
24 emt.working_hours AS workingHours, 24 emt.working_hours AS workingHours,
25 case when (emt.real_end_time &lt;= emt.end_time and emt.working_hours &lt;= emp.limit_duration) then 1 else 2 end AS complete_tag, 25 case when (emt.real_end_time &lt;= emt.end_time and CAST(emt.working_hours AS DECIMAL(10, 2)) &lt;= CAST(emp.limit_duration AS DECIMAL(10, 2))) then 1 else 2 end AS complete_tag,
26 emt.picture_url AS pictureUrl, 26 emt.picture_url AS pictureUrl,
27 emt.equipment_id AS equipmentId, 27 emt.equipment_id AS equipmentId,
28 emt.results_enforcement AS resultsEnforcement, 28 emt.results_enforcement AS resultsEnforcement,
......
...@@ -170,6 +170,7 @@ public class MybatisInterceptor implements Interceptor { ...@@ -170,6 +170,7 @@ public class MybatisInterceptor implements Interceptor {
170 || "com.skua.modules.safe.mapper.DangerLevelManageShareMapper.selectPage".equals(sqlId) 170 || "com.skua.modules.safe.mapper.DangerLevelManageShareMapper.selectPage".equals(sqlId)
171 || "com.skua.modules.edu.mapper.QuestionMapper.selectQuestionList".equals(sqlId)//试题列表 171 || "com.skua.modules.edu.mapper.QuestionMapper.selectQuestionList".equals(sqlId)//试题列表
172 || "com.skua.modules.edu.mapper.QuestionMapper.queryPageList".equals(sqlId)//试题分页 172 || "com.skua.modules.edu.mapper.QuestionMapper.queryPageList".equals(sqlId)//试题分页
173 || "com.skua.modules.safe.mapper.SafetyEnvironmentFeeMapper.selectPage".equals(sqlId)//安全环保费
173 ) { 174 ) {
174 log.debug("************************------sqlId------**************************" + sqlId); 175 log.debug("************************------sqlId------**************************" + sqlId);
175 return invocation.proceed(); 176 return invocation.proceed();
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!