|
|
|
@ -1175,11 +1175,17 @@ public class HrmSelfHelpController {
|
|
|
|
|
long formdata = employee.getFormdata();
|
|
|
|
|
dataMap.put("formdata",formdata);
|
|
|
|
|
|
|
|
|
|
String sql =" select field69,field69_obj from eteams.Hrmemployeedefined where form_data_id='"+formdata+"'" ;
|
|
|
|
|
String sql =" select field69,field69_obj from eteams.Hrmemployeedefined where form_data_id=? " ;
|
|
|
|
|
dataMap.put("sql",sql);
|
|
|
|
|
|
|
|
|
|
log.error("getSelfServiceData--sql:"+sql);
|
|
|
|
|
|
|
|
|
|
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
|
|
|
|
|
SqlParamEntity sqlParamEntity = new SqlParamEntity();
|
|
|
|
|
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
|
|
|
|
|
sqlParamEntity.setValue(String.valueOf(formdata));
|
|
|
|
|
sqlparam.add(sqlParamEntity);
|
|
|
|
|
|
|
|
|
|
Map<String, Object> result = databaseUtils.execute(sourceType, groupId, sql);
|
|
|
|
|
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
|
|
|
|
|
dataMap.put("data90",recordList);
|
|
|
|
@ -1193,33 +1199,97 @@ public class HrmSelfHelpController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/testSapi100")
|
|
|
|
|
@GetMapping("/testSapi110")
|
|
|
|
|
@WeaPermission(publicPermission = true)
|
|
|
|
|
public WeaResult<Object> testSapi100(HttpServletRequest request){
|
|
|
|
|
public WeaResult<Object> testSapi110(HttpServletRequest request){
|
|
|
|
|
|
|
|
|
|
String groupId = "weaver-ebuilder-form-service";
|
|
|
|
|
String groupId = "weaver-hr-service";
|
|
|
|
|
String sourceType = "LOGIC";
|
|
|
|
|
|
|
|
|
|
Map<String,Object> dataMap = new HashMap<String,Object>();
|
|
|
|
|
dataMap.put("test","testSapi90");
|
|
|
|
|
dataMap.put("test","testSapi110");
|
|
|
|
|
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
String hip = "" ;
|
|
|
|
|
String nowDay = sdf.format(new Date());
|
|
|
|
|
SimpleEmployee employee = UserContext.getCurrentUser();
|
|
|
|
|
log.error("employee:"+employee.getEmployeeId());
|
|
|
|
|
|
|
|
|
|
long formdata = employee.getFormdata();
|
|
|
|
|
dataMap.put("formdata",formdata);
|
|
|
|
|
String tip_id = "" ;
|
|
|
|
|
String sql =" select id " +
|
|
|
|
|
" from hr_tip\n" +
|
|
|
|
|
" where TIP_TYPE='birthday'\n" +
|
|
|
|
|
" and TENANT_KEY='t7akvdnf84'\n" +
|
|
|
|
|
" and DELETE_TYPE='0' " ;
|
|
|
|
|
dataMap.put("sql",sql);
|
|
|
|
|
log.error("--sql:"+sql);
|
|
|
|
|
Map<String, Object> result = databaseUtils.execute(sourceType, groupId, sql);
|
|
|
|
|
List<Map<String,Object>> recordList = databaseUtils.getDataSourceList(result);
|
|
|
|
|
if(recordList.size()>0){
|
|
|
|
|
Map<String, Object> recordMap = recordList.get(0);
|
|
|
|
|
tip_id = String.valueOf(recordMap.get("id"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// SendMessageEntity smg = null;
|
|
|
|
|
// WeaResult<Long> result =asyncSystemMessageRest.sendMsg(smg);
|
|
|
|
|
// log.info("{}",result);
|
|
|
|
|
String tip_target_id = "" ;
|
|
|
|
|
if(StringUtils.isNotBlank(tip_id)){
|
|
|
|
|
sql = " select id from hr_tip_target \n" +
|
|
|
|
|
" where TIP_ID = ? \n" +
|
|
|
|
|
" and TARGET_TYPE='colleague' \n" +
|
|
|
|
|
" and tip_time_type='sameDay' ";
|
|
|
|
|
log.error("--sql:"+sql);
|
|
|
|
|
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
|
|
|
|
|
SqlParamEntity sqlParamEntity = new SqlParamEntity();
|
|
|
|
|
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
|
|
|
|
|
sqlParamEntity.setValue(tip_id);
|
|
|
|
|
sqlparam.add(sqlParamEntity);
|
|
|
|
|
|
|
|
|
|
WeaResult<Long> data = sendBaseMsg("生日快乐",employee);
|
|
|
|
|
long data2 = data.getData();
|
|
|
|
|
int code = data.getCode();
|
|
|
|
|
String msg = data.getMsg();
|
|
|
|
|
Map<String, Object> result2 = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
|
|
|
|
|
List<Map<String,Object>> recordList2 = databaseUtils.getDataSourceList(result2);
|
|
|
|
|
if(recordList2.size()>0){
|
|
|
|
|
Map<String, Object> recordMap = recordList2.get(0);
|
|
|
|
|
tip_target_id = String.valueOf(recordMap.get("id"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dataMap.put("data2",data2);
|
|
|
|
|
dataMap.put("code",code);
|
|
|
|
|
dataMap.put("msg",msg);
|
|
|
|
|
if(StringUtils.isNotBlank(tip_id) && StringUtils.isNotBlank(tip_target_id)){
|
|
|
|
|
sql = " select id \n" +
|
|
|
|
|
" from hr_tip_send_history\n" +
|
|
|
|
|
" where history_date = ? \n" +
|
|
|
|
|
" and tip_id = ? \n" +
|
|
|
|
|
" and tip_target_id= ? \n" +
|
|
|
|
|
" order by create_time desc " +
|
|
|
|
|
" limit 1 ";
|
|
|
|
|
log.error("--sql:"+sql);
|
|
|
|
|
|
|
|
|
|
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
|
|
|
|
|
SqlParamEntity sqlParamEntity = new SqlParamEntity();
|
|
|
|
|
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
|
|
|
|
|
sqlParamEntity.setValue(nowDay);
|
|
|
|
|
sqlparam.add(sqlParamEntity);
|
|
|
|
|
|
|
|
|
|
sqlParamEntity = new SqlParamEntity();
|
|
|
|
|
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
|
|
|
|
|
sqlParamEntity.setValue(tip_id);
|
|
|
|
|
sqlparam.add(sqlParamEntity);
|
|
|
|
|
|
|
|
|
|
sqlParamEntity = new SqlParamEntity();
|
|
|
|
|
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
|
|
|
|
|
sqlParamEntity.setValue(tip_target_id);
|
|
|
|
|
sqlparam.add(sqlParamEntity);
|
|
|
|
|
|
|
|
|
|
Map<String, Object> result3 = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam);
|
|
|
|
|
List<Map<String,Object>> recordList3 = databaseUtils.getDataSourceList(result3);
|
|
|
|
|
if(recordList3.size()>0){
|
|
|
|
|
Map<String, Object> recordMap = recordList3.get(0);
|
|
|
|
|
hip = String.valueOf(recordMap.get("id"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
log.error("--hip:"+hip);
|
|
|
|
|
dataMap.put("hip",hip);
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
@ -1232,26 +1302,5 @@ public class HrmSelfHelpController {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public SendMessageEntity getSmsMsg(String content, SimpleEmployee simpleEmployee) {
|
|
|
|
|
SendMessageEntity smg = new SendMessageEntity();
|
|
|
|
|
smg.setModule(MessageModule.SYSTEM_REMIND);
|
|
|
|
|
smg.setEvent(MessageEvent.NOTIFY);
|
|
|
|
|
smg.setSender(UserEntity.WORK_FLOW_ROBOT);
|
|
|
|
|
Map<String, String> params = new HashMap<>();
|
|
|
|
|
params.put("content", content);
|
|
|
|
|
smg.setDynamicParams(params);
|
|
|
|
|
smg.setReceivers(Collections.singletonList((new UserEntity()).setPhone(simpleEmployee.getTelephone()).setTenantKey(simpleEmployee.getTenantKey4Im()).setEmployeeId(simpleEmployee.getEmployeeId().longValue()).setEmail(simpleEmployee.getEmail()).setLanguage(6)));
|
|
|
|
|
Set<MessageChannelEnum> set = new HashSet<>();
|
|
|
|
|
set.add(MessageChannelEnum.IM);
|
|
|
|
|
smg.setChannels(set);
|
|
|
|
|
return smg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public WeaResult<Long> sendBaseMsg(String content, SimpleEmployee simpleEmployee) {
|
|
|
|
|
SendMessageEntity smg = getSmsMsg(content, simpleEmployee);
|
|
|
|
|
WeaResult<Long> result = systemMessageRest.sendMsg(smg);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|