Compare commits

...

2 Commits

33 changed files with 8098 additions and 0 deletions

View File

@ -0,0 +1,8 @@
package com.api.bokang.xiao.zscq.entity;/**
*@ClassName SendFileEntity
*@Author
*@Date 2023/4/23 10:10
*@Description <h1></h1>
**/
public class SendFileEntity {
}

View File

@ -0,0 +1,8 @@
package com.api.bokang.xiao.zscq.entity;/**
*@ClassName WeaverFile
*@Author
*@Date 2023/4/23 10:09
*@Description <h1></h1>
**/
public class WeaverFile {
}

View File

@ -0,0 +1,8 @@
package com.api.bokang.xiao.zscq.mapper;/**
*@ClassName QueryMapper
*@Author
*@Date 2023/4/23 10:14
*@Description <h1></h1>
**/
public interface QueryMapper {
}

View File

@ -0,0 +1,584 @@
package com.api.interfaces.liyi;
import com.alibaba.fastjson.JSON;
import com.api.interfaces.liyi.common.ApiResult;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Path("/xsd/DataCenterApi")
public class DataCenterApi extends BaseBean {
@GET
@Path("/getCompInfo")
@Produces(MediaType.TEXT_PLAIN)
public String getCompInfo(@Context HttpServletRequest request, @Context HttpServletResponse response){
ApiResult<Map<String,Object>> apiResult = new ApiResult<>();
RecordSet rs = new RecordSet();
String idCard = Util.null2String(request.getParameter("id_card"));
String tableName = getFormId("datacenter_table");
HashMap<String,Object> comMap = new HashMap<>();
try {
if(!idCard.equals("")){
String id = "";
String sql = "select top 1 * from "+tableName+" where field016 = '"+idCard+"' order by id desc";
writeLog("------sql zb------"+sql);
rs.executeQuery(sql);
if(rs.next()){
id = rs.getString("id");
String ypgw = rs.getString("field055");
String ypgw_xz = getSelectName(tableName,null,"field055",ypgw);
String djrq = rs.getString("field007");
String xm = rs.getString("field008");
String xb = rs.getString("field052");
String xb_xz = getSelectName(tableName,null,"field052",xb);
String csrq = rs.getString("field010");
String mz = rs.getString("field053");
String mz_xz = getSelectName(tableName,null,"field053",mz);
String jg = rs.getString("field056");
String jg_xz = getSelectName(tableName,null,"field056",jg);
String hy = rs.getString("field085");
String hy_xz = getSelectName(tableName,null,"field085",hy);
String zzmm = rs.getString("field054");
String zzmm_xz = getSelectName(tableName,null,"field054",zzmm);
String sj = rs.getString("field015");
String yx = rs.getString("field017");
String pro = rs.getString("field077");
String city = rs.getString("field078");
String qx = rs.getString("field079");
String xxdz = rs.getString("field080");
String xpro = rs.getString("field081");
String xcity = rs.getString("field082");
String xqx = rs.getString("field083");
String xxxdz = rs.getString("field084");
String jjlxr = rs.getString("field020");
String jjlxrgx = rs.getString("field086");
jjlxrgx = getSelectName(tableName,null,"field086",jjlxrgx);
String lxrdh = rs.getString("field022");
String english = rs.getString("field023");
english = getSelectName(tableName,null,"field023",english);
String cert = rs.getString("field061");
String eng_fj = rs.getString("field058");
String qtyz = rs.getString("field059");
String djzs = rs.getString("field062");
String qtyz_fj = rs.getString("field060");
String zyzg = rs.getString("field063");
String zyzgzs = rs.getString("field064");
String zyzg_fj = rs.getString("field065");
String qtjn = rs.getString("field066");
String bgrj = rs.getString("field067");
String qtjn_fj = rs.getString("field068");
String xqah = rs.getString("field025");
String gdxzsq = rs.getString("field026");
String qwxzsq = rs.getString("field027");
String sbyf = rs.getString("field028");
String sbnf = rs.getString("field029");
String gzlxdh = rs.getString("field030");
String zmr = rs.getString("field031");
String zmrgw = rs.getString("field032");
String sfjcldht = rs.getString("field033");
String sfjlcf = rs.getString("field034");
String sfjb = rs.getString("field035");
String sfss = rs.getString("field036");
String sfyhjkgz = rs.getString("field037");
String sfyytj = rs.getString("field038");
String sftgbszy = rs.getString("field039");
String tjrxm = rs.getString("field040");
String tjrgx = rs.getString("field041");
String bgsqs = rs.getString("field042");
String gxr = rs.getString("field046");
String gxrgx = rs.getString("field047");
String tbr = rs.getString("field048");
String sfty = rs.getString("field069");
comMap.put("ypgw",ypgw);
comMap.put("ypgw_xz",ypgw_xz);
comMap.put("djrq",djrq);
comMap.put("xm",xm);
comMap.put("xb",xb);
comMap.put("xb_xz",xb_xz);
comMap.put("csrq",csrq);
comMap.put("mz",mz);
comMap.put("mz_xz",mz_xz);
comMap.put("jg",jg);
comMap.put("jg_xz",jg_xz);
comMap.put("hy",hy);
comMap.put("hy_xz", hy_xz);
comMap.put("zzmm",zzmm);
comMap.put("zzmm_xz",zzmm_xz);
comMap.put("sj",sj);
comMap.put("yx",yx);
comMap.put("pro",pro);
comMap.put("city",city);
comMap.put("qx",qx);
comMap.put("xxdz",xxdz);
comMap.put("xpro",xpro);
comMap.put("xcity",xcity);
comMap.put("xqx",xqx);
comMap.put("xxxdz",xxxdz);
comMap.put("jjlxr",jjlxr);
comMap.put("jjlxrgx",jjlxrgx);
comMap.put("lxrdh",lxrdh);
comMap.put("english",english);
comMap.put("cert",cert);
comMap.put("eng_fj",eng_fj);
comMap.put("qtyz",qtyz);
comMap.put("djzs",djzs);
comMap.put("qtyz_fj",qtyz_fj);
comMap.put("zyzg",zyzg);
comMap.put("zyzgzs",zyzgzs);
comMap.put("zyzg_fj",zyzg_fj);
comMap.put("qtjn",qtjn);
comMap.put("bgrj",bgrj);
comMap.put("qtjn_fj",qtjn_fj);
comMap.put("xqah",xqah);
comMap.put("gdxzsq",gdxzsq);
comMap.put("qwxzsq",qwxzsq);
comMap.put("sbyf",sbyf);
comMap.put("sbnf",sbnf);
comMap.put("gzlxdh",gzlxdh);
comMap.put("zmr",zmr);
comMap.put("zmrgw",zmrgw);
comMap.put("sfjcldht",sfjcldht);
comMap.put("sfjlcf",sfjlcf);
comMap.put("sfjb",sfjb);
comMap.put("sfss",sfss);
comMap.put("sfyhjkgz",sfyhjkgz);
comMap.put("sfyytj",sfyytj);
comMap.put("sftgbszy",sftgbszy);
comMap.put("tjrxm",tjrxm);
comMap.put("tjrgx",tjrgx);
comMap.put("bgsqs",bgsqs);
comMap.put("gxr",gxr);
comMap.put("gxrgx",gxrgx);
comMap.put("sfty",sfty);
comMap.put("tbr",tbr);
}
List<HashMap<String,String>> dt1_list = new ArrayList<>();
sql = "select * from "+tableName+"_dt1 where mainid = '"+id+"'";
writeLog("------sql dt1------"+sql);
rs.executeQuery(sql);
while(rs.next()){
HashMap<String,String> dt1_map = new HashMap<>();
String xl = rs.getString("field008");
String xl_xz = getSelectName(tableName,tableName+"_dt1","field008",xl);
String start = rs.getString("field009");
String end = rs.getString("field010");
String xx = rs.getString("field004");
String zy = rs.getString("field005");
String xxxs = rs.getString("field011");
String xxxs_xz = getSelectName(tableName,tableName+"_dt1","field011",xxxs);
String xw = rs.getString("field012");
String xw_xz = getSelectName(tableName,tableName+"_dt1","field012",xw);
dt1_map.put("xl",xl);
dt1_map.put("xl_xz",xl_xz);
dt1_map.put("start",start);
dt1_map.put("end",end);
dt1_map.put("xx",xx);
dt1_map.put("zy",zy);
dt1_map.put("xxxs",xxxs);
dt1_map.put("xxxs_xz",xxxs_xz);
dt1_map.put("xw",xw);
dt1_map.put("xw_xz",xw_xz);
dt1_list.add(dt1_map);
}
writeLog("------sql dt1--data----"+dt1_list.toString());
comMap.put("dt1",dt1_list);
List<HashMap<String,String>> dt2_list = new ArrayList<>();
sql = "select * from "+tableName+"_dt2 where mainid = '"+id+"'";
rs.executeQuery(sql);
writeLog("------sql dt2------"+sql);
while(rs.next()){
HashMap<String,String> dt2_map = new HashMap<>();
String start = rs.getString("field008");
String end = rs.getString("field009");
String gzdw = rs.getString("field003");
String gzdwdz = rs.getString("field004");
String gw = rs.getString("field005");
String lzyy = rs.getString("field006");
String lxdh = rs.getString("field007");
dt2_map.put("start",start);
dt2_map.put("end",end);
dt2_map.put("gzdw",gzdw);
dt2_map.put("gzdwdz",gzdwdz);
dt2_map.put("gw",gw);
dt2_map.put("lzyy",lzyy);
dt2_map.put("lxdh",lxdh);
dt2_list.add(dt2_map);
}
writeLog("------sql dt2--data----"+dt2_list.toString());
comMap.put("dt2",dt2_list);
List<HashMap<String,String>> dt3_list = new ArrayList<>();
sql = "select * from "+tableName+"_dt3 where mainid = '"+id+"'";
writeLog("------sql dt3-----"+sql);
rs.executeQuery(sql);
while(rs.next()){
HashMap<String,String> dt3_map = new HashMap<>();
String xm = rs.getString("field001");
String gx = rs.getString("field005");
String gx_xz = getSelectName(tableName,tableName+"_dt3","field005",gx);
String nl = rs.getString("field003");
String gzdw = rs.getString("field004");
dt3_map.put("xm",xm);
dt3_map.put("gx",gx);
dt3_map.put("gx_xz",gx_xz);
dt3_map.put("nl",nl);
dt3_map.put("gzdw",gzdw);
dt3_list.add(dt3_map);
}
writeLog("------sql dt3--data----"+dt3_list.toString());
comMap.put("dt3",dt3_list);
List<HashMap<String,String>> dt4_list = new ArrayList<>();
sql = "select * from "+tableName+"_dt4 where mainid = '"+id+"'";
writeLog("------sql dt4------"+sql);
rs.executeQuery(sql);
while(rs.next()){
HashMap<String,String> dt4_map = new HashMap<>();
String yz = rs.getString("field001");
String cert = rs.getString("field002");
dt4_map.put("qtyz",yz);
dt4_map.put("djzs",cert);
dt4_list.add(dt4_map);
}
writeLog("------sql dt4--data----"+dt4_list.toString());
comMap.put("dt4",dt4_list);
List<HashMap<String,String>> dt5_list = new ArrayList<>();
sql ="select * from "+tableName+"_dt5 where mainid = '"+id+"'";
writeLog("------sql dt5------"+sql);
rs.executeQuery(sql);
while(rs.next()){
HashMap<String,String> dt5_map = new HashMap<>();
String zgzs = rs.getString("field001");
String bgrj = rs.getString("field002");
dt5_map.put("zgzs",zgzs);
dt5_map.put("bgrj",bgrj);
dt5_list.add(dt5_map);
}
writeLog("------sql dt5--data----"+dt5_list.toString());
comMap.put("dt5",dt5_list);
List<HashMap<String,String>> dt6_list = new ArrayList<>();
sql = "select * from "+tableName+"_dt6 where mainid = '"+id+"'";
writeLog("------sql dt6------"+sql);
rs.executeQuery(sql);
while(rs.next()){
HashMap<String,String> dt6_map = new HashMap<>();
String wbk = rs.getString("field001");
dt6_map.put("wbk",wbk);
dt6_list.add(dt6_map);
}
writeLog("------sql dt6--data----"+dt6_list.toString());
comMap.put("dt6",dt6_list);
List<HashMap<String,String>> dt7_list = new ArrayList<>();
sql = "select * from "+tableName+"_dt7 where mainid = '"+id+"'";
writeLog("------sql dt7------"+sql);
rs.executeQuery(sql);
while(rs.next()){
HashMap<String,String> dt7_map = new HashMap<>();
String kcmc = rs.getString("field001");
String ksrq = rs.getString("field002");
String jsrq = rs.getString("field003");
dt7_map.put("kcmc",kcmc);
dt7_map.put("ksrq",ksrq);
dt7_map.put("jsrq",jsrq);
dt7_list.add(dt7_map);
}
writeLog("------sql dt7--data----"+dt7_list.toString());
comMap.put("dt7",dt7_list);
List<HashMap<String,String>> dt8_list = new ArrayList<>();
sql = "select * from "+tableName+"_dt8 where mainid = '"+id+"'";
writeLog("------sql dt8------"+sql);
rs.executeQuery(sql);
while(rs.next()){
HashMap<String,String> dt8_map = new HashMap<>();
String jlqk = rs.getString("field001");
String jlqk_xz = getSelectName(tableName,tableName+"_dt8","field001",jlqk);
String nr1 = rs.getString("field002");
String nr2 = rs.getString("field003");
dt8_map.put("jlqk",jlqk);
dt8_map.put("jlqk_xz",jlqk_xz);
dt8_map.put("nr1",nr1);
dt8_map.put("nr2",nr2);
dt8_list.add(dt8_map);
}
writeLog("------sql dt8--data----"+dt8_list.toString());
comMap.put("dt8",dt8_list);
List<HashMap<String,String>> dt9_list = new ArrayList<>();
sql = "select * from "+tableName+"_dt9 where mainid = '"+id+"'";
writeLog("------sql dt9------"+sql);
rs.executeQuery(sql);
while(rs.next()){
HashMap<String,String> dt9_map = new HashMap<>();
String rq = rs.getString("field001");
String nr = rs.getString("field002");
String yy = rs.getString("field003");
String lb = rs.getString("field004");
String jb = rs.getString("field005");
String dw = rs.getString("field006");
String je = rs.getString("field007");
String bz = rs.getString("field008");
dt9_map.put("rq",rq);
dt9_map.put("nr",nr);
dt9_map.put("yy",yy);
dt9_map.put("lb",lb);
dt9_map.put("jb",jb);
dt9_map.put("dw",dw);
dt9_map.put("je",je);
dt9_map.put("bz",bz);
dt9_list.add(dt9_map);
}
writeLog("------sql dt9--data----"+dt9_list.toString());
comMap.put("dt9",dt9_list);
List<HashMap<String,String>> dt10_list = new ArrayList<>();
sql = "select * from "+tableName+"_dt10 where mainid = '"+id+"'";
writeLog("------sql dt10------"+sql);
rs.executeQuery(sql);
while(rs.next()){
HashMap<String,String> dt10_map = new HashMap<>();
String rq = rs.getString("field001");
String nr = rs.getString("field002");
String yy = rs.getString("field003");
String lb = rs.getString("field004");
String jb = rs.getString("field005");
String dw = rs.getString("field006");
String je = rs.getString("field007");
String bz = rs.getString("field008");
dt10_map.put("rq",rq);
dt10_map.put("nr",nr);
dt10_map.put("yy",yy);
dt10_map.put("lb",lb);
dt10_map.put("jb",jb);
dt10_map.put("dw",dw);
dt10_map.put("je",je);
dt10_map.put("bz",bz);
dt10_list.add( dt10_map);
}
writeLog("------sql dt10--data----"+dt10_list.toString());
comMap.put("dt10",dt10_list);
List<HashMap<String,String>> dt11_list = new ArrayList<>();
sql = "select * from "+tableName+"_dt11 where mainid = '"+id+"'";
writeLog("------sql dt11------"+sql);
rs.executeQuery(sql);
while(rs.next()){
HashMap<String,String> dt11_map = new HashMap<>();
String rq = rs.getString("field001");
String cg = rs.getString("field002");
String jg = rs.getString("field003");
String zl = rs.getString("field004");
String bz = rs.getString("field005");
dt11_map.put("rq",rq);
dt11_map.put("cg",cg);
dt11_map.put("jg",jg);
dt11_map.put("zl",zl);
dt11_map.put("bz",bz);
dt11_list.add( dt11_map);
}
writeLog("------sql dt11--data----"+dt11_list.toString());
comMap.put("dt11",dt11_list);
List<HashMap<String,String>> dt12_list = new ArrayList<>();
sql = "select * from "+tableName+"_dt12 where mainid = '"+id+"'";
writeLog("------sql dt12------"+sql);
rs.executeQuery(sql);
while(rs.next()){
HashMap<String,String> dt12_map = new HashMap<>();
String rq = rs.getString("field001");
String tm = rs.getString("field002");
String cbs = rs.getString("field003");
String mt = rs.getString("field004");
String bz = rs.getString("field005");
dt12_map.put("rq",rq);
dt12_map.put("tm",tm);
dt12_map.put("cbs",cbs);
dt12_map.put("mt",mt);
dt12_map.put("bz",bz);
dt12_list.add( dt12_map);
}
writeLog("------sql dt12--data----"+dt12_list.toString());
comMap.put("dt12",dt12_list);
List<HashMap<String,String>> dt13_list = new ArrayList<>();
sql = "select * from "+tableName+"_dt13 where mainid = '"+id+"'";
writeLog("------sql dt13------"+sql);
rs.executeQuery(sql);
while(rs.next()){
HashMap<String,String> dt13_map = new HashMap<>();
String ksrq = rs.getString("field001");
String jsrq = rs.getString("field002");
String mc = rs.getString("field003");
String je = rs.getString("field004");
String gj = rs.getString("field005");
String gjly = rs.getString("field006");
String zq = rs.getString("field007");
String zw = rs.getString("field008");
String bz = rs.getString("field009");
dt13_map.put("ksrq",ksrq);
dt13_map.put("jsrq",jsrq);
dt13_map.put("mc",mc);
dt13_map.put("je",je);
dt13_map.put("gj",gj);
dt13_map.put("gjly",gjly);
dt13_map.put("zq",zq);
dt13_map.put("zw",zw);
dt13_map.put("bz",bz);
dt13_list.add( dt13_map);
}
writeLog("------sql dt12--data----"+dt13_list.toString());
comMap.put("dt13",dt13_list);
writeLog("------sql data-----"+comMap.toString());
apiResult.success(true,comMap,"success");
}else {
apiResult.fail("id_card为空");
}
} catch (Exception e) {
e.printStackTrace();
apiResult.fail("error");
}
return JSON.toJSONString(apiResult);
}
@GET
@Path("/updateAcc")
@Produces(MediaType.TEXT_PLAIN)
public String updateAcc(@Context HttpServletRequest request, @Context HttpServletResponse response){
ApiResult<Boolean> apiResult = new ApiResult<>();
RecordSet rs = new RecordSet();
String billid = Util.null2String(request.getParameter("id"));
String tableName = getFormId("datacenter_table");
try {
//------请在下面编写业务逻辑代码------
String sql = "select * from "+tableName+" where id = '"+billid+"'";
new BaseBean().writeLog("----datacenter---sql-:"+sql);
rs.executeQuery(sql);
if(rs.next()){
String confirm = rs.getString("field051");
new BaseBean().writeLog("----datacenter---confirm--:"+confirm);
if(!confirm.equals("")){
String eng_fj1 = rs.getString("field058");
String qtyz_fj1 = rs.getString("field060");
String zyzg_fj1 = rs.getString("field065");
String qtjn_fj1 = rs.getString("field068");
String eng_fj = rs.getString("field070");
String qtyz_fj = rs.getString("field071");
String zyzg_fj = rs.getString("field072");
String qtjn_fj = rs.getString("field073");
if(!eng_fj.equals("")){
eng_fj1 += ","+eng_fj;
}
if(!qtyz_fj.equals("")){
qtyz_fj1 += ","+qtyz_fj;
}
if(!zyzg_fj.equals("")){
zyzg_fj1 += ","+zyzg_fj;
}
if(!qtjn_fj.equals("")){
qtjn_fj1 += ","+qtjn_fj;
}
sql = "update "+tableName+" set field058=?,field060=?,field065=?,field068=? where id = '"+billid+"'";
rs.executeUpdate(sql,eng_fj1,qtyz_fj1,zyzg_fj1,qtjn_fj1);
}
apiResult.success(true,true,"success");
}
} catch (Exception e) {
e.printStackTrace();
apiResult.fail("error");
}
return JSON.toJSONString(apiResult);
}
@GET
@Path("/updateData")
@Produces(MediaType.TEXT_PLAIN)
public String updateData(@Context HttpServletRequest request, @Context HttpServletResponse response){
ApiResult<Boolean> apiResult = new ApiResult<>();
RecordSet rs = new RecordSet();
String billid = Util.null2String(request.getParameter("id"));
String tableName = getFormId("datacenter_table");
try {
//------请在下面编写业务逻辑代码------
String sql = "update "+tableName+" set field076 = '正式入职' where id = '"+billid+"'";
new BaseBean().writeLog("----datacenter---sql-:"+sql);
rs.executeQuery(sql);
} catch (Exception e) {
e.printStackTrace();
apiResult.fail("error");
}
return JSON.toJSONString(apiResult);
}
public static String getFormId(String name){
RecordSet recordSet = new RecordSet();
String sql = "select cs from uf_xtpzb1 where xtbs ='"+name+"'";
recordSet.execute(sql);
if(recordSet.next()){
return recordSet.getString("cs");
}else {
return "";
}
}
/**
*
* @param maintableName
* @param detailtableName
* @param fieldName
* @param selectValue
* @return
*/
public String getSelectName(String maintableName, String detailtableName, String fieldName, String selectValue){
//writeLog("CSX--enter getSelectName");
RecordSet rs0 = new RecordSet();
String choiceBoxName = "";
StringBuffer sql= new StringBuffer();
sql.append("select t1.selectname \n");
sql.append("from workflow_SelectItem t1\n");
sql.append(", workflow_billfield t2\n");
sql.append(", workflow_bill t3\n");
sql.append(" where t1.fieldid=t2.id ");
sql.append("and t2.billid=t3.id and t3.tablename='").append(maintableName).append("'");
if(detailtableName==null){
detailtableName=" ";
//writeLog("detailtableName->"+detailtableName);
}
//writeLog("!StringUtils.isNotBlank(detailtableName)->"+!org.apache.commons.lang.StringUtils.isNotBlank(detailtableName));
if(!com.alipay.oceanbase.jdbc.StringUtils.isNotBlank(detailtableName)){
if(rs0.getDBType().equalsIgnoreCase("oracle")){//判断数据库类型是不是Oracle
sql.append(" and t2.detailtable is null\n");
}else{
sql.append(" and t2.detailtable ='' \n");
}
}else{
sql.append(" and t2.detailtable ='").append(detailtableName).append("' \n");
}
sql.append(" and t2.fieldname='").append(fieldName);
sql.append("'\n and t1.selectvalue='").append(selectValue).append("'");
//writeLog("getChoiceBoxNameSql->\n"+sql.toString());
rs0.execute(sql.toString());
if(rs0.next()){
choiceBoxName = rs0.getString("selectname");
}
//writeLog("ChoiceBoxName->"+choiceBoxName);
return choiceBoxName;
}
}

View File

@ -0,0 +1,59 @@
package com.api.interfaces.liyi.common;
public class ApiResult<T> {
private boolean success;
private String message;
private T data;
public ApiResult() {
}
public void success(boolean success, T data, String message) {
this.success = success;
this.data = data;
this.message = message;
}
public ApiResult<T> success(T data) {
this.data = data;
this.success = true;
this.message = "";
return this;
}
public ApiResult<T> fail(String message) {
this.message = message;
this.success = false;
this.data = null;
return this;
}
public boolean isSuccess() {
return this.success;
}
public void setSuccess(boolean success) {
this.success = success;
}
public String getMessage() {
return this.message;
}
public void setMessage(String message) {
this.message = message;
}
public T getData() {
return this.data;
}
public void setData(T data) {
this.data = data;
}
}

View File

@ -0,0 +1,602 @@
package com.api.interfaces.liyi.crod;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.api.interfaces.liyi.service.HuilianyiClientService;
import com.api.interfaces.liyi.service.impl.HuilianyiClientServiceImpl;
import com.engine.common.util.ServiceUtil;
import weaver.conn.RecordSet;
import weaver.formmode.exttools.impexp.common.DateUtils;
import weaver.general.BaseBean;
import weaver.general.TimeUtil;
import weaver.general.Util;
import weaver.interfaces.schedule.BaseCronJob;
import weaver.soa.workflow.request.*;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
public class HuilianyiTravelJob extends BaseCronJob {
private HuilianyiClientService getHuilianyiClientService(){
return ServiceUtil.getService(HuilianyiClientServiceImpl.class);
}
@Override
public void execute() {
try {
// RecordSet rs = new RecordSet();
// RequestService service = new RequestService();
// String nowdate = TimeUtil.getCurrentTimeString();
String ccsq_wfid = getFormId("ccsq_wfid");
String ccbg_wfid = getFormId("ccbg_wfid");
String ccsqTable = getFormId("ccsq_tablename");
String ccbgTable = getFormId("ccbg_tablename");
//String query_time = getFormId("query_time");
String currentDateTime = DateUtils.getCurrentDateTime();
String[] s = currentDateTime.split(" ");
String hour = s[1].split(":")[0];
String startTime = "";
// if(Integer.parseInt(hour)>0){
// startTime = DateUtils.getCurrentDate() + " " + query_time;
//
// }else {
// startTime = DateUtils.getCurrentDate()+ " 12:00:00";
// }
String cur_date = DateUtils.getCurrentDate();
String cur_year = cur_date.split("-")[0];
String cur_month = cur_date.split("-")[1];
startTime = cur_year+"-"+cur_month+"-"+"01 00:00:00";
//startTime = "2022-11-24 12:00:00";
/**
* token
*/
String resp = getHuilianyiClientService().getToken();
JSONObject res = JSONUtil.parseObj(resp);
List<String> resp_list = new ArrayList<>();
if(null != res.get("access_token")){
new BaseBean().writeLog("------token----:"+res.getStr("access_token"));
String token = res.getStr("access_token");
/**
*
*/
HttpResponse response1 = getHuilianyiClientService().
getTravelApplication(res.getStr("access_token"), startTime, currentDateTime, "1003,1012", "1", "100");
resp = response1.body();
String total = response1.header("X-Total-Count");
new BaseBean().writeLog("------1st resp--"+resp);
if(resp.equals("[]")){
new BaseBean().writeLog("------no resp--");
}
else {
resp_list.add(resp);
}
new BaseBean().writeLog("----total----"+total);
int page = (Integer.parseInt(total)/100) + 1;
if(page > 1){
for(int i = 2;i <= page;i++){
/**
*
*/
HttpResponse response2 = getHuilianyiClientService().
getTravelApplication(res.getStr("access_token"),startTime,currentDateTime,"1003,1012",String.valueOf(i),"100");
String resp2 = response2.body();
new BaseBean().writeLog("------either resp--"+resp2);
if(resp2.equals("[]")){
new BaseBean().writeLog("------no resp--");
}
else {
resp_list.add(resp2);
}
}
}
for (String result : resp_list) {
JSONArray jsonArray = JSONUtil.parseArray(result);
parseCreateReq(jsonArray,ccbg_wfid,ccsq_wfid,ccbgTable,ccsqTable,token);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
/**
*
* @param jsonArray
* @param ccbg_wfid
* @param ccsq_wfid
* @param ccbgTable
* @param ccsqTable
*/
private void parseCreateReq(JSONArray jsonArray, String ccbg_wfid, String ccsq_wfid, String ccbgTable, String ccsqTable,String token) {
RecordSet rs = new RecordSet();
RequestService service = new RequestService();
String nowdate = TimeUtil.getCurrentTimeString();
String tokenUrl = getFormId("hly_tokenUrl");
jsonArray.stream().map(o -> (JSONObject) o).forEach(result -> {
try {
Set<String> comp_uid = new HashSet<>();
List<String> emp_id = new ArrayList<>();
String companions = "";
JSONObject applicant = ((JSONObject) result).getJSONObject("applicant");
String status = ((JSONObject) result).getStr("status");
String employeeID =((JSONObject) applicant).getStr("employeeID");
String fullName = applicant.getStr("fullName");
JSONArray custFormValues = ((JSONObject) result).getJSONArray("custFormValues");
custFormValues.stream().map(o -> (JSONObject) o).forEach(data ->{
String fieldName = ((JSONObject) data).getStr("fieldName");
if(fieldName.equals("出差人员")){
JSONArray comp_value = ((JSONObject) data).getJSONArray("value");
comp_value.stream().map(o -> (JSONObject) o).forEach(comp ->{
String userOID = ((JSONObject) comp).getStr("userOID");
comp_uid.add(userOID);
});
}
});
if(comp_uid.size()>0){
for (String uid : comp_uid) {
HttpResponse user_res = HttpUtil.createGet(tokenUrl + "/api/open/user/"+uid)
.header("Authorization", "Bearer ".concat(token))//头信息,多个头信息多次调用此方法即可
.header("Content-Type", "application/json")
.timeout(1000 * 120)
.execute();
String user_resp = user_res.body();
//out.println("----user_resp:"+user_resp);
JSONObject compInfo = JSONUtil.parseObj(user_resp);
String empid = compInfo.getStr("employeeID");
if(empid==null){
}else {
if(!emp_id.contains(empid)){
emp_id.add(empid);
}
}
}
}
if(emp_id.size()>0){
if(emp_id.size()>1){
List<String> empids = emp_id;
for (String txr_id : empids) {
rs.executeQuery("select id from hrmresource where workcode = '"+txr_id+"'");
while (rs.next()){
if(companions.equals("")){
companions = rs.getString("id");
}else {
companions += ","+rs.getString("id");
}
}
}
}
}
String departmentNumber = ((JSONObject) result).getStr("departmentNumber");
String version = ((JSONObject) result).getStr("version");
String businessCode = ((JSONObject) result).getStr("businessCode");
Boolean closed = ((JSONObject) result).getBool("closed");
Boolean participantClosed = ((JSONObject) result).getBool("participantClosed");
JSONObject travelApplication = ((JSONObject) result).getJSONObject("travelApplication");
String startDate = travelApplication.getStr("startDate");
startDate = startDate.replace("T", " ");
startDate = startDate.replace("Z", "");
//转时区
startDate = convertDateGMT(startDate);
String endDate = travelApplication.getStr("endDate");
endDate = endDate.replace("T", " ");
endDate = endDate.replace("Z", "");
//转时区
endDate = convertDateGMT(endDate);
new BaseBean().writeLog("------result-1---:"+fullName+"---"+employeeID+"---txrids"+companions+"---"+departmentNumber+"---"+version+"---"+businessCode+"---"+startDate+"---"+endDate+"---close---"+closed+"--partclose--"+participantClosed);
String fromDate = "";
String fromTime = "";
String toDate = "";
String toTime = "";
//2022-11-17 09:00
if(startDate!=null){
fromDate = startDate.split(" ")[0];
String time = startDate.split(" ")[1];
fromTime = time.split(":")[0]+":"+time.split(":")[1];
}
if(endDate!=null){
toDate = endDate.split(" ")[0];
String time = endDate.split(" ")[1];
toTime = time.split(":")[0]+":"+time.split(":")[1];
}
String reqName_sq = "";
String reqName_bg = "";
String workflowname = "";
String req_sql = "";
String id = "";
req_sql = "select id,departmentid from hrmresource where workcode = '"+employeeID+"'";
rs.executeQuery(req_sql);
if(rs.next()){
id = rs.getString("id");
departmentNumber = rs.getString("departmentid");
}
//出差 及 变更逻辑
if(status.equals("1003")){
if(Integer.parseInt(version)==0){
req_sql = "select workflowname from workflow_base where id = '"+ccsq_wfid+"'";
rs.executeQuery(req_sql);
while (rs.next()){
workflowname = rs.getString("workflowname");
}
reqName_sq = workflowname+"-"+fullName+"-"+ DateUtils.getCurrentDate();
Map<String, String> mainTable = new HashMap<>();
mainTable.put("resourceId",id);
mainTable.put("gh",employeeID);
mainTable.put("departmentId",departmentNumber);
mainTable.put("fromDate",fromDate);
mainTable.put("fromTime",fromTime);
mainTable.put("toDate",toDate);
mainTable.put("toTime",toTime);
mainTable.put("status","1003");
mainTable.put("version",version);
mainTable.put("sqdh",businessCode);
mainTable.put("companion",companions);
new BaseBean().writeLog("------data---"+mainTable.toString());
req_sql = "select count(id) as count from "+ccsqTable+" where sqdh = '"+businessCode+"' and version = 0";
rs.executeQuery(req_sql);
if(rs.next()){
int count = rs.getInt("count");
if(count==0){
String reqId = creatRequest("1", ccsq_wfid, reqName_sq, false, mainTable, null);
RequestInfo request = service.getRequest(Integer.valueOf(reqId));
Boolean submit = service.nextNodeBySubmit(request, Integer.valueOf(reqId), 1, nowdate);
if (submit) {
new BaseBean().writeLog(reqId + "提交成功");
} else {
new BaseBean().writeLog(reqId + "流程提交异常");
}
}
}
}
else if(Integer.parseInt(version)>=1){
String changerequestid = "";
String changetype = "";
String ver = "1";
String ccks_date = "";
String ccks_time = "";
String ccjs_date = "";
String ccjs_time = "";
String kqsc = "";
String bgsc = "";
String req_id = "";
/**
* 1
*
*
*
*/
// req_sql = "select top 1 requestid,id,changetype,version from "+ccbgTable+" where sqdh = '"+businessCode+"' and changetype='1' order by version desc,id desc";
// rs.executeQuery(req_sql);
// if(rs.next()){
// changerequestid = Util.null2String(rs.getString("requestid"));
// changetype = rs.getString("changetype");
// req_id = rs.getString("id");
// ver = rs.getString("version");
// }
// //没有变更
// if(changerequestid.equals("")){
//先查出差
req_sql = "select top 1 * from "+ccsqTable+" where sqdh = '"+businessCode+"' order by version desc ";
rs.executeQuery(req_sql);
if(rs.next()){
ver = rs.getString("version");
changerequestid = Util.null2String(rs.getString("requestid"));
ccks_date = rs.getString("fromDate");
ccks_time = rs.getString("fromTime");
ccjs_date = rs.getString("toDate");
ccjs_time = rs.getString("toTime");
}
//如果有 新建变更 撤销
if(!changerequestid.equals("")){
//只有 出差最大的版本比 获取的版本小 才需要变更撤销
//如果第二天同样的数据进来 就不会重复撤销
new BaseBean().writeLog("--new-:"+version+"---wf:"+ver);
if(Integer.parseInt(ver) < Integer.parseInt(version)){
req_sql = "select top 1 requestid,id,version from "+ccbgTable+" where sqdh = '"+businessCode+"' and changetype='1' and status = '1003' order by version desc ";
rs.executeQuery(req_sql);
String bgversion = "0";
String bgreq = "";
if(rs.next()){
bgversion = rs.getString("version");
bgreq = rs.getString("requestid");
}
if((!bgreq.equals("") && Integer.parseInt(bgversion)< Integer.parseInt(version)) || bgreq.equals("")){
//如果未查到撤销对变更,但是有出差,先起变更撤销出差
//获取流程名
req_sql = "select workflowname from workflow_base where id = '"+ccbg_wfid+"'";
rs.executeQuery(req_sql);
while (rs.next()){
workflowname = rs.getString("workflowname");
}
reqName_bg = workflowname+"-"+fullName+"-"+ DateUtils.getCurrentDate();
Map<String, String> mainTable = new HashMap<>();
mainTable.put("resourceId",id);
mainTable.put("gh",employeeID);
mainTable.put("status","1003");
mainTable.put("version",version);
mainTable.put("companion",companions);
mainTable.put("changetype","1");
mainTable.put("sqdh",businessCode);
mainTable.put("changerequestid",changerequestid);
LinkedHashMap<String, List<Map<String, String>>> detail = new LinkedHashMap<>();
List<Map<String, String>> list = new ArrayList<>();
Map<String,String> map = new HashMap<>();
map.put("detail_attendancefromDate",ccks_date);
map.put("detail_attendancefromTime",ccks_time);
map.put("detail_attendancetoDate",ccjs_date);
map.put("detail_attendancetoTime",ccjs_time);
//map.put("detail_attendanceduration",kqsc);
map.put("detail_changefromDate",fromDate);
map.put("detail_changefromTime",fromTime);
map.put("detail_changetoDate",toDate);
map.put("detail_changetoTime",toTime);
//map.put("detail_changeduration",bgsc);
list.add(map);
detail.put("1",list);
new BaseBean().writeLog("------data---"+detail.toString());
new BaseBean().writeLog("------create version---"+version);
if(!version.equals("0")){
String reqId = creatRequest("1", ccbg_wfid, reqName_bg, false, mainTable, detail);
RequestInfo request = service.getRequest(Integer.valueOf(reqId));
Boolean submit = service.nextNodeBySubmit(request, Integer.valueOf(reqId), 1, nowdate);
if (submit) {
new BaseBean().writeLog(reqId + "提交成功");
} else {
new BaseBean().writeLog(reqId + "流程提交异常");
}
}
}
}
}
// }
req_sql = "select count(id) as count from "+ccsqTable+" where sqdh = '"+businessCode+"' and version = '"+version+"'";
rs.executeQuery(req_sql);
if(rs.next()){
int count = rs.getInt("count");
if(count==0){
req_sql = "select workflowname from workflow_base where id = '"+ccsq_wfid+"'";
rs.executeQuery(req_sql);
while (rs.next()){
workflowname = rs.getString("workflowname");
}
reqName_sq = workflowname+"-"+fullName+"-"+ DateUtils.getCurrentDate();
Map<String, String> mainTable = new HashMap<>();
mainTable.put("resourceId",id);
mainTable.put("gh",employeeID);
mainTable.put("departmentId",departmentNumber);
mainTable.put("fromDate",fromDate);
mainTable.put("fromTime",fromTime);
mainTable.put("toDate",toDate);
mainTable.put("toTime",toTime);
mainTable.put("status","1003");
mainTable.put("version",version);
mainTable.put("sqdh",businessCode);
mainTable.put("companion",companions);
new BaseBean().writeLog("------data---"+mainTable.toString());
String reqId = creatRequest("1", ccsq_wfid, reqName_sq, false, mainTable, null);
RequestInfo request = service.getRequest(Integer.valueOf(reqId));
Boolean submit = service.nextNodeBySubmit(request, Integer.valueOf(reqId), 1, nowdate);
if (submit) {
new BaseBean().writeLog(reqId + "提交成功");
} else {
new BaseBean().writeLog(reqId + "流程提交异常");
}
}
}
}
}
// 出差作废逻辑
else if(status.equals("1012")){
Map<String, String> mainTable = new HashMap<>();
mainTable.put("resourceId",id);
mainTable.put("gh",employeeID);
mainTable.put("status",status);
mainTable.put("version",version);
mainTable.put("changetype","1");
mainTable.put("sqdh",businessCode);
String changerequestid = "";
String req_id = "" ;
String changetype = "";
String ccks_date = "";
String ccks_time = "";
String ccjs_date = "";
String ccjs_time = "";
String bgversion = "0";
String ccversion = "0";
req_sql = "select top 1 requestid,id,version from "+ccbgTable+" where sqdh = '"+businessCode+"' and changetype='1' and status = '1012' order by version desc ";
rs.executeQuery(req_sql);
if(rs.next()){
changerequestid = Util.null2String(rs.getString("requestid"));
}
if(changerequestid.equals("")){
req_sql = "select top 1 * from "+ccsqTable+" where sqdh = '"+businessCode+"' order by version desc";
rs.executeQuery(req_sql);
if(rs.next()){
changerequestid = Util.null2String(rs.getString("requestid"));
ccversion = rs.getString("version");
ccks_date = rs.getString("fromDate");
ccks_time = rs.getString("fromTime");
ccjs_date = rs.getString("toDate");
ccjs_time = rs.getString("toTime");
}
//获取流程名
req_sql = "select workflowname from workflow_base where id = '"+ccbg_wfid+"'";
rs.executeQuery(req_sql);
while (rs.next()){
workflowname = rs.getString("workflowname");
}
reqName_bg = workflowname+"-"+fullName+"-"+ DateUtils.getCurrentDate();
mainTable.put("changerequestid",changerequestid);
LinkedHashMap<String, List<Map<String, String>>> detail = new LinkedHashMap<>();
List<Map<String, String>> list = new ArrayList<>();
Map<String,String> map = new HashMap<>();
map.put("detail_attendancefromDate",ccks_date);
map.put("detail_attendancefromTime",ccks_time);
map.put("detail_attendancetoDate",ccjs_date);
map.put("detail_attendancetoTime",ccjs_time);
//map.put("detail_attendanceduration",kqsc);
map.put("detail_changefromDate",fromDate);
map.put("detail_changefromTime",fromTime);
map.put("detail_changetoDate",toDate);
map.put("detail_changetoTime",toTime);
//map.put("detail_changeduration",bgsc);
list.add(map);
detail.put("1",list);
new BaseBean().writeLog("------data---"+detail.toString());
//if(!changerequestid.equals("") && Integer.parseInt(version)>Integer.parseInt(bgversion) && Integer.parseInt(version)>Integer.parseInt(ccversion)){
if(!changerequestid.equals("")){
String reqId = creatRequest("1", ccbg_wfid, reqName_bg, false, mainTable, detail);
RequestInfo request = service.getRequest(Integer.valueOf(reqId));
Boolean submit = service.nextNodeBySubmit(request, Integer.valueOf(reqId), 1, nowdate);
if (submit) {
new BaseBean().writeLog(reqId + "提交成功");
} else {
new BaseBean().writeLog(reqId + "流程提交异常");
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
});
}
/**
*
*
* @param createrId id
* @param workflowId id
* @param requestName
* @param isNextFlow
* @param mainTable Map key: value:
* @param detail (LinkedHashMap) Map key: value List {Map key: value:
* }
* @return
*/
public String creatRequest(
String createrId,
String workflowId,
String requestName,
boolean isNextFlow,
Map<String, String> mainTable,
LinkedHashMap<String, List<Map<String, String>>> detail
) throws Exception {
if (mainTable == null || "0".equals(createrId) || "0".equals(workflowId)) {
return "0";
}
//请求基本信息
RequestInfo requestInfo = new RequestInfo();
requestInfo.setCreatorid(createrId); // 创建人
requestInfo.setWorkflowid(workflowId); // 工作流id
requestInfo.setDescription(requestName); // 标题
if (!isNextFlow) { // 是否提交下一节点
requestInfo.setIsNextFlow("0");
}
// 主表信息
MainTableInfo mainTableInfo = new MainTableInfo();
Property[] propertyArray = new Property[mainTable.size()];
int p = 0;
for (Map.Entry<String, String> entry : mainTable.entrySet()) {
propertyArray[p] = new Property();
propertyArray[p].setName(entry.getKey());
propertyArray[p].setValue(entry.getValue());
p++;
}
mainTableInfo.setProperty(propertyArray);
requestInfo.setMainTableInfo(mainTableInfo);
// 明细信息
DetailTableInfo detailTableInfo = new DetailTableInfo();
if (detail != null) {
DetailTable[] detailTables = new DetailTable[detail.size()];
int ds = 0;
for (Map.Entry<String, List<Map<String, String>>> entry : detail.entrySet()) {
DetailTable detailTable = new DetailTable();
List<Map<String, String>> list = entry.getValue();
for (Map<String, String> map : list) {
Row row = new Row();
for (Map.Entry<String, String> rentry : map.entrySet()) {
Cell cell = new Cell();
cell.setName("" + rentry.getKey());
cell.setValue("" + rentry.getValue());
row.addCell(cell);
}
detailTable.addRow(row);
}
detailTable.setId(entry.getKey());
detailTables[ds] = detailTable;
ds++;
}
detailTableInfo.setDetailTable(detailTables);
requestInfo.setDetailTableInfo(detailTableInfo); // 明细表
}
RequestService service = new RequestService();
String requestid = service.createRequest(requestInfo);
// 创建请求id
if(requestid == null){
throw new RuntimeException("创建流程失败");
}
int requestidInt = Integer.valueOf(requestid);
if(requestidInt < 0){
throw new RuntimeException("创建流程失败");
}
return requestid;
}
/**
*
* @param name
* @return
*/
public static String getFormId(String name){
RecordSet recordSet = new RecordSet();
String sql = "select cs from uf_xtpzb1 where xtbs ='"+name+"'";
recordSet.execute(sql);
if(recordSet.next()){
return recordSet.getString("cs");
}else {
return "";
}
}
/**
*
* @param dateStr
* @return
* @throws ParseException
*/
public String convertDateGMT(String dateStr) throws ParseException {
String sourceTimeZone = "GMT";
String targetTimeZone = "GMT+8";
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
//获取传入的时间值
Long time = new Date(sdf.parse(dateStr).getTime()).getTime();
//获取源时区时间相对的GMT时间
Long sourceRelativelyGMT = time - TimeZone.getTimeZone(sourceTimeZone).getRawOffset();
//GMT时间+目标时间时区的偏移量获取目标时间
Long targetTime = sourceRelativelyGMT + TimeZone.getTimeZone(targetTimeZone).getRawOffset();
Date date = new Date(targetTime);
return sdf.format(date);
}
}

View File

@ -0,0 +1,23 @@
package com.api.interfaces.liyi.service;
import cn.hutool.http.HttpResponse;
import java.util.Map;
public interface HuilianyiClientService {
/**
* token
* @return
*/
String getToken();
/**
*
* @return
*/
HttpResponse getTravelApplication(String token, String startDate, String endDate, String status, String page, String size);
HttpResponse getCompInfo(String token, String uid);
}

View File

@ -0,0 +1,76 @@
package com.api.interfaces.liyi.service.impl;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import com.api.interfaces.liyi.service.HuilianyiClientService;
import com.engine.core.impl.Service;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.rsa.security.Base64;
import java.util.HashMap;
import java.util.Map;
public class HuilianyiClientServiceImpl extends Service implements HuilianyiClientService {
private static String clientId = "4b8b787c-40c1-4349-8217-5535a8327175";//需要替换
private static String securet = "OTY4ZWJkZTQtOWRmZC00Y2QwLThmMTktNGQ3ZGFjNzUwMDI2";//需要替换
private static String tokenUrl = "https://apistage.huilianyi.com/gateway";//需要替换
@Override
public String getToken() {
clientId = getFormId("hly_clientId");
securet = getFormId("hly_securet");
tokenUrl = getFormId("hly_tokenUrl");
int MAX_TIME_OUT = 1000 * 120;
String authStr = clientId.concat(":").concat(securet);
String authStrEnc = new String(Base64.encodeBase64(authStr.getBytes()));
String response = HttpUtil.createPost(tokenUrl+"/oauth/token?grant_type=client_credentials&scope=write")
.header("Authorization", "Basic ".concat(authStrEnc))//头信息,多个头信息多次调用此方法即可
.timeout(MAX_TIME_OUT)
.execute().body();
return response;
}
@Override
public HttpResponse getTravelApplication(String token, String startDate, String endDate, String status, String page, String size) {
// String url = tokenUrl+"/api/open/travelApplication?access_token={AccessToken}&startDate={startDate}&endDate={endDate}&status={status}" +
// "&page={page}&size={size}";
int MAX_TIME_OUT = 1000 * 120;
tokenUrl = getFormId("hly_tokenUrl");
HttpResponse resp = HttpUtil.createGet(tokenUrl + "/api/open/travelApplication?access_token=" + token + "" +
"&startDate=" + startDate + "&endDate=" + endDate + "&status=" + status + "&page=" + page + "&size=" + size + "")
.header("Authorization", "Bearer ".concat(token))//头信息,多个头信息多次调用此方法即可
.header("Content-Type", "application/json")
.timeout(MAX_TIME_OUT)
.execute();
String response = resp.body();
String total = resp.header("X-Total-Count");
new BaseBean().writeLog("-- hly--resp---:"+response);
Map<String,String> resMap = new HashMap<>();
resMap.put("total",total);
resMap.put("resp",response);
return resp;
}
@Override
public HttpResponse getCompInfo(String token, String uid) {
int MAX_TIME_OUT = 1000 * 120;
HttpResponse user_res = HttpUtil.createGet(tokenUrl + "/api/open/user/"+uid)
.header("Authorization", "Bearer ".concat(token))//头信息,多个头信息多次调用此方法即可
.header("Content-Type", "application/json")
.timeout(MAX_TIME_OUT)
.execute();
return user_res;
}
public static String getFormId(String name){
RecordSet recordSet = new RecordSet();
String sql = "select cs from uf_xtpzb1 where xtbs ='"+name+"'";
recordSet.execute(sql);
if(recordSet.next()){
return recordSet.getString("cs");
}else {
return "";
}
}
}

View File

@ -0,0 +1,155 @@
package com.api.nonstandardext.zenner.job;
import com.api.nonstandardext.zenner.model.sap.PeriodBalance;
import com.api.nonstandardext.zenner.utils.SAPWebserviceTool;
import net.sf.json.JSONObject;
import weaver.conn.RecordSet;
import weaver.formmode.setup.ModeRightInfo;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.interfaces.schedule.BaseCronJob;
import java.util.Calendar;
/**
*
*
* 1. SAP
*
* 2. b2e0005() b2e0012()
* b2e0035
* b2e0035
*
* 3.OA
*/
public class SyncAccountInfoFromSapJob extends BaseCronJob {
BaseBean logger = new BaseBean();
private final static String JobName = " SyncAccountInfoFromSapJob ";
private String interfaceName;
private String theNearPeriod;
private String comCodes; //6000
private String sapAccount; //10020103
public String getInterfaceName() {
return interfaceName;
}
public void setInterfaceName(String interfaceName) {
this.interfaceName = interfaceName;
}
public String getTheNearPeriod() {
return theNearPeriod;
}
public void setTheNearPeriod(String theNearPeriod) {
this.theNearPeriod = theNearPeriod;
}
public String getComCodes() {
return comCodes;
}
public void setComCodes(String comCodes) {
this.comCodes = comCodes;
}
public String getSapAccount() {
return sapAccount;
}
public void setSapAccount(String sapAccount) {
this.sapAccount = sapAccount;
}
public void execute() {
logger.writeLog("-----" + JobName + " Begin------");
RecordSet rs = new RecordSet();
try {
logger.writeLog("-----" + JobName + " getInterfaceName------" + getInterfaceName());
// if (getInterfaceName().indexOf("syncGlaccPeriodBalancesFromSap") >= 0){
SAPWebserviceTool tool = new SAPWebserviceTool();
String webserviceUrl = tool.getSystemParamValue("SAP_OA011_Webservice_URL");
Integer nearPeriod = Integer.parseInt(getTheNearPeriod());
String[] companyCodes = getComCodes().split(",");
for (int c = 0; c < companyCodes.length; c++){
if ("".equals(companyCodes[c])){
continue;
}
Calendar cal = Calendar.getInstance();
for (int i = 1; i <= nearPeriod; i++){
syncGlaccPeriodBalancesFromSap(companyCodes[c], (cal.get(Calendar.MONTH) + 1) + "", cal.get(Calendar.YEAR) + "", getSapAccount(), tool);
cal.add(Calendar.MONTH, -1);
}
}
// }
} catch (Exception e) {
logger.writeLog(JobName + " 获取异常: " + e.getMessage());
e.printStackTrace();
}
logger.writeLog("--------------------" + JobName + " End---------------------------");
}
public void syncGlaccPeriodBalancesFromSap(String comCode, String period, String year, String glAccount, SAPWebserviceTool tool) throws Exception {
String params = tool.callParams_011(comCode, period, year, glAccount);
JSONObject result = tool.callInterface_011(params);
logger.writeLog(JobName + " syncGlaccPeriodBalancesFromSap result : " + result);
JSONObject balanceResponse = result.getJSONObject("balanceResponse");
PeriodBalance periodBalance = new PeriodBalance();
periodBalance.setIvCompCode(comCode);
periodBalance.setIvFiscYear(year);
periodBalance.setIvFisPeriod(period);
periodBalance.setEvBalance(Util.null2String(balanceResponse.getString("EvBalance")));
periodBalance.setEvPerSales(Util.null2String(balanceResponse.getString("EvPerSales")));
periodBalance.setEvCreditPer(Util.null2String(balanceResponse.getString("EvCreditPer")));
periodBalance.setEvDebitsPer(Util.null2String(balanceResponse.getString("EvDebitsPer")));
periodBalance.setEvCurrency(Util.null2String(balanceResponse.getString("EvCurrency")));
periodBalance.setGlAccount(glAccount);
periodBalance.save(periodBalance, 52, "uf_period_balance");
// String result = "";
//// String url = "http://127.0.0.1/uapws/service/nc65to63projectsysplugin";//这是接口地址,注意去掉.wsdl否则会报错
// Service service = new Service();
// Call call = (Call) service.createCall();
// call.setTargetEndpointAddress(webserviceUrl);
// String parametersName = "string";//设置参数名
// call.setOperationName("ZoaGlGetglaccperiodbalances");//设置方法名
// call.addParameter("IvComCode", XMLType.XSD_STRING, ParameterMode.IN);//方法参数1参数名、2参数类型、3.入参
// call.addParameter("IvFisPeriod", XMLType.XSD_STRING, ParameterMode.IN);//方法参数1参数名、2参数类型、3.入参
// call.addParameter("IvFiscYear", XMLType.XSD_STRING, ParameterMode.IN);//方法参数1参数名、2参数类型、3.入参
// call.addParameter("IvGlAccount", XMLType.XSD_STRING, ParameterMode.IN);//方法参数1参数名、2参数类型、3.入参
// call.setReturnType(XMLType.XSD_STRING);//返回类型
// JSONObject keyParams = new JSONObject();
// keyParams.put("IvComCode", 6000);
// keyParams.put("IvFisPeriod", 8);
// keyParams.put("IvFiscYear", 2022);
// keyParams.put("IvGlAccount", 12345);
// String str = keyParams.toString();
// logger.writeLog(JobName + " syncSapData Service Call str : " + str);
// Object resultObject = call.invoke(new Object[] { 6000, 8, 2022, 12345 });//调用接口
// result = (String) resultObject;
}
public void setModeRight(int creater, int modeid, int sourceid) {
ModeRightInfo moderightinfo = new ModeRightInfo();
moderightinfo.setNewRight(true);
moderightinfo.editModeDataShare(creater, modeid, sourceid);
}
}

View File

@ -0,0 +1,259 @@
package com.api.nonstandardext.zenner.job;
import com.api.nonstandardext.zenner.model.bank.DayBalance;
import com.api.nonstandardext.zenner.service.bank.Bank_b2e0005_Service;
import com.api.nonstandardext.zenner.utils.ZennerApiService;
import com.api.nonstandardext.zenner.utils.ZennerUtil;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.interfaces.schedule.BaseCronJob;
import java.io.File;
import java.util.*;
/**
*
*
* 1. b2e0005() b2e0012()
* b2e0035
* b2e0035
*
* 2. SAP
*
* 3.OA
*/
public class SyncAccountStatementJob extends BaseCronJob {
BaseBean logger = new BaseBean();
private String interfaceName;
private final static String JobName = " SyncAccountStatementJob ";
public String getInterfaceName() {
return interfaceName;
}
public void setInterfaceName(String interfaceName) {
this.interfaceName = interfaceName;
}
public void execute() {
logger.writeLog("-----" + JobName + " Begin------");
RecordSet rs = new RecordSet();
ZennerApiService zennerApiService = new ZennerApiService();
try {
logger.writeLog("-----" + JobName + " getInterfaceName------" + getInterfaceName());
//银行
String bankApiUrl = zennerApiService.getSystemConfigValue("BANK_API_URL");
String bankSql = "select * from uf_bank_account";
rs.execute(bankSql);
while (rs.next()){
syncBank_b2e0005(bankApiUrl, Util.null2String(rs.getString("lxh")), Util.null2String(rs.getString("yxzh")));
}
} catch (Exception e) {
logger.writeLog(JobName + " 获取异常: " + e.getMessage());
e.printStackTrace();
}
logger.writeLog("--------------------" + JobName + " End---------------------------");
}
/**
* b2e0005
* @param bankApiUrl
* @throws Exception
*/
public void syncBank_b2e0005(String bankApiUrl, String ibknum, String actacn) throws Exception {
String dirPath = "E:\\WEAVER\\bank\\";
File dir = new File(dirPath);
if (!dir.exists()) {
dir.mkdirs();
}
logger.writeLog(JobName + "..syncBank_b2e0005......bankApiUrl: " + bankApiUrl);
//当日账号余额
Map<String, String> xmlParams = new HashMap<>();
xmlParams.put("termid", "E192168000104");
xmlParams.put("trnid", "");
xmlParams.put("cusopr", "395169759");
xmlParams.put("custid", "387679060");
xmlParams.put("trncod", "b2e0005");
xmlParams.put("token", "");
xmlParams.put("ibknum", ibknum);
xmlParams.put("actacn", actacn);
String xmlFileUrl = dirPath + "b2e0005_" + ZennerUtil.parseToDateString(Calendar.getInstance().getTime(), ZennerUtil.formatYYYYMMDD)+ ".xml";
logger.writeLog(JobName + ".syncBank_b2e0005.......xmlFileUrl: " + xmlFileUrl);
Bank_b2e0005_Service bankB2e0005Service = new Bank_b2e0005_Service();
bankB2e0005Service.createXml(xmlFileUrl, xmlParams);
String apiParams = bankB2e0005Service.getXmlString(xmlFileUrl);
Integer pLen = apiParams.length();
int ps = 500;
int logPageNum = pLen / ps;
int i = 0;
if (pLen <= ps){
logger.writeLog(JobName + ".syncBank_b2e0005.......voucherParams last: " + apiParams);
} else {
for (i = 0; i < logPageNum; i++){
logger.writeLog(JobName + ".syncBank_b2e0005.......voucherParams " + i + " : " + apiParams.substring(i * ps, (i + 1) * 500));
}
logger.writeLog(JobName + ".syncBank_b2e0005.......voucherParams last: " + apiParams.substring((i-1) * 500));
}
logger.writeLog(JobName + " bankApiUrl : " + bankApiUrl);
String result = ZennerUtil.httpPostToken(bankApiUrl, new HashMap<>(), apiParams);
logger.writeLog(JobName + " syncBank_b2e0005 result : " + result);
Document doc = DocumentHelper.parseText(result); // 将xml转为dom对象
Element root = doc.getRootElement(); // 获取根节点
List<Element> elements = root.elements("trans");//获取名称为env:Body的子节点
DayBalance dayBalance = new DayBalance();
boolean statusOk = false;
for (Object l2 : elements) { //遍历子元素
Element l2Element = (Element) l2;
logger.writeLog("l2Element name :" + l2Element.getName());
List<Element> elementsL3 = l2Element.elements();
for (Object l3 : elementsL3) { //遍历子元素
Element l3Element = (Element) l3;
List<Element> elementsL4 = l3Element.elements();
for (Object l4 : elementsL4) { //遍历子元素
Element dataElement = (Element) l4;
logger.writeLog("l4Element name :" + dataElement.getName());
if ("status".equals(dataElement.getName())){
List<Element> elementsL5 = dataElement.elements();
for (Object l5 : elementsL5) { //遍历子元素
Element l5Element = (Element) l5;
if ("rspcod".equals(l5Element.getName())) {
logger.writeLog("rspcod:" + l5Element.getStringValue());
if (l5Element.getStringValue().equals("B001")){
statusOk = true;
} else {
statusOk = false;
}
}
if ("rspmsg".equals(l5Element.getName())) {
logger.writeLog("rspmsg:" + l5Element.getStringValue());
}
}
}
logger.writeLog("statusOk:" + statusOk);
if (statusOk){
logger.writeLog("dataElement.getName():" + dataElement.getName());
if ("b2e0005-rs".equals(dataElement.getName())){
List<Element> elementsData = dataElement.elements();
for (Object data : elementsData) { //遍历子元素
Element l4Element = (Element) data;
if ("account".equals(l4Element.getName())){
List<Element> elementsL5 = l4Element.elements();
for (Object l5 : elementsL5) { //遍历子元素
Element l5Element = (Element) l5;
if ("ibknum".equals(l5Element.getName())) {
logger.writeLog("ibknum:" + l5Element.getStringValue());
dayBalance.setIbknum(l5Element.getStringValue());
}
if ("actacn".equals(l5Element.getName())) {
logger.writeLog("actacn:" + l5Element.getStringValue());
dayBalance.setActacn(l5Element.getStringValue());
}
if ("curcde".equals(l5Element.getName())) {
logger.writeLog("curcde:" + l5Element.getStringValue());
dayBalance.setCurcde(l5Element.getStringValue());
}
if ("actname".equals(l5Element.getName())) {
logger.writeLog("actname:" + l5Element.getStringValue());
dayBalance.setActname(l5Element.getStringValue());
}
}
}
if ("balance".equals(l4Element.getName())) {
List<Element> elementsL5 = l4Element.elements();
for (Object l5 : elementsL5) { //遍历子元素
Element l5Element = (Element) l5;
if ("bokbal".equals(l5Element.getName())) {
logger.writeLog("bokbal:" + l5Element.getStringValue());
dayBalance.setBokbal(l5Element.getStringValue());
}
if ("avabal".equals(l5Element.getName())) {
logger.writeLog("avabal:" + l5Element.getStringValue());
dayBalance.setAvabal(l5Element.getStringValue());
}
if ("currentavabal".equals(l5Element.getName())) {
logger.writeLog("currentavabal:" + l5Element.getStringValue());
if ("".equals(l5Element.getStringValue())){
dayBalance.setCurrentavabal("0");
} else {
dayBalance.setCurrentavabal(l5Element.getStringValue());
}
}
if ("stpamt".equals(l5Element.getName())) {
logger.writeLog("stpamt:" + l5Element.getStringValue());
if ("".equals(l5Element.getStringValue())){
dayBalance.setStpamt("0");
} else {
dayBalance.setStpamt(l5Element.getStringValue());
}
}
if ("ovramt".equals(l5Element.getName())) {
logger.writeLog("ovramt:" + l5Element.getStringValue());
dayBalance.setOvramt("".equals(l5Element.getStringValue()) ? "0" : l5Element.getStringValue());
}
if ("frzamt".equals(l5Element.getName())) {
logger.writeLog("frzamt:" + l5Element.getStringValue());
dayBalance.setFrzamt("".equals(l5Element.getStringValue()) ? "0" : l5Element.getStringValue());
}
if ("effauthamt".equals(l5Element.getName())) {
logger.writeLog("effauthamt:" + l5Element.getStringValue());
dayBalance.setEffauthamt("".equals(l5Element.getStringValue()) ? "0" : l5Element.getStringValue());
}
if ("effusdoverbal".equals(l5Element.getName())) {
logger.writeLog("effusdoverbal:" + l5Element.getStringValue());
dayBalance.setEffusdoverbal("".equals(l5Element.getStringValue()) ? "0" : l5Element.getStringValue());
}
if ("effuseablequota".equals(l5Element.getName())) {
logger.writeLog("effuseablequota:" + l5Element.getStringValue());
dayBalance.setEffuseablequota("".equals(l5Element.getStringValue()) ? "0" : l5Element.getStringValue());
}
}
}
if ("baldat".equals(l4Element.getName())) {
logger.writeLog("baldat:" + l4Element.getStringValue());
if (!"".equals(l4Element.getStringValue())){
Date date = ZennerUtil.parseToDate(l4Element.getStringValue(), ZennerUtil.formatYYYYMMDD_NoSplit);
dayBalance.setBaldat(ZennerUtil.parseToDateString(date, ZennerUtil.formatYYYYMMDD));
}
}
}
}
}
}
}
}
dayBalance.save(dayBalance, 50, "uf_bank_day_balance");
logger.writeLog(JobName + " result dayBalance: " + dayBalance.toString());
}
}

View File

@ -0,0 +1,332 @@
package com.api.nonstandardext.zenner.job;
import com.api.nonstandardext.zenner.model.bank.TradeInfo;
import com.api.nonstandardext.zenner.service.bank.Bank_b2e0035_Service;
import com.api.nonstandardext.zenner.utils.ZennerApiService;
import com.api.nonstandardext.zenner.utils.ZennerUtil;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.interfaces.schedule.BaseCronJob;
import java.io.File;
import java.util.*;
/**
*
*
* 1. b2e0005() b2e0012()
* b2e0035
* b2e0035
*
* 2. SAP
*
* 3.OA
*/
public class SyncAccountTradeInfoJob extends BaseCronJob {
BaseBean logger = new BaseBean();
private String interfaceName;
private final static String JobName = " SyncAccountTradeInfoJob ";
public String getInterfaceName() {
return interfaceName;
}
public void setInterfaceName(String interfaceName) {
this.interfaceName = interfaceName;
}
public void execute() {
logger.writeLog("-----" + JobName + " Begin------");
RecordSet rs = new RecordSet();
ZennerApiService zennerApiService = new ZennerApiService();
try {
logger.writeLog("-----" + JobName + " getInterfaceName------" + getInterfaceName());
//银行
String bankApiUrl = zennerApiService.getSystemConfigValue("BANK_API_URL");
String bankSql = "select * from uf_bank_account";
rs.execute(bankSql);
int pageSize = 50;
while (rs.next()){
int total = syncBank_b2e0035(bankApiUrl, Util.null2String(rs.getString("lxh")), Util.null2String(rs.getString("yxzh")), 1, pageSize);
Integer totalPage = (total + pageSize - 1) / pageSize;
logger.writeLog(JobName + " totalPage:" + totalPage);
for (int pageNo = 2; pageNo <= totalPage; pageNo++) {
int startNo = (pageNo - 1) * pageSize;
int endNo = pageNo * pageSize;
logger.writeLog(JobName + " startNo:" + startNo + " endNo:" + endNo);
int pageTotal = syncBank_b2e0035(bankApiUrl, Util.null2String(rs.getString("lxh")), Util.null2String(rs.getString("yxzh")), startNo, pageSize);
logger.writeLog(JobName + " total:" + pageTotal);
}
}
} catch (Exception e) {
logger.writeLog(JobName + " 获取异常: " + e.getMessage());
e.printStackTrace();
}
logger.writeLog("--------------------" + JobName + " End---------------------------");
}
/**
*
* @param bankApiUrl
* @throws Exception
*/
public int syncBank_b2e0035(String bankApiUrl, String ibknum, String actacn, int start, int end) throws Exception {
int notenum = 0;
String dirPath = "E:\\WEAVER\\bank\\";
File dir = new File(dirPath);
if (!dir.exists()) {
dir.mkdirs();
}
//当日账号余额
Map<String, String> xmlParams = new HashMap<>();
xmlParams.put("termid", "E192168000104");
xmlParams.put("trnid", "");
xmlParams.put("cusopr", "395169759");
xmlParams.put("custid", "387679060");
xmlParams.put("trncod", "b2e0035");
xmlParams.put("token", "");
xmlParams.put("type", "2002");
xmlParams.put("ibknum", ibknum);
xmlParams.put("actacn", actacn);
xmlParams.put("from", "20220919");
Calendar cal = Calendar.getInstance();
cal.set(Calendar.DAY_OF_MONTH, -1);
xmlParams.put("to", ZennerUtil.parseToDateString(cal.getTime(), ZennerUtil.formatYYYYMMDD_NoSplit));
xmlParams.put("amountFrom", "1");
xmlParams.put("amountTo", "100000");
xmlParams.put("begnum", start + "");
xmlParams.put("recnum", end + "");
xmlParams.put("direction", "0");
String xmlFileUrl = dirPath + "b2e0035_" + ZennerUtil.parseToDateString(Calendar.getInstance().getTime(), ZennerUtil.formatYYYYMMDD)+ ".xml";
logger.writeLog(JobName + " xmlFileUrl : " + xmlFileUrl);
Bank_b2e0035_Service bankB2e0035Service = new Bank_b2e0035_Service();
bankB2e0035Service.createXml(xmlFileUrl, xmlParams);
String apiParams = bankB2e0035Service.getXmlString(xmlFileUrl);
Integer pLen = apiParams.length();
int ps = 500;
int logPageNum = pLen / ps;
int i = 0;
if (pLen <= ps){
logger.writeLog(JobName + "........voucherParams last: " + apiParams);
} else {
for (i = 0; i < logPageNum; i++){
logger.writeLog(JobName + "........voucherParams " + i + " : " + apiParams.substring(i * ps, (i + 1) * 500));
}
logger.writeLog(JobName + "........voucherParams last: " + apiParams.substring((i-1) * 500));
}
logger.writeLog(JobName + " bankApiUrl : " + bankApiUrl);
String result = ZennerUtil.httpPostToken(bankApiUrl, new HashMap<>(), apiParams);
logger.writeLog(JobName + " syncBank_b2e0035 result : " + result);
Document doc = DocumentHelper.parseText(result); // 将xml转为dom对象
Element root = doc.getRootElement(); // 获取根节点
List<Element> elements = root.elements("trans");//获取名称为env:Body的子节点
List<TradeInfo> tradeInfoList = new ArrayList<>();
boolean statusOk = false;
for (Object l2 : elements) { //遍历子元素
Element l2Element = (Element) l2;
logger.writeLog(JobName + "l2Element name :" + l2Element.getName());
List<Element> elementsL3 = l2Element.elements();
for (Object l3 : elementsL3) { //遍历子元素
Element l3Element = (Element) l3;
List<Element> elementsL4 = l3Element.elements();
for (Object l4 : elementsL4) { //遍历子元素
Element dataElement = (Element) l4;
logger.writeLog(JobName + "l4Element name :" + dataElement.getName());
if ("status".equals(dataElement.getName())){
List<Element> elementsL5 = dataElement.elements();
for (Object l5 : elementsL5) { //遍历子元素
Element l5Element = (Element) l5;
if ("rspcod".equals(l5Element.getName())) {
logger.writeLog("rspcod:" + l5Element.getStringValue());
if (l5Element.getStringValue().equals("B001") || l5Element.getStringValue().equals("B002")){
statusOk = true;
} else {
statusOk = false;
}
}
if ("rspmsg".equals(l5Element.getName())) {
logger.writeLog(JobName + "rspmsg:" + l5Element.getStringValue());
}
}
}
if ("totalnum".equals(dataElement.getName())){
logger.writeLog("totalnum:" + dataElement.getStringValue());
}
if ("notenum".equals(dataElement.getName())){
logger.writeLog("notenum:" + dataElement.getStringValue());
String notenumStr = Util.null2String(dataElement.getStringValue());
if ("".equals(notenum)){
notenumStr = "0";
}
notenum = Integer.parseInt(notenumStr);
}
logger.writeLog("statusOk:" + statusOk);
if (statusOk){
logger.writeLog(JobName + "dataElement.getName():" + dataElement.getName());
if ("b2e0035-rs".equals(dataElement.getName())){
TradeInfo tradeInfo = new TradeInfo();
List<Element> elementsData = dataElement.elements();
for (Object data : elementsData) { //遍历子元素
Element l4Element = (Element) data;
if ("fractn".equals(l4Element.getName())){
List<Element> elementsL5 = l4Element.elements();
for (Object l5 : elementsL5) { //遍历子元素
Element l5Element = (Element) l5;
if ("ibknum".equals(l5Element.getName())) {
tradeInfo.setIbknum(l5Element.getStringValue());
}
if ("actacn".equals(l5Element.getName())) {
tradeInfo.setActacn(l5Element.getStringValue());
}
if ("acntname".equals(l5Element.getName())) {
tradeInfo.setAcntname(l5Element.getStringValue());
}
if ("ibkname".equals(l5Element.getName())) {
tradeInfo.setIbkname(l5Element.getStringValue());
}
if ("outref".equals(l5Element.getName())) {
tradeInfo.setOutref(l5Element.getStringValue());
}
}
}
if ("toactn".equals(l4Element.getName())) {
List<Element> elementsL5 = l4Element.elements();
for (Object l5 : elementsL5) { //遍历子元素
Element l5Element = (Element) l5;
if ("toibkn".equals(l5Element.getName())) {
logger.writeLog(JobName + "toibkn:" + l5Element.getStringValue());
tradeInfo.setToibkn(l5Element.getStringValue());
}
if ("actacn".equals(l5Element.getName())) {
logger.writeLog(JobName + "actacn:" + l5Element.getStringValue());
tradeInfo.setActacn_receipt(l5Element.getStringValue());
}
if ("toname".equals(l5Element.getName())) {
logger.writeLog(JobName + "toname:" + l5Element.getStringValue());
tradeInfo.setToname(l5Element.getStringValue());
}
if ("tobank".equals(l5Element.getName())) {
logger.writeLog(JobName + "tobank:" + l5Element.getStringValue());
tradeInfo.setTobank(l5Element.getStringValue());
}
if ("tobref".equals(l5Element.getName())) {
logger.writeLog(JobName + "tobref:" + l5Element.getStringValue());
tradeInfo.setTobref(l5Element.getStringValue());
}
}
}
if ("txndate".equals(l4Element.getName())) {
if (!"".equals(l4Element.getStringValue())){
Date date = ZennerUtil.parseToDate(l4Element.getStringValue(), ZennerUtil.formatYYYYMMDD_NoSplit);
tradeInfo.setTxndate_time(ZennerUtil.parseToDateString(date, ZennerUtil.formatYYYYMMDD));
}
}
if ("txnamt".equals(l4Element.getName())) {
if (!"".equals(l4Element.getStringValue())){
tradeInfo.setTxnamt(l4Element.getStringValue());
}
}
if ("acctbal".equals(l4Element.getName())) {
if (!"".equals(l4Element.getStringValue())){
tradeInfo.setAcctbal(l4Element.getStringValue());
}
}
if ("avlbal".equals(l4Element.getName())) {
if (!"".equals(l4Element.getStringValue())){
tradeInfo.setAvlbal(l4Element.getStringValue());
}
}
if ("frzamt".equals(l4Element.getName())) {
if (!"".equals(l4Element.getStringValue())){
tradeInfo.setFrzamt(l4Element.getStringValue());
}
}
if ("overdramt".equals(l4Element.getName())) {
if (!"".equals(l4Element.getStringValue())){
tradeInfo.setOverdramt(l4Element.getStringValue());
}
}
if ("avloverdramt".equals(l4Element.getName())) {
if (!"".equals(l4Element.getStringValue())){
tradeInfo.setAvloverdramt(l4Element.getStringValue());
}
}
if ("useinfo".equals(l4Element.getName())) {
if (!"".equals(l4Element.getStringValue())){
tradeInfo.setUseinfo(l4Element.getStringValue());
}
}
if ("furinfo".equals(l4Element.getName())) {
if (!"".equals(l4Element.getStringValue())){
tradeInfo.setFy(l4Element.getStringValue());
}
}
if ("transtype".equals(l4Element.getName())) {
if (!"".equals(l4Element.getStringValue())){
tradeInfo.setTranstype(l4Element.getStringValue());
}
}
if ("trncur".equals(l4Element.getName())) {
if (!"".equals(l4Element.getStringValue())){
tradeInfo.setTrncur(l4Element.getStringValue());
}
}
if ("direction".equals(l4Element.getName())) {
if (!"".equals(l4Element.getStringValue())){
tradeInfo.setDirection(l4Element.getStringValue());
}
}
}
tradeInfoList.add(tradeInfo);
}
}
}
}
}
logger.writeLog(JobName + " result tradeInfoList size: " + tradeInfoList.size());
for (TradeInfo tradeInfo : tradeInfoList){
if (!"".equals(tradeInfo.getIbknum())){
tradeInfo.save(tradeInfo, 51, "uf_bank_trade_info");
}
}
return notenum;
}
}

View File

@ -0,0 +1,379 @@
package com.api.nonstandardext.zenner.model.bank;
import weaver.conn.RecordSet;
import weaver.formmode.setup.ModeRightInfo;
import weaver.general.BaseBean;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
*
*/
public class DayBalance extends BaseBean {
private Integer formmodeid;
private String modedatacreater;
private String modedatacreatertype;
private String modedatacreatedate;
private String modedatacreatetime;
//联行号
private String ibknum;
//账号
private String actacn;
//货币码
private String curcde;
//账户户名
private String actname;
//账面余额
private String bokbal;
//有效余额
private String avabal;
//一户通主账户活期账户余额
private String currentavabal;
//圈存金额
private String stpamt;
//透支额度
private String ovramt;
//冻结余额
private String frzamt;
//有效额度
private String effauthamt;
//有效已用额度
private String effusdoverbal;
//有效未用额度
private String effuseablequota;
//系统日期
private String baldat;
public Integer save(DayBalance ufModel, Integer formmodeid, String tableName) {
String modelName = "银行当日余额";
Integer billId = 0;
try {
RecordSet rs = new RecordSet();
String fieldSql = "";
String valueSql = "";
boolean result = false;
String currentDateTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
ufModel.setFormmodeid(formmodeid);
ufModel.setModedatacreater("1");
ufModel.setModedatacreatertype("0");
ufModel.setModedatacreatedate(currentDateTime.substring(0, 10));
ufModel.setModedatacreatetime(currentDateTime.substring(11));
String existSql = "select id from " + tableName + " where ibknum='" + ufModel.getIbknum() + "' and actacn='" + ufModel.getActacn() + "' and curcde='" + ufModel.getCurcde() + "' and baldat='" + ufModel.getBaldat() + "'";
rs.execute(existSql);
if (rs.next()) {
billId = rs.getInt("id");
String msg = update(modelName, tableName, ufModel);
if (!"".equals(msg)){
this.writeLog(modelName + " 保存异常: " + msg);
}
return billId;
}
// 获取实体类的所有属性返回Field数组
Field[] field = ufModel.getClass().getDeclaredFields();
// 遍历所有属性
for (int i = 0; i < field.length; i++) {
// 获取属性的名字,并将属性第一个字符大写
String name = field[i].getName();
name = name.substring(0, 1).toUpperCase() + name.substring(1);
// 得到属性类型
String type = field[i].getGenericType().toString();
if (type.equals("class java.lang.String")) {
Method m = ufModel.getClass().getMethod("get" + name);
// 调用getter方法获取属性值
String value = (String) m.invoke(ufModel);
if (value != null) {
fieldSql += "," + name;
valueSql += ",'" + value.trim() + "'";
}
}
if (type.equals("class java.lang.Integer")) {
Method m = ufModel.getClass().getMethod("get" + name);
// 调用getter方法获取属性值
Integer value = (Integer) m.invoke(ufModel);
if (value != null) {
fieldSql += "," + name;
valueSql += "," + value + "";
}
}
}
if (!"".equals(fieldSql)) {
fieldSql = fieldSql.substring(1);
valueSql = valueSql.substring(1);
String insertSql = "insert into " + tableName + " (" + fieldSql + ") values (" + valueSql + ")";
result = rs.execute(insertSql);
if (!result) {
return -1;
}
RecordSet rightRs = new RecordSet();
writeLog(modelName + ", insertSql ->" + insertSql + ", result:" + result + ", formmodeid: " + formmodeid);
rightRs.execute("SELECT id FROM " + tableName + " where ibknum='" + ufModel.getIbknum() + "' and actacn='" + ufModel.getActacn() + "' and curcde='" + ufModel.getCurcde() + "' and baldat='" + ufModel.getBaldat() + "'");
if (rightRs.next()) {
billId = rightRs.getInt("id");
this.setModeRight(1, formmodeid, billId);
}
}
} catch (Exception e) {
writeLog(modelName + ", 新增报错 ->" + e.getMessage());
e.printStackTrace();
return -1;
}
return billId;
}
public String update(String modelName, String tableName, DayBalance ufModel) throws Exception{
writeLog(modelName + ", update -> formmodeid: " + formmodeid);
RecordSet rs = new RecordSet();
String setSql = "";
boolean result = false;
try {
// 获取实体类的所有属性返回Field数组
Field[] field = ufModel.getClass().getDeclaredFields();
// 遍历所有属性
for(int i = 0; i < field.length; i++) {
// 获取属性的名字,并将属性第一个字符大写
String name = field[i].getName();
name = name.substring(0, 1).toUpperCase() + name.substring(1);
// 主键不更新
if("Ibknum".equals(name) || "Actacn".equals(name) || "Curcde".equals(name) || "Baldat".equals(name) || "Modedatacreatedate".equals(name) || "Modedatacreatetime".equals(name)) {
continue;
}
// 得到属性类型
String type = field[i].getGenericType().toString();
if (type.equals("class java.lang.String")) {
Method m = ufModel.getClass().getMethod("get" + name);
// 调用getter方法获取属性值
String value = (String) m.invoke(ufModel);
if (value != null) {
setSql += "," + name + "='" + value + "'";
}
}
if (type.equals("class java.lang.Integer")) {
Method m = ufModel.getClass().getMethod("get" + name);
// 调用getter方法获取属性值
Integer value = (Integer) m.invoke(ufModel);
if (value != null) {
setSql += "," + name + "=" + value;
}
}
}
if(!"".equals(setSql)) {
setSql = setSql.substring(1);
String updateSql = "update " + tableName + " set " + setSql + " where ibknum='" + ufModel.getIbknum() + "' and actacn='" + ufModel.getActacn() + "' and curcde='" + ufModel.getCurcde() + "' and baldat='" + ufModel.getBaldat() + "'";
writeLog(modelName + ", updateSql ->" + updateSql);
result = rs.execute(updateSql);
if (!result){
return "修改失败";
}
}
} catch (Exception e){
writeLog(modelName + ", 修改报错 ->" + e.getMessage());
e.printStackTrace();
return e.getMessage();
}
return "";
}
public void setModeRight(int creater, int modeid, int sourceid) {
ModeRightInfo moderightinfo = new ModeRightInfo();
moderightinfo.setNewRight(true);
moderightinfo.editModeDataShare(creater, modeid, sourceid);
}
public Integer getFormmodeid() {
return formmodeid;
}
public void setFormmodeid(Integer formmodeid) {
this.formmodeid = formmodeid;
}
public String getModedatacreater() {
return modedatacreater;
}
public void setModedatacreater(String modedatacreater) {
this.modedatacreater = modedatacreater;
}
public String getModedatacreatertype() {
return modedatacreatertype;
}
public void setModedatacreatertype(String modedatacreatertype) {
this.modedatacreatertype = modedatacreatertype;
}
public String getModedatacreatedate() {
return modedatacreatedate;
}
public void setModedatacreatedate(String modedatacreatedate) {
this.modedatacreatedate = modedatacreatedate;
}
public String getModedatacreatetime() {
return modedatacreatetime;
}
public void setModedatacreatetime(String modedatacreatetime) {
this.modedatacreatetime = modedatacreatetime;
}
public String getIbknum() {
return ibknum;
}
public void setIbknum(String ibknum) {
this.ibknum = ibknum;
}
public String getActacn() {
return actacn;
}
public void setActacn(String actacn) {
this.actacn = actacn;
}
public String getCurcde() {
return curcde;
}
public void setCurcde(String curcde) {
this.curcde = curcde;
}
public String getActname() {
return actname;
}
public void setActname(String actname) {
this.actname = actname;
}
public String getBokbal() {
return bokbal;
}
public void setBokbal(String bokbal) {
this.bokbal = bokbal;
}
public String getAvabal() {
return avabal;
}
public void setAvabal(String avabal) {
this.avabal = avabal;
}
public String getCurrentavabal() {
return currentavabal;
}
public void setCurrentavabal(String currentavabal) {
this.currentavabal = currentavabal;
}
public String getStpamt() {
return stpamt;
}
public void setStpamt(String stpamt) {
this.stpamt = stpamt;
}
public String getOvramt() {
return ovramt;
}
public void setOvramt(String ovramt) {
this.ovramt = ovramt;
}
public String getFrzamt() {
return frzamt;
}
public void setFrzamt(String frzamt) {
this.frzamt = frzamt;
}
public String getEffauthamt() {
return effauthamt;
}
public void setEffauthamt(String effauthamt) {
this.effauthamt = effauthamt;
}
public String getEffusdoverbal() {
return effusdoverbal;
}
public void setEffusdoverbal(String effusdoverbal) {
this.effusdoverbal = effusdoverbal;
}
public String getEffuseablequota() {
return effuseablequota;
}
public void setEffuseablequota(String effuseablequota) {
this.effuseablequota = effuseablequota;
}
public String getBaldat() {
return baldat;
}
public void setBaldat(String baldat) {
this.baldat = baldat;
}
@Override
public String toString() {
return "DayBalance{" +
"ibknum='" + ibknum + '\'' +
", actacn='" + actacn + '\'' +
", curcde='" + curcde + '\'' +
", actname='" + actname + '\'' +
", bokbal='" + bokbal + '\'' +
", avabal='" + avabal + '\'' +
", currentavabal='" + currentavabal + '\'' +
", stpamt='" + stpamt + '\'' +
", ovramt='" + ovramt + '\'' +
", frzamt='" + frzamt + '\'' +
", effauthamt='" + effauthamt + '\'' +
", effusdoverbal='" + effusdoverbal + '\'' +
", effuseablequota='" + effuseablequota + '\'' +
", baldat='" + baldat + '\'' +
'}';
}
}

View File

@ -0,0 +1,582 @@
package com.api.nonstandardext.zenner.model.bank;
import weaver.conn.RecordSet;
import weaver.formmode.setup.ModeRightInfo;
import weaver.general.BaseBean;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
*
*/
public class TradeInfo extends BaseBean {
private Integer formmodeid;
private String modedatacreater;
private String modedatacreatertype;
private String modedatacreatedate;
private String modedatacreatetime;
//付款行号
private String ibknum;
//付款账号
private String actacn;
//货币码
private String curcde;
//账户户名
private String actname;
//付款人
private String acntname;
//付款人开户行名
private String ibkname;
//汇款行业务编号
private String outref;
//收款行号
private String toibkn;
//收款账号
private String actacn_receipt;
//收款行业务编号
private String tobref;
//收款人
private String toname;
//被代理行号
private String mactibkn;
//被代理账号
private String mactacn;
//被代理账户名
private String mactname;
//被代理账户开户行名
private String mactbank;
//凭证号或传票号
private String vchnum;
//记录标识号
private String transid;
//客户业务编号后12位
private String insid;
//交易时间
private String txndate_time;
//金额
private String txnamt;
//交易后余额
private String acctbal;
//可用余额
private String avlbal;
//冻结金额
private String frzamt;
//透支额度
private String overdramt;
//可用透支额度
private String avloverdramt;
//用途
private String useinfo;
//附言
private String fy;
//业务类型
private String transtype;
//货币名称
private String trncur;
//来往账标识
private String direction;
//收款人开户行名
private String tobank;
public Integer save(TradeInfo ufModel, Integer formmodeid, String tableName) {
String modelName = "银行交易信息";
Integer billId = 0;
try {
RecordSet rs = new RecordSet();
String fieldSql = "";
String valueSql = "";
boolean result = false;
String currentDateTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
ufModel.setFormmodeid(formmodeid);
ufModel.setModedatacreater("1");
ufModel.setModedatacreatertype("0");
ufModel.setModedatacreatedate(currentDateTime.substring(0, 10));
ufModel.setModedatacreatetime(currentDateTime.substring(11));
String existSql = "select id from " + tableName + " where ibknum='" + ufModel.getIbknum() + "' and actacn='" + ufModel.getActacn() + "' and outref='" + ufModel.getOutref() + "'";
rs.execute(existSql);
if (rs.next()) {
billId = rs.getInt("id");
String msg = update(modelName, tableName, ufModel);
if (!"".equals(msg)){
this.writeLog(modelName + " 保存异常: " + msg);
}
return billId;
}
// 获取实体类的所有属性返回Field数组
Field[] field = ufModel.getClass().getDeclaredFields();
// 遍历所有属性
for (int i = 0; i < field.length; i++) {
// 获取属性的名字,并将属性第一个字符大写
String name = field[i].getName();
name = name.substring(0, 1).toUpperCase() + name.substring(1);
// 得到属性类型
String type = field[i].getGenericType().toString();
if (type.equals("class java.lang.String")) {
Method m = ufModel.getClass().getMethod("get" + name);
// 调用getter方法获取属性值
String value = (String) m.invoke(ufModel);
if (value != null) {
fieldSql += "," + name;
valueSql += ",'" + value.trim() + "'";
}
}
if (type.equals("class java.lang.Integer")) {
Method m = ufModel.getClass().getMethod("get" + name);
// 调用getter方法获取属性值
Integer value = (Integer) m.invoke(ufModel);
if (value != null) {
fieldSql += "," + name;
valueSql += "," + value + "";
}
}
}
if (!"".equals(fieldSql)) {
fieldSql = fieldSql.substring(1);
valueSql = valueSql.substring(1);
String insertSql = "insert into " + tableName + " (" + fieldSql + ") values (" + valueSql + ")";
result = rs.execute(insertSql);
if (!result) {
return -1;
}
RecordSet rightRs = new RecordSet();
writeLog(modelName + ", insertSql ->" + insertSql + ", result:" + result + ", formmodeid: " + formmodeid);
rightRs.execute("SELECT id FROM " + tableName + " where ibknum='" + ufModel.getIbknum() + "' and actacn='" + ufModel.getActacn() + "' and outref='" + ufModel.getOutref() + "'");
if (rightRs.next()) {
billId = rightRs.getInt("id");
this.setModeRight(1, formmodeid, billId);
}
}
} catch (Exception e) {
writeLog(modelName + ", 新增报错 ->" + e.getMessage());
e.printStackTrace();
return -1;
}
return billId;
}
public String update(String modelName, String tableName, TradeInfo ufModel) throws Exception{
writeLog(modelName + ", update -> formmodeid: " + formmodeid);
RecordSet rs = new RecordSet();
String setSql = "";
boolean result = false;
try {
// 获取实体类的所有属性返回Field数组
Field[] field = ufModel.getClass().getDeclaredFields();
// 遍历所有属性
for(int i = 0; i < field.length; i++) {
// 获取属性的名字,并将属性第一个字符大写
String name = field[i].getName();
name = name.substring(0, 1).toUpperCase() + name.substring(1);
// 主键不更新
if("Ibknum".equals(name) || "Actacn".equals(name) || "Curcde".equals(name) || "Baldat".equals(name) || "Modedatacreatedate".equals(name) || "Modedatacreatetime".equals(name)) {
continue;
}
// 得到属性类型
String type = field[i].getGenericType().toString();
if (type.equals("class java.lang.String")) {
Method m = ufModel.getClass().getMethod("get" + name);
// 调用getter方法获取属性值
String value = (String) m.invoke(ufModel);
if (value != null) {
setSql += "," + name + "='" + value + "'";
}
}
if (type.equals("class java.lang.Integer")) {
Method m = ufModel.getClass().getMethod("get" + name);
// 调用getter方法获取属性值
Integer value = (Integer) m.invoke(ufModel);
if (value != null) {
setSql += "," + name + "=" + value;
}
}
}
if(!"".equals(setSql)) {
setSql = setSql.substring(1);
String updateSql = "update " + tableName + " set " + setSql + " where ibknum='" + ufModel.getIbknum() + "' and actacn='" + ufModel.getActacn() + "' and outref='" + ufModel.getOutref() + "'";
writeLog(modelName + ", updateSql ->" + updateSql);
result = rs.execute(updateSql);
if (!result){
return "修改失败";
}
}
} catch (Exception e){
writeLog(modelName + ", 修改报错 ->" + e.getMessage());
e.printStackTrace();
return e.getMessage();
}
return "";
}
public void setModeRight(int creater, int modeid, int sourceid) {
ModeRightInfo moderightinfo = new ModeRightInfo();
moderightinfo.setNewRight(true);
moderightinfo.editModeDataShare(creater, modeid, sourceid);
}
public Integer getFormmodeid() {
return formmodeid;
}
public void setFormmodeid(Integer formmodeid) {
this.formmodeid = formmodeid;
}
public String getModedatacreater() {
return modedatacreater;
}
public void setModedatacreater(String modedatacreater) {
this.modedatacreater = modedatacreater;
}
public String getModedatacreatertype() {
return modedatacreatertype;
}
public void setModedatacreatertype(String modedatacreatertype) {
this.modedatacreatertype = modedatacreatertype;
}
public String getModedatacreatedate() {
return modedatacreatedate;
}
public void setModedatacreatedate(String modedatacreatedate) {
this.modedatacreatedate = modedatacreatedate;
}
public String getModedatacreatetime() {
return modedatacreatetime;
}
public void setModedatacreatetime(String modedatacreatetime) {
this.modedatacreatetime = modedatacreatetime;
}
public String getIbknum() {
return ibknum;
}
public void setIbknum(String ibknum) {
this.ibknum = ibknum;
}
public String getActacn() {
return actacn;
}
public void setActacn(String actacn) {
this.actacn = actacn;
}
public String getCurcde() {
return curcde;
}
public void setCurcde(String curcde) {
this.curcde = curcde;
}
public String getActname() {
return actname;
}
public void setActname(String actname) {
this.actname = actname;
}
public String getAcntname() {
return acntname;
}
public void setAcntname(String acntname) {
this.acntname = acntname;
}
public String getIbkname() {
return ibkname;
}
public void setIbkname(String ibkname) {
this.ibkname = ibkname;
}
public String getOutref() {
return outref;
}
public void setOutref(String outref) {
this.outref = outref;
}
public String getToibkn() {
return toibkn;
}
public void setToibkn(String toibkn) {
this.toibkn = toibkn;
}
public String getActacn_receipt() {
return actacn_receipt;
}
public void setActacn_receipt(String actacn_receipt) {
this.actacn_receipt = actacn_receipt;
}
public String getTobref() {
return tobref;
}
public void setTobref(String tobref) {
this.tobref = tobref;
}
public String getToname() {
return toname;
}
public void setToname(String toname) {
this.toname = toname;
}
public String getMactibkn() {
return mactibkn;
}
public void setMactibkn(String mactibkn) {
this.mactibkn = mactibkn;
}
public String getMactacn() {
return mactacn;
}
public void setMactacn(String mactacn) {
this.mactacn = mactacn;
}
public String getMactname() {
return mactname;
}
public void setMactname(String mactname) {
this.mactname = mactname;
}
public String getMactbank() {
return mactbank;
}
public void setMactbank(String mactbank) {
this.mactbank = mactbank;
}
public String getVchnum() {
return vchnum;
}
public void setVchnum(String vchnum) {
this.vchnum = vchnum;
}
public String getTransid() {
return transid;
}
public void setTransid(String transid) {
this.transid = transid;
}
public String getInsid() {
return insid;
}
public void setInsid(String insid) {
this.insid = insid;
}
public String getTxndate_time() {
return txndate_time;
}
public void setTxndate_time(String txndate_time) {
this.txndate_time = txndate_time;
}
public String getTxnamt() {
return txnamt;
}
public void setTxnamt(String txnamt) {
this.txnamt = txnamt;
}
public String getAcctbal() {
return acctbal;
}
public void setAcctbal(String acctbal) {
this.acctbal = acctbal;
}
public String getAvlbal() {
return avlbal;
}
public void setAvlbal(String avlbal) {
this.avlbal = avlbal;
}
public String getFrzamt() {
return frzamt;
}
public void setFrzamt(String frzamt) {
this.frzamt = frzamt;
}
public String getOverdramt() {
return overdramt;
}
public void setOverdramt(String overdramt) {
this.overdramt = overdramt;
}
public String getAvloverdramt() {
return avloverdramt;
}
public void setAvloverdramt(String avloverdramt) {
this.avloverdramt = avloverdramt;
}
public String getUseinfo() {
return useinfo;
}
public void setUseinfo(String useinfo) {
this.useinfo = useinfo;
}
public String getFy() {
return fy;
}
public void setFy(String fy) {
this.fy = fy;
}
public String getTranstype() {
return transtype;
}
public void setTranstype(String transtype) {
this.transtype = transtype;
}
public String getTrncur() {
return trncur;
}
public void setTrncur(String trncur) {
this.trncur = trncur;
}
public String getDirection() {
return direction;
}
public void setDirection(String direction) {
this.direction = direction;
}
public String getTobank() {
return tobank;
}
public void setTobank(String tobank) {
this.tobank = tobank;
}
@Override
public String toString() {
return "TradeInfo{" +
"ibknum='" + ibknum + '\'' +
", actacn='" + actacn + '\'' +
", curcde='" + curcde + '\'' +
", actname='" + actname + '\'' +
", acntname='" + acntname + '\'' +
", ibkname='" + ibkname + '\'' +
", outref='" + outref + '\'' +
", toibkn='" + toibkn + '\'' +
", actacn_receipt='" + actacn_receipt + '\'' +
", tobref='" + tobref + '\'' +
", toname='" + toname + '\'' +
", mactibkn='" + mactibkn + '\'' +
", mactacn='" + mactacn + '\'' +
", mactname='" + mactname + '\'' +
", mactbank='" + mactbank + '\'' +
", vchnum='" + vchnum + '\'' +
", transid='" + transid + '\'' +
", insid='" + insid + '\'' +
", txndate_time='" + txndate_time + '\'' +
", txnamt='" + txnamt + '\'' +
", acctbal='" + acctbal + '\'' +
", avlbal='" + avlbal + '\'' +
", frzamt='" + frzamt + '\'' +
", overdramt='" + overdramt + '\'' +
", avloverdramt='" + avloverdramt + '\'' +
", useinfo='" + useinfo + '\'' +
", fy='" + fy + '\'' +
", transtype='" + transtype + '\'' +
", trncur='" + trncur + '\'' +
", direction='" + direction + '\'' +
", tobank='" + tobank + '\'' +
'}';
}
}

View File

@ -0,0 +1,314 @@
package com.api.nonstandardext.zenner.model.sap;
import weaver.conn.RecordSet;
import weaver.formmode.setup.ModeRightInfo;
import weaver.general.BaseBean;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
*
*/
public class PeriodBalance extends BaseBean {
private Integer formmodeid;
private String modedatacreater;
private String modedatacreatertype;
private String modedatacreatedate;
private String modedatacreatetime;
private String IvCompCode;
private String IvFiscYear;
private String IvFisPeriod;
//累计余额
private String EvBalance;
//期间余额
private String EvPerSales;
//期间贷方发生额
private String EvCreditPer;
//期间借方发生额
private String EvDebitsPer;
//币种
private String EvCurrency;
//科目
private String glAccount;
public Integer save(PeriodBalance ufModel, Integer formmodeid, String tableName) {
String modelName = "期间余额";
Integer billId = 0;
try {
RecordSet rs = new RecordSet();
String fieldSql = "";
String valueSql = "";
boolean result = false;
String currentDateTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
ufModel.setFormmodeid(formmodeid);
ufModel.setModedatacreater("1");
ufModel.setModedatacreatertype("0");
ufModel.setModedatacreatedate(currentDateTime.substring(0, 10));
ufModel.setModedatacreatetime(currentDateTime.substring(11));
String existSql = "select id from " + tableName + " where IvCompCode='" + ufModel.getIvCompCode() + "' and IvFiscYear='" + ufModel.getIvFiscYear() + "' and IvFisPeriod='" + ufModel.getIvFisPeriod() + "'";
rs.execute(existSql);
if (rs.next()) {
billId = rs.getInt("id");
String msg = update(modelName, tableName, ufModel);
if (!"".equals(msg)){
this.writeLog(modelName + " 保存异常: " + msg);
}
return billId;
}
// 获取实体类的所有属性返回Field数组
Field[] field = ufModel.getClass().getDeclaredFields();
// 遍历所有属性
for (int i = 0; i < field.length; i++) {
// 获取属性的名字,并将属性第一个字符大写
String name = field[i].getName();
name = name.substring(0, 1).toUpperCase() + name.substring(1);
// 得到属性类型
String type = field[i].getGenericType().toString();
if (type.equals("class java.lang.String")) {
Method m = ufModel.getClass().getMethod("get" + name);
// 调用getter方法获取属性值
String value = (String) m.invoke(ufModel);
if (value != null) {
fieldSql += "," + name;
valueSql += ",'" + value.trim() + "'";
}
}
if (type.equals("class java.lang.Integer")) {
Method m = ufModel.getClass().getMethod("get" + name);
// 调用getter方法获取属性值
Integer value = (Integer) m.invoke(ufModel);
if (value != null) {
fieldSql += "," + name;
valueSql += "," + value + "";
}
}
}
if (!"".equals(fieldSql)) {
fieldSql = fieldSql.substring(1);
valueSql = valueSql.substring(1);
String insertSql = "insert into " + tableName + " (" + fieldSql + ") values (" + valueSql + ")";
result = rs.execute(insertSql);
if (!result) {
return -1;
}
RecordSet rightRs = new RecordSet();
writeLog(modelName + ", insertSql ->" + insertSql + ", result:" + result + ", formmodeid: " + formmodeid);
rightRs.execute("SELECT id FROM " + tableName + " where IvCompCode='" + ufModel.getIvCompCode() + "' and IvFiscYear='" + ufModel.getIvFiscYear() + "' and IvFisPeriod='" + ufModel.getIvFisPeriod() + "'");
if (rightRs.next()) {
billId = rightRs.getInt("id");
this.setModeRight(1, formmodeid, billId);
}
}
} catch (Exception e) {
writeLog(modelName + ", 新增报错 ->" + e.getMessage());
e.printStackTrace();
return -1;
}
return billId;
}
public String update(String modelName, String tableName, PeriodBalance ufModel) throws Exception{
writeLog(modelName + ", update -> formmodeid: " + formmodeid);
RecordSet rs = new RecordSet();
String setSql = "";
boolean result = false;
try {
// 获取实体类的所有属性返回Field数组
Field[] field = ufModel.getClass().getDeclaredFields();
// 遍历所有属性
for(int i = 0; i < field.length; i++) {
// 获取属性的名字,并将属性第一个字符大写
String name = field[i].getName();
name = name.substring(0, 1).toUpperCase() + name.substring(1);
// 主键不更新
if("IvCompCode".equals(name) || "IvFiscYear".equals(name) || "IvFisPeriod".equals(name) || "Modedatacreatedate".equals(name) || "Modedatacreatetime".equals(name)) {
continue;
}
// 得到属性类型
String type = field[i].getGenericType().toString();
if (type.equals("class java.lang.String")) {
Method m = ufModel.getClass().getMethod("get" + name);
// 调用getter方法获取属性值
String value = (String) m.invoke(ufModel);
if (value != null) {
setSql += "," + name + "='" + value + "'";
}
}
if (type.equals("class java.lang.Integer")) {
Method m = ufModel.getClass().getMethod("get" + name);
// 调用getter方法获取属性值
Integer value = (Integer) m.invoke(ufModel);
if (value != null) {
setSql += "," + name + "=" + value;
}
}
}
if(!"".equals(setSql)) {
setSql = setSql.substring(1);
String updateSql = "update " + tableName + " set " + setSql + " where IvCompCode='" + ufModel.getIvCompCode() + "' and IvFiscYear='" + ufModel.getIvFiscYear() + "' and IvFisPeriod='" + ufModel.getIvFisPeriod() + "'";
writeLog(modelName + ", updateSql ->" + updateSql);
result = rs.execute(updateSql);
if (!result){
return "修改失败";
}
}
} catch (Exception e){
writeLog(modelName + ", 修改报错 ->" + e.getMessage());
e.printStackTrace();
return e.getMessage();
}
return "";
}
public void setModeRight(int creater, int modeid, int sourceid) {
ModeRightInfo moderightinfo = new ModeRightInfo();
moderightinfo.setNewRight(true);
moderightinfo.editModeDataShare(creater, modeid, sourceid);
}
public Integer getFormmodeid() {
return formmodeid;
}
public void setFormmodeid(Integer formmodeid) {
this.formmodeid = formmodeid;
}
public String getModedatacreater() {
return modedatacreater;
}
public void setModedatacreater(String modedatacreater) {
this.modedatacreater = modedatacreater;
}
public String getModedatacreatertype() {
return modedatacreatertype;
}
public void setModedatacreatertype(String modedatacreatertype) {
this.modedatacreatertype = modedatacreatertype;
}
public String getModedatacreatedate() {
return modedatacreatedate;
}
public void setModedatacreatedate(String modedatacreatedate) {
this.modedatacreatedate = modedatacreatedate;
}
public String getModedatacreatetime() {
return modedatacreatetime;
}
public void setModedatacreatetime(String modedatacreatetime) {
this.modedatacreatetime = modedatacreatetime;
}
public String getEvBalance() {
return EvBalance;
}
public void setEvBalance(String evBalance) {
EvBalance = evBalance;
}
public String getEvPerSales() {
return EvPerSales;
}
public void setEvPerSales(String evPerSales) {
EvPerSales = evPerSales;
}
public String getEvCreditPer() {
return EvCreditPer;
}
public void setEvCreditPer(String evCreditPer) {
EvCreditPer = evCreditPer;
}
public String getEvDebitsPer() {
return EvDebitsPer;
}
public void setEvDebitsPer(String evDebitsPer) {
EvDebitsPer = evDebitsPer;
}
public String getEvCurrency() {
return EvCurrency;
}
public void setEvCurrency(String evCurrency) {
EvCurrency = evCurrency;
}
public String getGlAccount() {
return glAccount;
}
public void setGlAccount(String glAccount) {
this.glAccount = glAccount;
}
public String getIvCompCode() {
return IvCompCode;
}
public void setIvCompCode(String ivCompCode) {
IvCompCode = ivCompCode;
}
public String getIvFiscYear() {
return IvFiscYear;
}
public void setIvFiscYear(String ivFiscYear) {
IvFiscYear = ivFiscYear;
}
public String getIvFisPeriod() {
return IvFisPeriod;
}
public void setIvFisPeriod(String ivFisPeriod) {
IvFisPeriod = ivFisPeriod;
}
@Override
public String toString() {
return "PeriodBalance{" +
"IvCompCode='" + IvCompCode + '\'' +
", IvFiscYear='" + IvFiscYear + '\'' +
", IvFisPeriod='" + IvFisPeriod + '\'' +
", EvBalance='" + EvBalance + '\'' +
", EvPerSales='" + EvPerSales + '\'' +
", EvCreditPer='" + EvCreditPer + '\'' +
", EvDebitsPer='" + EvDebitsPer + '\'' +
", EvCurrency='" + EvCurrency + '\'' +
", glAccount='" + glAccount + '\'' +
'}';
}
}

View File

@ -0,0 +1,130 @@
package com.api.nonstandardext.zenner.service.bank;
import org.xml.sax.helpers.AttributesImpl;
import weaver.general.BaseBean;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Result;
import javax.xml.transform.Transformer;
import javax.xml.transform.sax.SAXTransformerFactory;
import javax.xml.transform.sax.TransformerHandler;
import javax.xml.transform.stream.StreamResult;
import java.io.*;
import java.util.*;
public class Bank_b2e0005_Service extends BaseBean {
private final static String ServiceName = " Bank_b2e0005_Service ";
public void createXml(String xmlFileUrl, Map<String, String> params) throws Exception{
SAXTransformerFactory tff = (SAXTransformerFactory) SAXTransformerFactory.newInstance();
// 2、通过SAXTransformerFactory创建一个TransformerHandler的对象
TransformerHandler handler = tff.newTransformerHandler();
// 3、通过handler创建一个Transformer对象
Transformer tr = handler.getTransformer();
// 4、通过Transformer对象对生成的xml文件进行设置
// 设置编码方式
tr.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
// 设置是否换行
tr.setOutputProperty(OutputKeys.INDENT, "yes");
// 5、创建一个Result对象
File f = new File(xmlFileUrl);
// 判断文件是否存在
if (!f.exists()) {
f.createNewFile();
}
Result result = new StreamResult(new FileOutputStream(f));
// 6、使RESULT与handler关联
handler.setResult(result);
// 打开document
handler.startDocument();
AttributesImpl attrImpl = new AttributesImpl();
this.writeLog(ServiceName + "........params: " + params.toString());
attrImpl.addAttribute("", "", "version", "", "100");
attrImpl.addAttribute("", "", "security", "", "true");
attrImpl.addAttribute("", "", "lang", "", "chs");
handler.startElement("", "", "bocb2e", attrImpl);
attrImpl.clear();
attrImpl.addAttribute("", "", "id", "", "11074E1000000000S6SL");
handler.startElement("", "", "head", attrImpl);
attrImpl.clear();
handler.startElement("", "", "termid", attrImpl);
handler.characters(params.get("termid").toCharArray(), 0, params.get("termid").length());
handler.endElement("", "", "termid");
handler.startElement("", "", "trnid", attrImpl);
handler.characters(params.get("trnid").toCharArray(), 0, params.get("trnid").length());
handler.endElement("", "", "trnid");
handler.startElement("", "", "cusopr", attrImpl);
handler.characters(params.get("cusopr").toCharArray(), 0, params.get("cusopr").length());
handler.endElement("", "", "cusopr");
handler.startElement("", "", "custid", attrImpl);
handler.characters(params.get("custid").toCharArray(), 0, params.get("custid").length());
handler.endElement("", "", "custid");
handler.startElement("", "", "trncod", attrImpl);
handler.characters(params.get("trncod").toCharArray(), 0, params.get("trncod").length());
handler.endElement("", "", "trncod");
handler.startElement("", "", "token", attrImpl);
handler.characters(params.get("token").toCharArray(), 0, params.get("token").length());
handler.endElement("", "", "token");
handler.endElement("", "", "head");
attrImpl.clear();
handler.startElement("", "", "trans", attrImpl);
this.writeLog(ServiceName + "........params 2 : " + params.toString());
handler.startElement("", "", "trn-b2e0005-rq", attrImpl);
handler.startElement("", "", "b2e0005-rq", attrImpl);
handler.startElement("", "", "account", attrImpl);
handler.startElement("", "", "ibknum", attrImpl);
handler.characters(params.get("ibknum").toCharArray(), 0, params.get("ibknum").length());
handler.endElement("", "", "ibknum");
handler.startElement("", "", "actacn", attrImpl);
handler.characters(params.get("actacn").toCharArray(), 0, params.get("actacn").length());
handler.endElement("", "", "actacn");
handler.endElement("", "", "account");
handler.endElement("", "", "b2e0005-rq");
handler.endElement("", "", "trn-b2e0005-rq");
handler.endElement("", "", "trans");
handler.endElement("", "", "bocb2e");
this.writeLog(ServiceName + "........params 3 : " + params.toString());
// 关闭document
handler.endDocument();
}
public String getXmlString(String xmlFileUrl) {
StringBuilder sb = new StringBuilder();
try {
InputStream inputStream = new FileInputStream(xmlFileUrl);
BufferedReader br=new BufferedReader(new InputStreamReader(inputStream));
String line="";
for(line=br.readLine();line!=null;line=br.readLine()) {
sb.append(line+"\n");
}
} catch (FileNotFoundException e) {
this.writeLog(ServiceName + " e 1 : " + e.getMessage());
} catch (IOException e) {
this.writeLog(ServiceName + " e 2 : " + e.getMessage());
}
return sb.toString();
}
}

View File

@ -0,0 +1,160 @@
package com.api.nonstandardext.zenner.service.bank;
import org.xml.sax.helpers.AttributesImpl;
import weaver.general.BaseBean;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Result;
import javax.xml.transform.Transformer;
import javax.xml.transform.sax.SAXTransformerFactory;
import javax.xml.transform.sax.TransformerHandler;
import javax.xml.transform.stream.StreamResult;
import java.io.*;
import java.util.Map;
public class Bank_b2e0035_Service extends BaseBean {
private final static String ServiceName = " Bank_b2e0035_Service ";
public void createXml(String xmlFileUrl, Map<String, String> params) throws Exception{
SAXTransformerFactory tff = (SAXTransformerFactory) SAXTransformerFactory.newInstance();
// 2、通过SAXTransformerFactory创建一个TransformerHandler的对象
TransformerHandler handler = tff.newTransformerHandler();
// 3、通过handler创建一个Transformer对象
Transformer tr = handler.getTransformer();
// 4、通过Transformer对象对生成的xml文件进行设置
// 设置编码方式
tr.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
// 设置是否换行
tr.setOutputProperty(OutputKeys.INDENT, "yes");
// 5、创建一个Result对象
File f = new File(xmlFileUrl);
// 判断文件是否存在
if (!f.exists()) {
f.createNewFile();
}
Result result = new StreamResult(new FileOutputStream(f));
// 6、使RESULT与handler关联
handler.setResult(result);
// 打开document
handler.startDocument();
AttributesImpl attrImpl = new AttributesImpl();
attrImpl.addAttribute("", "", "version", "", "110");
attrImpl.addAttribute("", "", "locale", "", "zh_CN");
handler.startElement("", "", "bocb2e", attrImpl);
attrImpl.clear();
handler.startElement("", "", "head", attrImpl);
attrImpl.clear();
handler.startElement("", "", "termid", attrImpl);
handler.characters(params.get("termid").toCharArray(), 0, params.get("termid").length());
handler.endElement("", "", "termid");
handler.startElement("", "", "trnid", attrImpl);
handler.characters(params.get("trnid").toCharArray(), 0, params.get("trnid").length());
handler.endElement("", "", "trnid");
handler.startElement("", "", "cusopr", attrImpl);
handler.characters(params.get("cusopr").toCharArray(), 0, params.get("cusopr").length());
handler.endElement("", "", "cusopr");
handler.startElement("", "", "custid", attrImpl);
handler.characters(params.get("custid").toCharArray(), 0, params.get("custid").length());
handler.endElement("", "", "custid");
handler.startElement("", "", "trncod", attrImpl);
handler.characters(params.get("trncod").toCharArray(), 0, params.get("trncod").length());
handler.endElement("", "", "trncod");
handler.startElement("", "", "token", attrImpl);
handler.characters(params.get("token").toCharArray(), 0, params.get("token").length());
handler.endElement("", "", "token");
handler.endElement("", "", "head");
attrImpl.clear();
handler.startElement("", "", "trans", attrImpl);
handler.startElement("", "", "trn-b2e0035-rq", attrImpl);
handler.startElement("", "", "b2e0035-rq", attrImpl);
handler.startElement("", "", "ibknum", attrImpl);
handler.characters(params.get("ibknum").toCharArray(), 0, params.get("ibknum").length());
handler.endElement("", "", "ibknum");
handler.startElement("", "", "actacn", attrImpl);
handler.characters(params.get("actacn").toCharArray(), 0, params.get("actacn").length());
handler.endElement("", "", "actacn");
handler.startElement("", "", "type", attrImpl);
handler.characters(params.get("type").toCharArray(), 0, params.get("type").length());
handler.endElement("", "", "type");
handler.startElement("", "", "datescope", attrImpl);
handler.startElement("", "", "from", attrImpl);
handler.characters(params.get("from").toCharArray(), 0, params.get("from").length());
handler.endElement("", "", "from");
handler.startElement("", "", "to", attrImpl);
handler.characters(params.get("to").toCharArray(), 0, params.get("to").length());
handler.endElement("", "", "to");
handler.endElement("", "", "datescope");
handler.startElement("", "", "amountscope", attrImpl);
handler.startElement("", "", "from", attrImpl);
handler.characters(params.get("amountFrom").toCharArray(), 0, params.get("amountFrom").length());
handler.endElement("", "", "from");
handler.startElement("", "", "to", attrImpl);
handler.characters(params.get("amountTo").toCharArray(), 0, params.get("amountTo").length());
handler.endElement("", "", "to");
handler.endElement("", "", "amountscope");
handler.startElement("", "", "begnum", attrImpl);
handler.characters(params.get("begnum").toCharArray(), 0, params.get("begnum").length());
handler.endElement("", "", "begnum");
handler.startElement("", "", "recnum", attrImpl);
handler.characters(params.get("recnum").toCharArray(), 0, params.get("recnum").length());
handler.endElement("", "", "recnum");
handler.startElement("", "", "direction", attrImpl);
handler.characters(params.get("direction").toCharArray(), 0, params.get("direction").length());
handler.endElement("", "", "direction");
handler.endElement("", "", "b2e0035-rq");
handler.endElement("", "", "trn-b2e0035-rq");
handler.endElement("", "", "trans");
handler.endElement("", "", "bocb2e");
// 关闭document
handler.endDocument();
}
public String getXmlString(String xmlFileUrl) {
StringBuilder sb = new StringBuilder();
try {
InputStream inputStream = new FileInputStream(xmlFileUrl);
BufferedReader br=new BufferedReader(new InputStreamReader(inputStream));
String line="";
for(line=br.readLine();line!=null;line=br.readLine()) {
sb.append(line+"\n");
}
} catch (FileNotFoundException e) {
this.writeLog(ServiceName + " e 1 : " + e.getMessage());
} catch (IOException e) {
this.writeLog(ServiceName + " e 2 : " + e.getMessage());
}
return sb.toString();
}
}

View File

@ -0,0 +1,288 @@
package com.api.nonstandardext.zenner.utils;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import net.sf.json.xml.XMLSerializer;
import org.apache.http.HttpEntity;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import java.io.IOException;
/**
*
* -SAP
* @Date: 2022/9/09 10:06
*/
public class SAPWebserviceTool extends BaseBean {
//SAP接口日志表名称
private String Logger_Mode_Table = this.getSystemParamValue("SAPInterface_Logger_Mode_TableName");
//SAP接口日志模块ID
private int Logger_Mode_ID = Util.getIntValue(this.getSystemParamValue("SAPInterface_Logger_Mode_ID"),0);
//获取SAP接口认证头参数值(用户名)
private String authenticator_username = this.getSystemParamValue("SAP_Webservice_Authenticator_Username");
//获取SAP接口认证头参数值(密码)
private String authenticator_password = this.getSystemParamValue("SAP_Webservice_Authenticator_Password");
public String getSystemParamValue(String uuid){
String paramvalue = "";
if(!"".equals(uuid)){
String select_sql = "select paramvalue from uf_systemconfig where uuid = ?";
RecordSet rs = new RecordSet();
rs.executeQuery(select_sql,uuid);
if(rs.next()){
paramvalue = Util.null2String(rs.getString(1));
}
}
return paramvalue;
}
/**
*
*/
public SAPWebserviceTool(){
if("".equals(authenticator_username)){
authenticator_username = this.getSystemParamValue("SAP_Webservice_Authenticator_Username");
}
if("".equals(authenticator_password)){
authenticator_password = this.getSystemParamValue("SAP_Webservice_Authenticator_Password");
}
}
public String callParams_011(String comCode, String period, String year, String glAccount){
String params = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:urn=\"urn:sap-com:document:sap:soap:functions:mc-style\">\n" +
" <soapenv:Header/>\n" +
" <soapenv:Body>\n" +
" <urn:ZoaGlGetglaccperiodbalances>\n" +
" <IvCompCode>$comCode$</IvCompCode>\n" +
" <IvFisPeriod>$period$</IvFisPeriod>\n" +
" <IvFiscYear>$year$</IvFiscYear>\n" +
" <IvGlAccount>$glAccount$</IvGlAccount>\n" +
" </urn:ZoaGlGetglaccperiodbalances>\n" +
" </soapenv:Body>\n" +
"</soapenv:Envelope>";
params = params.replace("$comCode$", comCode);
params = params.replace("$period$", period);
params = params.replace("$year$", year);
params = params.replace("$glAccount$", glAccount);
this.writeLog(" xml params:[" + params.toString() + "]");
return params;
}
/**
* {
* "@xmlns:n0": "urn:sap-com:document:sap:soap:functions:mc-style",
* "EsReturn": {
* "Type": [],
* "Code": [],
* "Message": [],
* "LogNo": [],
* "LogMsgNo": "000000",
* "MessageV1": [],
* "MessageV2": [],
* "MessageV3": [],
* "MessageV4": []
* },
* "EvBalance": "19715385.21",
* "EvCreditPer": "-220.0",
* "EvCurrency": "CNY",
* "EvDebitsPer": "15718007.26",
* "EvPerSales": "15717787.26",
* "EvRc": "S"
* }
* @param params
* @return
*/
public JSONObject callInterface_011(String params){
JSONObject result = new JSONObject();
String webservice_url = this.getSystemParamValue("SAP_OA011_Webservice_URL");//"http://ashca160.minol.org:8004/sap/bc/srt/rfc/sap/zoa_outgoing_document_post1/400/s1/b1";
this.writeLog("xml webservice_url:[" + webservice_url + "]");
this.writeLog("authenticator_username:[" + authenticator_username + "] authenticator_password[" + authenticator_password + "]");
try {
String webservice_result = sendPostData(webservice_url, params, authenticator_username, authenticator_password);
result.put("webservice_result", webservice_result);
this.writeLog("sap webservice_result:[" + webservice_result + "]");
if(null != webservice_result && !"".equals(webservice_result)){
XMLSerializer xmlSerializer = new XMLSerializer();
JSONObject results = (JSONObject) xmlSerializer.read(webservice_result);
JSONObject balanceResponse = results.getJSONObject("soap-env:Body").getJSONObject("n0:ZoaGlGetglaccperiodbalancesResponse");
this.writeLog("balanceResponse toString:[" + balanceResponse.toString() + "]");
String evRc = balanceResponse.getString("EvRc");//返回代码 S 成功,E 错误,W 警告,I 信息,A 中断
if ("S".equals(evRc)){
result.put("balanceResponse", balanceResponse);
} else {
String message = "";
if(isJson(balanceResponse.getString("EtReturn"))){
JSONObject EtReturn = balanceResponse.getJSONObject("EtReturn").getJSONObject("item");
String TYPE = EtReturn.getString("TYPE");
String MESSAGE = EtReturn.getString("MESSAGE");
message = MESSAGE;
}else{
JSONArray EtReturn = balanceResponse.getJSONArray("EtReturn");
for(int k=0;k<EtReturn.size();k++){
JSONObject EtReturnitem = EtReturn.getJSONObject(k);
String TYPE = EtReturnitem.getString("TYPE");
String MESSAGE = EtReturnitem.getString("MESSAGE");
if(!"".equals(MESSAGE)){
message += " " + MESSAGE;
}
}
}
result.put("success",false);
result.put("message",message);
}
}else{
result.put("success",false);
result.put("message","");
}
}catch (Exception e){
this.writeLog("Exception:[" + e.getMessage() + "]");
result.put("success",false);
result.put("message",e.toString()+"/"+e.getMessage());
e.printStackTrace();
} finally {
this.writeLog("resultmap:[" + result + "]");
}
return result;
}
// public String loginEas(String kingdeeHost, org.apache.axis.client.Call call, String USER_NAME, String USER_PASSWORD, String DATACENTER_NAME) {
// WSContext rs = null;
// try {
// call.setTargetEndpointAddress("http://ashca162.minol.org:8006/sap/bc/srt/wsdl/bndg_5914D161EA5B9D2FE100000019011AA2/wsdl11/allinone/ws_policy/document?sap-client=400");
//
// call.setOperationName("login");
// call.setTimeout(Integer.valueOf(1000 * 600000 * 60));
// call.setMaintainSession(true);
//
// String DB_TYPE = "0";
//
// call.addParameter("userName", XMLType.XSD_STRING, ParameterMode.IN);
// call.addParameter("password", XMLType.XSD_STRING, ParameterMode.IN);
// call.addParameter("slnName", XMLType.XSD_STRING, ParameterMode.IN);
// call.addParameter("dcName", XMLType.XSD_STRING, ParameterMode.IN);
// call.addParameter("language", XMLType.XSD_STRING, ParameterMode.IN);
// call.addParameter("dbType", XMLType.XSD_INT, ParameterMode.IN);
// logger.writeLog("kingdeeHost : " + kingdeeHost);
// call.setReturnType(new QName("urn:client", "WSContext"));
// call.setReturnClass(WSContext.class);
// logger.writeLog("DATACENTER_NAME : " + DATACENTER_NAME);
// rs = (WSContext) call.invoke(new Object[]{USER_NAME, USER_PASSWORD, "eas", DATACENTER_NAME, "l2", Integer.valueOf(DB_TYPE)});
// } catch (Exception e) {
// logger.writeLog("exception : " + e.getMessage());
// e.printStackTrace();
// }
// this.writeLog(" loginEas rs : " + rs.getSessionId());
// String sessionId = rs.getSessionId();
// this.writeLog(" loginEas sessionId : " + sessionId);
// return sessionId;
// }
public static boolean isJson(String content) {
try {
JSONObject.fromObject(content);
return true;
} catch (Exception e) {
return false;
}
}
public static boolean isJsonArray(String content) {
try {
JSONArray.fromObject(content);
return true;
} catch (Exception e) {
return false;
}
}
/**
* POST
* @param interface_url
* @return
*/
private String sendPostData(String interface_url,String params, String username, String password) {
String reponsedata = "";
try {
//设置超时时间
RequestConfig defaultRequestConfig = RequestConfig.custom()
.setSocketTimeout(30000)
.setConnectTimeout(30000)
.setConnectionRequestTimeout(30000)
.build();
//使用帮助类HttpClients创建CloseableHttpClient对象
CloseableHttpClient client;
if(!"".equals(username) && !"".equals(password)){
CredentialsProvider credsProvider = new BasicCredentialsProvider();
credsProvider.setCredentials(AuthScope.ANY,new UsernamePasswordCredentials(username, password));
client = HttpClients.custom().setDefaultCredentialsProvider(credsProvider).setDefaultRequestConfig(defaultRequestConfig).build();
}else{
client = HttpClients.createDefault();
}
//HTTP请求类型创建HttpPost实例
HttpPost post = new HttpPost(interface_url);
//使用addHeader方法添加请求头部,诸如User-Agent, Accept-Encoding等参数.
post.setHeader("Content-Type", "text/xml;charset=UTF-8");
//组织数据
StringEntity se = new StringEntity(params,"UTF-8");
//设置编码格式
se.setContentEncoding("utf-8");
//设置数据类型
se.setContentType("text/xml");
//对于POST请求,把请求体填充进HttpPost实体.
post.setEntity(se);
//通过执行HttpPost请求获取CloseableHttpResponse实例 ,从此CloseableHttpResponse实例中获取状态码,错误信息,以及响应页面等等.
CloseableHttpResponse response = client.execute(post);
int StatusCode = response.getStatusLine().getStatusCode();
this.writeLog("====>>>StatusCode["+StatusCode+"]");
//通过HttpResponse接口的getEntity方法返回响应信息并进行相应的处理
HttpEntity entity = response.getEntity();
reponsedata = EntityUtils.toString(entity);
//最后关闭HttpClient资源.
client.close();
} catch (IOException e) {
this.writeLog("====>>>sendPostData Exception["+e.getMessage() + "/" + e.toString()+"]");
// TODO Auto-generated catch block
e.printStackTrace();
}
return reponsedata;
}
}

View File

@ -0,0 +1,20 @@
package com.api.nonstandardext.zenner.utils;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
public class ZennerApiService extends BaseBean {
//通过parambs配置标识查找系统参数配置表获取配置值
public String getSystemConfigValue(String configKey){
String configValue = "";
RecordSet rs = new RecordSet();
String corpSecretSql = "select paramvalue from uf_systemconfig where uuid = '" + configKey + "'";
rs.execute(corpSecretSql);
if (rs.next()){
configValue = Util.null2String(rs.getString("paramvalue"));
}
return configValue;
}
}

View File

@ -0,0 +1,374 @@
package com.api.nonstandardext.zenner.utils;
import com.api.nonstandardext.allist.utils.DefaultTmForAllist;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.http.client.utils.DateUtils;
import weaver.general.BaseBean;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocketFactory;
import java.io.*;
import java.net.*;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Map;
import java.util.Set;
public class ZennerUtil {
public final static SimpleDateFormat formatYYYYMMDDHHMMSS = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
public final static SimpleDateFormat formatYYYYMMDD = new SimpleDateFormat("yyyy-MM-dd");
public final static SimpleDateFormat formatYYYYMMDD_NoSplit = new SimpleDateFormat("yyyyMMdd");
public static boolean isJsonObject(String content) {
try {
JSONObject.fromObject(content);
return true;
} catch (Exception e) {
return false;
}
}
public static boolean isJsonArray(String content) {
try {
JSONArray.fromObject(content);;
return true;
} catch (Exception e) {
return false;
}
}
public static String parseToDateString(Date date, SimpleDateFormat formatInfo) {
if (date == null) {
return "";
}
return formatInfo.format(date);
}
public static Date parseToDate(String dateString, SimpleDateFormat formatInfo){
try {
return formatInfo.parse(dateString);
} catch (ParseException e) {
e.printStackTrace();
}
return null;
}
public static String httpPostToken(String httpUrl, Map<String, String> headParams, String bodyParams) {
BaseBean log = new BaseBean();
log.writeLog(httpUrl);
log.writeLog(headParams);
log.writeLog(bodyParams);
String result = "";
HttpClient httpClient = new HttpClient();
PostMethod postMethod = new PostMethod(httpUrl);
Set<String> keySet = headParams.keySet();
for (String key : keySet) {
postMethod.setRequestHeader(key, headParams.get(key));
}
postMethod.setRequestBody(bodyParams);
postMethod.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
log.writeLog(postMethod);
try {
int httpStatus = httpClient.executeMethod(postMethod);
byte[] resultByte = postMethod.getResponseBody();
result = new String(resultByte, "UTF-8");
} catch (HttpException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return result;
}
public static String proxyHttp(boolean needProxy, String proxyIp, String proxyPort, String userId, String password, String url, String param, String encoding){
OutputStreamWriter out = null;
BufferedReader in = null;
String result = "";
BaseBean logger = new BaseBean();
try {
URL realUrl = new URL(url);
HttpURLConnection conn = null;
if (needProxy){
@SuppressWarnings("static-access")
Proxy proxy = new Proxy(Proxy.Type.DIRECT.HTTP, new InetSocketAddress(proxyIp, Integer.parseInt(proxyPort)));
conn = (HttpURLConnection) realUrl.openConnection(proxy);
} else {
conn = (HttpURLConnection) realUrl.openConnection();
}
logger.writeLog("发送 POST needProxy : " +needProxy);
logger.writeLog("发送 POST conn : " +conn);
logger.writeLog("发送 POST userId : " +userId);
logger.writeLog("发送 POST no proxy : ");
if (needProxy){
Authenticator.setDefault(new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
if (getRequestorType().equals( RequestorType.PROXY )) {
return new PasswordAuthentication(userId, password.toCharArray() );
}
return super.getPasswordAuthentication();
}
});
}
// 发送POST请求必须设置如下两行
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setRequestMethod("POST"); // POST方法
// 设置通用的请求属性
if (needProxy){
conn.setRequestProperty("accept", "*/*");
conn.setRequestProperty("connection", "Keep-Alive");
conn.setRequestProperty("user-agent","Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
}
// conn.setRequestProperty("Authorization", "Basic " + encoding);
logger.writeLog("发送 POST encoding : "+ encoding);
conn.setRequestProperty("Content-Type", "text/xml;charset=UTF-8");
conn.connect();
// 获取URLConnection对象对应的输出流
out = new OutputStreamWriter(conn.getOutputStream(), "UTF-8");
// 发送请求参数
out.write(param);
// flush输出流的缓冲
out.flush();
// 定义BufferedReader输入流来读取URL的响应
in = new BufferedReader(
new InputStreamReader(conn.getInputStream()));
String line;
while ((line = in.readLine()) != null) {
logger.writeLog("发送 POST line : "+ line);
result += line;
}
logger.writeLog("发送 POST result : "+ result);
} catch (Exception e) {
logger.writeLog("发送 POST 请求出现异常!"+e);
e.printStackTrace();
} finally{
try{
if(out!=null){
out.close();
}
if(in!=null){
in.close();
}
}
catch(IOException ex){
ex.printStackTrace();
}
}
return result;
}
public static String httpsGet(String baseUrl,String encoderNum) {
BufferedReader in = null;
BaseBean baseBean = new BaseBean();
try {
SSLContext sslContext = SSLContext.getInstance("TLSv1.2");
javax.net.ssl.TrustManager[] truset = new javax.net.ssl.TrustManager[1];
javax.net.ssl.TrustManager tm = new DefaultTmForAllist();
truset[0] = tm;
sslContext.init(null, truset, null);
SSLSocketFactory factory = sslContext.getSocketFactory();
URL u = new URL(baseUrl);
HttpsURLConnection huconn = (HttpsURLConnection) u.openConnection();
huconn.setSSLSocketFactory(factory);
huconn.setRequestProperty("Authorization","Basic " + encoderNum);
StringBuilder result = new StringBuilder();
huconn.connect();
// baseBean.writeLog("httpsGet execute baseUrl..1." + baseUrl);
in = new BufferedReader(new InputStreamReader(huconn.getInputStream(), "UTF-8"));
String line;
while ((line = in.readLine()) != null) {
result.append(line);
}
if (in != null) {
in.close();
}
// baseBean.writeLog("httpsGet execute result..1." + result.toString());
// 打印返回结果
return result.toString();
} catch (Exception e) {
baseBean.writeLog("httpsGet execute exception...message:" + e.getMessage());
if (in != null) {
try {
in.close();
} catch (IOException ioException) {
ioException.printStackTrace();
baseBean.writeLog("关闭报错");
baseBean.writeLog(ioException.getMessage());
}
}
return "";
}
}
public static String httpGet(String baseUrl){
String url = baseUrl;
try {
URL u = new URL(url);
HttpURLConnection huconn = (HttpURLConnection) u.openConnection();
BufferedReader in = null;
StringBuilder result = new StringBuilder();
huconn.connect();
in = new BufferedReader(new InputStreamReader(huconn.getInputStream(), "UTF-8"));
String line;
while ((line = in.readLine()) != null) {
result.append(line);
}
if (in != null) {
in.close();
}
return result.toString();
} catch (Exception e) {
return "";
}
}
public static String httpsPost(String httpUrl, String content) throws Exception {
BufferedReader in = null;
SSLContext sslContext = SSLContext.getInstance("TLSv1.2");
javax.net.ssl.TrustManager [] truset = new javax.net.ssl.TrustManager[1];
javax.net.ssl.TrustManager tm = new DefaultTmForAllist();
truset[0] = tm;
sslContext.init(null,truset,null);
SSLSocketFactory factory = sslContext.getSocketFactory();
//https://blog.csdn.net/pk5454754/article/details/80092974?utm_medium=distribute.pc_relevant_download.none-task-blog-baidujs-1.nonecase&depth_1-utm_source=distribute.pc_relevant_download.none-task-blog-baidujs-1.nonecase
URL u = new URL(httpUrl);
HttpsURLConnection conn = (HttpsURLConnection) u.openConnection();
conn.setDoOutput(true);
conn.addRequestProperty("connection", "Keep-Alive");
conn.setRequestMethod("POST");
conn.setSSLSocketFactory(factory);
StringBuilder result = new StringBuilder();
conn.connect();
DataOutputStream out = new DataOutputStream(conn.getOutputStream());
out.write(content.getBytes("utf-8"));
// 刷新、关闭
out.flush();
out.close();
in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8"));
String line;
while ((line = in.readLine()) != null) {
result.append(line);
}
if (in != null) {
in.close();
}
return result.toString();
}
public static String httpPostForXwwwForm(String httpUrl, Map<String, String> headParams, Map<String, String> paramsMap){
String result = "";
HttpClient httpClient = new HttpClient();
PostMethod postMethod = new PostMethod(httpUrl);
Set<String> keySet = headParams.keySet();
for (String key : keySet) {
postMethod.setRequestHeader(key, headParams.get(key));
}
Set<String> paramsSet = paramsMap.keySet();
for (String key : paramsSet) {
postMethod.setParameter(key, paramsMap.get(key));
}
postMethod.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
try {
int httpStatus = httpClient.executeMethod(postMethod);
byte[] resultByte = postMethod.getResponseBody();
result = new String(resultByte, "UTF-8");
} catch (HttpException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return result;
}
/**
*
*/
public static int getQuarter() {
Calendar c = Calendar.getInstance();
int month = c.get(c.MONTH) + 1;
int quarter = 0;
if (month >= 1 && month <= 3) {
quarter = 1;
} else if (month >= 4 && month <= 6) {
quarter = 2;
} else if (month >= 7 && month <= 9) {
quarter = 3;
} else {
quarter = 4;
}
return quarter;
}
/**
* num
*/
public static String[] getCurrQuarter(int num) {
String[] s = new String[2];
String str = "";
// 设置本年的季
Calendar quarterCalendar = null;
switch (num) {
case 1: // 本年到现在经过了一个季度在加上前4个季度
quarterCalendar = Calendar.getInstance();
quarterCalendar.set(Calendar.MONTH, 3);
quarterCalendar.set(Calendar.DATE, 1);
quarterCalendar.add(Calendar.DATE, -1);
str = DateUtils.formatDate(quarterCalendar.getTime(), "yyyy-MM-dd");
s[0] = str.substring(0, str.length() - 5) + "01-01";
s[1] = str;
break;
case 2: // 本年到现在经过了二个季度,在加上前三个季度
quarterCalendar = Calendar.getInstance();
quarterCalendar.set(Calendar.MONTH, 6);
quarterCalendar.set(Calendar.DATE, 1);
quarterCalendar.add(Calendar.DATE, -1);
str = DateUtils.formatDate(quarterCalendar.getTime(), "yyyy-MM-dd");
s[0] = str.substring(0, str.length() - 5) + "04-01";
s[1] = str;
break;
case 3:// 本年到现在经过了三个季度,在加上前二个季度
quarterCalendar = Calendar.getInstance();
quarterCalendar.set(Calendar.MONTH, 9);
quarterCalendar.set(Calendar.DATE, 1);
quarterCalendar.add(Calendar.DATE, -1);
str = DateUtils.formatDate(quarterCalendar.getTime(), "yyyy-MM-dd");
s[0] = str.substring(0, str.length() - 5) + "07-01";
s[1] = str;
break;
case 4:// 本年到现在经过了四个季度,在加上前一个季度
quarterCalendar = Calendar.getInstance();
str = DateUtils.formatDate(quarterCalendar.getTime(), "yyyy-MM-dd");
s[0] = str.substring(0, str.length() - 5) + "10-01";
s[1] = str.substring(0, str.length() - 5) + "12-31";
break;
}
return s;
}
}

View File

@ -0,0 +1,309 @@
package com.engine.hrm.cmd.departmentfielddefined;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.cloudstore.dev.api.util.TextUtil;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.biz.EncryptConfigBiz;
import com.engine.common.entity.BizLogContext;
import com.engine.common.entity.EncryptFieldEntity;
import com.engine.common.enums.EncryptMould;
import com.engine.core.interceptor.CommandContext;
import weaver.conn.RecordSet;
import weaver.general.LabelUtil;
import weaver.general.Util;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import weaver.hrm.definedfield.HrmDeptFieldManagerE9;
import weaver.hrm.definedfield.HrmFieldComInfo;
import weaver.matrix.MatrixUtil;
import weaver.systeminfo.SystemEnv;
import weaver.workflow.field.BrowserComInfo;
/**
*
* @author lvyi
*
*/
public class GetFieldDefinedCmd extends AbstractCommonCommand<Map<String, Object>> {
public GetFieldDefinedCmd(Map<String, Object> params, User user) {
this.user = user;
this.params = params;
}
@Override
public Map<String, Object> execute(CommandContext commandContext) {
Map<String, Object> retmap = new HashMap<String, Object>();
List<Map<String, Object>> lsFieldInfo = new ArrayList<Map<String, Object>>();
Map<String, Object> fieldInfo = null;
Map<String, Object> recordInfo = null;
Map<String, Object> propsInfo = null;
Map<String, Object> comInfo = null;
List<Object> fieldTypeInfo = null;
List<Object> lsComDetialInfo = null;
Map<String, Object> comDetialInfo = null;
try {
if (!HrmUserVarify.checkUserRight("DeptDefineInfo1:DeptMaintain1", user)) {
retmap.put("status", "-1");
retmap.put("message", SystemEnv.getHtmlLabelName(2012, user.getLanguage()));
return retmap;
}
int groupId = Util.getIntValue((String)params.get("groupId"));
boolean encryptEnable = EncryptConfigBiz.getEncryptEnable(EncryptMould.HRM.getCode());
int scopeId = 5;
BrowserComInfo BrowserComInfo = new BrowserComInfo();
HrmFieldComInfo HrmFieldComInfo = new HrmFieldComInfo();
HrmDeptFieldManagerE9 hfm = new HrmDeptFieldManagerE9(scopeId);
List lsGroup = hfm.getLsGroup();
lsGroup = hfm.getLsGroup();
int idx = 0;
boolean canDel = false;
for (int i = 0; lsGroup != null && i < lsGroup.size(); i++) {
String groupid = (String) lsGroup.get(i);
List lsField = hfm.getLsField(groupid);
if(!groupid.equals(""+groupId)){
continue;
}
if (lsField.size() == 0)
continue;
for (int j = 0; lsField != null && j < lsField.size(); j++) {
String fieldid = (String) lsField.get(j);
String issystem = HrmFieldComInfo.getIssystem(fieldid);
String fieldname = HrmFieldComInfo.getFieldname(fieldid);
boolean isUsed = false;
if (issystem.equals("1")) {
isUsed = true;
} else {
isUsed = hfm.getIsUsed(fieldid, fieldname);
}
String fieldlabel = HrmFieldComInfo.getLabel(fieldid);
String fieldfdbtype = HrmFieldComInfo.getFielddbtype(fieldid);
String fieldhtmltype = HrmFieldComInfo.getFieldhtmltype(fieldid);
String fieldtype = HrmFieldComInfo.getFieldType(fieldid);
String fielddmlurl = HrmFieldComInfo.getFieldDmlurl(fieldid);
String fieldstrlength = hfm.getStrLength(fieldfdbtype, fieldhtmltype, fieldtype);
String allowhide = HrmFieldComInfo.getAllowhide(fieldid);
String isUse = HrmFieldComInfo.getIsused(fieldid);
String isMand = HrmFieldComInfo.getIsmand(fieldid);
String dsporder = HrmFieldComInfo.getDsporder(fieldid);
String textheight = ""+HrmFieldComInfo.getTextheight(fieldid);
//判断人力资源类型 字段是否通过矩阵被流程引用
boolean isUsed_ = false;
if (fieldtype.equals("1") || fieldtype.equals("17")) {
isUsed_ = MatrixUtil.isUsed(fieldname, "2");
if (isUsed_)
isUsed = isUsed_;
}
List<Object> fieldTypeObj = new ArrayList<Object>();
String fieldType = "";
if (fieldhtmltype.equals("1")) {
fieldTypeObj.add("input");
fieldType = SystemEnv.getHtmlLabelName(688, user.getLanguage());
if (fieldhtmltype.equals("1")) {
if (fieldtype.equals("1")) {
fieldTypeObj.add("text");
fieldType += " " + SystemEnv.getHtmlLabelName(608, user.getLanguage());
fieldType += " " + SystemEnv.getHtmlLabelName(608, user.getLanguage()) + ":" + fieldstrlength;
fieldTypeObj.add(fieldstrlength);
} else if (fieldtype.equals("2")) {
fieldTypeObj.add("int");
fieldType += " " + SystemEnv.getHtmlLabelName(696, user.getLanguage());
} else if (fieldtype.equals("3")) {
fieldTypeObj.add("float");
fieldType += " " + SystemEnv.getHtmlLabelName(697, user.getLanguage());
}
}
} else if (fieldhtmltype.equals("2")) {
fieldTypeObj.add("textarea");
fieldType = SystemEnv.getHtmlLabelName(689, user.getLanguage());
//fieldType += " " + SystemEnv.getHtmlLabelName(689, user.getLanguage())+textheight+" "+(fieldtype.equals("1")?"":"");
} else if (fieldhtmltype.equals("3")) {
fieldTypeObj.add("browser");
List<Object> replaceDatas = new ArrayList<Object>();
Map<String, Object> tmp = new HashMap<String, Object>();
tmp.put("value", fieldtype);
tmp.put("valueSpan", SystemEnv.getHtmlLabelName(Util.getIntValue(BrowserComInfo.getBrowserlabelid(fieldtype), 0), user.getLanguage()));
Map<String, Object> tmp1 = new HashMap<String, Object>();
tmp1.put("id", fieldtype);
tmp1.put("name", SystemEnv.getHtmlLabelName(Util.getIntValue(BrowserComInfo.getBrowserlabelid(fieldtype), 0), user.getLanguage()));
replaceDatas.add(tmp1);
tmp.put("replaceDatas", replaceDatas);
fieldTypeObj.add(tmp);
if(fieldtype.equals("161")||fieldtype.equals("162") || fieldtype.equals("256") || fieldtype.equals("257")){
tmp = new HashMap<String, Object>();
tmp.put("value", fielddmlurl);
tmp.put("valueSpan", getName(fielddmlurl));
fieldTypeObj.add(tmp);
}
fieldType = SystemEnv.getHtmlLabelName(695, user.getLanguage());
fieldType += " " + SystemEnv.getHtmlLabelName(Util.getIntValue(BrowserComInfo.getBrowserlabelid(fieldtype), 0), user.getLanguage());
if ("emptyVal".equals(fielddmlurl) || "".equals(fielddmlurl)) {
} else {
fieldType += " " + getName(fielddmlurl);
}
} else if (fieldhtmltype.equals("4")) {
fieldTypeObj.add("check");
fieldType = SystemEnv.getHtmlLabelName(691, user.getLanguage());
} else if (fieldhtmltype.equals("5")) {
fieldTypeObj.add("select");
fieldTypeObj.add("select");
List<Object> datas = new ArrayList<Object>();
Map<String, Object> tmp = new HashMap<String, Object>();
Map<String, Object> data = null;
RecordSet rs = new RecordSet();
rs.executeSql("select selectvalue, selectname, isdefault, cancel from hrm_selectitem where fieldid=" + fieldid + " order by listorder");
int key = 0;
while (rs.next()) {
data = new HashMap<String, Object>();
data.put("option", rs.getString("selectname"));
data.put("default", rs.getString("isdefault"));
data.put("unuse", rs.getString("cancel"));
datas.add(data);
}
tmp.put("datas", datas);
tmp.put("sort", "horizontal");
fieldTypeObj.add(tmp);
fieldType = SystemEnv.getHtmlLabelName(690, user.getLanguage());
} else if (fieldhtmltype.equals("6")) {
fieldTypeObj.add("upload");
fieldTypeObj.add("file");
fieldType = SystemEnv.getHtmlLabelName(17616, user.getLanguage());
fieldType += " " + SystemEnv.getHtmlLabelName(20798, user.getLanguage());
//fieldType += " " + (fieldtype.equals("1") ? SystemEnv.getHtmlLabelName(20798, user.getLanguage()) : SystemEnv.getHtmlLabelName(20001, user.getLanguage()));
}
fieldInfo = new HashMap<String, Object>();
recordInfo = new HashMap<String, Object>();
recordInfo.put("id", fieldid);
recordInfo.put("fieldlabel", TextUtil.toBase64ForMultilang(new LabelUtil().getMultiLangLabel(fieldlabel)));
recordInfo.put("fieldname", fieldname);
recordInfo.put("fieldType", fieldType);
recordInfo.put("fieldTypeObj", fieldTypeObj);
recordInfo.put("enable", isUse);
recordInfo.put("required", isMand);
recordInfo.put("viewAttr", isUsed || issystem.equals("1") ? 1 : 2);
recordInfo.put("key", dsporder);
if (encryptEnable && ((fieldhtmltype.equals("1")||fieldhtmltype.equals("2")) && !issystem.equals("1")) ) {
//只支持单行文本,多行文本
String tablename = "hrmdepartmentdefined";
EncryptFieldEntity encryptFieldEntity = EncryptConfigBiz.getFieldEncryptConfig(tablename,fieldname);
recordInfo.put("encryptId", encryptFieldEntity!=null?encryptFieldEntity.getId():"");
recordInfo.put("tablename", tablename);
recordInfo.put("canEncrypt", "1");
}
fieldInfo.put("record", recordInfo);
propsInfo = new HashMap<String, Object>();
Map<String, Object> checkPropsInfo = new HashMap<String, Object>();
Map<String, Object> checkPropsDetialInfo = null;
checkPropsDetialInfo = new HashMap<String, Object>();
checkPropsDetialInfo.put("viewAttr", allowhide.equals("1") ? 2 : 1);
checkPropsInfo.put("enable", checkPropsDetialInfo);
checkPropsInfo.put("required", checkPropsDetialInfo);
propsInfo.put("checkProps", checkPropsInfo);
fieldInfo.put("props", propsInfo);
comInfo = new HashMap<String, Object>();
lsComDetialInfo = new ArrayList<Object>();
comDetialInfo = new HashMap<String, Object>();
comDetialInfo.put("label", "");
comDetialInfo.put("type", "INPUT");
comDetialInfo.put("width", "15%");
comDetialInfo.put("key", "fieldlabel");
comDetialInfo.put("viewAttr", "3");
lsComDetialInfo.add(comDetialInfo);
comInfo.put("fieldlabel", lsComDetialInfo);
lsComDetialInfo = new ArrayList<Object>();
comDetialInfo = new HashMap<String, Object>();
comDetialInfo.put("label", "");
comDetialInfo.put("type", "TEXT");
comDetialInfo.put("width", "15%");
comDetialInfo.put("key", "fieldname");
comDetialInfo.put("viewAttr", "3");
lsComDetialInfo.add(comDetialInfo);
comInfo.put("fieldname", lsComDetialInfo);
lsComDetialInfo = new ArrayList<Object>();
comDetialInfo = new HashMap<String, Object>();
comDetialInfo.put("label", "");
comDetialInfo.put("type", fieldhtmltype.equals("5") ? "CUSTOMFIELD" : "TEXT");
comDetialInfo.put("width", "60%");
comDetialInfo.put("key", "fieldType");
lsComDetialInfo.add(comDetialInfo);
comInfo.put("fieldType", lsComDetialInfo);
fieldInfo.put("com", comInfo);
fieldTypeInfo = new ArrayList<Object>();
fieldTypeInfo.add("select");
fieldTypeInfo.add("select");
Map<String, Object> fieldTypeParamInfo = new HashMap<String, Object>();
List<Object> lsFieldTypeParamDetialInfo = new ArrayList<Object>();
Map<String, Object> fieldTypeParamDetialInfo = null;
if (fieldhtmltype.equals("5")) {
//hfm.getSelectItem(fieldid);
RecordSet rs = new RecordSet();
rs.executeSql("select selectvalue, selectname, isdefault, cancel from hrm_selectitem where fieldid=" + fieldid + " order by listorder");
int key = 0;
while (rs.next()) {
fieldTypeParamDetialInfo = new HashMap<String, Object>();
fieldTypeParamDetialInfo.put("key", key++);
fieldTypeParamDetialInfo.put("id", rs.getString("selectvalue"));
fieldTypeParamDetialInfo.put("option", rs.getString("selectname"));
fieldTypeParamDetialInfo.put("default", rs.getString("isdefault"));
fieldTypeParamDetialInfo.put("unuse", rs.getString("cancel"));
lsFieldTypeParamDetialInfo.add(fieldTypeParamDetialInfo);
}
fieldTypeParamInfo.put("datas", lsFieldTypeParamDetialInfo);
fieldTypeParamInfo.put("sort", "horizontal");
fieldTypeInfo.add(fieldTypeParamInfo);
fieldInfo.put("fieldType", fieldTypeInfo);
}
lsFieldInfo.add(fieldInfo);
}
}
retmap.put("status", "1");
retmap.put("data", lsFieldInfo);
retmap.put("encryptEnable",encryptEnable);
} catch (Exception e) {
retmap.put("status", "-1");
retmap.put("message", SystemEnv.getHtmlLabelName(382661, user.getLanguage()));
writeLog(e);
}
return retmap;
}
private String getName(String showname) {
RecordSet rs = new RecordSet();
if (showname != null && !"".equals(showname)) {
//兼容老数据如果id有moduleid则去掉
int index = showname.indexOf(".");
if (index > 0) {
showname = showname.substring(index + 1);
}
String sql = "select name from datashowset where showname='" + showname + "'";
rs.executeSql(sql);
if (rs.next()) {
return Util.null2String(rs.getString("name"));
}
}
return "";
}
@Override
public BizLogContext getLogContext() {
// TODO Auto-generated method stub
return null;
}
}

View File

@ -0,0 +1,213 @@
package com.engine.hrm.cmd.departmentfielddefined;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.biz.SimpleBizLogger;
import com.engine.common.constant.BizLogSmallType4Hrm;
import com.engine.common.constant.BizLogType;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import com.engine.hrm.entity.FieldBean;
import com.engine.hrm.entity.FieldSelectOptionBean;
import com.engine.hrm.util.HrmUtil;
import weaver.conn.RecordSet;
import weaver.docs.docs.FieldParam;
import weaver.general.LabelUtil;
import weaver.general.Util;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import weaver.hrm.common.database.dialect.DialectUtil;
import weaver.hrm.definedfield.HrmDeptFieldManagerE9;
import weaver.hrm.definedfield.HrmFieldComInfo;
import weaver.matrix.MatrixUtil;
import weaver.systeminfo.SystemEnv;
/**
*
* @author lvyi
*
*/
public class SaveFieldDefinedCmd extends AbstractCommonCommand<Map<String, Object>>{
private SimpleBizLogger logger;
public SaveFieldDefinedCmd(Map<String, Object> params, User user) {
this.user = user;
this.params = params;
RecordSet rs = new RecordSet();
String sql = "";
String data = Util.null2String(params.get("data"));
JSONObject jsonObj = JSON.parseObject(data);
String groupId = Util.null2String(jsonObj.get("groupId"));
this.logger = new SimpleBizLogger();
BizLogContext bizLogContext = new BizLogContext();
bizLogContext.setLogType(BizLogType.HRM_ENGINE);//模块类型
bizLogContext.setBelongType(BizLogSmallType4Hrm.HRM_ENGINE_DEPARTMENTFIELDDEFINED);//所属大类型
bizLogContext.setLogSmallType(BizLogSmallType4Hrm.HRM_ENGINE_DEPARTMENTFIELDDEFINED);//当前小类型
bizLogContext.setParams(params);//当前request请求参数
logger.setUser(user);//当前操作人
String mainSql = "SELECT a.*, b.labelname FROM hrm_fieldgroup a, htmllabelinfo b WHERE a.grouplabel= b.indexid and a.id= "+groupId+" and b.languageid="+user.getLanguage();
logger.setMainSql(mainSql,"id");//主表sql
logger.setMainPrimarykey("id");//主日志表唯一key
logger.setMainTargetNameColumn("labelname");//当前targetName对应的列对应日志中的对象名
SimpleBizLogger.SubLogInfo subLogInfo = logger.getNewSubLogInfo();
String subSql = "SELECT * FROM hrm_formfield WHERE groupid = "+groupId;
subLogInfo.setSubSql(subSql,"fieldid");
logger.addSubLogInfo(subLogInfo);
logger.before(bizLogContext);
}
@Override
public Map<String, Object> execute(CommandContext commandContext) {
Map<String, Object> retmap = new HashMap<String, Object>();
RecordSet rs = new RecordSet();
HrmFieldComInfo HrmFieldComInfo = new HrmFieldComInfo();
String sql = "";
try {
if(!HrmUserVarify.checkUserRight("DeptDefineInfo1:DeptMaintain1",user)) {
retmap.put("status", "-1");
retmap.put("message", SystemEnv.getHtmlLabelName(2012, user.getLanguage()));
return retmap;
}
String data = Util.null2String(params.get("data"));
JSONObject jsonObj = JSON.parseObject(data);
String groupId = Util.null2String(jsonObj.get("groupId"));
String groupType = "";
sql = "SELECT grouptype FROM hrm_fieldgroup WHERE id="+groupId;
rs.executeSql(sql);
if(rs.next()){
groupType = rs.getString("groupType");
}
List<String> listFieldLabel = new ArrayList<String>();
List<String> listFieldName = new ArrayList<String>();
sql = " SELECT fieldlabel FROM hrm_formfield WHERE groupid IN (SELECT id FROM hrm_fieldgroup WHERE grouptype = "+groupType+") and groupid not in("+groupId+")";
rs.executeQuery(sql);
while(rs.next()){
listFieldLabel.add(SystemEnv.getHtmlLabelNames(rs.getString("fieldlabel"), user.getLanguage()));
}
sql = " SELECT fieldname FROM hrm_formfield WHERE groupid IN (SELECT id FROM hrm_fieldgroup WHERE grouptype = "+groupType+") and groupid not in("+groupId+")";
rs.executeQuery(sql);
while(rs.next()){
listFieldName.add(rs.getString("fieldname").toLowerCase());
}
JSONArray records = (JSONArray)jsonObj.get("records");
for(int i=0; i<records.size();i++){
FieldBean fieldBean = (FieldBean) JSONObject.toJavaObject((JSONObject)records.get(i), FieldBean.class);
listFieldLabel.add(Util.formatMultiLang(Util.null2String(fieldBean.getFieldlabel()),""+user.getLanguage()));
listFieldName.add(Util.null2String(fieldBean.getFieldname()).toLowerCase());
}
if(listFieldLabel.size() != new HashSet<String>(listFieldLabel).size()||
listFieldName.size() != new HashSet<String>(listFieldName).size()){
retmap.put("status", "-1");
retmap.put("message", SystemEnv.getHtmlLabelName(383055, user.getLanguage()));
return retmap;
}
for(int i=0; i<records.size();i++){
FieldBean fieldBean = (FieldBean) JSONObject.toJavaObject((JSONObject)records.get(i), FieldBean.class);
fieldBean.initFieldType("department");
this.save(fieldBean,groupId);
}
HrmFieldComInfo.removeFieldCache();
//同步部门数据到矩阵
MatrixUtil.sysDepartmentData();
retmap.put("status", "1");
} catch (Exception e) {
retmap.put("status", "-1");
retmap.put("message", SystemEnv.getHtmlLabelName(382661,user.getLanguage()));
writeLog(e);
}
return retmap;
}
private void save(FieldBean fieldBean, String groupId){
try {
HrmUtil hrmUtil = new HrmUtil();
HrmDeptFieldManagerE9 hfm = new HrmDeptFieldManagerE9(5);
String fieldId = Util.null2String(fieldBean.getId());
String fieldLabel = Util.null2String(fieldBean.getFieldlabel());
String fieldName = Util.null2String(fieldBean.getFieldname());
String fieldHtmlType = "";
String type = "";
String typeDetial = "";
String dmlUrl = "";
if(fieldBean.getFieldTypeBean()!=null){
fieldHtmlType = Util.null2String(fieldBean.getFieldTypeBean().getFieldHtmlType());
type = Util.null2String(fieldBean.getFieldTypeBean().getFieldType());
if(fieldHtmlType.equals("1")||fieldHtmlType.equals("2")){
typeDetial = Util.null2String(fieldBean.getFieldTypeBean().getOtherParam());
}else if(fieldHtmlType.equals("66") || fieldHtmlType.equals("67")){
dmlUrl = Util.null2String(fieldBean.getFieldTypeBean().getOtherParam());
} else if (type.equals("161") || type.equals("162") || type.equals("256")|| type.equals("257")) {
dmlUrl = Util.null2String(fieldBean.getFieldTypeBean().getOtherParam());
}
}
String isUse = Util.null2String(fieldBean.getEnable(),"0");
String isMand = Util.null2String(fieldBean.getRequired(),"0");
String fieldOrder = Util.null2String(fieldBean.getKey());
int temId = Util.getIntValue(fieldId,-1);
//int lableid = hrmUtil.getFieldLabelId(fieldLabel);
int lableid = new LabelUtil().getLabelId(fieldLabel);
if(Util.null2String(fieldId).length()==0){
FieldParam fp = new FieldParam();
if(fieldHtmlType.equals("1")){
fp.setSimpleText(Util.getIntValue(type,-1),typeDetial);
}else if(fieldHtmlType.equals("2")){
fp.setText();
}else if(fieldHtmlType.equals("3")){
fp.setBrowser(Util.getIntValue(type,-1));
}else if(fieldHtmlType.equals("4")){
fp.setCheck();
}else if(fieldHtmlType.equals("5")){
fp.setSelect();
}else if(fieldHtmlType.equals("6")){
fp.setAttach();
}
temId = hfm.addField(fieldName, fp.getFielddbtype(), fieldHtmlType, type, ""+lableid, fieldOrder, isMand, isUse, groupId, dmlUrl);
}else{
//只允许更改显示属性,数据库层面的不允许修改
hfm.editField(fieldId, ""+lableid, fieldOrder, isMand, isUse, groupId);
}
if(fieldHtmlType.equals("5")){
List<FieldSelectOptionBean> lsSelectOption = fieldBean.getFieldTypeBean().getLsSelectOption();
hfm.checkSelectField(temId, lsSelectOption);
}
}catch (Exception e) {
writeLog(e);
}
}
@Override
public BizLogContext getLogContext() {
return null;
}
@Override
public List<BizLogContext> getLogContexts() {
return logger.getBizLogContexts();
}
}

View File

@ -0,0 +1,189 @@
package com.engine.hrm.cmd.organization;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.hrm.company.DepartmentComInfo;
import weaver.hrm.definedfield.HrmDeptFieldManager;
import weaver.hrm.definedfield.HrmDeptFieldManagerE9;
import weaver.hrm.definedfield.HrmFieldComInfo;
import weaver.hrm.definedfield.HrmFieldGroupComInfo;
import weaver.systeminfo.SystemEnv;
import com.api.browser.bean.SearchConditionItem;
import com.api.hrm.bean.HrmFieldBean;
import com.api.hrm.util.HrmFieldSearchConditionComInfo;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import com.engine.hrm.util.HrmOrganizationUtil;
public class GetDepartmentFormFieldCmd extends AbstractCommonCommand<Map<String, Object>> {
public GetDepartmentFormFieldCmd(Map<String, Object> params, User user) {
this.user = user;
this.params = params;
}
@Override
public Map<String, Object> execute(CommandContext commandContext) {
Map<String, Object> retmap = new HashMap<String, Object>();
List<Map<String, Object>> grouplist = new ArrayList<Map<String, Object>>();
Map<String, Object> groupitem = null;
List<Object> itemlist = null;
try {
String id = Util.null2String(params.get("id"));
int viewattr = Util.getIntValue((String)params.get("viewattr"),1);
String nodeType = Util.null2String(params.get("type"));
String addType = Util.null2String(params.get("addType"));
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
String subcompanyid1 = "";
String supdepid = "";
if(addType.equals("normal")){
if(nodeType.equals("subcompany")){
subcompanyid1 = id;
}else{
subcompanyid1 = departmentComInfo.getSubcompanyid1(id);
}
}else if(addType.equals("sibling")){
subcompanyid1 = departmentComInfo.getSubcompanyid1(id);
supdepid = departmentComInfo.getDepartmentsupdepid(id);
}else if(addType.equals("child")){
subcompanyid1 = departmentComInfo.getSubcompanyid1(id);
supdepid = id;
}
HrmFieldGroupComInfo HrmFieldGroupComInfo = new HrmFieldGroupComInfo();
HrmFieldComInfo HrmFieldComInfo = new HrmFieldComInfo();
HrmFieldSearchConditionComInfo hrmFieldSearchConditionComInfo = new HrmFieldSearchConditionComInfo();
SearchConditionItem searchConditionItem = null;
HrmFieldBean hrmFieldBean = null;
HrmDeptFieldManagerE9 hfm = new HrmDeptFieldManagerE9(5);
hfm.isReturnDecryptData(true);
hfm.getCustomData(Util.getIntValue(id));
List lsGroup = hfm.getLsGroup();
for (int tmp = 0; lsGroup != null && tmp < lsGroup.size(); tmp++) {
String groupid = (String) lsGroup.get(tmp);
List lsField = hfm.getLsField(groupid);
//if (lsField.size() == 0) continue;
//if (hfm.getGroupCount(lsField) == 0) continue;
//if(!Util.null2String(HrmFieldGroupComInfo.getIsShow(groupid)).equals("1"))continue;
boolean groupHide = lsField.size() == 0 || hfm.getGroupCount(lsField) == 0 || !Util.null2String(HrmFieldGroupComInfo.getIsShow(groupid)).equals("1");
String grouplabel = HrmFieldGroupComInfo.getLabel(groupid);
itemlist = new ArrayList<Object>();
groupitem = new HashMap<String, Object>();
groupitem.put("title", SystemEnv.getHtmlLabelNames(grouplabel, user.getLanguage()));
groupitem.put("hide", groupHide);
groupitem.put("defaultshow", true);
for (int j = 0; lsField != null && j < lsField.size(); j++) {
String fieldid = (String) lsField.get(j);
String fieldname = HrmFieldComInfo.getFieldname(fieldid);
String isuse = HrmFieldComInfo.getIsused(fieldid);
if (!isuse.equals("1"))continue;
int tmpViewattr = viewattr;
String rules = "";
String fieldlabel = HrmFieldComInfo.getLabel(fieldid);
String fieldhtmltype = HrmFieldComInfo.getFieldhtmltype(fieldid);
String type = HrmFieldComInfo.getFieldType(fieldid);
String dmlurl = Util.null2String(HrmFieldComInfo.getFieldDmlurl(fieldid));
String fieldValue = "";
if(addType.length()>0) {
}else {
if (HrmFieldComInfo.getIssystem(fieldid).equals("1")) {
fieldValue = hfm.getData(fieldname);
} else {
fieldValue = hfm.getData("hrmdepartmentdefined", fieldname);
}
}
if(!groupHide && tmpViewattr==2&&HrmFieldComInfo.getIsmand(fieldid).equals("1")){
tmpViewattr=3;
if("1".equals(fieldhtmltype) && "2".equals(type)){
rules = "required|integer";
}else{
rules = "required|string";
}
}
if(subcompanyid1.length()>0 && fieldname.equals("subcompanyid1")){
fieldValue = subcompanyid1;
}
if(supdepid.length()>0 && fieldname.equals("supdepid")){
fieldValue = supdepid;
}
if(fieldname.equals("showid")){
if(addType.length()>0){
continue;
}else{
fieldValue = id;
tmpViewattr = 1;
}
}
hrmFieldBean = new HrmFieldBean();
hrmFieldBean.setFieldid(fieldid);
hrmFieldBean.setFieldname(fieldname);
hrmFieldBean.setFieldlabel(fieldlabel);
hrmFieldBean.setFieldhtmltype(fieldhtmltype);
hrmFieldBean.setType(type);
hrmFieldBean.setIsFormField(true);
hrmFieldBean.setIssystem("1");
hrmFieldBean.setFieldvalue(fieldValue);
hrmFieldBean.setDmlurl(dmlurl);
hrmFieldBean.setViewAttr(tmpViewattr);
hrmFieldBean.setRules(rules);
if(hrmFieldBean.getFieldname().equals("subcompanyid1")||hrmFieldBean.getFieldname().equals("supdepid")){
hrmFieldBean.setHideVirtualOrg(true);
}
if(hrmFieldBean.getFieldname().equals("departmentcode")){
hrmFieldBean.setMultilang(false);
}
searchConditionItem = hrmFieldSearchConditionComInfo.getSearchConditionItem(hrmFieldBean, user);
if(searchConditionItem!=null){
searchConditionItem.setLabelcol(8);
searchConditionItem.setFieldcol(16);
}
if(fieldname.equals("showorder")){
searchConditionItem.setPrecision(2);
}
if(fieldname.equals("showid")){
Map<String, Object> otherParams = new HashMap<String, Object>();
otherParams.put("hasBorder", true);
searchConditionItem.setOtherParams(otherParams);
}
if("6".equals(fieldhtmltype)){//附件
Map<String, Object> otherParams1 = new HashMap<String, Object>();
otherParams1.put("showOrder", false);
searchConditionItem.setOtherParams(otherParams1);
}
itemlist.add(searchConditionItem);
}
groupitem.put("items", itemlist);
grouplist.add(groupitem);
}
retmap.put("status", "1");
retmap.put("id", id);
retmap.put("titleInfo", HrmOrganizationUtil.getTitleInfo(id, "department", user));
retmap.put("formField", grouplist);
} catch (Exception e) {
retmap.put("status", "-1");
retmap.put("message", SystemEnv.getHtmlLabelName(382661,user.getLanguage()));
writeLog(e);
}
return retmap;
}
@Override
public BizLogContext getLogContext() {
return null;
}
}

View File

@ -0,0 +1,183 @@
package com.engine.hrm.cmd.organization;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.hrm.company.SubCompanyComInfo;
import weaver.hrm.definedfield.HrmDeptFieldManager;
import weaver.hrm.definedfield.HrmDeptFieldManagerE9;
import weaver.hrm.definedfield.HrmFieldComInfo;
import weaver.hrm.definedfield.HrmFieldGroupComInfo;
import weaver.systeminfo.SystemEnv;
import com.api.browser.bean.SearchConditionItem;
import com.api.hrm.bean.HrmFieldBean;
import com.api.hrm.util.HrmFieldSearchConditionComInfo;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import com.engine.hrm.util.HrmOrganizationUtil;
public class GetSubCompanyFormFieldCmd extends AbstractCommonCommand<Map<String, Object>> {
public GetSubCompanyFormFieldCmd(Map<String, Object> params, User user) {
this.user = user;
this.params = params;
}
@Override
public Map<String, Object> execute(CommandContext commandContext) {
Map<String, Object> retmap = new HashMap<String, Object>();
List<Map<String, Object>> grouplist = new ArrayList<Map<String, Object>>();
Map<String, Object> groupitem = null;
List<Object> itemlist = null;
try {
String id = Util.null2String(params.get("id"));
int viewattr = Util.getIntValue((String)params.get("viewattr"),1);
String addType = Util.null2String(params.get("addType"));
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
String supsubcomid = "";
if(addType.equals("sibling")){
supsubcomid = subCompanyComInfo.getSupsubcomid(id);
}else if(addType.equals("child")){
supsubcomid = id;
}
if(addType.length()>0){
id = "";
}
HrmFieldGroupComInfo HrmFieldGroupComInfo = new HrmFieldGroupComInfo();
HrmFieldComInfo HrmFieldComInfo = new HrmFieldComInfo();
HrmFieldSearchConditionComInfo hrmFieldSearchConditionComInfo = new HrmFieldSearchConditionComInfo();
SearchConditionItem searchConditionItem = null;
HrmFieldBean hrmFieldBean = null;
HrmDeptFieldManagerE9 hfm = new HrmDeptFieldManagerE9(4);
hfm.isReturnDecryptData(true);
hfm.getCustomData(Util.getIntValue(id));
List lsGroup = hfm.getLsGroup();
for (int tmp = 0; lsGroup != null && tmp < lsGroup.size(); tmp++) {
String groupid = (String) lsGroup.get(tmp);
List lsField = hfm.getLsField(groupid);
//if (lsField.size() == 0) continue;
//if (hfm.getGroupCount(lsField) == 0) continue;
//if(!Util.null2String(HrmFieldGroupComInfo.getIsShow(groupid)).equals("1"))continue;
boolean groupHide = lsField.size() == 0 || hfm.getGroupCount(lsField) == 0 || !Util.null2String(HrmFieldGroupComInfo.getIsShow(groupid)).equals("1");
String grouplabel = HrmFieldGroupComInfo.getLabel(groupid);
itemlist = new ArrayList<Object>();
groupitem = new HashMap<String, Object>();
groupitem.put("title", SystemEnv.getHtmlLabelNames(grouplabel, user.getLanguage()));
groupitem.put("hide", groupHide);
groupitem.put("defaultshow", true);
for (int j = 0; lsField != null && j < lsField.size(); j++) {
String fieldid = (String) lsField.get(j);
String fieldname = HrmFieldComInfo.getFieldname(fieldid);
String isuse = HrmFieldComInfo.getIsused(fieldid);
if (!isuse.equals("1"))continue;
int tmpViewattr = viewattr;
String rules = "";
String fieldlabel = HrmFieldComInfo.getLabel(fieldid);
String fieldhtmltype = HrmFieldComInfo.getFieldhtmltype(fieldid);
String type = HrmFieldComInfo.getFieldType(fieldid);
String dmlurl = Util.null2String(HrmFieldComInfo.getFieldDmlurl(fieldid));
String fieldValue = "";
if(addType.length()>0) {
}else{
if (HrmFieldComInfo.getIssystem(fieldid).equals("1")) {
fieldValue = hfm.getData(fieldname);
} else {
fieldValue = hfm.getData("hrmsubcompanydefined", fieldname);
}
}
if(!groupHide && tmpViewattr==2&&HrmFieldComInfo.getIsmand(fieldid).equals("1")){
tmpViewattr=3;
if("1".equals(fieldhtmltype) && "2".equals(type)){
rules = "required|integer";
}else{
rules = "required|string";
}
}
if ("84".equals(fieldid)) {
if (user.getUID() != 1)
continue;
fieldValue = fieldValue.equals("0") ? "" : fieldValue;
}
if(supsubcomid.length()>0 && fieldname.equals("supsubcomid")){
fieldValue = supsubcomid;
}
if(fieldname.equals("subshowid")){
if(addType.length()>0){
continue;
}else{
fieldValue = id;
tmpViewattr = 1;
}
}
hrmFieldBean = new HrmFieldBean();
hrmFieldBean.setFieldid(fieldid);
hrmFieldBean.setFieldname(fieldname);
hrmFieldBean.setFieldlabel(fieldlabel);
hrmFieldBean.setFieldhtmltype(fieldhtmltype);
hrmFieldBean.setType(type);
hrmFieldBean.setIsFormField(true);
hrmFieldBean.setFieldvalue(fieldValue);
hrmFieldBean.setDmlurl(dmlurl);
hrmFieldBean.setViewAttr(tmpViewattr);
hrmFieldBean.setRules(rules);
hrmFieldBean.setIssystem("1");
if(hrmFieldBean.getFieldname().equals("supsubcomid")){
hrmFieldBean.setHideVirtualOrg(true);
}
if(hrmFieldBean.getFieldname().equals("subcompanycode")) {
hrmFieldBean.setMultilang(false);
}
searchConditionItem = hrmFieldSearchConditionComInfo.getSearchConditionItem(hrmFieldBean, user);
if(searchConditionItem!=null){
searchConditionItem.setLabelcol(8);
searchConditionItem.setFieldcol(16);
}
if(hrmFieldBean.getFieldname().equals("showorder")){
searchConditionItem.setPrecision(2);
}
if(fieldname.equals("subshowid")){
Map<String, Object> otherParams = new HashMap<String, Object>();
otherParams.put("hasBorder", true);
searchConditionItem.setOtherParams(otherParams);
}
if("6".equals(fieldhtmltype)){//附件
Map<String, Object> otherParams1 = new HashMap<String, Object>();
otherParams1.put("showOrder", false);
searchConditionItem.setOtherParams(otherParams1);
}
itemlist.add(searchConditionItem);
}
groupitem.put("items", itemlist);
grouplist.add(groupitem);
}
retmap.put("status", "1");
retmap.put("id", id);
retmap.put("titleInfo", HrmOrganizationUtil.getTitleInfo(id, "subcompany", user));
retmap.put("formField", grouplist);
} catch (Exception e) {
retmap.put("status", "-1");
retmap.put("message", SystemEnv.getHtmlLabelName(382661,user.getLanguage()));
writeLog(e);
}
return retmap;
}
@Override
public BizLogContext getLogContext() {
return null;
}
}

View File

@ -0,0 +1,310 @@
package com.engine.hrm.cmd.subcompanyfielddefined;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.cloudstore.dev.api.util.TextUtil;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.biz.EncryptConfigBiz;
import com.engine.common.entity.BizLogContext;
import com.engine.common.entity.EncryptFieldEntity;
import com.engine.common.enums.EncryptMould;
import com.engine.core.interceptor.CommandContext;
import weaver.conn.RecordSet;
import weaver.general.LabelUtil;
import weaver.general.Util;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import weaver.hrm.definedfield.HrmDeptFieldManagerE9;
import weaver.hrm.definedfield.HrmFieldComInfo;
import weaver.matrix.MatrixUtil;
import weaver.systeminfo.SystemEnv;
import weaver.workflow.field.BrowserComInfo;
/**
*
* @author lvyi
*
*/
public class GetFieldDefinedCmd extends AbstractCommonCommand<Map<String, Object>> {
public GetFieldDefinedCmd(Map<String, Object> params, User user) {
this.user = user;
this.params = params;
}
@Override
public Map<String, Object> execute(CommandContext commandContext) {
Map<String, Object> retmap = new HashMap<String, Object>();
List<Map<String, Object>> lsFieldInfo = new ArrayList<Map<String, Object>>();
Map<String, Object> fieldInfo = null;
Map<String, Object> recordInfo = null;
Map<String, Object> propsInfo = null;
Map<String, Object> comInfo = null;
List<Object> fieldTypeInfo = null;
List<Object> lsComDetialInfo = null;
Map<String, Object> comDetialInfo = null;
try {
if (!HrmUserVarify.checkUserRight("SubCompanyDefineInfo1:SubMaintain1", user)) {
retmap.put("status", "-1");
retmap.put("message", SystemEnv.getHtmlLabelName(2012, user.getLanguage()));
return retmap;
}
int groupId = Util.getIntValue((String)params.get("groupId"));
boolean encryptEnable = EncryptConfigBiz.getEncryptEnable(EncryptMould.HRM.getCode());
int scopeId = 4;
BrowserComInfo BrowserComInfo = new BrowserComInfo();
HrmFieldComInfo HrmFieldComInfo = new HrmFieldComInfo();
HrmDeptFieldManagerE9 hfm = new HrmDeptFieldManagerE9(scopeId);
List lsGroup = hfm.getLsGroup();
lsGroup = hfm.getLsGroup();
int idx = 0;
boolean canDel = false;
for (int i = 0; lsGroup != null && i < lsGroup.size(); i++) {
String groupid = (String) lsGroup.get(i);
List lsField = hfm.getLsField(groupid);
if(!groupid.equals(""+groupId)){
continue;
}
if (lsField.size() == 0)
continue;
for (int j = 0; lsField != null && j < lsField.size(); j++) {
String fieldid = (String) lsField.get(j);
String issystem = HrmFieldComInfo.getIssystem(fieldid);
String fieldname = HrmFieldComInfo.getFieldname(fieldid);
boolean isUsed = false;
if (issystem.equals("1")) {
isUsed = true;
} else {
isUsed = hfm.getIsUsed(fieldid, fieldname);
}
String fieldlabel = HrmFieldComInfo.getLabel(fieldid);
String fieldfdbtype = HrmFieldComInfo.getFielddbtype(fieldid);
String fieldhtmltype = HrmFieldComInfo.getFieldhtmltype(fieldid);
String fieldtype = HrmFieldComInfo.getFieldType(fieldid);
String fielddmlurl = HrmFieldComInfo.getFieldDmlurl(fieldid);
String fieldstrlength = hfm.getStrLength(fieldfdbtype, fieldhtmltype, fieldtype);
String allowhide = HrmFieldComInfo.getAllowhide(fieldid);
String isUse = HrmFieldComInfo.getIsused(fieldid);
String isMand = HrmFieldComInfo.getIsmand(fieldid);
String dsporder = HrmFieldComInfo.getDsporder(fieldid);
String textheight = ""+HrmFieldComInfo.getTextheight(fieldid);
//判断人力资源类型 字段是否通过矩阵被流程引用
boolean isUsed_ = false;
if (fieldtype.equals("1") || fieldtype.equals("17")) {
isUsed_ = MatrixUtil.isUsed(fieldname, "1");
if (isUsed_)
isUsed = isUsed_;
}
List<Object> fieldTypeObj = new ArrayList<Object>();
String fieldType = "";
if (fieldhtmltype.equals("1")) {
fieldTypeObj.add("input");
fieldType = SystemEnv.getHtmlLabelName(688, user.getLanguage());
if (fieldhtmltype.equals("1")) {
if (fieldtype.equals("1")) {
fieldTypeObj.add("text");
fieldType += " " + SystemEnv.getHtmlLabelName(608, user.getLanguage());
fieldType += " " + SystemEnv.getHtmlLabelName(608, user.getLanguage()) + ":" + fieldstrlength;
fieldTypeObj.add(fieldstrlength);
} else if (fieldtype.equals("2")) {
fieldTypeObj.add("int");
fieldType += " " + SystemEnv.getHtmlLabelName(696, user.getLanguage());
} else if (fieldtype.equals("3")) {
fieldTypeObj.add("float");
fieldType += " " + SystemEnv.getHtmlLabelName(697, user.getLanguage());
}
}
} else if (fieldhtmltype.equals("2")) {
fieldTypeObj.add("textarea");
fieldType = SystemEnv.getHtmlLabelName(689, user.getLanguage());
//fieldType += " " + SystemEnv.getHtmlLabelName(689, user.getLanguage())+textheight+" "+(fieldtype.equals("1")?"":"");
} else if (fieldhtmltype.equals("3")) {
fieldTypeObj.add("browser");
List<Object> replaceDatas = new ArrayList<Object>();
Map<String, Object> tmp = new HashMap<String, Object>();
tmp.put("value", fieldtype);
tmp.put("valueSpan", SystemEnv.getHtmlLabelName(Util.getIntValue(BrowserComInfo.getBrowserlabelid(fieldtype), 0), user.getLanguage()));
Map<String, Object> tmp1 = new HashMap<String, Object>();
tmp1.put("id", fieldtype);
tmp1.put("name", SystemEnv.getHtmlLabelName(Util.getIntValue(BrowserComInfo.getBrowserlabelid(fieldtype), 0), user.getLanguage()));
replaceDatas.add(tmp1);
tmp.put("replaceDatas", replaceDatas);
fieldTypeObj.add(tmp);
if(fieldtype.equals("161")||fieldtype.equals("162") || fieldtype.equals("256") || fieldtype.equals("257")){
tmp = new HashMap<String, Object>();
tmp.put("value", fielddmlurl);
tmp.put("valueSpan", getName(fielddmlurl));
fieldTypeObj.add(tmp);
}
fieldType = SystemEnv.getHtmlLabelName(695, user.getLanguage());
fieldType += " " + SystemEnv.getHtmlLabelName(Util.getIntValue(BrowserComInfo.getBrowserlabelid(fieldtype), 0), user.getLanguage());
if ("emptyVal".equals(fielddmlurl) || "".equals(fielddmlurl)) {
} else {
fieldType += " " + getName(fielddmlurl);
}
} else if (fieldhtmltype.equals("4")) {
fieldTypeObj.add("check");
fieldType = SystemEnv.getHtmlLabelName(691, user.getLanguage());
} else if (fieldhtmltype.equals("5")) {
fieldTypeObj.add("select");
fieldTypeObj.add("select");
List<Object> datas = new ArrayList<Object>();
Map<String, Object> tmp = new HashMap<String, Object>();
Map<String, Object> data = null;
RecordSet rs = new RecordSet();
rs.executeSql("select selectvalue, selectname, isdefault, cancel from hrm_selectitem where fieldid=" + fieldid + " order by listorder");
int key = 0;
while (rs.next()) {
data = new HashMap<String, Object>();
data.put("option", rs.getString("selectname"));
data.put("default", rs.getString("isdefault"));
data.put("unuse", rs.getString("cancel"));
datas.add(data);
}
tmp.put("datas", datas);
tmp.put("sort", "horizontal");
fieldTypeObj.add(tmp);
fieldType = SystemEnv.getHtmlLabelName(690, user.getLanguage());
} else if (fieldhtmltype.equals("6")) {
fieldTypeObj.add("upload");
fieldTypeObj.add("file");
fieldType = SystemEnv.getHtmlLabelName(17616, user.getLanguage());
fieldType += " " + SystemEnv.getHtmlLabelName(20798, user.getLanguage());
//fieldType += " " + (fieldtype.equals("1") ? SystemEnv.getHtmlLabelName(20798, user.getLanguage()) : SystemEnv.getHtmlLabelName(20001, user.getLanguage()));
}
fieldInfo = new HashMap<String, Object>();
recordInfo = new HashMap<String, Object>();
recordInfo.put("id", fieldid);
recordInfo.put("fieldlabel", TextUtil.toBase64ForMultilang(new LabelUtil().getMultiLangLabel(fieldlabel)));
recordInfo.put("fieldname", fieldname);
recordInfo.put("fieldType", fieldType);
recordInfo.put("fieldTypeObj", fieldTypeObj);
recordInfo.put("enable", isUse);
recordInfo.put("required", isMand);
recordInfo.put("viewAttr", isUsed || issystem.equals("1") ? 1 : 2);
recordInfo.put("key", dsporder);
if (encryptEnable && ((fieldhtmltype.equals("1")||fieldhtmltype.equals("2")) && !issystem.equals("1")) ) {
//只支持单行文本,多行文本
String tablename = "hrmsubcompanydefined";
EncryptFieldEntity encryptFieldEntity = EncryptConfigBiz.getFieldEncryptConfig(tablename,fieldname);
recordInfo.put("encryptId", encryptFieldEntity!=null?encryptFieldEntity.getId():"");
recordInfo.put("tablename", tablename);
recordInfo.put("canEncrypt", "1");
}
fieldInfo.put("record", recordInfo);
propsInfo = new HashMap<String, Object>();
Map<String, Object> checkPropsInfo = new HashMap<String, Object>();
Map<String, Object> checkPropsDetialInfo = null;
checkPropsDetialInfo = new HashMap<String, Object>();
checkPropsDetialInfo.put("viewAttr", allowhide.equals("1") ? 2 : 1);
checkPropsInfo.put("enable", checkPropsDetialInfo);
checkPropsInfo.put("required", checkPropsDetialInfo);
propsInfo.put("checkProps", checkPropsInfo);
fieldInfo.put("props", propsInfo);
comInfo = new HashMap<String, Object>();
lsComDetialInfo = new ArrayList<Object>();
comDetialInfo = new HashMap<String, Object>();
comDetialInfo.put("label", "");
comDetialInfo.put("type", "INPUT");
comDetialInfo.put("width", "15%");
comDetialInfo.put("key", "fieldlabel");
comDetialInfo.put("viewAttr", 3);
lsComDetialInfo.add(comDetialInfo);
comInfo.put("fieldlabel", lsComDetialInfo);
lsComDetialInfo = new ArrayList<Object>();
comDetialInfo = new HashMap<String, Object>();
comDetialInfo.put("label", "");
comDetialInfo.put("type", "TEXT");
comDetialInfo.put("width", "15%");
comDetialInfo.put("key", "fieldname");
comDetialInfo.put("viewAttr", 3);
lsComDetialInfo.add(comDetialInfo);
comInfo.put("fieldname", lsComDetialInfo);
lsComDetialInfo = new ArrayList<Object>();
comDetialInfo = new HashMap<String, Object>();
comDetialInfo.put("label", "");
comDetialInfo.put("type", fieldhtmltype.equals("5") ? "CUSTOMFIELD" : "TEXT");
comDetialInfo.put("width", "60%");
comDetialInfo.put("key", "fieldType");
lsComDetialInfo.add(comDetialInfo);
comInfo.put("fieldType", lsComDetialInfo);
fieldInfo.put("com", comInfo);
fieldTypeInfo = new ArrayList<Object>();
fieldTypeInfo.add("select");
fieldTypeInfo.add("select");
Map<String, Object> fieldTypeParamInfo = new HashMap<String, Object>();
List<Object> lsFieldTypeParamDetialInfo = new ArrayList<Object>();
Map<String, Object> fieldTypeParamDetialInfo = null;
if (fieldhtmltype.equals("5")) {
//hfm.getSelectItem(fieldid);
RecordSet rs = new RecordSet();
rs.executeSql("select selectvalue, selectname, isdefault, cancel from hrm_selectitem where fieldid=" + fieldid + " order by listorder");
int key = 0;
while (rs.next()) {
fieldTypeParamDetialInfo = new HashMap<String, Object>();
fieldTypeParamDetialInfo.put("key", key++);
fieldTypeParamDetialInfo.put("id", rs.getString("selectvalue"));
fieldTypeParamDetialInfo.put("option", rs.getString("selectname"));
fieldTypeParamDetialInfo.put("default", rs.getString("isdefault"));
fieldTypeParamDetialInfo.put("unuse", rs.getString("cancel"));
lsFieldTypeParamDetialInfo.add(fieldTypeParamDetialInfo);
}
fieldTypeParamInfo.put("datas", lsFieldTypeParamDetialInfo);
fieldTypeParamInfo.put("sort", "horizontal");
fieldTypeInfo.add(fieldTypeParamInfo);
fieldInfo.put("fieldType", fieldTypeInfo);
}
lsFieldInfo.add(fieldInfo);
}
}
retmap.put("status", "1");
retmap.put("data", lsFieldInfo);
retmap.put("encryptEnable",encryptEnable);
} catch (Exception e) {
retmap.put("status", "-1");
retmap.put("message", SystemEnv.getHtmlLabelName(382661, user.getLanguage()));
writeLog(e);
}
return retmap;
}
private String getName(String showname) {
RecordSet rs = new RecordSet();
if (showname != null && !"".equals(showname)) {
//兼容老数据如果id有moduleid则去掉
int index = showname.indexOf(".");
if (index > 0) {
showname = showname.substring(index + 1);
}
String sql = "select name from datashowset where showname='" + showname + "'";
rs.executeSql(sql);
if (rs.next()) {
return Util.null2String(rs.getString("name"));
}
}
return "";
}
@Override
public BizLogContext getLogContext() {
// TODO Auto-generated method stub
return null;
}
}

View File

@ -0,0 +1,211 @@
package com.engine.hrm.cmd.subcompanyfielddefined;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.biz.SimpleBizLogger;
import com.engine.common.constant.BizLogSmallType4Hrm;
import com.engine.common.constant.BizLogType;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import com.engine.hrm.entity.FieldBean;
import com.engine.hrm.entity.FieldSelectOptionBean;
import com.engine.hrm.util.HrmUtil;
import weaver.conn.RecordSet;
import weaver.docs.docs.FieldParam;
import weaver.general.LabelUtil;
import weaver.general.Util;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import weaver.hrm.common.database.dialect.DialectUtil;
import weaver.hrm.definedfield.HrmDeptFieldManagerE9;
import weaver.hrm.definedfield.HrmFieldComInfo;
import weaver.matrix.MatrixUtil;
import weaver.systeminfo.SystemEnv;
/**
*
* @author lvyi
*
*/
public class SaveFieldDefinedCmd extends AbstractCommonCommand<Map<String, Object>>{
private SimpleBizLogger logger;
public SaveFieldDefinedCmd(Map<String, Object> params, User user) {
this.user = user;
this.params = params;
RecordSet rs = new RecordSet();
String sql = "";
String data = Util.null2String(params.get("data"));
JSONObject jsonObj = JSON.parseObject(data);
String groupId = Util.null2String(jsonObj.get("groupId"));
this.logger = new SimpleBizLogger();
BizLogContext bizLogContext = new BizLogContext();
bizLogContext.setLogType(BizLogType.HRM_ENGINE);//模块类型
bizLogContext.setBelongType(BizLogSmallType4Hrm.HRM_ENGINE_SUBCOMPANYFIELDDEFINED);//所属大类型
bizLogContext.setLogSmallType(BizLogSmallType4Hrm.HRM_ENGINE_SUBCOMPANYFIELDDEFINED);//当前小类型
bizLogContext.setParams(params);//当前request请求参数
logger.setUser(user);//当前操作人
String mainSql = "SELECT a.*, b.labelname FROM hrm_fieldgroup a, htmllabelinfo b WHERE a.grouplabel= b.indexid and a.id= "+groupId+" and b.languageid="+user.getLanguage();
logger.setMainSql(mainSql,"id");//主表sql
logger.setMainPrimarykey("id");//主日志表唯一key
logger.setMainTargetNameColumn("labelname");//当前targetName对应的列对应日志中的对象名
SimpleBizLogger.SubLogInfo subLogInfo = logger.getNewSubLogInfo();
String subSql = "SELECT * FROM hrm_formfield WHERE groupid = "+groupId;
subLogInfo.setSubSql(subSql,"fieldid");
logger.addSubLogInfo(subLogInfo);
logger.before(bizLogContext);
}
@Override
public Map<String, Object> execute(CommandContext commandContext) {
Map<String, Object> retmap = new HashMap<String, Object>();
RecordSet rs = new RecordSet();
HrmFieldComInfo HrmFieldComInfo = new HrmFieldComInfo();
String sql = "";
try {
if(!HrmUserVarify.checkUserRight("SubCompanyDefineInfo1:SubMaintain1",user)) {
retmap.put("status", "-1");
retmap.put("message", SystemEnv.getHtmlLabelName(2012, user.getLanguage()));
return retmap;
}
String data = Util.null2String(params.get("data"));
JSONObject jsonObj = JSON.parseObject(data);
String groupId = Util.null2String(jsonObj.get("groupId"));
String groupType = "";
sql = "SELECT grouptype FROM hrm_fieldgroup WHERE id="+groupId;
rs.executeSql(sql);
if(rs.next()){
groupType = rs.getString("groupType");
}
List<String> listFieldLabel = new ArrayList<String>();
List<String> listFieldName = new ArrayList<String>();
sql = " SELECT fieldlabel FROM hrm_formfield WHERE groupid IN (SELECT id FROM hrm_fieldgroup WHERE grouptype = "+groupType+") and groupid not in("+groupId+")";
rs.executeQuery(sql);
while(rs.next()){
listFieldLabel.add(SystemEnv.getHtmlLabelNames(rs.getString("fieldlabel"), user.getLanguage()));
}
sql = " SELECT fieldname FROM hrm_formfield WHERE groupid IN (SELECT id FROM hrm_fieldgroup WHERE grouptype = "+groupType+") and groupid not in("+groupId+")";
rs.executeQuery(sql);
while(rs.next()){
listFieldName.add(rs.getString("fieldname").toLowerCase());
}
JSONArray records = (JSONArray)jsonObj.get("records");
for(int i=0; i<records.size();i++){
FieldBean fieldBean = (FieldBean) JSONObject.toJavaObject((JSONObject)records.get(i), FieldBean.class);
listFieldLabel.add(Util.formatMultiLang(Util.null2String(fieldBean.getFieldlabel()),""+user.getLanguage()));
listFieldName.add(Util.null2String(fieldBean.getFieldname()).toLowerCase());
}
System.out.print(listFieldLabel.toString());
if(listFieldLabel.size() != new HashSet<String>(listFieldLabel).size()||
listFieldName.size() != new HashSet<String>(listFieldName).size()){
retmap.put("status", "-1");
retmap.put("message", SystemEnv.getHtmlLabelName(383055, user.getLanguage()));
return retmap;
}
for(int i=0; i<records.size();i++){
FieldBean fieldBean = (FieldBean) JSONObject.toJavaObject((JSONObject)records.get(i), FieldBean.class);
fieldBean.initFieldType("subcompany");
this.save(fieldBean,groupId);
}
HrmFieldComInfo.removeFieldCache();
//同步分部数据到矩阵
MatrixUtil.sysSubcompayData();
retmap.put("status", "1");
} catch (Exception e) {
retmap.put("status", "-1");
retmap.put("message", SystemEnv.getHtmlLabelName(382661,user.getLanguage()));
writeLog(e);
}
return retmap;
}
private void save(FieldBean fieldBean, String groupId){
try {
HrmUtil hrmUtil = new HrmUtil();
HrmDeptFieldManagerE9 hfm = new HrmDeptFieldManagerE9(4);
String fieldId = Util.null2String(fieldBean.getId());
String fieldLabel = Util.null2String(fieldBean.getFieldlabel());
String fieldName = Util.null2String(fieldBean.getFieldname());
String fieldHtmlType = "";
String type = "";
String typeDetial = "";
String dmlUrl = "";
if(fieldBean.getFieldTypeBean()!=null){
fieldHtmlType = Util.null2String(fieldBean.getFieldTypeBean().getFieldHtmlType());
type = Util.null2String(fieldBean.getFieldTypeBean().getFieldType());
if(fieldHtmlType.equals("1")||fieldHtmlType.equals("2")){
typeDetial = Util.null2String(fieldBean.getFieldTypeBean().getOtherParam());
} else if(fieldHtmlType.equals("66") || fieldHtmlType.equals("67")){
dmlUrl = Util.null2String(fieldBean.getFieldTypeBean().getOtherParam());
} else if (type.equals("161") || type.equals("162") || type.equals("256")|| type.equals("257")) {
dmlUrl = Util.null2String(fieldBean.getFieldTypeBean().getOtherParam());
}
}
String isUse = Util.null2String(fieldBean.getEnable(),"0");
String isMand = Util.null2String(fieldBean.getRequired(),"0");
String fieldOrder = Util.null2String(fieldBean.getKey());
int temId = Util.getIntValue(fieldId,-1);
//int lableid = hrmUtil.getFieldLabelId(fieldLabel);
int lableid = new LabelUtil().getLabelId(fieldLabel);
if(Util.null2String(fieldId).length()==0){
FieldParam fp = new FieldParam();
if(fieldHtmlType.equals("1")){
fp.setSimpleText(Util.getIntValue(type,-1),typeDetial);
}else if(fieldHtmlType.equals("2")){
fp.setText();
}else if(fieldHtmlType.equals("3")){
fp.setBrowser(Util.getIntValue(type,-1));
}else if(fieldHtmlType.equals("4")){
fp.setCheck();
}else if(fieldHtmlType.equals("5")){
fp.setSelect();
}else if(fieldHtmlType.equals("6")){
fp.setAttach();
}
temId = hfm.addField(fieldName, fp.getFielddbtype(), fieldHtmlType, type, ""+lableid, fieldOrder, isMand, isUse, groupId, dmlUrl);
}else{
//只允许更改显示属性,数据库层面的不允许修改
hfm.editField(fieldId, ""+lableid, fieldOrder, isMand, isUse, groupId);
}
if(fieldHtmlType.equals("5")){
List<FieldSelectOptionBean> lsSelectOption = fieldBean.getFieldTypeBean().getLsSelectOption();
hfm.checkSelectField(temId, lsSelectOption);
}
}catch (Exception e) {
writeLog(e);
}
}
@Override
public BizLogContext getLogContext() {
return null;
}
@Override
public List<BizLogContext> getLogContexts() {
return logger.getBizLogContexts();
}
}

View File

@ -0,0 +1,8 @@
package weaver.bokang.xiao.tbxc.mapper;/**
*@ClassName FormFieldMapper
*@Author
*@Date 2023/4/26 17:22
*@Description <h1></h1>
**/
public class FormFieldMapper {
}

View File

@ -0,0 +1,8 @@
package weaver.bokang.xiao.zscq.fun;/**
*@ClassName WorkflowRepossessedSign
*@Author
*@Date 2023/4/24 11:11
*@Description <h1></h1>
**/
public class WorkflowRepossessedSign {
}

View File

@ -0,0 +1,499 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ include file="/systeminfo/init_wev8.jsp"%>
<%@ taglib uri="/WEB-INF/weaver.tld" prefix="wea"%>
<%@ taglib uri="/WEB-INF/tld/browser.tld" prefix="brow"%>
<%@ page import="weaver.file.Prop" %>
<%@ page import="weaver.hrm.HrmUserVarify" %>
<%@ page import="weaver.systeminfo.SystemEnv" %>
<jsp:useBean id="RecordSet" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="RecordSet_count" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="ResourceComInfo" class="weaver.hrm.resource.ResourceComInfo" scope="page" />
<jsp:useBean id="DepartmentComInfo" class="weaver.hrm.company.DepartmentComInfo" scope="page" />
<jsp:useBean id="CrmSupplierComInfo" class="weaver.crm.supplierinfo.CrmSupplierComInfo" scope="page" />
<jsp:useBean id="RecordSet_Dep" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="SubCompanyComInfo" class="weaver.hrm.company.SubCompanyComInfo" scope="page" /><!--zl-->
<HTML>
<HEAD>
<LINK href="/css/Weaver_wev8.css" type=text/css rel=STYLESHEET>
<SCRIPT language="javascript" src="/js/weaver_wev8.js"></script>
<style>
td * {font-size:9px !important;}
</style>
</head>
<%
String sqlwhere = " where 1=1 ";
String subcompanyid1 = ResourceComInfo.getSubCompanyID(String.valueOf(user.getUID()));
//是否采购部
boolean isDep = false;
//是否是流程接收人
boolean isShow = false;
//采购部的同事可以选择所有合同卡片;而本部门的人员(非采购部)只能选择本部门的合同卡片
RecordSet_Dep.executeSql("select * from HrmDepartment where departmentname like '%采购%' and id="+user.getUserDepartment());
if(RecordSet_Dep.next()) isDep = true;
//是否合同流程接收人
String sqlwhere_workflow = "";
RecordSet_Dep.executeSql("select distinct requestId from workflow_currentoperator where workflowid in (79,148,133,128,118,108,98,153,167,316,470,514,532,543,600,717,719,739,832,927,929) and userid="+user.getUID());
if(RecordSet_Dep.next()) isShow = true;
if(!HrmUserVarify.checkUserRight("ContactInfo:Manager", user) && !HrmUserVarify.checkUserRight("ContactInfo:User", user) && !isShow && !isDep){
response.sendRedirect("/notice/noright.jsp");
}
//如果是合同管理权限则直接1=1
if(HrmUserVarify.checkUserRight("ContactInfo:Manager", user)){
sqlwhere += " and 1=1";
}else if(isShow && HrmUserVarify.checkUserRight("ContactInfo:User", user)){
//如果是流程接收人,并且有合同查看权限
sqlwhere += " and (requestid in (select distinct requestId from workflow_currentoperator where workflowid in (79,148,133,128,118,108,98,153,167,316,470,514,532,543,600,717,719,739,832,927,929) and userid="+user.getUID()+") or reqDeptId = '"+user.getUserDepartment()+"')";
}else if(HrmUserVarify.checkUserRight("ContactInfo:User", user)){
//如果只有合同查看权限
sqlwhere += " and reqDeptId = '"+user.getUserDepartment()+"'";
}else if(isShow){
//如果只是流程接收人
sqlwhere += " and requestid in (select distinct requestId from workflow_currentoperator where workflowid in (79,148,133,128,118,108,98,153,167,316,470,514,532,543,600,717,719,739,832,927,929) and userid="+user.getUID()+")";
}
//如果没有查看全部的权限,加分部条件
if(!HrmUserVarify.checkUserRight("ContactInfoList:ALL", user)){
if (!subcompanyid1.equals("0")) {sqlwhere += " and CrmContractInfo.subcompanyid1 = '"+subcompanyid1+"' ";}
}
String imagefilename = "/images/hdReport.gif";
String titlename = SystemEnv.getHtmlLabelName(614, user.getLanguage()) + SystemEnv.getHtmlLabelName(527, user.getLanguage());
String needfav = "1";
String needhelp = "";
%>
<BODY>
<%@ include file="/systeminfo/TopTitle_wev8.jsp"%>
<%@ include file="/systeminfo/RightClickMenuConent_wev8.jsp"%>
<%
RCMenu += "{" + SystemEnv.getHtmlLabelName(197, user.getLanguage()) + ",javascript:OnSearch(),_top} ";
RCMenuHeight += RCMenuHeightStep;
RCMenu += "{" + "Excel,javascript:ContractExport(),_top} ";
RCMenuHeight += RCMenuHeightStep;
RCMenu += "{" + SystemEnv.getHtmlLabelName(18363, user.getLanguage()) + ",javascript:_table.firstPage(),_self}";
RCMenuHeight += RCMenuHeightStep;
RCMenu += "{" + SystemEnv.getHtmlLabelName(1258, user.getLanguage()) + ",javascript:_table.prePage(),_self}";
RCMenuHeight += RCMenuHeightStep;
RCMenu += "{" + SystemEnv.getHtmlLabelName(1259, user.getLanguage()) + ",javascript:_table.nextPage(),_self}";
RCMenuHeight += RCMenuHeightStep;
RCMenu += "{" + SystemEnv.getHtmlLabelName(18362, user.getLanguage()) + ",javascript:_table.lastPage(),_self}";
RCMenuHeight += RCMenuHeightStep;
%>
<%
int pagenum = Util.getIntValue(request.getParameter("pagenum"), 1);
int perpage = Util.getPerpageLog();
if (perpage <= 1) perpage = 10;
String creator = Util.fromScreen(request.getParameter("creator"), user.getLanguage());
String fromdate = Util.fromScreen(request.getParameter("fromdate"), user.getLanguage());
String fromdate2 = Util.fromScreen(request.getParameter("fromdate2"), user.getLanguage());
String enddate = Util.fromScreen(request.getParameter("enddate"), user.getLanguage());
String enddate2 = Util.fromScreen(request.getParameter("enddate2"), user.getLanguage());
String status_temp = Util.null2String(request.getParameter("status_temp"));
String conNo = Util.fromScreen(request.getParameter("conNo"), user.getLanguage());
String prNo = Util.fromScreen(request.getParameter("prNo"), user.getLanguage());
String jpcNo = Util.fromScreen(request.getParameter("jpcNo"), user.getLanguage());
String suppliersId = Util.fromScreen(request.getParameter("suppliersId"), user.getLanguage());
String isOneSuppliers = Util.fromScreen(request.getParameter("isOneSuppliers"), user.getLanguage());
// String reqDeptId = String.valueOf(user.getUserDepartment());
String reqDeptId = Util.fromScreen(request.getParameter("reqDeptId"), user.getLanguage());;
//管理员组或采购部才能查询所有部门下合同,合同接收人查看接收的合同
// if(HrmUserVarify.checkUserRight("ContactInfo:Manager", user) || isShow) reqDeptId = Util.fromScreen(request.getParameter("reqDeptId"), user.getLanguage());
String isOverdue = Util.fromScreen(request.getParameter("isOverdue"), user.getLanguage());
String status = Util.fromScreen(request.getParameter("status"), user.getLanguage());
String isOverdueNext = Util.fromScreen(request.getParameter("isOverdueNext"), user.getLanguage());
String conType = Util.fromScreen(request.getParameter("conType"), user.getLanguage());
String name = Util.fromScreen(request.getParameter("name"), user.getLanguage());
String subCompanyId = Util.fromScreen(request.getParameter("subCompanyId"), user.getLanguage());
String reNewStatus = Util.fromScreen(request.getParameter("reNewStatus"), user.getLanguage());
String conStatus = Util.fromScreen(request.getParameter("conStatus"), user.getLanguage());
String contractName = Util.fromScreen(request.getParameter("contractName"), user.getLanguage());
String csstatus = Util.fromScreen(request.getParameter("csstatus"), user.getLanguage());
int opentype = Util.getIntValue(request.getParameter("opentype"),-1);
//String sqlwhere = " where status = '' ";
//if(!"".equals(status_temp)) sqlwhere += " and status in ("+status_temp+") ";
if (!fromdate.equals("")) sqlwhere += " and startDate>='" + fromdate + "'";
if (!fromdate2.equals("")) sqlwhere += " and startDate<='" + fromdate2 + "'";
if (!enddate.equals("")) sqlwhere += " and enddate>='" + enddate + "'";
if (!enddate2.equals("")) sqlwhere += " and enddate<='" + enddate2 + "'";
if (!conNo.equals("")) sqlwhere += " and conNo like '%" + conNo + "%'";
if (!prNo.equals("")) sqlwhere += " and prNo='" + prNo + "'";
if (!jpcNo.equals("")) sqlwhere += " and jpcNo='" + jpcNo + "'";
if(!"".equals(suppliersId)) sqlwhere += " and suppliersId=" + suppliersId;
if (!isOneSuppliers.equals("")) sqlwhere += " and isOneSuppliers='" + isOneSuppliers + "'";
if (!"".equals(creator) && !"0".equals(creator)) sqlwhere += " and CrmContractInfo.creator=" + creator;
if (!reqDeptId.equals("")) sqlwhere += " and reqDeptId=" + reqDeptId;
if (!isOverdue.equals("")) sqlwhere += " and isOverdue='" + isOverdue + "'";
if (!status.equals("")) sqlwhere += " and CrmContractInfo.status='" + status + "'";
if (!isOverdueNext.equals("")) sqlwhere += " and isOverdueNext='" + isOverdueNext + "'";
if (!conType.equals("")) sqlwhere += " and conType='" + conType + "'";
if (!csstatus.equals("")) sqlwhere += " and CrmSalesContractInfo.status='" + csstatus + "'";
if (!name.equals("")) sqlwhere += " and name like '%" + name + "%'";
if (!subCompanyId.equals("")) sqlwhere += " and CrmContractInfo.subcompanyid1 = '" + subCompanyId + "'";
if (!reNewStatus.equals("")) sqlwhere += " and conStatus = '" + reNewStatus + "'";
if (!contractName.equals("")) sqlwhere += " and contractName like '%" + contractName + "%'";
//if (reNewStatus2.equals("待续签")) sqlwhere += " and dbo.getReNewStatus2(2,CrmContractInfo.saleContract) > 0";
//else if (reNewStatus2.equals("已续签")) sqlwhere += " and dbo.getReNewStatus2(1,CrmContractInfo.saleContract) > 0";
//else if (reNewStatus2.equals("无需续签")) sqlwhere += " and dbo.getReNewStatus2(3,CrmContractInfo.saleContract) > 0";
//System.out.println("sqlwhere:"+sqlwhere);
if(opentype > -1){
sqlwhere += " and isnull(CrmContractInfo.opentype,0) = " + opentype;
}
String orderStr = " order by startDate desc, CrmContractInfo.id desc ";
// out.println("sqlwhere:" + sqlwhere);
// out.println("orderStr:" + orderStr);
// session.setAttribute("sqlwhere", sqlwhere);
// session.setAttribute("orderStr", orderStr);
%>
<form id=frmmain name=frmmain method=post action="ContractList.jsp">
<input type=hidden id=pagenum name=pagenum value="<%=pagenum%>">
<input type=hidden id=status_temp name=status_temp value="">
<table class=ViewForm>
<tbody>
<COLGROUP>
<COL width="13%">
<COL width="20%">
<COL width="14%">
<COL width="20%">
<COL width="13%">
<COL width="20%">
<TR class=Title>
<TH colSpan=6><%=SystemEnv.getHtmlLabelName(15774, user.getLanguage())%></TH>
</TR>
<tr style="height: 1px">
<td class=Line1 colspan=6></td>
</tr>
<tr style="height: 1px">
<td class=Line colspan=6></td>
</tr>
<tr>
<TD>合同状态</TD>
<TD class=Field>
<select id="reNewStatus" name="reNewStatus">
<option value="" <%="".equals(reNewStatus)?"selected":""%>></option>
<option value="0" <%="0".equals(reNewStatus)?"selected":""%>>执行</option>
<option value="1" <%="1".equals(reNewStatus)?"selected":""%>>待续签</option>
<option value="2" <%="2".equals(reNewStatus)?"selected":""%>>已续签</option>
<option value="3" <%="3".equals(reNewStatus)?"selected":""%>>关闭</option>
</select>
</TD>
<td><%=SystemEnv.getHtmlLabelName(1970, user.getLanguage())%></td>
<td class=field>
<BUTTON type="button" class=calendar id=SelectDate onclick=getDate('fromdatespan','fromdate')></BUTTON>&nbsp;
<SPAN id=fromdatespan><%=Util.toScreen(fromdate, user.getLanguage())%></SPAN>&nbsp;-&nbsp;
<BUTTON type="button" class=calendar id=SelectDate onclick=getDate('fromdate2span','fromdate2')></BUTTON>&nbsp;
<SPAN id=fromdate2span><%=Util.toScreen(fromdate2, user.getLanguage())%></SPAN>
<input type="hidden" name="fromdate" value=<%=fromdate%>>
<input type="hidden" name="fromdate2" value=<%=fromdate2%>>
</td>
<td><%=SystemEnv.getHtmlLabelName(15236, user.getLanguage())%></td>
<td class=field>
<BUTTON type="button" class=calendar id=SelectDate onclick=getDate('enddatespan','enddate')></BUTTON>&nbsp;
<SPAN id=enddatespan><%=Util.toScreen(enddate, user.getLanguage())%></SPAN>&nbsp;-&nbsp;
<BUTTON type="button" class=calendar id=SelectDate onclick=getDate('enddate2span','enddate2')></BUTTON>&nbsp;
<SPAN id=enddate2span><%=Util.toScreen(enddate2, user.getLanguage())%></SPAN>
<input type="hidden" name="enddate" value=<%=enddate%>>
<input type="hidden" name="enddate2" value=<%=enddate2%>>
</td>
</TR>
<tr style="height: 1px">
<td class=Line colspan=6></td>
</tr>
<TR>
<TD><%=SystemEnv.getHtmlLabelName(21282, user.getLanguage())%></TD>
<TD class=Field>
<INPUT class=InputStyle maxLength=100 id="conNo" name="conNo" STYLE="width:150" value="<%=conNo%>">
</TD>
<TD>PR<%=SystemEnv.getHtmlLabelName(403,user.getLanguage())%></TD>
<TD class=Field>
<INPUT class=InputStyle maxLength=100 id="prNo" name="prNo" STYLE="width:150" value="<%=prNo%>">
</TD>
<TD>JPC<%=SystemEnv.getHtmlLabelName(2171,user.getLanguage())%><%=SystemEnv.getHtmlLabelName(16992,user.getLanguage())%></TD>
<TD class=Field>
<INPUT class=InputStyle maxLength=100 id="jpcNo" name="jpcNo" STYLE="width:150" value="<%=jpcNo%>">
</TD>
</TR>
<tr style="height: 1px">
<td class=Line colspan=6></td>
</tr>
<TR>
<TD><%=SystemEnv.getHtmlLabelName(613002, user.getLanguage())%></TD>
<TD class=Field>
<brow:browser viewType="0"
id="suppliersId"
name="suppliersId"
browserValue="<%=suppliersId %>"
browserUrl="/systeminfo/BrowserMain.jsp?url=/interface/CommonBrowser.jsp?type=browser.gys"
hasInput="true"
isSingle="true"
hasBrowser = "true"
isMustInput='1'
width="165px"
browserSpanValue="<%=CrmSupplierComInfo.getSuppliername(suppliersId) %>">
</brow:browser>
</TD>
<TD></TD>
<TD class=Field>
</TD>
<TD><%=SystemEnv.getHtmlLabelName(913, user.getLanguage())%></TD>
<TD class=Field>
<brow:browser viewType="0"
id="creator"
name="creator"
browserValue="<%=creator %>"
browserUrl="/systeminfo/BrowserMain.jsp?url=/hrm/resource/ResourceBrowser.jsp"
hasInput="true"
isSingle="true"
hasBrowser = "true"
isMustInput='1'
width="165px"
browserSpanValue="<%=ResourceComInfo.getResourcename(creator) %>">
</brow:browser>
</TD>
</TR>
<tr style="height: 1px">
<td class=Line colspan=6></td>
</tr>
<TR>
<TD><%=SystemEnv.getHtmlLabelName(620002, user.getLanguage())%></TD>
<TD class=Field>
<brow:browser viewType="0"
id="reqDeptId"
name="reqDeptId"
browserValue="<%=reqDeptId %>"
browserUrl="/systeminfo/BrowserMain.jsp?url=/hrm/company/DepartmentBrowser.jsp"
hasInput="true"
isSingle="true"
hasBrowser = "true"
isMustInput='1'
width="165px"
browserSpanValue="<%=Util.toScreen(DepartmentComInfo.getDepartmentname(reqDeptId),user.getLanguage())%>">
</brow:browser>
<%-- <%--%>
<%-- //管理员组才能查询所有部门下合同--%>
<%-- if(HrmUserVarify.checkUserRight("ContactInfo:Manager", user)){--%>
<%-- %>--%>
<%-- <brow:browser viewType="0"--%>
<%-- id="reqDeptId"--%>
<%-- name="reqDeptId"--%>
<%-- browserValue="<%=reqDeptId %>"--%>
<%-- browserUrl="/systeminfo/BrowserMain.jsp?url=/hrm/company/DepartmentBrowser.jsp"--%>
<%-- hasInput="true"--%>
<%-- isSingle="true"--%>
<%-- hasBrowser = "true"--%>
<%-- isMustInput='1'--%>
<%-- width="165px"--%>
<%-- browserSpanValue="<%=Util.toScreen(DepartmentComInfo.getDepartmentname(reqDeptId),user.getLanguage())%>">--%>
<%-- </brow:browser>--%>
<%-- &lt;%&ndash;<INPUT type=hidden class="wuiBrowser" _required="no" _displayTemplate="#b{name}" _displayText="<%=Util.toScreen(DepartmentComInfo.getDepartmentname(reqDeptId),user.getLanguage()) %>" _url="/systeminfo/BrowserMain.jsp?url=/hrm/company/DepartmentBrowser.jsp" name="reqDeptId" value="<%=reqDeptId%>">&ndash;%&gt;--%>
<%-- <%}else{ %>--%>
<%-- <%=Util.toScreen(DepartmentComInfo.getDepartmentname(reqDeptId),user.getLanguage()) %>--%>
<%-- <%} %>--%>
</TD>
<TD>付款状态</TD>
<TD class=Field>
<select id="status" name="status">
<option value="" <%="".equals(status)?"selected":""%>></option>
<option value="0" <%="0".equals(status)?"selected":""%>>执行中</option>
<option value="1" <%="1".equals(status)?"selected":""%>>已结清</option>
</select>
</TD>
<TD><%=SystemEnv.getHtmlLabelName(620017, user.getLanguage())%></TD>
<TD class=Field>
<select id="isOverdueNext" name="isOverdueNext">
<option value="" <%="".equals(isOverdueNext)?"selected":""%>></option>
<option value="Y" <%="Y".equals(isOverdueNext)?"selected":""%>><%=SystemEnv.getHtmlLabelName(163,user.getLanguage())%></option>
<option value="N" <%="N".equals(isOverdueNext)?"selected":""%>><%=SystemEnv.getHtmlLabelName(161,user.getLanguage())%></option>
</select>
</TD>
</TR>
<tr style="height: 1px">
<td class=Line colspan=6></td>
</tr>
<TR>
<TD><%=SystemEnv.getHtmlLabelName(15775, user.getLanguage())%></TD>
<TD class=Field>
<select id="conType" name="conType">
<option value="" <%="".equals(conType)?"selected":""%>></option>
<option value="0" <%="0".equals(conType)?"selected":""%>>业务型</option>
<option value="1" <%="1".equals(conType)?"selected":""%>>资本型</option>
<option value="2" <%="2".equals(conType)?"selected":""%>>费用型</option>
</select>
</TD>
<TD><%=SystemEnv.getHtmlLabelName(15142, user.getLanguage())%></TD>
<TD class=Field>
<INPUT class=InputStyle maxLength=200 id="name" name="name" STYLE="width:150" value="<%=name%>">
</TD>
<%if(HrmUserVarify.checkUserRight("ContactInfoList:ALL", user)){%>
<TD><%=SystemEnv.getHtmlLabelName(141,user.getLanguage())%></TD>
<TD class=Field>
<brow:browser viewType="0"
id="subCompanyId"
name="subCompanyId"
browserValue="<%=subCompanyId %>"
browserUrl="/systeminfo/BrowserMain.jsp?url=/hrm/company/SubcompanyBrowser.jsp"
hasInput="true"
isSingle="true"
hasBrowser = "true"
isMustInput='1'
width="165px"
browserSpanValue="<%=SubCompanyComInfo.getSubCompanyname(subCompanyId+"")%>">
</brow:browser>
<%--<input class=wuiBrowser class=inputStyle id=subCompanyId type=hidden name=subCompanyId value="<%=subCompanyId%>"--%>
<%--_url="/systeminfo/BrowserMain.jsp?url=/hrm/company/SubcompanyBrowser.jsp"--%>
<%--_displayText="<%=SubCompanyComInfo.getSubCompanyname(subCompanyId+"")%>"--%>
<%-->--%>
</TD>
<%}%>
</TR>
<tr style="height: 1px">
<td class=Line colspan=6></td>
</tr>
<TR>
<TD><%=SystemEnv.getHtmlLabelName(16404, user.getLanguage())%><%=SystemEnv.getHtmlLabelName(195, user.getLanguage())%></TD>
<TD class=Field>
<INPUT class=InputStyle maxLength=200 id="contractName" name="contractName" STYLE="width:150" value="<%=contractName%>">
</TD>
<TD>销售合同状态</TD>
<TD class=Field>
<select id="csstatus" name="csstatus">
<option value="" <%="".equals(csstatus)?"selected":""%>></option>
<option value="0" <%="0".equals(csstatus)?"selected":""%>>已签署</option>
<option value="1" <%="1".equals(csstatus)?"selected":""%>>未签署</option>
<option value="2" <%="2".equals(csstatus)?"selected":""%>>已续签</option>
<option value="3" <%="3".equals(csstatus)?"selected":""%>>关闭</option>
</select>
</TD>
<td>开闭口类型</td>
<td class="Field">
<select name="opentype">
<option value="-1" <%=(opentype == -1) ?"selected":"" %>>--请选择--</option>
<option value="0" <%=(opentype == 0) ?"selected":"" %>>闭口</option>
<option value="1" <%=(opentype == 1) ?"selected":"" %>>开口</option>
<option value="2" <%=(opentype == 2) ?"selected":"" %>>周期性</option>
</select>
</td>
</TR>
<tr style="height: 1px">
<td class=Line colspan=6></td>
</tr>
</tbody>
</table>
</form>
<div id="" style="overflow-x:scroll;width:100%;">
<table width="2500px" style="table-Layout:fixed">
<tr>
<td>
<%
String tableString = "";
String backfields = " CrmContractInfo.id,case CrmContractInfo.opentype when '0' then '闭口' when '1' then '开口' when '2' then '周期性' end opentype, reqDeptId, suppliersId, conNo, name, startDate, endDate, case isOverdue when 'Y' then '是' else '否' end as isOverdue, conAmount, content, ',' as str_temp, case isOverdueNext when 'Y' then '是' else '否' end as isOverdueNext, case CrmContractInfo.status when '0' then '执行中' when '1' then '已结清' end as status, CrmContractInfo.creator, CrmContractInfo.subcompanyid1, case conStatus when '0' then '执行' when '1' then '待续签' when '2' then '已续签' when '3' then '关闭' end as reNewStatus, contractName, saleContract, case when dbo.getReNewStatus2(1,CrmContractInfo.saleContract) > 0 then '已续签' when dbo.getReNewStatus2(2,CrmContractInfo.saleContract) > 0 then '待续签' when dbo.getReNewStatus2(3,CrmContractInfo.saleContract) > 0 then '无需续签' end as reNewStatus2,case CrmSalesContractInfo.status when '0' then '已签署' when '1' then '未签署' when '2' then '已续签' when '3' then '关闭' end as csstatus ";
String fromSql = " CrmContractInfo Left Join CrmSalesContractInfo On CrmSalesContractInfo.id=CrmContractInfo.saleContract ";
//out.print("select"+backfields+"from"+fromSql +sqlwhere);
String str_content = "content"+"str_temp";
tableString = " <table instanceid=\"crmContractInfoTable\" tabletype=\"none\" pageId=\"perpage\" pagesize=\"" +PageIdConst.getPageSize("perpage",user.getUID())+"\" >" + "<sql backfields=\"" + backfields + "\" sqlform=\"" + fromSql + "\" sqlwhere=\"" + Util.toHtmlForSplitPage(sqlwhere) + "\" sqlprimarykey=\"CrmContractInfo.id\" sqlsortway=\"Desc\" sqlisdistinct=\"false\" />" + "<head>";
tableString += "<col width=\"10%\" text=\"" + SystemEnv.getHtmlLabelName(15142, user.getLanguage()) + "\" column=\"name\" orderkey=\"name\" linkkey=\"id\" linkvaluecolumn=\"id\" href=\"/CRM/contractinfo/ContractEdit.jsp\" target=\"_fullwindow\" />";
tableString += "<col width=\"10%\" text=\"" + SystemEnv.getHtmlLabelName(21282, user.getLanguage()) + "\" column=\"conNo\" orderkey=\"conNo\" />";
tableString += "<col width=\"10%\" text=\"" + SystemEnv.getHtmlLabelName(620002, user.getLanguage()) + "\" column=\"reqDeptId\" orderkey=\"reqDeptId\" transmethod=\"weaver.hrm.company.DepartmentComInfo.getDepartmentname\" linkkey=\"id\" href=\"/hrm/company/HrmDepartmentDsp.jsp\" target=\"_fullwindow\" />";
tableString += "<col width=\"10%\" text=\""+ SystemEnv.getHtmlLabelName(613002, user.getLanguage()) + "\" column=\"suppliersId\" orderkey=\"suppliersId\" linkkey=\"id\" transmethod=\"weaver.crm.supplierinfo.CrmSupplierComInfo.getSuppliername\" href=\"/CRM/supplierinfo/SuppliersEdit.jsp?1=1\" target=\"_fullwindow\" />";
tableString += "<col width=\"6%\" text=\"" + SystemEnv.getHtmlLabelName(1970, user.getLanguage()) + "\" column=\"startDate\" orderkey=\"startDate\" />";
tableString += "<col width=\"6%\" text=\"" + SystemEnv.getHtmlLabelName(15236, user.getLanguage()) + "\" column=\"endDate\" orderkey=\"endDate\" />";
//tableString += "<col width=\"3%\" text=\"" + SystemEnv.getHtmlLabelName(620016, user.getLanguage()) + "\" column=\"isOverdue\" orderkey=\"isOverdue\" />";
tableString += "<col width=\"6%\" text=\"" + SystemEnv.getHtmlLabelName(6146, user.getLanguage()) + "\" column=\"conAmount\" orderkey=\"conAmount\" />";
tableString += "<col width=\"10%\" text=\"" + SystemEnv.getHtmlLabelName(620015, user.getLanguage()) + "\" column=\"content\" orderkey=\""+str_content+"\" transmethod=\"weaver.splitepage.transform.SptmForDoc.getDocNames\" />";
tableString += "<col width=\"4%\" text=\"" + SystemEnv.getHtmlLabelName(620017, user.getLanguage()) + "\" column=\"isOverdueNext\" orderkey=\"isOverdueNext\" />";
tableString += "<col width=\"4%\" text=\"付款状态\" column=\"status\" orderkey=\"status\" />";
tableString += "<col width=\"4%\" text=\"" + SystemEnv.getHtmlLabelName(913, user.getLanguage()) + "\" column=\"creator\" orderkey=\"creator\" linkkey=\"id\" transmethod=\"weaver.hrm.resource.ResourceComInfo.getResourcename\" href=\"/hrm/resource/HrmResource.jsp?1=1\" target=\"_fullwindow\" />";
//tableString += "<col width=\"10%\" text=\"" + SystemEnv.getHtmlLabelName(104, user.getLanguage()) + "\" column=\"id\" orderkey=\"id\" transmethod=\"weaver.crm.contractinfo.CrmContractTool.getLinkButtons\" />";
tableString += "<col width=\"4%\" text=\"合同状态\" column=\"reNewStatus\" orderkey=\"reNewStatus\" />";
tableString += "<col width=\"4%\" text=\"销售合同\" column=\"contractName\" orderkey=\"contractName\" linkkey=\"id\" linkvaluecolumn=\"saleContract\" href=\"/CRM/salecontractinfo/SaleContractEdits.jsp?metherid=search\" target=\"_fullwindow\" />";
tableString += "<col width=\"4%\" text=\"销售合同状态\" column=\"csstatus\" orderkey=\"csstatus\" />";
tableString += "<col width=\"4%\" text=\"开闭口类型\" column=\"opentype\" orderkey=\"opentype\" />";
tableString += "<col width=\"4%\" text=\"" + SystemEnv.getHtmlLabelName(141,user.getLanguage()) + "\" column=\"subcompanyid1\" orderkey=\"subcompanyid1\" transmethod=\"weaver.hrm.company.SubCompanyComInfo.getSubCompanyname\" />";
tableString += "</head>";
tableString += "</table>";
%>
<input type="hidden" name="pageId" id="pageId" value="crmContractInfoTable" />
<wea:SplitPageTag tableString="<%=tableString%>" mode="run" />
</td>
</tr>
</table>
</div>
<%@ include file="/systeminfo/RightClickMenu_wev8.jsp"%>
</body>
<iframe id="searchexport" style="display: none"></iframe>
<script language=javascript>
function ContractExport() {
var sqlwhere = encodeURI("<%=sqlwhere%>");
var orderStr = encodeURI("<%=orderStr%>");
jQuery("#searchexport").attr("src", "ContractReportExport.jsp?sqlwhere="+sqlwhere+"&orderStr=" + orderStr);
}
function OnSubmit(pagenum) {
document.frmmain.pagenum.value = pagenum;
document.frmmain.submit();
}
function OnSearch(){
var chkInTableTags = document.getElementsByName("status");
var status_temp = "";
for(var i=0;i<chkInTableTags.length;i++){
if(chkInTableTags[i].checked && chkInTableTags[i].value != ''){
if(status_temp == "") status_temp = "'" + chkInTableTags[i].value + "'";
else status_temp = status_temp + ",'" + chkInTableTags[i].value + "'";
}
}
jQuery("#status_temp").val(status_temp);
document.frmmain.submit();
}
//续签
function newWorkflowByContract4(key){
location.href = "ContractNewWorkflow.jsp?status=4&id="+key;
}
//试运作
function newWorkflowByContract3(key){
location.href = "ContractNewWorkflow.jsp?status=3&id="+key;
}
</script>
<SCRIPT language="javascript" src="/js/datetime_wev8.js"></script>
<SCRIPT language="javascript" src="/js/JSDateTime/WdatePicker_wev8.js"></script>
</html>

View File

@ -0,0 +1,127 @@
<%@ page language="java" contentType="text/html; charset=GBK" %>
<%@ include file="/systeminfo/init.jsp" %>
<%@ page import="weaver.general.Util, weaver.file.ExcelSheet, weaver.file.ExcelRow" %>
<jsp:useBean id="RecordSet" class="weaver.conn.RecordSet" scope="page"/>
<jsp:useBean id="ResourceComInfo" class="weaver.hrm.resource.ResourceComInfo" scope="page"/>
<jsp:useBean id="SptmForDoc" class="weaver.splitepage.transform.SptmForDoc" scope="page"/>
<jsp:useBean id="SubCompanyComInfo" class="weaver.hrm.company.SubCompanyComInfo" scope="page"/>
<jsp:useBean id="DepartmentComInfo" class="weaver.hrm.company.DepartmentComInfo" scope="page"/>
<jsp:useBean id="CrmSupplierComInfo" class="weaver.crm.supplierinfo.CrmSupplierComInfo" scope="page"/>
<jsp:useBean id="RequestComInfo" class="weaver.workflow.request.RequestComInfo" scope="page"/>
<jsp:useBean id="DocComInfo" class="weaver.docs.docs.DocComInfo" scope="page"/>
<jsp:useBean id="ExcelFile" class="weaver.file.ExcelFile" scope="session"/>
<%!
public static String ToDBC(String input) {
char[] c = input.toCharArray();
for (int i = 0; i < c.length; i++) {
if (c[i] == 12288) {
//全角空格为12288半角空格为32
c[i] = (char) 32;
continue;
}
if (c[i] > 65280 && c[i] < 65375)
//其他字符半角(33-126)与全角(65281-65374)的对应关系是均相差65248
c[i] = (char) (c[i] - 65248);
}
return new String(c);
}
%>
<%
// String sqlwhere=(String)session.getAttribute("sqlwhere");
// String orderStr=(String)session.getAttribute("orderStr");
String sqlwhere = request.getParameter("sqlwhere");
sqlwhere = ToDBC(sqlwhere);
String orderStr = request.getParameter("orderStr");
orderStr = ToDBC(orderStr);
String sqlstr = "";
if (RecordSet.getDBType().equals("oracle")) {
sqlstr = "select CrmContractInfo.id, reqDeptId, suppliersId, conNo, name, startDate, endDate, case isOverdue when 'Y' then '是' else '否' end as isOverdue, conAmount, content, case isOverdueNext when 'Y' then '是' else '否' end as isOverdueNext, case CrmContractInfo.status when '0' then '执行中' when '1' then '已结清' end as status, case isOneSuppliers when 'Y' then '是' when 'N' then '否' else '' end as isOneSuppliers, prRequestId,jpcNo,jpcFile,prNo,prAmount,prAmountSum,conAmount,managerId,subject,giveDate,giveRemark,payRemark,content,CrmContractInfo.createDate,CrmContractInfo.creator,CrmContractInfo.subcompanyid1, case conStatus when '0' then '执行' when '1' then '待续签' when '2' then '已续签' when '3' then '关闭' end as reNewStatus,contractName, saleContract, case CrmSalesContractInfo.status when '0' then '已签署' when '1' then '未签署' when '2' then '已续签' when '3' then '关闭' end as reNewStatus2 from CrmContractInfo Left Join CrmSalesContractInfo On CrmSalesContractInfo.id=CrmContractInfo.saleContract" + sqlwhere + orderStr;
} else {
sqlstr = "select CrmContractInfo.id, reqDeptId, suppliersId, conNo, name, startDate, endDate, case isOverdue when 'Y' then '是' else '否' end as isOverdue, conAmount, content, case isOverdueNext when 'Y' then '是' else '否' end as isOverdueNext, case CrmContractInfo.status when '0' then '执行中' when '1' then '已结清' end as status, case isOneSuppliers when 'Y' then '是' when 'N' then '否' else '' end as isOneSuppliers, prRequestId,jpcNo,jpcFile,prNo,prAmount,prAmountSum,conAmount,managerId,subject,giveDate,giveRemark,payRemark,content,CrmContractInfo.createDate,CrmContractInfo.creator,CrmContractInfo.subcompanyid1, case conStatus when '0' then '执行' when '1' then '待续签' when '2' then '已续签' when '3' then '关闭' end as reNewStatus,contractName, saleContract, case CrmSalesContractInfo.status when '0' then '已签署' when '1' then '未签署' when '2' then '已续签' when '3' then '关闭' end as reNewStatus2 from CrmContractInfo Left Join CrmSalesContractInfo On CrmSalesContractInfo.id=CrmContractInfo.saleContract" + sqlwhere + orderStr;
}
new BaseBean().writeLog(">>>>>>>>"+sqlstr);
RecordSet.executeQuery(sqlstr);
ExcelSheet es = new ExcelSheet();
ExcelRow er = es.newExcelRow();
er.addStringValue(SystemEnv.getHtmlLabelName(141,user.getLanguage()));
er.addStringValue(SystemEnv.getHtmlLabelName(620002,user.getLanguage()));
er.addStringValue(SystemEnv.getHtmlLabelName(613002,user.getLanguage()));
er.addStringValue(SystemEnv.getHtmlLabelName(21282,user.getLanguage()));
er.addStringValue(SystemEnv.getHtmlLabelName(15142,user.getLanguage()));
er.addStringValue(SystemEnv.getHtmlLabelName(1970,user.getLanguage()));
er.addStringValue(SystemEnv.getHtmlLabelName(15236,user.getLanguage()));
er.addStringValue(SystemEnv.getHtmlLabelName(620016,user.getLanguage()));
er.addStringValue(SystemEnv.getHtmlLabelName(6146,user.getLanguage()));
er.addStringValue(SystemEnv.getHtmlLabelName(620015,user.getLanguage()));
er.addStringValue(SystemEnv.getHtmlLabelName(620017,user.getLanguage()));
er.addStringValue("付款状态");
er.addStringValue(SystemEnv.getHtmlLabelName(913,user.getLanguage()));
er.addStringValue(SystemEnv.getHtmlLabelName(620009,user.getLanguage()));
er.addStringValue(SystemEnv.getHtmlLabelName(620003,user.getLanguage()));
er.addStringValue("JPC"+SystemEnv.getHtmlLabelName(16992,user.getLanguage()));
er.addStringValue(SystemEnv.getHtmlLabelName(620004,user.getLanguage()));
er.addStringValue("PR"+SystemEnv.getHtmlLabelName(403,user.getLanguage()));
er.addStringValue("PR"+SystemEnv.getHtmlLabelName(856,user.getLanguage()));
er.addStringValue(SystemEnv.getHtmlLabelName(620010,user.getLanguage()));
er.addStringValue(SystemEnv.getHtmlLabelName(620011,user.getLanguage()));
er.addStringValue(SystemEnv.getHtmlLabelName(620006,user.getLanguage()));
er.addStringValue(SystemEnv.getHtmlLabelName(620012,user.getLanguage()));
er.addStringValue(SystemEnv.getHtmlLabelName(620013,user.getLanguage()));
er.addStringValue(SystemEnv.getHtmlLabelName(620014,user.getLanguage()));
er.addStringValue(SystemEnv.getHtmlLabelName(620015,user.getLanguage()));
er.addStringValue(SystemEnv.getHtmlLabelName(614,user.getLanguage())+SystemEnv.getHtmlLabelName(722,user.getLanguage()));
er.addStringValue("合同状态");
er.addStringValue("销售合同");
er.addStringValue("销售合同状态");
while (RecordSet.next()) {
ExcelRow erdetail = es.newExcelRow();
erdetail.addStringValue(SubCompanyComInfo.getSubCompanyname(RecordSet.getString("subcompanyid1")));
erdetail.addStringValue(DepartmentComInfo.getDepartmentname(RecordSet.getString("reqDeptId")));
erdetail.addStringValue(CrmSupplierComInfo.getSuppliername(RecordSet.getString("suppliersId")));
erdetail.addStringValue(RecordSet.getString("conNo"));
erdetail.addStringValue(RecordSet.getString("name"));
erdetail.addStringValue(RecordSet.getString("startDate"));
erdetail.addStringValue(RecordSet.getString("endDate"));
erdetail.addStringValue(RecordSet.getString("isOverdue"));
erdetail.addStringValue(RecordSet.getString("conAmount"));
erdetail.addStringValue(Util.toScreen(SptmForDoc.getDocName(RecordSet.getString("content")), user.getLanguage()));
erdetail.addStringValue(RecordSet.getString("isOverdueNext"));
erdetail.addStringValue(RecordSet.getString("status"));
erdetail.addStringValue(Util.toScreen(ResourceComInfo.getResourcename(RecordSet.getString("creator")), user.getLanguage()));
erdetail.addStringValue(RecordSet.getString("isOneSuppliers"));
erdetail.addStringValue(RequestComInfo.getRequestname(RecordSet.getString("prRequestId")));
erdetail.addStringValue(RecordSet.getString("jpcNo"));
erdetail.addStringValue(DocComInfo.getDocname(RecordSet.getString("jpcFile")));
erdetail.addStringValue(RecordSet.getString("prNo"));
erdetail.addStringValue(RecordSet.getString("prAmount"));
erdetail.addStringValue(RecordSet.getString("prAmountSum"));
erdetail.addStringValue(ResourceComInfo.getResourcename(RecordSet.getString("managerId")));
erdetail.addStringValue(RecordSet.getString("subject"));
erdetail.addStringValue(RecordSet.getString("giveDate"));
erdetail.addStringValue(RecordSet.getString("giveRemark"));
erdetail.addStringValue(RecordSet.getString("payRemark"));
erdetail.addStringValue(DocComInfo.getDocname(RecordSet.getString("content")));
erdetail.addStringValue(RecordSet.getString("createDate"));
erdetail.addStringValue(RecordSet.getString("reNewStatus"));
erdetail.addStringValue(RecordSet.getString("contractName"));
erdetail.addStringValue(RecordSet.getString("reNewStatus2"));
}
ExcelFile.init();
ExcelFile.setFilename("合同报表");
ExcelFile.addSheet("合同", es);
%>
<iframe name="ExcelOut" id="ExcelOut" src="/weaver/weaver.file.ExcelOut" style="display:none" ></iframe>
<%--<script language="javascript">--%>
<%-- window.location = "/weaver/weaver.file.ExcelOut";--%>
<%--</script>--%>

View File

@ -0,0 +1,499 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ include file="/systeminfo/init_wev8.jsp"%>
<%@ taglib uri="/WEB-INF/weaver.tld" prefix="wea"%>
<%@ taglib uri="/WEB-INF/tld/browser.tld" prefix="brow"%>
<%@ page import="weaver.file.Prop" %>
<%@ page import="weaver.hrm.HrmUserVarify" %>
<%@ page import="weaver.systeminfo.SystemEnv" %>
<jsp:useBean id="RecordSet" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="RecordSet_count" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="ResourceComInfo" class="weaver.hrm.resource.ResourceComInfo" scope="page" />
<jsp:useBean id="DepartmentComInfo" class="weaver.hrm.company.DepartmentComInfo" scope="page" />
<jsp:useBean id="CrmSupplierComInfo" class="weaver.crm.supplierinfo.CrmSupplierComInfo" scope="page" />
<jsp:useBean id="RecordSet_Dep" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="SubCompanyComInfo" class="weaver.hrm.company.SubCompanyComInfo" scope="page" /><!--zl-->
<HTML>
<HEAD>
<LINK href="/css/Weaver_wev8.css" type=text/css rel=STYLESHEET>
<SCRIPT language="javascript" src="/js/weaver_wev8.js"></script>
<style>
td * {font-size:9px !important;}
</style>
</head>
<%
String sqlwhere = " where 1=1 ";
String subcompanyid1 = ResourceComInfo.getSubCompanyID(String.valueOf(user.getUID()));
//是否采购部
boolean isDep = false;
//是否是流程接收人
boolean isShow = false;
//采购部的同事可以选择所有合同卡片;而本部门的人员(非采购部)只能选择本部门的合同卡片
RecordSet_Dep.executeSql("select * from HrmDepartment where departmentname like '%采购%' and id="+user.getUserDepartment());
if(RecordSet_Dep.next()) isDep = true;
//是否合同流程接收人
String sqlwhere_workflow = "";
RecordSet_Dep.executeSql("select distinct requestId from workflow_currentoperator where workflowid in (79,148,133,128,118,108,98,153,167,316,470,514,532,543,600,717,719,739,832,927,929) and userid="+user.getUID());
if(RecordSet_Dep.next()) isShow = true;
if(!HrmUserVarify.checkUserRight("ContactInfo:Manager", user) && !HrmUserVarify.checkUserRight("ContactInfo:User", user) && !isShow && !isDep){
response.sendRedirect("/notice/noright.jsp");
}
//如果是合同管理权限则直接1=1
if(HrmUserVarify.checkUserRight("ContactInfo:Manager", user)){
sqlwhere += " and 1=1";
}else if(isShow && HrmUserVarify.checkUserRight("ContactInfo:User", user)){
//如果是流程接收人,并且有合同查看权限
sqlwhere += " and (requestid in (select distinct requestId from workflow_currentoperator where workflowid in (79,148,133,128,118,108,98,153,167,316,470,514,532,543,600,717,719,739,832,927,929) and userid="+user.getUID()+") or reqDeptId = '"+user.getUserDepartment()+"')";
}else if(HrmUserVarify.checkUserRight("ContactInfo:User", user)){
//如果只有合同查看权限
sqlwhere += " and reqDeptId = '"+user.getUserDepartment()+"'";
}else if(isShow){
//如果只是流程接收人
sqlwhere += " and requestid in (select distinct requestId from workflow_currentoperator where workflowid in (79,148,133,128,118,108,98,153,167,316,470,514,532,543,600,717,719,739,832,927,929) and userid="+user.getUID()+")";
}
//如果没有查看全部的权限,加分部条件
if(!HrmUserVarify.checkUserRight("ContactInfoList:ALL", user)){
if (!subcompanyid1.equals("0")) {sqlwhere += " and CrmContractInfo.subcompanyid1 = '"+subcompanyid1+"' ";}
}
String imagefilename = "/images/hdReport.gif";
String titlename = SystemEnv.getHtmlLabelName(614, user.getLanguage()) + SystemEnv.getHtmlLabelName(527, user.getLanguage());
String needfav = "1";
String needhelp = "";
%>
<BODY>
<%@ include file="/systeminfo/TopTitle_wev8.jsp"%>
<%@ include file="/systeminfo/RightClickMenuConent_wev8.jsp"%>
<%
RCMenu += "{" + SystemEnv.getHtmlLabelName(197, user.getLanguage()) + ",javascript:OnSearch(),_top} ";
RCMenuHeight += RCMenuHeightStep;
RCMenu += "{" + "Excel,javascript:ContractExport(),_top} ";
RCMenuHeight += RCMenuHeightStep;
RCMenu += "{" + SystemEnv.getHtmlLabelName(18363, user.getLanguage()) + ",javascript:_table.firstPage(),_self}";
RCMenuHeight += RCMenuHeightStep;
RCMenu += "{" + SystemEnv.getHtmlLabelName(1258, user.getLanguage()) + ",javascript:_table.prePage(),_self}";
RCMenuHeight += RCMenuHeightStep;
RCMenu += "{" + SystemEnv.getHtmlLabelName(1259, user.getLanguage()) + ",javascript:_table.nextPage(),_self}";
RCMenuHeight += RCMenuHeightStep;
RCMenu += "{" + SystemEnv.getHtmlLabelName(18362, user.getLanguage()) + ",javascript:_table.lastPage(),_self}";
RCMenuHeight += RCMenuHeightStep;
%>
<%
int pagenum = Util.getIntValue(request.getParameter("pagenum"), 1);
int perpage = Util.getPerpageLog();
if (perpage <= 1) perpage = 10;
String creator = Util.fromScreen(request.getParameter("creator"), user.getLanguage());
String fromdate = Util.fromScreen(request.getParameter("fromdate"), user.getLanguage());
String fromdate2 = Util.fromScreen(request.getParameter("fromdate2"), user.getLanguage());
String enddate = Util.fromScreen(request.getParameter("enddate"), user.getLanguage());
String enddate2 = Util.fromScreen(request.getParameter("enddate2"), user.getLanguage());
String status_temp = Util.null2String(request.getParameter("status_temp"));
String conNo = Util.fromScreen(request.getParameter("conNo"), user.getLanguage());
String prNo = Util.fromScreen(request.getParameter("prNo"), user.getLanguage());
String jpcNo = Util.fromScreen(request.getParameter("jpcNo"), user.getLanguage());
String suppliersId = Util.fromScreen(request.getParameter("suppliersId"), user.getLanguage());
String isOneSuppliers = Util.fromScreen(request.getParameter("isOneSuppliers"), user.getLanguage());
// String reqDeptId = String.valueOf(user.getUserDepartment());
String reqDeptId = Util.fromScreen(request.getParameter("reqDeptId"), user.getLanguage());;
//管理员组或采购部才能查询所有部门下合同,合同接收人查看接收的合同
// if(HrmUserVarify.checkUserRight("ContactInfo:Manager", user) || isShow) reqDeptId = Util.fromScreen(request.getParameter("reqDeptId"), user.getLanguage());
String isOverdue = Util.fromScreen(request.getParameter("isOverdue"), user.getLanguage());
String status = Util.fromScreen(request.getParameter("status"), user.getLanguage());
String isOverdueNext = Util.fromScreen(request.getParameter("isOverdueNext"), user.getLanguage());
String conType = Util.fromScreen(request.getParameter("conType"), user.getLanguage());
String name = Util.fromScreen(request.getParameter("name"), user.getLanguage());
String subCompanyId = Util.fromScreen(request.getParameter("subCompanyId"), user.getLanguage());
String reNewStatus = Util.fromScreen(request.getParameter("reNewStatus"), user.getLanguage());
String conStatus = Util.fromScreen(request.getParameter("conStatus"), user.getLanguage());
String contractName = Util.fromScreen(request.getParameter("contractName"), user.getLanguage());
String csstatus = Util.fromScreen(request.getParameter("csstatus"), user.getLanguage());
int opentype = Util.getIntValue(request.getParameter("opentype"),-1);
//String sqlwhere = " where status = '' ";
//if(!"".equals(status_temp)) sqlwhere += " and status in ("+status_temp+") ";
if (!fromdate.equals("")) sqlwhere += " and startDate>='" + fromdate + "'";
if (!fromdate2.equals("")) sqlwhere += " and startDate<='" + fromdate2 + "'";
if (!enddate.equals("")) sqlwhere += " and enddate>='" + enddate + "'";
if (!enddate2.equals("")) sqlwhere += " and enddate<='" + enddate2 + "'";
if (!conNo.equals("")) sqlwhere += " and conNo like '%" + conNo + "%'";
if (!prNo.equals("")) sqlwhere += " and prNo='" + prNo + "'";
if (!jpcNo.equals("")) sqlwhere += " and jpcNo='" + jpcNo + "'";
if(!"".equals(suppliersId)) sqlwhere += " and suppliersId=" + suppliersId;
if (!isOneSuppliers.equals("")) sqlwhere += " and isOneSuppliers='" + isOneSuppliers + "'";
if (!"".equals(creator) && !"0".equals(creator)) sqlwhere += " and CrmContractInfo.creator=" + creator;
if (!reqDeptId.equals("")) sqlwhere += " and reqDeptId=" + reqDeptId;
if (!isOverdue.equals("")) sqlwhere += " and isOverdue='" + isOverdue + "'";
if (!status.equals("")) sqlwhere += " and CrmContractInfo.status='" + status + "'";
if (!isOverdueNext.equals("")) sqlwhere += " and isOverdueNext='" + isOverdueNext + "'";
if (!conType.equals("")) sqlwhere += " and conType='" + conType + "'";
if (!csstatus.equals("")) sqlwhere += " and CrmSalesContractInfo.status='" + csstatus + "'";
if (!name.equals("")) sqlwhere += " and name like '%" + name + "%'";
if (!subCompanyId.equals("")) sqlwhere += " and CrmContractInfo.subcompanyid1 = '" + subCompanyId + "'";
if (!reNewStatus.equals("")) sqlwhere += " and conStatus = '" + reNewStatus + "'";
if (!contractName.equals("")) sqlwhere += " and contractName like '%" + contractName + "%'";
//if (reNewStatus2.equals("待续签")) sqlwhere += " and dbo.getReNewStatus2(2,CrmContractInfo.saleContract) > 0";
//else if (reNewStatus2.equals("已续签")) sqlwhere += " and dbo.getReNewStatus2(1,CrmContractInfo.saleContract) > 0";
//else if (reNewStatus2.equals("无需续签")) sqlwhere += " and dbo.getReNewStatus2(3,CrmContractInfo.saleContract) > 0";
//System.out.println("sqlwhere:"+sqlwhere);
if(opentype > -1){
sqlwhere += " and isnull(CrmContractInfo.opentype,0) = " + opentype;
}
String orderStr = " order by startDate desc, CrmContractInfo.id desc ";
// out.println("sqlwhere:" + sqlwhere);
// out.println("orderStr:" + orderStr);
// session.setAttribute("sqlwhere", sqlwhere);
// session.setAttribute("orderStr", orderStr);
%>
<form id=frmmain name=frmmain method=post action="ContractList.jsp">
<input type=hidden id=pagenum name=pagenum value="<%=pagenum%>">
<input type=hidden id=status_temp name=status_temp value="">
<table class=ViewForm>
<tbody>
<COLGROUP>
<COL width="13%">
<COL width="20%">
<COL width="14%">
<COL width="20%">
<COL width="13%">
<COL width="20%">
<TR class=Title>
<TH colSpan=6><%=SystemEnv.getHtmlLabelName(15774, user.getLanguage())%></TH>
</TR>
<tr style="height: 1px">
<td class=Line1 colspan=6></td>
</tr>
<tr style="height: 1px">
<td class=Line colspan=6></td>
</tr>
<tr>
<TD>合同状态</TD>
<TD class=Field>
<select id="reNewStatus" name="reNewStatus">
<option value="" <%="".equals(reNewStatus)?"selected":""%>></option>
<option value="0" <%="0".equals(reNewStatus)?"selected":""%>>执行</option>
<option value="1" <%="1".equals(reNewStatus)?"selected":""%>>待续签</option>
<option value="2" <%="2".equals(reNewStatus)?"selected":""%>>已续签</option>
<option value="3" <%="3".equals(reNewStatus)?"selected":""%>>关闭</option>
</select>
</TD>
<td><%=SystemEnv.getHtmlLabelName(1970, user.getLanguage())%></td>
<td class=field>
<BUTTON type="button" class=calendar id=SelectDate onclick=getDate('fromdatespan','fromdate')></BUTTON>&nbsp;
<SPAN id=fromdatespan><%=Util.toScreen(fromdate, user.getLanguage())%></SPAN>&nbsp;-&nbsp;
<BUTTON type="button" class=calendar id=SelectDate onclick=getDate('fromdate2span','fromdate2')></BUTTON>&nbsp;
<SPAN id=fromdate2span><%=Util.toScreen(fromdate2, user.getLanguage())%></SPAN>
<input type="hidden" name="fromdate" value=<%=fromdate%>>
<input type="hidden" name="fromdate2" value=<%=fromdate2%>>
</td>
<td><%=SystemEnv.getHtmlLabelName(15236, user.getLanguage())%></td>
<td class=field>
<BUTTON type="button" class=calendar id=SelectDate onclick=getDate('enddatespan','enddate')></BUTTON>&nbsp;
<SPAN id=enddatespan><%=Util.toScreen(enddate, user.getLanguage())%></SPAN>&nbsp;-&nbsp;
<BUTTON type="button" class=calendar id=SelectDate onclick=getDate('enddate2span','enddate2')></BUTTON>&nbsp;
<SPAN id=enddate2span><%=Util.toScreen(enddate2, user.getLanguage())%></SPAN>
<input type="hidden" name="enddate" value=<%=enddate%>>
<input type="hidden" name="enddate2" value=<%=enddate2%>>
</td>
</TR>
<tr style="height: 1px">
<td class=Line colspan=6></td>
</tr>
<TR>
<TD><%=SystemEnv.getHtmlLabelName(21282, user.getLanguage())%></TD>
<TD class=Field>
<INPUT class=InputStyle maxLength=100 id="conNo" name="conNo" STYLE="width:150" value="<%=conNo%>">
</TD>
<TD>PR<%=SystemEnv.getHtmlLabelName(403,user.getLanguage())%></TD>
<TD class=Field>
<INPUT class=InputStyle maxLength=100 id="prNo" name="prNo" STYLE="width:150" value="<%=prNo%>">
</TD>
<TD>JPC<%=SystemEnv.getHtmlLabelName(2171,user.getLanguage())%><%=SystemEnv.getHtmlLabelName(16992,user.getLanguage())%></TD>
<TD class=Field>
<INPUT class=InputStyle maxLength=100 id="jpcNo" name="jpcNo" STYLE="width:150" value="<%=jpcNo%>">
</TD>
</TR>
<tr style="height: 1px">
<td class=Line colspan=6></td>
</tr>
<TR>
<TD><%=SystemEnv.getHtmlLabelName(613002, user.getLanguage())%></TD>
<TD class=Field>
<brow:browser viewType="0"
id="suppliersId"
name="suppliersId"
browserValue="<%=suppliersId %>"
browserUrl="/systeminfo/BrowserMain.jsp?url=/interface/CommonBrowser.jsp?type=browser.gys"
hasInput="true"
isSingle="true"
hasBrowser = "true"
isMustInput='1'
width="165px"
browserSpanValue="<%=CrmSupplierComInfo.getSuppliername(suppliersId) %>">
</brow:browser>
</TD>
<TD></TD>
<TD class=Field>
</TD>
<TD><%=SystemEnv.getHtmlLabelName(913, user.getLanguage())%></TD>
<TD class=Field>
<brow:browser viewType="0"
id="creator"
name="creator"
browserValue="<%=creator %>"
browserUrl="/systeminfo/BrowserMain.jsp?url=/hrm/resource/ResourceBrowser.jsp"
hasInput="true"
isSingle="true"
hasBrowser = "true"
isMustInput='1'
width="165px"
browserSpanValue="<%=ResourceComInfo.getResourcename(creator) %>">
</brow:browser>
</TD>
</TR>
<tr style="height: 1px">
<td class=Line colspan=6></td>
</tr>
<TR>
<TD><%=SystemEnv.getHtmlLabelName(620002, user.getLanguage())%></TD>
<TD class=Field>
<brow:browser viewType="0"
id="reqDeptId"
name="reqDeptId"
browserValue="<%=reqDeptId %>"
browserUrl="/systeminfo/BrowserMain.jsp?url=/hrm/company/DepartmentBrowser.jsp"
hasInput="true"
isSingle="true"
hasBrowser = "true"
isMustInput='1'
width="165px"
browserSpanValue="<%=Util.toScreen(DepartmentComInfo.getDepartmentname(reqDeptId),user.getLanguage())%>">
</brow:browser>
<%-- <%--%>
<%-- //管理员组才能查询所有部门下合同--%>
<%-- if(HrmUserVarify.checkUserRight("ContactInfo:Manager", user)){--%>
<%-- %>--%>
<%-- <brow:browser viewType="0"--%>
<%-- id="reqDeptId"--%>
<%-- name="reqDeptId"--%>
<%-- browserValue="<%=reqDeptId %>"--%>
<%-- browserUrl="/systeminfo/BrowserMain.jsp?url=/hrm/company/DepartmentBrowser.jsp"--%>
<%-- hasInput="true"--%>
<%-- isSingle="true"--%>
<%-- hasBrowser = "true"--%>
<%-- isMustInput='1'--%>
<%-- width="165px"--%>
<%-- browserSpanValue="<%=Util.toScreen(DepartmentComInfo.getDepartmentname(reqDeptId),user.getLanguage())%>">--%>
<%-- </brow:browser>--%>
<%-- &lt;%&ndash;<INPUT type=hidden class="wuiBrowser" _required="no" _displayTemplate="#b{name}" _displayText="<%=Util.toScreen(DepartmentComInfo.getDepartmentname(reqDeptId),user.getLanguage()) %>" _url="/systeminfo/BrowserMain.jsp?url=/hrm/company/DepartmentBrowser.jsp" name="reqDeptId" value="<%=reqDeptId%>">&ndash;%&gt;--%>
<%-- <%}else{ %>--%>
<%-- <%=Util.toScreen(DepartmentComInfo.getDepartmentname(reqDeptId),user.getLanguage()) %>--%>
<%-- <%} %>--%>
</TD>
<TD>付款状态</TD>
<TD class=Field>
<select id="status" name="status">
<option value="" <%="".equals(status)?"selected":""%>></option>
<option value="0" <%="0".equals(status)?"selected":""%>>执行中</option>
<option value="1" <%="1".equals(status)?"selected":""%>>已结清</option>
</select>
</TD>
<TD><%=SystemEnv.getHtmlLabelName(620017, user.getLanguage())%></TD>
<TD class=Field>
<select id="isOverdueNext" name="isOverdueNext">
<option value="" <%="".equals(isOverdueNext)?"selected":""%>></option>
<option value="Y" <%="Y".equals(isOverdueNext)?"selected":""%>><%=SystemEnv.getHtmlLabelName(163,user.getLanguage())%></option>
<option value="N" <%="N".equals(isOverdueNext)?"selected":""%>><%=SystemEnv.getHtmlLabelName(161,user.getLanguage())%></option>
</select>
</TD>
</TR>
<tr style="height: 1px">
<td class=Line colspan=6></td>
</tr>
<TR>
<TD><%=SystemEnv.getHtmlLabelName(15775, user.getLanguage())%></TD>
<TD class=Field>
<select id="conType" name="conType">
<option value="" <%="".equals(conType)?"selected":""%>></option>
<option value="0" <%="0".equals(conType)?"selected":""%>>业务型</option>
<option value="1" <%="1".equals(conType)?"selected":""%>>资本型</option>
<option value="2" <%="2".equals(conType)?"selected":""%>>费用型</option>
</select>
</TD>
<TD><%=SystemEnv.getHtmlLabelName(15142, user.getLanguage())%></TD>
<TD class=Field>
<INPUT class=InputStyle maxLength=200 id="name" name="name" STYLE="width:150" value="<%=name%>">
</TD>
<%if(HrmUserVarify.checkUserRight("ContactInfoList:ALL", user)){%>
<TD><%=SystemEnv.getHtmlLabelName(141,user.getLanguage())%></TD>
<TD class=Field>
<brow:browser viewType="0"
id="subCompanyId"
name="subCompanyId"
browserValue="<%=subCompanyId %>"
browserUrl="/systeminfo/BrowserMain.jsp?url=/hrm/company/SubcompanyBrowser.jsp"
hasInput="true"
isSingle="true"
hasBrowser = "true"
isMustInput='1'
width="165px"
browserSpanValue="<%=SubCompanyComInfo.getSubCompanyname(subCompanyId+"")%>">
</brow:browser>
<%--<input class=wuiBrowser class=inputStyle id=subCompanyId type=hidden name=subCompanyId value="<%=subCompanyId%>"--%>
<%--_url="/systeminfo/BrowserMain.jsp?url=/hrm/company/SubcompanyBrowser.jsp"--%>
<%--_displayText="<%=SubCompanyComInfo.getSubCompanyname(subCompanyId+"")%>"--%>
<%-->--%>
</TD>
<%}%>
</TR>
<tr style="height: 1px">
<td class=Line colspan=6></td>
</tr>
<TR>
<TD><%=SystemEnv.getHtmlLabelName(16404, user.getLanguage())%><%=SystemEnv.getHtmlLabelName(195, user.getLanguage())%></TD>
<TD class=Field>
<INPUT class=InputStyle maxLength=200 id="contractName" name="contractName" STYLE="width:150" value="<%=contractName%>">
</TD>
<TD>销售合同状态</TD>
<TD class=Field>
<select id="csstatus" name="csstatus">
<option value="" <%="".equals(csstatus)?"selected":""%>></option>
<option value="0" <%="0".equals(csstatus)?"selected":""%>>已签署</option>
<option value="1" <%="1".equals(csstatus)?"selected":""%>>未签署</option>
<option value="2" <%="2".equals(csstatus)?"selected":""%>>已续签</option>
<option value="3" <%="3".equals(csstatus)?"selected":""%>>关闭</option>
</select>
</TD>
<td>开闭口类型</td>
<td class="Field">
<select name="opentype">
<option value="-1" <%=(opentype == -1) ?"selected":"" %>>--请选择--</option>
<option value="0" <%=(opentype == 0) ?"selected":"" %>>闭口</option>
<option value="1" <%=(opentype == 1) ?"selected":"" %>>开口</option>
<option value="2" <%=(opentype == 2) ?"selected":"" %>>周期性</option>
</select>
</td>
</TR>
<tr style="height: 1px">
<td class=Line colspan=6></td>
</tr>
</tbody>
</table>
</form>
<div id="" style="overflow-x:scroll;width:100%;">
<table width="2500px" style="table-Layout:fixed">
<tr>
<td>
<%
String tableString = "";
String backfields = " CrmContractInfo.id,case CrmContractInfo.opentype when '0' then '闭口' when '1' then '开口' when '2' then '周期性' end opentype, reqDeptId, suppliersId, conNo, name, startDate, endDate, case isOverdue when 'Y' then '是' else '否' end as isOverdue, conAmount, content, ',' as str_temp, case isOverdueNext when 'Y' then '是' else '否' end as isOverdueNext, case CrmContractInfo.status when '0' then '执行中' when '1' then '已结清' end as status, CrmContractInfo.creator, CrmContractInfo.subcompanyid1, case conStatus when '0' then '执行' when '1' then '待续签' when '2' then '已续签' when '3' then '关闭' end as reNewStatus, contractName, saleContract, case when dbo.getReNewStatus2(1,CrmContractInfo.saleContract) > 0 then '已续签' when dbo.getReNewStatus2(2,CrmContractInfo.saleContract) > 0 then '待续签' when dbo.getReNewStatus2(3,CrmContractInfo.saleContract) > 0 then '无需续签' end as reNewStatus2,case CrmSalesContractInfo.status when '0' then '已签署' when '1' then '未签署' when '2' then '已续签' when '3' then '关闭' end as csstatus ";
String fromSql = " CrmContractInfo Left Join CrmSalesContractInfo On CrmSalesContractInfo.id=CrmContractInfo.saleContract ";
//out.print("select"+backfields+"from"+fromSql +sqlwhere);
String str_content = "content"+"str_temp";
tableString = " <table instanceid=\"crmContractInfoTable\" tabletype=\"none\" pageId=\"perpage\" pagesize=\"" +PageIdConst.getPageSize("perpage",user.getUID())+"\" >" + "<sql backfields=\"" + backfields + "\" sqlform=\"" + fromSql + "\" sqlwhere=\"" + Util.toHtmlForSplitPage(sqlwhere) + "\" sqlprimarykey=\"CrmContractInfo.id\" sqlsortway=\"Desc\" sqlisdistinct=\"false\" />" + "<head>";
tableString += "<col width=\"10%\" text=\"" + SystemEnv.getHtmlLabelName(15142, user.getLanguage()) + "\" column=\"name\" orderkey=\"name\" linkkey=\"id\" linkvaluecolumn=\"id\" href=\"/CRM/contractinfo/ContractEdit.jsp\" target=\"_fullwindow\" />";
tableString += "<col width=\"10%\" text=\"" + SystemEnv.getHtmlLabelName(21282, user.getLanguage()) + "\" column=\"conNo\" orderkey=\"conNo\" />";
tableString += "<col width=\"10%\" text=\"" + SystemEnv.getHtmlLabelName(620002, user.getLanguage()) + "\" column=\"reqDeptId\" orderkey=\"reqDeptId\" transmethod=\"weaver.hrm.company.DepartmentComInfo.getDepartmentname\" linkkey=\"id\" href=\"/hrm/company/HrmDepartmentDsp.jsp\" target=\"_fullwindow\" />";
tableString += "<col width=\"10%\" text=\""+ SystemEnv.getHtmlLabelName(613002, user.getLanguage()) + "\" column=\"suppliersId\" orderkey=\"suppliersId\" linkkey=\"id\" transmethod=\"weaver.crm.supplierinfo.CrmSupplierComInfo.getSuppliername\" href=\"/CRM/supplierinfo/SuppliersEdit.jsp?1=1\" target=\"_fullwindow\" />";
tableString += "<col width=\"6%\" text=\"" + SystemEnv.getHtmlLabelName(1970, user.getLanguage()) + "\" column=\"startDate\" orderkey=\"startDate\" />";
tableString += "<col width=\"6%\" text=\"" + SystemEnv.getHtmlLabelName(15236, user.getLanguage()) + "\" column=\"endDate\" orderkey=\"endDate\" />";
//tableString += "<col width=\"3%\" text=\"" + SystemEnv.getHtmlLabelName(620016, user.getLanguage()) + "\" column=\"isOverdue\" orderkey=\"isOverdue\" />";
tableString += "<col width=\"6%\" text=\"" + SystemEnv.getHtmlLabelName(6146, user.getLanguage()) + "\" column=\"conAmount\" orderkey=\"conAmount\" />";
tableString += "<col width=\"10%\" text=\"" + SystemEnv.getHtmlLabelName(620015, user.getLanguage()) + "\" column=\"content\" orderkey=\""+str_content+"\" transmethod=\"weaver.splitepage.transform.SptmForDoc.getDocNames\" />";
tableString += "<col width=\"4%\" text=\"" + SystemEnv.getHtmlLabelName(620017, user.getLanguage()) + "\" column=\"isOverdueNext\" orderkey=\"isOverdueNext\" />";
tableString += "<col width=\"4%\" text=\"付款状态\" column=\"status\" orderkey=\"status\" />";
tableString += "<col width=\"4%\" text=\"" + SystemEnv.getHtmlLabelName(913, user.getLanguage()) + "\" column=\"creator\" orderkey=\"creator\" linkkey=\"id\" transmethod=\"weaver.hrm.resource.ResourceComInfo.getResourcename\" href=\"/hrm/resource/HrmResource.jsp?1=1\" target=\"_fullwindow\" />";
//tableString += "<col width=\"10%\" text=\"" + SystemEnv.getHtmlLabelName(104, user.getLanguage()) + "\" column=\"id\" orderkey=\"id\" transmethod=\"weaver.crm.contractinfo.CrmContractTool.getLinkButtons\" />";
tableString += "<col width=\"4%\" text=\"合同状态\" column=\"reNewStatus\" orderkey=\"reNewStatus\" />";
tableString += "<col width=\"4%\" text=\"销售合同\" column=\"contractName\" orderkey=\"contractName\" linkkey=\"id\" linkvaluecolumn=\"saleContract\" href=\"/CRM/salecontractinfo/SaleContractEdits.jsp?metherid=search\" target=\"_fullwindow\" />";
tableString += "<col width=\"4%\" text=\"销售合同状态\" column=\"csstatus\" orderkey=\"csstatus\" />";
tableString += "<col width=\"4%\" text=\"开闭口类型\" column=\"opentype\" orderkey=\"opentype\" />";
tableString += "<col width=\"4%\" text=\"" + SystemEnv.getHtmlLabelName(141,user.getLanguage()) + "\" column=\"subcompanyid1\" orderkey=\"subcompanyid1\" transmethod=\"weaver.hrm.company.SubCompanyComInfo.getSubCompanyname\" />";
tableString += "</head>";
tableString += "</table>";
%>
<input type="hidden" name="pageId" id="pageId" value="crmContractInfoTable" />
<wea:SplitPageTag tableString="<%=tableString%>" mode="run" />
</td>
</tr>
</table>
</div>
<%@ include file="/systeminfo/RightClickMenu_wev8.jsp"%>
</body>
<iframe id="searchexport" style="display: none"></iframe>
<script language=javascript>
function ContractExport() {
var sqlwhere = encodeURI("<%=sqlwhere%>");
var orderStr = encodeURI("<%=orderStr%>");
jQuery("#searchexport").attr("src", "ContractReportExport.jsp?sqlwhere="+sqlwhere+"&orderStr=" + orderStr);
}
function OnSubmit(pagenum) {
document.frmmain.pagenum.value = pagenum;
document.frmmain.submit();
}
function OnSearch(){
var chkInTableTags = document.getElementsByName("status");
var status_temp = "";
for(var i=0;i<chkInTableTags.length;i++){
if(chkInTableTags[i].checked && chkInTableTags[i].value != ''){
if(status_temp == "") status_temp = "'" + chkInTableTags[i].value + "'";
else status_temp = status_temp + ",'" + chkInTableTags[i].value + "'";
}
}
jQuery("#status_temp").val(status_temp);
document.frmmain.submit();
}
//续签
function newWorkflowByContract4(key){
location.href = "ContractNewWorkflow.jsp?status=4&id="+key;
}
//试运作
function newWorkflowByContract3(key){
location.href = "ContractNewWorkflow.jsp?status=3&id="+key;
}
</script>
<SCRIPT language="javascript" src="/js/datetime_wev8.js"></script>
<SCRIPT language="javascript" src="/js/JSDateTime/WdatePicker_wev8.js"></script>
</html>

View File

@ -0,0 +1,127 @@
<%@ page language="java" contentType="text/html; charset=GBK" %>
<%@ include file="/systeminfo/init.jsp" %>
<%@ page import="weaver.general.Util, weaver.file.ExcelSheet, weaver.file.ExcelRow" %>
<jsp:useBean id="RecordSet" class="weaver.conn.RecordSet" scope="page"/>
<jsp:useBean id="ResourceComInfo" class="weaver.hrm.resource.ResourceComInfo" scope="page"/>
<jsp:useBean id="SptmForDoc" class="weaver.splitepage.transform.SptmForDoc" scope="page"/>
<jsp:useBean id="SubCompanyComInfo" class="weaver.hrm.company.SubCompanyComInfo" scope="page"/>
<jsp:useBean id="DepartmentComInfo" class="weaver.hrm.company.DepartmentComInfo" scope="page"/>
<jsp:useBean id="CrmSupplierComInfo" class="weaver.crm.supplierinfo.CrmSupplierComInfo" scope="page"/>
<jsp:useBean id="RequestComInfo" class="weaver.workflow.request.RequestComInfo" scope="page"/>
<jsp:useBean id="DocComInfo" class="weaver.docs.docs.DocComInfo" scope="page"/>
<jsp:useBean id="ExcelFile" class="weaver.file.ExcelFile" scope="session"/>
<%!
public static String ToDBC(String input) {
char[] c = input.toCharArray();
for (int i = 0; i < c.length; i++) {
if (c[i] == 12288) {
//全角空格为12288半角空格为32
c[i] = (char) 32;
continue;
}
if (c[i] > 65280 && c[i] < 65375)
//其他字符半角(33-126)与全角(65281-65374)的对应关系是均相差65248
c[i] = (char) (c[i] - 65248);
}
return new String(c);
}
%>
<%
// String sqlwhere=(String)session.getAttribute("sqlwhere");
// String orderStr=(String)session.getAttribute("orderStr");
String sqlwhere = request.getParameter("sqlwhere");
sqlwhere = ToDBC(sqlwhere);
String orderStr = request.getParameter("orderStr");
orderStr = ToDBC(orderStr);
String sqlstr = "";
if (RecordSet.getDBType().equals("oracle")) {
sqlstr = "select CrmContractInfo.id, reqDeptId, suppliersId, conNo, name, startDate, endDate, case isOverdue when 'Y' then '是' else '否' end as isOverdue, conAmount, content, case isOverdueNext when 'Y' then '是' else '否' end as isOverdueNext, case CrmContractInfo.status when '0' then '执行中' when '1' then '已结清' end as status, case isOneSuppliers when 'Y' then '是' when 'N' then '否' else '' end as isOneSuppliers, prRequestId,jpcNo,jpcFile,prNo,prAmount,prAmountSum,conAmount,managerId,subject,giveDate,giveRemark,payRemark,content,CrmContractInfo.createDate,CrmContractInfo.creator,CrmContractInfo.subcompanyid1, case conStatus when '0' then '执行' when '1' then '待续签' when '2' then '已续签' when '3' then '关闭' end as reNewStatus,contractName, saleContract, case CrmSalesContractInfo.status when '0' then '已签署' when '1' then '未签署' when '2' then '已续签' when '3' then '关闭' end as reNewStatus2 from CrmContractInfo Left Join CrmSalesContractInfo On CrmSalesContractInfo.id=CrmContractInfo.saleContract" + sqlwhere + orderStr;
} else {
sqlstr = "select CrmContractInfo.id, reqDeptId, suppliersId, conNo, name, startDate, endDate, case isOverdue when 'Y' then '是' else '否' end as isOverdue, conAmount, content, case isOverdueNext when 'Y' then '是' else '否' end as isOverdueNext, case CrmContractInfo.status when '0' then '执行中' when '1' then '已结清' end as status, case isOneSuppliers when 'Y' then '是' when 'N' then '否' else '' end as isOneSuppliers, prRequestId,jpcNo,jpcFile,prNo,prAmount,prAmountSum,conAmount,managerId,subject,giveDate,giveRemark,payRemark,content,CrmContractInfo.createDate,CrmContractInfo.creator,CrmContractInfo.subcompanyid1, case conStatus when '0' then '执行' when '1' then '待续签' when '2' then '已续签' when '3' then '关闭' end as reNewStatus,contractName, saleContract, case CrmSalesContractInfo.status when '0' then '已签署' when '1' then '未签署' when '2' then '已续签' when '3' then '关闭' end as reNewStatus2 from CrmContractInfo Left Join CrmSalesContractInfo On CrmSalesContractInfo.id=CrmContractInfo.saleContract" + sqlwhere + orderStr;
}
new BaseBean().writeLog(">>>>>>>>"+sqlstr);
RecordSet.executeQuery(sqlstr);
ExcelSheet es = new ExcelSheet();
ExcelRow er = es.newExcelRow();
er.addStringValue(SystemEnv.getHtmlLabelName(141,user.getLanguage()));
er.addStringValue(SystemEnv.getHtmlLabelName(620002,user.getLanguage()));
er.addStringValue(SystemEnv.getHtmlLabelName(613002,user.getLanguage()));
er.addStringValue(SystemEnv.getHtmlLabelName(21282,user.getLanguage()));
er.addStringValue(SystemEnv.getHtmlLabelName(15142,user.getLanguage()));
er.addStringValue(SystemEnv.getHtmlLabelName(1970,user.getLanguage()));
er.addStringValue(SystemEnv.getHtmlLabelName(15236,user.getLanguage()));
er.addStringValue(SystemEnv.getHtmlLabelName(620016,user.getLanguage()));
er.addStringValue(SystemEnv.getHtmlLabelName(6146,user.getLanguage()));
er.addStringValue(SystemEnv.getHtmlLabelName(620015,user.getLanguage()));
er.addStringValue(SystemEnv.getHtmlLabelName(620017,user.getLanguage()));
er.addStringValue("付款状态");
er.addStringValue(SystemEnv.getHtmlLabelName(913,user.getLanguage()));
er.addStringValue(SystemEnv.getHtmlLabelName(620009,user.getLanguage()));
er.addStringValue(SystemEnv.getHtmlLabelName(620003,user.getLanguage()));
er.addStringValue("JPC"+SystemEnv.getHtmlLabelName(16992,user.getLanguage()));
er.addStringValue(SystemEnv.getHtmlLabelName(620004,user.getLanguage()));
er.addStringValue("PR"+SystemEnv.getHtmlLabelName(403,user.getLanguage()));
er.addStringValue("PR"+SystemEnv.getHtmlLabelName(856,user.getLanguage()));
er.addStringValue(SystemEnv.getHtmlLabelName(620010,user.getLanguage()));
er.addStringValue(SystemEnv.getHtmlLabelName(620011,user.getLanguage()));
er.addStringValue(SystemEnv.getHtmlLabelName(620006,user.getLanguage()));
er.addStringValue(SystemEnv.getHtmlLabelName(620012,user.getLanguage()));
er.addStringValue(SystemEnv.getHtmlLabelName(620013,user.getLanguage()));
er.addStringValue(SystemEnv.getHtmlLabelName(620014,user.getLanguage()));
er.addStringValue(SystemEnv.getHtmlLabelName(620015,user.getLanguage()));
er.addStringValue(SystemEnv.getHtmlLabelName(614,user.getLanguage())+SystemEnv.getHtmlLabelName(722,user.getLanguage()));
er.addStringValue("合同状态");
er.addStringValue("销售合同");
er.addStringValue("销售合同状态");
while (RecordSet.next()) {
ExcelRow erdetail = es.newExcelRow();
erdetail.addStringValue(SubCompanyComInfo.getSubCompanyname(RecordSet.getString("subcompanyid1")));
erdetail.addStringValue(DepartmentComInfo.getDepartmentname(RecordSet.getString("reqDeptId")));
erdetail.addStringValue(CrmSupplierComInfo.getSuppliername(RecordSet.getString("suppliersId")));
erdetail.addStringValue(RecordSet.getString("conNo"));
erdetail.addStringValue(RecordSet.getString("name"));
erdetail.addStringValue(RecordSet.getString("startDate"));
erdetail.addStringValue(RecordSet.getString("endDate"));
erdetail.addStringValue(RecordSet.getString("isOverdue"));
erdetail.addStringValue(RecordSet.getString("conAmount"));
erdetail.addStringValue(Util.toScreen(SptmForDoc.getDocName(RecordSet.getString("content")), user.getLanguage()));
erdetail.addStringValue(RecordSet.getString("isOverdueNext"));
erdetail.addStringValue(RecordSet.getString("status"));
erdetail.addStringValue(Util.toScreen(ResourceComInfo.getResourcename(RecordSet.getString("creator")), user.getLanguage()));
erdetail.addStringValue(RecordSet.getString("isOneSuppliers"));
erdetail.addStringValue(RequestComInfo.getRequestname(RecordSet.getString("prRequestId")));
erdetail.addStringValue(RecordSet.getString("jpcNo"));
erdetail.addStringValue(DocComInfo.getDocname(RecordSet.getString("jpcFile")));
erdetail.addStringValue(RecordSet.getString("prNo"));
erdetail.addStringValue(RecordSet.getString("prAmount"));
erdetail.addStringValue(RecordSet.getString("prAmountSum"));
erdetail.addStringValue(ResourceComInfo.getResourcename(RecordSet.getString("managerId")));
erdetail.addStringValue(RecordSet.getString("subject"));
erdetail.addStringValue(RecordSet.getString("giveDate"));
erdetail.addStringValue(RecordSet.getString("giveRemark"));
erdetail.addStringValue(RecordSet.getString("payRemark"));
erdetail.addStringValue(DocComInfo.getDocname(RecordSet.getString("content")));
erdetail.addStringValue(RecordSet.getString("createDate"));
erdetail.addStringValue(RecordSet.getString("reNewStatus"));
erdetail.addStringValue(RecordSet.getString("contractName"));
erdetail.addStringValue(RecordSet.getString("reNewStatus2"));
}
ExcelFile.init();
ExcelFile.setFilename("合同报表");
ExcelFile.addSheet("合同", es);
%>
<iframe name="ExcelOut" id="ExcelOut" src="/weaver/weaver.file.ExcelOut" style="display:none" ></iframe>
<%--<script language="javascript">--%>
<%-- window.location = "/weaver/weaver.file.ExcelOut";--%>
<%--</script>--%>

View File

@ -0,0 +1,916 @@
<%@ page import="weaver.general.Util"%>
<%@ page import="java.util.*"%>
<jsp:useBean id="RecordSet" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="RecordSet_count" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="ResourceComInfo" class="weaver.hrm.resource.ResourceComInfo" scope="page" />
<jsp:useBean id="DepartmentComInfo" class="weaver.hrm.company.DepartmentComInfo" scope="page" />
<jsp:useBean id="CrmSupplierComInfo" class="weaver.crm.supplierinfo.CrmSupplierComInfo" scope="page" />
<jsp:useBean id="RecordSet_Dep" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="SubCompanyComInfo" class="weaver.hrm.company.SubCompanyComInfo" scope="page" /><!--zl-->
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ include file="/systeminfo/init_wev8.jsp"%>
<%@ taglib uri="/WEB-INF/weaver.tld" prefix="wea"%>
<%@ taglib uri="/WEB-INF/tld/browser.tld" prefix="brow"%>
<HTML>
<HEAD>
<LINK href="/css/Weaver_wev8.css" type=text/css rel=STYLESHEET>
<SCRIPT language="javascript" src="/js/weaver_wev8.js"></script>
<SCRIPT type="text/javascript">
function changecn(){
var pro=document.getElementById("isMainSell").value;
if(pro!="0"){
var nono=new Option("无","");
document.getElementById("contractType").options.length=0;
document.getElementById("contractType").options.add(nono);
}else{
var oo=new Option("","");
var con0=new Option("正式合同","0");
var con1=new Option("延期协议","1");
var con2=new Option("意向书及其他","2");
// 先清除之前的选项
document.getElementById("contractType").options.length=0;
//执行添加
document.getElementById("contractType").options.add(oo);
document.getElementById("contractType").options.add(con0);
document.getElementById("contractType").options.add(con1);
document.getElementById("contractType").options.add(con2);
}
}
/**默认加载*/
function changeCon()
{
changecn();
}
</SCRIPT>
</head>
<%
String sqlwhere = " where 1=1 ";
//查看权限
boolean hasViewRight = false;
if(HrmUserVarify.checkUserRight("xsht:view", user))
{
hasViewRight = true;
}
if(!hasViewRight ){
sqlwhere += " and (exists(";
sqlwhere += " select 1 from (";
sqlwhere += " select requestid, htbh from formtable_main_29 where htbh is not null";
sqlwhere += " union all";
sqlwhere += " select requestid, htbh from formtable_main_31 where htbh is not null";
sqlwhere += " ) t ";
sqlwhere += " where exists( ";
sqlwhere += " select 1 from workflow_currentoperator ";
sqlwhere += " where requestid = t.requestid and workflowid in(200,201,205,206,264,267,270,271,272,275,277,279,339,343,344,348,352,353,354,355,357,360,361,365,366,373,374,375,377,378,381,382,383,458,461,462,495,496,497,498,612,614,750,759,776,846,852,854,856,871,872,914,918,954,955,987,989,990,991,1080,1081) and userid = "+user.getUID();
sqlwhere += " ) and htbh = mt.contractCode";
sqlwhere += " ) or contractRemind='"+ user.getUID() +"'";
//组合权限
sqlwhere += " or exists(select a.id from CrmContractRights a join HrmRoleMembers b on a.roleId=b.roleid where a.propDeptId=mt.propDeptId and a.operationDeptId=mt.operationDeptId and b.resourceid='"+ user.getUID()+"')";
sqlwhere += " )";
}
// if(!hasViewRight ){
// sqlwhere += " and (exists(";
// sqlwhere += " select a.requestid from";
// sqlwhere += " (select requestid from workflow_currentoperator";
// sqlwhere += " where workflowid in(200,201,205,206,264,267,270,271,272,275,277,279,339,343,344,348,352,353,354,355,357,360,361,365,366,373,374,375,377,378,381,382,383,458,461,462,495,496,497,498,612,614,750,759,776,846,852,854,856,871,872,914,918,954,955,987,989,990,991,1080,1081) and userid = " + user.getUID();
// sqlwhere += " )as a";
// sqlwhere += " left join formtable_main_29 as c on c.requestid = a.requestId and c.htbh = mt.contractCode";
// sqlwhere += " left join formtable_main_31 as d on d.requestid = a.requestId and d.htbh = mt.contractCode";
// sqlwhere += " where";
// sqlwhere += " (c.htbh is not null or";
// sqlwhere += " d.htbh is not null";
// sqlwhere += " )";
// sqlwhere += " ) or contractRemind='"+ user.getUID() +"'";
// //组合权限
// sqlwhere += " or exists(select a.id from CrmContractRights a join HrmRoleMembers b on a.roleId=b.roleid where a.propDeptId=mt.propDeptId and a.operationDeptId=mt.operationDeptId and b.resourceid='"+ user.getUID()+"')";
// sqlwhere += " )";
// }
//提醒人变更权限
boolean hasHttxrbgRight = false;
if (HrmUserVarify.checkUserRight("httxr:edit", user)){
hasHttxrbgRight = true;
}
//是否采购部
//boolean isDep = false;
//是否是流程接收人
//boolean isShow = false;
//采购部的同事可以选择所有合同卡片;而本部门的人员(非采购部)只能选择本部门的合同卡片
//RecordSet_Dep.executeSql("select * from HrmDepartment where departmentname like '%采购%' and id="+user.getUserDepartment());
//if(RecordSet_Dep.next()) isDep = true;
//是否合同流程接收人
//String sqlwhere_workflow = "";
//RecordSet_Dep.executeSql("select distinct requestId from workflow_currentoperator where workflowid in (79,148,133,128,118,108,98,153,167) and userid="+user.getUID());
//if(RecordSet_Dep.next()) isShow = true;
// if(!HrmUserVarify.checkUserRight("ContactInfo:Manager", user) && !HrmUserVarify.checkUserRight("ContactInfo:User", user) && !isShow && !isDep){
// response.sendRedirect("/notice/noright.jsp");
// }
//如果是合同管理权限则直接1=1
// if(HrmUserVarify.checkUserRight("ContactInfo:Manager", user)){//判断用户是否具有权限
// // sqlwhere += " and 1=1";
// }else if(isShow && HrmUserVarify.checkUserRight("ContactInfo:User", user)){
// //如果是流程接收人,并且有合同查看权限
// sqlwhere += " and requestid in (select distinct requestId from workflow_currentoperator where workflowid in (79,148,133,128,118,108,98,153,167) and userid="+user.getUID()+") or reqDeptId = '"+user.getUserDepartment()+"'";
// }else if(HrmUserVarify.checkUserRight("ContactInfo:User", user)){
// //如果只有合同查看权限
// sqlwhere += " and reqDeptId = '"+user.getUserDepartment()+"'";
// }else if(isShow){
// //如果只是流程接收人
// sqlwhere += " and requestid in (select distinct requestId from workflow_currentoperator where workflowid in (79,148,133,128,118,108,98,153,167) and userid="+user.getUID()+")";
// }
//如果没有查看全部的权限,加分部条件 ADD BY LIST 20141106
String subcompanyid1 = ResourceComInfo.getSubCompanyID(String.valueOf(user.getUID()));
if(!HrmUserVarify.checkUserRight("SalesContractList:ALL", user)){
if (!subcompanyid1.equals("0")) {sqlwhere += " and subcompanyid1='" + subcompanyid1 + "'";}
}
//如果没有查看全部的权限,加分部条件 ADD BY LIST 20141106
String imagefilename = "/images/hdReport.gif";
String titlename = SystemEnv.getHtmlLabelName(614, user.getLanguage()) + SystemEnv.getHtmlLabelName(527, user.getLanguage());
String needfav = "1";
String needhelp = "";
%>
<BODY>
<%@ include file="/systeminfo/TopTitle_wev8.jsp"%>
<%@ include file="/systeminfo/RightClickMenuConent_wev8.jsp"%>
<%
RCMenu += "{" + "搜索" + ",javascript:doSubmit(this),_self} ";
RCMenuHeight += RCMenuHeightStep;
RCMenu += "{" + "Excel" + ",javascript:SalesContractListBacthExport(),_top}";//add by list 20150505
RCMenuHeight += RCMenuHeightStep;//add by list 20150505
RCMenu += "{" + SystemEnv.getHtmlLabelName(18363, user.getLanguage()) + ",javascript:_table.firstPage(),_self}";
RCMenuHeight += RCMenuHeightStep;
RCMenu += "{" + SystemEnv.getHtmlLabelName(1258, user.getLanguage()) + ",javascript:_table.prePage(),_self}";
RCMenuHeight += RCMenuHeightStep;
RCMenu += "{" + SystemEnv.getHtmlLabelName(1259, user.getLanguage()) + ",javascript:_table.nextPage(),_self}";
RCMenuHeight += RCMenuHeightStep;
RCMenu += "{" + SystemEnv.getHtmlLabelName(18362, user.getLanguage()) + ",javascript:_table.lastPage(),_self}";
RCMenuHeight += RCMenuHeightStep;
if(hasHttxrbgRight){
RCMenu += "{" + "提醒人变更" + ",javascript:doOverBackMutil(this),_self}";
RCMenuHeight += RCMenuHeightStep;
}
RCMenu += "{"+"返回"+",javascript:history.back(),_self} " ;
RCMenuHeight += RCMenuHeightStep ;
%>
<table width=100% height=100% border="0" cellspacing="0"
cellpadding="0">
<colgroup>
<col width="10">
<col width="">
<col width="10">
<tr>
<td height="10" colspan="3"></td>
</tr>
<tr>
<td></td>
<td valign="top">
<TABLE class=Shadow>
<tr>
<td valign="top">
<%
int pagenum = Util.getIntValue(request.getParameter("pagenum"), 1);
int perpage = Util.getPerpageLog();
if (perpage <= 1) perpage = 10;
String id = Util.fromScreen(request.getParameter("id"), user.getLanguage());//id
String isMainSell = Util.fromScreen(request.getParameter("isMainSell"), user.getLanguage());//是否主营销售类
String contractType = Util.fromScreen(request.getParameter("contractType"), user.getLanguage());//合同类型
String contractName = Util.fromScreen(request.getParameter("contractName"), user.getLanguage());//合同名称
String contractCode = Util.fromScreen(request.getParameter("contractCode"), user.getLanguage());//合同编号
String proposer = Util.fromScreen(request.getParameter("proposer"), user.getLanguage());//申请人
String propDeptId = Util.fromScreen(request.getParameter("propDeptId"), user.getLanguage());//申请部门ID
String clientCode1 = Util.fromScreen(request.getParameter("clientCode1"), user.getLanguage());//客户编号
String clientCode = Util.fromScreen(request.getParameter("clientCode"), user.getLanguage());//客户编号
String clientName = Util.fromScreen(request.getParameter("clientName"), user.getLanguage());//客户名称
String industryINOut = Util.fromScreen(request.getParameter("industryINOut"), user.getLanguage());//业内/业外
String operationDeptId = Util.fromScreen(request.getParameter("operationDeptId"), user.getLanguage());//运作部门ID
String contractNewOld = Util.fromScreen(request.getParameter("contractNewOld"), user.getLanguage());//新/老合同
String CLandFM = Util.fromScreen(request.getParameter("CLandFM"), user.getLanguage());//CL/FM
String serviceType = Util.fromScreen(request.getParameter("serviceType"), user.getLanguage());//服务种类
String contractStartTimeFirst = Util.fromScreen(request.getParameter("contractStartTimeFirst"), user.getLanguage());//合同起始日期(开始)
String contractStartTimeEnd = Util.fromScreen(request.getParameter("contractStartTimeEnd"), user.getLanguage());//合同起始日期(结束)
String contractEndTimeFirst = Util.fromScreen(request.getParameter("contractEndTimeFirst"), user.getLanguage());//合同结束日期(开始)
String contractEndTimeEnd = Util.fromScreen(request.getParameter("contractEndTimeEnd"), user.getLanguage());//合同结束日期(结束)
String estimateStartTmeFirst = Util.fromScreen(request.getParameter("estimateStartTmeFirst"), user.getLanguage());//预估运作起始日期(开始)
String estimateStartTmeEnd = Util.fromScreen(request.getParameter("estimateStartTmeEnd"), user.getLanguage());//预估运作起始日期(结束)
String estimateEndTimeFirst = Util.fromScreen(request.getParameter("estimateEndTimeFirst"), user.getLanguage());//预估运作结束日期(开始)
String estimateEndTimeEnd = Util.fromScreen(request.getParameter("estimateEndTimeEnd"), user.getLanguage());//预估运作结束日期(结束)
String contractTotalMoney = Util.fromScreen(request.getParameter("contractTotalMoney"), user.getLanguage());//合同总金额
String yearContractrTotMon = Util.fromScreen(request.getParameter("yearContractrTotMon"), user.getLanguage());//年合同总金额
String yearAchieveIncome = Util.fromScreen(request.getParameter("yearAchieveIncome"), user.getLanguage());//当年可实现收入金额
String creditPaymentDays = Util.fromScreen(request.getParameter("creditPaymentDays"), user.getLanguage());//信用账期(天)
String creditLimit = Util.fromScreen(request.getParameter("creditLimit"), user.getLanguage());//信用额度
String settleAccountsUnit = Util.fromScreen(request.getParameter("settleAccountsUnit"), user.getLanguage());//结算单位
String status = Util.fromScreen(request.getParameter("status"), user.getLanguage());//合同状态
String contractBackFileTimeFirst = Util.fromScreen(request.getParameter("contractBackFileTimeFirst"), user.getLanguage());//合同流程归档日期(开始)
String contractBackFileTimeEnd = Util.fromScreen(request.getParameter("contractBackFileTimeEnd"), user.getLanguage());//合同流程归档日期(结束)
String contractTotalMoneys = Util.null2String(request.getParameter("contractTotalMoneys"));
String yearContractrTotMons = Util.null2String(request.getParameter("yearContractrTotMons"));
String yearAchieveIncomes = Util.null2String(request.getParameter("yearAchieveIncomes"));
String creditPaymentDayss = Util.null2String(request.getParameter("creditPaymentDayss"));
String creditLimits = Util.null2String(request.getParameter("creditLimits"));
// ADD BY LIST 20141106
String subCompanyId = Util.fromScreen(request.getParameter("subCompanyId"), user.getLanguage());
// ADD BY LIST 20141106
//查询分部名称
String subcompanyname = "";
if(!"".equals(subCompanyId)){
RecordSet.executeQuery("select subcompanyname from HrmSubCompany where id in ("+subCompanyId+")");
while (RecordSet.next()){
String subcompanyname_temp = Util.null2String(RecordSet.getString(1));
if(!"".equals(subcompanyname_temp)){
if("".equals(subcompanyname)){
subcompanyname = subcompanyname_temp;
}else{
subcompanyname += "," + subcompanyname_temp;
}
}
}
}
//ADD BY ZWL 20191122
int opentype = Util.getIntValue(request.getParameter("opentype"),-1);//开闭口类型 0-闭口 1-开口 2-周期性
//sqlwhere = " 1=1 ";
//out.print("clientName="+clientName);
if(!"".equals(isMainSell)) sqlwhere += " and isMainSell = '"+isMainSell+"'";
if (!contractType.equals("")) sqlwhere += " and contractType='" + contractType + "'";
if (!contractName.equals("")) sqlwhere += " and contractName like '%" + contractName + "%'";
if (!contractCode.equals("")) sqlwhere += " and contractCode like '%" + contractCode + "%'";
if (!proposer.equals("")) sqlwhere += " and proposer='" + proposer + "'";
if (!propDeptId.equals("")) sqlwhere += " and propDeptId='" + propDeptId + "'";
if(!"".equals(clientName)){
if(clientName.indexOf(",")!=-1){
String arr[] = clientName.split(",");
sqlwhere += " and (clientName = '"+arr[0]+"'";
for(int i = 1;i<arr.length;i++){
if(i == arr.length-1){
sqlwhere += " or clientName = '"+arr[i]+"')";
}else{
sqlwhere += " or clientName = '"+arr[i]+"'";
}
}
}else{
sqlwhere += " and clientName like '%"+clientName+"%'";
}
}
if (!clientCode1.equals("")) sqlwhere += " and clientCode = '" + clientCode1 + "'";
if (!industryINOut.equals("")) sqlwhere += " and industryINOut='" + industryINOut + "'";
if (!operationDeptId.equals("")) sqlwhere += " and operationDeptId='" + operationDeptId + "'";
if (!contractNewOld.equals("")) sqlwhere += " and contractNewOld='" + contractNewOld + "'";
if (!CLandFM.equals("")) sqlwhere += " and CLandFM='" + CLandFM + "'";
if (!serviceType.equals("")) sqlwhere += " and serviceType='" + serviceType + "'";
if (!contractStartTimeFirst.equals("")) sqlwhere += " and CONVERT(varchar(100), contractStartTime, 23)>='" + contractStartTimeFirst + "'";
if (!contractStartTimeEnd.equals("")) sqlwhere += " and CONVERT(varchar(100), contractStartTime, 23)<='" + contractStartTimeEnd + "'";
if (!contractEndTimeFirst.equals("")) sqlwhere += " and CONVERT(varchar(100), contractEndTime, 23)>='" + contractEndTimeFirst + "'";
if (!contractEndTimeEnd.equals("")) sqlwhere += " and CONVERT(varchar(100), contractEndTime, 23)<='" + contractEndTimeEnd + "'";
if (!estimateStartTmeFirst.equals("")) sqlwhere += " and CONVERT(varchar(100), estimateStartTme, 23)>='" + estimateStartTmeFirst + "'";
if (!estimateStartTmeEnd.equals("")) sqlwhere += " and CONVERT(varchar(100), estimateStartTme, 23)<='" + estimateStartTmeEnd + "'";
if (!estimateEndTimeFirst.equals("")) sqlwhere += " and CONVERT(varchar(100), estimateEndTime, 23)>='" + estimateEndTimeFirst + "'";
if (!estimateEndTimeEnd.equals("")) sqlwhere += " and CONVERT(varchar(100), estimateEndTime, 23)<='" + estimateEndTimeEnd + "'";
if (!contractTotalMoney.equals("")) {
if("0".equals(contractTotalMoneys)){
sqlwhere += " and (cast (isnull(nullif(contractTotalMoney,''),0) as decimal(19,2)))>" + contractTotalMoney ;
}
if("1".equals(contractTotalMoneys)){
sqlwhere += " and (cast (isnull(nullif(contractTotalMoney,''),0) as decimal(19,2)))=" + contractTotalMoney ;
}
if("2".equals(contractTotalMoneys)){
sqlwhere += " and (cast (isnull(nullif(contractTotalMoney,''),0) as decimal(19,2)))<" + contractTotalMoney ;
}
}
if (!yearContractrTotMon.equals("")) {
if("0".equals(yearContractrTotMons)){
sqlwhere += " and (cast (isnull(nullif(yearContractrTotMon,''),0) as decimal(19,2)))>" + yearContractrTotMon ;
}
if("1".equals(yearContractrTotMons)){
sqlwhere += " and (cast (isnull(nullif(yearContractrTotMon,''),0) as decimal(19,2)))=" + yearContractrTotMon ;
}
if("2".equals(yearContractrTotMons)){
sqlwhere += " and (cast (isnull(nullif(yearContractrTotMon,''),0) as decimal(19,2)))<" + yearContractrTotMon ;
}
}
if (!yearAchieveIncome.equals("")) {
if("0".equals(yearAchieveIncomes)){
sqlwhere += " and ISNUMERIC(yearAchieveIncome)=1 and (cast (isnull(nullif(yearAchieveIncome,''),0) as decimal(19,2)))>" + yearAchieveIncome ;
}
if("1".equals(yearAchieveIncomes)){
sqlwhere += " and ISNUMERIC(yearAchieveIncome)=1 and (cast (isnull(nullif(yearAchieveIncome,''),0) as decimal(19,2)))=" + yearAchieveIncome ;
}
if("2".equals(yearAchieveIncomes)){
sqlwhere += " and ISNUMERIC(yearAchieveIncome)=1 and (cast (isnull(nullif(yearAchieveIncome,''),0) as decimal(19,2)))<" + yearAchieveIncome ;
}
}
new BaseBean().writeLog(">>creditPaymentDays====== "+creditPaymentDays);
if(!"".equals(creditPaymentDays)) {
new BaseBean().writeLog(">>creditPaymentDayss====222== "+creditPaymentDayss);
if("0".equals(creditPaymentDayss)){
sqlwhere += " and ISNUMERIC(creditPaymentDays)=1 and (cast (isnull(nullif(creditPaymentDays,''),0) as decimal(19,2)))>=" + creditPaymentDays ;
}
if("1".equals(creditPaymentDayss)){
sqlwhere += " and ISNUMERIC(creditPaymentDays)=1 and (cast (isnull(nullif(creditPaymentDays,''),0) as decimal(19,2)))=" + creditPaymentDays ;
}
if("2".equals(creditPaymentDayss)){
sqlwhere += " and ISNUMERIC(creditPaymentDays)=1 and (cast (isnull(nullif(creditPaymentDays,''),0) as decimal(19,2)))<" + creditPaymentDays ;
}
}
if (!creditLimit.equals("")) {
if("0".equals(creditLimits)){
sqlwhere += " and ISNUMERIC(creditLimit)=1 and (cast (isnull(nullif(creditLimit,''),0) as decimal(19,2)))>" + creditLimit ;
}
if("1".equals(creditLimits)){
sqlwhere += " and ISNUMERIC(creditLimit)=1 and (cast (isnull(nullif(creditLimit,''),0) as decimal(19,2)))=" + creditLimit ;
}
if("2".equals(creditLimits)){
sqlwhere += " and ISNUMERIC(creditLimit)=1 and (cast (isnull(nullif(creditLimit,''),0) as decimal(19,2)))<" + creditLimit ;
}
}
if (!settleAccountsUnit.equals("")) sqlwhere += " and settleAccountsUnit like '%" + settleAccountsUnit + "%'";
if (!status.equals("")) sqlwhere += " and status='" + status + "'";
if (!contractBackFileTimeFirst.equals("")) sqlwhere += " and CONVERT(varchar(100), contractBackFileTime, 23)>='" + contractBackFileTimeFirst + "'";
if (!contractBackFileTimeEnd.equals("")) sqlwhere += " and CONVERT(varchar(100), contractBackFileTime, 23)<='" + contractBackFileTimeEnd + "'";
// ADD BY LIST 20141106
//if (!subCompanyId.equals("")) sqlwhere += " and subcompanyid1 = '" + subCompanyId + "'";
if (!subCompanyId.equals("")) sqlwhere += " and subcompanyid1 in ("+subCompanyId+")";
// ADD BY LIST 20141106
//System.out.println("sqlwhere:"+sqlwhere);
//ADD BY ZWL 20191122
if(opentype > -1){
sqlwhere += " and isnull(opentype,0) = " + opentype;
}
String orderStr = " order by startDate desc, id desc ";
session.setAttribute("sqlwhere", sqlwhere);
session.setAttribute("orderStr", orderStr);
new BaseBean().writeLog(">>SalesContractList.jsp查询条件====== "+sqlwhere);
%>
<form id=frmmain name=frmmain method=post action="SalesContractList.jsp">
<input type=hidden id=pagenum name=pagenum value="<%=pagenum%>">
<table class=ViewForm>
<tbody onload="changeCon()">
<COLGROUP>
<COL width="15%">
<COL width="35%">
<COL width="15%">
<COL width="35%">
</COLGROUP>
<TR class=Title>
<TH colSpan=6><%=SystemEnv.getHtmlLabelName(15774, user.getLanguage())%></TH>
</TR>
<tr style="height: 1px">
<td class=Line1 colspan=4></td>
</tr>
<tr>
<TD>是否主营销售业务</TD>
<TD class=Field >
<select id="isMainSell" name="isMainSell" onchange="changecn()">
<option value="" <%="".equals(isMainSell)?"selected":""%>></option>
<option value="0" <%="0".equals(isMainSell)?"selected":""%>>主营销售类</option>
<option value="1" <%="1".equals(isMainSell)?"selected":""%>>非主营销售类</option>
</select>
</TD>
<TD >合同类型</TD>
<TD class=Field >
<select id="contractType" name="contractType" >
<option value="" <%="".equals(contractType)?"selected":""%>></option>
<option value="0" <%="0".equals(contractType)?"selected":""%>>正式合同</option>
<option value="1" <%="1".equals(contractType)?"selected":""%>>延期协议</option>
<option value="2" <%="2".equals(contractType)?"selected":""%>>意向书及其他</option>
</select>
</TD>
</TR>
<tr style="height: 1px">
<td class=Line colspan=4></td>
</tr>
<TR>
<TD>合同名称</TD>
<TD class=Field >
<INPUT class=InputStyle maxLength=100 id="contractName" name="contractName" STYLE="width:200" value="<%=contractName%>">
</TD>
<TD><%=SystemEnv.getHtmlLabelName(21282, user.getLanguage())%></TD>
<TD class=Field >
<INPUT class=InputStyle maxLength=100 id="contractCode" name="contractCode" STYLE="width:200" value="<%=contractCode%>">
</TD>
</TR>
<tr style="height: 1px">
<td class=Line colspan=4></td>
</tr>
<TR>
<TD>申请人</TD>
<TD class=Field>
<brow:browser viewType="0"
id="proposer"
name="proposer"
browserValue="<%=proposer %>"
browserUrl="/systeminfo/BrowserMain.jsp?url=/hrm/resource/ResourceBrowser.jsp"
hasInput="true"
isSingle="true"
hasBrowser = "true"
isMustInput='1'
width="165px"
browserSpanValue="<%=ResourceComInfo.getResourcename(proposer+"") %>">
</brow:browser>
</TD>
<TD>申请部门</TD>
<TD class=Field>
<brow:browser viewType="0"
id="propDeptId"
name="propDeptId"
browserValue="<%=propDeptId %>"
browserUrl="/systeminfo/BrowserMain.jsp?url=/hrm/company/DepartmentBrowser.jsp"
hasInput="true"
isSingle="true"
hasBrowser = "true"
isMustInput='1'
width="165px"
browserSpanValue="<%=DepartmentComInfo.getDepartmentname(propDeptId+"")%>">
</brow:browser>
</TD>
</TR>
<tr style="height: 1px">
<td class=Line colspan=4></td>
</tr>
<TR>
<TD>客户名称</TD>
<TD class=Field >
<%--<button class=Browser type="button" onClick="onShowClientName('clientNamespan','clientCode')"></button>--%>
<%--<span id=clientNamespan><%=clientName%></span>--%>
<%--<input type="hidden" name="clientName" value="<%=clientCode%>" >--%>
<%--<input type="hidden" name="namespan" value="<%=clientName%>" >--%>
<input width="150px" type="text" id="clientName" name="clientName" value="<%=clientName%>" >
<%--<button class=Browser type="button" onClick="onShowClientName('clientNamespan','clientName',1,'namespan')"></button>
<span id=clientNamespan><%=clientName%></span>
<input type="hidden" id="clientName" name="clientName" value="<%=clientName%>" >
<input type="hidden" id="namespan" name="namespan" value="<%=clientName%>" > --%>
<%-- <brow:browser viewType="0"
id="clientName"
name="clientName"
browserValue="<%=clientName %>"
browserUrl="/systeminfo/BrowserMain.jsp?url=/CRM/clientinfo/ClientCenterBrowser.jsp"
hasInput="true"
isSingle="true"
hasBrowser = "true"
isMustInput='1'
width="165px"
browserSpanValue="<%= %>">
</brow:browser> --%>
</TD>
<TD>客户编号</TD>
<TD class=Field >
<INPUT class=InputStyle maxLength=100 id="clientCode1" name="clientCode1" STYLE="width:200" value="<%=clientCode1%>">
</TD>
</TR>
<tr style="height: 1px">
<td class=Line colspan=4></td>
</tr>
<TR>
<TD>业内/业外</TD>
<TD class=Field>
<select id="industryINOut" name="industryINOut">
<option value="" <%="".equals(industryINOut)?"selected":""%>></option>
<option value="0" <%="0".equals(industryINOut)?"selected":""%>>业内</option>
<option value="1" <%="1".equals(industryINOut)?"selected":""%>>业外</option>
</select>
</TD>
<TD>运作部门</TD>
<TD class=Field>
<brow:browser viewType="0"
id="operationDeptId"
name="operationDeptId"
browserValue="<%=operationDeptId %>"
browserUrl="/systeminfo/BrowserMain.jsp?url=/hrm/company/DepartmentBrowser.jsp"
hasInput="true"
isSingle="true"
hasBrowser = "true"
isMustInput='1'
width="165px"
browserSpanValue="<%=DepartmentComInfo.getDepartmentname(operationDeptId+"")%>">
</brow:browser>
</TD>
</TR>
<tr style="height: 1px">
<td class=Line colspan=4></td>
</tr>
<tr>
<TD>新/老合同</TD>
<TD class=Field >
<select id="contractNewOld" name="contractNewOld">
<option value="" <%="".equals(contractNewOld)?"selected":""%>></option>
<option value="0" <%="0".equals(contractNewOld)?"selected":""%>>新合同</option>
<option value="1" <%="1".equals(contractNewOld)?"selected":""%>>老合同</option>
<option value="2" <%="1".equals(contractNewOld)?"selected":""%>>老合同含新增</option>
</select>
</TD>
<TD>CL/FM</TD>
<TD class=Field >
<select id="CLandFM" name="CLandFM">
<option value="" <%="".equals(CLandFM)?"selected":""%>></option>
<option value="0" <%="0".equals(CLandFM)?"selected":""%>>CL</option>
<option value="1" <%="1".equals(CLandFM)?"selected":""%>>FM</option>
</select>
</TD>
</TR>
<tr style="height: 1px">
<td class=Line colspan=4></td>
</tr>
<tr>
<TD>服务种类</TD>
<TD class=Field>
<select id="serviceType" name="serviceType">
<option value="" <%="".equals(serviceType)?"selected":""%>></option>
<option value="0" <%="0".equals(serviceType)?"selected":""%>>仓储</option>
<option value="1" <%="1".equals(serviceType)?"selected":""%>>运输</option>
<option value="2" <%="2".equals(serviceType)?"selected":""%>>其他</option>
</select>
</TD>
<%if(HrmUserVarify.checkUserRight("ContactInfoList:ALL", user)){%>
<TD><%=SystemEnv.getHtmlLabelName(141,user.getLanguage())%></TD>
<TD class=Field>
<%-- <input class=wuiBrowser class=inputStyle id=subCompanyId type=hidden name=subCompanyId value="<%=subCompanyId%>"
_url="/systeminfo/BrowserMain.jsp?url=/hrm/company/SubcompanyBrowser.jsp"
_displayText="<%=SubCompanyComInfo.getSubCompanyname(subCompanyId+"")%>"
> --%>
<brow:browser viewType="0"
id="subCompanyId"
name="subCompanyId"
browserValue="<%=subCompanyId+"" %>"
browserUrl="/systeminfo/BrowserMain.jsp?url=/hrm/company/MutiSubcompanyBrowser.jsp"
hasInput="true"
isSingle="false"
hasBrowser = "true"
isMustInput='1'
width="165px"
browserSpanValue="<%=subcompanyname%>" >
</brow:browser>
</TD>
<%}%>
</TR>
<tr style="height: 1px">
<td class=Line colspan=4></td>
</tr>
<TR>
<td>合同起始日期</td>
<TD class=Field>
<BUTTON class=Calendar type='button' onclick=onShowDate('createDate_byspanw','contractStartTimeFirst')></BUTTON>
<SPAN id=createDate_byspanw><%=contractStartTimeFirst %></SPAN>
<input type='hidden' id='contractStartTimeFirst' name='contractStartTimeFirst' value='<%=contractStartTimeFirst %>'>
--
<BUTTON class=Calendar type='button' onclick=onShowDate('createDate_tospanq','contractStartTimeEnd')></BUTTON>
<SPAN id=createDate_tospanq><%=contractStartTimeEnd %></SPAN>
<input type='hidden' id='contractStartTimeEnd' name='contractStartTimeEnd' value='<%=contractStartTimeEnd %>'>
</TD>
<td><%=SystemEnv.getHtmlLabelName(15236, user.getLanguage())%></td>
<TD class=Field>
<BUTTON class=Calendar type='button' onclick=onShowDate('createDate_byspan3','contractEndTimeFirst')></BUTTON>
<SPAN id=createDate_byspan3><%=contractEndTimeFirst %></SPAN>
<input type='hidden' id='contractEndTimeFirst' name='contractEndTimeFirst' value='<%=contractEndTimeFirst %>'>
--
<BUTTON class=Calendar type='button' onclick=onShowDate('createDate_tospan4','contractEndTimeEnd')></BUTTON>
<SPAN id=createDate_tospan4><%=contractEndTimeEnd %></SPAN>
<input type='hidden' id='contractEndTimeEnd' name='contractEndTimeEnd' value='<%=contractEndTimeEnd %>'>
</TD>
</TR>
<tr style="height: 1px">
<td class=Line colspan=4></td>
</tr>
<tr>
<td>预估运作起始日期</td>
<TD class=Field>
<BUTTON class=Calendar type='button' onclick=onShowDate('createDate_byspan11','estimateStartTmeFirst')></BUTTON>
<SPAN id=createDate_byspan11><%=estimateStartTmeFirst %></SPAN>
<input type='hidden' id='estimateStartTmeFirst' name='estimateStartTmeFirst' value='<%=estimateStartTmeFirst %>'>
--
<BUTTON class=Calendar type='button' onclick=onShowDate('createDate_tospan22','estimateStartTmeEnd')></BUTTON>
<SPAN id=createDate_tospan22><%=estimateStartTmeEnd %></SPAN>
<input type='hidden' id='estimateStartTmeEnd' name='estimateStartTmeEnd' value='<%=estimateStartTmeEnd %>'>
</TD>
<td>预估运作结束日期</td>
<TD class=Field>
<BUTTON class=Calendar type='button' onclick=onShowDate('createDate_byspan33','estimateEndTimeFirst')></BUTTON>
<SPAN id=createDate_byspan33><%=estimateEndTimeFirst %></SPAN>
<input type='hidden' id='estimateEndTimeFirst' name='estimateEndTimeFirst' value='<%=estimateEndTimeFirst %>'>
--
<BUTTON class=Calendar type='button' onclick=onShowDate('createDate_tospan44','estimateEndTimeEnd')></BUTTON>
<SPAN id=createDate_tospan44><%=estimateEndTimeEnd %></SPAN>
<input type='hidden' id='estimateEndTimeEnd' name='estimateEndTimeEnd' value='<%=estimateEndTimeEnd %>'>
</TD>
</TR>
<tr style="height: 1px">
<td class=Line colspan=4></td>
</tr>
<TR>
<TD>合同总金额</TD>
<TD class=Field >
<select id="contractTotalMoneys" name="contractTotalMoneys">
<option value="0" <%="0".equals(contractTotalMoneys)?"selected":""%>>大于</option>
<option value="1" <%="1".equals(contractTotalMoneys)?"selected":""%>>等于</option>
<option value="2" <%="2".equals(contractTotalMoneys)?"selected":""%>>小于</option>
</select>
<INPUT class=InputStyle maxLength=100 id="contractTotalMoney" name="contractTotalMoney" STYLE="width:200" value="<%=contractTotalMoney%>" >
</TD>
<TD>年合同总金额</TD>
<TD class=Field >
<select id="yearContractrTotMons" name="yearContractrTotMons">
<option value="0" <%="0".equals(yearContractrTotMons)?"selected":""%>>大于</option>
<option value="1" <%="1".equals(yearContractrTotMons)?"selected":""%>>等于</option>
<option value="2" <%="2".equals(yearContractrTotMons)?"selected":""%>>小于</option>
</select>
<INPUT class=InputStyle maxLength=100 id="yearContractrTotMon" name="yearContractrTotMon" STYLE="width:200" value="<%=yearContractrTotMon%>">
</TD>
</TR>
<tr style="height: 1px">
<td class=Line colspan=4></td>
</tr>
<TR>
<TD>当年可实现收入金额</TD>
<TD class=Field >
<select id="yearAchieveIncomes" name="yearAchieveIncomes">
<option value="0" <%="0".equals(yearAchieveIncomes)?"selected":""%>>大于</option>
<option value="1" <%="1".equals(yearAchieveIncomes)?"selected":""%>>等于</option>
<option value="2" <%="2".equals(yearAchieveIncomes)?"selected":""%>>小于</option>
</select>
<INPUT class=InputStyle maxLength=100 id="yearAchieveIncome" name="yearAchieveIncome" STYLE="width:200" value="<%=yearAchieveIncome%>">
</TD>
<TD>信用账期(天)</TD>
<TD class=Field >
<select id="creditPaymentDayss" name="creditPaymentDayss">
<option value="0" <%="0".equals(creditPaymentDayss)?"selected":""%>>大于</option>
<option value="1" <%="1".equals(creditPaymentDayss)?"selected":""%>>等于</option>
<option value="2" <%="2".equals(creditPaymentDayss)?"selected":""%>>小于</option>
</select>
<INPUT class=InputStyle maxLength=100 id="creditPaymentDays" name="creditPaymentDays" STYLE="width:200" value="<%=creditPaymentDays%>">
</TD>
</TR>
<tr style="height: 1px">
<td class=Line colspan=4></td>
</tr>
<TR>
<TD>信用额度</TD>
<TD class=Field >
<select id="creditLimits" name="creditLimits">
<option value="0" <%="0".equals(creditLimits)?"selected":""%>>大于</option>
<option value="1" <%="1".equals(creditLimits)?"selected":""%>>等于</option>
<option value="2" <%="2".equals(creditLimits)?"selected":""%>>小于</option>
</select>
<INPUT class=InputStyle maxLength=100 id="creditLimit" name="creditLimit" STYLE="width:200" value="<%=creditLimit%>">
</TD>
<TD>结算单位</TD>
<TD class=Field >
<INPUT class=InputStyle maxLength=100 id="settleAccountsUnit" name="settleAccountsUnit" STYLE="width:200" value="<%=settleAccountsUnit%>">
</TD>
</TR>
<tr style="height: 1px">
<td class=Line colspan=4></td>
</tr>
<tr>
<TD>合同状态</TD>
<TD class=Field>
<select id="status" name="status">
<option value="" <%="".equals(status)?"selected":""%>></option>
<option value="0" <%="0".equals(status)?"selected":""%>>已签署</option>
<option value="1" <%="1".equals(status)?"selected":""%>>未签署</option>
<option value="2" <%="2".equals(status)?"selected":""%>>已续签</option>
<option value="3" <%="3".equals(status)?"selected":""%>>关闭</option>
</select>
</TD>
<td>合同流程归档日期</td>
<TD class=Field>
<BUTTON class=Calendar type='button' onclick=onShowDate('createDate_byspan6','contractBackFileTimeFirst')></BUTTON>
<SPAN id=createDate_byspan6><%=contractBackFileTimeFirst %></SPAN>
<input type='hidden' id='contractBackFileTimeFirst' name='contractBackFileTimeFirst' value='<%=contractBackFileTimeFirst %>'>
--
<BUTTON class=Calendar type='button' onclick=onShowDate('createDate_tospan7','contractBackFileTimeEnd')></BUTTON>
<SPAN id=createDate_tospan7><%=contractBackFileTimeEnd %></SPAN>
<input type='hidden' id='contractBackFileTimeEnd' name='contractBackFileTimeEnd' value='<%=contractBackFileTimeEnd %>'>
</TD>
</TR>
<tr style="height: 1px">
<td class=Line colspan=4></td>
</tr>
</tbody>
</table>
<table width="100%" style="table-Layout:fixed">
<tr>
<td>
<%
String para3="column:id"+id;
String tableString = "";
String backfields = " id, clientCode, contractName, clientName, case contractType when '0' then '正式合同' when '1' then '延期协议' when '2' then '意向书及其他' end as contractType, "+
"case status when '0' then '已签署' when '1' then '未签署' when '2' then '已续签' when '3' then '关闭' end as status, "+
"propDeptId,"+
"case industryINOut when '0' then '业内' else '业外' end as industryINOut, "+
"case serviceType when '0' then '仓储' when '1' then '运输' when '2' then '其他' end as serviceType, "+
"case contractNewOld when '0' then '新合同' when '1' then '老合同' when '2' then '老合同含新增' end as contractNewOld, "+
"contractStartTime, contractEndTime, contractBackFileTime, yearContractrTotMon, "+
"case earlyWarning when '0' then '是' when '1' then '否' end as earlyWarning,subcompanyid1 ";
String fromSql = " CrmSalesContractInfo as mt ";
session.setAttribute("fromSql", fromSql);//add by list 20150505
// out.println("backfields:"+backfields);
//
// out.println("sqlform:"+fromSql);
//
// out.println("sqlwhere:"+sqlwhere);
tableString = " <table instanceid=\"CrmSalesContractInfoTable\" tabletype=\"none\" pagesize=\"" + perpage + "\" >"
+"<sql backfields=\"" + backfields + "\" sqlform=\"" + fromSql + "\" sqlwhere=\"" + Util.toHtmlForSplitPage(sqlwhere) + "\" sqlprimarykey=\"id\" sqlsortway=\"Desc\" sqlisdistinct=\"true\" />" + "<head>";
tableString += "<col width=\"12%\" text=\"" + "合同名称" + "\" column=\"contractName\" orderkey=\"contractName\" linkkey=\"id\" linkvaluecolumn=\"id\" href=\"/CRM/salecontractinfo/SaleContractEdits.jsp?metherid=search\" target=\"_fullwindow\" />";
tableString += "<col width=\"12%\" text=\"" + "客户名称" + "\" column=\"clientName\" orderkey=\"clientName\" linkkey=\"id\" linkvaluecolumn=\"id\" href=\"/CRM/clientinfo/CRMClientMainInfoEdit.jsp?ds=1\" target=\"_fullwindow\" />";
tableString += "<col width=\"6%\" text=\"" + "合同类型" + "\" column=\"contractType\" orderkey=\"contractType\" />";
tableString += "<col width=\"5%\" text=\""+ "合同状态" + "\" column=\"status\" orderkey=\"status\" />";
tableString += "<col width=\"7%\" text=\"" + "申请部门" + "\" column=\"propDeptId\" orderkey=\"propDeptId\" transmethod=\"weaver.hrm.company.DepartmentComInfo.getDepartmentname\" />";
tableString += "<col width=\"5%\" text=\"" + "业内/业外" + "\" column=\"industryINOut\" orderkey=\"industryINOut\" />";
tableString += "<col width=\"5%\" text=\"" + "服务种类" + "\" column=\"serviceType\" orderkey=\"serviceType\" />";
tableString += "<col width=\"5%\" text=\"" + "新/老合同" + "\" column=\"contractNewOld\" orderkey=\"contractNewOld\" />";
tableString += "<col width=\"7%\" text=\"" + "合同起始日期" + "\" column=\"contractStartTime\" orderkey=\"contractStartTime\" />";
tableString += "<col width=\"7%\" text=\"" + "合同结束日期" + "\" column=\"contractEndTime\" orderkey=\"contractEndTime\" />";
tableString += "<col width=\"7%\" text=\"" + "合同归档日期" + "\" column=\"contractBackFileTime\" orderkey=\"contractBackFileTime\" />";
tableString += "<col width=\"7%\" text=\"" + "年合同总金额" + "\" column=\"yearContractrTotMon\" orderkey=\"yearContractrTotMon\" />";
tableString += "<col width=\"6%\" text=\"" + "预警" + "\" column=\"earlyWarning\" orderkey=\"earlyWarning\" />";
tableString += "<col width=\"8%\" text=\"" + SystemEnv.getHtmlLabelName(141,user.getLanguage()) + "\" column=\"subcompanyid1\" orderkey=\"subcompanyid1\" transmethod=\"weaver.hrm.company.SubCompanyComInfo.getSubCompanyname\" />";
tableString += "</head>";
tableString += "</table>";
%>
<input type="hidden" name="pageId" id="pageId" value="CrmSalesContractInfoTable" />
<wea:SplitPageTag tableString="<%=tableString%>" mode="run" />
</td>
</tr>
</table>
</form></td>
</tr>
</TABLE></td>
<td></td>
</tr>
<tr>
<td height="10" colspan="3"></td>
</tr>
</table>
<%@ include file="/systeminfo/RightClickMenu_wev8.jsp"%>
<!-- add by list 20150505 -->
<form id="myform" method="post" action="SalesContractListBacthExport.jsp" target="receiptExport">
<input type="hidden" name="receiptLists">
</form>
<!-- add by list 20150505 -->
</body>
<iframe id="searchexport" style="display: none"></iframe>
<!-- add by list 20150505 -->
<iframe name="receiptExport" id="receiptExport" style="display: none"></iframe>
<!-- add by list 20150505 -->
<script>
function onShowClientName(tdname,inputename,objtmp,nameSpan) {
tmpids = document.getElementById(inputename).value
// id = window.showModalDialog("/systeminfo/BrowserMain.jsp?url=/crm/clientinfo/ClientCenterBrowser.jsp?resourceids="+tmpids)
// if (id){
// if (id.id!=""){
// document.getElementById("clientName").innerHtml =id.name
// document.getElementById(inputename).value=id.id
// document.getElementById("clientName").value=id.name
// }else{
// document.getElementById(spanname).innerHtml =""
// document.getElementById(inputename).value=""
// document.getElementById("clientName").value=""
// }
// }
data = window.showModalDialog("/systeminfo/BrowserMain.jsp?url=/CRM/clientinfo/ClientCenterBrowser.jsp")
if (data){
if (data.id!=""){
document.getElementById(tdname).innerHTML = data.name
document.getElementById(nameSpan).value = data.id
document.getElementById(inputename).value = data.name
}else{
document.all(tdname).innerHTML = ""
document.all(nameSpan).value = ""
document.all(inputename).value=""
document.all("usertype_s").value=""
}
}
}
</script>
<%--<script language="vbs">--%>
<%--sub onShowClientName(spanname,inputename)--%>
<%--tmpids = document.getElementById(inputename).value--%>
<%--alert(tmpids);--%>
<%--id = window.showModalDialog("/systeminfo/BrowserMain.jsp?url=/crm/clientinfo/ClientCenterBrowser.jsp?resourceids="&tmpids)--%>
<%--if (Not IsEmpty(id)) then--%>
<%--if id(0)<> "" then--%>
<%--document.getElementById(spanname).innerHtml =id(1)--%>
<%--document.getElementById(inputename).value=id(0)--%>
<%--document.getElementById("clientName").value=id(1)--%>
<%--else--%>
<%--document.getElementById(spanname).innerHtml =""--%>
<%--document.getElementById(inputename).value=""--%>
<%--document.getElementById("clientName").value=""--%>
<%--end if--%>
<%--end if--%>
<%--end sub--%>
<%--</script>--%>
<script language=javascript>
function doOverBackMutil(obj){
var requestids = _xtable_CheckedCheckboxId();
var strl= requestids.split(",");
if(requestids == ""){
alert("请选择一项");
}else if(strl.length>2){
alert("只能选择一项");
}else{
document.frmmain.method = "post";
document.frmmain.action = "/CRM/salecontractinfo/SalesContractEdit.jsp?1=1&id="+ strl[0];
obj.disabled = true;
document.frmmain.submit();
}
}
function doSubmit(obj)
{
obj.disabled = true;
document.frmmain.submit();
}
function redirect(flag){
var url;
if(flag){
url = "MailAdd.jsp?flag="+flag+"&mailId=<%=id%>";
}else{
var mailAddress = event.srcElement.innerHTML;
mailAddress = mailAddress.replace("(","<");
mailAddress = mailAddress.replace(")",">");
url = "MailAdd.jsp?to="+mailAddress+"";
}
redirectByFrame(url);
}
function SalesContractExport() {
jQuery("#searchexport").attr("src", "SalesContractExport.jsp");
}
function OnSubmit(pagenum) {
document.frmmain.pagenum.value = pagenum;
document.frmmain.submit();
}
function OnSearch(){
var chkInTableTags = document.getElementsByName("status");
var status_temp = "";
for(var i=0;i<chkInTableTags.length;i++){
if(chkInTableTags[i].checked && chkInTableTags[i].value != ''){
if(status_temp == "") status_temp = "'" + chkInTableTags[i].value + "'";
else status_temp = status_temp + ",'" + chkInTableTags[i].value + "'";
}
}
jQuery("#status_temp").val(status_temp);
document.frmmain.submit();
}
//续签
function newWorkflowByContract4(key){
location.href = "ContractNewWorkflow.jsp?status=4&id="+key;
}
//试运作
function newWorkflowByContract3(key){
location.href = "ContractNewWorkflow.jsp?status=3&id="+key;
}
//批量导出 add by list 20150505
function SalesContractListBacthExport(){
document.getElementById('myform').submit();
}
</script>
<SCRIPT language="javascript" src="/js/datetime_wev8.js"></script>
<SCRIPT language="javascript" src="/js/JSDateTime/WdatePicker_wev8.js"></script>
</html>

View File

@ -0,0 +1,138 @@
<!-- lt-list 2015-05-05 new 合同批量导出 -->
<%@ page language="java" contentType="text/html; charset=GBK" %> <%@ include file="/systeminfo/init.jsp" %>
<%@ page import="weaver.general.Util, weaver.file.ExcelSheet, weaver.file.ExcelRow, weaver.file.Prop, java.util.Hashtable, java.math.BigDecimal
" %>
<jsp:useBean id="RecordSet" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="RecordSetDepname" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="RecordSetSubname" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="ExcelFile" class="weaver.file.ExcelFile" scope="session"/>
<%
//String receiptLists = request.getParameter("receiptLists");
//new BaseBean().writeLog(">>>>>>>>>> 台账编号获得: "+receiptLists);
//String receiptLists2 = receiptLists;
//if(receiptLists.endsWith(",")){
// receiptLists2 = receiptLists.substring(0, receiptLists.length() - 1);
//}
String fromSql=(String)session.getAttribute("fromSql");
String sqlwhere=(String)session.getAttribute("sqlwhere");
String sqlorder=(String)session.getAttribute("orderStr");
String sqlstr="";
String backfields = "select id, clientCode, contractName, clientName, case contractType when '0' then '正式合同' when '1' then '延期协议' when '2' then '意向书及其他' end as contractType, "+
"case contractState when '0' then '正常' when '1' then '关闭' when '2' then '提前终止' end as contractState, "+
"propDeptId,"+
"case industryINOut when '0' then '业内' else '业外' end as industryINOut, "+
"case serviceType when '0' then '仓储' when '1' then '运输' when '2' then '其他' end as serviceType, "+
"case contractNewOld when '0' then '新合同' when '1' then '老合同' end as contractNewOld, "+
"contractStartTime, contractEndTime, contractBackFileTime, yearContractrTotMon, "+
"case earlyWarning when '0' then '是' when '1' then '否' end as earlyWarning,subcompanyid1 ";
sqlstr = backfields;
sqlstr += " from" + fromSql;
sqlstr += sqlwhere;
//sqlstr += " and ParameterNumber in ('" + receiptLists2.replaceAll("," ,"','") + "')";
sqlstr += " order by id desc ";
new BaseBean().writeLog(">>>>>>>>>> 合同批量导出: "+sqlstr);
RecordSet.executeSql(sqlstr);
ExcelSheet es = new ExcelSheet();
ExcelRow er = es.newExcelRow();
er.addStringValue("合同名称");
er.addStringValue("客户名称");
er.addStringValue("合同类型");
er.addStringValue("合同状态");
er.addStringValue("申请部门");
er.addStringValue("业内/业外");
er.addStringValue("服务种类");
er.addStringValue("新/老合同");
er.addStringValue("合同启始日期");
er.addStringValue("合同结束日期");
er.addStringValue("合同归档日期");
er.addStringValue("年合同总金额");
er.addStringValue("预警");
er.addStringValue("分部");
//合同信息
int i=1;
String depId="";
String sqlDepName= "";
String depName= "";
String subId="";
String sqlSubName= "";
String subName= "";
while(RecordSet.next()){
//获取部门名称
depId=RecordSet.getString("propDeptId");
sqlDepName= "select departmentname from HrmDepartment where id ='"+depId+"'";
RecordSetDepname.executeSql(sqlDepName);
RecordSetDepname.next();
//new BaseBean().writeLog(">>>>>>>>>> sqlDepName "+sqlDepName);
depName=RecordSetDepname.getString("departmentname");
//获取分部名称
subId=RecordSet.getString("subcompanyid1");
sqlSubName= "select subcompanyname from HrmSubCompany where id ='"+subId+"'";
RecordSetSubname.executeSql(sqlSubName);
RecordSetSubname.next();
subName=RecordSetSubname.getString("subcompanyname");
er = es.newExcelRow();
//er.addStringValue(String.valueOf(i++));20141113 change by zhangy
er.addStringValue(RecordSet.getString("contractName"));
er.addStringValue(RecordSet.getString("clientName"));
er.addStringValue(RecordSet.getString("contractType"));
er.addStringValue(RecordSet.getString("contractState"));
er.addStringValue(depName);
er.addStringValue(RecordSet.getString("industryINOut"));
er.addStringValue(RecordSet.getString("serviceType"));
er.addStringValue(RecordSet.getString("contractNewOld"));
er.addStringValue(RecordSet.getString("contractStartTime"));
er.addStringValue(RecordSet.getString("contractEndTime"));
er.addStringValue(RecordSet.getString("contractBackFileTime"));
er.addStringValue(RecordSet.getString("yearContractrTotMon"));
er.addStringValue(RecordSet.getString("earlyWarning"));
er.addStringValue(subName);
/*
er.addStringValue(Util.useSpecialTreat("weaver.hrm.resource.ResourceComInfo.getResourcename", Util.null2String(RecordSet.getString("gatheringCharge"))));
er.addStringValue(RecordSet.getString("clientName"));
er.addStringValue(RecordSet.getString("companyName"));
er.addStringValue(RecordSet.getString("contractCode"));
String actualTotalAmountString = RecordSet.getString("actualTotalAmount");
BigDecimal actualTotalAmount = new BigDecimal(actualTotalAmountString);
double actualTotalAmount2 = actualTotalAmount.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
er.addValue(actualTotalAmount2);
er.addStringValue(RecordSet.getString("flowNumber"));
er.addStringValue(RecordSet.getString("invoiceMakeDate"));
String moneyReceiptString = RecordSet.getString("moneyReceipt");
BigDecimal moneyReceipt = new BigDecimal(moneyReceiptString);
double moneyReceipt2 = actualTotalAmount.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
er.addValue(moneyReceipt2);
er.addStringValue(RecordSet.getString("status"));
*/
}
/*
er = es.newExcelRow();
er.addStringValue("导入前请用行删除方法删除该行");
er.addStringValue("");
er.addStringValue("发票开具日期请一定按照【YYYY/MM/DD】格式输入");
er.addStringValue("");
er.addStringValue("");
er.addStringValue("");
*/
ExcelFile.init() ;
ExcelFile.setFilename("合同报表") ;
ExcelFile.addSheet("合同", es) ;
%>
success
<script language="javascript">
window.location="/weaver/weaver.file.ExcelOut";
</script>