|
|
|
@ -20,6 +20,7 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; |
|
|
|
@ -106,7 +107,7 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
@Override |
|
|
|
|
public IPage<DistributionStockArticleVO> selectDistributionStockArticlePage(IPage<DistributionStockArticleVO> page, DistributionStockArticleVO distributionStockArticle) { |
|
|
|
|
List<DistributionStockArticleVO> distributionStockArticleVOS = baseMapper.selectDistributionStockArticlePage(page, distributionStockArticle); |
|
|
|
|
distributionStockArticleVOS.forEach(t->{ |
|
|
|
|
distributionStockArticleVOS.forEach(t -> { |
|
|
|
|
t.setOrderStatusName(DictBizCache.getValue(DictBizConstant.DELIVERY_ORDER_STATUS, t.getOrderStatus())); |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
@ -127,50 +128,50 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
public Boolean saveStock(String ids) { |
|
|
|
|
// try {
|
|
|
|
|
if (StringUtils.isNotBlank(ids)) { |
|
|
|
|
//查询
|
|
|
|
|
List<DistributionParcelListEntity> list1 = distributionParcelListService.list(Wrappers.<DistributionParcelListEntity>query().lambda() |
|
|
|
|
.in(DistributionParcelListEntity::getStockArticleId, ids.split(",")) |
|
|
|
|
); |
|
|
|
|
if (list1.size() > 0) { |
|
|
|
|
list1.forEach(i -> { |
|
|
|
|
//查询库存品里面有没有一样的
|
|
|
|
|
if (StringUtils.isNotBlank(ids)) { |
|
|
|
|
//查询
|
|
|
|
|
List<DistributionParcelListEntity> list1 = distributionParcelListService.list(Wrappers.<DistributionParcelListEntity>query().lambda() |
|
|
|
|
.in(DistributionParcelListEntity::getStockArticleId, ids.split(",")) |
|
|
|
|
); |
|
|
|
|
if (list1.size() > 0) { |
|
|
|
|
list1.forEach(i -> { |
|
|
|
|
//查询库存品里面有没有一样的
|
|
|
|
|
// List<DistributionStockListEntity> list = distributionStockListService.list(Wrappers.<DistributionStockListEntity>query().lambda()
|
|
|
|
|
// .eq(DistributionStockListEntity::getServiceNumber,i.getServiceNumber())
|
|
|
|
|
// .eq(DistributionStockListEntity::getMaterial,i.getMaterial())
|
|
|
|
|
// );
|
|
|
|
|
//查询包件有没有物料
|
|
|
|
|
List<DistributionParcelDetailsEntity> list = distributionParcelDetailsService.list(Wrappers.<DistributionParcelDetailsEntity>query().lambda() |
|
|
|
|
.eq(DistributionParcelDetailsEntity::getParcelListId, i.getId()) |
|
|
|
|
); |
|
|
|
|
if(list.size() > 0){ |
|
|
|
|
list.forEach( a ->{ |
|
|
|
|
DistributionParcelListEntity parcelListEntity = new DistributionParcelListEntity(); |
|
|
|
|
BeanUtil.copyProperties(i,parcelListEntity); |
|
|
|
|
parcelListEntity.setMaterialName(a.getName()); |
|
|
|
|
parcelListEntity.setMaterialCode(a.getEncoded()); |
|
|
|
|
parcelListEntity.setMaterialUnit(a.getUnit()); |
|
|
|
|
// 添加库存品信息
|
|
|
|
|
addStockList(parcelListEntity, 1); |
|
|
|
|
} ); |
|
|
|
|
}else{ |
|
|
|
|
//查询包件有没有物料
|
|
|
|
|
List<DistributionParcelDetailsEntity> list = distributionParcelDetailsService.list(Wrappers.<DistributionParcelDetailsEntity>query().lambda() |
|
|
|
|
.eq(DistributionParcelDetailsEntity::getParcelListId, i.getId()) |
|
|
|
|
); |
|
|
|
|
if (list.size() > 0) { |
|
|
|
|
list.forEach(a -> { |
|
|
|
|
DistributionParcelListEntity parcelListEntity = new DistributionParcelListEntity(); |
|
|
|
|
BeanUtil.copyProperties(i, parcelListEntity); |
|
|
|
|
parcelListEntity.setMaterialName(a.getName()); |
|
|
|
|
parcelListEntity.setMaterialCode(a.getEncoded()); |
|
|
|
|
parcelListEntity.setMaterialUnit(a.getUnit()); |
|
|
|
|
// 添加库存品信息
|
|
|
|
|
addStockList(i, 1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
String[] split = ids.split(","); |
|
|
|
|
for (int i = 0; i < split.length; i++) { |
|
|
|
|
//修改订单状态
|
|
|
|
|
DistributionStockArticleEntity stockArticleEntity = new DistributionStockArticleEntity(); |
|
|
|
|
stockArticleEntity.setId(Long.parseLong(split[i])); |
|
|
|
|
stockArticleEntity.setGenre(2); |
|
|
|
|
baseMapper.updateById(stockArticleEntity); |
|
|
|
|
addStockList(parcelListEntity, 1); |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
// 添加库存品信息
|
|
|
|
|
addStockList(i, 1); |
|
|
|
|
} |
|
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
String[] split = ids.split(","); |
|
|
|
|
for (int i = 0; i < split.length; i++) { |
|
|
|
|
//修改订单状态
|
|
|
|
|
DistributionStockArticleEntity stockArticleEntity = new DistributionStockArticleEntity(); |
|
|
|
|
stockArticleEntity.setId(Long.parseLong(split[i])); |
|
|
|
|
stockArticleEntity.setGenre(2); |
|
|
|
|
baseMapper.updateById(stockArticleEntity); |
|
|
|
|
} |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
// } catch (Exception e) {
|
|
|
|
|
// log.info("异常", e.getMessage());
|
|
|
|
|
// return false;
|
|
|
|
@ -298,7 +299,7 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
|
|
|
|
|
//查询在库订单信息
|
|
|
|
|
DistributionStockArticleEntity distributionStockArticleEntity = baseMapper.selectById(distributionParcelList.getStockArticleId()); |
|
|
|
|
if(ObjectUtil.isEmpty(distributionStockArticleEntity.getMallId()) || distributionStockArticleEntity.getMallId().equals("-1") ){ |
|
|
|
|
if (ObjectUtil.isEmpty(distributionStockArticleEntity.getMallId()) || distributionStockArticleEntity.getMallId().equals("-1")) { |
|
|
|
|
throw new ServiceException("客户数据异常,无法转换!!"); |
|
|
|
|
} |
|
|
|
|
DistributionStockListEntity distributionStockListEntity = new DistributionStockListEntity(); |
|
|
|
@ -379,17 +380,17 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
public IPage<DistributionStockArticleEntity> selectClientListPage(IPage<DistributionStockArticleEntity> page, DistributionStockArticleVO distributionStockArticle) { |
|
|
|
|
// 获取当前登陆人
|
|
|
|
|
BladeUser user = AuthUtil.getUser(); |
|
|
|
|
List<DistributionStockArticleEntity> result =baseMapper.selectClientListPage(page, distributionStockArticle,user.getUserId()); |
|
|
|
|
List<DistributionStockArticleEntity> result = baseMapper.selectClientListPage(page, distributionStockArticle, user.getUserId()); |
|
|
|
|
return page.setRecords(result); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public R<List<DistributionStockArticleVO>> selectStockArticleAndParcel(Map<String,Object> query) { |
|
|
|
|
public R<List<DistributionStockArticleVO>> selectStockArticleAndParcel(Map<String, Object> query) { |
|
|
|
|
List<DistributionStockArticleVO> distributionStockArticleVOList = distributionStockArticleMapper.getAllReservationStockArticleInfo(query); |
|
|
|
|
distributionStockArticleVOList.forEach(s->{ |
|
|
|
|
distributionStockArticleVOList.forEach(s -> { |
|
|
|
|
QueryWrapper<DistributionParcelListEntity> parcelListVOQueryWrapper = new QueryWrapper<>(); |
|
|
|
|
parcelListVOQueryWrapper.lambda().eq(DistributionParcelListEntity::getStockArticleId,s.getId()); |
|
|
|
|
parcelListVOQueryWrapper.lambda().eq(DistributionParcelListEntity::getStockArticleId, s.getId()); |
|
|
|
|
List<DistributionParcelListEntity> distributionParcelListEntityList = distributionParcelListService.getBaseMapper().selectList(parcelListVOQueryWrapper); |
|
|
|
|
s.setParcelListVOS(distributionParcelListEntityList); |
|
|
|
|
}); |
|
|
|
@ -401,42 +402,42 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
// String tenantId = AuthUtil.getTenantId();
|
|
|
|
|
// String templateId = (String) params.get("templateId");
|
|
|
|
|
BasicPrintTemplateEntity template = basicPrintTemplateClient.getPrintTemplate(); |
|
|
|
|
if(ObjectUtil.isEmpty(template)){ |
|
|
|
|
if (ObjectUtil.isEmpty(template)) { |
|
|
|
|
throw new ServiceException("模板信息未找到!!"); |
|
|
|
|
} |
|
|
|
|
// BasicPrintTemplateEntity template = basicPrintTemplateClient.getTemplate("1688431772497219586");
|
|
|
|
|
String qrCode = (String) params.get("qrCode"); |
|
|
|
|
if (Func.isBlank(qrCode)){ |
|
|
|
|
log.error("参数异常:+{"+qrCode+"}"); |
|
|
|
|
if (Func.isBlank(qrCode)) { |
|
|
|
|
log.error("参数异常:+{" + qrCode + "}"); |
|
|
|
|
throw new ServiceException("服务器正忙!!!"); |
|
|
|
|
} |
|
|
|
|
String filename = QRCodeUtil.createCodeToFile(qrCode); |
|
|
|
|
String filetypeName = QRCodeUtil.createCodeToFileType(qrCode); |
|
|
|
|
params.put("img","/"+filename); |
|
|
|
|
params.put("img", "/" + filename); |
|
|
|
|
|
|
|
|
|
log.info(">>>>> 文件路径{}",filename); |
|
|
|
|
log.info(">>>>> 文件路径{}",filetypeName); |
|
|
|
|
log.info(">>>>> 文件路径{}", filename); |
|
|
|
|
log.info(">>>>> 文件路径{}", filetypeName); |
|
|
|
|
// params.put("img",getEmpAutograph(filename));
|
|
|
|
|
// params.put("imgType",getEmpAutograph(filetypeName));
|
|
|
|
|
params.put("imgType","/"+filetypeName); |
|
|
|
|
params.put("imgType", "/" + filetypeName); |
|
|
|
|
//查询订单号
|
|
|
|
|
String o =(String) params.get("id"); |
|
|
|
|
String o = (String) params.get("id"); |
|
|
|
|
DistributionStockArticleQRCodeVO orderNoList = baseMapper.getOrderNoList(qrCode, o); |
|
|
|
|
Map<String, Object> map = orderNoList.toMap(); |
|
|
|
|
// 创建一个新的Map,并将map1和map2合并到其中
|
|
|
|
|
Map<String, Object> mergedMap = new HashMap<>(); |
|
|
|
|
mergedMap.putAll(params); |
|
|
|
|
mergedMap.putAll(map); |
|
|
|
|
ServletOutputStream os =null; |
|
|
|
|
ServletOutputStream os = null; |
|
|
|
|
try { |
|
|
|
|
BufferedImage image = TemplateUtil.turnImage(template.getTemplateName(), mergedMap,template.getTemplateUrl(),template.getTemplateWidth(),template.getTemplateHeight()); |
|
|
|
|
BufferedImage image = TemplateUtil.turnImage(template.getTemplateName(), mergedMap, template.getTemplateUrl(), template.getTemplateWidth(), template.getTemplateHeight()); |
|
|
|
|
os = response.getOutputStream(); |
|
|
|
|
ImageIO.write(image, "png",os); |
|
|
|
|
ImageIO.write(image, "png", os); |
|
|
|
|
os.flush(); |
|
|
|
|
} catch (IOException e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
log.error("获取响应流失败+{"+e.getMessage()+"}"); |
|
|
|
|
}finally { |
|
|
|
|
log.error("获取响应流失败+{" + e.getMessage() + "}"); |
|
|
|
|
} finally { |
|
|
|
|
File file = new File(filename); |
|
|
|
|
file.delete(); |
|
|
|
|
File filetype = new File(filetypeName); |
|
|
|
@ -450,8 +451,8 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private String getEmpAutograph(String filePath) { |
|
|
|
|
String img =null; |
|
|
|
|
if(StringUtils.isNotEmpty(filePath)){ |
|
|
|
|
String img = null; |
|
|
|
|
if (StringUtils.isNotEmpty(filePath)) { |
|
|
|
|
InputStream in = null; |
|
|
|
|
byte[] picdata = null; |
|
|
|
|
try { |
|
|
|
@ -462,7 +463,7 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
img = encoder.encode(picdata); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
}finally{ |
|
|
|
|
} finally { |
|
|
|
|
try { |
|
|
|
|
in.close(); |
|
|
|
|
} catch (IOException e) { |
|
|
|
@ -470,65 +471,72 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return "data:image/png;base64,"+img; |
|
|
|
|
return "data:image/png;base64," + img; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public R<?> getPrintTemplates(Map<String, Object> params, HttpServletResponse response) { |
|
|
|
|
String templateByUrl = null; |
|
|
|
|
StringBuffer buffer = new StringBuffer(); |
|
|
|
|
//待删除文件列表
|
|
|
|
|
List<String> list= new ArrayList<>(); |
|
|
|
|
List<String> list = new ArrayList<>(); |
|
|
|
|
BasicPrintTemplateEntity template = basicPrintTemplateClient.getPrintTemplate(); |
|
|
|
|
if(ObjectUtil.isEmpty(template)){ |
|
|
|
|
return R.fail("模板信息未找到!!"); |
|
|
|
|
if (ObjectUtil.isEmpty(template)) { |
|
|
|
|
return R.fail("模板信息未找到!!"); |
|
|
|
|
} |
|
|
|
|
String id = (String) params.get("id"); |
|
|
|
|
DistributionStockArticleQRCodeVO orderNoList = baseMapper.getOrderNoList( null,id); |
|
|
|
|
Map<String,Object> map = JSONObject.parseObject(JSONObject.toJSONString(orderNoList), Map.class); |
|
|
|
|
String qrCode = (String) map.get("qrCode"); |
|
|
|
|
String filename = QRCodeUtil.createCodeToFile(qrCode); |
|
|
|
|
list.add(filename); |
|
|
|
|
map.put("img",getEmpAutograph(filename)); |
|
|
|
|
String filetypeName = QRCodeUtil.createCodeToFileType(qrCode); |
|
|
|
|
map.put("imgType",getEmpAutograph(filetypeName)); |
|
|
|
|
list.add(filetypeName); |
|
|
|
|
try { |
|
|
|
|
templateByUrl = TemplateUtil.getTemplateByUrl(template.getFileName(), map, template.getTemplateUrl()); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
return R.fail("模板获取异常"); |
|
|
|
|
} |
|
|
|
|
buffer.append(templateByUrl); |
|
|
|
|
DistributionStockArticleQRCodeVO orderNoList = baseMapper.getOrderNoList(null, id); |
|
|
|
|
Map<String, Object> map = JSONObject.parseObject(JSONObject.toJSONString(orderNoList), Map.class); |
|
|
|
|
String qrCode = (String) map.get("qrCode"); |
|
|
|
|
String filename = QRCodeUtil.createCodeToFile(qrCode); |
|
|
|
|
list.add(filename); |
|
|
|
|
map.put("img", getEmpAutograph(filename)); |
|
|
|
|
String filetypeName = QRCodeUtil.createCodeToFileType(qrCode); |
|
|
|
|
map.put("imgType", getEmpAutograph(filetypeName)); |
|
|
|
|
list.add(filetypeName); |
|
|
|
|
try { |
|
|
|
|
templateByUrl = TemplateUtil.getTemplateByUrl(template.getFileName(), map, template.getTemplateUrl()); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
return R.fail("模板获取异常"); |
|
|
|
|
} |
|
|
|
|
buffer.append(templateByUrl); |
|
|
|
|
ScheduledThreadPoolExecutor scheduledThreadPoolExecutor = new ScheduledThreadPoolExecutor(5); |
|
|
|
|
scheduledThreadPoolExecutor.schedule(new FileUtil(list),30, TimeUnit.SECONDS); |
|
|
|
|
scheduledThreadPoolExecutor.schedule(new FileUtil(list), 30, TimeUnit.SECONDS); |
|
|
|
|
return R.data(buffer.toString()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public OrderPackgeCodeDataVO showOrderPackgeCode(Map<String, Object> params) throws Exception { |
|
|
|
|
OrderPackgeCodeDataVO orderPackgeCodeDataVO=new OrderPackgeCodeDataVO(); |
|
|
|
|
OrderPackgeCodeDataVO orderPackgeCodeDataVO = new OrderPackgeCodeDataVO(); |
|
|
|
|
List<Map> data = new ArrayList<>(); |
|
|
|
|
BasicPrintTemplateEntity template = basicPrintTemplateClient.getPrintTemplate(); |
|
|
|
|
if(ObjectUtil.isEmpty(template)){ |
|
|
|
|
if (ObjectUtil.isEmpty(template)) { |
|
|
|
|
throw new ServiceException("模板内容未找到"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String html = TemplateUtil.getTemplateByUrl(template.getTemplateUrl()); |
|
|
|
|
orderPackgeCodeDataVO.setTemplateHtml(html); |
|
|
|
|
orderPackgeCodeDataVO.setTemplateId(template.getId()); |
|
|
|
|
String ids = (String) params.get("ids"); |
|
|
|
|
|
|
|
|
|
String[] idArray = ids.split(","); |
|
|
|
|
if(ObjectUtils.isNull(idArray)){ |
|
|
|
|
throw new ServiceException("参数错误"); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for (String id : idArray) { |
|
|
|
|
DistributionStockArticleQRCodeVO orderNoList = baseMapper.getOrderNoList(null, id); |
|
|
|
|
Map<String, Object> map = JSONObject.parseObject(JSONObject.toJSONString(orderNoList), Map.class); |
|
|
|
|
String filename = QRCodeUtil.createCodeToFile(orderNoList.getQrCode()); |
|
|
|
|
map.put("img", getEmpAutograph(filename)); |
|
|
|
|
String fileTypeName = QRCodeUtil.createCodeToFileType(orderNoList.getQrCode()); |
|
|
|
|
map.put("imgType", getEmpAutograph(fileTypeName)); |
|
|
|
|
data.add(map); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String id = (String) params.get("id"); |
|
|
|
|
DistributionStockArticleQRCodeVO orderNoList = baseMapper.getOrderNoList( null,id); |
|
|
|
|
Map<String,Object> map = JSONObject.parseObject(JSONObject.toJSONString(orderNoList), Map.class); |
|
|
|
|
String qrCode = (String) map.get("qrCode"); |
|
|
|
|
String filename = QRCodeUtil.createCodeToFile(qrCode); |
|
|
|
|
map.put("img",getEmpAutograph(filename)); |
|
|
|
|
String filetypeName = QRCodeUtil.createCodeToFileType(qrCode); |
|
|
|
|
map.put("imgType",getEmpAutograph(filetypeName)); |
|
|
|
|
data.add(map); |
|
|
|
|
orderPackgeCodeDataVO.setDataList(data); |
|
|
|
|
|
|
|
|
|
return orderPackgeCodeDataVO; |
|
|
|
|