|
|
|
@ -69,33 +69,42 @@ public class SzOrderUtils { |
|
|
|
* @param use_isli |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public static boolean checkOrder(Goods goods, GoodsDetail goodsDetail,String use_isli){ |
|
|
|
public static String checkOrder(Goods goods, GoodsDetail goodsDetail,String use_isli){ |
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
// 非工作时间购买
|
|
|
|
Calendar calendar= Calendar.getInstance(); |
|
|
|
int hour = calendar.get(Calendar.HOUR); |
|
|
|
//返回的字符串
|
|
|
|
String retStr=null; |
|
|
|
|
|
|
|
if (hour<9 && hour>18) { |
|
|
|
throw new ChException("非正常交易日时间,请在交易日内进行交易,交易日时间为周一至周日9:00-18:00",400); |
|
|
|
retStr="非正常交易日时间,请在交易日内进行交易,交易日时间为周一至周日9:00-18:00"; |
|
|
|
return retStr; |
|
|
|
} |
|
|
|
if(goods.getApplyOut()==1){ |
|
|
|
throw new ChException("该标的已撤销,标的ISLI标识码:"+goods.getGoodsIslicode(), 400); |
|
|
|
retStr="该标的已撤销,标的ISLI标识码:"+goods.getGoodsIslicode(); |
|
|
|
return retStr; |
|
|
|
} |
|
|
|
if(goods.getUserIslicode().equals(use_isli)){ |
|
|
|
throw new ChException("您是标的的授权方,不可购买,标的ISLI标识码:"+goods.getGoodsIslicode(), 400); |
|
|
|
retStr="您是标的的授权方,不可购买,标的ISLI标识码:"+goods.getGoodsIslicode(); |
|
|
|
return retStr; |
|
|
|
} |
|
|
|
if(goods.getGoodsStatus()!= 1){ |
|
|
|
throw new ChException("该标的现不在上架中,标的ISLI标识码:"+goods.getGoodsIslicode(), 400); |
|
|
|
retStr="该标的现不在上架中,标的ISLI标识码:"+goods.getGoodsIslicode(); |
|
|
|
return retStr; |
|
|
|
} |
|
|
|
if(goodsDetail.getStock()<=0 && goodsDetail.getGoodsEntrust()== 1){ |
|
|
|
throw new ChException("标的库存为0,不可购买,标的ISLI标识码:"+goods.getGoodsIslicode(), 400); |
|
|
|
retStr="标的库存为0,不可购买,标的ISLI标识码:"+goods.getGoodsIslicode(); |
|
|
|
return retStr; |
|
|
|
} |
|
|
|
if(goodsDetail.getContractualPeriod()==3){ |
|
|
|
Date now =new Date(); |
|
|
|
if(now.compareTo(goods.getContractualtimeEndTime()) >0){ |
|
|
|
throw new ChException("标的委托已结束,标的ISLI标识码:"+goods.getGoodsIslicode(), 400); |
|
|
|
retStr="标的委托已结束,标的ISLI标识码:"+goods.getGoodsIslicode(); |
|
|
|
return retStr; |
|
|
|
} |
|
|
|
} |
|
|
|
return true; |
|
|
|
return retStr; |
|
|
|
} |
|
|
|
/** |
|
|
|
* 组装成订单用户 |
|
|
|
|