| | |
| | | <version>${poi.version}</version>
|
| | | </dependency>
|
| | |
|
| | |
|
| | | <!-- velocity代ç çæä½¿ç¨æ¨¡æ¿ -->
|
| | | <dependency>
|
| | | <groupId>org.apache.velocity</groupId>
|
| | |
| | | <version>${okhttp.version}</version>
|
| | | </dependency>
|
| | |
|
| | | <dependency>
|
| | | <groupId>com.deepoove</groupId>
|
| | | <artifactId>poi-tl</artifactId>
|
| | | <version>1.12.2</version>
|
| | | </dependency>
|
| | |
|
| | | </dependencies>
|
| | |
|
| | | <build>
|
| | |
| | | </pluginRepository>
|
| | | </pluginRepositories>
|
| | |
|
| | | </project> |
| | | </project>
|
| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.mapper.AccountIncomeMapper; |
| | | import com.ruoyi.account.pojo.AccountExpense; |
| | | import com.ruoyi.account.pojo.AccountIncome; |
| | | import com.ruoyi.account.service.AccountExpenseService; |
| | |
| | | |
| | | @Resource |
| | | private AccountExpenseService accountExpenseService; |
| | | |
| | | @Resource |
| | | private AccountIncomeService accountIncomeService; |
| | | |
| | | |
| | | /** |
| | |
| | | return AjaxResult.success(accountExpenseService.report(dateQueryDto)); |
| | | } |
| | | |
| | | /** |
| | | * è´¢å¡æ¥è¡¨å¾è¡¨æ¶å
¥å¹´åº¦æ¥è¯¢ |
| | | * @param |
| | | * @return |
| | | */ |
| | | @GetMapping("/report/income") |
| | | public AjaxResult reportIncome() { |
| | | return AjaxResult.success(accountIncomeService.reportIncome()); |
| | | } |
| | | |
| | | /** |
| | | * è´¢å¡æ¥è¡¨å¾è¡¨æ¯åºå¹´åº¦æ¥è¯¢ |
| | | * @param |
| | | * @return |
| | | */ |
| | | @GetMapping("/report/expense") |
| | | public AjaxResult reportExpense() { |
| | | return AjaxResult.success(accountExpenseService.reportExpense()); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | private String typeName; |
| | | |
| | | |
| | | /** |
| | | * ç¾åå æ¯ |
| | | */ |
| | | private BigDecimal proportion; |
| | | |
| | | |
| | | |
| | | /** |
| | | * éé¢ |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.account.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * è´¢å¡ç®¡ç--è´¢å¡æ¥è¡¨(ç±»å) |
| | | */ |
| | | |
| | | @Data |
| | | public class AccountDto3 implements Serializable { |
| | | |
| | | |
| | | /** |
| | | * ç±»å |
| | | */ |
| | | private String typeName; |
| | | |
| | | |
| | | /** |
| | | * ç¾åå æ¯ |
| | | */ |
| | | private BigDecimal proportion; |
| | | |
| | | |
| | | |
| | | /** |
| | | * éé¢ |
| | | */ |
| | | private List<BigDecimal> account; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | |
| | | List<AccountDto2> report(@Param("dateQueryDto") DateQueryDto dateQueryDto); |
| | | BigDecimal report1(@Param("dateQueryDto") DateQueryDto dateQueryDto, @Param("dictValue") String dictValue); |
| | | } |
| | |
| | | List<AccountIncome> accountIncomeExport(@Param("accountIncome") AccountIncome accountIncome); |
| | | |
| | | List<AccountDto2> report(@Param("dateQueryDto") DateQueryDto dateQueryDto); |
| | | BigDecimal report1(@Param("dateQueryDto") DateQueryDto dateQueryDto, @Param("dictValue") String dictValue); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.account.dto.AccountDto; |
| | | import com.ruoyi.account.dto.AccountDto2; |
| | | import com.ruoyi.account.dto.AccountDto3; |
| | | import com.ruoyi.account.pojo.AccountExpense; |
| | | import com.ruoyi.account.pojo.AccountIncome; |
| | | import com.ruoyi.dto.DateQueryDto; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | public interface AccountExpenseService extends IService<AccountExpense> { |
| | | |
| | |
| | | void accountExpenseExport(HttpServletResponse response, AccountExpense accountExpense); |
| | | |
| | | AccountDto report(DateQueryDto dateQueryDto); |
| | | |
| | | List<AccountDto3> reportExpense(); |
| | | } |
| | |
| | | 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.account.pojo.AccountFile; |
| | | import com.ruoyi.account.dto.AccountDto2; |
| | | import com.ruoyi.account.dto.AccountDto3; |
| | | import com.ruoyi.account.pojo.AccountIncome; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | public interface AccountIncomeService extends IService<AccountIncome> { |
| | | |
| | |
| | | IPage<AccountIncome> accountIncomeListPage(Page page, AccountIncome accountIncome); |
| | | |
| | | void accountIncomeExport(HttpServletResponse response, AccountIncome accountIncome); |
| | | |
| | | List<AccountDto3> reportIncome(); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.dto.AccountDto; |
| | | import com.ruoyi.account.dto.AccountDto2; |
| | | import com.ruoyi.account.dto.AccountDto3; |
| | | import com.ruoyi.account.mapper.AccountExpenseMapper; |
| | | import com.ruoyi.account.mapper.AccountFileMapper; |
| | | import com.ruoyi.account.mapper.AccountIncomeMapper; |
| | | import com.ruoyi.account.pojo.AccountExpense; |
| | | import com.ruoyi.account.pojo.AccountIncome; |
| | | import com.ruoyi.account.service.AccountExpenseService; |
| | | import com.ruoyi.account.service.AccountIncomeService; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.dto.DateQueryDto; |
| | | import com.ruoyi.project.system.domain.SysDictData; |
| | | import com.ruoyi.project.system.mapper.SysDictDataMapper; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | private AccountExpenseMapper accountExpenseMapper; |
| | | |
| | | private AccountIncomeMapper accountIncomeMapper; |
| | | |
| | | private SysDictDataMapper sysDictDataMapper; |
| | | |
| | | |
| | | //å页æ¥è¯¢ |
| | |
| | | AccountDto accountDto = new AccountDto(); |
| | | //è·å该段æ¶é´å
çæææ¶å
¥ |
| | | List<AccountDto2> accountIncomes =accountIncomeMapper.report(dateQueryDto); |
| | | accountDto.setIncomeType(accountIncomes); |
| | | |
| | | Long incomeNumber = accountIncomeMapper.selectCount(Wrappers.<AccountIncome>lambdaQuery() |
| | | .between(AccountIncome::getIncomeDate, dateQueryDto.getEntryDateStart(), dateQueryDto.getEntryDateEnd())); |
| | | accountDto.setIncomeNumber(incomeNumber); |
| | | BigDecimal totalIncome = accountIncomes.stream().map(AccountDto2::getAccount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | accountDto.setTotalIncome(totalIncome); |
| | | accountIncomes.stream().forEach(accountDto2 -> { |
| | | accountDto2.setProportion(accountDto2.getAccount().divide(totalIncome,2,BigDecimal.ROUND_HALF_UP)); |
| | | }); |
| | | accountDto.setIncomeType(accountIncomes); |
| | | //è·å该段æ¶é´å
çæææ¯åº |
| | | List<AccountDto2> accountExpenses =accountExpenseMapper.report(dateQueryDto); |
| | | accountDto.setExpenseType(accountExpenses); |
| | |
| | | accountDto.setExpenseNumber(expenseNumber); |
| | | BigDecimal totalExpense = accountExpenses.stream().map(AccountDto2::getAccount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | accountDto.setTotalExpense(totalExpense); |
| | | accountExpenses.stream().forEach(accountDto2 -> { |
| | | accountDto2.setProportion(accountDto2.getAccount().divide(totalExpense,2,BigDecimal.ROUND_HALF_UP)); |
| | | }); |
| | | accountDto.setExpenseType(accountExpenses); |
| | | //åæ¶å
¥ |
| | | BigDecimal netRevenue = totalIncome.subtract(totalExpense); |
| | | accountDto.setNetRevenue(netRevenue); |
| | | return accountDto; |
| | | } |
| | | |
| | | //è´¢å¡æ¥è¡¨å¹´æ¥è¯¢ |
| | | @Override |
| | | public List<AccountDto3> reportExpense() { |
| | | List<AccountDto3> accountDto3s = new ArrayList<>(); |
| | | //å
æ¥è¯¢æ¶å
¥ç±»åæåªäº |
| | | List<SysDictData> incomeTypes = sysDictDataMapper.selectDictDataByType("expense_types"); |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | int currentYear = LocalDate.now().getYear(); // è·åå½å年份ï¼å¦2025ï¼ |
| | | for (SysDictData incomeType : incomeTypes) { |
| | | AccountDto3 accountDto3 = new AccountDto3(); |
| | | accountDto3.setTypeName(incomeType.getDictLabel());//ç±»å |
| | | List<BigDecimal> account=new ArrayList<>(); |
| | | for (int i = 1; i <= 12; i++) { |
| | | // å½æç¬¬ä¸å¤©ï¼å¹´ä»½ä¸ºå½åå¹´ï¼æä»½ä¸ºiï¼æ¥æä¸º1 |
| | | LocalDate firstDay = LocalDate.of(currentYear, i, 1); |
| | | DateQueryDto dateQueryDto = new DateQueryDto(); |
| | | dateQueryDto.setEntryDateStart(firstDay.format(formatter)); |
| | | // 彿æåä¸å¤©ï¼ç¬¬ä¸å¤©çæä»½çæåä¸å¤© |
| | | dateQueryDto.setEntryDateEnd(firstDay.plusMonths(1).minusDays(1).format(formatter)); |
| | | account.add(accountExpenseMapper.report1(dateQueryDto,incomeType.getDictValue())); |
| | | } |
| | | accountDto3.setAccount(account);//ç±»å |
| | | accountDto3s.add(accountDto3); |
| | | } |
| | | return accountDto3s; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | 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.account.mapper.AccountFileMapper; |
| | | import com.ruoyi.account.dto.AccountDto2; |
| | | import com.ruoyi.account.dto.AccountDto3; |
| | | import com.ruoyi.account.mapper.AccountIncomeMapper; |
| | | import com.ruoyi.account.pojo.AccountFile; |
| | | import com.ruoyi.account.pojo.AccountIncome; |
| | | import com.ruoyi.account.service.AccountFileService; |
| | | import com.ruoyi.account.service.AccountIncomeService; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.quality.pojo.QualityInspect; |
| | | import com.ruoyi.dto.DateQueryDto; |
| | | import com.ruoyi.project.system.domain.SysDictData; |
| | | import com.ruoyi.project.system.mapper.SysDictDataMapper; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @AllArgsConstructor |
| | | @Service |
| | | public class AccountIncomeServiceImpl extends ServiceImpl<AccountIncomeMapper, AccountIncome> implements AccountIncomeService { |
| | | |
| | | private AccountIncomeMapper accountIncomeMapper; |
| | | |
| | | private SysDictDataMapper sysDictDataMapper; |
| | | |
| | | |
| | | //å页æ¥è¯¢ |
| | |
| | | ExcelUtil<AccountIncome> util = new ExcelUtil<AccountIncome>(AccountIncome.class); |
| | | util.exportExcel(response, accountIncomes, "æ¶å
¥ç®¡ç导åº"); |
| | | } |
| | | |
| | | //è´¢å¡æ¥è¡¨å¹´æ¥è¯¢ |
| | | @Override |
| | | public List<AccountDto3> reportIncome() { |
| | | List<AccountDto3> accountDto3s = new ArrayList<>(); |
| | | //å
æ¥è¯¢æ¶å
¥ç±»åæåªäº |
| | | List<SysDictData> incomeTypes = sysDictDataMapper.selectDictDataByType("income_types"); |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | int currentYear = LocalDate.now().getYear(); // è·åå½å年份ï¼å¦2025ï¼ |
| | | for (SysDictData incomeType : incomeTypes) { |
| | | AccountDto3 accountDto3 = new AccountDto3(); |
| | | accountDto3.setTypeName(incomeType.getDictLabel());//ç±»å |
| | | List<BigDecimal> account=new ArrayList<>(); |
| | | for (int i = 1; i <= 12; i++) { |
| | | // å½æç¬¬ä¸å¤©ï¼å¹´ä»½ä¸ºå½åå¹´ï¼æä»½ä¸ºiï¼æ¥æä¸º1 |
| | | LocalDate firstDay = LocalDate.of(currentYear, i, 1); |
| | | DateQueryDto dateQueryDto = new DateQueryDto(); |
| | | dateQueryDto.setEntryDateStart(firstDay.format(formatter)); |
| | | // 彿æåä¸å¤©ï¼ç¬¬ä¸å¤©çæä»½çæåä¸å¤© |
| | | dateQueryDto.setEntryDateEnd(firstDay.plusMonths(1).minusDays(1).format(formatter)); |
| | | account.add(accountIncomeMapper.report1(dateQueryDto,incomeType.getDictValue())); |
| | | } |
| | | accountDto3.setAccount(account);//ç±»å |
| | | accountDto3s.add(accountDto3); |
| | | } |
| | | return accountDto3s; |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.approve.pojo.ApproveNode; |
| | | import com.ruoyi.approve.service.IApproveNodeService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.IOException; |
| | | |
| | | @Api(tags = "审æ¹è®°å½") |
| | | @RestController |
| | | @RequestMapping("/approveNode") |
| | | public class ApproveNodeController { |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/details/{id}") |
| | | @ApiOperation(value = "æµç¨ç¶æè¯¦æ
") |
| | | public AjaxResult details(@PathVariable String id) { |
| | | return AjaxResult.success(approveNodeService.details(id)); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/updateApproveNode") |
| | | public AjaxResult updateApproveNode(@RequestBody ApproveNode approveNode) { |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @ApiOperation(value = "审æ¹èç¹") |
| | | public AjaxResult updateApproveNode(@RequestBody ApproveNode approveNode) throws IOException { |
| | | approveNodeService.updateApproveNode(approveNode); |
| | | return AjaxResult.success(); |
| | | } |
| | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.sales.pojo.CommonFile; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Data |
| | | @TableName("approve_node") |
| | | @ApiModel |
| | | public class ApproveNode{ |
| | | |
| | | |
| | | @ApiModelProperty("éä»¶id") |
| | | @TableField(exist = false) |
| | | private List<String> tempFileIds; |
| | | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty("éä»¶å表") |
| | | private String url; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.approve.pojo.ApproveNode; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | |
| | | public interface IApproveNodeService extends IService<ApproveNode> { |
| | |
| | | */ |
| | | List<ApproveNode> details(String id); |
| | | |
| | | void updateApproveNode(ApproveNode approveNode); |
| | | void updateApproveNode(ApproveNode approveNode) throws IOException; |
| | | |
| | | void delApproveNodeByApproveId(Long id); |
| | | } |
| | |
| | | import com.ruoyi.approve.pojo.ApproveNode; |
| | | import com.ruoyi.approve.pojo.ApproveProcess; |
| | | import com.ruoyi.approve.service.IApproveNodeService; |
| | | import com.ruoyi.common.enums.FileNameType; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.other.service.impl.TempFileServiceImpl; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import com.ruoyi.sales.mapper.CommonFileMapper; |
| | | import com.ruoyi.sales.pojo.CommonFile; |
| | | import com.ruoyi.sales.service.impl.CommonFileServiceImpl; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.io.IOException; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Comparator; |
| | | import java.util.Date; |
| | |
| | | private ApproveProcessMapper approveProcessMapper; |
| | | @Autowired |
| | | private SysUserMapper sysUserMapper; |
| | | |
| | | @Autowired |
| | | private TempFileServiceImpl tempFileService; |
| | | |
| | | @Autowired |
| | | private CommonFileMapper fileMapper; |
| | | |
| | | |
| | | public ApproveProcess getApproveById(String id) { |
| | |
| | | return list; |
| | | } |
| | | for (ApproveNode approveNode : list) { |
| | | List<CommonFile> commonFiles = fileMapper.selectList(new LambdaQueryWrapper<CommonFile>() |
| | | .eq(CommonFile::getCommonId, approveNode.getId()) |
| | | .eq(CommonFile::getType, FileNameType.ApproveNode.getValue())); |
| | | if(!CollectionUtils.isEmpty(commonFiles)){ |
| | | approveNode.setUrl(commonFiles.get(0).getUrl()); |
| | | } |
| | | if(approveNode.getApproveNodeStatus() == 1){ |
| | | continue; |
| | | } |
| | |
| | | return list; |
| | | } |
| | | |
| | | public void updateApproveProcessStatus(ApproveNode approveNode,Integer status) { |
| | | public void updateApproveProcessStatus(ApproveNode approveNode,Integer status) throws IOException { |
| | | LambdaQueryWrapper<ApproveProcess> approveProcessLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | approveProcessLambdaQueryWrapper.eq(ApproveProcess::getApproveId, approveNode.getApproveProcessId()) |
| | | .eq(ApproveProcess::getApproveDelete, 0) |
| | |
| | | approveProcess.setApproveUserCurrentName(approveNode1.getApproveNodeUser()); |
| | | } |
| | | approveProcessMapper.updateById(approveProcess); |
| | | |
| | | // ç»å®éä»¶ |
| | | if(!CollectionUtils.isEmpty(approveNode.getTempFileIds()) && approveNode.getApproveNodeStatus() == 1){ |
| | | tempFileService.migrateTempFilesToFormal(approveNode.getId(), approveNode.getTempFileIds(), FileNameType.ApproveNode.getValue()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void updateApproveNode(ApproveNode approveNode) { |
| | | public void updateApproveNode(ApproveNode approveNode) throws IOException { |
| | | // 审æ¹èç¹ç¶æ:1åæï¼2æç»ï¼0å°æªå®¡æ ¸ |
| | | switch (approveNode.getApproveNodeStatus()){ |
| | | case 1: |
| | |
| | | SALE(1), // éå® |
| | | PURCHASE(2), // éè´ |
| | | INVOICE(3), //å票 |
| | | PURCHASELEDGER(4); // |
| | | PURCHASELEDGER(4), |
| | | MEASURING(5), //计éå¨å
·å°è´¦ |
| | | MEASURINGRecord(6),//计éå¨å
·å°è´¦è®°å½ |
| | | ApproveNode(7); //åå审æ¹å®¡æ ¸ |
| | | |
| | | private final int value; |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | * Copyright 2014-2020 Sayi |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package com.ruoyi.common.utils; |
| | | |
| | | import com.deepoove.poi.XWPFTemplate; |
| | | import com.deepoove.poi.exception.RenderException; |
| | | import com.deepoove.poi.policy.RenderPolicy; |
| | | import com.deepoove.poi.render.compute.RenderDataCompute; |
| | | import com.deepoove.poi.render.processor.DocumentProcessor; |
| | | import com.deepoove.poi.resolver.TemplateResolver; |
| | | import com.deepoove.poi.template.ElementTemplate; |
| | | import com.deepoove.poi.template.MetaTemplate; |
| | | import com.deepoove.poi.template.run.RunTemplate; |
| | | import com.deepoove.poi.util.ReflectionUtils; |
| | | import com.deepoove.poi.util.TableTools; |
| | | import org.apache.poi.xwpf.usermodel.*; |
| | | import org.apache.xmlbeans.XmlCursor; |
| | | import org.apache.xmlbeans.XmlObject; |
| | | import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRow; |
| | | import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTcPr; |
| | | import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTVMerge; |
| | | import org.openxmlformats.schemas.wordprocessingml.x2006.main.STMerge; |
| | | |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * Hack for loop table row |
| | | * |
| | | * @author |
| | | * |
| | | */ |
| | | public class HackLoopTableRenderPolicy implements RenderPolicy { |
| | | |
| | | private String prefix; |
| | | private String suffix; |
| | | private boolean onSameLine; |
| | | |
| | | public HackLoopTableRenderPolicy() { |
| | | this(false); |
| | | } |
| | | |
| | | public HackLoopTableRenderPolicy(boolean onSameLine) { |
| | | this("[", "]", onSameLine); |
| | | } |
| | | |
| | | public HackLoopTableRenderPolicy(String prefix, String suffix) { |
| | | this(prefix, suffix, false); |
| | | } |
| | | |
| | | public HackLoopTableRenderPolicy(String prefix, String suffix, boolean onSameLine) { |
| | | this.prefix = prefix; |
| | | this.suffix = suffix; |
| | | this.onSameLine = onSameLine; |
| | | } |
| | | |
| | | @Override |
| | | public void render(ElementTemplate eleTemplate, Object data, XWPFTemplate template) { |
| | | RunTemplate runTemplate = (RunTemplate) eleTemplate; |
| | | XWPFRun run = runTemplate.getRun(); |
| | | try { |
| | | if (!TableTools.isInsideTable(run)) { |
| | | throw new IllegalStateException( |
| | | "The template tag " + runTemplate.getSource() + " must be inside a table"); |
| | | } |
| | | XWPFTableCell tagCell = (XWPFTableCell) ((XWPFParagraph) run.getParent()).getBody(); |
| | | XWPFTable table = tagCell.getTableRow().getTable(); |
| | | run.setText("", 0); |
| | | |
| | | int templateRowIndex = getTemplateRowIndex(tagCell); |
| | | if (null != data && data instanceof Iterable) { |
| | | Iterator<?> iterator = ((Iterable<?>) data).iterator(); |
| | | XWPFTableRow templateRow = table.getRow(templateRowIndex); |
| | | int insertPosition = templateRowIndex; |
| | | |
| | | TemplateResolver resolver = new TemplateResolver(template.getConfig().copy(prefix, suffix)); |
| | | boolean firstFlag = true; |
| | | while (iterator.hasNext()) { |
| | | insertPosition = templateRowIndex++; |
| | | XWPFTableRow nextRow = table.insertNewTableRow(insertPosition); |
| | | setTableRow(table, templateRow, insertPosition); |
| | | |
| | | // double set row |
| | | XmlCursor newCursor = templateRow.getCtRow().newCursor(); |
| | | newCursor.toPrevSibling(); |
| | | XmlObject object = newCursor.getObject(); |
| | | nextRow = new XWPFTableRow((CTRow) object, table); |
| | | if (!firstFlag) { |
| | | // update VMerge cells for non-first row |
| | | List<XWPFTableCell> tableCells = nextRow.getTableCells(); |
| | | for (XWPFTableCell cell : tableCells) { |
| | | CTTcPr tcPr = TableTools.getTcPr(cell); |
| | | CTVMerge vMerge = tcPr.getVMerge(); |
| | | if (null == vMerge) continue; |
| | | if (STMerge.RESTART == vMerge.getVal()) { |
| | | vMerge.setVal(STMerge.CONTINUE); |
| | | } |
| | | } |
| | | } else { |
| | | firstFlag = false; |
| | | } |
| | | setTableRow(table, nextRow, insertPosition); |
| | | |
| | | RenderDataCompute dataCompute = template.getConfig().getRenderDataComputeFactory() |
| | | .newCompute(iterator.next()); |
| | | List<XWPFTableCell> cells = nextRow.getTableCells(); |
| | | cells.forEach(cell -> { |
| | | List<MetaTemplate> templates = resolver.resolveBodyElements(cell.getBodyElements()); |
| | | new DocumentProcessor(template, resolver, dataCompute).process(templates); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | table.removeRow(templateRowIndex); |
| | | afterloop(table, data); |
| | | } catch (Exception e) { |
| | | throw new RenderException("HackLoopTable for " + eleTemplate + "error: " + e.getMessage(), e); |
| | | } |
| | | } |
| | | |
| | | private int getTemplateRowIndex(XWPFTableCell tagCell) { |
| | | XWPFTableRow tagRow = tagCell.getTableRow(); |
| | | return onSameLine ? getRowIndex(tagRow) : (getRowIndex(tagRow) + 1); |
| | | } |
| | | |
| | | protected void afterloop(XWPFTable table, Object data) { |
| | | } |
| | | |
| | | @SuppressWarnings("unchecked") |
| | | private void setTableRow(XWPFTable table, XWPFTableRow templateRow, int pos) { |
| | | List<XWPFTableRow> rows = (List<XWPFTableRow>) ReflectionUtils.getValue("tableRows", table); |
| | | rows.set(pos, templateRow); |
| | | table.getCTTbl().setTrArray(pos, templateRow.getCtRow()); |
| | | } |
| | | |
| | | private int getRowIndex(XWPFTableRow row) { |
| | | List<XWPFTableRow> rows = row.getTable().getRows(); |
| | | return rows.indexOf(row); |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.compensationperformance.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.compensationperformance.pojo.CompensationPerformance; |
| | | import com.ruoyi.compensationperformance.service.CompensationPerformanceService; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author :yys |
| | | * @date : 2025/8/8 9:56 |
| | | */ |
| | | @RestController |
| | | @Api(tags = "èªé
¬ç»©æ") |
| | | @RequestMapping("/compensationPerformance") |
| | | public class CompensationPerformanceController extends BaseController { |
| | | |
| | | @Autowired |
| | | private CompensationPerformanceService compensationPerformanceService; |
| | | |
| | | @GetMapping("/listPage") |
| | | @Log(title = "èªé
¬ç»©æ-å页æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | @ApiOperation("èªé
¬ç»©æ-å页æ¥è¯¢") |
| | | public AjaxResult listPage(Page page, CompensationPerformance compensationPerformance){ |
| | | IPage<CompensationPerformance> listPage = compensationPerformanceService.listPage(page, compensationPerformance); |
| | | return AjaxResult.success(listPage); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Log(title = "èªé
¬ç»©æ-æ·»å ", businessType = BusinessType.INSERT) |
| | | @ApiOperation("èªé
¬ç»©æ-æ·»å ") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult add(@RequestBody CompensationPerformance compensationPerformance){ |
| | | boolean save = compensationPerformanceService.save(compensationPerformance); |
| | | return save ? AjaxResult.success("æ·»å æå") : AjaxResult.error("æ·»å 失败"); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Log(title = "èªé
¬ç»©æ-ä¿®æ¹", businessType = BusinessType.UPDATE) |
| | | @ApiOperation("èªé
¬ç»©æ-ä¿®æ¹") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult update(@RequestBody CompensationPerformance compensationPerformance){ |
| | | boolean update = compensationPerformanceService.updateById(compensationPerformance); |
| | | return update ? AjaxResult.success("ä¿®æ¹æå") : AjaxResult.error("ä¿®æ¹å¤±è´¥"); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Log(title = "èªé
¬ç»©æ-å é¤", businessType = BusinessType.DELETE) |
| | | @ApiOperation("èªé
¬ç»©æ-å é¤") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult delete(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | boolean delete = compensationPerformanceService.removeBatchByIds(ids); |
| | | return delete ? AjaxResult.success("å 餿å") : AjaxResult.error("å é¤å¤±è´¥"); |
| | | } |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.compensationperformance.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.compensationperformance.pojo.CompensationPerformance; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | | * @author :yys |
| | | * @date : 2025/8/8 9:54 |
| | | */ |
| | | public interface CompensationPerformanceMapper extends BaseMapper<CompensationPerformance> { |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ |
| | | * |
| | | * @param page |
| | | * @param compensationPerformance |
| | | * @return |
| | | */ |
| | | IPage<CompensationPerformance> listPage(Page page,@Param("req") CompensationPerformance compensationPerformance); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.compensationperformance.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author :yys |
| | | * @date : 2025/8/8 9:40 |
| | | */ |
| | | @Data |
| | | @TableName("compensation_performance") |
| | | @ApiModel |
| | | public class CompensationPerformance { |
| | | |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * åå·¥id |
| | | */ |
| | | @ApiModelProperty("åå·¥id") |
| | | @Excel(name = "åå·¥id") |
| | | private Long staffId; |
| | | |
| | | /** |
| | | * å§å |
| | | */ |
| | | @ApiModelProperty("å§å") |
| | | @Excel(name = "å§å") |
| | | private String name; |
| | | |
| | | /** |
| | | * èªèµæä»½(æ¥è¯¢) |
| | | */ |
| | | @ApiModelProperty("èªèµæä»½(æ¥è¯¢)") |
| | | @TableField(exist = false) |
| | | private String payDateStr; |
| | | |
| | | /** |
| | | * èªèµæä»½ |
| | | */ |
| | | @ApiModelProperty("èªèµæä»½") |
| | | @Excel(name = "èªèµæä»½", dateFormat = "yyyy-MM", width = 30) |
| | | @JsonFormat(pattern = "yyyy-MM", timezone = "GMT+8") |
| | | @DateTimeFormat(pattern = "yyyy-MM") |
| | | private Date payDate; |
| | | |
| | | |
| | | /** |
| | | * åºåºå¤å¤©æ° |
| | | */ |
| | | @ApiModelProperty("åºåºå¤å¤©æ°") |
| | | @Excel(name = "åºåºå¤å¤©æ°") |
| | | private BigDecimal shouldAttendedNum; |
| | | |
| | | /** |
| | | * å®é
åºå¤å¤©æ° |
| | | */ |
| | | @ApiModelProperty("å®é
åºå¤å¤©æ°") |
| | | @Excel(name = "å®é
åºå¤å¤©æ°") |
| | | private BigDecimal actualAttendedNum; |
| | | |
| | | |
| | | /** |
| | | * åºæ¬å·¥èµ |
| | | */ |
| | | @ApiModelProperty("åºæ¬å·¥èµ") |
| | | @Excel(name = "åºæ¬å·¥èµ") |
| | | private BigDecimal basicSalary; |
| | | |
| | | /** |
| | | * å²ä½å·¥èµ |
| | | */ |
| | | @ApiModelProperty("å²ä½å·¥èµ") |
| | | @Excel(name = "å²ä½å·¥èµ") |
| | | private BigDecimal postSalary; |
| | | |
| | | /** |
| | | * å
¥ç¦»èç¼ºå¤æ£æ¬¾ |
| | | */ |
| | | @ApiModelProperty("å
¥ç¦»èç¼ºå¤æ£æ¬¾") |
| | | @Excel(name = "å
¥ç¦»èç¼ºå¤æ£æ¬¾") |
| | | private BigDecimal deductionAbsenteeism; |
| | | |
| | | |
| | | /** |
| | | * ç
åæ£æ¬¾ |
| | | */ |
| | | @ApiModelProperty("ç
åæ£æ¬¾") |
| | | @Excel(name = "ç
åæ£æ¬¾") |
| | | private BigDecimal sickLeaveDeductions; |
| | | |
| | | /** |
| | | * äºåæ£æ¬¾ |
| | | */ |
| | | @ApiModelProperty("äºåæ£æ¬¾") |
| | | @Excel(name = "äºåæ£æ¬¾") |
| | | private BigDecimal deductionPersonalLeave; |
| | | /** |
| | | * å¿è®°æå¡æ£æ¬¾ |
| | | */ |
| | | @ApiModelProperty("å¿è®°æå¡æ£æ¬¾") |
| | | @Excel(name = "å¿è®°æå¡æ£æ¬¾") |
| | | private BigDecimal forgetClockDeduct; |
| | | |
| | | /** |
| | | * 绩æå¾å |
| | | */ |
| | | @ApiModelProperty("绩æå¾å") |
| | | @Excel(name = "绩æå¾å") |
| | | private BigDecimal performanceScore; |
| | | |
| | | /** |
| | | * 绩æå·¥èµ |
| | | */ |
| | | @ApiModelProperty("绩æå·¥èµ") |
| | | @Excel(name = "绩æå·¥èµ") |
| | | private BigDecimal performancePay; |
| | | |
| | | |
| | | /** |
| | | * åºåå计 |
| | | */ |
| | | @ApiModelProperty("åºåå计") |
| | | @Excel(name = "åºåå计") |
| | | private BigDecimal payableWages; |
| | | |
| | | /** |
| | | * 社ä¿ä¸ªäºº |
| | | */ |
| | | @ApiModelProperty("社ä¿ä¸ªäºº") |
| | | @Excel(name = "社ä¿ä¸ªäºº") |
| | | private BigDecimal socialSecurityIndividuals; |
| | | /** |
| | | * 社ä¿å
¬å¸ |
| | | */ |
| | | @ApiModelProperty("社ä¿å
¬å¸") |
| | | @Excel(name = "社ä¿å
¬å¸") |
| | | private BigDecimal socialSecurityCompanies; |
| | | |
| | | /** |
| | | * 社ä¿å计 |
| | | */ |
| | | @ApiModelProperty("社ä¿å计") |
| | | @Excel(name = "社ä¿å计") |
| | | private BigDecimal socialSecurityTotal; |
| | | |
| | | /** |
| | | * å
¬ç§¯éå计 |
| | | */ |
| | | @ApiModelProperty("å
¬ç§¯éå计") |
| | | @Excel(name = "å
¬ç§¯éå计") |
| | | private BigDecimal providentFundTotal; |
| | | /** |
| | | * å
¬ç§¯éå
¬å¸ |
| | | */ |
| | | @ApiModelProperty("å
¬ç§¯éå
¬å¸") |
| | | @Excel(name = "å
¬ç§¯éå
¬å¸") |
| | | private BigDecimal providentFundCompany; |
| | | |
| | | /** |
| | | * å
¬ç§¯é个人 |
| | | */ |
| | | @ApiModelProperty("å
¬ç§¯é个人") |
| | | @Excel(name = "å
¬ç§¯é个人") |
| | | private BigDecimal providentFundIndividuals; |
| | | |
| | | /** |
| | | * åºç¨å·¥èµ |
| | | */ |
| | | @ApiModelProperty("åºç¨å·¥èµ") |
| | | @Excel(name = "åºç¨å·¥èµ") |
| | | private BigDecimal taxableWaget; |
| | | /** |
| | | * 个人æå¾ç¨ |
| | | */ |
| | | @ApiModelProperty("个人æå¾ç¨") |
| | | @Excel(name = "个人æå¾ç¨") |
| | | private BigDecimal personalIncomeTax; |
| | | |
| | | /** |
| | | * å®åå·¥èµ |
| | | */ |
| | | @ApiModelProperty("å®åå·¥èµ") |
| | | @Excel(name = "å®åå·¥èµ") |
| | | private BigDecimal actualWages; |
| | | |
| | | /** |
| | | * å建è
|
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | /** |
| | | * ä¿®æ¹è
|
| | | */ |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | |
| | | /** |
| | | * ä¿®æ¹æ¶é´ |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | /** |
| | | * ç§æ·ID |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.compensationperformance.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.compensationperformance.pojo.CompensationPerformance; |
| | | |
| | | /** |
| | | * @author :yys |
| | | * @date : 2025/8/8 9:55 |
| | | */ |
| | | public interface CompensationPerformanceService extends IService<CompensationPerformance> { |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ |
| | | * |
| | | * @param page |
| | | * @param compensationPerformance |
| | | * @return |
| | | */ |
| | | IPage<CompensationPerformance> listPage(Page page, CompensationPerformance compensationPerformance); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.compensationperformance.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.compensationperformance.mapper.CompensationPerformanceMapper; |
| | | import com.ruoyi.compensationperformance.pojo.CompensationPerformance; |
| | | import com.ruoyi.compensationperformance.service.CompensationPerformanceService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author :yys |
| | | * @date : 2025/8/8 9:55 |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | public class CompensationPerformanceServiceImpl extends ServiceImpl<CompensationPerformanceMapper, CompensationPerformance> implements CompensationPerformanceService { |
| | | |
| | | @Autowired |
| | | private CompensationPerformanceMapper compensationPerformanceMapper; |
| | | |
| | | |
| | | @Override |
| | | public IPage<CompensationPerformance> listPage(Page page, CompensationPerformance compensationPerformance) { |
| | | IPage<CompensationPerformance> compensationPerformanceIPage = compensationPerformanceMapper.listPage(page, compensationPerformance); |
| | | return compensationPerformanceIPage; |
| | | } |
| | | } |
| | |
| | | @ApiModelProperty("åºåç±»å") |
| | | @Excel(name = "åºåç±»å") |
| | | private String areaType; |
| | | /** |
| | | * æåº |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long sort; |
| | | |
| | | /** |
| | | * ç¶ç±»id |
| | |
| | | package com.ruoyi.equipmentenergyconsumption.pojo; |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @TableName("energy_period") |
| | | @ApiModel |
| | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | /** |
| | | * å¼å§æ¶é´ |
| | | * æ¥æ |
| | | */ |
| | | @ApiModelProperty("å¼å§æ¶é´") |
| | | @Excel(name = "å¼å§æ¶é´") |
| | | private String startTime; |
| | | /** |
| | | * ç»ææ¶é´ |
| | | */ |
| | | @ApiModelProperty("ç»ææ¶é´") |
| | | @Excel(name = "ç»ææ¶é´") |
| | | private String endTime; |
| | | @ApiModelProperty("æ¥æ") |
| | | @Excel(name = "æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date date; |
| | | /** |
| | | * åä»· |
| | | */ |
| | |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | /** |
| | | * 峰段 |
| | | */ |
| | | @ApiModelProperty("峰段") |
| | | @Excel(name = "峰段") |
| | | private Double peak; |
| | | /** |
| | | * 谷段 |
| | | */ |
| | | @ApiModelProperty("谷段") |
| | | @Excel(name = "谷段") |
| | | private Double valley; |
| | | /** |
| | | * 平段 |
| | | */ |
| | | @ApiModelProperty("平段") |
| | | @Excel(name = "平段") |
| | | private Double flat; |
| | | /** |
| | | * å°æ®µ |
| | | */ |
| | | @ApiModelProperty("å°æ®µ") |
| | | @Excel(name = "å°æ®µ") |
| | | private Double sharp; |
| | | } |
| | |
| | | package com.ruoyi.framework.config; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.DbType; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.ParameterUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; |
| | | import com.baomidou.mybatisplus.extension.plugins.inner.BlockAttackInnerInterceptor; |
| | | import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor; |
| | | import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; |
| | | import com.baomidou.mybatisplus.extension.plugins.inner.TenantLineInnerInterceptor; |
| | | import com.ruoyi.common.handler.CustomTenantLineHandler; |
| | | import org.apache.ibatis.executor.Executor; |
| | | import org.apache.ibatis.mapping.BoundSql; |
| | | import org.apache.ibatis.mapping.MappedStatement; |
| | | import org.apache.ibatis.session.ResultHandler; |
| | | import org.apache.ibatis.session.RowBounds; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.transaction.annotation.EnableTransactionManagement; |
| | | |
| | | import java.sql.SQLException; |
| | | |
| | | /** |
| | | * Mybatis Plus é
ç½® |
| | |
| | | /** |
| | | * å页æä»¶ï¼èªå¨è¯å«æ°æ®åºç±»å https://baomidou.com/guide/interceptor-pagination.html |
| | | */ |
| | | public PaginationInnerInterceptor paginationInnerInterceptor() |
| | | { |
| | | PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor(); |
| | | // è®¾ç½®æ°æ®åºç±»å为mysql |
| | | paginationInnerInterceptor.setDbType(DbType.MYSQL); |
| | | // 设置æå¤§å页éå¶æ°éï¼é»è®¤ 500 æ¡ï¼-1 ä¸åéå¶ |
| | | paginationInnerInterceptor.setMaxLimit(-1L); |
| | | return paginationInnerInterceptor; |
| | | // public PaginationInnerInterceptor paginationInnerInterceptor() |
| | | // { |
| | | // PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor(); |
| | | // // è®¾ç½®æ°æ®åºç±»å为mysql |
| | | // paginationInnerInterceptor.setDbType(DbType.MYSQL); |
| | | // // 设置æå¤§å页éå¶æ°éï¼é»è®¤ 500 æ¡ï¼-1 ä¸åéå¶ |
| | | // paginationInnerInterceptor.setMaxLimit(-1L); |
| | | // return paginationInnerInterceptor; |
| | | // } |
| | | |
| | | public PaginationInnerInterceptor paginationInnerInterceptor() { |
| | | PaginationInnerInterceptor interceptor = new PaginationInnerInterceptor(DbType.MYSQL) { |
| | | @Override |
| | | public void beforeQuery(Executor executor, MappedStatement ms, Object parameter, |
| | | RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql) throws SQLException { |
| | | IPage<?> page = ParameterUtils.findPage(parameter).orElse(null); |
| | | if (page != null && page.getSize() <= 0) { |
| | | // å½size<=0æ¶ï¼ä¸è¿è¡å页 |
| | | return; |
| | | } |
| | | super.beforeQuery(executor, ms, parameter, rowBounds, resultHandler, boundSql); |
| | | } |
| | | }; |
| | | interceptor.setMaxLimit(1000L); // 建议设置åççæå¤§å¼ |
| | | return interceptor; |
| | | } |
| | | |
| | | /** |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.measuringinstrumentledger.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.equipmentenergyconsumption.pojo.EquipmentEnergyConsumption; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | 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.measuringinstrumentledger.dto.MeasuringInstrumentLedgerDto; |
| | | import com.ruoyi.measuringinstrumentledger.mapper.MeasuringInstrumentLedgerRecordMapper; |
| | | import com.ruoyi.measuringinstrumentledger.pojo.MeasuringInstrumentLedger; |
| | | import com.ruoyi.measuringinstrumentledger.pojo.MeasuringInstrumentLedgerRecord; |
| | | import com.ruoyi.measuringinstrumentledger.service.MeasuringInstrumentLedgerService; |
| | | import com.ruoyi.measuringinstrumentledger.service.impl.MeasuringInstrumentLedgerServiceImpl; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author :yys |
| | | * @date : 2025/8/5 9:27 |
| | | */ |
| | | @RestController |
| | | @Api(tags = "计éå¨å
·å°è´¦") |
| | | @RequestMapping("/measuringInstrumentLedger") |
| | | public class MeasuringInstrumentLedgerController extends BaseController { |
| | | |
| | | @Autowired |
| | | private MeasuringInstrumentLedgerService measuringInstrumentLedgerService; |
| | | |
| | | @Autowired |
| | | private SysUserMapper sysUserMapper; |
| | | |
| | | @Autowired |
| | | private MeasuringInstrumentLedgerRecordMapper measuringInstrumentLedgerRecordMapper; |
| | | |
| | | |
| | | @GetMapping("/listPage") |
| | | @ApiOperation("计éå¨å
·å°è´¦-å页æ¥è¯¢") |
| | | @Log(title = "计éå¨å
·å°è´¦-å页æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPage(Page page, MeasuringInstrumentLedger measuringInstrumentLedger) { |
| | | IPage<MeasuringInstrumentLedger> listPage = measuringInstrumentLedgerService.listPage(page, measuringInstrumentLedger); |
| | | return AjaxResult.success(listPage); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/add") |
| | | @ApiOperation("计éå¨å
·å°è´¦-æ°å¢") |
| | | @Log(title = "计éå¨å
·å°è´¦-æ°å¢", businessType = BusinessType.INSERT) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult add(@RequestBody MeasuringInstrumentLedger measuringInstrumentLedger) throws IOException { |
| | | boolean save = measuringInstrumentLedgerService.add(measuringInstrumentLedger); |
| | | if (save) { |
| | | return AjaxResult.success(); |
| | | } |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @ApiOperation("计éå¨å
·å°è´¦-ä¿®æ¹") |
| | | @Log(title = "计éå¨å
·å°è´¦-ä¿®æ¹", businessType = BusinessType.UPDATE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult update(@RequestBody MeasuringInstrumentLedger measuringInstrumentLedger) { |
| | | SysUser sysUser = sysUserMapper.selectUserById(measuringInstrumentLedger.getUserId()); |
| | | if (sysUser == null) { |
| | | return AjaxResult.error("ç¨æ·ä¸åå¨"); |
| | | } |
| | | measuringInstrumentLedger.setUserName(sysUser.getUserName()); |
| | | boolean update = measuringInstrumentLedgerService.updateById(measuringInstrumentLedger); |
| | | if (update) { |
| | | return AjaxResult.success(); |
| | | } |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @ApiOperation("计éå¨å
·å°è´¦-å é¤") |
| | | @Log(title = "计éå¨å
·å°è´¦-å é¤", businessType = BusinessType.DELETE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | for (Long id : ids) { |
| | | LambdaQueryWrapper<MeasuringInstrumentLedgerRecord> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(MeasuringInstrumentLedgerRecord::getMeasuringInstrumentLedgerId,id); |
| | | List<MeasuringInstrumentLedgerRecord> measuringInstrumentLedgerRecords = measuringInstrumentLedgerRecordMapper.selectList(queryWrapper); |
| | | if(!CollectionUtils.isEmpty(measuringInstrumentLedgerRecords)){ |
| | | return AjaxResult.error("请å
å é¤éä¸è®¡éå¨å
·å°è´¦ä¸çæææ£å®è®°å½"); |
| | | } |
| | | } |
| | | boolean delete = measuringInstrumentLedgerService.removeBatchByIds(ids); |
| | | if (delete) { |
| | | return AjaxResult.success(); |
| | | } |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | | @PostMapping("/verifying") |
| | | @ApiOperation("计éå¨å
·å°è´¦-æ£å®") |
| | | @Log(title = "计éå¨å
·å°è´¦-æ£å®", businessType = BusinessType.UPDATE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult verifying(@RequestBody MeasuringInstrumentLedgerDto measuringInstrumentLedger) throws IOException { |
| | | boolean update = measuringInstrumentLedgerService.verifying(measuringInstrumentLedger); |
| | | return update ? AjaxResult.success("æ£å®æå") : AjaxResult.error("æ£å®å¤±è´¥"); |
| | | } |
| | | |
| | | /** |
| | | * 导åºè®¡éå¨å
·å°è´¦ |
| | | */ |
| | | @Log(title = "导åºè®¡éå¨å
·å°è´¦", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | @ApiOperation("导åºè®¡éå¨å
·å°è´¦") |
| | | public void export(HttpServletResponse response) { |
| | | measuringInstrumentLedgerService.export( response); |
| | | } |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.measuringinstrumentledger.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | 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.measuringinstrumentledger.pojo.MeasuringInstrumentLedgerRecord; |
| | | import com.ruoyi.measuringinstrumentledger.service.MeasuringInstrumentLedgerRecordService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | |
| | | /** |
| | | * @author :yys |
| | | * @date : 2025/8/5 9:28 |
| | | */ |
| | | @RestController |
| | | @Api(tags = "计éå¨å
·å°è´¦è®°å½") |
| | | @RequestMapping("/measuringInstrumentLedgerRecord") |
| | | public class MeasuringInstrumentLedgerRecordController extends BaseController { |
| | | |
| | | @Autowired |
| | | private MeasuringInstrumentLedgerRecordService measuringInstrumentLedgerRecordService; |
| | | |
| | | |
| | | @GetMapping("/listPage") |
| | | @ApiOperation("计éå¨å
·å°è´¦è®°å½-å页æ¥è¯¢") |
| | | @Log(title = "计éå¨å
·å°è´¦è®°å½-å页æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPage(Page page, MeasuringInstrumentLedgerRecord measuringInstrumentLedgerRecord){ |
| | | IPage<MeasuringInstrumentLedgerRecord> listPage = measuringInstrumentLedgerRecordService.listPage(page, measuringInstrumentLedgerRecord); |
| | | return AjaxResult.success(listPage); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @ApiOperation("计éå¨å
·å°è´¦è®°å½-ä¿®æ¹") |
| | | @Log(title = "计éå¨å
·å°è´¦è®°å½-ä¿®æ¹", businessType = BusinessType.UPDATE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult update(@RequestBody MeasuringInstrumentLedgerRecord measuringInstrumentLedgerRecord) throws IOException { |
| | | boolean update = measuringInstrumentLedgerRecordService.updateMeasuringInstrumentLedgerRecord(measuringInstrumentLedgerRecord); |
| | | if (update) { |
| | | return AjaxResult.success(); |
| | | } |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | | /** |
| | | * 导åºè®¡éå¨å
·å°è´¦ |
| | | */ |
| | | @ApiOperation("计éå¨å
·å°è´¦è®°å½-导åº") |
| | | @Log(title = "计éå¨å
·å°è´¦è®°å½-导åº", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response) { |
| | | measuringInstrumentLedgerRecordService.export( response); |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.measuringinstrumentledger.dto; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author :yys |
| | | * @date : 2025/8/5 9:50 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class MeasuringInstrumentLedgerDto { |
| | | |
| | | @ApiModelProperty("ID") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("éä»¶id") |
| | | private List<String> tempFileIds; |
| | | |
| | | @ApiModelProperty("æ£å®æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd", iso = DateTimeFormat.ISO.DATE) |
| | | private Date recordDate; |
| | | |
| | | @ApiModelProperty("å½å
¥æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd", iso = DateTimeFormat.ISO.DATE) |
| | | private Date entryDate; |
| | | |
| | | |
| | | @ApiModelProperty("æææ") |
| | | private Integer valid; |
| | | |
| | | @ApiModelProperty("æ£å®äºº") |
| | | private Long userId; |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.measuringinstrumentledger.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.measuringinstrumentledger.pojo.MeasuringInstrumentLedger; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author :yys |
| | | * @date : 2025/8/5 9:20 |
| | | */ |
| | | public interface MeasuringInstrumentLedgerMapper extends BaseMapper<MeasuringInstrumentLedger> { |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ |
| | | * |
| | | * @param page |
| | | * @param measuringInstrumentLedger |
| | | * @return |
| | | */ |
| | | IPage<MeasuringInstrumentLedger> listPage(Page page,@Param("req") MeasuringInstrumentLedger measuringInstrumentLedger); |
| | | |
| | | List<MeasuringInstrumentLedger> listPage(@Param("req") MeasuringInstrumentLedger measuringInstrumentLedger); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.measuringinstrumentledger.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.measuringinstrumentledger.pojo.MeasuringInstrumentLedgerRecord; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author :yys |
| | | * @date : 2025/8/5 9:19 |
| | | */ |
| | | public interface MeasuringInstrumentLedgerRecordMapper extends BaseMapper<MeasuringInstrumentLedgerRecord> { |
| | | |
| | | |
| | | IPage<MeasuringInstrumentLedgerRecord> listPage(Page page,@Param("req") MeasuringInstrumentLedgerRecord measuringInstrumentLedgerRecord); |
| | | |
| | | List<MeasuringInstrumentLedgerRecord> list(@Param("req") MeasuringInstrumentLedgerRecord measuringInstrumentLedgerRecord); |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.measuringinstrumentledger.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import com.ruoyi.sales.pojo.CommonFile; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author :yys |
| | | * @date : 2025/8/5 9:12 |
| | | */ |
| | | @Data |
| | | @TableName("measuring_instrument_ledger") |
| | | @ApiModel |
| | | public class MeasuringInstrumentLedger { |
| | | |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty("éä»¶id") |
| | | @TableField(exist = false) |
| | | private List<String> tempFileIds; |
| | | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty("éä»¶å表") |
| | | private List<CommonFile> commonFiles; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("å½å
¥äººid") |
| | | private Long userId; |
| | | |
| | | @ApiModelProperty("å½å
¥äººåç§°") |
| | | @Excel(name = "å½å
¥äººåç§°") |
| | | private String userName; |
| | | |
| | | /** |
| | | * 计éå¨å
·ç¼å· |
| | | */ |
| | | @ApiModelProperty("计éå¨å
·ç¼å·") |
| | | @Excel(name = "计éå¨å
·ç¼å·") |
| | | private String code; |
| | | |
| | | /** |
| | | * 计éå¨å
·åç§° |
| | | */ |
| | | @ApiModelProperty("计éå¨å
·åç§°") |
| | | @Excel(name = "计éå¨å
·åç§°") |
| | | private String name; |
| | | |
| | | /** |
| | | * è§æ ¼åå· |
| | | */ |
| | | @ApiModelProperty("è§æ ¼åå·") |
| | | @Excel(name = "è§æ ¼åå·") |
| | | private String model; |
| | | |
| | | /** |
| | | * æè¿ä¸æ¬¡æ£å®æ¥æ |
| | | */ |
| | | @ApiModelProperty("æè¿ä¸æ¬¡æ£å®æ¥æ") |
| | | @Excel(name = "æè¿ä¸æ¬¡æ£å®æ¥æ", width = 30, dateFormat = "yyyy-MM-dd") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date mostDate; |
| | | |
| | | |
| | | /** |
| | | * æ£å®æææ |
| | | */ |
| | | @ApiModelProperty("æ£å®æææ") |
| | | @Excel(name = "æ£å®æææ") |
| | | private Integer valid; |
| | | |
| | | /** |
| | | * é¢è®¡ä¸æ¬¡æ£å®æ¥æ |
| | | */ |
| | | @ApiModelProperty("é¢è®¡ä¸æ¬¡æ£å®æ¥æ") |
| | | @Excel(name = "é¢è®¡ä¸æ¬¡æ£å®æ¥æ" , width = 30, dateFormat = "yyyy-MM-dd") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date nextDate; |
| | | |
| | | /** |
| | | * å½å
¥æ¥æ |
| | | */ |
| | | @ApiModelProperty("å½å
¥æ¥æ") |
| | | @Excel(name = "å½å
¥æ¥æ" , width = 30, dateFormat = "yyyy-MM-dd") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date recordDate; |
| | | |
| | | |
| | | /** |
| | | * ç¶æï¼1-ææ 2-é¾æï¼ |
| | | */ |
| | | @ApiModelProperty("ç¶æï¼1-ææ 2-龿ï¼") |
| | | @Excel(name = "ç¶æ", readConverterExp = "1=ææ,2=龿") |
| | | private Integer status; |
| | | |
| | | /** |
| | | * å建è
|
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | /** |
| | | * ä¿®æ¹è
|
| | | */ |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | |
| | | /** |
| | | * ä¿®æ¹æ¶é´ |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | /** |
| | | * ç§æ·ID |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.measuringinstrumentledger.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import com.ruoyi.sales.pojo.CommonFile; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author :yys |
| | | * @date : 2025/8/5 9:12 |
| | | */ |
| | | @Data |
| | | @TableName("measuring_instrument_ledger_record") |
| | | @ApiModel |
| | | public class MeasuringInstrumentLedgerRecord { |
| | | |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty("计éå¨å
·ç¼å·") |
| | | @TableField(exist = false) |
| | | @Excel(name = "计éå¨å
·ç¼å·") |
| | | private String code; |
| | | |
| | | @ApiModelProperty("åç§°") |
| | | @TableField(exist = false) |
| | | @Excel(name = "åç§°") |
| | | private String name; |
| | | |
| | | @ApiModelProperty("计éå¨å
·åç§°") |
| | | @TableField(exist = false) |
| | | @Excel(name = "计éå¨å
·åç§°") |
| | | private String model; |
| | | |
| | | @ApiModelProperty("éä»¶id") |
| | | @TableField(exist = false) |
| | | private List<String> tempFileIds; |
| | | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty("éä»¶å表") |
| | | private List<CommonFile> commonFiles; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("计éå¨å
·å°è´¦id") |
| | | private Long measuringInstrumentLedgerId; |
| | | |
| | | @ApiModelProperty("æ£å®äººid") |
| | | private Long userId; |
| | | |
| | | @ApiModelProperty("æ£å®äººåç§°") |
| | | @Excel(name = "æ£å®äººåç§°") |
| | | private String userName; |
| | | |
| | | /** |
| | | * æ£å®æ¥æ |
| | | */ |
| | | @ApiModelProperty("æ£å®æ¥æ") |
| | | @Excel(name = "æ£å®æ¥æ" , width = 30, dateFormat = "yyyy-MM-dd") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date recordDate; |
| | | |
| | | @ApiModelProperty("å½å
¥æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | @Excel(name = "å½å
¥æ¥æ" , width = 30, dateFormat = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd", iso = DateTimeFormat.ISO.DATE) |
| | | private Date entryDate; |
| | | |
| | | /** |
| | | * æææï¼åä½å¤©ï¼ |
| | | */ |
| | | @ApiModelProperty("æææï¼åä½å¤©ï¼") |
| | | private Integer valid; |
| | | |
| | | |
| | | /** |
| | | * ç¶æï¼1-ææ 2-é¾æï¼ |
| | | */ |
| | | @ApiModelProperty("ç¶æï¼1-ææ 2-龿ï¼") |
| | | private Integer status; |
| | | |
| | | /** |
| | | * å建è
|
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | /** |
| | | * ä¿®æ¹è
|
| | | */ |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | |
| | | /** |
| | | * ä¿®æ¹æ¶é´ |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | /** |
| | | * ç§æ·ID |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.measuringinstrumentledger.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.measuringinstrumentledger.pojo.MeasuringInstrumentLedgerRecord; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | |
| | | /** |
| | | * @author :yys |
| | | * @date : 2025/8/5 9:22 |
| | | */ |
| | | public interface MeasuringInstrumentLedgerRecordService extends IService<MeasuringInstrumentLedgerRecord> { |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ |
| | | * |
| | | * @param page |
| | | * @param measuringInstrumentLedgerRecord |
| | | * @return |
| | | */ |
| | | IPage<MeasuringInstrumentLedgerRecord> listPage(Page page, MeasuringInstrumentLedgerRecord measuringInstrumentLedgerRecord); |
| | | |
| | | void export(HttpServletResponse response); |
| | | |
| | | boolean updateMeasuringInstrumentLedgerRecord(MeasuringInstrumentLedgerRecord measuringInstrumentLedgerRecord) throws IOException; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.measuringinstrumentledger.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.measuringinstrumentledger.dto.MeasuringInstrumentLedgerDto; |
| | | import com.ruoyi.measuringinstrumentledger.pojo.MeasuringInstrumentLedger; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | |
| | | /** |
| | | * @author :yys |
| | | * @date : 2025/8/5 9:23 |
| | | */ |
| | | public interface MeasuringInstrumentLedgerService extends IService<MeasuringInstrumentLedger> { |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ |
| | | * |
| | | * @param page |
| | | * @param measuringInstrumentLedger |
| | | * @return |
| | | */ |
| | | IPage<MeasuringInstrumentLedger> listPage(Page page, MeasuringInstrumentLedger measuringInstrumentLedger); |
| | | |
| | | /** |
| | | * æ£å® |
| | | * |
| | | * @param measuringInstrumentLedger |
| | | * @return |
| | | */ |
| | | boolean verifying(MeasuringInstrumentLedgerDto measuringInstrumentLedger) throws IOException; |
| | | |
| | | void export(HttpServletResponse response); |
| | | |
| | | /** |
| | | * æ°å¢ |
| | | * |
| | | * @param measuringInstrumentLedger |
| | | * @return |
| | | */ |
| | | boolean add(MeasuringInstrumentLedger measuringInstrumentLedger) throws IOException; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.measuringinstrumentledger.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.enums.FileNameType; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.measuringinstrumentledger.mapper.MeasuringInstrumentLedgerMapper; |
| | | import com.ruoyi.measuringinstrumentledger.mapper.MeasuringInstrumentLedgerRecordMapper; |
| | | import com.ruoyi.measuringinstrumentledger.pojo.MeasuringInstrumentLedger; |
| | | import com.ruoyi.measuringinstrumentledger.pojo.MeasuringInstrumentLedgerRecord; |
| | | import com.ruoyi.measuringinstrumentledger.service.MeasuringInstrumentLedgerRecordService; |
| | | import com.ruoyi.other.mapper.TempFileMapper; |
| | | import com.ruoyi.other.pojo.TempFile; |
| | | import com.ruoyi.sales.mapper.CommonFileMapper; |
| | | import com.ruoyi.sales.pojo.CommonFile; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.io.FilenameUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.nio.file.Files; |
| | | import java.nio.file.Path; |
| | | import java.nio.file.Paths; |
| | | import java.nio.file.StandardCopyOption; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author :yys |
| | | * @date : 2025/8/5 9:24 |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | public class MeasuringInstrumentLedgerRecordServiceImpl extends ServiceImpl<MeasuringInstrumentLedgerRecordMapper, MeasuringInstrumentLedgerRecord> implements MeasuringInstrumentLedgerRecordService { |
| | | |
| | | @Autowired |
| | | private MeasuringInstrumentLedgerRecordMapper measuringInstrumentLedgerRecordMapper; |
| | | |
| | | @Autowired |
| | | private MeasuringInstrumentLedgerMapper measuringInstrumentLedgerMapper; |
| | | |
| | | @Autowired |
| | | private CommonFileMapper commonFileMapper; |
| | | |
| | | @Autowired |
| | | private TempFileMapper tempFileMapper; |
| | | |
| | | @Value("${file.upload-dir}") |
| | | private String uploadDir; |
| | | |
| | | @Override |
| | | public IPage<MeasuringInstrumentLedgerRecord> listPage(Page page, MeasuringInstrumentLedgerRecord measuringInstrumentLedgerRecord) { |
| | | IPage<MeasuringInstrumentLedgerRecord> measuringInstrumentLedgerRecordIPage = measuringInstrumentLedgerRecordMapper.listPage(page, measuringInstrumentLedgerRecord); |
| | | measuringInstrumentLedgerRecordIPage.getRecords().forEach(item -> { |
| | | LambdaQueryWrapper<CommonFile> salesLedgerFileWrapper = new LambdaQueryWrapper<>(); |
| | | salesLedgerFileWrapper.eq(CommonFile::getCommonId, item.getId()) |
| | | .eq(CommonFile::getType, FileNameType.MEASURINGRecord.getValue()); |
| | | List<CommonFile> commonFiles = commonFileMapper.selectList(salesLedgerFileWrapper); |
| | | item.setCommonFiles(commonFiles); |
| | | }); |
| | | return measuringInstrumentLedgerRecordIPage; |
| | | } |
| | | |
| | | @Override |
| | | public void export(HttpServletResponse response) { |
| | | List<MeasuringInstrumentLedgerRecord> list = measuringInstrumentLedgerRecordMapper.list( new MeasuringInstrumentLedgerRecord()); |
| | | ExcelUtil<MeasuringInstrumentLedgerRecord> util = new ExcelUtil<MeasuringInstrumentLedgerRecord>(MeasuringInstrumentLedgerRecord.class); |
| | | util.exportExcel(response, list , "计éå¨å
·å°è´¦è®°å½æ°æ®"); |
| | | } |
| | | |
| | | @Override |
| | | public boolean updateMeasuringInstrumentLedgerRecord(MeasuringInstrumentLedgerRecord measuringInstrumentLedgerRecord) throws IOException { |
| | | MeasuringInstrumentLedgerRecord measuringInstrumentLedgerRecord1 = measuringInstrumentLedgerRecordMapper.selectById(measuringInstrumentLedgerRecord.getId()); |
| | | if (measuringInstrumentLedgerRecord1 == null) { |
| | | return false; |
| | | } |
| | | // æææåæ´ï¼éæ°è®¡ç®é¢è®¡ä¸æ¬¡æ£å®æ¥æ |
| | | if(!measuringInstrumentLedgerRecord1.getValid().equals(measuringInstrumentLedgerRecord.getValid())){ |
| | | MeasuringInstrumentLedger measuringInstrumentLedger = measuringInstrumentLedgerMapper.selectById(measuringInstrumentLedgerRecord1.getMeasuringInstrumentLedgerId()); |
| | | if(measuringInstrumentLedger != null){ |
| | | measuringInstrumentLedger.setValid(measuringInstrumentLedgerRecord.getValid()); |
| | | measuringInstrumentLedger.setNextDate(new Date(measuringInstrumentLedger.getMostDate().getTime() + measuringInstrumentLedgerRecord.getValid() * 24 * 60 * 60 * 1000L)); |
| | | } |
| | | measuringInstrumentLedgerMapper.updateById(measuringInstrumentLedger); |
| | | } |
| | | measuringInstrumentLedgerRecordMapper.updateById(measuringInstrumentLedgerRecord); |
| | | // è®°å½éä»¶ç»å® |
| | | migrateTempFilesToFormal(measuringInstrumentLedgerRecord.getId(), measuringInstrumentLedgerRecord.getTempFileIds(), FileNameType.MEASURINGRecord.getValue()); |
| | | return true; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * å°ä¸´æ¶æä»¶è¿ç§»å°æ£å¼ç®å½ |
| | | * |
| | | * @param businessId ä¸å¡IDï¼éå®å°è´¦IDï¼ |
| | | * @param tempFileIds ä¸´æ¶æä»¶IDå表 |
| | | * @throws IOException æä»¶æä½å¼å¸¸ |
| | | */ |
| | | private void migrateTempFilesToFormal(Long businessId, List<String> tempFileIds,Integer fileType) throws IOException { |
| | | if (com.baomidou.mybatisplus.core.toolkit.CollectionUtils.isEmpty(tempFileIds)) { |
| | | return; |
| | | } |
| | | |
| | | // æå»ºæ£å¼ç®å½è·¯å¾ï¼æä¸å¡ç±»å忥æåç»ï¼ |
| | | String formalDir = uploadDir + LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE); |
| | | |
| | | Path formalDirPath = Paths.get(formalDir); |
| | | |
| | | // ç¡®ä¿æ£å¼ç®å½åå¨ï¼éå½åå»ºï¼ |
| | | if (!Files.exists(formalDirPath)) { |
| | | Files.createDirectories(formalDirPath); |
| | | } |
| | | |
| | | for (String tempFileId : tempFileIds) { |
| | | // æ¥è¯¢ä¸´æ¶æä»¶è®°å½ |
| | | TempFile tempFile = tempFileMapper.selectById(tempFileId); |
| | | if (tempFile == null) { |
| | | log.warn("ä¸´æ¶æä»¶ä¸åå¨ï¼è·³è¿å¤ç: {}", tempFileId); |
| | | continue; |
| | | } |
| | | |
| | | // æå»ºæ£å¼æä»¶åï¼å
å«ä¸å¡IDåæ¶é´æ³ï¼é¿å
å²çªï¼ |
| | | String originalFilename = tempFile.getOriginalName(); |
| | | String fileExtension = FilenameUtils.getExtension(originalFilename); |
| | | String formalFilename = businessId + "_" + |
| | | System.currentTimeMillis() + "_" + |
| | | UUID.randomUUID().toString().substring(0, 8) + |
| | | (StringUtils.hasText(fileExtension) ? "." + fileExtension : ""); |
| | | |
| | | Path formalFilePath = formalDirPath.resolve(formalFilename); |
| | | |
| | | try { |
| | | // æ§è¡æä»¶è¿ç§»ï¼ä½¿ç¨ååæä½ç¡®ä¿å®å
¨æ§ï¼ |
| | | Files.move( |
| | | Paths.get(tempFile.getTempPath()), |
| | | formalFilePath, |
| | | StandardCopyOption.REPLACE_EXISTING, |
| | | StandardCopyOption.ATOMIC_MOVE |
| | | ); |
| | | log.info("æä»¶è¿ç§»æå: {} -> {}", tempFile.getTempPath(), formalFilePath); |
| | | |
| | | // æ´æ°æä»¶è®°å½ï¼å
³èå°ä¸å¡IDï¼ |
| | | CommonFile fileRecord = new CommonFile(); |
| | | fileRecord.setCommonId(businessId); |
| | | fileRecord.setName(originalFilename); |
| | | fileRecord.setUrl(formalFilePath.toString()); |
| | | fileRecord.setCreateTime(LocalDateTime.now()); |
| | | fileRecord.setType(fileType); |
| | | commonFileMapper.insert(fileRecord); |
| | | |
| | | // å é¤ä¸´æ¶æä»¶è®°å½ |
| | | tempFileMapper.deleteById(tempFile); |
| | | |
| | | log.info("æä»¶è¿ç§»æå: {} -> {}", tempFile.getTempPath(), formalFilePath); |
| | | } catch (IOException e) { |
| | | log.error("æä»¶è¿ç§»å¤±è´¥: {}", tempFile.getTempPath(), e); |
| | | // å¯éæ©åæ»äºå¡æè®°å½å¤±è´¥æä»¶ |
| | | throw new IOException("æä»¶è¿ç§»å¼å¸¸", e); |
| | | } |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.measuringinstrumentledger.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.enums.FileNameType; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.measuringinstrumentledger.dto.MeasuringInstrumentLedgerDto; |
| | | import com.ruoyi.measuringinstrumentledger.mapper.MeasuringInstrumentLedgerMapper; |
| | | import com.ruoyi.measuringinstrumentledger.mapper.MeasuringInstrumentLedgerRecordMapper; |
| | | import com.ruoyi.measuringinstrumentledger.pojo.MeasuringInstrumentLedger; |
| | | import com.ruoyi.measuringinstrumentledger.pojo.MeasuringInstrumentLedgerRecord; |
| | | import com.ruoyi.measuringinstrumentledger.service.MeasuringInstrumentLedgerService; |
| | | import com.ruoyi.other.mapper.TempFileMapper; |
| | | import com.ruoyi.other.pojo.TempFile; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import com.ruoyi.sales.mapper.CommonFileMapper; |
| | | import com.ruoyi.sales.pojo.CommonFile; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.io.FilenameUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.nio.file.Files; |
| | | import java.nio.file.Path; |
| | | import java.nio.file.Paths; |
| | | import java.nio.file.StandardCopyOption; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author :yys |
| | | * @date : 2025/8/5 9:23 |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | public class MeasuringInstrumentLedgerServiceImpl extends ServiceImpl<MeasuringInstrumentLedgerMapper, MeasuringInstrumentLedger> implements MeasuringInstrumentLedgerService { |
| | | |
| | | @Autowired |
| | | private MeasuringInstrumentLedgerMapper measuringInstrumentLedgerMapper; |
| | | |
| | | @Autowired |
| | | private MeasuringInstrumentLedgerRecordMapper measuringInstrumentLedgerRecordMapper; |
| | | |
| | | @Autowired |
| | | private TempFileMapper tempFileMapper; |
| | | |
| | | @Autowired |
| | | private CommonFileMapper commonFileMapper; |
| | | |
| | | @Autowired |
| | | private SysUserMapper sysUserMapper; |
| | | |
| | | @Value("${file.upload-dir}") |
| | | private String uploadDir; |
| | | |
| | | @Override |
| | | public IPage<MeasuringInstrumentLedger> listPage(Page page, MeasuringInstrumentLedger measuringInstrumentLedger) { |
| | | IPage<MeasuringInstrumentLedger> measuringInstrumentLedgerIPage = measuringInstrumentLedgerMapper.listPage(page, measuringInstrumentLedger); |
| | | List<Integer> types = new ArrayList<>(); |
| | | types.add(FileNameType.MEASURING.getValue()); |
| | | types.add(FileNameType.MEASURINGRecord.getValue()); |
| | | measuringInstrumentLedgerIPage.getRecords().forEach(item -> { |
| | | LambdaQueryWrapper<MeasuringInstrumentLedgerRecord> measuringInstrumentLedgerRecordLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | measuringInstrumentLedgerRecordLambdaQueryWrapper.eq(MeasuringInstrumentLedgerRecord::getMeasuringInstrumentLedgerId, item.getId()); |
| | | List<MeasuringInstrumentLedgerRecord> measuringInstrumentLedgerRecords = measuringInstrumentLedgerRecordMapper.selectList(measuringInstrumentLedgerRecordLambdaQueryWrapper); |
| | | List<Long> collect = new ArrayList<>(); |
| | | if(!CollectionUtils.isEmpty(measuringInstrumentLedgerRecords)){ |
| | | collect = measuringInstrumentLedgerRecords.stream().map(MeasuringInstrumentLedgerRecord::getId).collect(Collectors.toList()); |
| | | } |
| | | collect.add(item.getId()); |
| | | LambdaQueryWrapper<CommonFile> salesLedgerFileWrapper = new LambdaQueryWrapper<>(); |
| | | salesLedgerFileWrapper.in(CommonFile::getCommonId, collect) |
| | | .in(CommonFile::getType,types); |
| | | List<CommonFile> commonFiles = commonFileMapper.selectList(salesLedgerFileWrapper); |
| | | item.setCommonFiles(commonFiles); |
| | | |
| | | }); |
| | | return measuringInstrumentLedgerIPage; |
| | | } |
| | | |
| | | @Override |
| | | public boolean verifying(MeasuringInstrumentLedgerDto req) throws IOException { |
| | | MeasuringInstrumentLedger measuringInstrumentLedger = measuringInstrumentLedgerMapper.selectById(req.getId()); |
| | | if(measuringInstrumentLedger == null) { |
| | | return false; |
| | | } |
| | | SysUser sysUser = sysUserMapper.selectUserById(measuringInstrumentLedger.getUserId()); |
| | | measuringInstrumentLedger.setValid(req.getValid()); |
| | | measuringInstrumentLedger.setMostDate(req.getRecordDate()); |
| | | measuringInstrumentLedger.setNextDate(new Date(req.getRecordDate().getTime() + 1000L * 60 * 60 * 24 * req.getValid())); |
| | | MeasuringInstrumentLedgerRecord measuringInstrumentLedgerRecord = new MeasuringInstrumentLedgerRecord(); |
| | | if(measuringInstrumentLedgerMapper.updateById(measuringInstrumentLedger) > 0) { |
| | | measuringInstrumentLedgerRecord.setMeasuringInstrumentLedgerId(req.getId()); |
| | | measuringInstrumentLedgerRecord.setRecordDate(req.getRecordDate()); |
| | | measuringInstrumentLedgerRecord.setEntryDate(req.getEntryDate()); |
| | | measuringInstrumentLedgerRecord.setValid(req.getValid()); |
| | | measuringInstrumentLedgerRecord.setUserId(req.getUserId()); |
| | | measuringInstrumentLedgerRecord.setUserName(sysUser.getUserName()); |
| | | measuringInstrumentLedgerRecordMapper.insert(measuringInstrumentLedgerRecord); |
| | | // å°è´¦ç»å®ä¸æ¬¡ |
| | | // if(!CollectionUtils.isEmpty(req.getTempFileIds())){ |
| | | // migrateTempFilesToFormal(measuringInstrumentLedger.getId(), req.getTempFileIds(), FileNameType.MEASURING.getValue()); |
| | | // } |
| | | // å°è´¦è®°å½ç»å®ä¸æ¬¡ |
| | | if(!CollectionUtils.isEmpty(req.getTempFileIds())){ |
| | | migrateTempFilesToFormal(measuringInstrumentLedgerRecord.getId(), req.getTempFileIds(), FileNameType.MEASURINGRecord.getValue()); |
| | | } |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public void export(HttpServletResponse response) { |
| | | List<MeasuringInstrumentLedger> list = measuringInstrumentLedgerMapper.listPage(new MeasuringInstrumentLedger()); |
| | | ExcelUtil<MeasuringInstrumentLedger> util = new ExcelUtil<MeasuringInstrumentLedger>(MeasuringInstrumentLedger.class); |
| | | util.exportExcel(response, list , "å®¢æ·æ¡£æ¡æ°æ®"); |
| | | } |
| | | |
| | | @Override |
| | | public boolean add(MeasuringInstrumentLedger measuringInstrumentLedger) throws IOException { |
| | | SysUser sysUser = sysUserMapper.selectUserById(measuringInstrumentLedger.getUserId()); |
| | | if (sysUser == null) { |
| | | return false; |
| | | } |
| | | measuringInstrumentLedger.setUserName(sysUser.getUserName()); |
| | | measuringInstrumentLedgerMapper.insert(measuringInstrumentLedger); |
| | | if(!CollectionUtils.isEmpty(measuringInstrumentLedger.getTempFileIds())){ |
| | | migrateTempFilesToFormal(measuringInstrumentLedger.getId(), measuringInstrumentLedger.getTempFileIds(), FileNameType.MEASURING.getValue()); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * å°ä¸´æ¶æä»¶è¿ç§»å°æ£å¼ç®å½ |
| | | * |
| | | * @param businessId ä¸å¡IDï¼éå®å°è´¦IDï¼ |
| | | * @param tempFileIds ä¸´æ¶æä»¶IDå表 |
| | | * @throws IOException æä»¶æä½å¼å¸¸ |
| | | */ |
| | | private void migrateTempFilesToFormal(Long businessId, List<String> tempFileIds,Integer fileType) throws IOException { |
| | | if (CollectionUtils.isEmpty(tempFileIds)) { |
| | | return; |
| | | } |
| | | |
| | | // æå»ºæ£å¼ç®å½è·¯å¾ï¼æä¸å¡ç±»å忥æåç»ï¼ |
| | | String formalDir = uploadDir + LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE); |
| | | |
| | | Path formalDirPath = Paths.get(formalDir); |
| | | |
| | | // ç¡®ä¿æ£å¼ç®å½åå¨ï¼éå½åå»ºï¼ |
| | | if (!Files.exists(formalDirPath)) { |
| | | Files.createDirectories(formalDirPath); |
| | | } |
| | | |
| | | for (String tempFileId : tempFileIds) { |
| | | // æ¥è¯¢ä¸´æ¶æä»¶è®°å½ |
| | | TempFile tempFile = tempFileMapper.selectById(tempFileId); |
| | | if (tempFile == null) { |
| | | log.warn("ä¸´æ¶æä»¶ä¸åå¨ï¼è·³è¿å¤ç: {}", tempFileId); |
| | | continue; |
| | | } |
| | | |
| | | // æå»ºæ£å¼æä»¶åï¼å
å«ä¸å¡IDåæ¶é´æ³ï¼é¿å
å²çªï¼ |
| | | String originalFilename = tempFile.getOriginalName(); |
| | | String fileExtension = FilenameUtils.getExtension(originalFilename); |
| | | String formalFilename = businessId + "_" + |
| | | System.currentTimeMillis() + "_" + |
| | | UUID.randomUUID().toString().substring(0, 8) + |
| | | (StringUtils.hasText(fileExtension) ? "." + fileExtension : ""); |
| | | |
| | | Path formalFilePath = formalDirPath.resolve(formalFilename); |
| | | |
| | | try { |
| | | // æ§è¡æä»¶è¿ç§»ï¼ä½¿ç¨ååæä½ç¡®ä¿å®å
¨æ§ï¼ |
| | | Files.move( |
| | | Paths.get(tempFile.getTempPath()), |
| | | formalFilePath, |
| | | StandardCopyOption.REPLACE_EXISTING, |
| | | StandardCopyOption.ATOMIC_MOVE |
| | | ); |
| | | log.info("æä»¶è¿ç§»æå: {} -> {}", tempFile.getTempPath(), formalFilePath); |
| | | |
| | | // æ´æ°æä»¶è®°å½ï¼å
³èå°ä¸å¡IDï¼ |
| | | CommonFile fileRecord = new CommonFile(); |
| | | fileRecord.setCommonId(businessId); |
| | | fileRecord.setName(originalFilename); |
| | | fileRecord.setUrl(formalFilePath.toString()); |
| | | fileRecord.setCreateTime(LocalDateTime.now()); |
| | | fileRecord.setType(fileType); |
| | | commonFileMapper.insert(fileRecord); |
| | | |
| | | // å é¤ä¸´æ¶æä»¶è®°å½ |
| | | tempFileMapper.deleteById(tempFile); |
| | | |
| | | log.info("æä»¶è¿ç§»æå: {} -> {}", tempFile.getTempPath(), formalFilePath); |
| | | } catch (IOException e) { |
| | | log.error("æä»¶è¿ç§»å¤±è´¥: {}", tempFile.getTempPath(), e); |
| | | // å¯éæ©åæ»äºå¡æè®°å½å¤±è´¥æä»¶ |
| | | throw new IOException("æä»¶è¿ç§»å¼å¸¸", e); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.other.mapper.TempFileMapper; |
| | | import com.ruoyi.other.pojo.TempFile; |
| | | import com.ruoyi.other.service.TempFileService; |
| | | import com.ruoyi.sales.mapper.CommonFileMapper; |
| | | import com.ruoyi.sales.pojo.CommonFile; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.catalina.util.URLEncoder; |
| | | import org.apache.commons.io.FilenameUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | |
| | | import java.nio.file.Files; |
| | | import java.nio.file.Path; |
| | | import java.nio.file.Paths; |
| | | import java.nio.file.StandardCopyOption; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private TempFileMapper tempFileMapper; |
| | | |
| | | @Autowired |
| | | private CommonFileMapper commonFileMapper; |
| | | |
| | | @Value("${file.upload-dir}") |
| | | private String uploadDir; |
| | | |
| | | @Value("${file.temp-dir}") |
| | | private String tempDir; |
| | |
| | | return tempFileRecord; |
| | | } |
| | | |
| | | /** |
| | | * å°ä¸´æ¶æä»¶è¿ç§»å°æ£å¼ç®å½ |
| | | * |
| | | * @param businessId ä¸å¡IDï¼éå®å°è´¦IDï¼ |
| | | * @param tempFileIds ä¸´æ¶æä»¶IDå表 |
| | | * @throws IOException æä»¶æä½å¼å¸¸ |
| | | */ |
| | | public void migrateTempFilesToFormal(Long businessId, List<String> tempFileIds, Integer fileType) throws IOException { |
| | | if (com.baomidou.mybatisplus.core.toolkit.CollectionUtils.isEmpty(tempFileIds)) { |
| | | return; |
| | | } |
| | | |
| | | // æå»ºæ£å¼ç®å½è·¯å¾ï¼æä¸å¡ç±»å忥æåç»ï¼ |
| | | String formalDir = uploadDir + LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE); |
| | | |
| | | Path formalDirPath = Paths.get(formalDir); |
| | | |
| | | // ç¡®ä¿æ£å¼ç®å½åå¨ï¼éå½åå»ºï¼ |
| | | if (!Files.exists(formalDirPath)) { |
| | | Files.createDirectories(formalDirPath); |
| | | } |
| | | |
| | | for (String tempFileId : tempFileIds) { |
| | | // æ¥è¯¢ä¸´æ¶æä»¶è®°å½ |
| | | TempFile tempFile = tempFileMapper.selectById(tempFileId); |
| | | if (tempFile == null) { |
| | | log.warn("ä¸´æ¶æä»¶ä¸åå¨ï¼è·³è¿å¤ç: {}", tempFileId); |
| | | continue; |
| | | } |
| | | |
| | | // æå»ºæ£å¼æä»¶åï¼å
å«ä¸å¡IDåæ¶é´æ³ï¼é¿å
å²çªï¼ |
| | | String originalFilename = tempFile.getOriginalName(); |
| | | String fileExtension = FilenameUtils.getExtension(originalFilename); |
| | | String formalFilename = businessId + "_" + |
| | | System.currentTimeMillis() + "_" + |
| | | UUID.randomUUID().toString().substring(0, 8) + |
| | | (StringUtils.hasText(fileExtension) ? "." + fileExtension : ""); |
| | | |
| | | Path formalFilePath = formalDirPath.resolve(formalFilename); |
| | | |
| | | try { |
| | | // æ§è¡æä»¶è¿ç§»ï¼ä½¿ç¨ååæä½ç¡®ä¿å®å
¨æ§ï¼ |
| | | Files.move( |
| | | Paths.get(tempFile.getTempPath()), |
| | | formalFilePath, |
| | | StandardCopyOption.REPLACE_EXISTING, |
| | | StandardCopyOption.ATOMIC_MOVE |
| | | ); |
| | | log.info("æä»¶è¿ç§»æå: {} -> {}", tempFile.getTempPath(), formalFilePath); |
| | | |
| | | // æ´æ°æä»¶è®°å½ï¼å
³èå°ä¸å¡IDï¼ |
| | | CommonFile fileRecord = new CommonFile(); |
| | | fileRecord.setCommonId(businessId); |
| | | fileRecord.setName(originalFilename); |
| | | fileRecord.setUrl(formalFilePath.toString()); |
| | | fileRecord.setCreateTime(LocalDateTime.now()); |
| | | fileRecord.setType(fileType); |
| | | commonFileMapper.insert(fileRecord); |
| | | |
| | | // å é¤ä¸´æ¶æä»¶è®°å½ |
| | | tempFileMapper.deleteById(tempFile); |
| | | |
| | | log.info("æä»¶è¿ç§»æå: {} -> {}", tempFile.getTempPath(), formalFilePath); |
| | | } catch (IOException e) { |
| | | log.error("æä»¶è¿ç§»å¤±è´¥: {}", tempFile.getTempPath(), e); |
| | | // å¯éæ©åæ»äºå¡æè®°å½å¤±è´¥æä»¶ |
| | | throw new IOException("æä»¶è¿ç§»å¼å¸¸", e); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Scheduled(cron = "0 0 3 * * ?") // æ¯å¤©åæ¨3ç¹æ§è¡ |
| | | public void cleanupExpiredTempFiles() { |
| | | LambdaQueryWrapper<TempFile> wrapper = new LambdaQueryWrapper<>(); |
| | |
| | | *
|
| | | * @return ç¨æ·ä¿¡æ¯
|
| | | */
|
| | | @GetMapping("getInfo")
|
| | | @GetMapping("/getInfo")
|
| | | public AjaxResult getInfo()
|
| | | {
|
| | | LoginUser loginUser = SecurityUtils.getLoginUser();
|
| | |
| | | @TableField(exist = false) |
| | | private String issueDateEnd; |
| | | |
| | | @TableField(exist = false) |
| | | private String supplierNameOrContractNo; |
| | | |
| | | @ApiModelProperty(value = "å½å
¥æ¶é´") |
| | | private LocalDate enterDate; |
| | | } |
| | |
| | | @Override |
| | | public IPage<TicketRegistration> selectTicketRegistrationListPage(Page page, TicketRegistration ticketRegistration) { |
| | | LambdaQueryWrapper<TicketRegistration> queryWrapper = new LambdaQueryWrapper<>(); |
| | | if (StringUtils.isNotBlank(ticketRegistration.getPurchaseContractNumber())) { |
| | | queryWrapper.like(TicketRegistration::getPurchaseContractNumber, ticketRegistration.getPurchaseContractNumber()) |
| | | .like(TicketRegistration::getSupplierName, ticketRegistration.getSupplierName()); |
| | | if (StringUtils.isNotBlank(ticketRegistration.getSupplierNameOrContractNo())) { |
| | | queryWrapper.and(wrapper -> wrapper |
| | | .like(TicketRegistration::getPurchaseContractNumber, ticketRegistration.getSupplierNameOrContractNo()) |
| | | .or() |
| | | .like(TicketRegistration::getSupplierName, ticketRegistration.getSupplierNameOrContractNo()) |
| | | .or() |
| | | .like(TicketRegistration::getSalesContractNo, ticketRegistration.getSupplierNameOrContractNo())); |
| | | } |
| | | if (!ObjectUtils.isEmpty(ticketRegistration.getIssueDateStart()) && !ObjectUtils.isEmpty(ticketRegistration.getIssueDateEnd())) { |
| | | queryWrapper.between(TicketRegistration::getIssueDate, LocalDate.parse(ticketRegistration.getIssueDateStart(), DateTimeFormatter.ofPattern("yyyy-MM-dd")), LocalDate.parse(ticketRegistration.getIssueDateEnd(), DateTimeFormatter.ofPattern("yyyy-MM-dd"))); |
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.quality.dto.QualityInspectDto; |
| | | import com.ruoyi.quality.pojo.QualityInspect; |
| | | import com.ruoyi.quality.pojo.QualityInspectFile; |
| | | import com.ruoyi.quality.pojo.QualityInspectParam; |
| | |
| | | |
| | | /** |
| | | * æ°å¢ |
| | | * @param qualityInspect |
| | | * @param qualityInspectDto |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody QualityInspect qualityInspect) { |
| | | return AjaxResult.success(qualityInspectService.add(qualityInspect)); |
| | | public AjaxResult add(@RequestBody QualityInspectDto qualityInspectDto) { |
| | | return AjaxResult.success(qualityInspectService.add(qualityInspectDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @GetMapping("/{id}") |
| | | public AjaxResult QualityInspectDetail(@PathVariable("id") Integer id) { |
| | | return AjaxResult.success(qualityInspectService.getById(id)); |
| | | return AjaxResult.success(qualityInspectService.getDetailById(id)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹ |
| | | * @param qualityInspect |
| | | * @param qualityInspectDto |
| | | * @return |
| | | */ |
| | | @PostMapping("/update") |
| | | public AjaxResult update(@RequestBody QualityInspect qualityInspect) { |
| | | return AjaxResult.success(qualityInspectService.updateQualityInspect(qualityInspect)); |
| | | public AjaxResult update(@RequestBody QualityInspectDto qualityInspectDto) { |
| | | return AjaxResult.success(qualityInspectService.updateQualityInspect(qualityInspectDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | qualityInspectService.qualityInspectExport(response, qualityInspect); |
| | | } |
| | | |
| | | /** |
| | | * æäº¤ |
| | | * @param qualityInspect |
| | | * @return |
| | | */ |
| | | @PostMapping("/submit") |
| | | public AjaxResult submit(@RequestBody QualityInspect qualityInspect) { |
| | | return AjaxResult.success(qualityInspectService.submit(qualityInspect)); |
| | | } |
| | | |
| | | /** |
| | | * ä¸è½½ |
| | | * @param response |
| | | * @param qualityInspect |
| | | */ |
| | | @PostMapping("/down") |
| | | public void down(HttpServletResponse response,@RequestBody QualityInspect qualityInspect) { |
| | | qualityInspectService.down(response, qualityInspect); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.quality.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.quality.pojo.QualityTestStandard; |
| | |
| | | qualityTestStandardService.qualityTestStandardListPageExport(response, qualityTestStandard); |
| | | } |
| | | |
| | | /** |
| | | * 详æ
|
| | | * @param productId |
| | | * @return |
| | | */ |
| | | @GetMapping("/product/{productId}") |
| | | public AjaxResult QualityInspectDetail(@PathVariable("productId") Long productId) { |
| | | return AjaxResult.success(qualityTestStandardService.list(Wrappers.<QualityTestStandard>lambdaQuery().eq(QualityTestStandard::getProductId,productId))); |
| | | } |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.quality.dto; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.dto.DateQueryDto; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import com.ruoyi.quality.pojo.QualityInspect; |
| | | import com.ruoyi.quality.pojo.QualityInspectParam; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | //è´¨éæ£éªæ°å¢ç¼è¾åæ° |
| | | @Data |
| | | public class QualityInspectDto extends QualityInspect implements Serializable { |
| | | |
| | | //æ£éªé¡¹ç® |
| | | private List<QualityInspectParam> qualityInspectParams; |
| | | |
| | | } |
| | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | /** |
| | | * ç±»å«(0:æªæäº¤;1:å·²æäº¤) |
| | | */ |
| | | private Integer inspectState; |
| | | |
| | | |
| | | } |
| | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | // 导åºä½¿ç¨ |
| | | @TableField(select = false, exist = false) |
| | | private Integer index; |
| | | |
| | | |
| | | } |
| | |
| | | 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.quality.dto.QualityInspectDto; |
| | | import com.ruoyi.quality.pojo.QualityInspect; |
| | | import com.ruoyi.staff.pojo.StaffJoinLeaveRecord; |
| | | import com.ruoyi.staff.pojo.StaffOnJob; |
| | |
| | | public interface IQualityInspectService extends IService<QualityInspect> { |
| | | |
| | | |
| | | int add(QualityInspect qualityInspect); |
| | | int add(QualityInspectDto qualityInspectDto); |
| | | |
| | | int updateQualityInspect(QualityInspect qualityInspect); |
| | | int updateQualityInspect(QualityInspectDto qualityInspectDto); |
| | | |
| | | IPage<QualityInspect> qualityInspectListPage(Page page, QualityInspect qualityInspect); |
| | | |
| | | void qualityInspectExport(HttpServletResponse response, QualityInspect qualityInspect); |
| | | |
| | | QualityInspectDto getDetailById(Integer id); |
| | | |
| | | int submit(QualityInspect qualityInspect); |
| | | |
| | | void down(HttpServletResponse response, QualityInspect qualityInspect); |
| | | } |
| | |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.deepoove.poi.XWPFTemplate; |
| | | import com.deepoove.poi.config.Configure; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.HackLoopTableRenderPolicy; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.quality.dto.QualityInspectDto; |
| | | import com.ruoyi.quality.mapper.QualityInspectMapper; |
| | | import com.ruoyi.quality.mapper.QualityInspectParamMapper; |
| | | import com.ruoyi.quality.mapper.QualityTestStandardMapper; |
| | | import com.ruoyi.quality.mapper.QualityUnqualifiedMapper; |
| | | import com.ruoyi.quality.pojo.QualityInspect; |
| | | import com.ruoyi.quality.pojo.QualityInspectParam; |
| | | import com.ruoyi.quality.pojo.QualityTestStandard; |
| | | import com.ruoyi.quality.pojo.QualityUnqualified; |
| | | import com.ruoyi.quality.service.IQualityInspectParamService; |
| | | import com.ruoyi.quality.service.IQualityInspectService; |
| | | import com.ruoyi.staff.mapper.StaffJoinLeaveRecordMapper; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | 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; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | |
| | | private QualityTestStandardMapper qualityTestStandardMapper; |
| | | |
| | | private QualityUnqualifiedMapper qualityUnqualifiedMapper; |
| | | |
| | | @Override |
| | | public int add(QualityInspect qualityInspect) { |
| | | String[] ignoreProperties = {"id"};//æé¤id屿§ |
| | | //æ ¹æ®äº§åidæ¥è¯¢ææ ç»´æ¤å¯¹åºæ°å¢æ£éªåæ° |
| | | List<QualityTestStandard> qualityTestStandards = qualityTestStandardMapper.selectList(Wrappers.<QualityTestStandard>lambdaQuery() |
| | | .eq(QualityTestStandard::getProductId, qualityInspect.getProductId())); |
| | | if (qualityTestStandards.size()>0){ |
| | | qualityInspectMapper.insert(qualityInspect); |
| | | List<QualityInspectParam> qualityInspectParams = qualityTestStandards.stream().map(qualityTestStandard -> { |
| | | QualityInspectParam qualityInspectParam = new QualityInspectParam(); |
| | | BeanUtils.copyProperties(qualityTestStandard, qualityInspectParam,ignoreProperties); |
| | | qualityInspectParam.setInspectId(qualityInspect.getId()); |
| | | return qualityInspectParam; |
| | | }).collect(Collectors.toList()); |
| | | qualityInspectParamService.saveBatch(qualityInspectParams); |
| | | }else{ |
| | | throw new BaseException("è¯¥äº§åæ²¡æç»´æ¤æ£éªææ ,è¯·æ£æ¥!!!!!!!!"); |
| | | public int add(QualityInspectDto qualityInspectDto) { |
| | | QualityInspect qualityInspect = new QualityInspect(); |
| | | BeanUtils.copyProperties(qualityInspectDto,qualityInspect); |
| | | qualityInspect.setInspectState(0);//é»è®¤æªæäº¤ |
| | | qualityInspectMapper.insert(qualityInspect); |
| | | for (QualityInspectParam qualityInspectParam : qualityInspectDto.getQualityInspectParams()) { |
| | | qualityInspectParam.setInspectId(qualityInspect.getId()); |
| | | } |
| | | qualityInspectParamService.saveBatch(qualityInspectDto.getQualityInspectParams()); |
| | | return 0; |
| | | } |
| | | |
| | | @Override |
| | | public int updateQualityInspect(QualityInspect qualityInspect) { |
| | | String[] ignoreProperties = {"id"};//æé¤id屿§ |
| | | //å
å é¤æææ£éªåæ°åæ°å¢ |
| | | qualityInspectParamService.remove(Wrappers.<QualityInspectParam>lambdaQuery() |
| | | .eq(QualityInspectParam::getInspectId,qualityInspect.getId())); |
| | | //æ ¹æ®äº§åidæ¥è¯¢ææ ç»´æ¤å¯¹åºæ°å¢æ£éªåæ° |
| | | List<QualityTestStandard> qualityTestStandards = qualityTestStandardMapper.selectList(Wrappers.<QualityTestStandard>lambdaQuery() |
| | | .eq(QualityTestStandard::getProductId, qualityInspect.getProductId())); |
| | | if (qualityTestStandards.size()>0){ |
| | | List<QualityInspectParam> qualityInspectParams = qualityTestStandards.stream().map(qualityTestStandard -> { |
| | | QualityInspectParam qualityInspectParam = new QualityInspectParam(); |
| | | BeanUtils.copyProperties(qualityTestStandard, qualityInspectParam,ignoreProperties); |
| | | qualityInspectParam.setInspectId(qualityInspect.getId()); |
| | | return qualityInspectParam; |
| | | }).collect(Collectors.toList()); |
| | | qualityInspectParamService.saveBatch(qualityInspectParams); |
| | | }else{ |
| | | throw new BaseException("è¯¥äº§åæ²¡æç»´æ¤æ£éªææ ,è¯·æ£æ¥!!!!!!!!"); |
| | | public QualityInspectDto getDetailById(Integer id) { |
| | | QualityInspect qualityInspect = qualityInspectMapper.selectById(id); |
| | | List<QualityInspectParam> qualityInspectParams = qualityInspectParamService.list(Wrappers.<QualityInspectParam>lambdaQuery().eq(QualityInspectParam::getInspectId, id)); |
| | | QualityInspectDto qualityInspectDto = new QualityInspectDto(); |
| | | BeanUtils.copyProperties(qualityInspect,qualityInspectDto); |
| | | qualityInspectDto.setQualityInspectParams(qualityInspectParams); |
| | | return qualityInspectDto; |
| | | } |
| | | |
| | | //æäº¤ |
| | | @Override |
| | | public int submit(QualityInspect inspect) { |
| | | QualityInspect qualityInspect = qualityInspectMapper.selectById(inspect.getId()); |
| | | /*夿ä¸åæ ¼*/ |
| | | if (ObjectUtils.isNotNull(qualityInspect.getCheckResult()) && qualityInspect.getCheckResult().equals("ä¸åæ ¼")){ |
| | | QualityUnqualified qualityUnqualified = new QualityUnqualified(); |
| | | BeanUtils.copyProperties(qualityInspect,qualityUnqualified); |
| | | qualityUnqualified.setInspectState(0);//å¾
å¤ç |
| | | List<QualityInspectParam> inspectParams = qualityInspectParamService.list(Wrappers.<QualityInspectParam>lambdaQuery().eq(QualityInspectParam::getInspectId, inspect.getId())); |
| | | String text = inspectParams.stream().map(QualityInspectParam::getParameterItem).collect(Collectors.joining(",")); |
| | | qualityUnqualified.setDefectivePhenomena(text+"è¿äºææ ä¸åå¨ä¸åæ ¼");//ä¸åæ ¼ç°è±¡ |
| | | qualityUnqualifiedMapper.insert(qualityUnqualified); |
| | | } |
| | | return qualityInspectMapper.updateById(qualityInspect); |
| | | qualityInspect.setInspectState(1);//å·²æäº¤ |
| | | return qualityInspectMapper.updateById(qualityInspect); |
| | | } |
| | | |
| | | /*çææ£éªæ¥å*/ |
| | | @Override |
| | | public void down(HttpServletResponse response, QualityInspect qualityInspect) { |
| | | QualityInspect inspect = qualityInspectMapper.selectById(qualityInspect.getId()); |
| | | String inspectType=""; |
| | | switch (inspect.getInspectType()){ |
| | | case 0: |
| | | inspectType="åæææ£éª"; |
| | | break; |
| | | case 1: |
| | | inspectType="è¿ç¨æ£éª"; |
| | | break; |
| | | case 2: |
| | | inspectType="åºåæ£éª"; |
| | | break; |
| | | } |
| | | List<QualityInspectParam> paramList = qualityInspectParamService.list(Wrappers.<QualityInspectParam>lambdaQuery().eq(QualityInspectParam::getInspectId, inspect.getId())); |
| | | int index = 1; |
| | | for (QualityInspectParam detail : paramList) { |
| | | detail.setIndex(index); |
| | | index++; |
| | | } |
| | | InputStream inputStream = this.getClass().getResourceAsStream("/static/report-template.docx"); |
| | | Configure configure = Configure.builder() |
| | | .bind("paramList", new HackLoopTableRenderPolicy()) |
| | | .build(); |
| | | String finalInspectType = inspectType; |
| | | XWPFTemplate template = XWPFTemplate.compile(inputStream, configure).render( |
| | | new HashMap<String, Object>() {{ |
| | | put("inspect", inspect); |
| | | put("inspectType", finalInspectType); |
| | | put("paramList", paramList); |
| | | }}); |
| | | |
| | | 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("导åºå¤±è´¥"); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public int updateQualityInspect(QualityInspectDto qualityInspectDto) { |
| | | if (ObjectUtils.isNotNull(qualityInspectDto.getQualityInspectParams())) { |
| | | qualityInspectParamService.remove(Wrappers.<QualityInspectParam>lambdaQuery().eq(QualityInspectParam::getInspectId,qualityInspectDto.getId())); |
| | | for (QualityInspectParam qualityInspectParam : qualityInspectDto.getQualityInspectParams()) { |
| | | qualityInspectParam.setInspectId(qualityInspectDto.getId()); |
| | | } |
| | | qualityInspectParamService.saveBatch(qualityInspectDto.getQualityInspectParams()); |
| | | } |
| | | QualityInspect qualityInspect = new QualityInspect(); |
| | | BeanUtils.copyProperties(qualityInspectDto,qualityInspect); |
| | | return qualityInspectMapper.updateById(qualityInspect); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | package com.ruoyi.staff.controller; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.staff.pojo.StaffJoinLeaveRecord; |
| | | import com.ruoyi.staff.pojo.StaffOnJob; |
| | |
| | | import com.ruoyi.staff.service.IStaffOnJobService; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | |
| | | public AjaxResult staffOnJobDetail(String staffNo) { |
| | | return AjaxResult.success(staffOnJobService.staffOnJobDetail(staffNo)); |
| | | } |
| | | /** |
| | | * å¨èå工导å
¥ |
| | | */ |
| | | @PostMapping("/import") |
| | | @Log(title = "å¨èå工导å
¥", businessType = BusinessType.IMPORT) |
| | | public AjaxResult importData(@RequestPart("file") MultipartFile file) { |
| | | Boolean b = staffOnJobService.importData(file); |
| | | if (b) { |
| | | return AjaxResult.success("导å
¥æå"); |
| | | } |
| | | return AjaxResult.error("导å
¥å¤±è´¥"); |
| | | } |
| | | |
| | | /** |
| | | * å¨èåå·¥å¯¼åº |
| | |
| | | /** |
| | | * åå·¥ç¼å· |
| | | */ |
| | | @Excel(name = "åå·¥ç¼å·") |
| | | @Excel(name = "åå·¥ç¼å·", type = Excel.Type.EXPORT, cellType = Excel.ColumnType.STRING) |
| | | private String staffNo; |
| | | |
| | | /** |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.staff.pojo.StaffJoinLeaveRecord; |
| | | import com.ruoyi.staff.pojo.StaffOnJob; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | |
| | | void staffOnJobExport(HttpServletResponse response, StaffOnJob staffOnJob); |
| | | |
| | | List<StaffJoinLeaveRecord> staffOnJobList(); |
| | | |
| | | Boolean importData(MultipartFile file); |
| | | } |
| | |
| | | import com.ruoyi.staff.service.IStaffOnJobService; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | |
| | | return staffJoinLeaveRecordMapper.staffOnJobList(); |
| | | } |
| | | |
| | | @Override |
| | | public Boolean importData(MultipartFile file) { |
| | | try { |
| | | ExcelUtil<StaffOnJob> util = new ExcelUtil<>(StaffOnJob.class); |
| | | List<StaffOnJob> staffOnJobs = util.importExcel(file.getInputStream()); |
| | | return saveOrUpdateBatch(staffOnJobs); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | # 项ç®ç¸å
³é
ç½® |
| | | ruoyi: |
| | | # åç§° |
| | | name: RuoYi |
| | | # çæ¬ |
| | | version: 3.8.9 |
| | | # çæå¹´ä»½ |
| | | copyrightYear: 2025 |
| | | # æä»¶è·¯å¾ 示ä¾ï¼ Windowsé
ç½®D:/ruoyi/uploadPathï¼Linuxé
ç½® /home/ruoyi/uploadPathï¼ |
| | | profile: /javaWork/product-inventory-management/file |
| | | |
| | | # è·åipå°åå¼å
³ |
| | | addressEnabled: false |
| | | # éªè¯ç ç±»å math æ°åè®¡ç® char å符éªè¯ |
| | | captchaType: math |
| | | |
| | | # å¼åç¯å¢é
ç½® |
| | | server: |
| | | # æå¡å¨çHTTP端å£ï¼é»è®¤ä¸º8080 |
| | | port: 8089 |
| | | servlet: |
| | | # åºç¨ç访é®è·¯å¾ |
| | | context-path: / |
| | | tomcat: |
| | | # tomcatçURIç¼ç |
| | | uri-encoding: UTF-8 |
| | | # è¿æ¥æ°æ»¡åçæéæ°ï¼é»è®¤ä¸º100 |
| | | accept-count: 1000 |
| | | threads: |
| | | # tomcatæå¤§çº¿ç¨æ°ï¼é»è®¤ä¸º200 |
| | | max: 800 |
| | | # Tomcatå¯å¨åå§åççº¿ç¨æ°ï¼é»è®¤å¼10 |
| | | min-spare: 100 |
| | | |
| | | # æ¥å¿é
ç½® |
| | | logging: |
| | | level: |
| | | com.ruoyi: warn |
| | | org.springframework: warn |
| | | |
| | | minio: |
| | | endpoint: http://114.132.189.42/ |
| | | port: 7019 |
| | | secure: false |
| | | accessKey: admin |
| | | secretKey: 12345678 |
| | | preview-expiry: 24 # é¢è§å°åé»è®¤24å°æ¶ |
| | | default-bucket: uploadPath |
| | | # ç¨æ·é
ç½® |
| | | user: |
| | | password: |
| | | # å¯ç æå¤§éè¯¯æ¬¡æ° |
| | | maxRetryCount: 5 |
| | | # å¯ç é宿¶é´ï¼é»è®¤10åéï¼ |
| | | lockTime: 10 |
| | | |
| | | # Springé
ç½® |
| | | spring: |
| | | datasource: |
| | | type: com.alibaba.druid.pool.DruidDataSource |
| | | driverClassName: com.mysql.cj.jdbc.Driver |
| | | druid: |
| | | # ä¸»åºæ°æ®æº |
| | | master: |
| | | url: jdbc:mysql://114.132.189.42:9004/product-inventory-management-demo?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 |
| | | username: root |
| | | password: 123456 |
| | | # ä»åºæ°æ®æº |
| | | slave: |
| | | # 仿°æ®æºå¼å
³/é»è®¤å
³é |
| | | enabled: false |
| | | url: |
| | | username: |
| | | password: |
| | | # åå§è¿æ¥æ° |
| | | initialSize: 5 |
| | | # æå°è¿æ¥æ± æ°é |
| | | minIdle: 10 |
| | | # æå¤§è¿æ¥æ± æ°é |
| | | maxActive: 20 |
| | | # é
ç½®è·åè¿æ¥çå¾
è¶
æ¶çæ¶é´ |
| | | maxWait: 60000 |
| | | # é
ç½®è¿æ¥è¶
æ¶æ¶é´ |
| | | connectTimeout: 30000 |
| | | # é
ç½®ç½ç»è¶
æ¶æ¶é´ |
| | | socketTimeout: 60000 |
| | | # é
ç½®é´éå¤ä¹
æè¿è¡ä¸æ¬¡æ£æµï¼æ£æµéè¦å
³éç空é²è¿æ¥ï¼å使¯æ¯«ç§ |
| | | timeBetweenEvictionRunsMillis: 60000 |
| | | # é
ç½®ä¸ä¸ªè¿æ¥å¨æ± 䏿å°çåçæ¶é´ï¼å使¯æ¯«ç§ |
| | | minEvictableIdleTimeMillis: 300000 |
| | | # é
ç½®ä¸ä¸ªè¿æ¥å¨æ± 䏿大çåçæ¶é´ï¼å使¯æ¯«ç§ |
| | | maxEvictableIdleTimeMillis: 900000 |
| | | # é
ç½®æ£æµè¿æ¥æ¯å¦ææ |
| | | validationQuery: SELECT 1 FROM DUAL |
| | | testWhileIdle: true |
| | | testOnBorrow: false |
| | | testOnReturn: false |
| | | webStatFilter: |
| | | enabled: true |
| | | statViewServlet: |
| | | enabled: true |
| | | # 设置ç½ååï¼ä¸å¡«åå
许ææè®¿é® |
| | | allow: |
| | | url-pattern: /druid/* |
| | | # æ§å¶å°ç®¡çç¨æ·ååå¯ç |
| | | login-username: ruoyi |
| | | login-password: 123456 |
| | | filter: |
| | | stat: |
| | | enabled: true |
| | | # æ
¢SQLè®°å½ |
| | | log-slow-sql: true |
| | | slow-sql-millis: 1000 |
| | | merge-sql: true |
| | | wall: |
| | | config: |
| | | multi-statement-allow: true |
| | | # èµæºä¿¡æ¯ |
| | | messages: |
| | | # å½é
åèµæºæä»¶è·¯å¾ |
| | | basename: i18n/messages |
| | | # æä»¶ä¸ä¼ |
| | | servlet: |
| | | multipart: |
| | | # å个æä»¶å¤§å° |
| | | max-file-size: 1GB |
| | | # 设置æ»ä¸ä¼ çæä»¶å¤§å° |
| | | max-request-size: 2GB |
| | | # æå¡æ¨¡å |
| | | devtools: |
| | | restart: |
| | | # çé¨ç½²å¼å
³ |
| | | enabled: false |
| | | # redis é
ç½® |
| | | redis: |
| | | # å°å |
| | | host: 127.0.0.1 |
| | | # host: 172.17.0.1 |
| | | # 端å£ï¼é»è®¤ä¸º6379 |
| | | port: 6379 |
| | | # æ°æ®åºç´¢å¼ |
| | | database: 0 |
| | | # å¯ç |
| | | password: root2022! |
| | | # password: |
| | | |
| | | # è¿æ¥è¶
æ¶æ¶é´ |
| | | timeout: 10s |
| | | lettuce: |
| | | pool: |
| | | # è¿æ¥æ± ä¸çæå°ç©ºé²è¿æ¥ |
| | | min-idle: 0 |
| | | # è¿æ¥æ± ä¸çæå¤§ç©ºé²è¿æ¥ |
| | | max-idle: 8 |
| | | # è¿æ¥æ± çæå¤§æ°æ®åºè¿æ¥æ° |
| | | max-active: 8 |
| | | # #è¿æ¥æ± æå¤§é»å¡çå¾
æ¶é´ï¼ä½¿ç¨è´å¼è¡¨ç¤ºæ²¡æéå¶ï¼ |
| | | max-wait: -1ms |
| | | |
| | | # tokené
ç½® |
| | | token: |
| | | # 令çèªå®ä¹æ è¯ |
| | | header: Authorization |
| | | # 令çå¯é¥ |
| | | secret: abcdefghijklmnopqrstuvwxyz |
| | | # ä»¤çæææï¼é»è®¤30åéï¼ |
| | | expireTime: 450 |
| | | |
| | | # MyBatis Plusé
ç½® |
| | | mybatis-plus: |
| | | # æç´¢æå®å
å«å æ ¹æ®èªå·±çé¡¹ç®æ¥ |
| | | typeAliasesPackage: com.ruoyi.**.pojo |
| | | # é
ç½®mapperçæ«æï¼æ¾å°ææçmapper.xmlæ å°æä»¶ |
| | | mapperLocations: classpath*:mapper/**/*Mapper.xml |
| | | # å è½½å
¨å±çé
ç½®æä»¶ |
| | | configLocation: classpath:mybatis/mybatis-config.xml |
| | | global-config: |
| | | enable-sql-runner: true |
| | | db-config: |
| | | id-type: auto |
| | | |
| | | # PageHelperå页æä»¶ |
| | | pagehelper: |
| | | helperDialect: mysql |
| | | supportMethodsArguments: true |
| | | params: count=countSql |
| | | |
| | | # Swaggeré
ç½® |
| | | swagger: |
| | | # æ¯å¦å¼å¯swagger |
| | | enabled: false |
| | | # 请æ±åç¼ |
| | | pathMapping: /dev-api |
| | | |
| | | # 鲿¢XSSæ»å» |
| | | xss: |
| | | # è¿æ»¤å¼å
³ |
| | | enabled: true |
| | | # æé¤é¾æ¥ï¼å¤ä¸ªç¨éå·åéï¼ |
| | | excludes: /system/notice |
| | | # å¹é
龿¥ |
| | | urlPatterns: /system/*,/monitor/*,/tool/* |
| | | |
| | | # 代ç çæ |
| | | gen: |
| | | # ä½è
|
| | | author: ruoyi |
| | | # é»è®¤çæå
è·¯å¾ system éæ¹æèªå·±ç模ååç§° å¦ system monitor tool |
| | | packageName: com.ruoyi.project.system |
| | | # èªå¨å»é¤è¡¨åç¼ï¼é»è®¤æ¯true |
| | | autoRemovePre: false |
| | | # 表åç¼ï¼çæç±»åä¸ä¼å
å«è¡¨åç¼ï¼å¤ä¸ªç¨éå·åéï¼ |
| | | tablePrefix: sys_ |
| | | # æ¯å¦å
è®¸çææä»¶è¦çå°æ¬å°ï¼èªå®ä¹è·¯å¾ï¼ï¼é»è®¤ä¸å
许 |
| | | allowOverwrite: false |
| | | |
| | | file: |
| | | temp-dir: /javaWork/product-inventory-management/file/temp/uploads |
| | | upload-dir: /javaWork/product-inventory-management/file/prod/uploads |
| | |
| | | group by expense_type |
| | | </select> |
| | | |
| | | <select id="report1" resultType="java.math.BigDecimal"> |
| | | SELECT |
| | | sum(expense_money) account |
| | | FROM account_expense ai |
| | | where |
| | | expense_type=#{dictValue} |
| | | <if test="dateQueryDto.entryDateStart != null and dateQueryDto.entryDateStart != '' "> |
| | | AND expense_date >= DATE_FORMAT(#{dateQueryDto.entryDateStart},'%Y-%m-%d') |
| | | </if> |
| | | <if test="dateQueryDto.entryDateEnd != null and dateQueryDto.entryDateEnd != '' "> |
| | | AND expense_date <= DATE_FORMAT(#{dateQueryDto.entryDateEnd},'%Y-%m-%d') |
| | | </if> |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | </if> |
| | | group by income_type |
| | | </select> |
| | | <select id="report1" resultType="java.math.BigDecimal"> |
| | | SELECT |
| | | sum(income_money) account |
| | | FROM account_income ai |
| | | where |
| | | income_type=#{dictValue} |
| | | <if test="dateQueryDto.entryDateStart != null and dateQueryDto.entryDateStart != '' "> |
| | | AND income_date >= DATE_FORMAT(#{dateQueryDto.entryDateStart},'%Y-%m-%d') |
| | | </if> |
| | | <if test="dateQueryDto.entryDateEnd != null and dateQueryDto.entryDateEnd != '' "> |
| | | AND income_date <= DATE_FORMAT(#{dateQueryDto.entryDateEnd},'%Y-%m-%d') |
| | | </if> |
| | | </select> |
| | | </mapper> |
| | |
| | | <if test="req.approveId != null and req.approveId != ''"> |
| | | and approve_id like concat('%',#{req.approveId},'%') |
| | | </if> |
| | | <if test="req.approveStatus != null and req.approveStatus != ''"> |
| | | <if test="req.approveStatus != null or req.approveStatus == 0"> |
| | | and approve_status = #{req.approveStatus} |
| | | </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.compensationperformance.mapper.CompensationPerformanceMapper"> |
| | | |
| | | <select id="listPage" resultType="com.ruoyi.compensationperformance.pojo.CompensationPerformance"> |
| | | select * from compensation_performance |
| | | <where> |
| | | <if test="req.name != null and req.name != ''"> |
| | | and `name` like concat('%',#{req.name},'%') |
| | | </if> |
| | | <if test="req.payDateStr != null and req.payDateStr != ''"> |
| | | and pay_date like concat('%',#{req.payDateStr},'%') |
| | | </if> |
| | | </where> |
| | | </select> |
| | | </mapper> |
| | |
| | | <select id="listPage" resultType="com.ruoyi.equipmentenergyconsumption.pojo.EnergyPeriod"> |
| | | select * from energy_period |
| | | <where> |
| | | <if test="energyPeriod.startTime != null"> |
| | | start_time = #{energyPeriod.startTime} |
| | | </if> |
| | | <if test="energyPeriod.endTime != null"> |
| | | and end_time = #{energyPeriod.endTime} |
| | | <if test="energyPeriod.date != null"> |
| | | date = #{energyPeriod.date} |
| | | </if> |
| | | <if test="energyPeriod.price != null"> |
| | | and price = #{energyPeriod.price} |
| | | </if> |
| | | <if test="energyPeriod.peak != null"> |
| | | and peak = #{energyPeriod.peak} |
| | | </if> |
| | | <if test="energyPeriod.valley != null"> |
| | | and valley = #{energyPeriod.valley} |
| | | </if> |
| | | <if test="energyPeriod.flat != null"> |
| | | and flat = #{energyPeriod.flat} |
| | | </if> |
| | | <if test="energyPeriod.sharp != null"> |
| | | and sharp = #{energyPeriod.sharp} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | </mapper> |
| | |
| | | <select id="listPage" resultType="com.ruoyi.equipmentenergyconsumption.pojo.ElectricityConsumptionArea"> |
| | | select * from electricity_consumption_area |
| | | <where> |
| | | <if test="electricityConsumptionArea.id != null"> |
| | | id = #{electricityConsumptionArea.id} |
| | | </if> |
| | | <if test="electricityConsumptionArea.areaName != null and electricityConsumptionArea.areaName != ''"> |
| | | area_name like CONCAT('%', #{electricityConsumptionArea.areaName}, '%') |
| | | and area_name like CONCAT('%', #{electricityConsumptionArea.areaName}, '%') |
| | | </if> |
| | | <if test="electricityConsumptionArea.areaType != null and electricityConsumptionArea.areaType != ''"> |
| | | and area_type like CONCAT('%', #{electricityConsumptionArea.areaType}, '%') |
| | | </if> |
| | | <if test="electricityConsumptionArea.sort != null"> |
| | | and sort = #{electricityConsumptionArea.sort} |
| | | </if> |
| | | <if test="electricityConsumptionArea.fuId != null"> |
| | | and fu_id = #{electricityConsumptionArea.fuId} |
| | | </if> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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.measuringinstrumentledger.mapper.MeasuringInstrumentLedgerMapper"> |
| | | |
| | | <select id="listPage" resultType="com.ruoyi.measuringinstrumentledger.pojo.MeasuringInstrumentLedger"> |
| | | SELECT |
| | | id, |
| | | user_id, |
| | | user_name, |
| | | code, |
| | | name, |
| | | model, |
| | | most_date, |
| | | valid, |
| | | next_date, |
| | | record_date, |
| | | CASE |
| | | WHEN next_date >= DATE_FORMAT(now(),'%Y-%m-%d') THEN 1 |
| | | ELSE 2 |
| | | END AS status, |
| | | create_user, |
| | | create_time, |
| | | update_user, |
| | | update_time, |
| | | tenant_id |
| | | FROM |
| | | measuring_instrument_ledger |
| | | <where> |
| | | <!-- æ¥è¯¢æ¡ä»¶åä¸ --> |
| | | <if test="req.code != null and req.code != ''"> |
| | | AND code LIKE CONCAT('%', #{req.code}, '%') |
| | | </if> |
| | | <if test="req.name != null and req.name != ''"> |
| | | AND name LIKE CONCAT('%', #{req.name}, '%') |
| | | </if> |
| | | <if test="req.status != null"> |
| | | <choose> |
| | | <when test="req.status == 1"> |
| | | AND next_date >= DATE_FORMAT(now(),'%Y-%m-%d') |
| | | </when> |
| | | <when test="req.status == 2"> |
| | | AND next_date < DATE_FORMAT(now(),'%Y-%m-%d') |
| | | </when> |
| | | </choose> |
| | | </if> |
| | | <if test="req.tenantId != null"> |
| | | AND tenant_id = #{req.tenantId} |
| | | </if> |
| | | <if test="req.recordDate != null"> |
| | | AND record_date = DATE_FORMAT(#{req.recordDate},'%Y-%m-%d') |
| | | </if> |
| | | </where> |
| | | ORDER BY update_time DESC |
| | | </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.measuringinstrumentledger.mapper.MeasuringInstrumentLedgerRecordMapper"> |
| | | |
| | | <select id="listPage" |
| | | resultType="com.ruoyi.measuringinstrumentledger.pojo.MeasuringInstrumentLedgerRecord"> |
| | | SELECT |
| | | t1.id, |
| | | t1.user_id, |
| | | t1.user_name, |
| | | t2.code, |
| | | t2.name, |
| | | t2.model, |
| | | t1.valid, |
| | | t1.record_date, |
| | | t1.entry_date |
| | | FROM |
| | | measuring_instrument_ledger_record t1 |
| | | left join measuring_instrument_ledger t2 on t1.measuring_instrument_ledger_id = t2.id |
| | | <where> |
| | | <!-- æ¥è¯¢æ¡ä»¶åä¸ --> |
| | | <if test="req.code != null and req.code != ''"> |
| | | AND t2.code LIKE CONCAT('%', #{req.code}, '%') |
| | | </if> |
| | | <if test="req.name != null and req.name != ''"> |
| | | AND t2.name LIKE CONCAT('%', #{req.name}, '%') |
| | | </if> |
| | | <if test="req.entryDate != null"> |
| | | AND t1.entry_date = DATE_FORMAT(#{req.entryDate},'%Y-%m-%d') |
| | | </if> |
| | | <if test="req.recordDate != null"> |
| | | AND t1.record_date = DATE_FORMAT(#{req.recordDate},'%Y-%m-%d') |
| | | </if> |
| | | </where> |
| | | ORDER BY t1.update_time DESC |
| | | </select> |
| | | <select id="list" resultType="com.ruoyi.measuringinstrumentledger.pojo.MeasuringInstrumentLedgerRecord"> |
| | | SELECT |
| | | t1.id, |
| | | t1.user_id, |
| | | t1.user_name, |
| | | t2.code, |
| | | t2.name, |
| | | t2.model, |
| | | t1.valid, |
| | | t1.record_date, |
| | | t1.entry_date |
| | | FROM |
| | | measuring_instrument_ledger_record t1 |
| | | left join measuring_instrument_ledger t2 on t1.measuring_instrument_ledger_id = t2.id |
| | | <where> |
| | | <!-- æ¥è¯¢æ¡ä»¶åä¸ --> |
| | | <if test="req.code != null and req.code != ''"> |
| | | AND t2.code LIKE CONCAT('%', #{req.code}, '%') |
| | | </if> |
| | | <if test="req.name != null and req.name != ''"> |
| | | AND t2.name LIKE CONCAT('%', #{req.name}, '%') |
| | | </if> |
| | | <if test="req.entryDate != null"> |
| | | AND t1.entry_date = DATE_FORMAT(#{req.entryDate},'%Y-%m-%d') |
| | | </if> |
| | | <if test="req.recordDate != null"> |
| | | AND t1.record_date = DATE_FORMAT(#{req.recordDate},'%Y-%m-%d') |
| | | </if> |
| | | </where> |
| | | ORDER BY t1.update_time DESC |
| | | </select> |
| | | </mapper> |