package abacus.springboot.example.esb; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.stream.Collectors; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Isolation; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import abacus.springboot.example.api.view.ApiBillHg; import abacus.springboot.example.api.view.ApiBillHgItem; import abacus.springboot.example.api.view.ApiBillHgPayment; import abacus.springboot.example.api.view.ApiJcBill; import abacus.springboot.example.api.view.ApiJcBillHgSearchItem; import abacus.springboot.example.api.view.ApiJcBillItem; import abacus.springboot.example.api.view.ApiJcBillSearch; import abacus.springboot.example.api.view.ApiReqJcBill; import abacus.springboot.example.api.view.ApiReqJcBillGoodsPhoto; import abacus.springboot.example.api.view.ApiReqJcBillItem; import abacus.springboot.example.api.view.JcBillCount; import abacus.springboot.example.api.view.JcCodeFlow; import abacus.springboot.example.api.view.JcProduct; import abacus.springboot.example.api.view.JcProductBillSouce; import abacus.springboot.example.dao.JcBill; import abacus.springboot.example.dao.JcBillHg; import abacus.springboot.example.dao.JcBillHgPay; import abacus.springboot.example.dao.JcBillInItem; import abacus.springboot.example.dao.JcBillPhoto; import abacus.springboot.example.dao.JcBillSourceItem; import abacus.springboot.example.dao.JcSourceItem; import abacus.springboot.example.pi.ApiJcBillAccessIF; import abacus.springboot.example.pi.JcBillAccessIF; import abacus.springboot.example.repository.JcBillHgPayRepository; import abacus.springboot.example.repository.JcBillHgRepository; import abacus.springboot.example.repository.JcBillInItemRepository; import abacus.springboot.example.repository.JcBillPhotoRepository; import abacus.springboot.example.repository.JcBillRepository; import abacus.springboot.example.repository.JcBillSourceItemRepository; import abacus.springboot.example.repository.JcSourceItemRepository; import abacus.springboot.example.wsi.ApiJcBillServiceIF; @Service public class ApiJcBillService implements ApiJcBillServiceIF { private static final Logger LOG = LoggerFactory.getLogger(ApiJcBillService.class); @Autowired private ApiJcBillAccessIF apiJcBillAccess; @Autowired private JcBillAccessIF jcBillAccess; @Autowired private JcBillRepository jcBillRepository; @Autowired private JcBillSourceItemRepository jcBillSourceItemRepository; @Autowired private JcBillPhotoRepository jcBillPhotoRepository; @Autowired private JcBillHgRepository jcBillHgRepository; @Autowired private JcBillHgPayRepository jcBillHgPayRepository; @Autowired private JcSourceItemRepository jcSourceItemRepository; @Autowired private JcBillInItemRepository jcBillInItemRepository; @Override public Page queryApiJcBillSearch(String keyword, String employee, String status, Pageable pageable) throws RuntimeException { try { return this.apiJcBillAccess.queryApiJcBillSearch(keyword, employee, status, pageable); } catch (RuntimeException e) { e.printStackTrace(); LOG.error("服务异常", e.getMessage()); throw new RuntimeException("服务异常:", e); } } @Override public ApiJcBill queryApiJcBillById(String id) throws RuntimeException { try { return this.apiJcBillAccess.queryApiJcBillById(id); } catch (RuntimeException e) { e.printStackTrace(); LOG.error("服务异常", e.getMessage()); throw new RuntimeException("服务异常:", e); } } @Override public List queryApiJcBillItemByBIllId(String billId) throws RuntimeException { try { return this.apiJcBillAccess.queryApiJcBillItemByBIllId(billId); } catch (RuntimeException e) { e.printStackTrace(); LOG.error("服务异常", e.getMessage()); throw new RuntimeException("服务异常:", e); } } @Override public Map> queryJcBillPhoto(String srcid) throws RuntimeException { try { List billPhotos = jcBillAccess.queryJcBillPhoto(srcid, null, null); if(billPhotos == null) return new HashMap>(); Map> map = billPhotos.stream() .collect(Collectors.groupingBy(e -> { return e.getTypephoto() + "#" + e.getSrcitemid(); }, Collectors.collectingAndThen(Collectors.toList(), value -> value) )); return map; } catch (RuntimeException e) { e.printStackTrace(); LOG.error("服务异常", e.getMessage()); throw new RuntimeException("服务异常:", e); } } @Override public Map> queryJcBillPhotoIn(List srcids) throws RuntimeException { try { List billPhotos = jcBillAccess.queryJcBillPhotoIn(srcids); if(billPhotos == null) return new HashMap>(); Map> map = billPhotos.stream() .collect(Collectors.groupingBy(e -> { return e.getTypephoto() + "#" + e.getSrcitemid(); }, Collectors.collectingAndThen(Collectors.toList(), value -> value) )); return map; } catch (RuntimeException e) { e.printStackTrace(); LOG.error("服务异常", e.getMessage()); throw new RuntimeException("服务异常:", e); } } @Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) @Override public ApiReqJcBill saveApiReqJcBill(ApiReqJcBill reqJcBill, JcBill jcBill, List createItems) throws RuntimeException { try { List tempItems = jcBillSourceItemRepository.saveAll(createItems); // Map map = tempItems.stream() // .collect(Collectors.groupingBy(e -> { // return String.valueOf(e.getIndexno()) + e.getGoodsid(); // }, // Collectors.collectingAndThen(Collectors.toList(), value -> value.get(0)) // )); // 新增 List createPhoto = new ArrayList(); if(reqJcBill.getItems() != null && reqJcBill.getItems().size() >= 1) { JcBillPhoto fkPhoto = null; JcBillPhoto hpPhoto = null; for(ApiReqJcBillItem item : reqJcBill.getItems()) { // 付款图 if(item.getPaymentPhoto() != null && item.getPaymentPhoto().size() >= 1) { for(String urlphoto : item.getPaymentPhoto()) { fkPhoto = new JcBillPhoto(); fkPhoto.setSrcid(jcBill.getId()); fkPhoto.setSrcitemid(String.valueOf(item.getIndexno())); fkPhoto.setTypephoto(JcBillPhoto.JC_FK); fkPhoto.setUrlphoto(urlphoto); createPhoto.add(fkPhoto); } } for(ApiReqJcBillGoodsPhoto photo : item.getGoodsPhotos()) { // 货品图 if(item.getGoodsPhotos() != null && item.getGoodsPhotos().size() >= 1) { for(String urlphoto : photo.getGoodsPhotos()) { hpPhoto = new JcBillPhoto(); hpPhoto.setSrcid(jcBill.getId()); hpPhoto.setSrcitemid(String.valueOf(item.getIndexno()) + "#" + photo.getGoodsid()); hpPhoto.setTypephoto(JcBillPhoto.JC_HP); hpPhoto.setUrlphoto(urlphoto); createPhoto.add(hpPhoto); } } } } } // 删除图片 jcBillAccess.deleteJcBillPhoto(jcBill.getId(), null, JcBillPhoto.JC_FK); jcBillAccess.deleteJcBillPhoto(jcBill.getId(), null, JcBillPhoto.JC_HP); jcBillPhotoRepository.saveAll(createPhoto); jcBillRepository.save(jcBill); return reqJcBill; } catch (RuntimeException e) { e.printStackTrace(); LOG.error("服务异常", e.getMessage()); throw new RuntimeException("服务异常:", e); } } @Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) @Override public ApiReqJcBill updateApiReqJcBill(ApiReqJcBill reqJcBill, JcBill jcBill, List createItems, List updateItems) throws RuntimeException { try { // Map map = tempItems.stream() // .collect(Collectors.groupingBy(e -> { // return String.valueOf(e.getIndexno()) + e.getGoodsid(); // }, // Collectors.collectingAndThen(Collectors.toList(), value -> value.get(0)) // )); // 新增 List createPhoto = new ArrayList(); if(reqJcBill.getItems() != null && reqJcBill.getItems().size() >= 1) { JcBillPhoto fkPhoto = null; JcBillPhoto hpPhoto = null; for(ApiReqJcBillItem item : reqJcBill.getItems()) { // 付款图 if(item.getPaymentPhoto() != null && item.getPaymentPhoto().size() >= 1) { for(String urlphoto : item.getPaymentPhoto()) { fkPhoto = new JcBillPhoto(); fkPhoto.setSrcid(jcBill.getId()); fkPhoto.setSrcitemid(String.valueOf(item.getIndexno())); fkPhoto.setTypephoto(JcBillPhoto.JC_FK); fkPhoto.setUrlphoto(urlphoto); createPhoto.add(fkPhoto); } } for(ApiReqJcBillGoodsPhoto photo : item.getGoodsPhotos()) { // 货品图 if(item.getGoodsPhotos() != null && item.getGoodsPhotos().size() >= 1) { for(String urlphoto : photo.getGoodsPhotos()) { hpPhoto = new JcBillPhoto(); hpPhoto.setSrcid(jcBill.getId()); hpPhoto.setSrcitemid(String.valueOf(item.getIndexno()) + "#" + photo.getGoodsid()); hpPhoto.setTypephoto(JcBillPhoto.JC_HP); hpPhoto.setUrlphoto(urlphoto); createPhoto.add(hpPhoto); } } } } } // 删除图片 jcBillAccess.deleteJcBillPhoto(jcBill.getId(), null, JcBillPhoto.JC_FK); jcBillAccess.deleteJcBillPhoto(jcBill.getId(), null, JcBillPhoto.JC_HP); jcBillSourceItemRepository.deleteByBillid(jcBill.getId()); jcBillRepository.deleteById(jcBill.getId()); List tempItems = jcBillSourceItemRepository.saveAll(createItems); jcBillPhotoRepository.saveAll(createPhoto); jcBillRepository.save(jcBill); return reqJcBill; } catch (RuntimeException e) { e.printStackTrace(); LOG.error("服务异常", e.getMessage()); throw new RuntimeException("服务异常:", e); } } /*@Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) @Override public ApiReqJcBill updateApiReqJcBill(ApiReqJcBill reqJcBill, JcBill jcBill, List createItems, List updateItems) throws RuntimeException { try { List tempItems = jcBillSourceItemRepository.saveAll(createItems); // Map map = tempItems.stream() // .collect(Collectors.groupingBy(e -> { // return String.valueOf(e.getIndexno()); // }, // Collectors.collectingAndThen(Collectors.toList(), value -> value.get(0)) // )); // 新增 List createPhoto = new ArrayList(); // 修改 List updatePhoto = new ArrayList(); if(reqJcBill.getItems() != null && reqJcBill.getItems().size() >= 1) { JcBillPhoto fkPhoto = null; JcBillPhoto hpPhoto = null; for(ApiReqJcBillItem item : reqJcBill.getItems()) { // 付款图 if(item.getPaymentPhoto() != null && item.getPaymentPhoto().size() >= 1) { for(String urlphoto : item.getPaymentPhoto()) { fkPhoto = new JcBillPhoto(); fkPhoto.setSrcid(jcBill.getId()); fkPhoto.setSrcitemid(String.valueOf(item.getIndexno())); fkPhoto.setTypephoto(JcBillPhoto.JC_FK); fkPhoto.setUrlphoto(urlphoto); createPhoto.add(fkPhoto); } } for(ApiReqJcBillGoodsPhoto photo : item.getGoodsPhotos()) { // 货品图 if(item.getGoodsPhotos() != null && item.getGoodsPhotos().size() >= 1) { for(String urlphoto : photo.getGoodsPhotos()) { hpPhoto = new JcBillPhoto(); hpPhoto.setSrcid(jcBill.getId()); hpPhoto.setSrcitemid(String.valueOf(item.getIndexno()) + "#" + photo.getGoodsid()); hpPhoto.setTypephoto(JcBillPhoto.JC_HP); hpPhoto.setUrlphoto(urlphoto); createPhoto.add(hpPhoto); } } } } } // 删除图片 // for(JcBillPhoto photo : createPhoto) { // jcBillAccess.deleteJcBillPhoto(photo.getSrcid(), photo.getSrcitemid(), photo.getTypephoto()); // } jcBillAccess.deleteJcBillPhoto(jcBill.getId(), null, JcBillPhoto.JC_FK); jcBillAccess.deleteJcBillPhoto(jcBill.getId(), null, JcBillPhoto.JC_HP); jcBillPhotoRepository.saveAll(createPhoto); jcBillAccess.updateJcBill(jcBill); jcBillAccess.updateJcBillSourceItem(updateItems); List itemsLogs = new ArrayList(); itemsLogs.addAll(tempItems); itemsLogs.addAll(updateItems); List photoLogs = new ArrayList(); photoLogs.addAll(createPhoto); photoLogs.addAll(updatePhoto); 操作日志 OperationLog log = new OperationLog("api_jc_bill", jcBill.getId(), "更新", "", "", JSONObject.toJSONString(jcBill) + JSONArray.toJSONString(itemsLogs) + JSONArray.toJSONString(photoLogs)); log.setOperator(jcBill.getApplicant()); log.setOperatorName(jcBill.getApplicantname()); BusinessESUtil.checkService(this.operationLogService).saveOperationLog(log); return reqJcBill; } catch (RuntimeException e) { e.printStackTrace(); LOG.error("服务异常", e.getMessage()); throw new RuntimeException("服务异常:", e); } }*/ @Override public int countJcBillItemIndexno(String billId) throws RuntimeException { try { return jcBillAccess.countJcBillItemIndexno(billId); } catch (RuntimeException e) { e.printStackTrace(); LOG.error("服务异常", e.getMessage()); throw new RuntimeException("服务异常:", e); } } @Override public JcBill queryJcBillById(String billId) throws RuntimeException { try { Optional optional = jcBillRepository.findById(billId); return optional.isPresent() ? optional.get() : null; } catch (RuntimeException e) { e.printStackTrace(); LOG.error("服务异常", e.getMessage()); throw new RuntimeException("服务异常:", e); } } @Override public List queryJcBillSourceItemByBillId(String billId) throws RuntimeException { try { List list = jcBillSourceItemRepository.findByBillid(billId); return (list != null && list.size() >= 1) ? list : null; } catch (RuntimeException e) { e.printStackTrace(); LOG.error("服务异常", e.getMessage()); throw new RuntimeException("服务异常:", e); } } @Override public JcBillSourceItem queryJcBillSourceItembyId(Long id) throws RuntimeException { try { Optional optional = jcBillSourceItemRepository.findById(id); return optional.isPresent() ? optional.get() : new JcBillSourceItem(); } catch (RuntimeException e) { e.printStackTrace(); LOG.error("服务异常", e.getMessage()); throw new RuntimeException("服务异常:", e); } } @Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) @Override public void updateStatusJcBill(JcBill jcBill, int oldStatus) throws RuntimeException { try { jcBillRepository.save(jcBill); // jcBillSourceItemRepository.saveAll(sourceItems); } catch (RuntimeException e) { e.printStackTrace(); LOG.error("服务异常", e.getMessage()); throw new RuntimeException("服务异常:", e); } } @Override public Page queryApiJcBillHgSearchItem(String keyword, String employee, String status, Pageable pageable) throws RuntimeException { try { return this.apiJcBillAccess.queryApiJcBillHgSearchItem(keyword, employee, status, pageable); } catch (RuntimeException e) { e.printStackTrace(); LOG.error("服务异常", e.getMessage()); throw new RuntimeException("服务异常:", e); } } @Override public Map queryJcBillCount(List ids) throws RuntimeException { try { if(ids != null && ids.size() >= 1) { List counts = apiJcBillAccess.queryJcBillCount(ids); if(counts == null) return new HashMap(); Map map = counts.stream() .collect(Collectors.groupingBy(e -> { return e.getId(); }, Collectors.collectingAndThen(Collectors.toList(), value -> value.get(0)) )); return map; } else { return new HashMap(); } } catch (RuntimeException e) { e.printStackTrace(); LOG.error("服务异常", e.getMessage()); throw new RuntimeException("服务异常:", e); } } @Override public ApiBillHg queryApiBillHgById(String hgId) throws RuntimeException { try { return this.apiJcBillAccess.queryApiBillHgById(hgId); } catch (RuntimeException e) { e.printStackTrace(); LOG.error("服务异常", e.getMessage()); throw new RuntimeException("服务异常:", e); } } @Override public List queryApiBillHgItemByHgId(String hgId) throws RuntimeException { try { return this.apiJcBillAccess.queryApiBillHgItemByHgId(hgId); } catch (RuntimeException e) { e.printStackTrace(); LOG.error("服务异常", e.getMessage()); throw new RuntimeException("服务异常:", e); } } @Override public List queryApiBillHgPaymentByHgId(String hgId) throws RuntimeException { try { return this.apiJcBillAccess.queryApiBillHgPaymentByHgId(hgId); } catch (RuntimeException e) { e.printStackTrace(); LOG.error("服务异常", e.getMessage()); throw new RuntimeException("服务异常:", e); } } @Override public JcBillHg queryJcBillHg(String billHg) throws RuntimeException { try { Optional optional = jcBillHgRepository.findById(billHg); return optional.isPresent() ? optional.get() : null; } catch (RuntimeException e) { e.printStackTrace(); LOG.error("服务异常", e.getMessage()); throw new RuntimeException("服务异常:", e); } } @Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) @Override public void updateJcBillHg(JcBillHg entity, List pays) throws RuntimeException { try { jcBillHgRepository.save(entity); jcBillHgPayRepository.saveAll(pays); } catch (RuntimeException e) { e.printStackTrace(); LOG.error("服务异常", e.getMessage()); throw new RuntimeException("服务异常:", e); } } @Override public JcBillPhoto queryJcBillPhoto(String srcid, String srcitemid, String typephoto) throws RuntimeException { try { return jcBillPhotoRepository.findBySrcidAndSrcitemidAndTypephoto(srcid, srcitemid, typephoto); } catch (RuntimeException e) { e.printStackTrace(); LOG.error("服务异常", e.getMessage()); throw new RuntimeException("服务异常:", e); } } @Override public List queryJcBillPhoto(String srcid, String typephoto) throws RuntimeException { try { return jcBillAccess.queryJcBillPhoto(srcid, null, typephoto); } catch (RuntimeException e) { e.printStackTrace(); LOG.error("服务异常", e.getMessage()); throw new RuntimeException("服务异常:", e); } } @Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) @Override public void saveAndDeletePhoto(List photos, JcBillHg billHg) throws RuntimeException { try { for(JcBillPhoto photo : photos) { jcBillPhotoRepository.deleteBySrcidAndSrcitemidAndTypephoto(photo.getSrcid(), photo.getSrcitemid(), photo.getTypephoto()); } jcBillPhotoRepository.saveAll(photos); jcBillHgRepository.save(billHg); } catch (RuntimeException e) { e.printStackTrace(); LOG.error("服务异常", e.getMessage()); throw new RuntimeException("服务异常:", e); } } @Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) @Override public void saveAndDeletePhoto(List photos, String billId) throws RuntimeException { try { jcBillPhotoRepository.saveAll(photos); } catch (RuntimeException e) { e.printStackTrace(); LOG.error("服务异常", e.getMessage()); throw new RuntimeException("服务异常:", e); } } @Override public String lastBillHgId() throws RuntimeException { try { return jcBillAccess.lastBillHgId(); } catch (RuntimeException e) { e.printStackTrace(); LOG.error("服务异常", e.getMessage()); throw new RuntimeException("服务异常:", e); } } @Override public List queryJcCodeFlow(List codes) throws RuntimeException { try { List flows = apiJcBillAccess.queryJcCodeFlow(codes); if(flows == null) return null; // Map map = flows.stream() // .collect(Collectors.groupingBy(e -> { // return e.getCode(); // }, // Collectors.collectingAndThen(Collectors.toList(), value -> value.get(0)) // )); return flows; } catch (RuntimeException e) { e.printStackTrace(); LOG.error("服务异常", e.getMessage()); throw new RuntimeException("服务异常:", e); } } @Override public List queryJcSourceItemByBillId(String billId) throws RuntimeException { try { return jcBillAccess.queryJcSourceItemByBillId(billId); } catch (RuntimeException e) { e.printStackTrace(); LOG.error("服务异常", e.getMessage()); throw new RuntimeException("服务异常:", e); } } @Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) @Override public void saveJcSourceItem(List items, List sourceItems, JcBill jcBill) throws RuntimeException { try { jcBillAccess.deleteJcSourceItemBySource(jcBill.getId()); if(sourceItems != null && sourceItems.size() >= 1) jcSourceItemRepository.saveAll(sourceItems); jcBillSourceItemRepository.saveAll(items); boolean flag = true; for(JcBillSourceItem item : items) { if(item.getStatus() == 0 && item.getStatus() == -2) flag = false; } if(flag)jcBill.setStatus(JcBill.STATUS_ONE); jcBillRepository.save(jcBill); } catch (RuntimeException e) { e.printStackTrace(); LOG.error("服务异常", e.getMessage()); throw new RuntimeException("服务异常:", e); } } @Override public JcBillPhoto queryJcBillPhotoById(String id) throws RuntimeException { try { Optional optional = jcBillPhotoRepository.findById(Long.parseLong(id)); return optional.isPresent() ? optional.get() : null; } catch (RuntimeException e) { e.printStackTrace(); LOG.error("服务异常", e.getMessage()); throw new RuntimeException("服务异常:", e); } } @Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) @Override public void deleteJcBillPhotoById(JcBillPhoto entity) throws RuntimeException { try { jcBillPhotoRepository.delete(entity); } catch (RuntimeException e) { e.printStackTrace(); LOG.error("服务异常", e.getMessage()); throw new RuntimeException("服务异常:", e); } } @Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) @Override public void deleteJcSourceItem(String billid, String itemid) throws RuntimeException { try { Optional optional = jcBillSourceItemRepository.findById(Long.parseLong(itemid)); if(optional.isPresent()) { JcBillSourceItem item = optional.get(); jcBillAccess.deleteJcBillPhoto(billid, String.valueOf(item.getIndexno()), JcBillPhoto.JC_FK); jcBillAccess.deleteJcBillPhoto(billid, item.getIndexno() + "#" + item.getGoodsid(), JcBillPhoto.JC_HP); jcBillSourceItemRepository.delete(item); } } catch (RuntimeException e) { e.printStackTrace(); LOG.error("服务异常", e.getMessage()); throw new RuntimeException(e); } } @Override public List queryApiBillHgPaymentByHgId(List hgIds) throws RuntimeException { try { return this.apiJcBillAccess.queryApiBillHgPaymentByHgId(hgIds); } catch (RuntimeException e) { e.printStackTrace(); LOG.error("服务异常", e.getMessage()); throw new RuntimeException("服务异常:", e); } } @Override public String getBaiduToken() throws RuntimeException { return jcBillAccess.getBaiduToken(); } @Override public List queryJcProduct(String product, String stockInId, String hgId) throws RuntimeException { try { return this.apiJcBillAccess.queryJcProduct(product, stockInId, hgId); } catch (RuntimeException e) { e.printStackTrace(); LOG.error("服务异常", e.getMessage()); throw new RuntimeException("服务异常:", e); } } @Override public Map> queryJcProductBillSouce(List billIds) throws RuntimeException { try { List billPhotos = apiJcBillAccess.queryJcProductBillSouce(billIds); if(billPhotos == null) return new HashMap>(); Map> map = billPhotos.stream() .collect(Collectors.groupingBy(e -> { return e.getBillid() + e.getAccount() + e.getProduct(); }, Collectors.collectingAndThen(Collectors.toList(), value -> value) )); return map; } catch (RuntimeException e) { e.printStackTrace(); LOG.error("服务异常", e.getMessage()); throw new RuntimeException("服务异常:", e); } } @Override public List queryJcProduct(String product, String stockInId) throws RuntimeException { try { return this.apiJcBillAccess.queryJcProduct(product, stockInId); } catch (RuntimeException e) { e.printStackTrace(); LOG.error("服务异常", e.getMessage()); throw new RuntimeException("服务异常:", e); } } @Override public void updateStatusByJcBill(JcBill jcBill, int status) throws RuntimeException { try { } catch (RuntimeException e) { e.printStackTrace(); LOG.error("服务异常", e.getMessage()); throw new RuntimeException("服务异常:", e); } } @Override public List qeryJcBillHgs(List billids) throws RuntimeException { try { return apiJcBillAccess.qeryJcBillHgs(billids); } catch (RuntimeException e) { e.printStackTrace(); LOG.error("服务异常", e.getMessage()); throw new RuntimeException("服务异常:", e); } } @Override public JcBillInItem queryJcBillInItemById(Long id) throws RuntimeException { try { Optional optional = jcBillInItemRepository.findById(id); return optional.isPresent() ? optional.get() : new JcBillInItem(); } catch (RuntimeException e) { e.printStackTrace(); LOG.error("服务异常", e.getMessage()); throw new RuntimeException("服务异常:", e); } } }