|
|
|
@ -8,6 +8,7 @@ import com.weaver.ebuilder.datasource.api.enums.SqlParamType;
|
|
|
|
|
import com.weaver.seconddev.jcldoor.util.CommonUtils;
|
|
|
|
|
import com.weaver.seconddev.jcldoor.util.DatabaseUtils;
|
|
|
|
|
import com.weaver.teams.domain.user.SimpleEmployee;
|
|
|
|
|
import com.weaver.teams.security.context.UserContext;
|
|
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
@ -42,6 +43,7 @@ public class PortalBirthdayWishesCmd {
|
|
|
|
|
public Map<String, Object> getInfo(HttpServletRequest request, SimpleEmployee simpleEmployee) {
|
|
|
|
|
Map<String, Object> result = new HashMap<>(100);
|
|
|
|
|
JSONArray list = new JSONArray();
|
|
|
|
|
String hid = getHid();
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
String groupId = "weaver-hr-service";
|
|
|
|
@ -112,6 +114,7 @@ public class PortalBirthdayWishesCmd {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result.put("list",list);
|
|
|
|
|
result.put("hid",hid);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -138,4 +141,88 @@ public class PortalBirthdayWishesCmd {
|
|
|
|
|
|
|
|
|
|
return sex;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getHid() {
|
|
|
|
|
String hid = "";
|
|
|
|
|
|
|
|
|
|
String groupId = "weaver-hr-service";
|
|
|
|
|
String sourceType = "LOGIC";
|
|
|
|
|
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
String nowDay = sdf.format(new Date());
|
|
|
|
|
SimpleEmployee employee = UserContext.getCurrentUser();
|
|
|
|
|
|
|
|
|
|
long formdata = employee.getFormdata();
|
|
|
|
|
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' ";
|
|
|
|
|
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"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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' ";
|
|
|
|
|
List<SqlParamEntity> sqlparam = new ArrayList<SqlParamEntity>();
|
|
|
|
|
SqlParamEntity sqlParamEntity = new SqlParamEntity();
|
|
|
|
|
sqlParamEntity.setParamType(SqlParamType.VARCHAR);
|
|
|
|
|
sqlParamEntity.setValue(tip_id);
|
|
|
|
|
sqlparam.add(sqlParamEntity);
|
|
|
|
|
|
|
|
|
|
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"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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 ";
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
hid = String.valueOf(recordMap.get("id"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
log.error("getHid Exception"+e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
return hid;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|