Commit 74710c84 by guojuxing

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

parents 4581261d b1140086
......@@ -211,4 +211,13 @@ public interface EnterpriseApiService {
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Void>


 */
ServiceResponse<Void> buyServiceSuccess(Integer enterpriseId, String json);
/** @Description: 商户过期提醒
* @author taogs
* @Date 17:13 2020/3/9
* @Param
* @return
*/
ServiceResponse<Void> overdueReminder(String param);
}
......@@ -128,7 +128,17 @@ public interface PushMessageApiService {
* @Param
* @return
*/
ServiceResponse<Integer> pushUserMessage(Integer enterpriseId, Integer userId, String title, String content);
ServiceResponse<Integer> pushUserMessage(Integer enterpriseId, Integer userId, String classify, String title, String content);
/** @Description: 商户下所有管理员推送消息
* @author taogs
* @Date 15:23 2020/3/9
* @Param
* @return
*/
ServiceResponse<Integer> pushMessage(Integer enterpriseId, String classify, String title, String content);
/** @Description: 所有标记为已读
* @author taogs
......
package com.gic.enterprise.config;
import com.ctrip.framework.apollo.spring.annotation.EnableApolloConfig;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
@Configuration
@EnableApolloConfig
public class Config {
@Value("${host}")
private String host;
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
}
......@@ -44,6 +44,11 @@ public class TabPushUserMessage {
/**
*
*/
private String classify;
/**
*
*/
private String title;
/**
......@@ -107,6 +112,14 @@ public class TabPushUserMessage {
this.status = status;
}
public String getClassify() {
return classify;
}
public void setClassify(String classify) {
this.classify = classify;
}
public String getTitle() {
return title;
}
......
package com.gic.enterprise.service;
public interface PushUserMessageService {
int save(Integer enterpriseId, Integer userId, Integer messageId, String title, String content);
int save(Integer enterpriseId, Integer userId, Integer messageId, String classify, String title, String content);
int reCallMessage(Integer messageId);
......
......@@ -15,7 +15,7 @@ public class PushUserMessageServiceImpl implements PushUserMessageService {
private TabPushUserMessageMapper tabPushUserMessageMapper;
@Override
public int save(Integer enterpriseId, Integer userId, Integer messageId, String title, String content) {
public int save(Integer enterpriseId, Integer userId, Integer messageId, String classify, String title, String content) {
TabPushUserMessage tab = new TabPushUserMessage();
tab.setCreateTime(new Date());
tab.setEnterpriseId(enterpriseId);
......@@ -25,6 +25,7 @@ public class PushUserMessageServiceImpl implements PushUserMessageService {
tab.setUpdateTime(new Date());
tab.setTitle(title);
tab.setContent(content);
tab.setClassify(classify);
return this.tabPushUserMessageMapper.insert(tab);
}
......
......@@ -13,6 +13,7 @@ import com.gic.commons.util.DateUtil;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.GlobalInfo;
import com.gic.commons.util.PageHelperUtils;
import com.gic.enterprise.config.Config;
import com.gic.enterprise.constant.AuditTypeEnum;
import com.gic.enterprise.constant.DataSecurityAuditEnum;
import com.gic.enterprise.constants.Constants;
......@@ -67,6 +68,10 @@ public class AuditLogApiServiceImpl implements AuditLogApiService {
private TodoItemApiService todoItemApiService;
@Autowired
private EnterpriseService enterpriseService;
@Autowired
private PushMessageApiService pushMessageApiService;
@Autowired
private Config config;
@Override
@Transactional(rollbackFor = Exception.class)
......@@ -206,6 +211,11 @@ public class AuditLogApiServiceImpl implements AuditLogApiService {
jsonObject.put("auditReason", auditLogDTO.getAuditReason());
String[] callback = projectItem.getCallbackUrl().split(GlobalInfo.FLAG_COMMA);
AsyncCallbackUtils.callBack(jsonObject, callback[0], callback[1]);
//发送通知消息
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);
return EnterpriseServiceResponse.success();
}
......
......@@ -6,6 +6,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.gic.enterprise.config.Config;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -39,6 +40,10 @@ public class BillingAccountApiServiceImpl implements BillingAccountApiService {
private BillingEnterpriseSmsPackageService billingEnterpriseSmsPackageService;
@Autowired
private BillingCouponCardService billingCouponCardService;
@Autowired
private PushMessageApiService pushMessageApiService;
@Autowired
private Config config;
@Override
public ServiceResponse<BillingAccountDTO> getByEnterpriseId(Integer enterpriseId) {
......@@ -196,6 +201,11 @@ public class BillingAccountApiServiceImpl implements BillingAccountApiService {
int i = billingAccountService.deductAccount(totalFee, enterpriseId);
LOGGER.info("扣费是否成功:{}", i > 0);
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);
}
return ServiceResponse.success(i);
} else {
return EnterpriseServiceResponse.failure(ErrorCode.OPERATION_FAILED);
......
......@@ -9,6 +9,7 @@ import com.gic.auth.service.UserApiService;
import com.gic.commons.util.DateUtil;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.PageHelperUtils;
import com.gic.enterprise.config.Config;
import com.gic.enterprise.constant.*;
import com.gic.enterprise.dto.AuditLogDTO;
import com.gic.enterprise.dto.DownloadReportDTO;
......@@ -46,6 +47,10 @@ public class DownloadReportApiServiceImpl implements DownloadReportApiService {
private AuditLogApiService auditLogApiService;
@Autowired
private ProjectItemService projectItemService;
@Autowired
private PushMessageApiService pushMessageApiService;
@Autowired
private Config config;
@Override
public ServiceResponse<Integer> saveDownloadReport(DownloadReportDTO downloadReportDTO) {
......@@ -85,6 +90,12 @@ public class DownloadReportApiServiceImpl implements DownloadReportApiService {
@Override
public ServiceResponse<Integer> updateDownloadUrl(Integer downloadReportId, String downloadUrl) {
Integer line = downloadReportService.updateDownloadUrl(downloadReportId, downloadUrl);
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);
}
return EnterpriseServiceResponse.success(line);
}
......
package com.gic.enterprise.service.outer.impl;
import java.text.SimpleDateFormat;
import java.util.*;
import com.gic.auth.dto.BusinessFrontResDTO;
......@@ -82,6 +83,8 @@ public class EnterpriseApiServiceImpl implements EnterpriseApiService {
private EnterpriseResourceRelService enterpriseResourceRelService;
@Autowired
private BusinessFrontResApiService businessFrontResApiService;
@Autowired
private PushMessageApiService pushMessageApiService;
@Override
@Transactional(rollbackFor = Exception.class)
......@@ -553,6 +556,26 @@ public class EnterpriseApiServiceImpl implements EnterpriseApiService {
return ServiceResponse.success();
}
@Override
public ServiceResponse<Void> overdueReminder(String param) {
List<EnterpriseDTO> list = this.enterpriseService.listEnterprise();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date now = new Date();
for(EnterpriseDTO enterpriseDTO : list){
try{
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(), "产品通知",
"GIC版本即将过期", "您的GIC版本即将在"+ days +"天到期,为了不影响业务的开展,请及时续费");
}
}catch (Exception e){
e.printStackTrace();
}
}
return null;
}
private String getVersionNameFromJson(String jsonStr) {
JSONObject jsonObject = JSONObject.parseObject(jsonStr);
JSONObject version = jsonObject.getJSONObject("version");
......
......@@ -130,11 +130,13 @@ public class PushMessageApiServiceImpl implements PushMessageApiService {
Integer enterpriseId = json.getInteger("enterpriseId");
Integer messageId = json.getInteger("messageId");
TabPushMessage tabPushMessage = this.pushMessageService.getById(messageId);
TabPushClassify pushClassify = this.pushTypeService.getById(tabPushMessage.getPushClassifyId());
if(tabPushMessage.getPushStatus() == 1){
ServiceResponse<List<Integer>> response = this.userApiService.listAllUser(enterpriseId);
if(response.isSuccess() && CollectionUtils.isNotEmpty(response.getResult())){
for(Integer userId : response.getResult()){
this.pushUserMessageService.save(enterpriseId, userId, messageId, tabPushMessage.getTitle(), tabPushMessage.getContent());
this.pushUserMessageService.save(enterpriseId, userId, messageId, pushClassify.getClassifyName(),
tabPushMessage.getTitle(), tabPushMessage.getContent());
}
}
}
......@@ -168,11 +170,12 @@ public class PushMessageApiServiceImpl implements PushMessageApiService {
}
@Override
public ServiceResponse<Integer> pushUserMessage(Integer enterpriseId, Integer userId, String title, String content) {
public ServiceResponse<Integer> pushUserMessage(Integer enterpriseId, Integer userId, String classify,
String title, String content) {
if(enterpriseId == null || userId == null || StringUtils.isBlank(title) || StringUtils.isBlank(content)){
return ServiceResponse.failure(ErrorCode.MISS_PARAMETER.getCode(), ErrorCode.MISS_PARAMETER.getErrorMsg());
}
int i = this.pushUserMessageService.save(enterpriseId, userId, null, title, content);
int i = this.pushUserMessageService.save(enterpriseId, userId, null, classify, title, content);
if(i > 0){
return ServiceResponse.success(i);
}else {
......@@ -181,6 +184,17 @@ public class PushMessageApiServiceImpl implements PushMessageApiService {
}
@Override
public ServiceResponse<Integer> pushMessage(Integer enterpriseId, String classify, String title, String content) {
ServiceResponse<List<Integer>> response = this.userApiService.listAllUser(enterpriseId);
if(response.isSuccess() && CollectionUtils.isNotEmpty(response.getResult())){
for(Integer userId : response.getResult()){
this.pushUserMessageService.save(enterpriseId, userId, null, classify,title, content);
}
}
return ServiceResponse.success();
}
@Override
public ServiceResponse<Integer> readAll(Integer userId) {
int i = this.pushUserMessageService.readAll(userId);
return ServiceResponse.success(i);
......
......@@ -15,6 +15,7 @@ import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.service.BillingOrderService;
import com.gic.enterprise.service.BillingPayInfoService;
import com.gic.enterprise.service.BillingRechargeRecordService;
import com.gic.enterprise.service.PushMessageApiService;
import com.gic.store.utils.CreateSerialNumberUtils;
import com.gic.thirdparty.api.dto.ScanPayReqDataDTO;
import com.gic.thirdparty.api.service.Pay4WXService;
......@@ -45,6 +46,8 @@ public class WxPayStrategy implements PayStrategy {
private BillingRechargeRecordService billingRechargeRecordService;
@Autowired
private BillingOrderService billingOrderService;
@Autowired
private PushMessageApiService pushMessageApiService;
@Override
public ServiceResponse<BillingPayInfoDTO> savePrePayInfo(OutPayDTO outPayDTO) {
......@@ -109,6 +112,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()+"元!感谢您的支持和使用!");
break;
case 2:
// 短信套餐包购买
......
......@@ -21,7 +21,7 @@
</resultMap>
<resultMap id="userMessageResult" type="com.gic.enterprise.dto.UserMessageDTO">
<id column="message_id" jdbcType="INTEGER" property="messageId" />
<result column="classify_name" jdbcType="VARCHAR" property="classifyName" />
<result column="classify" jdbcType="VARCHAR" property="classifyName" />
<result column="title" jdbcType="VARCHAR" property="title" />
<result column="content" jdbcType="VARCHAR" property="content" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
......@@ -259,10 +259,10 @@
</select>
<select id="pageUserMessage" resultMap="userMessageResult">
select
t2.classify_name,t1.title,t1.content,t1.message_id,t1.create_time,t1.status, t3.sign
from tab_push_user_message t1, tab_push_classify t2, tab_push_message t3
t1.classify,t1.title,t1.content,t1.message_id,t1.create_time,t1.status, t3.sign
from tab_push_user_message t1, tab_push_message t3
where t1.user_id=#{userId}
and (t1.status = 1 or t1.status = 2) and t1.message_id=t3.message_id and t2.id=t3.push_classify_id
and (t1.status = 1 or t1.status = 2) and t1.message_id=t3.message_id
<if test="search != null and search != ''">
and (title like concat('%', #{search}, '%') or content like concat('%', #{search}, '%'))
</if>
......
......@@ -9,12 +9,13 @@
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="classify" jdbcType="VARCHAR" property="classify" />
<result column="title" jdbcType="VARCHAR" property="title" />
<result column="content" jdbcType="VARCHAR" property="content" />
</resultMap>
<sql id="Base_Column_List">
id, enterprise_id, user_id, message_id, create_time, update_time, status, title,
content
id, enterprise_id, user_id, message_id, create_time, update_time, status, classify,
title, content
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
......@@ -29,12 +30,12 @@
<insert id="insert" parameterType="com.gic.enterprise.entity.TabPushUserMessage">
insert into tab_push_user_message (id, enterprise_id, user_id,
message_id, create_time, update_time,
status, title, content
)
status, classify, title,
content)
values (#{id,jdbcType=INTEGER}, #{enterpriseId,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER},
#{messageId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{status,jdbcType=INTEGER}, #{title,jdbcType=VARCHAR}, #{content,jdbcType=VARCHAR}
)
#{status,jdbcType=INTEGER}, #{classify,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR},
#{content,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.gic.enterprise.entity.TabPushUserMessage">
insert into tab_push_user_message
......@@ -60,6 +61,9 @@
<if test="status != null">
status,
</if>
<if test="classify != null">
classify,
</if>
<if test="title != null">
title,
</if>
......@@ -89,6 +93,9 @@
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
<if test="classify != null">
#{classify,jdbcType=VARCHAR},
</if>
<if test="title != null">
#{title,jdbcType=VARCHAR},
</if>
......@@ -118,6 +125,9 @@
<if test="status != null">
status = #{status,jdbcType=INTEGER},
</if>
<if test="classify != null">
classify = #{classify,jdbcType=VARCHAR},
</if>
<if test="title != null">
title = #{title,jdbcType=VARCHAR},
</if>
......@@ -135,6 +145,7 @@
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
status = #{status,jdbcType=INTEGER},
classify = #{classify,jdbcType=VARCHAR},
title = #{title,jdbcType=VARCHAR},
content = #{content,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
......
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