消息管理联调以及大屏接口开发
This commit is contained in:
parent
f9545167b8
commit
ae9d118c49
|
|
@ -120,6 +120,22 @@ public class BmMessageController extends BaseController {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改消息
|
||||
*/
|
||||
@ApiOperation(value = "全部已读修改")
|
||||
@PreventRepeatSubmit
|
||||
//@RequiresPermissions("basic:message:edit")
|
||||
@SysLog(title = "消息", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改消息")
|
||||
@PostMapping("/editAll")
|
||||
public AjaxResult editAll(@RequestBody BmMessage bmMessage) {
|
||||
try {
|
||||
return toAjax(bmMessageService.updateBmMessageAll(bmMessage));
|
||||
} catch (Exception e) {
|
||||
return error("系统错误, " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除消息
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -57,6 +57,11 @@ public class BmMessage extends BaseEntity {
|
|||
@ApiModelProperty(value = "来自companyId")
|
||||
private Long fromCompany;
|
||||
|
||||
/** 来自companyId */
|
||||
@Excel(name = "来自companyId")
|
||||
@ApiModelProperty(value = "来自companyId")
|
||||
private Long[] fromCompanys;
|
||||
|
||||
/** 来自companyName */
|
||||
@Excel(name = "来自companyName")
|
||||
@ApiModelProperty(value = "来自companyName")
|
||||
|
|
|
|||
|
|
@ -45,6 +45,8 @@ public interface IBmMessageService {
|
|||
*/
|
||||
public int updateBmMessage(BmMessage bmMessage);
|
||||
|
||||
public int updateBmMessageAll(BmMessage bmMessage);
|
||||
|
||||
/**
|
||||
* 批量删除消息
|
||||
*
|
||||
|
|
|
|||
|
|
@ -2,21 +2,15 @@ package com.bonus.material.basic.service.impl;
|
|||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONReader;
|
||||
import com.bonus.common.biz.constant.MaterialConstants;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.utils.SpringUtils;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.redis.service.RedisService;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.system.api.domain.SysDictData;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.bonus.material.basic.mapper.BmMessageMapper;
|
||||
|
|
@ -27,7 +21,7 @@ import javax.annotation.Resource;
|
|||
|
||||
@Service
|
||||
public class BmMessageServiceImpl implements IBmMessageService {
|
||||
@Autowired
|
||||
@Resource
|
||||
private BmMessageMapper bmMessageMapper;
|
||||
|
||||
@Resource
|
||||
|
|
@ -71,7 +65,20 @@ public class BmMessageServiceImpl implements IBmMessageService {
|
|||
List<BmMessage> sortedList = result.stream()
|
||||
.sorted(Comparator.comparing(BmMessage::getCreateTime))
|
||||
.collect(Collectors.toList());
|
||||
return sortedList.subList(0,1);
|
||||
Optional<BmMessage> lastElement = sortedList.stream()
|
||||
.reduce((first, second) -> second);
|
||||
String messageContent = lastElement.map(BmMessage::getMessageContent)
|
||||
.orElse("");
|
||||
Integer isRead = lastElement.map(BmMessage::getIsRead)
|
||||
.orElse(0);
|
||||
if (sortedList.size() > 0) {
|
||||
List<BmMessage> messages = sortedList.subList(0, 1);
|
||||
messages.get(0).setMessageContent(messageContent);
|
||||
messages.get(0).setIsRead(isRead);
|
||||
return messages;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public List<BmMessage> selectBmMessageListFromCacheOne(BmMessage bmMessage) {
|
||||
|
|
@ -106,9 +113,10 @@ public class BmMessageServiceImpl implements IBmMessageService {
|
|||
bmMessage.setFromCompany(companyId);
|
||||
bmMessage.setFromUser(SecurityUtils.getLoginUser().getSysUser().getUserId());
|
||||
bmMessage.setUuid(String.valueOf(UUID.randomUUID()));
|
||||
bmMessage.setIsRead(0);
|
||||
String msgKey = MaterialConstants.CACHE_MATERIAL_MALL_MESSAGE + companyId + ":" + bmMessage.getToCompany();
|
||||
JSONArray arrayCache = SpringUtils.getBean(RedisService.class).getCacheObject(msgKey);
|
||||
if (arrayCache == null){
|
||||
if (arrayCache == null) {
|
||||
arrayCache = new JSONArray();
|
||||
}
|
||||
List<BmMessage> list = arrayCache.toList(BmMessage.class);
|
||||
|
|
@ -142,7 +150,7 @@ public class BmMessageServiceImpl implements IBmMessageService {
|
|||
for (String key : keys) {
|
||||
JSONArray arrayCache = SpringUtils.getBean(RedisService.class).getCacheObject(key);
|
||||
List<BmMessage> list = arrayCache.toList(BmMessage.class);
|
||||
list.stream().forEach(t->t.setIsRead(1));
|
||||
list.stream().forEach(t -> t.setIsRead(1));
|
||||
SpringUtils.getBean(RedisService.class).setCacheObject(key, list);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
|
@ -151,6 +159,33 @@ public class BmMessageServiceImpl implements IBmMessageService {
|
|||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateBmMessageAll(BmMessage bmMessage) {
|
||||
bmMessage.setIsRead(1);
|
||||
bmMessage.setUpdateTime(DateUtils.getNowDate());
|
||||
Long companyId = SecurityUtils.getLoginUser().getSysUser().getCompanyId();
|
||||
bmMessage.setToCompany(companyId);
|
||||
for (Long fromCompany : bmMessage.getFromCompanys()) {
|
||||
try {
|
||||
bmMessage.setFromCompany(fromCompany);
|
||||
bmMessageMapper.updateBmMessage(bmMessage);
|
||||
//Redis
|
||||
Collection<String> keys1 = SpringUtils.getBean(RedisService.class).keys(MaterialConstants.CACHE_MATERIAL_MALL_MESSAGE + fromCompany + ":" + companyId);
|
||||
List<String> keys = new ArrayList<>();
|
||||
keys.addAll(keys1);
|
||||
for (String key : keys) {
|
||||
JSONArray arrayCache = SpringUtils.getBean(RedisService.class).getCacheObject(key);
|
||||
List<BmMessage> list = arrayCache.toList(BmMessage.class);
|
||||
list.stream().forEach(t -> t.setIsRead(1));
|
||||
SpringUtils.getBean(RedisService.class).setCacheObject(key, list);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("错误信息描述");
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除消息
|
||||
*
|
||||
|
|
|
|||
|
|
@ -191,5 +191,7 @@ public interface DevInfoMapper {
|
|||
List<DevInfoVo> getDevList(DevInfoVo devInfo);
|
||||
|
||||
DevInfo getDevStatus(DevInfoVo devInfoVo);
|
||||
|
||||
Integer getTodayDevCount();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,60 @@
|
|||
package com.bonus.material.largeScreen.controller;
|
||||
|
||||
import com.bonus.common.biz.domain.TypeInfo;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.device.mapper.DevInfoMapper;
|
||||
import com.bonus.material.largeScreen.entity.OrderData;
|
||||
import com.bonus.material.lease.mapper.MaLeaseInfoMapper;
|
||||
import com.bonus.material.order.mapper.OrderMapper;
|
||||
import com.bonus.material.order.service.OrderService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @Author:liang.chao
|
||||
* @Date:2024/12/24 - 15:46
|
||||
*/
|
||||
|
||||
@Api(value = "大屏", tags = {"大屏"})
|
||||
@RestController
|
||||
@RequestMapping("/largeScreen")
|
||||
public class LargeScreenController {
|
||||
@Resource
|
||||
private OrderService orderService;
|
||||
@Resource
|
||||
private OrderMapper orderMapper;
|
||||
|
||||
@Resource
|
||||
private DevInfoMapper devInfoMapper;
|
||||
|
||||
@Resource
|
||||
private MaLeaseInfoMapper leaseInfoMapper;
|
||||
|
||||
|
||||
@ApiOperation("订单数据")
|
||||
@GetMapping("/orderData")
|
||||
public AjaxResult getOrderData() {
|
||||
return AjaxResult.success(orderService.getOrderData());
|
||||
}
|
||||
|
||||
@ApiOperation("各单位租金排行")
|
||||
@GetMapping("/comCost")
|
||||
public AjaxResult getCompanysCost() {
|
||||
return AjaxResult.success(orderService.getCompanysCost());
|
||||
}
|
||||
|
||||
@ApiOperation("今日装备入驻数、今日订单成交数、今日成交金额数、今日需求发布数、今日需求接单数")
|
||||
@GetMapping("/todayCount")
|
||||
public AjaxResult getTodayCount() {
|
||||
Integer devCount = devInfoMapper.getTodayDevCount();
|
||||
OrderData orderData = new OrderData();
|
||||
orderData = orderMapper.getTodayOderCount();
|
||||
orderData = leaseInfoMapper.getTodayLeaseCount();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package com.bonus.material.largeScreen.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @Author:liang.chao
|
||||
* @Date:2024/12/24 - 15:50
|
||||
*/
|
||||
@Data
|
||||
public class OrderData {
|
||||
|
||||
@ApiModelProperty(value = "订单总数")
|
||||
private Integer orderNum;
|
||||
|
||||
@ApiModelProperty(value = "订单金额")
|
||||
private BigDecimal orderCosts;
|
||||
|
||||
@ApiModelProperty(value = "所属公司id")
|
||||
private Integer ownCo;
|
||||
|
||||
@ApiModelProperty(value = "公司订单金额")
|
||||
private BigDecimal cost;
|
||||
|
||||
@ApiModelProperty(value = "公司名称")
|
||||
private String companyName;
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.material.lease.mapper;
|
||||
|
||||
import com.bonus.material.largeScreen.entity.OrderData;
|
||||
import com.bonus.material.lease.domain.MaLease;
|
||||
import com.bonus.material.lease.domain.MaLeaseDetails;
|
||||
import com.bonus.material.lease.domain.MaLeaseDto;
|
||||
|
|
@ -113,4 +114,6 @@ public interface MaLeaseInfoMapper {
|
|||
* @return
|
||||
*/
|
||||
int deleteDetailsById(MaLeaseInfo maLeaseInfo);
|
||||
|
||||
OrderData getTodayLeaseCount();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.bonus.material.order.mapper;
|
|||
import com.bonus.material.comprehensive.entity.RentDetailDto;
|
||||
import com.bonus.material.device.domain.DevInfo;
|
||||
import com.bonus.material.device.domain.vo.DevInfoVo;
|
||||
import com.bonus.material.largeScreen.entity.OrderData;
|
||||
import com.bonus.material.lease.domain.LeaseRepairRecord;
|
||||
import com.bonus.material.order.domain.OrderDetailDto;
|
||||
import com.bonus.material.order.domain.OrderInfoDto;
|
||||
|
|
@ -54,4 +55,10 @@ public interface OrderMapper {
|
|||
OrderInfoDto getAgreementByOrderId(String orderId);
|
||||
|
||||
List<RentDetailDto> getRentDetails(DevInfoVo devInfo);
|
||||
|
||||
OrderData getOrderData();
|
||||
|
||||
OrderData getCompanysCost();
|
||||
|
||||
OrderData getTodayOderCount();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
package com.bonus.material.order.service;
|
||||
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.comprehensive.entity.RentDetailDto;
|
||||
import com.bonus.material.device.domain.vo.DevInfoVo;
|
||||
import com.bonus.material.largeScreen.entity.OrderData;
|
||||
import com.bonus.material.order.domain.OrderDetailDto;
|
||||
import com.bonus.material.order.domain.OrderInfoDto;
|
||||
|
||||
|
|
@ -30,4 +32,9 @@ public interface OrderService {
|
|||
List<RentDetailDto> getRentDetails(DevInfoVo devInfo);
|
||||
|
||||
List<OrderInfoDto> getOrderInfos(OrderInfoDto orderInfoDto);
|
||||
|
||||
OrderData getOrderData();
|
||||
|
||||
OrderData getCompanysCost();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import com.bonus.common.security.utils.SecurityUtils;
|
|||
import com.bonus.material.comprehensive.entity.RentDetailDto;
|
||||
import com.bonus.material.device.domain.DevInfo;
|
||||
import com.bonus.material.device.domain.vo.DevInfoVo;
|
||||
import com.bonus.material.largeScreen.entity.OrderData;
|
||||
import com.bonus.material.lease.domain.LeaseRepair;
|
||||
import com.bonus.material.lease.domain.LeaseRepairRecord;
|
||||
import com.bonus.material.lease.mapper.LeaseRepairRecordMapper;
|
||||
|
|
@ -320,4 +321,14 @@ public class OrderServiceImpl implements OrderService {
|
|||
}
|
||||
return orderInfoDtos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrderData getOrderData() {
|
||||
return orderMapper.getOrderData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrderData getCompanysCost() {
|
||||
return orderMapper.getCompanysCost();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -877,5 +877,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
ORDER BY
|
||||
moi.order_time DESC
|
||||
</select>
|
||||
<select id="getTodayDevCount" resultType="java.lang.Integer">
|
||||
SELECT
|
||||
COUNT(1)
|
||||
FROM
|
||||
ma_dev_info
|
||||
WHERE
|
||||
DATE_FORMAT( create_time, '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
|
||||
AND is_active = '1'
|
||||
AND ma_status != 0
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -405,4 +405,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN ma_type mt1 ON mt1.type_id = mt2.parent_id and mt1.del_flag = '0'
|
||||
where m.lease_id = #{id}
|
||||
</select>
|
||||
<select id="getTodayLeaseCount" resultType="com.bonus.material.largeScreen.entity.OrderData">
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -384,6 +384,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
ORDER BY
|
||||
moi.order_time DESC
|
||||
</select>
|
||||
<select id="getOrderData" resultType="com.bonus.material.largeScreen.entity.OrderData">
|
||||
SELECT
|
||||
count( moi.order_id ) AS orderNum,
|
||||
sum( moi.cost ) AS orderCosts
|
||||
FROM
|
||||
ma_order_info moi
|
||||
</select>
|
||||
<select id="getCompanysCost" resultType="com.bonus.material.largeScreen.entity.OrderData">
|
||||
SELECT
|
||||
mdi.own_co,
|
||||
sum( hh.costs ) cost,
|
||||
sd.dept_name AS companyName
|
||||
FROM
|
||||
ma_order_details hh
|
||||
LEFT JOIN ma_dev_info mdi ON hh.ma_id = mdi.ma_id
|
||||
LEFT JOIN sys_dept sd ON mdi.own_co = sd.dept_id
|
||||
WHERE
|
||||
mdi.is_active = 1 and mdi.ma_status != 0
|
||||
GROUP BY
|
||||
mdi.own_co
|
||||
</select>
|
||||
<select id="getTodayOderCount" resultType="com.bonus.material.largeScreen.entity.OrderData">
|
||||
SELECT
|
||||
count( moi.order_id ) orderNum,
|
||||
SUM( moi.cost ) cost
|
||||
FROM
|
||||
ma_order_info moi
|
||||
WHERE
|
||||
DATE_FORMAT( moi.create_time, '%Y-%m-%d' ) = DATE_FORMAT(NOW(),'%Y-%m-%d')
|
||||
</select>
|
||||
|
||||
<delete id="deleteCostReliefs">
|
||||
delete from ma_order_details_relief
|
||||
|
|
|
|||
Loading…
Reference in New Issue