Commit 4b83f772 by 胡懿

货品,二维码,入库,台账jsp

parent d8b7e90f
......@@ -94,7 +94,7 @@ public class GoodsService extends CrudService<GoodsMapper, Goods> {
*/
@Transactional(readOnly = false)
public GoodsInfo printQr(String infoId) {
String qrImgPath = Global.getUserfilesBaseDir() + "image";
String qrImgPath = Global.getAttachmentDir() + "image";
File file = new File(qrImgPath);
if (!file .exists() && !file .isDirectory()) {
System.out.println("//不存在");
......@@ -135,7 +135,7 @@ public class GoodsService extends CrudService<GoodsMapper, Goods> {
} catch (IOException e) {
e.printStackTrace();
}
qrCode.setUrl("image/" + numSeq + "_" + i + ".png");
qrCode.setUrl(Global.getAttachmentUrl() + "image/" + numSeq + "_" + i + ".png");
qrCodeMapper.insert(qrCode);
qrCodeList.add(qrCode);
......@@ -171,7 +171,11 @@ public class GoodsService extends CrudService<GoodsMapper, Goods> {
for (QrCode qrCode : qrCodeList) {
if (StringUtils.isNotBlank(qrCode.getUrl())) {
try {
FileUtil.deleteFile(new File(Global.getUserfilesBaseDir() + qrCode.getUrl()));
String url = qrCode.getUrl();
if (null != url && url.contains("image")) {
String photo = url.split("image/")[1];
FileUtil.deleteFile(new File(Global.getAttachmentDir() + "image/" + photo));
}
} catch (IOException e) {
e.printStackTrace();
}
......
package com.jeeplus.modules.warehouse.ikanalyzer;
import java.io.StringReader;
import org.wltea.analyzer.cfg.DefaultConfig;
import org.wltea.analyzer.core.IKSegmenter;
import org.wltea.analyzer.core.Lexeme;
import org.wltea.analyzer.cfg.Configuration;
public class IKSegmenterTest {
private static Configuration m_wordCut_cfg;
public String parse(String content, boolean useSmart) throws Exception{
StringReader sr = new StringReader(content);
// 参数2为是否使用智能分词
// true:使用智能分词
// false:使用最细粒度分词
IKSegmenter ikSegmenter = new IKSegmenter(sr, useSmart);
Lexeme word = null;
String w = null;
StringBuffer sb = new StringBuffer();
while((word = ikSegmenter.next()) != null){
w = word.getLexemeText();
// int nTtype = word.getLexemeType();
// if (nTtype == 64) continue;
if(sb.length() > 0){
sb.append("|");
}
sb.append(w);
}
return sb.toString();
}
/**
* 分词方法
* @param text 需要拆分的字符串
* @param b ture为智能拆分,false为最细粒度拆分
* @return
*/
public static String splitStr(String text, boolean b) {
String strs = text;
m_wordCut_cfg = DefaultConfig.getInstance();
try {
IKSegmenterTest ikSegmenterTest = new IKSegmenterTest();
strs = ikSegmenterTest.parse(text,b);
} catch (Exception e) {
e.printStackTrace();
}
return strs;
}
public static void main(String[] args) {
String text = "185的绿色军鞋15双";
System.out.println("使用智能分词结果:"+splitStr(text, true));
System.out.println("最细粒度分词结果:"+splitStr(text, false));
}
}
......@@ -49,6 +49,7 @@ public class LedgerService extends CrudService<LedgerMapper, Ledger> {
List<CountLedgerInfo> list = map.get(batchNum);
if (null == list) {
list = new ArrayList<>();
list.add(countLedgerInfo);
map.put(countLedgerInfo.getBatchNum(), list);
} else {
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
<comment>IK Analyzer 扩展配置</comment>
<!--用户可以在这里配置自己的扩展字典 -->
<entry key="ext_dict">ext.dic;</entry>
<!--用户可以在这里配置自己的扩展停止词字典 -->
<!-- <entry key="ext_stopwords">stopword.dic;org/wltea/analyzer/dic/main2012.dic;</entry>-->
</properties>
\ No newline at end of file
185
170
鞋子
衣服
裤子
绿军鞋
\ No newline at end of file
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