Commit d4cffa84 authored by renchao's avatar renchao

送验单模块代码编写

parent b5305763
......@@ -2,7 +2,7 @@ package cn.wise.sc.acquisition.business.controller;
import cn.wise.sc.acquisition.business.model.query.TSampleLaboratorysheetQuery;
import cn.wise.sc.acquisition.business.service.impl.TSampleLaboratorysheetServiceImpl;
import cn.wise.sc.acquisition.business.service.ITSampleLaboratorysheetService;
import com.baomidou.mybatisplus.extension.api.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -29,7 +29,7 @@ import javax.servlet.http.HttpServletResponse;
public class TSampleLaboratorysheetController {
@Autowired
private TSampleLaboratorysheetServiceImpl tSampleLaboratorysheetService;
private ITSampleLaboratorysheetService itSampleLaboratorysheetService;
/**
......@@ -41,7 +41,7 @@ public class TSampleLaboratorysheetController {
@ApiOperation(value = "根据样号查看分析结果")
@RequestMapping(value = "/getByYh", method = RequestMethod.GET)
public R getByYh(TSampleLaboratorysheetQuery tSampleLaboratorysheetQuery) {
return tSampleLaboratorysheetService.getByYh(tSampleLaboratorysheetQuery);
return itSampleLaboratorysheetService.getByYh(tSampleLaboratorysheetQuery);
}
......@@ -54,7 +54,7 @@ public class TSampleLaboratorysheetController {
@ApiOperation(value = "根据样号修改分析结果")
@RequestMapping(value = "/updateByYh", method = RequestMethod.POST)
public R updateByYh(@RequestBody TSampleLaboratorysheetQuery tSampleLaboratorysheetQuery) {
return tSampleLaboratorysheetService.updateByYh(tSampleLaboratorysheetQuery);
return itSampleLaboratorysheetService.updateByYh(tSampleLaboratorysheetQuery);
}
......@@ -67,7 +67,7 @@ public class TSampleLaboratorysheetController {
@ApiOperation(value = "根据样号删除分析结果")
@RequestMapping(value = "/deleteByYh", method = RequestMethod.POST)
public R deleteByYh(@RequestBody TSampleLaboratorysheetQuery tSampleLaboratorysheetQuery) {
return tSampleLaboratorysheetService.deleteByYh(tSampleLaboratorysheetQuery);
return itSampleLaboratorysheetService.deleteByYh(tSampleLaboratorysheetQuery);
}
......@@ -80,7 +80,7 @@ public class TSampleLaboratorysheetController {
@ApiOperation(value = "增加分析结果")
@RequestMapping(value = "/insertTSampleLaboratorysheet", method = RequestMethod.POST)
public R insertTSampleLaboratorysheet(@RequestBody TSampleLaboratorysheetQuery tSampleLaboratorysheetQuery) {
return tSampleLaboratorysheetService.insertTSampleLaboratorysheet(tSampleLaboratorysheetQuery);
return itSampleLaboratorysheetService.insertTSampleLaboratorysheet(tSampleLaboratorysheetQuery);
}
/**
......@@ -92,7 +92,7 @@ public class TSampleLaboratorysheetController {
@ApiOperation(value = "二维码下载")
@RequestMapping(value = "/getImage", method = RequestMethod.POST)
public R getImage(TSampleLaboratorysheetQuery tSampleLaboratorysheetQuery,final HttpServletResponse response) {
return tSampleLaboratorysheetService.getImage(tSampleLaboratorysheetQuery,response);
return itSampleLaboratorysheetService.getImage(tSampleLaboratorysheetQuery,response);
}
}
......@@ -2,7 +2,7 @@ package cn.wise.sc.acquisition.business.controller;
import cn.wise.sc.acquisition.business.model.query.TSampleListQuery;
import cn.wise.sc.acquisition.business.service.impl.TSampleListServiceImpl;
import cn.wise.sc.acquisition.business.service.ITSampleListService;
import cn.wise.sc.acquisition.business.wrapper.page.Query;
import com.baomidou.mybatisplus.extension.api.R;
import io.swagger.annotations.Api;
......@@ -28,7 +28,7 @@ import javax.servlet.http.HttpServletResponse;
public class TSampleListController {
@Autowired
private TSampleListServiceImpl tSampleListService;
private ITSampleListService itSampleListService;
/**
* 根据条件查询送验单 分页
......@@ -39,7 +39,7 @@ public class TSampleListController {
@ApiOperation(value = "获取送验单列表 可分页模糊查询")
@RequestMapping(value = "/getPage", method = RequestMethod.GET)
public R getPage(TSampleListQuery tSampleListQuery, Query query) {
return tSampleListService.getPage(tSampleListQuery,query);
return itSampleListService.getPage(tSampleListQuery,query);
}
......@@ -52,7 +52,7 @@ public class TSampleListController {
@ApiOperation(value = "根据样号修改送验单")
@RequestMapping(value = "/updateByYh", method = RequestMethod.POST)
public R updateByYh(@RequestBody TSampleListQuery tSampleListQuery) {
return tSampleListService.updateByYh(tSampleListQuery);
return itSampleListService.updateByYh(tSampleListQuery);
}
/**
......@@ -64,7 +64,7 @@ public class TSampleListController {
@ApiOperation(value = "增加送验单")
@RequestMapping(value = "/insertSampleList", method = RequestMethod.POST)
public R insertSampleList(@RequestBody TSampleListQuery tSampleListQuery ) {
return tSampleListService.insertSampleList(tSampleListQuery);
return itSampleListService.insertSampleList(tSampleListQuery);
}
......@@ -77,7 +77,7 @@ public class TSampleListController {
@ApiOperation(value = "根据样号删除送验单")
@RequestMapping(value = "/deleteByYh", method = RequestMethod.POST)
public R deleteByYh(@RequestBody TSampleListQuery tSampleListQuery) {
return tSampleListService.deleteByYh(tSampleListQuery);
return itSampleListService.deleteByYh(tSampleListQuery);
}
......@@ -89,7 +89,7 @@ public class TSampleListController {
@ApiOperation(value = "保存图片")
@RequestMapping(value = "/saveImage", method = RequestMethod.POST)
public R saveImage( TSampleListQuery query,@RequestParam(value = "file", required = true) MultipartFile file){
return tSampleListService.saveImage(query,file);
return itSampleListService.saveImage(query,file);
}
/**
......@@ -100,7 +100,7 @@ public class TSampleListController {
@ApiOperation(value = "下载图片")
@RequestMapping(value="/getImage",method=RequestMethod.GET)
public R getImage(TSampleListQuery query,final HttpServletResponse response){
return tSampleListService.getImage(query,response);
return itSampleListService.getImage(query,response);
}
}
......
......@@ -7,6 +7,7 @@ import cn.wise.sc.acquisition.business.mapper.TSampleLaboratorysheetMapper;
import cn.wise.sc.acquisition.business.model.query.TSampleLaboratorysheetQuery;
import cn.wise.sc.acquisition.business.model.query.TSampleListQuery;
import cn.wise.sc.acquisition.business.service.ITSampleLaboratorysheetService;
import cn.wise.sc.acquisition.business.service.ITSampleListService;
import cn.wise.sc.acquisition.business.util.ImageUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.extension.api.R;
......@@ -32,26 +33,33 @@ import javax.servlet.http.HttpServletResponse;
public class TSampleLaboratorysheetServiceImpl extends ServiceImpl<TSampleLaboratorysheetMapper, TSampleLaboratorysheet> implements ITSampleLaboratorysheetService {
@Autowired
private TSampleListServiceImpl tSampleListService;
private ITSampleListService tSampleListService;
@Override
public R getByYh(TSampleLaboratorysheetQuery tSampleLaboratorysheetQuery) {
log.info(JSON.toJSONString(tSampleLaboratorysheetQuery));
public R getByYh(TSampleLaboratorysheetQuery query) {
log.info(JSON.toJSONString(query));
//参数校验
Rcode.NOT_PARAM.assertNotEmpty(tSampleLaboratorysheetQuery.getYh());
TSampleLaboratorysheet tSampleLaboratorysheet = baseMapper.selectById(tSampleLaboratorysheetQuery.getYh());
Rcode.NOT_PARAM.assertNotNull(query);
Rcode.NOT_PARAM.assertNotEmpty(query.getYh());
TSampleLaboratorysheet tSampleLaboratorysheet = baseMapper.selectById(query.getYh());
return R.ok(tSampleLaboratorysheet);
}
@Override
public R updateByYh(TSampleLaboratorysheetQuery tSampleLaboratorysheetQuery) {
log.info(JSON.toJSONString(tSampleLaboratorysheetQuery));
public R updateByYh(TSampleLaboratorysheetQuery query) {
log.info(JSON.toJSONString(query));
//参数校验
Rcode.NOT_PARAM.assertNotEmpty(tSampleLaboratorysheetQuery.getYh());
Rcode.NOT_PARAM.assertNotNull(query);
Rcode.NOT_PARAM.assertNotEmpty(query.getYh());
//查询数据
TSampleLaboratorysheet tSampleLaboratorysheet = baseMapper.selectById(query.getYh());
if (tSampleLaboratorysheet == null) {
return R.failed("数据不存在,样号:" + query.getYh());
}
//封装
TSampleLaboratorysheet tSampleLaboratorysheet = new TSampleLaboratorysheet();
BeanUtils.copyProperties(tSampleLaboratorysheetQuery, tSampleLaboratorysheet);
tSampleLaboratorysheet = new TSampleLaboratorysheet();
BeanUtils.copyProperties(query, tSampleLaboratorysheet);
int update = baseMapper.updateById(tSampleLaboratorysheet);
if (update > 0) {
return R.ok("修改成功");
......@@ -62,12 +70,18 @@ public class TSampleLaboratorysheetServiceImpl extends ServiceImpl<TSampleLabora
}
@Override
public R deleteByYh(TSampleLaboratorysheetQuery tSampleLaboratorysheetQuery) {
log.info(JSON.toJSONString(tSampleLaboratorysheetQuery));
public R deleteByYh(TSampleLaboratorysheetQuery query) {
log.info(JSON.toJSONString(query));
//参数校验
Rcode.NOT_PARAM.assertNotEmpty(tSampleLaboratorysheetQuery.getYh());
Rcode.NOT_PARAM.assertNotNull(query);
Rcode.NOT_PARAM.assertNotEmpty(query.getYh());
//查询数据
TSampleLaboratorysheet tSampleLaboratorysheet = baseMapper.selectById(query.getYh());
if (tSampleLaboratorysheet == null) {
return R.failed("数据不存在,样号:" + query.getYh());
}
//删除
int delete = baseMapper.deleteById(tSampleLaboratorysheetQuery.getYh());
int delete = baseMapper.deleteById(query.getYh());
if (delete > 0) {
return R.ok("修改成功");
} else {
......@@ -76,42 +90,43 @@ public class TSampleLaboratorysheetServiceImpl extends ServiceImpl<TSampleLabora
}
@Override
public R insertTSampleLaboratorysheet(TSampleLaboratorysheetQuery tSampleLaboratorysheetQuery) {
log.info(JSON.toJSONString(tSampleLaboratorysheetQuery));
public R insertTSampleLaboratorysheet(TSampleLaboratorysheetQuery query) {
log.info(JSON.toJSONString(query));
//参数校验
Rcode.NOT_PARAM.assertNotEmpty(tSampleLaboratorysheetQuery.getYh());
Rcode.NOT_PARAM.assertNotNull(query);
Rcode.NOT_PARAM.assertNotEmpty(query.getYh());
//判断是否存在送样号
R temp = tSampleListService.getByYh(new TSampleListQuery(tSampleLaboratorysheetQuery.getYh()));
R temp = tSampleListService.getByYh(new TSampleListQuery(query.getYh()));
if (temp.getData() == null) {
return R.failed("送验单不存在,样号:" + tSampleLaboratorysheetQuery.getYh());
return R.failed("送验单不存在,样号:" + query.getYh());
}
//判断是否已经存在分析结果单
R temp1 = getByYh(tSampleLaboratorysheetQuery);
R temp1 = getByYh(query);
if (temp1.getData() != null) {
return R.failed("分析结果样号已存在,样号:" + tSampleLaboratorysheetQuery.getYh());
return R.failed("分析结果样号已存在,样号:" + query.getYh());
}
//继续判断参数
Rcode.NOT_PARAM.assertNotEmpty(tSampleLaboratorysheetQuery.getLaboratoryID());
Rcode.NOT_PARAM.assertNotNull(tSampleLaboratorysheetQuery.getSysj());
Rcode.NOT_PARAM.assertNotNull(tSampleLaboratorysheetQuery.getHysj());
Rcode.NOT_PARAM.assertNotEmpty(tSampleLaboratorysheetQuery.getHyr());
Rcode.NOT_PARAM.assertNotEmpty(tSampleLaboratorysheetQuery.getFpcfwz());
Rcode.NOT_PARAM.assertNotNull(tSampleLaboratorysheetQuery.getCao());
Rcode.NOT_PARAM.assertNotNull(tSampleLaboratorysheetQuery.getMgO());
Rcode.NOT_PARAM.assertNotNull(tSampleLaboratorysheetQuery.getSiO2());
Rcode.NOT_PARAM.assertNotNull(tSampleLaboratorysheetQuery.getAl2O3());
Rcode.NOT_PARAM.assertNotNull(tSampleLaboratorysheetQuery.getFe2O3());
Rcode.NOT_PARAM.assertNotNull(tSampleLaboratorysheetQuery.getK2o());
Rcode.NOT_PARAM.assertNotNull(tSampleLaboratorysheetQuery.getNa2O());
Rcode.NOT_PARAM.assertNotNull(tSampleLaboratorysheetQuery.getSo3());
Rcode.NOT_PARAM.assertNotNull(tSampleLaboratorysheetQuery.getCl());
Rcode.NOT_PARAM.assertNotNull(tSampleLaboratorysheetQuery.getSsl());
Rcode.NOT_PARAM.assertNotEmpty(query.getLaboratoryID());
Rcode.NOT_PARAM.assertNotNull(query.getSysj());
Rcode.NOT_PARAM.assertNotNull(query.getHysj());
Rcode.NOT_PARAM.assertNotEmpty(query.getHyr());
Rcode.NOT_PARAM.assertNotEmpty(query.getFpcfwz());
Rcode.NOT_PARAM.assertNotNull(query.getCao());
Rcode.NOT_PARAM.assertNotNull(query.getMgO());
Rcode.NOT_PARAM.assertNotNull(query.getSiO2());
Rcode.NOT_PARAM.assertNotNull(query.getAl2O3());
Rcode.NOT_PARAM.assertNotNull(query.getFe2O3());
Rcode.NOT_PARAM.assertNotNull(query.getK2o());
Rcode.NOT_PARAM.assertNotNull(query.getNa2O());
Rcode.NOT_PARAM.assertNotNull(query.getSo3());
Rcode.NOT_PARAM.assertNotNull(query.getCl());
Rcode.NOT_PARAM.assertNotNull(query.getSsl());
//封装
TSampleLaboratorysheet tSampleLaboratorysheet = new TSampleLaboratorysheet();
BeanUtils.copyProperties(tSampleLaboratorysheetQuery, tSampleLaboratorysheet);
BeanUtils.copyProperties(query, tSampleLaboratorysheet);
//生成二维码 并且保存
tSampleLaboratorysheet.setQRCode(ImageUtil.QRCodeGenerator(JSON.toJSONString(tSampleLaboratorysheet)));
//tSampleLaboratorysheet.setQRCode(ImageUtil.QRCodeGenerator(JSON.toJSONString(tSampleLaboratorysheet)));
//保存
int insert = baseMapper.insert(tSampleLaboratorysheet);
if (insert > 0) {
......@@ -136,8 +151,15 @@ public class TSampleLaboratorysheetServiceImpl extends ServiceImpl<TSampleLabora
//参加校验
Rcode.NOT_PARAM.assertNotNull(query);
Rcode.NOT_PARAM.assertNotEmpty(query.getYh());
//查询
TSampleLaboratorysheet tSampleLaboratorysheet = baseMapper.selectById(query.getYh());
if (tSampleLaboratorysheet == null) {
return R.failed("数据不存在,样号:" + query.getYh());
}
//获取二维码或者记录形式
//先生成二维码并且放到实体中
tSampleLaboratorysheet.setQRCode(ImageUtil.QRCodeGenerator(JSON.toJSONString(tSampleLaboratorysheet)));
//下载图片
ImageUtil.getImage(ProjectEnum.ImageType.QR_CODE.getValue(), tSampleLaboratorysheet, response);
//如果下载失败才会执行return
return R.failed("该条数据没有图片");
......
......@@ -62,6 +62,7 @@ public class TSampleListServiceImpl extends ServiceImpl<TSampleListMapper, TSamp
public R getByYh(TSampleListQuery query) {
log.info(JSON.toJSONString(query));
//参数校验
Rcode.NOT_PARAM.assertNotNull(query);
Rcode.NOT_PARAM.assertNotEmpty(query.getYh());
//查询并且返回
return R.ok(baseMapper.selectById(query.getYh()));
......@@ -73,6 +74,7 @@ public class TSampleListServiceImpl extends ServiceImpl<TSampleListMapper, TSamp
public R updateByYh(TSampleListQuery query) {
log.info(JSON.toJSONString(query));
//参数校验
Rcode.NOT_PARAM.assertNotNull(query);
Rcode.NOT_PARAM.assertNotEmpty(query.getYh());
//条件封装
TSampleList tSampleList = new TSampleList();
......@@ -97,6 +99,7 @@ public class TSampleListServiceImpl extends ServiceImpl<TSampleListMapper, TSamp
public R insertSampleList(TSampleListQuery query) {
log.info(JSON.toJSONString(query));
//参数校验
Rcode.NOT_PARAM.assertNotNull(query);
Rcode.NOT_PARAM.assertNotEmpty(query.getYh());
//判断数据是否已存在,如果存在不能添加
R r = getByYh(query);
......@@ -133,12 +136,13 @@ public class TSampleListServiceImpl extends ServiceImpl<TSampleListMapper, TSamp
@Override
@Transactional
public R deleteByYh(TSampleListQuery tSampleListQuery) {
log.info(JSON.toJSONString(tSampleListQuery));
public R deleteByYh(TSampleListQuery query) {
log.info(JSON.toJSONString(query));
//参数校验
Rcode.NOT_PARAM.assertNotEmpty(tSampleListQuery.getYh());
Rcode.NOT_PARAM.assertNotNull(query);
Rcode.NOT_PARAM.assertNotEmpty(query.getYh());
//删除
int delete = baseMapper.delete(new QueryWrapper<TSampleList>().eq(ProjectEnum.TSampleListType.YH.getLabel(), tSampleListQuery.getYh()));
int delete = baseMapper.delete(new QueryWrapper<TSampleList>().eq(ProjectEnum.TSampleListType.YH.getLabel(), query.getYh()));
if (delete > 0) {
return R.ok("删除成功");
} else {
......@@ -154,8 +158,9 @@ public class TSampleListServiceImpl extends ServiceImpl<TSampleListMapper, TSamp
//参加校验
Rcode.NOT_PARAM.assertNotNull(query);
Rcode.NOT_PARAM.assertNotEmpty(query.getYh());
Rcode.NOT_PARAM.assertNotNull(file);
Rcode.NOT_PARAM.assertNotNull(query.getImageType());
Rcode.NOT_PARAM.assertNotNull(file);
//封装
TSampleList tSampleList = new TSampleList();
BeanUtils.copyProperties(query, tSampleList);
......
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