Commit de04730a authored by Administrator's avatar Administrator

push

parent fe728525
......@@ -39,191 +39,200 @@ public class AdminApi {
@RequestMapping("test")
public String hello(){
public String hello() {
return "f1";
}
/**
* 获得用户列表
*
* @return
*/
@RequestMapping("getUserList")
public List<UserInfo> selectAllUser() {
List<UserInfo> list = userInfoService.getAllUserInfo();
List<UserInfo> list = userInfoService.getAllUserInfo();
return list;
}
/**
* 用户添加;
*
* @return
*/
@PostMapping("userAdd")
public Map<String,String> userInfoAdd(@RequestBody String json){
public Map<String, String> userInfoAdd(@RequestBody String json) {
JSONObject jsonObject = JSONObject.fromObject(json);
String salt = UUID.randomUUID().toString();
UserInfo userInfo = new UserInfo();
userInfo.setPassword(Md5Utils.entryptPassword(jsonObject.getString("password"),salt));
userInfo.setPassword(Md5Utils.entryptPassword(jsonObject.getString("password"), salt));
userInfo.setSalt(salt);
userInfo.setUsername(jsonObject.getString("username"));
userInfo.setName(jsonObject.getString("name"));
Map<String,String> map = new HashMap<>();
Map<String, String> map = new HashMap<>();
boolean flag = false;
flag = userInfoService.addUser(userInfo,Integer.parseInt(jsonObject.getString("roleId")));
if (flag){
map.put("resultMsg","添加成功");
flag = userInfoService.addUser(userInfo, Integer.parseInt(jsonObject.getString("roleId")));
if (flag) {
map.put("resultMsg", "添加成功");
}else {
map.put("resultMsg","添加失败");
} else {
map.put("resultMsg", "添加失败");
}
return map;
}
/**
* 通过id查询用户;
*
* @return
*/
@RequestMapping(value = "getUserById",method = RequestMethod.GET)
public Map<String,Object> getUserById(@RequestParam("userId") String userId, HttpServletResponse response){
@RequestMapping(value = "getUserById", method = RequestMethod.GET)
public Map<String, Object> getUserById(@RequestParam("userId") String userId, HttpServletResponse response) {
response.setCharacterEncoding("UTF-8");
Map<String,Object> map = new HashMap<>();
UserInfo userInfo =userInfoService.getUserInfoByUserId(Integer.parseInt(userId));
map.put("user",userInfo);
return map;
Map<String, Object> map = new HashMap<>();
UserInfo userInfo = userInfoService.getUserInfoByUserId(Integer.parseInt(userId));
map.put("user", userInfo);
return map;
}
/**
* 用户删除;
*
* @return
*/
@RequestMapping(value = "userDel",method = RequestMethod.GET)
public Map<String,Object> userInfoDel(@RequestParam("userId") String userId,HttpServletResponse response){
@RequestMapping(value = "userDel", method = RequestMethod.GET)
public Map<String, Object> userInfoDel(@RequestParam("userId") String userId, HttpServletResponse response) {
response.setCharacterEncoding("UTF-8");
Map<String,Object> map = new HashMap<>();
Map<String, Object> map = new HashMap<>();
boolean flag = false;
flag = userInfoService.deleteUserInfo(Integer.parseInt(userId));
if(flag){
map.put("returnMsg","删除成功");
}else{
map.put("returnMsg","删除失败");
if (flag) {
map.put("returnMsg", "删除成功");
} else {
map.put("returnMsg", "删除失败");
}
return map;
return map;
}
/**
* 用户启用;
*
* @return
*/
@RequestMapping(value = "userBack",method = RequestMethod.GET)
public Map<String,Object> userInfoBack(@RequestParam("userId") String userId, HttpServletResponse response){
@RequestMapping(value = "userBack", method = RequestMethod.GET)
public Map<String, Object> userInfoBack(@RequestParam("userId") String userId, HttpServletResponse response) {
response.setCharacterEncoding("UTF-8");
Map<String,Object> map = new HashMap<>();
Map<String, Object> map = new HashMap<>();
boolean flag = false;
flag = userInfoService.BackUserInfo(Integer.parseInt(userId));
if(flag){
map.put("returnMsg","启用成功");
}else{
map.put("returnMsg","启用失败");
if (flag) {
map.put("returnMsg", "启用成功");
} else {
map.put("returnMsg", "启用失败");
}
return map;
return map;
}
@RequestMapping("getRoleList")
public List<SysRole> selectAllRole() {
List<SysRole> list = sysRoleService.getAllRoleInfo();
List<SysRole> list = sysRoleService.getAllRoleInfo();
return list;
}
@RequestMapping("getPermissionList")
public List<SysPermission> selectAllPermission() {
List<SysPermission> list = sysPermissionService.getAllPermission();
public List<SysPermission> selectAllPermission() {
List<SysPermission> list = sysPermissionService.getAllPermission();
return list;
}
/**
* 权限删除;
*
* @return
*/
@RequestMapping("permissionDel")
public Map permissionDel(@RequestParam("permissionId") String permissionId,HttpServletResponse response){
public Map permissionDel(@RequestParam("permissionId") String permissionId, HttpServletResponse response) {
response.setCharacterEncoding("UTF-8");
Map map = new HashMap();
boolean flag = false;
flag = sysPermissionService.deletePermission(Integer.parseInt(permissionId));
if(flag){
map.put("returnMsg","删除成功");
}else{
map.put("returnMsg","删除失败");
if (flag) {
map.put("returnMsg", "删除成功");
} else {
map.put("returnMsg", "删除失败");
}
return map;
}
/**
* 权限启用;
*
* @return
*/
@RequestMapping("permissionOpen")
public Map permissionBack(@RequestParam("permissionId") String permissionId,HttpServletResponse response){
public Map permissionBack(@RequestParam("permissionId") String permissionId, HttpServletResponse response) {
response.setCharacterEncoding("UTF-8");
Map map = new HashMap();
boolean flag = false;
flag = sysPermissionService.backPermission(Integer.parseInt(permissionId));
if(flag){
map.put("returnMsg","启用成功");
}else{
map.put("returnMsg","启用失败");
if (flag) {
map.put("returnMsg", "启用成功");
} else {
map.put("returnMsg", "启用失败");
}
return map;
}
/**
* 通过id查询权限;
*
* @return
*/
@RequestMapping(value = "getPermsById",method = RequestMethod.GET)
public Map<String,Object> getPermsById(@RequestParam("permissionId") String permissionId, HttpServletResponse response){
@RequestMapping(value = "getPermsById", method = RequestMethod.GET)
public Map<String, Object> getPermsById(@RequestParam("permissionId") String permissionId, HttpServletResponse response) {
response.setCharacterEncoding("UTF-8");
Map<String,Object> map = new HashMap<>();
SysPermission sysPermission =sysPermissionService.getPermissionByPId(Integer.parseInt(permissionId));
map.put("permission",sysPermission);
return map;
Map<String, Object> map = new HashMap<>();
SysPermission sysPermission = sysPermissionService.getPermissionByPId(Integer.parseInt(permissionId));
map.put("permission", sysPermission);
return map;
}
/**
* 通过id查询角色;
*
* @return
*/
@RequestMapping(value = "getRoleById",method = RequestMethod.GET)
public Map<String,Object> getRoleById(@RequestParam("roleId") String roleId, HttpServletResponse response){
@RequestMapping(value = "getRoleById", method = RequestMethod.GET)
public Map<String, Object> getRoleById(@RequestParam("roleId") String roleId, HttpServletResponse response) {
response.setCharacterEncoding("UTF-8");
Map<String,Object> map = new HashMap<>();
SysRole sysRole =sysRoleService.getRoleByRoleId(Integer.parseInt(roleId));
map.put("role",sysRole);
return map;
Map<String, Object> map = new HashMap<>();
SysRole sysRole = sysRoleService.getRoleByRoleId(Integer.parseInt(roleId));
map.put("role", sysRole);
return map;
}
/**
* 添加权限
*
* @param jsonStr
* @param resp
* @return
*/
@RequestMapping(value="permissionAdd",method = RequestMethod.POST)
public Map<String,String> userAdd(@RequestBody String jsonStr, HttpServletResponse resp){
@RequestMapping(value = "permissionAdd", method = RequestMethod.POST)
public Map<String, String> userAdd(@RequestBody String jsonStr, HttpServletResponse resp) {
resp.setCharacterEncoding("UTF-8");
Map<String,String> map = new HashMap<>();
Map<String, String> map = new HashMap<>();
JSONObject jsonObject = JSONObject.fromObject(jsonStr);
boolean flag = false;
String str = "0";
......@@ -240,42 +249,44 @@ public class AdminApi {
// }
System.out.println(sysPermission);
flag = sysPermissionService.addPermission(sysPermission);
if (flag){
map.put("resultMsg","添加成功");
if (flag) {
map.put("resultMsg", "添加成功");
}else {
map.put("resultMsg","添加失败");
} else {
map.put("resultMsg", "添加失败");
}
return map;
}
/**
* 查询所有非锁定角色;
*
* @return
*/
@RequestMapping(value = "getAllActiveRoleList",method = RequestMethod.GET)
public List<SysRole> userInfoAdd(){
@RequestMapping(value = "getAllActiveRoleList", method = RequestMethod.GET)
public List<SysRole> userInfoAdd() {
List<SysRole> list = sysRoleService.getAllActiveRoleInfo();
return list;
}
/**
* 查询所有非锁定权限;
*
* @return
*/
@RequestMapping(value = "getAllActivePermissionList",method = RequestMethod.GET)
public List<SysPermission> getAllActivePermissionList(){
@RequestMapping(value = "getAllActivePermissionList", method = RequestMethod.GET)
public List<SysPermission> getAllActivePermissionList() {
List<SysPermission> list = sysPermissionService.getAllActivePermission();
return list;
}
/**
* 角色删除;
*
* @return
*/
// @GET
......@@ -309,14 +320,10 @@ public class AdminApi {
// }
// return map.toString();
// }
@RequestMapping("roleAdd")
public Map<String,String> roleAdd(@RequestBody String jsonStr,HttpServletResponse resp) {
public Map<String, String> roleAdd(@RequestBody String jsonStr, HttpServletResponse resp) {
resp.setCharacterEncoding("UTF-8");
Map<String,String> map = new HashMap<>();
Map<String, String> map = new HashMap<>();
JSONObject jsonObject = JSONObject.fromObject(jsonStr);
boolean flag = false;
SysRole sysRole = new SysRole();
......@@ -325,42 +332,42 @@ public class AdminApi {
String permissionIds = jsonObject.getString("permissionIds");
JSONArray jsonArray = JSONArray.fromObject(permissionIds);
flag = sysRoleService.addRole(sysRole,jsonArray);
if (flag){
map.put("resultMsg","添加成功");
flag = sysRoleService.addRole(sysRole, jsonArray);
if (flag) {
map.put("resultMsg", "添加成功");
}else {
map.put("resultMsg","添加失败");
} else {
map.put("resultMsg", "添加失败");
}
return map;
}
@PostMapping("userUpdate")
public Map<String,String> userInfoUpdate(@RequestBody String json,HttpServletResponse resp) {
public Map<String, String> userInfoUpdate(@RequestBody String json, HttpServletResponse resp) {
resp.setCharacterEncoding("UTF-8");
JSONObject jsonObject = JSONObject.fromObject(json);
UserInfo userInfo = new UserInfo();
userInfo.setUsername(jsonObject.getString("username"));
userInfo.setName(jsonObject.getString("name"));
userInfo.setId(Integer.parseInt(jsonObject.getString("id")));
Map<String,String> map = new HashMap<>();
Map<String, String> map = new HashMap<>();
boolean flag = false;
flag = userInfoService.updateUser(userInfo,Integer.parseInt(jsonObject.getString("roleId")),Integer.parseInt(jsonObject.getString("oldRoleId")));
if (flag){
map.put("resultMsg","修改成功");
flag = userInfoService.updateUser(userInfo, Integer.parseInt(jsonObject.getString("roleId")), Integer.parseInt(jsonObject.getString("oldRoleId")));
if (flag) {
map.put("resultMsg", "修改成功");
}else {
map.put("resultMsg","修改失败");
} else {
map.put("resultMsg", "修改失败");
}
return map;
}
@RequestMapping("roleUpdate")
public Map roleUpdate(@RequestBody String jsonStr,HttpServletResponse resp) {
public Map roleUpdate(@RequestBody String jsonStr, HttpServletResponse resp) {
resp.setCharacterEncoding("UTF-8");
Map<String,String> map = new HashMap<>();
Map<String, String> map = new HashMap<>();
JSONObject jsonObject = JSONObject.fromObject(jsonStr);
boolean flag = false;
SysRole sysRole = new SysRole();
......@@ -370,13 +377,13 @@ public class AdminApi {
String oldPermissionIds = jsonObject.getString("oldPermissionIds");
JSONArray jsonArrayOldPids = JSONArray.fromObject(oldPermissionIds);
String permissionIds = jsonObject.getString("permissionId");
JSONArray jsonArrayPids = JSONArray.fromObject(permissionIds);
flag = sysRoleService.updateRole(sysRole,jsonArrayPids,jsonArrayOldPids);
if (flag){
map.put("resultMsg","修改成功");
JSONArray jsonArrayPids = JSONArray.fromObject(permissionIds);
flag = sysRoleService.updateRole(sysRole, jsonArrayPids, jsonArrayOldPids);
if (flag) {
map.put("resultMsg", "修改成功");
}else {
map.put("resultMsg","修改失败");
} else {
map.put("resultMsg", "修改失败");
}
return map;
......@@ -384,10 +391,10 @@ public class AdminApi {
@PostMapping("permissionUpdate")
public Map<String,String> permissionUpdate(@RequestBody String jsonStr,HttpServletResponse resp){
public Map<String, String> permissionUpdate(@RequestBody String jsonStr, HttpServletResponse resp) {
resp.setCharacterEncoding("UTF-8");
JSONObject jsonObject = JSONObject.fromObject(jsonStr);
Map<String,String> map = new HashMap<>();
Map<String, String> map = new HashMap<>();
boolean flag = false;
// String str = "0";
SysPermission sysPermission = new SysPermission();
......@@ -404,21 +411,15 @@ public class AdminApi {
// }
System.out.println(sysPermission);
flag = sysPermissionService.updatePermission(sysPermission);
if (flag){
map.put("resultMsg","修改成功");
if (flag) {
map.put("resultMsg", "修改成功");
}else {
map.put("resultMsg","修改失败");
} else {
map.put("resultMsg", "修改失败");
}
return map;
}
}
}
......@@ -58,14 +58,14 @@ public class UserApi {
UserInfo userInfo = (UserInfo) SecurityUtils.getSubject().getPrincipal();
resultMap.put("status", 200);
resultMap.put("message", "登录成功");
resultMap.put("user",userInfo);
resultMap.put("user", userInfo);
} catch (UnknownAccountException e) {
resultMap.put("status", 201);
resultMap.put("message", "账号不存在!");
}catch(IncorrectCredentialsException e1){
} catch (IncorrectCredentialsException e1) {
resultMap.put("status", 202);
resultMap.put("message", "密码错误!");
}catch (Exception e) {
} catch (Exception e) {
resultMap.put("status", 500);
resultMap.put("message", "用户名密码错误");
}
......@@ -79,13 +79,15 @@ public class UserApi {
subject.logout();
}
}
/**
* 查询任务单;
*
* @return
*/
@RequestMapping(value = "/getProductionTaskListByID", method = RequestMethod.GET)
@ResponseBody
public String getProductionTaskListByID(@RequestParam("id") String id, HttpServletResponse resp) {
public String getProductionTaskListByID(@RequestParam("id") String id, HttpServletResponse resp) {
List<TaskEntity> productionTaskListEntity = taskService.findProductionTaskListEntityByID(Long.valueOf(id));
YXJSONResponse yxjsonResponse = new YXJSONResponse();
......@@ -98,12 +100,13 @@ public class UserApi {
/**
* 更新任务单;
*
* @return
*/
@RequestMapping(value = "/updateProductionTask", method = RequestMethod.GET)
@RequiresPermissions("userInfo.add")//权限管理;
@ResponseBody
public String updateProductionTask(@RequestParam("id") String id, HttpServletResponse resp) {
public String updateProductionTask(@RequestParam("id") String id, HttpServletResponse resp) {
String map = "{\"production_Task_List_Id\":\"20181016001\",\"make_Type\":8,\"old_Make_Type\":8,} ";
JSONObject jsonObject = JSONObject.fromObject(map);
TaskEntity productionTaskListEntity = (TaskEntity) jsonObject.toBean(jsonObject, TaskEntity.class);
......@@ -122,13 +125,13 @@ public class UserApi {
@RequestMapping(value = "/addProductionTaskList", method = RequestMethod.GET)
@RequiresPermissions("userInfo.add")//权限管理;
@ResponseBody
public String addProductionTaskList(@RequestParam("id") String id, HttpServletResponse resp) {
public String addProductionTaskList(@RequestParam("id") String id, HttpServletResponse resp) {
String map = "{\"productionTaskListId\":\"20181016001\",\"makeType\":4,\"oldMakeType\":7}";
JSONObject jsonObject = JSONObject.fromObject(map);
Object taskList = jsonObject.get("taskList");
Object groupInfoList = jsonObject.get("groupInfoList");
List<GroupNoEntity> groupNoEntities = (List<GroupNoEntity>) groupInfoList;
TaskEntity taskEntity = (TaskEntity) taskList;
TaskEntity taskEntity = (TaskEntity) taskList;
YXJSONResponse yxjsonResponse = new YXJSONResponse();
resp.setCharacterEncoding("UTF-8");
......@@ -139,12 +142,13 @@ public class UserApi {
/**
* 查询证件信息;
*
* @return
*/
@RequestMapping(value = "/findCardInfoByCardIDOrAcceptNo", method = RequestMethod.GET)
@RequiresPermissions("userInfo.add")//权限管理;
@ResponseBody
public String findCardInfoByCardIDOrAcceptNo(@RequestParam("id") String id, HttpServletResponse resp) {
public String findCardInfoByCardIDOrAcceptNo(@RequestParam("id") String id, HttpServletResponse resp) {
YXJSONResponse yxjsonResponse = new YXJSONResponse();
resp.setCharacterEncoding("UTF-8");
......@@ -155,12 +159,13 @@ public class UserApi {
/**
* 添加快证任务单;
*
* @return
*/
@RequestMapping(value = "/addQuickCyclesheetInfo", method = RequestMethod.GET)
@RequiresPermissions("userInfo.add")//权限管理;
@ResponseBody
public String addQuickCyclesheetInfo(@RequestParam("id") String id, HttpServletResponse resp) {
public String addQuickCyclesheetInfo(@RequestParam("id") String id, HttpServletResponse resp) {
YXJSONResponse yxjsonResponse = new YXJSONResponse();
resp.setCharacterEncoding("UTF-8");
......@@ -201,7 +206,7 @@ public class UserApi {
@RequestMapping("/test")
@RequiresPermissions("userInfo.add")//权限管理;
@ResponseBody
public String test(@RequestParam("id") String permissionId,HttpServletResponse resp) {
public String test(@RequestParam("id") String permissionId, HttpServletResponse resp) {
//TODO
YXJSONResponse yxjsonResponse = new YXJSONResponse();
resp.setCharacterEncoding("UTF-8");
......@@ -213,66 +218,70 @@ public class UserApi {
/**
* 保存废证详情;
*
* @return
*/
@RequestMapping("addFailedinfo")
public String addFailedinfo(@RequestParam("id") String id,HttpServletResponse resp){
String map ="[{\"failedinfoid\":\"20181016002\",\"failed_Reason\":1,\"groupno\":\"41108201\",\"cyclesheetid\":\"20181016001\"}]";
public String addFailedinfo(@RequestParam("id") String id, HttpServletResponse resp) {
String map = "[{\"failedinfoid\":\"20181016002\",\"failed_Reason\":1,\"groupno\":\"41108201\",\"cyclesheetid\":\"20181016001\"}]";
JSONArray jsonArray = JSONArray.fromObject(map);
List<FailedCardEntity> failedinfoEntityList = new ArrayList<>();
for (Object object: jsonArray) {
for (Object object : jsonArray) {
FailedCardEntity o = (FailedCardEntity) JSONObject.toBean((JSONObject) object, FailedCardEntity.class);
failedinfoEntityList.add(o);
}
YXJSONResponse yxjsonResponse = new YXJSONResponse();
resp.setCharacterEncoding("UTF-8");
int i = failedCardService.saveFailedinfo(failedinfoEntityList);
yxjsonResponse.outPutSuccess(i+"添加成功");
yxjsonResponse.outPutSuccess(i + "添加成功");
return yxjsonResponse.toJSONString();
}
/**
* 更新废证详情;
* 更新废证详情;
*
* @return
*/
@RequestMapping("updateFailedinfo")
@RequiresPermissions("userInfo.add")//权限管理;
public String updateFailedinfo(@RequestParam("id") String id, HttpServletResponse resp){
String map ="[{\"failedinfoid\":\"201810302\",\"failed_Reason\":1,\"groupno\":\"411081\",\"cyclesheetid\":\"20181016001\"}]";
public String updateFailedinfo(@RequestParam("id") String id, HttpServletResponse resp) {
String map = "[{\"failedinfoid\":\"201810302\",\"failed_Reason\":1,\"groupno\":\"411081\",\"cyclesheetid\":\"20181016001\"}]";
JSONArray jsonArray = JSONArray.fromObject(map);
List<FailedCardEntity> failedinfoEntityList = new ArrayList<>();
for (Object object: jsonArray) {
for (Object object : jsonArray) {
FailedCardEntity o = (FailedCardEntity) JSONObject.toBean((JSONObject) object, FailedCardEntity.class);
failedinfoEntityList.add(o);
}
YXJSONResponse yxjsonResponse = new YXJSONResponse();
resp.setCharacterEncoding("UTF-8");
int i = failedCardService.updateFailedinfo(failedinfoEntityList);
yxjsonResponse.outPutSuccess(i+"更新成功");
yxjsonResponse.outPutSuccess(i + "更新成功");
return yxjsonResponse.toJSONString();
}
/**
* 查询废证详情;
* 查询废证详情;
*
* @return
*/
@RequestMapping("findFailedinfo")
@RequiresPermissions("userInfo.add")//权限管理;
public String findFailedinfo(@RequestParam("id") String id, HttpServletResponse resp){
public String findFailedinfo(@RequestParam("id") String id, HttpServletResponse resp) {
YXJSONResponse yxjsonResponse = new YXJSONResponse();
resp.setCharacterEncoding("UTF-8");
List<Map<String, Object>> maps = failedCardService.selectFailedinfo(Integer.valueOf(id));
yxjsonResponse.outPutSuccess(maps+"------添加成功---"+maps.size());
yxjsonResponse.outPutSuccess(maps + "------添加成功---" + maps.size());
return yxjsonResponse.toJSONString();
}
/**
* 查询任务单详情;
* 查询任务单详情;
*
* @return
*/
@RequestMapping("findProductionTaskListByState")
@RequiresPermissions("userInfo.add")//权限管理;
public String findProductionTaskListByState(@RequestParam("state") String state, HttpServletResponse resp){
public String findProductionTaskListByState(@RequestParam("state") String state, HttpServletResponse resp) {
YXJSONResponse yxjsonResponse = new YXJSONResponse();
resp.setCharacterEncoding("UTF-8");
List<Map<String, Object>> productionTaskInfoList = taskService.findProductionTaskListEntityByState(Integer.valueOf(state));
......@@ -281,12 +290,13 @@ public class UserApi {
}
/**
* 查询区县列表详情;
* 查询区县列表详情;
*
* @return
*/
@RequestMapping("findProdCountyList")
@RequiresPermissions("userInfo.add")//权限管理;
public String findProdCountyList(@RequestParam("cyclesheetID") String cyclesheetID, HttpServletResponse resp){
public String findProdCountyList(@RequestParam("cyclesheetID") String cyclesheetID, HttpServletResponse resp) {
YXJSONResponse yxjsonResponse = new YXJSONResponse();
resp.setCharacterEncoding("UTF-8");
List<Map<String, Object>> countyInfoList = groupNoService.findCountyInfoList(cyclesheetID);
......@@ -295,16 +305,17 @@ public class UserApi {
}
/**
* 保存派出所申请类型数量;
* 保存派出所申请类型数量;
*
* @return
*/
@RequestMapping("savePoliceApplyCount")
@RequiresPermissions("userInfo.add")//权限管理;
public String savePoliceApplyCount(@RequestParam("cyclesheetID") String cyclesheetID, HttpServletResponse resp){
public String savePoliceApplyCount(@RequestParam("cyclesheetID") String cyclesheetID, HttpServletResponse resp) {
YXJSONResponse yxjsonResponse = new YXJSONResponse();
resp.setCharacterEncoding("UTF-8");
int i = policeStationApplyReasonService.savePoliceStationApplyReasonEntity(cyclesheetID);
yxjsonResponse.outPutSuccess(i+"");
yxjsonResponse.outPutSuccess(i + "");
return yxjsonResponse.toJSONString();
}
......@@ -323,7 +334,7 @@ public class UserApi {
String fout = null;
List<Map<String, Object>> countyInfoList = groupNoService.findCountyInfoList(taskID);
List<TaskEntity> taskEntities = taskService.findProductionTaskListEntityByID(Long.valueOf(taskID));
fout = exportExcel(countyInfoList, taskEntities.get(0).getCard_Type()+"", "p1", 6000, taskEntities.get(0).getCitycode() ,dateTime,taskID);
fout = exportExcel(countyInfoList, taskEntities.get(0).getCard_Type() + "", "p1", 6000, taskEntities.get(0).getCitycode(), dateTime, taskID);
String outFile = dateTime + taskEntities.get(0).getCitycode() + "二代身份证统计表";
try {
FileInputStream fis = new FileInputStream(new File(fout));
......@@ -344,14 +355,14 @@ public class UserApi {
* 下载装箱单
*
* @param countyInfoList 装箱单信息
* @param typeName 制证类型
* @param workShop 制证车间
* @param sum 总数
* @param cityName 地市
* @param typeName 制证类型
* @param workShop 制证车间
* @param sum 总数
* @param cityName 地市
*/
private String exportExcel(List<Map<String, Object>> countyInfoList, String typeName, String workShop, int sum, String cityName,String permanentPositionDate ,String cyclesheetid) {
if (typeName.contains("null")){
typeName=typeName.replace("null","");
private String exportExcel(List<Map<String, Object>> countyInfoList, String typeName, String workShop, int sum, String cityName, String permanentPositionDate, String cyclesheetid) {
if (typeName.contains("null")) {
typeName = typeName.replace("null", "");
}
//第一步创建workbook
HSSFWorkbook wb = new HSSFWorkbook();
......@@ -458,8 +469,8 @@ public class UserApi {
cell.setCellValue("");
cell.setCellStyle(style);
cell = row.createCell(3);
cell.setCellValue(((Integer.parseInt(map.get("DOWNLOAD").toString()) % 250==0?Integer.parseInt(map.get("DOWNLOAD").toString()) / 250:Integer.parseInt(map.get("DOWNLOAD").toString()) / 250+1)) + "");
num += ((Integer.parseInt(map.get("DOWNLOAD").toString()) % 250==0?Integer.parseInt(map.get("DOWNLOAD").toString()) / 250:Integer.parseInt(map.get("DOWNLOAD").toString()) / 250+1));
cell.setCellValue(((Integer.parseInt(map.get("DOWNLOAD").toString()) % 250 == 0 ? Integer.parseInt(map.get("DOWNLOAD").toString()) / 250 : Integer.parseInt(map.get("DOWNLOAD").toString()) / 250 + 1)) + "");
num += ((Integer.parseInt(map.get("DOWNLOAD").toString()) % 250 == 0 ? Integer.parseInt(map.get("DOWNLOAD").toString()) / 250 : Integer.parseInt(map.get("DOWNLOAD").toString()) / 250 + 1));
cell.setCellStyle(style);
cell = row.createCell(4);
cell.setCellValue("");
......@@ -728,8 +739,8 @@ public class UserApi {
cell.setCellStyle(style);
cell = row.createCell(3);
cell.setCellStyle(style);
cell.setCellValue(((Integer.parseInt(map.get("DOWNLOAD") + "") % 250==0?Integer.parseInt(map.get("DOWNLOAD") + "") / 250:Integer.parseInt(map.get("DOWNLOAD") + "") / 250+1)) + "");
boxNum += ((Integer.parseInt(map.get("DOWNLOAD") + "") % 250==0?Integer.parseInt(map.get("DOWNLOAD") + "") / 250:Integer.parseInt(map.get("DOWNLOAD") + "") / 250+1));
cell.setCellValue(((Integer.parseInt(map.get("DOWNLOAD") + "") % 250 == 0 ? Integer.parseInt(map.get("DOWNLOAD") + "") / 250 : Integer.parseInt(map.get("DOWNLOAD") + "") / 250 + 1)) + "");
boxNum += ((Integer.parseInt(map.get("DOWNLOAD") + "") % 250 == 0 ? Integer.parseInt(map.get("DOWNLOAD") + "") / 250 : Integer.parseInt(map.get("DOWNLOAD") + "") / 250 + 1));
cell = row.createCell(4);
cell.setCellValue("");
cell.setCellStyle(style);
......@@ -921,7 +932,7 @@ public class UserApi {
cell.setCellStyle(style);
cell = row.createCell(3);
cell.setCellStyle(style);
cell.setCellValue(((Integer.parseInt(map.get("DOWNLOAD") + "") % 250==0?Integer.parseInt(map.get("DOWNLOAD") + "") / 250:Integer.parseInt(map.get("DOWNLOAD") + "") / 250+1)) + "");
cell.setCellValue(((Integer.parseInt(map.get("DOWNLOAD") + "") % 250 == 0 ? Integer.parseInt(map.get("DOWNLOAD") + "") / 250 : Integer.parseInt(map.get("DOWNLOAD") + "") / 250 + 1)) + "");
cell = row.createCell(4);
cell.setCellValue("");
cell.setCellStyle(style);
......@@ -962,7 +973,7 @@ public class UserApi {
}
cell.setCellStyle(style);
cell = row.createCell(3);
cell.setCellValue(((Integer.parseInt(map.get("DOWNLOAD") + "") % 250==0?Integer.parseInt(map.get("DOWNLOAD") + "") / 250:Integer.parseInt(map.get("DOWNLOAD") + "") / 250+1)) + "");
cell.setCellValue(((Integer.parseInt(map.get("DOWNLOAD") + "") % 250 == 0 ? Integer.parseInt(map.get("DOWNLOAD") + "") / 250 : Integer.parseInt(map.get("DOWNLOAD") + "") / 250 + 1)) + "");
cell.setCellStyle(style);
cell = row.createCell(4);
cell.setCellValue(permanentPositionDate);
......@@ -1049,7 +1060,7 @@ public class UserApi {
}
System.out.println("Excel文件生成成功..." + new Date());
return "F:\\Excel\\" + simpleDateFormat.format(new Date()) +countyInfoList.get(0).get("COUNTYNAME") + ".xls";
return "F:\\Excel\\" + simpleDateFormat.format(new Date()) + countyInfoList.get(0).get("COUNTYNAME") + ".xls";
// return "D:\\" + simpleDateFormat.format(new Date()) + list.get(0).getString("COUNTYNAME") + ".xls";
}
......
......@@ -38,10 +38,10 @@ public class MyShiroRealm extends AuthorizingRealm {
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
System.out.println("权限配置-->MyShiroRealm.doGetAuthorizationInfo()");
SimpleAuthorizationInfo authorizationInfo = new SimpleAuthorizationInfo();
UserInfo userInfo = (UserInfo)principals.getPrimaryPrincipal();
for(SysRole role:userInfo.getRoleList()){
UserInfo userInfo = (UserInfo) principals.getPrimaryPrincipal();
for (SysRole role : userInfo.getRoleList()) {
authorizationInfo.addRole(role.getRole());
for(SysPermission p:role.getPermissions()){
for (SysPermission p : role.getPermissions()) {
authorizationInfo.addStringPermission(p.getPermission());
}
}
......@@ -49,7 +49,6 @@ public class MyShiroRealm extends AuthorizingRealm {
}
/**
*
* @param token
* @return
* @throws AuthenticationException
......@@ -59,13 +58,13 @@ public class MyShiroRealm extends AuthorizingRealm {
throws AuthenticationException {
System.out.println("MyShiroRealm.doGetAuthenticationInfo()");
//获取用户的输入的账号.
String username = (String)token.getPrincipal();
String username = (String) token.getPrincipal();
System.out.println(username);
System.out.println(token.getCredentials().toString());
//通过username从数据库中查找 User对象,如果找到,没找到.
//实际项目中,这里可以根据实际情况做缓存,如果不做,Shiro自己也是有时间间隔机制,2分钟内不会重复执行该方法
UserInfo user = userInfoService.findByUsername(username);
if(user == null || user.getState()==1){
if (user == null || user.getState() == 1) {
return null;
}
SimpleAuthenticationInfo authenticationInfo = new SimpleAuthenticationInfo(
......
......@@ -33,43 +33,43 @@ import java.util.*;
@Configuration
public class ShiroConfig {
@Autowired
private MyShiroRealm realm;
@Autowired
private MyShiroRealm realm;
@Bean
public MyShiroRealm customRealm() {
return new MyShiroRealm();
}
@Bean
public MyShiroRealm customRealm() {
return new MyShiroRealm();
}
@Bean
public DefaultWebSecurityManager securityManager() {
System.out.println("添加了DefaultWebSecurityManager");
DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
securityManager.setRealm(realm);
return securityManager;
}
@Bean
public DefaultWebSecurityManager securityManager() {
System.out.println("添加了DefaultWebSecurityManager");
DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
securityManager.setRealm(realm);
return securityManager;
}
@Bean
public static DefaultAdvisorAutoProxyCreator getDefaultAdvisorAutoProxyCreator(){
@Bean
public static DefaultAdvisorAutoProxyCreator getDefaultAdvisorAutoProxyCreator() {
DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator=new DefaultAdvisorAutoProxyCreator();
defaultAdvisorAutoProxyCreator.setUsePrefix(true);
DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator = new DefaultAdvisorAutoProxyCreator();
defaultAdvisorAutoProxyCreator.setUsePrefix(true);
return defaultAdvisorAutoProxyCreator;
}
return defaultAdvisorAutoProxyCreator;
}
@Bean
public ShiroFilterChainDefinition shiroFilterChainDefinition() {
System.out.println("添加了过滤器链");
DefaultShiroFilterChainDefinition chainDefinition = new DefaultShiroFilterChainDefinition();
@Bean
public ShiroFilterChainDefinition shiroFilterChainDefinition() {
System.out.println("添加了过滤器链");
DefaultShiroFilterChainDefinition chainDefinition = new DefaultShiroFilterChainDefinition();
chainDefinition.addPathDefinition("/admin/**", "authc");
chainDefinition.addPathDefinition("/admin/**", "roles[admin]");
chainDefinition.addPathDefinition("/user/login", "anon");
chainDefinition.addPathDefinition("/user/logout", "anon");
chainDefinition.addPathDefinition("/user/**", "authc");
chainDefinition.addPathDefinition("/**", "anon");
chainDefinition.addPathDefinition("/admin/**", "authc");
chainDefinition.addPathDefinition("/admin/**", "roles[admin]");
chainDefinition.addPathDefinition("/user/login", "anon");
chainDefinition.addPathDefinition("/user/logout", "anon");
chainDefinition.addPathDefinition("/user/**", "authc");
chainDefinition.addPathDefinition("/**", "anon");
return chainDefinition;
}
return chainDefinition;
}
}
......@@ -9,7 +9,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment