| | |
| | | package com.vci.frameworkcore.controller; |
| | | |
| | | import com.vci.dto.SmPasswordStrategyDTO; |
| | | import com.vci.frameworkcore.compatibility.SmPwdStrategyQueryServiceI; |
| | | import com.vci.frameworkcore.pagemodel.SmPasswordStrategyVO; |
| | | import com.vci.frameworkcore.pagemodel.SmUserVO; |
| | | import com.vci.pagemodel.SmPasswordStrategyVO; |
| | | import com.vci.starter.web.annotation.controller.VciUnCheckRight; |
| | | import com.vci.starter.web.exception.VciBaseException; |
| | | import com.vci.starter.web.pagemodel.BaseQueryObject; |
| | | import com.vci.starter.web.pagemodel.BaseResult; |
| | | import com.vci.starter.web.pagemodel.DataGrid; |
| | | import com.vci.starter.web.util.VciBaseUtil; |
| | | import com.vci.web.util.Func; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author ludc |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/passwordStrategyQueryController") |
| | | @Slf4j |
| | | public class SmPwdStrategyQueryController { |
| | | |
| | | /** |
| | |
| | | private SmPwdStrategyQueryServiceI pwdStrategyQueryService; |
| | | |
| | | /** |
| | | * 用户的列表参照, |
| | | * @param queryObject 查询对象,包含了查询条件,分页,排序等,即允许使用SmUserVO里的所有属性作为查询条件,也可以使用pkRole.xxx,pkDepartment.xxx,pkDuty.xxx这样来查询 |
| | | * @return 普通用户(不包含三员,也不包含停用的)的显示对象列表数据,请获取其中的data属性 |
| | | * 日志 |
| | | */ |
| | | private Logger logger = LoggerFactory.getLogger(getClass()); |
| | | |
| | | /** |
| | | * 密码安全策略的列表参照查询 |
| | | * @param queryObject 查询条件 |
| | | * @return |
| | | * @throws VciBaseException 查询出错的时候会抛出异常,如果是老的项目里不抛出异常 |
| | | */ |
| | | @RequestMapping(value = "/refDataGrid",method = RequestMethod.GET) |
| | |
| | | return BaseResult.dataGrid(pwdStrategyVODataGrid); |
| | | }catch (Exception e) { |
| | | e.printStackTrace(); |
| | | String exceptionMessage = VciBaseUtil.getExceptionMessage(e); |
| | | log.error("密码安全策略列表查询时出现错误,原因:" + exceptionMessage); |
| | | return BaseResult.fail("密码安全策略列表查询时出现错误,原因:" + e.getMessage()); |
| | | String exceptionMessage = "密码安全策略列表查询时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(exceptionMessage); |
| | | return BaseResult.fail(exceptionMessage); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 查询密码安全策略,下拉使用的接口 |
| | | * @param queryObject |
| | | * @return key为密码策略name,value为密码策略的oid |
| | | * @throws VciBaseException |
| | | */ |
| | | @RequestMapping(value = "/selectPwdStrategyMap",method = RequestMethod.GET) |
| | | public BaseResult<List<Map<String,String>>> selectPwdStrategyMap(BaseQueryObject queryObject) throws VciBaseException { |
| | | try { |
| | | List<Map<String,String>> pwdStrategyVODataGrid = pwdStrategyQueryService.selectPwdStrategyMap(queryObject.getConditionMap()); |
| | | return BaseResult.dataList(pwdStrategyVODataGrid); |
| | | }catch (Exception e) { |
| | | e.printStackTrace(); |
| | | String exceptionMessage = "密码安全策略下拉列表查询时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(exceptionMessage); |
| | | return BaseResult.fail(exceptionMessage); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 保存用户密码策略关联关系 |
| | | * @param userIds |
| | | * @param passwordStrategId |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/saveUserPasswordStrateg",method = RequestMethod.POST) |
| | | public BaseResult saveUserPasswordStrateg(String[] userIds, String passwordStrategId){ |
| | | try { |
| | |
| | | ? BaseResult.success("为用户设置密码安全策略成功!"):BaseResult.fail("为用户设置密码安全策略失败!"); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | String exceptionMessage = VciBaseUtil.getExceptionMessage(e); |
| | | log.error("为用户设置密码安全策略时出现错误,原因:" + exceptionMessage); |
| | | return BaseResult.fail("为用户设置密码安全策略时出现错误,原因:" + exceptionMessage); |
| | | String exceptionMessage = "为用户设置密码安全策略时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(exceptionMessage); |
| | | return BaseResult.fail(exceptionMessage); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 新增密码策略 |
| | | * @param smPasswordStrategyDTO |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/addPasswordStrateg",method = RequestMethod.POST) |
| | | public BaseResult addPasswordStrateg(@RequestBody SmPasswordStrategyDTO smPasswordStrategyDTO){ |
| | | try { |
| | | return pwdStrategyQueryService.addPasswordStrateg(smPasswordStrategyDTO) |
| | | ? BaseResult.success("新增密码安全策略成功!"):BaseResult.fail("新增密码安全策略失败!"); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | String exceptionMessage = "新增密码安全策略时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(exceptionMessage); |
| | | return BaseResult.fail(exceptionMessage); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 修改密码策略 |
| | | * @param smPasswordStrategyDTO |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/updatePasswordStrateg",method = RequestMethod.PUT) |
| | | public BaseResult updatePasswordStrateg(@RequestBody SmPasswordStrategyDTO smPasswordStrategyDTO){ |
| | | try { |
| | | return pwdStrategyQueryService.updatePasswordStrateg(smPasswordStrategyDTO) |
| | | ? BaseResult.success("修改密码安全策略成功!"):BaseResult.fail("修改密码安全策略失败!"); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | String exceptionMessage = "修改密码安全策略时出现错误,原因:" +VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(exceptionMessage); |
| | | return BaseResult.fail(exceptionMessage); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 删除密码策略 |
| | | * @param pwdIds |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/delPasswordStrateg",method = RequestMethod.DELETE) |
| | | public BaseResult delPasswordStrateg(String[] pwdIds){ |
| | | try { |
| | | return pwdStrategyQueryService.delPasswordStrateg(pwdIds) |
| | | ? BaseResult.success("删除密码安全策略成功!"):BaseResult.fail("删除密码安全策略失败!"); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | String exceptionMessage = "删除密码安全策略时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e); |
| | | logger.error(exceptionMessage); |
| | | return BaseResult.fail(exceptionMessage); |
| | | } |
| | | } |
| | | |