编号管理

pull/34/MERGE^2
Chengliang 3 years ago
parent 6601f117cd
commit 7c950e8626

@ -1,10 +1,13 @@
package com.api.organization.web;
import javax.ws.rs.Path;
/**
* @Author weaver_cl
* @Description: TODO
* @Date 2022/5/30
* @Version V1.0
**/
public class CodeSettingController {
@Path("/bs/hrmorganization/codeSetting")
public class CodeSettingController extends com.engine.organization.web.CodeSettingController {
}

@ -1,5 +1,7 @@
package com.engine.organization.service;
import com.engine.organization.util.response.ReturnResult;
/**
* @Author weaver_cl
* @Description: TODO
@ -7,4 +9,6 @@ package com.engine.organization.service;
* @Version V1.0
**/
public interface CodeSettingService {
ReturnResult getHasRight(String serialtype);
}

@ -1,7 +1,13 @@
package com.engine.organization.service.impl;
import com.engine.core.impl.Service;
import com.engine.hrm.entity.RuleCodeType;
import com.engine.organization.service.CodeSettingService;
import com.engine.organization.util.response.ReturnResult;
import weaver.hrm.HrmUserVarify;
import java.util.HashMap;
import java.util.Map;
/**
* @Author weaver_cl
@ -10,4 +16,26 @@ import com.engine.organization.service.CodeSettingService;
* @Version V1.0
**/
public class CodeSettingServiceImpl extends Service implements CodeSettingService {
@Override
public ReturnResult getHasRight(String serialtype) {
boolean hasRight = false;
Map<String, Object> retmap = new HashMap<>();
switch (RuleCodeType.getByValue(serialtype)) {
case SUBCOMPANY:
hasRight = HrmUserVarify.checkUserRight("HrmCodeRuleSubcompany:All", user);
break;
case DEPARTMENT:
hasRight = HrmUserVarify.checkUserRight("HrmCodeRuleDepartment:All", user);
break;
case JOBTITLES:
hasRight = HrmUserVarify.checkUserRight("HrmCodeRuleJobtitles:All", user);
break;
case USER:
hasRight = HrmUserVarify.checkUserRight("HrmCodeRuleUser:All", user);
break;
}
retmap.put("hasRight", hasRight);
return ReturnResult.successed(retmap);
}
}

@ -1,5 +1,20 @@
package com.engine.organization.web;
import com.engine.common.util.ServiceUtil;
import com.engine.organization.util.response.ReturnResult;
import com.engine.organization.wrapper.CodeSettingWrapper;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
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.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
/**
* @Author weaver_cl
* @Description: TODO
@ -8,5 +23,28 @@ package com.engine.organization.web;
**/
public class CodeSettingController {
public CodeSettingWrapper getCodeSettingWrapper(User user) {
return ServiceUtil.getService(CodeSettingWrapper.class,user);
}
/**
*
* @param request
* @param response
* @return
*/
@GET
@Path("/getHasRight")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult getHasRight(@Context HttpServletRequest request, @Context HttpServletResponse response,
@QueryParam("serialtype") String serialtype) {
try {
User user = HrmUserVarify.getUser(request, response);
return getCodeSettingWrapper(user).getHasRight(serialtype);
} catch (Exception e) {
return ReturnResult.exceptionHandle(e.getMessage());
}
}
}

@ -1,12 +1,25 @@
package com.engine.organization.wrapper;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.organization.service.CodeSettingService;
import com.engine.organization.service.impl.CodeSettingServiceImpl;
import com.engine.organization.util.response.ReturnResult;
import weaver.hrm.User;
/**
* @Author weaver_cl
* @Description: TODO
* @Date 2022/5/30
* @Version V1.0
**/
public class CodeSettingWrapper {
public class CodeSettingWrapper extends Service {
public CodeSettingService getCodeSettingService(User user) {
return ServiceUtil.getService(CodeSettingServiceImpl.class,user);
}
public ReturnResult getHasRight(String serialtype) {
return getCodeSettingService(user).getHasRight(serialtype);
}
}

Loading…
Cancel
Save