feat(equipment): 添加设备维保记录导出功能
- 新增维保记录导出接口和相关服务方法 - 在 EquipmentMaintainTaskController 中添加 exportXls 方法处理导出请求 - 在 EquipmentMaintainTaskServiceImpl 中实现 getXlsList 方法获取导出数据 - 更新相关实体类和 VO 类以支持新功能
正在显示
16 个修改的文件
包含
236 行增加
和
10 行删除
... | @@ -202,7 +202,7 @@ public class EquipmentInController { | ... | @@ -202,7 +202,7 @@ public class EquipmentInController { |
202 | if ("departIdName".equals(targetFieldName) && srcFieldVal != null) { | 202 | if ("departIdName".equals(targetFieldName) && srcFieldVal != null) { |
203 | return sysDepartVal2KeyMap.getOrDefault(srcFieldVal, ""); | 203 | return sysDepartVal2KeyMap.getOrDefault(srcFieldVal, ""); |
204 | } else if ("sparepartName".equals(targetFieldName)) { | 204 | } else if ("sparepartName".equals(targetFieldName)) { |
205 | String sql2 = "select es.sparepart_name as sparepartName ,es.sparepart_type from equipment_sparepart_supplies as es " + | 205 | String sql2 = "select es.sparepart_name as sparepartName ,es.sparepart_type,es.specification from equipment_sparepart_supplies as es " + |
206 | "inner join (select sparepart_id from equipment_in_child where in_id = '" + srcFieldVal + "') as tmp on es.id = tmp.sparepart_id"; | 206 | "inner join (select sparepart_id from equipment_in_child where in_id = '" + srcFieldVal + "') as tmp on es.id = tmp.sparepart_id"; |
207 | List<Map<String, Object>> sparePartList = iCommonSqlService.queryForList(sql2); | 207 | List<Map<String, Object>> sparePartList = iCommonSqlService.queryForList(sql2); |
208 | Map<String, Integer> name2CountMap = new HashMap<>(); | 208 | Map<String, Integer> name2CountMap = new HashMap<>(); |
... | @@ -217,6 +217,22 @@ public class EquipmentInController { | ... | @@ -217,6 +217,22 @@ public class EquipmentInController { |
217 | stringBuilder.append(",").append(item.getKey()); | 217 | stringBuilder.append(",").append(item.getKey()); |
218 | } | 218 | } |
219 | return stringBuilder.toString().replaceFirst(",", ""); | 219 | return stringBuilder.toString().replaceFirst(",", ""); |
220 | } else if ("specification_dictText".equals(targetFieldName)) { | ||
221 | String sql3 = "select es.sparepart_name as sparepartName ,es.sparepart_type,es.specification from equipment_sparepart_supplies as es " + | ||
222 | "inner join (select sparepart_id from equipment_in_child where in_id = '" + srcFieldVal + "') as tmp on es.id = tmp.sparepart_id"; | ||
223 | List<Map<String, Object>> spareCodeList = iCommonSqlService.queryForList(sql3); | ||
224 | Map<String, Integer> code2CountMap = new HashMap<>(); | ||
225 | if (spareCodeList != null && !spareCodeList.isEmpty() && spareCodeList.get(0) != null) { | ||
226 | for (Map<String, Object> it : spareCodeList) { | ||
227 | String code = "" + it.get("specification"); | ||
228 | code2CountMap.put(code, code2CountMap.getOrDefault(code, 0) + 1); | ||
229 | } | ||
230 | } | ||
231 | StringBuilder stringBuilder = new StringBuilder(); | ||
232 | for (Map.Entry<String, Integer> item : code2CountMap.entrySet()) { | ||
233 | stringBuilder.append(",").append(item.getKey()); | ||
234 | } | ||
235 | return stringBuilder.toString().replaceFirst(",", ""); | ||
220 | } else if ("useByName".equals(targetFieldName)) { | 236 | } else if ("useByName".equals(targetFieldName)) { |
221 | return sysUserVal2KeyMap.getOrDefault(srcFieldVal, ""); | 237 | return sysUserVal2KeyMap.getOrDefault(srcFieldVal, ""); |
222 | } else if ("suppliesWarehouseId_dictText".equals(targetFieldName)) { | 238 | } else if ("suppliesWarehouseId_dictText".equals(targetFieldName)) { |
... | @@ -229,6 +245,9 @@ public class EquipmentInController { | ... | @@ -229,6 +245,9 @@ public class EquipmentInController { |
229 | if (StringUtils.isNotEmpty(equipmentInDTO.getSparepartName())) { | 245 | if (StringUtils.isNotEmpty(equipmentInDTO.getSparepartName())) { |
230 | equipmentInVOList = equipmentInVOList.stream().filter(item -> item.getSparepartName().contains(equipmentInDTO.getSparepartName())).collect(Collectors.toList()); | 246 | equipmentInVOList = equipmentInVOList.stream().filter(item -> item.getSparepartName().contains(equipmentInDTO.getSparepartName())).collect(Collectors.toList()); |
231 | } | 247 | } |
248 | if (StringUtils.isNotEmpty(equipmentInDTO.getSpecification())) { | ||
249 | equipmentInVOList = equipmentInVOList.stream().filter(item -> item.getSpecification().contains(equipmentInDTO.getSpecification())).collect(Collectors.toList()); | ||
250 | } | ||
232 | voPage.setTotal(page.getTotal()); | 251 | voPage.setTotal(page.getTotal()); |
233 | voPage.setRecords(equipmentInVOList); | 252 | voPage.setRecords(equipmentInVOList); |
234 | result.setResult(voPage); | 253 | result.setResult(voPage); | ... | ... |
... | @@ -202,6 +202,21 @@ public class EquipmentOutController { | ... | @@ -202,6 +202,21 @@ public class EquipmentOutController { |
202 | stringBuilder.append(",").append(item.getKey()); | 202 | stringBuilder.append(",").append(item.getKey()); |
203 | } | 203 | } |
204 | return stringBuilder.toString().replaceFirst(",", ""); | 204 | return stringBuilder.toString().replaceFirst(",", ""); |
205 | } else if ("specification".equals(targetFieldName)) { | ||
206 | String sql2 = "select es.sparepart_name as sparepartName from equipment_sparepart_supplies as es inner join (select sparepart_id from equipment_out_child where out_id = '" + srcFieldVal + "') as tmp on es.id = tmp.sparepart_id"; | ||
207 | List<Map<String, Object>> sparePartList = iCommonSqlService.queryForList(sql2); | ||
208 | Map<String, Integer> code2CountMap = new HashMap<>(); | ||
209 | if (sparePartList != null && !sparePartList.isEmpty() && sparePartList.get(0) != null) { | ||
210 | for (Map<String, Object> it : sparePartList) { | ||
211 | String name = "" + it.get("specification"); | ||
212 | code2CountMap.put(name, code2CountMap.getOrDefault(name, 0) + 1); | ||
213 | } | ||
214 | } | ||
215 | StringBuilder stringBuilder = new StringBuilder(); | ||
216 | for (Map.Entry<String, Integer> item : code2CountMap.entrySet()) { | ||
217 | stringBuilder.append(",").append(item.getKey()); | ||
218 | } | ||
219 | return stringBuilder.toString().replaceFirst(",", ""); | ||
205 | } else if ("useByName".equals(targetFieldName)) { | 220 | } else if ("useByName".equals(targetFieldName)) { |
206 | return sysUserVal2KeyMap.getOrDefault(srcFieldVal, ""); | 221 | return sysUserVal2KeyMap.getOrDefault(srcFieldVal, ""); |
207 | } else if ("departCode_dictText".equals(targetFieldName)) { | 222 | } else if ("departCode_dictText".equals(targetFieldName)) { |
... | @@ -214,6 +229,9 @@ public class EquipmentOutController { | ... | @@ -214,6 +229,9 @@ public class EquipmentOutController { |
214 | if (StringUtils.isNotEmpty(equipmentOutDTO.getSparepartName())) { | 229 | if (StringUtils.isNotEmpty(equipmentOutDTO.getSparepartName())) { |
215 | equipmentOutVOList = equipmentOutVOList.stream().filter(item -> item.getSparepartName().contains(equipmentOutDTO.getSparepartName())).collect(Collectors.toList()); | 230 | equipmentOutVOList = equipmentOutVOList.stream().filter(item -> item.getSparepartName().contains(equipmentOutDTO.getSparepartName())).collect(Collectors.toList()); |
216 | } | 231 | } |
232 | if (StringUtils.isNotEmpty(equipmentOutDTO.getSpecification())) { | ||
233 | equipmentOutVOList = equipmentOutVOList.stream().filter(item -> item.getSpecification().contains(equipmentOutDTO.getSpecification())).collect(Collectors.toList()); | ||
234 | } | ||
217 | voPage.setRecords(equipmentOutVOList); | 235 | voPage.setRecords(equipmentOutVOList); |
218 | result.setResult(voPage); | 236 | result.setResult(voPage); |
219 | result.setSuccess(true); | 237 | result.setSuccess(true); | ... | ... |
... | @@ -4,9 +4,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage; | ... | @@ -4,9 +4,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage; |
4 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 4 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
5 | import com.skua.core.api.vo.Result; | 5 | import com.skua.core.api.vo.Result; |
6 | import com.skua.core.aspect.annotation.AutoLog; | 6 | import com.skua.core.aspect.annotation.AutoLog; |
7 | import com.skua.modules.equipment.dto.EquipmentMaintainTaskDTO; | ||
7 | import com.skua.modules.equipment.service.IEquipmentMaintainTaskService; | 8 | import com.skua.modules.equipment.service.IEquipmentMaintainTaskService; |
8 | import com.skua.modules.equipment.service.IEquipmentRepairService; | 9 | import com.skua.modules.equipment.service.IEquipmentRepairService; |
9 | import com.skua.modules.equipment.vo.EquipmentMaintainTaskForm; | 10 | import com.skua.modules.equipment.vo.EquipmentMaintainTaskForm; |
11 | import com.skua.modules.equipment.vo.EquipmentMaintainTaskVO; | ||
10 | import com.skua.modules.equipment.vo.EquipmentRepairForm; | 12 | import com.skua.modules.equipment.vo.EquipmentRepairForm; |
11 | import com.skua.modules.system.service.ISysDepartService; | 13 | import com.skua.modules.system.service.ISysDepartService; |
12 | import com.skua.tool.util.JSUtils; | 14 | import com.skua.tool.util.JSUtils; |
... | @@ -14,12 +16,18 @@ import io.swagger.annotations.Api; | ... | @@ -14,12 +16,18 @@ import io.swagger.annotations.Api; |
14 | import io.swagger.annotations.ApiOperation; | 16 | import io.swagger.annotations.ApiOperation; |
15 | import lombok.extern.slf4j.Slf4j; | 17 | import lombok.extern.slf4j.Slf4j; |
16 | import org.apache.commons.lang.StringUtils; | 18 | import org.apache.commons.lang.StringUtils; |
19 | import org.jeecgframework.poi.excel.def.NormalExcelConstants; | ||
20 | import org.jeecgframework.poi.excel.entity.ExportParams; | ||
21 | import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; | ||
17 | import org.springframework.beans.factory.annotation.Autowired; | 22 | import org.springframework.beans.factory.annotation.Autowired; |
18 | import org.springframework.web.bind.annotation.GetMapping; | 23 | import org.springframework.web.bind.annotation.GetMapping; |
19 | import org.springframework.web.bind.annotation.RequestMapping; | 24 | import org.springframework.web.bind.annotation.RequestMapping; |
20 | import org.springframework.web.bind.annotation.RequestParam; | 25 | import org.springframework.web.bind.annotation.RequestParam; |
21 | import org.springframework.web.bind.annotation.RestController; | 26 | import org.springframework.web.bind.annotation.RestController; |
27 | import org.springframework.web.servlet.ModelAndView; | ||
28 | |||
22 | import javax.servlet.http.HttpServletRequest; | 29 | import javax.servlet.http.HttpServletRequest; |
30 | import java.util.List; | ||
23 | 31 | ||
24 | /** | 32 | /** |
25 | * 维修维护报表 | 33 | * 维修维护报表 |
... | @@ -80,4 +88,40 @@ public class EquipmentRepairReportController { | ... | @@ -80,4 +88,40 @@ public class EquipmentRepairReportController { |
80 | result.setResult(pageList); | 88 | result.setResult(pageList); |
81 | return result; | 89 | return result; |
82 | } | 90 | } |
91 | |||
92 | @RequestMapping(value = "/maintain/exportXls") | ||
93 | public ModelAndView maintainExportXls(EquipmentMaintainTaskForm maintainTaskForm) { | ||
94 | if(StringUtils.isNotEmpty(maintainTaskForm.getDepartId())){ | ||
95 | maintainTaskForm.setDepartIds(JSUtils.quoteEach(departService.getChildDepartId(maintainTaskForm.getDepartId()),",") ); | ||
96 | } | ||
97 | List<EquipmentMaintainTaskForm> pageList = maintainTaskService.queryMaintainTaskFormByList(maintainTaskForm); | ||
98 | //Step.2 AutoPoi 导出Excel | ||
99 | ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); | ||
100 | //导出文件名称 | ||
101 | mv.addObject(NormalExcelConstants.FILE_NAME, "维保记录列表"); | ||
102 | mv.addObject(NormalExcelConstants.CLASS, EquipmentMaintainTaskForm.class); | ||
103 | mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("维保记录列表列表数据", "导出人:", "Sheet1")); | ||
104 | mv.addObject(NormalExcelConstants.DATA_LIST, pageList); | ||
105 | return mv; | ||
106 | } | ||
107 | |||
108 | @RequestMapping(value = "/repair/exportXls") | ||
109 | public ModelAndView repairExportXls(EquipmentRepairForm equipmentRepairForm) { | ||
110 | if(StringUtils.isNotEmpty(equipmentRepairForm.getFinishFlag())){ | ||
111 | equipmentRepairForm.setFinishFlag(JSUtils.quoteEach(equipmentRepairForm.getFinishFlag(),",")); | ||
112 | } | ||
113 | if(StringUtils.isNotEmpty(equipmentRepairForm.getDepartId())){ | ||
114 | equipmentRepairForm.setDepartIds(JSUtils.quoteEach(departService.getChildDepartId(equipmentRepairForm.getDepartId()),",") ); | ||
115 | } | ||
116 | equipmentRepairForm.setDepartId(null); | ||
117 | List<EquipmentRepairForm> pageList = equipmentRepairService.queryRepairFormList(equipmentRepairForm); | ||
118 | //Step.2 AutoPoi 导出Excel | ||
119 | ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); | ||
120 | //导出文件名称 | ||
121 | mv.addObject(NormalExcelConstants.FILE_NAME, "维修记录列表"); | ||
122 | mv.addObject(NormalExcelConstants.CLASS, EquipmentRepairForm.class); | ||
123 | mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("维修记录列表列表数据", "导出人:", "Sheet1")); | ||
124 | mv.addObject(NormalExcelConstants.DATA_LIST, pageList); | ||
125 | return mv; | ||
126 | } | ||
83 | } | 127 | } | ... | ... |
1 | package com.skua.modules.equipment.controller.web; | 1 | package com.skua.modules.equipment.controller.web; |
2 | 2 | ||
3 | import java.io.UnsupportedEncodingException; | ||
4 | import java.net.URLDecoder; | ||
3 | import java.util.*; | 5 | import java.util.*; |
4 | 6 | ||
7 | import com.alibaba.fastjson.JSON; | ||
8 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||
9 | import com.skua.core.query.QueryGenerator; | ||
5 | import com.skua.modules.equipment.entity.*; | 10 | import com.skua.modules.equipment.entity.*; |
6 | import org.apache.commons.lang.StringUtils; | 11 | import org.apache.commons.lang3.StringUtils; |
12 | import org.jeecgframework.poi.excel.def.NormalExcelConstants; | ||
13 | import org.jeecgframework.poi.excel.entity.ExportParams; | ||
14 | import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; | ||
7 | import org.springframework.beans.factory.annotation.Autowired; | 15 | import org.springframework.beans.factory.annotation.Autowired; |
8 | import org.springframework.web.bind.annotation.*; | 16 | import org.springframework.web.bind.annotation.*; |
9 | 17 | ||
... | @@ -21,6 +29,10 @@ import com.skua.tool.query.WrapperFactory; | ... | @@ -21,6 +29,10 @@ import com.skua.tool.query.WrapperFactory; |
21 | import io.swagger.annotations.Api; | 29 | import io.swagger.annotations.Api; |
22 | import io.swagger.annotations.ApiOperation; | 30 | import io.swagger.annotations.ApiOperation; |
23 | import lombok.extern.slf4j.Slf4j; | 31 | import lombok.extern.slf4j.Slf4j; |
32 | import org.springframework.web.servlet.ModelAndView; | ||
33 | |||
34 | import javax.servlet.http.HttpServletRequest; | ||
35 | import javax.servlet.http.HttpServletResponse; | ||
24 | 36 | ||
25 | @Slf4j | 37 | @Slf4j |
26 | @Api(tags = "设备管理/设备保养/保养任务") | 38 | @Api(tags = "设备管理/设备保养/保养任务") |
... | @@ -147,4 +159,17 @@ public class EquipmentMaintainTaskController { | ... | @@ -147,4 +159,17 @@ public class EquipmentMaintainTaskController { |
147 | return result; | 159 | return result; |
148 | } | 160 | } |
149 | 161 | ||
162 | @RequestMapping(value = "/exportXls") | ||
163 | public ModelAndView exportXls(EquipmentMaintainTaskDTO equipmentMaintainTask) { | ||
164 | List<EquipmentMaintainTaskVO> pageList = iEquipmentMaintainTaskService.getXlsList(equipmentMaintainTask); | ||
165 | //Step.2 AutoPoi 导出Excel | ||
166 | ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); | ||
167 | //导出文件名称 | ||
168 | mv.addObject(NormalExcelConstants.FILE_NAME, "维保记录列表"); | ||
169 | mv.addObject(NormalExcelConstants.CLASS, EquipmentMaintainTaskVO.class); | ||
170 | mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("维保记录列表列表数据", "导出人:", "Sheet1")); | ||
171 | mv.addObject(NormalExcelConstants.DATA_LIST, pageList); | ||
172 | return mv; | ||
173 | } | ||
174 | |||
150 | } | 175 | } | ... | ... |
... | @@ -148,6 +148,10 @@ public class EquipmentIn { | ... | @@ -148,6 +148,10 @@ public class EquipmentIn { |
148 | @Dict(dicCode="departCode") | 148 | @Dict(dicCode="departCode") |
149 | private String purchaseDepart; | 149 | private String purchaseDepart; |
150 | 150 | ||
151 | @ApiModelProperty(value = "规格型号") | ||
152 | @BeanAnno(targetFieldName = "specification_dictText") | ||
153 | private String specification; | ||
154 | |||
151 | public EquipmentIn( ) { | 155 | public EquipmentIn( ) { |
152 | } | 156 | } |
153 | 157 | ... | ... |
... | @@ -140,4 +140,8 @@ public class EquipmentOut { | ... | @@ -140,4 +140,8 @@ public class EquipmentOut { |
140 | @ApiModelProperty(value = "库存更新时间") | 140 | @ApiModelProperty(value = "库存更新时间") |
141 | private Date inventoryUpdateTime; | 141 | private Date inventoryUpdateTime; |
142 | 142 | ||
143 | @ApiModelProperty(value = "规格型号") | ||
144 | @BeanAnno(targetFieldName = "specification") | ||
145 | private String specification; | ||
146 | |||
143 | } | 147 | } | ... | ... |
... | @@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ... | @@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
8 | import com.baomidou.mybatisplus.extension.service.IService; | 8 | import com.baomidou.mybatisplus.extension.service.IService; |
9 | import com.skua.modules.equipment.dto.EquipmentMaintainTaskDTO; | 9 | import com.skua.modules.equipment.dto.EquipmentMaintainTaskDTO; |
10 | import com.skua.modules.equipment.entity.EquipmentMaintainTask; | 10 | import com.skua.modules.equipment.entity.EquipmentMaintainTask; |
11 | import com.skua.modules.equipment.entity.EquipmentRepairResponse; | ||
11 | import com.skua.modules.equipment.vo.EquipmentMaintainTaskCalendarVO; | 12 | import com.skua.modules.equipment.vo.EquipmentMaintainTaskCalendarVO; |
12 | import com.skua.modules.equipment.vo.EquipmentMaintainTaskForm; | 13 | import com.skua.modules.equipment.vo.EquipmentMaintainTaskForm; |
13 | import com.skua.modules.equipment.vo.EquipmentMaintainTaskVO; | 14 | import com.skua.modules.equipment.vo.EquipmentMaintainTaskVO; |
... | @@ -59,4 +60,6 @@ public interface IEquipmentMaintainTaskService extends IService<EquipmentMaintai | ... | @@ -59,4 +60,6 @@ public interface IEquipmentMaintainTaskService extends IService<EquipmentMaintai |
59 | List<EquipmentMaintainTaskForm> queryMaintainTaskFormByList( EquipmentMaintainTaskForm maintainTaskForm); | 60 | List<EquipmentMaintainTaskForm> queryMaintainTaskFormByList( EquipmentMaintainTaskForm maintainTaskForm); |
60 | 61 | ||
61 | List<Map<String, Object>> getList(String startTime, String endTime); | 62 | List<Map<String, Object>> getList(String startTime, String endTime); |
63 | |||
64 | List<EquipmentMaintainTaskVO> getXlsList(EquipmentMaintainTaskDTO equipmentMaintainTask); | ||
62 | } | 65 | } | ... | ... |
... | @@ -390,6 +390,43 @@ public class EquipmentMaintainTaskServiceImpl extends ServiceImpl<EquipmentMaint | ... | @@ -390,6 +390,43 @@ public class EquipmentMaintainTaskServiceImpl extends ServiceImpl<EquipmentMaint |
390 | } | 390 | } |
391 | 391 | ||
392 | @Override | 392 | @Override |
393 | public List<EquipmentMaintainTaskVO> getXlsList(EquipmentMaintainTaskDTO equipmentMaintainTask) { | ||
394 | |||
395 | List<EquipmentMaintainTaskVO> equipmentMaintainTasks = new ArrayList<>(); | ||
396 | // 查询前先改变当前时间之前的任务改变状态为进行中 | ||
397 | //baseMapper.updateResultsEnforcement(new Date(), 1, 2, ""); | ||
398 | String userCode = BaseContextHandler.getUserId(); | ||
399 | if (null != equipmentMaintainTask.getType() && equipmentMaintainTask.getType() == 0) { | ||
400 | //type=0表示保养任务查询,type=1表示保养记录查询 | ||
401 | equipmentMaintainTask.setPlanArrangerId(userCode); | ||
402 | equipmentMaintainTasks = baseMapper.queryCustomPageList(null, equipmentMaintainTask); | ||
403 | }else{ | ||
404 | if (null == equipmentMaintainTask.getType()) { | ||
405 | if(ConvertUtils.isEmpty(equipmentMaintainTask.getDepartId())){ | ||
406 | equipmentMaintainTask.setDepartId(BaseContextHandler.getDeparts()); | ||
407 | } | ||
408 | equipmentMaintainTask.setResultsEnforcement(1); | ||
409 | equipmentMaintainTasks = baseMapper.queryPageList(null, equipmentMaintainTask); | ||
410 | }else{ | ||
411 | equipmentMaintainTasks = baseMapper.queryCustomPageList(null, equipmentMaintainTask); | ||
412 | } | ||
413 | } | ||
414 | equipmentMaintainTasks.forEach(e -> { | ||
415 | e.setCycleUnit(UnitUtils.getCycleUnitName(e.getCycleUnit())); | ||
416 | //状态<=2的时候,执行人 具有操作权限,其他人查看权限 | ||
417 | if(e.getResultsEnforcement()<=2&&userCode.equals(e.getPlanArrangerId())) { | ||
418 | e.setCurrentState(2); | ||
419 | } | ||
420 | //状态=3的时候,验收人具有操作权限,其他人查看权限 | ||
421 | if(e.getResultsEnforcement()==3&&userCode.equals(e.getPlanAccepterId())) { | ||
422 | e.setCurrentState(3); | ||
423 | } | ||
424 | }); | ||
425 | |||
426 | return equipmentMaintainTasks; | ||
427 | } | ||
428 | |||
429 | @Override | ||
393 | public boolean updateResultsEnforcement(String id) { | 430 | public boolean updateResultsEnforcement(String id) { |
394 | baseMapper.updateResultsEnforcement(new Date(), 1, 2, id); | 431 | baseMapper.updateResultsEnforcement(new Date(), 1, 2, id); |
395 | return true; | 432 | return true; | ... | ... |
... | @@ -20,4 +20,6 @@ public class EquipmentInVO extends EquipmentIn { | ... | @@ -20,4 +20,6 @@ public class EquipmentInVO extends EquipmentIn { |
20 | @Excel(name = "入库备品备件", width = 15) | 20 | @Excel(name = "入库备品备件", width = 15) |
21 | private String sparepartName; | 21 | private String sparepartName; |
22 | 22 | ||
23 | private String specification_dictText; | ||
24 | |||
23 | } | 25 | } | ... | ... |
... | @@ -30,7 +30,6 @@ public class EquipmentRepairForm { | ... | @@ -30,7 +30,6 @@ public class EquipmentRepairForm { |
30 | @ApiModelProperty(value = "机构名称") | 30 | @ApiModelProperty(value = "机构名称") |
31 | private java.lang.String departName; | 31 | private java.lang.String departName; |
32 | /**设备id*/ | 32 | /**设备id*/ |
33 | @Excel(name = "设备id", width = 15) | ||
34 | @ApiModelProperty(value = "设备id") | 33 | @ApiModelProperty(value = "设备id") |
35 | private String infoId; | 34 | private String infoId; |
36 | 35 | ||
... | @@ -42,7 +41,6 @@ public class EquipmentRepairForm { | ... | @@ -42,7 +41,6 @@ public class EquipmentRepairForm { |
42 | @ApiModelProperty(value = "设备分类名称") | 41 | @ApiModelProperty(value = "设备分类名称") |
43 | private String equipmentCategory; | 42 | private String equipmentCategory; |
44 | 43 | ||
45 | @Excel(name = "办结标记,yes办结", width = 15) | ||
46 | @ApiModelProperty(value = "办结标记,yes办结") | 44 | @ApiModelProperty(value = "办结标记,yes办结") |
47 | @Dict(dicCode = "equipment_repair_state") | 45 | @Dict(dicCode = "equipment_repair_state") |
48 | private java.lang.String finishFlag; | 46 | private java.lang.String finishFlag; | ... | ... |
1 | package com.skua.modules.system.controller; | 1 | package com.skua.modules.system.controller; |
2 | 2 | ||
3 | import java.text.SimpleDateFormat; | ||
3 | import java.util.Arrays; | 4 | import java.util.Arrays; |
4 | import java.util.List; | 5 | import java.util.List; |
5 | import java.util.Map; | 6 | import java.util.Map; |
... | @@ -15,13 +16,18 @@ import com.skua.core.query.QueryGenerator; | ... | @@ -15,13 +16,18 @@ import com.skua.core.query.QueryGenerator; |
15 | import com.skua.core.service.ISequenceService; | 16 | import com.skua.core.service.ISequenceService; |
16 | import com.skua.core.util.ConvertUtils; | 17 | import com.skua.core.util.ConvertUtils; |
17 | import com.skua.modules.system.entity.SysFactoryUserData; | 18 | import com.skua.modules.system.entity.SysFactoryUserData; |
19 | import com.skua.modules.system.entity.SysFactoryUserInfo; | ||
20 | import com.skua.modules.system.entity.SysUser; | ||
18 | import com.skua.modules.system.service.ISysFactoryUserDataService; | 21 | import com.skua.modules.system.service.ISysFactoryUserDataService; |
19 | import java.util.Date; | 22 | import java.util.Date; |
20 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 23 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
21 | import com.baomidou.mybatisplus.core.metadata.IPage; | 24 | import com.baomidou.mybatisplus.core.metadata.IPage; |
22 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 25 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
26 | import com.skua.modules.system.service.ISysFactoryUserInfoService; | ||
27 | import com.skua.modules.system.service.ISysUserService; | ||
23 | import lombok.extern.slf4j.Slf4j; | 28 | import lombok.extern.slf4j.Slf4j; |
24 | 29 | ||
30 | import org.apache.commons.lang.StringUtils; | ||
25 | import org.jeecgframework.poi.excel.ExcelImportUtil; | 31 | import org.jeecgframework.poi.excel.ExcelImportUtil; |
26 | import org.jeecgframework.poi.excel.def.NormalExcelConstants; | 32 | import org.jeecgframework.poi.excel.def.NormalExcelConstants; |
27 | import org.jeecgframework.poi.excel.entity.ExportParams; | 33 | import org.jeecgframework.poi.excel.entity.ExportParams; |
... | @@ -47,6 +53,14 @@ import io.swagger.annotations.ApiOperation; | ... | @@ -47,6 +53,14 @@ import io.swagger.annotations.ApiOperation; |
47 | public class SysFactoryUserDataController { | 53 | public class SysFactoryUserDataController { |
48 | @Autowired | 54 | @Autowired |
49 | private ISysFactoryUserDataService sysFactoryUserDataService; | 55 | private ISysFactoryUserDataService sysFactoryUserDataService; |
56 | @Autowired | ||
57 | private ISysFactoryUserInfoService sysFactoryUserInfoService; | ||
58 | @Autowired | ||
59 | private ISequenceService sequenceService; | ||
60 | @Autowired | ||
61 | private ISysUserService sysUserService; | ||
62 | // 定义日期格式 | ||
63 | private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | ||
50 | 64 | ||
51 | /** | 65 | /** |
52 | * <pre> | 66 | * <pre> |
... | @@ -92,14 +106,49 @@ public class SysFactoryUserDataController { | ... | @@ -92,14 +106,49 @@ public class SysFactoryUserDataController { |
92 | public Result<SysFactoryUserData> add(@RequestBody SysFactoryUserData sysFactoryUserData) { | 106 | public Result<SysFactoryUserData> add(@RequestBody SysFactoryUserData sysFactoryUserData) { |
93 | Result<SysFactoryUserData> result = new Result<SysFactoryUserData>(); | 107 | Result<SysFactoryUserData> result = new Result<SysFactoryUserData>(); |
94 | try { | 108 | try { |
95 | sysFactoryUserDataService.save(sysFactoryUserData); | 109 | if(sysFactoryUserData.getUserId()!=null&&sysFactoryUserData.getDepartId()!=null){ |
96 | result.success("添加成功!"); | 110 | //同步修改主信息表 |
111 | sysFactoryUserData = syncSaveOrUpdate(sysFactoryUserData); | ||
112 | sysFactoryUserDataService.save(sysFactoryUserData); | ||
113 | result.success("添加成功!"); | ||
114 | }else{ | ||
115 | result.error500("未选择用户或机构"); | ||
116 | } | ||
97 | } catch (Exception e) { | 117 | } catch (Exception e) { |
98 | log.error(e.getMessage(),e); | 118 | log.error(e.getMessage(),e); |
99 | result.error500("操作失败"); | 119 | result.error500("操作失败"); |
100 | } | 120 | } |
101 | return result; | 121 | return result; |
102 | } | 122 | } |
123 | |||
124 | //同步修改主信息表 | ||
125 | private SysFactoryUserData syncSaveOrUpdate(SysFactoryUserData sysFactoryUserData) { | ||
126 | SysFactoryUserInfo factoryUserInfo = sysFactoryUserInfoService.getFactoryUserInfoByUserId(sysFactoryUserData.getUserId()); | ||
127 | if(factoryUserInfo!=null){ | ||
128 | sysFactoryUserData.setBaseId(factoryUserInfo.getId()); | ||
129 | }else{ | ||
130 | String baseId = String.valueOf(sequenceService.nextId()); | ||
131 | factoryUserInfo = new SysFactoryUserInfo(); | ||
132 | factoryUserInfo.setId(baseId); | ||
133 | SysUser user = sysUserService.getById(sysFactoryUserData.getUserId()); | ||
134 | if(ConvertUtils.isNotEmpty(user)){ | ||
135 | factoryUserInfo.setUserName(user.getRealname()); | ||
136 | factoryUserInfo.setEmail(user.getEmail()); | ||
137 | factoryUserInfo.setTelephone(user.getPhone()); | ||
138 | if(ConvertUtils.isNotEmpty(user.getSex())){ | ||
139 | factoryUserInfo.setSex(user.getSex().toString()); | ||
140 | } | ||
141 | if(ConvertUtils.isNotEmpty(user.getBirthday())){ | ||
142 | String birthday = sdf.format(user.getBirthday()); | ||
143 | factoryUserInfo.setUserAge(birthday); | ||
144 | } | ||
145 | } | ||
146 | sysFactoryUserInfoService.save(factoryUserInfo); | ||
147 | sysFactoryUserData.setBaseId(factoryUserInfo.getId()); | ||
148 | } | ||
149 | return sysFactoryUserData; | ||
150 | } | ||
151 | |||
103 | /** | 152 | /** |
104 | * <pre> | 153 | * <pre> |
105 | * 编辑 | 154 | * 编辑 |
... | @@ -118,10 +167,15 @@ public class SysFactoryUserDataController { | ... | @@ -118,10 +167,15 @@ public class SysFactoryUserDataController { |
118 | if(sysFactoryUserDataEntity==null) { | 167 | if(sysFactoryUserDataEntity==null) { |
119 | result.error500("未找到对应实体"); | 168 | result.error500("未找到对应实体"); |
120 | }else { | 169 | }else { |
121 | boolean ok = sysFactoryUserDataService.updateById(sysFactoryUserData); | 170 | if(sysFactoryUserData.getUserId()!=null&&sysFactoryUserData.getDepartId()!=null){ |
122 | //TODO 返回false说明什么? | 171 | //同步修改主信息表 |
123 | if(ok) { | 172 | sysFactoryUserData = syncSaveOrUpdate(sysFactoryUserData); |
124 | result.success("修改成功!"); | 173 | boolean ok = sysFactoryUserDataService.updateById(sysFactoryUserData); |
174 | if(ok) { | ||
175 | result.success("修改成功!"); | ||
176 | } | ||
177 | }else{ | ||
178 | result.error500("未选择用户或机构"); | ||
125 | } | 179 | } |
126 | } | 180 | } |
127 | 181 | ... | ... |
... | @@ -32,6 +32,11 @@ public class SysFactoryUserData { | ... | @@ -32,6 +32,11 @@ public class SysFactoryUserData { |
32 | @Excel(name = "基础信息ID", width = 15) | 32 | @Excel(name = "基础信息ID", width = 15) |
33 | @ApiModelProperty(value = "基础信息ID") | 33 | @ApiModelProperty(value = "基础信息ID") |
34 | private String baseId; | 34 | private String baseId; |
35 | /**所属厂区*/ | ||
36 | @Excel(name = "所属厂区", width = 15) | ||
37 | @ApiModelProperty(value = "所属厂区") | ||
38 | @Dict(dictTable = "sys_depart", dicCode="id", dicText = "depart_name") | ||
39 | private String departId; | ||
35 | /**成员ID*/ | 40 | /**成员ID*/ |
36 | @Excel(name = "成员ID", width = 15) | 41 | @Excel(name = "成员ID", width = 15) |
37 | @ApiModelProperty(value = "成员ID") | 42 | @ApiModelProperty(value = "成员ID") | ... | ... |
... | @@ -13,4 +13,5 @@ public interface SysFactoryUserInfoMapper extends BaseMapper<SysFactoryUserInfo> | ... | @@ -13,4 +13,5 @@ public interface SysFactoryUserInfoMapper extends BaseMapper<SysFactoryUserInfo> |
13 | 13 | ||
14 | List<SysFactoryUserInfo> getList(String departIds, String userName); | 14 | List<SysFactoryUserInfo> getList(String departIds, String userName); |
15 | 15 | ||
16 | SysFactoryUserInfo getFactoryUserInfoByUserId(@Param("userId") String userId); | ||
16 | } | 17 | } | ... | ... |
... | @@ -23,4 +23,8 @@ | ... | @@ -23,4 +23,8 @@ |
23 | fu.user_id | 23 | fu.user_id |
24 | </select> | 24 | </select> |
25 | 25 | ||
26 | <select id="getFactoryUserInfoByUserId" resultType="com.skua.modules.system.entity.SysFactoryUserInfo"> | ||
27 | select * from sys_factory_user_info where user_id = #{userId} limit 1 | ||
28 | </select> | ||
29 | |||
26 | </mapper> | 30 | </mapper> | ... | ... |
... | @@ -18,4 +18,6 @@ public interface ISysFactoryUserInfoService extends IService<SysFactoryUserInfo> | ... | @@ -18,4 +18,6 @@ public interface ISysFactoryUserInfoService extends IService<SysFactoryUserInfo> |
18 | List<SysFactoryUserInfo> getList(SysFactoryUserInfo sysFactoryUserInfo); | 18 | List<SysFactoryUserInfo> getList(SysFactoryUserInfo sysFactoryUserInfo); |
19 | 19 | ||
20 | SysFactoryUserInfo saveOrUpdateByUser(SysUser sysUser); | 20 | SysFactoryUserInfo saveOrUpdateByUser(SysUser sysUser); |
21 | |||
22 | SysFactoryUserInfo getFactoryUserInfoByUserId(String userId); | ||
21 | } | 23 | } | ... | ... |
... | @@ -53,4 +53,10 @@ public class SysFactoryUserInfoServiceImpl extends ServiceImpl<SysFactoryUserInf | ... | @@ -53,4 +53,10 @@ public class SysFactoryUserInfoServiceImpl extends ServiceImpl<SysFactoryUserInf |
53 | return null; | 53 | return null; |
54 | } | 54 | } |
55 | 55 | ||
56 | @Override | ||
57 | public SysFactoryUserInfo getFactoryUserInfoByUserId(String userId) { | ||
58 | SysFactoryUserInfo factoryUserInfo = sysFactoryUserInfoMapper.getFactoryUserInfoByUserId(userId); | ||
59 | return factoryUserInfo; | ||
60 | } | ||
61 | |||
56 | } | 62 | } | ... | ... |
-
请 注册 或 登录 后发表评论