206 lines
6.5 KiB
Java
206 lines
6.5 KiB
Java
package customization.test;
|
|
|
|
import com.engine.crm.util.CrmCommonUtil;
|
|
import org.junit.Test;
|
|
import aiyh.utils.Util;
|
|
import aiyh.utils.sqlUtil.sqlResult.impl.BatchSqlResultImpl;
|
|
import aiyh.utils.sqlUtil.sqlResult.impl.PrepSqlResultImpl;
|
|
import aiyh.utils.sqlUtil.whereUtil.Where;
|
|
import weaver.aiyh_pcn.workflow_to_customer.AddCustomer_Action;
|
|
import weaver.aiyh_pcn.workflow_to_customer.config.CRM_Config;
|
|
import weaver.aiyh_pcn.workflow_to_customer.model.MainResult;
|
|
import weaver.aiyh_pcn.workflow_to_customer.utils.*;
|
|
import weaver.conn.RecordSet;
|
|
import weaver.crm.Maint.*;
|
|
import weaver.hrm.companyvirtual.ResourceVirtualComInfo;
|
|
import weaver.soa.workflow.request.RequestInfo;
|
|
import weaver.workflow.request.RequestManager;
|
|
|
|
import java.util.*;
|
|
|
|
/**
|
|
* @author EBU7-dev1-ayh
|
|
* @create 2021/8/6 0006 15:46
|
|
* ceshi
|
|
*/
|
|
|
|
|
|
public class WorkflowToCustomerTest extends BaseTest{
|
|
|
|
@Test
|
|
public void testSqlBuilderBatch(){
|
|
List<LinkedHashMap<String, Object>> list = new ArrayList<>();
|
|
List<Where> whereList = new ArrayList<>();
|
|
list.add(new LinkedHashMap<String, Object>(){{
|
|
put("id",9);
|
|
put("name","updateSql");
|
|
put("status","prod");
|
|
}});
|
|
list.add(new LinkedHashMap<String, Object>(){{
|
|
put("id",10);
|
|
put("name","updateSql1");
|
|
put("status","prod1");
|
|
}});
|
|
list.add(new LinkedHashMap<String, Object>(){{
|
|
put("id",11);
|
|
put("name","updateSql2");
|
|
put("status","prod3");
|
|
}});
|
|
whereList.add(Util.createPrepWhereImpl()
|
|
.whereAnd("id").whereEqual(9)
|
|
.whereAnd("name").whereLike("%Sql%"));
|
|
whereList.add(Util.createPrepWhereImpl()
|
|
.whereAnd("id").whereEqual(10)
|
|
.whereAnd("name").whereLike("%Sql%"));
|
|
whereList.add(Util.createPrepWhereImpl()
|
|
.whereAnd("id").whereEqual(11)
|
|
.whereAnd("name").whereLike("%Sql%"));
|
|
BatchSqlResultImpl batchSqlResult = Util.createSqlBuilder().updateBatchSql("tablename", list, whereList);
|
|
System.out.println(batchSqlResult.getSqlStr());
|
|
System.out.println(batchSqlResult.getBatchList());
|
|
}
|
|
|
|
@Test
|
|
public void testSqlBuilder(){
|
|
PrepSqlResultImpl prepSqlResult = Util.createSqlBuilder().insertSql("tablename",
|
|
ParaMap.create().put("id", 10)
|
|
.put("name", "insertSql")
|
|
.put("status", "test"));
|
|
System.out.println(prepSqlResult.getSqlStr());
|
|
System.out.println(prepSqlResult.getArgs());
|
|
}
|
|
|
|
|
|
// @Test
|
|
// public void testUtilSql(){
|
|
// String sql = Util.createWhereImpl().whereAnd("id").whereEqual("90").whereOr("name")
|
|
// .whereLike("%不知道%")
|
|
// .whereAnd("age").whereIn(1,2,3,4,5).getSql();
|
|
// System.out.println(sql);
|
|
// }
|
|
|
|
// @Test
|
|
// public void testUtilPreSql(){
|
|
// Where where = Util.createPrepWhereImpl().whereAnd("id").whereEqual("90").whereOr("name")
|
|
// .whereLike("%不知道%")
|
|
// .whereAnd("age").whereIn(1, 2, 3, 4, 5);
|
|
// System.out.println(where.getSql());
|
|
// System.out.println(where.getArgs());
|
|
// }
|
|
|
|
@Test
|
|
public void testMap(){
|
|
UtilMap<String, Object> utilMap = new UtilMap<>();
|
|
utilMap.uPut("test","testValue").uPut("liu","liu").uPut("isnull",null);
|
|
Map<String, Object> filter = utilMap.filter((key,value) -> !Objects.isNull(value));
|
|
System.out.println(filter);
|
|
System.out.println(utilMap);
|
|
}
|
|
|
|
@Test
|
|
public void testPinYin(){
|
|
CrmCommonUtil crmCommonUtil = new CrmCommonUtil();
|
|
System.out.println(crmCommonUtil.getPinYin("不知道", 7));
|
|
}
|
|
|
|
|
|
@Test
|
|
public void testInsert(){
|
|
RecordSet rs = new RecordSet();
|
|
boolean b = rs.executeUpdate("insert into formtable_main_2 (requestId,jbr) values (-121,2);");
|
|
rs.executeQuery("select @@identity");
|
|
System.out.println(rs.getString(1));
|
|
System.out.println(rs.getString(2));
|
|
}
|
|
|
|
@Test
|
|
public void testSQLWhere(){
|
|
SQLWhere sqlWhere = SQLWhere.creatWhere()
|
|
.and("id").equal(90)
|
|
.or("name").like("%testname%")
|
|
.and("mainid").equalSql("select id from maintable")
|
|
.create();
|
|
Map<String, Object > map = new HashMap<>();
|
|
map.put("id", "90");
|
|
String tablename = BuilderSqlUtil.builderUpdateFullSql("tablename", map, sqlWhere);
|
|
System.out.println(tablename);
|
|
}
|
|
|
|
@Test
|
|
public void testPrepSQLWhere(){
|
|
PrepSQLWhere prepSQLWhere = PrepSQLWhere.creatPrepWhere()
|
|
.and("id").equal(6)
|
|
.or("name").like("%public%")
|
|
.and("status").in(2,3,4,5,6)
|
|
.create();
|
|
Map<String, Object > map = new HashMap<>();
|
|
map.put("id", "90");
|
|
SqlResult tablename = BuilderSqlUtil.builderUpdateSql("tablename", map, prepSQLWhere);
|
|
System.out.println(tablename.getSqlStr());
|
|
System.out.println(Arrays.toString(tablename.getArgs()));
|
|
}
|
|
|
|
@Test
|
|
public void testInnerPrepSQLWhere(){
|
|
PrepSQLWhere prepSQLWhere = PrepSQLWhere.creatPrepWhere()
|
|
.and("id").equal(6)
|
|
.or("name").like("%public%")
|
|
.and("status").in(2,3,4,5,6)
|
|
.create();
|
|
Map<String, Object > map = new HashMap<>();
|
|
map.put("id", "90");
|
|
SqlResult tablename = BuilderSqlUtil.builderUpdateSql("tablename", map, prepSQLWhere);
|
|
System.out.println(tablename.getSqlStr());
|
|
System.out.println(Arrays.toString(tablename.getArgs()));
|
|
}
|
|
|
|
|
|
@Test
|
|
public void testRemoveCache(){
|
|
CustomerInfoComInfo customerInfo = new CustomerInfoComInfo();
|
|
customerInfo.removeCustomerInfoCache();
|
|
customerInfo.removeCache();
|
|
ResourceVirtualComInfo resource = new ResourceVirtualComInfo();
|
|
resource.removeCache();
|
|
resource.removeResourceVirtualCache();
|
|
(new CustomerContacterComInfo()).removeCustomerContacterCache();
|
|
}
|
|
|
|
@Test
|
|
public void test_crm_config(){
|
|
// CRM_Config conf = new CRM_Config("6","formtable_main_32","105106");
|
|
RequestInfo requestInfo = new RequestInfo();
|
|
AddCustomer_Action addCustomer = new AddCustomer_Action();
|
|
requestInfo.setRequestid("179181");
|
|
requestInfo.setWorkflowid("6");
|
|
requestInfo.setCreatorid("1");
|
|
requestInfo.setRequestManager(new RequestManager(){{setBilltablename("formtable_main_32");}});
|
|
addCustomer.execute(requestInfo);
|
|
// System.out.println(conf.getConfigInfo());;
|
|
}
|
|
|
|
@Test
|
|
public void test_removeSegmentation(){
|
|
StringBuilder sqlBuilder = new StringBuilder(" ,insert into 1,2,3,4,5 , ");
|
|
System.out.println(Utils.removeSeparator(sqlBuilder));
|
|
}
|
|
|
|
@Test
|
|
public void testAddCustomerAction(){
|
|
AddCustomer_Action addCustomer_action = new AddCustomer_Action();
|
|
CRM_Config config = new CRM_Config("4","formtable_main_2","5011");
|
|
Map<String, List<Map<String, Object>>> configInfoMap = config.getConfigInfo();
|
|
MainResult mainResult = config.getMainResult();
|
|
System.out.println(configInfoMap);
|
|
System.out.println(mainResult);
|
|
if(mainResult.getChangeSetting() == 0){
|
|
// 表示插入
|
|
addCustomer_action.insertCustomerModel(mainResult,configInfoMap);
|
|
}else{
|
|
// 表示根据流程字段判断是插入还是更新
|
|
|
|
}
|
|
}
|
|
|
|
}
|