| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.project.system.domain.SysNotice; |
| | | import com.ruoyi.project.system.mapper.SysNoticeMapper; |
| | | import com.ruoyi.safe.mapper.SafeTrainingMapper; |
| | | import com.ruoyi.safe.pojo.SafeTraining; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.List; |
| | | |
| | | @Component |
| | | //宿¶ä»»å¡æ±æ» |
| | | public class ScheduleTask { |
| | | |
| | | @Autowired |
| | | private SafeTrainingMapper safeTrainingMapper; |
| | | |
| | | @Autowired |
| | | private SysNoticeMapper noticeMapper; |
| | | |
| | | //宿¶ä»»å¡(15åéæ§è¡ä¸æ¬¡--夿å¹è®è®¡åæ°æ®,ç¶æååæ´) |
| | | @Scheduled(cron = "0 0/15 * * * ?") |
| | | public void testScheduleTask() { |
| | | List<SafeTraining> safeTrainings = safeTrainingMapper.selectList(Wrappers.<SafeTraining>lambdaQuery().ne(SafeTraining::getState, 2)); |
| | | if (safeTrainings.size() > 0) { |
| | | for (SafeTraining safeTraining : safeTrainings) { |
| | | //æ ¹æ®æ¶é´å¤æå¹è®ç¶æ |
| | | String trainingDate = safeTraining.getTrainingDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); |
| | | LocalDateTime openingTime = LocalDateTime.parse((trainingDate + safeTraining.getOpeningTime()), DateTimeFormatter.ofPattern("yyyy-MM-ddHH:mm:ss")); |
| | | LocalDateTime endTime = LocalDateTime.parse((trainingDate + safeTraining.getEndTime()), DateTimeFormatter.ofPattern("yyyy-MM-ddHH:mm:ss")); |
| | | if (LocalDateTime.now().isBefore(openingTime)) { |
| | | //æªå¼å§ |
| | | safeTraining.setState(0); |
| | | } else if (LocalDateTime.now().isAfter(endTime)) { |
| | | //å·²ç»æ |
| | | safeTraining.setState(2); |
| | | } else { |
| | | //è¿è¡ä¸ |
| | | safeTraining.setState(1); |
| | | } |
| | | safeTrainingMapper.updateById(safeTraining); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //å·²è¯»æ°æ®åä¸ä¸ªå®æ¶ä»»å¡(æ¯æ1å·1ç¹æ¸
ç䏿¬¡ä¸ä¸ªæå·²è¯»æ°æ®) |
| | | @Scheduled(cron = "0 0 1 1 * ?") |
| | | public void cleanReadData() { |
| | | noticeMapper.delete(Wrappers.<SysNotice>lambdaQuery() |
| | | .eq(SysNotice::getStatus,"1") |
| | | .lt(SysNotice::getCreateTime, LocalDateTime.now())); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.dto.DateQueryDto; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import com.ruoyi.home.dto.IncomeExpenseAnalysisDto; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | |
| | | |
| | | List<AccountDto2> report(@Param("dateQueryDto") DateQueryDto dateQueryDto); |
| | | BigDecimal report1(@Param("dateQueryDto") DateQueryDto dateQueryDto, @Param("dictValue") String dictValue); |
| | | |
| | | List<IncomeExpenseAnalysisDto> selectAccountExpenseStats(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("dateFormat") String dateFormat); |
| | | |
| | | List<com.ruoyi.dto.MapDto> selectExpenseComposition(@Param("startDate") String startDate, @Param("endDate") String endDate); |
| | | } |
| | |
| | | import com.ruoyi.account.pojo.AccountFile; |
| | | import com.ruoyi.account.pojo.AccountIncome; |
| | | import com.ruoyi.dto.DateQueryDto; |
| | | import com.ruoyi.home.dto.IncomeExpenseAnalysisDto; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | |
| | | List<AccountDto2> report(@Param("dateQueryDto") DateQueryDto dateQueryDto); |
| | | BigDecimal report1(@Param("dateQueryDto") DateQueryDto dateQueryDto, @Param("dictValue") String dictValue); |
| | | |
| | | List<IncomeExpenseAnalysisDto> selectIncomeStats(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("dateFormat") String dateFormat); |
| | | |
| | | } |
| | |
| | | package com.ruoyi.approve.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | |
| | | import com.ruoyi.approve.service.IApproveNodeService; |
| | | import com.ruoyi.approve.vo.ApproveProcessVO; |
| | | import com.ruoyi.common.enums.FileNameType; |
| | | import com.ruoyi.common.enums.StockQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.device.mapper.DeviceRepairMapper; |
| | | import com.ruoyi.device.pojo.DeviceRepair; |
| | | import com.ruoyi.other.service.impl.TempFileServiceImpl; |
| | | import com.ruoyi.procurementrecord.utils.StockUtils; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import com.ruoyi.project.system.service.ISysNoticeService; |
| | | import com.ruoyi.purchase.mapper.PurchaseLedgerMapper; |
| | | import com.ruoyi.purchase.pojo.PurchaseLedger; |
| | | import com.ruoyi.sales.mapper.CommonFileMapper; |
| | | import com.ruoyi.sales.mapper.SalesQuotationMapper; |
| | | import com.ruoyi.sales.mapper.SalesQuotationProductMapper; |
| | | import com.ruoyi.sales.mapper.ShippingInfoMapper; |
| | | import com.ruoyi.purchase.service.impl.PurchaseLedgerServiceImpl; |
| | | import com.ruoyi.sales.mapper.*; |
| | | import com.ruoyi.sales.pojo.CommonFile; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import com.ruoyi.sales.pojo.SalesQuotation; |
| | | import com.ruoyi.sales.pojo.ShippingInfo; |
| | | import com.ruoyi.sales.service.impl.CommonFileServiceImpl; |
| | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | //@RequiredArgsConstructor |
| | | public class ApproveNodeServiceImpl extends ServiceImpl<ApproveNodeMapper, ApproveNode> implements IApproveNodeService { |
| | | |
| | | @Autowired |
| | |
| | | |
| | | @Autowired |
| | | private CommonFileServiceImpl commonFileService; |
| | | @Autowired |
| | | private StockUtils stockUtils; |
| | | @Autowired |
| | | private SalesLedgerProductMapper salesLedgerProductMapper; |
| | | |
| | | @Autowired |
| | | private PurchaseLedgerServiceImpl purchaseLedgerServiceImpl; |
| | | |
| | | |
| | | public ApproveProcess getApproveById(String id) { |
| | |
| | | LambdaQueryWrapper<ApproveNode> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(ApproveNode::getApproveProcessId, id); |
| | | queryWrapper.eq(ApproveNode::getDeleteFlag, 0); |
| | | queryWrapper.eq(ApproveNode::getApproveNodeStatus, 0); |
| | | List<ApproveNode> list = list(queryWrapper); |
| | | // æç
§ approveNodeOrder åæ®µååºæåº |
| | | list.sort(Comparator.comparingInt(ApproveNode::getApproveNodeOrder)); |
| | | LambdaQueryWrapper<ApproveProcess> approveProcessLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | approveProcessLambdaQueryWrapper.eq(ApproveProcess::getApproveId, id) |
| | | .eq(ApproveProcess::getApproveDelete, 0) |
| | | .eq(ApproveProcess::getApproveStatus, 0) |
| | | .last("limit 1"); |
| | | ApproveProcess approveProcess = approveProcessMapper.selectOne(approveProcessLambdaQueryWrapper); |
| | | if(approveProcess != null && approveProcess.getApproveStatus() == 3){ |
| | |
| | | LambdaQueryWrapper<ApproveProcess> approveProcessLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | approveProcessLambdaQueryWrapper.eq(ApproveProcess::getApproveId, approveNode.getApproveProcessId()) |
| | | .eq(ApproveProcess::getApproveDelete, 0) |
| | | .eq(ApproveProcess::getApproveStatus, 0) |
| | | .last("limit 1"); |
| | | ApproveProcess approveProcess = approveProcessMapper.selectOne(approveProcessLambdaQueryWrapper); |
| | | if(approveProcess == null) throw new RuntimeException("审æ¹ä¸åå¨"); |
| | |
| | | approveNodeLambdaQueryWrapper.eq(ApproveNode::getApproveProcessId, approveNode.getApproveProcessId()) |
| | | .eq(ApproveNode::getApproveNodeOrder, approveNode.getApproveNodeOrder() + 1) |
| | | .eq(ApproveNode::getDeleteFlag, 0) |
| | | .eq(ApproveNode::getApproveNodeStatus, 0) |
| | | .last("limit 1"); |
| | | ApproveNode approveNode1 = approveNodeMapper.selectOne(approveNodeLambdaQueryWrapper); |
| | | approveProcess.setApproveStatus(status); |
| | |
| | | if (status.equals(2)) { |
| | | // åæ |
| | | purchaseLedger.setApprovalStatus(3); |
| | | List<SalesLedgerProduct> salesLedgerProducts = salesLedgerProductMapper.selectList(new QueryWrapper<SalesLedgerProduct>() |
| | | .lambda().eq(SalesLedgerProduct::getSalesLedgerId, purchaseLedger.getId()).eq(SalesLedgerProduct::getType, 2)); |
| | | for (SalesLedgerProduct salesLedgerProduct : salesLedgerProducts) { |
| | | // è´¨æ£ |
| | | if (salesLedgerProduct.getIsChecked()) { |
| | | purchaseLedgerServiceImpl.addQualityInspect(purchaseLedger, salesLedgerProduct); |
| | | }else { |
| | | //ç´æ¥å
¥åº |
| | | stockUtils.addStock(salesLedgerProduct.getProductModelId(), salesLedgerProduct.getQuantity(), StockQualifiedRecordTypeEnum.PURCHASE_STOCK_IN.getCode(), purchaseLedger.getId()); |
| | | } |
| | | } |
| | | } else if (status.equals(3)) { |
| | | // æç» |
| | | purchaseLedger.setApprovalStatus(4); |
| | |
| | | if(status.equals(2)){ |
| | | shippingInfo.setStatus("å®¡æ ¸éè¿"); |
| | | }else if(status.equals(3)){ |
| | | shippingInfo.setType("å®¡æ ¸æç»"); |
| | | shippingInfo.setStatus("å®¡æ ¸æç»"); |
| | | }else if(status.equals(1)){ |
| | | shippingInfo.setStatus("å®¡æ ¸ä¸"); |
| | | } |
| | |
| | | .eq(ApproveProcess::getApproveId, approveNode.getApproveProcessId())).get(0); |
| | | if (approveProcess.getApproveUserIds().split(",").length > nodeOrder){ |
| | | String id = approveProcess.getApproveUserIds().split(",")[nodeOrder]; |
| | | sysNoticeService.simpleNoticeByUser(approveProcessType(approveProcess.getApproveType()), |
| | | approveNode.getApproveProcessId()+"æµç¨ç¼å·ç审æ¹éè¦æ¨å®¡æ ¸!!!!!", |
| | | Arrays.asList(Long.valueOf(id)), |
| | | "/collaborativeApproval/approvalProcess?approveType="+approveProcess.getApproveType()+"&approveId="+approveNode.getApproveProcessId()); |
| | | if (approveProcess.getApproveType()==8){ |
| | | sysNoticeService.simpleNoticeByUser(approveProcessType(approveProcess.getApproveType()), |
| | | approveProcess.getApproveId() + "æµç¨ç¼å·ç审æ¹éè¦æ¨å®¡æ ¸!!!!!", |
| | | Arrays.asList(Long.valueOf(id)), |
| | | "/safeProduction/safeWorkApproval?approveType=" + approveProcess.getApproveType() + "&approveId=" + approveProcess.getApproveId()); |
| | | }else { |
| | | sysNoticeService.simpleNoticeByUser(approveProcessType(approveProcess.getApproveType()), |
| | | approveProcess.getApproveId() + "æµç¨ç¼å·ç审æ¹éè¦æ¨å®¡æ ¸!!!!!", |
| | | Arrays.asList(Long.valueOf(id)), |
| | | "/collaborativeApproval/approvalProcess?approveType=" + approveProcess.getApproveType() + "&approveId=" + approveProcess.getApproveId()); |
| | | } |
| | | } |
| | | break; |
| | | case 2: |
| | |
| | | case 6: |
| | | return "æ¥ä»·å®¡æ¹"; |
| | | case 7: |
| | | return "åºåºå®¡æ¹"; |
| | | return "å货审æ¹"; |
| | | case 8: |
| | | return "å±é©ä½ä¸å®¡æ¹"; |
| | | } |
| | | return null; |
| | | } |
| | |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | //@RequiredArgsConstructor |
| | | public class ApproveProcessServiceImpl extends ServiceImpl<ApproveProcessMapper, ApproveProcess> implements IApproveProcessService { |
| | | private static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("yyyyMMdd"); |
| | | |
| | | private final StringRedisTemplate redisTemplate; |
| | | |
| | | private final DailyRedisCounter dailyRedisCounter; |
| | | |
| | | private final SysDeptMapper sysDeptMapper; |
| | | private final IApproveNodeService approveNodeService; |
| | | private final SysUserMapper sysUserMapper; |
| | | private final ApproveProcessMapper approveProcessMapper; |
| | | private final TempFileServiceImpl tempFileService; |
| | | private final CommonFileMapper commonFileMapper; |
| | | private final CommonFileServiceImpl commonFileService; |
| | | private final ISysNoticeService sysNoticeService; |
| | | @Autowired |
| | | private StringRedisTemplate redisTemplate; |
| | | @Autowired |
| | | private DailyRedisCounter dailyRedisCounter; |
| | | @Autowired |
| | | private SysDeptMapper sysDeptMapper; |
| | | @Autowired |
| | | private IApproveNodeService approveNodeService; |
| | | @Autowired |
| | | private SysUserMapper sysUserMapper; |
| | | @Autowired |
| | | private ApproveProcessMapper approveProcessMapper; |
| | | @Autowired |
| | | private TempFileServiceImpl tempFileService; |
| | | @Autowired |
| | | private CommonFileMapper commonFileMapper; |
| | | @Autowired |
| | | private CommonFileServiceImpl commonFileService; |
| | | @Autowired |
| | | private ISysNoticeService sysNoticeService; |
| | | |
| | | @Override |
| | | public void addApprove(ApproveProcessVO approveProcessVO) throws Exception { |
| | |
| | | tempFileService.migrateTempFilesToFormal(approveProcess.getId(), approveProcessVO.getTempFileIds(), FileNameType.ApproveProcess.getValue()); |
| | | /*æ¶æ¯éç¥*/ |
| | | String id = approveProcessVO.getApproveUserIds().split(",")[0]; |
| | | sysNoticeService.simpleNoticeByUser(approveProcessType(approveProcessVO.getApproveType()), |
| | | approveID + "æµç¨ç¼å·ç审æ¹éè¦æ¨å®¡æ ¸!!!!!", |
| | | Arrays.asList(Long.valueOf(id)), |
| | | "/collaborativeApproval/approvalProcess?approveType=" + approveProcessVO.getApproveType() + "&approveId=" + approveID); |
| | | if (approveProcess.getApproveType()==8){ |
| | | sysNoticeService.simpleNoticeByUser(approveProcessType(approveProcess.getApproveType()), |
| | | approveProcess.getApproveId() + "æµç¨ç¼å·ç审æ¹éè¦æ¨å®¡æ ¸!!!!!", |
| | | Arrays.asList(Long.valueOf(id)), |
| | | "/safeProduction/safeWorkApproval?approveType=" + approveProcess.getApproveType() + "&approveId=" + approveProcess.getApproveId()); |
| | | }else { |
| | | sysNoticeService.simpleNoticeByUser(approveProcessType(approveProcess.getApproveType()), |
| | | approveProcess.getApproveId() + "æµç¨ç¼å·ç审æ¹éè¦æ¨å®¡æ ¸!!!!!", |
| | | Arrays.asList(Long.valueOf(id)), |
| | | "/collaborativeApproval/approvalProcess?approveType=" + approveProcess.getApproveType() + "&approveId=" + approveProcess.getApproveId()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | |
| | | return one; |
| | | } |
| | | |
| | | private final ApproveNodeMapper approveNodeMapper; |
| | | @Autowired |
| | | private ApproveNodeMapper approveNodeMapper; |
| | | |
| | | // æ¥ä»·å®¡æ¹ç¼è¾å®¡æ ¸äºº |
| | | public void updateApproveUser(ApproveGetAndUpdateVo approveGetAndUpdateVo) { |
| | |
| | | approveNodeService.initApproveNodes(approveGetAndUpdateVo.getApproveUserIds(), approveProcess.getApproveId(), approveProcess.getTenantId()); |
| | | /*æ¶æ¯éç¥*/ |
| | | String id = approveProcess.getApproveUserIds().split(",")[0]; |
| | | sysNoticeService.simpleNoticeByUser(approveProcessType(approveProcess.getApproveType()), |
| | | approveProcess.getApproveId() + "æµç¨ç¼å·ç审æ¹éè¦æ¨å®¡æ ¸!!!!!", |
| | | Arrays.asList(Long.valueOf(id)), |
| | | "/collaborativeApproval/approvalProcess?approveType=" + approveProcess.getApproveType() + "&approveId=" + approveProcess.getApproveId()); |
| | | if (approveProcess.getApproveType()==8){ |
| | | sysNoticeService.simpleNoticeByUser(approveProcessType(approveProcess.getApproveType()), |
| | | approveProcess.getApproveId() + "æµç¨ç¼å·ç审æ¹éè¦æ¨å®¡æ ¸!!!!!", |
| | | Arrays.asList(Long.valueOf(id)), |
| | | "/safeProduction/safeWorkApproval?approveType=" + approveProcess.getApproveType() + "&approveId=" + approveProcess.getApproveId()); |
| | | }else { |
| | | sysNoticeService.simpleNoticeByUser(approveProcessType(approveProcess.getApproveType()), |
| | | approveProcess.getApproveId() + "æµç¨ç¼å·ç审æ¹éè¦æ¨å®¡æ ¸!!!!!", |
| | | Arrays.asList(Long.valueOf(id)), |
| | | "/collaborativeApproval/approvalProcess?approveType=" + approveProcess.getApproveType() + "&approveId=" + approveProcess.getApproveId()); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | @GetMapping("/incomeExpenseAnalysis") |
| | | @ApiOperation("æ¯æ¶å¯¹æ¯åæ") |
| | | public AjaxResult incomeExpenseAnalysis(@RequestParam(value = "type", defaultValue = "1") Integer type) { |
| | | List<Map<String, Object>> result = homeService.incomeExpenseAnalysis(type); |
| | | return AjaxResult.success(result); |
| | | } |
| | | |
| | | @GetMapping("/profitTrendAnalysis") |
| | | @ApiOperation("婿¶¦è¶å¿åæ") |
| | | public AjaxResult profitTrendAnalysis(){ |
| | | List<MapDto> list = homeService.profitTrendAnalysis(); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | @GetMapping("/expenseCompositionAnalysis") |
| | | @ApiOperation("ææåæ") |
| | | public AjaxResult expenseCompositionAnalysis(@RequestParam(value = "type", defaultValue = "1") Integer type) { |
| | | List<MapDto> list = homeService.expenseCompositionAnalysis(type); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | @GetMapping("/monthlyIncome") |
| | | @ApiOperation("æåº¦æ¶å
¥") |
| | | public AjaxResult monthlyIncome(){ |
| | | MonthlyIncomeDto dto = homeService.monthlyIncome(); |
| | | return AjaxResult.success(dto); |
| | | } |
| | | |
| | | @GetMapping("/monthlyExpenditure") |
| | | @ApiOperation("æåº¦æ¯åº") |
| | | public AjaxResult monthlyExpenditure(){ |
| | | MonthlyExpenditureDto dto = homeService.monthlyExpenditure(); |
| | | return AjaxResult.success(dto); |
| | | } |
| | | |
| | | /********************************************************è¥ééè´ç±»**************************************************/ |
| | | @GetMapping("/business") |
| | | @Log(title = "éå®-éè´-åºåæ°æ®", businessType = BusinessType.OTHER) |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.home.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * æ¯æ¶å¯¹æ¯åæç»è®¡ DTO |
| | | */ |
| | | @Data |
| | | public class IncomeExpenseAnalysisDto { |
| | | /** |
| | | * æ¥æ |
| | | */ |
| | | private String dateStr; |
| | | |
| | | /** |
| | | * éé¢ |
| | | */ |
| | | private BigDecimal amount; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.home.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * æåº¦æ¯åº DTO |
| | | */ |
| | | @Data |
| | | public class MonthlyExpenditureDto { |
| | | /** |
| | | * æåº¦æ»æ¯åº |
| | | */ |
| | | private BigDecimal monthlyExpenditure = BigDecimal.ZERO; |
| | | |
| | | /** |
| | | * 仿¬¾ç (ç¾åæ¯) |
| | | */ |
| | | private String paymentRate = "0.00"; |
| | | |
| | | /** |
| | | * æ¯å©æ¶¦ (éé¢) |
| | | */ |
| | | private BigDecimal grossProfit = BigDecimal.ZERO; |
| | | |
| | | /** |
| | | * 婿¶¦ç (ç¾åæ¯) |
| | | */ |
| | | private String profitMarginRate = "0.00"; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.home.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * æåº¦æ¶å
¥ DTO |
| | | */ |
| | | @Data |
| | | public class MonthlyIncomeDto { |
| | | /** |
| | | * æåº¦æ¶å
¥ |
| | | */ |
| | | private BigDecimal monthlyIncome = BigDecimal.ZERO; |
| | | |
| | | /** |
| | | * 忬¾ç |
| | | */ |
| | | private String collectionRate = "0.00"; |
| | | |
| | | /** |
| | | * é¾ææ° |
| | | */ |
| | | private BigDecimal overdueNum = BigDecimal.ZERO; |
| | | |
| | | /** |
| | | * 龿ç |
| | | */ |
| | | private String overdueRate = "0.00"; |
| | | } |
| | |
| | | List<Map<String, Object>> productInOutAnalysis(Integer type); |
| | | |
| | | List<MapDto> productTurnoverDays(); |
| | | |
| | | List<Map<String, Object>> incomeExpenseAnalysis(Integer type); |
| | | |
| | | List<MapDto> profitTrendAnalysis(); |
| | | |
| | | List<MapDto> expenseCompositionAnalysis(Integer type); |
| | | |
| | | MonthlyIncomeDto monthlyIncome(); |
| | | |
| | | MonthlyExpenditureDto monthlyExpenditure(); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.mapper.AccountIncomeMapper; |
| | | import com.ruoyi.account.pojo.AccountExpense; |
| | | import com.ruoyi.home.mapper.HomeMapper; |
| | | import com.ruoyi.account.mapper.AccountExpenseMapper; |
| | | import com.ruoyi.approve.mapper.ApproveProcessMapper; |
| | | import com.ruoyi.approve.pojo.ApproveProcess; |
| | | import com.ruoyi.basic.mapper.CustomerMapper; |
| | |
| | | public List<MapDto> productTurnoverDays() { |
| | | return homeMapper.productTurnoverDays(); |
| | | } |
| | | |
| | | @Autowired |
| | | private AccountExpenseMapper accountExpenseMapper; |
| | | |
| | | @Autowired |
| | | private AccountIncomeMapper accountIncomeMapper; |
| | | |
| | | |
| | | public List<Map<String, Object>> incomeExpenseAnalysis(Integer type) { |
| | | |
| | | LocalDate today = LocalDate.now(); |
| | | LocalDate startDate; |
| | | LocalDate endDate; |
| | | String dateFormat; |
| | | DateTimeFormatter formatter; |
| | | List<String> xAxis = new ArrayList<>(); |
| | | |
| | | // 1. æ¶é´èå´ & X è½´ |
| | | if (type == 3) { |
| | | // æ¬å£åº¦ï¼ææï¼ |
| | | Month currentMonth = today.getMonth(); |
| | | Month firstMonthOfQuarter = currentMonth.firstMonthOfQuarter(); |
| | | startDate = today.withMonth(firstMonthOfQuarter.getValue()) |
| | | .with(TemporalAdjusters.firstDayOfMonth()); |
| | | endDate = startDate.plusMonths(2) |
| | | .with(TemporalAdjusters.lastDayOfMonth()); |
| | | |
| | | dateFormat = "%Y-%m"; |
| | | formatter = DateTimeFormatter.ofPattern("yyyy-MM"); |
| | | |
| | | LocalDate tmp = startDate; |
| | | while (!tmp.isAfter(endDate)) { |
| | | xAxis.add(tmp.format(formatter)); |
| | | tmp = tmp.plusMonths(1); |
| | | } |
| | | |
| | | } else { |
| | | // å¨ / æï¼æå¤©ï¼ |
| | | dateFormat = "%Y-%m-%d"; |
| | | formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | |
| | | if (type == 1) { |
| | | startDate = today.with(DayOfWeek.MONDAY); |
| | | endDate = today.with(DayOfWeek.SUNDAY); |
| | | } else { |
| | | startDate = today.with(TemporalAdjusters.firstDayOfMonth()); |
| | | endDate = today.with(TemporalAdjusters.lastDayOfMonth()); |
| | | } |
| | | |
| | | LocalDate tmp = startDate; |
| | | while (!tmp.isAfter(endDate)) { |
| | | xAxis.add(tmp.format(formatter)); |
| | | tmp = tmp.plusDays(1); |
| | | } |
| | | } |
| | | |
| | | String startStr = startDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); |
| | | String endStr = endDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); |
| | | |
| | | // 2. æ¥è¯¢æ°æ® |
| | | List<IncomeExpenseAnalysisDto> incomeList = accountIncomeMapper.selectIncomeStats(startStr, endStr, dateFormat); |
| | | |
| | | // List<IncomeExpenseAnalysisDto> purchaseList = |
| | | // purchaseLedgerMapper.selectPurchaseStats(startStr, endStr, dateFormat); |
| | | |
| | | List<IncomeExpenseAnalysisDto> expenseList = accountExpenseMapper.selectAccountExpenseStats(startStr, endStr, dateFormat); |
| | | |
| | | // 3. 转 Mapï¼èªå¨åå¹¶ï¼ |
| | | Map<String, BigDecimal> incomeMap = incomeList.stream() |
| | | .collect(Collectors.toMap( |
| | | IncomeExpenseAnalysisDto::getDateStr, |
| | | IncomeExpenseAnalysisDto::getAmount, |
| | | BigDecimal::add)); |
| | | |
| | | // Map<String, BigDecimal> purchaseMap = purchaseList.stream() |
| | | // .collect(Collectors.toMap( |
| | | // IncomeExpenseAnalysisDto::getDateStr, |
| | | // IncomeExpenseAnalysisDto::getAmount, |
| | | // BigDecimal::add)); |
| | | |
| | | Map<String, BigDecimal> expenseMap = expenseList.stream() |
| | | .collect(Collectors.toMap( |
| | | IncomeExpenseAnalysisDto::getDateStr, |
| | | IncomeExpenseAnalysisDto::getAmount, |
| | | BigDecimal::add)); |
| | | |
| | | // 4. ç»è£
è¿å |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | |
| | | for (String dateStr : xAxis) { |
| | | Map<String, Object> item = new HashMap<>(); |
| | | item.put("date", dateStr); |
| | | |
| | | // æ¶å
¥ |
| | | BigDecimal income = incomeMap.getOrDefault(dateStr, BigDecimal.ZERO); |
| | | item.put("income", income.setScale(2, RoundingMode.HALF_UP)); |
| | | |
| | | // æ¯åº = éè´ + è´¢å¡æ¯åº |
| | | // BigDecimal purchase = purchaseMap.getOrDefault(dateStr, BigDecimal.ZERO); |
| | | BigDecimal expense = expenseMap.getOrDefault(dateStr, BigDecimal.ZERO); |
| | | // BigDecimal totalExpense = purchase.add(expense); |
| | | BigDecimal totalExpense = expense; |
| | | |
| | | item.put("expense", totalExpense.setScale(2, RoundingMode.HALF_UP)); |
| | | |
| | | result.add(item); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<MapDto> profitTrendAnalysis() { |
| | | LocalDate today = LocalDate.now(); |
| | | LocalDate startDate = today.minusMonths(11).with(TemporalAdjusters.firstDayOfMonth()); |
| | | LocalDate endDate = today.with(TemporalAdjusters.lastDayOfMonth()); |
| | | |
| | | String dateFormat = "%Y-%m"; |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM"); |
| | | |
| | | List<String> months = new ArrayList<>(); |
| | | LocalDate temp = startDate; |
| | | while (!temp.isAfter(endDate)) { |
| | | months.add(temp.format(formatter)); |
| | | temp = temp.plusMonths(1); |
| | | } |
| | | |
| | | String startStr = startDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); |
| | | String endStr = endDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); |
| | | |
| | | // List<IncomeExpenseAnalysisDto> incomeList = salesLedgerMapper.selectIncomeStats(startStr, endStr, dateFormat); |
| | | List<IncomeExpenseAnalysisDto> incomeList = new ArrayList<>(); |
| | | List<IncomeExpenseAnalysisDto> purchaseList = purchaseLedgerMapper.selectPurchaseStats(startStr, endStr, dateFormat); |
| | | List<IncomeExpenseAnalysisDto> expenseList = accountExpenseMapper.selectAccountExpenseStats(startStr, endStr, dateFormat); |
| | | |
| | | Map<String, BigDecimal> incomeMap = incomeList.stream().collect(Collectors.toMap(IncomeExpenseAnalysisDto::getDateStr, IncomeExpenseAnalysisDto::getAmount, BigDecimal::add)); |
| | | Map<String, BigDecimal> purchaseMap = purchaseList.stream().collect(Collectors.toMap(IncomeExpenseAnalysisDto::getDateStr, IncomeExpenseAnalysisDto::getAmount, BigDecimal::add)); |
| | | Map<String, BigDecimal> expenseMap = expenseList.stream().collect(Collectors.toMap(IncomeExpenseAnalysisDto::getDateStr, IncomeExpenseAnalysisDto::getAmount, BigDecimal::add)); |
| | | |
| | | List<MapDto> result = new ArrayList<>(); |
| | | |
| | | for (String month : months) { |
| | | MapDto dto = new MapDto(); |
| | | dto.setName(month); |
| | | |
| | | BigDecimal income = incomeMap.getOrDefault(month, BigDecimal.ZERO); |
| | | |
| | | BigDecimal purchase = purchaseMap.getOrDefault(month, BigDecimal.ZERO); |
| | | income = BigDecimal.ZERO; |
| | | BigDecimal expense = expenseMap.getOrDefault(month, BigDecimal.ZERO); |
| | | BigDecimal totalExpense = purchase.add(expense); |
| | | |
| | | BigDecimal profit = income.subtract(totalExpense); |
| | | |
| | | dto.setValue(profit.setScale(2, RoundingMode.HALF_UP).toString()); |
| | | result.add(dto); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public List<MapDto> expenseCompositionAnalysis(Integer type) { |
| | | List<MapDto> result = new ArrayList<>(); |
| | | |
| | | if (type == 2) { |
| | | List<MapDto> customerList = salesLedgerMapper.selectCustomerSalesComposition(); |
| | | if (customerList != null) { |
| | | result.addAll(customerList); |
| | | } |
| | | } else { |
| | | BigDecimal rawMaterialAmount = salesLedgerProductMapper.selectRawMaterialExpense(); |
| | | MapDto rawMaterialDto = new MapDto(); |
| | | rawMaterialDto.setName("åææ"); |
| | | rawMaterialDto.setValue(rawMaterialAmount != null ? rawMaterialAmount.toString() : "0"); |
| | | result.add(rawMaterialDto); |
| | | |
| | | List<MapDto> expenseList = accountExpenseMapper.selectExpenseComposition(null, null); |
| | | if (expenseList != null) { |
| | | result.addAll(expenseList); |
| | | } |
| | | } |
| | | |
| | | BigDecimal total = BigDecimal.ZERO; |
| | | for (MapDto dto : result) { |
| | | if (dto.getValue() != null) { |
| | | total = total.add(new BigDecimal(dto.getValue())); |
| | | } |
| | | } |
| | | |
| | | if (total.compareTo(BigDecimal.ZERO) > 0) { |
| | | for (MapDto dto : result) { |
| | | if (dto.getValue() != null) { |
| | | BigDecimal val = new BigDecimal(dto.getValue()); |
| | | String rate = val.divide(total, 4, RoundingMode.HALF_UP) |
| | | .multiply(new BigDecimal("100")) |
| | | .setScale(2, RoundingMode.HALF_UP) |
| | | .toString(); |
| | | dto.setRate(rate); |
| | | } else { |
| | | dto.setRate("0.00"); |
| | | } |
| | | } |
| | | } else { |
| | | for (MapDto dto : result) { |
| | | dto.setRate("0.00"); |
| | | } |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public MonthlyIncomeDto monthlyIncome() { |
| | | MonthlyIncomeDto dto = new MonthlyIncomeDto(); |
| | | LocalDate now = LocalDate.now(); |
| | | YearMonth currentMonth = YearMonth.from(now); |
| | | LocalDateTime startOfMonth = currentMonth.atDay(1).atStartOfDay(); |
| | | LocalDateTime endOfMonth = currentMonth.atEndOfMonth().atTime(23, 59, 59); |
| | | |
| | | LambdaQueryWrapper<SalesLedgerProduct> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(SalesLedgerProduct::getType, 1); |
| | | wrapper.ge(SalesLedgerProduct::getRegisterDate, startOfMonth); |
| | | wrapper.le(SalesLedgerProduct::getRegisterDate, endOfMonth); |
| | | |
| | | List<SalesLedgerProduct> products = salesLedgerProductMapper.selectList(wrapper); |
| | | |
| | | if (CollectionUtils.isEmpty(products)) { |
| | | return dto; |
| | | } |
| | | |
| | | BigDecimal collected = products.stream() |
| | | .map(SalesLedgerProduct::getInvoiceTotal) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | dto.setMonthlyIncome(collected); |
| | | |
| | | BigDecimal overdue = products.stream() |
| | | .map(SalesLedgerProduct::getPendingInvoiceTotal) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | dto.setOverdueNum(overdue); |
| | | |
| | | BigDecimal total = collected.add(overdue); |
| | | |
| | | if (total.compareTo(BigDecimal.ZERO) > 0) { |
| | | String collectionRate = collected.divide(total, 4, RoundingMode.HALF_UP) |
| | | .multiply(new BigDecimal("100")) |
| | | .setScale(2, RoundingMode.HALF_UP) |
| | | .toString(); |
| | | dto.setCollectionRate(collectionRate); |
| | | |
| | | String overdueRate = overdue.divide(total, 4, RoundingMode.HALF_UP) |
| | | .multiply(new BigDecimal("100")) |
| | | .setScale(2, RoundingMode.HALF_UP) |
| | | .toString(); |
| | | dto.setOverdueRate(overdueRate); |
| | | } |
| | | |
| | | return dto; |
| | | } |
| | | |
| | | public MonthlyExpenditureDto monthlyExpenditure() { |
| | | |
| | | MonthlyExpenditureDto dto = new MonthlyExpenditureDto(); |
| | | |
| | | // 彿æ¶é´èå´ |
| | | LocalDate now = LocalDate.now(); |
| | | YearMonth currentMonth = YearMonth.from(now); |
| | | LocalDateTime startOfMonth = currentMonth.atDay(1).atStartOfDay(); |
| | | LocalDateTime endOfMonth = currentMonth.atEndOfMonth().atTime(23, 59, 59); |
| | | |
| | | // éè´å°è´¦ï¼type = 2ï¼ |
| | | LambdaQueryWrapper<SalesLedgerProduct> purchaseWrapper = new LambdaQueryWrapper<>(); |
| | | purchaseWrapper.eq(SalesLedgerProduct::getType, 2); |
| | | purchaseWrapper.ge(SalesLedgerProduct::getRegisterDate, startOfMonth); |
| | | purchaseWrapper.le(SalesLedgerProduct::getRegisterDate, endOfMonth); |
| | | |
| | | List<SalesLedgerProduct> purchaseProducts = |
| | | salesLedgerProductMapper.selectList(purchaseWrapper); |
| | | |
| | | BigDecimal rawMaterialCost = BigDecimal.ZERO; // åææææ¬ |
| | | BigDecimal paidAmount = BigDecimal.ZERO; // 已仿¬¾éé¢ |
| | | BigDecimal pendingAmount = BigDecimal.ZERO; // å¾
仿¬¾éé¢ |
| | | |
| | | if (!CollectionUtils.isEmpty(purchaseProducts)) { |
| | | for (SalesLedgerProduct p : purchaseProducts) { |
| | | |
| | | if (p.getTaxInclusiveTotalPrice() != null) { |
| | | rawMaterialCost = rawMaterialCost.add(p.getTaxInclusiveTotalPrice()); |
| | | } |
| | | |
| | | if (p.getTicketsTotal() != null) { |
| | | paidAmount = paidAmount.add(p.getTicketsTotal()); |
| | | } |
| | | |
| | | if (p.getPendingTicketsTotal() != null) { |
| | | pendingAmount = pendingAmount.add(p.getPendingTicketsTotal()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // å
¶ä»è´¹ç¨ |
| | | LambdaQueryWrapper<AccountExpense> expenseWrapper = new LambdaQueryWrapper<>(); |
| | | expenseWrapper.ge(AccountExpense::getExpenseDate, |
| | | java.sql.Date.valueOf(currentMonth.atDay(1))); |
| | | expenseWrapper.le(AccountExpense::getExpenseDate, |
| | | java.sql.Date.valueOf(currentMonth.atEndOfMonth())); |
| | | |
| | | List<AccountExpense> expenses = |
| | | accountExpenseMapper.selectList(expenseWrapper); |
| | | |
| | | BigDecimal otherExpense = BigDecimal.ZERO; |
| | | if (!CollectionUtils.isEmpty(expenses)) { |
| | | for (AccountExpense e : expenses) { |
| | | if (e.getExpenseMoney() != null) { |
| | | otherExpense = otherExpense.add(e.getExpenseMoney()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // æåº¦æ»æ¯åº |
| | | // BigDecimal monthlyExpenditure = rawMaterialCost.add(otherExpense); |
| | | BigDecimal monthlyExpenditure = otherExpense; |
| | | dto.setMonthlyExpenditure(monthlyExpenditure); |
| | | |
| | | // 已仿¬¾ ÷ï¼å·²ä»æ¬¾ + å¾
仿¬¾ï¼ |
| | | BigDecimal totalPayable = paidAmount.add(pendingAmount); |
| | | if (totalPayable.compareTo(BigDecimal.ZERO) > 0) { |
| | | String paymentRate = paidAmount |
| | | .divide(totalPayable, 4, RoundingMode.HALF_UP) |
| | | .multiply(BigDecimal.valueOf(100)) |
| | | .setScale(2, RoundingMode.HALF_UP) |
| | | .toString(); |
| | | dto.setPaymentRate(paymentRate); |
| | | } |
| | | |
| | | // å®å°è´¦ï¼type = 1ï¼ |
| | | LambdaQueryWrapper<SalesLedgerProduct> salesWrapper = new LambdaQueryWrapper<>(); |
| | | salesWrapper.eq(SalesLedgerProduct::getType, 1); |
| | | salesWrapper.ge(SalesLedgerProduct::getRegisterDate, startOfMonth); |
| | | salesWrapper.le(SalesLedgerProduct::getRegisterDate, endOfMonth); |
| | | |
| | | List<SalesLedgerProduct> salesProducts = |
| | | salesLedgerProductMapper.selectList(salesWrapper); |
| | | |
| | | BigDecimal revenue = BigDecimal.ZERO; |
| | | if (!CollectionUtils.isEmpty(salesProducts)) { |
| | | for (SalesLedgerProduct s : salesProducts) { |
| | | if (s.getInvoiceAmount() != null) { |
| | | revenue = revenue.add(s.getInvoiceAmount()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // æ¯å©æ¶¦ & 婿¶¦ç |
| | | if (revenue.compareTo(BigDecimal.ZERO) > 0) { |
| | | |
| | | // æ¯å©æ¶¦ = é宿¶å
¥ - åææææ¬ |
| | | BigDecimal grossProfit = revenue.subtract(rawMaterialCost); |
| | | dto.setGrossProfit(grossProfit); |
| | | |
| | | // 婿¶¦ç = (é宿¶å
¥ - æåº¦æ»æ¯åº) / é宿¶å
¥ |
| | | BigDecimal profit = revenue.subtract(monthlyExpenditure); |
| | | String profitMarginRate = profit |
| | | .divide(revenue, 4, RoundingMode.HALF_UP) |
| | | .multiply(BigDecimal.valueOf(100)) |
| | | .setScale(2, RoundingMode.HALF_UP) |
| | | .toString(); |
| | | |
| | | dto.setProfitMarginRate(profitMarginRate); |
| | | } |
| | | |
| | | return dto; |
| | | } |
| | | |
| | | } |
| | |
| | | package com.ruoyi.procurementrecord.utils; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.ruoyi.procurementrecord.mapper.ProcurementRecordMapper; |
| | | import com.ruoyi.procurementrecord.mapper.ProcurementRecordOutMapper; |
| | | import com.ruoyi.stock.dto.StockInRecordDto; |
| | |
| | | StockInRecord one = stockInRecordService.getOne(new QueryWrapper<StockInRecord>() |
| | | .lambda().eq(StockInRecord::getRecordId, recordId) |
| | | .eq(StockInRecord::getRecordType, recordType)); |
| | | |
| | | stockInRecordService.batchDelete(Collections.singletonList(one.getId())); |
| | | if (ObjectUtils.isNotEmpty(one)) { |
| | | stockInRecordService.batchDelete(Collections.singletonList(one.getId())); |
| | | } |
| | | } |
| | | public void deleteStockOutRecord(Long recordId, String recordType) { |
| | | StockOutRecord one = stockOutRecordService.getOne(new QueryWrapper<StockOutRecord>() |
| | | .lambda().eq(StockOutRecord::getRecordId, recordId) |
| | | .eq(StockOutRecord::getRecordType, recordType)); |
| | | |
| | | stockOutRecordService.batchDelete(Collections.singletonList(one.getId())); |
| | | if (ObjectUtils.isNotEmpty(one)) { |
| | | stockOutRecordService.batchDelete(Collections.singletonList(one.getId())); |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.production.dto.ProductOrderDto; |
| | | import com.ruoyi.production.dto.SalesLedgerProductionAccountingDto; |
| | | import com.ruoyi.production.pojo.SalesLedgerProductionAccounting; |
| | | import com.ruoyi.production.service.SalesLedgerProductionAccountingService; |
| | | import com.ruoyi.production.service.impl.SalesLedgerProductionAccountingServiceImpl; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | |
| | | public class SalesLedgerProductionAccountingController extends BaseController { |
| | | |
| | | @Autowired |
| | | private SalesLedgerProductionAccountingServiceImpl salesLedgerProductionAccountingService; |
| | | private SalesLedgerProductionAccountingService salesLedgerProductionAccountingService; |
| | | |
| | | @GetMapping("/listPage") |
| | | @ApiOperation("çäº§æ ¸ç®-å页æ¥è¯¢") |
| | |
| | | ExcelUtil<SalesLedgerProductionAccountingDto> util = new ExcelUtil<SalesLedgerProductionAccountingDto>(SalesLedgerProductionAccountingDto.class); |
| | | util.exportExcel(response, list, "çäº§æ ¸ç®æ°æ®"); |
| | | } |
| | | //---------------------------------------------------------------------------------------------------------------------------------------------------- |
| | | @GetMapping("/page") |
| | | @ApiModelProperty("æ¥è¯¢å·¥äººç产工èµä¿¡æ¯") |
| | | public R pageProductionAccounting(SalesLedgerProductionAccountingDto salesLedgerProductionAccountingDto, Page page){ |
| | | return R.ok(salesLedgerProductionAccountingService.pageProductionAccounting(salesLedgerProductionAccountingDto, page)); |
| | | } |
| | | |
| | | @GetMapping("/listProductionDetails") |
| | | @ApiModelProperty("æ¥è¯¢å·¥äººç产工èµä¿¡æ¯") |
| | | public R listProductionDetails(SalesLedgerProductionAccountingDto salesLedgerProductionAccountingDto, Page page){ |
| | | return R.ok(salesLedgerProductionAccountingService.listProductionDetails(salesLedgerProductionAccountingDto,page)); |
| | | } |
| | | } |
| | |
| | | @ApiModelProperty(value = "BOMç¼å·") |
| | | @Excel(name = "BOMç¼å·") |
| | | private String bomNo; |
| | | |
| | | @ApiModelProperty(value = "交æåå·®") |
| | | private Integer deliveryDaysDiff; |
| | | } |
| | |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | |
| | | //éå®ååå· |
| | | @Excel(name = "éå®ååå·") |
| | | private String salesContractNo; |
| | | |
| | | private LocalDate scheduleDate; |
| | | private String schedulingUserName; |
| | | private String customerName; |
| | | private String process; |
| | | private BigDecimal workHours; |
| | | private BigDecimal wages; |
| | | } |
| | |
| | | @ApiModelProperty(value = "ç»ææ¶é´") |
| | | private String entryDateEnd; |
| | | |
| | | |
| | | private BigDecimal outputNum; |
| | | |
| | | private BigDecimal outputRate; |
| | | |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.production.dto.ProductionProductMainDto; |
| | | import com.ruoyi.production.dto.SalesLedgerProductionAccountingDto; |
| | | import com.ruoyi.production.pojo.ProductOrder; |
| | | import com.ruoyi.production.pojo.ProductionProductMain; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | |
| | | * @return |
| | | */ |
| | | ProductOrder getOrderByMainId(@Param("productMainId") Long productMainId); |
| | | |
| | | IPage<ProductionProductMainDto> listProductionDetails(SalesLedgerProductionAccountingDto salesLedgerProductionAccountingDto, Page page); |
| | | } |
| | |
| | | IPage<SalesLedgerProductionAccountingDto> listPage(Page page,@Param("salesLedgerDto") SalesLedgerProductionAccountingDto salesLedgerProductionAccountingDto); |
| | | |
| | | |
| | | IPage<SalesLedgerProductionAccountingDto> pageProductionAccounting(Page page, @Param("ew") SalesLedgerProductionAccountingDto salesLedgerProductionAccountingDto); |
| | | } |
| | |
| | | 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.production.dto.ProductionProductMainDto; |
| | | import com.ruoyi.production.dto.SalesLedgerProductionAccountingDto; |
| | | import com.ruoyi.production.pojo.SalesLedgerProductionAccounting; |
| | | |
| | |
| | | IPage<SalesLedgerProductionAccountingDto> listPage(Page page, SalesLedgerProductionAccountingDto salesLedgerProductionAccountingDto); |
| | | |
| | | |
| | | IPage<SalesLedgerProductionAccountingDto> pageProductionAccounting(SalesLedgerProductionAccountingDto salesLedgerProductionAccountingDto, Page page); |
| | | |
| | | IPage<ProductionProductMainDto> listProductionDetails(SalesLedgerProductionAccountingDto salesLedgerProductionAccountingDto, Page page); |
| | | } |
| | |
| | | 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.production.dto.ProductionProductMainDto; |
| | | import com.ruoyi.production.dto.SalesLedgerProductionAccountingDto; |
| | | import com.ruoyi.production.mapper.ProductionProductMainMapper; |
| | | import com.ruoyi.production.mapper.SalesLedgerProductionAccountingMapper; |
| | | import com.ruoyi.production.pojo.SalesLedgerProductionAccounting; |
| | | import com.ruoyi.production.service.SalesLedgerProductionAccountingService; |
| | |
| | | public class SalesLedgerProductionAccountingServiceImpl extends ServiceImpl<SalesLedgerProductionAccountingMapper, SalesLedgerProductionAccounting> implements SalesLedgerProductionAccountingService { |
| | | |
| | | private final SalesLedgerProductionAccountingMapper salesLedgerProductionAccountingMapper; |
| | | |
| | | private final ProductionProductMainMapper productionProductMainMapper; |
| | | |
| | | @Override |
| | | public IPage<SalesLedgerProductionAccountingDto> listPage(Page page, SalesLedgerProductionAccountingDto salesLedgerProductionAccountingDto) { |
| | | IPage<SalesLedgerProductionAccountingDto> list = salesLedgerProductionAccountingMapper.listPage(page, salesLedgerProductionAccountingDto); |
| | |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public IPage<SalesLedgerProductionAccountingDto> pageProductionAccounting(SalesLedgerProductionAccountingDto salesLedgerProductionAccountingDto, Page page) { |
| | | // TODO 管çåæ¥è¯¢ææï¼å
¶ä»äººåªè½æ¥èªå·± |
| | | return salesLedgerProductionAccountingMapper.pageProductionAccounting(page, salesLedgerProductionAccountingDto); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<ProductionProductMainDto> listProductionDetails(SalesLedgerProductionAccountingDto salesLedgerProductionAccountingDto, Page page) { |
| | | return productionProductMainMapper.listProductionDetails(salesLedgerProductionAccountingDto, page); |
| | | } |
| | | |
| | | public static boolean isNumeric(String str) { |
| | | if (str == null || str.isEmpty()) { |
| | | return false; |
| | |
| | | package com.ruoyi.project.system.mapper;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import org.apache.ibatis.annotations.Mapper;
|
| | | import org.apache.ibatis.annotations.Param;
|
| | | import com.ruoyi.project.system.domain.SysDept;
|
| | |
|
| | | /**
|
| | | * é¨é¨ç®¡ç æ°æ®å±
|
| | | * |
| | | *
|
| | | * @author ruoyi
|
| | | */
|
| | | @Mapper
|
| | | public interface SysDeptMapper
|
| | | {
|
| | | /**
|
| | | * æ¥è¯¢é¨é¨ç®¡çæ°æ®
|
| | | * |
| | | *
|
| | | * @param dept é¨é¨ä¿¡æ¯
|
| | | * @return é¨é¨ä¿¡æ¯éå
|
| | | */
|
| | |
| | |
|
| | | /**
|
| | | * æ ¹æ®è§è²IDæ¥è¯¢é¨é¨æ ä¿¡æ¯
|
| | | * |
| | | *
|
| | | * @param roleId è§è²ID
|
| | | * @param deptCheckStrictly é¨é¨æ 鿩项æ¯å¦å
³èæ¾ç¤º
|
| | | * @return éä¸é¨é¨å表
|
| | |
| | |
|
| | | /**
|
| | | * æ ¹æ®é¨é¨IDæ¥è¯¢ä¿¡æ¯
|
| | | * |
| | | *
|
| | | * @param deptId é¨é¨ID
|
| | | * @return é¨é¨ä¿¡æ¯
|
| | | */
|
| | |
| | |
|
| | | /**
|
| | | * æ ¹æ®IDæ¥è¯¢ææåé¨é¨
|
| | | * |
| | | *
|
| | | * @param deptId é¨é¨ID
|
| | | * @return é¨é¨å表
|
| | | */
|
| | |
| | |
|
| | | /**
|
| | | * æ ¹æ®IDæ¥è¯¢ææåé¨é¨ï¼æ£å¸¸ç¶æï¼
|
| | | * |
| | | *
|
| | | * @param deptId é¨é¨ID
|
| | | * @return åé¨é¨æ°
|
| | | */
|
| | |
| | |
|
| | | /**
|
| | | * æ¯å¦åå¨åèç¹
|
| | | * |
| | | *
|
| | | * @param deptId é¨é¨ID
|
| | | * @return ç»æ
|
| | | */
|
| | |
| | |
|
| | | /**
|
| | | * æ¥è¯¢é¨é¨æ¯å¦åå¨ç¨æ·
|
| | | * |
| | | *
|
| | | * @param deptId é¨é¨ID
|
| | | * @return ç»æ
|
| | | */
|
| | |
| | |
|
| | | /**
|
| | | * æ ¡éªé¨é¨åç§°æ¯å¦å¯ä¸
|
| | | * |
| | | *
|
| | | * @param deptName é¨é¨åç§°
|
| | | * @param parentId ç¶é¨é¨ID
|
| | | * @return ç»æ
|
| | |
| | |
|
| | | /**
|
| | | * æ°å¢é¨é¨ä¿¡æ¯
|
| | | * |
| | | *
|
| | | * @param dept é¨é¨ä¿¡æ¯
|
| | | * @return ç»æ
|
| | | */
|
| | |
| | |
|
| | | /**
|
| | | * ä¿®æ¹é¨é¨ä¿¡æ¯
|
| | | * |
| | | *
|
| | | * @param dept é¨é¨ä¿¡æ¯
|
| | | * @return ç»æ
|
| | | */
|
| | |
| | |
|
| | | /**
|
| | | * ä¿®æ¹æå¨é¨é¨æ£å¸¸ç¶æ
|
| | | * |
| | | *
|
| | | * @param deptIds é¨é¨IDç»
|
| | | */
|
| | | public void updateDeptStatusNormal(Long[] deptIds);
|
| | |
|
| | | /**
|
| | | * ä¿®æ¹åå
ç´ å
³ç³»
|
| | | * |
| | | *
|
| | | * @param depts åå
ç´
|
| | | * @return ç»æ
|
| | | */
|
| | |
| | |
|
| | | /**
|
| | | * å é¤é¨é¨ç®¡çä¿¡æ¯
|
| | | * |
| | | *
|
| | | * @param deptId é¨é¨ID
|
| | | * @return ç»æ
|
| | | */
|
| | |
| | | package com.ruoyi.project.system.service.impl;
|
| | |
|
| | | import java.time.LocalDateTime;
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
| | | import com.ruoyi.project.system.mapper.SysUserMapper;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.context.annotation.Lazy;
|
| | | import org.springframework.scheduling.annotation.Scheduled;
|
| | | import org.springframework.stereotype.Service;
|
| | | import com.ruoyi.project.system.domain.SysNotice;
|
| | | import com.ruoyi.project.system.mapper.SysNoticeMapper;
|
| | |
| | | sysNotice.setTenantId(tenantId);
|
| | | return sysNotice;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import com.ruoyi.purchase.dto.PurchaseLedgerDto; |
| | | import com.ruoyi.purchase.pojo.PurchaseLedger; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import com.ruoyi.home.dto.IncomeExpenseAnalysisDto; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | |
| | | IPage<PurchaseLedgerDto> selectPurchaseLedgerListPage(IPage ipage, @Param("c") PurchaseLedgerDto purchaseLedger); |
| | | |
| | | List<PaymentRegistrationDto> getPaymentRegistrationDtoById(Long id); |
| | | |
| | | List<IncomeExpenseAnalysisDto> selectPurchaseStats(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("dateFormat") String dateFormat); |
| | | |
| | | BigDecimal selectTotalPurchaseAmount(@Param("startDate") String startDate, @Param("endDate") String endDate); |
| | | } |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.io.FilenameUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.data.redis.core.StringRedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | * @date 2025-05-09 |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | @Slf4j |
| | | public class PurchaseLedgerServiceImpl extends ServiceImpl<PurchaseLedgerMapper, PurchaseLedger> implements IPurchaseLedgerService { |
| | | private final AccountExpenseService accountExpenseService; |
| | | private final PurchaseLedgerMapper purchaseLedgerMapper; |
| | | @Autowired |
| | | private AccountExpenseService accountExpenseService; |
| | | @Autowired |
| | | private PurchaseLedgerMapper purchaseLedgerMapper; |
| | | |
| | | private final SalesLedgerMapper salesLedgerMapper; |
| | | private final SalesLedgerProductMapper salesLedgerProductMapper; |
| | | @Autowired |
| | | private SalesLedgerMapper salesLedgerMapper; |
| | | @Autowired |
| | | private SalesLedgerProductMapper salesLedgerProductMapper; |
| | | |
| | | private final SysUserMapper userMapper; |
| | | @Autowired |
| | | private SysUserMapper userMapper; |
| | | |
| | | private final TempFileMapper tempFileMapper; |
| | | @Autowired |
| | | private TempFileMapper tempFileMapper; |
| | | |
| | | private final CommonFileMapper commonFileMapper; |
| | | @Autowired |
| | | private CommonFileMapper commonFileMapper; |
| | | |
| | | private final SupplierManageMapper supplierManageMapper; |
| | | @Autowired |
| | | private SupplierManageMapper supplierManageMapper; |
| | | |
| | | private final ProductMapper productMapper; |
| | | @Autowired |
| | | private ProductMapper productMapper; |
| | | |
| | | private final ProductModelMapper productModelMapper; |
| | | @Autowired |
| | | private ProductModelMapper productModelMapper; |
| | | |
| | | private final SysUserMapper sysUserMapper; |
| | | @Autowired |
| | | private SysUserMapper sysUserMapper; |
| | | |
| | | private final TicketRegistrationMapper ticketRegistrationMapper; |
| | | @Autowired |
| | | private TicketRegistrationMapper ticketRegistrationMapper; |
| | | |
| | | private final ProductRecordMapper productRecordMapper; |
| | | @Autowired |
| | | private ProductRecordMapper productRecordMapper; |
| | | |
| | | private final PaymentRegistrationMapper paymentRegistrationMapper; |
| | | |
| | | private final InvoiceRegistrationProductMapper invoiceRegistrationProductMapper; |
| | | |
| | | private final StringRedisTemplate redisTemplate; |
| | | private final QualityInspectMapper qualityInspectMapper; |
| | | private final CommonFileServiceImpl commonFileService; |
| | | private final QualityTestStandardBindingMapper qualityTestStandardBindingMapper; |
| | | private final QualityTestStandardParamMapper qualityTestStandardParamMapper; |
| | | private final QualityTestStandardMapper qualityTestStandardMapper; |
| | | private final QualityInspectParamMapper qualityInspectParamMapper; |
| | | |
| | | private final ApproveProcessServiceImpl approveProcessService; |
| | | |
| | | private final ProcurementRecordMapper procurementRecordStorageMapper; |
| | | |
| | | private final PurchaseLedgerTemplateMapper purchaseLedgerTemplateMapper; |
| | | |
| | | private final SalesLedgerProductTemplateMapper salesLedgerProductTemplateMapper; |
| | | @Autowired |
| | | private PaymentRegistrationMapper paymentRegistrationMapper; |
| | | @Autowired |
| | | private InvoiceRegistrationProductMapper invoiceRegistrationProductMapper; |
| | | @Autowired |
| | | private StringRedisTemplate redisTemplate; |
| | | @Autowired |
| | | private QualityInspectMapper qualityInspectMapper; |
| | | @Autowired |
| | | private CommonFileServiceImpl commonFileService; |
| | | @Autowired |
| | | private QualityTestStandardBindingMapper qualityTestStandardBindingMapper; |
| | | @Autowired |
| | | private QualityTestStandardParamMapper qualityTestStandardParamMapper; |
| | | @Autowired |
| | | private QualityTestStandardMapper qualityTestStandardMapper; |
| | | @Autowired |
| | | private QualityInspectParamMapper qualityInspectParamMapper; |
| | | @Autowired |
| | | private ApproveProcessServiceImpl approveProcessService; |
| | | @Autowired |
| | | private ProcurementRecordMapper procurementRecordStorageMapper; |
| | | @Autowired |
| | | private PurchaseLedgerTemplateMapper purchaseLedgerTemplateMapper; |
| | | @Autowired |
| | | private SalesLedgerProductTemplateMapper salesLedgerProductTemplateMapper; |
| | | @Value("${file.upload-dir}") |
| | | private String uploadDir; |
| | | |
| | |
| | | return 1; |
| | | } |
| | | |
| | | private void addQualityInspect(PurchaseLedger purchaseLedger, SalesLedgerProduct saleProduct) { |
| | | |
| | | public void addQualityInspect(PurchaseLedger purchaseLedger, SalesLedgerProduct saleProduct) { |
| | | QualityInspect qualityInspect = new QualityInspect(); |
| | | qualityInspect.setInspectType(0); |
| | | qualityInspect.setSupplier(purchaseLedger.getSupplierName()); |
| | |
| | | if (ids == null || ids.length == 0) { |
| | | throw new BaseException("请éä¸è³å°ä¸æ¡æ°æ®"); |
| | | } |
| | | for (Long id : ids) { |
| | | PurchaseLedger purchaseLedger = purchaseLedgerMapper.selectById(id); |
| | | if (purchaseLedger.getApprovalStatus().equals(3)) { |
| | | throw new BaseException(purchaseLedger.getPurchaseContractNumber()+"å·²ç»å®¡æ¹éè¿ï¼ä¸å
许å é¤"); |
| | | } |
| | | } |
| | | // æ¹éå é¤å
³èçéè´å
¥åºè®°å½ |
| | | LambdaQueryWrapper<SalesLedgerProduct> salesLedgerProductQueryWrapper = new LambdaQueryWrapper<>(); |
| | | salesLedgerProductQueryWrapper.in(SalesLedgerProduct::getSalesLedgerId, ids) |
| | |
| | | */ |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody QualityUnqualified qualityUnqualified) { |
| | | qualityUnqualified.setInspectState(0); |
| | | return AjaxResult.success(qualityUnqualifiedService.save(qualityUnqualified)); |
| | | } |
| | | |
| | |
| | | public int deal(QualityUnqualified qualityUnqualified) { |
| | | QualityUnqualified unqualified = qualityUnqualifiedMapper.selectById(qualityUnqualified.getId()); |
| | | QualityInspect qualityInspect = qualityInspectService.getById(unqualified.getInspectId()); |
| | | switch (qualityUnqualified.getDealResult()) { |
| | | case "è¿ä¿®": |
| | | case "è¿å·¥": |
| | | //å¤æè´¨æ£è¡¨æ¯å¦æç¸å
³çæ¥å·¥id,å¦æææ¥å·¥id,é£ä¹è¿å·¥éè¦éæ°å建ç产订åéæ°ç产 |
| | | if (ObjectUtils.isNotNull(qualityInspect.getProductMainId())) { |
| | | //è¿å·¥éè¦éæ°å建ç产订åéæ°ç产 |
| | | ProductOrder productOrder = productionProductMainMapper.getOrderByMainId(qualityInspect.getProductMainId()); |
| | | ProductOrder order = new ProductOrder(); |
| | | BeanUtils.copyProperties(productOrder, order); |
| | | order.setId(null); |
| | | order.setQuantity(unqualified.getQuantity()); |
| | | order.setCompleteQuantity(BigDecimal.ZERO); |
| | | order.setStartTime(null); |
| | | order.setEndTime(null); |
| | | productOrderService.save(order); |
| | | //æ°å¢ç产订åä¸çå·¥èºè·¯çº¿ä¸»è¡¨ |
| | | ProductProcessRoute productProcessRoute = productProcessRouteMapper.selectList(Wrappers.<ProductProcessRoute>lambdaQuery().eq(ProductProcessRoute::getProductOrderId, productOrder.getId()).orderByDesc(ProductProcessRoute::getId)).get(0); |
| | | ProductProcessRoute newProcessRoute = new ProductProcessRoute(); |
| | | BeanUtils.copyProperties(productProcessRoute, newProcessRoute); |
| | | newProcessRoute.setId(null); |
| | | newProcessRoute.setProductOrderId(order.getId()); |
| | | productProcessRouteMapper.insert(newProcessRoute); |
| | | //æ°å¢ç产订åä¸çå·¥èºè·¯çº¿å表 |
| | | List<ProductProcessRouteItem> processRouteItems = productProcessRouteItemMapper.selectList(new QueryWrapper<ProductProcessRouteItem>().lambda().eq(ProductProcessRouteItem::getProductRouteId, productProcessRoute.getId())); |
| | | // çæå½åæ¥æçåç¼ï¼å¹´ææ¥ |
| | | String datePrefix = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")); |
| | | for (ProductProcessRouteItem processRouteItem : processRouteItems) { |
| | | ProductProcessRouteItem productProcessRouteItem = new ProductProcessRouteItem(); |
| | | BeanUtils.copyProperties(processRouteItem, productProcessRouteItem); |
| | | productProcessRouteItem.setId(null); |
| | | productProcessRouteItem.setProductRouteId(newProcessRoute.getId()); |
| | | int insert = productProcessRouteItemMapper.insert(productProcessRouteItem); |
| | | if (insert > 0) { |
| | | // æ¥è¯¢ä»æ¥å·²åå¨çæå¤§å·¥åå· |
| | | QueryWrapper<ProductWorkOrder> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.likeRight("work_order_no", datePrefix) |
| | | .orderByDesc("work_order_no") |
| | | .last("LIMIT 1"); |
| | | ProductWorkOrder lastWorkOrder = productWorkOrderMapper.selectOne(queryWrapper); |
| | | int sequenceNumber = 1; // é»è®¤åºå· |
| | | if (lastWorkOrder != null && lastWorkOrder.getWorkOrderNo() != null) { |
| | | String lastNo = lastWorkOrder.getWorkOrderNo().toString(); |
| | | if (lastNo.startsWith(datePrefix)) { |
| | | String seqStr = lastNo.substring(datePrefix.length()); |
| | | try { |
| | | sequenceNumber = Integer.parseInt(seqStr) + 1; |
| | | } catch (NumberFormatException e) { |
| | | sequenceNumber = 1; |
| | | if (ObjectUtils.isNotNull(qualityInspect) && qualityInspect.getInspectType()!=0) { |
| | | switch (qualityUnqualified.getDealResult()) { |
| | | case "è¿ä¿®": |
| | | case "è¿å·¥": |
| | | //å¤æè´¨æ£è¡¨æ¯å¦æç¸å
³çæ¥å·¥id,å¦æææ¥å·¥id,é£ä¹è¿å·¥éè¦éæ°å建ç产订åéæ°ç产 |
| | | if (ObjectUtils.isNotNull(qualityInspect.getProductMainId())) { |
| | | //è¿å·¥éè¦éæ°å建ç产订åéæ°ç产 |
| | | ProductOrder productOrder = productionProductMainMapper.getOrderByMainId(qualityInspect.getProductMainId()); |
| | | ProductOrder order = new ProductOrder(); |
| | | BeanUtils.copyProperties(productOrder, order); |
| | | order.setId(null); |
| | | order.setQuantity(unqualified.getQuantity()); |
| | | order.setCompleteQuantity(BigDecimal.ZERO); |
| | | order.setStartTime(null); |
| | | order.setEndTime(null); |
| | | productOrderService.save(order); |
| | | //æ°å¢ç产订åä¸çå·¥èºè·¯çº¿ä¸»è¡¨ |
| | | ProductProcessRoute productProcessRoute = productProcessRouteMapper.selectList(Wrappers.<ProductProcessRoute>lambdaQuery().eq(ProductProcessRoute::getProductOrderId, productOrder.getId()).orderByDesc(ProductProcessRoute::getId)).get(0); |
| | | ProductProcessRoute newProcessRoute = new ProductProcessRoute(); |
| | | BeanUtils.copyProperties(productProcessRoute, newProcessRoute); |
| | | newProcessRoute.setId(null); |
| | | newProcessRoute.setProductOrderId(order.getId()); |
| | | productProcessRouteMapper.insert(newProcessRoute); |
| | | //æ°å¢ç产订åä¸çå·¥èºè·¯çº¿å表 |
| | | List<ProductProcessRouteItem> processRouteItems = productProcessRouteItemMapper.selectList(new QueryWrapper<ProductProcessRouteItem>().lambda().eq(ProductProcessRouteItem::getProductRouteId, productProcessRoute.getId())); |
| | | // çæå½åæ¥æçåç¼ï¼å¹´ææ¥ |
| | | String datePrefix = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")); |
| | | for (ProductProcessRouteItem processRouteItem : processRouteItems) { |
| | | ProductProcessRouteItem productProcessRouteItem = new ProductProcessRouteItem(); |
| | | BeanUtils.copyProperties(processRouteItem, productProcessRouteItem); |
| | | productProcessRouteItem.setId(null); |
| | | productProcessRouteItem.setProductRouteId(newProcessRoute.getId()); |
| | | int insert = productProcessRouteItemMapper.insert(productProcessRouteItem); |
| | | if (insert > 0) { |
| | | // æ¥è¯¢ä»æ¥å·²åå¨çæå¤§å·¥åå· |
| | | QueryWrapper<ProductWorkOrder> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.likeRight("work_order_no", datePrefix) |
| | | .orderByDesc("work_order_no") |
| | | .last("LIMIT 1"); |
| | | ProductWorkOrder lastWorkOrder = productWorkOrderMapper.selectOne(queryWrapper); |
| | | int sequenceNumber = 1; // é»è®¤åºå· |
| | | if (lastWorkOrder != null && lastWorkOrder.getWorkOrderNo() != null) { |
| | | String lastNo = lastWorkOrder.getWorkOrderNo().toString(); |
| | | if (lastNo.startsWith(datePrefix)) { |
| | | String seqStr = lastNo.substring(datePrefix.length()); |
| | | try { |
| | | sequenceNumber = Integer.parseInt(seqStr) + 1; |
| | | } catch (NumberFormatException e) { |
| | | sequenceNumber = 1; |
| | | } |
| | | } |
| | | } |
| | | // çæå®æ´çå·¥åå· |
| | | String workOrderNoStr = String.format("%s%03d", datePrefix, sequenceNumber); |
| | | ProductWorkOrder productWorkOrder = new ProductWorkOrder(); |
| | | productWorkOrder.setProductProcessRouteItemId(productProcessRouteItem.getId()); |
| | | productWorkOrder.setProductOrderId(order.getId()); |
| | | productWorkOrder.setPlanQuantity(order.getQuantity()); |
| | | productWorkOrder.setWorkOrderNo(workOrderNoStr); |
| | | productWorkOrder.setStatus(1); |
| | | productWorkOrderMapper.insert(productWorkOrder); |
| | | } |
| | | // çæå®æ´çå·¥åå· |
| | | String workOrderNoStr = String.format("%s%03d", datePrefix, sequenceNumber); |
| | | ProductWorkOrder productWorkOrder = new ProductWorkOrder(); |
| | | productWorkOrder.setProductProcessRouteItemId(productProcessRouteItem.getId()); |
| | | productWorkOrder.setProductOrderId(order.getId()); |
| | | productWorkOrder.setPlanQuantity(order.getQuantity()); |
| | | productWorkOrder.setWorkOrderNo(workOrderNoStr); |
| | | productWorkOrder.setStatus(1); |
| | | productWorkOrderMapper.insert(productWorkOrder); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case "æ¥åº": |
| | | //è°ç¨ä¸åæ ¼åºåæ¥å£ å
¥ä¸åæ ¼åº |
| | | stockUtils.addUnStock(qualityInspect.getProductModelId(), unqualified.getQuantity(), StockUnQualifiedRecordTypeEnum.DEFECTIVE_SCRAP.getCode(),unqualified.getId()); |
| | | break; |
| | | case "è®©æ¥æ¾è¡": |
| | | //è°ç¨æäº¤åæ ¼çæ¥å£ |
| | | stockUtils.addStock(qualityInspect.getProductModelId(), unqualified.getQuantity(), StockQualifiedRecordTypeEnum.DEFECTIVE_PASS.getCode(),unqualified.getId()); |
| | | qualityInspect.setCheckResult("åæ ¼"); |
| | | qualityInspectService.submit(qualityInspect); |
| | | break; |
| | | default: |
| | | break; |
| | | break; |
| | | case "æ¥åº": |
| | | //è°ç¨ä¸åæ ¼åºåæ¥å£ å
¥ä¸åæ ¼åº |
| | | stockUtils.addUnStock(qualityInspect.getProductModelId(), unqualified.getQuantity(), StockUnQualifiedRecordTypeEnum.DEFECTIVE_SCRAP.getCode(), unqualified.getId()); |
| | | break; |
| | | case "è®©æ¥æ¾è¡": |
| | | //è°ç¨æäº¤åæ ¼çæ¥å£ |
| | | stockUtils.addStock(qualityInspect.getProductModelId(), unqualified.getQuantity(), StockQualifiedRecordTypeEnum.DEFECTIVE_PASS.getCode(), unqualified.getId()); |
| | | qualityInspect.setCheckResult("åæ ¼"); |
| | | qualityInspectService.submit(qualityInspect); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | qualityUnqualified.setInspectState(1);//å·²å¤ç |
| | | return qualityUnqualifiedMapper.updateById(qualityUnqualified); |
| | |
| | | |
| | | @ApiOperation("å é¤äºæ
䏿¥è®°å½") |
| | | @DeleteMapping("/{ids}") |
| | | public R delSafeCertification(@RequestBody List<Integer> ids) { |
| | | public R delSafeAccident(@RequestBody List<Integer> ids) { |
| | | return R.ok(safeAccidentService.removeBatchByIds(ids)); |
| | | } |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.safe.controller; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.safe.dto.SafeTrainingDto; |
| | | import com.ruoyi.safe.pojo.SafeAccident; |
| | | import com.ruoyi.safe.pojo.SafeTraining; |
| | | import com.ruoyi.safe.pojo.SafeTrainingDetails; |
| | | import com.ruoyi.safe.service.SafeAccidentService; |
| | | import com.ruoyi.safe.service.SafeTrainingDetailsService; |
| | | import com.ruoyi.safe.service.SafeTrainingService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * å®å
¨ç产--å®å
¨å¹è®èæ ¸ å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-29 10:54:06 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/safeTraining") |
| | | @Api(tags = "å®å
¨ç产--å®å
¨å¹è®èæ ¸") |
| | | public class SafeTrainingController { |
| | | |
| | | @Autowired |
| | | private SafeTrainingService safeTrainingService; |
| | | |
| | | @Autowired |
| | | private SafeTrainingDetailsService safeTrainingDetailsService; |
| | | |
| | | @GetMapping("/page") |
| | | @ApiOperation("å页æ¥è¯¢") |
| | | public R page(Page page, SafeTrainingDto safeTrainingDto) { |
| | | return R.ok(safeTrainingService.pageSafeTraining(page, safeTrainingDto)); |
| | | } |
| | | |
| | | @ApiOperation("æ°å¢/ç¼è¾å®å
¨å¹è®èæ ¸") |
| | | @PostMapping() |
| | | public R addOrUpdate(@RequestBody SafeTraining safeTraining) { |
| | | return R.ok(safeTrainingService.addOrUpdate(safeTraining)); |
| | | } |
| | | |
| | | @ApiOperation("ç¾å°") |
| | | @PostMapping ("/sign") |
| | | public R sign(@RequestBody SafeTrainingDetails safeTrainingDetails) { |
| | | return R.ok(safeTrainingDetailsService.save(safeTrainingDetails)); |
| | | } |
| | | |
| | | @ApiOperation("ç»ææç»æ¥è¯¢") |
| | | @GetMapping ("/getSafeTraining") |
| | | public R getSafeTraining(Long id) { |
| | | return R.ok(safeTrainingService.getSafeTraining(id)); |
| | | } |
| | | |
| | | @ApiOperation("ç»ææç»ä¿å") |
| | | @PostMapping ("/saveSafeTraining") |
| | | public R saveSafeTraining(@RequestBody SafeTrainingDto safeTrainingDto) { |
| | | return R.ok(safeTrainingService.saveSafeTraining(safeTrainingDto)); |
| | | } |
| | | |
| | | @ApiOperation("å é¤å®å
¨å¹è®èæ ¸") |
| | | @DeleteMapping("/{ids}") |
| | | public R delSafeTraining(@RequestBody List<Integer> ids) { |
| | | return R.ok(safeTrainingService.delSafeTraining(ids)); |
| | | } |
| | | |
| | | @ApiOperation("导åº") |
| | | @PostMapping ("/export") |
| | | public void export(HttpServletResponse response, @RequestBody SafeTraining safeTraining) { |
| | | safeTrainingService.export(response,safeTraining.getId()); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.safe.controller; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.safe.dto.SafeTrainingDto; |
| | | import com.ruoyi.safe.pojo.SafeTraining; |
| | | import com.ruoyi.safe.pojo.SafeTrainingDetails; |
| | | import com.ruoyi.safe.service.SafeTrainingDetailsService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * <p> |
| | | * å®å
¨ç产--å®å
¨å¹è®èæ ¸--è®°å½è¯¦æ
å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-29 10:54:15 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/safeTrainingDetails") |
| | | @Api(tags = "å®å
¨ç产--å®å
¨å¹è®èæ ¸--è®°å½è¯¦æ
") |
| | | public class SafeTrainingDetailsController { |
| | | |
| | | |
| | | @Autowired |
| | | private SafeTrainingDetailsService safeTrainingDetailsService; |
| | | |
| | | @GetMapping("/page") |
| | | @ApiOperation("å页æ¥è¯¢") |
| | | public R page(Page page, SafeTrainingDetails safeTrainingDetails) { |
| | | return R.ok(safeTrainingDetailsService.pageDetails(page, safeTrainingDetails)); |
| | | } |
| | | |
| | | @ApiOperation("导åº") |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, @RequestBody SafeTrainingDetails safeTrainingDetails) { |
| | | safeTrainingDetailsService.export(response,safeTrainingDetails.getUserId()); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.safe.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.safe.pojo.SafeHiddenFile; |
| | | import com.ruoyi.safe.pojo.SafeTrainingFile; |
| | | import com.ruoyi.safe.service.SafeTrainingFileService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * å®å
¨ç产--å®å
¨å¹è®èæ ¸--éä»¶ å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-29 10:54:23 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/safeTrainingFile") |
| | | @Api(tags = "å®å
¨ç产--å®å
¨å¹è®èæ ¸--éä»¶") |
| | | public class SafeTrainingFileController { |
| | | |
| | | @Resource |
| | | private SafeTrainingFileService safeTrainingFileService; |
| | | |
| | | |
| | | /** |
| | | * æ°å¢ |
| | | * @param safeHiddenFile |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | @ApiOperation("æ°å¢") |
| | | public R add(@RequestBody SafeTrainingFile safeHiddenFile) { |
| | | return R.ok(safeTrainingFileService.save(safeHiddenFile)); |
| | | } |
| | | |
| | | /** |
| | | * å é¤ |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | @ApiOperation("å é¤") |
| | | public R delSafeHiddenFile(@RequestBody List<Integer> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return R.fail("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | } |
| | | //å 餿£éªéä»¶ |
| | | return R.ok(safeTrainingFileService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | | *å页æ¥è¯¢ |
| | | * @param page |
| | | * @param safeTrainingFile |
| | | * @return |
| | | */ |
| | | @GetMapping("/listPage") |
| | | @ApiOperation("å页æ¥è¯¢") |
| | | public R listPage(Page page, SafeTrainingFile safeTrainingFile) { |
| | | return R.ok(safeTrainingFileService.page(page, Wrappers.<SafeTrainingFile>lambdaQuery().eq(SafeTrainingFile::getSafeTrainingId,safeTrainingFile.getSafeTrainingId()))); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.safe.dto; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.safe.pojo.SafeTrainingDetails; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | public class SafeTrainingDetailsDto extends SafeTrainingDetails { |
| | | |
| | | @ApiModelProperty("å¹è®äººåç¼å·") |
| | | private String userName; |
| | | |
| | | @ApiModelProperty("å¹è®äººååç§°") |
| | | private String nickName; |
| | | |
| | | @ApiModelProperty("ææºå·ç ") |
| | | private String phonenumber; |
| | | |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.safe.dto; |
| | | |
| | | import com.ruoyi.safe.pojo.SafeTraining; |
| | | import com.ruoyi.safe.pojo.SafeTrainingDetails; |
| | | import com.ruoyi.safe.pojo.SafeTrainingFile; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class SafeTrainingDto extends SafeTraining { |
| | | |
| | | @ApiModelProperty("æ¥å人æ°") |
| | | private Integer nums; |
| | | |
| | | @ApiModelProperty("è¯ä»·äºº") |
| | | private String assessmentUserName; |
| | | |
| | | @ApiModelProperty("éä»¶éå") |
| | | private List<SafeTrainingFile> safeTrainingFileList; |
| | | |
| | | @ApiModelProperty("å¹è®è®°å½äººå详æ
éå") |
| | | private List<SafeTrainingDetailsDto> safeTrainingDetailsDtoList; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.safe.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.safe.dto.SafeTrainingDetailsDto; |
| | | import com.ruoyi.safe.pojo.SafeTrainingDetails; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * å®å
¨ç产--å®å
¨å¹è®èæ ¸--è®°å½è¯¦æ
Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-29 10:54:15 |
| | | */ |
| | | @Mapper |
| | | public interface SafeTrainingDetailsMapper extends BaseMapper<SafeTrainingDetails> { |
| | | |
| | | List<SafeTrainingDetailsDto> getSafeTraining(@Param("id") Long id); |
| | | |
| | | IPage<SafeTrainingDetails> pageDetails(Page page, @Param("c") SafeTrainingDetails safeTrainingDetails); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.safe.mapper; |
| | | |
| | | import com.ruoyi.safe.pojo.SafeTrainingFile; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * å®å
¨ç产--å®å
¨å¹è®èæ ¸--éä»¶ Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-29 10:54:23 |
| | | */ |
| | | @Mapper |
| | | public interface SafeTrainingFileMapper extends BaseMapper<SafeTrainingFile> { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.safe.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.safe.dto.SafeTrainingDto; |
| | | import com.ruoyi.safe.pojo.SafeTraining; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | | * <p> |
| | | * å®å
¨ç产--å®å
¨å¹è®èæ ¸ Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-29 10:54:06 |
| | | */ |
| | | @Mapper |
| | | public interface SafeTrainingMapper extends BaseMapper<SafeTraining> { |
| | | |
| | | IPage<SafeTrainingDto> pageSafeTraining(Page page, @Param("c") SafeTrainingDto safeTrainingDto); |
| | | |
| | | SafeTrainingDto getSafeTraining(@Param("id") Long id); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.safe.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import java.io.Serializable; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | |
| | | /** |
| | | * <p> |
| | | * å®å
¨ç产--å®å
¨å¹è®èæ ¸ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-29 10:54:06 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @TableName("safe_training") |
| | | @ApiModel(value = "SafeTraining对象", description = "å®å
¨ç产--å®å
¨å¹è®èæ ¸") |
| | | public class SafeTraining implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("课ç¨ç¼å·") |
| | | private String courseCode; |
| | | |
| | | @ApiModelProperty("å¹è®ç®æ ") |
| | | private String trainingObjectives; |
| | | |
| | | @ApiModelProperty("å¹è®å
容") |
| | | private String trainingContent; |
| | | |
| | | @ApiModelProperty("å¹è®æ¹å¼") |
| | | private String trainingMode; |
| | | |
| | | @ApiModelProperty("ç¶æ(0ï¼æªå¼å§1ï¼è¿è¡ä¸ï¼2ï¼å·²ç»æ)") |
| | | private Integer state; |
| | | |
| | | @ApiModelProperty("åå 对象") |
| | | private String participants; |
| | | |
| | | @ApiModelProperty("å¹è®å°ç¹") |
| | | private String placeTraining; |
| | | |
| | | @ApiModelProperty("å¹è®è®²å¸") |
| | | private String trainingLecturer; |
| | | |
| | | @ApiModelProperty("å¹è®æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | @NotBlank(message = "å¹è®æ¥æä¸è½ä¸ºç©º") |
| | | private LocalDate trainingDate; |
| | | |
| | | @ApiModelProperty("å¼å§æ¶é´(æ¶åç§)") |
| | | @NotBlank(message = "å¼å§æ¶é´ä¸è½ä¸ºç©º") |
| | | private String openingTime; |
| | | |
| | | @ApiModelProperty("ç»ææ¶é´(æ¶åç§)") |
| | | @NotBlank(message = "ç»ææ¶é´ä¸è½ä¸ºç©º") |
| | | private String endTime; |
| | | |
| | | @ApiModelProperty("课é¢å¦å") |
| | | private String projectCredits; |
| | | |
| | | @ApiModelProperty("课æ¶") |
| | | private Double classHour; |
| | | |
| | | @ApiModelProperty("èæ ¸æ¹å¼") |
| | | private String assessmentMethod; |
| | | |
| | | @ApiModelProperty("æ¬æ¬¡å¹è®ç»¼åè¯ä»·") |
| | | private String comprehensiveAssessment; |
| | | |
| | | @ApiModelProperty("夿³¨") |
| | | private String remarks; |
| | | |
| | | @ApiModelProperty("è¯ä»·äººid") |
| | | private Integer assessmentUserId; |
| | | |
| | | @ApiModelProperty("è¯ä»·æ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate assessmentDate; |
| | | |
| | | @ApiModelProperty("å¹è®æè¦") |
| | | private String trainingAbstract; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime createTime; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer tenantId; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.safe.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import java.io.Serializable; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | |
| | | /** |
| | | * <p> |
| | | * å®å
¨ç产--å®å
¨å¹è®èæ ¸--è®°å½è¯¦æ
|
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-29 10:54:15 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @TableName("safe_training_details") |
| | | @ApiModel(value = "SafeTrainingDetails对象", description = "å®å
¨ç产--å®å
¨å¹è®èæ ¸--è®°å½è¯¦æ
") |
| | | public class SafeTrainingDetails implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty("ç¨æ·è¡¨æ ¼ï¼userï¼ä¸»é®") |
| | | @NotBlank(message = "ç¨æ·idä¸è½ä¸ºç©º") |
| | | private Long userId; |
| | | |
| | | @ApiModelProperty("å
³èå®å
¨å¹è®èæ ¸id") |
| | | private Integer safeTrainingId; |
| | | |
| | | @ApiModelProperty("èæ ¸ç»æ") |
| | | private String examinationResults; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime createTime; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer tenantId; |
| | | |
| | | |
| | | @ApiModelProperty("å¹è®æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | @TableField(exist = false) |
| | | private LocalDate trainingDate; |
| | | |
| | | @ApiModelProperty("课ç¨ç¼å·") |
| | | @TableField(exist = false) |
| | | private String courseCode; |
| | | |
| | | @ApiModelProperty("å¹è®å
容") |
| | | @TableField(exist = false) |
| | | private String trainingContent; |
| | | |
| | | @ApiModelProperty("å¹è®è¯¾æ¶") |
| | | @TableField(exist = false) |
| | | private Double classHour; |
| | | |
| | | @ApiModelProperty("课é¢å¦å") |
| | | @TableField(exist = false) |
| | | private String projectCredits; |
| | | |
| | | @ApiModelProperty("夿³¨") |
| | | @TableField(exist = false) |
| | | private String remarks; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.safe.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * <p> |
| | | * å®å
¨ç产--å®å
¨å¹è®èæ ¸--éä»¶ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-29 10:54:23 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @TableName("safe_training_file") |
| | | @ApiModel(value = "SafeTrainingFile对象", description = "å®å
¨ç产--å®å
¨å¹è®èæ ¸--éä»¶") |
| | | public class SafeTrainingFile implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty("å
³èå®å
¨å¹è®èæ ¸id") |
| | | private Integer safeTrainingId; |
| | | |
| | | private String name; |
| | | |
| | | private String url; |
| | | |
| | | private Object fileSize; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer tenantId; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.safe.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.safe.dto.SafeTrainingDto; |
| | | import com.ruoyi.safe.pojo.SafeTrainingDetails; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * <p> |
| | | * å®å
¨ç产--å®å
¨å¹è®èæ ¸--è®°å½è¯¦æ
æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-29 10:54:15 |
| | | */ |
| | | public interface SafeTrainingDetailsService extends IService<SafeTrainingDetails> { |
| | | |
| | | IPage<SafeTrainingDetails> pageDetails(Page page, SafeTrainingDetails safeTrainingDetails); |
| | | |
| | | void export(HttpServletResponse response, Long userId); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.safe.service; |
| | | |
| | | import com.ruoyi.safe.pojo.SafeTrainingFile; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * å®å
¨ç产--å®å
¨å¹è®èæ ¸--éä»¶ æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-29 10:54:23 |
| | | */ |
| | | public interface SafeTrainingFileService extends IService<SafeTrainingFile> { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.safe.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.safe.dto.SafeTrainingDto; |
| | | import com.ruoyi.safe.pojo.SafeTraining; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * å®å
¨ç产--å®å
¨å¹è®èæ ¸ æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-29 10:54:06 |
| | | */ |
| | | public interface SafeTrainingService extends IService<SafeTraining> { |
| | | |
| | | IPage<SafeTrainingDto> pageSafeTraining(Page page, SafeTrainingDto safeTrainingDto); |
| | | |
| | | int addOrUpdate(SafeTraining safeTraining); |
| | | |
| | | SafeTrainingDto getSafeTraining(Long id); |
| | | |
| | | int saveSafeTraining(SafeTrainingDto safeTrainingDto); |
| | | |
| | | int delSafeTraining(List<Integer> ids); |
| | | |
| | | void export(HttpServletResponse response, Long id); |
| | | } |
| | |
| | | @Override |
| | | public int add(SafeHidden safeHidden) { |
| | | safeHiddenMapper.insert(safeHidden); |
| | | String datePrefix = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")); |
| | | String datePrefix = LocalDate.now().format(DateTimeFormatter.ofPattern("yyMMdd")); |
| | | String no = "YH" + String.format("%s%03d", datePrefix, safeHidden.getId()); |
| | | safeHidden.setHiddenCode(no); |
| | | safeHiddenMapper.updateById(safeHidden); |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.safe.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.deepoove.poi.XWPFTemplate; |
| | | import com.deepoove.poi.config.Configure; |
| | | import com.ruoyi.common.utils.HackLoopTableRenderPolicy; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import com.ruoyi.safe.dto.SafeTrainingDetailsDto; |
| | | import com.ruoyi.safe.dto.SafeTrainingDto; |
| | | import com.ruoyi.safe.pojo.SafeTrainingDetails; |
| | | import com.ruoyi.safe.mapper.SafeTrainingDetailsMapper; |
| | | import com.ruoyi.safe.service.SafeTrainingDetailsService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | | import java.net.URLEncoder; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * å®å
¨ç产--å®å
¨å¹è®èæ ¸--è®°å½è¯¦æ
æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-29 10:54:15 |
| | | */ |
| | | @Service |
| | | public class SafeTrainingDetailsServiceImpl extends ServiceImpl<SafeTrainingDetailsMapper, SafeTrainingDetails> implements SafeTrainingDetailsService { |
| | | |
| | | @Autowired |
| | | private SafeTrainingDetailsMapper safeTrainingDetailsMapper; |
| | | |
| | | @Autowired |
| | | private SysUserMapper sysUserMapper; |
| | | |
| | | @Override |
| | | public IPage<SafeTrainingDetails> pageDetails(Page page, SafeTrainingDetails safeTrainingDetails) { |
| | | return safeTrainingDetailsMapper.pageDetails(page, safeTrainingDetails); |
| | | } |
| | | |
| | | @Override |
| | | public void export(HttpServletResponse response, Long userId) { |
| | | SafeTrainingDetails safeTrainingDetails = new SafeTrainingDetails(); |
| | | safeTrainingDetails.setUserId(userId); |
| | | SysUser sysUser = sysUserMapper.selectUserById(userId); |
| | | List<SafeTrainingDetails> safeTrainingDetailsList = safeTrainingDetailsMapper.pageDetails(new Page(1, -1), safeTrainingDetails).getRecords(); |
| | | InputStream inputStream = this.getClass().getResourceAsStream("/static/safe-training-details.docx"); |
| | | Configure configure = Configure.builder() |
| | | .bind("safeTrainingDetailsList", new HackLoopTableRenderPolicy()) |
| | | .build(); |
| | | XWPFTemplate template = XWPFTemplate.compile(inputStream, configure).render( |
| | | new HashMap<String, Object>() {{ |
| | | put("user", sysUser); |
| | | put("safeTrainingDetailsList", safeTrainingDetailsList); |
| | | }}); |
| | | |
| | | try { |
| | | response.setContentType("application/msword"); |
| | | String fileName = URLEncoder.encode( |
| | | "å¹è®ä¸èæ ¸è®°å½", "UTF-8"); |
| | | response.setHeader("Access-Control-Expose-Headers", "Content-Disposition"); |
| | | response.setHeader("Content-disposition", |
| | | "attachment;filename=" + fileName + ".docx"); |
| | | OutputStream os = response.getOutputStream(); |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.safe.service.impl; |
| | | |
| | | import com.ruoyi.safe.pojo.SafeTrainingFile; |
| | | import com.ruoyi.safe.mapper.SafeTrainingFileMapper; |
| | | import com.ruoyi.safe.service.SafeTrainingFileService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * å®å
¨ç产--å®å
¨å¹è®èæ ¸--éä»¶ æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-29 10:54:23 |
| | | */ |
| | | @Service |
| | | public class SafeTrainingFileServiceImpl extends ServiceImpl<SafeTrainingFileMapper, SafeTrainingFile> implements SafeTrainingFileService { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.safe.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.deepoove.poi.XWPFTemplate; |
| | | import com.deepoove.poi.config.Configure; |
| | | import com.ruoyi.common.utils.HackLoopTableRenderPolicy; |
| | | import com.ruoyi.production.pojo.ProductOrder; |
| | | import com.ruoyi.production.pojo.ProductWorkOrder; |
| | | import com.ruoyi.project.system.domain.SysNotice; |
| | | import com.ruoyi.safe.dto.SafeTrainingDetailsDto; |
| | | import com.ruoyi.safe.dto.SafeTrainingDto; |
| | | import com.ruoyi.safe.mapper.SafeTrainingDetailsMapper; |
| | | import com.ruoyi.safe.mapper.SafeTrainingFileMapper; |
| | | import com.ruoyi.safe.pojo.SafeTraining; |
| | | import com.ruoyi.safe.mapper.SafeTrainingMapper; |
| | | import com.ruoyi.safe.pojo.SafeTrainingDetails; |
| | | import com.ruoyi.safe.pojo.SafeTrainingFile; |
| | | import com.ruoyi.safe.service.SafeTrainingService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | | import java.net.URLEncoder; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneId; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * å®å
¨ç产--å®å
¨å¹è®èæ ¸ æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-01-29 10:54:06 |
| | | */ |
| | | @Service |
| | | public class SafeTrainingServiceImpl extends ServiceImpl<SafeTrainingMapper, SafeTraining> implements SafeTrainingService { |
| | | |
| | | @Autowired |
| | | private SafeTrainingMapper safeTrainingMapper; |
| | | |
| | | @Autowired |
| | | private SafeTrainingFileMapper safeTrainingFileMapper; |
| | | |
| | | @Autowired |
| | | private SafeTrainingDetailsMapper safeTrainingDetailsMapper; |
| | | |
| | | @Override |
| | | public IPage<SafeTrainingDto> pageSafeTraining(Page page, SafeTrainingDto safeTrainingDto) { |
| | | return safeTrainingMapper.pageSafeTraining(page, safeTrainingDto); |
| | | } |
| | | |
| | | @Override |
| | | public int addOrUpdate(SafeTraining safeTraining) { |
| | | if (ObjectUtils.isNull(safeTraining.getId())) { |
| | | String datePrefix = LocalDate.now().format(DateTimeFormatter.ofPattern("yyMMdd")); |
| | | // æ¥è¯¢ä»æ¥å·²åå¨çæå¤§è¯¾ç¨ç¼å· |
| | | QueryWrapper<SafeTraining> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.likeRight("course_code", datePrefix) |
| | | .orderByDesc("course_code") |
| | | .last("LIMIT 1"); |
| | | SafeTraining lastSafeTraining = safeTrainingMapper.selectOne(queryWrapper); |
| | | int sequenceNumber = 1; // é»è®¤åºå· |
| | | if (lastSafeTraining != null && lastSafeTraining.getCourseCode() != null) { |
| | | String lastNo = lastSafeTraining.getCourseCode().toString(); |
| | | if (lastNo.startsWith(datePrefix)) { |
| | | String seqStr = lastNo.substring(datePrefix.length()); |
| | | try { |
| | | sequenceNumber = Integer.parseInt(seqStr) + 1; |
| | | } catch (NumberFormatException e) { |
| | | sequenceNumber = 1; |
| | | } |
| | | } |
| | | } |
| | | // çæå®æ´ç课ç¨ç¼å· |
| | | String no = "KC-" + String.format("%s%03d", datePrefix, sequenceNumber); |
| | | safeTraining.setCourseCode(no); |
| | | } |
| | | //æ ¹æ®æ¶é´å¤æå¹è®ç¶æ |
| | | String trainingDate = safeTraining.getTrainingDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); |
| | | LocalDateTime openingTime = LocalDateTime.parse((trainingDate + safeTraining.getOpeningTime()), DateTimeFormatter.ofPattern("yyyy-MM-ddHH:mm:ss")); |
| | | LocalDateTime endTime = LocalDateTime.parse((trainingDate + safeTraining.getEndTime()), DateTimeFormatter.ofPattern("yyyy-MM-ddHH:mm:ss")); |
| | | if (LocalDateTime.now().isBefore(openingTime)) { |
| | | //æªå¼å§ |
| | | safeTraining.setState(0); |
| | | } else if (LocalDateTime.now().isAfter(endTime)) { |
| | | //å·²ç»æ |
| | | safeTraining.setState(2); |
| | | } else { |
| | | //è¿è¡ä¸ |
| | | safeTraining.setState(1); |
| | | } |
| | | //æ°å¢ææ´æ° |
| | | saveOrUpdate(safeTraining); |
| | | return 0; |
| | | } |
| | | |
| | | @Override |
| | | public SafeTrainingDto getSafeTraining(Long id) { |
| | | //ä¸»è¡¨æ°æ® |
| | | SafeTrainingDto safeTrainingDto = safeTrainingMapper.getSafeTraining(id); |
| | | //éä»¶ |
| | | List<SafeTrainingFile> safeTrainingFiles = safeTrainingFileMapper.selectList(Wrappers.<SafeTrainingFile>lambdaQuery().eq(SafeTrainingFile::getSafeTrainingId, id)); |
| | | safeTrainingDto.setSafeTrainingFileList(safeTrainingFiles); |
| | | //å¹è®è®°å½è¯¦æ
|
| | | List<SafeTrainingDetailsDto> safeTrainingDetailsDto = safeTrainingDetailsMapper.getSafeTraining(id); |
| | | safeTrainingDto.setSafeTrainingDetailsDtoList(safeTrainingDetailsDto); |
| | | return safeTrainingDto; |
| | | } |
| | | |
| | | @Override |
| | | public int saveSafeTraining(SafeTrainingDto safeTrainingDto) { |
| | | //æ´æ°ä¸»è¡¨ |
| | | safeTrainingMapper.updateById(safeTrainingDto); |
| | | //æ´æ°å¹è®è®°å½è¯¦æ
|
| | | safeTrainingDto.getSafeTrainingDetailsDtoList().forEach(safeTrainingDetailsDto -> { |
| | | safeTrainingDetailsMapper.updateById(safeTrainingDetailsDto); |
| | | }); |
| | | return 0; |
| | | } |
| | | |
| | | @Override |
| | | public int delSafeTraining(List<Integer> ids) { |
| | | //å é¤ä¸»è¡¨ |
| | | safeTrainingMapper.deleteBatchIds(ids); |
| | | //å é¤éä»¶ |
| | | safeTrainingFileMapper.delete(Wrappers.<SafeTrainingFile>lambdaQuery().in(SafeTrainingFile::getSafeTrainingId, ids)); |
| | | //å é¤å¹è®è®°å½ |
| | | safeTrainingDetailsMapper.delete(Wrappers.<SafeTrainingDetails>lambdaQuery().in(SafeTrainingDetails::getSafeTrainingId, ids)); |
| | | return 0; |
| | | } |
| | | |
| | | @Override |
| | | public void export(HttpServletResponse response, Long id) { |
| | | SafeTrainingDto safeTrainingDto = safeTrainingMapper.getSafeTraining(id); |
| | | List<SafeTrainingDetailsDto> safeTrainingDetailsDtoList = safeTrainingDetailsMapper.getSafeTraining(id); |
| | | InputStream inputStream = this.getClass().getResourceAsStream("/static/safe-training.docx"); |
| | | Configure configure = Configure.builder() |
| | | .bind("safeTrainingDetailsDtoList", new HackLoopTableRenderPolicy()) |
| | | .build(); |
| | | XWPFTemplate template = XWPFTemplate.compile(inputStream, configure).render( |
| | | new HashMap<String, Object>() {{ |
| | | put("safeTrainingDto", safeTrainingDto); |
| | | put("safeTrainingDetailsDtoList", safeTrainingDetailsDtoList); |
| | | }}); |
| | | |
| | | try { |
| | | response.setContentType("application/msword"); |
| | | String fileName = URLEncoder.encode( |
| | | safeTrainingDto.getCourseCode() + "å¹è®ä¸èæ ¸è®¡å", "UTF-8"); |
| | | response.setHeader("Access-Control-Expose-Headers", "Content-Disposition"); |
| | | response.setHeader("Content-disposition", |
| | | "attachment;filename=" + fileName + ".docx"); |
| | | OutputStream os = response.getOutputStream(); |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | @GetMapping("/listPage") |
| | | @ApiOperation("åè´§ä¿¡æ¯å表") |
| | | public AjaxResult listPage(Page page, ShippingInfo req) { |
| | | IPage<ShippingInfo> listPage = shippingInfoService.listPage(page,req); |
| | | IPage<ShippingInfoDto> listPage = shippingInfoService.listPage(page,req); |
| | | return AjaxResult.success(listPage); |
| | | } |
| | | |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Log(title = "åè´§ä¿¡æ¯ç®¡ç", businessType = BusinessType.UPDATE) |
| | | public AjaxResult deductStock(@RequestBody ShippingInfoDto req) throws IOException { |
| | | |
| | | |
| | | return shippingInfoService.deductStock( req) ? AjaxResult.success() : AjaxResult.error(); |
| | | } |
| | | |
| | |
| | | |
| | | @ApiModelProperty(value = "仿¬¾æ¹å¼") |
| | | private String paymentMethod; |
| | | |
| | | @ApiModelProperty(value = "äº¤è´§æ¥æ") |
| | | private LocalDate deliveryDate; |
| | | } |
| | |
| | | */ |
| | | private Long supplierId; |
| | | |
| | | private Integer approvalStatus; |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.support.SFunction; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.home.dto.IncomeExpenseAnalysisDto; |
| | | import com.ruoyi.sales.dto.SalesLedgerDto; |
| | | import com.ruoyi.sales.dto.SalesTrendDto; |
| | | import com.ruoyi.sales.dto.StatisticsTableDto; |
| | |
| | | * @date 2025-05-08 |
| | | */ |
| | | public interface SalesLedgerMapper extends BaseMapper<SalesLedger> { |
| | | |
| | | List<IncomeExpenseAnalysisDto> selectIncomeStats(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("dateFormat") String dateFormat); |
| | | |
| | | List<com.ruoyi.dto.MapDto> selectCustomerSalesComposition(); |
| | | /** |
| | | * æ¥è¯¢æå®æ¥æçææåååºåå· |
| | | * @param datePart æ¥æé¨åï¼æ ¼å¼ï¼yyyyMMddï¼ |
| | |
| | | List<Map<String, Object>> selectRawMaterialPurchaseAnalysis(); |
| | | |
| | | int selectProductCountByTypeAndDate(@Param("type") Integer type, @Param("startDate") String startDate, @Param("endDate") String endDate); |
| | | |
| | | BigDecimal selectRawMaterialExpense(); |
| | | } |
| | |
| | | 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.sales.dto.ShippingInfoDto; |
| | | import com.ruoyi.sales.pojo.ShippingInfo; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | * @date : 2025/10/22 9:32 |
| | | */ |
| | | public interface ShippingInfoMapper extends BaseMapper<ShippingInfo> { |
| | | IPage<ShippingInfo> listPage(Page page,@Param("req") ShippingInfo req); |
| | | IPage<ShippingInfoDto> listPage(Page page, @Param("req") ShippingInfo req); |
| | | |
| | | List<ShippingInfo> listAll(); |
| | | } |
| | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty(value = "çäº§ç¶æ") |
| | | private String productionStatus = "æªå¼å§"; |
| | | |
| | | //äº¤è´§æ¥æ |
| | | @ApiModelProperty(value = "äº¤è´§æ¥æ") |
| | | @TableField(value = "delivery_date") |
| | | private LocalDate deliveryDate; |
| | | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty(value = "交货天æ°å·®") |
| | | private Integer deliveryDaysDiff; |
| | | } |
| | | |
| | |
| | | * @date : 2025/10/22 9:33 |
| | | */ |
| | | public interface ShippingInfoService extends IService<ShippingInfo>{ |
| | | IPage<ShippingInfo> listPage(Page page, ShippingInfo req); |
| | | IPage<ShippingInfoDto> listPage(Page page, ShippingInfo req); |
| | | |
| | | boolean deductStock(ShippingInfoDto req) throws IOException; |
| | | |
| | |
| | | @Value("${file.upload-dir}") |
| | | private String uploadDir; |
| | | |
| | | public List<CommonFile> getFileListByBusinessId(Long businessId,Integer type) { |
| | | return commonFileMapper.selectList(new LambdaQueryWrapper<CommonFile>().eq(CommonFile::getCommonId, businessId) |
| | | .eq(CommonFile::getType, type)); |
| | | } |
| | | |
| | | public void deleteByBusinessId(Long businessId,Integer type) { |
| | | commonFileMapper.delete(new LambdaQueryWrapper<CommonFile>().eq(CommonFile::getCommonId, businessId) |
| | | .eq(CommonFile::getType, type)); |
| | |
| | | if(ObjectUtils.isEmpty(invoiceRegistrationProductDto)){ |
| | | throw new RuntimeException("产åå¼ç¥¨å°è´¦æ¥æ¾å¤±è´¥"); |
| | | } |
| | | List<InvoiceRegistrationProduct> invoiceRegistrationProducts = invoiceRegistrationProductMapper.selectList(new LambdaQueryWrapper<InvoiceRegistrationProduct>() |
| | | .eq(InvoiceRegistrationProduct::getSalesLedgerProductId, invoiceRegistrationProductDto.getSalesLedgerProductId())); |
| | | if(CollectionUtils.isNotEmpty(invoiceRegistrationProducts)){ |
| | | invoiceRegistrationProductDto.setNoInvoiceNum(invoiceRegistrationProductDto.getQuantity() |
| | | .subtract(invoiceRegistrationProducts.stream().map(InvoiceRegistrationProduct::getInvoiceNum).reduce(BigDecimal.ZERO, BigDecimal::add))); |
| | | invoiceRegistrationProductDto.setNoInvoiceAmount(invoiceRegistrationProductDto.getTaxInclusiveTotalPrice() |
| | | .subtract(invoiceRegistrationProducts.stream().map(InvoiceRegistrationProduct::getInvoiceAmount).reduce(BigDecimal.ZERO, BigDecimal::add))); |
| | | } |
| | | // æ¥è¯¢éä»¶ |
| | | QueryWrapper<InvoiceLedgerFile> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("invoice_ledger_id", invoiceRegistrationProductDto.getInvoiceLedgerId()); |
| | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | import java.util.function.Function; |
| | |
| | | int result; |
| | | Long salesLedgerId = salesLedgerProduct.getSalesLedgerId(); |
| | | if (salesLedgerProduct.getId() == null) { |
| | | salesLedgerProduct.setRegisterDate(LocalDateTime.now()); |
| | | result = salesLedgerProductMapper.insert(salesLedgerProduct); |
| | | addProductionData(salesLedgerProduct); |
| | | } else { |
| | |
| | | |
| | | @Override |
| | | public List<MonthlyAmountDto> getAmountHalfYear(Integer type) { |
| | | |
| | | LocalDate now = LocalDate.now(); |
| | | LocalDateTime currentDateTime = LocalDateTime.now(); |
| | | |
| | | // æ ¹æ® type ç¡®å®æ¥è¯¢çæ¶é´é´éï¼å¤©æ°ï¼åæ»æ¥è¯¢å¤©æ° |
| | | int daysPerPeriod; |
| | | int totalDays; |
| | | switch (type) { |
| | | case 1: |
| | | daysPerPeriod = 5; // æ¯5天æ¥ä¸æ¬¡ |
| | | totalDays = 30; // 6次 à 5天 = 30天 |
| | | break; |
| | | case 2: |
| | | daysPerPeriod = 15; // æ¯15天æ¥ä¸æ¬¡ |
| | | totalDays = 90; // 6次 à 15天 = 90天 |
| | | break; |
| | | case 3: |
| | | daysPerPeriod = 30; // æ¯30天æ¥ä¸æ¬¡ |
| | | totalDays = 180; // 6次 à 30天 = 180天 |
| | | break; |
| | | default: |
| | | throw new IllegalArgumentException("Invalid type value: " + type); |
| | | } |
| | | |
| | | List<MonthlyAmountDto> result = new ArrayList<>(); |
| | | |
| | | // 循ç¯6æ¬¡ï¼æ¯æ¬¡æ¥è¯¢ä¸ä¸ªæ¶é´æ®µçæ°æ® |
| | | for (int i = 0; i < 6; i++) { |
| | | // 计ç®å½åæ¶é´æ®µçèµ·å§åç»ææ¶é´ |
| | | LocalDateTime endTime = currentDateTime.minusDays(i * daysPerPeriod); |
| | | LocalDateTime startTime = endTime.minusDays(daysPerPeriod); |
| | | for (int i = 5; i >= 0; i--) { |
| | | YearMonth yearMonth = YearMonth.from(now.minusMonths(i)); |
| | | LocalDateTime startTime = yearMonth.atDay(1).atStartOfDay(); |
| | | LocalDateTime endTime = yearMonth.atEndOfMonth().atTime(23, 59, 59); |
| | | |
| | | // æ¥è¯¢å款éé¢ |
| | | // 忬¾éé¢ |
| | | LambdaQueryWrapper<ReceiptPayment> receiptPaymentQuery = new LambdaQueryWrapper<>(); |
| | | receiptPaymentQuery |
| | | .ge(ReceiptPayment::getCreateTime, startTime) |
| | | .lt(ReceiptPayment::getCreateTime, endTime); |
| | | List<ReceiptPayment> receiptPayments = receiptPaymentMapper.selectList(receiptPaymentQuery); |
| | | .le(ReceiptPayment::getCreateTime, endTime); |
| | | |
| | | // æ¥è¯¢å¼ç¥¨éé¢ |
| | | LambdaQueryWrapper<InvoiceLedger> invoiceLedgerQuery = new LambdaQueryWrapper<>(); |
| | | invoiceLedgerQuery |
| | | .ge(InvoiceLedger::getCreateTime, startTime) |
| | | .lt(InvoiceLedger::getCreateTime, endTime); |
| | | List<InvoiceLedger> invoiceLedgers = invoiceLedgerMapper.selectList(invoiceLedgerQuery); |
| | | List<ReceiptPayment> receiptPayments = |
| | | receiptPaymentMapper.selectList(receiptPaymentQuery); |
| | | |
| | | // 计ç®å款æ»é¢ |
| | | BigDecimal receiptAmount = receiptPayments.stream() |
| | | .map(ReceiptPayment::getReceiptPaymentAmount) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | |
| | | // 计ç®å¼ç¥¨æ»é¢ |
| | | // å¼ç¥¨éé¢ |
| | | LambdaQueryWrapper<InvoiceLedger> invoiceLedgerQuery = new LambdaQueryWrapper<>(); |
| | | invoiceLedgerQuery |
| | | .ge(InvoiceLedger::getCreateTime, startTime) |
| | | .le(InvoiceLedger::getCreateTime, endTime); |
| | | |
| | | List<InvoiceLedger> invoiceLedgers = |
| | | invoiceLedgerMapper.selectList(invoiceLedgerQuery); |
| | | |
| | | BigDecimal invoiceAmount = invoiceLedgers.stream() |
| | | .map(InvoiceLedger::getInvoiceTotal) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | |
| | | // æé è¿åç DTO |
| | | MonthlyAmountDto dto = new MonthlyAmountDto(); |
| | | dto.setMonth(startTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + " ~ " + |
| | | endTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); |
| | | dto.setMonth(yearMonth.format(DateTimeFormatter.ofPattern("yyyy-MM"))); |
| | | dto.setReceiptAmount(receiptAmount); |
| | | dto.setInvoiceAmount(invoiceAmount); |
| | | |
| | | result.add(dto); |
| | | } |
| | | |
| | | // å转å表ï¼ä½¿æ¶é´é¡ºåºä»æ©å°æ |
| | | Collections.reverse(result); |
| | | return result; |
| | | } |
| | | |
| | |
| | | private ApproveProcessServiceImpl approveProcessService; |
| | | |
| | | @Override |
| | | public IPage<ShippingInfo> listPage(Page page, ShippingInfo req) { |
| | | IPage<ShippingInfo> listPage = shippingInfoMapper.listPage(page, req); |
| | | |
| | | public IPage<ShippingInfoDto> listPage(Page page, ShippingInfo req) { |
| | | IPage<ShippingInfoDto> listPage = shippingInfoMapper.listPage(page, req); |
| | | listPage.getRecords().forEach(item ->{ |
| | | item.setCommonFileList(commonFileService.getFileListByBusinessId(item.getId(), FileNameType.SHIP.getValue())); |
| | | }); |
| | | return listPage; |
| | | } |
| | | |
| | |
| | | if (byId == null) { |
| | | throw new RuntimeException("åè´§ä¿¡æ¯ä¸åå¨"); |
| | | } |
| | | //æ£ååºå |
| | | if(!"å·²åè´§".equals(byId.getStatus())){ |
| | | SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(byId.getSalesLedgerProductId()); |
| | | stockUtils.substractStock(salesLedgerProduct.getProductModelId(), salesLedgerProduct.getQuantity(), StockQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode(), req.getId()); |
| | | } |
| | | byId.setExpressNumber(req.getExpressNumber()); |
| | | byId.setExpressCompany(req.getExpressCompany()); |
| | | byId.setStatus("å·²åè´§"); |
| | | byId.setShippingCarNumber(req.getShippingCarNumber()); |
| | | boolean update = this.updateById(req); |
| | | //æ£ååºå |
| | | SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(req.getSalesLedgerProductId()); |
| | | stockUtils.substractStock(salesLedgerProduct.getProductModelId(), salesLedgerProduct.getQuantity(), StockQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode(), req.getId()); |
| | | boolean update = this.updateById(byId); |
| | | // è¿ç§»æä»¶ |
| | | if(CollectionUtils.isNotEmpty(req.getTempFileIds())){ |
| | | tempFileService.migrateTempFilesToFormal(req.getId(), req.getTempFileIds(), FileNameType.SHIP.getValue()); |
| | |
| | | // æ´æ°å¯¹åºç¨æ·ç¶æä¸ºåç¨ |
| | | // æ ¹æ®åå·¥ç¼å·æ¥è¯¢ç¨æ· |
| | | SysUser sysUser = sysUserMapper.selectUserByUserName(staffOnJob.getStaffNo()); |
| | | sysUser.setStatus("1"); |
| | | sysUserMapper.updateUser(sysUser); |
| | | if (sysUser != null) { |
| | | sysUser.setStatus("1"); |
| | | sysUserMapper.updateUser(sysUser); |
| | | } |
| | | |
| | | // æ´æ°ç¦»èç¶æä¸ºç¦»è |
| | | staffOnJob.setStaffState(0); |
| | |
| | | throw new BaseException("ç¼å·ä¸º"+staffOnJobParams.getStaffNo()+"çåå·¥ä¸åå¨,æ æ³æ´æ°!!!"); |
| | | } |
| | | |
| | | String[] ignoreProperties = {"id"};//æé¤id屿§ |
| | | String[] ignoreProperties = {"id"};//æé¤æ´æ°å±æ§ |
| | | |
| | | // è·åææ°ååæ°æ®ï¼å¹¶ä¸æ´æ° |
| | | StaffContract contract = staffContractMapper.selectOne(Wrappers.<StaffContract>lambdaQuery() |
| | |
| | | } |
| | | |
| | | // æ´æ°åå·¥æ°æ® |
| | | BeanUtils.copyProperties(staffOnJobParams,job,ignoreProperties); |
| | | job.setContractExpireTime(staffOnJobParams.getContractEndTime()); |
| | | return staffOnJobMapper.updateById(job); |
| | | staffOnJobParams.setContractExpireTime(staffOnJobParams.getContractEndTime()); |
| | | return staffOnJobMapper.updateById(staffOnJobParams); |
| | | } |
| | | |
| | | //å é¤å
¥è |
| | |
| | | StaffOnJobDto staffOnJobDto = new StaffOnJobDto(); |
| | | BeanUtils.copyProperties(staffOnJob, staffOnJobDto); |
| | | // æ¥è¯¢å²ä½åç§° |
| | | SysPost post = sysPostMapper.selectPostById((long) staffOnJob.getSysPostId()); |
| | | staffOnJobDto.setPostName(post.getPostName()); |
| | | if (staffOnJob.getSysPostId() != null) { |
| | | SysPost post = sysPostMapper.selectPostById(staffOnJob.getSysPostId().longValue()); |
| | | if (post != null) { |
| | | staffOnJobDto.setPostName(post.getPostName()); |
| | | } |
| | | } |
| | | |
| | | // æ¥è¯¢ååä¿¡æ¯ |
| | | StaffContract contract = staffContractMapper.selectOne(Wrappers.<StaffContract>lambdaQuery() |
| | |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="selectAccountExpenseStats" resultType="com.ruoyi.home.dto.IncomeExpenseAnalysisDto"> |
| | | SELECT DATE_FORMAT(expense_date, #{dateFormat}) as dateStr, IFNULL(SUM(expense_money), 0) as amount |
| | | FROM account_expense |
| | | WHERE expense_date BETWEEN #{startDate} AND #{endDate} |
| | | GROUP BY dateStr |
| | | </select> |
| | | |
| | | <select id="selectExpenseComposition" resultType="com.ruoyi.dto.MapDto"> |
| | | SELECT sdd.dict_label as name, CAST(IFNULL(SUM(ae.expense_money), 0) AS CHAR) as value |
| | | FROM account_expense ae |
| | | LEFT JOIN sys_dict_data sdd ON ae.expense_type = sdd.dict_value AND sdd.dict_type = 'expense_types' |
| | | <where> |
| | | <if test="startDate != null and startDate != ''"> |
| | | AND ae.expense_date >= #{startDate} |
| | | </if> |
| | | <if test="endDate != null and endDate != ''"> |
| | | AND ae.expense_date <= #{endDate} |
| | | </if> |
| | | </where> |
| | | GROUP BY ae.expense_type, sdd.dict_label |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | AND income_date <= DATE_FORMAT(#{dateQueryDto.entryDateEnd},'%Y-%m-%d') |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="selectIncomeStats" |
| | | resultType="com.ruoyi.home.dto.IncomeExpenseAnalysisDto"> |
| | | SELECT DATE_FORMAT(income_date, #{dateFormat}) AS dateStr, |
| | | IFNULL(SUM(income_money), 0) AS amount |
| | | FROM account_income |
| | | WHERE income_date BETWEEN #{startDate} AND #{endDate} |
| | | AND business_type = 1 |
| | | GROUP BY dateStr |
| | | ORDER BY dateStr |
| | | |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | slp.specification_model, |
| | | ppr.process_route_code, |
| | | pb.bom_no, |
| | | ROUND(po.complete_quantity / po.quantity * 100, 2) AS completionStatus |
| | | ROUND(po.complete_quantity / po.quantity * 100, 2) AS completionStatus, |
| | | DATEDIFF(sl.delivery_date, CURDATE()) AS delivery_days_diff |
| | | from product_order po |
| | | left join sales_ledger sl on po.sales_ledger_id = sl.id |
| | | left join sales_ledger_product slp on po.product_model_id = slp.id |
| | |
| | | |
| | | <select id="listPageProductionProductMainDto" resultType="com.ruoyi.production.dto.ProductionProductMainDto"> |
| | | select ppm.*, |
| | | pwo.work_order_no as workOrderNo, |
| | | pwo.status as workOrderStatus, |
| | | u.nick_name as nickName, |
| | | p.product_name as productName, |
| | | pm.model as productModelName, |
| | | ppo.quantity, |
| | | ppo.scrap_qty, |
| | | pm.unit, |
| | | sl.sales_contract_no salesContractNo |
| | | pwo.work_order_no as workOrderNo, |
| | | pwo.status as workOrderStatus, |
| | | u.nick_name as nickName, |
| | | p.product_name as productName, |
| | | pm.model as productModelName, |
| | | ppo.quantity, |
| | | ppo.scrap_qty, |
| | | pm.unit, |
| | | sl.sales_contract_no salesContractNo |
| | | from |
| | | production_product_main ppm |
| | | left join product_work_order pwo on pwo.id = ppm.work_order_id |
| | | left join product_order po on po.id = pwo.product_order_id |
| | | left join production_product_output ppo on ppm.id = ppo.product_main_id |
| | | left join product_model pm on pm.id = ppo.product_model_id |
| | | left join product p on p.id = pm.product_id |
| | | left join sales_ledger sl on sl.id = po.sales_ledger_id |
| | | left join sys_user u on u.user_id = ppm.user_id |
| | | production_product_main ppm |
| | | left join product_work_order pwo on pwo.id = ppm.work_order_id |
| | | left join product_order po on po.id = pwo.product_order_id |
| | | left join production_product_output ppo on ppm.id = ppo.product_main_id |
| | | left join product_model pm on pm.id = ppo.product_model_id |
| | | left join product p on p.id = pm.product_id |
| | | left join sales_ledger sl on sl.id = po.sales_ledger_id |
| | | left join sys_user u on u.user_id = ppm.user_id |
| | | <where> |
| | | <if test="c.nickName != null and c.nickName != ''"> |
| | | and u.nick_name like concat('%',#{c.nickName},'%') |
| | |
| | | <select id="getOrderByMainId" resultType="com.ruoyi.production.pojo.ProductOrder"> |
| | | select po.* |
| | | from product_order po |
| | | left join product_work_order pwo on po.id = pwo.product_order_id |
| | | left join production_product_main pm on work_order_id=pwo.id |
| | | where pm.id=#{productMainId} |
| | | left join product_work_order pwo on po.id = pwo.product_order_id |
| | | left join production_product_main pm on work_order_id = pwo.id |
| | | where pm.id = #{productMainId} |
| | | </select> |
| | | <select id="listProductionDetails" resultType="com.ruoyi.production.dto.ProductionProductMainDto"> |
| | | SELECT |
| | | slpa.scheduling_date, |
| | | slpa.scheduling_user_name, |
| | | sl.sales_contract_no, |
| | | sl.customer_name, |
| | | p.product_name, |
| | | pm.model, |
| | | pm.unit, |
| | | slpa.process, |
| | | ppo.quantity, |
| | | slpa.work_hours, |
| | | slpa.work_hours * slpa.finished_num AS wages |
| | | FROM |
| | | production_product_main ppm |
| | | LEFT JOIN sales_ledger_production_accounting slpa ON slpa.sales_ledger_work_id = ppm.id |
| | | LEFT JOIN production_product_output ppo ON ppm.id = ppo.product_main_id |
| | | LEFT JOIN product_work_order pwo ON pwo.id = ppm.work_order_id |
| | | LEFT JOIN product_order po ON po.id = pwo.product_order_id |
| | | LEFT JOIN process_route pr ON pr.id = po.route_id |
| | | LEFT JOIN product_model pm ON po.product_model_id = pm.id |
| | | LEFT JOIN product p ON p.id = pm.product_id |
| | | LEFT JOIN sales_ledger sl ON po.sales_ledger_id = sl.id |
| | | </select> |
| | | |
| | | <delete id="deleteByWorkOrderIds" parameterType="java.util.List"> |
| | |
| | | group by t4.id |
| | | order by t4.scheduling_date desc |
| | | </select> |
| | | <select id="pageProductionAccounting" |
| | | resultType="com.ruoyi.production.dto.SalesLedgerProductionAccountingDto"> |
| | | SELECT |
| | | slpa.scheduling_user_id, |
| | | slpa.scheduling_user_name, |
| | | sum(ppout.quantity) as output_num, |
| | | sum(slpa.finished_num * work_hours) as wages, |
| | | SUM(slpa.finished_num) / SUM(ppout.quantity) as output_rate |
| | | FROM sales_ledger_production_accounting slpa |
| | | LEFT JOIN production_product_main ppm ON slpa.sales_ledger_work_id = ppm.id |
| | | LEFT JOIN production_product_output ppout ON ppm.id = ppout.product_main_id |
| | | <where> |
| | | <if test="ew.schedulingUserName != null and ew.schedulingUserName !=''" > |
| | | and slpa.scheduling_user_name = #{ew.schedulingUserName} |
| | | </if> |
| | | </where> |
| | | GROUP BY slpa.scheduling_user_name |
| | | |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | WHERE |
| | | T1.sales_ledger_product_id = #{id} |
| | | </select> |
| | | |
| | | |
| | | <select id="selectPurchaseStats" resultType="com.ruoyi.home.dto.IncomeExpenseAnalysisDto"> |
| | | SELECT DATE_FORMAT(entry_date, #{dateFormat}) as dateStr, IFNULL(SUM(contract_amount), 0) as amount |
| | | FROM purchase_ledger |
| | | WHERE entry_date BETWEEN #{startDate} AND #{endDate} |
| | | GROUP BY dateStr |
| | | </select> |
| | | |
| | | <select id="selectTotalPurchaseAmount" resultType="java.math.BigDecimal"> |
| | | SELECT IFNULL(SUM(contract_amount), 0) |
| | | FROM purchase_ledger |
| | | <where> |
| | | <if test="startDate != null and startDate != ''"> |
| | | AND entry_date >= #{startDate} |
| | | </if> |
| | | <if test="endDate != null and endDate != ''"> |
| | | AND entry_date <= #{endDate} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | </mapper> |
| | |
| | | </resultMap> |
| | | <select id="pageSafeAccident" resultType="com.ruoyi.safe.pojo.SafeAccident"> |
| | | select sa.*, |
| | | su.nick_name createUserName, |
| | | su.nick_name createUserName |
| | | from safe_accident sa |
| | | left join sys_user su on sa.create_user = su.user_id |
| | | where 1=1 |
| | |
| | | and sa.accident_code like concat('%', #{c.accidentCode}, '%') |
| | | </if> |
| | | <if test="c.accidentName != null and c.accidentName != ''"> |
| | | and sa.accident_name like concat('%', #{accidentName}, '%') |
| | | and sa.accident_name like concat('%', #{c.accidentName}, '%') |
| | | </if> |
| | | <if test="c.accidentType != null and c.accidentType != ''"> |
| | | and sa.accident_type like concat('%', #{accidentType}, '%') |
| | | and sa.accident_type like concat('%', #{c.accidentType}, '%') |
| | | </if> |
| | | <if test="c.accidentGrade != null and c.accidentGrade != ''"> |
| | | and sa.accident_grade like concat('%', #{accidentGrade}, '%') |
| | | and sa.accident_grade like concat('%', #{c.accidentGrade}, '%') |
| | | </if> |
| | | </select> |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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.safe.mapper.SafeTrainingDetailsMapper"> |
| | | |
| | | <!-- éç¨æ¥è¯¢æ å°ç»æ --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.safe.pojo.SafeTrainingDetails"> |
| | | <id column="id" property="id"/> |
| | | <result column="user_id" property="userId"/> |
| | | <result column="safe_training_id" property="safeTrainingId"/> |
| | | <result column="examination_results" property="examinationResults"/> |
| | | <result column="create_time" property="createTime"/> |
| | | <result column="create_user" property="createUser"/> |
| | | <result column="update_time" property="updateTime"/> |
| | | <result column="update_user" property="updateUser"/> |
| | | <result column="tenant_id" property="tenantId"/> |
| | | </resultMap> |
| | | <select id="getSafeTraining" resultType="com.ruoyi.safe.dto.SafeTrainingDetailsDto"> |
| | | select std.*, |
| | | su.user_name, |
| | | su.nick_name, |
| | | su.phonenumber |
| | | from safe_training_details std |
| | | left join sys_user su on std.user_id = su.user_id |
| | | where std.safe_training_id = #{id} |
| | | </select> |
| | | <select id="pageDetails" resultType="com.ruoyi.safe.pojo.SafeTrainingDetails"> |
| | | select std.*, |
| | | st.* |
| | | from safe_training_details std |
| | | left join safe_training st on std.safe_training_id = st.id |
| | | where std.user_id = #{c.userId} |
| | | <if test="c.trainingDate != null"> |
| | | and st.training_date = #{c.trainingDate} |
| | | </if> |
| | | </select> |
| | | |
| | | </mapper> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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.safe.mapper.SafeTrainingFileMapper"> |
| | | |
| | | <!-- éç¨æ¥è¯¢æ å°ç»æ --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.safe.pojo.SafeTrainingFile"> |
| | | <id column="id" property="id" /> |
| | | <result column="safe_training_id" property="safeTrainingId" /> |
| | | <result column="name" property="name" /> |
| | | <result column="url" property="url" /> |
| | | <result column="file_size" property="fileSize" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="create_user" property="createUser" /> |
| | | <result column="update_time" property="updateTime" /> |
| | | <result column="update_user" property="updateUser" /> |
| | | <result column="tenant_id" property="tenantId" /> |
| | | </resultMap> |
| | | |
| | | </mapper> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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.safe.mapper.SafeTrainingMapper"> |
| | | |
| | | <!-- éç¨æ¥è¯¢æ å°ç»æ --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.safe.pojo.SafeTraining"> |
| | | <id column="id" property="id" /> |
| | | <result column="course_code" property="courseCode" /> |
| | | <result column="training_objectives" property="trainingObjectives" /> |
| | | <result column="training_content" property="trainingContent" /> |
| | | <result column="training_mode" property="trainingMode" /> |
| | | <result column="state" property="state" /> |
| | | <result column="participants" property="participants" /> |
| | | <result column="place_training" property="placeTraining" /> |
| | | <result column="training_lecturer" property="trainingLecturer" /> |
| | | <result column="training_date" property="trainingDate" /> |
| | | <result column="opening_time" property="openingTime" /> |
| | | <result column="end_time" property="endTime" /> |
| | | <result column="project_credits" property="projectCredits" /> |
| | | <result column="class_hour" property="classHour" /> |
| | | <result column="assessment_method" property="assessmentMethod" /> |
| | | <result column="comprehensive_assessment" property="comprehensiveAssessment" /> |
| | | <result column="remarks" property="remarks" /> |
| | | <result column="assessment_user_id" property="assessmentUserId" /> |
| | | <result column="assessment_date" property="assessmentDate" /> |
| | | <result column="training_abstract" property="trainingAbstract" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="create_user" property="createUser" /> |
| | | <result column="update_time" property="updateTime" /> |
| | | <result column="update_user" property="updateUser" /> |
| | | <result column="tenant_id" property="tenantId" /> |
| | | </resultMap> |
| | | <select id="pageSafeTraining" resultType="com.ruoyi.safe.dto.SafeTrainingDto"> |
| | | select st.*, |
| | | su.nick_name assessmentUserName, |
| | | count(std.id) nums |
| | | from safe_training st |
| | | left join safe_training_details std on std.safe_training_id = st.id |
| | | left join sys_user su on st.assessment_user_id = su.user_id |
| | | where 1=1 |
| | | <if test="c.placeTraining != null and c.placeTraining != ''"> |
| | | and st.place_training like concat('%', #{c.placeTraining}, '%') |
| | | </if> |
| | | <if test="c.trainingDate != null and c.trainingDate != ''"> |
| | | and st.training_date = #{c.trainingDate} |
| | | </if> |
| | | <if test="c.state != null and c.state != ''"> |
| | | and st.state like concat('%', #{c.state}, '%') |
| | | </if> |
| | | </select> |
| | | <select id="getSafeTraining" resultType="com.ruoyi.safe.dto.SafeTrainingDto"> |
| | | select st.*, |
| | | su.nick_name assessmentUserName |
| | | from safe_training st |
| | | left join sys_user su on st.assessment_user_id = su.user_id |
| | | where st.id=#{id} |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | |
| | | <select id="selectSalesLedgerList" resultType="com.ruoyi.sales.pojo.SalesLedger"> |
| | | SELECT |
| | | T1.id, |
| | | T1.sales_contract_no, |
| | | T1.customer_contract_no, |
| | | T1.project_name, |
| | | T1.entry_date, |
| | | T1.salesman, |
| | | T1.customer_id, |
| | | T1.customer_name, |
| | | T1.entry_person, |
| | | T1.remarks, |
| | | T1.attachment_materials, |
| | | T1.tenant_id, |
| | | T1.contract_amount, |
| | | T1.execution_date, |
| | | T2.nick_name AS entry_person_name, |
| | | T1.payment_method |
| | | T1.id, |
| | | T1.sales_contract_no, |
| | | T1.customer_contract_no, |
| | | T1.project_name, |
| | | T1.entry_date, |
| | | T1.salesman, |
| | | T1.customer_id, |
| | | T1.customer_name, |
| | | T1.entry_person, |
| | | T1.remarks, |
| | | T1.attachment_materials, |
| | | T1.tenant_id, |
| | | T1.contract_amount, |
| | | T1.execution_date, |
| | | T2.nick_name AS entry_person_name, |
| | | T1.payment_method, |
| | | DATEDIFF(T1.delivery_date, CURDATE()) AS delivery_days_diff |
| | | FROM |
| | | sales_ledger T1 |
| | | sales_ledger T1 |
| | | LEFT JOIN sys_user T2 ON T1.entry_person = T2.user_id |
| | | <where> |
| | | <if test="salesLedgerDto.customerName != null and salesLedgerDto.customerName != '' "> |
| | |
| | | T1.contract_amount as noInvoiceAmountTotal, |
| | | T1.execution_date, |
| | | T2.nick_name AS entry_person_name, |
| | | T1.payment_method |
| | | T1.payment_method, |
| | | T1.delivery_date, |
| | | DATEDIFF(T1.delivery_date, CURDATE()) AS delivery_days_diff |
| | | FROM |
| | | sales_ledger T1 |
| | | LEFT JOIN sys_user T2 ON T1.entry_person = T2.user_id |
| | |
| | | </where> |
| | | order by T1.entry_date desc |
| | | </select> |
| | | |
| | | <select id="selectIncomeStats" resultType="com.ruoyi.home.dto.IncomeExpenseAnalysisDto"> |
| | | SELECT DATE_FORMAT(entry_date, #{dateFormat}) as dateStr, IFNULL(SUM(contract_amount), 0) as amount |
| | | FROM sales_ledger |
| | | WHERE entry_date BETWEEN #{startDate} AND #{endDate} |
| | | GROUP BY dateStr |
| | | </select> |
| | | |
| | | <select id="selectCustomerSalesComposition" resultType="com.ruoyi.dto.MapDto"> |
| | | SELECT customer_name as name, CAST(IFNULL(SUM(contract_amount), 0) AS CHAR) as value |
| | | FROM sales_ledger |
| | | GROUP BY customer_name |
| | | </select> |
| | | </mapper> |
| | |
| | | <if test="req.purchaseContractNumber != null and req.purchaseContractNumber != '' "> |
| | | AND sl.purchase_contract_number like concat('%',#{req.purchaseContractNumber},'%') |
| | | </if> |
| | | <if test="req.approvalStatus != null and req.approvalStatus != ''"> |
| | | and sl.approval_status = #{req.approvalStatus} |
| | | </if> |
| | | <if test="req.customerContractNo != null and req.customerContractNo != '' "> |
| | | AND sl.customer_contract_no like concat('%',#{req.customerContractNo},'%') |
| | | </if> |
| | |
| | | left join product p on pm.product_id = p.id |
| | | </select> |
| | | |
| | | <select id="selectProductSalesAnalysis" resultType="java.util.LinkedHashMap"> |
| | | <select id="selectProductSalesAnalysis" resultType="java.util.Map"> |
| | | SELECT |
| | | product_category as name, |
| | | SUM( tax_inclusive_total_price ) AS value |
| | |
| | | LIMIT 5 |
| | | </select> |
| | | |
| | | <select id="selectRawMaterialPurchaseAnalysis" resultType="java.util.LinkedHashMap"> |
| | | <select id="selectRawMaterialPurchaseAnalysis" resultType="java.util.Map"> |
| | | SELECT |
| | | pr.product_name AS name, |
| | | SUM( slp.tax_inclusive_total_price ) AS value |
| | |
| | | AND register_date <= #{endDate} |
| | | </select> |
| | | |
| | | <select id="selectRawMaterialExpense" resultType="java.math.BigDecimal"> |
| | | WITH RECURSIVE product_tree AS (SELECT id |
| | | FROM product |
| | | WHERE product_name = 'åææ' |
| | | |
| | | UNION ALL |
| | | |
| | | SELECT p.id |
| | | FROM product p |
| | | INNER JOIN product_tree pt ON p.parent_id = pt.id) |
| | | SELECT IFNULL(SUM(slp.tax_inclusive_total_price), 0) |
| | | FROM sales_ledger_product slp |
| | | WHERE slp.type = 2 |
| | | AND slp.product_id IN (SELECT id |
| | | FROM product_tree); |
| | | |
| | | </select> |
| | | </mapper> |
| | |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.sales.mapper.ShippingInfoMapper"> |
| | | |
| | | <select id="listPage" resultType="com.ruoyi.sales.pojo.ShippingInfo"> |
| | | <select id="listPage" resultType="com.ruoyi.sales.dto.ShippingInfoDto"> |
| | | SELECT |
| | | s.id, |
| | | s.sales_ledger_id, |
| | |
| | | select ifnull(sum(qualitity), 0) |
| | | from stock_inventory |
| | | </select> |
| | | |
| | | <select id="selectTotalByDate" resultType="java.math.BigDecimal"> |
| | | select sum(qualitity) |
| | | select IFNULL(sum(qualitity), 0) |
| | | from stock_inventory |
| | | where |
| | | create_time >= #{now} and create_time < DATE_ADD(#{now}, INTERVAL 1 DAY) |
| | | where create_time >= #{now} |
| | | and create_time < DATE_ADD(#{now}, INTERVAL 1 DAY) |
| | | </select> |
| | | |
| | | <select id="selectStorageProductCountByDate" resultType="int"> |