| @@ -14,6 +14,7 @@ import com.iformall.enums.EnumRentContractAppStatus; | |||||
| import com.iformall.enums.EnumYesOrNo; | import com.iformall.enums.EnumYesOrNo; | ||||
| import com.iformall.service.ExcelService; | import com.iformall.service.ExcelService; | ||||
| import com.iformall.service.WxBusinessService; | import com.iformall.service.WxBusinessService; | ||||
| import com.iformall.utils.Constant; | |||||
| import com.iformall.utils.DateUtils; | import com.iformall.utils.DateUtils; | ||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| @@ -45,7 +46,7 @@ public class WxBusinessController extends BaseController { | |||||
| @SystemControllerLog(description = "业态-全列表") | @SystemControllerLog(description = "业态-全列表") | ||||
| public ResultData listAll() { | public ResultData listAll() { | ||||
| logger.debug("[" + getIpAddr() + "] WxBusinessController::getList"); | logger.debug("[" + getIpAddr() + "] WxBusinessController::getList"); | ||||
| final List<WxBusiness> busList = wxBusinessService.findListAll(getTenantInfo(),null,null); | |||||
| final List<WxBusiness> busList = wxBusinessService.findListAll(true,getTenantInfo(),null,null); | |||||
| return new ResultData(busList); | return new ResultData(busList); | ||||
| } | } | ||||
| @@ -30,7 +30,7 @@ public class WxBusinessController extends BaseController { | |||||
| if(appPlat == null){ | if(appPlat == null){ | ||||
| appPlat = EnumAppPlat.WX; | appPlat = EnumAppPlat.WX; | ||||
| } | } | ||||
| return new ResultData(wxBusinessService.findListAll(getTenantInfo(),filter,appPlat.getCode())); | |||||
| return new ResultData(wxBusinessService.findListAll(true,getTenantInfo(),filter,appPlat.getCode())); | |||||
| } | } | ||||
| } | } | ||||
| @@ -11,8 +11,8 @@ public interface WxBusinessMapper extends CommonMapper<WxBusiness, String> { | |||||
| List<WxBusiness> findList(WxBusiness wxBusiness); | List<WxBusiness> findList(WxBusiness wxBusiness); | ||||
| List<WxBusiness> findListAll(WxBusiness wxBusiness); | List<WxBusiness> findListAll(WxBusiness wxBusiness); | ||||
| List<WxBusiness> findListForMerchant(@Param("finalTenantId")String finalTenantId,@Param("isRoot")Integer isRoot,@Param("tenantId") String tenantId, @Param("parentTenantId") String parentTenantId); | |||||
| List<WxBusiness> findListForCoupon(@Param("finalTenantId")String finalTenantId,@Param("isRoot")Integer isRoot,@Param("tenantId") String tenantId, @Param("parentTenantId") String parentTenantId, @Param("platCode") Integer platCode); | |||||
| List<WxBusiness> findListForMerchant(@Param("finalTenantId")String finalTenantId,@Param("isRoot")Integer isRoot,@Param("isDel")Integer isDel,@Param("tenantId") String tenantId, @Param("parentTenantId") String parentTenantId); | |||||
| List<WxBusiness> findListForCoupon(@Param("finalTenantId")String finalTenantId,@Param("isRoot")Integer isRoot,@Param("isDel")Integer isDel,@Param("tenantId") String tenantId, @Param("parentTenantId") String parentTenantId, @Param("platCode") Integer platCode); | |||||
| List<Map<String,Object>> businessDataList(WxBusiness wxBusiness); | List<Map<String,Object>> businessDataList(WxBusiness wxBusiness); | ||||
| @@ -44,7 +44,7 @@ public interface WxBusinessService { | |||||
| * | * | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| List<WxBusiness> findListAll(TenantEntity tenantEntity, Integer filter,Integer platCode); | |||||
| List<WxBusiness> findListAll(boolean isValid,TenantEntity tenantEntity, Integer filter,Integer platCode); | |||||
| /** | /** | ||||
| * 根据Id获得实体 | * 根据Id获得实体 | ||||
| @@ -9,6 +9,7 @@ import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.domain.po.WxBusiness; | import com.iformall.domain.po.WxBusiness; | ||||
| import com.iformall.domain.po.WxPropertyContract; | import com.iformall.domain.po.WxPropertyContract; | ||||
| import com.iformall.domain.po.WxRentContract; | import com.iformall.domain.po.WxRentContract; | ||||
| import com.iformall.domain.po.WxScoreRules; | |||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| import com.iformall.mapper.WxBusinessMapper; | import com.iformall.mapper.WxBusinessMapper; | ||||
| import com.iformall.mapper.WxPropertyContractMapper; | import com.iformall.mapper.WxPropertyContractMapper; | ||||
| @@ -20,6 +21,8 @@ import org.apache.commons.collections.CollectionUtils; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.beans.factory.annotation.Qualifier; | |||||
| import org.springframework.data.redis.core.RedisTemplate; | |||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import java.io.Serializable; | import java.io.Serializable; | ||||
| @@ -42,6 +45,10 @@ public class WxBusinessServiceImpl implements WxBusinessService { | |||||
| private WxRentContractMapper wxRentContractMapper; | private WxRentContractMapper wxRentContractMapper; | ||||
| @Autowired | @Autowired | ||||
| private WxPropertyContractMapper wxPropertyContractMapper; | private WxPropertyContractMapper wxPropertyContractMapper; | ||||
| @Autowired | |||||
| @Qualifier("scoreRuleRedisTemplate") | |||||
| RedisTemplate<String, WxScoreRules> scoreRulesRedisTemplate; | |||||
| @Override | @Override | ||||
| public void businessInit(TenantEntity tenantInfo) { | public void businessInit(TenantEntity tenantInfo) { | ||||
| @@ -68,18 +75,23 @@ public class WxBusinessServiceImpl implements WxBusinessService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public List<WxBusiness> findListAll(TenantEntity tenantEntity, Integer filter,Integer paltCode) { | |||||
| public List<WxBusiness> findListAll(boolean isValid,TenantEntity tenantEntity, Integer filter,Integer paltCode) { | |||||
| WxBusiness bq = new WxBusiness(); | WxBusiness bq = new WxBusiness(); | ||||
| bq.setFinalTenantId(tenantEntity.getFinalTenantId()); | bq.setFinalTenantId(tenantEntity.getFinalTenantId()); | ||||
| bq.setIsRoot(EnumYesOrNo.YES.getCode()); | bq.setIsRoot(EnumYesOrNo.YES.getCode()); | ||||
| Integer isDel = null; | |||||
| if (isValid) { | |||||
| isDel = EnumYesOrNo.NO.getCode(); | |||||
| } | |||||
| bq.setIsDel(isDel); | |||||
| if (filter == null){ | if (filter == null){ | ||||
| return wxBusinessMapper.findListAll(bq); | return wxBusinessMapper.findListAll(bq); | ||||
| }else if (filter.equals(EnumBusinessFilter.FILTER_BY_COUPON.getCode())) { | }else if (filter.equals(EnumBusinessFilter.FILTER_BY_COUPON.getCode())) { | ||||
| if (paltCode == null) | if (paltCode == null) | ||||
| paltCode = EnumAppPlat.WX.getCode(); | paltCode = EnumAppPlat.WX.getCode(); | ||||
| return wxBusinessMapper.findListForCoupon(tenantEntity.getFinalTenantId(),EnumYesOrNo.YES.getCode(),tenantEntity.getTenantId(), tenantEntity.getParentTenantId(), paltCode); | |||||
| return wxBusinessMapper.findListForCoupon(tenantEntity.getFinalTenantId(),EnumYesOrNo.YES.getCode(),isDel,tenantEntity.getTenantId(), tenantEntity.getParentTenantId(), paltCode); | |||||
| }else if (filter.equals(EnumBusinessFilter.FILTER_BY_MERCHANT.getCode())) { | }else if (filter.equals(EnumBusinessFilter.FILTER_BY_MERCHANT.getCode())) { | ||||
| return wxBusinessMapper.findListForMerchant(tenantEntity.getFinalTenantId(),EnumYesOrNo.YES.getCode(),tenantEntity.getTenantId(), tenantEntity.getParentTenantId()); | |||||
| return wxBusinessMapper.findListForMerchant(tenantEntity.getFinalTenantId(),EnumYesOrNo.YES.getCode(),isDel,tenantEntity.getTenantId(), tenantEntity.getParentTenantId()); | |||||
| }else { | }else { | ||||
| return wxBusinessMapper.findListAll(bq); | return wxBusinessMapper.findListAll(bq); | ||||
| } | } | ||||
| @@ -312,6 +324,25 @@ public class WxBusinessServiceImpl implements WxBusinessService { | |||||
| record.setUpdateDate(new Date()); | record.setUpdateDate(new Date()); | ||||
| wxBusinessMapper.updateById(record); | wxBusinessMapper.updateById(record); | ||||
| } | } | ||||
| //删除积分规则,成长值规则缓存 | |||||
| String key = Constant.SCORE_RULES_KEY_PREV + record.getFinalTenantId(); | |||||
| boolean hasKey = scoreRulesRedisTemplate.hasKey(key); | |||||
| if (hasKey) { | |||||
| scoreRulesRedisTemplate.delete(key); | |||||
| } | |||||
| String key1 = Constant.CREDIT_RULES_KEY_PREV + record.getFinalTenantId(); | |||||
| boolean hasKey1 = scoreRulesRedisTemplate.hasKey(key1); | |||||
| if (hasKey1) { | |||||
| scoreRulesRedisTemplate.delete(key1); | |||||
| } | |||||
| String key2 = Constant.CREDIT_DOUBLE_RULES_KEY_PREV + record.getFinalTenantId(); | |||||
| boolean hasKey2 = scoreRulesRedisTemplate.hasKey(key2); | |||||
| if (hasKey2) { | |||||
| scoreRulesRedisTemplate.delete(key2); | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -734,7 +734,7 @@ public class WxChartServiceImpl implements WxChartDataService { | |||||
| kwMerchantMeterDataDto.setLimitCount(null); | kwMerchantMeterDataDto.setLimitCount(null); | ||||
| List <KwMerchantMeterDataVo> businessPower = kwMerchantMeterService.findDataVoList(kwMerchantMeterDataDto); | List <KwMerchantMeterDataVo> businessPower = kwMerchantMeterService.findDataVoList(kwMerchantMeterDataDto); | ||||
| List <WxBusiness> businessList = wxBusinessService.findListAll(tenantEntity,null,null); | |||||
| List <WxBusiness> businessList = wxBusinessService.findListAll(true,tenantEntity,null,null); | |||||
| businessList.stream().forEach(b->{ | businessList.stream().forEach(b->{ | ||||
| Optional<KwMerchantMeterDataVo> businessData = businessPower.stream().filter(bd->bd.getBusinessId().equals(b.getId())).findAny(); | Optional<KwMerchantMeterDataVo> businessData = businessPower.stream().filter(bd->bd.getBusinessId().equals(b.getId())).findAny(); | ||||
| if (businessData.isPresent()) { | if (businessData.isPresent()) { | ||||
| @@ -132,7 +132,7 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||||
| } | } | ||||
| } | } | ||||
| //根据业态来匹配 | //根据业态来匹配 | ||||
| List<WxBusiness> rootBusiness = wxBusinessService.findListAll(tenantEntity, null, null); | |||||
| List<WxBusiness> rootBusiness = wxBusinessService.findListAll(true,tenantEntity, null, null); | |||||
| if (null != rootBusiness && rootBusiness.size() > 0 ) { | if (null != rootBusiness && rootBusiness.size() > 0 ) { | ||||
| for (int i = 0 ; i < rootBusiness.size(); i++){ | for (int i = 0 ; i < rootBusiness.size(); i++){ | ||||
| WxBusiness bu = rootBusiness.get(i); | WxBusiness bu = rootBusiness.get(i); | ||||
| @@ -96,7 +96,7 @@ | |||||
| and `parent_id` is null | and `parent_id` is null | ||||
| </if> | </if> | ||||
| <if test=" null != isDel "> | <if test=" null != isDel "> | ||||
| and `is_del` = #{isDel} | |||||
| and `is_del` = #{isDel} | |||||
| </if> | </if> | ||||
| order by create_date asc | order by create_date asc | ||||
| </select> | </select> | ||||
| @@ -109,6 +109,9 @@ | |||||
| <if test=" 1 == isRoot"> | <if test=" 1 == isRoot"> | ||||
| and b.`parent_id` is null | and b.`parent_id` is null | ||||
| </if> | </if> | ||||
| <if test=" null != isDel "> | |||||
| and b.`is_del` = #{isDel} | |||||
| </if> | |||||
| and | and | ||||
| (select count(*) from wx_merchant m | (select count(*) from wx_merchant m | ||||
| where b.id = m.business_id | where b.id = m.business_id | ||||
| @@ -131,6 +134,9 @@ | |||||
| <if test=" 1 == isRoot"> | <if test=" 1 == isRoot"> | ||||
| and b.`parent_id` is null | and b.`parent_id` is null | ||||
| </if> | </if> | ||||
| <if test=" null != isDel "> | |||||
| and b.`is_del` = #{isDel} | |||||
| </if> | |||||
| and | and | ||||
| (select count(*) from wx_coupon_channel cc | (select count(*) from wx_coupon_channel cc | ||||
| where b.id = cc.business | where b.id = cc.business | ||||
| @@ -39,7 +39,7 @@ public class WxBusinessController extends BaseController { | |||||
| @SystemControllerLog(description = "业态-全列表") | @SystemControllerLog(description = "业态-全列表") | ||||
| public ResultData listAll() { | public ResultData listAll() { | ||||
| logger.debug("[" + getIpAddr() + "] WxBusinessController::getList"); | logger.debug("[" + getIpAddr() + "] WxBusinessController::getList"); | ||||
| final List<WxBusiness> busList = wxBusinessService.findListAll(getTenantInfo(),null,null); | |||||
| final List<WxBusiness> busList = wxBusinessService.findListAll(true,getTenantInfo(),null,null); | |||||
| return new ResultData(busList); | return new ResultData(busList); | ||||
| } | } | ||||
| @@ -25,7 +25,7 @@ public class WxBusinessController extends BaseController { | |||||
| @ApiOperation("业态全列表接口") | @ApiOperation("业态全列表接口") | ||||
| @GetMapping("listAll") | @GetMapping("listAll") | ||||
| public ResultData listAll(Integer filter) { | public ResultData listAll(Integer filter) { | ||||
| return new ResultData(wxBusinessService.findListAll(getTenantInfo(),filter,null)); | |||||
| return new ResultData(wxBusinessService.findListAll(true,getTenantInfo(),filter,null)); | |||||
| } | } | ||||
| } | } | ||||