Commit 3a4b152b authored by ligang's avatar ligang
Browse files

Merge remote-tracking branch 'upstream/dev-20190415' into dev-20190415

parents 0cfeb4b9 0e4c8651
Loading
Loading
Loading
Loading
+33 −1
Original line number Diff line number Diff line
@@ -68,7 +68,39 @@ public class TaskRecordController extends BaseController{
   try{
        logger.info("query task record list, task name:{}, state :{}, taskDate: {}, start:{}, end:{}",
                taskName, state,  taskDate, startTime, endTime);
        Map<String, Object> result = taskRecordService.queryTaskRecordListPaging(taskName, startTime,  taskDate, sourceTable, destTable, endTime,state, pageNo, pageSize);
        Map<String, Object> result = taskRecordService.queryTaskRecordListPaging(false, taskName, startTime,  taskDate, sourceTable, destTable, endTime,state, pageNo, pageSize);
        return returnDataListPaging(result);
    }catch (Exception e){
        logger.error(QUERY_TASK_RECORD_LIST_PAGING_ERROR.getMsg(),e);
        return error(QUERY_TASK_RECORD_LIST_PAGING_ERROR.getCode(), QUERY_TASK_RECORD_LIST_PAGING_ERROR.getMsg());
    }

    }

    /**
     * query history task record list paging
     *
     * @param loginUser
     * @return
     */
    @GetMapping("/history-list-paging")
    @ResponseStatus(HttpStatus.OK)
    public Result queryHistoryTaskRecordListPaging(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
                                            @RequestParam(value = "taskName", required = false) String taskName,
                                            @RequestParam(value = "state", required = false) String state,
                                            @RequestParam(value = "sourceTable", required = false) String sourceTable,
                                            @RequestParam(value = "destTable", required = false) String destTable,
                                            @RequestParam(value = "taskDate", required = false) String taskDate,
                                            @RequestParam(value = "startDate", required = false) String startTime,
                                            @RequestParam(value = "endDate", required = false) String endTime,
                                            @RequestParam("pageNo") Integer pageNo,
                                            @RequestParam("pageSize") Integer pageSize
    ){

        try{
            logger.info("query hisotry task record list, task name:{}, state :{}, taskDate: {}, start:{}, end:{}",
                    taskName, state,  taskDate, startTime, endTime);
            Map<String, Object> result = taskRecordService.queryTaskRecordListPaging(true, taskName, startTime,  taskDate, sourceTable, destTable, endTime,state, pageNo, pageSize);
            return returnDataListPaging(result);
        }catch (Exception e){
            logger.error(QUERY_TASK_RECORD_LIST_PAGING_ERROR.getMsg(),e);
+8 −6
Original line number Diff line number Diff line
@@ -64,13 +64,14 @@ public class UsersController extends BaseController{
                                                     @RequestParam(value = "userName") String userName,
                                                     @RequestParam(value = "userPassword") String userPassword,
                                                     @RequestParam(value = "tenantId") int tenantId,
                                                     @RequestParam(value = "queue") String queue,
                                                     @RequestParam(value = "email") String email,
                                                     @RequestParam(value = "phone", required = false) String phone) {
        logger.info("login user {}, create user, userName: {}, email: {}, tenantId: {}, userPassword: {}, phone: {}, proxyUsers: {}",
                loginUser.getUserName(), userName, email, tenantId, Constants.PASSWORD_DEFAULT, phone);
        logger.info("login user {}, create user, userName: {}, email: {}, tenantId: {}, userPassword: {}, phone: {}, user queue: {}",
                loginUser.getUserName(), userName, email, tenantId, Constants.PASSWORD_DEFAULT, phone,queue);

        try {
            Map<String, Object> result = usersService.createUser(loginUser, userName, userPassword, email, tenantId, phone);
            Map<String, Object> result = usersService.createUser(loginUser, userName, userPassword,email,tenantId, phone,queue);
            return returnDataList(result);
        }catch (Exception e){
            logger.error(CREATE_USER_ERROR.getMsg(),e);
@@ -127,13 +128,14 @@ public class UsersController extends BaseController{
                                                     @RequestParam(value = "id") int id,
                                                     @RequestParam(value = "userName") String userName,
                                                     @RequestParam(value = "userPassword") String userPassword,
                                                     @RequestParam(value = "queue") String queue,
                                                     @RequestParam(value = "email") String email,
                                                     @RequestParam(value = "tenantId") int tenantId,
                                                     @RequestParam(value = "phone", required = false) String phone) {
        logger.info("login user {}, updateProcessInstance user, userName: {}, email: {}, tenantId: {}, userPassword: {}, phone: {}, proxyUsers: {}",
                loginUser.getUserName(), userName, email, tenantId, Constants.PASSWORD_DEFAULT, phone);
        logger.info("login user {}, updateProcessInstance user, userName: {}, email: {}, tenantId: {}, userPassword: {}, phone: {}, user queue: {}",
                loginUser.getUserName(), userName, email, tenantId, Constants.PASSWORD_DEFAULT, phone,queue);
        try {
            Map<String, Object> result = usersService.updateUser(id,userName,userPassword,email,tenantId,phone);
            Map<String, Object> result = usersService.updateUser(id,userName,userPassword,email,tenantId,phone,queue);
            return returnDataList(result);
        }catch (Exception e){
            logger.error(UPDATE_USER_ERROR.getMsg(),e);
+6 −3
Original line number Diff line number Diff line
@@ -29,6 +29,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static cn.escheduler.common.Constants.*;

/**
 * task record service
 */
@@ -51,7 +53,7 @@ public class TaskRecordService extends BaseService{
     * @param pageSize
     * @return
     */
    public Map<String,Object> queryTaskRecordListPaging(String taskName, String startDate,
    public Map<String,Object> queryTaskRecordListPaging(boolean isHistory, String taskName, String startDate,
                                                        String taskDate, String sourceTable,
                                                        String destTable, String endDate,
                                                        String state, Integer pageNo, Integer pageSize) {
@@ -69,8 +71,9 @@ public class TaskRecordService extends BaseService{
        map.put("offset", pageInfo.getStart().toString());
        map.put("pageSize", pageInfo.getPageSize().toString());

        int count = TaskRecordDao.countTaskRecord(map);
        List<TaskRecord> recordList = TaskRecordDao.queryAllTaskRecord(map);
        String table = isHistory ? TASK_RECORD_TABLE_HISTORY_HIVE_LOG : TASK_RECORD_TABLE_HIVE_LOG;
        int count = TaskRecordDao.countTaskRecord(map, table);
        List<TaskRecord> recordList = TaskRecordDao.queryAllTaskRecord(map, table);
        pageInfo.setTotalCount(count);
        pageInfo.setLists(recordList);
        result.put(Constants.DATA_LIST, pageInfo);
+11 −2
Original line number Diff line number Diff line
@@ -87,7 +87,8 @@ public class UsersService extends BaseService {
                                          String userPassword,
                                          String email,
                                          int tenantId,
                                          String phone) throws Exception {
                                          String phone,
                                          String queue) throws Exception {

        Map<String, Object> result = new HashMap<>(5);
        result = CheckUtils.checkUserParams(userName, userPassword, email, phone);
@@ -114,6 +115,7 @@ public class UsersService extends BaseService {
        user.setUserType(UserType.GENERAL_USER);
        user.setCreateTime(now);
        user.setUpdateTime(now);
        user.setQueue(queue);

        // save user
        userMapper.insert(user);
@@ -194,7 +196,13 @@ public class UsersService extends BaseService {
     * @param phone
     * @return
     */
    public Map<String, Object> updateUser(int userId, String userName, String userPassword, String email, int tenantId, String phone) throws Exception {
    public Map<String, Object> updateUser(int userId,
                                          String userName,
                                          String userPassword,
                                          String email,
                                          int tenantId,
                                          String phone,
                                          String queue) throws Exception {
        Map<String, Object> result = new HashMap<>(5);
        result.put(Constants.STATUS, false);

@@ -218,6 +226,7 @@ public class UsersService extends BaseService {
        if (StringUtils.isNotEmpty(email)) {
            user.setEmail(email);
        }
        user.setQueue(queue);
        user.setPhone(phone);
        user.setUpdateTime(now);

+9 −0
Original line number Diff line number Diff line
@@ -463,6 +463,10 @@ public final class Constants {

    public static final String TASK_RECORD_PWD = "task.record.datasource.password";

    public static  String TASK_RECORD_TABLE_HIVE_LOG = "eamp_hive_log_hd";

    public static  String TASK_RECORD_TABLE_HISTORY_HIVE_LOG = "eamp_hive_hist_log_hd";

    public static final String STATUS = "status";


@@ -826,4 +830,9 @@ public final class Constants {
    public static final String CONTENT = "content";
    public static final String DEPENDENT_SPLIT = ":||";
    public static final String DEPENDENT_ALL = "ALL";


    /**
     *
     */
}
Loading