| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.basic.event; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | |
| | | /** æ åç»´æ¤ä¿åäºä»¶ã */ |
| | | @Data |
| | | @AllArgsConstructor |
| | | @Schema(description = "æ åç»´æ¤ä¿åäºä»¶") |
| | | public class StandardMethodSavedEvent { |
| | | |
| | | @Schema(description = "æ åæ¹æ³ID") |
| | | private Integer standardMethodId; |
| | | |
| | | @Schema(description = "æ åç¼å·") |
| | | private String code; |
| | | |
| | | @Schema(description = "æ åæè¿°") |
| | | private String name; |
| | | |
| | | @Schema(description = "æ¯å¦æ¥æ°ï¼0å¦ï¼1æ¯ï¼") |
| | | private Integer needSearchNew; |
| | | |
| | | @Schema(description = "æ¯å¦ä¸ºç¼è¾æä½") |
| | | private boolean edit; |
| | | } |
| | |
| | | */ |
| | | @TableName(value ="standard_method") |
| | | @Data |
| | | @Schema(description = "æ åæ¹æ³") |
| | | public class StandardMethod implements Serializable { |
| | | /** |
| | | * |
| | | */ |
| | | @TableId(type = IdType.AUTO) |
| | | @Schema(description = "æ åæ¹æ³ID") |
| | | private Integer id; |
| | | |
| | | @Schema(description = "é¢å") |
| | | private String field; |
| | | |
| | | @Schema(description = "æ£éªå¯¹è±¡") |
| | | private String structureTestObjectId; |
| | | |
| | | /** æ ååºä¸çº§è¡ä¸IDï¼ä»
æ¥å£äº¤äºï¼ä¸è½standard_methodè¡¨ï¼ */ |
| | | @Schema(description = "æ ååºä¸çº§è¡ä¸ID") |
| | | @TableField(exist = false) |
| | | private List<Integer> industryIds; |
| | | |
| | | /** å·²ç»å®è¡ä¸åç§°ï¼å表å±ç¤ºï¼ */ |
| | | @Schema(description = "å·²ç»å®è¡ä¸åç§°") |
| | | @TableField(exist = false) |
| | | private String industryNames; |
| | | |
| | | /** éä»¶æ°éï¼å表å±ç¤ºï¼ */ |
| | | @Schema(description = "éä»¶æ°é") |
| | | @TableField(exist = false) |
| | | private Integer attachmentCount; |
| | | |
| | |
| | | @Schema(description = "æ¯å¦å¯ç¨") |
| | | private Integer isUse; |
| | | |
| | | @Schema(description = "æ¯å¦æ¥æ°ï¼0å¦ï¼1æ¯ï¼") |
| | | private Integer needSearchNew; |
| | | |
| | | @Schema(description = "å建人id") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.basic.pojo.StandardMethodList; |
| | | import com.ruoyi.basic.event.StandardMethodSavedEvent; |
| | | import com.ruoyi.common.utils.QueryWrappers; |
| | | import com.ruoyi.basic.mapper.StandardMethodMapper; |
| | | import com.ruoyi.basic.mapper.StandardProductListMapper; |
| | |
| | | import com.ruoyi.basic.utils.StandardTreePath; |
| | | import com.ruoyi.basic.utils.StandardTreePathParser; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.context.ApplicationEventPublisher; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | |
| | | private LaboratoryMapper laboratoryMapper; |
| | | private StandardTreeMapper standardTreeMapper; |
| | | private StandardTreeTemplateBindingMapper standardTreeTemplateBindingMapper; |
| | | private final ApplicationEventPublisher eventPublisher; |
| | | |
| | | @Value("${file.path}") |
| | | private String filePath; |
| | |
| | | StandardMethodAttachmentMapper standardMethodAttachmentMapper, |
| | | LaboratoryMapper laboratoryMapper, |
| | | StandardTreeMapper standardTreeMapper, |
| | | StandardTreeTemplateBindingMapper standardTreeTemplateBindingMapper) { |
| | | StandardTreeTemplateBindingMapper standardTreeTemplateBindingMapper, |
| | | ApplicationEventPublisher eventPublisher) { |
| | | this.standardMethodMapper = standardMethodMapper; |
| | | this.standardProductListMapper = standardProductListMapper; |
| | | this.standardProductListService = standardProductListService; |
| | |
| | | this.laboratoryMapper = laboratoryMapper; |
| | | this.standardTreeMapper = standardTreeMapper; |
| | | this.standardTreeTemplateBindingMapper = standardTreeTemplateBindingMapper; |
| | | this.eventPublisher = eventPublisher; |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Integer addStandardMethod(StandardMethod standardMethod) { |
| | | standardMethod.setStructureTestObjectId(null); |
| | | if (standardMethod.getNeedSearchNew() == null) { |
| | | standardMethod.setNeedSearchNew(0); |
| | | } |
| | | standardMethodMapper.insert(standardMethod); |
| | | syncIndustries(standardMethod, Collections.<Integer>emptySet()); |
| | | publishSavedEvent(standardMethod, false); |
| | | return standardMethod.getId(); |
| | | } |
| | | |
| | |
| | | if (!oldStandardMethod.getCode().equals(standardMethod.getCode())) { |
| | | CompletableFuture.supplyAsync(() -> replaceMethod(oldStandardMethod.getCode(), standardMethod.getCode())); |
| | | } |
| | | if (standardMethod.getNeedSearchNew() == null) { |
| | | standardMethod.setNeedSearchNew(oldStandardMethod.getNeedSearchNew() == null |
| | | ? 0 : oldStandardMethod.getNeedSearchNew()); |
| | | } |
| | | int i = standardMethodMapper.updateById(standardMethod); |
| | | syncIndustries(standardMethod, new LinkedHashSet<>(selectIndustryIds(oldStandardMethod.getId()))); |
| | | publishSavedEvent(standardMethodMapper.selectById(standardMethod.getId()), true); |
| | | return i; |
| | | } |
| | | |
| | | private void publishSavedEvent(StandardMethod standardMethod, boolean edit) { |
| | | eventPublisher.publishEvent(new StandardMethodSavedEvent( |
| | | standardMethod.getId(), standardMethod.getCode(), standardMethod.getName(), |
| | | standardMethod.getNeedSearchNew(), edit)); |
| | | } |
| | | |
| | | private List<Integer> selectIndustryIds(Integer methodId) { |
| | | List<StandardMethodIndustry> list = standardMethodIndustryMapper.selectList( |
| | | Wrappers.<StandardMethodIndustry>lambdaQuery() |
| | |
| | | <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> |
| | | <result property="updateUser" column="update_user" jdbcType="INTEGER"/> |
| | | <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/> |
| | | <result property="needSearchNew" column="need_search_new" jdbcType="INTEGER"/> |
| | | </resultMap> |
| | | |
| | | <select id="selectStandardMethodList" resultType="com.ruoyi.basic.pojo.StandardMethod"> |
| | |
| | | sm.field, |
| | | sm.name_en, |
| | | sm.is_use, |
| | | sm.need_search_new, |
| | | sm.qualification_id, |
| | | COALESCE((SELECT GROUP_CONCAT(l.laboratory_name ORDER BY COALESCE(l.sort, 0), l.id SEPARATOR 'ã') |
| | | FROM standard_method_industry smi JOIN laboratory l ON l.id = smi.industry_id |
| | |
| | | sm.field, |
| | | sm.name_en, |
| | | sm.is_use, |
| | | sm.need_search_new, |
| | | sm.qualification_id |
| | | from standard_method sm |
| | | left join user u1 on sm.create_user = u1.id |
| | |
| | | public Result delAnalyseFile(Integer analyseFileId){ |
| | | return Result.success(clientSatisfactionAnalyseFileMapper.deleteById(analyseFileId)); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢æ»¡æåº¦éä»¶ |
| | | */ |
| | | @Operation(summary = "æ¥è¯¢æ»¡æåº¦éä»¶") |
| | | @GetMapping("/selectAttachments") |
| | | public Result selectAttachments(Integer clientSatisfactionId) { |
| | | return Result.success(clientSatisfactionService.selectAttachments(clientSatisfactionId)); |
| | | } |
| | | |
| | | /** |
| | | * ä¸ä¼ 满æåº¦éä»¶ |
| | | */ |
| | | @Operation(summary = "ä¸ä¼ 满æåº¦éä»¶") |
| | | @PostMapping("/uploadAttachment") |
| | | public Result uploadAttachment(@RequestParam("clientSatisfactionId") Integer clientSatisfactionId, |
| | | @RequestParam("file") MultipartFile file) { |
| | | return Result.success(clientSatisfactionService.uploadAttachment(clientSatisfactionId, file)); |
| | | } |
| | | |
| | | /** |
| | | * å 餿»¡æåº¦éä»¶ |
| | | */ |
| | | @Operation(summary = "å 餿»¡æåº¦éä»¶") |
| | | @DeleteMapping("/deleteAttachment") |
| | | public Result deleteAttachment(Long id) { |
| | | return Result.success(clientSatisfactionService.deleteAttachment(id)); |
| | | } |
| | | } |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.manage.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.manage.pojo.ClientSatisfactionAttachment; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * å®¢æ·æ»¡æåº¦éä»¶ |
| | | */ |
| | | @Mapper |
| | | public interface ClientSatisfactionAttachmentMapper extends BaseMapper<ClientSatisfactionAttachment> { |
| | | } |
| | |
| | | @Schema(description = "夿³¨(对æä»¬ç叿)") |
| | | private String remark; |
| | | |
| | | @Schema(description = "å§æåid(ins_order.id)") |
| | | private Integer orderId; |
| | | |
| | | @Schema(description = "å§æåç¼å·") |
| | | private String entrustCode; |
| | | |
| | | @Schema(description = "æ ·ååç§°") |
| | | private String sampleName; |
| | | |
| | | @Schema(description = "å建人") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.manage.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * å®¢æ·æ»¡æåº¦éä»¶ |
| | | */ |
| | | @Data |
| | | @TableName("cnas_client_satisfaction_attachment") |
| | | public class ClientSatisfactionAttachment { |
| | | @TableId(type = IdType.AUTO) |
| | | private Long id; |
| | | private Integer clientSatisfactionId; |
| | | private String fileName; |
| | | private String fileUrl; |
| | | private Integer sort; |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime createTime; |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime updateTime; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.manage.pojo.ClientSatisfaction; |
| | | import com.ruoyi.manage.pojo.ClientSatisfactionAnalyseFile; |
| | | import com.ruoyi.manage.pojo.ClientSatisfactionAttachment; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * å®¢æ·æ»¡æåº¦ |
| | |
| | | * @param userId ä¿®æ¹äººid |
| | | */ |
| | | void confirmClientSatisfaction(ClientSatisfaction clientSatisfaction, Integer userId); |
| | | |
| | | /** |
| | | * æ¥è¯¢æ»¡æåº¦éä»¶ |
| | | * @param clientSatisfactionId 满æåº¦è®°å½id |
| | | * @return |
| | | */ |
| | | List<ClientSatisfactionAttachment> selectAttachments(Integer clientSatisfactionId); |
| | | |
| | | /** |
| | | * ä¸ä¼ 满æåº¦éä»¶ |
| | | * @param clientSatisfactionId 满æåº¦è®°å½id |
| | | * @param file |
| | | * @return |
| | | */ |
| | | ClientSatisfactionAttachment uploadAttachment(Integer clientSatisfactionId, MultipartFile file); |
| | | |
| | | /** |
| | | * å 餿»¡æåº¦éä»¶ |
| | | * @param id éä»¶id |
| | | * @return |
| | | */ |
| | | boolean deleteAttachment(Long id); |
| | | } |
| | | |
| | |
| | | package com.ruoyi.manage.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | |
| | | import com.deepoove.poi.config.ConfigureBuilder; |
| | | import com.deepoove.poi.data.Pictures; |
| | | import com.ruoyi.common.core.domain.entity.User; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.QueryWrappers; |
| | | import com.ruoyi.framework.exception.ErrorException; |
| | | import com.ruoyi.manage.dto.ClientSatisfactionDto; |
| | | import com.ruoyi.manage.mapper.ClientSatisfactionAnalyseFileMapper; |
| | | import com.ruoyi.manage.mapper.ClientSatisfactionAttachmentMapper; |
| | | import com.ruoyi.manage.mapper.ClientSatisfactionMapper; |
| | | import com.ruoyi.manage.pojo.ClientSatisfaction; |
| | | import com.ruoyi.manage.pojo.ClientSatisfactionAnalyseFile; |
| | | import com.ruoyi.manage.pojo.ClientSatisfactionAttachment; |
| | | import com.ruoyi.manage.service.ClientSatisfactionService; |
| | | import com.ruoyi.system.mapper.UserMapper; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | |
| | | import jakarta.annotation.Resource; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | | import java.net.URLEncoder; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | |
| | | |
| | | @Resource |
| | | private ClientSatisfactionAnalyseFileMapper clientSatisfactionAnalyseFileMapper; |
| | | |
| | | @Resource |
| | | private ClientSatisfactionAttachmentMapper clientSatisfactionAttachmentMapper; |
| | | |
| | | @Resource |
| | | private UserMapper userMapper; |
| | |
| | | clientSatisfaction.setConfirmStatus(1); |
| | | baseMapper.updateById(clientSatisfaction); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢æ»¡æåº¦éä»¶ |
| | | * |
| | | * @param clientSatisfactionId 满æåº¦è®°å½id |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<ClientSatisfactionAttachment> selectAttachments(Integer clientSatisfactionId) { |
| | | return clientSatisfactionAttachmentMapper.selectList(new QueryWrapper<ClientSatisfactionAttachment>().lambda() |
| | | .eq(ClientSatisfactionAttachment::getClientSatisfactionId, clientSatisfactionId) |
| | | .orderByAsc(ClientSatisfactionAttachment::getSort, ClientSatisfactionAttachment::getId)); |
| | | } |
| | | |
| | | /** |
| | | * ä¸ä¼ 满æåº¦éä»¶ |
| | | * |
| | | * @param clientSatisfactionId 满æåº¦è®°å½id |
| | | * @param file |
| | | * @return |
| | | */ |
| | | @Override |
| | | public ClientSatisfactionAttachment uploadAttachment(Integer clientSatisfactionId, MultipartFile file) { |
| | | if (baseMapper.selectById(clientSatisfactionId) == null) { |
| | | throw new BaseException("å®¢æ·æ»¡æåº¦è°æ¥ä¸åå¨"); |
| | | } |
| | | if (file == null || file.isEmpty()) { |
| | | throw new BaseException("éä»¶ä¸è½ä¸ºç©º"); |
| | | } |
| | | // ç³»ç»å
¨å±ä¸ä¼ ä¸é为200MBï¼è¿éæåç»åºå好æç¤º |
| | | if (file.getSize() > 200L * 1024 * 1024) { |
| | | throw new BaseException("éä»¶ä¸è½è¶
è¿200MB"); |
| | | } |
| | | String originalName = file.getOriginalFilename(); |
| | | if (originalName == null || originalName.trim().isEmpty()) { |
| | | originalName = "æªå½åæä»¶"; |
| | | } |
| | | // ä¸ªå«æµè§å¨å¯è½å¸¦ä¸è·¯å¾åç¼ï¼åªä¿çæä»¶åæ¬èº« |
| | | originalName = originalName.replaceAll(".*[/\\\\]", ""); |
| | | try { |
| | | // å¾çæ¾å¾çç®å½ï¼/img éæè·¯å¾ï¼ï¼å
¶ä½ä»»ææ ¼å¼æ¾ word ç®å½ï¼/word éæè·¯å¾ï¼ |
| | | boolean image = originalName.matches("(?i).+\\.(jpg|jpeg|png|gif)$"); |
| | | File directory = new File(image ? imgUrl : wordUrl); |
| | | if (!directory.exists()) { |
| | | directory.mkdirs(); |
| | | } |
| | | String fileUrl = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyMMddHHmmssSSS")) + "-" + originalName; |
| | | file.transferTo(new File(directory, fileUrl)); |
| | | ClientSatisfactionAttachment attachment = new ClientSatisfactionAttachment(); |
| | | attachment.setClientSatisfactionId(clientSatisfactionId); |
| | | attachment.setFileName(originalName); |
| | | attachment.setFileUrl(fileUrl); |
| | | attachment.setSort(selectAttachments(clientSatisfactionId).size()); |
| | | clientSatisfactionAttachmentMapper.insert(attachment); |
| | | return attachment; |
| | | } catch (IOException e) { |
| | | throw new BaseException("éä»¶ä¸ä¼ 失败"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å 餿»¡æåº¦éä»¶ |
| | | * |
| | | * @param id éä»¶id |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean deleteAttachment(Long id) { |
| | | return clientSatisfactionAttachmentMapper.deleteById(id) > 0; |
| | | } |
| | | } |
| | | |
| | |
| | | List<ManageRecordIntervals> manageRecordIntervalsList = new ArrayList<>(); |
| | | |
| | | DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | //è·åå½å年份 |
| | | LocalDate currentDate = LocalDate.now(); |
| | | // å®ä¹æ¥ææ ¼å¼ |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy"); |
| | | // æ ¼å¼åå½åæ¥æ |
| | | String currentMonth = currentDate.format(formatter); |
| | | ManageRecordIntervalsTotal manageRecordIntervalsTotal = manageRecordIntervalsTotalMapper.selectOne(Wrappers.<ManageRecordIntervalsTotal>lambdaQuery().eq(ManageRecordIntervalsTotal::getYear, currentMonth)); |
| | | ManageRecordIntervalsTotal manageRecordIntervalsTotal = getOrCreateCurrentYearTotal(); |
| | | try { |
| | | InputStream inputStream = file.getInputStream(); |
| | | XWPFDocument document = new XWPFDocument(inputStream); |
| | |
| | | |
| | | @Override |
| | | public int addManageRecordIntervals(ManageRecordIntervals manageRecordIntervals) { |
| | | //è·åå½å年份 |
| | | LocalDate currentDate = LocalDate.now(); |
| | | // å®ä¹æ¥ææ ¼å¼ |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy"); |
| | | // æ ¼å¼åå½åæ¥æ |
| | | String currentMonth = currentDate.format(formatter); |
| | | ManageRecordIntervalsTotal manageRecordIntervalsTotal = manageRecordIntervalsTotalMapper.selectOne(Wrappers.<ManageRecordIntervalsTotal>lambdaQuery().eq(ManageRecordIntervalsTotal::getYear, currentMonth)); |
| | | ManageRecordIntervalsTotal manageRecordIntervalsTotal = getOrCreateCurrentYearTotal(); |
| | | manageRecordIntervals.setRecordIntervalsTotalId(manageRecordIntervalsTotal.getId()); |
| | | manageRecordIntervalsMapper.insert(manageRecordIntervals); |
| | | manageRecordIntervalsTotal.setTotalNum(1 + manageRecordIntervalsTotal.getTotalNum()); |
| | |
| | | ManageRecordIntervals manageRecordIntervals = manageRecordIntervalsMapper.selectById(id); |
| | | manageRecordIntervalsMapper.deleteById(id); |
| | | ManageRecordIntervalsTotal manageRecordIntervalsTotal = manageRecordIntervalsTotalMapper.selectById(manageRecordIntervals.getRecordIntervalsTotalId()); |
| | | manageRecordIntervalsTotal.setTotalNum(manageRecordIntervalsTotal.getTotalNum() - 1); |
| | | if (manageRecordIntervalsTotal == null) { |
| | | return 0; |
| | | } |
| | | manageRecordIntervalsTotal.setTotalNum((manageRecordIntervalsTotal.getTotalNum() == null ? 0 : manageRecordIntervalsTotal.getTotalNum()) - 1); |
| | | return manageRecordIntervalsTotalMapper.updateById(manageRecordIntervalsTotal); |
| | | } |
| | | |
| | | // å¹´åº¦æ±æ»è®°å½åæ¬ç±æ¯å¹´ 1 æ 1 æ¥ç宿¶ä»»å¡å建ï¼ä»»å¡æªå¯ç¨æ¶æ¤å¤å
åºèªå¨è¡¥å»ºï¼é¿å
å id æ¶æ¥ç©ºæé |
| | | private ManageRecordIntervalsTotal getOrCreateCurrentYearTotal() { |
| | | String year = String.valueOf(LocalDate.now().getYear()); |
| | | ManageRecordIntervalsTotal manageRecordIntervalsTotal = manageRecordIntervalsTotalMapper.selectOne(Wrappers.<ManageRecordIntervalsTotal>lambdaQuery().eq(ManageRecordIntervalsTotal::getYear, year)); |
| | | if (manageRecordIntervalsTotal == null) { |
| | | manageRecordIntervalsTotal = new ManageRecordIntervalsTotal(); |
| | | manageRecordIntervalsTotal.setYear(year); |
| | | manageRecordIntervalsTotal.setTotalNum(0); |
| | | manageRecordIntervalsTotalMapper.insert(manageRecordIntervalsTotal); |
| | | } else if (manageRecordIntervalsTotal.getTotalNum() == null) { |
| | | manageRecordIntervalsTotal.setTotalNum(0); |
| | | } |
| | | return manageRecordIntervalsTotal; |
| | | } |
| | | |
| | | // æ°´å¹³åå¹¶åå
æ ¼ |
| | | private static void mergeCellsHorizontally(XWPFTable table, int row, int fromCol, int toCol) { |
| | | for (int i = fromCol; i <= toCol; i++) { |
| | |
| | | @Override |
| | | public IPage<ManageRecordVerify> pageManageRecordVerify(Page page, ManageRecordVerify manageRecordVerify) { |
| | | if (ObjectUtils.isEmpty(manageRecordVerify.getManageRecordTotalId())) { |
| | | //è·åå½å年份 |
| | | LocalDate currentDate = LocalDate.now(); |
| | | // å®ä¹æ¥ææ ¼å¼ |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy"); |
| | | // æ ¼å¼åå½åæ¥æ |
| | | String currentMonth = currentDate.format(formatter); |
| | | //æ¥è¯¢åå² |
| | | ManageRecordTotal manageRecordTotal = manageRecordTotalMapper.selectOne(Wrappers.<ManageRecordTotal>lambdaQuery().eq(ManageRecordTotal::getYear, currentMonth)); |
| | | manageRecordVerify.setManageRecordTotalId(manageRecordTotal.getId()); |
| | | manageRecordVerify.setManageRecordTotalId(getOrCreateCurrentYearTotal().getId()); |
| | | } |
| | | return manageRecordVerifyMapper.pageManageRecordVerify(page, QueryWrappers.queryWrappers(manageRecordVerify)); |
| | | } |
| | | |
| | | @Override |
| | | public int addManageRecordVerify(ManageRecordVerify manageRecordVerify) { |
| | | //è·åå½å年份 |
| | | LocalDate currentDate = LocalDate.now(); |
| | | // å®ä¹æ¥ææ ¼å¼ |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy"); |
| | | // æ ¼å¼åå½åæ¥æ |
| | | String currentMonth = currentDate.format(formatter); |
| | | ManageRecordTotal manageRecordTotal = manageRecordTotalMapper.selectOne(Wrappers.<ManageRecordTotal>lambdaQuery().eq(ManageRecordTotal::getYear, currentMonth)); |
| | | ManageRecordTotal manageRecordTotal = getOrCreateCurrentYearTotal(); |
| | | manageRecordVerify.setManageRecordTotalId(manageRecordTotal.getId()); |
| | | manageRecordVerifyMapper.insert(manageRecordVerify); |
| | | manageRecordTotal.setTotalNum(1 + manageRecordTotal.getTotalNum()); |
| | |
| | | ManageRecordVerify manageRecordVerify = manageRecordVerifyMapper.selectById(id); |
| | | manageRecordVerifyMapper.deleteById(id); |
| | | ManageRecordTotal manageRecordTotal = manageRecordTotalMapper.selectById(manageRecordVerify.getManageRecordTotalId()); |
| | | manageRecordTotal.setTotalNum(manageRecordTotal.getTotalNum() - 1); |
| | | if (manageRecordTotal == null) { |
| | | return 0; |
| | | } |
| | | manageRecordTotal.setTotalNum((manageRecordTotal.getTotalNum() == null ? 0 : manageRecordTotal.getTotalNum()) - 1); |
| | | return manageRecordTotalMapper.updateById(manageRecordTotal); |
| | | } |
| | | |
| | |
| | | public int exportManageRecordVerify(MultipartFile file) { |
| | | List<ManageRecordVerify> manageRecordVerifyList = new ArrayList<>(); |
| | | DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | //è·åå½å年份 |
| | | LocalDate currentDate = LocalDate.now(); |
| | | // å®ä¹æ¥ææ ¼å¼ |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy"); |
| | | // æ ¼å¼åå½åæ¥æ |
| | | String currentMonth = currentDate.format(formatter); |
| | | ManageRecordTotal manageRecordTotal = manageRecordTotalMapper.selectOne(Wrappers.<ManageRecordTotal>lambdaQuery().eq(ManageRecordTotal::getYear, currentMonth)); |
| | | ManageRecordTotal manageRecordTotal = getOrCreateCurrentYearTotal(); |
| | | try { |
| | | InputStream inputStream = file.getInputStream(); |
| | | XWPFDocument document = new XWPFDocument(inputStream); |
| | |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | // å¹´åº¦æ±æ»è®°å½åæ¬ç±æ¯å¹´ 1 æ 1 æ¥ç宿¶ä»»å¡å建ï¼ä»»å¡æªå¯ç¨æ¶æ¤å¤å
åºèªå¨è¡¥å»ºï¼é¿å
å id æ¶æ¥ç©ºæé |
| | | private ManageRecordTotal getOrCreateCurrentYearTotal() { |
| | | String year = String.valueOf(LocalDate.now().getYear()); |
| | | ManageRecordTotal manageRecordTotal = manageRecordTotalMapper.selectOne(Wrappers.<ManageRecordTotal>lambdaQuery().eq(ManageRecordTotal::getYear, year)); |
| | | if (manageRecordTotal == null) { |
| | | manageRecordTotal = new ManageRecordTotal(); |
| | | manageRecordTotal.setYear(year); |
| | | manageRecordTotal.setTotalNum(0); |
| | | manageRecordTotalMapper.insert(manageRecordTotal); |
| | | } else if (manageRecordTotal.getTotalNum() == null) { |
| | | manageRecordTotal.setTotalNum(0); |
| | | } |
| | | return manageRecordTotal; |
| | | } |
| | | } |
| | |
| | | @Operation(summary = "ä¿®æ¹æ 忥æ°") |
| | | @PostMapping("/updateMethodSearchNew") |
| | | public Result updateMethodSearchNew(@RequestBody ProcessMethodSearchNew processMethodSearchNew ) { |
| | | return Result.success(processMethodSearchNewService.updateById(processMethodSearchNew)); |
| | | return Result.success(processMethodSearchNewService.updateMethodSearchNew(processMethodSearchNew)); |
| | | } |
| | | |
| | | /** |
| | |
| | | return Result.success(processMethodSearchNewService.pageMethodSearchNew(page, processMethodSearchNew)); |
| | | } |
| | | |
| | | @Operation(summary = "èªå¨å½æ¡£è®°å½å表") |
| | | @GetMapping("/pageAutoArchived") |
| | | public Result<IPage<ProcessMethodSearchNew>> pageAutoArchived(ProcessMethodSearchNew processMethodSearchNew, Page page) { |
| | | return Result.success(processMethodSearchNewService.pageAutoArchived(page, processMethodSearchNew)); |
| | | } |
| | | |
| | | @Operation(summary = "æ 忥æ°å¯¼åº") |
| | | @GetMapping("/exportMethodSearchNew") |
| | | public void exportMethodSearchNew(Integer archivedId, HttpServletResponse response) throws Exception { |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.process.listener; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.basic.event.StandardMethodSavedEvent; |
| | | import com.ruoyi.basic.mapper.StandardMethodMapper; |
| | | import com.ruoyi.basic.pojo.StandardMethod; |
| | | import com.ruoyi.process.mapper.ProcessMethodSearchNewFileSeqMapper; |
| | | import com.ruoyi.process.mapper.ProcessMethodSearchNewMapper; |
| | | import com.ruoyi.process.pojo.ProcessMethodSearchNew; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.context.event.EventListener; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneId; |
| | | import java.time.format.DateTimeFormatter; |
| | | |
| | | /** æ ¹æ®æ åç»´æ¤ä¿åå¨ä½åæ¥çæã彿¡£æ 忥æ°è®°å½ã */ |
| | | @Component |
| | | @RequiredArgsConstructor |
| | | public class StandardMethodSearchNewListener { |
| | | |
| | | private static final ZoneId CHINA_ZONE = ZoneId.of("Asia/Shanghai"); |
| | | private static final DateTimeFormatter FILE_DATE = DateTimeFormatter.BASIC_ISO_DATE; |
| | | |
| | | private final StandardMethodMapper standardMethodMapper; |
| | | private final ProcessMethodSearchNewMapper searchNewMapper; |
| | | private final ProcessMethodSearchNewFileSeqMapper fileSeqMapper; |
| | | |
| | | @EventListener |
| | | public void onStandardMethodSaved(StandardMethodSavedEvent event) { |
| | | if (!Integer.valueOf(1).equals(event.getNeedSearchNew())) { |
| | | return; |
| | | } |
| | | |
| | | StandardMethod standard = standardMethodMapper.selectOne(Wrappers.<StandardMethod>lambdaQuery() |
| | | .eq(StandardMethod::getId, event.getStandardMethodId()) |
| | | .last("FOR UPDATE")); |
| | | if (standard == null) { |
| | | return; |
| | | } |
| | | |
| | | ProcessMethodSearchNew current = searchNewMapper.selectOne(Wrappers.<ProcessMethodSearchNew>lambdaQuery() |
| | | .eq(ProcessMethodSearchNew::getCurrentAutoStandardId, event.getStandardMethodId()) |
| | | .last("FOR UPDATE")); |
| | | if (!event.isEdit() && current != null) { |
| | | return; |
| | | } |
| | | |
| | | LocalDateTime now = LocalDateTime.now(CHINA_ZONE); |
| | | if (current != null) { |
| | | searchNewMapper.update(null, Wrappers.<ProcessMethodSearchNew>lambdaUpdate() |
| | | .eq(ProcessMethodSearchNew::getMethodSearchNewId, current.getMethodSearchNewId()) |
| | | .set(ProcessMethodSearchNew::getIsNewStandard, 0) |
| | | .set(ProcessMethodSearchNew::getIsAutoArchived, 1) |
| | | .set(ProcessMethodSearchNew::getCurrentAutoStandardId, null) |
| | | .set(ProcessMethodSearchNew::getAutoArchivedTime, now)); |
| | | } |
| | | |
| | | ProcessMethodSearchNew created = new ProcessMethodSearchNew(); |
| | | created.setMethodName(event.getName()); |
| | | created.setStandardNo(event.getCode()); |
| | | created.setFileNo(nextFileNo(now.toLocalDate())); |
| | | created.setIsNewStandard(1); |
| | | created.setSearchNewSource(null); |
| | | created.setStandardMethodId(event.getStandardMethodId()); |
| | | created.setCurrentAutoStandardId(event.getStandardMethodId()); |
| | | created.setIsAutoArchived(0); |
| | | searchNewMapper.insert(created); |
| | | } |
| | | |
| | | private String nextFileNo(LocalDate date) { |
| | | String prefix = date.format(FILE_DATE); |
| | | fileSeqMapper.insertIfAbsent(date); |
| | | Integer stored = fileSeqMapper.selectForUpdate(date); |
| | | Integer existing = fileSeqMapper.selectMaxExisting(prefix); |
| | | int next = Math.max(stored == null ? 0 : stored, existing == null ? 0 : existing) + 1; |
| | | fileSeqMapper.updateValue(date, next); |
| | | return prefix + String.format("%03d", next); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.process.mapper; |
| | | |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.time.LocalDate; |
| | | |
| | | @Mapper |
| | | public interface ProcessMethodSearchNewFileSeqMapper { |
| | | |
| | | int insertIfAbsent(@Param("seqDate") LocalDate seqDate); |
| | | |
| | | Integer selectForUpdate(@Param("seqDate") LocalDate seqDate); |
| | | |
| | | Integer selectMaxExisting(@Param("prefix") String prefix); |
| | | |
| | | int updateValue(@Param("seqDate") LocalDate seqDate, @Param("value") Integer value); |
| | | } |
| | |
| | | */ |
| | | IPage<ProcessMethodSearchNew> pageMethodSearchNew(@Param("page") Page page, @Param("ew") QueryWrapper<ProcessMethodSearchNewBackupsDto> processMethodSearchNewDtoQueryWrapper, @Param("beginDate") String beginDate, @Param("endDate") String endDate); |
| | | |
| | | IPage<ProcessMethodSearchNew> pageAutoArchived(@Param("page") Page page, |
| | | @Param("ew") QueryWrapper<ProcessMethodSearchNew> queryWrapper); |
| | | |
| | | } |
| | | |
| | |
| | | public class ProcessMethodSearchNew { |
| | | |
| | | @TableId(type = IdType.AUTO) |
| | | @Schema(description = "æ 忥æ°è®°å½ID") |
| | | private Integer methodSearchNewId; |
| | | |
| | | @Schema(description = "æ åæ¹æ³éªè¯id") |
| | |
| | | @Schema(description = "夿³¨,0ä½åº, 1æ¿æ¢") |
| | | private Integer remark; |
| | | |
| | | @Schema(description = "æ¥æºæ åç»´æ¤IDï¼èªå¨çæè®°å½ä½¿ç¨") |
| | | private Integer standardMethodId; |
| | | |
| | | @Schema(description = "å½åèªå¨è®°å½å¯¹åºçæ åç»´æ¤IDï¼å½æ¡£å为空") |
| | | private Integer currentAutoStandardId; |
| | | |
| | | @Schema(description = "æ¯å¦èªå¨å½æ¡£ï¼0å¦ï¼1æ¯ï¼") |
| | | private Integer isAutoArchived; |
| | | |
| | | @Schema(description = "èªå¨å½æ¡£æ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime autoArchivedTime; |
| | | |
| | | @Schema(description = "å建人") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | |
| | | */ |
| | | boolean addMethodSearchNew(List<ProcessMethodSearchNew> processMethodSearchNewList); |
| | | |
| | | boolean updateMethodSearchNew(ProcessMethodSearchNew processMethodSearchNew); |
| | | |
| | | /** |
| | | * æ 忥æ°å表 |
| | | * @param processMethodSearchNew |
| | |
| | | */ |
| | | IPage<ProcessMethodSearchNew> pageMethodSearchNew(Page page, ProcessMethodSearchNewBackupsDto processMethodSearchNew); |
| | | |
| | | IPage<ProcessMethodSearchNew> pageAutoArchived(Page page, ProcessMethodSearchNew processMethodSearchNew); |
| | | |
| | | /** |
| | | * æ 忥æ°å¯¼åº |
| | | * @param archivedId |
| | |
| | | public boolean addMethodSearchNew(List<ProcessMethodSearchNew> processMethodSearchNewList) { |
| | | for (ProcessMethodSearchNew processMethodSearchNew : processMethodSearchNewList) { |
| | | processMethodSearchNew.setIsNewStandard(1); |
| | | processMethodSearchNew.setIsAutoArchived(0); |
| | | processMethodSearchNew.setStandardMethodId(null); |
| | | processMethodSearchNew.setCurrentAutoStandardId(null); |
| | | processMethodSearchNew.setAutoArchivedTime(null); |
| | | } |
| | | // æ°å¢ |
| | | this.saveBatch(processMethodSearchNewList); |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public boolean updateMethodSearchNew(ProcessMethodSearchNew processMethodSearchNew) { |
| | | ProcessMethodSearchNew old = getById(processMethodSearchNew.getMethodSearchNewId()); |
| | | if (old == null) { |
| | | throw new ErrorException("æ 忥æ°è®°å½ä¸åå¨"); |
| | | } |
| | | if (Integer.valueOf(1).equals(old.getIsAutoArchived())) { |
| | | throw new ErrorException("èªå¨å½æ¡£è®°å½ä¸å
许修æ¹"); |
| | | } |
| | | return update(Wrappers.<ProcessMethodSearchNew>lambdaUpdate() |
| | | .eq(ProcessMethodSearchNew::getMethodSearchNewId, old.getMethodSearchNewId()) |
| | | .set(ProcessMethodSearchNew::getVerifyId, processMethodSearchNew.getVerifyId()) |
| | | .set(ProcessMethodSearchNew::getMethodName, processMethodSearchNew.getMethodName()) |
| | | .set(ProcessMethodSearchNew::getStandardNo, processMethodSearchNew.getStandardNo()) |
| | | .set(ProcessMethodSearchNew::getFileNo, processMethodSearchNew.getFileNo()) |
| | | .set(ProcessMethodSearchNew::getNewMethodName, processMethodSearchNew.getNewMethodName()) |
| | | .set(ProcessMethodSearchNew::getNewStandardNo, processMethodSearchNew.getNewStandardNo()) |
| | | .set(ProcessMethodSearchNew::getSearchNewSource, processMethodSearchNew.getSearchNewSource()) |
| | | .set(ProcessMethodSearchNew::getRemark, processMethodSearchNew.getRemark()) |
| | | .set(ProcessMethodSearchNew::getIsNewStandard, 1)); |
| | | } |
| | | |
| | | /** |
| | |
| | | processMethodSearchNew.setBeginDate(null); |
| | | processMethodSearchNew.setEndDate(null); |
| | | return baseMapper.pageMethodSearchNew(page, QueryWrappers.queryWrappers(processMethodSearchNew), beginDate, endDate); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<ProcessMethodSearchNew> pageAutoArchived(Page page, ProcessMethodSearchNew processMethodSearchNew) { |
| | | processMethodSearchNew.setIsAutoArchived(null); |
| | | return baseMapper.pageAutoArchived(page, QueryWrappers.queryWrappers(processMethodSearchNew)); |
| | | } |
| | | |
| | | /** |
| | |
| | | searchNewBackupsDto.setRemarkString("ä½åº"); |
| | | } |
| | | } |
| | | switch (methodSearchNew.getSearchNewSource()) { |
| | | if (methodSearchNew.getSearchNewSource() != null) switch (methodSearchNew.getSearchNewSource()) { |
| | | case 0: |
| | | searchNewBackupsDto.setStandardNet("â"); |
| | | break; |
| | |
| | | List<ProcessMethodSearchNew> collect = searchNewDtoList.stream().map(searchNewDto -> { |
| | | ProcessMethodSearchNew searchNew = new ProcessMethodSearchNew(); |
| | | BeanUtils.copyProperties(searchNewDto, searchNew); |
| | | // æ¯å¦æ¯æ´æ° |
| | | if (StringUtils.isNotBlank(searchNewDto.getIsNewStandardString())) { |
| | | if (searchNewDto.getIsNewStandardString().equals("æ¯")) { |
| | | searchNew.setIsNewStandard(1); |
| | | } else { |
| | | searchNew.setIsNewStandard(0); |
| | | } |
| | | } |
| | | searchNew.setIsNewStandard(1); |
| | | searchNew.setIsAutoArchived(0); |
| | | // æ¥æ°è®°å½ |
| | | if (StringUtils.isNotBlank(searchNewDto.getStandardNet())) { |
| | | searchNew.setSearchNewSource(0); |
| | | } else if (StringUtils.isNotBlank(searchNewDto.getInformationOffices())) { |
| | | searchNew.setSearchNewSource(1); |
| | | } else if (StringUtils.isNotBlank(searchNewDto.getIsNewStandardString())) { |
| | | } else if (StringUtils.isNotBlank(searchNewDto.getStandardBookstore())) { |
| | | searchNew.setSearchNewSource(2); |
| | | } else if (StringUtils.isNotBlank(searchNewDto.getOther())) { |
| | | searchNew.setSearchNewSource(3); |
| | |
| | | processMethodSearchNewArchivedMapper.insert(archived); |
| | | |
| | | // æ¥è¯¢ææçæ åæ¥æ° |
| | | List<ProcessMethodSearchNew> searchNewList = this.list(); |
| | | List<ProcessMethodSearchNew> searchNewList = this.list(Wrappers.<ProcessMethodSearchNew>lambdaQuery() |
| | | .eq(ProcessMethodSearchNew::getIsAutoArchived, 0)); |
| | | |
| | | // æ°å¢å¤å¶ |
| | | List<ProcessMethodSearchNewBackups> methodSearchNewBackups = searchNewList.stream().map(processMethodSearchNew -> { |
| | | ProcessMethodSearchNewBackups backups = new ProcessMethodSearchNewBackups(); |
| | | BeanUtils.copyProperties(processMethodSearchNew, backups); |
| | | backups.setIsNewStandard(0); |
| | | backups.setArchivedId(archived.getArchivedId()); |
| | | return backups; |
| | | }).collect(Collectors.toList()); |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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.process.mapper.ProcessMethodSearchNewFileSeqMapper"> |
| | | |
| | | <insert id="insertIfAbsent"> |
| | | INSERT IGNORE INTO cnas_process_method_search_new_file_seq |
| | | (seq_date, sequence_value) |
| | | VALUES |
| | | (#{seqDate}, 0) |
| | | </insert> |
| | | |
| | | <select id="selectForUpdate" resultType="java.lang.Integer"> |
| | | SELECT sequence_value |
| | | FROM cnas_process_method_search_new_file_seq |
| | | WHERE seq_date = #{seqDate} |
| | | FOR UPDATE |
| | | </select> |
| | | |
| | | <select id="selectMaxExisting" resultType="java.lang.Integer"> |
| | | SELECT COALESCE(MAX(seq_value), 0) |
| | | FROM ( |
| | | SELECT CAST(SUBSTRING(file_no, 9) AS UNSIGNED) AS seq_value |
| | | FROM cnas_process_method_search_new |
| | | WHERE file_no REGEXP CONCAT('^', #{prefix}, '[0-9]+$') |
| | | UNION ALL |
| | | SELECT CAST(SUBSTRING(file_no, 9) AS UNSIGNED) AS seq_value |
| | | FROM cnas_process_method_search_new_backups |
| | | WHERE file_no REGEXP CONCAT('^', #{prefix}, '[0-9]+$') |
| | | ) numbers |
| | | </select> |
| | | |
| | | <update id="updateValue"> |
| | | UPDATE cnas_process_method_search_new_file_seq |
| | | SET sequence_value = #{value} |
| | | WHERE seq_date = #{seqDate} |
| | | </update> |
| | | |
| | | </mapper> |
| | |
| | | from (select * |
| | | from cnas_process_method_search_new |
| | | <where> |
| | | and is_auto_archived = 0 |
| | | <if test="beginDate != null and beginDate != '' and endDate != null and endDate != ''"> |
| | | and create_time between #{beginDate} and #{endDate} |
| | | </if> |
| | |
| | | ${ew.customSqlSegment} |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="pageAutoArchived" resultType="com.ruoyi.process.pojo.ProcessMethodSearchNew"> |
| | | select * |
| | | from ( |
| | | select * from cnas_process_method_search_new |
| | | where is_auto_archived = 1 |
| | | order by auto_archived_time desc, method_search_new_id desc |
| | | ) a |
| | | <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> |
| | | ${ew.customSqlSegment} |
| | | </if> |
| | | </select> |
| | | </mapper> |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.core.domain.Result; |
| | | import com.ruoyi.require.dto.AcceptanceDto; |
| | | import com.ruoyi.require.pojo.FeStandardSubstance; |
| | | import com.ruoyi.require.pojo.FeStandardSubstanceAcceptanceInspection; |
| | | import com.ruoyi.require.service.FeStandardSubstanceAcceptanceInspectionService; |
| | | import com.ruoyi.require.service.FeStandardSubstanceAcceptanceService; |
| | | import com.ruoyi.require.service.FeStandardSubstanceService; |
| | | import com.ruoyi.require.vo.AcceptanceVo; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | |
| | | private FeStandardSubstanceAcceptanceInspectionService inspectionService; |
| | | @Resource |
| | | private FeStandardSubstanceAcceptanceService feStandardSubstanceAcceptanceService; |
| | | @Resource |
| | | private FeStandardSubstanceService feStandardSubstanceService; |
| | | |
| | | @Operation(summary = "æ°å¢") |
| | | @PostMapping("/addAcceptance") |
| | |
| | | |
| | | @Operation(summary = "ç¼è¾") |
| | | @PostMapping("/updateAcceptance") |
| | | @Transactional |
| | | public Result updateAcceptance(@RequestBody AcceptanceDto acceptanceDto) { |
| | | FeStandardSubstance substance = acceptanceDto.getSubstance(); |
| | | if (substance != null) { |
| | | if (substance.getId() == null) { |
| | | substance.setState(0); |
| | | feStandardSubstanceService.save(substance); |
| | | } else { |
| | | // é¢ç¨ç¶æç±é¢ç¨/å½è¿æä½ç»´æ¤ï¼ç¼è¾éªæ¶åæ¶ä¸åå |
| | | substance.setState(null); |
| | | feStandardSubstanceService.updateById(substance); |
| | | } |
| | | acceptanceDto.getAcceptance().setSubstanceId(substance.getId()); |
| | | } |
| | | feStandardSubstanceAcceptanceService.updateById(acceptanceDto.getAcceptance()); |
| | | for (FeStandardSubstanceAcceptanceInspection v : acceptanceDto.getList()) { |
| | | if (v.getId()== null) { |
| | |
| | | return Result.success(); |
| | | } |
| | | |
| | | @Operation(summary = "æ åç©è´¨æ¸
åå½è¿") |
| | | @PostMapping("/returnSubstance") |
| | | @Transactional |
| | | public Result returnSubstance(@RequestBody FeStandardSubstanceRecord record) { |
| | | feStandardSubstanceRecordService.returnSubstance(record); |
| | | return Result.success(); |
| | | @Operation(summary = "æ¥è¯¢æ åç©è´¨å©ä½å¯é¢ç¨æ°é") |
| | | @GetMapping("/getRemainingQuantity/{substanceId}") |
| | | public Result<Long> getRemainingQuantity(@PathVariable("substanceId") Integer substanceId) { |
| | | return Result.success(feStandardSubstanceRecordService.getRemainingQuantity(substanceId)); |
| | | } |
| | | |
| | | @Operation(summary = "æ åç©è´¨æ¸
åé¢ç¨æ¥è¯¢") |
| | |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | |
| | | return Result.success(supplierManagementService.selectSupplierManagementAll()); |
| | | } |
| | | |
| | | @Operation(summary = "æ¥è¯¢ä¾åºåéä»¶") |
| | | @GetMapping("/selectAttachments") |
| | | public Result selectAttachments(Integer supplierManagementId) { |
| | | return Result.success(supplierManagementService.selectAttachments(supplierManagementId)); |
| | | } |
| | | |
| | | @Operation(summary = "ä¸ä¼ ä¾åºåéä»¶") |
| | | @PostMapping("/uploadAttachment") |
| | | public Result uploadAttachment(@RequestParam("supplierManagementId") Integer supplierManagementId, |
| | | @RequestParam("file") MultipartFile file) { |
| | | return Result.success(supplierManagementService.uploadAttachment(supplierManagementId, file)); |
| | | } |
| | | |
| | | @Operation(summary = "å é¤ä¾åºåéä»¶") |
| | | @DeleteMapping("/deleteAttachment") |
| | | public Result deleteAttachment(Long id) { |
| | | return Result.success(supplierManagementService.deleteAttachment(id)); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.ruoyi.require.dto; |
| | | |
| | | import com.ruoyi.require.pojo.FeStandardSubstance; |
| | | import com.ruoyi.require.pojo.FeStandardSubstanceAcceptance; |
| | | import com.ruoyi.require.pojo.FeStandardSubstanceAcceptanceInspection; |
| | | import lombok.Data; |
| | |
| | | |
| | | private FeStandardSubstanceAcceptance acceptance; |
| | | |
| | | private FeStandardSubstance substance; |
| | | |
| | | private List<FeStandardSubstanceAcceptanceInspection> list; |
| | | } |
| | |
| | | @ExcelProperty("ç产åå®¶") |
| | | private String factoryManufacturer; |
| | | |
| | | @ExcelProperty("åºåºç¼å·") |
| | | @ExcelProperty("åºåç¼å·") |
| | | private String factoryNum; |
| | | |
| | | @ExcelProperty("管çç¼å·") |
| | |
| | | @ExcelProperty("æææ") |
| | | private LocalDateTime effectiveDate; |
| | | |
| | | @ExcelProperty("ææ¡£ç¼å·") |
| | | @ExcelProperty("æ¡£æ¡ç¼å·") |
| | | private String fileNum; |
| | | |
| | | @ExcelProperty("åæ¾ä½ç½®") |
| | |
| | | @ExcelProperty("è§æ ¼åå·*") |
| | | private String model; |
| | | |
| | | @ExcelProperty("ç产åå®¶*") |
| | | @ExcelProperty("ç产åå®¶") |
| | | private String factoryManufacturer; |
| | | |
| | | @ExcelProperty("åºåç¼å·*") |
| | |
| | | @ExcelProperty("æ°é*") |
| | | private String quantity; |
| | | |
| | | @ExcelProperty("åä½") |
| | | private String unit; |
| | | |
| | | @ExcelProperty("è´ç½®æ¥æ*(yyyy-MM-dd)") |
| | | private String acquisitionDate; |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.require.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.require.pojo.SupplierManagementAttachment; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | @Mapper |
| | | public interface SupplierManagementAttachmentMapper extends BaseMapper<SupplierManagementAttachment> { |
| | | } |
| | |
| | | package com.ruoyi.require.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | |
| | | @Schema(description = "ç产åå®¶") |
| | | private String factoryManufacturer; |
| | | |
| | | @Schema(description = "åºåºç¼å·") |
| | | @Schema(description = "ä¾åºå") |
| | | private String supplier; |
| | | |
| | | @Schema(description = "åºåç¼å·") |
| | | private String factoryNum; |
| | | |
| | | @Schema(description = "管çç¼å·") |
| | |
| | | @Schema(description = "æ°é") |
| | | private Long quantity; |
| | | |
| | | @Schema(description = "åä½") |
| | | private String unit; |
| | | |
| | | @Schema(description = "è´ç½®æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime acquisitionDate; |
| | | |
| | | @Schema(description = "æææ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime effectiveDate; |
| | | |
| | | @Schema(description = "ææ¡£ç¼å·") |
| | | @Schema(description = "æ¡£æ¡ç¼å·") |
| | | private String fileNum; |
| | | |
| | | @Schema(description = "åæ¾ä½ç½®") |
| | |
| | | private String createUser; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime createTime; |
| | | |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private String updateUser; |
| | | |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime updateTime; |
| | | } |
| | |
| | | import com.alibaba.excel.annotation.ExcelIgnore; |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | |
| | | |
| | | @ExcelIgnore |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ExcelIgnore |
| | |
| | | |
| | | @ExcelIgnore |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime updateTime; |
| | | } |
| | |
| | | package com.ruoyi.require.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | |
| | | @Schema(description = "ç©è´¨id") |
| | | private Integer substanceId; |
| | | |
| | | @Schema(description = "æ¬æ¬¡é¢ç¨æ°é") |
| | | private Long borrowQuantity; |
| | | |
| | | @Schema(description = "åå§æ°é(é¢ç¨æ¶å¿«ç
§)") |
| | | private Long originalQuantity; |
| | | |
| | | @Schema(description = "é¢ç¨åå©ä½æ°é") |
| | | private Long remainingQuantity; |
| | | |
| | | @Schema(description = "åç¨-å®å¥½æ§") |
| | | private String integrity; |
| | | |
| | |
| | | private String phone; |
| | | |
| | | @Schema(description = "åç¨-ååºæ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime borrowDate; |
| | | |
| | | @Schema(description = "å½è¿æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime borrowReturnDate; |
| | | |
| | | @Schema(description = "ååºäºº") |
| | |
| | | private String returnedPerson; |
| | | |
| | | @Schema(description = "å½è¿-æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime returnDate; |
| | | |
| | | @Schema(description = "å½è¿-å®å¥½æ§") |
| | |
| | | private String createUser; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime createTime; |
| | | |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private String updateUser; |
| | | |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime updateTime; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.require.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | @TableName("cnas_supplier_management_attachment") |
| | | public class SupplierManagementAttachment { |
| | | @TableId(type = IdType.AUTO) |
| | | private Long id; |
| | | private Integer supplierManagementId; |
| | | private String fileName; |
| | | private String fileUrl; |
| | | private Integer sort; |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime createTime; |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime updateTime; |
| | | } |
| | |
| | | |
| | | void borrowSubstance(FeStandardSubstanceRecord feStandardSubstanceRecord); |
| | | |
| | | void returnSubstance(FeStandardSubstanceRecord feStandardSubstanceRecord); |
| | | |
| | | List<FeStandardSubstanceRecord> getSubstanceRecord(Integer id); |
| | | |
| | | IPage<SubstanceRecordVo> getPage(Page page, SubstanceRecordVo vo); |
| | | |
| | | Long getRemainingQuantity(Integer substanceId); |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.require.pojo.SupplierManagement; |
| | | import com.ruoyi.require.pojo.SupplierManagementAttachment; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | |
| | | List<SupplierManagement> selectSupplierManagementByParentId(Integer parentId); |
| | | |
| | | List<SupplierManagement> selectSupplierManagementAll(); |
| | | |
| | | List<SupplierManagementAttachment> selectAttachments(Integer supplierManagementId); |
| | | |
| | | SupplierManagementAttachment uploadAttachment(Integer supplierManagementId, MultipartFile file); |
| | | |
| | | boolean deleteAttachment(Long id); |
| | | } |
| | |
| | | @Override |
| | | public void addAcceptance(AcceptanceDto dto) { |
| | | FeStandardSubstanceAcceptance acceptance = dto.getAcceptance(); |
| | | FeStandardSubstance substance = dto.getSubstance(); |
| | | if (substance != null) { |
| | | if (substance.getId() == null) { |
| | | substance.setState(0); |
| | | feStandardSubstanceMapper.insert(substance); |
| | | } |
| | | acceptance.setSubstanceId(substance.getId()); |
| | | } |
| | | this.baseMapper.insert(acceptance); |
| | | List<FeStandardSubstanceAcceptanceInspection> list = dto.getList(); |
| | | if (CollectionUtils.isNotEmpty(list)) { |
| | |
| | | |
| | | @Override |
| | | public void borrowSubstance(FeStandardSubstanceRecord feStandardSubstanceRecord) { |
| | | FeStandardSubstance standardSubstance = feStandardSubstanceMapper.selectOne(Wrappers.<FeStandardSubstance>lambdaQuery() |
| | | .eq(FeStandardSubstance::getId, feStandardSubstanceRecord.getSubstanceId()) |
| | | .eq(FeStandardSubstance::getState, 0) |
| | | .last("limit 1")); |
| | | if (ObjectUtils.isEmpty(standardSubstance)){ |
| | | throw new ErrorException("该ç©è´¨å·²è¢«ååºï¼"); |
| | | Long borrowQuantity = feStandardSubstanceRecord.getBorrowQuantity(); |
| | | if (borrowQuantity == null || borrowQuantity <= 0) { |
| | | throw new ErrorException("è¯·å¡«åæ£ç¡®çé¢ç¨æ°éï¼"); |
| | | } |
| | | FeStandardSubstance standardSubstance = feStandardSubstanceMapper.selectById(feStandardSubstanceRecord.getSubstanceId()); |
| | | if (ObjectUtils.isEmpty(standardSubstance)){ |
| | | throw new ErrorException("该æ åç©è´¨ä¸åå¨ï¼"); |
| | | } |
| | | long remaining = calcRemaining(standardSubstance); |
| | | if (remaining <= 0) { |
| | | throw new ErrorException("该æ åç©è´¨å·²å
¨é¨é¢ç¨ï¼å©ä½æ°é为0ï¼"); |
| | | } |
| | | if (borrowQuantity > remaining) { |
| | | throw new ErrorException("é¢ç¨æ°éä¸è½è¶
è¿å©ä½æ°éï¼å½åå©ä½" + remaining + "ï¼ï¼"); |
| | | } |
| | | long remainingAfter = remaining - borrowQuantity; |
| | | feStandardSubstanceRecord.setRemainingQuantity(remainingAfter); |
| | | // è®°å½é¢ç¨å½æ¶çåå§æ°éå¿«ç
§ï¼ä¹åæ¸
åéåæ¹æ°éä¸å½±ååå²é¢ç¨è®°å½ |
| | | feStandardSubstanceRecord.setOriginalQuantity(standardSubstance.getQuantity()); |
| | | this.baseMapper.insert(feStandardSubstanceRecord); |
| | | standardSubstance.setState(1); |
| | | standardSubstance.setState(remainingAfter == 0 ? 1 : 0); |
| | | feStandardSubstanceMapper.updateById(standardSubstance); |
| | | } |
| | | |
| | | @Override |
| | | public void returnSubstance(FeStandardSubstanceRecord feStandardSubstanceRecord) { |
| | | FeStandardSubstance standardSubstance = feStandardSubstanceMapper.selectOne(Wrappers.<FeStandardSubstance>lambdaQuery() |
| | | .eq(FeStandardSubstance::getId, feStandardSubstanceRecord.getSubstanceId()) |
| | | .eq(FeStandardSubstance::getState, 1)); |
| | | if (ObjectUtils.isEmpty(standardSubstance)){ |
| | | throw new ErrorException("该ç©è´¨æªè¢«é¢ç¨ï¼æ éå½è¿ï¼"); |
| | | public Long getRemainingQuantity(Integer substanceId) { |
| | | FeStandardSubstance standardSubstance = feStandardSubstanceMapper.selectById(substanceId); |
| | | if (ObjectUtils.isEmpty(standardSubstance)) { |
| | | return 0L; |
| | | } |
| | | standardSubstance.setState(0); |
| | | feStandardSubstanceMapper.updateById(standardSubstance); |
| | | baseMapper.update(feStandardSubstanceRecord, Wrappers.<FeStandardSubstanceRecord>lambdaUpdate() |
| | | .eq(FeStandardSubstanceRecord::getSubstanceId, feStandardSubstanceRecord.getSubstanceId()) |
| | | .eq(FeStandardSubstanceRecord::getStatus, 0)); |
| | | return Math.max(calcRemaining(standardSubstance), 0L); |
| | | } |
| | | |
| | | private long calcRemaining(FeStandardSubstance substance) { |
| | | long total = substance.getQuantity() == null ? 0L : substance.getQuantity(); |
| | | long borrowed = 0L; |
| | | List<FeStandardSubstanceRecord> records = this.baseMapper.selectList(Wrappers.<FeStandardSubstanceRecord>lambdaQuery() |
| | | .eq(FeStandardSubstanceRecord::getSubstanceId, substance.getId())); |
| | | for (FeStandardSubstanceRecord record : records) { |
| | | if ("1".equals(record.getStatus())) { // åå²å½è¿è®°å½ä¸è®¡å
¥å·²é¢ç¨ |
| | | continue; |
| | | } |
| | | borrowed += record.getBorrowQuantity() == null ? total : record.getBorrowQuantity(); |
| | | } |
| | | return total - borrowed; |
| | | } |
| | | |
| | | @Override |
| | |
| | | FeStandardSubstance substance = new FeStandardSubstance(); |
| | | substance.setName(required(row.getName(), rowNumber, "æ åç©è´¨åç§°")); |
| | | substance.setModel(required(row.getModel(), rowNumber, "è§æ ¼åå·")); |
| | | substance.setFactoryManufacturer(required(row.getFactoryManufacturer(), rowNumber, "ç产åå®¶")); |
| | | substance.setFactoryManufacturer(trim(row.getFactoryManufacturer())); |
| | | substance.setFactoryNum(required(row.getFactoryNum(), rowNumber, "åºåç¼å·")); |
| | | substance.setManageNum(manageNum); |
| | | substance.setUncertainty(required(row.getUncertainty(), rowNumber, "ä¸ç¡®å®åº¦")); |
| | | substance.setQuantity(parseQuantity(row.getQuantity(), rowNumber)); |
| | | substance.setUnit(trim(row.getUnit())); |
| | | substance.setAcquisitionDate(parseDate(row.getAcquisitionDate(), rowNumber, "è´ç½®æ¥æ")); |
| | | substance.setEffectiveDate(parseDate(row.getEffectiveDate(), rowNumber, "æææ")); |
| | | substance.setFileNum(required(row.getFileNum(), rowNumber, "æ¡£æ¡ç¼å·")); |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.QueryWrappers; |
| | | import com.ruoyi.require.dto.SupplierManagementDto; |
| | | import com.ruoyi.require.mapper.SupplierManagementAttachmentMapper; |
| | | import com.ruoyi.require.mapper.SupplierManagementMapper; |
| | | import com.ruoyi.require.pojo.SupplierManagement; |
| | | import com.ruoyi.require.pojo.SupplierManagementAttachment; |
| | | import com.ruoyi.require.service.SupplierManagementService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.net.URLEncoder; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | |
| | | @Autowired |
| | | private SupplierManagementMapper supplierManagementMapper; |
| | | |
| | | @Autowired |
| | | private SupplierManagementAttachmentMapper supplierManagementAttachmentMapper; |
| | | |
| | | @Value("${file.path}") |
| | | private String filePath; |
| | | |
| | | @Value("${wordUrl}") |
| | | private String wordUrl; |
| | | |
| | | public SupplierManagementServiceImpl(SupplierManagementMapper supplierManagementMapper) { |
| | | this.supplierManagementMapper = supplierManagementMapper; |
| | |
| | | public List<SupplierManagement> selectSupplierManagementAll() { |
| | | return supplierManagementMapper.selectList(null); |
| | | } |
| | | |
| | | @Override |
| | | public List<SupplierManagementAttachment> selectAttachments(Integer supplierManagementId) { |
| | | return supplierManagementAttachmentMapper.selectList(new QueryWrapper<SupplierManagementAttachment>().lambda() |
| | | .eq(SupplierManagementAttachment::getSupplierManagementId, supplierManagementId) |
| | | .orderByAsc(SupplierManagementAttachment::getSort, SupplierManagementAttachment::getId)); |
| | | } |
| | | |
| | | @Override |
| | | public SupplierManagementAttachment uploadAttachment(Integer supplierManagementId, MultipartFile file) { |
| | | if (supplierManagementMapper.selectById(supplierManagementId) == null) { |
| | | throw new BaseException("ä¾åºåä¸åå¨"); |
| | | } |
| | | if (file == null || file.isEmpty()) { |
| | | throw new BaseException("éä»¶ä¸è½ä¸ºç©º"); |
| | | } |
| | | // ç³»ç»å
¨å±ä¸ä¼ ä¸é为200MBï¼è¿éæåç»åºå好æç¤º |
| | | if (file.getSize() > 200L * 1024 * 1024) { |
| | | throw new BaseException("éä»¶ä¸è½è¶
è¿200MB"); |
| | | } |
| | | String originalName = file.getOriginalFilename(); |
| | | if (originalName == null || originalName.trim().isEmpty()) { |
| | | originalName = "æªå½åæä»¶"; |
| | | } |
| | | // ä¸ªå«æµè§å¨å¯è½å¸¦ä¸è·¯å¾åç¼ï¼åªä¿çæä»¶åæ¬èº« |
| | | originalName = originalName.replaceAll(".*[/\\\\]", ""); |
| | | try { |
| | | // å¾çæ¾å¾çç®å½ï¼/img éæè·¯å¾ï¼ï¼å
¶ä½ä»»ææ ¼å¼æ¾ word ç®å½ï¼/word éæè·¯å¾ï¼ |
| | | boolean image = originalName.matches("(?i).+\\.(jpg|jpeg|png|gif)$"); |
| | | File directory = new File(image ? filePath : wordUrl); |
| | | if (!directory.exists()) { |
| | | directory.mkdirs(); |
| | | } |
| | | String fileUrl = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyMMddHHmmssSSS")) + "-" + originalName; |
| | | file.transferTo(new File(directory, fileUrl)); |
| | | SupplierManagementAttachment attachment = new SupplierManagementAttachment(); |
| | | attachment.setSupplierManagementId(supplierManagementId); |
| | | attachment.setFileName(originalName); |
| | | attachment.setFileUrl(fileUrl); |
| | | attachment.setSort(selectAttachments(supplierManagementId).size()); |
| | | supplierManagementAttachmentMapper.insert(attachment); |
| | | return attachment; |
| | | } catch (IOException e) { |
| | | throw new BaseException("éä»¶ä¸ä¼ 失败"); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public boolean deleteAttachment(Long id) { |
| | | return supplierManagementAttachmentMapper.deleteById(id) > 0; |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.require.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | |
| | | @Schema(description = "ç产åå®¶") |
| | | private String factoryManufacturer; |
| | | |
| | | @Schema(description = "åºåºç¼å·") |
| | | @Schema(description = "åºåç¼å·") |
| | | private String factoryNum; |
| | | |
| | | @Schema(description = "管çç¼å·") |
| | |
| | | @Schema(description = "æ°é") |
| | | private Long quantity; |
| | | |
| | | @Schema(description = "åä½") |
| | | private String unit; |
| | | |
| | | @Schema(description = "è´ç½®æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime acquisitionDate; |
| | | |
| | | @Schema(description = "æææ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime effectiveDate; |
| | | |
| | | @Schema(description = "ææ¡£ç¼å·") |
| | | @Schema(description = "æ¡£æ¡ç¼å·") |
| | | private String fileNum; |
| | | |
| | | @Schema(description = "åæ¾ä½ç½®") |
| | | private String position; |
| | | |
| | | @Schema(description = "æäº¤æ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime createTime; |
| | | } |
| | |
| | | package com.ruoyi.require.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | |
| | | @Schema(description = "è§æ ¼åå·") |
| | | private String model; |
| | | |
| | | @Schema(description = "åºåºç¼å·") |
| | | @Schema(description = "åºåç¼å·") |
| | | private String factoryNum; |
| | | |
| | | @Schema(description = "æ°é") |
| | | private Long quantity; |
| | | |
| | | @Schema(description = "åä½") |
| | | private String unit; |
| | | |
| | | @Schema(description = "æ¬æ¬¡é¢ç¨æ°é") |
| | | private Long borrowQuantity; |
| | | |
| | | @Schema(description = "é¢ç¨åå©ä½æ°é") |
| | | private Long remainingQuantity; |
| | | |
| | | @Schema(description = "é¢ç¨äºº") |
| | | private String borrowUser; |
| | | |
| | | @Schema(description = "ååºæ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime borrowDate; |
| | | |
| | | @Schema(description = "å½è¿æ¥æ") |
| | | private LocalDateTime returnDate; |
| | | |
| | | @Schema(description = "å½è¿äºº") |
| | | private String returnedPerson; |
| | | |
| | | @Schema(description = "å®å¥½æ§") |
| | | private String returnIntegrity; |
| | | |
| | | @Schema(description = "0ï¼åç¨ 1:å½è¿") |
| | | private String status; |
| | | |
| | | @Schema(description = "夿³¨") |
| | | private String remark; |
| | |
| | | ss.manage_num, |
| | | ss.uncertainty, |
| | | ss.quantity, |
| | | ss.unit, |
| | | ss.acquisition_date, |
| | | ss.effective_date, |
| | | ss.file_num, |
| | | ss.position |
| | | ss.position, |
| | | sa.create_time |
| | | FROM cnas_fe_standard_substance_acceptance sa |
| | | LEFT JOIN cnas_fe_standard_substance ss on ss.id = sa.substance_id |
| | | <where> |
| | |
| | | ss.name, |
| | | ss.model, |
| | | ss.factory_num, |
| | | ss.quantity, |
| | | COALESCE(ssr.original_quantity, ss.quantity) AS quantity, |
| | | ss.unit, |
| | | COALESCE(ssr.borrow_quantity, ss.quantity) AS borrowQuantity, |
| | | COALESCE(ssr.remaining_quantity, 0) AS remainingQuantity, |
| | | ssr.borrow_user, |
| | | ssr.borrow_date, |
| | | ssr.return_date, |
| | | ssr.integrity, |
| | | ssr.return_integrity, |
| | | ssr.returned_person, |
| | | ss.remark |
| | | FROM cnas_fe_standard_substance_record ssr |
| | | LEFT JOIN cnas_fe_standard_substance ss on ss.id = ssr.substance_id |
| | |
| | | package com.ruoyi.inspect.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.basic.dto.InventoryDetailDTO; |
| | |
| | | return insOrderService.judgeNotSpotCheckOrder(insPlaceOrderDto.getSampleList(), insPlaceOrderDto.getInsOrder()); |
| | | } |
| | | |
| | | @Operation(summary = "æ¥è¯¢å·²å®æå§æå(å®¢æ·æ»¡æåº¦ä¸æç¨, ä»
å·²æ£éªstate=4)") |
| | | @GetMapping("/selectCompletedOrders") |
| | | public Result selectCompletedOrders() { |
| | | LambdaQueryWrapper<InsOrder> qw = new LambdaQueryWrapper<>(); |
| | | qw.select(InsOrder::getId, InsOrder::getEntrustCode, InsOrder::getCompany, |
| | | InsOrder::getCompanyId, InsOrder::getSampleView) |
| | | .eq(InsOrder::getState, 4) |
| | | .isNotNull(InsOrder::getCompany) |
| | | .orderByDesc(InsOrder::getCreateTime); |
| | | return Result.success(insOrderService.page(new Page<>(1, 500), qw).getRecords()); |
| | | } |
| | | |
| | | } |
| | |
| | | druid: |
| | | # ä¸»åºæ°æ®æº |
| | | master: |
| | | url: jdbc:mysql://192.168.0.24:3307/lims-xjxj?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 |
| | | url: jdbc:mysql://127.0.0.1:3307/lims-xjxj?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 |
| | | username: root |
| | | password: 123456 |
| | | # ä»åºæ°æ®æº |
| | |
| | | config: |
| | | multi-statement-allow: true |
| | | |
| | | # Redis è¿æ¥é
ç½® |
| | | data: |
| | | redis: |
| | | host: 127.0.0.1 |
| | | port: 6379 |
| | | database: 0 |
| | | password: |
| | | timeout: 10s |
| | | lettuce: |
| | | pool: |
| | | # è¿æ¥æ± ä¸çæå°ç©ºé²è¿æ¥ |
| | | min-idle: 0 |
| | | # è¿æ¥æ± ä¸çæå¤§ç©ºé²è¿æ¥ |
| | | max-idle: 8 |
| | | # è¿æ¥æ± çæå¤§æ°æ®åºè¿æ¥æ° |
| | | max-active: 8 |
| | | # #è¿æ¥æ± æå¤§é»å¡çå¾
æ¶é´ï¼ä½¿ç¨è´å¼è¡¨ç¤ºæ²¡æéå¶ï¼ |
| | | max-wait: -1ms |
| | | |
| | | # 项ç®ç¸å
³é
ç½® |
| | | ruoyi: |
| | | name: RuoYi |
| | | version: 3.9.2 |
| | | copyrightYear: 2026 |
| | | profile: D:/ruoyi/uploadPath |
| | | addressEnabled: false |
| | | |
| | | # ç¨æ·å¯ç é
ç½® |
| | | user: |
| | | password: |
| | | maxRetryCount: 5 |
| | | lockTime: 10 |
| | | |
| | | # 令çé
ç½® |
| | | token: |
| | | header: Authorization |
| | | secret: awertgbadrtawetfgfbsdfawerghbfdsftreagd |
| | | expireTime: 450 |
| | | |
| | | # é²çé¾é
ç½® |
| | | referer: |
| | | enabled: false |
| | | allowed-domains: localhost,127.0.0.1,ruoyi.vip,www.ruoyi.vip |
| | | |
| | | # XSS è¿æ»¤é
ç½® |
| | | xss: |
| | | enabled: true |
| | | excludes: /system/notice |
| | | urlPatterns: /system/*,/monitor/*,/tool/* |
| | | |
| | | # ç
§çåå¨è·¯å¾+++++++++++++++++++++++++++è¿ç»´éè¦é
ç½®+++++++++++++++++++++++++++ |
| | | file: |
| | | path: D:\é¡¹ç®æä»¶åå¨\image |
| | |
| | | allowed: png,jpg,jpeg,gif |
| | | |
| | | # æ¥å word åå¨è·¯å¾ |
| | | wordUrl: D:\é¡¹ç®æä»¶åå¨\word |
| | | wordUrl: D:\é¡¹ç®æä»¶åå¨\word |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | # è£
夿µè¯åºé
ç½® |
| | | |
| | | # æ°æ®æºé
ç½® |
| | | spring: |
| | | datasource: |
| | | type: com.alibaba.druid.pool.DruidDataSource |
| | | driverClassName: com.mysql.cj.jdbc.Driver |
| | | druid: |
| | | # ä¸»åºæ°æ®æº |
| | | master: |
| | | url: jdbc:mysql://172.17.0.1:11101/lims-xjxj?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 |
| | | username: root |
| | | password: xd@123456.. |
| | | |
| | | # ä»åºæ°æ®æº |
| | | slave: |
| | | # 仿°æ®æºå¼å
³/é»è®¤å
³é |
| | | enabled: false |
| | | url: |
| | | username: |
| | | password: |
| | | # åå§è¿æ¥æ° |
| | | initialSize: 5 |
| | | # æå°è¿æ¥æ± æ°é |
| | | minIdle: 10 |
| | | # æå¤§è¿æ¥æ± æ°é |
| | | maxActive: 20 |
| | | # é
ç½®è·åè¿æ¥çå¾
è¶
æ¶çæ¶é´ |
| | | maxWait: 60000 |
| | | # é
ç½®è¿æ¥è¶
æ¶æ¶é´ |
| | | connectTimeout: 30000 |
| | | # é
ç½®ç½ç»è¶
æ¶æ¶é´ |
| | | socketTimeout: 60000 |
| | | # é
ç½®é´éå¤ä¹
æè¿è¡ä¸æ¬¡æ£æµï¼æ£æµéè¦å
³éç空é²è¿æ¥ï¼å使¯æ¯«ç§ |
| | | timeBetweenEvictionRunsMillis: 60000 |
| | | # é
ç½®ä¸ä¸ªè¿æ¥å¨æ± 䏿å°çåçæ¶é´ï¼å使¯æ¯«ç§ |
| | | minEvictableIdleTimeMillis: 300000 |
| | | # é
ç½®ä¸ä¸ªè¿æ¥å¨æ± 䏿大çåçæ¶é´ï¼å使¯æ¯«ç§ |
| | | maxEvictableIdleTimeMillis: 900000 |
| | | # é
ç½®æ£æµè¿æ¥æ¯å¦ææ |
| | | validationQuery: SELECT 1 FROM DUAL |
| | | testWhileIdle: true |
| | | testOnBorrow: false |
| | | testOnReturn: false |
| | | webStatFilter: |
| | | enabled: true |
| | | statViewServlet: |
| | | enabled: true |
| | | # 设置ç½ååï¼ä¸å¡«åå
许ææè®¿é® |
| | | allow: |
| | | url-pattern: /druid/* |
| | | # æ§å¶å°ç®¡çç¨æ·ååå¯ç |
| | | login-username: ruoyi |
| | | login-password: 123456 |
| | | filter: |
| | | stat: |
| | | enabled: true |
| | | # æ
¢SQLè®°å½ |
| | | log-slow-sql: true |
| | | slow-sql-millis: 1000 |
| | | merge-sql: true |
| | | wall: |
| | | config: |
| | | multi-statement-allow: true |
| | | |
| | | # redis é
ç½® |
| | | data: |
| | | # redis é
ç½® |
| | | redis: |
| | | # å°å |
| | | host: 172.17.0.1 |
| | | # 端å£ï¼é»è®¤ä¸º6379 |
| | | port: 11102 |
| | | # æ°æ®åºç´¢å¼ |
| | | database: 6 |
| | | # å¯ç |
| | | password: |
| | | # è¿æ¥è¶
æ¶æ¶é´ |
| | | timeout: 10s |
| | | lettuce: |
| | | pool: |
| | | # è¿æ¥æ± ä¸çæå°ç©ºé²è¿æ¥ |
| | | min-idle: 0 |
| | | # è¿æ¥æ± ä¸çæå¤§ç©ºé²è¿æ¥ |
| | | max-idle: 8 |
| | | # è¿æ¥æ± çæå¤§æ°æ®åºè¿æ¥æ° |
| | | max-active: 8 |
| | | # #è¿æ¥æ± æå¤§é»å¡çå¾
æ¶é´ï¼ä½¿ç¨è´å¼è¡¨ç¤ºæ²¡æéå¶ï¼ |
| | | max-wait: -1ms |
| | | |
| | | # mybatis-plusé
ç½® |
| | | mybatis-plus: |
| | | configuration: |
| | | log-impl: org.apache.ibatis.logging.stdout.StdOutImpl |
| | | |
| | | # æ¥å¿é
ç½® |
| | | logging: |
| | | file-location: /center-lims/Java |
| | | level: |
| | | root: info |
| | | com.ruoyi: debug |
| | | org.springframework.web: debug |
| | | org.springframework.security: info |
| | | org.mybatis: debug |
| | | com.baomidou.mybatisplus: debug |
| | | |
| | | # Swaggeré
ç½® |
| | | swagger: |
| | | # æ¯å¦å¼å¯swagger |
| | | enabled: true |
| | | |
| | | # 项ç®ç¸å
³é
ç½® |
| | | ruoyi: |
| | | name: RuoYi |
| | | version: 3.9.2 |
| | | copyrightYear: 2026 |
| | | profile: D:/ruoyi/uploadPath |
| | | addressEnabled: false |
| | | |
| | | # ç¨æ·å¯ç é
ç½® |
| | | user: |
| | | password: |
| | | maxRetryCount: 5 |
| | | lockTime: 10 |
| | | |
| | | # 令çé
ç½® |
| | | token: |
| | | header: Authorization |
| | | secret: awertgbadrtawetfgfbsdfawerghbfdsftreagd |
| | | expireTime: 450 |
| | | |
| | | # é²çé¾é
ç½® |
| | | referer: |
| | | enabled: false |
| | | allowed-domains: localhost,127.0.0.1,ruoyi.vip,www.ruoyi.vip |
| | | |
| | | # XSS è¿æ»¤é
ç½® |
| | | xss: |
| | | enabled: true |
| | | excludes: /system/notice |
| | | urlPatterns: /system/*,/monitor/*,/tool/* |
| | | |
| | | |
| | | # ç
§çåå¨è·¯å¾+++++++++++++++++++++++++++è¿ç»´éè¦é
ç½®+++++++++++++++++++++++++++ |
| | | file: |
| | | path: /center-lims/Work/img |
| | | # ä¸ä¼ æä»¶å
è®¸çæ©å±å |
| | | allowed: png,jpg,jpeg,gif |
| | | # æ¥åå°å |
| | | wordUrl: /center-lims/Work/word |
| | |
| | | # 项ç®ç¸å
³é
ç½® |
| | | ruoyi: |
| | | # åç§° |
| | | name: RuoYi |
| | | # çæ¬ |
| | | version: 3.9.2 |
| | | # çæå¹´ä»½ |
| | | copyrightYear: 2026 |
| | | # æä»¶è·¯å¾ 示ä¾ï¼ Windowsé
ç½®D:/ruoyi/uploadPathï¼Linuxé
ç½® /home/ruoyi/uploadPathï¼ |
| | | profile: D:/ruoyi/uploadPath |
| | | # è·åipå°åå¼å
³ |
| | | addressEnabled: false |
| | | |
| | | # å¼åç¯å¢é
ç½® |
| | | server: |
| | | # æå¡å¨çHTTP端å£ï¼é»è®¤ä¸º8080 |
| | | port: 8002 |
| | | # æå¡å¨çHTTP端å£ï¼é»è®¤ä¸º8080ï¼æå¡å¨æ°èå端为9509 |
| | | port: 9509 |
| | | servlet: |
| | | # åºç¨ç访é®è·¯å¾ |
| | | context-path: / |
| | |
| | | level: |
| | | com.ruoyi: debug |
| | | org.springframework: warn |
| | | |
| | | # ç¨æ·é
ç½® |
| | | user: |
| | | password: |
| | | # å¯ç æå¤§éè¯¯æ¬¡æ° |
| | | maxRetryCount: 5 |
| | | # å¯ç é宿¶é´ï¼é»è®¤10åéï¼ |
| | | lockTime: 10 |
| | | |
| | | # Springé
ç½® |
| | | spring: |
| | |
| | | restart: |
| | | # çé¨ç½²å¼å
³ |
| | | enabled: true |
| | | data: |
| | | # redis é
ç½® |
| | | redis: |
| | | # å°å |
| | | host: 192.168.0.24 |
| | | # 端å£ï¼é»è®¤ä¸º6379 |
| | | port: 6379 |
| | | # æ°æ®åºç´¢å¼ |
| | | database: 0 |
| | | # å¯ç |
| | | password: |
| | | # è¿æ¥è¶
æ¶æ¶é´ |
| | | timeout: 10s |
| | | lettuce: |
| | | pool: |
| | | # è¿æ¥æ± ä¸çæå°ç©ºé²è¿æ¥ |
| | | min-idle: 0 |
| | | # è¿æ¥æ± ä¸çæå¤§ç©ºé²è¿æ¥ |
| | | max-idle: 8 |
| | | # è¿æ¥æ± çæå¤§æ°æ®åºè¿æ¥æ° |
| | | max-active: 8 |
| | | # #è¿æ¥æ± æå¤§é»å¡çå¾
æ¶é´ï¼ä½¿ç¨è´å¼è¡¨ç¤ºæ²¡æéå¶ï¼ |
| | | max-wait: -1ms |
| | | |
| | | # tokené
ç½® |
| | | token: |
| | | # 令çèªå®ä¹æ è¯ |
| | | header: Authorization |
| | | # 令çå¯é¥ |
| | | secret: abcdefghijklmnopqrstuvwxyz |
| | | # ä»¤çæææï¼é»è®¤30åéï¼ |
| | | expireTime: 30 |
| | | |
| | | # MyBatis-Plusé
ç½® |
| | | mybatis-plus: |
| | | # æç´¢æå®å
å«å |
| | |
| | | display-name: 'æµè¯æ¨¡å' |
| | | paths-to-match: '/**' |
| | | packages-to-scan: com.ruoyi |
| | | |
| | | # é²çé¾é
ç½® |
| | | referer: |
| | | # é²çé¾å¼å
³ |
| | | enabled: false |
| | | # å
许çååå表 |
| | | allowed-domains: localhost,127.0.0.1,ruoyi.vip,www.ruoyi.vip |
| | | |
| | | # 鲿¢XSSæ»å» |
| | | xss: |
| | | # è¿æ»¤å¼å
³ |
| | | enabled: true |
| | | # æé¤é¾æ¥ï¼å¤ä¸ªç¨éå·åéï¼ |
| | | excludes: /system/notice |
| | | # å¹é
龿¥ |
| | | urlPatterns: /system/*,/monitor/*,/tool/* |