Commit 82cec665 authored by renchao's avatar renchao

生产工序业务修改

parent 0212e23f
...@@ -93,24 +93,24 @@ public class TSampleListController { ...@@ -93,24 +93,24 @@ public class TSampleListController {
* *
* @return * @return
*/ */
@ApiOperation(value = "保存图片") // @ApiOperation(value = "保存图片")
@RequestMapping(value = "/saveImage", method = RequestMethod.POST) // @RequestMapping(value = "/saveImage", method = RequestMethod.POST)
public R saveImage(TSampleListQuery query, @RequestParam(value = "file", required = true) MultipartFile file) { // public R saveImage(TSampleListQuery query, @RequestParam(value = "file", required = true) MultipartFile file) {
return itSampleListService.saveImage(query, file); // return itSampleListService.saveImage(query, file);
} // }
/** /**
* 下载图片 * 下载图片
* *
* @return * @return
*/ */
@ApiOperation(value = "下载图片") // @ApiOperation(value = "下载图片")
@GetMapping(value = "/getImage/{yh}" ) // @GetMapping(value = "/getImage/{yh}" )
public R getImage(@PathVariable @NotBlank String yh, final HttpServletResponse response) { // public R getImage(@PathVariable @NotBlank String yh, final HttpServletResponse response) {
TSampleListQuery param = new TSampleListQuery(); // TSampleListQuery param = new TSampleListQuery();
param.setYh(yh); // param.setYh(yh);
return itSampleListService.getImage(param, response); // return itSampleListService.getImage(param, response);
} // }
} }
...@@ -108,8 +108,8 @@ public class TProcessesAuxiliary implements Serializable { ...@@ -108,8 +108,8 @@ public class TProcessesAuxiliary implements Serializable {
/** /**
* 司机 * 司机
*/ */
// @TableField("Driver") @TableField("Driver")
// private String Driver; private String Driver;
/** /**
* 作业日期 * 作业日期
......
...@@ -96,14 +96,14 @@ public class TSampleList implements Serializable { ...@@ -96,14 +96,14 @@ public class TSampleList implements Serializable {
/** /**
* 记录对象 * 记录对象
*/ */
@TableField("RecordName") // @TableField("RecordName")
private String RecordName; // private String RecordName;
/** /**
* 记录形式 因为是字节,很长,不查询这个字段 * 记录形式 因为是字节,很长,不查询这个字段
*/ */
@TableField("RecordCode") // @TableField("RecordCode")
private byte[] RecordCode; // private byte[] RecordCode;
/** /**
* 化验室是否已接收,0未接收,1已接收 * 化验室是否已接收,0未接收,1已接收
......
...@@ -102,8 +102,8 @@ public class TProcessesAuxiliaryQuery { ...@@ -102,8 +102,8 @@ public class TProcessesAuxiliaryQuery {
/** /**
* 司机 * 司机
*/ */
// @ApiModelProperty("Driver") @ApiModelProperty("Driver")
// private String Driver; private String Driver;
/** /**
* 作业日期 * 作业日期
*/ */
......
...@@ -95,14 +95,14 @@ public class TSampleListQuery { ...@@ -95,14 +95,14 @@ public class TSampleListQuery {
/** /**
* 记录对象 * 记录对象
*/ */
@ApiModelProperty("记录对象") // @ApiModelProperty("记录对象")
private String RecordName; // private String RecordName;
/** /**
* 记录形式 * 记录形式
*/ */
@ApiModelProperty("记录形式") // @ApiModelProperty("记录形式")
private byte[] RecordCode; // private byte[] RecordCode;
public TSampleListQuery(){} public TSampleListQuery(){}
......
...@@ -98,8 +98,8 @@ public class TProcessesAuxiliaryVo { ...@@ -98,8 +98,8 @@ public class TProcessesAuxiliaryVo {
/** /**
* 司机 * 司机
*/ */
// @ApiModelProperty("Driver") @ApiModelProperty("Driver")
// private String Driver; private String Driver;
/** /**
* 作业日期 * 作业日期
......
...@@ -87,7 +87,7 @@ public class TProcessesAuxiliaryServiceImpl extends ServiceImpl<TProcessesAuxili ...@@ -87,7 +87,7 @@ public class TProcessesAuxiliaryServiceImpl extends ServiceImpl<TProcessesAuxili
if (update > 0) { if (update > 0) {
return R.ok("辅助工序中->修改成功"); return R.ok("辅助工序中->修改成功");
} else { } else {
log.error("辅助工序中->修改失败:{}",JSON.toJSONString(tSampleList)); log.error("辅助工序中->修改失败:{}", JSON.toJSONString(tSampleList));
return R.failed("辅助工序中->修改失败"); return R.failed("辅助工序中->修改失败");
} }
...@@ -98,6 +98,9 @@ public class TProcessesAuxiliaryServiceImpl extends ServiceImpl<TProcessesAuxili ...@@ -98,6 +98,9 @@ public class TProcessesAuxiliaryServiceImpl extends ServiceImpl<TProcessesAuxili
log.info(JSON.toJSONString(query)); log.info(JSON.toJSONString(query));
//参数校验 //参数校验
Rcode.NOT_PARAM.assertNotNull(query); Rcode.NOT_PARAM.assertNotNull(query);
Rcode.NOT_PARAM.assertNotNull(query.getLjyl());
Rcode.NOT_PARAM.assertNotNull(query.getZj());
Rcode.NOT_PARAM.assertNotNull(query.getDyljcl());
//uid自动生成 不能手动设置 //uid自动生成 不能手动设置
if (query.getUid() != null) { if (query.getUid() != null) {
return R.failed("辅助工序中->uid自动生成 不能手动设置"); return R.failed("辅助工序中->uid自动生成 不能手动设置");
...@@ -106,6 +109,14 @@ public class TProcessesAuxiliaryServiceImpl extends ServiceImpl<TProcessesAuxili ...@@ -106,6 +109,14 @@ public class TProcessesAuxiliaryServiceImpl extends ServiceImpl<TProcessesAuxili
if (StringUtils.isNotBlank(query.getTag())) { if (StringUtils.isNotBlank(query.getTag())) {
return R.failed("辅助工序中->tag为自动生成字段,不能添加"); return R.failed("辅助工序中->tag为自动生成字段,不能添加");
} }
//单耗为自动计算
if (query.getDh() != null) {
return R.failed("辅助工序中->dh为自动计算字段,不能添加");
}
//当月累计油量不为0时,当月累计产量不能为0
if (query.getLjyl() != 0 && query.getDyljcl() == 0) {
return R.failed("辅助工序中->当月累计油量Ljyl 不为0时,当月累计产量Dyljcl不能为0,分母不能为0");
}
//条件封装 //条件封装
TProcessesAuxiliary tProcessesAuxiliary = new TProcessesAuxiliary(); TProcessesAuxiliary tProcessesAuxiliary = new TProcessesAuxiliary();
BeanUtils.copyProperties(query, tProcessesAuxiliary); BeanUtils.copyProperties(query, tProcessesAuxiliary);
...@@ -115,13 +126,21 @@ public class TProcessesAuxiliaryServiceImpl extends ServiceImpl<TProcessesAuxili ...@@ -115,13 +126,21 @@ public class TProcessesAuxiliaryServiceImpl extends ServiceImpl<TProcessesAuxili
return R.failed(r1.getMsg()); return R.failed(r1.getMsg());
} }
tProcessesAuxiliary.setTag((String) r1.getData()); tProcessesAuxiliary.setTag((String) r1.getData());
//设置单耗
if (query.getLjyl() == 0) {
tProcessesAuxiliary.setDh(0D);
} else {
//强转失去精度,借助字符串
float dh = query.getLjyl() / query.getDyljcl();
tProcessesAuxiliary.setDh(Double.valueOf(String.valueOf(dh)));
}
//增加 //增加
log.info(JSON.toJSONString(tProcessesAuxiliary)); log.info(JSON.toJSONString(tProcessesAuxiliary));
int insert = baseMapper.insert(tProcessesAuxiliary); int insert = baseMapper.insert(tProcessesAuxiliary);
if (insert > 0) { if (insert > 0) {
return R.ok("辅助工序中->增加成功"); return R.ok("辅助工序中->增加成功");
} else { } else {
log.error("辅助工序中->增加失败: {}",JSON.toJSONString(tProcessesAuxiliary)); log.error("辅助工序中->增加失败: {}", JSON.toJSONString(tProcessesAuxiliary));
return R.failed("辅助工序中->增加失败"); return R.failed("辅助工序中->增加失败");
} }
} }
......
...@@ -315,7 +315,7 @@ public class TProcessesBlastdesignHoleServiceImpl extends ServiceImpl<TProcesses ...@@ -315,7 +315,7 @@ public class TProcessesBlastdesignHoleServiceImpl extends ServiceImpl<TProcesses
} }
return R.ok("炮孔设计中->增加成功"); return R.ok("炮孔设计中->增加成功");
} else { } else {
log.info(JSON.toJSONString(tProcessesBlastdesignHole)); log.error(JSON.toJSONString(tProcessesBlastdesignHole));
return R.failed("炮孔设计中->增加失败"); return R.failed("炮孔设计中->增加失败");
} }
} }
......
...@@ -25,6 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -25,6 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Stack;
/** /**
* <p> * <p>
...@@ -306,4 +307,5 @@ public class TProcessesDrillingServiceImpl extends ServiceImpl<TProcessesDrillin ...@@ -306,4 +307,5 @@ public class TProcessesDrillingServiceImpl extends ServiceImpl<TProcessesDrillin
private Double calculateHoleBlastVolume(Double HoleSpace, Double RowSpace, Double StepHeight) { private Double calculateHoleBlastVolume(Double HoleSpace, Double RowSpace, Double StepHeight) {
return HoleSpace * RowSpace * StepHeight; return HoleSpace * RowSpace * StepHeight;
} }
} }
...@@ -49,7 +49,6 @@ public class TSampleListServiceImpl extends ServiceImpl<TSampleListMapper, TSamp ...@@ -49,7 +49,6 @@ public class TSampleListServiceImpl extends ServiceImpl<TSampleListMapper, TSamp
ProjectEnum.TSampleListType.START.getLabel(), ProjectEnum.TSampleListType.START.getLabel(),
ProjectEnum.TSampleListType.END_TO.getLabel(), ProjectEnum.TSampleListType.END_TO.getLabel(),
ProjectEnum.TSampleListType.YH.getLabel(), ProjectEnum.TSampleListType.YH.getLabel(),
ProjectEnum.TSampleListType.RECORD_NAME.getLabel(),
ProjectEnum.TSampleListType.SYR.getLabel(), ProjectEnum.TSampleListType.SYR.getLabel(),
ProjectEnum.TSampleListType.SYRQ.getLabel() ProjectEnum.TSampleListType.SYRQ.getLabel()
); );
...@@ -121,7 +120,7 @@ public class TSampleListServiceImpl extends ServiceImpl<TSampleListMapper, TSamp ...@@ -121,7 +120,7 @@ public class TSampleListServiceImpl extends ServiceImpl<TSampleListMapper, TSamp
Rcode.NOT_PARAM.assertNotEmpty(query.getHolesID()); Rcode.NOT_PARAM.assertNotEmpty(query.getHolesID());
Rcode.NOT_PARAM.assertNotEmpty(query.getStart()); Rcode.NOT_PARAM.assertNotEmpty(query.getStart());
Rcode.NOT_PARAM.assertNotEmpty(query.getEndTo()); Rcode.NOT_PARAM.assertNotEmpty(query.getEndTo());
Rcode.NOT_PARAM.assertNotEmpty(query.getRecordName()); //Rcode.NOT_PARAM.assertNotEmpty(query.getRecordName());
Rcode.NOT_PARAM.assertNotEmpty(query.getBz()); Rcode.NOT_PARAM.assertNotEmpty(query.getBz());
Rcode.NOT_PARAM.assertNotEmpty(query.getSyr()); Rcode.NOT_PARAM.assertNotEmpty(query.getSyr());
//条件封装 //条件封装
......
...@@ -97,8 +97,10 @@ public class ImageUtil { ...@@ -97,8 +97,10 @@ public class ImageUtil {
* 将字节转化为文件,并下载 * 将字节转化为文件,并下载
*/ */
public static void transformImageMore(byte[] data, final HttpServletResponse response) { public static void transformImageMore(byte[] data, final HttpServletResponse response) {
if (data == null || data.length == 0) throw new RuntimeException("transformImageMore method:byte[] data is null"); if (data == null || data.length == 0)
if (response == null) throw new RuntimeException("transformImageMore method:HttpServletResponse response is null"); throw new RuntimeException("transformImageMore method:byte[] data is null");
if (response == null)
throw new RuntimeException("transformImageMore method:HttpServletResponse response is null");
response.setContentType("image/jpeg"); response.setContentType("image/jpeg");
response.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8");
OutputStream outputSream = null; OutputStream outputSream = null;
...@@ -123,22 +125,24 @@ public class ImageUtil { ...@@ -123,22 +125,24 @@ public class ImageUtil {
* 根据obj类型获取图片 * 根据obj类型获取图片
*/ */
public static void getImage(Integer imageType, Object obj, final HttpServletResponse response) { public static void getImage(Integer imageType, Object obj, final HttpServletResponse response) {
if (imageType == null || imageType.intValue() == 0) throw new RuntimeException("getImage method:imageType is null"); if (imageType == null || imageType.intValue() == 0)
throw new RuntimeException("getImage method:imageType is null");
if (obj == null) throw new RuntimeException("getImage method:Object obj is null"); if (obj == null) throw new RuntimeException("getImage method:Object obj is null");
if (response == null) throw new RuntimeException("getImage method:HttpServletResponse response is null"); if (response == null) throw new RuntimeException("getImage method:HttpServletResponse response is null");
byte[] data = null; byte[] data = null;
if (obj instanceof TSampleList) { // if (obj instanceof TSampleList) {
TSampleList tSampleList = (TSampleList) obj; // TSampleList tSampleList = (TSampleList) obj;
//判断获取二维码还是记录形式 // //判断获取二维码还是记录形式
if (ProjectEnum.ImageType.getLabel(imageType).equals(ProjectEnum.ImageType.RECORD_CODE.getLabel())) { // if (ProjectEnum.ImageType.getLabel(imageType).equals(ProjectEnum.ImageType.RECORD_CODE.getLabel())) {
data = tSampleList.getRecordCode(); // data = tSampleList.getRecordCode();
} // }
if (ProjectEnum.ImageType.getLabel(imageType).equals(ProjectEnum.ImageType.QR_CODE.getLabel())) { // if (ProjectEnum.ImageType.getLabel(imageType).equals(ProjectEnum.ImageType.QR_CODE.getLabel())) {
data = tSampleList.getQRCode(); // data = tSampleList.getQRCode();
} // }
//
} else if (obj instanceof TSampleLaboratorysheet) { // } else
if (obj instanceof TSampleLaboratorysheet) {
TSampleLaboratorysheet tSampleLaboratorysheet = (TSampleLaboratorysheet) obj; TSampleLaboratorysheet tSampleLaboratorysheet = (TSampleLaboratorysheet) obj;
data = tSampleLaboratorysheet.getQRCode(); data = tSampleLaboratorysheet.getQRCode();
} }
...@@ -153,20 +157,22 @@ public class ImageUtil { ...@@ -153,20 +157,22 @@ public class ImageUtil {
* 根据类型保存并转化文件为图片 需要请求参数ImageType 保存的实体TSampleList 以及file * 根据类型保存并转化文件为图片 需要请求参数ImageType 保存的实体TSampleList 以及file
*/ */
public static void setImage(Integer imageType, Object obj, MultipartFile file) { public static void setImage(Integer imageType, Object obj, MultipartFile file) {
if (imageType == null || imageType.intValue() == 0) throw new RuntimeException("getImage method:imageType is null"); if (imageType == null || imageType.intValue() == 0)
throw new RuntimeException("getImage method:imageType is null");
if (obj == null) throw new RuntimeException("getImage method:Object obj is null"); if (obj == null) throw new RuntimeException("getImage method:Object obj is null");
if (file == null) throw new RuntimeException("getImage method:MultipartFile file is null"); if (file == null) throw new RuntimeException("getImage method:MultipartFile file is null");
if (obj instanceof TSampleList) { // if (obj instanceof TSampleList) {
TSampleList tSampleList = (TSampleList) obj; // TSampleList tSampleList = (TSampleList) obj;
//判断保存二维码还是记录形式 // //判断保存二维码还是记录形式
if (ProjectEnum.ImageType.getLabel(imageType).equals(ProjectEnum.ImageType.RECORD_CODE.getLabel())) { // if (ProjectEnum.ImageType.getLabel(imageType).equals(ProjectEnum.ImageType.RECORD_CODE.getLabel())) {
tSampleList.setRecordCode(transformByte(file)); // tSampleList.setRecordCode(transformByte(file));
} // }
if (ProjectEnum.ImageType.getLabel(imageType).equals(ProjectEnum.ImageType.QR_CODE.getLabel())) { // if (ProjectEnum.ImageType.getLabel(imageType).equals(ProjectEnum.ImageType.QR_CODE.getLabel())) {
tSampleList.setQRCode(transformByte(file)); // tSampleList.setQRCode(transformByte(file));
} // }
} else if (obj instanceof TSampleLaboratorysheet) { // } else
if (obj instanceof TSampleLaboratorysheet) {
TSampleLaboratorysheet tSampleLaboratorysheet = (TSampleLaboratorysheet) obj; TSampleLaboratorysheet tSampleLaboratorysheet = (TSampleLaboratorysheet) obj;
tSampleLaboratorysheet.setQRCode(transformByte(file)); tSampleLaboratorysheet.setQRCode(transformByte(file));
} }
...@@ -193,16 +199,12 @@ public class ImageUtil { ...@@ -193,16 +199,12 @@ public class ImageUtil {
} }
/** /**
* 判断图片大小 * 判断图片大小
* *
* @param len * @param len 文件长度
* 文件长度 * @param size 限制大小
* @param size * @param unit 限制单位(B,K,M,G)
* 限制大小
* @param unit
* 限制单位(B,K,M,G)
* @return * @return
*/ */
public static boolean checkFileSize(Long len, int size, String unit) { public static boolean checkFileSize(Long len, int size, String unit) {
...@@ -224,13 +226,5 @@ public class ImageUtil { ...@@ -224,13 +226,5 @@ public class ImageUtil {
} }
} }
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