Commit 3f6168b9 by guojuxing

Merge remote-tracking branch 'origin/developer' into developer

parents d3041553 0df29002
......@@ -122,7 +122,8 @@ public interface PushMessageApiService {
* @Param
* @return
*/
ServiceResponse<Integer> totalUserMessage(Integer userId, Integer status);
ServiceResponse<Integer> totalUserMessage(Integer userId, String search, Integer status,
Date startTime, Date endTime, Integer pushClassifyId);
/** @Description: 推送消息接口
* @author taogs
......@@ -157,4 +158,5 @@ public interface PushMessageApiService {
* @return
*/
ServiceResponse<Integer> readMessage(Integer messageId);
}
......@@ -66,7 +66,7 @@ public interface TabPushMessageMapper {
@Param("status") Integer status,
@Param("startTime") Date startTime,
@Param("endTime") Date endTime,
@Param("pushClassifyId") Integer pushClassifyId,
@Param("classify") String classify,
@Param("userId") Integer userId);
int readCount(@Param("messageId") Integer messageId);
......
......@@ -3,6 +3,7 @@ package com.gic.enterprise.dao.mapper;
import com.gic.enterprise.entity.TabPushUserMessage;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
public interface TabPushUserMessageMapper {
......@@ -56,8 +57,12 @@ public interface TabPushUserMessageMapper {
int recallMessage(@Param("messageId") Integer messageId);
List<Integer> totalUserMessage(@Param("userId") Integer userId,
@Param("status") Integer status);
List<Integer> totalUserMessage(@Param("search") String search,
@Param("status") Integer status,
@Param("startTime") Date startTime,
@Param("endTime") Date endTime,
@Param("classify") String classify,
@Param("userId") Integer userId);
int readAll(@Param("userId") Integer userId);
......
......@@ -13,9 +13,11 @@ public interface PushMessageService {
int delete(Integer id);
Page<TabPushMessage> pagePushMesage(String search, Integer pushStatus, Date startTime, Date endTime, Integer pushClassifyId);
Page<TabPushMessage> pagePushMesage(String search, Integer pushStatus, Date startTime, Date endTime,
Integer pushClassifyId);
Page<UserMessageDTO> pageUserMessage(String search, Integer status, Date startTime, Date endTime, Integer pushClassifyId, Integer userId);
Page<UserMessageDTO> pageUserMessage(String search, Integer status, Date startTime, Date endTime,
Integer pushClassifyId, Integer userId, Integer pageNum, Integer pageSize);
int readCount(Integer messageId);
}
......@@ -16,4 +16,6 @@ public interface PushTypeService {
TabPushClassify getById(Integer id);
List<TabPushClassify> listPushTypeByName(String name);
boolean saveClassify(String classify);
}
......@@ -2,12 +2,15 @@ package com.gic.enterprise.service;
import com.gic.enterprise.entity.TabPushUserMessage;
import java.util.Date;
public interface PushUserMessageService {
int save(Integer enterpriseId, Integer userId, Integer messageId, String classify, String title, String content);
int reCallMessage(Integer messageId);
int totalUserMessage(Integer userId, int status);
int totalUserMessage(Integer userId, String search, Integer status,
Date startTime, Date endTime, Integer pushClassifyId);
int readAll(Integer userId);
......
......@@ -2,9 +2,12 @@ package com.gic.enterprise.service.impl;
import com.gic.enterprise.dao.mapper.TabPushMessageMapper;
import com.gic.enterprise.dto.UserMessageDTO;
import com.gic.enterprise.entity.TabPushClassify;
import com.gic.enterprise.entity.TabPushMessage;
import com.gic.enterprise.service.PushMessageService;
import com.gic.enterprise.service.PushTypeService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -14,6 +17,8 @@ import java.util.Date;
public class PushMessageServiceImpl implements PushMessageService {
@Autowired
private TabPushMessageMapper tabPushMessageMapper;
@Autowired
private PushTypeService pushTypeService;
@Override
public int savePushMesasge(TabPushMessage tabPushMessage) {
......@@ -39,14 +44,17 @@ public class PushMessageServiceImpl implements PushMessageService {
}
@Override
public Page<TabPushMessage> pagePushMesage(String search, Integer pushStatus, Date startTime, Date endTime, Integer pushClassifyId) {
public Page<TabPushMessage> pagePushMesage(String search, Integer pushStatus, Date startTime, Date endTime,
Integer pushClassifyId) {
return this.tabPushMessageMapper.pagePushMesage(search, pushStatus, startTime, endTime, pushClassifyId);
}
@Override
public Page<UserMessageDTO> pageUserMessage(String search, Integer status, Date startTime, Date endTime,
Integer pushClassifyId, Integer userId) {
return this.tabPushMessageMapper.pageUserMessage(search, status, startTime, endTime, pushClassifyId, userId);
Integer pushClassifyId, Integer userId, Integer pageNum, Integer pageSize) {
TabPushClassify byId = this.pushTypeService.getById(pushClassifyId);
PageHelper.startPage(pageNum, pageSize);
return this.tabPushMessageMapper.pageUserMessage(search, status, startTime, endTime, byId == null ? null : byId.getClassifyName(), userId);
}
@Override
......
......@@ -4,6 +4,7 @@ import com.gic.enterprise.dao.mapper.TabPushClassifyMapper;
import com.gic.enterprise.entity.TabPushClassify;
import com.gic.enterprise.service.PushTypeService;
import com.github.pagehelper.Page;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -47,4 +48,18 @@ public class PushTypeServiceImpl implements PushTypeService {
public List<TabPushClassify> listPushTypeByName(String name) {
return this.tabPushClassifyMapper.listPushTypeByName(name);
}
@Override
public boolean saveClassify(String classify) {
List<TabPushClassify> list = this.listPushTypeByName(classify);
if(CollectionUtils.isNotEmpty(list)){
return true;
}else {
TabPushClassify tabPushType = new TabPushClassify();
tabPushType.setClassifyName(classify);
tabPushType.setClassifyDesc(classify);
this.savePushType(tabPushType);
}
return false;
}
}
package com.gic.enterprise.service.impl;
import com.gic.enterprise.dao.mapper.TabPushUserMessageMapper;
import com.gic.enterprise.entity.TabPushClassify;
import com.gic.enterprise.entity.TabPushUserMessage;
import com.gic.enterprise.service.PushTypeService;
import com.gic.enterprise.service.PushUserMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -13,6 +15,8 @@ import java.util.List;
public class PushUserMessageServiceImpl implements PushUserMessageService {
@Autowired
private TabPushUserMessageMapper tabPushUserMessageMapper;
@Autowired
private PushTypeService pushTypeService;
@Override
public int save(Integer enterpriseId, Integer userId, Integer messageId, String classify, String title, String content) {
......@@ -35,8 +39,10 @@ public class PushUserMessageServiceImpl implements PushUserMessageService {
}
@Override
public int totalUserMessage(Integer userId, int status) {
List<Integer> list = this.tabPushUserMessageMapper.totalUserMessage(userId, status);
public int totalUserMessage(Integer userId, String search, Integer status,
Date startTime, Date endTime, Integer pushClassifyId) {
TabPushClassify byId = this.pushTypeService.getById(pushClassifyId);
List<Integer> list = this.tabPushUserMessageMapper.totalUserMessage(search, status, startTime, endTime, byId == null ? null : byId.getClassifyName(), userId);
return list.get(0);
}
......
......@@ -37,6 +37,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
......@@ -104,17 +105,21 @@ public class AuditLogApiServiceImpl implements AuditLogApiService {
auditLogDTO.setApplyUserName(userServiceResponse.getResult().getUserName());
auditLogDTO.setApplyUserPhone(userServiceResponse.getResult().getPhoneNumber());
// 判断有没有审核员, 没有审核员就返回错误
ServiceResponse<List<AuditorDTO>> auditorResponse = auditorApiService.listAuditorByProject(auditLogDTO.getProjectItemId(), auditLogDTO.getApplyUserId(), auditLogDTO.getEnterpriseId());
if (!auditorResponse.isSuccess()) {
return EnterpriseServiceResponse.failure(auditorResponse.getCode(), auditorResponse.getMessage());
}
List<AuditorDTO> auditorList = auditorResponse.getResult();
List<AuditorDTO> openidList = auditorList.stream().filter(e -> StringUtils.isNotBlank(e.getOpenid())).collect(Collectors.toList());
List<AuditorDTO> userIdList = auditorList.stream().filter(e -> e.getUserId() != null).collect(Collectors.toList());
if (CollectionUtils.isEmpty(openidList) && CollectionUtils.isEmpty(userIdList)) {
return EnterpriseServiceResponse.failure(ErrorCode.OPERATION_FAILED.getCode(), "审核员没有绑定微信或管理员");
List<AuditorDTO> auditorList = Collections.emptyList();
if (userServiceResponse.getResult().getSuperAdmin() == 0) {
// 普通管理员需要判断是否有审核员
if (!auditorResponse.isSuccess()) {
return EnterpriseServiceResponse.failure(auditorResponse.getCode(), auditorResponse.getMessage());
}
auditorList = auditorResponse.getResult();
List<AuditorDTO> openidList = auditorList.stream().filter(e -> StringUtils.isNotBlank(e.getOpenid())).collect(Collectors.toList());
List<AuditorDTO> userIdList = auditorList.stream().filter(e -> e.getUserId() != null).collect(Collectors.toList());
if (CollectionUtils.isEmpty(openidList) && CollectionUtils.isEmpty(userIdList)) {
return EnterpriseServiceResponse.failure(ErrorCode.OPERATION_FAILED.getCode(), "审核员没有绑定微信或管理员");
}
}
// 判断审批项是否禁用
if (Constants.DEL_STATUS.equals(projectItem.getUseStatus())) {
return EnterpriseServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "该审批项已被禁用");
......@@ -169,6 +174,21 @@ public class AuditLogApiServiceImpl implements AuditLogApiService {
// sendWxMessage();
}
// 如果申请人是超管 自动审批
if (userServiceResponse.getResult().getSuperAdmin() == 1) {
AuditLogDTO autoAudit = new AuditLogDTO();
autoAudit.setEnterpriseId(auditLogDTO.getEnterpriseId());
autoAudit.setApplyUserId(auditLogDTO.getApplyUserId());
autoAudit.setAuditorId(auditLogDTO.getApplyUserId());
autoAudit.setAuditResult(DataSecurityAuditEnum.PASS.getCode());
autoAudit.setAuditorPhone(auditLogDTO.getApplyUserPhone());
autoAudit.setAuditorName(auditLogDTO.getAuditorName());
autoAudit.setAuditReason("自动审批");
this.audit(autoAudit);
}
return EnterpriseServiceResponse.success();
}
......@@ -176,7 +196,7 @@ public class AuditLogApiServiceImpl implements AuditLogApiService {
@Transactional(rollbackFor = Exception.class)
public ServiceResponse<AuditLogDTO> audit(AuditLogDTO auditLogDTO) {
// 完成待办事项
todoItemApiService.finishTodoItem(auditLogDTO.getEnterpriseId(), auditLogDTO.getAuditorId(), com.gic.enterprise.constant.Constants.TODO_ITEM_AUDIT, "www.baidu.com?auditLogId=" + auditLogDTO.getAuditLogId());
todoItemApiService.finishTodoItem(auditLogDTO.getEnterpriseId(), auditLogDTO.getAuditorId(), com.gic.enterprise.constant.Constants.TODO_ITEM_AUDIT, com.gic.enterprise.constant.Constants.TODO_ITEM_AUDIT_URL + "?auditLogId=" + auditLogDTO.getAuditLogId());
TabAuditLog auditLog = this.auditLogService.getAuditById(auditLogDTO.getAuditLogId());
if (auditLog == null) {
......@@ -221,7 +241,7 @@ public class AuditLogApiServiceImpl implements AuditLogApiService {
String url = config.getHost() + "/damo-system/examine-logs";
String result = auditLogDTO.getAuditResult() == 1? "已通过" : "未通过";
String content = "您的操作"+ result +"审核,可以在<a href='"+url+"'>审核日志</a>查看到本次审核记录";
this.pushMessageApiService.pushUserMessage(auditLogDTO.getEnterpriseId(), auditLogDTO.getApplyUserId(),"审核通知", "审核结果", content);
this.pushMessageApiService.pushUserMessage(auditLogDTO.getEnterpriseId(), auditLogDTO.getApplyUserId(),"系统消息", "审核结果", content);
return EnterpriseServiceResponse.success();
}
......
......@@ -15,6 +15,7 @@ import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.response.EnterpriseServiceResponse;
import com.gic.enterprise.service.*;
import com.gic.redis.data.util.RedisUtil;
import org.apache.logging.log4j.core.pattern.AbstractStyleNameConverter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -25,6 +26,7 @@ import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
@Service("billingAccountApiService")
public class BillingAccountApiServiceImpl implements BillingAccountApiService {
......@@ -206,11 +208,14 @@ public class BillingAccountApiServiceImpl implements BillingAccountApiService {
if (i > 0) {
TabBillingAccount account = this.billingAccountService.getByEnterpriseId(enterpriseId);
if(account.getAccountBalance() <= 0){
String content = "您的GIC商户余额已欠费"+(-account.getAccountBalance())+"元,为了不影响业务的开展,请及时<a href='"+config.getHost()+"cost-center/billing-center/recharge'>充值</a>";
this.pushMessageApiService.pushMessage(enterpriseId, "产品通知", "商户欠费", content);
// 待办事项
sendTotoItem(enterpriseId);
Object cache = RedisUtil.getCache("message:" + enterpriseId);
if(cache == null){
String content = "您的GIC商户余额已欠费"+(-account.getAccountBalance())+"元,为了不影响业务的开展,请及时<a href='"+config.getHost()+"cost-center/billing-center/recharge'>充值</a>";
this.pushMessageApiService.pushMessage(enterpriseId, "系统消息", "商户欠费", content);
// 待办事项
sendTotoItem(enterpriseId);
RedisUtil.setCache("message:" + enterpriseId, 1, 1l, TimeUnit.DAYS);
}
}
return ServiceResponse.success(i);
} else {
......
......@@ -97,8 +97,8 @@ public class DownloadReportApiServiceImpl implements DownloadReportApiService {
TabDownloadReport downloadReport = this.downloadReportService.getById(downloadReportId);
if(downloadReport != null){
String url = config.getHost() + "damo-system/report-list";
String content = "您的"+ downloadReport.getDataContent() +"已生成,请前往<a href='"+ url +"'>下载中心</a>查看";
this.pushMessageApiService.pushUserMessage(downloadReport.getEnterpriseId(), downloadReport.getApplyUserId(), "下载通知", "下载通知", content);
String content = "您的"+ downloadReport.getDataContent() +"已生成,请前往<a href='"+ url +"' style='color:#2f54ed'>下载中心</a>查看";
this.pushMessageApiService.pushUserMessage(downloadReport.getEnterpriseId(), downloadReport.getApplyUserId(), "系统消息", "下载通知", content);
}
return EnterpriseServiceResponse.success(line);
}
......
......@@ -574,7 +574,7 @@ public class EnterpriseApiServiceImpl implements EnterpriseApiService {
Date auditTime = enterpriseDTO.getAuditTime();
long days = (sdf.parse(sdf.format(auditTime)).getTime() - sdf.parse(sdf.format(now)).getTime())/(1000 * 60 * 60 * 24);
if(days <= 7){
this.pushMessageApiService.pushMessage(enterpriseDTO.getEnterpriseId(), "产品通知",
this.pushMessageApiService.pushMessage(enterpriseDTO.getEnterpriseId(), "系统消息",
"GIC版本即将过期", "您的GIC版本即将在"+ days +"天到期,为了不影响业务的开展,请及时续费");
}
}catch (Exception e){
......
......@@ -148,9 +148,8 @@ public class PushMessageApiServiceImpl implements PushMessageApiService {
public ServiceResponse<Page<UserMessageDTO>> pageUserMessage(Integer userId, String search, Integer status,
Date startTime, Date endTime, Integer pushClassifyId,
Integer pageNum, Integer pageSize) {
PageHelper.startPage(pageNum, pageSize);
com.github.pagehelper.Page<UserMessageDTO> page = this.pushMessageService.pageUserMessage(search, status,
startTime, endTime, pushClassifyId, userId);
startTime, endTime, pushClassifyId, userId, pageNum, pageSize);
Page<UserMessageDTO> userMessageDTOPage = PageHelperUtils.changePageHelperToCurrentPage(page);
return ServiceResponse.success(userMessageDTOPage);
}
......@@ -166,8 +165,9 @@ public class PushMessageApiServiceImpl implements PushMessageApiService {
}
@Override
public ServiceResponse<Integer> totalUserMessage(Integer userId, Integer status) {
return ServiceResponse.success(this.pushUserMessageService.totalUserMessage(userId, status));
public ServiceResponse<Integer> totalUserMessage(Integer userId, String search, Integer status,
Date startTime, Date endTime, Integer pushClassifyId) {
return ServiceResponse.success(this.pushUserMessageService.totalUserMessage(userId, search, status, startTime, endTime, pushClassifyId));
}
@Override
......@@ -176,6 +176,7 @@ public class PushMessageApiServiceImpl implements PushMessageApiService {
if(enterpriseId == null || userId == null || StringUtils.isBlank(title) || StringUtils.isBlank(content)){
return ServiceResponse.failure(ErrorCode.MISS_PARAMETER.getCode(), ErrorCode.MISS_PARAMETER.getErrorMsg());
}
this.pushTypeService.saveClassify(classify);
int i = this.pushUserMessageService.save(enterpriseId, userId, null, classify, title, content);
if(i > 0){
return ServiceResponse.success(i);
......
......@@ -113,7 +113,7 @@ public class WxPayStrategy implements PayStrategy {
case 1:
// 商户余额充值
billingRechargeRecordService.updateBySerialNumber(resData.getEnterpriseId(), billingPayInfo.getOrderSerialNumber(), resData.getTotalFeePaid(), resData.getTotalFeePaid(), BillingAuditStatusEnum.PASS.getCode(), resData.getTimeEnd());
this.pushMessageApiService.pushMessage(resData.getEnterpriseId(), "产品通知", "余额充值", "您的商户成功充值"+resData.getTotalFeePaid()+"元!感谢您的支持和使用!");
this.pushMessageApiService.pushMessage(resData.getEnterpriseId(), "系统通知", "余额充值", "您的商户成功充值"+resData.getTotalFeePaid()+"元!感谢您的支持和使用!");
break;
case 2:
// 短信套餐包购买
......
......@@ -276,8 +276,8 @@
<if test="endTime != null">
and (t1.create_time &lt;= #{endTime})
</if>
<if test="pushClassifyId != null">
and t3.push_classify_id = #{pushClassifyId}
<if test="classify != null and classify !=''">
and t1.classify = #{classify}
</if>
order by t1.status asc,t1.create_time desc
</select>
......
......@@ -156,10 +156,25 @@
where message_id = #{messageId,jdbcType=INTEGER} and status!=0
</update>
<select id="totalUserMessage" resultType="integer">
select
count(1)
from tab_push_user_message
where user_id=#{userId} and status = #{status}
select count(1)
from tab_push_user_message t1 left join tab_push_message t3 on t1.message_id = t3.message_id
where t1.user_id=#{userId}
and (t1.status = 1 or t1.status = 2)
<if test="search != null and search != ''">
and (t1.title like concat('%', #{search}, '%') or t1.content like concat('%', #{search}, '%'))
</if>
<if test="status != null">
and t1.status = #{status}
</if>
<if test="startTime != null">
and (t1.create_time &gt;= #{startTime})
</if>
<if test="endTime != null">
and (t1.create_time &lt;= #{endTime})
</if>
<if test="classify != null and classify !=''">
and t1.classify = #{classify}
</if>
</select>
<update id="readAll">
update tab_push_user_message
......
......@@ -59,7 +59,8 @@ public class IndexModuleController {
try {
ServiceResponse<Page<UserMessageDTO>> response = this.pushMessageApiService.pageUserMessage(userId, search, status, StringUtils.isBlank(startTime) ? null : sdf.parse(startTime+" 00:00:00"),
StringUtils.isBlank(endTime) ? null : sdf.parse(endTime+" 23:59:59"), pushClassifyId, pageQO.getCurrentPage(), pageQO.getPageSize());
ServiceResponse<Integer> unReadResponse = this.pushMessageApiService.totalUserMessage(UserDetailUtils.getUserDetail().getUserId(), 1);
ServiceResponse<Integer> unReadResponse = this.pushMessageApiService.totalUserMessage(userId, search, 1, StringUtils.isBlank(startTime) ? null : sdf.parse(startTime+" 00:00:00"),
StringUtils.isBlank(endTime) ? null : sdf.parse(endTime+" 23:59:59"), pushClassifyId);
Map<String, Object> result = new HashMap<>();
result.put("page", response.getResult());
result.put("unReadCount", unReadResponse.getResult());
......@@ -72,7 +73,8 @@ public class IndexModuleController {
@RequestMapping("total-message")
public RestResponse totalMessage(){
ServiceResponse<Integer> response = this.pushMessageApiService.totalUserMessage(UserDetailUtils.getUserDetail().getUserId(), 1);
ServiceResponse<Integer> response = this.pushMessageApiService.totalUserMessage(UserDetailUtils.getUserDetail().getUserId(), null, null, null,
null, null);
return RestResponse.success(response.getResult());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment