lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamUserSelectController.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,51 @@ package org.jeecg.modules.eam.controller; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.jeecg.common.api.vo.Result; import org.jeecg.modules.eam.entity.EamEquipment; import org.jeecg.modules.eam.service.IEamEquipmentService; import org.jeecg.modules.system.service.ISysUserService; import org.jeecg.modules.system.vo.UserSelector; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import java.util.List; /** * @Description: ç¨æ·éæ© * @Author: jeecg-boot * @Date: 2025-03-19 * @Version: V1.0 */ @Slf4j @Api(tags = "ç¨æ·éæ©") @RestController @RequestMapping("/eam/user_select") public class EamUserSelectController { @Autowired private ISysUserService sysUserService; @Autowired private IEamEquipmentService eamEquipmentService; @ApiOperation(value = "ç¨æ·éæ©-éæ©æä½äººå表æ¥è¯¢", notes = "ç¨æ·éæ©-éæ©æä½äººå表æ¥è¯¢") @GetMapping(value = "/list") public Result<?> selectOperatorList(@RequestParam(required = false, value = "equipmentId") String equipmentId, @RequestParam("positionCode") String positionCode) { String productionId = null; if (StringUtils.isNotBlank(equipmentId)) { EamEquipment equipment = eamEquipmentService.getById(equipmentId); if(equipment != null) { productionId = equipment.getOrgId(); } } List<UserSelector> list = sysUserService.selectOperatorList(equipmentId, productionId, positionCode); return Result.ok(list); } } lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamWeekMaintenanceOrderController.java
@@ -86,14 +86,23 @@ /** * ç¼è¾ * * @param eamWeekMaintenanceOrder * @param request * @return */ @AutoLog(value = "å¨ä¿å·¥å-ç¼è¾") @ApiOperation(value = "å¨ä¿å·¥å-ç¼è¾", notes = "å¨ä¿å·¥å-ç¼è¾") @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) public Result<?> edit(@RequestBody EamWeekMaintenanceOrder eamWeekMaintenanceOrder) { eamWeekMaintenanceOrderService.updateById(eamWeekMaintenanceOrder); public Result<?> edit(@RequestBody EamWeekMaintenanceRequest request) { if (request == null) { return Result.error("æ·»å ç对象ä¸è½ä¸ºç©ºï¼"); } if (CollectionUtil.isEmpty(request.getTableDetailList())) { return Result.error("ä¿å »é¡¹ä¸è½ä¸ºç©ºï¼"); } boolean b = eamWeekMaintenanceOrderService.editWeekMaintenance(request); if (!b) { return Result.error("ç¼è¾å¤±è´¥ï¼"); } return Result.OK("ç¼è¾æå!"); } lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamWeekMaintenanceOrder.java
@@ -1,6 +1,7 @@ package org.jeecg.modules.eam.entity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; @@ -104,6 +105,8 @@ //å表å±ç¤º @TableField(exist = false) private String equipmentCode; @TableField(exist = false) private String equipmentName; } lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamWeekMaintenanceOrderService.java
@@ -29,4 +29,11 @@ * @return */ IPage<EamWeekMaintenanceOrder> queryPageList(Page<EamWeekMaintenanceOrder> page, EamWeekMaintenanceQuery query); /** * å¨ä¿ç¼è¾ç¶æ * @param request * @return */ boolean editWeekMaintenance(EamWeekMaintenanceRequest request); } lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamWeekMaintenanceOrderServiceImpl.java
@@ -9,12 +9,13 @@ import org.apache.shiro.SecurityUtils; import org.jeecg.common.constant.CommonConstant; import org.jeecg.common.constant.DataBaseConstant; import org.jeecg.common.exception.JeecgBootException; import org.jeecg.common.system.vo.LoginUser; import org.jeecg.common.util.oConvertUtils; import org.jeecg.modules.eam.constant.MaintenanceStatusEnum; import org.jeecg.modules.eam.constant.OrderCreationMethodEnum; import org.jeecg.modules.eam.entity.EamEquipment; import org.jeecg.modules.eam.entity.EamWeekMaintenanceOrder; import org.jeecg.modules.eam.entity.EamWeekMaintenanceOrderDetail; import org.jeecg.modules.eam.mapper.EamWeekMaintenanceOrderMapper; import org.jeecg.modules.eam.request.EamWeekMaintenanceQuery; import org.jeecg.modules.eam.request.EamWeekMaintenanceRequest; @@ -25,9 +26,10 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.List; import java.util.stream.Collectors; /** * @Description: å¨ä¿å·¥å @@ -121,4 +123,45 @@ return eamWeekMaintenanceOrderMapper.queryPageList(page, queryWrapper); } @Override @Transactional(rollbackFor = Exception.class) public boolean editWeekMaintenance(EamWeekMaintenanceRequest request) { EamWeekMaintenanceOrder entity = eamWeekMaintenanceOrderMapper.selectById(request.getId()); if(entity == null){ throw new JeecgBootException("ç¼è¾çæ°æ®å·²å é¤ï¼è¯·å·æ°éè¯ï¼"); } if(!MaintenanceStatusEnum.WAIT_MAINTENANCE.name().equals(entity.getMaintenanceStatus())){ throw new JeecgBootException("åªæå¾ ä¿å »ç¶æçæ°æ®æå¯ç¼è¾ï¼"); } entity.setMaintenanceDate(request.getMaintenanceDate()); entity.setOperator(request.getOperator()); entity.setRemark(request.getRemark()); eamWeekMaintenanceOrderMapper.updateById(entity); //å¤ç详æ if(CollectionUtil.isNotEmpty(request.getTableDetailList())) { List<EamWeekMaintenanceOrderDetail> addList = new ArrayList<>(); List<EamWeekMaintenanceOrderDetail> updateList = new ArrayList<>(); request.getTableDetailList().forEach(tableDetail -> { tableDetail.setOrderId(entity.getId()); if(tableDetail.getId() == null){ addList.add(tableDetail); }else { updateList.add(tableDetail); } }); if(CollectionUtil.isNotEmpty(addList)){ eamWeekMaintenanceOrderDetailService.saveBatch(addList); } if(CollectionUtil.isNotEmpty(updateList)){ eamWeekMaintenanceOrderDetailService.updateBatchById(updateList); } } if(CollectionUtil.isNotEmpty(request.getRemoveDetailList())) { List<String> ids = request.getRemoveDetailList().stream().map(EamWeekMaintenanceOrderDetail::getId).collect(Collectors.toList()); eamWeekMaintenanceOrderDetailService.removeBatchByIds(ids); } return true; } } lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/ISysUserService.java
@@ -10,6 +10,7 @@ import org.jeecg.modules.system.entity.SysRoleIndex; import org.jeecg.modules.system.entity.SysUser; import org.jeecg.modules.system.model.SysUserSysDepartModel; import org.jeecg.modules.system.vo.UserSelector; import org.springframework.transaction.annotation.Transactional; import java.util.Collection; @@ -320,4 +321,13 @@ List<String> getUserByRoleCode(String roleCode); List<SysUser> getEquipmentAdmin(String roleCode, String equipmentId); /** * éæ©ç¨æ· * @param equipmentId éæ©ç设å¤ID * @param productionId éæ©ç车é´ID * @param positionCode å²ä½ç¼å· * @return */ List<UserSelector> selectOperatorList(String equipmentId, String productionId, String positionCode); } lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysUserServiceImpl.java
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.jeecg.common.api.vo.Result; import org.jeecg.common.constant.CacheConstant; import org.jeecg.common.constant.CommonConstant; @@ -26,6 +27,7 @@ import org.jeecg.modules.system.service.ISysUserService; import org.jeecg.modules.system.vo.MdcUserProVo; import org.jeecg.modules.system.vo.SysUserDepVo; import org.jeecg.modules.system.vo.UserSelector; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.annotation.CacheEvict; @@ -742,4 +744,24 @@ public List<SysUser> getEquipmentAdmin(String roleCode, String equipmentId) { return this.baseMapper.getEquipmentAdmin(roleCode, equipmentId); } @Override public List<UserSelector> selectOperatorList(String equipmentId, String productionId, String positionCode) { LambdaQueryWrapper<SysUser> queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(SysUser::getPost, positionCode); if(StringUtils.isNotBlank(equipmentId)) { queryWrapper.isNull(SysUser::getEquipmentIds); queryWrapper.or().eq(SysUser::getEquipmentIds, ""); queryWrapper.or().like(SysUser::getEquipmentIds, equipmentId); } if(StringUtils.isNotBlank(productionId)) { queryWrapper.exists("select 1 from mdc_user_production t where t.user_id=id and t.pro_id={0}", productionId); } queryWrapper.eq(SysUser::getDelFlag, CommonConstant.DEL_FLAG_0); queryWrapper.eq(SysUser::getStatus, CommonConstant.DEL_FLAG_1); queryWrapper.orderByDesc(SysUser::getId); List<SysUser> sysUsers = userMapper.selectList(queryWrapper); List<UserSelector> collect = sysUsers.stream().map(user -> new UserSelector(user.getId(), user.getUsername(), user.getRealname())).collect(Collectors.toList()); return collect; } } lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/vo/UserSelector.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,18 @@ package org.jeecg.modules.system.vo; import lombok.Data; @Data public class UserSelector { private String id; private String username; private String realname; public UserSelector() {} public UserSelector(String id, String username, String realname) { this.id = id; this.username = username; this.realname = realname; } }