Merge remote-tracking branch 'origin/dev_New' into dev_New
| | |
| | | |
| | | @PostMapping("/saveMeetingApplication") |
| | | public R saveMeetApplication(@RequestBody MeetApplication meetApplication) { |
| | | meetingService.saveMeetApplication(meetApplication); |
| | | return R.ok(); |
| | | return meetingService.saveMeetApplication(meetApplication); |
| | | } |
| | | |
| | | @PostMapping("/applicationList") |
| | |
| | | import com.ruoyi.collaborativeApproval.vo.SearchMeetingDraftVo; |
| | | import com.ruoyi.collaborativeApproval.vo.SearchMeetingRoomVo; |
| | | import com.ruoyi.collaborativeApproval.vo.SearchMeetingUseVo; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | |
| | | |
| | | import java.util.List; |
| | |
| | | |
| | | // ************ç³è¯·ä¼è®®************ |
| | | |
| | | void saveMeetApplication(MeetApplication meetApplication); |
| | | R<Void> saveMeetApplication(MeetApplication meetApplication); |
| | | |
| | | // ************ç³è¯·å®¡æ¹************ |
| | | |
| | |
| | | import com.ruoyi.collaborativeApproval.vo.SearchMeetingRoomVo; |
| | | import com.ruoyi.collaborativeApproval.vo.SearchMeetingUseVo; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import com.ruoyi.project.system.service.ISysNoticeService; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void saveMeetApplication(MeetApplication meetApplication) { |
| | | public R<Void> saveMeetApplication(MeetApplication meetApplication) { |
| | | meetApplication.setApplicant(SecurityUtils.getUsername()); |
| | | |
| | | // æ¶é´å²çªæ ¡éª |
| | | LambdaQueryWrapper<MeetApplication> meetApplicationLambdaQueryWrapper = Wrappers.<MeetApplication>lambdaQuery() |
| | | .eq(MeetApplication::getRoomId, meetApplication.getRoomId()) |
| | | // 妿idä¸ä¸ºnullåæé¤èªå·± |
| | | .ne(meetApplication.getId() != null, MeetApplication::getId, meetApplication.getId()) |
| | | // æ¶é´å²çªå¤æ |
| | | .lt(MeetApplication::getStartTime, meetApplication.getEndTime()) |
| | | .gt(MeetApplication::getEndTime, meetApplication.getStartTime()); |
| | | |
| | | Long count = meetApplicationMapper.selectCount(meetApplicationLambdaQueryWrapper); |
| | | if (count > 0) { |
| | | return R.fail("æéä¼è®®å®¤å¨è¯¥æ¶é´æ®µå·²æå
¶ä»ä¼è®®ï¼è¯·è°æ´æ¶é´ææ´æ¢ä¼è®®å®¤"); |
| | | } |
| | | |
| | | if (meetApplication.getId() != null) { |
| | | // æ´æ° |
| | | meetApplicationMapper.updateById(meetApplication); |
| | | } else { |
| | | // æ°å¢ |
| | | meetApplicationMapper.insert(meetApplication); |
| | | } |
| | | if (ObjectUtils.isNotNull(meetApplication.getPublishStatus()) && meetApplication.getPublishStatus() == 1){ |
| | | |
| | | /*ä¼è®®åå¸çæ¶æ¯éç¥*/ |
| | | //åä¼äººåid(人åå°è´¦åç¨æ·è¡¨éè¿äººåç¼å·åç¨æ·åç§°(ç»å½è´¦å·)åå¹é
) |
| | | if (Integer.valueOf(1).equals(meetApplication.getPublishStatus())) { |
| | | MeetApplication application = meetApplicationMapper.selectById(meetApplication.getId()); |
| | | /*ä¼è®®åå¸çæ¶æ¯éç¥*/ |
| | | //åä¼äººåid(人åå°è´¦åç¨æ·è¡¨éè¿äººåç¼å·åç¨æ·åç§°(ç»å½è´¦å·)åå¹é
) |
| | | String cleanStr = application.getParticipants().trim() |
| | | |
| | | String cleanStr = application.getParticipants() |
| | | .replaceAll("^\\[|\\]$", "") |
| | | .trim(); |
| | | List<Long> ids = Arrays.stream(cleanStr.split(",")) |
| | | |
| | | List<Long> userIds = Arrays.stream(cleanStr.split(",")) |
| | | .map(String::trim) |
| | | .filter(s -> !s.isEmpty()) |
| | | .map(s -> { |
| | | StaffJoinLeaveRecord staffJoinLeaveRecord = staffJoinLeaveRecordMapper.selectById(Long.valueOf(s)); |
| | | List<SysUser> users = userMapper.selectList(Wrappers.<SysUser>lambdaQuery().eq(SysUser::getUserName,staffJoinLeaveRecord.getStaffNo())); |
| | | if (users.size() > 0){ |
| | | return users.get(0).getUserId(); |
| | | }else return null; |
| | | .map(Long::valueOf) |
| | | .map(staffId -> { |
| | | StaffJoinLeaveRecord record = staffJoinLeaveRecordMapper.selectById(staffId); |
| | | if (record == null) { |
| | | return null; |
| | | } |
| | | return userMapper.selectOne( |
| | | Wrappers.<SysUser>lambdaQuery() |
| | | .eq(SysUser::getUserName, record.getStaffNo()) |
| | | ); |
| | | }) |
| | | .filter(Objects::nonNull) |
| | | .map(SysUser::getUserId) |
| | | .collect(Collectors.toList()); |
| | | if (ids.size() > 0) { |
| | | sysNoticeService.simpleNoticeByUser("ä¼è®®éç¥", |
| | | |
| | | if (!userIds.isEmpty()) { |
| | | sysNoticeService.simpleNoticeByUser( |
| | | "ä¼è®®éç¥", |
| | | "ä¼è®®ä¸»é¢ï¼" + application.getTitle() + "\n" + |
| | | "ä¼è®®æ¶é´ï¼" + application.getStartTime() + "-" + application.getEndTime() + "\n" + |
| | | "å起人ï¼" + application.getApplicant(), |
| | | ids, |
| | | userIds, |
| | | application.getTenantId(), |
| | | ""); |
| | | "" |
| | | ); |
| | | } |
| | | } |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @Override |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.enums; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | |
| | | /** |
| | | * éä»¶è®°å½ç±»åæä¸¾ |
| | | * |
| | | */ |
| | | @AllArgsConstructor |
| | | public enum StaffLeaveReason { |
| | | StaffLeaveReasonSalary("salary","èªèµå¾
é"), |
| | | StaffLeaveReasonCareerDevelopment("career_development","èä¸åå±"), |
| | | StaffLeaveReasonWorkEnvironment("work_environment","å·¥ä½ç¯å¢"), |
| | | StaffLeaveReasonPersonalReason("personal_reason","个人åå "), |
| | | StaffLeaveReasonOther("other","å
¶ä»åå "); |
| | | |
| | | |
| | | private final String code; |
| | | private final String info; |
| | | |
| | | public String getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public String getInfo() { |
| | | return info; |
| | | } |
| | | } |
| | |
| | | productProcessRouteItem.setProcessId(processRouteItem.getProcessId()); |
| | | productProcessRouteItem.setProductOrderId(productOrder.getId()); |
| | | productProcessRouteItem.setProductRouteId(productProcessRoute.getId()); |
| | | productProcessRouteItem.setDragSort(processRouteItem.getDragSort()); |
| | | int insert = productProcessRouteItemMapper.insert(productProcessRouteItem); |
| | | if (insert > 0) { |
| | | // æ¥è¯¢ä»æ¥å·²åå¨çæå¤§å·¥åå· |
| | |
| | | ProductWorkOrder productWorkOrder = new ProductWorkOrder(); |
| | | productWorkOrder.setProductProcessRouteItemId(productProcessRouteItem.getId()); |
| | | productWorkOrder.setProductOrderId(productOrder.getId()); |
| | | productWorkOrder.setPlanQuantity(productOrder.getQuantity()); |
| | | ProductOrder order = productOrderMapper.selectById(productOrder); |
| | | productWorkOrder.setPlanQuantity(order.getQuantity()); |
| | | productWorkOrder.setWorkOrderNo(workOrderNoStr); |
| | | productWorkOrder.setStatus(1); |
| | | productWorkOrderMapper.insert(productWorkOrder); |
| | |
| | | handleSalesLedgerProducts(purchaseLedger.getId(), productList, purchaseLedgerDto.getType()); |
| | | } |
| | | //æ°å¢åæææ£éª |
| | | for (SalesLedgerProduct saleProduct : productList) { |
| | | //æ¯å¦æ¨éè´¨æ£ï¼å¦ætrue就添å |
| | | if (saleProduct.getIsChecked()) { |
| | | addQualityInspect(purchaseLedger, saleProduct); |
| | | if (productList != null) { |
| | | for (SalesLedgerProduct saleProduct : productList) { |
| | | //æ¯å¦æ¨éè´¨æ£ï¼å¦ætrue就添å |
| | | if (saleProduct.getIsChecked()) { |
| | | addQualityInspect(purchaseLedger, saleProduct); |
| | | } |
| | | } |
| | | } |
| | | // 5. è¿ç§»ä¸´æ¶æä»¶å°æ£å¼ç®å½ |
| | |
| | | qualityInspect.setInspectType(0); |
| | | qualityInspect.setSupplier(purchaseLedger.getSupplierName()); |
| | | qualityInspect.setPurchaseLedgerId(purchaseLedger.getId()); |
| | | qualityInspect.setProductId(saleProduct.getId()); |
| | | qualityInspect.setProductId(saleProduct.getProductId()); |
| | | qualityInspect.setProductName(saleProduct.getProductCategory()); |
| | | qualityInspect.setModel(saleProduct.getSpecificationModel()); |
| | | qualityInspect.setProductModelId(saleProduct.getProductModelId()); |
| | |
| | | BigDecimal stockQuantity = stockUtils.getStockQuantity(item.getProductModelId()).get("stockQuantity"); |
| | | if(stockQuantity != null) { |
| | | // ProcurementPageDtoCopy procurementDtoCopy = result.getRecords().get(0); |
| | | if (item.getQuantity().compareTo(stockQuantity) >= 0 && item.getApproveStatus() == 0) { |
| | | if (item.getQuantity().compareTo(stockQuantity) <= 0 && item.getApproveStatus() == 0) { |
| | | item.setApproveStatus(1); |
| | | salesLedgerProductService.addOrUpdateSalesLedgerProduct(item); |
| | | } |
| | |
| | | productProcessRouteItem.setProcessId(processRouteItem.getProcessId()); |
| | | productProcessRouteItem.setProductOrderId(productOrder.getId()); |
| | | productProcessRouteItem.setProductRouteId(productProcessRoute.getId()); |
| | | productProcessRouteItem.setDragSort(processRouteItem.getDragSort()); |
| | | int insert = productProcessRouteItemMapper.insert(productProcessRouteItem); |
| | | if (insert > 0) { |
| | | // æ¥è¯¢ä»æ¥å·²åå¨çæå¤§å·¥åå· |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.staff.controller; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.staff.dto.StaffLeaveDto; |
| | | import com.ruoyi.staff.pojo.StaffJoinLeaveRecord; |
| | | import com.ruoyi.staff.service.StaffLeaveService; |
| | | import io.swagger.annotations.Api; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * å工离è |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/staff/staffLeave") |
| | | @Api(tags = "å工离è") |
| | | public class StaffLeaveController { |
| | | @Resource |
| | | private StaffLeaveService staffLeaveService; |
| | | /** |
| | | * æ°å¢ç¦»èå页æ¥è¯¢ |
| | | * @param page |
| | | * @param staffLeaveDto |
| | | * @return |
| | | */ |
| | | @GetMapping("/listPage") |
| | | public AjaxResult staffLeaveListPage(Page page, StaffLeaveDto staffLeaveDto) { |
| | | return AjaxResult.success(staffLeaveService.staffLeaveListPage(page, staffLeaveDto)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢ç¦»è |
| | | * @param staffLeaveDto |
| | | * @return |
| | | */ |
| | | @PostMapping("") |
| | | public AjaxResult add(@RequestBody StaffLeaveDto staffLeaveDto) { |
| | | return AjaxResult.success(staffLeaveService.add(staffLeaveDto)); |
| | | } |
| | | |
| | | /** |
| | | * æ´æ°ç¦»èä¿¡æ¯ |
| | | * @param id |
| | | * @param staffLeaveDto |
| | | * @return |
| | | */ |
| | | @PutMapping("/{id}") |
| | | public AjaxResult update(@PathVariable("id") Long id, @RequestBody StaffLeaveDto staffLeaveDto) { |
| | | return AjaxResult.success(staffLeaveService.update(id, staffLeaveDto)); |
| | | } |
| | | |
| | | /** |
| | | * å é¤å
¥è |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | public AjaxResult del(@RequestBody List<Integer> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | } |
| | | return AjaxResult.success(staffLeaveService.del(ids)); |
| | | } |
| | | |
| | | /** |
| | | * 离èå¯¼åº |
| | | * @param staffLeaveDto |
| | | */ |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, StaffLeaveDto staffLeaveDto) { |
| | | staffLeaveService.export(response, staffLeaveDto); |
| | | } |
| | | } |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/staff/staffOnJob") |
| | | @Api(tags = "åå·¥å°è´¦/åå管ç") |
| | | @Api(tags = "åå·¥å°è´¦") |
| | | public class StaffOnJobController { |
| | | |
| | | @Resource |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/{id}") |
| | | public AjaxResult staffJoinLeaveRecordDetail(@PathVariable("id") Long id) { |
| | | public AjaxResult staffOnJobDetail(@PathVariable("id") Long id) { |
| | | return AjaxResult.success(staffOnJobService.staffOnJobDetail(id)); |
| | | } |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.staff.dto; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import com.ruoyi.staff.pojo.StaffLeave; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | public class StaffLeaveDto extends StaffLeave { |
| | | @Excel(name = "ç¶æ", readConverterExp = "0=离è,1=å¨è", sort = 1) |
| | | private Integer staffState; |
| | | |
| | | /** |
| | | * åå·¥ç¼å· |
| | | */ |
| | | @Excel(name = "åå·¥ç¼å·", type = Excel.Type.EXPORT, cellType = Excel.ColumnType.STRING, sort = 2) |
| | | private String staffNo; |
| | | |
| | | /** |
| | | * åå·¥å§å |
| | | */ |
| | | @Excel(name = "åå·¥å§å", sort = 3) |
| | | private String staffName; |
| | | |
| | | /** |
| | | * æ§å« |
| | | */ |
| | | @Excel(name = "æ§å«", sort = 4) |
| | | private String sex; |
| | | |
| | | /** |
| | | * ç±è´¯ |
| | | */ |
| | | @Excel(name = "ç±è´¯", sort = 5) |
| | | private String nativePlace; |
| | | |
| | | /** |
| | | * å®¶åºä½å |
| | | */ |
| | | @Excel(name = "å®¶åºä½å", sort = 6) |
| | | private String adress; |
| | | |
| | | /** |
| | | * å²ä½ |
| | | */ |
| | | @Excel(name = "å²ä½",sort = 7) |
| | | private String postName; |
| | | |
| | | /** |
| | | * 第ä¸å¦å |
| | | */ |
| | | @Excel(name = "第ä¸å¦å", sort = 8) |
| | | private String firstStudy; |
| | | |
| | | /** |
| | | * ä¸ä¸ |
| | | */ |
| | | @Excel(name = "ä¸ä¸", sort = 9) |
| | | private String profession; |
| | | |
| | | /** |
| | | * 身份è¯å·ç |
| | | */ |
| | | @Excel(name = "身份è¯å·ç ", sort = 10) |
| | | private String identityCard; |
| | | |
| | | /** |
| | | * å¹´é¾ |
| | | */ |
| | | @Excel(name = "å¹´é¾", sort = 11) |
| | | private String age; |
| | | |
| | | /** |
| | | * èç³»çµè¯ |
| | | */ |
| | | @Excel(name = "èç³»çµè¯", sort = 12) |
| | | private String phone; |
| | | |
| | | /** |
| | | * ç´§æ¥è系人 |
| | | */ |
| | | @Excel(name = "ç´§æ¥è系人", sort = 13) |
| | | private String emergencyContact; |
| | | |
| | | /** |
| | | * ç´§æ¥è系人çµè¯ |
| | | */ |
| | | @Excel(name = "ç´§æ¥è系人çµè¯", sort = 14) |
| | | private String emergencyContactPhone; |
| | | } |
| | |
| | | package com.ruoyi.staff.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.staff.dto.StaffLeaveDto; |
| | | import com.ruoyi.staff.dto.StaffOnJobDto; |
| | | import com.ruoyi.staff.pojo.StaffLeave; |
| | | import com.ruoyi.staff.pojo.StaffOnJob; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | @Mapper |
| | | public interface StaffLeaveMapper extends BaseMapper<StaffLeave> { |
| | | IPage<StaffLeaveDto> staffLeaveListPage(Page page, @Param("c") StaffLeaveDto staffLeaveDto); |
| | | |
| | | List<StaffLeaveDto> staffLeaveList(@Param("c") StaffLeaveDto staffLeaveDto); |
| | | } |
| | |
| | | @ApiModelProperty(value = "å¨èåå·¥ID") |
| | | private Long staffOnJobId; |
| | | |
| | | @ApiModelProperty(value = "离èåå ") |
| | | private String reason; |
| | | |
| | | @ApiModelProperty(value = "离è夿³¨") |
| | | private String remark; |
| | | |
| | | @ApiModelProperty(value = "ç§æ·ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | |
| | | package com.ruoyi.staff.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.staff.dto.StaffLeaveDto; |
| | | import com.ruoyi.staff.dto.StaffOnJobDto; |
| | | import com.ruoyi.staff.pojo.StaffJoinLeaveRecord; |
| | | import com.ruoyi.staff.pojo.StaffLeave; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | public interface StaffLeaveService extends IService<StaffLeave> { |
| | | IPage<StaffLeaveDto> staffLeaveListPage(Page page, StaffLeaveDto staffLeaveDto); |
| | | /** |
| | | * æ°å¢ç¦»è |
| | | * @param staffLeaveDto |
| | | * @return |
| | | */ |
| | | int add(StaffLeaveDto staffLeaveDto); |
| | | |
| | | /** |
| | | * æ´æ°ç¦»èä¿¡æ¯ |
| | | * @param id |
| | | * @param staffLeaveDto |
| | | * @return |
| | | */ |
| | | int update(Long id, StaffLeaveDto staffLeaveDto); |
| | | |
| | | int del(List<Integer> ids); |
| | | |
| | | void export(HttpServletResponse response, StaffLeaveDto staffLeaveDto); |
| | | } |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.ServletException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.*; |
| | | import java.util.function.Function; |
| | | |
| | | import static com.ruoyi.common.enums.StaffJoinLeaveRecordDimissionReason.StaffJoinLeaveRecordDimissionReasonOther; |
| | | |
| | | @Service |
| | | @AllArgsConstructor |
| | |
| | | } |
| | | if (staffJoinLeaveRecord.getDimissionReason()==null){ |
| | | throw new BaseException("离èåå ä¸è½ä¸ºç©º!!!"); |
| | | } |
| | | if (!StaffJoinLeaveRecordDimissionReasonOther.getCode().equals(staffJoinLeaveRecord.getDimissionReason())){ |
| | | staffJoinLeaveRecord.setDimissionRemark(""); |
| | | } |
| | | } |
| | | return staffJoinLeaveRecordMapper.insert(staffJoinLeaveRecord); |
| | |
| | | //离èçç¼è¾ä¸ä¼å½±åå¨è表 |
| | | if (staffJoinLeaveRecord.getDimissionReason()==null){ |
| | | throw new BaseException("离èåå ä¸è½ä¸ºç©º!!!"); |
| | | } |
| | | if (!StaffJoinLeaveRecordDimissionReasonOther.getCode().equals(staffJoinLeaveRecord.getDimissionReason())){ |
| | | staffJoinLeaveRecord.setDimissionRemark(""); |
| | | } |
| | | } |
| | | return staffJoinLeaveRecordMapper.updateById(staffJoinLeaveRecord); |
| | |
| | | package com.ruoyi.staff.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.staff.dto.StaffLeaveDto; |
| | | import com.ruoyi.staff.dto.StaffOnJobDto; |
| | | import com.ruoyi.staff.mapper.StaffLeaveMapper; |
| | | import com.ruoyi.staff.mapper.StaffOnJobMapper; |
| | | import com.ruoyi.staff.pojo.StaffContract; |
| | | import com.ruoyi.staff.pojo.StaffJoinLeaveRecord; |
| | | import com.ruoyi.staff.pojo.StaffOnJob; |
| | | import com.ruoyi.staff.service.StaffLeaveService; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import com.ruoyi.staff.pojo.StaffLeave; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | import static com.ruoyi.common.enums.StaffLeaveReason.StaffLeaveReasonOther; |
| | | |
| | | @AllArgsConstructor |
| | | @Service |
| | | public class StaffLeaveServiceImpl extends ServiceImpl<StaffLeaveMapper, StaffLeave> implements StaffLeaveService { |
| | | private StaffLeaveMapper staffLeaveMapper; |
| | | |
| | | private StaffOnJobMapper staffOnJobMapper; |
| | | |
| | | //æ°å¢ç¦»èå表å页æ¥è¯¢ |
| | | @Override |
| | | public IPage<StaffLeaveDto> staffLeaveListPage(Page page, StaffLeaveDto staffLeaveDto) { |
| | | return staffLeaveMapper.staffLeaveListPage(page,staffLeaveDto); |
| | | } |
| | | |
| | | //æ°å¢ç¦»è |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int add(StaffLeaveDto staffLeaveDto) { |
| | | // æ ¡éªå¨èåå·¥æ¯å¦åå¨ |
| | | StaffOnJob staffOnJob = staffOnJobMapper.selectById(staffLeaveDto.getStaffOnJobId()); |
| | | if (staffOnJob == null) { |
| | | throw new IllegalArgumentException("åå·¥ä¸åå¨"); |
| | | } |
| | | |
| | | // æ ¡éªåå·¥æ¯å¦ç¦»è |
| | | if (staffOnJob.getStaffState() == 0) { |
| | | throw new IllegalArgumentException("å工已离è"); |
| | | } |
| | | |
| | | // æ°å¢ç¦»èè®°å½ |
| | | StaffLeave staffLeave = new StaffLeave(); |
| | | staffLeave.setStaffOnJobId(staffLeaveDto.getStaffOnJobId()); |
| | | String reason = staffLeaveDto.getReason(); |
| | | if (!StaffLeaveReasonOther.getCode().equals(reason)){ |
| | | staffLeave.setRemark(""); |
| | | } |
| | | staffLeaveMapper.insert(staffLeave); |
| | | |
| | | // æ´æ°ç¦»èç¶æä¸ºç¦»è |
| | | staffOnJob.setStaffState(0); |
| | | return staffOnJobMapper.updateById(staffOnJob); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int update(Long id, StaffLeaveDto staffLeaveDto) { |
| | | // å¤æå¯¹è±¡æ¯å¦åå¨ |
| | | StaffLeave leave = staffLeaveMapper.selectById(id); |
| | | if (leave == null){ |
| | | throw new BaseException("该离èè®°å½ä¸åå¨,æ æ³æ´æ°!!!"); |
| | | } |
| | | |
| | | String reason = staffLeaveDto.getReason(); |
| | | leave.setReason(reason); |
| | | // æ ¡éªç¦»èåå æ¯å¦ä¸ºå
¶ä»ï¼å¦ææ¯å
¶ä»ï¼å¤æ³¨èµå¼ |
| | | if (StaffLeaveReasonOther.getCode().equals(reason)){ |
| | | leave.setRemark(staffLeaveDto.getRemark()); |
| | | } else { |
| | | leave.setRemark(""); |
| | | } |
| | | return staffLeaveMapper.updateById(leave); |
| | | } |
| | | |
| | | //å é¤ç¦»è |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int del(List<Integer> ids) { |
| | | // å é¤ç¦»èæ°æ® |
| | | return staffLeaveMapper.deleteBatchIds(ids); |
| | | } |
| | | |
| | | //å¯¼åº |
| | | @Override |
| | | public void export(HttpServletResponse response, StaffLeaveDto staffLeaveDto) { |
| | | List<StaffLeaveDto> staffLeaves =staffLeaveMapper.staffLeaveList(staffLeaveDto); |
| | | ExcelUtil<StaffLeaveDto> util = new ExcelUtil<StaffLeaveDto>(StaffLeaveDto.class); |
| | | util.exportExcel(response, staffLeaves, "å工离è导åº"); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | import java.time.ZoneId; |
| | | import java.util.*; |
| | | |
| | | import static com.ruoyi.common.enums.StaffJoinLeaveRecordDimissionReason.StaffJoinLeaveRecordDimissionReasonOther; |
| | | |
| | | @AllArgsConstructor |
| | | @Service |
| | | public class StaffOnJobServiceImpl extends ServiceImpl<StaffOnJobMapper, StaffOnJob> implements IStaffOnJobService { |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
| | | <mapper namespace="com.ruoyi.staff.mapper.StaffLeaveMapper"> |
| | | <select id="staffLeaveListPage" resultType="com.ruoyi.staff.dto.StaffLeaveDto"> |
| | | SELECT |
| | | staff_leave.*, |
| | | soj.staff_name as staffName, |
| | | soj.staff_state as staffState, |
| | | soj.staff_no as staffNo, |
| | | soj.sex as sex, |
| | | soj.native_place as nativePlace, |
| | | soj.adress as adress, |
| | | soj.first_study as firstStudy, |
| | | soj.profession as profession, |
| | | soj.identity_card as identityCard, |
| | | soj.age as age, |
| | | soj.phone as phone, |
| | | soj.emergency_contact as emergencyContact, |
| | | soj.emergency_contact_phone as emergencyContactPhone, |
| | | sp.post_name as postName |
| | | FROM staff_leave |
| | | LEFT JOIN |
| | | staff_on_job soj ON soj.id = staff_leave.staff_on_job_id |
| | | LEFT JOIN |
| | | sys_post sp ON sp.post_id = soj.sys_post_id |
| | | where 1=1 |
| | | <if test="c.staffName != null and c.staffName != '' "> |
| | | AND soj.staff_name LIKE CONCAT('%',#{c.staffName},'%') |
| | | </if> |
| | | </select> |
| | | <select id="staffLeaveList" resultType="com.ruoyi.staff.dto.StaffLeaveDto"> |
| | | SELECT |
| | | staff_leave.*, |
| | | soj.staff_name as staffName, |
| | | soj.staff_state as staffState, |
| | | soj.staff_no as staffNo, |
| | | soj.sex as sex, |
| | | soj.native_place as nativePlace, |
| | | soj.adress as adress, |
| | | soj.first_study as firstStudy, |
| | | soj.profession as profession, |
| | | soj.identity_card as identityCard, |
| | | soj.age as age, |
| | | soj.phone as phone, |
| | | soj.emergency_contact as emergencyContact, |
| | | soj.emergency_contact_phone as emergencyContactPhone, |
| | | sp.post_name as postName |
| | | FROM staff_leave |
| | | LEFT JOIN |
| | | staff_on_job soj ON soj.id = staff_leave.staff_on_job_id |
| | | LEFT JOIN |
| | | sys_post sp ON sp.post_id = soj.sys_post_id |
| | | where 1=1 |
| | | <if test="c.staffName != null and c.staffName != '' "> |
| | | AND soj.staff_name LIKE CONCAT('%',#{c.staffName},'%') |
| | | </if> |
| | | </select> |
| | | </mapper> |