Commit d14f5572 authored by qinhu's avatar qinhu

小样管理---存储二维码生成

parent 77a00448
...@@ -38,12 +38,10 @@ ...@@ -38,12 +38,10 @@
<dependency> <dependency>
<groupId>org.redisson</groupId> <groupId>org.redisson</groupId>
<artifactId>redisson</artifactId> <artifactId>redisson</artifactId>
<version>3.11.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>redis.clients</groupId> <groupId>redis.clients</groupId>
<artifactId>jedis</artifactId> <artifactId>jedis</artifactId>
<version>3.1.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
...@@ -68,7 +66,6 @@ ...@@ -68,7 +66,6 @@
<groupId>mysql</groupId> <groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-java</artifactId>
<!--<version>5.1.45</version>--> <!--<version>5.1.45</version>-->
<version>8.0.18</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.httpcomponents</groupId> <groupId>org.apache.httpcomponents</groupId>
...@@ -99,7 +96,6 @@ ...@@ -99,7 +96,6 @@
<dependency> <dependency>
<groupId>cn.hutool</groupId> <groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId> <artifactId>hutool-all</artifactId>
<version>4.6.8</version>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/org.freemarker/freemarker --> <!-- https://mvnrepository.com/artifact/org.freemarker/freemarker -->
<dependency> <dependency>
...@@ -110,28 +106,28 @@ ...@@ -110,28 +106,28 @@
<dependency> <dependency>
<groupId>io.jsonwebtoken</groupId> <groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId> <artifactId>jjwt</artifactId>
<version>0.9.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.google.guava</groupId> <groupId>com.google.guava</groupId>
<artifactId>guava</artifactId> <artifactId>guava</artifactId>
<version>23.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.poi</groupId> <groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId> <artifactId>poi</artifactId>
<version>3.17</version>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/net.oschina.zcx7878/fastdfs-client-java --> <!-- https://mvnrepository.com/artifact/net.oschina.zcx7878/fastdfs-client-java -->
<dependency> <dependency>
<groupId>net.oschina.zcx7878</groupId> <groupId>net.oschina.zcx7878</groupId>
<artifactId>fastdfs-client-java</artifactId> <artifactId>fastdfs-client-java</artifactId>
<version>1.27.0.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-io</groupId> <groupId>commons-io</groupId>
<artifactId>commons-io</artifactId> <artifactId>commons-io</artifactId>
<version>2.6</version> </dependency>
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>core</artifactId>
</dependency> </dependency>
</dependencies> </dependencies>
......
package cn.wise.sc.cement.business.controller; package cn.wise.sc.cement.business.controller;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.qrcode.QrCodeUtil;
import cn.wise.sc.cement.business.model.BaseResponse; import cn.wise.sc.cement.business.model.BaseResponse;
import cn.wise.sc.cement.business.model.PageQuery; import cn.wise.sc.cement.business.model.PageQuery;
import cn.wise.sc.cement.business.model.query.SampleManageQuery; import cn.wise.sc.cement.business.model.query.SampleManageQuery;
import cn.wise.sc.cement.business.model.query.StandardQuery;
import cn.wise.sc.cement.business.service.ISampleService; import cn.wise.sc.cement.business.service.ISampleService;
import cn.wise.sc.cement.business.service.ISysDictionaryService; import cn.wise.sc.cement.business.service.ISysDictionaryService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -15,104 +15,137 @@ import org.slf4j.Logger; ...@@ -15,104 +15,137 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.imageio.ImageIO;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.awt.image.BufferedImage;
import java.io.IOException;
/** /**
* <p> * <p>
* 前端控制器 * 前端控制器
* </p> * </p>
* *
* @author ztw * @author ztw
* @since 2020-09-04 * @since 2020-09-04
*/ */
@Api(tags="样品管理") @Api(tags = "样品管理")
@RestController @RestController
@RequestMapping("/business/sample") @RequestMapping("/business/sample")
public class SampleController { public class SampleController {
private static final Logger log = LoggerFactory.getLogger("SampleController"); private static final Logger log = LoggerFactory.getLogger("SampleController");
@Autowired @Autowired
private ISampleService sampleService; private ISampleService sampleService;
@Autowired @Autowired
private ISysDictionaryService dictionaryService; private ISysDictionaryService dictionaryService;
@ApiOperation(value = "样品分页列表") @ApiOperation(value = "样品分页列表")
@ApiImplicitParams(value = { @ApiImplicitParams(value = {
@ApiImplicitParam(name = "sampleName", value = "样品名称", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "sampleName", value = "样品名称", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "cementCode", value = "样品本所编号", paramType = "query", dataType = "String") @ApiImplicitParam(name = "cementCode", value = "样品本所编号", paramType = "query", dataType = "String")
}) })
@GetMapping("/getPage") @GetMapping("/getPage")
public BaseResponse getPage(PageQuery pageQuery, String sampleName, String cementCode) { public BaseResponse getPage(PageQuery pageQuery, String sampleName, String cementCode) {
try { try {
return sampleService.getPage(pageQuery, sampleName, cementCode); return sampleService.getPage(pageQuery, sampleName, cementCode);
} catch (Exception e) { } catch (Exception e) {
log.debug("样品分页列表{}", e); log.debug("样品分页列表{}", e);
} }
return BaseResponse.errorMsg("失败!"); return BaseResponse.errorMsg("失败!");
} }
@ApiOperation("样品列表导出") @ApiOperation("样品列表导出")
@PostMapping("/export") @PostMapping("/export")
public void export(String sampleName, String cementCode, public void export(String sampleName, String cementCode,
String fileName, HttpServletResponse response) { String fileName, HttpServletResponse response) {
try { try {
sampleService.export(sampleName, cementCode, sampleService.export(sampleName, cementCode,
fileName, response); fileName, response);
} catch (Exception e) { } catch (Exception e) {
log.debug("样品列表导出{}", e); log.debug("样品列表导出{}", e);
} }
} }
@ApiOperation(value = "样品详情")
@GetMapping("/{id}")
public BaseResponse getById(@PathVariable Integer id) {
@ApiOperation(value = "样品详情") try {
@GetMapping("/{id}") return sampleService.getDetail(id);
public BaseResponse getById(@PathVariable Integer id){ } catch (Exception e) {
try { log.debug("样品详情{}", e);
return sampleService.getDetail(id); }
}catch (Exception e){ return BaseResponse.errorMsg("失败!");
log.debug("样品详情{}",e); }
}
return BaseResponse.errorMsg("失败!"); @ApiOperation(value = "样品登记")
} @PostMapping("/register")
public BaseResponse register(@RequestBody SampleManageQuery query) {
@ApiOperation(value = "样品登记") try {
@PostMapping("/register") return sampleService.register(query);
public BaseResponse register(@RequestBody SampleManageQuery query) { } catch (Exception e) {
try { log.debug("样品登记{}", e);
return sampleService.register(query); }
}catch (Exception e) { return BaseResponse.errorMsg("失败!");
log.debug("样品登记{}",e); }
}
return BaseResponse.errorMsg("失败!"); @ApiOperation("绑定样品信息")
} @PutMapping("/bind/savePosition")
public BaseResponse<String> bindSavePosition(@RequestBody SampleManageQuery query){
@ApiOperation(value = "样品销毁")
@PostMapping("/destruction/{id}") try {
public BaseResponse destruction(@PathVariable Integer id) { return sampleService.bindSavePosition(query);
try { }catch (Exception e){
return sampleService.destruction(id); log.debug("样品登记{}", e);
}catch (Exception e) { }
log.debug("样品销毁{}",e); return BaseResponse.errorMsg("失败!");
} }
return BaseResponse.errorMsg("失败!");
} @ApiOperation("样品复查")
@PutMapping("/review")
@ApiOperation(value = "获取样品状态列表") public BaseResponse<Boolean> ampleReview(Integer id){
@GetMapping("/getSampleFormList") return sampleService.ampleReview(id);
public BaseResponse getSampleFormList(){ }
try {
return dictionaryService.getContent("样品状态"); @ApiOperation("获取存储位置二维码")
}catch (Exception e){ @PostMapping("/saverq/init")
log.debug("获取样品状态列表{}",e); public void getSaveRQ(String savePosition, HttpServletResponse response) {
}
return BaseResponse.errorMsg("失败!"); if (StrUtil.isBlank(savePosition)) {
} log.error("生成存储位置二维码失败!savePosition参数为空!");
}
BufferedImage bufferedImage = QrCodeUtil.generate(savePosition, 200, 200);
try (ServletOutputStream os = response.getOutputStream()) {
ImageIO.write(bufferedImage, "jpg", os);
os.flush();
} catch (IOException e) {
e.printStackTrace();
}
}
@ApiOperation(value = "样品销毁")
@PostMapping("/destruction/{id}")
public BaseResponse destruction(@PathVariable Integer id) {
try {
return sampleService.destruction(id);
} catch (Exception e) {
log.debug("样品销毁{}", e);
}
return BaseResponse.errorMsg("失败!");
}
@ApiOperation(value = "获取样品状态列表")
@GetMapping("/getSampleFormList")
public BaseResponse getSampleFormList() {
try {
return dictionaryService.getContent("样品状态");
} catch (Exception e) {
log.debug("获取样品状态列表{}", e);
}
return BaseResponse.errorMsg("失败!");
}
} }
...@@ -3,11 +3,9 @@ package cn.wise.sc.cement.business.entity; ...@@ -3,11 +3,9 @@ package cn.wise.sc.cement.business.entity;
import java.math.BigDecimal; import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.io.Serializable; import java.io.Serializable;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
...@@ -98,7 +96,7 @@ public class Sample implements Serializable { ...@@ -98,7 +96,7 @@ public class Sample implements Serializable {
@ApiModelProperty("原样位置") @ApiModelProperty("原样位置")
private String originalPosition; private String originalPosition;
@ApiModelProperty("(0未领用,1已领用,2已销毁)") @ApiModelProperty("(0未领用,1已领用,2已销毁,3复查)")
private Integer status; private Integer status;
@ApiModelProperty("销毁时间") @ApiModelProperty("销毁时间")
...@@ -112,6 +110,4 @@ public class Sample implements Serializable { ...@@ -112,6 +110,4 @@ public class Sample implements Serializable {
@ApiModelProperty("样品是否校核完成(0未检测完成, 1检测完成,)") @ApiModelProperty("样品是否校核完成(0未检测完成, 1检测完成,)")
private Integer isCheck; private Integer isCheck;
} }
package cn.wise.sc.cement.business.model.query; package cn.wise.sc.cement.business.model.query;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.mysql.cj.xdevapi.JsonArray;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Map; import java.util.Map;
/** /**
......
...@@ -31,4 +31,17 @@ public interface ISampleService extends IService<Sample> { ...@@ -31,4 +31,17 @@ public interface ISampleService extends IService<Sample> {
void export(String sampleName, String cementCode, void export(String sampleName, String cementCode,
String fileName, HttpServletResponse response); String fileName, HttpServletResponse response);
/**
* 绑定位置信息
* @param query 小样绑定位置信息
* @return 成功与否
*/
BaseResponse<String> bindSavePosition(SampleManageQuery query);
/**
* 样品复查
* @param id 样品id
* @return 复查成功与否
*/
BaseResponse<Boolean> ampleReview(Integer id);
} }
...@@ -269,8 +269,8 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl ...@@ -269,8 +269,8 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
} }
} }
if(teamNameList.contains("Al2O3")){ if(teamNameList.contains("Al2O3")){
if(!teamNameList.contains("Fe2O3")){ if(!teamNameList.contains("Fe2o3")){
return BaseResponse.errorMsg("选择Al2O3必须要选择Fe2O3"); return BaseResponse.errorMsg("选择Al2O3必须要选择Fe2o3");
} }
} }
} }
......
...@@ -5,12 +5,9 @@ import cn.wise.sc.cement.business.mapper.SysDictionaryMapper; ...@@ -5,12 +5,9 @@ import cn.wise.sc.cement.business.mapper.SysDictionaryMapper;
import cn.wise.sc.cement.business.model.BaseResponse; import cn.wise.sc.cement.business.model.BaseResponse;
import cn.wise.sc.cement.business.service.ISysDictionaryService; import cn.wise.sc.cement.business.service.ISysDictionaryService;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mysql.cj.xdevapi.JsonArray;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
/** /**
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
<dependency> <dependency>
<groupId>com.baomidou</groupId> <groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-generator</artifactId> <artifactId>mybatis-plus-generator</artifactId>
<version>3.3.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>mysql</groupId> <groupId>mysql</groupId>
...@@ -28,7 +27,6 @@ ...@@ -28,7 +27,6 @@
<dependency> <dependency>
<groupId>org.apache.velocity</groupId> <groupId>org.apache.velocity</groupId>
<artifactId>velocity-engine-core</artifactId> <artifactId>velocity-engine-core</artifactId>
<version>2.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.logging.log4j</groupId> <groupId>org.apache.logging.log4j</groupId>
......
...@@ -65,10 +65,55 @@ ...@@ -65,10 +65,55 @@
<artifactId>commons-collections4</artifactId> <artifactId>commons-collections4</artifactId>
<version>4.2</version> <version>4.2</version>
</dependency> </dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>4.6.8</version>
</dependency>
<dependency>
<groupId>net.oschina.zcx7878</groupId>
<artifactId>fastdfs-client-java</artifactId>
<version>1.27.0.0</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.9.0</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>23.0</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.17</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>core</artifactId>
<version>3.3.3</version>
</dependency>
<dependency> <dependency>
<groupId>mysql</groupId> <groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-java</artifactId>
<version>5.1.39</version> <version>8.0.18</version>
</dependency>
<dependency>
<groupId>org.redisson</groupId>
<artifactId>redisson</artifactId>
<version>3.11.1</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-generator</artifactId>
<version>3.3.1</version>
</dependency> </dependency>
<!--日志--> <!--日志-->
<dependency> <dependency>
...@@ -77,6 +122,11 @@ ...@@ -77,6 +122,11 @@
<version>2.10.0</version> <version>2.10.0</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-engine-core</artifactId>
<version>2.0</version>
</dependency>
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId> <artifactId>jul-to-slf4j</artifactId>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment