📄 shoptaskinfo.java
字号:
package com.saas.biz.shoptaskMgr;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.*;
import com.saas.biz.commen.commMethodMgr;
import com.saas.biz.dao.shoptaskDAO.ShoptaskExt;
import com.saas.sys.buffer.Buffers;
import com.saas.sys.dbm.Dbtable;
import com.saas.sys.exp.SaasApplicationException;
import com.saas.sys.log.Logger;
import com.saas.biz.shopneedMgr.ShopneedInfo;
import com.saas.biz.custMgr.Custinfo;
import com.saas.biz.motorcadeMgr.MotorCadeInfo;
import com.saas.biz.carMgr.CarInfo;
public class ShoptaskInfo {
Logger log;
Buffers inBuffer;
Buffers outBuffer;
Dbtable tradeQuery;
commMethodMgr commen;
ArrayList queryResult = new ArrayList();
public ShoptaskInfo() {
log = new Logger(this);
tradeQuery = new Dbtable();
commen = new commMethodMgr();
outBuffer = new Buffers();
}
public void setOutBuffer(Buffers outBuffer) {
this.outBuffer = outBuffer;
}
public Buffers getOutBuffer() {
return this.outBuffer;
}
public void setTradeQuery(Dbtable tradeQuery) {
this.tradeQuery = tradeQuery;
}
public Dbtable getTradeQuery() {
return this.tradeQuery;
}
public ArrayList getQueryResult() {
return this.queryResult;
}
public void setQueryResult(ArrayList queryResult) {
this.queryResult = queryResult;
}
public void addShoptask(Buffers inbuffer) {
log.LOG_INFO("进入addShoptask方法...");
this.outBuffer = inbuffer;
String cust_id = inbuffer.getString("SESSION_CUST_ID");
String shopo_id2 = inbuffer.getString("SHOPO_ID");
String task_title = inbuffer.getString("TASK_TITLE");
String task_obj_id = inbuffer.getString("TASK_OBJ_ID");
String state_code = inbuffer.getString("STATE_CODE");
String state_code_date = inbuffer.getString("STATE_CODE_DATE");
String user_id = inbuffer.getString("SESSION_USER_ID");
String publish_date = inbuffer.getString("PUBLISH_DATE");
String remark = inbuffer.getString("REMARK");
String shopo_id = "";
ShopneedInfo needInfo = new ShopneedInfo();
StringTokenizer shopo_id1 = new StringTokenizer(shopo_id2, "|");
commMethodMgr comm = new commMethodMgr();
String task_id = comm.GenTradeId();
int iResult = -1;
try {
while (shopo_id1.hasMoreTokens()) {
shopo_id = shopo_id1.nextToken();
ArrayList list = needInfo.getOneShopNeed(cust_id, shopo_id);
String pre_date = "", act_date = "", from_addr = "", to_addr = "", ship_type = "", task_num = "", unit = "";
if (list != null && list.size() > 0) {
HashMap needMap = (HashMap) list.get(0);
if (needMap.get("pre_date") != null) {
pre_date = needMap.get("pre_date").toString();
}
if (needMap.get("act_date") != null) {
act_date = needMap.get("act_date").toString();
}
if (needMap.get("from_addr") != null) {
from_addr = needMap.get("from_addr").toString();
}
if (needMap.get("to_addr") != null) {
to_addr = needMap.get("to_addr").toString();
}
if (needMap.get("ship_type") != null) {
ship_type = needMap.get("ship_type").toString();
}
if (needMap.get("need_num") != null) {
task_num = needMap.get("need_num").toString();
}
if (needMap.get("unit") != null) {
unit = needMap.get("unit").toString();
}
}
iResult = addShoptask(cust_id, shopo_id, task_id, task_title,
task_obj_id, pre_date, act_date, from_addr, to_addr,
ship_type, task_num, unit, state_code, state_code_date,
user_id, publish_date, remark);
}
} catch (SaasApplicationException e) {
log.LOG_INFO(e.getMessage());
}
if (iResult != 0) {
this.outBuffer.setInt("RESULT_CODE", -1);
this.outBuffer.setString("RESULT_INFO", "业务处理失败!");
} else {
this.outBuffer.setInt("RESULT_CODE", 0);
this.outBuffer.setString("RESULT_INFO", "业务处理成功!");
}
log.LOG_INFO("退出addShoptask方法...");
}
public int addShoptask(String cust_id, String shopo_id, String task_id,
String task_title, String task_obj_id, String pre_date,
String act_date, String from_addr, String to_addr,
String ship_type, String task_num, String unit, String state_code,
String state_code_date, String user_id, String publish_date,
String remark) throws SaasApplicationException {
ShoptaskExt shoptaskExt = new ShoptaskExt();
shoptaskExt.setParam(":VCUST_ID", cust_id);
shoptaskExt.setParam(":VSHOPO_ID", shopo_id);
shoptaskExt.setParam(":VTASK_ID", task_id);
shoptaskExt.setParam(":VTASK_TITLE", task_title);
shoptaskExt.setParam(":VTASK_OBJ_ID", task_obj_id);
shoptaskExt.setParam(":VPRE_DATE", pre_date);
shoptaskExt.setParam(":VACT_DATE", act_date);
shoptaskExt.setParam(":VFROM_ADDR", from_addr);
shoptaskExt.setParam(":VTO_ADDR", to_addr);
shoptaskExt.setParam(":VSHIP_TYPE", ship_type);
shoptaskExt.setParam(":VTASK_NUM", task_num);
shoptaskExt.setParam(":VUNIT", unit);
shoptaskExt.setParam(":VSTATE_CODE", state_code);
shoptaskExt.setParam(":VSTATE_CODE_DATE", state_code_date);
shoptaskExt.setParam(":VUSER_ID", user_id);
shoptaskExt.setParam(":VPUBLISH_DATE", publish_date);
shoptaskExt.setParam(":VREMARK", remark);
tradeQuery.executeBy(shoptaskExt.insBy("INS_SHOPTASK_ALL"));
return 0;
}
public void updateShoptask(Buffers inbuffer)
throws SaasApplicationException {
log.LOG_INFO("进入updateShoptask方法...");
this.outBuffer = inbuffer;
String cust_id = inbuffer.getString("SESSION_CUST_ID");
String shopo_id2 = inbuffer.getString("SHOPO_ID");
String task_id = inbuffer.getString("TASK_ID");
String task_title1 = inbuffer.getString("TASK_TITLE");
String task_title = "";
task_title = getOneShopTaskTitle(cust_id, task_title1);
String task_obj_id = inbuffer.getString("TASK_OBJ_ID");
String remark = inbuffer.getString("REMARK");
int iResult = -1;
String shopo_id = "";
StringTokenizer shopo_id1 = new StringTokenizer(shopo_id2, "|");
try {
while (shopo_id1.hasMoreTokens()) {
shopo_id = shopo_id1.nextToken();
iResult = updateShoptask(cust_id, shopo_id, task_id,
task_title, task_obj_id, remark);
}
} catch (SaasApplicationException e) {
log.LOG_INFO(e.getMessage());
}
if (iResult != 0) {
this.outBuffer.setInt("RESULT_CODE", -1);
this.outBuffer.setString("RESULT_INFO", "业务处理失败!");
} else {
this.outBuffer.setInt("RESULT_CODE", 0);
this.outBuffer.setString("RESULT_INFO", "业务处理成功!");
}
log.LOG_INFO("退出updateShoptask方法...");
}
public int updateShoptask(String cust_id, String shopo_id, String task_id,
String task_title, String task_obj_id, String remark)
throws SaasApplicationException {
ShoptaskExt shoptaskExt = new ShoptaskExt();
shoptaskExt.setParam(":VCUST_ID", cust_id);
shoptaskExt.setParam(":VSHOPO_ID", shopo_id);
shoptaskExt.setParam(":VTASK_ID", task_id);
shoptaskExt.setParam(":VTASK_TITLE", task_title);
shoptaskExt.setParam(":VTASK_OBJ_ID", task_obj_id);
shoptaskExt.setParam(":VREMARK", remark);
tradeQuery.executeBy(shoptaskExt.insBy("UPDATE_SHOPTASK"));
return 0;
}
public void delOneShoptask(Buffers inbuffer) {
log.LOG_INFO("进入delOneShoptask方法...");
this.outBuffer = inbuffer;
String cust_id = inbuffer.getString("SESSION_CUST_ID");
String task_id = inbuffer.getString("TASK_ID");
String need_id2 = inbuffer.getString("NEED_ID");
StringTokenizer need_id1 = new StringTokenizer(need_id2, "|");
String need_id = "";
int iResult = -1;
try {
while (need_id1.hasMoreTokens()) {
need_id = need_id1.nextToken();
iResult = delOneShoptask(cust_id, task_id, need_id);
}
} catch (SaasApplicationException e) {
log.LOG_INFO(e.getMessage());
}
if (iResult != 0) {
this.outBuffer.setInt("RESULT_CODE", -1);
this.outBuffer.setString("RESULT_INFO", "业务处理失败!");
} else {
this.outBuffer.setInt("RESULT_CODE", 0);
this.outBuffer.setString("RESULT_INFO", "业务处理成功!");
}
log.LOG_INFO("退出delOneShoptask方法...");
}
public int delOneShoptask(String cust_id, String task_id, String need_id)
throws SaasApplicationException {
ShoptaskExt shoptaskExt = new ShoptaskExt();
shoptaskExt.setParam(":VCUST_ID", cust_id);
shoptaskExt.setParam(":VTASK_ID", task_id);
shoptaskExt.setParam(":VNEED_ID", need_id);
tradeQuery.executeBy(shoptaskExt.insBy("DEL_ONE_SHOPTASK"));
return 0;
}
public void delOnlyShoptask(Buffers inbuffer) {
log.LOG_INFO("进入delOneShoptask方法...");
this.outBuffer = inbuffer;
String cust_id = inbuffer.getString("SESSION_CUST_ID");
String task_id = inbuffer.getString("TASK_ID");
int iResult = -1;
try {
iResult = delOnlyShoptask(cust_id, task_id);
} catch (SaasApplicationException e) {
log.LOG_INFO(e.getMessage());
}
if (iResult != 0) {
this.outBuffer.setInt("RESULT_CODE", -1);
this.outBuffer.setString("RESULT_INFO", "业务处理失败!");
} else {
this.outBuffer.setInt("RESULT_CODE", 0);
this.outBuffer.setString("RESULT_INFO", "业务处理成功!");
}
log.LOG_INFO("退出delOneShoptask方法...");
}
public int delOnlyShoptask(String cust_id, String task_id)
throws SaasApplicationException {
ShoptaskExt shoptaskExt = new ShoptaskExt();
shoptaskExt.setParam(":VCUST_ID", cust_id);
shoptaskExt.setParam(":VTASK_ID", task_id);
tradeQuery.executeBy(shoptaskExt.insBy("DEL_ONLY_SHOPTASK"));
return 0;
}
public ArrayList getAllShoptaskByCustId(String cust_id, int iStart,
String state_code) throws SaasApplicationException {
ArrayList list = new ArrayList();
ShoptaskExt shoptaskExt = new ShoptaskExt();
try {
iStart = iStart * 20;
shoptaskExt.setParam(":VCUST_ID", cust_id);
shoptaskExt.setParam(":VSTATE_CODE", state_code);
list = shoptaskExt.selByList("SEL_ALL_SHOPTASK", iStart, 20);
} catch (RuntimeException e) {
log.LOG_INFO(e.getMessage());
}
return list;
}
public int getAllShoptaskByCustId(String cust_id, String state_code)
throws SaasApplicationException {
int count = 0;
ArrayList list = new ArrayList();
ShoptaskExt shoptaskExt = new ShoptaskExt();
try {
shoptaskExt.setParam(":VCUST_ID", cust_id);
shoptaskExt.setParam(":VSTATE_CODE", state_code);
list = shoptaskExt.selByList("SEL_ALL_SHOPTASK");
} catch (RuntimeException e) {
log.LOG_INFO(e.getMessage());
}
if (list != null && list.size() > 0) {
count = list.size();
}
return count;
}
public ArrayList getOneShopTask(String cust_id, String task_id, int iStart)
throws SaasApplicationException {
ArrayList list = new ArrayList();
ShoptaskExt shoptaskExt = new ShoptaskExt();
try {
iStart = iStart * 20;
shoptaskExt.setParam(":VCUST_ID", cust_id);
shoptaskExt.setParam(":VTASK_ID", task_id);
list = shoptaskExt.selByList("SEL_ONE_SHOPTASK", iStart, 20);
} catch (RuntimeException e) {
log.LOG_INFO(e.getMessage());
}
return list;
}
public String getOneShopTaskTitle(String cust_id, String task_id)
throws SaasApplicationException {
ArrayList list = new ArrayList();
ShoptaskExt shoptaskExt = new ShoptaskExt();
HashMap map = new HashMap();
shoptaskExt.setParam(":VCUST_ID", cust_id);
shoptaskExt.setParam(":VTASK_ID", task_id);
list = shoptaskExt.selByList("SEL_ONE_SHOPTASK");
String tast_title = "";
if (list != null && list.size() > 0) {
map = (HashMap) list.get(0);
if (map.get("tast_title") != null) {
tast_title = map.get("tast_title").toString();
}
}
return tast_title;
}
public HashMap getDwrOneShopTask(String cust_id, String task_id)
throws SaasApplicationException {
Custinfo custInfo = new Custinfo();
CarInfo carInfo = new CarInfo();
MotorCadeInfo motor = new MotorCadeInfo();
ArrayList list = new ArrayList();
HashMap map = new HashMap();
ShoptaskExt shoptaskExt = new ShoptaskExt();
try {
shoptaskExt.setParam(":VCUST_ID", cust_id);
shoptaskExt.setParam(":VTASK_ID", task_id);
list = shoptaskExt.selByList("SEL_ONE_SHOPTASK");
} catch (RuntimeException e) {
log.LOG_INFO(e.getMessage());
}
HashMap map1 = new HashMap();
String task_obj_id = "", remark = "", task_obj_id1 = "";
if (list != null && list.size() > 0) {
map = (HashMap) list.get(0);
if (map.get("task_obj_id") != null) {
task_obj_id = map.get("task_obj_id").toString();
}
if (map.get("remark") != null) {
remark = map.get("remark").toString();
}
map1.put("task_obj_id", task_obj_id);
map1.put("remark", remark);
String delims = "[|]";
String dd[] = task_obj_id.split(delims);
if (dd[0].equals("1")) {
task_obj_id1 = "客户:" + custInfo.getCustNameById(dd[1]);
} else if (dd[0].equals("2")) {
task_obj_id1 = "车队名称:" + motor.getMotorCadeNameById(dd[1]);
} else if (dd[0].equals("3")) {
task_obj_id1 = "车辆车牌号:" + carInfo.getCarTagNoById(dd[1]);
}
map1.put("task_obj_id1", task_obj_id1);
}
return map1;
}
public int getOneShopTask(String cust_id, String task_id)
throws SaasApplicationException {
int count = 0;
ArrayList list = new ArrayList();
ShoptaskExt shoptaskExt = new ShoptaskExt();
try {
shoptaskExt.setParam(":VCUST_ID", cust_id);
shoptaskExt.setParam(":VTASK_ID", task_id);
list = shoptaskExt.selByList("SEL_ONE_SHOPTASK");
} catch (RuntimeException e) {
log.LOG_INFO(e.getMessage());
}
if (list != null && list.size() > 0) {
count = list.size();
}
return count;
}
public String getSelectByCustId(String cust_id)
throws SaasApplicationException {
ArrayList list = new ArrayList();
ShoptaskExt shoptaskExt = new ShoptaskExt();
try {
shoptaskExt.setParam(":VCUST_ID", cust_id);
list = shoptaskExt.selByList("SEL_SELECT_BY_CUST_ID");
} catch (RuntimeException e) {
log.LOG_INFO(e.getMessage());
}
HashMap map = new HashMap();
String task_title = "", task_id = "", str = "";
if (list != null && list.size() > 0) {
for (int i = 0; i < list.size(); i++) {
map = (HashMap) list.get(i);
if (map.get("task_title") != null) {
task_title = map.get("task_title").toString();
}
if (map.get("task_id") != null) {
task_id = map.get("task_id").toString();
}
str += "<option value=" + task_id + ">" + task_title
+ "</option>";
}
}
return str;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -