李林
2024-04-08 ff057092893a5c3852d66d2423cfeb5463106079
费用统计
已修改9个文件
已添加1个文件
149 ■■■■■ 文件已修改
inspect-server/src/main/java/com/yuanchu/mom/controller/InsOrderController.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/controller/InsReportController.java 49 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/dto/CostStatisticsDto.java 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/mapper/InsOrderMapper.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/service/InsOrderService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/service/InsReportService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderServiceImpl.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsReportServiceImpl.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/resources/mapper/InsOrderMapper.xml 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
system-run/src/main/resources/application-dev.yml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/controller/InsOrderController.java
@@ -4,6 +4,7 @@
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yuanchu.mom.annotation.ValueAuth;
import com.yuanchu.mom.dto.CostStatisticsDto;
import com.yuanchu.mom.dto.SampleOrderDto;
import com.yuanchu.mom.dto.SampleProductDto;
import com.yuanchu.mom.dto.SampleProductDto2;
@@ -123,4 +124,12 @@
        return Result.success(insOrderService.selectSampleAndProductByOrderId(page, sampleProductDto));
    }
    @ApiOperation(value = "费用统计")
    @PostMapping("/costStatistics")
    public Result<?> costStatistics(@RequestBody Map<String, Object> data) throws Exception {
        Page page = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("page")), Page.class);
        CostStatisticsDto costStatisticsDto = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), CostStatisticsDto.class);
        return Result.success(insOrderService.costStatistics(page, costStatisticsDto));
    }
}
inspect-server/src/main/java/com/yuanchu/mom/controller/InsReportController.java
@@ -1,29 +1,36 @@
package com.yuanchu.mom.controller;
import cn.hutool.core.lang.UUID;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yuanchu.mom.annotation.ValueAuth;
import com.yuanchu.mom.dto.ReportPageDto;
import com.yuanchu.mom.dto.SampleOrderDto;
import com.yuanchu.mom.exception.ErrorException;
import com.yuanchu.mom.service.InsReportService;
import com.yuanchu.mom.utils.JackSonUtil;
import com.yuanchu.mom.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
@AllArgsConstructor
@RestController
@RequestMapping("/insReport")
@Api("检验报告")
public class InsReportController {
    @Resource
    private InsReportService insReportService;
    @Value("${wordUrl}")
    private String wordUrl;
    @ApiOperation(value = "查询检验报告数据")
    @PostMapping("/pageInsReport")
@@ -40,4 +47,36 @@
        return Result.success("转换成功", insReportService.wordToHtml(path));
    }
    @ApiOperation(value = "报告上传")
    @PostMapping("/inReport")
    public Result inReport(MultipartFile file, Integer id) {
        String urlString;
        String pathName;
        try {
            String path = wordUrl;
            File realpath = new File(path);
            if (!realpath.exists()) {
                realpath.mkdirs();
            }
            pathName = UUID.randomUUID() + "_" + file.getOriginalFilename();
            urlString = realpath + "/" + pathName;
            file.transferTo(new File(urlString));
            return Result.success(insReportService.inReport("/word/"+pathName, id));
        } catch (Exception e) {
            throw new ErrorException("文件上传失败");
        }
    }
    @ApiOperation(value = "报告还原")
    @PostMapping("/upReportUrl")
    public Result upReportUrl(Integer id) {
        return Result.success(insReportService.upReportUrl(id));
    }
    @ApiOperation(value = "报告在线编制")
    @GetMapping("/upReportFile")
    public Result upReportFile() {
        return Result.success();
    }
}
inspect-server/src/main/java/com/yuanchu/mom/dto/CostStatisticsDto.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,44 @@
package com.yuanchu.mom.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yuanchu.mom.annotation.ValueTableShow;
import com.yuanchu.mom.common.OrderBy;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Data
public class CostStatisticsDto extends OrderBy {
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ValueTableShow(value = 1, name = "下单时间")
    private LocalDateTime createTime;
    @ValueTableShow(value = 2, name = "委托编号")
    private String entrustCode;
    @ValueTableShow(value = 3, name = "样品名称")
    private String sample;
    @ValueTableShow(value = 4, name = "规格型号")
    private String model;
    @ValueTableShow(value = 5, name = "样品数量")
    private Integer num = 1;
    @ValueTableShow(value = 6, name = "总价")
    private BigDecimal price;
    @ValueTableShow(value = 7, name = "试验项目")
    private String product;
    @ValueTableShow(value = 8, name = "委托单位")
    private String company;
    @ValueTableShow(value = 9, name = "委托人")
    private String name;
    private Integer createUser;
}
inspect-server/src/main/java/com/yuanchu/mom/mapper/InsOrderMapper.java
@@ -3,6 +3,7 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yuanchu.mom.dto.CostStatisticsDto;
import com.yuanchu.mom.dto.SampleOrderDto;
import com.yuanchu.mom.dto.SampleProductDto;
import com.yuanchu.mom.dto.SampleProductDto2;
@@ -28,6 +29,8 @@
    IPage<SampleProductDto2> selectSampleAndProductByOrderId(IPage<SampleProductDto2> page, QueryWrapper<SampleProductDto2> ew);
    IPage<CostStatisticsDto> selectCostStatistics(IPage<CostStatisticsDto> page, QueryWrapper<CostStatisticsDto> ew);
}
inspect-server/src/main/java/com/yuanchu/mom/service/InsOrderService.java
@@ -31,4 +31,6 @@
    Map<String, Object> selectSampleAndProductByOrderId(IPage<SampleProductDto2> page, SampleProductDto2 sampleProductDto);
    Map<String, Object> costStatistics(IPage<CostStatisticsDto> page, CostStatisticsDto costStatisticsDto);
}
inspect-server/src/main/java/com/yuanchu/mom/service/InsReportService.java
@@ -19,4 +19,8 @@
    String wordToHtml(String path);
    int inReport(String url, Integer id);
    int upReportUrl(Integer id);
}
inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderServiceImpl.java
@@ -149,6 +149,16 @@
        map.put("body", insOrderMapper.selectSampleAndProductByOrderId(page, QueryWrappers.queryWrappers(sampleProductDto)));
        return map;
    }
    @Override
    public Map<String, Object> costStatistics(IPage<CostStatisticsDto> page, CostStatisticsDto costStatisticsDto) {
        Map<String, Object> map = new HashMap<>();
        map.put("head", PrintChina.printChina(CostStatisticsDto.class));
        Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId("costStatistics");
        if (map1.get("look") == 1) costStatisticsDto.setCreateUser(map1.get("userId"));
        map.put("body", insOrderMapper.selectCostStatistics(page, QueryWrappers.queryWrappers(costStatisticsDto)));
        return map;
    }
}
inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsReportServiceImpl.java
@@ -1,6 +1,7 @@
package com.yuanchu.mom.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.spire.doc.Document;
@@ -65,6 +66,19 @@
            throw new ErrorException("转换失败");
        }
    }
    @Override
    public int inReport(String url, Integer id) {
        InsReport insReport = new InsReport();
        insReport.setId(id);
        insReport.setUrlS(url);
        return insReportMapper.updateById(insReport);
    }
    @Override
    public int upReportUrl(Integer id) {
        return insReportMapper.update(null, Wrappers.<InsReport>lambdaUpdate().eq(InsReport::getId, id).set(InsReport::getUrlS, null));
    }
}
inspect-server/src/main/resources/mapper/InsOrderMapper.xml
@@ -116,6 +116,18 @@
            ${ew.customSqlSegment}
        </if>
    </select>
    <select id="selectCostStatistics" resultType="com.yuanchu.mom.dto.CostStatisticsDto">
        select * from {
        SELECT io.id,io.entrust_code,io.create_time,isa.sample,isa.model,ip.price,ip.inspection_item,u.company,u.`name`,io.create_user from ins_order io
        LEFT JOIN ins_sample isa ON isa.ins_order_id = io.id
        LEFT JOIN ins_product ip ON ip.ins_sample_id = isa.id
        LEFT JOIN `user` u ON u.id = io.user_id
#         where (io.state = 3 OR io.state = 4)
        } a
        <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
            ${ew.customSqlSegment}
        </if>
    </select>
    <update id="upInsOrderParameter" parameterType="com.yuanchu.mom.pojo.InsOrder">
        UPDATE ins_order
system-run/src/main/resources/application-dev.yml
@@ -10,7 +10,7 @@
# æ•°æ®åº“备份路径
backup:
  # æ•°æ®åº“备份路径+++++++++++++++++++++++++++运维需要配置+++++++++++++++++++++++++++
  path: D:\Download\log
  path: #D:\Download\log
  # æ•°æ®åº“备份天数
  destiny: 7
  # æ•°æ®åº“备份工具路径+++++++++++++++++++++++++++运维需要配置+++++++++++++++++++++++++++