| @@ -81,15 +81,15 @@ public class WxScoreHistoryController extends BaseController { | |||||
| return false; | 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查询接口") | @ApiOperation("根据id查询接口") | ||||
| @GetMapping("/findById") | @GetMapping("/findById") | ||||
| @@ -97,7 +97,7 @@ public class WxScoreHistoryController extends BaseController { | |||||
| @SystemControllerLog(description = "成长值-查询") | @SystemControllerLog(description = "成长值-查询") | ||||
| public ResultData findById(Long id) { | public ResultData findById(Long id) { | ||||
| logger.debug("[" + getIpAddr() + "] WxScoreHistoryController::findById"); | logger.debug("[" + getIpAddr() + "] WxScoreHistoryController::findById"); | ||||
| return new ResultData(Result.SUCCESS, "查询成功", wxScoreHistoryService.getById(id)); | |||||
| return new ResultData(Result.SUCCESS, "查询成功", wxScoreHistoryService.getById(id,getTenantInfo().getTenantId())); | |||||
| } | } | ||||
| @@ -1,19 +1,22 @@ | |||||
| package com.iformall.mapper; | package com.iformall.mapper; | ||||
| import java.util.*; | import java.util.*; | ||||
| import org.apache.ibatis.annotations.Param; | |||||
| import com.iformall.common.CommonMapper; | import com.iformall.common.CommonMapper; | ||||
| import com.iformall.domain.po.WxScoreHistory; | import com.iformall.domain.po.WxScoreHistory; | ||||
| import com.iformall.domain.vo.WxScoreHistoryNewIdVo; | |||||
| public interface WxScoreHistoryMapper extends CommonMapper<WxScoreHistory, String> { | 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 countTodayList(WxScoreHistory wxScoreHistory); | ||||
| int countList(WxScoreHistory wxScoreHistory); | int countList(WxScoreHistory wxScoreHistory); | ||||
| int updateNewId(WxScoreHistoryNewIdVo wxScoreHistoryNewIdVo); | |||||
| int deleteById(@Param("id")Long id,@Param("tenantId")String tenantId); | |||||
| } | } | ||||
| @@ -21,7 +21,7 @@ public interface WxScoreHistoryService { | |||||
| * @param id | * @param id | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| WxScoreHistory getById(Long id); | |||||
| WxScoreHistory getById(Long id,String tenantId); | |||||
| /** | /** | ||||
| * 保存或更新实体 | * 保存或更新实体 | ||||
| @@ -35,7 +35,7 @@ public interface WxScoreHistoryService { | |||||
| * | * | ||||
| * @param id | * @param id | ||||
| */ | */ | ||||
| void deleteById(Long id); | |||||
| void deleteById(Long id,String tenantId); | |||||
| @@ -27,8 +27,8 @@ public class WxScoreHistoryServiceImpl implements WxScoreHistoryService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public WxScoreHistory getById(Long id) { | |||||
| return wxScoreHistoryMapper.selectById(id); | |||||
| public WxScoreHistory getById(Long id,String tennatId) { | |||||
| return wxScoreHistoryMapper.selectById(id,tennatId); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -44,8 +44,8 @@ public class WxScoreHistoryServiceImpl implements WxScoreHistoryService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public void deleteById(Long id) { | |||||
| wxScoreHistoryMapper.deleteById(id); | |||||
| public void deleteById(Long id,String tenantId) { | |||||
| wxScoreHistoryMapper.deleteById(id,tenantId); | |||||
| } | } | ||||
| @@ -273,7 +273,7 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||||
| history = histories.get(0); | history = histories.get(0); | ||||
| } | } | ||||
| if (history != null) { | if (history != null) { | ||||
| num = wxScoreHistoryMapper.deleteById(history.getId()); | |||||
| num = wxScoreHistoryMapper.deleteById(history.getId(),record.getTenantId()); | |||||
| if (num != 1) { | if (num != 1) { | ||||
| logger.error("删除成长值历史出错"+ history.toString()); | logger.error("删除成长值历史出错"+ history.toString()); | ||||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "删除成长值历史出错"); | 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(); | WxScoreHistory scoreHistory = new WxScoreHistory(); | ||||
| scoreHistory.setCUserId(cUser.getId()); | scoreHistory.setCUserId(cUser.getId()); | ||||
| scoreHistory.setScoreType(EnumScoreType.LOGIN.getCode()); | scoreHistory.setScoreType(EnumScoreType.LOGIN.getCode()); | ||||
| scoreHistory.updateTenantInfo(tenantinfo); | |||||
| return wxScoreHistoryMapper.countTodayList(scoreHistory); | return wxScoreHistoryMapper.countTodayList(scoreHistory); | ||||
| } | } | ||||
| private int loginAddScore(TenantEntity tenantEntity,WxCUserBasicInfo user) { | private int loginAddScore(TenantEntity tenantEntity,WxCUserBasicInfo user) { | ||||
| int addScoreNumber = 0; | int addScoreNumber = 0; | ||||
| if (checkTodayLoginScoreCount(user) > 0) | |||||
| if (checkTodayLoginScoreCount(user,tenantEntity) > 0) | |||||
| return 0; | return 0; | ||||
| // 1. score_rules | // 1. score_rules | ||||
| @@ -440,16 +441,17 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||||
| return addScoreNumber; | return addScoreNumber; | ||||
| } | } | ||||
| private int checkCompleteInfoScoreCount(WxCUserBasicInfo user) { | |||||
| private int checkCompleteInfoScoreCount(WxCUserBasicInfo user,TenantEntity tenantinfo) { | |||||
| WxScoreHistory scoreHistory = new WxScoreHistory(); | WxScoreHistory scoreHistory = new WxScoreHistory(); | ||||
| scoreHistory.setCUserId(user.getId()); | scoreHistory.setCUserId(user.getId()); | ||||
| scoreHistory.setScoreType(EnumScoreType.COMPLETE_INFO.getCode()); | scoreHistory.setScoreType(EnumScoreType.COMPLETE_INFO.getCode()); | ||||
| scoreHistory.updateTenantInfo(tenantinfo); | |||||
| return wxScoreHistoryMapper.countList(scoreHistory); | return wxScoreHistoryMapper.countList(scoreHistory); | ||||
| } | } | ||||
| private int infoAddScore(TenantEntity tenantEntity,WxCUserBasicInfo user) { | private int infoAddScore(TenantEntity tenantEntity,WxCUserBasicInfo user) { | ||||
| int addScoreNumber = 0; | int addScoreNumber = 0; | ||||
| if (checkCompleteInfoScoreCount(user) > 0) | |||||
| if (checkCompleteInfoScoreCount(user,tenantEntity) > 0) | |||||
| return 0; | return 0; | ||||
| // 1. 获取score rules | // 1. 获取score rules | ||||
| @@ -87,10 +87,14 @@ | |||||
| <include refid="dynamicWhereConditions"/> | <include refid="dynamicWhereConditions"/> | ||||
| </select> | </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 id="countTodayList" parameterType="com.iformall.domain.po.WxScoreHistory" resultType="java.lang.Integer"> | ||||
| select count(*) | |||||
| select count(1) | |||||
| from wx_score_history | from wx_score_history | ||||
| where 1=1 | |||||
| where tenant_id = #{tenantId} | |||||
| <if test=" null != cUserId "> | <if test=" null != cUserId "> | ||||
| and `c_user_id` = #{cUserId} | and `c_user_id` = #{cUserId} | ||||
| </if> | </if> | ||||
| @@ -101,7 +105,7 @@ | |||||
| </select> | </select> | ||||
| <select id="countList" parameterType="com.iformall.domain.po.WxScoreHistory" resultType="java.lang.Integer"> | <select id="countList" parameterType="com.iformall.domain.po.WxScoreHistory" resultType="java.lang.Integer"> | ||||
| select count(*) | |||||
| select count(1) | |||||
| from wx_score_history | from wx_score_history | ||||
| where 1=1 | where 1=1 | ||||
| <if test=" null != tenantId and '' != tenantId"> | <if test=" null != tenantId and '' != tenantId"> | ||||
| @@ -117,17 +121,9 @@ | |||||
| and `score_type` = #{scoreType} | and `score_type` = #{scoreType} | ||||
| </if> | </if> | ||||
| </select> | </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> | </mapper> | ||||