Commit 82cec665 authored by renchao's avatar renchao

生产工序业务修改

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