Commit d14ab025 by zhiwj

bug

parent 974e16e5
......@@ -140,6 +140,16 @@ public class InternationalSmsRecordDTO implements Serializable {
*/
private String storeGroupName;
/**
* 缓存更新成功标志 1:成功
*/
private Integer cacheStatus;
/**
* 数据库更新成功标志 1:成功
*/
private Integer databaseStatus;
public Integer getSmsRecordId() {
return smsRecordId;
}
......@@ -283,4 +293,60 @@ public class InternationalSmsRecordDTO implements Serializable {
public void setNationName(String nationName) {
this.nationName = nationName;
}
public String getMemberName() {
return memberName;
}
public void setMemberName(String memberName) {
this.memberName = memberName;
}
public Integer getStoreId() {
return storeId;
}
public void setStoreId(Integer storeId) {
this.storeId = storeId;
}
public String getStoreName() {
return storeName;
}
public void setStoreName(String storeName) {
this.storeName = storeName;
}
public Integer getStoreGroupId() {
return storeGroupId;
}
public void setStoreGroupId(Integer storeGroupId) {
this.storeGroupId = storeGroupId;
}
public String getStoreGroupName() {
return storeGroupName;
}
public void setStoreGroupName(String storeGroupName) {
this.storeGroupName = storeGroupName;
}
public Integer getCacheStatus() {
return cacheStatus;
}
public void setCacheStatus(Integer cacheStatus) {
this.cacheStatus = cacheStatus;
}
public Integer getDatabaseStatus() {
return databaseStatus;
}
public void setDatabaseStatus(Integer databaseStatus) {
this.databaseStatus = databaseStatus;
}
}
......@@ -27,22 +27,22 @@ public class TabBillingInternationalSmsRecord {
private String receivePhone;
/**
* 支付方式
* 支付方式 支付方式 1微信 2支付宝 3.银行对公转账 4余额支付
*/
private Integer payType;
/**
* 应用
* 应用 运维后台配置
*/
private String appCode;
/**
* 应用name
* 应用name 运维后台配置
*/
private String appName;
/**
* 短信类型
* 短信类型 1:普通短信 2:短信验证码
*/
private Integer smsType;
......@@ -121,6 +121,16 @@ public class TabBillingInternationalSmsRecord {
*/
private String storeGroupName;
/**
* 缓存更新成功标志 1:成功
*/
private Integer cacheStatus;
/**
* 数据库更新成功标志 1:成功
*/
private Integer databaseStatus;
public Integer getSmsRecordId() {
return smsRecordId;
}
......@@ -304,4 +314,20 @@ public class TabBillingInternationalSmsRecord {
public void setStoreGroupName(String storeGroupName) {
this.storeGroupName = storeGroupName;
}
public Integer getCacheStatus() {
return cacheStatus;
}
public void setCacheStatus(Integer cacheStatus) {
this.cacheStatus = cacheStatus;
}
public Integer getDatabaseStatus() {
return databaseStatus;
}
public void setDatabaseStatus(Integer databaseStatus) {
this.databaseStatus = databaseStatus;
}
}
\ No newline at end of file
......@@ -44,4 +44,8 @@ public interface BillingInternationalSmsRecordService {
Integer save(InternationalSmsRecordDTO internationalSmsRecordDTO);
Integer countInternationalSmsRecord(RecordQO recordQO);
void updateCacheStatus(Integer smsRecordId);
void updateDatabaseStatus(InternationalSmsRecordDTO internationalSmsRecordDTO);
}
......@@ -15,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
......@@ -57,11 +58,30 @@ public class BillingInternationalSmsRecordServiceImpl implements BillingInternat
@Override
public Integer save(InternationalSmsRecordDTO internationalSmsRecordDTO) {
TabBillingInternationalSmsRecord billingInternationalSmsRecord = EntityUtil.changeEntityByJSON(TabBillingInternationalSmsRecord.class, internationalSmsRecordDTO);
return this.tabBillingInternationalSmsRecordMapper.insertSelective(billingInternationalSmsRecord);
this.tabBillingInternationalSmsRecordMapper.insertSelective(billingInternationalSmsRecord);
return billingInternationalSmsRecord.getSmsRecordId();
}
@Override
public Integer countInternationalSmsRecord(RecordQO recordQO) {
return tabBillingInternationalSmsRecordMapper.countInternationalSmsRecord(recordQO);
}
@Override
public void updateCacheStatus(Integer smsRecordId) {
TabBillingInternationalSmsRecord tabBillingInternationalSmsRecord = new TabBillingInternationalSmsRecord();
tabBillingInternationalSmsRecord.setSmsRecordId(smsRecordId);
tabBillingInternationalSmsRecord.setCacheStatus(1);
tabBillingInternationalSmsRecordMapper.updateByPrimaryKeySelective(tabBillingInternationalSmsRecord);
}
@Override
public void updateDatabaseStatus(InternationalSmsRecordDTO internationalSmsRecordDTO) {
TabBillingInternationalSmsRecord tabBillingInternationalSmsRecord = new TabBillingInternationalSmsRecord();
tabBillingInternationalSmsRecord.setSmsRecordId(internationalSmsRecordDTO.getSmsRecordId());
tabBillingInternationalSmsRecord.setDatabaseStatus(1);
tabBillingInternationalSmsRecord.setDeductionTime(new Date());
tabBillingInternationalSmsRecord.setAppName(internationalSmsRecordDTO.getAppName());
tabBillingInternationalSmsRecordMapper.updateByPrimaryKeySelective(tabBillingInternationalSmsRecord);
}
}
......@@ -63,6 +63,7 @@ public class BillingSmsRecordServiceImpl implements BillingSmsRecordService{
TabBillingSmsRecord billingSmsRecord = EntityUtil.changeEntityByJSON(TabBillingSmsRecord.class, smsRecordDTO);
billingSmsRecord.setStatus(GlobalInfo.DATA_STATUS_NORMAL);
billingSmsRecord.setCreateTime(new Date());
billingSmsRecord.setBillNumber(1);
tabBillingSmsRecordMapper.insertSelective(billingSmsRecord);
return billingSmsRecord.getSmsRecordId();
}
......
......@@ -86,11 +86,16 @@ public class InternationalSmsRecordApiServiceImpl implements InternationalSmsRec
logger.info("海外短信缓存扣费:{}", arg);
InternationalSmsRecordDTO internationalSmsRecordDTO = JSON.parseObject(arg, InternationalSmsRecordDTO.class);
// 判断是扣套餐包还是扣余额
// Integer fee = accountStandardService.queryUnitFee(internationalSmsRecordDTO.getEnterpriseId(), AccountStandardEnum.SMS.getCode());
billingAccountService.deductAccountByCache(internationalSmsRecordDTO.getFee(), internationalSmsRecordDTO.getEnterpriseId());
Integer fee = accountStandardService.queryUnitFee(internationalSmsRecordDTO.getEnterpriseId(), AccountStandardEnum.SMS.getCode());
billingAccountService.deductAccountByCache(fee, internationalSmsRecordDTO.getEnterpriseId());
internationalSmsRecordDTO.setFee((double)fee / 1000);
// todo 队列
client.sendMessage("InternationalSmsDbMq", arg);
Integer smsRecordId = billingInternationalSmsRecordService.save(internationalSmsRecordDTO);
internationalSmsRecordDTO.setSmsRecordId(smsRecordId);
// 队列
client.sendMessage("InternationalSmsDbMq", JSON.toJSONString(internationalSmsRecordDTO));
billingInternationalSmsRecordService.updateCacheStatus(internationalSmsRecordDTO.getSmsRecordId());
// this.executeDatabase(arg);
} catch (Exception e) {
logger.warn("调用mq失败", e);
......@@ -112,7 +117,7 @@ public class InternationalSmsRecordApiServiceImpl implements InternationalSmsRec
}
}
billingAccountService.deductAccountByDatabase(internationalSmsRecordDTO.getFee(), internationalSmsRecordDTO.getEnterpriseId());
billingInternationalSmsRecordService.save(internationalSmsRecordDTO);
billingInternationalSmsRecordService.updateDatabaseStatus(internationalSmsRecordDTO);
return ServiceResponse.success();
}
}
......@@ -162,8 +162,7 @@ public class SmsRecordApiServiceImpl implements SmsRecordApiService {
smsRecordDTO.setEnterpriseSmsPackageId(enterpriseSmsPackageId);
} else if (deductType == 4) {
// 余额扣费
Integer unitFee = accountStandardService.queryUnitFee(smsRecordDTO.getEnterpriseId(), AccountStandardEnum.SMS.getCode());
billingAccountService.deductAccountByDatabase(unitFee.doubleValue() / 1000, smsRecordDTO.getEnterpriseId());
billingAccountService.deductAccountByDatabase(smsRecordDTO.getFee(), smsRecordDTO.getEnterpriseId());
}
billingSmsRecordService.updateDatabaseStatus(smsRecordDTO);
return ServiceResponse.success();
......
......@@ -25,12 +25,14 @@
<result column="store_name" jdbcType="VARCHAR" property="storeName" />
<result column="store_group_id" jdbcType="INTEGER" property="storeGroupId" />
<result column="store_group_name" jdbcType="VARCHAR" property="storeGroupName" />
<result column="cache_status" jdbcType="INTEGER" property="cacheStatus" />
<result column="database_status" jdbcType="INTEGER" property="databaseStatus" />
</resultMap>
<sql id="Base_Column_List">
sms_record_id, status, send_time, receive_phone, pay_type, app_code, app_name, sms_type,
bill_number, fee, sms_content, create_time, update_time, deduction_time, enterprise_id,
enterprise_sms_package_id, nation_code, nation_name, member_name, store_id, store_name,
store_group_id, store_group_name
store_group_id, store_group_name, cache_status, database_status
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
......@@ -50,7 +52,8 @@
update_time, deduction_time, enterprise_id,
enterprise_sms_package_id, nation_code, nation_name,
member_name, store_id, store_name,
store_group_id, store_group_name)
store_group_id, store_group_name, cache_status,
database_status)
values (#{smsRecordId,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, #{sendTime,jdbcType=TIMESTAMP},
#{receivePhone,jdbcType=VARCHAR}, #{payType,jdbcType=INTEGER}, #{appCode,jdbcType=VARCHAR},
#{appName,jdbcType=VARCHAR}, #{smsType,jdbcType=INTEGER}, #{billNumber,jdbcType=INTEGER},
......@@ -58,9 +61,13 @@
#{updateTime,jdbcType=TIMESTAMP}, #{deductionTime,jdbcType=TIMESTAMP}, #{enterpriseId,jdbcType=INTEGER},
#{enterpriseSmsPackageId,jdbcType=INTEGER}, #{nationCode,jdbcType=VARCHAR}, #{nationName,jdbcType=VARCHAR},
#{memberName,jdbcType=VARCHAR}, #{storeId,jdbcType=INTEGER}, #{storeName,jdbcType=VARCHAR},
#{storeGroupId,jdbcType=INTEGER}, #{storeGroupName,jdbcType=VARCHAR})
#{storeGroupId,jdbcType=INTEGER}, #{storeGroupName,jdbcType=VARCHAR}, #{cacheStatus,jdbcType=INTEGER},
#{databaseStatus,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.gic.enterprise.entity.TabBillingInternationalSmsRecord">
<selectKey keyProperty="smsRecordId" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into tab_billing_international_sms_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="smsRecordId != null">
......@@ -132,6 +139,12 @@
<if test="storeGroupName != null">
store_group_name,
</if>
<if test="cacheStatus != null">
cache_status,
</if>
<if test="databaseStatus != null">
database_status,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="smsRecordId != null">
......@@ -203,6 +216,12 @@
<if test="storeGroupName != null">
#{storeGroupName,jdbcType=VARCHAR},
</if>
<if test="cacheStatus != null">
#{cacheStatus,jdbcType=INTEGER},
</if>
<if test="databaseStatus != null">
#{databaseStatus,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.enterprise.entity.TabBillingInternationalSmsRecord">
......@@ -274,6 +293,12 @@
<if test="storeGroupName != null">
store_group_name = #{storeGroupName,jdbcType=VARCHAR},
</if>
<if test="cacheStatus != null">
cache_status = #{cacheStatus,jdbcType=INTEGER},
</if>
<if test="databaseStatus != null">
database_status = #{databaseStatus,jdbcType=INTEGER},
</if>
</set>
where sms_record_id = #{smsRecordId,jdbcType=INTEGER}
</update>
......@@ -300,7 +325,9 @@
store_id = #{storeId,jdbcType=INTEGER},
store_name = #{storeName,jdbcType=VARCHAR},
store_group_id = #{storeGroupId,jdbcType=INTEGER},
store_group_name = #{storeGroupName,jdbcType=VARCHAR}
store_group_name = #{storeGroupName,jdbcType=VARCHAR},
cache_status = #{cacheStatus,jdbcType=INTEGER},
database_status = #{databaseStatus,jdbcType=INTEGER}
where sms_record_id = #{smsRecordId,jdbcType=INTEGER}
</update>
<select id="listHomeStatistics" parameterType="com.gic.enterprise.qo.HomeStatisticsQO" resultType="com.gic.enterprise.dto.HomeStatisticsDTO">
......
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