Commit f89e0d06 by shenweidong

更新了装备汇总信息的相关接口

parent 438cce9b
......@@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
@RestController
......@@ -29,6 +30,22 @@ public class PubOrgController {
return returnMsg;
}
@PostMapping("/ChangeOrgState")
@ApiOperation("改变组织机构状态信息")
public ResponseResult changeOrgState(@RequestBody Map<String, Object> msg) {
//传入当前的组织机构id,展示所有本级及下级的
ResponseResult returnMsg = pubOrgService.changeOrgState(msg);
return returnMsg;
}
// @PostMapping("/ShowAllPubOrgList")
// @ApiOperation("查询组织机构列表(含禁用)")
// public ResponseResult showAllPubOrgList(@RequestBody Map<String, Object> orgId) {
// //传入当前的组织机构id,展示所有本级及下级的
// ResponseResult returnMsg = pubOrgService.showAllPubOrgList(orgId);
// return returnMsg;
// }
// @PostMapping("/ShowPubOrgListOld")
// @ApiOperation("查询组织机构列表_完整版")
// public ResponseResult showPubOrgListOld(@RequestBody Map<String, Object> orgId) {
......@@ -48,7 +65,6 @@ public class PubOrgController {
@PostMapping("/SetDName")
@ApiOperation("填充组织机构简称到数据库")
public ResponseResult setShortName(@RequestBody Map<String, Object> orgId) {
//传入当前的组织机构id,展示所有本级及下级的
ResponseResult returnMsg = pubOrgService.setShortName(orgId);
return returnMsg;
}
......@@ -56,8 +72,15 @@ public class PubOrgController {
@PostMapping("/GetOrgDetail")
@ApiOperation("查询组织机构详细信息")
public ResponseResult getOrgDetail(@RequestBody Map<String, Object> msg) {
//传入当前的组织机构id,展示所有本级及下级的
ResponseResult returnMsg = pubOrgService.getOrgDetail(msg);
return returnMsg;
}
@PostMapping("/GetLowerOrg")
@ApiOperation("获取本级及下级的组织机构")
public ResponseResult getLowerOrg(@RequestBody Map<String, Object> msg) {
String orgId = msg.get("orgId").toString();
List<String> returnMsg = pubOrgService.getLowerOrg(orgId);
return new ResponseResult(99200,"操作成功",returnMsg);
}
}
......@@ -28,7 +28,7 @@ public class PoliceFinger implements Serializable {
/**
* 指纹名称
*/
@ApiModelProperty(value = "警员id")
@ApiModelProperty(value = "指纹名称")
private String name;
/**
......
......@@ -71,10 +71,10 @@ public class PubOrg implements Serializable {
private Byte sortVal;
/**
* 状态:1-启用,2-禁用
* 状态:1-启用,0-禁用
*/
@ApiModelProperty(value="状态:1-启用,2-禁用")
private Byte statusFlag;
@ApiModelProperty(value="状态:1-启用,0-禁用")
private Integer statusFlag;
/**
* 描述
......@@ -83,9 +83,9 @@ public class PubOrg implements Serializable {
private String remark;
/**
* 删除标记:Y-已删除,N-未删除
* 删除标记:0-已删除,1-未删除
*/
@ApiModelProperty(value="删除标记:Y-已删除,N-未删除")
@ApiModelProperty(value="删除标记:0-已删除,1-未删除")
private Short delFlag;
/**
......
......@@ -22,4 +22,8 @@ public interface PubOrgMapper {
Map<String, Object> getOrgDetail(String orgId);
String getParentOrgName(Long orgParentId);
List<PubOrg> showAllPubOrgList();
void changeOrgState(@Param("statusFlag") Integer statusFlag,List<String> orgIdList);
}
\ No newline at end of file
......@@ -18,4 +18,6 @@ public interface PubOrgService{
ResponseResult setOrgParentIds();
ResponseResult getOrgDetail(Map<String, Object> orgId);
ResponseResult changeOrgState(Map<String, Object> msg);
}
......@@ -328,7 +328,6 @@ public class CabinetServiceImpl implements CabinetService {
private List<Map<String, Object>> getAllCabinetByOrg(Map<String, Object> msg, List<String> allOrgId) {
List<Map<String, Object>> allCabinet = new ArrayList<>();
System.out.println(allOrgId);
allCabinet = cabinetMapper.getAllCabinetByOrgList(allOrgId);
return allCabinet;
}
......
......@@ -50,9 +50,17 @@ public class EquipmentTypeServiceImpl implements EquipmentTypeService {
map.put("updateTime", menu.getUpdateTime());
map.put("type",menu.getType());
//如果是id和parentId都为 00000 的超级根,就将它放在映射为-1的数据中
if (menu.getId().equals("00000000-0000-0000-0000-000000000000") && menu.getParentId().equals("00000000-0000-0000-0000-000000000000")){
childrenMap.put("-1", new ArrayList<>());
childrenMap.get("-1").add(map);
continue;
}
if (!childrenMap.containsKey(menu.getParentId())) {
childrenMap.put(menu.getParentId(), new ArrayList<>());
}
childrenMap.get(menu.getParentId()).add(map);
}
......
......@@ -149,7 +149,7 @@ public class InventoryServiceImpl implements InventoryService {
public ResponseResult setInventoryMsg(){
inventoryMapper.deleteAllMsg(); //清空数据库中已存在的信息
inventoryMapper.setOrgInventory(); //放入组织机构信息汇总
//inventoryMapper.setOrgInventory(); //放入组织机构信息汇总
inventoryMapper.setCabinetInventory(); //放入组织机构信息汇总
......
......@@ -54,6 +54,7 @@ public class PubOrgServiceImpl implements PubOrgService{
map.put("parentId", menu.getOrgParentId());
map.put("findCode", menu.getFindCode());
map.put("orgName", menu.getDName());
map.put("statusFlag",menu.getStatusFlag());
if (!childrenMap.containsKey(menu.getOrgParentId())) {
childrenMap.put(menu.getOrgParentId(), new ArrayList<>());
......@@ -67,6 +68,7 @@ public class PubOrgServiceImpl implements PubOrgService{
topMap.put("parentId", menu.getOrgParentId());
topMap.put("findCode", menu.getFindCode());
topMap.put("orgName", menu.getDName());
topMap.put("statusFlag",menu.getStatusFlag());
topList.add(topMap);
}
}
......@@ -139,10 +141,11 @@ public class PubOrgServiceImpl implements PubOrgService{
for (Map<String, Object> item : list) {
// 获取当前节点的ID
Map<String,Object> setMsg = new HashMap<>();
setMsg.put("id", Long.valueOf(item.get("id").toString()));
setMsg.put("id", item.get("id").toString() + "-0"); //在最后面加个 -0 来表示列表的唯一id
setMsg.put("parentId", item.get("parentId").toString());
setMsg.put("findCode", item.get("findCode").toString());
setMsg.put("orgName", item.get("orgName").toString());
setMsg.put("statusFlag",item.get("statusFlag"));
// 将当前节点的ID添加到子节点的第一个位置
@SuppressWarnings("unchecked")
......@@ -260,7 +263,7 @@ public class PubOrgServiceImpl implements PubOrgService{
@Override
public List<String> getLowerOrg(String orgId) {
//构建 Redis 缓存键
String redisKey = "showPubOrgList_"+orgId;
String redisKey = "getLowerOrg";
// 从 Redis 中获取数据
List<PubOrg> cachedData = redisUtils.findCachedData(redisKey);
......@@ -275,6 +278,8 @@ public class PubOrgServiceImpl implements PubOrgService{
List<String> resultList = new ArrayList<>(); // 存储最终的菜单树结果
Map<Long, List<String>> childrenMap = new HashMap<>(); // 存储每个菜单项的子菜单映射
resultList.add(orgId); //将自己加入到返回的List中
// 构建子菜单映射表
for (PubOrg menu : menuList) {
String org = menu.getOrgId().toString();
......@@ -285,7 +290,8 @@ public class PubOrgServiceImpl implements PubOrgService{
childrenMap.get(menu.getOrgParentId()).add(org); // 将当前菜单项放入对应的子菜单列表中
}
BigInteger orgInfo = new BigInteger(orgId); // 获取顶级菜单的标识符
Long orgInfo = Long.valueOf(orgId);//获取输入的组织机构id信息
//Long orgInfo = new BigInteger(orgId); // 获取顶级菜单的标识符
// 获取顶级菜单
List<String> topMenus = childrenMap.get(orgInfo);
......@@ -437,6 +443,21 @@ public class PubOrgServiceImpl implements PubOrgService{
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);
}
}
......
......@@ -105,13 +105,10 @@
c.out_sum as outSum
from base_cabinet c
left join pub_org o on c.org_id_int =o.org_id
where c.org_id_int in
where c.org_id_int in
<foreach item="item" collection="list" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<update id="setCabinetSumInventory">
......
......@@ -115,73 +115,78 @@ GROUP BY bi.org_id_int, bi.type_id, bi.size_id;
</insert>
<insert id="setCabinetInventory">
INSERT INTO base_inventory_summary (id,location_id,location_name,type_id,type_name,size_id,size_name,number, price, stock_number, outbound_number,location_type)
INSERT INTO base_inventory_summary (id,org_id_int,org_name,location_id,location_name,type_id,type_name,size_id,size_name,number, price, stock_number, outbound_number,location_type)
SELECT
UUID() as id,
bi.location_id,
bc.name as '单警柜名称',
bi.org_id_int as orgIdInt,
po.org_name as orgName,
bi.location_id as locationId,
bc.name as locationName,
bi.type_id,
t.name as '装备名称',
t.name as typeName,
bi.size_id,
s.name as '号型名称',
s.name as sizeName,
count(*) as 'number',
sum(bi.price) as 'price',
SUM(CASE WHEN location_state = 'in' THEN 1 ELSE 0 END) AS 'stock_number',
count(*) - SUM(CASE WHEN location_state = 'in' THEN 1 ELSE 0 END) AS 'outbound_number',
SUM(CASE WHEN location_state = 'in' THEN 1 ELSE 0 END) AS 'stockNumber',
count(*) - SUM(CASE WHEN location_state = 'in' THEN 1 ELSE 0 END) AS 'outboundNumber',
bi.location_type
FROM base_inventory bi
join base_cabinet_box bcb on bi.location_id = bcb.id
join base_cabinet bc on bcb.cabinet_id = bc.id
join base_equipment_type t on t.id = bi.type_id
join base_equipment_size s on s.id = bi.size_id
join pub_org po on bi.org_id_int = po.org_id
WHERE location_id IN (
SELECT location_id
FROM base_inventory
GROUP BY location_id,type_id
having type_id in(
SELECT
type_id as '装备类型id'
type_id as 'typeId'
FROM base_inventory b
GROUP BY type_id
)
)
and location_type = 1
GROUP BY location_id, type_id,size_id;
GROUP BY location_id, type_id,size_id,bi.org_id_int;
</insert>
<insert id="setWarehouseInventory">
INSERT INTO base_inventory_summary (id,location_id, location_name,type_id, type_name,size_id,size_name, number, price, stock_number, outbound_number,location_type)
INSERT INTO base_inventory_summary (id,org_id_int,org_name,location_id, location_name,type_id, type_name,size_id,size_name, number, price, stock_number, outbound_number,location_type)
SELECT
UUID() as id,
bi.location_id,
bw.name,
bi.org_id_int as orgIdInt,
po.org_name as orgName,
bi.location_id as locationId,
bw.name as locationName,
bi.type_id,
t.name,
t.name as typeName,
bi.size_id,
s.name,
s.name as sizeName,
count(*) as 'number',
sum(bi.price) as 'price',
SUM(CASE WHEN location_state = 'in' THEN 1 ELSE 0 END) AS 'stock_number',
count(*) - SUM(CASE WHEN location_state = 'in' THEN 1 ELSE 0 END) AS 'outbound_number',
SUM(CASE WHEN location_state = 'in' THEN 1 ELSE 0 END) AS 'stockNumber',
count(*) - SUM(CASE WHEN location_state = 'in' THEN 1 ELSE 0 END) AS 'outboundNumber',
bi.location_type
FROM base_inventory bi
join base_warehouse bw on bi.location_id = bw.id
join base_equipment_type t on t.id = bi.type_id
join base_equipment_size s on s.id = bi.size_id
join pub_org po on bi.org_id_int = po.org_id
WHERE location_id IN (
SELECT location_id
FROM base_inventory
GROUP BY location_id,type_id
having type_id in(
SELECT
type_id as '装备类型id'
type_id as 'typeId'
FROM base_inventory b
GROUP BY type_id
)
)
and location_type = 0
GROUP BY location_id, type_id,size_id;
GROUP BY location_id, type_id,size_id,bi.org_id_int;
</insert>
<select id="getInventoryList" resultType="Map">
......@@ -222,4 +227,11 @@ join base_supplier s on s.id = i.supplier_id
and size_id = #{sizeId}
</select>
<select id="getInventoryByOrgId" resultType="Map">
select
*
from base_inventory i
where org_id_int =#{orgId}
</select>
</mapper>
\ No newline at end of file
......@@ -32,9 +32,28 @@
</sql>
<select id="selectAllOrg" resultType="com.junmp.jyzb.domain.PubOrg">
SELECT org_id,org_parent_id,org_name,d_name,find_code as findCode
SELECT
IFNULL(org_id, 'null') as orgId,
IFNULL(org_parent_id, 'null') as orgParentId,
IFNULL(org_name, 'null') as orgName,
IFNULL(d_name, 'null') as dName,
IFNULL(find_code, 'null') as findCode,
IFNULL(status_flag, 'null') as statusFlag
FROM
pub_org
WHERE
del_flag = 1;
</select>
<select id="showAllPubOrgList" resultType="com.junmp.jyzb.domain.PubOrg">
SELECT org_id,
IFNULL(org_id, 'null') as orgId,
IFNULL(org_parent_id, 'null') as orgParentId,
IFNULL(org_name, 'null') as orgName,
IFNULL(d_name, 'null') as dName,
IFNULL(find_code, 'null') as findCode,
IFNULL(del_flag, 'null') as delFlag
FROM pub_org
where del_flag = 1
</select>
<select id="getOnePubOrg" resultType="Long">
......@@ -99,4 +118,13 @@ SET p.org_parent_ids = cte.org_parent_ids;
<select id="getParentOrgName" resultType="String">
select d_name from pub_org o where org_id =#{orgParentId}
</select>
<update id="changeOrgState">
UPDATE pub_org
SET status_flag = #{statusFlag}
WHERE org_id IN
<foreach item="item" collection="orgIdList" open="(" separator="," close=")">
#{item}
</foreach>
</update>
</mapper>
\ No newline at end of file
......@@ -109,7 +109,7 @@
where w.org_id_int in
<foreach item="item" collection="list" open="(" separator="," close=")">
#{item}
</foreach>
</foreach>
</select>
<update id="setWarehouseSumInventory">
......
......@@ -4,7 +4,9 @@
<facet type="jpa" name="JPA">
<configuration>
<setting name="validation-enabled" value="true" />
<datasource-mapping />
<datasource-mapping>
<factory-entry name="jyzb-boot" />
</datasource-mapping>
<naming-strategy-map />
</configuration>
</facet>
......
......@@ -13,7 +13,7 @@ import java.util.Map;
@RabbitListener(queues = "TestDirectQueue") //监听的队列名称 TestDirectQueue
public class DirectReceiver {
@RabbitHandler
public void process(Map testMessage) {
System.out.println("DirectReceiver消费者收到消息 : " + testMessage.toString());
public void process(Object testMessage) {
System.out.println("DirectReceiver消费者收到消息 : " + testMessage);
}
}
\ No newline at end of file
server:
port: 8090
spring:
#配置rabbitMq 服务器
rabbitmq:
host: 192.168.3.188
port: 5672
username: root
password: 123456
#虚拟host 可以不设置,使用server默认host
virtual-host: /
artifactId=jyzb-mq-consumer
groupId=com.junmp.jyzb
version=1.0.0
com\junmp\jyzb\controller\SendMsgController.class
com\junmp\jyzb\config\DirectRabbitConfig.class
com\junmp\jyzb\MqConsumerApplication.class
com\junmp\jyzb\config\DirectReceiver.class
D:\java-project\jyzb-platform\jyzb_platform\jyzb-mq\jyzb-mq-consumer\src\main\java\com\junmp\jyzb\config\DirectReceiver.java
D:\java-project\jyzb-platform\jyzb_platform\jyzb-mq\jyzb-mq-consumer\src\main\java\com\junmp\jyzb\config\DirectRabbitConfig.java
D:\java-project\jyzb-platform\jyzb_platform\jyzb-mq\jyzb-mq-consumer\src\main\java\com\junmp\jyzb\MqConsumerApplication.java
D:\java-project\jyzb-platform\jyzb_platform\jyzb-mq\jyzb-mq-consumer\src\main\java\com\junmp\jyzb\controller\SendMsgController.java
......@@ -32,8 +32,10 @@ public class SendMsgController {
@PostMapping("/send")
public String sendMessage() {
//生成当前时间
String createTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
try {
//将记录当前时间的信息发送到消息队列
rabbitTemplate.convertAndSend("TestDirectExchange", "TestDirectRouting", "消息发送的时间为:" + createTime);
return "消息发送成功";
} catch (Exception e) {
......
server:
port: 9001
spring:
#配置rabbitMq 服务器
rabbitmq:
host: 192.168.3.188
port: 5672
username: root
password: 123456
#虚拟host 可以不设置,使用server默认host
virtual-host: /
artifactId=jyzb-mq-producer
groupId=com.junmp.jyzb
version=1.0.0
com\junmp\jyzb\controller\SendMsgController.class
com\junmp\jyzb\MqProducerApplication.class
com\junmp\jyzb\config\DirectRabbitConfig.class
D:\java-project\jyzb-platform\jyzb_platform\jyzb-mq\jyzb-mq-producer\src\main\java\com\junmp\jyzb\controller\SendMsgController.java
D:\java-project\jyzb-platform\jyzb_platform\jyzb-mq\jyzb-mq-producer\src\main\java\com\junmp\jyzb\config\DirectRabbitConfig.java
D:\java-project\jyzb-platform\jyzb_platform\jyzb-mq\jyzb-mq-producer\src\main\java\com\junmp\jyzb\MqProducerApplication.java
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论