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

wx_score_history添加分表

release_toaliyun_real
xiaohanzi 5 лет назад
Родитель
Сommit
4d0681b64b
6 измененных файлов: 41 добавлений и 40 удалений
  1. +10
    -10
      mallinkAdmin/src/main/java/com/iformall/controller/mem/WxScoreHistoryController.java
  2. +7
    -4
      mallinkService/src/main/java/com/iformall/mapper/WxScoreHistoryMapper.java
  3. +2
    -2
      mallinkService/src/main/java/com/iformall/service/WxScoreHistoryService.java
  4. +4
    -4
      mallinkService/src/main/java/com/iformall/service/impl/WxScoreHistoryServiceImpl.java
  5. +7
    -5
      mallinkService/src/main/java/com/iformall/service/impl/WxScoreRulesServiceImpl.java
  6. +11
    -15
      mallinkService/src/main/resources/mapper/WxScoreHistoryMapper.xml

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

@@ -81,15 +81,15 @@ public class WxScoreHistoryController extends BaseController {
return false;
}

@ApiOperation("根据id删除接口")
@GetMapping("/del")
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true)
@SystemControllerLog(description = "成长值-删除")
public ResultData delete(Long id) {
logger.debug("[" + getIpAddr() + "] WxScoreHistoryController::delete");
wxScoreHistoryService.deleteById(id);
return new ResultData(Result.SUCCESS, "删除成功", null);
}
// @ApiOperation("根据id删除接口")
// @GetMapping("/del")
// @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true)
// @SystemControllerLog(description = "成长值-删除")
// public ResultData delete(Long id) {
// logger.debug("[" + getIpAddr() + "] WxScoreHistoryController::delete");
// wxScoreHistoryService.deleteById(id);
// return new ResultData(Result.SUCCESS, "删除成功", null);
// }

