Merge branch 'databigscreen' into master

# Conflicts:
#	sql/v2.1.sql
This commit is contained in:
wen 2022-01-28 10:30:29 +08:00
commit cbd41db98a
15 changed files with 191 additions and 42 deletions

View File

@ -37,7 +37,7 @@ public class AuthFilter implements GlobalFilter, Ordered {
private static final Logger log = LoggerFactory.getLogger(AuthFilter.class);
private final static long EXPIRE_TIME = Constants.TOKEN_EXPIRE * 600;
private final static long EXPIRE_TIME = Constants.TOKEN_EXPIRE * 600000;
// 排除过滤的 uri 地址nacos自行添加
@Autowired

View File

@ -562,4 +562,7 @@ CREATE TABLE `xhpc_message_board_receive_user`
`new_info_time` datetime DEFAULT NULL COMMENT '新消息发送时间',
`del_flag` tinyint(1) DEFAULT NULL COMMENT '逻辑删除0为删除'
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 COMMENT ='用来保存每个租户后台显示的用户的信息列表';
DEFAULT CHARSET = utf8mb4 COMMENT ='用来保存每个租户后台显示的用户的信息列表';
ALTER TABLE `ry-cloud`.`t_iccard_info`
ADD COLUMN `tenant_id` varchar(10) NOT NULL DEFAULT '000000' COMMENT '租户id' AFTER `createTime`;

View File

@ -15,6 +15,8 @@ import java.util.Date;
@SuppressWarnings("all")
public class MyDateUtil {
public static final String DATE_FORMAT_DATE_TIME = "yyyy-MM-dd HH:mm:ss";
public static void main(String[] args) {
System.out.println(getCurrentDateStr());
@ -43,8 +45,6 @@ public class MyDateUtil {
}
public static final String DATE_FORMAT_DATE_TIME = "yyyy-MM-dd HH:mm:ss";
/**
* 获取表示所传入的Date对象的Calendar对象
*

View File

@ -50,9 +50,7 @@ public class XhpcInvoiceApiController extends BaseController {
@PostMapping("/user/commit")
public AjaxResult saveInvoiceInfo(@RequestBody SaveInvoiceInfoRequest saveInvoiceInfoRequest) throws Exception {
if (saveInvoiceInfoRequest.getCreateTime() == null) {
saveInvoiceInfoRequest.setCreateTime(DateUtil.getYyyyMmDdHhMmSs());
}
saveInvoiceInfoRequest.setCreateTime(DateUtil.getYyyyMmDdHhMmSs());
xhpcInvoiceService.saveInvoiceInfo(saveInvoiceInfoRequest);
return AjaxResult.success();
}

View File

@ -66,7 +66,6 @@ public class XhpcInvoiceController extends BaseController {
* @date 2021/12/29 16:40
* @since version-1.0
*/
@Log(title = "电子发票上传", businessType = BusinessType.INSERT)
@PostMapping("/pdf")
public AjaxResult uploadPdf(MultipartFile invoicePdf) throws IOException {
@ -93,6 +92,9 @@ public class XhpcInvoiceController extends BaseController {
@Log(title = "用户提交发票状态", businessType = BusinessType.UPDATE)
@PatchMapping()
public AjaxResult invoiceToUser(@RequestBody InvoiceToUserRequest requestData) {
System.out.println("进入方法");
long start = System.currentTimeMillis();
//前置条件
if (requestData.getInvoiceId() == null) {
return AjaxResult.error("必须上传发票id");
@ -120,6 +122,9 @@ public class XhpcInvoiceController extends BaseController {
return AjaxResult.error(e.getMessage());
}
}
long end = System.currentTimeMillis();
System.out.println("方法执行时间");
System.out.println(end - start);
return AjaxResult.success();
}

View File

@ -128,8 +128,11 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService {
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean invoiceToUser(InvoiceToUserRequest requestData) {
//获取当前时间
requestData.setInvoicingTime(DateUtil.getYyyyMmDdHhMmSs());
if (requestData.getInvoicingTime() == null || "".equals(requestData.getInvoicingTime())) {
//获取当前时间
requestData.setInvoicingTime(DateUtil.getYyyyMmDdHhMmSs());
}
//根据操作人的id查询操作人的名字
SysUser sysUser = sysUserMapper.selectUserById(Long.valueOf(requestData.getDrawer()));
requestData.setDrawer(sysUser.getNickName());
@ -143,12 +146,20 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService {
//参数1 文件下载路径
//参数2 文件存放位置
//服务器响应404 表示服务器找不到客户端所请求的资源
System.out.println("下载文件");
long start = System.currentTimeMillis();
HttpUtil.downloadFile(fileUrl, electricInvoiceFile);
long end = System.currentTimeMillis();
System.out.println(end - start);
} catch (Exception e) {
throw new RuntimeException("在阿里云上无法找到该文件,请检查上传的图片路径是否完整或有误");
}
try {
System.out.println("发送邮件");
long start = System.currentTimeMillis();
MailUtil.send(receiveEmail, "【小华充电】电子发票", "邮件来自小华充电", false, electricInvoiceFile);
long end = System.currentTimeMillis();
System.out.println(end - start);
} catch (Exception e) {
System.out.println(e.getMessage());
return Boolean.FALSE;
@ -170,8 +181,11 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService {
@Override
@Transactional(rollbackFor = Exception.class)
public void failInvoiceToUser(InvoiceToUserRequest requestData) {
//获取当前时间
requestData.setInvoicingTime(DateUtil.getYyyyMmDdHhMmSs());
if (requestData.getInvoicingTime() == null || "".equals(requestData.getInvoicingTime())) {
//获取当前时间
requestData.setInvoicingTime(DateUtil.getYyyyMmDdHhMmSs());
}
//根据操作人的id查询操作人的名字
SysUser sysUser = sysUserMapper.selectUserById(Long.valueOf(requestData.getDrawer()));
requestData.setDrawer(sysUser.getNickName());

View File

@ -37,5 +37,5 @@ oss:
#文件路径
file:
aliyunPath: invoicePdf/
# serverStoreDisposableFileLocation: /www/wwwroot/xhpc.scxhua.com/disposableFiles/
serverStoreDisposableFileLocation: C:\\www\\wwwroot\\xhpc.scxhua.com\\disposableFiles\\
serverStoreDisposableFileLocation: /www/wwwroot/xhpc.scxhua.com/disposableFiles/
# serverStoreDisposableFileLocation: C:\\www\\wwwroot\\xhpc.scxhua.com\\disposableFiles\\

View File

@ -24,6 +24,21 @@ public class XhpcMessageBoardController {
@Resource
XhpcMessageBoardService xhpcMessageBoardService;
/**
* 平台删除所查看的用户列表中的指定用户
*
* @author WH
* @date 2022/1/13 18:43
* @since version-1.0
*/
@PatchMapping("/platform/list/user")
public AjaxResult deleteListUser(@Validated @RequestBody UserInfo userInfo) {
xhpcMessageBoardService.deleteListUser(userInfo);
return AjaxResult.success();
}
/**
* 平台给用户发送消息
*
@ -34,6 +49,9 @@ public class XhpcMessageBoardController {
@PostMapping("/platform/message")
public AjaxResult platformSendMessageToUser(@RequestBody PlatformSendMessageToUserRequest platformRequest) {
if (platformRequest.getMessageContent() == null || "".equals(platformRequest.getMessageContent())) {
return AjaxResult.error("必须传入有效的信息内容");
}
xhpcMessageBoardService.platformSendMessageToUser(platformRequest);
return AjaxResult.success();
@ -63,7 +81,7 @@ public class XhpcMessageBoardController {
* @since version-1.0
*/
@GetMapping("/user/message")
public AjaxResult platformQueryMessage(UserQueryCondition userQueryCondition) throws Exception {
public AjaxResult platformQueryMessage(UserQueryCondition userQueryCondition) {
QueryUserMassageResponse queryUserMassageResponse = xhpcMessageBoardService.platformQueryMessage(userQueryCondition);

View File

@ -5,7 +5,6 @@ import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
@ -47,14 +46,11 @@ public class QueryUserListRequest {
* tenantId
*/
@JsonProperty("tenantId")
@NotNull(message = "tenantId的参数名不正确或者tenantId的值为空请检查传入参数")
@NotBlank(message = "tenantId的参数为''字符串,请检查传入参数")
private String tenantId;
/**
* tenantType
*/
@JsonProperty("tenantType")
@NotNull(message = "tenantType的参数名不正确或者tenantType的值为空请检查传入参数")
private Integer tenantType;
}

View File

@ -0,0 +1,48 @@
package com.xhpc.board.domain;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* 用户信息
*
* @author WH
* @date 2022/1/18 17:34
* @since version-1.0
*/
@NoArgsConstructor
@Data
public class UserInfo {
/**
* userAccount
*/
@JsonProperty("userAccount")
@NotNull(message = "userAccount的参数名不正确或者userAccount的值为空请检查传入参数")
@NotBlank(message = "userAccount的参数不能为''字符串,请检查传入参数")
private String userAccount;
/**
* userType
*/
@JsonProperty("userType")
@NotNull(message = "userType的参数名不正确或者userType的值为空请检查传入参数")
@Min(value = 0, message = "userType的参数不能小于0请检查传入参数")
private Integer userType;
/**
* tenantId
*/
@JsonProperty("tenantId")
private String tenantId;
/**
* tenantType
*/
@JsonProperty("tenantType")
private Integer tenantType;
}

View File

@ -73,4 +73,24 @@ public interface XhpcMessageBoardReceiveUserMapper {
*/
void updateHaveNewInfoIsNull(UserQueryCondition userQueryCondition);
/**
* 删除指定租户列表中的指定用户
*
* @param userQueryCondition 用户信息
* @author WH
* @date 2022/1/24 10:32
* @since version-1.0
*/
void updateDelFlag(UserQueryCondition userQueryCondition);
/**
* 设置指定用户从租户列表中恢复
*
* @param userMessage 用户信息
* @author WH
* @date 2022/1/24 10:37
* @since version-1.0
*/
void setDelFlag(SendMessageToPlatformRequest userMessage);
}

View File

@ -78,4 +78,14 @@ public interface XhpcMessageBoardService {
*/
QueryUserMassageResponse platformQueryMessage(UserQueryCondition userQueryCondition);
/**
* 删除指定租户用户列表中的用户
*
* @param userInfo 指定用户信息
* @author WH
* @date 2022/1/18 17:39
* @since version-1.0
*/
void deleteListUser(UserInfo userInfo);
}

View File

@ -9,13 +9,13 @@ import com.xhpc.board.service.XhpcMessageBoardService;
import com.xhpc.common.api.UserTypeService;
import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.utils.DateUtils;
import com.xhpc.common.core.utils.bean.BeanUtils;
import com.xhpc.common.redis.service.RedisService;
import com.xhpc.common.security.service.TokenService;
import com.xhpc.common.util.DateUtil;
import com.xhpc.common.util.MyPagingUtil;
import com.xhpc.system.api.domain.SysUser;
import com.xhpc.system.api.model.LoginUser;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -86,6 +86,7 @@ public class XhpcMessageBoardServiceImpl implements XhpcMessageBoardService {
xhpcMessageBoardReceiveUserMapper.insertSelective(xhpcMessageBoardReceiveUser);
} else {
xhpcMessageBoardReceiveUserMapper.updateHaveNewInfoFiledByUserCondition(userMessage);
xhpcMessageBoardReceiveUserMapper.setDelFlag(userMessage);
}
} else {
//reset redis key valid time
@ -111,6 +112,7 @@ public class XhpcMessageBoardServiceImpl implements XhpcMessageBoardService {
xhpcMessageBoardReceiveUserMapper.insertSelective(xhpcMessageBoardReceiveUser);
} else {
xhpcMessageBoardReceiveUserMapper.updateHaveNewInfoFiledByUserCondition(userMessage);
xhpcMessageBoardReceiveUserMapper.setDelFlag(userMessage);
}
}
}
@ -211,7 +213,7 @@ public class XhpcMessageBoardServiceImpl implements XhpcMessageBoardService {
List<XhpcMessageBoard> aMonthRecords = messageBoardMapper.selectBy(userQueryCondition, nextTimeStr);
//如果没有数据则返回空实体类对象
QueryUserMassageResponse response = new QueryUserMassageResponse();
if (aMonthRecords.size() == 0) {
if (aMonthRecords.isEmpty()) {
return response;
}
List<Long> messageIdList = new ArrayList<>();
@ -248,8 +250,14 @@ public class XhpcMessageBoardServiceImpl implements XhpcMessageBoardService {
*/
@Override
public String returnPlatformAvatar(String tenantId, Integer tenantType) {
//todo 查询数据库
return "https://xhpc-bucket1.oss-cn-hangzhou.aliyuncs.com/avatar/logo.png";
SysUser sysUser = tokenService.getLoginUser().getSysUser();
String avatar = sysUser.getAvatar();
if (avatar == null) {
return "https://xhpc-bucket1.oss-cn-hangzhou.aliyuncs.com/avatar/logo.png";
} else {
return avatar;
}
}
/**
@ -268,13 +276,12 @@ public class XhpcMessageBoardServiceImpl implements XhpcMessageBoardService {
param.setCurrentPage(startIndex);
//查询用户列表
SysUser receiverInfo = tokenService.getLoginUser().getSysUser();
if (receiverInfo == null) {
throw new Exception("查询不到指定的租户receiverInfo为null请检查传递的参数");
}
param.setTenantId(receiverInfo.getTenantId());
param.setTenantType(0);
QueryUserListResponse queryUserListResponse = new QueryUserListResponse();
//查询出该租户拥有的所有用户列表
List<XhpcMessageBoardReceiveUser> userList = xhpcMessageBoardReceiveUserMapper.findAllBy(param);
if (userList.size() == 0) {
if (userList.isEmpty()) {
return queryUserListResponse;
}
List<QueryUserListResponse.DataDTO> dataDtoList = new ArrayList<>();
@ -314,7 +321,7 @@ public class XhpcMessageBoardServiceImpl implements XhpcMessageBoardService {
//查询用户是否有数据即查询该用户的所有时间记录有时间记录表示该用户发送过信息
List<XhpcMessageBoard> allTimeRecords = messageBoardMapper.selectTimeRecords(userQueryCondition);
QueryUserMassageResponse queryUserMassageResponse = new QueryUserMassageResponse();
if (allTimeRecords.size() == 0) {
if (allTimeRecords.isEmpty()) {
return queryUserMassageResponse;
}
//获取最后一个时间记录将其减去一个月放入查询条件中
@ -338,7 +345,7 @@ public class XhpcMessageBoardServiceImpl implements XhpcMessageBoardService {
List<XhpcMessageBoard> aMonthRecords = messageBoardMapper.selectBy(userQueryCondition, nextTimeStr);
//如果没有数据则返回空实体类对象
QueryUserMassageResponse response = new QueryUserMassageResponse();
if (aMonthRecords.size() == 0) {
if (aMonthRecords.isEmpty()) {
return response;
}
List<Long> messageIdList = new ArrayList<>();
@ -360,10 +367,24 @@ public class XhpcMessageBoardServiceImpl implements XhpcMessageBoardService {
dataDTOS.add(dataDTO);
}
//处理下次查询时间
//todo 截取时间
response.setNextQueryTime(nextTimeStr);
response.setData(dataDTOS);
return response;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteListUser(UserInfo userInfo) {
SysUser sysUser = tokenService.getLoginUser().getSysUser();
userInfo.setTenantId(sysUser.getTenantId());
userInfo.setTenantType(0);
UserQueryCondition userQueryCondition = new UserQueryCondition();
BeanUtils.copyProperties(userInfo, userQueryCondition);
userQueryCondition.setSenderType(userInfo.getUserType());
userQueryCondition.setSenderAccount(userInfo.getUserAccount());
xhpcMessageBoardReceiveUserMapper.updateDelFlag(userQueryCondition);
}
}

View File

@ -23,6 +23,6 @@ spring:
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
logging:
level:
com.xhpc.board.mapper: debug
#logging:
# level:
# com.xhpc.board.mapper: debug

View File

@ -53,6 +53,7 @@
<if test="delFlag != null">
del_flag,
</if>
new_info_time,
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="tenantId != null">
@ -76,16 +77,17 @@
<if test="delFlag != null">
#{delFlag,jdbcType=BOOLEAN},
</if>
now(),
</trim>
</insert>
<update id="updateHaveNewInfoFiledByUserCondition">
UPDATE xhpc_message_board_receive_user
SET have_new_info = 0
SET have_new_info = 0,
new_info_time = now()
WHERE tenant_type = #{tenantType}
AND tenant_id = #{tenantId}
AND sender_account = #{senderAccount}
AND sender_type = #{senderType}
AND del_flag IS NULL;
</update>
<update id="updateHaveNewInfoIsNull">
UPDATE xhpc_message_board_receive_user
@ -96,6 +98,22 @@
AND sender_type = #{senderType}
AND del_flag IS NULL;
</update>
<update id="updateDelFlag">
UPDATE xhpc_message_board_receive_user
SET del_flag = 0
WHERE tenant_type = #{tenantType}
AND tenant_id = #{tenantId}
AND sender_account = #{senderAccount}
AND sender_type = #{senderType}
</update>
<update id="setDelFlag">
UPDATE xhpc_message_board_receive_user
SET del_flag = null
WHERE tenant_type = #{tenantType}
AND tenant_id = #{tenantId}
AND sender_account = #{senderAccount}
AND sender_type = #{senderType}
</update>
<select id="findOneByCondition" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
@ -106,7 +124,6 @@
AND tenant_type = #{tenantType}
AND sender_account = #{senderAccount}
AND sender_type = #{senderType}
AND del_flag IS NULL
</select>
<select id="findAllBy" resultMap="BaseResultMap">
SELECT
@ -117,13 +134,13 @@
tenant_id = #{tenantId}
AND tenant_type = #{tenantType}
AND del_flag IS NULL
AND have_new_info = 0
<if test="userType!=null">
<if test="userType!=null and userType!=''">
AND sender_type = #{userType}
</if>
<if test="senderAccount">
<if test="senderAccount!=null and senderAccount!=''">
AND sender_account = #{senderAccount}
</if>
ORDER BY new_info_time desc,have_new_info DESC
LIMIT #{currentPage},#{items}
</select>
<select id="totalUserNumber" resultType="java.lang.Long">
@ -132,11 +149,10 @@
WHERE tenant_id = #{tenantId}
AND tenant_type = #{tenantType}
AND del_flag IS NULL
AND have_new_info = 0
<if test="userType!=null">
<if test="userType!=null and userType!=''">
AND sender_type = #{userType}
</if>
<if test="senderAccount">
<if test="senderAccount!=null and senderAccount!=''">
AND sender_account = #{senderAccount}
</if>
</select>