标签:loader throw context setw sage select 整合 min cut
<dependency><groupId>org.apache.cxf</groupId><artifactId>cxf-rt-frontend-jaxws</artifactId><version>3.0.1</version></dependency><dependency><groupId>org.apache.cxf</groupId><artifactId>cxf-rt-transports-http</artifactId><version>3.0.1</version></dependency>
package com.itcast.weather;import javax.jws.WebService;@WebServicepublic interface IWeatherService {public String getWeatherInFoByCityName( String cityName);}
package com.itcast.weather;public class WeatherService implements IWeatherService {@Overridepublic String getWeatherInFoByCityName(String cityName) {if ("北京".equals(cityName)) {return "轻度雾霾";}return "晴天";}}
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd"><bean id="weatherService" class="com.itcast.weather.WeatherService" ></bean><jaxws:server address="/weather" ><jaxws:serviceBean><ref bean="weatherService" /></jaxws:serviceBean></jaxws:server></beans>
<servlet><servlet-name>webservice</servlet-name><servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class></servlet><servlet-mapping><servlet-name>webservice</servlet-name><url-pattern>/ws/*</url-pattern></servlet-mapping>






<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd"><!-- 把jaxws:client当做一个特殊的bean --><jaxws:client id="weatherService" serviceClass="com.itcast.weather.IWeatherService"address="http://localhost:8080/CXFServer/ws/weather?wsdl"></jaxws:client></beans>
public class Test {public static void main(String[] args) {ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext_cxf.xml");IWeatherService weatherService = (IWeatherService) context.getBean("weatherService");String info = weatherService.getWeatherInFoByCityName("北京");System.out.println(info);}}

public static void main(String[] args) {ApplicationContext app = new ClassPathXmlApplicationContext("classpath:applicationContext_cxf.xml");MobileCodeWSSoap mobileCode = (MobileCodeWSSoap) app.getBean("code");String codeInfo = mobileCode.getMobileCodeInfo("1850137", null);System.out.println(codeInfo);}




<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:jaxws="http://cxf.apache.org/jaxws"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd "><bean id="waybillService" class="cn.itcast.bos.ws.WayBillService" ></bean><jaxws:server address="waybill" ><jaxws:serviceBean><ref bean="waybillService" /></jaxws:serviceBean></jaxws:server></beans>
<filter><filter-name>struts2</filter-name><filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class></filter><filter-mapping><filter-name>struts2</filter-name><url-pattern>/admin/*</url-pattern></filter-mapping><servlet><servlet-name>webservice</servlet-name><servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class></servlet><servlet-mapping><servlet-name>webservice</servlet-name><url-pattern>/ws/*</url-pattern></servlet-mapping>
<struts><package name="default" namespace="/admin" extends="struts-default"><!-- --><action name="waybill_*" class="waybillAction" method="{1}"></action><!-- --><action name="waybilldetail_*" class="waybilldetailAction" method="{1}"></action></package></struts>
public class WayBillService implements IWayBillService {private IWaybilldetailBiz waybilldetailBiz ;private IWaybillBiz waybillBiz ;public void setWaybillBiz(IWaybillBiz waybillBiz) {this.waybillBiz = waybillBiz;}public void setWaybilldetailBiz(IWaybilldetailBiz waybilldetailBiz) {this.waybilldetailBiz = waybilldetailBiz;}/*** 根据运单号获取运单详情*/public List<Waybilldetail> getWayBilldetails(Long sn) {Waybilldetail t1 = new Waybilldetail();t1.setSn(sn);List<Waybilldetail> list= waybilldetailBiz.getList(t1, null, null);return list;}/*** 在线下单预约功能* state:0待发 1在途 2结束*/public Long online(Long userid, String toaddress, String addressee, String tele, String info) {Waybill waybill = new Waybill();waybill.setAddressee(addressee);waybill.setInfo(info);waybill.setState("0");waybill.setTele(tele);waybill.setToaddress(toaddress);waybill.setUserid(userid);waybillBiz.add(waybill);return waybill.getSn();}}
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:jaxws="http://cxf.apache.org/jaxws"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd "><bean id="waybillService" class="cn.itcast.bos.ws.WayBillService" ><property name="waybillBiz" ref="waybillBiz" ></property><property name="waybilldetailBiz" ref="waybilldetailBiz" ></property></bean><jaxws:server address="waybill" ><jaxws:serviceBean><ref bean="waybillService" /></jaxws:serviceBean></jaxws:server></beans>
public void waybilldetials(){List<Waybilldetail> list = ordersBiz.waybilldetials(sn);write(JSON.toJSONString(list));}
public List<Waybilldetail> waybilldetials(Long sn) {List<Waybilldetail> list = wayBillService.getWayBilldetails(sn);return list;}
$("#waybillBtn").bind("click",function(){if($("#sn").html()==null||$("#sn").html()==""){$.messager.alert("提示","没有物流信息");}$("#waybillWindow").window("open");$("#waybillGrid").datagrid({url:‘orders_waybilldetials.action?sn=‘+$("#sn").html(),columns:[[{field:‘exedate‘,title:‘日期‘,width:100},{field:‘exetime‘,title:‘时间‘,width:100},{field:‘info‘,title:‘信息‘,width:100}]],singleSelect:true})})
private IWayBillService wayBillService ;public void setWayBillService(IWayBillService wayBillService) {this.wayBillService = wayBillService;}private ISupplierDao supplierDao;public void setSupplierDao(ISupplierDao supplierDao) {this.supplierDao = supplierDao;}/*** 出库逻辑* @param id* @param empuuid* @param storeuuid*/public void doOutstore(Long id,Long empuuid,Long storeuuid){// 1、修改订单项状态// private java.util.Date endtime;//结束日期// private Long ender;//库管员// private Long storeuuid;//仓库编号// private String state;//状态 采购订单0未入库 1已入库 销售订单 0未出库 1已出库Orderdetail orderdetail = get(id);orderdetail.setEnder(empuuid);orderdetail.setStoreuuid(storeuuid);orderdetail.setEndtime(new Date());orderdetail.setState("1");// 2、修改库存表// 2.1 先从数据库中查询是否有此商品的记录:传的条件:仓库ID 商品IDStoredetail t1= new Storedetail();t1.setGoodsuuid(orderdetail.getGoodsuuid());t1.setStoreuuid(orderdetail.getStoreuuid());List<Storedetail> list = storedetailDao.getList(t1, null, null);// 如果有记录if (list!=null&&list.size()>0) {t1=list.get(0); // if(t1.getNum()>=0){ //如果足够出库 数量递减t1.setNum(t1.getNum()-orderdetail.getNum());//// }else{//如果数据不够出库 抛异常//// }if (t1.getNum()<0) {throw new ErpException("库存不足");}}else{throw new ErpException("这个仓库没有此商品");}// 3、添加一个流水记录// private Long uuid;//编号// private Long empuuid;//员工编号// private java.util.Date opertime;//操作日期// private Long storeuuid;//仓库编号// private Long goodsuuid;//商品编号// private Long num;//数量// private String type;//类型 1采购订单-入库 2销售订单--出库Storeoper storeoper = new Storeoper();storeoper.setEmpuuid(empuuid);storeoper.setGoodsuuid(orderdetail.getGoodsuuid());storeoper.setNum(orderdetail.getNum());storeoper.setOpertime(new Date());storeoper.setStoreuuid(storeuuid);storeoper.setType("2");storeoperDao.add(storeoper);// 4、修改订单状态// 前提条件:此订单下的所有订单项都已出库才修改订单状态// select * from orderdetail where ordersuuid=1 and state=0--有数据 表示有未出库的订单项Orders orders = orderdetail.getOrders();Orderdetail detail1 =new Orderdetail();detail1.setState("0");detail1.setOrders(orders);long count = orderdetailDao.getCount(detail1, null,null);if (count==0) {// private java.util.Date endtime;//结束日期// private Long ender;//库管员orders.setEnder(empuuid);orders.setEndtime(new Date());orders.setState("3");// private String state;//订单状态 采购订单 0为审核 1已审核 2已确认 3已结束 销售订单 0未结束 3已结束Supplier supplier = supplierDao.get(orders.getSupplieruuid());List<Orderdetail> orderdetails = orders.getOrderdetails();String info="";for (Orderdetail detail : orderdetails) {info+=detail.getGoodsname()+":"+detail.getNum()+" ";}Long sn = wayBillService.online(1l, supplier.getAddress(),supplier.getContact() , supplier.getTele(),info);orders.setWaybillsn(sn);}}
标签:loader throw context setw sage select 整合 min cut
原文地址:http://www.cnblogs.com/qinhelili/p/6985997.html