| | |
| | | alter table staff_join_leave_record |
| | | alter table staff_on_job |
| | | add sys_post_id bigint not null default 0 comment 'å²ä½id'; |
| | | alter table staff_join_leave_record |
| | | alter table staff_on_job |
| | | drop column post_job; |
| | | alter table staff_on_job |
| | | add sys_post_id bigint not null default 0 comment 'å²ä½id'; |
| | | alter table staff_on_job |
| | | drop column post_job; |
| | | add sys_dept_id bigint default 0 not null; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | alter table procurement_record_storage |
| | | add quality_inspect_id bigint null comment 'è´¨æ£id'; |
| | |
| | | |
| | | @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; |
| | | import com.ruoyi.staff.mapper.StaffJoinLeaveRecordMapper; |
| | | import com.ruoyi.staff.pojo.StaffJoinLeaveRecord; |
| | | import com.ruoyi.staff.mapper.StaffOnJobMapper; |
| | | import com.ruoyi.staff.pojo.StaffOnJob; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | private final MeetDraftMapper meetDraftMapper; |
| | | |
| | | private final MeetApplicationMapper meetApplicationMapper; |
| | | private final StaffJoinLeaveRecordMapper staffJoinLeaveRecordMapper; |
| | | private final StaffOnJobMapper staffOnJobMapper; |
| | | |
| | | private final MeetingMinutesMapper meetingMinutesMapper; |
| | | private final SysUserMapper userMapper; |
| | | private final ISysNoticeService sysNoticeService; |
| | | |
| | | |
| | | @Override |
| | | public IPage<MeetingRoom> getMeetingRoomList(SearchMeetingRoomVo vo) { |
| | |
| | | } |
| | | |
| | | @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 -> { |
| | | StaffOnJob record = staffOnJobMapper.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; |
| | | } |
| | | } |
| | |
| | | }
|
| | |
|
| | | /**
|
| | | * æ©å±ï¼è¯»åExcelä¸å¤ä¸ªæå®Sheetçæ°æ®
|
| | | * @param sheetNameList è¦è¯»åçSheetåç§°å表ï¼nullåè¯»åææSheetï¼
|
| | | * @param is è¾å
¥æµ
|
| | | * @param titleNum æ é¢å ç¨è¡æ°
|
| | | * @return Map<Sheetåç§°, 对åºSheetçæ°æ®å表>
|
| | | */
|
| | | public Map<String, List<T>> importExcelMultiSheet(List<String> sheetNameList, InputStream is, int titleNum) {
|
| | | Map<String, List<T>> resultMap = new HashMap<>();
|
| | | try {
|
| | | this.type = Type.IMPORT;
|
| | | this.wb = WorkbookFactory.create(is);
|
| | |
|
| | | // 1. ç¡®å®è¦è¯»åçSheetå表
|
| | | List<Sheet> sheetsToRead = new ArrayList<>();
|
| | | if (sheetNameList != null && !sheetNameList.isEmpty()) {
|
| | | // 读åæå®åç§°çSheet
|
| | | for (String sheetName : sheetNameList) {
|
| | | Sheet sheet = wb.getSheet(sheetName);
|
| | | if (sheet != null) {
|
| | | sheetsToRead.add(sheet);
|
| | | } else {
|
| | | log.warn("æå®çSheetåç§°ä¸åå¨ï¼{}", sheetName);
|
| | | }
|
| | | }
|
| | | } else {
|
| | | // è¯»åææSheet
|
| | | int sheetCount = wb.getNumberOfSheets();
|
| | | for (int i = 0; i < sheetCount; i++) {
|
| | | sheetsToRead.add(wb.getSheetAt(i));
|
| | | }
|
| | | }
|
| | |
|
| | | // 2. éåæ¯ä¸ªSheetï¼å¤ç¨åæå¯¼å
¥é»è¾
|
| | | for (Sheet sheet : sheetsToRead) {
|
| | | String sheetName = wb.getSheetName(wb.getSheetIndex(sheet));
|
| | | // å¤ç¨åææ ¸å¿å¯¼å
¥é»è¾ï¼å
³é®ï¼å°åææ¹æ³æå为å¯å¤ç¨çå
鍿¹æ³ï¼
|
| | | List<T> sheetData = importExcelBySheet(sheet, titleNum);
|
| | | resultMap.put(sheetName, sheetData);
|
| | | }
|
| | | } catch (Exception e) {
|
| | | log.error("导å
¥å¤Sheet Excelå¼å¸¸{}", e.getMessage());
|
| | | throw new UtilException(e.getMessage());
|
| | | } finally {
|
| | | IOUtils.closeQuietly(is);
|
| | | }
|
| | | return resultMap;
|
| | | }
|
| | |
|
| | | /**
|
| | | * å
é¨å¤ç¨æ¹æ³ï¼æ ¹æ®æå®Sheetå¯¹è±¡è¯»åæ°æ®ï¼æååæimportExcelçæ ¸å¿é»è¾ï¼
|
| | | */
|
| | | private List<T> importExcelBySheet(Sheet sheet, int titleNum) throws Exception {
|
| | | List<T> list = new ArrayList<T>();
|
| | | if (sheet == null) {
|
| | | return list;
|
| | | }
|
| | |
|
| | | boolean isXSSFWorkbook = !(wb instanceof HSSFWorkbook);
|
| | | Map<String, List<PictureData>> pictures = null;
|
| | | if (isXSSFWorkbook) {
|
| | | pictures = getSheetPictures07((XSSFSheet) sheet, (XSSFWorkbook) wb);
|
| | | } else {
|
| | | pictures = getSheetPictures03((HSSFSheet) sheet, (HSSFWorkbook) wb);
|
| | | }
|
| | |
|
| | | int rows = sheet.getLastRowNum();
|
| | | if (rows > 0) {
|
| | | Map<String, Integer> cellMap = new HashMap<String, Integer>();
|
| | | Row heard = sheet.getRow(titleNum);
|
| | | for (int i = 0; i < heard.getPhysicalNumberOfCells(); i++) {
|
| | | Cell cell = heard.getCell(i);
|
| | | if (StringUtils.isNotNull(cell)) {
|
| | | String value = this.getCellValue(heard, i).toString();
|
| | | cellMap.put(value, i);
|
| | | } else {
|
| | | cellMap.put(null, i);
|
| | | }
|
| | | }
|
| | |
|
| | | List<Object[]> fields = this.getFields();
|
| | | Map<Integer, Object[]> fieldsMap = new HashMap<Integer, Object[]>();
|
| | | for (Object[] objects : fields) {
|
| | | Excel attr = (Excel) objects[1];
|
| | | Integer column = cellMap.get(attr.name());
|
| | | if (column != null) {
|
| | | fieldsMap.put(column, objects);
|
| | | }
|
| | | }
|
| | |
|
| | | for (int i = titleNum + 1; i <= rows; i++) {
|
| | | Row row = sheet.getRow(i);
|
| | | if (isRowEmpty(row)) {
|
| | | continue;
|
| | | }
|
| | | T entity = null;
|
| | | for (Map.Entry<Integer, Object[]> entry : fieldsMap.entrySet()) {
|
| | | Object val = this.getCellValue(row, entry.getKey());
|
| | | entity = (entity == null ? clazz.newInstance() : entity);
|
| | | Field field = (Field) entry.getValue()[0];
|
| | | Excel attr = (Excel) entry.getValue()[1];
|
| | | Class<?> fieldType = field.getType();
|
| | |
|
| | | // 以䏿¯åææ°æ®ç±»å转æ¢ãåå
¸è§£æçé»è¾ï¼å®å
¨å¤ç¨ï¼
|
| | | if (String.class == fieldType) {
|
| | | String s = Convert.toStr(val);
|
| | | if (s.matches("^\\d+\\.0$")) {
|
| | | val = StringUtils.substringBefore(s, ".0");
|
| | | } else {
|
| | | String dateFormat = field.getAnnotation(Excel.class).dateFormat();
|
| | | if (StringUtils.isNotEmpty(dateFormat)) {
|
| | | val = parseDateToStr(dateFormat, val);
|
| | | } else {
|
| | | val = Convert.toStr(val);
|
| | | }
|
| | | }
|
| | | } else if ((Integer.TYPE == fieldType || Integer.class == fieldType) && StringUtils.isNumeric(Convert.toStr(val))) {
|
| | | val = Convert.toInt(val);
|
| | | } else if ((Long.TYPE == fieldType || Long.class == fieldType) && StringUtils.isNumeric(Convert.toStr(val))) {
|
| | | val = Convert.toLong(val);
|
| | | } else if (Double.TYPE == fieldType || Double.class == fieldType) {
|
| | | val = Convert.toDouble(val);
|
| | | } else if (Float.TYPE == fieldType || Float.class == fieldType) {
|
| | | val = Convert.toFloat(val);
|
| | | } else if (BigDecimal.class == fieldType) {
|
| | | val = Convert.toBigDecimal(val);
|
| | | } else if (Date.class == fieldType) {
|
| | | if (val instanceof String) {
|
| | | val = DateUtils.parseDate(val);
|
| | | } else if (val instanceof Double) {
|
| | | val = DateUtil.getJavaDate((Double) val);
|
| | | }
|
| | | } else if (Boolean.TYPE == fieldType || Boolean.class == fieldType) {
|
| | | val = Convert.toBool(val, false);
|
| | | }
|
| | |
|
| | | if (StringUtils.isNotNull(fieldType)) {
|
| | | String propertyName = field.getName();
|
| | | if (StringUtils.isNotEmpty(attr.targetAttr())) {
|
| | | propertyName = field.getName() + "." + attr.targetAttr();
|
| | | }
|
| | | if (StringUtils.isNotEmpty(attr.readConverterExp())) {
|
| | | val = reverseByExp(Convert.toStr(val), attr.readConverterExp(), attr.separator());
|
| | | } else if (StringUtils.isNotEmpty(attr.dictType())) {
|
| | | if (!sysDictMap.containsKey(attr.dictType() + val)) {
|
| | | String dictValue = reverseDictByExp(Convert.toStr(val), attr.dictType(), attr.separator());
|
| | | sysDictMap.put(attr.dictType() + val, dictValue);
|
| | | }
|
| | | val = sysDictMap.get(attr.dictType() + val);
|
| | | } else if (!attr.handler().equals(ExcelHandlerAdapter.class)) {
|
| | | val = dataFormatHandlerAdapter(val, attr, null);
|
| | | } else if (ColumnType.IMAGE == attr.cellType() && StringUtils.isNotEmpty(pictures)) {
|
| | | StringBuilder propertyString = new StringBuilder();
|
| | | List<PictureData> images = pictures.get(row.getRowNum() + "_" + entry.getKey());
|
| | | for (PictureData picture : images) {
|
| | | byte[] data = picture.getData();
|
| | | String fileName = FileUtils.writeImportBytes(data);
|
| | | propertyString.append(fileName).append(SEPARATOR);
|
| | | }
|
| | | val = StringUtils.stripEnd(propertyString.toString(), SEPARATOR);
|
| | | }
|
| | | ReflectUtils.invokeSetter(entity, propertyName, val);
|
| | | }
|
| | | }
|
| | | list.add(entity);
|
| | | }
|
| | | }
|
| | | return list;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 对listæ°æ®æºå°å
¶éé¢çæ°æ®å¯¼å
¥å°excel表å
|
| | | *
|
| | | * @param list å¯¼åºæ°æ®éå
|
| | |
| | | if(CollectionUtils.isEmpty(approveProcesses)){ |
| | | approveProcesses = new ArrayList<>(); |
| | | } |
| | | // æ¥è¯¢æªé¢ç¨å³ä¿è®°å½ |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | |
| | | LaborIssue laborIssue1 = new LaborIssue(); |
| | | laborIssue1.setAdoptedDate(new Date()); |
| | | laborIssue1.setIssueDate(sdf.parse(sdf.format(new Date()))); |
| | | List<LaborIssue> laborIssues = lavorIssueMapper.list(laborIssue1); |
| | | if(!CollectionUtils.isEmpty(laborIssues)){ |
| | | for (LaborIssue laborIssue : laborIssues) { |
| | | ApproveProcess approveProcess = new ApproveProcess(); |
| | | approveProcess.setApproveId(laborIssue.getOrderNo()); |
| | | approveProcess.setApproveDeptName(sysDeptMapper.selectDeptById(loginUser.getTenantId()).getDeptName()); |
| | | approveProcess.setApproveTime(laborIssue.getIssueDate()); |
| | | approveProcess.setApproveReason(laborIssue.getDictTypeName() + "-" + laborIssue.getDictName() + "è¶
æ¶æªé¢å"); |
| | | approveProcesses.add(approveProcess); |
| | | } |
| | | } |
| | | // // æ¥è¯¢æªé¢ç¨å³ä¿è®°å½ |
| | | // SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | // |
| | | // LaborIssue laborIssue1 = new LaborIssue(); |
| | | // laborIssue1.setAdoptedDate(new Date()); |
| | | // laborIssue1.setIssueDate(sdf.parse(sdf.format(new Date()))); |
| | | // List<LaborIssue> laborIssues = lavorIssueMapper.list(laborIssue1); //staff_join_leave_record表被å é¤ |
| | | // if(!CollectionUtils.isEmpty(laborIssues)){ |
| | | // for (LaborIssue laborIssue : laborIssues) { |
| | | // ApproveProcess approveProcess = new ApproveProcess(); |
| | | // approveProcess.setApproveId(laborIssue.getOrderNo()); |
| | | // approveProcess.setApproveDeptName(sysDeptMapper.selectDeptById(loginUser.getTenantId()).getDeptName()); |
| | | // approveProcess.setApproveTime(laborIssue.getIssueDate()); |
| | | // approveProcess.setApproveReason(laborIssue.getDictTypeName() + "-" + laborIssue.getDictName() + "è¶
æ¶æªé¢å"); |
| | | // approveProcesses.add(approveProcess); |
| | | // } |
| | | // } |
| | | return approveProcesses; |
| | | } |
| | | |
| | |
| | | |
| | | private String typeName; |
| | | private Integer purchaseLedgerId; |
| | | private Long qualityInspectId; |
| | | |
| | | } |
| | |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate endDate; |
| | | |
| | | private Long productModelId; |
| | | |
| | | } |
| | |
| | | * 产åID |
| | | */ |
| | | private Long productModelId; |
| | | |
| | | private Long qualityInspectId; |
| | | } |
| | |
| | | .updateTime(LocalDateTime.now()) |
| | | .updateUser(loginUser.getUserId()) |
| | | .createBy(procurementDto.getNickName()) |
| | | .productModelId(detail.getProductModelId()); |
| | | .productModelId(detail.getProductModelId()) |
| | | .qualityInspectId(ObjectUtils.isNotNull(procurementDto.getQualityInspectId())?procurementDto.getQualityInspectId():0L); |
| | | this.save(procurementRecordBuilder.build()); |
| | | // å
¥åºæååæéè´æ°é |
| | | // LambdaQueryWrapper<SalesLedgerProduct> salesLedgerProductLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | |
| | | @Override |
| | | public IPage<ProcurementPageDto> listPageByProductProduction(Page page, ProcurementPageDto procurementDto) { |
| | | IPage<ProcurementPageDto> procurementPageDtoIPage = procurementRecordMapper.listPageByProductProduction(page, procurementDto); |
| | | |
| | | |
| | | List<ProcurementPageDto> procurementPageDtos = procurementPageDtoIPage.getRecords(); |
| | | // 计ç®å¾
å
¥åºæ°é |
| | | // æ¥è¯¢éè´è®°å½å·²å
¥åºæ°é |
| | | List<Integer> collect = procurementPageDtos.stream().map(ProcurementPageDto::getId).collect(Collectors.toList()); |
| | | if(CollectionUtils.isEmpty( collect)){ |
| | | return procurementPageDtoIPage; |
| | | } |
| | | LambdaQueryWrapper<ProcurementRecordOut> procurementRecordLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | procurementRecordLambdaQueryWrapper.in(ProcurementRecordOut::getProcurementRecordStorageId, collect) |
| | | .eq(ProcurementRecordOut::getType, 4); |
| | | List<ProcurementRecordOut> procurementRecords = procurementRecordOutMapper.selectList(procurementRecordLambdaQueryWrapper); |
| | | if(CollectionUtils.isEmpty( procurementRecords)){ |
| | | return procurementPageDtoIPage; |
| | | } |
| | | for (ProcurementPageDto dto : procurementPageDtos) { |
| | | // æ ¹æ®éè´å°è´¦IDçé对åºçåºåºè®°å½ |
| | | List<ProcurementRecordOut> collect1 = procurementRecords.stream() |
| | | .filter(ProcurementRecordOut -> ProcurementRecordOut.getProcurementRecordStorageId().equals(dto.getId())) |
| | | .collect(Collectors.toList()); |
| | | |
| | | // å¦ææ²¡æç¸å
³çåºåºè®°å½ï¼è·³è¿è¯¥æ¡æ°æ® |
| | | if(CollectionUtils.isEmpty(collect1)){ |
| | | dto.setInboundNum0(dto.getInboundNum()); |
| | | continue; |
| | | } |
| | | |
| | | // 计ç®å·²åºåºæ°éæ»åï¼å¹¶è®¾ç½®å¾
åºåºæ°é |
| | | BigDecimal totalInboundNum = collect1.stream() |
| | | .map(ProcurementRecordOut::getInboundNum) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | |
| | | // å¾
åºåºæ°é = æ»æ°é - å·²åºåºæ°é |
| | | dto.setInboundNum0(dto.getInboundNum().subtract(totalInboundNum)); |
| | | } |
| | | return procurementPageDtoIPage; |
| | | } |
| | | |
| | |
| | | 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); |
| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
| | | import com.github.xiaoymin.knife4j.core.util.StrUtil;
|
| | | import com.ruoyi.common.utils.SecurityUtils;
|
| | | import com.ruoyi.project.system.domain.SysDept;
|
| | | import com.ruoyi.project.system.domain.SysUser;
|
| | | import com.ruoyi.project.system.domain.SysUserDept;
|
| | | import com.ruoyi.project.system.mapper.SysDeptMapper;
|
| | | import com.ruoyi.project.system.mapper.SysUserDeptMapper;
|
| | | import com.ruoyi.project.system.mapper.SysUserMapper;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.context.annotation.Lazy;
|
| | |
| | |
|
| | | @Autowired
|
| | | private SysUserMapper userMapper;
|
| | |
|
| | | @Autowired
|
| | | private SysDeptMapper deptMapper;
|
| | |
|
| | | @Autowired
|
| | | private SysUserDeptMapper userDeptMapper;
|
| | |
|
| | | @Autowired
|
| | | @Lazy
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public void simpleNoticeAll(String title, String message, Long tenantId,String jumpPath) {
|
| | | public void simpleNoticeAll(String title, String message, Long rootDeptId, String jumpPath) {
|
| | | Long userId = SecurityUtils.getLoginUser().getUserId();
|
| | | List<SysUser> sysUsers = userMapper.selectList(Wrappers.<SysUser>lambdaQuery()
|
| | | .eq(SysUser::getStatus, "0")
|
| | | .eq(SysUser::getTenantId, tenantId));
|
| | | List<SysNotice> collect = sysUsers.stream().map(it -> convertSysNotice(title, message, it.getUserId(),tenantId, jumpPath, userId)).collect(Collectors.toList());
|
| | | if (userId == null) {
|
| | | return;
|
| | | }
|
| | |
|
| | | // æ¥ææåé¨é¨
|
| | | List<SysDept> childrenDepts = deptMapper.selectChildrenDeptById(rootDeptId);
|
| | |
|
| | | // ç»è£
deptIds
|
| | | List<Long> deptIds = childrenDepts.stream()
|
| | | .map(SysDept::getDeptId)
|
| | | .collect(Collectors.toList());
|
| | | deptIds.add(rootDeptId);
|
| | |
|
| | | // æ¥ç¨æ·ID
|
| | | List<Long> userIds = userDeptMapper.selectList(
|
| | | Wrappers.<SysUserDept>lambdaQuery()
|
| | | .in(SysUserDept::getDeptId, deptIds)
|
| | | ).stream()
|
| | | .map(SysUserDept::getUserId)
|
| | | .distinct()
|
| | | .collect(Collectors.toList());
|
| | |
|
| | | if (userIds.isEmpty()) {
|
| | | return;
|
| | | }
|
| | |
|
| | | // æ¥ç¨æ·
|
| | | List<SysUser> sysUsers = userMapper.selectList(
|
| | | Wrappers.<SysUser>lambdaQuery()
|
| | | .eq(SysUser::getStatus, "0")
|
| | | .in(SysUser::getUserId, userIds)
|
| | | );
|
| | |
|
| | | // åéç¥
|
| | | List<SysNotice> collect = sysUsers.stream()
|
| | | .map(it -> convertSysNotice(
|
| | | title,
|
| | | message,
|
| | | it.getUserId(),
|
| | | it.getTenantId(),
|
| | | jumpPath,
|
| | | userId
|
| | | ))
|
| | | .collect(Collectors.toList());
|
| | |
|
| | | sysNoticeService.saveBatch(collect);
|
| | | }
|
| | |
|
| | |
| | | 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()); |
| | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.UUID; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int delRegistration(Long[] ids) { |
| | | // å é¤éè´å°è´¦äº§åå¼ç¥¨è®°å½å¯¹è±¡ |
| | | LambdaQueryWrapper<ProductRecord> productRecordLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | productRecordLambdaQueryWrapper.in(ProductRecord::getId, Arrays.asList(ids)); |
| | | List<ProductRecord> productRecords = productRecordMapper.selectList(productRecordLambdaQueryWrapper); |
| | | if(CollectionUtils.isEmpty(productRecords)){ |
| | | |
| | | // æ¥è¯¢è¦å é¤çäº§åæ¥ç¥¨è®°å½ |
| | | LambdaQueryWrapper<ProductRecord> productWrapper = new LambdaQueryWrapper<>(); |
| | | productWrapper.in(ProductRecord::getId, Arrays.asList(ids)); |
| | | List<ProductRecord> productRecords = productRecordMapper.selectList(productWrapper); |
| | | |
| | | if (CollectionUtils.isEmpty(productRecords)) { |
| | | return 0; |
| | | } |
| | | LambdaQueryWrapper<TicketRegistration> ticketRegistrationLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | ticketRegistrationLambdaQueryWrapper.in(TicketRegistration::getId, productRecords.stream().map(ProductRecord::getTicketRegistrationId).collect(Collectors.toList())); |
| | | List<TicketRegistration> ticketRegistrations = ticketRegistrationMapper.selectList(ticketRegistrationLambdaQueryWrapper); |
| | | |
| | | // ä¿®æ¹äº§åä¿¡æ¯ |
| | | for (ProductRecord productRecord : productRecords) { |
| | | BigDecimal subtract = ticketRegistrations.get(0).getInvoiceAmount().subtract(productRecords.get(0).getTicketsAmount()); |
| | | // å°äºçäº0å é¤ ï¼å¤§äº0ä¿®æ¹ |
| | | if(subtract.compareTo(BigDecimal.ZERO) <= 0){ |
| | | ticketRegistrationMapper.deleteById(ticketRegistrations.get(0)); |
| | | // å é¤ä»æ¬¾æµæ°´è®°å½ |
| | | paymentRegistrationMapper.delete(new LambdaQueryWrapper<PaymentRegistration>().eq(PaymentRegistration::getTicketRegistrationId, ticketRegistrations.get(0).getId())); |
| | | }else if(subtract.compareTo(BigDecimal.ZERO) > 0){ |
| | | ticketRegistrations.get(0).setInvoiceAmount(subtract); |
| | | ticketRegistrationMapper.updateById(ticketRegistrations.get(0)); |
| | | } |
| | | LambdaQueryWrapper<SalesLedgerProduct> salesLedgerProductLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | salesLedgerProductLambdaQueryWrapper.eq(SalesLedgerProduct::getId, productRecord.getSaleLedgerProjectId()) |
| | | .eq(SalesLedgerProduct::getType, 2); |
| | | List<SalesLedgerProduct> salesLedgerProducts = salesLedgerProductMapper.selectList(salesLedgerProductLambdaQueryWrapper); |
| | | if(!CollectionUtils.isEmpty(salesLedgerProducts)){ |
| | | for (SalesLedgerProduct salesLedgerProduct : salesLedgerProducts) { |
| | | salesLedgerProduct.setFutureTickets(salesLedgerProduct.getFutureTickets().add(productRecord.getTicketsNum())); |
| | | salesLedgerProduct.setFutureTicketsAmount(salesLedgerProduct.getFutureTicketsAmount().add(productRecord.getTicketsAmount())); |
| | | salesLedgerProductMapper.updateById(salesLedgerProduct); |
| | | // æ¶éå
³èID |
| | | Set<Long> ticketRegistrationIds = productRecords.stream() |
| | | .map(ProductRecord::getTicketRegistrationId) |
| | | .collect(Collectors.toSet()); |
| | | |
| | | } |
| | | Set<Long> salesLedgerProductIds = productRecords.stream() |
| | | .map(ProductRecord::getSaleLedgerProjectId) |
| | | .collect(Collectors.toSet()); |
| | | |
| | | // æ¥è¯¢æ¥ç¥¨ç»è®° |
| | | List<TicketRegistration> ticketRegistrations = |
| | | ticketRegistrationMapper.selectBatchIds(ticketRegistrationIds); |
| | | |
| | | // å¤çæ¥ç¥¨ç»è®°éé¢ã仿¬¾æµæ°´ |
| | | for (TicketRegistration ticket : ticketRegistrations) { |
| | | |
| | | // 该æ¥ç¥¨ç»è®°ä¸ææäº§åè®°å½ |
| | | List<ProductRecord> recordsOfTicket = productRecords.stream() |
| | | .filter(r -> r.getTicketRegistrationId().equals(ticket.getId())) |
| | | .collect(Collectors.toList()); |
| | | |
| | | // 计ç®è¦åéçéé¢ |
| | | BigDecimal rollbackAmount = recordsOfTicket.stream() |
| | | .map(ProductRecord::getTicketsAmount) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | |
| | | BigDecimal remain = ticket.getInvoiceAmount().subtract(rollbackAmount); |
| | | |
| | | if (remain.compareTo(BigDecimal.ZERO) <= 0) { |
| | | // å 餿¥ç¥¨ç»è®° |
| | | ticketRegistrationMapper.deleteById(ticket.getId()); |
| | | // å é¤ä»æ¬¾æµæ°´ |
| | | paymentRegistrationMapper.delete( |
| | | new LambdaQueryWrapper<PaymentRegistration>() |
| | | .eq(PaymentRegistration::getTicketRegistrationId, ticket.getId()) |
| | | ); |
| | | } else { |
| | | ticket.setInvoiceAmount(remain); |
| | | ticketRegistrationMapper.updateById(ticket); |
| | | } |
| | | } |
| | | // å é¤éè´å°è´¦äº§åå¼ç¥¨è®°å½ |
| | | productRecordMapper.delete(productRecordLambdaQueryWrapper); |
| | | |
| | | // åééå®å°è´¦äº§åçæªæ¥ç¥¨ |
| | | for (ProductRecord record : productRecords) { |
| | | |
| | | LambdaQueryWrapper<SalesLedgerProduct> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(SalesLedgerProduct::getId, record.getSaleLedgerProjectId()) |
| | | .eq(SalesLedgerProduct::getType, 2); |
| | | |
| | | SalesLedgerProduct product = salesLedgerProductMapper.selectOne(wrapper); |
| | | if (product != null) { |
| | | product.setFutureTickets( |
| | | product.getFutureTickets().add(record.getTicketsNum()) |
| | | ); |
| | | product.setFutureTicketsAmount( |
| | | product.getFutureTicketsAmount().add(record.getTicketsAmount()) |
| | | ); |
| | | salesLedgerProductMapper.updateById(product); |
| | | } |
| | | } |
| | | |
| | | // å é¤äº§åæ¥ç¥¨è®°å½ |
| | | productRecordMapper.delete(productWrapper); |
| | | |
| | | // éæ°è®¡ç® currentInvoiceAmount |
| | | for (Long productId : salesLedgerProductIds) { |
| | | refreshCurrentInvoiceAmount(productId); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | private void refreshCurrentInvoiceAmount(Long salesLedgerProductId) { |
| | | |
| | | // æ¥è¯¢è¯¥äº§åææ°ä¸æ¡æ¥ç¥¨è®°å½ |
| | | LambdaQueryWrapper<ProductRecord> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(ProductRecord::getSaleLedgerProjectId, salesLedgerProductId) |
| | | .orderByDesc(ProductRecord::getCreatedAt) |
| | | .last("limit 1"); |
| | | |
| | | ProductRecord latestRecord = productRecordMapper.selectOne(wrapper); |
| | | |
| | | SalesLedgerProduct product = |
| | | salesLedgerProductMapper.selectById(salesLedgerProductId); |
| | | |
| | | if (product == null) { |
| | | return; |
| | | } |
| | | |
| | | if (latestRecord == null) { |
| | | // 没æä»»ä½æ¥ç¥¨è®°å½ |
| | | product.setTicketsAmount(BigDecimal.ZERO); |
| | | } else { |
| | | // æ°¸è¿åææ°ä¸æ¡ |
| | | product.setTicketsAmount(latestRecord.getTicketsAmount()); |
| | | } |
| | | |
| | | salesLedgerProductMapper.updateById(product); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public TicketRegistrationDto getRegistrationById(TicketRegistrationDto ticketRegistrationDto) { |
| | | TicketRegistration ticketRegistration = ticketRegistrationMapper.selectById(ticketRegistrationDto.getId()); |
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.procurementrecord.pojo.ProcurementRecordStorage; |
| | | import com.ruoyi.procurementrecord.service.ProcurementRecordService; |
| | | import com.ruoyi.procurementrecord.service.impl.ProcurementRecordServiceImpl; |
| | | import com.ruoyi.quality.dto.QualityInspectDto; |
| | | import com.ruoyi.quality.pojo.QualityInspect; |
| | | import com.ruoyi.quality.pojo.QualityInspectFile; |
| | |
| | | import com.ruoyi.quality.service.IQualityInspectParamService; |
| | | import com.ruoyi.quality.service.IQualityInspectService; |
| | | import com.ruoyi.quality.service.IQualityUnqualifiedService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | |
| | | @Resource |
| | | private IQualityInspectFileService qualityInspectFileService; |
| | | @Autowired |
| | | private ProcurementRecordService procurementRecordService; |
| | | |
| | | |
| | | /** |
| | |
| | | //å 餿£éªéä»¶ |
| | | qualityInspectFileService.remove(Wrappers.<QualityInspectFile>lambdaQuery() |
| | | .in(QualityInspectFile::getInspectId,ids)); |
| | | //å é¤å
¥åºè®°å½ |
| | | procurementRecordService.remove(Wrappers.<ProcurementRecordStorage>lambdaQuery().in(ProcurementRecordStorage::getQualityInspectId,ids)); |
| | | //å 餿£éªå |
| | | return AjaxResult.success(qualityInspectService.removeBatchByIds(ids)); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.quality.dto.QualityInspectDto; |
| | | import com.ruoyi.quality.pojo.QualityInspect; |
| | | import com.ruoyi.staff.pojo.StaffJoinLeaveRecord; |
| | | import com.ruoyi.staff.pojo.StaffOnJob; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | public interface IQualityInspectService extends IService<QualityInspect> { |
| | | |
| | |
| | | package com.ruoyi.quality.service.impl; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | 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.procurementrecord.service.ProcurementRecordService; |
| | | import com.ruoyi.quality.dto.QualityInspectDto; |
| | | import com.ruoyi.quality.mapper.QualityInspectMapper; |
| | | import com.ruoyi.quality.mapper.QualityInspectParamMapper; |
| | | import com.ruoyi.quality.mapper.QualityTestStandardMapper; |
| | | import com.ruoyi.quality.mapper.QualityUnqualifiedMapper; |
| | | import com.ruoyi.quality.pojo.QualityInspect; |
| | | import com.ruoyi.quality.pojo.QualityInspectParam; |
| | | import com.ruoyi.quality.pojo.QualityTestStandard; |
| | | import com.ruoyi.quality.pojo.QualityUnqualified; |
| | | import com.ruoyi.quality.service.IQualityInspectParamService; |
| | | import com.ruoyi.quality.service.IQualityInspectService; |
| | | import com.ruoyi.sales.mapper.SalesLedgerProductMapper; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import com.ruoyi.staff.mapper.StaffJoinLeaveRecordMapper; |
| | | import com.ruoyi.staff.mapper.StaffOnJobMapper; |
| | | import com.ruoyi.staff.pojo.StaffJoinLeaveRecord; |
| | | import com.ruoyi.staff.pojo.StaffOnJob; |
| | | import com.ruoyi.staff.service.IStaffOnJobService; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | if ("åæ ¼".equals(qualityInspect.getCheckResult())) { |
| | | ProcurementAddDto procurementRecordOutAdd = new ProcurementAddDto(); |
| | | procurementRecordOutAdd.setType(1); |
| | | procurementRecordOutAdd.setTypeName("éè´å
¥åº"); |
| | | procurementRecordOutAdd.setTypeName("éè´åæææ£éªåæ ¼å
¥åº"); |
| | | procurementRecordOutAdd.setNickName(loginUser.getNickName()); |
| | | procurementRecordOutAdd.setPurchaseLedgerId(Math.toIntExact(qualityInspect.getPurchaseLedgerId())); |
| | | if (qualityInspect.getPurchaseLedgerId() == null) { |
| | |
| | | details.setProductModelId(qualityInspect.getProductModelId()); |
| | | detailss.add( details); |
| | | procurementRecordOutAdd.setDetails(detailss); |
| | | procurementRecordOutAdd.setQualityInspectId(qualityInspect.getId()); |
| | | procurementRecordService.add(procurementRecordOutAdd); |
| | | } |
| | | }else if (qualityInspect.getInspectType() == 1) { |
| | | //æ¥è¯¢UnitPrice/TotalPrice |
| | | ProcurementAddDto procurementRecordOutAdd = new ProcurementAddDto(); |
| | | procurementRecordOutAdd.setType(2); |
| | | procurementRecordOutAdd.setTypeName("ç产å
¥åº"); |
| | | procurementRecordOutAdd.setTypeName("ç产è¿ç¨æ£éªåæ ¼å
¥åº"); |
| | | procurementRecordOutAdd.setNickName(loginUser.getNickName()); |
| | | List<Details> details = new ArrayList<>(); |
| | | Details details1 = new Details(); |
| | |
| | | .updateTime(LocalDateTime.now()) |
| | | .updateUser(loginUser.getUserId()) |
| | | .createBy(procurementRecordOutAdd.getNickName()) |
| | | .productModelId(details1.getProductModelId()); |
| | | .productModelId(details1.getProductModelId()) |
| | | .qualityInspectId(qualityInspect.getId()); |
| | | procurementRecordService.save(procurementRecordBuilder.build()); |
| | | |
| | | |
| | |
| | | SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectSalesLedgerProductByMainId(qualityInspect.getProductMainId()); |
| | | ProcurementAddDto procurementRecordOutAdd = new ProcurementAddDto(); |
| | | procurementRecordOutAdd.setType(2); |
| | | procurementRecordOutAdd.setTypeName("ç产å
¥åº"); |
| | | procurementRecordOutAdd.setTypeName("ç产åºåæ£éªåæ ¼å
¥åº"); |
| | | procurementRecordOutAdd.setNickName(loginUser.getNickName()); |
| | | List<Details> details = new ArrayList<>(); |
| | | Details details1 = new Details(); |
| | |
| | | details1.setProductModelId(salesLedgerProduct.getProductModelId()); |
| | | details.add(details1); |
| | | procurementRecordOutAdd.setDetails(details); |
| | | procurementRecordOutAdd.setQualityInspectId(qualityInspect.getId()); |
| | | procurementRecordService.add(procurementRecordOutAdd); |
| | | } |
| | | qualityInspect.setInspectState(1);//å·²æäº¤ |
| | |
| | | import com.ruoyi.sales.pojo.SalesLedger; |
| | | import com.ruoyi.sales.service.ICommonFileService; |
| | | import com.ruoyi.sales.service.ISalesLedgerService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.math.BigDecimal; |
| | |
| | | @RestController |
| | | @RequestMapping("/sales/ledger") |
| | | @AllArgsConstructor |
| | | @Api(tags = "éå®å°è´¦") |
| | | public class SalesLedgerController extends BaseController { |
| | | |
| | | private ISalesLedgerService salesLedgerService; |
| | |
| | | private ReceiptPaymentMapper receiptPaymentMapper; |
| | | |
| | | /** |
| | | * 导å
¥éå®å°è´¦ |
| | | */ |
| | | @Log(title = "导å
¥éå®å°è´¦", businessType = BusinessType.INSERT) |
| | | @PostMapping("/import") |
| | | @ApiOperation("导å
¥éå®å°è´¦") |
| | | public AjaxResult importData(@RequestParam("file") |
| | | @ApiParam(value = "Excelæä»¶", required = true) |
| | | MultipartFile file) { |
| | | return salesLedgerService.importData(file); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢éå®å°è´¦å表 |
| | | */ |
| | | @GetMapping("/list") |
| | |
| | | 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); |
| | | } |
| | |
| | | |
| | | // 审æ¹éè¿ |
| | | if (req.getApproveStatus() == 3) { |
| | | // æ¥è¯¢éè´å
¥åºè®°å½ |
| | | LambdaQueryWrapper<ProcurementRecordStorage> lambdaQueryWrapper = new LambdaQueryWrapper<ProcurementRecordStorage>() |
| | | .eq(ProcurementRecordStorage::getSalesLedgerProductId, req.getSalesLedgerProductId()); |
| | | ProcurementRecordStorage procurementRecordStorage = procurementRecordStorageService.getOne(lambdaQueryWrapper); |
| | | |
| | | if (procurementRecordStorage == null) { |
| | | // ä¿è¯åé¢çä¿®æ¹å
¨é¨åæ» |
| | | throw new ServiceException("éè´è®°å½ä¸åå¨ï¼å®¡æ¹åæ»"); |
| | | } |
| | | // // æ¥è¯¢éè´å
¥åºè®°å½ |
| | | // LambdaQueryWrapper<ProcurementRecordStorage> lambdaQueryWrapper = new LambdaQueryWrapper<ProcurementRecordStorage>() |
| | | // .eq(ProcurementRecordStorage::getSalesLedgerProductId, req.getSalesLedgerProductId()); |
| | | // ProcurementRecordStorage procurementRecordStorage = procurementRecordStorageService.getOne(lambdaQueryWrapper); |
| | | // |
| | | // if (procurementRecordStorage == null) { |
| | | // // ä¿è¯åé¢çä¿®æ¹å
¨é¨åæ» |
| | | // throw new ServiceException("éè´è®°å½ä¸åå¨ï¼å®¡æ¹åæ»"); |
| | | // } |
| | | |
| | | // çæåºåºè®°å½ |
| | | ProcurementRecordOutAdd procurementRecordOutAdd = new ProcurementRecordOutAdd(); |
| | | procurementRecordOutAdd.setId(procurementRecordStorage.getId()); |
| | | // procurementRecordOutAdd.setId(procurementRecordStorage.getId()); |
| | | procurementRecordOutAdd.setId(0); |
| | | procurementRecordOutAdd.setProductModelId(salesLedgerProduct.getProductModelId()); |
| | | procurementRecordOutAdd.setSalesLedgerProductId((long) Math.toIntExact(salesLedgerProduct.getId())); |
| | | procurementRecordOutAdd.setType(2); |
| | | procurementRecordOutAdd.setUserId(Math.toIntExact(getUserId())); |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.sales.dto; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import com.ruoyi.sales.pojo.CommonFile; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author :yys |
| | | * @date : 2026/1/19 9:50 |
| | | */ |
| | | @Data |
| | | public class SalesLedgerImportDto extends SalesLedgerProductImportDto{ |
| | | |
| | | @Excel(name = "éå®åå·") |
| | | private String salesContractNo; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @Excel(name = "å½å
¥æ¥æ", width = 30, dateFormat = "yyyy-MM-dd") |
| | | private Date entryDate; |
| | | |
| | | @Excel(name = "ä¸å¡å") |
| | | private String salesman; |
| | | @Excel(name = "客æ·åç§°") |
| | | private String customerName; |
| | | @Excel(name = "å½å
¥äºº") |
| | | private String entryPerson; |
| | | @Excel(name = "夿³¨") |
| | | private String remarks; |
| | | |
| | | @ApiModelProperty(value = "ç¾è®¢æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @Excel(name = "ç¾è®¢æ¥æ", width = 30, dateFormat = "yyyy-MM-dd") |
| | | private Date executionDate; |
| | | |
| | | @Excel(name = "ååéé¢") |
| | | private BigDecimal contractAmount; |
| | | |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.sales.dto; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author :yys |
| | | * @date : 2026/1/19 9:59 |
| | | */ |
| | | @Data |
| | | public class SalesLedgerProductImportDto { |
| | | |
| | | @Excel(name = "éå®åå·") |
| | | private String salesContractNo; |
| | | |
| | | |
| | | /** |
| | | * 产å大类 |
| | | */ |
| | | @Excel(name = "产å大类") |
| | | private String productCategory; |
| | | |
| | | /** |
| | | * è§æ ¼åå· |
| | | */ |
| | | @Excel(name = "è§æ ¼åå·") |
| | | private String specificationModel; |
| | | |
| | | /** |
| | | * åä½ |
| | | */ |
| | | @Excel(name = "åä½") |
| | | private String unit; |
| | | |
| | | /** |
| | | * æ°é |
| | | */ |
| | | @Excel(name = "æ°é") |
| | | private BigDecimal quantity; |
| | | |
| | | /** |
| | | * ç¨ç |
| | | */ |
| | | @Excel(name = "ç¨ç") |
| | | private BigDecimal taxRate; |
| | | |
| | | /** |
| | | * å«ç¨åä»· |
| | | */ |
| | | @Excel(name = "å«ç¨åä»·") |
| | | private BigDecimal taxInclusiveUnitPrice; |
| | | |
| | | /** |
| | | * å«ç¨æ»ä»· |
| | | */ |
| | | @Excel(name = "å«ç¨æ»ä»·") |
| | | private BigDecimal taxInclusiveTotalPrice; |
| | | |
| | | /** |
| | | * å票类å |
| | | */ |
| | | @Excel(name = "å票类å") |
| | | private String invoiceType; |
| | | |
| | | /** |
| | | * æ¯å¦è´¨æ£ |
| | | */ |
| | | @Excel(name = "æ¯å¦è´¨æ£", readConverterExp = "0=å¦,1=æ¯") |
| | | private Boolean isChecked; |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | private BigDecimal futureTicketsAmount=BigDecimal.ZERO; |
| | | |
| | | @ApiModelProperty(value = "å¼ç¥¨æ°") |
| | | private BigDecimal invoiceNum; |
| | | private BigDecimal invoiceNum = BigDecimal.ZERO; |
| | | |
| | | @ApiModelProperty(value = "æªå¼ç¥¨æ°") |
| | | private BigDecimal noInvoiceNum; |
| | | private BigDecimal noInvoiceNum = BigDecimal.ZERO; |
| | | |
| | | @ApiModelProperty(value = "å¼ç¥¨éé¢") |
| | | private BigDecimal invoiceAmount; |
| | | private BigDecimal invoiceAmount = BigDecimal.ZERO; |
| | | |
| | | @ApiModelProperty(value = "æªå¼ç¥¨éé¢") |
| | | private BigDecimal noInvoiceAmount; |
| | | private BigDecimal noInvoiceAmount = BigDecimal.ZERO; |
| | | |
| | | @ApiModelProperty(value = "æ¬æ¬¡å¼ç¥¨æ°") |
| | | @TableField(exist = false) |
| | |
| | | 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.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.sales.dto.MonthlyAmountDto; |
| | | import com.ruoyi.sales.dto.SalesLedgerDto; |
| | | import com.ruoyi.sales.pojo.SalesLedger; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | |
| | | List<MonthlyAmountDto> getAmountHalfYear(Integer type); |
| | | |
| | | IPage<SalesLedger> selectSalesLedgerListPage(Page page, SalesLedgerDto salesLedgerDto); |
| | | |
| | | AjaxResult importData(MultipartFile file); |
| | | } |
| | |
| | | if(ledgerProduct.getId().intValue() == registrationProductDto.getSalesLedgerProductId()){ |
| | | invoiceNum = invoiceNum.add(registrationProductDto.getInvoiceNum()); |
| | | invoiceAmount = invoiceAmount.add(registrationProductDto.getInvoiceAmount()); |
| | | noInvoiceNum = ledgerProduct.getQuantity().subtract(invoiceNum); |
| | | noInvoiceAmount = ledgerProduct.getTaxInclusiveTotalPrice().subtract(invoiceAmount); |
| | | } |
| | | } |
| | | noInvoiceNum = ledgerProduct.getQuantity().subtract(invoiceNum); |
| | | noInvoiceAmount = ledgerProduct.getTaxInclusiveTotalPrice().subtract(invoiceAmount); |
| | | ledgerProduct.setInvoiceNum(invoiceNum); |
| | | ledgerProduct.setInvoiceAmount(invoiceAmount); |
| | | ledgerProduct.setNoInvoiceNum(noInvoiceNum); |
| | |
| | | productProcessRouteItem.setProcessId(processRouteItem.getProcessId()); |
| | | productProcessRouteItem.setProductOrderId(productOrder.getId()); |
| | | productProcessRouteItem.setProductRouteId(productProcessRoute.getId()); |
| | | productProcessRouteItem.setDragSort(processRouteItem.getDragSort()); |
| | | int insert = productProcessRouteItemMapper.insert(productProcessRouteItem); |
| | | if (insert > 0) { |
| | | // æ¥è¯¢ä»æ¥å·²åå¨çæå¤§å·¥åå· |
| | |
| | | import com.ruoyi.account.pojo.AccountIncome; |
| | | import com.ruoyi.account.service.AccountIncomeService; |
| | | import com.ruoyi.basic.mapper.CustomerMapper; |
| | | import com.ruoyi.basic.mapper.ProductMapper; |
| | | import com.ruoyi.basic.mapper.ProductModelMapper; |
| | | import com.ruoyi.basic.pojo.Customer; |
| | | import com.ruoyi.basic.pojo.Product; |
| | | import com.ruoyi.basic.pojo.ProductModel; |
| | | import com.ruoyi.common.enums.FileNameType; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.other.mapper.TempFileMapper; |
| | | import com.ruoyi.other.pojo.TempFile; |
| | | import com.ruoyi.production.dto.ProductStructureDto; |
| | | import com.ruoyi.production.mapper.*; |
| | | import com.ruoyi.production.pojo.*; |
| | | import com.ruoyi.project.system.domain.SysDept; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.mapper.SysDeptMapper; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import com.ruoyi.quality.mapper.QualityInspectMapper; |
| | | import com.ruoyi.quality.pojo.QualityInspect; |
| | | import com.ruoyi.sales.dto.MonthlyAmountDto; |
| | | import com.ruoyi.sales.dto.SalesLedgerDto; |
| | | import com.ruoyi.sales.dto.SalesLedgerImportDto; |
| | | import com.ruoyi.sales.dto.SalesLedgerProductImportDto; |
| | | import com.ruoyi.sales.mapper.*; |
| | | import com.ruoyi.sales.pojo.*; |
| | | import com.ruoyi.sales.service.ISalesLedgerProductService; |
| | |
| | | import org.springframework.data.redis.core.script.DefaultRedisScript; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.lang.reflect.Field; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.nio.file.Files; |
| | | import java.nio.file.Path; |
| | | import java.nio.file.Paths; |
| | |
| | | private final RedisTemplate<String, String> redisTemplate; |
| | | @Autowired |
| | | private ProductModelMapper productModelMapper; |
| | | |
| | | @Autowired |
| | | private ProductMapper productMapper; |
| | | @Autowired |
| | | private ProductStructureMapper productStructureMapper; |
| | | |
| | |
| | | return salesLedgerMapper.selectSalesLedgerListPage(page, salesLedgerDto); |
| | | } |
| | | |
| | | @Autowired |
| | | private SysUserMapper sysUserMapper; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult importData(MultipartFile file) { |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | try { |
| | | InputStream inputStream = file.getInputStream(); |
| | | ExcelUtil<SalesLedgerImportDto> salesLedgerImportDtoExcelUtil = new ExcelUtil<>(SalesLedgerImportDto.class); |
| | | Map<String, List<SalesLedgerImportDto>> stringListMap = salesLedgerImportDtoExcelUtil.importExcelMultiSheet(Arrays.asList("éå®å°è´¦æ°æ®","éå®äº§åæ°æ®"), inputStream, 0); |
| | | if(CollectionUtils.isEmpty(stringListMap)) return AjaxResult.error("éå®è¡¨æ ¼ä¸ºç©ºï¼"); |
| | | // ä¸å¡å±åå¹¶ |
| | | List<SalesLedgerImportDto> salesLedgerImportDtoList = stringListMap.get("éå®å°è´¦æ°æ®"); |
| | | if(CollectionUtils.isEmpty(salesLedgerImportDtoList)) return AjaxResult.error("éå®å°è´¦æ°æ®ä¸ºç©ºï¼"); |
| | | List<SalesLedgerImportDto> salesLedgerProductImportDtoList = stringListMap.get("éå®äº§åæ°æ®"); |
| | | if(CollectionUtils.isEmpty(salesLedgerProductImportDtoList)) return AjaxResult.error("éå®äº§åæ°æ®ä¸ºç©ºï¼"); |
| | | // å®¢æ·æ°æ® |
| | | List<Customer> customers = customerMapper.selectList(new LambdaQueryWrapper<Customer>().in(Customer::getCustomerName, |
| | | salesLedgerImportDtoList.stream().map(SalesLedgerImportDto::getCustomerName).toArray(String[]::new))); |
| | | // è§æ ¼åå·æ°æ® |
| | | List<ProductModel> productModels = productModelMapper.selectList(new LambdaQueryWrapper<ProductModel>().in(ProductModel::getModel, |
| | | salesLedgerImportDtoList.stream().map(SalesLedgerImportDto::getSpecificationModel).toArray(String[]::new))); |
| | | // 产åå¤§ç±»æ°æ® |
| | | List<Product> productList = productMapper.selectList(new LambdaQueryWrapper<Product>().in(Product::getProductName, |
| | | salesLedgerImportDtoList.stream().map(SalesLedgerImportDto::getProductCategory).toArray(String[]::new))); |
| | | // å½å
¥äººæ°æ® |
| | | List<SysUser> sysUsers = sysUserMapper.selectList(new LambdaQueryWrapper<SysUser>().in(SysUser::getNickName, |
| | | salesLedgerImportDtoList.stream().map(SalesLedgerImportDto::getEntryPerson).toArray(String[]::new))); |
| | | for (SalesLedgerImportDto salesLedgerImportDto : salesLedgerImportDtoList) { |
| | | SalesLedger salesLedger = new SalesLedger(); |
| | | BeanUtils.copyProperties(salesLedgerImportDto, salesLedger); |
| | | // éè¿å®¢æ·åç§°æ¥è¯¢å®¢æ·IDï¼å®¢æ·ååå· |
| | | salesLedger.setCustomerId(customers.stream() |
| | | .filter(customer -> customer.getCustomerName().equals(salesLedger.getCustomerName())) |
| | | .findFirst() |
| | | .map(Customer::getId) |
| | | .orElse(null)); |
| | | salesLedger.setCustomerContractNo(customers.stream() |
| | | .filter(customer -> customer.getCustomerName().equals(salesLedger.getCustomerName())) |
| | | .findFirst() |
| | | .map(Customer::getTaxpayerIdentificationNumber) |
| | | .orElse(null)); |
| | | Long aLong = sysUsers.stream() |
| | | .filter(sysUser -> sysUser.getNickName().equals(salesLedger.getEntryPerson())) |
| | | .findFirst() |
| | | .map(SysUser::getUserId) |
| | | .orElse(null); |
| | | if(aLong == null) throw new RuntimeException("å½å
¥äºº:"+salesLedger.getEntryPerson()+",æ 对åºç¨æ·ï¼"); |
| | | salesLedger.setEntryPerson(aLong.toString()); |
| | | salesLedgerMapper.insert(salesLedger); |
| | | // éå®äº§åæ°æ®ç»å®ï¼éè¿éå®åå·è·å对åºéå®äº§åæ°æ® |
| | | List<SalesLedgerProductImportDto> salesLedgerProductImportDtos = salesLedgerProductImportDtoList.stream() |
| | | .filter(salesLedgerProductImportDto -> salesLedgerProductImportDto.getSalesContractNo().equals(salesLedger.getSalesContractNo())) |
| | | .collect(Collectors.toList()); |
| | | if(CollectionUtils.isEmpty(salesLedgerProductImportDtos)) throw new RuntimeException("éå®åå·:"+salesLedgerImportDto.getSalesContractNo()+",æ 对åºäº§åæ°æ®ï¼"); |
| | | for (SalesLedgerProductImportDto salesLedgerProductImportDto : salesLedgerProductImportDtos) { |
| | | SalesLedgerProduct salesLedgerProduct = new SalesLedgerProduct(); |
| | | BeanUtils.copyProperties(salesLedgerProductImportDto, salesLedgerProduct); |
| | | salesLedgerProduct.setSalesLedgerId(salesLedger.getId()); |
| | | salesLedgerProduct.setType(1); |
| | | // 计ç®ä¸å«ç¨æ»ä»· |
| | | salesLedgerProduct.setTaxExclusiveTotalPrice(salesLedgerProduct.getTaxInclusiveTotalPrice().divide(new BigDecimal(1).add(salesLedgerProduct.getTaxRate().divide(new BigDecimal(100))), 2, RoundingMode.HALF_UP)); |
| | | salesLedgerProduct.setNoInvoiceNum(salesLedgerProduct.getQuantity()); |
| | | salesLedgerProduct.setNoInvoiceAmount(salesLedgerProduct.getTaxExclusiveTotalPrice()); |
| | | |
| | | salesLedgerProduct.setProductId(productList.stream() |
| | | .filter(product -> product.getProductName().equals(salesLedgerProduct.getProductCategory())) |
| | | .findFirst() |
| | | .map(Product::getId) |
| | | .orElse(null)); |
| | | salesLedgerProduct.setProductModelId(productModels.stream() |
| | | .filter(productModel -> productModel.getModel().equals(salesLedgerProduct.getSpecificationModel())) |
| | | .findFirst() |
| | | .map(ProductModel::getId) |
| | | .orElse(null)); |
| | | salesLedgerProduct.setRegister(loginUser.getNickName()); |
| | | salesLedgerProduct.setRegisterDate(LocalDateTime.now()); |
| | | salesLedgerProduct.setApproveStatus(0); |
| | | salesLedgerProduct.setPendingInvoiceTotal(salesLedgerProductImportDto.getTaxInclusiveTotalPrice()); |
| | | salesLedgerProductMapper.insert(salesLedgerProduct); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | return AjaxResult.success("导å
¥æå"); |
| | | }catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return AjaxResult.success("导å
¥å¤±è´¥"); |
| | | } |
| | | |
| | | // å
é¨ç±»ç¨äºåå¨èåç»æ |
| | | private static class GroupedCustomer { |
| | | private final Long customerId; |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.staff.pojo.PersonalAttendanceRecords; |
| | | import com.ruoyi.staff.pojo.StaffJoinLeaveRecord; |
| | | import com.ruoyi.staff.pojo.StaffOnJob; |
| | | import com.ruoyi.staff.service.PersonalAttendanceRecordsService; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | 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.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); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.staff.dto.StaffOnJobDto; |
| | | import com.ruoyi.staff.pojo.StaffJoinLeaveRecord; |
| | | import com.ruoyi.staff.pojo.StaffContract; |
| | | import com.ruoyi.staff.pojo.StaffOnJob; |
| | | import com.ruoyi.staff.service.IStaffJoinLeaveRecordService; |
| | | import com.ruoyi.staff.service.IStaffOnJobService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/staff/staffOnJob") |
| | | @Api(tags = "åå·¥å°è´¦/åå管ç") |
| | | @Api(tags = "åå·¥å°è´¦") |
| | | public class StaffOnJobController { |
| | | |
| | | @Resource |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/list") |
| | | public AjaxResult staffOnJobList() { |
| | | return AjaxResult.success(staffOnJobService.staffOnJobList()); |
| | | public AjaxResult staffOnJobList(StaffOnJob staffOnJob) { |
| | | return AjaxResult.success(staffOnJobService.staffOnJobList(staffOnJob)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/{id}") |
| | | public AjaxResult staffJoinLeaveRecordDetail(@PathVariable("id") Long id) { |
| | | public AjaxResult staffOnJobDetail(@PathVariable("id") Long id) { |
| | | return AjaxResult.success(staffOnJobService.staffOnJobDetail(id)); |
| | | } |
| | | |
| | | /** |
| | | * ç»ç¾åå |
| | | * @param id |
| | | * @param staffContract |
| | | * @return |
| | | */ |
| | | @PostMapping("/renewContract/{id}") |
| | | public AjaxResult renewContract(@PathVariable("id") Long id, @RequestBody StaffContract staffContract) { |
| | | return AjaxResult.success(staffOnJobService.renewContract(id, staffContract)); |
| | | } |
| | | |
| | | /** |
| | | * å¨èå工导å
¥ |
| | | */ |
| | | @PostMapping("/import") |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | 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 deptName; |
| | | |
| | | /** |
| | | * å²ä½ |
| | | */ |
| | | @Excel(name = "å²ä½",sort = 8) |
| | | private String postName; |
| | | |
| | | /** |
| | | * 第ä¸å¦å |
| | | */ |
| | | @Excel(name = "第ä¸å¦å", sort = 9) |
| | | private String firstStudy; |
| | | |
| | | /** |
| | | * ä¸ä¸ |
| | | */ |
| | | @Excel(name = "ä¸ä¸", sort = 10) |
| | | private String profession; |
| | | |
| | | /** |
| | | * 身份è¯å·ç |
| | | */ |
| | | @Excel(name = "身份è¯å·ç ", sort = 11) |
| | | private String identityCard; |
| | | |
| | | /** |
| | | * å¹´é¾ |
| | | */ |
| | | @Excel(name = "å¹´é¾", sort = 12) |
| | | private String age; |
| | | |
| | | /** |
| | | * èç³»çµè¯ |
| | | */ |
| | | @Excel(name = "èç³»çµè¯", sort = 13) |
| | | private String phone; |
| | | |
| | | /** |
| | | * ç´§æ¥è系人 |
| | | */ |
| | | @Excel(name = "ç´§æ¥è系人", sort = 14) |
| | | private String emergencyContact; |
| | | |
| | | /** |
| | | * ç´§æ¥è系人çµè¯ |
| | | */ |
| | | @Excel(name = "ç´§æ¥è系人çµè¯", sort = 15) |
| | | private String emergencyContactPhone; |
| | | } |
| | |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import com.ruoyi.staff.pojo.StaffJoinLeaveRecord; |
| | | import com.ruoyi.staff.pojo.StaffOnJob; |
| | | import lombok.Data; |
| | | |
| | |
| | | |
| | | @Data |
| | | public class StaffOnJobDto extends StaffOnJob { |
| | | @Excel(name = "å²ä½",sort = 7) |
| | | @Excel(name = "é¨é¨",sort = 7) |
| | | private String deptName; |
| | | |
| | | @Excel(name = "å²ä½",sort = 8) |
| | | private String postName; |
| | | |
| | | @Excel(name = "ååå¹´é") |
| | | private String contractTerm; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @Excel(name = "ååå¼å§æ¥æ", width = 30, dateFormat = "yyyy-MM-dd") |
| | | private Date contractStartTime; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @Excel(name = "ååç»ææ¥æ", width = 30, dateFormat = "yyyy-MM-dd") |
| | | private Date contractEndTime; |
| | | } |
| | |
| | | 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; |
| | |
| | | */ |
| | | private Integer sysPostId; |
| | | |
| | | /** |
| | | * é¨é¨ |
| | | */ |
| | | private Integer sysDeptId; |
| | | |
| | | /** |
| | | * å®¶åºä½å |
| | | */ |
| | |
| | | /** |
| | | * 第ä¸å¦å |
| | | */ |
| | | @Excel(name = "第ä¸å¦å", sort = 8) |
| | | @Excel(name = "第ä¸å¦å", sort = 9) |
| | | private String firstStudy; |
| | | |
| | | /** |
| | | * ä¸ä¸ |
| | | */ |
| | | @Excel(name = "ä¸ä¸", sort = 9) |
| | | @Excel(name = "ä¸ä¸", sort = 10) |
| | | private String profession; |
| | | |
| | | /** |
| | | * 身份è¯å·ç |
| | | */ |
| | | @Excel(name = "身份è¯å·ç ", sort = 10) |
| | | @Excel(name = "身份è¯å·ç ", sort = 11) |
| | | private String identityCard; |
| | | |
| | | /** |
| | | * å¹´é¾ |
| | | */ |
| | | @Excel(name = "å¹´é¾", sort = 11) |
| | | @Excel(name = "å¹´é¾", sort = 12) |
| | | private String age; |
| | | |
| | | /** |
| | | * èç³»çµè¯ |
| | | */ |
| | | @Excel(name = "èç³»çµè¯", sort = 12) |
| | | @Excel(name = "èç³»çµè¯", sort = 13) |
| | | private String phone; |
| | | |
| | | /** |
| | | * ç´§æ¥è系人 |
| | | */ |
| | | @Excel(name = "ç´§æ¥è系人", sort = 13) |
| | | @Excel(name = "ç´§æ¥è系人", sort = 14) |
| | | private String emergencyContact; |
| | | |
| | | /** |
| | | * ç´§æ¥è系人çµè¯ |
| | | */ |
| | | @Excel(name = "ç´§æ¥è系人çµè¯", sort = 14) |
| | | @Excel(name = "ç´§æ¥è系人çµè¯", sort = 15) |
| | | private String emergencyContactPhone; |
| | | |
| | | /** |
| | | * ååå¹´é |
| | | */ |
| | | @Excel(name = "ååå¹´é", sort = 15) |
| | | @Excel(name = "ååå¹´é", sort = 16) |
| | | private String contractTerm; |
| | | |
| | | /** |
| | | * ååå°ææ¥æ |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @Excel(name = "ååå°ææ¥æ", width = 30, dateFormat = "yyyy-MM-dd", sort = 16) |
| | | @Excel(name = "ååå°ææ¥æ", width = 30, dateFormat = "yyyy-MM-dd", sort = 17) |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date contractExpireTime; |
| | | |
| | |
| | | * ç»æè¯ç¨æ¶é´ |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @Excel(name = "ç»æè¯ç¨æ¶é´", width = 30, dateFormat = "yyyy-MM-dd", sort = 17) |
| | | @Excel(name = "ç»æè¯ç¨æ¶é´", width = 30, dateFormat = "yyyy-MM-dd", sort = 18) |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date trialEndDate; |
| | | |
| | |
| | | * å¼å§è¯ç¨æ¥æ |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @Excel(name = "å¼å§è¯ç¨æ¥æ", width = 30, dateFormat = "yyyy-MM-dd", sort = 18) |
| | | @Excel(name = "å¼å§è¯ç¨æ¥æ", width = 30, dateFormat = "yyyy-MM-dd", sort = 19) |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date trialStartDate; |
| | | |
| | |
| | | * ç¾è®¢æ¶é´ |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @Excel(name = "ç¾è®¢æ¶é´", width = 30, dateFormat = "yyyy-MM-dd", sort = 19) |
| | | @Excel(name = "ç¾è®¢æ¶é´", width = 30, dateFormat = "yyyy-MM-dd", sort = 20) |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date signDate; |
| | | |
| | |
| | | /** |
| | | * è¯ç¨æå·¥èµ |
| | | */ |
| | | @Excel(name = "è¯ç¨æå·¥èµ", sort = 20) |
| | | @Excel(name = "è¯ç¨æå·¥èµ", sort = 21) |
| | | private BigDecimal proSalary; |
| | | |
| | | /** |
| | |
| | | /** |
| | | * 夿³¨ï¼ç¦å©å¾
éï¼ |
| | | */ |
| | | @Excel(name = "夿³¨ï¼ç¦å©å¾
éï¼", sort = 21) |
| | | @Excel(name = "夿³¨ï¼ç¦å©å¾
éï¼", sort = 22) |
| | | private String remark; |
| | | |
| | | |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.staff.dto.StaffOnJobDto; |
| | | import com.ruoyi.staff.pojo.StaffJoinLeaveRecord; |
| | | import com.ruoyi.staff.pojo.StaffContract; |
| | | import com.ruoyi.staff.pojo.StaffOnJob; |
| | | import org.bouncycastle.crypto.digests.LongDigest; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | |
| | | |
| | | int delStaffOnJobs(List<Integer> ids); |
| | | |
| | | int renewContract(Long id, StaffContract staffContract); |
| | | |
| | | void staffOnJobExport(HttpServletResponse response, StaffOnJob staffOnJob); |
| | | |
| | | List<StaffJoinLeaveRecord> staffOnJobList(); |
| | | List<StaffOnJobDto> staffOnJobList(StaffOnJob staffOnJob); |
| | | |
| | | Boolean importData(MultipartFile file); |
| | | |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.staff.dto.StaffContractDto; |
| | | import com.ruoyi.staff.dto.StaffOnJobDto; |
| | | import com.ruoyi.staff.pojo.StaffContract; |
| | | import com.ruoyi.staff.pojo.StaffJoinLeaveRecord; |
| | | import com.ruoyi.staff.pojo.StaffOnJob; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | public interface StaffContractService extends IService<StaffContract> { |
| | | |
| | |
| | | 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.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); |
| | | } |
| | |
| | | package com.ruoyi.staff.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | 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.mapper.StaffLeaveMapper; |
| | | import com.ruoyi.staff.mapper.StaffOnJobMapper; |
| | | 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, "å工离è导åº"); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | package com.ruoyi.staff.service.impl; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | |
| | | import com.ruoyi.project.system.mapper.SysPostMapper; |
| | | import com.ruoyi.staff.dto.StaffOnJobDto; |
| | | import com.ruoyi.staff.mapper.StaffContractMapper; |
| | | import com.ruoyi.staff.mapper.StaffJoinLeaveRecordMapper; |
| | | 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.StaffLeave; |
| | | import com.ruoyi.staff.pojo.StaffOnJob; |
| | | import com.ruoyi.staff.service.IStaffOnJobService; |
| | |
| | | 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 { |
| | |
| | | |
| | | private SysPostMapper sysPostMapper; |
| | | |
| | | private StaffJoinLeaveRecordMapper staffJoinLeaveRecordMapper; |
| | | private StaffContractMapper staffContractMapper; |
| | | private StaffLeaveMapper staffLeaveMapper; |
| | | |
| | |
| | | throw new BaseException("ç¼å·ä¸º"+staffOnJobPrams.getStaffNo()+"çå工已ç»åå¨,æ æ³æ°å¢!!!"); |
| | | } |
| | | // å建å
¥èæ°æ® |
| | | staffOnJobPrams.setContractExpireTime(staffOnJobPrams.getContractEndTime()); |
| | | staffOnJobMapper.insert(staffOnJobPrams); |
| | | |
| | | // å建ååè®°å½ |
| | |
| | | throw new BaseException("ç¼å·ä¸º"+staffOnJobParams.getStaffNo()+"çåå·¥ä¸åå¨,æ æ³æ´æ°!!!"); |
| | | } |
| | | |
| | | // æ´æ°åå·¥æ°æ® |
| | | String[] ignoreProperties = {"id"};//æé¤id屿§ |
| | | BeanUtils.copyProperties(staffOnJobParams,job,ignoreProperties); |
| | | staffOnJobMapper.updateById(job); |
| | | |
| | | // è·åææ°ååæ°æ®ï¼å¹¶ä¸æ´æ° |
| | | StaffContract contract = staffContractMapper.selectOne(Wrappers.<StaffContract>lambdaQuery() |
| | | .eq(StaffContract::getStaffOnJobId, id) |
| | | .last("limit 1") |
| | | .orderByDesc(StaffContract::getId)); |
| | | if (contract != null){ |
| | | BeanUtils.copyProperties(staffOnJobParams,contract,ignoreProperties); |
| | | return staffContractMapper.updateById(contract); |
| | | staffContractMapper.updateById(contract); |
| | | } |
| | | return 0; |
| | | |
| | | // æ´æ°åå·¥æ°æ® |
| | | BeanUtils.copyProperties(staffOnJobParams,job,ignoreProperties); |
| | | job.setContractExpireTime(staffOnJobParams.getContractEndTime()); |
| | | return staffOnJobMapper.updateById(job); |
| | | } |
| | | |
| | | //å é¤å
¥è |
| | |
| | | return staffContractMapper.delete(Wrappers.<StaffContract>lambdaQuery().in(StaffContract::getStaffOnJobId, ids)); |
| | | } |
| | | |
| | | // ç»ç¾åå |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int renewContract(Long id, StaffContract staffContract) { |
| | | // å¤æå¯¹è±¡æ¯å¦åå¨ |
| | | StaffOnJob job = staffOnJobMapper.selectById(id); |
| | | if (job == null){ |
| | | throw new BaseException("该åå·¥ä¸åå¨,æ æ³æ´æ°!!!"); |
| | | } |
| | | |
| | | // å¢å åå |
| | | StaffContract newStaffContract = new StaffContract(); |
| | | newStaffContract.setStaffOnJobId(id); |
| | | newStaffContract.setContractTerm(staffContract.getContractTerm()); |
| | | newStaffContract.setContractStartTime(staffContract.getContractStartTime()); |
| | | newStaffContract.setContractEndTime(staffContract.getContractEndTime()); |
| | | staffContractMapper.insert(newStaffContract); |
| | | |
| | | // æ´æ°åå·¥ååè¿ææ¶é´ |
| | | job.setContractExpireTime(staffContract.getContractEndTime()); |
| | | staffOnJobMapper.updateById(job); |
| | | return 0; |
| | | } |
| | | |
| | | //å¨èå工详æ
|
| | | @Override |
| | | public StaffOnJobDto staffOnJobDetail(Long id) { |
| | | StaffOnJob staffOnJob = staffOnJobMapper.selectById(id); |
| | | if (staffOnJob == null) { |
| | | throw new IllegalArgumentException("该åå·¥ä¸åå¨"); |
| | | } |
| | | |
| | | StaffOnJobDto staffOnJobDto = new StaffOnJobDto(); |
| | | BeanUtils.copyProperties(staffOnJob, staffOnJobDto); |
| | | // æ¥è¯¢å²ä½åç§° |
| | |
| | | // æ¥è¯¢ååä¿¡æ¯ |
| | | StaffContract contract = staffContractMapper.selectOne(Wrappers.<StaffContract>lambdaQuery() |
| | | .eq(StaffContract::getStaffOnJobId, staffOnJob.getId()) |
| | | .last("limit 1") |
| | | .orderByDesc(StaffContract::getId)); |
| | | if (contract != null){ |
| | | staffOnJobDto.setContractTerm(contract.getContractTerm()); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<StaffJoinLeaveRecord> staffOnJobList() { |
| | | return staffJoinLeaveRecordMapper.staffOnJobList(); |
| | | public List<StaffOnJobDto> staffOnJobList(StaffOnJob staffOnJob) { |
| | | return staffOnJobMapper.staffOnJobList(staffOnJob); |
| | | } |
| | | |
| | | @Override |
| | |
| | | <result column="tenant_id" property="tenantId" /> |
| | | <result column="product_name" property="productName" /> |
| | | <result column="product_id" property="productId" /> |
| | | <result column="product_code" property="productCode" /> |
| | | </resultMap> |
| | | <select id="listPageProductModel" resultType="com.ruoyi.basic.pojo.ProductModel"> |
| | | select pm.*,p.product_name |
| | |
| | | <select id="listPageByProductProduction" resultType="com.ruoyi.procurementrecord.dto.ProcurementPageDto"> |
| | | select |
| | | t1.*, |
| | | t1.inbound_num as inboundNum0, |
| | | t2.model as specification_model , |
| | | t2.unit, |
| | | t3.product_name as product_category |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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, |
| | | sd.dept_name as deptName |
| | | 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 |
| | | LEFT JOIN |
| | | sys_dept sd ON sd.dept_id = soj.sys_dept_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, |
| | | sd.dept_name as deptName |
| | | 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 |
| | | LEFT JOIN |
| | | sys_dept sd ON sd.dept_id = soj.sys_dept_id |
| | | where 1=1 |
| | | <if test="c.staffName != null and c.staffName != '' "> |
| | | AND soj.staff_name LIKE CONCAT('%',#{c.staffName},'%') |
| | | </if> |
| | | </select> |
| | | </mapper> |
| | |
| | | <select id="staffOnJobListPage" resultType="com.ruoyi.staff.dto.StaffOnJobDto"> |
| | | SELECT |
| | | staff_on_job.*, |
| | | sp.post_name as postName |
| | | sp.post_name as postName, |
| | | sd.dept_name as deptName |
| | | FROM staff_on_job |
| | | LEFT JOIN |
| | | sys_post sp ON sp.post_id = staff_on_job.sys_post_id |
| | | LEFT JOIN |
| | | sys_dept sd ON sd.dept_id = staff_on_job.sys_dept_id |
| | | where 1=1 |
| | | <if test="staffOnJob.staffState != null"> |
| | | AND staff_state = #{staffOnJob.staffState} |
| | |
| | | <select id="staffOnJobList" resultType="com.ruoyi.staff.dto.StaffOnJobDto"> |
| | | SELECT |
| | | staff_on_job.*, |
| | | sp.post_name as postName |
| | | sp.post_name as postName, |
| | | sd.dept_name as deptName |
| | | FROM staff_on_job |
| | | LEFT JOIN |
| | | sys_post sp ON sp.post_id = staff_on_job.sys_post_id |
| | | LEFT JOIN |
| | | sys_dept sd ON sd.dept_id = staff_on_job.sys_dept_id |
| | | where 1=1 |
| | | <if test="staffOnJob.staffState != null"> |
| | | AND staff_state = #{staffOnJob.staffState} |
| | |
| | | <if test="params.endTime != null and params.endTime != ''"><!-- ç»ææ¶é´æ£ç´¢ --> |
| | | AND date_format(u.create_time,'%Y%m%d') <= date_format(#{params.endTime},'%Y%m%d') |
| | | </if> |
| | | <if test="params.deptId != null"> |
| | | <if test="deptId != null"> |
| | | AND u.user_id IN |
| | | ( |
| | | SELECT user_id FROM sys_user_dept WHERE dept_id = #{deptId} |