Commit c39fc72c by 李小惠

合并-2

parent a4ca2be4
package com.junmp.jyzb.controller;
import com.junmp.jyzb.api.bean.req.ProductReq;
import com.junmp.jyzb.beanReq.CabinetReq;
import com.junmp.jyzb.doc.CabinetDoc;
import com.junmp.jyzb.domain.Cabinet;
import com.junmp.jyzb.domain.PoliceFinger;
import com.junmp.jyzb.service.CabinetService;
import com.junmp.v2.common.bean.request.ValidationApi;
import com.junmp.v2.common.bean.response.ApiRes;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
@RestController
@Slf4j
@RequestMapping("/Cabinet")
@Api(tags = "单警柜基础信息模块")
public class CabinetController111 implements CabinetDoc {
@Resource
public CabinetService cabinetService;
@PostMapping("/AddCabinet")
@ApiOperation("添加单警柜")
public ApiRes<Boolean> addCabinet(@RequestBody @Validated(CabinetReq.add.class) CabinetReq req) throws Exception {
return ApiRes.success(cabinetService.addCabinet(req));
}
@PostMapping("/DeleteCabinet")
@ApiOperation("删除单警柜信息")
public ApiRes<Boolean> deleteCabinet(@RequestBody @Validated(ValidationApi.edit.class) CabinetReq req) throws Exception {
return ApiRes.success(cabinetService.deleteCabinet(req));
}
@PostMapping("/ShowCabinet")
@ApiOperation("查询单警柜列表")
public ApiRes<List<Cabinet>> showCabinet(@RequestBody @Validated(ValidationApi.edit.class) CabinetReq req,String includeLowerLevel){
return ApiRes.success(cabinetService.getAllCabinet(req,includeLowerLevel));
}
@PostMapping("/UpdateCabinet")
@ApiOperation("修改单警柜信息")
public ApiRes<Boolean> updateCabinet(@RequestBody @Validated(ValidationApi.edit.class) CabinetReq req) throws Exception {
return ApiRes.success(cabinetService.updateCabinet(req));
}
// @PostMapping("/ErrorState")
// @ApiOperation("单警柜状态变更")
// @PostMapping("/GetCabinetDetail")
// @ApiOperation("查询单警柜及其箱号信息")
// @PostMapping("/getCabinetBoxInfo")
// @ApiOperation("获取箱门列表")
}
//package com.junmp.jyzb.controller;
//
//import com.junmp.jyzb.api.bean.req.ProductReq;
//import com.junmp.jyzb.beanReq.CabinetReq;
//import com.junmp.jyzb.doc.CabinetDoc;
//import com.junmp.jyzb.domain.Cabinet;
//import com.junmp.jyzb.domain.PoliceFinger;
//import com.junmp.jyzb.service.CabinetService;
//import com.junmp.v2.common.bean.request.ValidationApi;
//import com.junmp.v2.common.bean.response.ApiRes;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.validation.annotation.Validated;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import javax.annotation.Resource;
//import java.util.List;
//
//@RestController
//@Slf4j
//@RequestMapping("/Cabinet")
//@Api(tags = "单警柜基础信息模块")
//public class CabinetController111 implements CabinetDoc {
// @Resource
// public CabinetService cabinetService;
//
// @PostMapping("/AddCabinet")
// @ApiOperation("添加单警柜")
// public ApiRes<Boolean> addCabinet(@RequestBody @Validated(CabinetReq.add.class) CabinetReq req) throws Exception {
// return ApiRes.success(cabinetService.addCabinet(req));
// }
//
//
// @PostMapping("/DeleteCabinet")
// @ApiOperation("删除单警柜信息")
// public ApiRes<Boolean> deleteCabinet(@RequestBody @Validated(ValidationApi.edit.class) CabinetReq req) throws Exception {
// return ApiRes.success(cabinetService.deleteCabinet(req));
// }
//
// @PostMapping("/ShowCabinet")
// @ApiOperation("查询单警柜列表")
// public ApiRes<List<Cabinet>> showCabinet(@RequestBody @Validated(ValidationApi.edit.class) CabinetReq req,String includeLowerLevel){
// return ApiRes.success(cabinetService.getAllCabinet(req,includeLowerLevel));
// }
//
//
// @PostMapping("/UpdateCabinet")
// @ApiOperation("修改单警柜信息")
// public ApiRes<Boolean> updateCabinet(@RequestBody @Validated(ValidationApi.edit.class) CabinetReq req) throws Exception {
// return ApiRes.success(cabinetService.updateCabinet(req));
// }
//
//
//// @PostMapping("/ErrorState")
//// @ApiOperation("单警柜状态变更")
//
//
//// @PostMapping("/GetCabinetDetail")
//// @ApiOperation("查询单警柜及其箱号信息")
//
//// @PostMapping("/getCabinetBoxInfo")
//// @ApiOperation("获取箱门列表")
//}
......@@ -30,12 +30,12 @@ public class PubOrgServiceImpl extends ServiceImpl<PubOrgMapper, PubOrg> implem
private RedisUtils redisUtils;
public ResponseResult showPubOrgList(Map<String, Object> orgId) {
// 构建 Redis 缓存
// 构建 Redis 缓存
String redisKey = "showPubOrgList";
Long orgInfo = Long.valueOf(orgId.get("orgId").toString());//获取输入的组织机构id信息
// Redis 中获取数
// �Redis 中获取数�
List<PubOrg> cachedData = redisUtils.findCachedData(redisKey);
List<PubOrg> menuList = new ArrayList<>();
if (cachedData != null) {
......@@ -63,7 +63,7 @@ public class PubOrgServiceImpl extends ServiceImpl<PubOrgMapper, PubOrg> implem
}
childrenMap.get(menu.getOrgParentId()).add(map);
//构建最顶级的菜
//构建最顶级的菜
if (menu.getOrgId().equals(orgInfo)){
Map<String, Object> topMap = new HashMap<>();
topMap.put("id", menu.getOrgId());
......@@ -77,14 +77,14 @@ public class PubOrgServiceImpl extends ServiceImpl<PubOrgMapper, PubOrg> implem
// 获取顶级菜单
List<Map<String, Object>> topMenus = childrenMap.get(orgInfo);
// 迭代构建菜单
// 迭代构建菜单
if (topMenus != null) {
for (Map<String, Object> topMenu : topMenus) {
Stack<Map<String, Object>> stack = new Stack<>();
stack.push(topMenu);
// 使用栈进行深度优先遍
// 使用栈进行深度优先遍
while (!stack.isEmpty()) {
Map<String, Object> currentMenu = stack.pop();
Long currentMenuId = (Long) currentMenu.get("id");
......@@ -103,7 +103,7 @@ public class PubOrgServiceImpl extends ServiceImpl<PubOrgMapper, PubOrg> implem
}
if (orgInfo == -1) {
// 如果输入的是浙江省公安厅,就将下级的组织机构进行排
// 如果输入的是浙江省公安厅,就将下级的组织机构进行排
for (Map<String, Object> orgMsg : resultList) {
List<Map<String, Object>> children = (List<Map<String, Object>>) orgMsg.get("children");
// 根据findCode从小到大排序
......@@ -122,16 +122,16 @@ public class PubOrgServiceImpl extends ServiceImpl<PubOrgMapper, PubOrg> implem
}
//topList = setParentMsg(topList);
// 遍历并添加父类的相关信息到children的第一个位
// 遍历并添加父类的相关信息到children的第一个位
traverseList(topList);
// 返回结果
return new ResponseResult(HttpStatus.SUCCESS, "操作成功", topList);
}
//将父类信息放在children的第一个位
//将父类信息放在children的第一个位
public static List<Map<String,Object>> setParentMsg(List<Map<String,Object>> resultList){
// 遍历并添加父类的相关信息到children的第一个位
// 遍历并添加父类的相关信息到children的第一个位
for (Map<String, Object> data : resultList) {
List<Map<String, Object>> children = (List<Map<String, Object>>) data.get("children");
if (!children.isEmpty()) {
......@@ -192,10 +192,10 @@ public class PubOrgServiceImpl extends ServiceImpl<PubOrgMapper, PubOrg> implem
* */
@Override
public ResponseResult showPubOrgListOld(Map<String, Object> orgId) {
//构建 Redis 缓存
//构建 Redis 缓存
String redisKey = "showPubOrgList";
// Redis 中获取数
// �Redis 中获取数�
List<PubOrg> cachedData = redisUtils.findCachedData(redisKey);
List<PubOrg> menuList = new ArrayList<>();
if (cachedData!=null){
......@@ -225,7 +225,7 @@ public class PubOrgServiceImpl extends ServiceImpl<PubOrgMapper, PubOrg> implem
// 获取顶级菜单
List<Map<String, Object>> topMenus = childrenMap.get(orgInfo);
// 迭代构建菜单
// 迭代构建菜单
if (topMenus != null) {
for (Map<String, Object> topMenu : topMenus) {
Stack<Map<String, Object>> stack = new Stack<>();
......@@ -255,10 +255,10 @@ public class PubOrgServiceImpl extends ServiceImpl<PubOrgMapper, PubOrg> implem
@Override
public List<String> getLowerOrg(String orgId) {
//构建 Redis 缓存
//构建 Redis 缓存
String redisKey = "showPubOrgList_"+orgId;
// Redis 中获取数
// �Redis 中获取数�
List<PubOrg> cachedData = redisUtils.findCachedData(redisKey);
List<PubOrg> menuList = new ArrayList<>();
if (cachedData!=null){
......@@ -268,8 +268,8 @@ public class PubOrgServiceImpl extends ServiceImpl<PubOrgMapper, PubOrg> implem
redisUtils.set(redisKey, menuList);
}
List<String> resultList = new ArrayList<>(); // 存储最终的菜单树结
Map<Long, List<String>> childrenMap = new HashMap<>(); // 存储每个菜单项的子菜单映
List<String> resultList = new ArrayList<>(); // 存储最终的菜单树结
Map<Long, List<String>> childrenMap = new HashMap<>(); // 存储每个菜单项的子菜单映
// 构建子菜单映射表
for (PubOrg menu : menuList) {
......@@ -278,7 +278,7 @@ public class PubOrgServiceImpl extends ServiceImpl<PubOrgMapper, PubOrg> implem
if (!childrenMap.containsKey(menu.getOrgParentId())) { // 如果父菜单还不存在于映射表中
childrenMap.put(menu.getOrgParentId(), new ArrayList<>()); // 创建一个新的子菜单列表
}
childrenMap.get(menu.getOrgParentId()).add(org); // 将当前菜单项放入对应的子菜单列表
childrenMap.get(menu.getOrgParentId()).add(org); // 将当前菜单项放入对应的子菜单列表
}
BigInteger orgInfo = new BigInteger(orgId); // 获取顶级菜单的标识符
......@@ -286,18 +286,18 @@ public class PubOrgServiceImpl extends ServiceImpl<PubOrgMapper, PubOrg> implem
// 获取顶级菜单
List<String> topMenus = childrenMap.get(orgInfo);
// 迭代构建菜单
// 迭代构建菜单
if (topMenus != null) {
Queue<String> queue = new LinkedList<>(); // 使用队列结构辅助构建菜单
queue.addAll(topMenus); // 将当前顶级菜单项放入队列
Queue<String> queue = new LinkedList<>(); // 使用队列结构辅助构建菜单
queue.addAll(topMenus); // 将当前顶级菜单项放入队列
while (!queue.isEmpty()) {
String currentMenu = queue.poll(); // 取出队首的当前菜单项
//Long currentMenuId = currentMenu; // 获取当前菜单项的标识
//Long currentMenuId = currentMenu; // 获取当前菜单项的标识
if (childrenMap.containsKey(currentMenu)) { // 如果当前菜单项有子菜
List<String> children = childrenMap.get(currentMenu); // 获取子菜单列
//currentMenu.put("children", children); // 将子菜单列表放入当前菜单项中children"字段
if (childrenMap.containsKey(currentMenu)) { // 如果当前菜单项有子菜
List<String> children = childrenMap.get(currentMenu); // 获取子菜单列
//currentMenu.put("children", children); // 将子菜单列表放入当前菜单项中children"字段
queue.addAll(children); // 将子菜单项放入队列中
}
......@@ -329,24 +329,24 @@ public class PubOrgServiceImpl extends ServiceImpl<PubOrgMapper, PubOrg> implem
map.put("id", menu.getOrgId());
map.put("parentId", menu.getOrgParentId());
//去掉前缀
String name1 = menu.getOrgName(); //name1 ,获得“浙江省公安厅
String name1 = menu.getOrgName(); //name1 ,获得“浙江省公安厅
//List<String> name2 = null;
List<String> name2 = new ArrayList<>();
//name3为固定字
//name3为固定字
List<String> name3 = new ArrayList<>();
name3.add("公安局");
name3.add("公安");
name3.add("分局");
if (menu.getOrgName().length()>3 && name2.size() <2 && (menu.getOrgName().charAt(2)==' ||menu.getOrgName().charAt(2)==')){
String nameHistory = menu.getOrgName().substring(0,3); //name2 ,获得“浙江省
if (menu.getOrgName().length()>3 && name2.size() <2 && (menu.getOrgName().charAt(2)=='省' ||menu.getOrgName().charAt(2)=='市')){
String nameHistory = menu.getOrgName().substring(0,3); //name2 ,获得“浙江省
name2.add(nameHistory);
name2.add(" ");
name2.add(" ");
}
if (menu.getOrgName().length()>3 && (menu.getOrgName().charAt(2)==')){
if (menu.getOrgName().length()>3 && (menu.getOrgName().charAt(2)=='区')){
name2.remove(2);
String nameHistory = menu.getOrgName().substring(0,3);
name2.add(2,nameHistory);
......@@ -393,13 +393,13 @@ public class PubOrgServiceImpl extends ServiceImpl<PubOrgMapper, PubOrg> implem
}
}
map.put("orgName", result);
if (result.length()>3 && (result.charAt(2)==' ||result.charAt(2)==')){
if (result.length()>3 && (result.charAt(2)=='省' ||result.charAt(2)=='市')){
name2.remove(1);
String nameHistory = result.substring(0,3); //获得“绍兴市
String nameHistory = result.substring(0,3); //获得“绍兴市
name2.add(1,nameHistory);
}
if (result.length()>3 && (result.charAt(2)==' ||result.charAt(2)==')){
if (result.length()>3 && (result.charAt(2)=='区' ||result.charAt(2)=='县')){
name2.remove(2);
String nameHistory = result.substring(0,3);
name2.add(2,nameHistory);
......@@ -433,6 +433,20 @@ public class PubOrgServiceImpl extends ServiceImpl<PubOrgMapper, PubOrg> implem
Map<String,Object> resultList = pubOrgMapper.getOrgDetail(orgId);
return new ResponseResult(HttpStatus.SUCCESS, "操作成功", resultList);
}
@Override
public ResponseResult changeOrgState(Map<String, Object> msg) {
try {
checkNotBlank(msg.get("statusFlag"), "statusFlag不能为空");
checkNotBlank(msg.get("orgIdList"), "orgIdList不能为空");
} catch (IllegalArgumentException e) {
return new ResponseResult(HttpStatus.ERROR, ReturnMsg.ERROR,e.getMessage());
}
List<String> orgIdList = (List<String>) msg.get("orgIdList");
Integer statusFlag = (Integer) msg.get("statusFlag");
pubOrgMapper.changeOrgState(statusFlag,orgIdList);
return new ResponseResult(HttpStatus.SUCCESS,ReturnMsg.PASS);
}
}
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.junmp.jyzb.mapper.CabinetMapper">
<resultMap id="" type="">
<!-- <resultMap id="" type="">-->
</resultMap>
<!-- </resultMap>-->
<sql id="Base_Column_List">
......
......@@ -226,15 +226,13 @@ join base_supplier s on s.id = i.supplier_id
</if>
and size_id = #{sizeId}
</select>
<select id="getInventoryByOrgId" resultType="java.util.Map" parameterType="java.lang.String">
select * from base_inventory where org_id_int = #{orgId}
</select>
<select id="getInventoryByOrgId" resultType="Map">
select
*
from base_inventory i
where org_id_int =#{orgId}
</select>
<!--<select id="getInventoryByOrgId" resultType="Map">-->
<!--select-->
<!-- *-->
<!--from base_inventory i-->
<!--where org_id_int =#{orgId}-->
<!--</select>-->
</mapper>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论