@ApiOperation("根据id查询接口")
@GetMapping("/findById")
@@ -97,7 +97,7 @@ public class WxScoreHistoryController extends BaseController {
@SystemControllerLog(description = "成长值-查询")
public ResultData findById(Long id) {
logger.debug("[" + getIpAddr() + "] WxScoreHistoryController::findById");
return new ResultData(Result.SUCCESS, "查询成功", wxScoreHistoryService.getById(id));
return new ResultData(Result.SUCCESS, "查询成功", wxScoreHistoryService.getById(id,getTenantInfo().getTenantId()));
}




+ 7
- 4
mallinkService/src/main/java/com/iformall/mapper/WxScoreHistoryMapper.java Просмотреть файл

@@ -1,19 +1,22 @@
package com.iformall.mapper;

import java.util.*;

import org.apache.ibatis.annotations.Param;

import com.iformall.common.CommonMapper;
import com.iformall.domain.po.WxScoreHistory;
import com.iformall.domain.vo.WxScoreHistoryNewIdVo;

public interface WxScoreHistoryMapper extends CommonMapper<WxScoreHistory, String> {

List<WxScoreHistory> findList(WxScoreHistory wxScoreHistory);
WxScoreHistory selectById(@Param("id")Long id,@Param("tenantId")String tenantId);
List<WxScoreHistory> findList(WxScoreHistory wxScoreHistory);
int countTodayList(WxScoreHistory wxScoreHistory);

int countList(WxScoreHistory wxScoreHistory);
int updateNewId(WxScoreHistoryNewIdVo wxScoreHistoryNewIdVo);
int deleteById(@Param("id")Long id,@Param("tenantId")String tenantId);
}

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

@@ -21,7 +21,7 @@ public interface WxScoreHistoryService {
* @param id
* @return
*/
WxScoreHistory getById(Long id);
WxScoreHistory getById(Long id,String tenantId);
/**
* 保存或更新实体
@@ -35,7 +35,7 @@ public interface WxScoreHistoryService {
*
* @param id
*/
void deleteById(Long id);
void deleteById(Long id,String tenantId);


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

@@ -27,8 +27,8 @@ public class WxScoreHistoryServiceImpl implements WxScoreHistoryService {
}

@Override
public WxScoreHistory getById(Long id) {
return wxScoreHistoryMapper.selectById(id);
public WxScoreHistory getById(Long id,String tennatId) {
return wxScoreHistoryMapper.selectById(id,tennatId);
}

@Override
@@ -44,8 +44,8 @@ public class WxScoreHistoryServiceImpl implements WxScoreHistoryService {
}

@Override
public void deleteById(Long id) {
wxScoreHistoryMapper.deleteById(id);
public void deleteById(Long id,String tenantId) {
wxScoreHistoryMapper.deleteById(id,tenantId);
}


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

@@ -273,7 +273,7 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService {
history = histories.get(0);
}
if (history != null) {
num = wxScoreHistoryMapper.deleteById(history.getId());
num = wxScoreHistoryMapper.deleteById(history.getId(),record.getTenantId());
if (num != 1) {
logger.error("删除成长值历史出错"+ history.toString());
throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "删除成长值历史出错");
@@ -307,17 +307,18 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService {
}


private int checkTodayLoginScoreCount(WxCUserBasicInfo cUser) {
private int checkTodayLoginScoreCount(WxCUserBasicInfo cUser,TenantEntity tenantinfo) {
WxScoreHistory scoreHistory = new WxScoreHistory();
scoreHistory.setCUserId(cUser.getId());
scoreHistory.setScoreType(EnumScoreType.LOGIN.getCode());
scoreHistory.updateTenantInfo(tenantinfo);
return wxScoreHistoryMapper.countTodayList(scoreHistory);
}

private int loginAddScore(TenantEntity tenantEntity,WxCUserBasicInfo user) {
int addScoreNumber = 0;

if (checkTodayLoginScoreCount(user) > 0)
if (checkTodayLoginScoreCount(user,tenantEntity) > 0)
return 0;

// 1. score_rules
@@ -440,16 +441,17 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService {
return addScoreNumber;
}

private int checkCompleteInfoScoreCount(WxCUserBasicInfo user) {
private int checkCompleteInfoScoreCount(WxCUserBasicInfo user,TenantEntity tenantinfo) {
WxScoreHistory scoreHistory = new WxScoreHistory();
scoreHistory.setCUserId(user.getId());
scoreHistory.setScoreType(EnumScoreType.COMPLETE_INFO.getCode());
scoreHistory.updateTenantInfo(tenantinfo);
return wxScoreHistoryMapper.countList(scoreHistory);
}

private int infoAddScore(TenantEntity tenantEntity,WxCUserBasicInfo user) {
int addScoreNumber = 0;
if (checkCompleteInfoScoreCount(user) > 0)
if (checkCompleteInfoScoreCount(user,tenantEntity) > 0)
return 0;

// 1. 获取score rules


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

@@ -87,10 +87,14 @@
<include refid="dynamicWhereConditions"/>
</select>

<select id="selectById" parameterType="java.util.HashMap" resultMap="BaseResultMap">
select <include refid="allColumns"/> from wx_score_history where id = #{id} and tenant_id = #{tenantId}
</select>

<select id="countTodayList" parameterType="com.iformall.domain.po.WxScoreHistory" resultType="java.lang.Integer">
select count(*)
select count(1)
from wx_score_history
where 1=1
where tenant_id = #{tenantId}
<if test=" null != cUserId ">
and `c_user_id` = #{cUserId}
</if>
@@ -101,7 +105,7 @@
</select>

<select id="countList" parameterType="com.iformall.domain.po.WxScoreHistory" resultType="java.lang.Integer">
select count(*)
select count(1)
from wx_score_history
where 1=1
<if test=" null != tenantId and '' != tenantId">
@@ -117,17 +121,9 @@
and `score_type` = #{scoreType}
</if>
</select>

<update id="updateNewId" parameterType="com.iformall.domain.vo.WxScoreHistoryNewIdVo">
update wx_score_history
set c_user_id=#{newUserId}
where c_user_id = #{cUserId}
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
</update>
<delete id="deleteById" parameterType="java.util.HashMap">
delete from wx_score_history where id = #{id} and tenant_id = #{tenantId}
</delete>

</mapper>

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