Commit f89e0d06 by shenweidong

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

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