Commit fa270b41 by wangweidong

土工平台修改

parent 2e72f7d9
......@@ -77,7 +77,59 @@ public class ApachePoiLineChart4 {
} finally {
}
}
public static void productZhexianAstm(XSSFSheet sheet, DrawXlsxUtil.AnchorPosition anchorPosition) {
try {
//创建一个画布
XSSFDrawing drawing = sheet.createDrawingPatriarch();
//前四个默认0,[0,5]:从0列5行开始;[7,26]:宽度7个单元格,26向下扩展到26行
//默认宽度(14-8)*12
XSSFClientAnchor anchor = drawing.createAnchor(0, 0, 0, 0, anchorPosition.getCol1Index(),
anchorPosition.getRow1Index(), anchorPosition.getCol2Index(), anchorPosition.getRow2Index());
//创建一个chart对象
XSSFChart chart = drawing.createChart(anchor);
//标题
chart.setTitleText(anchorPosition.getyTitle());
//标题覆盖
chart.setTitleOverlay(false);
//图例位置
XDDFChartLegend legend = chart.getOrAddLegend();
legend.setPosition(LegendPosition.TOP);
//分类轴标(X轴),标题位置
XDDFCategoryAxis bottomAxis = chart.createCategoryAxis(AxisPosition.BOTTOM);
bottomAxis.setTitle(anchorPosition.getxTitle());
//值(Y轴)轴,标题位置
XDDFValueAxis leftAxis = chart.createValueAxis(AxisPosition.LEFT);
leftAxis.setTitle(anchorPosition.getyTitle());
XDDFDataSource<String> countries = XDDFDataSourcesFactory.fromStringCellRange(sheet, new CellRangeAddress(2, 20, 18, 18));
XDDFNumericalDataSource<Double> area = XDDFDataSourcesFactory.fromNumericCellRange(sheet, new CellRangeAddress(2, 20, 19, 19));
//LINE:折线图,
XDDFLineChartData data = (XDDFLineChartData) chart.createData(ChartTypes.LINE, bottomAxis, leftAxis);
//图表加载数据,折线1
XDDFLineChartData.Series series1 = (XDDFLineChartData.Series) data.addSeries(countries, area);
//折线图例标题
series1.setTitle("面积", null);
//直线
series1.setSmooth(false);
//设置标记大小
series1.setMarkerSize((short) 6);
//设置标记样式,星星
series1.setMarkerStyle(MarkerStyle.CIRCLE);
//绘制
chart.plot(data);
// 将输出写入excel文件
} catch (Exception e) {
e.printStackTrace();
} finally {
}
}
}
\ No newline at end of file
......@@ -7,10 +7,7 @@ package com.patzn.cloud.service.lims.rcp;
*/
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.*;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioServerSocketChannel;
......@@ -34,10 +31,8 @@ public class NettyServer {
.childHandler(new ChannelInitializer<SocketChannel>() { // 绑定客户端连接时候触发操作
@Override
protected void initChannel(SocketChannel sh) throws Exception {
sh.pipeline()
.addLast(new RpcDecoder(RpcRequest.class)) //解码request
.addLast(new RpcEncoder(RpcResponse.class)) //编码response
.addLast(new ServerHandler()); //使用ServerHandler类来处理接收到的消息
ChannelPipeline pipeline = sh.pipeline();
pipeline.addLast(new ServerHandler());
}
});
//绑定监听端口,调用sync同步阻塞方法等待绑定操作完
......
package com.patzn.cloud.service.lims.rcp;
import com.patzn.cloud.service.lims.common.LabreOfficeUtil;
import com.patzn.cloud.service.lims.socket.SpringUtil;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelId;
import io.netty.channel.ChannelInboundHandlerAdapter;
import net.jodah.expiringmap.ExpiringMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.UUID;
public class ServerHandler extends ChannelInboundHandlerAdapter {
private static final Logger logger = LoggerFactory.getLogger(ServerHandler.class);
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
String oid = ctx.channel().id().asLongText();
public void channelRead(ChannelHandlerContext ctx, Object msg) {
try {
String oid = ctx.channel().id().asLongText();
ByteBuf buf = (ByteBuf) msg; byte[] req = new byte[buf.readableBytes()];
buf.readBytes(req);
String body = new String(req, "UTF-8");
logger.error("天平传输的原始数据为:"+body);
logger.error("天平传输的处理数据为:"+ConvertHexStrToByteArray.balanceTextChangg(body));
InitBalanceMap mapInit = (InitBalanceMap)SpringUtil.getBean("initBalanceMap");
ExpiringMap<String,String> mapId = mapInit.getMapId();
ExpiringMap<String,String> mapValue = mapInit.getMapValue();
if (mapId.get(oid)==null){
mapId.put(oid,ConvertHexStrToByteArray.balanceTextChangg(body));
}else{
mapValue.put(mapId.get(oid),ConvertHexStrToByteArray.balanceTextChangg(body));
}
RpcRequest request = (RpcRequest) msg;
logger.error("天平传输的原始数据为:"+request.getData().toString());
logger.error("天平传输的处理数据为:"+ConvertHexStrToByteArray.balanceTextChangg(ConvertHexStrToByteArray.hexStringToAsciiString(request.getData().toString())));
InitBalanceMap mapInit = (InitBalanceMap)SpringUtil.getBean("initBalanceMap");
ExpiringMap<String,String> mapId = mapInit.getMapId();
ExpiringMap<String,String> mapValue = mapInit.getMapValue();
if (mapId.get(oid)==null){
mapId.put(oid,ConvertHexStrToByteArray.balanceTextChangg(ConvertHexStrToByteArray.hexStringToAsciiString(request.getData().toString())));
}else{
mapValue.put(mapId.get(oid),ConvertHexStrToByteArray.balanceTextChangg(ConvertHexStrToByteArray.hexStringToAsciiString(request.getData().toString())));
}
System.out.println(body);
System.out.println("目前天平库的信息为:"+mapValue.toString());
System.out.println();
logger.error("目前天平库的信息为:"+mapValue.toString());
logger.error("目前天平库的信息为:"+mapValue.toString());
System.out.println("接收到客户端信息:" + msg.toString());
//返回的数据结构
ctx.writeAndFlush("OK");
}catch (Exception e){
e.printStackTrace();
}
System.out.println("接收到客户端信息:" + request.toString());
//返回的数据结构
RpcResponse response = new RpcResponse();
response.setId(UUID.randomUUID().toString());
response.setData("server响应结果");
response.setStatus(1);
ctx.writeAndFlush(response);
}
@Override
......
......@@ -102,13 +102,12 @@ public class SoilAloneSampleServiceImpl extends BaseServiceImpl<SoilAloneSampleM
}
RestAssert.fail(StringUtils.isBlank(aloneInOutStock.getStorehouse()),"请填写库房号");
RestAssert.fail(StringUtils.isBlank(aloneInOutStock.getShelfCode()),"请填写货架号");
RestAssert.fail(null == aloneInOutStock.getKeepLimit(),"请填写留存有效期");
RestAssert.fail(null == aloneInOutStock.getStorehouse(),"请填写库房号");
RestAssert.fail(null == aloneInOutStock.getInStockerId(),"请选择入库人");
RestAssert.fail(StringUtils.isBlank(aloneInOutStock.getInStocker()),"请选择入库人");
RestAssert.fail(null == aloneInOutStock.getInstockTime() ,"请填写入库时间");
Date date = DateUtils.dateAddDays(aloneInOutStock.getInstockTime(),aloneInOutStock.getKeepLimit()*30);
aloneInOutStock.setKeepLimitTime(date);
RestAssert.fail(null == aloneInOutStock.getKeepLimitTime() ,"请填写留存有效期");
List<SoilAloneInOutStock> saveList = new ArrayList<>();
for (Long id:ids) {
SoilAloneInOutStock stock = aloneInOutStock.convert(SoilAloneInOutStock.class);
......@@ -272,7 +271,7 @@ public class SoilAloneSampleServiceImpl extends BaseServiceImpl<SoilAloneSampleM
vo.setInstockTime(stock.getInstockTime());
vo.setKeepLimitTime(stock.getKeepLimitTime());
vo.setShelfCode(stock.getShelfCode());
vo.setOutGo(stock.getOutGo());
vo.setOutStocker(stock.getOutStocker());
vo.setOutStock(stock.getOutStock());
vo.setOutStockReceiver(stock.getOutStockReceiver());
......
......@@ -627,6 +627,17 @@ public class SoilEntrustServiceImpl extends BaseServiceImpl<SoilEntrustMapper, S
List<Long> groupIds =groupList.stream().map(g->{
return g.getId();
}).collect(Collectors.toList());
if (null != soilEntrust.getGroupId()){
if (!groupIds.contains(soilEntrust.getGroupId())){
return page;
}else{
groupIds.clear();
groupIds.add(soilEntrust.getGroupId());
}
}
SoilPrepareVO prepareVO = new SoilPrepareVO();
prepareVO.setStatus(SoilPrepareStatusEnum.PREPARED);
List<SoilPrepareVO> prepareVOList= soilPrepareService.listVOTake(prepareVO,groupIds);
......
......@@ -965,15 +965,19 @@ public class SoilExperimentServiceImpl extends BaseServiceImpl<SoilExperimentMap
int sheetNum = xssfWorkbook.getNumberOfSheets();
boolean keliJIa = "颗粒分析实验(甲种)".equals(template.getName());
boolean keliJIa = "颗粒分析实验(甲种)".equals(template.getName()) || "颗粒分析实验(乙种)".equals(template.getName());
boolean keliAstm = "颗粒分析实验(ASTM)".equals(template.getName()) ;
if (keliJIa){
//='颗粒分析试验(密度计法)'!$S$3:$T$22
// GenerateChartKeli(xssfSheet,"'"+xssfSheet.getSheetName()+"'!$S$"+3+":"+"$S$"+22,"'"+xssfSheet.getSheetName()+"'!$T$"+3+":$T$"+22);
DrawXlsxUtil.AnchorPosition position = new DrawXlsxUtil.AnchorPosition(21,2,28,8,"颗粒大小分布曲线","颗粒大小(mm)","小于某直径之百分数(%)");
ApachePoiLineChart4.productZhexian(xssfSheet,position);
}
if (keliAstm){
DrawXlsxUtil.AnchorPosition position = new DrawXlsxUtil.AnchorPosition(21,2,28,8,"颗粒大小分布曲线","颗粒大小(mm)","小于某直径之百分数(%)");
ApachePoiLineChart4.productZhexianAstm(xssfSheet,position);
}
for (SoilExperimentVO vo:voList) {
if (index==0){
......@@ -984,11 +988,13 @@ public class SoilExperimentServiceImpl extends BaseServiceImpl<SoilExperimentMap
}
XSSFSheet sheet = xssfWorkbook.cloneSheet(0);
if (keliJIa){
//GenerateChartKeli(sheet,"'界限含水率 (碟式液限仪多点法)'!$D$"+3+":"+"$D$"+5,"'界限含水率 (碟式液限仪多点法)'!$J$"+3+":$J$"+5);
// GenerateChartKeli(sheet,"'"+sheet.getSheetName()+"'!$S$"+3+":"+"$S$"+22,"'"+sheet.getSheetName()+"'!$T$"+3+":$T$"+22);
DrawXlsxUtil.AnchorPosition position = new DrawXlsxUtil.AnchorPosition(21,2,28,8,"颗粒大小分布曲线","颗粒大小(mm)","小于某直径之百分数(%)");
ApachePoiLineChart4.productZhexian(sheet,position);
}
if (keliAstm){
DrawXlsxUtil.AnchorPosition position = new DrawXlsxUtil.AnchorPosition(21,2,28,8,"颗粒大小分布曲线","颗粒大小(mm)","小于某直径之百分数(%)");
ApachePoiLineChart4.productZhexianAstm(xssfSheet,position);
}
index++;
}
......
......@@ -5,7 +5,7 @@
<select id="selectVOList" resultType="com.patzn.cloud.service.soil.vo.SoilAloneSampleVO">
SELECT
s.id,s.receiver,s.receive_time,s.project_name,s.project_leader,s.borehole_name,s.cases_num,s.registrant,s.regist_time,s.outstock_code,
o.instore_object_key,o.outstock_object_key,o.storehouse,o.shelf_code,o.instock_time,o.keep_limit_time,o.in_stocker
o.instore_object_key,o.outstock_object_key,o.storehouse,o.shelf_code,o.instock_time,o.keep_limit_time,o.in_stocker,o.out_go
FROM
soil_alone_sample s
JOIN soil_alone_in_out_stock o ON s.ID = o.alone_sample_id
......
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