Browse Source

Merge branch 'release_toaliyun_real' of https://git.malls.iformall.com/server/formallProject into release_toaliyun_real

release_toaliyun_real
winter 4 years ago
parent
commit
ea94224f7e
3 changed files with 42 additions and 29 deletions
  1. +21
    -1
      mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCUserBasicInfoController.java
  2. +7
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxCUserBasicInfo.java
  3. +14
    -28
      mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml

+ 21
- 1
mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCUserBasicInfoController.java View File

@@ -92,6 +92,23 @@ public class WxCUserBasicInfoController extends BaseController {
@Autowired
private WxCreditHistoryService wxCreditHistoryService;

private void updateLevelParam(WxCUserBasicInfo info) {
List<WxLevelConfig> levelList = wxLevelConfigService.getByTenantInfo(ifParentUpdateTenantInfo());
levelList = levelList.stream()
.sorted(Comparator.comparing(WxLevelConfig::getPoints))
.collect(Collectors.toList());
for (int levelIndex = 0; levelIndex < levelList.size(); levelIndex++) {
WxLevelConfig l = levelList.get(levelIndex);
if(l.getId().equals(info.getLevelId())){
Integer levelStartScore = l.getPoints();
Integer levelEndScore = levelIndex + 1 < levelList.size() ? levelList.get(levelIndex + 1).getPoints() : null;
info.setLevelStartScore(levelStartScore);
info.setLevelEndScore(levelEndScore);
break;
}
}
}

private void setUserInfoLevel(WxCUserBasicInfo info) {

if (info.getPoins() == null || info.getPoins() == 0) {
@@ -170,6 +187,9 @@ public class WxCUserBasicInfoController extends BaseController {
if (StringUtils.isBlank(wxCUserBasicInfo.getName())) {
wxCUserBasicInfo.setName(null);
}
if (wxCUserBasicInfo.getLevelId() != null){
updateLevelParam(wxCUserBasicInfo);
}
}
wxCUserBasicInfo.undateFinalTenantId(ifParentUpdateTenantInfo());
wxCUserBasicInfo.setSortColumns(BaseEntity.SortField.wcubiActiveTime_DESC);
@@ -177,7 +197,7 @@ public class WxCUserBasicInfoController extends BaseController {

if (page.getSize() > 0) {
for (WxCUserBasicInfo info : page.getList()) {
// setUserInfoLevel(info);
setUserInfoLevel(info);
setUserInfoCarCount(info);
info.setCreditStartTime(wxCUserBasicInfo.getCreditStartTime());
info.setCreditEndTime(wxCUserBasicInfo.getCreditEndTime());


+ 7
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxCUserBasicInfo.java View File

@@ -123,6 +123,13 @@ public class WxCUserBasicInfo extends TenantEntityWithoutFinalTenantId {
@io.swagger.annotations.ApiModelProperty(value="会员等级",name="level")
private String level;

@TableField(exist = false)
private Long levelId;
@TableField(exist = false)
private Integer levelStartScore;
@TableField(exist = false)
private Integer levelEndScore;

@TableField(exist = false)
private List<WxLevelConfig> levelList;



+ 14
- 28
mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml View File

@@ -36,10 +36,8 @@
wcubi.`id`,wcubi.`phone`,wcubi.`birthdate`,wcubi.`education`,wcubi.`sex`,wcubi.`height`,wcubi.`weight`,wcubi.`id_card`,wcubi.`email`,
wcubi.`address`,wcubi.`poins`,wcubi.`tag_id`,wcubi.`create_date`,wcubi.`update_date`,
wcubi.`final_tenant_id`,wcubi.`tenant_id`,wcubi.`parent_tenant_id`,wcubi.`name`,wcubi.`nick_name`,
wcubi.`avatar_url`,wcubi.`credit`,wcubi.`active_time`,wcubi.`login_count`,wcubi.`act_record`,wcubi.`qr_code`
,(select level from wx_level_config
where poins >= points and tenant_id=wcubi.final_tenant_id
order by points desc limit 1 ) level,wcubi.score_date,wcubi.status
wcubi.`avatar_url`,wcubi.`credit`,wcubi.`active_time`,wcubi.`login_count`,wcubi.`act_record`,wcubi.`qr_code`,
wcubi.score_date,wcubi.status
</sql>
<sql id="allSimpleColumns">
@@ -82,12 +80,12 @@
and wcubi.`address` like concat('%', #{address},'%')
</if>

<if test=" null != poins ">
and wcubi.`poins` = #{poins}
<if test=" null != levelStartScore ">
and wcubi.poins &gt;= #{levelStartScore}
</if>

<if test=" null != credit ">
and wcubi.`credit` = #{credit}
<if test=" null != levelEndScore">
and wcubi.poins &lt; #{levelEndScore}
</if>

<if test=" null != tagId ">
@@ -144,16 +142,10 @@
</select>

<select id="findList" parameterType="com.iformall.domain.po.WxCUserBasicInfo" resultMap="BaseResultMap">
select r.* from (
select
<include refid="allColumns"/>
from wx_c_user_basic_info wcubi
<include refid="dynamicWhereConditions"/>
) r where 1=1

<if test="null != level and '' != level">
and r.level =#{level}
</if>
select
<include refid="allColumns"/>
from wx_c_user_basic_info wcubi
<include refid="dynamicWhereConditions"/>
</select>

<sql id="dynamicWhereConditions1">
@@ -191,12 +183,12 @@
and wcubi.`address` like concat('%', #{basicInfo.address},'%')
</if>

<if test=" null != basicInfo.poins ">
and wcubi.`poins` = #{basicInfo.poins}
<if test=" null != basicInfo.levelStartScore ">
and wcubi.poins &gt;= #{basicInfo.levelStartScore}
</if>

<if test=" null != basicInfo.credit ">
and wcubi.`credit` = #{basicInfo.credit}
<if test=" null != basicInfo.levelEndScore">
and wcubi.poins &lt; #{basicInfo.levelEndScore}
</if>

<if test=" null != basicInfo.tagId ">
@@ -266,16 +258,10 @@


<select id="findList1" resultMap="BaseResultMap">
select r.* from (
select
<include refid="allColumns"/>
from wx_c_user_basic_info wcubi
<include refid="dynamicWhereConditions1"/>
) r where 1=1

<if test="null != basicInfo.level and '' != basicInfo.level">
and r.level =#{basicInfo.level}
</if>
</select>

<update id="updateScore" parameterType="com.iformall.domain.po.WxCUserBasicInfo">


Loading…
Cancel
Save