Просмотр исходного кода

[积分][修改]:花费金额增加str字段 导出增加积分字段

release_toaliyun_real
hanxueda 7 лет назад
Родитель
Сommit
09331a4bbb
6 измененных файлов: 20 добавлений и 11 удалений
  1. +2
    -2
      mallinkAdmin/src/main/java/com/iformall/controller/WxCreditHistoryController.java
  2. +2
    -2
      mallinkBApi/src/main/java/com/iformall/controller/WxCreditHistoryController.java
  3. +4
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxCreditHistory.java
  4. +1
    -1
      mallinkService/src/main/java/com/iformall/service/WxCreditHistoryService.java
  5. +9
    -4
      mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java
  6. +2
    -2
      mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml

+ 2
- 2
mallinkAdmin/src/main/java/com/iformall/controller/WxCreditHistoryController.java Просмотреть файл

@@ -40,9 +40,9 @@ public class WxCreditHistoryController extends BaseController
@ApiImplicitParams({
@ApiImplicitParam(name="merchantId",value="商户ID",dataType="long", paramType = "query",required=true),
@ApiImplicitParam(name="spend",value="消费金额",dataType="int", paramType = "query",required=true)})
public ResultData findByMerchantIdAndSpend(@RequestParam Long merchantId, @RequestParam Integer spend) {
public ResultData findByMerchantIdAndSpend(@RequestParam Long merchantId, @RequestParam String spendStr) {
logger.debug("[" + getIpAddr() + "] WxCreditHistoryController::findByMerchantIdAndSpend");
return new ResultData(wxCreditHistoryService.findByMerchantIdAndSpend(merchantId,spend,getTenantId()));
return new ResultData(wxCreditHistoryService.findByMerchantIdAndSpend(merchantId,spendStr,getTenantId()));
}

@ApiOperation("新增接口")


+ 2
- 2
mallinkBApi/src/main/java/com/iformall/controller/WxCreditHistoryController.java Просмотреть файл

@@ -35,9 +35,9 @@ public class WxCreditHistoryController extends BaseController {
@ApiImplicitParams({
@ApiImplicitParam(name="merchantId",value="商户ID",dataType="long", paramType = "query",required=true),
@ApiImplicitParam(name="spend",value="消费金额",dataType="int", paramType = "query",required=true)})
public ResultData findByMerchantIdAndSpend(@RequestParam Long merchantId, @RequestParam Integer spend) {
public ResultData findByMerchantIdAndSpend(@RequestParam Long merchantId, @RequestParam String spendStr) {
log.debug("[" + getIpAddr() + "] WxCreditHistoryController::findByMerchantIdAndSpend");
return new ResultData(wxCreditHistoryService.findByMerchantIdAndSpend(merchantId,spend,getTenantId()));
return new ResultData(wxCreditHistoryService.findByMerchantIdAndSpend(merchantId,spendStr,getTenantId()));
}

@ApiOperation("根据手机号查询接口")


+ 4
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxCreditHistory.java Просмотреть файл

@@ -39,6 +39,10 @@ public class WxCreditHistory implements Serializable {
@io.swagger.annotations.ApiModelProperty(value="姓名",name="name")
private String name;

@Transient
@io.swagger.annotations.ApiModelProperty(value="花费Str",name="spendStr")
private String spendStr;

/**租户ID*/
@io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId")
private String tenantId;


+ 1
- 1
mallinkService/src/main/java/com/iformall/service/WxCreditHistoryService.java Просмотреть файл

@@ -50,7 +50,7 @@ public interface WxCreditHistoryService {
*/
void deleteById(Long id);

Map<String, Integer> findByMerchantIdAndSpend(Long merchantId, Integer spend, String tenantId);
Map<String, Integer> findByMerchantIdAndSpend(Long merchantId, String spendStr, String tenantId);

}

+ 9
- 4
mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java Просмотреть файл

@@ -19,11 +19,13 @@ import com.iformall.service.WxCreditHistoryService;
import com.iformall.service.WxScoreRulesService;
import com.iformall.utils.RedisLock;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;
@@ -147,8 +149,9 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService {
//验证此用户是否存在
throw new MallinkException(ErrorCode.USER_IS_EMPTY);
}
//获取当前用户总积分
//int currentCreditAmount = wxCreditHistoryMapper.creditAmount(record.getCUserId());
if (StringUtils.isNotEmpty(record.getSpendStr())) {
record.setSpend(new BigDecimal(record.getSpendStr()).multiply(new BigDecimal(100)).intValue());
}
int currentCreditAmount = 0;
//获取当前用户总积分规则:优先获取wxCUserBasicInfo中数据 若不存在 再获取wxCUser表中数据
if (wxCUserBasicInfo != null && wxCUserBasicInfo.getCredit() != null && wxCUserBasicInfo.getCredit() > 0) {
@@ -197,14 +200,16 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService {
}

@Override
public Map<String, Integer> findByMerchantIdAndSpend(Long merchantId, Integer spend, String tenantId) {
public Map<String, Integer> findByMerchantIdAndSpend(Long merchantId, String spendStr, String tenantId) {
WxMerchant wxMerchant = wxMerchantMapper.selectByPrimaryKey(merchantId);
Map<String, Integer> creditMap = Maps.newHashMap();
if (wxMerchant != null && wxMerchant.getBusinessId() != null) {
WxCreditHistory wxCreditHistory = new WxCreditHistory();
wxCreditHistory.setBusinessId(Long.valueOf(wxMerchant.getBusinessId()));
wxCreditHistory.setTenantId(tenantId);
wxCreditHistory.setSpend(spend);
if (StringUtils.isNotEmpty(spendStr)) {
wxCreditHistory.setSpend(new BigDecimal(spendStr).multiply(new BigDecimal(100)).intValue());
}
int credit = payAddCredit(wxCreditHistory);
creditMap.put("credit", credit);
}


+ 2
- 2
mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml Просмотреть файл

@@ -245,14 +245,14 @@
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="level" jdbcType="VARCHAR" property="level"/>
<result column="nick_name" jdbcType="VARCHAR" property="nickName"/>
<result column="credit" jdbcType="INTEGER" property="credit"/>
<result column="tags" jdbcType="VARCHAR" property="tags"/>
</resultMap>

<sql id="allVoColumns">
cu.`id`,cu.`phone`,cu.`birthdate`,cu.`education`,cu.`sex`,cu.`email`,cu.`address`,cu.`poins`,cu.`tag_id`,
cu.`create_date`,cu.`update_date`,cu.`tenant_id`,cu.`name`,cu.`level`,cu.`nick_name`,
cut.`tags`
cut.`tags`,cu.`credit`
</sql>

<sql id="dynamicVoWhereConditions">


Загрузка…
Отмена
Сохранить