Merge remote-tracking branch 'origin/dev_New' into dev_New
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #产åéè´§å表 |
| | | drop table if exists purchase_return_orders; |
| | | create table purchase_return_orders |
| | | ( |
| | | id bigint auto_increment primary key, |
| | | no varchar(255) null comment 'éè´§åç¼å·', |
| | | return_type tinyint not null default 0 comment 'éè´§æ¹å¼ 0éè´§éæ¬¾ 1ææ¶', |
| | | supplier_id bigint not null default 0 comment 'ä¾åºåid', |
| | | project_id bigint not null default 0 comment '项ç®id', |
| | | project_phase tinyint not null default 0 comment '项ç®é¶æ®µ', |
| | | prepared_at datetime null comment 'å¶åæ¥æ', |
| | | prepared_user_id bigint not null default 0 comment 'å¶å人id', |
| | | return_user_id bigint not null default 0 comment 'éæäººid', |
| | | purchase_ledger_id bigint not null default 0 comment 'éè´è®¢åid', |
| | | total_discount_amount decimal(10, 2) null comment 'æ´åææ£é¢', |
| | | total_discount_rate decimal(10, 2) null comment 'æ´åææ£ç', |
| | | total_amount decimal(10,2) null comment 'æäº¤éé¢', |
| | | remark text null comment '夿³¨', |
| | | create_time datetime null comment 'å½å
¥æ¶é´', |
| | | update_time datetime null comment 'æ´æ°æ¶é´', |
| | | index idx_supplier_id (supplier_id), |
| | | index idx_purchase_ledger_id (purchase_ledger_id), |
| | | index idx_project_id (project_id) |
| | | ); |
| | | |
| | | #产åéè´§åä¸éè´äº§åå
³è表 |
| | | drop table if exists purchase_return_order_products; |
| | | create table purchase_return_order_products |
| | | ( |
| | | id bigint auto_increment primary key, |
| | | purchase_return_order_id bigint not null default 0 comment 'éè´§åid', |
| | | sales_ledger_product_id bigint not null default 0 comment 'éè´äº§åid', |
| | | create_time datetime null comment 'å½å
¥æ¶é´', |
| | | update_time datetime null comment 'æ´æ°æ¶é´', |
| | | index idx_purchase_return_order_id (purchase_return_order_id), |
| | | index idx_sales_ledger_product_id (sales_ledger_product_id) |
| | | ); |
| | |
| | | <tomcat.version>9.0.102</tomcat.version>
|
| | | <minio.version>8.4.3</minio.version>
|
| | | <okhttp.version>4.9.0</okhttp.version>
|
| | | <hutool.version>5.8.18</hutool.version>
|
| | | <logback.version>1.2.13</logback.version>
|
| | | <spring-security.version>5.7.12</spring-security.version>
|
| | | <spring-framework.version>5.3.39</spring-framework.version>
|
| | |
| | | <version>${getui-sdk.version}</version>
|
| | | <scope>compile</scope>
|
| | | </dependency>
|
| | | |
| | | <!--hutoolå·¥å
·å
-->
|
| | | <dependency>
|
| | | <groupId>cn.hutool</groupId>
|
| | | <artifactId>hutool-all</artifactId>
|
| | | <version>${hutool.version}</version>
|
| | | </dependency>
|
| | |
|
| | | <dependency>
|
| | | <groupId>cn.hutool</groupId>
|
| | | <artifactId>hutool-all</artifactId>
|
| | | <version>5.8.43</version>
|
| | | </dependency>
|
| | |
|
| | |
|
| | | </dependencies>
|
| | |
|
| | |
| | | .eq(SysNotice::getStatus,"1") |
| | | .lt(SysNotice::getCreateTime, LocalDateTime.now())); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import com.ruoyi.basic.dto.CustomerFollowUpFileDto; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | @PostMapping("/upload/{followUpId}") |
| | | @Log(title = "客æ·è·è¿-ä¸ä¼ éä»¶", businessType = BusinessType.INSERT) |
| | | public AjaxResult uploadFiles(@RequestParam("files") List<MultipartFile> files, @PathVariable Integer followUpId) { |
| | | customerFollowUpService.addFollowUpFiles(files, followUpId); |
| | | return AjaxResult.success(); |
| | | return AjaxResult.success(customerFollowUpService.addFollowUpFiles(files, followUpId)); |
| | | } |
| | | |
| | | /** |
| | | * ä¸ä¼ è·è¿éä»¶ï¼å¤ç¨ï¼æ IDï¼ |
| | | */ |
| | | @ApiOperation("ä¸ä¼ éä»¶(å¤ç¨)") |
| | | @PostMapping("/upload") |
| | | @Log(title = "ä¸ä¼ éä»¶(å¤ç¨)", businessType = BusinessType.INSERT) |
| | | public AjaxResult uploadFiles(@RequestParam("files") List<MultipartFile> files, @RequestParam(required = false) String name) { |
| | | List<CustomerFollowUpFileDto> uploadedFiles = customerFollowUpService.addFollowUpFiles(files, null); |
| | | return AjaxResult.success(uploadedFiles); |
| | | } |
| | | |
| | | /** |
| | | * æ¹éæ¥è¯¢éä»¶å表 |
| | | */ |
| | | @ApiOperation("æ¹éæ¥è¯¢éä»¶å表") |
| | | @PostMapping("/file/list") |
| | | public AjaxResult getFileList(@RequestBody List<Long> ids) { |
| | | return AjaxResult.success(customerFollowUpService.getFollowUpFilesByIds(ids)); |
| | | } |
| | | |
| | | /** |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.basic.dto; |
| | | |
| | | import com.ruoyi.basic.pojo.CustomerFollowUpFile; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * 客æ·è·è¿éä»¶DTO |
| | | * |
| | | * @author deslrey |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | public class CustomerFollowUpFileDto extends CustomerFollowUpFile { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * ä¸ä¼ è
å§å |
| | | */ |
| | | private String createUserName; |
| | | |
| | | /** |
| | | * ä¿®æ¹è
å§å |
| | | */ |
| | | private String updateUserName; |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.basic.pojo.CustomerFollowUpFile; |
| | | import com.ruoyi.common.vo.SimpleFileVo; |
| | | |
| | | import javax.annotation.Nullable; |
| | | import javax.validation.constraints.NotNull; |
| | | import javax.validation.constraints.Null; |
| | | import java.util.List; |
| | | import java.util.function.BiConsumer; |
| | | import java.util.function.Function; |
| | | |
| | | /** |
| | | * <br> |
| | |
| | | * @since 2026/03/04 14:52 |
| | | */ |
| | | public interface CustomerFollowUpFileService extends IService<CustomerFollowUpFile> { |
| | | |
| | | /** |
| | | * æ ¹æ® xx,xxx,xxæ¹éæ¥è¯¢å¹¶ä¸åºæå
¥SimpleFileVoè¿å
¥ |
| | | * @param list |
| | | * @param getAttachmentIds |
| | | * @param setAttachmentList |
| | | * @param <T> |
| | | */ |
| | | <T> void fillAttachment( |
| | | @Nullable List<T> list, |
| | | @NotNull Function<T, String> getAttachmentIds, |
| | | @NotNull BiConsumer<T, List<SimpleFileVo>> setAttachmentList |
| | | ); |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.basic.dto.CustomerFollowUpDto; |
| | | import com.ruoyi.basic.pojo.CustomerFollowUp; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import com.ruoyi.basic.dto.CustomerFollowUpFileDto; |
| | | import com.ruoyi.basic.pojo.CustomerFollowUpFile; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | /** |
| | | * æ·»å è·è¿éä»¶ |
| | | */ |
| | | void addFollowUpFiles(List<MultipartFile> files, Integer followUpId); |
| | | List<CustomerFollowUpFileDto> addFollowUpFiles(List<MultipartFile> files, Integer followUpId); |
| | | |
| | | /** |
| | | * å é¤è·è¿éä»¶ |
| | |
| | | void deleteFollowUpFile(Integer fileId); |
| | | |
| | | /** |
| | | * æ ¹æ®éä»¶IDéåè·åéä»¶å表 |
| | | */ |
| | | List<CustomerFollowUpFile> getFollowUpFilesByIds(Collection<Long> fileIds); |
| | | |
| | | /** |
| | | * è·åè·è¿è¯¦æ
|
| | | */ |
| | | CustomerFollowUpDto getFollowUpWithFiles(Integer id); |
| | |
| | | package com.ruoyi.basic.service.impl; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.stream.CollectorUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.google.common.collect.Lists; |
| | | import com.ruoyi.basic.mapper.CustomerFollowUpFileMapper; |
| | | import com.ruoyi.basic.pojo.CustomerFollowUpFile; |
| | | import com.ruoyi.basic.service.CustomerFollowUpFileService; |
| | | import com.ruoyi.basic.service.CustomerFollowUpService; |
| | | import com.ruoyi.common.vo.SimpleFileVo; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.*; |
| | | import java.util.function.BiConsumer; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <br> |
| | |
| | | * @since 2026/03/04 14:53 |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class CustomerFollowUpFileServiceImpl extends ServiceImpl<CustomerFollowUpFileMapper, CustomerFollowUpFile> implements CustomerFollowUpFileService { |
| | | |
| | | private final CustomerFollowUpService customerFollowUpService; |
| | | |
| | | |
| | | @Override |
| | | public <T> void fillAttachment(List<T> list, Function<T, String> getAttachmentIds, BiConsumer<T, List<SimpleFileVo>> setAttachmentList) { |
| | | if (CollUtil.isEmpty(list)) { |
| | | return; |
| | | } |
| | | // æ¶éæææä»¶ID |
| | | Set<Long> ids = list.stream() |
| | | .map(getAttachmentIds) |
| | | .filter(StrUtil::isNotBlank) |
| | | .flatMap(s -> Arrays.stream(s.split(","))) |
| | | .map(Long::valueOf) |
| | | .collect(Collectors.toSet()); |
| | | List<CustomerFollowUpFile> followUpFilesByIds = new ArrayList<>(); |
| | | Lists.partition(Lists.newArrayList(ids), 999).forEach(it -> { |
| | | followUpFilesByIds.addAll( |
| | | customerFollowUpService.getFollowUpFilesByIds(it) |
| | | ); |
| | | }); |
| | | if (CollUtil.isEmpty(followUpFilesByIds)) { |
| | | return; |
| | | } |
| | | Map<Long, SimpleFileVo> collectMap = followUpFilesByIds.stream().map(SimpleFileVo::convert).collect(Collectors.toMap( |
| | | SimpleFileVo::getId, |
| | | Function.identity() |
| | | )); |
| | | list.forEach(t -> { |
| | | String attachmentIds = getAttachmentIds.apply(t); |
| | | if (StrUtil.isNotBlank(attachmentIds)) { |
| | | List<SimpleFileVo> fileVos = Arrays.stream(attachmentIds.split(",")) |
| | | .map(Long::valueOf) |
| | | .map(it->collectMap.getOrDefault(it, (SimpleFileVo) Collections.emptyList())) |
| | | .collect(Collectors.toList()); |
| | | setAttachmentList.accept(t, fileVos); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.basic.pojo.CustomerFollowUpFile; |
| | | import com.ruoyi.basic.service.CustomerFollowUpFileService; |
| | | import com.ruoyi.basic.service.CustomerFollowUpService; |
| | | import com.ruoyi.basic.service.ICustomerService; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.basic.dto.CustomerFollowUpFileDto; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.service.ISysUserService; |
| | | |
| | | import org.apache.commons.io.FilenameUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | |
| | |
| | | |
| | | @Value("${file.upload-dir}") |
| | | private String uploadDir; |
| | | |
| | | @Autowired |
| | | private ISysUserService sysUserService; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void addFollowUpFiles(List<MultipartFile> files, Integer followUpId) { |
| | | handleFollowUpFiles(files, followUpId); |
| | | public List<CustomerFollowUpFileDto> addFollowUpFiles(List<MultipartFile> files, Integer followUpId) { |
| | | return handleFollowUpFiles(files, followUpId); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | } |
| | | |
| | | private void handleFollowUpFiles(List<MultipartFile> multipartFiles, Integer followUpId) { |
| | | @Override |
| | | public List<CustomerFollowUpFile> getFollowUpFilesByIds(Collection<Long> fileIds) { |
| | | if (fileIds == null || fileIds.isEmpty()) { |
| | | return new ArrayList<>(0); |
| | | } |
| | | |
| | | LambdaQueryWrapper<CustomerFollowUpFile> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.in(CustomerFollowUpFile::getId, fileIds) |
| | | .select(CustomerFollowUpFile::getId, CustomerFollowUpFile::getFileUrl, CustomerFollowUpFile::getFileName); |
| | | return customerFollowUpFileService.list(queryWrapper); |
| | | } |
| | | |
| | | private List<CustomerFollowUpFileDto> handleFollowUpFiles(List<MultipartFile> multipartFiles, Integer followUpId) { |
| | | List<CustomerFollowUpFile> fileList = new ArrayList<>(); |
| | | List<CustomerFollowUpFileDto> dtoList = new ArrayList<>(); |
| | | if (multipartFiles == null || multipartFiles.isEmpty()) { |
| | | return; |
| | | return dtoList; |
| | | } |
| | | |
| | | Long currentUserId = SecurityUtils.getUserId(); |
| | | Long currentTenantId = SecurityUtils.getLoginUser().getTenantId(); |
| | | List<CustomerFollowUpFile> fileList = new ArrayList<>(); |
| | | |
| | | for (MultipartFile file : multipartFiles) { |
| | | if (file == null || file.isEmpty()) { |
| | |
| | | |
| | | String originalFilename = file.getOriginalFilename(); |
| | | String fileExtension = FilenameUtils.getExtension(originalFilename); |
| | | String formalFilename = followUpId + "_" + |
| | | String prefix = (followUpId != null) ? followUpId.toString() : "temp"; |
| | | String formalFilename = prefix + "_" + |
| | | System.currentTimeMillis() + "_" + |
| | | UUID.randomUUID().toString().substring(0, 8) + |
| | | (StringUtils.hasText(fileExtension) ? "." + fileExtension : ""); |
| | |
| | | } |
| | | if (!fileList.isEmpty()) { |
| | | customerFollowUpFileService.saveBatch(fileList); |
| | | return convertToDtoList(fileList); |
| | | } |
| | | return dtoList; |
| | | } |
| | | |
| | | private List<CustomerFollowUpFileDto> convertToDtoList(List<CustomerFollowUpFile> fileList) { |
| | | List<CustomerFollowUpFileDto> dtoList = new ArrayList<>(); |
| | | if (fileList == null || fileList.isEmpty()) { |
| | | return dtoList; |
| | | } |
| | | for (CustomerFollowUpFile entity : fileList) { |
| | | CustomerFollowUpFileDto dto = new CustomerFollowUpFileDto(); |
| | | BeanUtils.copyProperties(entity, dto); |
| | | |
| | | if (entity.getCreateUser() != null) { |
| | | SysUser createUser = sysUserService.selectUserById(entity.getCreateUser()); |
| | | if (createUser != null) { |
| | | dto.setCreateUserName(createUser.getNickName()); |
| | | } |
| | | } |
| | | if (entity.getUpdateUser() != null) { |
| | | SysUser updateUser = sysUserService.selectUserById(entity.getUpdateUser()); |
| | | if (updateUser != null) { |
| | | dto.setUpdateUserName(updateUser.getNickName()); |
| | | } |
| | | } |
| | | dtoList.add(dto); |
| | | } |
| | | return dtoList; |
| | | } |
| | | |
| | | private void validateFollowUp(CustomerFollowUp followUp) { |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.enums; |
| | | |
| | | public enum ProcessType implements BaseEnum<Integer>{ |
| | | |
| | | TIMEKEEPING(1, "计æ¶"), |
| | | PIECERATE(2, "计件"); |
| | | |
| | | private final Integer code; |
| | | private final String value; |
| | | |
| | | ProcessType(Integer code, String value) { |
| | | this.code = code; |
| | | this.value = value; |
| | | } |
| | | |
| | | @Override |
| | | public Integer getCode() { |
| | | return this.code; |
| | | } |
| | | |
| | | @Override |
| | | public String getValue() { |
| | | return this.value; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.vo; |
| | | |
| | | import com.ruoyi.basic.pojo.CustomerFollowUpFile; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @author buhuazhen |
| | | * @date 2026/3/6 |
| | | * @email 3038525872@qq.com |
| | | */ |
| | | @Data |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | public class SimpleFileVo implements Serializable { |
| | | private Long id; |
| | | private String fileName; |
| | | private String fileUrl; |
| | | |
| | | public static SimpleFileVo convert(@NotNull CustomerFollowUpFile file){ |
| | | return new SimpleFileVo(file.getId(), file.getFileName(), file.getFileUrl()); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.ruoyi.procurementrecord.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.utils.OrderUtils; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.procurementrecord.dto.ReturnManagementDto; |
| | | import com.ruoyi.procurementrecord.mapper.ReturnManagementMapper; |
| | | import com.ruoyi.procurementrecord.pojo.ReturnManagement; |
| | | import com.ruoyi.procurementrecord.pojo.ReturnSaleProduct; |
| | | import com.ruoyi.procurementrecord.service.ReturnManagementService; |
| | | import com.ruoyi.procurementrecord.service.ReturnSaleProductService; |
| | | import com.ruoyi.procurementrecord.service.impl.ReturnSaleProductServiceImpl; |
| | | import com.ruoyi.sales.dto.SalesLedgerDto; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | * @date : 2025/9/17 10:34 |
| | | */ |
| | | @RestController |
| | | @Api(tags = "å°è´§ç®¡ç") |
| | | @Api(tags = "éå®éè´§") |
| | | @RequestMapping("/returnManagement") |
| | | public class ReturnManagementController extends BaseController { |
| | | |
| | | @Autowired |
| | | private ReturnManagementService returnManagementService; |
| | | |
| | | @Autowired |
| | | private ReturnManagementMapper returnManagementMapper; |
| | | private ReturnSaleProductService returnSaleProductService; |
| | | |
| | | @GetMapping("/listPage") |
| | | @ApiOperation("å°è´§ç®¡ç-æ¥è¯¢") |
| | | public AjaxResult listPage(Page page, ReturnManagement returnManagement) { |
| | | IPage<ReturnManagement> result = returnManagementService.listPage(page, returnManagement); |
| | | @ApiOperation("éå®éè´§-æ¥è¯¢") |
| | | public AjaxResult listPage(Page page, ReturnManagementDto returnManagement) { |
| | | IPage<ReturnManagementDto> result = returnManagementService.listPage(page, returnManagement); |
| | | return AjaxResult.success(result); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @ApiOperation("å°è´§ç®¡ç-æ·»å ") |
| | | @ApiOperation("éå®éè´§-æ·»å ") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult add(@RequestBody ReturnManagement returnManagement) { |
| | | String rt = OrderUtils.countTodayByCreateTime(returnManagementMapper, "RT"); |
| | | returnManagement.setReturnNo(rt); |
| | | boolean result = returnManagementService.save(returnManagement); |
| | | return result ? success() : error(); |
| | | public AjaxResult add(@RequestBody ReturnManagementDto returnManagementDto) { |
| | | return returnManagementService.addReturnManagementDto(returnManagementDto) ? success() : error(); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @ApiOperation("å°è´§ç®¡ç-ä¿®æ¹") |
| | | @ApiOperation("éå®éè´§-ä¿®æ¹") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult update(@RequestBody ReturnManagement returnManagement) { |
| | | boolean result = returnManagementService.updateById(returnManagement); |
| | | return result ? success() : error(); |
| | | public AjaxResult update(@RequestBody ReturnManagementDto returnManagementDto) { |
| | | return returnManagementService.updateReturnManagementDto(returnManagementDto) ? success() : error(); |
| | | } |
| | | |
| | | |
| | | @ApiOperation("éå®éè´§-å¤çéè´§å") |
| | | @GetMapping("/handle") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult handle(Long returnManagementId) { |
| | | return returnManagementService.handle(returnManagementId) ? success() : error(); |
| | | } |
| | | |
| | | |
| | | @DeleteMapping("/del") |
| | | @ApiOperation("å°è´§ç®¡ç-å é¤") |
| | | @ApiOperation("éå®éè´§-å é¤") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult del(@RequestBody List<Long> ids) { |
| | | if (CollectionUtils.isEmpty(ids)) return error("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | returnSaleProductService.remove(new QueryWrapper<ReturnSaleProduct>() |
| | | .lambda() |
| | | .in(ReturnSaleProduct::getReturnManagementId, ids)); |
| | | boolean result = returnManagementService.removeByIds(ids); |
| | | return result ? success() : error(); |
| | | } |
| | | |
| | | @GetMapping("/getById") |
| | | @ApiOperation("éå®éè´§-æ ¹æ®idæ¥è¯¢") |
| | | public AjaxResult getById(Long returnManagementId) { |
| | | ReturnManagementDto returnManagementDto = returnManagementService.getReturnManagementDtoById(returnManagementId); |
| | | return success(returnManagementDto); |
| | | } |
| | | |
| | | @GetMapping("/getByShippingId") |
| | | @ApiOperation("éå®éè´§-æ ¹æ®åºåºåæ¥è¯¢éå®è®¢å以å产åä¿¡æ¯") |
| | | public AjaxResult getByShippingId(Long shippingId) { |
| | | SalesLedgerDto salesLedgerDto = returnManagementService.getReturnManagementDtoByShippingIdId(shippingId); |
| | | return success(salesLedgerDto); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.procurementrecord.controller; |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * é货产å表 å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-03-05 03:57:42 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/returnSaleProduct") |
| | | public class ReturnSaleProductController { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.procurementrecord.dto; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.procurementrecord.pojo.ReturnManagement; |
| | | import com.ruoyi.procurementrecord.pojo.ReturnSaleProduct; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | 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.List; |
| | | |
| | | /** |
| | | * @author :yys |
| | | * @date : 2025/9/17 10:28 |
| | | */ |
| | | @Data |
| | | public class ReturnManagementDto extends ReturnManagement { |
| | | |
| | | |
| | | @ApiModelProperty(value = "客æ·åç§°") |
| | | private String customerName; |
| | | |
| | | @ApiModelProperty(value = "éå®åå·") |
| | | private String salesContractNo; |
| | | |
| | | @ApiModelProperty(value = "ä¸å¡å") |
| | | private String salesman; |
| | | |
| | | |
| | | @ApiModelProperty("å
³èåºåºåå·") |
| | | private String shippingNo; |
| | | |
| | | @ApiModelProperty(value = "项ç®åç§°") |
| | | private String projectName; |
| | | |
| | | @ApiModelProperty(value = "éå®å°è´¦id") |
| | | private Long salesLedgerId; |
| | | |
| | | @ApiModelProperty(value = "éå®äº§å对象æ°ç»") |
| | | private List<ReturnSaleProductDto> returnSaleProducts; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.procurementrecord.dto; |
| | | |
| | | import com.ruoyi.procurementrecord.pojo.ReturnSaleProduct; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | public class ReturnSaleProductDto extends ReturnSaleProduct { |
| | | |
| | | private String productName; |
| | | |
| | | private String model; |
| | | |
| | | private String unit; |
| | | |
| | | //æªéè´§æ°é |
| | | private BigDecimal unQuantity; |
| | | |
| | | private BigDecimal totalReturnNum; |
| | | } |
| | |
| | | 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.procurementrecord.dto.ReturnManagementDto; |
| | | import com.ruoyi.procurementrecord.pojo.ReturnManagement; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | * @param page |
| | | * @return |
| | | */ |
| | | IPage<ReturnManagement> listPage(Page page,@Param("req") ReturnManagement returnManagement); |
| | | IPage<ReturnManagementDto> listPage(Page page, @Param("req") ReturnManagementDto returnManagement); |
| | | |
| | | ReturnManagementDto getReturnManagementDtoById(Long id); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.procurementrecord.mapper; |
| | | |
| | | import com.ruoyi.procurementrecord.dto.ReturnSaleProductDto; |
| | | import com.ruoyi.procurementrecord.pojo.ReturnSaleProduct; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * é货产å表 Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-03-05 03:57:42 |
| | | */ |
| | | @Mapper |
| | | public interface ReturnSaleProductMapper extends BaseMapper<ReturnSaleProduct> { |
| | | |
| | | List<ReturnSaleProductDto> listReturnSaleProductDto(@Param("returnManagementId") Long returnManagementId); |
| | | } |
| | |
| | | @ApiModelProperty(value = "éè´§åå·") |
| | | private String returnNo; |
| | | |
| | | @ApiModelProperty(value = "å
³èåå·") |
| | | private String relatedNo; |
| | | @ApiModelProperty("客æ·id") |
| | | private Long customerId; |
| | | |
| | | @ApiModelProperty(value = "éè´§ç±»å") |
| | | private String returnType; |
| | | @ApiModelProperty("å
³èåºåºåå·Id") |
| | | private Long shippingId; |
| | | |
| | | @ApiModelProperty(value = "ä¾åºååç§°") |
| | | private String supplierName; |
| | | @ApiModelProperty("项ç®id") |
| | | private Long projectId; |
| | | |
| | | @ApiModelProperty(value = "éè´§åå ") |
| | | private String returnReason; |
| | | @ApiModelProperty("项ç®é¶æ®µ") |
| | | private String projectStage; |
| | | |
| | | @ApiModelProperty(value = "éè´§ç¶æ") |
| | | private String status; |
| | | @ApiModelProperty("å¶å人") |
| | | private String maker; |
| | | |
| | | @ApiModelProperty(value = "夿³¨") |
| | | private String remark; |
| | | |
| | | @ApiModelProperty(value = "å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @ApiModelProperty("å¶åæ¶é´") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime makeTime; |
| | | |
| | | @ApiModelProperty("ç»ç®äºº") |
| | | private String settler; |
| | | |
| | | @ApiModelProperty("ç¶æ") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty("å建æ¶é´") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "åå»ºç¨æ·") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | @ApiModelProperty(value = "ä¿®æ¹æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | @ApiModelProperty("æ´æ°æ¶é´") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty(value = "ä¿®æ¹ç¨æ·") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | |
| | | @ApiModelProperty(value = "ç§æ·ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.procurementrecord.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * <p> |
| | | * é货产å表 |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-03-05 03:57:42 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @TableName("return_sale_product") |
| | | @ApiModel(value = "ReturnSaleProduct对象", description = "é货产å表") |
| | | public class ReturnSaleProduct implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty("主é®id") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("éè´§åid") |
| | | private Long returnManagementId; |
| | | |
| | | @ApiModelProperty("é货产åid") |
| | | private Long returnSaleLedgerProductId; |
| | | |
| | | @ApiModelProperty("éè´§äº§åæ°é") |
| | | private BigDecimal num; |
| | | |
| | | @ApiModelProperty("éè´§ç¶æ 0 æªéå 1å·²éè´§") |
| | | private Integer status; |
| | | } |
| | |
| | | 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.procurementrecord.dto.ReturnManagementDto; |
| | | import com.ruoyi.procurementrecord.pojo.ReturnManagement; |
| | | import com.ruoyi.sales.dto.SalesLedgerDto; |
| | | |
| | | /** |
| | | * @author :yys |
| | |
| | | * @param returnManagement |
| | | * @return |
| | | */ |
| | | IPage<ReturnManagement> listPage(Page page, ReturnManagement returnManagement); |
| | | IPage<ReturnManagementDto> listPage(Page page, ReturnManagementDto returnManagement); |
| | | |
| | | boolean addReturnManagementDto(ReturnManagementDto returnManagementDto); |
| | | |
| | | boolean updateReturnManagementDto(ReturnManagementDto returnManagementDto); |
| | | |
| | | SalesLedgerDto getReturnManagementDtoByShippingIdId(Long shippingId); |
| | | |
| | | boolean handle(Long returnManagementId); |
| | | |
| | | ReturnManagementDto getReturnManagementDtoById(Long returnManagementId); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.procurementrecord.service; |
| | | |
| | | import com.ruoyi.procurementrecord.dto.ReturnSaleProductDto; |
| | | import com.ruoyi.procurementrecord.pojo.ReturnSaleProduct; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * é货产å表 æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-03-05 03:57:42 |
| | | */ |
| | | public interface ReturnSaleProductService extends IService<ReturnSaleProduct> { |
| | | |
| | | List<ReturnSaleProductDto> listReturnSaleProductDto(Long returnManagementId); |
| | | } |
| | |
| | | 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.utils.OrderUtils; |
| | | import com.ruoyi.procurementrecord.dto.ReturnManagementDto; |
| | | import com.ruoyi.procurementrecord.mapper.ReturnManagementMapper; |
| | | import com.ruoyi.procurementrecord.pojo.ReturnManagement; |
| | | import com.ruoyi.procurementrecord.pojo.ReturnSaleProduct; |
| | | import com.ruoyi.procurementrecord.service.ReturnManagementService; |
| | | import com.ruoyi.procurementrecord.service.ReturnSaleProductService; |
| | | import com.ruoyi.sales.dto.SalesLedgerDto; |
| | | import com.ruoyi.sales.dto.SalesLedgerProductDto; |
| | | import com.ruoyi.sales.mapper.SalesLedgerMapper; |
| | | import com.ruoyi.sales.pojo.SalesLedger; |
| | | import com.ruoyi.sales.pojo.ShippingInfo; |
| | | import com.ruoyi.sales.service.ShippingInfoService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author :yys |
| | |
| | | @Autowired |
| | | private ReturnManagementMapper returnManagementMapper; |
| | | |
| | | @Autowired |
| | | private ReturnSaleProductService returnSaleProductService; |
| | | @Autowired |
| | | private ShippingInfoService shippingInfoService; |
| | | @Autowired |
| | | private SalesLedgerMapper salesLedgerMapper; |
| | | |
| | | @Override |
| | | public IPage<ReturnManagement> listPage(Page page, ReturnManagement returnManagement) { |
| | | IPage<ReturnManagement> returnManagementIPage = returnManagementMapper.listPage(page, returnManagement); |
| | | public IPage<ReturnManagementDto> listPage(Page page, ReturnManagementDto returnManagement) { |
| | | IPage<ReturnManagementDto> returnManagementIPage = returnManagementMapper.listPage(page, returnManagement); |
| | | return returnManagementIPage; |
| | | } |
| | | |
| | | @Override |
| | | public boolean addReturnManagementDto(ReturnManagementDto returnManagementDto) { |
| | | String rt = OrderUtils.countTodayByCreateTime(returnManagementMapper, "RT"); |
| | | returnManagementDto.setReturnNo(rt); |
| | | save(returnManagementDto); |
| | | for (ReturnSaleProduct returnSaleProduct : returnManagementDto.getReturnSaleProducts()) { |
| | | returnSaleProduct.setReturnManagementId(returnManagementDto.getId()); |
| | | returnSaleProduct.setStatus(0); |
| | | returnSaleProductService.save(returnSaleProduct); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public boolean updateReturnManagementDto(ReturnManagementDto returnManagementDto) { |
| | | List<ReturnSaleProduct> returnSaleProducts = new ArrayList<>(); |
| | | if (!CollectionUtils.isEmpty(returnManagementDto.getReturnSaleProducts())) { |
| | | returnManagementDto.getReturnSaleProducts().stream().forEach(returnSaleProductDto -> { |
| | | ReturnSaleProduct returnSaleProduct = new ReturnSaleProduct(); |
| | | BeanUtils.copyProperties(returnSaleProductDto, returnSaleProduct); |
| | | returnSaleProducts.add(returnSaleProduct); |
| | | }); |
| | | } |
| | | returnSaleProductService.updateBatchById(returnSaleProducts); |
| | | return updateById(returnManagementDto); |
| | | } |
| | | |
| | | @Override |
| | | public SalesLedgerDto getReturnManagementDtoByShippingIdId(Long shippingId) { |
| | | ShippingInfo byId = shippingInfoService.getById(shippingId); |
| | | SalesLedger salesLedger = salesLedgerMapper.selectById(byId.getSalesLedgerId()); |
| | | SalesLedgerDto salesLedgerDto = new SalesLedgerDto(); |
| | | BeanUtils.copyProperties(salesLedger, salesLedgerDto); |
| | | |
| | | List<SalesLedgerProductDto> salesLedgerProductDtos = shippingInfoService.getReturnManagementDtoById(byId.getId()); |
| | | salesLedgerDto.setProductDtoData(salesLedgerProductDtos); |
| | | return salesLedgerDto; |
| | | } |
| | | |
| | | @Override |
| | | public boolean handle(Long returnManagementId) { |
| | | ReturnManagement byId = this.getById(returnManagementId); |
| | | byId.setStatus(1); |
| | | updateById(byId); |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public ReturnManagementDto getReturnManagementDtoById(Long returnManagementId) { |
| | | ReturnManagementDto returnManagementDtoById = returnManagementMapper.getReturnManagementDtoById(returnManagementId); |
| | | returnManagementDtoById.setReturnSaleProducts(returnSaleProductService.listReturnSaleProductDto(returnManagementId)); |
| | | return returnManagementDtoById; |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.procurementrecord.service.impl; |
| | | |
| | | import com.ruoyi.procurementrecord.dto.ReturnSaleProductDto; |
| | | import com.ruoyi.procurementrecord.pojo.ReturnSaleProduct; |
| | | import com.ruoyi.procurementrecord.mapper.ReturnSaleProductMapper; |
| | | import com.ruoyi.procurementrecord.service.ReturnSaleProductService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * é货产å表 æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-03-05 03:57:42 |
| | | */ |
| | | @Service |
| | | public class ReturnSaleProductServiceImpl extends ServiceImpl<ReturnSaleProductMapper, ReturnSaleProduct> implements ReturnSaleProductService { |
| | | |
| | | @Autowired |
| | | private ReturnSaleProductMapper returnSaleProductMapper; |
| | | @Override |
| | | public List<ReturnSaleProductDto> listReturnSaleProductDto(Long returnManagementId) { |
| | | |
| | | return returnSaleProductMapper.listReturnSaleProductDto(returnManagementId); |
| | | } |
| | | } |
| | |
| | | @TableField(updateStrategy = FieldStrategy.IGNORED) |
| | | private BigDecimal salaryQuota; |
| | | |
| | | @ApiModelProperty("ç±»å åºåæ¯è®¡æ¶è¿æ¯è®¡ä»¶ 0 è®¡æ¶ 1计件") |
| | | private Long type; |
| | | |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | |
| | | } |
| | | } |
| | | productOrderMapper.updateById(productOrder); |
| | | /*æ·»å çäº§æ ¸ç®*/ |
| | | /*æ·»å çäº§æ ¸ç® åºåå·¥åºæ¯è®¡ä»¶è¿æ¯è®¡æ¶*/ |
| | | BigDecimal workHours = (productProcess.getType() == 1) |
| | | ? productProcess.getSalaryQuota().multiply(productQty) |
| | | : productProcess.getSalaryQuota(); |
| | | |
| | | SalesLedgerProductionAccounting salesLedgerProductionAccounting = SalesLedgerProductionAccounting.builder() |
| | | .productMainId(productionProductMain.getId()) |
| | | .schedulingUserId(user.getUserId()) |
| | | .schedulingUserName(user.getNickName()) |
| | | .finishedNum(productQty) |
| | | .workHours(productProcess.getSalaryQuota()) |
| | | .workHours(workHours) |
| | | .process(productProcess.getName()) |
| | | .schedulingDate(LocalDate.now()) |
| | | .tenantId(dto.getTenantId()) |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.projectManagement.controller; |
| | | |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.projectManagement.service.PlanService; |
| | | import com.ruoyi.projectManagement.vo.SavePlanNodeVo; |
| | | import com.ruoyi.projectManagement.vo.SavePlanVo; |
| | | import com.ruoyi.projectManagement.vo.SearchPlanVo; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | |
| | | /** |
| | | * @author buhuazhen |
| | | * @date 2026/3/7 |
| | | * @email 3038525872@qq.com |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/projectManagement/plan") |
| | | @Api(value = "PlanController", tags = "项ç®ç®¡ç计å表(项ç®ç®¡çç±»å)") |
| | | @RequiredArgsConstructor |
| | | public class PlanController { |
| | | |
| | | private final PlanService planService; |
| | | |
| | | @PostMapping("/save") |
| | | @ApiOperation("ä¿å") |
| | | public AjaxResult save(@RequestBody @Valid SavePlanVo savePlanVo) { |
| | | planService.savePlan(savePlanVo); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @PostMapping("/delete/{id}") |
| | | @ApiOperation("å é¤") |
| | | public AjaxResult delete(@PathVariable Long id) { |
| | | planService.deletePlan(id); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @PostMapping("/listPage") |
| | | @ApiOperation("å页å表") |
| | | public AjaxResult listPage(@RequestBody SearchPlanVo searchPlanVo) { |
| | | return AjaxResult.success(planService.searchPlan(searchPlanVo)); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.projectManagement.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.ruoyi.projectManagement.pojo.Plan; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.projectManagement.vo.SearchPlanVo; |
| | | |
| | | /** |
| | | * @author buhuazhen |
| | | * @description é对表ãproject_management_plan(项ç®ç®¡ç计å表(项ç®ç®¡çç±»å))ãçæ°æ®åºæä½Mapper |
| | | * @createDate 2026-03-06 15:29:26 |
| | | * @Entity generator.domain.ProjectManagementPlan |
| | | */ |
| | | public interface PlanMapper extends BaseMapper<Plan> { |
| | | |
| | | IPage<Plan> selectPlanPage(SearchPlanVo searchPlanVo); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.projectManagement.mapper; |
| | | |
| | | import com.ruoyi.projectManagement.pojo.PlanNode; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * @author buhuazhen |
| | | * @description é对表ãproject_management_plan_node(计åèç¹)ãçæ°æ®åºæä½Mapper |
| | | * @createDate 2026-03-06 17:05:38 |
| | | * @Entity generator.domain.ProjectManagementPlanNode |
| | | */ |
| | | public interface PlanNodeMapper extends BaseMapper<PlanNode> { |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.projectManagement.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import java.time.LocalDateTime; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 项ç®ç®¡ç计å表(项ç®ç®¡çç±»å) |
| | | * @TableName project_management_plan |
| | | */ |
| | | @TableName(value ="project_management_plan") |
| | | @Data |
| | | @ApiModel(description="项ç®ç®¡ç计å表(项ç®ç®¡çç±»å)") |
| | | public class Plan { |
| | | /** |
| | | * |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @ApiModelProperty(value="主é®ID") |
| | | private Long id; |
| | | |
| | | /** |
| | | * 计ååç§° |
| | | */ |
| | | @TableField(value = "name") |
| | | @ApiModelProperty(value="计ååç§°") |
| | | private String name; |
| | | |
| | | /** |
| | | * 计åæè¿° |
| | | */ |
| | | @TableField(value = "description") |
| | | @ApiModelProperty(value="计åæè¿°") |
| | | private String description; |
| | | |
| | | /** |
| | | * éä»¶ ,è¿è¡åå² |
| | | */ |
| | | @TableField(value = "attachment") |
| | | @ApiModelProperty(value="éä»¶") |
| | | private String attachment; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @TableField(value = "is_delete") |
| | | @ApiModelProperty(value="æ¯å¦å é¤") |
| | | private Integer isDelete; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @TableField(value = "create_time",fill = FieldFill.INSERT) |
| | | @ApiModelProperty(value="å建æ¶é´") |
| | | private LocalDateTime createTime; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @TableField(value = "update_time",fill = FieldFill.INSERT_UPDATE) |
| | | @ApiModelProperty(value="æ´æ°æ¶é´") |
| | | private LocalDateTime updateTime; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @TableField(value = "create_user",fill = FieldFill.INSERT) |
| | | @ApiModelProperty(value="å建人") |
| | | private Integer createUser; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @TableField(value = "update_user",fill = FieldFill.INSERT_UPDATE) |
| | | @ApiModelProperty(value="æ´æ°äºº") |
| | | private Integer updateUser; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.projectManagement.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 计åèç¹ |
| | | * @TableName project_management_plan_node |
| | | */ |
| | | @TableName(value ="project_management_plan_node") |
| | | @Data |
| | | public class PlanNode implements Serializable { |
| | | /** |
| | | * |
| | | */ |
| | | @TableId(type = IdType.AUTO) |
| | | @TableField(value = "id") |
| | | private Long id; |
| | | |
| | | /** |
| | | * 对åºid |
| | | */ |
| | | @TableField(value = "project_management_plan_id") |
| | | private Long projectManagementPlanId; |
| | | |
| | | /** |
| | | * æåº |
| | | */ |
| | | @TableField(value = "sort") |
| | | private Integer sort; |
| | | |
| | | /** |
| | | * é¶æ®µåç§° |
| | | */ |
| | | @TableField(value = "name") |
| | | private String name; |
| | | |
| | | /** |
| | | * è´è´£ä»»ID |
| | | */ |
| | | @TableField(value = "leader_id") |
| | | private Long leaderId; |
| | | |
| | | /** |
| | | * è´è´£ä»»åç§° |
| | | */ |
| | | @TableField(value = "leader_name") |
| | | private String leaderName; |
| | | |
| | | /** |
| | | * é¢è®¡å·¥æ(天) |
| | | */ |
| | | @TableField(value = "estimated_duration") |
| | | private Integer estimatedDuration; |
| | | |
| | | /** |
| | | * 工价 |
| | | */ |
| | | @TableField(value = "hourly_rate") |
| | | private String hourlyRate; |
| | | |
| | | /** |
| | | * ä½ä¸å
容 |
| | | */ |
| | | @TableField(value = "work_content") |
| | | private String workContent; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @TableField(value = "is_delete") |
| | | private Integer isDelete; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @TableField(value = "create_time",fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @TableField(value = "update_time",fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @TableField(value = "create_user",fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | @TableField(value = "update_user",fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | |
| | | @TableField(exist = false) |
| | | private static final long serialVersionUID = 1L; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.projectManagement.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.ruoyi.projectManagement.pojo.Plan; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.projectManagement.vo.PlanVo; |
| | | import com.ruoyi.projectManagement.vo.SavePlanNodeVo; |
| | | import com.ruoyi.projectManagement.vo.SavePlanVo; |
| | | import com.ruoyi.projectManagement.vo.SearchPlanVo; |
| | | |
| | | import javax.annotation.Nullable; |
| | | import javax.validation.constraints.NotNull; |
| | | import javax.validation.constraints.Null; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author buhuazhen |
| | | * @description é对表ãproject_management_plan(项ç®ç®¡ç计å表(项ç®ç®¡çç±»å))ãçæ°æ®åºæä½Service |
| | | * @createDate 2026-03-06 15:29:26 |
| | | */ |
| | | public interface PlanService{ |
| | | |
| | | /** |
| | | * ä¿å项ç®ç®¡ç计å |
| | | * @param savePlanVo |
| | | */ |
| | | void savePlan(@NotNull SavePlanVo savePlanVo); |
| | | |
| | | /** |
| | | * ä¿å计åèç¹ |
| | | * @param planId |
| | | * @param savePlanNodeVos |
| | | */ |
| | | void savePlanNode(@NotNull Long planId,@Nullable List<SavePlanNodeVo> savePlanNodeVos); |
| | | |
| | | /** |
| | | * å é¤é¡¹ç®ç®¡ç计å |
| | | * @param id |
| | | */ |
| | | void deletePlan(@NotNull Long id); |
| | | |
| | | void deletePlanNode(@Nullable List<Long> ids); |
| | | |
| | | IPage<PlanVo> searchPlan(@NotNull SearchPlanVo searchPlanVo); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.projectManagement.service.impl; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.lang.Assert; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.ruoyi.basic.service.CustomerFollowUpFileService; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.projectManagement.mapper.PlanMapper; |
| | | import com.ruoyi.projectManagement.mapper.PlanNodeMapper; |
| | | import com.ruoyi.projectManagement.pojo.Plan; |
| | | import com.ruoyi.projectManagement.pojo.PlanNode; |
| | | import com.ruoyi.projectManagement.service.PlanService; |
| | | import com.ruoyi.projectManagement.vo.*; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.jetbrains.annotations.Nullable; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.IntStream; |
| | | |
| | | /** |
| | | * @author buhuazhen |
| | | * @description 项ç®ç®¡ç计åçå®ç° |
| | | * @createDate 2026-03-06 15:29:26 |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | @Transactional(readOnly = true) |
| | | public class PlanServiceImpl implements PlanService { |
| | | |
| | | private final PlanMapper planMapper; |
| | | |
| | | private final CustomerFollowUpFileService customerFollowUpFileService; |
| | | |
| | | private final PlanNodeMapper planNodeMapper; |
| | | |
| | | @Lazy |
| | | @Autowired |
| | | private PlanService planService; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void savePlan(SavePlanVo savePlanVo) { |
| | | Plan plan = BeanUtil.copyProperties(savePlanVo, Plan.class); |
| | | // éä»¶å¤ç , æ¼æ¥ |
| | | String attachments = String.join(",", Optional.ofNullable(savePlanVo.getAttachmentIds()).orElse(Collections.emptyList())); |
| | | plan.setAttachment(attachments); |
| | | if (savePlanVo.getId() == null) { |
| | | planMapper.insert(plan); |
| | | } else { |
| | | planMapper.updateById(plan); |
| | | } |
| | | planService.savePlanNode(plan.getId(), savePlanVo.getSavePlanNodeList()); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void savePlanNode(Long planId, @Nullable List<SavePlanNodeVo> savePlanNodeVos) { |
| | | Assert.notNull(planId, () -> new ServiceException("计åIDä¸è½ä¸ºç©º")); |
| | | if (CollUtil.isEmpty(savePlanNodeVos)) { |
| | | return; |
| | | } |
| | | |
| | | // å é¤å¤ä½èç¹ |
| | | List<Long> existNodeIds = savePlanNodeVos.stream().map(SavePlanNodeVo::getId).filter(Objects::nonNull).collect(Collectors.toList()); |
| | | LambdaQueryWrapper<PlanNode> planNodeLambdaQueryWrapper = new LambdaQueryWrapper<PlanNode>() |
| | | .select(PlanNode::getId) |
| | | .eq(PlanNode::getProjectManagementPlanId, planId); |
| | | if(CollUtil.isNotEmpty(existNodeIds)){ |
| | | planNodeLambdaQueryWrapper.notIn(PlanNode::getId, existNodeIds); |
| | | } |
| | | List<PlanNode> needDeleteNode = planNodeMapper.selectList(planNodeLambdaQueryWrapper); |
| | | |
| | | deletePlanNode(needDeleteNode.stream().map(PlanNode::getId).collect(Collectors.toList())); |
| | | |
| | | List<PlanNode> planNodes = BeanUtil.copyToList(savePlanNodeVos, PlanNode.class); |
| | | // 设置æåºç´¢å¼ |
| | | IntStream.range(0, savePlanNodeVos.size()).forEach(i -> { |
| | | planNodes.get(i).setSort(i); |
| | | planNodes.get(i).setProjectManagementPlanId(planId); |
| | | if (planNodes.get(i).getId() == null) { |
| | | planNodeMapper.insert(planNodes.get(i)); |
| | | } else { |
| | | planNodeMapper.updateById(planNodes.get(i)); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | private List<PlanNode> getPlanNodeByPlanId(Long planId) { |
| | | return planNodeMapper.selectList(new LambdaQueryWrapper<PlanNode>() |
| | | .eq(PlanNode::getIsDelete, 0) |
| | | .eq(PlanNode::getProjectManagementPlanId, planId)); |
| | | } |
| | | |
| | | private List<PlanNode> getPlanNodeByPlanIds(List<Long> planIds) { |
| | | return planNodeMapper.selectList(new LambdaQueryWrapper<PlanNode>() |
| | | .eq(PlanNode::getIsDelete, 0) |
| | | .in(PlanNode::getProjectManagementPlanId, planIds)); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void deletePlan(Long id) { |
| | | planMapper.update(null, |
| | | new LambdaUpdateWrapper<Plan>() |
| | | .eq(Plan::getId, id) |
| | | .set(Plan::getIsDelete, 1)); |
| | | planService.deletePlanNode(getPlanNodeByPlanId(id).stream().map(PlanNode::getId).collect(Collectors.toList())); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void deletePlanNode(List<Long> ids) { |
| | | if (CollUtil.isNotEmpty(ids)) { |
| | | planNodeMapper.update(null, |
| | | new LambdaUpdateWrapper<PlanNode>() |
| | | .in(PlanNode::getId, ids) |
| | | .set(PlanNode::getIsDelete, 1)); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public IPage<PlanVo> searchPlan(SearchPlanVo searchPlanVo) { |
| | | IPage<Plan> planIPage = planMapper.selectPlanPage(searchPlanVo); |
| | | IPage<PlanVo> resultPage = planIPage.convert(plan -> BeanUtil.copyProperties(plan, PlanVo.class)); |
| | | // æä»¶è·å |
| | | customerFollowUpFileService.fillAttachment(resultPage.getRecords(), PlanVo::getAttachment, PlanVo::setAttachmentList); |
| | | Map<Long, List<PlanNodeVo>> collect = getPlanNodeByPlanIds(resultPage.getRecords().stream().map(PlanVo::getId).collect(Collectors.toList())) |
| | | .stream() |
| | | .map(it -> BeanUtil.copyProperties(it, PlanNodeVo.class)) |
| | | .collect(Collectors.groupingBy(PlanNodeVo::getProjectManagementPlanId, Collectors.toList())); |
| | | resultPage.getRecords().forEach(planVo -> planVo.setPlanNodeList(collect.getOrDefault(planVo.getId(), Collections.emptyList()))); |
| | | return resultPage; |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.projectManagement.vo; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @author buhuazhen |
| | | * @date 2026/3/7 |
| | | * @email 3038525872@qq.com |
| | | */ |
| | | @Data |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | public class PlanNodeVo implements Serializable { |
| | | private Long id; |
| | | |
| | | private Long projectManagementPlanId; |
| | | |
| | | private Integer sort; |
| | | |
| | | private String name; |
| | | |
| | | private Long leaderId; |
| | | |
| | | private String leaderName; |
| | | |
| | | private Integer estimatedDuration; |
| | | |
| | | private String hourlyRate; |
| | | |
| | | private String workContent; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.projectManagement.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.fasterxml.jackson.annotation.JsonIgnore; |
| | | import com.ruoyi.common.vo.SimpleFileVo; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 计åVO |
| | | * @author buhuazhen |
| | | * @date 2026/3/6 |
| | | * @email 3038525872@qq.com |
| | | */ |
| | | @Data |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | public class PlanVo implements Serializable { |
| | | |
| | | private Long id; |
| | | |
| | | private String name; |
| | | |
| | | private String description; |
| | | |
| | | // éä»¶ |
| | | private List<SimpleFileVo> attachmentList; |
| | | |
| | | @JsonIgnore |
| | | private String attachment; |
| | | |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime createTime; |
| | | |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime updateTime; |
| | | |
| | | private List<PlanNodeVo> planNodeList; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.projectManagement.vo; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @author buhuazhen |
| | | * @date 2026/3/7 |
| | | * @email 3038525872@qq.com |
| | | */ |
| | | @Data |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | public class SavePlanNodeVo implements Serializable { |
| | | private Long id; |
| | | |
| | | private Long projectManagementPlanId; |
| | | |
| | | private Integer sort; |
| | | |
| | | @NotBlank |
| | | private String name; |
| | | |
| | | @NotNull |
| | | private Long leaderId; |
| | | |
| | | @NotBlank |
| | | private String leaderName; |
| | | |
| | | private Integer estimatedDuration; |
| | | |
| | | private String hourlyRate; |
| | | |
| | | private String workContent; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.projectManagement.vo; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | import javax.validation.Valid; |
| | | import javax.validation.constraints.NotBlank; |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author buhuazhen |
| | | * @date 2026/3/6 |
| | | * @email 3038525872@qq.com |
| | | */ |
| | | @Data |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | public class SavePlanVo implements Serializable { |
| | | |
| | | private Long id; |
| | | @NotBlank |
| | | private String name; |
| | | @NotBlank |
| | | private String description; |
| | | |
| | | private List<String> attachmentIds; |
| | | |
| | | @Valid |
| | | private List<SavePlanNodeVo> savePlanNodeList; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.projectManagement.vo; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @author buhuazhen |
| | | * @date 2026/3/6 |
| | | * @email 3038525872@qq.com |
| | | */ |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Data |
| | | @AllArgsConstructor |
| | | public class SearchPlanVo extends Page implements Serializable { |
| | | |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.purchase.controller; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.utils.OrderUtils; |
| | | 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.projectManagement.mapper.RolesMapper; |
| | | import com.ruoyi.purchase.dto.PurchaseReturnOrderDto; |
| | | import com.ruoyi.purchase.mapper.PurchaseReturnOrdersMapper; |
| | | import com.ruoyi.purchase.service.PurchaseReturnOrdersService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | /** |
| | | * <p> |
| | | * å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-03-06 11:44:38 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/purchaseReturnOrders") |
| | | public class PurchaseReturnOrdersController { |
| | | @Autowired |
| | | private PurchaseReturnOrdersService purchaseReturnOrdersService; |
| | | |
| | | @Autowired |
| | | private PurchaseReturnOrdersMapper purchaseReturnOrdersMapper; |
| | | |
| | | |
| | | @GetMapping("/listPage") |
| | | public AjaxResult listPage(Page page, PurchaseReturnOrderDto purchaseReturnOrderDto) { |
| | | return AjaxResult.success(purchaseReturnOrdersService.listPage(page, purchaseReturnOrderDto)); |
| | | } |
| | | |
| | | // æ°å¢ |
| | | @Log(title = "éè´éè´§å", businessType = BusinessType.INSERT) |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody PurchaseReturnOrderDto purchaseReturnOrderDto) throws Exception { |
| | | if (purchaseReturnOrderDto.getIsDefaultNo()) { |
| | | purchaseReturnOrderDto.setNo(OrderUtils.countTodayByCreateTime(purchaseReturnOrdersMapper, "CGTL")); |
| | | } |
| | | return AjaxResult.success(purchaseReturnOrdersService.save(purchaseReturnOrderDto)); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.purchase.dto; |
| | | |
| | | import com.ruoyi.purchase.pojo.PurchaseReturnOrders; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class PurchaseReturnOrderDto extends PurchaseReturnOrders { |
| | | // æ¯å¦ä½¿ç¨ç³»ç»åå· |
| | | private Boolean isDefaultNo; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.purchase.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.purchase.pojo.PurchaseReturnOrders; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.purchase.vo.PurchaseReturnOrderVo; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-03-06 11:44:38 |
| | | */ |
| | | @Mapper |
| | | public interface PurchaseReturnOrdersMapper extends BaseMapper<PurchaseReturnOrders> { |
| | | IPage<PurchaseReturnOrderVo> listPage(Page page, @Param("params") PurchaseReturnOrders purchaseReturnOrder); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.purchase.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-03-06 11:44:38 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @TableName("purchase_return_orders") |
| | | @ApiModel(value = "PurchaseReturnOrders对象", description = "éè´éè´§å") |
| | | public class PurchaseReturnOrders implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("éè´§åç¼å·") |
| | | private String no; |
| | | |
| | | @ApiModelProperty("éè´§æ¹å¼ 0éè´§éæ¬¾ 1ææ¶") |
| | | private Integer returnType; |
| | | |
| | | @ApiModelProperty("ä¾åºåid") |
| | | private Long supplierId; |
| | | |
| | | @ApiModelProperty("项ç®id") |
| | | private Long projectId; |
| | | |
| | | @ApiModelProperty("项ç®é¶æ®µ") |
| | | private Integer projectPhase; |
| | | |
| | | @ApiModelProperty("å¶åæ¥æ") |
| | | private LocalDateTime preparedAt; |
| | | |
| | | @ApiModelProperty("å¶å人id") |
| | | private Long preparedUserId; |
| | | |
| | | @ApiModelProperty("éæäººid") |
| | | private Long returnUserId; |
| | | |
| | | @ApiModelProperty("éè´è®¢åid") |
| | | private Long purchaseLedgerId; |
| | | |
| | | @ApiModelProperty("夿³¨") |
| | | private String remark; |
| | | |
| | | @ApiModelProperty("'æ´åææ£é¢'") |
| | | private BigDecimal totalDiscountAmount; |
| | | |
| | | @ApiModelProperty("'æ´åææ£ç'") |
| | | private BigDecimal totalDiscountRate; |
| | | |
| | | @ApiModelProperty("'æäº¤éé¢'") |
| | | private BigDecimal totalAmount; |
| | | |
| | | @ApiModelProperty("å½å
¥æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty("æ´æ°æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.purchase.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.purchase.dto.PurchaseReturnOrderDto; |
| | | import com.ruoyi.purchase.pojo.PurchaseReturnOrders; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.purchase.vo.PurchaseReturnOrderVo; |
| | | |
| | | /** |
| | | * <p> |
| | | * æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-03-06 11:44:38 |
| | | */ |
| | | public interface PurchaseReturnOrdersService extends IService<PurchaseReturnOrders> { |
| | | IPage<PurchaseReturnOrderVo> listPage(Page page, PurchaseReturnOrderDto purchaseReturnOrderDto); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.purchase.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.purchase.dto.PurchaseReturnOrderDto; |
| | | import com.ruoyi.purchase.pojo.PurchaseReturnOrders; |
| | | import com.ruoyi.purchase.mapper.PurchaseReturnOrdersMapper; |
| | | import com.ruoyi.purchase.service.PurchaseReturnOrdersService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.purchase.vo.PurchaseReturnOrderVo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-03-06 11:44:38 |
| | | */ |
| | | @Service |
| | | public class PurchaseReturnOrdersServiceImpl extends ServiceImpl<PurchaseReturnOrdersMapper, PurchaseReturnOrders> implements PurchaseReturnOrdersService { |
| | | @Autowired |
| | | private PurchaseReturnOrdersMapper purchaseReturnOrdersMapper; |
| | | |
| | | @Override |
| | | public IPage<PurchaseReturnOrderVo> listPage(Page page, PurchaseReturnOrderDto purchaseReturnOrderDto) { |
| | | return purchaseReturnOrdersMapper.listPage(page, purchaseReturnOrderDto); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.purchase.vo; |
| | | |
| | | import com.ruoyi.purchase.pojo.PurchaseReturnOrders; |
| | | |
| | | public class PurchaseReturnOrderVo extends PurchaseReturnOrders { |
| | | //ä¾åºååç§° |
| | | private String supplierName; |
| | | |
| | | // éè´ååå· |
| | | private String purchaseContractNumber; |
| | | |
| | | //éæäººå§å |
| | | private String returnUserName; |
| | | |
| | | //å¶å人å§å |
| | | private String createUserName; |
| | | } |
| | |
| | | util.exportExcel(response, list, "åè´§ä¿¡æ¯"); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/getByCustomerName") |
| | | @ApiOperation("éè¿å®¢æ·åç§°æ¥è¯¢") |
| | | public AjaxResult getByCustomerName(String customerName) { |
| | | return AjaxResult.success(shippingInfoService.getShippingInfoByCustomerName(customerName)); |
| | | } |
| | | } |
| | |
| | | |
| | | private Boolean hasChildren = false; |
| | | private List<SalesLedgerProduct> productData; |
| | | private List<SalesLedgerProductDto> productDtoData; |
| | | private List<String> tempFileIds; |
| | | private List<CommonFile> SalesLedgerFiles; |
| | | |
| | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | |
| | |
| | | |
| | | private Integer approvalStatus; |
| | | |
| | | |
| | | @ApiModelProperty(value = "æªéè´§æ°") |
| | | private BigDecimal unQuantity; |
| | | |
| | | @ApiModelProperty(value = "éè´§æ»æ°") |
| | | private BigDecimal totalReturnNum; |
| | | |
| | | } |
| | |
| | | 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.procurementrecord.dto.ReturnSaleProductDto; |
| | | import com.ruoyi.sales.dto.SalesLedgerProductDto; |
| | | import com.ruoyi.sales.dto.ShippingInfoDto; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import com.ruoyi.sales.pojo.ShippingInfo; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | IPage<ShippingInfoDto> listPage(Page page, @Param("req") ShippingInfo req); |
| | | |
| | | List<ShippingInfo> listAll(); |
| | | |
| | | List<SalesLedgerProductDto> getReturnManagementDtoById(@Param("shippingId")Long shippingId); |
| | | |
| | | List<ShippingInfo> getShippingInfoByCustomerName(String customerName); |
| | | |
| | | } |
| | |
| | | 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.procurementrecord.dto.ReturnSaleProductDto; |
| | | import com.ruoyi.sales.dto.SalesLedgerProductDto; |
| | | import com.ruoyi.sales.dto.ShippingInfoDto; |
| | | import com.ruoyi.sales.pojo.ShippingInfo; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | |
| | | boolean deductStock(ShippingInfoDto req) throws IOException; |
| | | |
| | | boolean delete(List<Long> ids); |
| | | |
| | | List<SalesLedgerProductDto> getReturnManagementDtoById( Long shippingId); |
| | | |
| | | List<ShippingInfo> getShippingInfoByCustomerName(String customerName); |
| | | } |
| | |
| | | import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum; |
| | | import com.ruoyi.other.service.impl.TempFileServiceImpl; |
| | | import com.ruoyi.procurementrecord.utils.StockUtils; |
| | | import com.ruoyi.sales.dto.SalesLedgerProductDto; |
| | | import com.ruoyi.sales.dto.ShippingInfoDto; |
| | | import com.ruoyi.sales.mapper.SalesLedgerProductMapper; |
| | | import com.ruoyi.sales.mapper.ShippingInfoMapper; |
| | |
| | | |
| | | return this.removeBatchByIds(ids); |
| | | } |
| | | |
| | | @Override |
| | | public List<SalesLedgerProductDto> getReturnManagementDtoById(Long shippingId) { |
| | | return shippingInfoMapper.getReturnManagementDtoById(shippingId ); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public List<ShippingInfo> getShippingInfoByCustomerName(String customerName) { |
| | | return shippingInfoMapper.getShippingInfoByCustomerName(customerName); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.staff.controller; |
| | | |
| | | import com.alibaba.excel.EasyExcel; |
| | | import com.alibaba.excel.write.style.HorizontalCellStyleStrategy; |
| | | import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.staff.dto.PerformanceShiftAddDto; |
| | | import com.ruoyi.staff.pojo.PersonalAttendanceLocationConfig; |
| | | import com.ruoyi.staff.pojo.PersonalShift; |
| | | import com.ruoyi.staff.service.PersonalAttendanceLocationConfigService; |
| | | import com.ruoyi.staff.service.PersonalShiftService; |
| | | import com.ruoyi.staff.utils.StyleMonthUtils; |
| | | import com.ruoyi.staff.utils.StyleYearUtils; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-03-05 03:52:19 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/personalShift") |
| | | @Api(tags = "人åæç") |
| | | public class PersonalShiftController { |
| | | |
| | | @Autowired |
| | | private PersonalShiftService personalShiftService; |
| | | |
| | | @ApiOperation("人åæç") |
| | | @PostMapping("/add") |
| | | public R add(@RequestBody PerformanceShiftAddDto performanceShiftAddDto){ |
| | | return R.ok(personalShiftService.performanceShiftAdd(performanceShiftAddDto)); |
| | | } |
| | | |
| | | @ApiOperation(value = "æä»½å页æ¥è¯¢") |
| | | @GetMapping("page") |
| | | public R performanceShiftPage(Integer size, Integer current, String time, String userName, Integer sysDeptId) { |
| | | return R.ok(personalShiftService.performanceShiftPage(new Page<>(current, size), time, userName, sysDeptId)); |
| | | } |
| | | |
| | | @ApiOperation(value = "年份å页æ¥è¯¢") |
| | | @GetMapping("pageYear") |
| | | public R performanceShiftPageYear(Integer size, Integer current, String time, String userName, Integer sysDeptId) { |
| | | return R.ok(personalShiftService.performanceShiftPageYear(new Page<>(current, size), time, userName, sysDeptId)); |
| | | } |
| | | |
| | | @ApiOperation(value = "çæ¬¡ç¶æä¿®æ¹") |
| | | @PostMapping("update") |
| | | public R performanceShiftUpdate(@RequestBody PersonalShift personalShift) { |
| | | personalShiftService.performanceShiftUpdate(personalShift); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @ApiOperation(value = "导åº") |
| | | @GetMapping("export") |
| | | public void exportToExcel(@NotNull(message = "æ¶é´ä¸è½ä¸ºç©ºï¼") String time, String userName, Integer sysDeptId, Boolean isMonth, HttpServletResponse response) throws Exception { |
| | | Map<Object, Object> data; |
| | | response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
| | | response.setHeader("requestType","excel"); |
| | | response.setHeader("Access-Control-Expose-Headers", "requestType"); |
| | | if (!isMonth) { |
| | | data = personalShiftService.exportToYearExcel(time, userName, sysDeptId); |
| | | // 设置åå
æ ¼æ ·å¼ |
| | | HorizontalCellStyleStrategy horizontalCellStyleStrategy = new HorizontalCellStyleStrategy(StyleYearUtils.getHeadStyle(), StyleYearUtils.getContentStyle()); |
| | | // ä¿åå°ç¬¬ä¸ä¸ªsheetä¸ |
| | | EasyExcel.write(response.getOutputStream()) |
| | | .head((List<List<String>>) data.get("header")) |
| | | .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) // èªéåºå宽 |
| | | .registerWriteHandler(horizontalCellStyleStrategy) |
| | | .sheet("年度") |
| | | .doWrite((Collection<?>) data.get("data")); |
| | | } else { |
| | | data = personalShiftService.exportToMonthExcel(time, userName, sysDeptId); |
| | | // 设置åå
æ ¼æ ·å¼ |
| | | HorizontalCellStyleStrategy horizontalCellStyleStrategy = new HorizontalCellStyleStrategy(StyleMonthUtils.getHeadStyle(), StyleMonthUtils.getContentStyle()); |
| | | EasyExcel.write(response.getOutputStream()) |
| | | .head((List<List<String>>) data.get("header")) |
| | | .registerWriteHandler(horizontalCellStyleStrategy) |
| | | .sheet("æåº¦") |
| | | .doWrite((Collection<?>) data.get("data")); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.staff.dto; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | public class PerformanceShiftAddDto { |
| | | |
| | | @NotNull(message = "è¯·éæ©çæ¬¡") |
| | | @ApiModelProperty("çæ¬¡") |
| | | private Integer personalAttendanceLocationConfigId; |
| | | |
| | | @NotNull(message = "è¯·éæ©åå·¥") |
| | | @ApiModelProperty("åå·¥id") |
| | | private String staffOnJobId; |
| | | |
| | | @NotNull(message = "è¯·éæ©å¨æ¬¡") |
| | | @ApiModelProperty("å¼å§å¨æ¬¡") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime startWeek; |
| | | |
| | | @NotNull(message = "è¯·éæ©å¨æ¬¡") |
| | | @ApiModelProperty("ç»æå¨æ¬¡") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime endWeek; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.staff.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Data |
| | | public class PerformanceShiftMapDto { |
| | | |
| | | private String name; |
| | | |
| | | private String shiftTime; |
| | | |
| | | private String userId; |
| | | |
| | | private String department; |
| | | |
| | | private Map<String, Object> monthlyAttendance = new HashMap<>(); |
| | | |
| | | private List<Map<String, Object>> list = new ArrayList<>(); |
| | | |
| | | private List<Map<Object, Object>> headerList = new ArrayList<>(); |
| | | } |
| | |
| | | @JsonFormat(pattern = "HH:mm") |
| | | @DateTimeFormat(pattern = "HH:mm") |
| | | private LocalTime endAt; |
| | | |
| | | //çæ¬¡ |
| | | private String shift; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.staff.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.config.MyBaseMapper; |
| | | import com.ruoyi.staff.dto.PerformanceShiftMapDto; |
| | | import com.ruoyi.staff.pojo.PersonalShift; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-03-05 03:52:19 |
| | | */ |
| | | @Mapper |
| | | public interface PersonalShiftMapper extends BaseMapper<PersonalShift> { |
| | | |
| | | IPage<PerformanceShiftMapDto> performanceShiftPage(Page<Object> page, @Param("time") String time, @Param("userName") String userName, @Param("sysDeptId") Integer sysDeptId); |
| | | |
| | | |
| | | IPage<Map<String, Object>> performanceShiftYear(Page<Object> page, @Param("time") String time, @Param("userName") String userName, @Param("sysDeptId") Integer sysDeptId); |
| | | |
| | | List<Map<String, Object>> performanceShiftYearList(@Param("time") String time, @Param("userName") String userName, @Param("sysDeptId") Integer sysDeptId); |
| | | |
| | | List<PerformanceShiftMapDto> performanceShiftList(@Param("time") String time, @Param("userName") String userName, @Param("sysDeptId") Integer sysDeptId); |
| | | } |
| | |
| | | @JsonFormat(pattern = "HH:mm") |
| | | @DateTimeFormat(pattern = "HH:mm") |
| | | private LocalTime endAt; |
| | | |
| | | @ApiModelProperty("çæ¬¡") |
| | | private String shift; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.staff.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-03-05 03:52:19 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @TableName("personal_shift") |
| | | @ApiModel(value = "PersonalShift对象", description = "") |
| | | public class PersonalShift implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("çæ¬¡(æå¡è§åid)") |
| | | private Integer personalAttendanceLocationConfigId; |
| | | |
| | | @ApiModelProperty("åå·¥å¨èid") |
| | | private Long staffOnJobId; |
| | | |
| | | @ApiModelProperty("å½å
¥æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty("æ´æ°æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty("æçæ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime workTime; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.staff.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.staff.dto.PerformanceShiftAddDto; |
| | | import com.ruoyi.staff.pojo.PersonalShift; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | | * æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-03-05 03:52:19 |
| | | */ |
| | | public interface PersonalShiftService extends IService<PersonalShift> { |
| | | |
| | | int performanceShiftAdd(PerformanceShiftAddDto performanceShiftAddDto); |
| | | |
| | | Map<String, Object> performanceShiftPage(Page<Object> page, String time, String userName, Integer sysDeptId); |
| | | |
| | | void performanceShiftUpdate(PersonalShift performanceShift); |
| | | |
| | | IPage<Map<String, Object>> performanceShiftPageYear(Page<Object> page, String time, String userName, Integer sysDeptId); |
| | | |
| | | Map<Object, Object> exportToYearExcel(String time, String userName, Integer sysDeptId) throws Exception; |
| | | |
| | | Map<Object, Object> exportToMonthExcel(String time, String userName, Integer sysDeptId); |
| | | } |
| | |
| | | package com.ruoyi.staff.service.impl; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | |
| | | import com.ruoyi.staff.dto.PersonalAttendanceRecordsDto; |
| | | import com.ruoyi.staff.dto.StaffOnJobDto; |
| | | import com.ruoyi.staff.mapper.PersonalAttendanceLocationConfigMapper; |
| | | import com.ruoyi.staff.mapper.PersonalShiftMapper; |
| | | import com.ruoyi.staff.mapper.StaffOnJobMapper; |
| | | import com.ruoyi.staff.pojo.PersonalAttendanceLocationConfig; |
| | | import com.ruoyi.staff.pojo.PersonalAttendanceRecords; |
| | | import com.ruoyi.staff.mapper.PersonalAttendanceRecordsMapper; |
| | | import com.ruoyi.staff.pojo.PersonalShift; |
| | | import com.ruoyi.staff.pojo.StaffOnJob; |
| | | import com.ruoyi.staff.service.PersonalAttendanceRecordsService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | @Autowired |
| | | private SysDeptMapper sysDeptMapper; |
| | | |
| | | @Autowired |
| | | private PersonalShiftMapper personalShiftMapper; |
| | | |
| | | @Override |
| | | public int add(PersonalAttendanceRecordsDto personalAttendanceRecordsDto) { |
| | | // å½åæ¶é´ |
| | |
| | | if (staffOnJob == null) { |
| | | throw new BaseException("å½åç¨æ·æ²¡æå¯¹åºçå工信æ¯"); |
| | | } |
| | | /*夿æå¡ä½ç½®æ¯å¦å¨è§åèå´å
*/ |
| | | List<PersonalAttendanceLocationConfig> personalAttendanceLocationConfigs = personalAttendanceLocationConfigMapper.selectList(Wrappers.<PersonalAttendanceLocationConfig>lambdaQuery() |
| | | .eq(PersonalAttendanceLocationConfig::getSysDeptId, staffOnJob.getSysDeptId()) |
| | | .orderByDesc(PersonalAttendanceLocationConfig::getId)); |
| | | if (personalAttendanceLocationConfigs == null || personalAttendanceLocationConfigs.isEmpty()) { |
| | | throw new BaseException("å½åé¨é¨æ²¡æè®¾ç½®æå¡è§å"); |
| | | //夿夿åå·¥å½å¤©æ¯å¦ææçæ°æ® |
| | | List<PersonalShift> personalShifts = personalShiftMapper.selectList(Wrappers.<PersonalShift>lambdaQuery() |
| | | .eq(PersonalShift::getStaffOnJobId, staffOnJob.getId()) |
| | | .eq(PersonalShift::getWorkTime, currentDate.atStartOfDay()) |
| | | .isNotNull(PersonalShift::getPersonalAttendanceLocationConfigId)); |
| | | if (CollectionUtil.isEmpty(personalShifts)){ |
| | | throw new BaseException("å½åç¨æ·å½å¤©æ²¡ææçæ°æ®"); |
| | | } |
| | | /*夿æå¡ä½ç½®æ¯å¦å¨è§åèå´å
*/ |
| | | PersonalShift personalShift = personalShifts.get(0); |
| | | |
| | | PersonalAttendanceLocationConfig locationConfig = personalAttendanceLocationConfigMapper.selectById(personalShift.getPersonalAttendanceLocationConfigId()); |
| | | Double punchLongitude = personalAttendanceRecordsDto.getLongitude(); //æå¡çç»åº¦ |
| | | Double punchLatitude = personalAttendanceRecordsDto.getLatitude(); // æå¡ç纬度 |
| | | if (punchLongitude == null || punchLatitude == null) { |
| | | throw new BaseException("æå¡å¤±è´¥ï¼æªè·åå°æ¨çä½ç½®ä¿¡æ¯ï¼è¯·å¼å¯å®ä½æé"); |
| | | } |
| | | //è®¡ç®æå¡ä½ç½®ä¸èå¤ç¹çè·ç¦» |
| | | PersonalAttendanceLocationConfig locationConfig = personalAttendanceLocationConfigs.get(0);//è·åææ°ç䏿¡æ°æ® |
| | | double allowedRadius = locationConfig.getRadius(); // å
许çèå´ï¼ç±³ï¼ |
| | | double actualDistance = LocationUtils.calculateDistance( |
| | | punchLatitude, punchLongitude, // åå·¥æå¡çç»çº¬åº¦ |
| | |
| | | SysDept dept = sysDeptMapper.selectDeptById(staffOnJob.getSysDeptId()); |
| | | resultDto.setDeptName(dept != null ? dept.getDeptName() : null); |
| | | //è·å该å工对åºçæå¡è§å |
| | | List<PersonalAttendanceLocationConfig> personalAttendanceLocationConfigs = personalAttendanceLocationConfigMapper.selectList(Wrappers.<PersonalAttendanceLocationConfig>lambdaQuery() |
| | | .eq(PersonalAttendanceLocationConfig::getSysDeptId, staffOnJob.getSysDeptId()) |
| | | .orderByDesc(PersonalAttendanceLocationConfig::getId)); |
| | | if (personalAttendanceLocationConfigs.size()>0){ |
| | | resultDto.setStartAt(personalAttendanceLocationConfigs.get(0).getStartAt()); |
| | | resultDto.setEndAt(personalAttendanceLocationConfigs.get(0).getEndAt()); |
| | | List<PersonalShift> personalShifts = personalShiftMapper.selectList(Wrappers.<PersonalShift>lambdaQuery() |
| | | .eq(PersonalShift::getStaffOnJobId, staffOnJob.getId()) |
| | | .eq(PersonalShift::getWorkTime, currentDate.atStartOfDay()) |
| | | .isNotNull(PersonalShift::getPersonalAttendanceLocationConfigId)); |
| | | if (CollectionUtil.isNotEmpty(personalShifts)){ |
| | | PersonalAttendanceLocationConfig personalAttendanceLocationConfig = personalAttendanceLocationConfigMapper.selectById(personalShifts.get(0).getPersonalAttendanceLocationConfigId()); |
| | | resultDto.setStartAt(personalAttendanceLocationConfig.getStartAt()); |
| | | resultDto.setEndAt(personalAttendanceLocationConfig.getEndAt()); |
| | | resultDto.setShift(personalAttendanceLocationConfig.getShift()); |
| | | } |
| | | return resultDto; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.staff.service.impl; |
| | | |
| | | import cn.hutool.core.date.DateTime; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.project.system.domain.SysDictData; |
| | | import com.ruoyi.staff.dto.PerformanceShiftAddDto; |
| | | import com.ruoyi.staff.dto.PerformanceShiftMapDto; |
| | | import com.ruoyi.staff.mapper.PersonalAttendanceLocationConfigMapper; |
| | | import com.ruoyi.staff.pojo.PersonalAttendanceLocationConfig; |
| | | import com.ruoyi.staff.pojo.PersonalShift; |
| | | import com.ruoyi.staff.mapper.PersonalShiftMapper; |
| | | import com.ruoyi.staff.service.PersonalAttendanceLocationConfigService; |
| | | import com.ruoyi.staff.service.PersonalShiftService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.staff.utils.JackSonUtil; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.ObjectUtils; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.YearMonth; |
| | | import java.time.ZoneId; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.time.temporal.TemporalAdjusters; |
| | | import java.util.*; |
| | | |
| | | |
| | | /** |
| | | * <p> |
| | | * æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-03-05 03:52:19 |
| | | */ |
| | | @Service |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public class PersonalShiftServiceImpl extends ServiceImpl<PersonalShiftMapper, PersonalShift> implements PersonalShiftService { |
| | | |
| | | @Autowired |
| | | private PersonalAttendanceLocationConfigMapper personalAttendanceLocationConfigMapper; |
| | | |
| | | @Override |
| | | public int performanceShiftAdd(PerformanceShiftAddDto performanceShiftAddDto) { |
| | | List<PersonalShift> list = new ArrayList<>(); |
| | | LocalDateTime startWeek = performanceShiftAddDto.getStartWeek();//å¼å§æ¥æ |
| | | LocalDateTime endWeek = performanceShiftAddDto.getEndWeek();//ç»ææ¥æ |
| | | |
| | | |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | String formattedDateTime = performanceShiftAddDto.getStartWeek().format(formatter); |
| | | String[] splitUserId = performanceShiftAddDto.getStaffOnJobId().split(","); |
| | | for (String userId : splitUserId) { |
| | | //夿æ¯å¦è·¨æ |
| | | boolean isMonth = startWeek.getMonthValue() != endWeek.getMonthValue(); |
| | | if (isMonth){ |
| | | //å¦æè·¨æ,å两个æé½å¤æä¸ä¸çæ°æ®åºæ¯åªä¸ªæä»½çæ°æ®æ²¡æ |
| | | boolean exists1 = baseMapper.exists(Wrappers.<PersonalShift>lambdaQuery() |
| | | .eq(PersonalShift::getWorkTime, startWeek) |
| | | .eq(PersonalShift::getStaffOnJobId, userId)); |
| | | boolean exists2 = baseMapper.exists(Wrappers.<PersonalShift>lambdaQuery() |
| | | .eq(PersonalShift::getWorkTime, endWeek) |
| | | .eq(PersonalShift::getStaffOnJobId, userId)); |
| | | if (!exists1 && !exists2){ |
| | | //两个æé½ä¸å卿°æ® |
| | | list = saveMonth(performanceShiftAddDto.getStartWeek(), userId, list); |
| | | list = saveMonth(performanceShiftAddDto.getEndWeek(), userId, list); |
| | | }else if (!exists1 && exists2){ |
| | | //å¼å§çæä»½ä¸å卿°æ® |
| | | list = saveMonth(performanceShiftAddDto.getStartWeek(), userId, list); |
| | | }else if (exists1 && !exists2){ |
| | | //ç»æçæä»½ä¸å卿°æ® |
| | | list = saveMonth(performanceShiftAddDto.getEndWeek(), userId, list); |
| | | } |
| | | }else { |
| | | //ä¸è·¨æ |
| | | boolean exists = baseMapper.exists(Wrappers.<PersonalShift>lambdaQuery() |
| | | .in(PersonalShift::getWorkTime, formattedDateTime) |
| | | .eq(PersonalShift::getStaffOnJobId, userId)); |
| | | // 妿ä¸å卿·»å æ°æ® |
| | | if (!exists) { |
| | | list = saveMonth(performanceShiftAddDto.getEndWeek(), userId, list); |
| | | } |
| | | } |
| | | } |
| | | if (!list.isEmpty()) { |
| | | saveBatch(list); |
| | | list.clear(); |
| | | } |
| | | // 忬¡æ´æ° |
| | | List<LocalDateTime> datesBetween = getLocalDateTimesBetween(performanceShiftAddDto.getStartWeek(), performanceShiftAddDto.getEndWeek()); |
| | | for (LocalDateTime date : datesBetween) { |
| | | for (String s : splitUserId) { |
| | | PersonalShift personalShift = new PersonalShift(); |
| | | personalShift.setPersonalAttendanceLocationConfigId(performanceShiftAddDto.getPersonalAttendanceLocationConfigId()); |
| | | personalShift.setStaffOnJobId(Long.valueOf(s)); |
| | | personalShift.setWorkTime(date); |
| | | String formatterDateTime = date.format(formatter); |
| | | baseMapper.update(new PersonalShift(), Wrappers.<PersonalShift>lambdaUpdate() |
| | | .set(PersonalShift::getPersonalAttendanceLocationConfigId, performanceShiftAddDto.getPersonalAttendanceLocationConfigId()) |
| | | .eq(PersonalShift::getStaffOnJobId, s) |
| | | .eq(PersonalShift::getWorkTime, formatterDateTime)); |
| | | } |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> performanceShiftPage(Page<Object> page, String time, String userName, Integer sysDeptId) { |
| | | IPage<PerformanceShiftMapDto> mapIPage = baseMapper.performanceShiftPage(page, time, userName, sysDeptId); |
| | | //æ¥è¯¢ææç次(æå¡è§å) |
| | | List<PersonalAttendanceLocationConfig> personalAttendanceLocationConfigs = personalAttendanceLocationConfigMapper.selectList(null); |
| | | mapIPage.getRecords().forEach(i -> { |
| | | String[] shiftTimes = i.getShiftTime().split(";"); |
| | | double totalAttendance = 0;//æ»åºå¤å¤©æ° |
| | | List<Map<String, Object>> map = new ArrayList<>(); |
| | | // å岿¥æ |
| | | for (String shiftTime : shiftTimes) { |
| | | i.setShiftTime(null); |
| | | Map<String, Object> hashMap = new HashMap<>(); |
| | | String[] shiftTimeAndShift = shiftTime.split("ï¼"); |
| | | //æçè¯¦ç»æ°æ® |
| | | hashMap.put("id", shiftTimeAndShift[2]); |
| | | hashMap.put("shift", shiftTimeAndShift[1]); |
| | | hashMap.put("time", shiftTimeAndShift[0]); |
| | | map.add(hashMap); |
| | | i.setList(map); |
| | | //æ±æ»çåçæ¬¡ç»è®¡æ°æ® |
| | | for (PersonalAttendanceLocationConfig personalAttendanceLocationConfig : personalAttendanceLocationConfigs) { |
| | | if (!i.getMonthlyAttendance().containsKey(personalAttendanceLocationConfig.getShift())){ |
| | | i.getMonthlyAttendance().put(personalAttendanceLocationConfig.getShift(), 0); |
| | | } |
| | | if (personalAttendanceLocationConfig.getShift().equals(shiftTimeAndShift[1])) { |
| | | BigDecimal bigDecimal = new BigDecimal(i.getMonthlyAttendance().get(personalAttendanceLocationConfig.getShift()).toString()); |
| | | i.getMonthlyAttendance().put(personalAttendanceLocationConfig.getShift(), bigDecimal.add(new BigDecimal("1"))); |
| | | } |
| | | } |
| | | //ç»è®¡æ»åºå¤å¤©æ°(æ©/ä¸/æ/å¤)é½ç®åºå¤,å
¶ä½é½æ¯ä¼æ¯ |
| | | if (shiftTimeAndShift[1].contains("æ©") || |
| | | shiftTimeAndShift[1].contains("ä¸") || |
| | | shiftTimeAndShift[1].contains("æ") || |
| | | shiftTimeAndShift[1].contains("å¤")) { |
| | | i.getMonthlyAttendance().put("totalAttendance", totalAttendance += 1); |
| | | } |
| | | } |
| | | }); |
| | | // è·åheaderæ¶é´ |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | DateTimeFormatter formatters = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | // å°å符串æ¶é´è½¬æ¢ä¸º LocalDateTime ç±»åæ¶é´ |
| | | LocalDateTime localDateTime = LocalDateTime.parse(time, formatters); |
| | | LocalDate firstDayOfMonth = localDateTime.toLocalDate().withDayOfMonth(1); |
| | | LocalDate lastDayOfMonth = localDateTime.toLocalDate().with(TemporalAdjusters.lastDayOfMonth()); |
| | | List<LocalDateTime> localDateTimesBetween = getLocalDateTimesBetween(firstDayOfMonth.atStartOfDay(), lastDayOfMonth.atStartOfDay()); |
| | | List<Object> list1 = new ArrayList<>(); |
| | | for (LocalDateTime dateTime : localDateTimesBetween) { |
| | | Map<Object, Object> hashMap = new HashMap<>(); |
| | | DateTime parse = DateUtil.parse(dateTime.format(formatter)); |
| | | hashMap.put("weekly", DateUtil.weekOfYear(DateUtil.offsetDay(parse, 1))); |
| | | hashMap.put("headerTime", getWeek(dateTime.format(formatters))); |
| | | list1.add(hashMap); |
| | | } |
| | | Map<String, Object> resultMap = new HashMap<>(); |
| | | resultMap.put("page", mapIPage); |
| | | resultMap.put("headerList", list1); |
| | | return resultMap; |
| | | } |
| | | |
| | | @Override |
| | | public void performanceShiftUpdate(PersonalShift personalShift) { |
| | | baseMapper.update(new PersonalShift(), Wrappers.<PersonalShift>lambdaUpdate() |
| | | .eq(PersonalShift::getId, personalShift.getId()) |
| | | .set(PersonalShift::getPersonalAttendanceLocationConfigId, personalShift.getPersonalAttendanceLocationConfigId())); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<Map<String, Object>> performanceShiftPageYear(Page<Object> page, String time, String userName, Integer sysDeptId) { |
| | | IPage<Map<String, Object>> mapYearIPage = baseMapper.performanceShiftYear(page, time, userName, sysDeptId); |
| | | //æ¥è¯¢ææç次(æå¡è§å) |
| | | List<PersonalAttendanceLocationConfig> personalAttendanceLocationConfigs = personalAttendanceLocationConfigMapper.selectList(null); |
| | | mapYearIPage.setRecords(annualAttendanceProcessing(mapYearIPage.getRecords(), personalAttendanceLocationConfigs)); |
| | | return mapYearIPage; |
| | | } |
| | | |
| | | @Override |
| | | public Map<Object, Object> exportToYearExcel(String time, String userName, Integer sysDeptId) throws Exception { |
| | | Map<Object, Object> map = new HashMap<>(); |
| | | //æ¥è¯¢ææç次(æå¡è§å) |
| | | List<PersonalAttendanceLocationConfig> personalAttendanceLocationConfigs = personalAttendanceLocationConfigMapper.selectList(null); |
| | | DateTimeFormatter formatters = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | // å°å符串æ¶é´è½¬æ¢ä¸º LocalDateTime ç±»åæ¶é´ |
| | | LocalDateTime localDateTime = LocalDateTime.parse(time, formatters); |
| | | map.put("header", getYearHeader(localDateTime.getYear() + " å¹´", personalAttendanceLocationConfigs)); |
| | | List<Map<String, Object>> mapYearList = baseMapper.performanceShiftYearList(time, userName, sysDeptId); |
| | | annualAttendanceProcessing(mapYearList, personalAttendanceLocationConfigs); |
| | | List<List<Object>> lists = dataRequiredForProcessingIntoExcel(mapYearList, personalAttendanceLocationConfigs); |
| | | map.put("data", lists); |
| | | return map; |
| | | } |
| | | |
| | | @Override |
| | | public Map<Object, Object> exportToMonthExcel(String time, String userName, Integer sysDeptId) { |
| | | //æ¥è¯¢ææç次(æå¡è§å) |
| | | List<PersonalAttendanceLocationConfig> personalAttendanceLocationConfigs = personalAttendanceLocationConfigMapper.selectList(null); |
| | | List<PerformanceShiftMapDto> mapIPage = baseMapper.performanceShiftList(time, userName, sysDeptId); |
| | | mapIPage.forEach(i -> { |
| | | String[] shiftTimes = i.getShiftTime().split(";"); |
| | | double totalAttendance = 0; |
| | | List<Map<String, Object>> map = new ArrayList<>(); |
| | | // å岿¥æ |
| | | for (String shiftTime : shiftTimes) { |
| | | Map<String, Object> hashMap = new HashMap<>(); |
| | | String[] shiftTimeAndShift = shiftTime.split("ï¼"); |
| | | for (PersonalAttendanceLocationConfig personalAttendanceLocationConfig : personalAttendanceLocationConfigs) { |
| | | if (!i.getMonthlyAttendance().containsKey(personalAttendanceLocationConfig.getShift())) { |
| | | i.getMonthlyAttendance().put(personalAttendanceLocationConfig.getShift(), 0); |
| | | } |
| | | if (personalAttendanceLocationConfig.getShift().equals(shiftTimeAndShift[1])) { |
| | | BigDecimal bigDecimal = new BigDecimal(i.getMonthlyAttendance().get(personalAttendanceLocationConfig.getShift()).toString()); |
| | | i.getMonthlyAttendance().put(personalAttendanceLocationConfig.getShift(), bigDecimal.add(new BigDecimal("1"))); |
| | | } |
| | | } |
| | | //ç»è®¡æ»åºå¤å¤©æ°(æ©/ä¸/æ/å¤)é½ç®åºå¤,å
¶ä½é½æ¯ä¼æ¯ |
| | | if (shiftTimeAndShift[1].contains("æ©") || |
| | | shiftTimeAndShift[1].contains("ä¸") || |
| | | shiftTimeAndShift[1].contains("æ") || |
| | | shiftTimeAndShift[1].contains("å¤")) { |
| | | i.getMonthlyAttendance().put("totalAttendance", totalAttendance += 1); |
| | | } |
| | | hashMap.put("id", shiftTimeAndShift[2]); |
| | | hashMap.put("shift", shiftTimeAndShift[1]); |
| | | hashMap.put("time", shiftTimeAndShift[0]); |
| | | map.add(hashMap); |
| | | } |
| | | i.setList(map); |
| | | i.setShiftTime(null); |
| | | }); |
| | | Map<Object, Object> map = new HashMap<>(); |
| | | DateTimeFormatter formatters = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | // å°å符串æ¶é´è½¬æ¢ä¸º LocalDateTime ç±»åæ¶é´ |
| | | LocalDateTime localDateTime = LocalDateTime.parse(time, formatters); |
| | | map.put("header", getMonthHeader(localDateTime)); |
| | | List<List<Object>> lists = dataRequiredForProcessingIntoExcelMonth(mapIPage, personalAttendanceLocationConfigs); |
| | | map.put("data", lists); |
| | | return map; |
| | | } |
| | | |
| | | // å¹´å页ä¸å¯¼åºå
±åä½¿ç¨ |
| | | public List<Map<String, Object>> annualAttendanceProcessing(List<Map<String, Object>> mapYearList,List<PersonalAttendanceLocationConfig> personalAttendanceLocationConfigs) { |
| | | for (Map<String, Object> map : mapYearList) { |
| | | Map<String, Object> resultMap = new LinkedHashMap<>(); |
| | | Map<String, Object> hashMapYear = new LinkedHashMap<>(); |
| | | double totalYearAttendance = 0; |
| | | // ä¸å¹´12个æ |
| | | for (int i = 1; i < 13; i++) { |
| | | Map<String, Object> hashMapMonth = new LinkedHashMap<>(); |
| | | double totalMonthAttendance = 0; |
| | | for (PersonalAttendanceLocationConfig personalAttendanceLocationConfig : personalAttendanceLocationConfigs) { |
| | | // åå§åèµå¼ |
| | | if (!hashMapYear.containsKey(personalAttendanceLocationConfig.getShift())){ |
| | | hashMapYear.put(personalAttendanceLocationConfig.getShift(), 0); |
| | | } |
| | | // æ |
| | | if (!ObjectUtils.isEmpty(map.get("month_str"))) { |
| | | String charArray = map.get("month_str").toString(); |
| | | int count = countOccurrences(charArray, i + "ï¼" + personalAttendanceLocationConfig.getShift()); |
| | | hashMapMonth.put(personalAttendanceLocationConfig.getShift(), count); |
| | | hashMapYear.put(personalAttendanceLocationConfig.getShift(), new BigDecimal(hashMapYear.get(personalAttendanceLocationConfig.getShift()).toString()).add(new BigDecimal(count))); |
| | | // æ©ï¼ä¸ï¼å¤ï¼å·® |
| | | if (personalAttendanceLocationConfig.getShift().contains("æ©") || |
| | | personalAttendanceLocationConfig.getShift().contains("ä¸") || |
| | | personalAttendanceLocationConfig.getShift().contains("æ") || |
| | | personalAttendanceLocationConfig.getShift().contains("å¤")) { |
| | | totalMonthAttendance += count; |
| | | totalYearAttendance += count; |
| | | } |
| | | } |
| | | // ç©ºæ°æ® |
| | | else { |
| | | map.put("work_time", i); |
| | | hashMapMonth.put(personalAttendanceLocationConfig.getShift(), 0); |
| | | } |
| | | } |
| | | hashMapMonth.put("totalMonthAttendance", totalMonthAttendance); |
| | | hashMapYear.put("totalYearAttendance", totalYearAttendance); |
| | | resultMap.put(i + "", hashMapMonth); |
| | | } |
| | | map.remove("month_str"); |
| | | map.remove("year_str"); |
| | | map.put("year", hashMapYear); |
| | | map.put("month", resultMap); |
| | | } |
| | | return mapYearList; |
| | | } |
| | | |
| | | public static int countOccurrences(String str, String target) { |
| | | int count = 0; |
| | | int index = 0; |
| | | while ((index = str.indexOf(target, index)) != -1) { |
| | | count++; |
| | | index += target.length(); |
| | | } |
| | | return count; |
| | | } |
| | | |
| | | public List<List<Object>> dataRequiredForProcessingIntoExcel(List<Map<String, Object>> list, List<PersonalAttendanceLocationConfig> personalAttendanceLocationConfigs) throws Exception { |
| | | List<List<Object>> data = new ArrayList<>(); |
| | | for (int i = 0; i < list.size(); i++) { |
| | | List<Object> excelRowList = new ArrayList<>(); |
| | | excelRowList.add(i + 1); |
| | | excelRowList.add(list.get(i).get("account")); |
| | | excelRowList.add(list.get(i).get("name")); |
| | | Map<String, Object> year = JackSonUtil.unmarshal(JackSonUtil.marshal(list.get(i).get("year")), Map.class); |
| | | excelRowList.add(year.get("totalYearAttendance")); |
| | | personalAttendanceLocationConfigs.forEach(j -> { |
| | | excelRowList.add(year.get(j.getShift())); |
| | | }); |
| | | Map<String, Map<String, Object>> month = JackSonUtil.unmarshal(JackSonUtil.marshal(list.get(i).get("month")), Map.class); |
| | | for (int j = 1; j < 13; j++) { |
| | | Object totalMonthAttendance = month.get(j + "").get("totalMonthAttendance"); |
| | | excelRowList.add(totalMonthAttendance); |
| | | for (PersonalAttendanceLocationConfig personalAttendanceLocationConfig : personalAttendanceLocationConfigs) { |
| | | excelRowList.add(month.get(j + "").get(personalAttendanceLocationConfig.getShift())); |
| | | } |
| | | } |
| | | data.add(excelRowList); |
| | | } |
| | | return data; |
| | | } |
| | | |
| | | |
| | | private List<PersonalShift> saveMonth (LocalDateTime week,String userId,List<PersonalShift> list){ |
| | | LocalDate firstDayOfMonth = week.toLocalDate().withDayOfMonth(1); |
| | | LocalDate lastDayOfMonth = week.toLocalDate().with(TemporalAdjusters.lastDayOfMonth()); |
| | | List<LocalDateTime> localDateTimesBetween = getLocalDateTimesBetween(firstDayOfMonth.atStartOfDay(), lastDayOfMonth.atStartOfDay()); |
| | | localDateTimesBetween.forEach(i -> { |
| | | PersonalShift personalShift = new PersonalShift(); |
| | | personalShift.setStaffOnJobId(Long.valueOf(userId)); |
| | | personalShift.setWorkTime(i); |
| | | list.add(personalShift); |
| | | if (list.size() >= 1000) { |
| | | saveBatch(list); |
| | | list.clear(); |
| | | } |
| | | }); |
| | | return list; |
| | | } |
| | | |
| | | // è·å两个localDateTimeçæ¯ä¸å¤© |
| | | public static List<LocalDateTime> getLocalDateTimesBetween(LocalDateTime start, LocalDateTime end) { |
| | | List<LocalDateTime> localDateTimes = new ArrayList<>(); |
| | | LocalDate currentDate = start.toLocalDate(); |
| | | LocalDateTime currentLocalDateTime = start; |
| | | while (!currentDate.isAfter(end.toLocalDate())) { |
| | | localDateTimes.add(currentLocalDateTime); |
| | | currentLocalDateTime = currentLocalDateTime.plusDays(1); |
| | | currentDate = currentDate.plusDays(1); |
| | | } |
| | | return localDateTimes; |
| | | } |
| | | |
| | | public static String getWeek(String dayStr) { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | try { |
| | | Date date = sdf.parse(dayStr); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(date); |
| | | int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK); |
| | | int day = calendar.get(Calendar.DAY_OF_MONTH); |
| | | return day + " " + getWeekDay(dayOfWeek); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public static String getWeekDay(int dayOfWeek) { |
| | | switch (dayOfWeek) { |
| | | case Calendar.MONDAY: |
| | | return "å¨ä¸"; |
| | | case Calendar.TUESDAY: |
| | | return "å¨äº"; |
| | | case Calendar.WEDNESDAY: |
| | | return "å¨ä¸"; |
| | | case Calendar.THURSDAY: |
| | | return "å¨å"; |
| | | case Calendar.FRIDAY: |
| | | return "å¨äº"; |
| | | case Calendar.SATURDAY: |
| | | return "å¨å
"; |
| | | case Calendar.SUNDAY: |
| | | return "卿¥"; |
| | | default: |
| | | return "æªç¥"; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è¿å表头 |
| | | * <p> |
| | | * å¤å±List代表è¡å
å± List代表å ç¸åçåæ°æ®ä¼è¢«ä¸»å¨åå¹¶ |
| | | * æé åå表头 |
| | | * |
| | | * @return List<List < String>> |
| | | */ |
| | | private static List<List<String>> getYearHeader(String year, List<PersonalAttendanceLocationConfig> personalAttendanceLocationConfigs) { |
| | | List<List<String>> line = new ArrayList<>(); |
| | | line.add(Arrays.asList("è夿±æ»", "åºå·", "åºå·")); |
| | | line.add(Arrays.asList("è夿±æ»", "å·¥å·", "å·¥å·")); |
| | | line.add(Arrays.asList("è夿±æ»", "å§å", "å§å")); |
| | | line.add(Arrays.asList("åºå¤è¯¦æ
", year, "åºå¤")); |
| | | // å¹´ header |
| | | for (PersonalAttendanceLocationConfig personalAttendanceLocationConfig : personalAttendanceLocationConfigs) { |
| | | line.add(Arrays.asList("è夿±æ»", year, personalAttendanceLocationConfig.getShift())); |
| | | } |
| | | // æheader |
| | | for (int i = 1; i < 13; i++) { |
| | | line.add(Arrays.asList("åºå¤è¯¦æ
", i + " æ", "åºå¤")); |
| | | for (PersonalAttendanceLocationConfig personalAttendanceLocationConfig : personalAttendanceLocationConfigs) { |
| | | line.add(Arrays.asList("åºå¤è¯¦æ
", i + " æ", personalAttendanceLocationConfig.getShift())); |
| | | } |
| | | } |
| | | return line; |
| | | } |
| | | |
| | | private static List<List<String>> getMonthHeader(LocalDateTime localDateTimeYear) { |
| | | String year = localDateTimeYear.getYear() + " 年人åçæ¬¡"; |
| | | List<List<String>> line = new ArrayList<>(); |
| | | line.add(Arrays.asList(year, "åºå·", "åºå·", "åºå·")); |
| | | line.add(Arrays.asList(year, "å§å", "å§å", "å§å")); |
| | | line.add(Arrays.asList(year, "é¨é¨", "é¨é¨", "é¨é¨")); |
| | | line.add(Arrays.asList(year, localDateTimeYear.getYear() + "", localDateTimeYear.getYear() + "", "åºå¤")); |
| | | line.add(Arrays.asList(year, localDateTimeYear.getYear() + "", localDateTimeYear.getYear() + "","ä¼")); |
| | | line.add(Arrays.asList(year, "å¹´", "å¹´", "请å")); |
| | | line.add(Arrays.asList(year, localDateTimeYear.getMonthValue() + "", localDateTimeYear.getMonthValue() + "", "æ©")); |
| | | line.add(Arrays.asList(year, "æ", "æ", "ä¸")); |
| | | line.add(Arrays.asList(year, "", "", "å¤")); |
| | | line.add(Arrays.asList(year, "卿¬¡", "ææ", "åºå·®")); |
| | | LocalDate firstDayOfMonth = localDateTimeYear.toLocalDate().withDayOfMonth(1); |
| | | LocalDate lastDayOfMonth = localDateTimeYear.toLocalDate().with(TemporalAdjusters.lastDayOfMonth()); |
| | | List<LocalDateTime> timeList = getLocalDateTimesBetween(firstDayOfMonth.atStartOfDay(), lastDayOfMonth.atStartOfDay()); |
| | | timeList.forEach(i -> { |
| | | int dayOfYear = i.getDayOfMonth(); |
| | | Date from = Date.from(i.atZone(ZoneId.systemDefault()).toInstant()); |
| | | String weekDay = getWeekDay(i.getDayOfWeek().getValue()); |
| | | line.add(Arrays.asList(year, DateUtil.weekOfYear(DateUtil.offsetDay(from, 1)) + "", weekDay, dayOfYear + "")); |
| | | }); |
| | | return line; |
| | | } |
| | | |
| | | public List<List<Object>> dataRequiredForProcessingIntoExcelMonth(List<PerformanceShiftMapDto> list, List<PersonalAttendanceLocationConfig> personalAttendanceLocationConfigs) { |
| | | List<List<Object>> data = new ArrayList<>(); |
| | | for (int i = 0; i < list.size(); i++) { |
| | | List<Object> excelRowList = new ArrayList<>(); |
| | | excelRowList.add(i + 1); |
| | | excelRowList.add(list.get(i).getName()); |
| | | excelRowList.add(list.get(i).getDepartment()); |
| | | excelRowList.add(list.get(i).getMonthlyAttendance().get("totalAttendance")); |
| | | excelRowList.add(list.get(i).getMonthlyAttendance().get("%ä¼%")); // ä¼ |
| | | excelRowList.add(list.get(i).getMonthlyAttendance().get("%å%")); // å |
| | | excelRowList.add(list.get(i).getMonthlyAttendance().get("%æ©%")); // æ© |
| | | excelRowList.add(list.get(i).getMonthlyAttendance().get("%ä¸%")); // ä¸ |
| | | excelRowList.add(list.get(i).getMonthlyAttendance().get("%å¤%")); // å¤ |
| | | excelRowList.add(list.get(i).getMonthlyAttendance().get("%å·®%")); // å·® |
| | | for (Map<String, Object> o : list.get(i).getList()) { |
| | | String enumLabel = ""; |
| | | for (PersonalAttendanceLocationConfig personalAttendanceLocationConfig : personalAttendanceLocationConfigs) { |
| | | if (personalAttendanceLocationConfig.getShift().equals(o.get("shift"))) { |
| | | enumLabel = personalAttendanceLocationConfig.getShift(); |
| | | } |
| | | } |
| | | excelRowList.add(ObjectUtils.isEmpty(enumLabel) ? "-" : enumLabel); |
| | | } |
| | | data.add(excelRowList); |
| | | } |
| | | return data; |
| | | } |
| | | |
| | | } |
| | |
| | | package com.ruoyi.staff.task; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.staff.dto.PerformanceShiftAddDto; |
| | | import com.ruoyi.staff.mapper.PersonalAttendanceLocationConfigMapper; |
| | | import com.ruoyi.staff.mapper.PersonalShiftMapper; |
| | | import com.ruoyi.staff.mapper.StaffOnJobMapper; |
| | | import com.ruoyi.staff.pojo.PersonalAttendanceLocationConfig; |
| | | import com.ruoyi.staff.pojo.PersonalAttendanceRecords; |
| | | import com.ruoyi.staff.pojo.StaffOnJob; |
| | | import com.ruoyi.staff.service.PersonalAttendanceRecordsService; |
| | | import com.ruoyi.staff.mapper.PersonalAttendanceRecordsMapper; |
| | | import com.ruoyi.staff.service.PersonalShiftService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | | import java.time.ZoneId; |
| | | import java.time.temporal.TemporalAdjusters; |
| | | import java.time.temporal.WeekFields; |
| | | import java.util.List; |
| | | import java.util.Locale; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 个人èå¤è®°å½å®æ¶ä»»å¡ |
| | |
| | | |
| | | @Autowired |
| | | private PersonalAttendanceRecordsService personalAttendanceRecordsService; |
| | | |
| | | @Autowired |
| | | private PersonalAttendanceLocationConfigMapper personalAttendanceLocationConfigMapper; |
| | | |
| | | @Autowired |
| | | private StaffOnJobMapper staffOnJobMapper; |
| | | |
| | | @Autowired |
| | | private PersonalShiftService personalShiftService; |
| | | |
| | | /** |
| | | * æ¯å¤©åæ¨çææ¨æ¥ç缺å¤è®°å½ |
| | |
| | | log.error("çææ¨æ¥ç¼ºå¤è®°å½ä»»å¡æ§è¡å¤±è´¥ï¼{}", e.getMessage(), e); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 宿¶ä»»å¡,æ¯ä¸ªæ1å·ç00:00:00ç»ä¸ä¸ä¸ªææç |
| | | * ç»æ¯ä¸ªäººé½è¿è¡æç(é»è®¤æ©ç) |
| | | */ |
| | | @Scheduled(cron = "0 10 0 1 * ?") |
| | | private void timerCreateSchedule() { |
| | | log.info("å¼å§ç»æ¯ä¸ªäººè¿è¡æç,é»è®¤æ©ç======start"); |
| | | PerformanceShiftAddDto performanceShiftAddDto = new PerformanceShiftAddDto(); |
| | | //æ¥è¯¢ææç次(æå¡è§å) |
| | | List<PersonalAttendanceLocationConfig> personalAttendanceLocationConfigs = personalAttendanceLocationConfigMapper.selectList(null); |
| | | if (CollectionUtil.isEmpty(personalAttendanceLocationConfigs)){ |
| | | return; |
| | | } |
| | | performanceShiftAddDto.setPersonalAttendanceLocationConfigId(personalAttendanceLocationConfigs.get(0).getId()); |
| | | //å¨è人å |
| | | List<StaffOnJob> staffOnJobs = staffOnJobMapper.selectList(Wrappers.<StaffOnJob>lambdaQuery().eq(StaffOnJob::getStaffState, 1)); |
| | | if (CollectionUtil.isEmpty(staffOnJobs)){ |
| | | return; |
| | | } |
| | | String userIds = staffOnJobs.stream().map(user -> user.getId().toString()).distinct().collect(Collectors.joining(",")); |
| | | performanceShiftAddDto.setStaffOnJobId(userIds); |
| | | //卿¬¡--å½æææ |
| | | // è·åå½åæ¥æ |
| | | LocalDate today = LocalDate.now(ZoneId.of(ZoneId.SHORT_IDS.get("CTT"))).plusMonths(1); |
| | | // è·åæ¬æç第ä¸å¤©åæåä¸å¤© |
| | | LocalDate firstDayOfMonth = today.with(TemporalAdjusters.firstDayOfMonth()); |
| | | LocalDate lastDayOfMonth = today.with(TemporalAdjusters.lastDayOfMonth()); |
| | | // è·åå¨å段信æ¯ï¼æ ¹æ®åºåè®¾ç½®ï¼ |
| | | WeekFields weekFields = WeekFields.of(Locale.getDefault()); |
| | | // è·åæ¬æç¬¬ä¸å¤©çå¨ä¸ |
| | | LocalDate startOfWeek = firstDayOfMonth.with(TemporalAdjusters.previousOrSame(weekFields.getFirstDayOfWeek())); |
| | | // éåæ¬æææå¤©æ°ï¼æ¾åºæ¯å¨ç第ä¸å¤©åæåä¸å¤© |
| | | LocalDate endOfWeek; |
| | | while (startOfWeek.isBefore(firstDayOfMonth.plusMonths(1))) { |
| | | endOfWeek = startOfWeek.plusDays(6); |
| | | LocalDateTime startDateTime = LocalDateTime.of(startOfWeek, LocalTime.MIDNIGHT); |
| | | LocalDateTime endDateTime = LocalDateTime.of(endOfWeek, LocalTime.MIDNIGHT); |
| | | log.info("Week starts on {} and ends on {}", startDateTime, endDateTime); |
| | | performanceShiftAddDto.setStartWeek(startDateTime); |
| | | performanceShiftAddDto.setEndWeek(endDateTime); |
| | | personalShiftService.performanceShiftAdd(performanceShiftAddDto); |
| | | startOfWeek = startOfWeek.plusWeeks(1); |
| | | } |
| | | log.info("æçç»æ======end"); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.staff.utils; |
| | | |
| | | import com.fasterxml.jackson.core.JsonGenerationException; |
| | | import com.fasterxml.jackson.core.JsonParseException; |
| | | import com.fasterxml.jackson.databind.JsonMappingException; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.fasterxml.jackson.databind.ObjectWriter; |
| | | import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | | |
| | | /** |
| | | * JSONè§£æå¤ç |
| | | * |
| | | * @author zss |
| | | */ |
| | | @Component |
| | | public class JackSonUtil { |
| | | private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); |
| | | private static final ObjectWriter OBJECT_WRITER = OBJECT_MAPPER.writerWithDefaultPrettyPrinter(); |
| | | |
| | | public static void marshal(File file, Object value) throws Exception { |
| | | try { |
| | | OBJECT_WRITER.writeValue(file, value); |
| | | } catch (JsonGenerationException e) { |
| | | throw new Exception(e); |
| | | } catch (JsonMappingException e) { |
| | | throw new Exception(e); |
| | | } catch (IOException e) { |
| | | throw new Exception(e); |
| | | } |
| | | } |
| | | |
| | | public static void marshal(OutputStream os, Object value) throws Exception { |
| | | try { |
| | | OBJECT_WRITER.writeValue(os, value); |
| | | } catch (JsonGenerationException e) { |
| | | throw new Exception(e); |
| | | } catch (JsonMappingException e) { |
| | | throw new Exception(e); |
| | | } catch (IOException e) { |
| | | throw new Exception(e); |
| | | } |
| | | } |
| | | |
| | | public static String marshal(Object value) throws Exception { |
| | | try { |
| | | return OBJECT_WRITER.writeValueAsString(value); |
| | | } catch (JsonGenerationException e) { |
| | | throw new Exception(e); |
| | | } catch (JsonMappingException e) { |
| | | throw new Exception(e); |
| | | } catch (IOException e) { |
| | | throw new Exception(e); |
| | | } |
| | | } |
| | | |
| | | public static byte[] marshalBytes(Object value) throws Exception { |
| | | try { |
| | | return OBJECT_WRITER.writeValueAsBytes(value); |
| | | } catch (JsonGenerationException e) { |
| | | throw new Exception(e); |
| | | } catch (JsonMappingException e) { |
| | | throw new Exception(e); |
| | | } catch (IOException e) { |
| | | throw new Exception(e); |
| | | } |
| | | } |
| | | |
| | | public static <T> T unmarshal(File file, Class<T> valueType) throws Exception { |
| | | try { |
| | | return OBJECT_MAPPER.readValue(file, valueType); |
| | | } catch (JsonParseException e) { |
| | | throw new Exception(e); |
| | | } catch (JsonMappingException e) { |
| | | throw new Exception(e); |
| | | } catch (IOException e) { |
| | | throw new Exception(e); |
| | | } |
| | | } |
| | | |
| | | public static <T> T unmarshal(InputStream is, Class<T> valueType) throws Exception { |
| | | try { |
| | | return OBJECT_MAPPER.readValue(is, valueType); |
| | | } catch (JsonParseException e) { |
| | | throw new Exception(e); |
| | | } catch (JsonMappingException e) { |
| | | throw new Exception(e); |
| | | } catch (IOException e) { |
| | | throw new Exception(e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å符串转对象 |
| | | * @param str |
| | | * @param valueType |
| | | * @return |
| | | * @param <T> |
| | | * @throws Exception |
| | | */ |
| | | public static <T> T unmarshal(String str, Class<T> valueType) throws Exception { |
| | | try { |
| | | OBJECT_MAPPER.registerModule(new JavaTimeModule()); |
| | | return OBJECT_MAPPER.readValue(str, valueType); |
| | | } catch (JsonParseException e) { |
| | | throw new Exception(e); |
| | | } catch (JsonMappingException e) { |
| | | throw new Exception(e); |
| | | } catch (IOException e) { |
| | | throw new Exception(e); |
| | | } |
| | | } |
| | | |
| | | public static <T> T unmarshal(byte[] bytes, Class<T> valueType) throws Exception { |
| | | try { |
| | | if (bytes == null) { |
| | | bytes = new byte[0]; |
| | | } |
| | | return OBJECT_MAPPER.readValue(bytes, 0, bytes.length, valueType); |
| | | } catch (JsonParseException e) { |
| | | throw new Exception(e); |
| | | } catch (JsonMappingException e) { |
| | | throw new Exception(e); |
| | | } catch (IOException e) { |
| | | throw new Exception(e); |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.staff.utils; |
| | | |
| | | import com.alibaba.excel.write.metadata.style.WriteCellStyle; |
| | | import com.alibaba.excel.write.metadata.style.WriteFont; |
| | | import org.apache.poi.ss.usermodel.BorderStyle; |
| | | import org.apache.poi.ss.usermodel.FillPatternType; |
| | | import org.apache.poi.ss.usermodel.HorizontalAlignment; |
| | | import org.apache.poi.ss.usermodel.VerticalAlignment; |
| | | |
| | | public class StyleMonthUtils { |
| | | /** |
| | | * æ 颿 ·å¼ |
| | | * @return |
| | | */ |
| | | public static WriteCellStyle getHeadStyle(){ |
| | | // 头ççç¥ |
| | | WriteCellStyle headWriteCellStyle = new WriteCellStyle(); |
| | | // èæ¯é¢è² |
| | | // headWriteCellStyle.setFillForegroundColor(IndexedColors.WHITE.getIndex()); |
| | | // headWriteCellStyle.setFillPatternType(FillPatternType.SOLID_FOREGROUND); |
| | | |
| | | // åä½ |
| | | WriteFont headWriteFont = new WriteFont(); |
| | | headWriteFont.setFontName("ç线");//设置åä½åå |
| | | headWriteFont.setFontHeightInPoints((short)9);//设置åä½å¤§å° |
| | | headWriteFont.setBold(true);//åä½å ç² |
| | | headWriteFont.setColor((short) 0); |
| | | headWriteCellStyle.setWriteFont(headWriteFont); //卿 ·å¼ç¨åºç¨è®¾ç½®çåä½; |
| | | |
| | | // æ ·å¼ |
| | | headWriteCellStyle.setBorderBottom(BorderStyle.THIN);//设置åºè¾¹æ¡; |
| | | headWriteCellStyle.setBottomBorderColor((short) 0);//设置åºè¾¹æ¡é¢è²; |
| | | headWriteCellStyle.setBorderLeft(BorderStyle.THIN); //设置左边æ¡; |
| | | headWriteCellStyle.setLeftBorderColor((short) 0);//设置左边æ¡é¢è²; |
| | | headWriteCellStyle.setBorderRight(BorderStyle.THIN);//设置å³è¾¹æ¡; |
| | | headWriteCellStyle.setRightBorderColor((short) 0);//设置å³è¾¹æ¡é¢è²; |
| | | headWriteCellStyle.setBorderTop(BorderStyle.THIN);//设置顶边æ¡; |
| | | headWriteCellStyle.setTopBorderColor((short) 0); //设置顶边æ¡é¢è²; |
| | | |
| | | headWriteCellStyle.setWrapped(false); //设置èªå¨æ¢è¡; |
| | | |
| | | headWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);//设置水平对é½çæ ·å¼ä¸ºå±
ä¸å¯¹é½; |
| | | headWriteCellStyle.setVerticalAlignment(VerticalAlignment.CENTER); //设置åç´å¯¹é½çæ ·å¼ä¸ºå±
ä¸å¯¹é½; |
| | | headWriteCellStyle.setShrinkToFit(true);//è®¾ç½®ææ¬æ¶ç¼©è³åé |
| | | |
| | | return headWriteCellStyle; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * å
å®¹æ ·å¼ |
| | | * @return |
| | | */ |
| | | public static WriteCellStyle getContentStyle(){ |
| | | // å
容ççç¥ |
| | | WriteCellStyle contentWriteCellStyle = new WriteCellStyle(); |
| | | |
| | | // è¿ééè¦æå® FillPatternType 为FillPatternType.SOLID_FOREGROUND ä¸ç¶æ æ³æ¾ç¤ºèæ¯é¢è².头é»è®¤äº FillPatternTypeæä»¥å¯ä»¥ä¸æå® |
| | | // contentWriteCellStyle.setFillForegroundColor(IndexedColors.LIGHT_GREEN.getIndex()); |
| | | contentWriteCellStyle.setFillPatternType(FillPatternType.SOLID_FOREGROUND); |
| | | |
| | | // 设置åä½ |
| | | WriteFont contentWriteFont = new WriteFont(); |
| | | contentWriteFont.setFontHeightInPoints((short) 10);//设置åä½å¤§å° |
| | | contentWriteFont.setFontName("ç线"); //设置åä½åå |
| | | contentWriteCellStyle.setWriteFont(contentWriteFont);//卿 ·å¼ç¨åºç¨è®¾ç½®çåä½; |
| | | |
| | | //è®¾ç½®æ ·å¼; |
| | | contentWriteCellStyle.setBorderBottom(BorderStyle.THIN);//设置åºè¾¹æ¡; |
| | | contentWriteCellStyle.setBottomBorderColor((short) 0);//设置åºè¾¹æ¡é¢è²; |
| | | contentWriteCellStyle.setBorderLeft(BorderStyle.THIN); //设置左边æ¡; |
| | | contentWriteCellStyle.setLeftBorderColor((short) 0);//设置左边æ¡é¢è²; |
| | | contentWriteCellStyle.setBorderRight(BorderStyle.THIN);//设置å³è¾¹æ¡; |
| | | contentWriteCellStyle.setRightBorderColor((short) 0);//设置å³è¾¹æ¡é¢è²; |
| | | contentWriteCellStyle.setBorderTop(BorderStyle.THIN);//设置顶边æ¡; |
| | | contentWriteCellStyle.setTopBorderColor((short) 0); ///设置顶边æ¡é¢è²; |
| | | |
| | | contentWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);// æ°´å¹³å±
ä¸ |
| | | contentWriteCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);// åç´å±
ä¸ |
| | | contentWriteCellStyle.setWrapped(false); //设置èªå¨æ¢è¡; |
| | | |
| | | // contentWriteCellStyle.setShrinkToFit(true);//è®¾ç½®ææ¬æ¶ç¼©è³åé |
| | | |
| | | return contentWriteCellStyle; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.staff.utils; |
| | | |
| | | import com.alibaba.excel.write.metadata.style.WriteCellStyle; |
| | | import com.alibaba.excel.write.metadata.style.WriteFont; |
| | | import org.apache.poi.ss.usermodel.BorderStyle; |
| | | import org.apache.poi.ss.usermodel.FillPatternType; |
| | | import org.apache.poi.ss.usermodel.HorizontalAlignment; |
| | | import org.apache.poi.ss.usermodel.VerticalAlignment; |
| | | |
| | | public class StyleYearUtils { |
| | | /** |
| | | * æ 颿 ·å¼ |
| | | * |
| | | * @return |
| | | */ |
| | | public static WriteCellStyle getHeadStyle() { |
| | | // 头ççç¥ |
| | | WriteCellStyle headWriteCellStyle = new WriteCellStyle(); |
| | | // èæ¯é¢è² |
| | | // headWriteCellStyle.setFillForegroundColor(IndexedColors.GREEN.getIndex()); |
| | | headWriteCellStyle.setFillPatternType(FillPatternType.SOLID_FOREGROUND); |
| | | |
| | | // åä½ |
| | | WriteFont headWriteFont = new WriteFont(); |
| | | headWriteFont.setFontName("仿å®");//设置åä½åå |
| | | headWriteFont.setFontHeightInPoints((short) 9);//设置åä½å¤§å° |
| | | headWriteFont.setBold(true);//åä½å ç² |
| | | headWriteFont.setColor((short) 1); |
| | | headWriteCellStyle.setWriteFont(headWriteFont); //卿 ·å¼ç¨åºç¨è®¾ç½®çåä½; |
| | | |
| | | // æ ·å¼ |
| | | headWriteCellStyle.setBorderBottom(BorderStyle.THIN);//设置åºè¾¹æ¡; |
| | | headWriteCellStyle.setBottomBorderColor((short) 1);//设置åºè¾¹æ¡é¢è²; |
| | | headWriteCellStyle.setBorderLeft(BorderStyle.THIN); //设置左边æ¡; |
| | | headWriteCellStyle.setLeftBorderColor((short) 1);//设置左边æ¡é¢è²; |
| | | headWriteCellStyle.setBorderRight(BorderStyle.THIN);//设置å³è¾¹æ¡; |
| | | headWriteCellStyle.setRightBorderColor((short) 1);//设置å³è¾¹æ¡é¢è²; |
| | | headWriteCellStyle.setBorderTop(BorderStyle.THIN);//设置顶边æ¡; |
| | | headWriteCellStyle.setTopBorderColor((short) 1); //设置顶边æ¡é¢è²; |
| | | |
| | | headWriteCellStyle.setWrapped(false); //设置èªå¨æ¢è¡; |
| | | |
| | | headWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);//设置水平对é½çæ ·å¼ä¸ºå±
ä¸å¯¹é½; |
| | | headWriteCellStyle.setVerticalAlignment(VerticalAlignment.CENTER); //设置åç´å¯¹é½çæ ·å¼ä¸ºå±
ä¸å¯¹é½; |
| | | headWriteCellStyle.setShrinkToFit(true);//è®¾ç½®ææ¬æ¶ç¼©è³åé |
| | | |
| | | return headWriteCellStyle; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * å
å®¹æ ·å¼ |
| | | * |
| | | * @return |
| | | */ |
| | | public static WriteCellStyle getContentStyle() { |
| | | // å
容ççç¥ |
| | | WriteCellStyle contentWriteCellStyle = new WriteCellStyle(); |
| | | |
| | | // è¿ééè¦æå® FillPatternType 为FillPatternType.SOLID_FOREGROUND ä¸ç¶æ æ³æ¾ç¤ºèæ¯é¢è².头é»è®¤äº FillPatternTypeæä»¥å¯ä»¥ä¸æå® |
| | | // contentWriteCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); |
| | | contentWriteCellStyle.setFillPatternType(FillPatternType.SOLID_FOREGROUND); |
| | | |
| | | // 设置åä½ |
| | | WriteFont contentWriteFont = new WriteFont(); |
| | | contentWriteFont.setFontHeightInPoints((short) 9);//设置åä½å¤§å° |
| | | contentWriteFont.setFontName("仿å®"); //设置åä½åå |
| | | contentWriteCellStyle.setWriteFont(contentWriteFont);//卿 ·å¼ç¨åºç¨è®¾ç½®çåä½; |
| | | |
| | | //è®¾ç½®æ ·å¼; |
| | | contentWriteCellStyle.setBorderBottom(BorderStyle.THIN);//设置åºè¾¹æ¡; |
| | | contentWriteCellStyle.setBottomBorderColor((short) 0);//设置åºè¾¹æ¡é¢è²; |
| | | contentWriteCellStyle.setBorderLeft(BorderStyle.THIN); //设置左边æ¡; |
| | | contentWriteCellStyle.setLeftBorderColor((short) 0);//设置左边æ¡é¢è²; |
| | | contentWriteCellStyle.setBorderRight(BorderStyle.THIN);//设置å³è¾¹æ¡; |
| | | contentWriteCellStyle.setRightBorderColor((short) 0);//设置å³è¾¹æ¡é¢è²; |
| | | contentWriteCellStyle.setBorderTop(BorderStyle.THIN);//设置顶边æ¡; |
| | | contentWriteCellStyle.setTopBorderColor((short) 0); ///设置顶边æ¡é¢è²; |
| | | |
| | | contentWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);// æ°´å¹³å±
ä¸ |
| | | contentWriteCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);// åç´å±
ä¸ |
| | | contentWriteCellStyle.setWrapped(false); //设置èªå¨æ¢è¡; |
| | | |
| | | // contentWriteCellStyle.setShrinkToFit(true);//è®¾ç½®ææ¬æ¶ç¼©è³åé |
| | | |
| | | return contentWriteCellStyle; |
| | | } |
| | | |
| | | } |
| | |
| | | t2.tax_exclusive_total_price, |
| | | t3.inbound_num as quantityStock |
| | | from purchase_ledger t1 |
| | | left join sales_ledger_product t2 on t1.id = t2.sales_ledger_id |
| | | left join sales_ledger_product t2 on t1.id = t2.sales_ledger_id and slp.type = 2 |
| | | left join procurement_record_storage t3 on t2.id = t3.sales_ledger_product_id |
| | | where t1.purchase_contract_number = #{req.purchaseContractNumber} |
| | | <if test="req.id != null and req.id != ''"> |
| | |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.procurementrecord.mapper.ReturnManagementMapper"> |
| | | |
| | | <select id="listPage" resultType="com.ruoyi.procurementrecord.pojo.ReturnManagement"> |
| | | select * from return_management |
| | | <select id="listPage" resultType="com.ruoyi.procurementrecord.dto.ReturnManagementDto"> |
| | | select rm.*, |
| | | c.customer_name, |
| | | si.shipping_no, |
| | | sl.project_name, |
| | | sl.sales_contract_no, |
| | | sl.salesman |
| | | from return_management rm |
| | | left join shipping_info si on rm.shipping_id = si.id |
| | | left join customer c on rm.customer_id = c.id |
| | | left join sales_ledger sl on si.sales_ledger_id = sl.id |
| | | <where> |
| | | <if test="req.returnNo != null and req.returnNo != ''"> |
| | | and return_no like concat('%',#{req.returnNo},'%') |
| | | and rm.return_no like concat('%',#{req.returnNo},'%') |
| | | </if> |
| | | <if test="req.returnType != null and req.returnType != ''"> |
| | | and return_type = #{req.returnType} |
| | | <if test="req.customerName != null and req.customerName != ''"> |
| | | and c.customer_name like concat('%',#{req.customerName},'%') |
| | | </if> |
| | | <if test="req.projectName != null and req.projectName != ''"> |
| | | and sl.project_name like concat('%',#{req.projectName},'%') |
| | | </if> |
| | | <if test="req.salesman != null and req.salesman != ''"> |
| | | and sl.salesman like concat('%',#{req.salesman},'%') |
| | | </if> |
| | | <if test="req.shippingNo != null and req.shippingNo != ''"> |
| | | and rm.shipping_no like concat('%',#{req.shippingNo},'%') |
| | | </if> |
| | | <if test="req.projectStage != null and req.projectStage != ''"> |
| | | and rm.project_stage like concat('%',#{req.projectStage},'%') |
| | | </if> |
| | | <if test="req.maker != null and req.maker != ''"> |
| | | and rm.maker like concat('%',#{req.maker},'%') |
| | | </if> |
| | | <if test="req.salesContractNo != null and req.salesContractNo != ''"> |
| | | and sl.sales_contract_no like concat('%',#{req.salesContractNo},'%') |
| | | </if> |
| | | </where> |
| | | </select> |
| | | <select id="getReturnManagementDtoById" resultType="com.ruoyi.procurementrecord.dto.ReturnManagementDto"> |
| | | select rm.*, |
| | | c.customer_name, |
| | | si.shipping_no, |
| | | sl.project_name, |
| | | sl.sales_contract_no, |
| | | sl.salesman |
| | | from return_management rm |
| | | left join shipping_info si on rm.shipping_id = si.id |
| | | left join customer c on rm.customer_id = c.id |
| | | left join sales_ledger sl on si.sales_ledger_id = sl.id |
| | | where rm.id = #{id} |
| | | </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.procurementrecord.mapper.ReturnSaleProductMapper"> |
| | | |
| | | <!-- éç¨æ¥è¯¢æ å°ç»æ --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.procurementrecord.pojo.ReturnSaleProduct"> |
| | | <id column="id" property="id" /> |
| | | <result column="return_management_id" property="returnManagementId" /> |
| | | <result column="return_sale_ledger_product_id" property="returnSaleLedgerProductId" /> |
| | | <result column="num" property="num" /> |
| | | <result column="status" property="status" /> |
| | | </resultMap> |
| | | <select id="listReturnSaleProductDto" resultType="com.ruoyi.procurementrecord.dto.ReturnSaleProductDto"> |
| | | SELECT slp.product_category as product_name, |
| | | slp.specification_model as model, |
| | | rsp.*, |
| | | GREATEST(slp.quantity - COALESCE(rs.total_return_num, 0), 0) AS un_quantity, |
| | | COALESCE(rs.total_return_num, 0) AS total_return_num |
| | | FROM return_sale_product rsp |
| | | LEFT JOIN return_management rm ON rm.id = rsp.return_management_id |
| | | LEFT JOIN shipping_info si ON si.id = rm.shipping_id |
| | | LEFT JOIN sales_ledger_product slp ON si.sales_ledger_product_id = slp.id and slp.type = 1 |
| | | LEFT JOIN (SELECT return_sale_ledger_product_id, |
| | | |
| | | SUM(num) AS total_return_num |
| | | FROM return_sale_product |
| | | WHERE 1 = 1 and return_management_id != #{returnManagementId} |
| | | GROUP BY return_sale_ledger_product_id) rs ON rs.return_sale_ledger_product_id = slp.id |
| | | where rm.id =#{returnManagementId} |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | ) shipping_status_counts ON sl.id = shipping_status_counts.sales_ledger_id |
| | | left join product_model pm on po.product_model_id = pm.id |
| | | left join product p on pm.product_id = p.id |
| | | left join sales_ledger_product slp on po.sale_ledger_product_id = slp.id |
| | | left join sales_ledger_product slp on po.sale_ledger_product_id = slp.id and slp.type = 1 |
| | | left join product_process_route ppr on po.id = ppr.product_order_id |
| | | left join product_bom pb on pb.id = ppr.bom_id |
| | | <where> |
| | |
| | | FROM |
| | | sales_ledger_production_accounting t4 |
| | | LEFT JOIN sales_ledger T1 ON T1.id = t4.sales_ledger_id |
| | | left join sales_ledger_product t3 on t4.sales_ledger_product_id = t3.id |
| | | left join sales_ledger_product t3 on t4.sales_ledger_product_id = t3.id and slp.type = 1 |
| | | <where> |
| | | t3.type = 1 |
| | | <if test="salesLedgerDto.schedulingUserName != null and salesLedgerDto.schedulingUserName != '' "> |
| | |
| | | FROM |
| | | sales_ledger_scheduling T2 |
| | | LEFT JOIN sales_ledger T1 ON T1.id = T2.sales_ledger_id |
| | | left join sales_ledger_product t3 on T2.sales_ledger_product_id = t3.id |
| | | left join sales_ledger_product t3 on T2.sales_ledger_product_id = t3.id and slp.type = 1 |
| | | <where> |
| | | t3.type = 1 |
| | | <if test="salesLedgerDto.status != null and salesLedgerDto.status != '' "> |
| | |
| | | FROM |
| | | sales_ledger_work t4 |
| | | LEFT JOIN sales_ledger T1 ON T1.id = t4.sales_ledger_id |
| | | left join sales_ledger_product t3 on t4.sales_ledger_product_id = t3.id |
| | | left join sales_ledger_product t3 on t4.sales_ledger_product_id = t3.id and slp.type = 1 |
| | | left join sales_ledger_scheduling t2 on t4.sales_ledger_scheduling_id = t2.id |
| | | <where> |
| | | t3.type = 1 |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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.projectManagement.mapper.PlanMapper"> |
| | | |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.projectManagement.pojo.Plan"> |
| | | <id property="id" column="id" jdbcType="BIGINT"/> |
| | | <result property="name" column="name" jdbcType="VARCHAR"/> |
| | | <result property="description" column="description" jdbcType="VARCHAR"/> |
| | | <result property="attachment" column="attachment" jdbcType="VARCHAR"/> |
| | | <result property="isDelete" column="is_delete" jdbcType="INTEGER"/> |
| | | <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> |
| | | <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/> |
| | | <result property="createUser" column="create_user" jdbcType="VARCHAR"/> |
| | | <result property="updateUser" column="update_user" jdbcType="VARCHAR"/> |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List"> |
| | | id,name,description, |
| | | attachment,is_delete,create_time, |
| | | update_time,create_user,update_user |
| | | </sql> |
| | | |
| | | <select id="selectPlanPage" resultMap="BaseResultMap"> |
| | | select t1.* |
| | | from project_management_plan as t1 |
| | | where t1.is_delete = 0 |
| | | order by t1.create_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.projectManagement.mapper.PlanNodeMapper"> |
| | | |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.projectManagement.pojo.PlanNode"> |
| | | <id property="id" column="id" jdbcType="BIGINT"/> |
| | | <result property="projectManagementPlanId" column="project_management_plan_id" jdbcType="BIGINT"/> |
| | | <result property="sort" column="sort" jdbcType="INTEGER"/> |
| | | <result property="name" column="name" jdbcType="VARCHAR"/> |
| | | <result property="leaderId" column="leader_id" jdbcType="BIGINT"/> |
| | | <result property="leaderName" column="leader_name" jdbcType="VARCHAR"/> |
| | | <result property="estimatedDuration" column="estimated_duration" jdbcType="INTEGER"/> |
| | | <result property="hourlyRate" column="hourly_rate" jdbcType="VARCHAR"/> |
| | | <result property="workContent" column="work_content" jdbcType="VARCHAR"/> |
| | | <result property="isDelete" column="is_delete" jdbcType="INTEGER"/> |
| | | <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> |
| | | <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/> |
| | | <result property="createUser" column="create_user" jdbcType="VARCHAR"/> |
| | | <result property="updateUser" column="update_user" jdbcType="VARCHAR"/> |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List"> |
| | | id,project_management_plan_id,sort, |
| | | name,leader_id,leader_name, |
| | | estimated_duration,hourly_rate,work_content, |
| | | is_delete,create_time,update_time, |
| | | create_user,update_user |
| | | </sql> |
| | | </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.purchase.mapper.PurchaseReturnOrdersMapper"> |
| | | |
| | | <!-- éç¨æ¥è¯¢æ å°ç»æ --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.purchase.pojo.PurchaseReturnOrders"> |
| | | <id column="id" property="id" /> |
| | | <result column="no" property="no" /> |
| | | <result column="return_type" property="returnType" /> |
| | | <result column="supplier_id" property="supplierId" /> |
| | | <result column="project_id" property="projectId" /> |
| | | <result column="project_phase" property="projectPhase" /> |
| | | <result column="prepared_at" property="preparedAt" /> |
| | | <result column="prepared_user_id" property="preparedUserId" /> |
| | | <result column="return_user_id" property="returnUserId" /> |
| | | <result column="purchase_ledger_id" property="purchaseLedgerId" /> |
| | | <result column="remark" property="remark" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="update_time" property="updateTime" /> |
| | | </resultMap> |
| | | |
| | | <select id="listPage" resultType="com.ruoyi.purchase.vo.PurchaseReturnOrderVo"> |
| | | SELECT |
| | | pro.*, |
| | | sm.supplier_name as supplierName, |
| | | pl.purchase_contract_number as purchaseContractNumber, |
| | | su.user_name as returnUserName, |
| | | su1.user_name as createUserName |
| | | FROM purchase_return_orders pro |
| | | LEFT JOIN supplier_manage sm ON pro.supplier_id = sm.id |
| | | LEFT JOIN purchase_ledger pl ON pl.id = pro.purchase_ledger_id |
| | | LEFT JOIN sys_user su ON su.user_id = pro.return_user_id |
| | | LEFT JOIN sys_user su1 ON su1.user_id = pro.prepared_user_id |
| | | where 1=1 |
| | | <if test="params.no != null and params.no != '' "> |
| | | AND pro.no LIKE CONCAT('%',#{params.no},'%') |
| | | </if> |
| | | </select> |
| | | </mapper> |
| | |
| | | FROM invoice_ledger_file |
| | | GROUP BY invoice_ledger_id |
| | | ) T4 ON T4.invoice_ledger_id = T1.id |
| | | LEFT JOIN sales_ledger_product T5 ON T2.sales_ledger_product_id = T5.id |
| | | LEFT JOIN sales_ledger_product T5 ON T2.sales_ledger_product_id = T5.id and slp.type = 1 |
| | | LEFT JOIN ( |
| | | SELECT |
| | | SUM(receipt_payment_amount) AS receipt_payment_amount_total, |
| | |
| | | GROUP_CONCAT( name ORDER BY id ASC SEPARATOR ' | ') AS invoiceFileName |
| | | FROM invoice_ledger_file GROUP BY invoice_ledger_id |
| | | ) T4 ON T4.invoice_ledger_id = T1.id |
| | | LEFT JOIN sales_ledger_product T5 ON T2.sales_ledger_product_id = T5.id |
| | | LEFT JOIN sales_ledger_product T5 ON T2.sales_ledger_product_id = T5.id and slp.type = 1 |
| | | LEFT JOIN ( |
| | | SELECT SUM(receipt_payment_amount) AS receipt_payment_amount_total,invoice_ledger_id FROM receipt_payment GROUP |
| | | BY invoice_ledger_id |
| | |
| | | GROUP_CONCAT( name ORDER BY id ASC SEPARATOR ' | ') AS invoiceFileName |
| | | FROM invoice_ledger_file GROUP BY invoice_ledger_id |
| | | ) T4 ON T4.invoice_ledger_id = T1.id |
| | | LEFT JOIN sales_ledger_product T5 ON T2.sales_ledger_product_id = T5.id |
| | | LEFT JOIN sales_ledger_product T5 ON T2.sales_ledger_product_id = T5.id and slp.type = 1 |
| | | LEFT JOIN ( |
| | | SELECT SUM(receipt_payment_amount) AS receipt_payment_amount_total,invoice_ledger_id FROM receipt_payment GROUP |
| | | BY invoice_ledger_id |
| | |
| | | left join production_product_main ppm on qi.product_main_id = ppm.id |
| | | left join product_work_order pwo on ppm.work_order_id = pwo.id |
| | | left join product_order po on pwo.product_order_id = po.id |
| | | left join sales_ledger_product slp on po.sale_ledger_product_id = slp.id |
| | | left join sales_ledger_product slp on po.sale_ledger_product_id = slp.id and slp.type = 1 |
| | | where qi.product_main_id = #{productMainId} |
| | | |
| | | |
| | |
| | | p.product_name, |
| | | ps.unit_quantity * slp.quantity AS single_quantity |
| | | FROM sales_ledger sl |
| | | LEFT JOIN sales_ledger_product slp ON slp.sales_ledger_id = sl.id |
| | | LEFT JOIN sales_ledger_product slp ON slp.sales_ledger_id = sl.id and slp.type = 1 |
| | | LEFT JOIN product_model pm ON pm.id = slp.product_model_id |
| | | LEFT JOIN product_bom pb ON pb.product_model_id = pm.id |
| | | LEFT JOIN product_structure ps ON pb.id = ps.bom_id |
| | |
| | | FROM shipment_approval sa |
| | | LEFT JOIN shipping_info si ON sa.shipping_info_id = si.id |
| | | LEFT JOIN sales_ledger sl ON sa.sales_ledger_id = sl.id |
| | | LEFT JOIN sales_ledger_product slp ON sa.sales_ledger_product_id = slp.id |
| | | LEFT JOIN sales_ledger_product slp ON sa.sales_ledger_product_id = slp.id and slp.type = 1 |
| | | LEFT JOIN sys_user T2 ON sl.entry_person = T2.user_id |
| | | <where> |
| | | 1=1 |
| | |
| | | sl.customer_name |
| | | FROM shipping_info s |
| | | LEFT JOIN sales_ledger sl ON s.sales_ledger_id = sl.id |
| | | LEFT JOIN sales_ledger_product slp ON s.sales_ledger_product_id = slp.id |
| | | LEFT JOIN sales_ledger_product slp ON s.sales_ledger_product_id = slp.id and slp.type = 1 |
| | | left join product_model pm on slp.product_model_id = pm.id |
| | | left join product p on pm.product_id = p.id |
| | | WHERE 1=1 |
| | |
| | | FROM shipping_info s |
| | | LEFT JOIN sales_ledger sl ON s.sales_ledger_id = sl.id |
| | | </select> |
| | | <select id="getReturnManagementDtoById" resultType="com.ruoyi.sales.dto.SalesLedgerProductDto"> |
| | | SELECT |
| | | slp.*, |
| | | GREATEST(slp.quantity - COALESCE(rs.total_return_num, 0), 0) AS un_quantity, |
| | | COALESCE(rs.total_return_num, 0) AS total_return_num |
| | | FROM shipping_info si |
| | | LEFT JOIN sales_ledger_product slp ON si.sales_ledger_product_id = slp.id and slp.type = 1 |
| | | LEFT JOIN ( |
| | | SELECT |
| | | return_sale_ledger_product_id, |
| | | SUM(num) AS total_return_num |
| | | FROM return_sale_product rsp |
| | | left join return_management rm on rm.id = rsp.return_management_id |
| | | left join shipping_info si on si.id = rm.shipping_id |
| | | WHERE 1=1 |
| | | GROUP BY return_sale_ledger_product_id |
| | | ) rs ON rs.return_sale_ledger_product_id = slp.id |
| | | <where> |
| | | <if test="shippingId != null"> |
| | | si.id = #{shippingId} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | <select id="getShippingInfoByCustomerName" resultType="com.ruoyi.sales.pojo.ShippingInfo"> |
| | | select * from shipping_info si |
| | | left join sales_ledger sl on si.sales_ledger_id = sl.id |
| | | where sl.customer_name = #{customerName} |
| | | </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.staff.mapper.PersonalShiftMapper"> |
| | | |
| | | <!-- éç¨æ¥è¯¢æ å°ç»æ --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.staff.pojo.PersonalShift"> |
| | | <id column="id" property="id" /> |
| | | <result column="personal_attendance_location_config_id" property="personalAttendanceLocationConfigId" /> |
| | | <result column="staff_on_job_id" property="staffOnJobId" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="update_time" property="updateTime" /> |
| | | <result column="work_time" property="workTime" /> |
| | | </resultMap> |
| | | <select id="performanceShiftPage" resultType="com.ruoyi.staff.dto.PerformanceShiftMapDto"> |
| | | SELECT |
| | | u.staff_name name, |
| | | GROUP_CONCAT(s.work_time, 'ï¼', IFNULL(palc.shift, ''), 'ï¼', s.id order by s.work_time SEPARATOR ';') AS shift_time, |
| | | u.id user_id |
| | | FROM personal_shift s |
| | | LEFT JOIN staff_on_job u ON u.id = s.staff_on_job_id |
| | | LEFT JOIN personal_attendance_location_config palc ON palc.id = s.personal_attendance_location_config_id |
| | | <where> |
| | | <if test="sysDeptId != null and sysDeptId != ''"> |
| | | and u.sys_dept_id = #{sysDeptId} |
| | | </if> |
| | | <if test="time != null and time != ''"> |
| | | and DATE_FORMAT(s.work_time, '%Y-%m') = DATE_FORMAT(#{time}, '%Y-%m' ) |
| | | </if> |
| | | <if test="userName != null and userName != ''"> |
| | | and u.staff_name like concat('%', #{userName}, '%') |
| | | </if> |
| | | </where> |
| | | GROUP BY u.id |
| | | order by s.create_time |
| | | </select> |
| | | |
| | | <select id="performanceShiftYear" resultType="java.util.Map"> |
| | | SELECT |
| | | u.staff_name name, |
| | | u.id user_id, |
| | | u.staff_no account, |
| | | DATE_FORMAT(s.work_time, '%c') work_time, |
| | | GROUP_CONCAT(DATE_FORMAT(s.work_time, '%c'), 'ï¼', IFNULL(palc.shift, '') order by s.work_time SEPARATOR ';') month_str |
| | | FROM personal_shift s |
| | | LEFT JOIN staff_on_job u ON u.id = s.staff_on_job_id |
| | | LEFT JOIN personal_attendance_location_config palc ON palc.id = s.personal_attendance_location_config_id |
| | | <where> |
| | | <if test="time != null and time != ''"> |
| | | and DATE_FORMAT(s.work_time, '%Y') = DATE_FORMAT(#{time}, '%Y' ) |
| | | </if> |
| | | <if test="userName != null and userName != ''"> |
| | | and u.staff_name like concat('%', #{userName}, '%') |
| | | </if> |
| | | <if test="sysDeptId != null and sysDeptId != ''"> |
| | | and u.sys_dept_id = #{sysDeptId} |
| | | </if> |
| | | </where> |
| | | GROUP BY u.id |
| | | order by s.create_time |
| | | </select> |
| | | <select id="performanceShiftYearList" resultType="java.util.Map"> |
| | | SELECT |
| | | u.staff_name name, |
| | | s.staff_on_job_id user_id, u.staff_no account, |
| | | DATE_FORMAT(s.work_time, '%c') work_time, |
| | | GROUP_CONCAT(DATE_FORMAT(s.work_time, '%c'), 'ï¼', IFNULL(palc.shift, '') order by s.work_time SEPARATOR ';') month_str |
| | | FROM personal_shift s |
| | | LEFT JOIN staff_on_job u ON u.id = s.staff_on_job_id |
| | | LEFT JOIN personal_attendance_location_config palc ON palc.id = s.personal_attendance_location_config_id |
| | | <where> |
| | | <if test="time != null and time != ''"> |
| | | and DATE_FORMAT(s.work_time, '%Y') = DATE_FORMAT(#{time}, '%Y' ) |
| | | </if> |
| | | <if test="userName != null and userName != ''"> |
| | | and u.staff_name like concat('%', #{userName}, '%') |
| | | </if> |
| | | <if test="sysDeptId != null and sysDeptId != ''"> |
| | | and u.sys_dept_id = #{sysDeptId} |
| | | </if> |
| | | </where> |
| | | GROUP BY u.id |
| | | order by s.create_time |
| | | </select> |
| | | <select id="performanceShiftList" resultType="com.ruoyi.staff.dto.PerformanceShiftMapDto"> |
| | | SELECT |
| | | u.staff_name name, |
| | | GROUP_CONCAT(s.work_time, 'ï¼', IFNULL(palc.shift, ''), 'ï¼', s.id order by s.work_time SEPARATOR ';') AS shift_time, u.id user_id |
| | | FROM personal_shift s |
| | | LEFT JOIN staff_on_job u ON u.id = s.staff_on_job_id |
| | | LEFT JOIN personal_attendance_location_config palc ON palc.id = s.personal_attendance_location_config_id |
| | | <where> |
| | | <if test="time != null and time != ''"> |
| | | and DATE_FORMAT(s.work_time, '%Y-%m') = DATE_FORMAT(#{time}, '%Y-%m' ) |
| | | </if> |
| | | <if test="userName != null and userName != ''"> |
| | | and u.staff_name like concat('%', #{userName}, '%') |
| | | </if> |
| | | <if test="sysDeptId != null and sysDeptId != ''"> |
| | | and u.sys_dept_id = #{sysDeptId} |
| | | </if> |
| | | </where> |
| | | GROUP BY u.id |
| | | order by s.create_time |
| | | </select> |
| | | |
| | | </mapper> |