📄 orderhelper.java
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi
// Source File Name: OrderHelper.java
package com.keyshop.shop.order.util;
import com.keyshop.pub.bo.PubHibernate;
import com.keyshop.pub.util.DateUtil;
import com.keyshop.pub.util.StringUtil;
import com.keyshop.shop.order.bo.*;
import com.keyshop.shop.order.model.*;
import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;
public class OrderHelper
{
public static int ISINTEGRAL_TRUE = 1;
public static int ISINTEGRAL_FALSE = 0;
public static String NO_DEAL_STATUS;
public static String DEAL_STATUS;
public static String FIT_NOGET_STATUS;
public static String GET_NOFIT_STATUS;
public static String GET_FIT_STATUS;
public static String CANCEL_FIT_STATUS;
public static String FAIL_STATUS;
public static Map statusNames;
public static String PAYAREA = "select id, name from shiparea";
public static String SHIPTYPE = "select SHIPTYPEID, name from shiptype";
public static final String ACCESSNUMBER = "access_number";
public static List getNextStatus(String currentStatus)
{
List list = new ArrayList();
if(NO_DEAL_STATUS.equals(currentStatus))
{
list.add(DEAL_STATUS);
list.add(FAIL_STATUS);
} else
if(DEAL_STATUS.equals(currentStatus))
{
list.add(FIT_NOGET_STATUS);
list.add(GET_NOFIT_STATUS);
} else
if(FIT_NOGET_STATUS.equals(currentStatus))
list.add(GET_FIT_STATUS);
else
if(GET_NOFIT_STATUS.equals(currentStatus))
list.add(GET_FIT_STATUS);
else
if(GET_FIT_STATUS.equals(currentStatus))
list.add(CANCEL_FIT_STATUS);
return list;
}
public OrderHelper()
{
}
public static void sendMail(String serverAddress, String user, String pwd, String from, String subject, String emailReceiver, String htmlContents)
{
try
{
Properties props = System.getProperties();
props.put("mail.smtp.auth", "true");
Session session = Session.getDefaultInstance(props, null);
Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(from));
InternetAddress address[] = {
new InternetAddress(emailReceiver)
};
msg.setRecipients(javax.mail.Message.RecipientType.TO, address);
msg.setSubject(subject);
Multipart mp = new MimeMultipart();
BodyPart bp = new MimeBodyPart();
bp.setContent(htmlContents, "text/html;charset=UTF-8");
mp.addBodyPart(bp);
msg.setSentDate(new Date());
msg.saveChanges();
Transport trans = session.getTransport("smtp");
trans.connect(serverAddress, user, pwd);
if(trans.isConnected())
{
trans.sendMessage(msg, msg.getAllRecipients());
trans.close();
}
}
catch(Exception exception) { }
}
public static PayType getPayType(String payTypeId)
{
if(payTypeId == null || payTypeId.length() <= 0)
return null;
PayType payType = null;
try
{
PayTypeBO bo = new PayTypeBO();
payType = (PayType)bo.get(payTypeId);
}
catch(Exception exception) { }
return payType;
}
public static List getPayTypes()
{
List shipTypes = null;
try
{
PayTypeBO bo = new PayTypeBO();
String sql = "from PayType";
shipTypes = bo.list(sql);
}
catch(Exception exception) { }
return shipTypes;
}
public static List getPayTypesByShipTypeId(String shipId)
{
if(StringUtil.isEmpty(shipId))
return null;
List searchResult = null;
try
{
PayTypeBO bo = new PayTypeBO();
String sql = "select distinct a.id, a.name, a.note, a.isnet from PayType a, ShipPayRelation b";
sql = sql + " where a.id=b.payTypeId and b.shipTypeId='" + shipId + "'";
searchResult = bo.list(sql);
if(searchResult != null && searchResult.size() > 0)
{
List returnList = new ArrayList();
for(int i = 0; i < searchResult.size(); i++)
{
PayType p = new PayType();
Object o[] = (Object[])searchResult.get(i);
if(o[0] != null)
p.setId((String)o[0]);
if(o[1] != null)
p.setName((String)o[1]);
if(o[2] != null)
p.setNote((String)o[2]);
if(o[3] != null)
p.setIsnet(((Boolean)o[3]).booleanValue());
returnList.add(p);
}
return returnList;
}
}
catch(Exception exception) { }
return null;
}
public static List getShipTypes()
{
List shipTypes = null;
try
{
ShipTypeBO bo = new ShipTypeBO();
String sql = "from ShipType";
shipTypes = bo.list(sql);
}
catch(Exception exception) { }
return shipTypes;
}
public static ShipType getShipType(String shipTypeId)
{
if(shipTypeId == null || shipTypeId.length() <= 0)
return null;
ShipType shipType = null;
try
{
ShipTypeBO bo = new ShipTypeBO();
shipType = (ShipType)bo.get(shipTypeId);
}
catch(Exception exception) { }
return shipType;
}
public static String createOrderNo()
{
String sheetId = "";
try
{
OrderBO bo = new OrderBO();
sheetId = getSheetNo(bo, DateUtil.getNoSpSysDateString() + DateUtil.getCurrentHourAndMinuteString(), 1);
}
catch(Exception exception) { }
return sheetId;
}
public static String getSheetNo(PubHibernate bo, String head, int sheetIdNo)
throws Exception
{
String sheetId = head + convertSheetIdNo(sheetIdNo);
if(bo.get(sheetId) != null)
return getSheetNo(bo, head, ++sheetIdNo);
else
return sheetId;
}
public static String convertSheetIdNo(int sheetIdNo)
{
String no = String.valueOf(sheetIdNo);
String sheetId = "";
int zeroNumbers = 0;
if(no.length() < 2)
zeroNumbers = 2 - no.length();
for(int i = 0; i < zeroNumbers; i++)
sheetId = sheetId + "0";
return sheetId + no;
}
public static boolean isInPayType(List payTypes, String payTypeId)
{
if(payTypes == null || payTypes.size() <= 0)
return false;
for(int i = 0; i < payTypes.size(); i++)
{
PayType p = (PayType)payTypes.get(i);
if(p.getId().equals(payTypeId))
return true;
}
return false;
}
public static void addTrace(Order order, String creator, String orderId, String operate, String status)
throws Exception
{
OrderTracerBO otbo = new OrderTracerBO();
OrderTracer t = new OrderTracer();
t.setCreateDate(DateUtil.getSysDateTimeString());
t.setCreator(creator);
t.setOrderId(orderId);
t.setOperate(operate);
t.setStatus(status);
t.setOrder(order);
order.getTraces().add(t);
}
public static Order getOrderById(String orderId)
{
if(!StringUtil.isEmpty(orderId))
return null;
try
{
OrderBO bo = new OrderBO();
Order order = (Order)bo.get(orderId);
return order;
}
catch(Exception ex)
{
ex.printStackTrace();
}
return null;
}
static
{
NO_DEAL_STATUS = "101";
DEAL_STATUS = "102";
FIT_NOGET_STATUS = "103";
GET_NOFIT_STATUS = "104";
GET_FIT_STATUS = "105";
CANCEL_FIT_STATUS = "106";
FAIL_STATUS = "107";
statusNames = new HashMap();
statusNames.put(NO_DEAL_STATUS, "未审核");
statusNames.put(DEAL_STATUS, "已审核");
statusNames.put(FIT_NOGET_STATUS, "已发货未收款");
statusNames.put(GET_NOFIT_STATUS, "已收款未发货");
statusNames.put(GET_FIT_STATUS, "成功订单");
statusNames.put(CANCEL_FIT_STATUS, "退货订单");
statusNames.put(FAIL_STATUS, "失败订单");
Set set = statusNames.keySet();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -