| @@ -184,31 +184,43 @@ public class WxAppinfoController extends BaseController { | |||||
| @GetMapping("/getAppMouldType") | @GetMapping("/getAppMouldType") | ||||
| public ResultData getAppMouldType(Integer plat) { | public ResultData getAppMouldType(Integer plat) { | ||||
| logger.debug("[" + getIpAddr() + "] WxAppinfoController::getAppMouldType"); | logger.debug("[" + getIpAddr() + "] WxAppinfoController::getAppMouldType"); | ||||
| // if(plat == null){ | |||||
| // plat = EnumAppPlat.WX.getCode(); | |||||
| // } | |||||
| EnumAppPlat enumPlat = EnumAppPlat.getByCode(plat); | |||||
| if(enumPlat == null){ | |||||
| enumPlat = EnumAppPlat.WX; | |||||
| } | |||||
| // EnumAppPlat byCode = EnumAppPlat.getByCode(plat); | // EnumAppPlat byCode = EnumAppPlat.getByCode(plat); | ||||
| // if(byCode == null){ | // if(byCode == null){ | ||||
| // return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | // return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | ||||
| // } | // } | ||||
| WxAppinfo cAppInfo = wxAppinfoService.getCAppInfoFromRedis(getTenantInfo().getTenantId(), null); | |||||
| WxAppinfo cAppInfo = wxAppinfoService.getCAppInfoFromRedis(getTenantInfo().getTenantId(), enumPlat); | |||||
| if(cAppInfo == null){ | |||||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | |||||
| } | |||||
| return new ResultData(new WxAppinfo(cAppInfo.getMouldType())); | return new ResultData(new WxAppinfo(cAppInfo.getMouldType())); | ||||
| } | } | ||||
| @PostMapping("updateAppMouldType") | @PostMapping("updateAppMouldType") | ||||
| @SystemControllerLog(description = "修改小程序首页风格") | |||||
| @SystemControllerLog(description = "修改微信小程序首页风格") | |||||
| public ResultData updateAppMouldType(@RequestBody WxAppinfo appinfo) { | public ResultData updateAppMouldType(@RequestBody WxAppinfo appinfo) { | ||||
| logger.debug("[" + getIpAddr() + "] WxAppinfoController::updateAppMouldType"); | logger.debug("[" + getIpAddr() + "] WxAppinfoController::updateAppMouldType"); | ||||
| if(appinfo.getMouldType() == null){ | if(appinfo.getMouldType() == null){ | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | ||||
| } | } | ||||
| // WxAppinfo updateAppinfo = new WxAppinfo(); | |||||
| // updateAppinfo.setId(appinfo.getId()); | |||||
| // updateAppinfo.setMouldType(appinfo.getMouldType()); | |||||
| // updateAppinfo.updateTenantInfo(ifParentUpdateAloneTenantInfo()); | |||||
| // wxAppinfoService.saveOrUpdate(updateAppinfo); | |||||
| wxAppinfoService.updateCMouldType(getTenantInfo(),appinfo.getMouldType()); | |||||
| EnumAppPlat plat = EnumAppPlat.getByCode(appinfo.getPlat()); | |||||
| if(plat == null){ | |||||
| plat = EnumAppPlat.WX; | |||||
| } | |||||
| WxAppinfo cAppInfo = wxAppinfoService.getCAppInfoFromRedis(getTenantInfo().getTenantId(), plat); | |||||
| if(cAppInfo == null){ | |||||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | |||||
| } | |||||
| WxAppinfo updateAppinfo = new WxAppinfo(); | |||||
| updateAppinfo.setId(cAppInfo.getId()); | |||||
| updateAppinfo.setMouldType(appinfo.getMouldType()); | |||||
| updateAppinfo.updateTenantInfo(getTenantInfo()); | |||||
| wxAppinfoService.saveOrUpdate(updateAppinfo); | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @@ -6,9 +6,12 @@ import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.Result; | import com.iformall.common.Result; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.controller.base.BaseController; | import com.iformall.controller.base.BaseController; | ||||
| import com.iformall.domain.po.WxAppinfo; | |||||
| import com.iformall.domain.po.WxCustomizeModule; | import com.iformall.domain.po.WxCustomizeModule; | ||||
| import com.iformall.enums.EnumAppPlat; | |||||
| import com.iformall.enums.EnumThemeType; | import com.iformall.enums.EnumThemeType; | ||||
| import com.iformall.enums.EnumYesOrNo; | import com.iformall.enums.EnumYesOrNo; | ||||
| import com.iformall.service.WxAppinfoService; | |||||
| import com.iformall.service.WxCustomizeModuleService; | import com.iformall.service.WxCustomizeModuleService; | ||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| @@ -30,15 +33,18 @@ public class WxCustomizeModuleController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| WxCustomizeModuleService wxCustomizeModuleService; | WxCustomizeModuleService wxCustomizeModuleService; | ||||
| @Autowired | |||||
| WxAppinfoService wxAppinfoService; | |||||
| @ApiOperation("查询CustomizeModule列表") | @ApiOperation("查询CustomizeModule列表") | ||||
| @GetMapping(value = "/getDesc") | @GetMapping(value = "/getDesc") | ||||
| @SystemControllerLog(description = "查询CustomizeModule列表") | @SystemControllerLog(description = "查询CustomizeModule列表") | ||||
| public ResultData getDesc() { | |||||
| public ResultData getDesc(Integer themeType) { | |||||
| logger.debug("[" + getIpAddr() + "] WxCustomizeModuleController::getDesc"); | logger.debug("[" + getIpAddr() + "] WxCustomizeModuleController::getDesc"); | ||||
| try { | try { | ||||
| WxCustomizeModule wxCustomizeModule = new WxCustomizeModule(); | WxCustomizeModule wxCustomizeModule = new WxCustomizeModule(); | ||||
| wxCustomizeModule.updateTenantInfo(getTenantInfo()); | wxCustomizeModule.updateTenantInfo(getTenantInfo()); | ||||
| if(wxCustomizeModule.getThemeType() == null){ | |||||
| if(themeType == null){ | |||||
| wxCustomizeModule.setThemeType(EnumThemeType.C.getCode()); | wxCustomizeModule.setThemeType(EnumThemeType.C.getCode()); | ||||
| } | } | ||||
| wxCustomizeModule.setIsUsing(EnumYesOrNo.YES.getCode()); | wxCustomizeModule.setIsUsing(EnumYesOrNo.YES.getCode()); | ||||
| @@ -92,7 +98,23 @@ public class WxCustomizeModuleController extends BaseController { | |||||
| if(wxCustomizeModule.getThemeType() == null){ | if(wxCustomizeModule.getThemeType() == null){ | ||||
| wxCustomizeModule.setThemeType(EnumThemeType.C.getCode()); | wxCustomizeModule.setThemeType(EnumThemeType.C.getCode()); | ||||
| } | } | ||||
| List<WxCustomizeModule> aDefault = wxCustomizeModuleService.findDefault(wxCustomizeModule); | |||||
| WxAppinfo cAppInfo = null; | |||||
| if(EnumThemeType.C.getCode().equals(wxCustomizeModule.getThemeType())){ | |||||
| cAppInfo = wxAppinfoService.getCAppInfo(getTenantInfo(), EnumAppPlat.WX); | |||||
| if(cAppInfo == null){ | |||||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND.getCode(),"未找到微信C端小程序"); | |||||
| } | |||||
| }else if(EnumThemeType.TT_C.getCode().equals(wxCustomizeModule.getThemeType())){ | |||||
| cAppInfo = wxAppinfoService.getCAppInfo(getTenantInfo(), EnumAppPlat.TOUTIAO); | |||||
| if(cAppInfo == null){ | |||||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND.getCode(),"未找到抖音C端小程序"); | |||||
| } | |||||
| } | |||||
| if(cAppInfo == null){ | |||||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND.getCode(),"未找到C端小程序"); | |||||
| } | |||||
| List<WxCustomizeModule> aDefault = wxCustomizeModuleService.findDefault(wxCustomizeModule,cAppInfo); | |||||
| PageInfo<WxCustomizeModule> page = new PageInfo(aDefault); | PageInfo<WxCustomizeModule> page = new PageInfo(aDefault); | ||||
| return new ResultData(page); | return new ResultData(page); | ||||
| }catch (Exception e){ | }catch (Exception e){ | ||||
| @@ -113,7 +135,22 @@ public class WxCustomizeModuleController extends BaseController { | |||||
| if(wxCustomizeModule.getThemeType() == null){ | if(wxCustomizeModule.getThemeType() == null){ | ||||
| wxCustomizeModule.setThemeType(EnumThemeType.C.getCode()); | wxCustomizeModule.setThemeType(EnumThemeType.C.getCode()); | ||||
| } | } | ||||
| return wxCustomizeModuleService.updateDefault(wxCustomizeModule); | |||||
| WxAppinfo cAppInfo = null; | |||||
| if(EnumThemeType.C.getCode().equals(wxCustomizeModule.getThemeType())){ | |||||
| cAppInfo = wxAppinfoService.getCAppInfo(getTenantInfo(), EnumAppPlat.WX); | |||||
| if(cAppInfo == null){ | |||||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND.getCode(),"未找到微信C端小程序"); | |||||
| } | |||||
| }else if(EnumThemeType.TT_C.getCode().equals(wxCustomizeModule.getThemeType())){ | |||||
| cAppInfo = wxAppinfoService.getCAppInfo(getTenantInfo(), EnumAppPlat.TOUTIAO); | |||||
| if(cAppInfo == null){ | |||||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND.getCode(),"未找到抖音C端小程序"); | |||||
| } | |||||
| } | |||||
| if(cAppInfo == null){ | |||||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND.getCode(),"未找到C端小程序"); | |||||
| } | |||||
| return wxCustomizeModuleService.updateDefault(wxCustomizeModule,cAppInfo); | |||||
| } | } | ||||
| @ApiOperation("根据id查询接口") | @ApiOperation("根据id查询接口") | ||||
| @@ -6,33 +6,18 @@ import com.iformall.annotation.TenantIgnore; | |||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| import com.iformall.common.Result; | import com.iformall.common.Result; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.config.WechatWebProperties; | |||||
| import com.iformall.controller.base.BaseController; | import com.iformall.controller.base.BaseController; | ||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.domain.vo.WxWeappInfo; | |||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| import com.iformall.service.*; | import com.iformall.service.*; | ||||
| import com.iformall.shiro.PasswordHelper; | |||||
| import com.iformall.utils.Constant; | |||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
| import org.apache.commons.lang3.StringUtils; | |||||
| 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.util.Assert; | |||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
| import java.util.Date; | |||||
| import java.util.HashMap; | |||||
| import java.util.List; | |||||
| import java.util.Map; | |||||
| import java.util.concurrent.TimeUnit; | |||||
| @RestController | @RestController | ||||
| @Api(description = "MiniappTheme相关接口") | @Api(description = "MiniappTheme相关接口") | ||||
| @RequestMapping("wxMiniappTheme") | @RequestMapping("wxMiniappTheme") | ||||
| @@ -59,8 +44,22 @@ public class WxMiniappThemeController extends BaseController { | |||||
| if(wxMiniappTheme.getType() == null){ | if(wxMiniappTheme.getType() == null){ | ||||
| wxMiniappTheme.setType(EnumThemeType.C.getCode()); | wxMiniappTheme.setType(EnumThemeType.C.getCode()); | ||||
| } | } | ||||
| WxAppinfo cAppInfo = wxAppinfoService.getCAppInfo(getTenantInfo(), null); | |||||
| wxMiniappTheme.setMouldType(cAppInfo.getMouldType()); | |||||
| if(EnumThemeType.C.getCode().equals(wxMiniappTheme.getType())){ | |||||
| WxAppinfo cAppInfo = wxAppinfoService.getCAppInfo(getTenantInfo(), EnumAppPlat.WX); | |||||
| if(cAppInfo == null){ | |||||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND.getCode(),"未找到微信C端小程序"); | |||||
| } | |||||
| wxMiniappTheme.setMouldType(cAppInfo.getMouldType()); | |||||
| }else if(EnumThemeType.TT_C.getCode().equals(wxMiniappTheme.getType())){ | |||||
| WxAppinfo cAppInfo = wxAppinfoService.getCAppInfo(getTenantInfo(), EnumAppPlat.TOUTIAO); | |||||
| if(cAppInfo == null){ | |||||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND.getCode(),"未找到抖音C端小程序"); | |||||
| } | |||||
| wxMiniappTheme.setMouldType(cAppInfo.getMouldType()); | |||||
| } | |||||
| if(wxMiniappTheme.getMouldType() == null){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请先确认模板类型"); | |||||
| } | |||||
| PageInfo<WxMiniappTheme> page = wxMiniappThemeService.listAsPage(wxMiniappTheme, pageNum, pageSize); | PageInfo<WxMiniappTheme> page = wxMiniappThemeService.listAsPage(wxMiniappTheme, pageNum, pageSize); | ||||
| if(page.getList() != null && page.getList().size() > 0){ | if(page.getList() != null && page.getList().size() > 0){ | ||||
| @@ -111,9 +110,7 @@ public class WxMiniappThemeController extends BaseController { | |||||
| wxThemeMall.setTenantId(getTenantInfo().getTenantId()); | wxThemeMall.setTenantId(getTenantInfo().getTenantId()); | ||||
| wxThemeMall.setMouldType(theme.getMouldType()); | wxThemeMall.setMouldType(theme.getMouldType()); | ||||
| if(wxThemeMall.getThemeType() == null){ | |||||
| wxThemeMall.setThemeType(EnumThemeType.C.getCode()); | |||||
| } | |||||
| wxThemeMall.setThemeType(theme.getType()); | |||||
| wxMiniappThemeService.updateEffect(wxThemeMall); | wxMiniappThemeService.updateEffect(wxThemeMall); | ||||
| return new ResultData(Result.SUCCESS); | return new ResultData(Result.SUCCESS); | ||||
| @@ -141,10 +138,14 @@ public class WxMiniappThemeController extends BaseController { | |||||
| if(wxMiniappTheme == null){ | if(wxMiniappTheme == null){ | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | ||||
| } | } | ||||
| wxMiniappTheme.setTenantId(getTenantInfo().getTenantId()); | wxMiniappTheme.setTenantId(getTenantInfo().getTenantId()); | ||||
| if(wxMiniappTheme.getType() == null){ | if(wxMiniappTheme.getType() == null){ | ||||
| wxMiniappTheme.setType(EnumThemeType.C.getCode()); | wxMiniappTheme.setType(EnumThemeType.C.getCode()); | ||||
| } | } | ||||
| if(wxMiniappTheme.getMouldType() == null){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"请确认模板类型"); | |||||
| } | |||||
| wxMiniappThemeService.saveOrUpdate(wxMiniappTheme); | wxMiniappThemeService.saveOrUpdate(wxMiniappTheme); | ||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @@ -525,14 +525,14 @@ public class WxInfoController extends BaseController { | |||||
| @GetMapping("/getAppMouldType") | @GetMapping("/getAppMouldType") | ||||
| public ResultData getAppMouldType(Integer plat) { | public ResultData getAppMouldType(Integer plat) { | ||||
| logger.debug("[" + getIpAddr() + "] WxAppinfoController::getAppMouldType"); | logger.debug("[" + getIpAddr() + "] WxAppinfoController::getAppMouldType"); | ||||
| // if(plat == null){ | |||||
| // plat = EnumAppPlat.WX.getCode(); | |||||
| // } | |||||
| // EnumAppPlat byCode = EnumAppPlat.getByCode(plat); | |||||
| // if(byCode == null){ | |||||
| // return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | |||||
| // } | |||||
| WxAppinfo cAppInfo = wxAppinfoService.getCAppInfoFromRedis(getTenantInfo().getTenantId(), null); | |||||
| EnumAppPlat enumPlat = EnumAppPlat.getByCode(plat); | |||||
| if(enumPlat == null){ | |||||
| enumPlat = EnumAppPlat.WX; | |||||
| } | |||||
| WxAppinfo cAppInfo = wxAppinfoService.getCAppInfoFromRedis(getTenantInfo().getTenantId(), enumPlat); | |||||
| if(cAppInfo == null){ | |||||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | |||||
| } | |||||
| return new ResultData(new WxAppinfo(cAppInfo.getMouldType())); | return new ResultData(new WxAppinfo(cAppInfo.getMouldType())); | ||||
| } | } | ||||
| @@ -2,9 +2,12 @@ package com.iformall.controller; | |||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.WxAppinfo; | |||||
| import com.iformall.domain.po.WxCustomizeModule; | import com.iformall.domain.po.WxCustomizeModule; | ||||
| import com.iformall.enums.EnumAppPlat; | |||||
| import com.iformall.enums.EnumThemeType; | import com.iformall.enums.EnumThemeType; | ||||
| import com.iformall.enums.EnumYesOrNo; | import com.iformall.enums.EnumYesOrNo; | ||||
| import com.iformall.service.WxAppinfoService; | |||||
| import com.iformall.service.WxCustomizeModuleService; | import com.iformall.service.WxCustomizeModuleService; | ||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
| @@ -25,20 +28,38 @@ public class WxCustomizeModuleController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| WxCustomizeModuleService wxCustomizeModuleService; | WxCustomizeModuleService wxCustomizeModuleService; | ||||
| @Autowired | |||||
| WxAppinfoService wxAppinfoService; | |||||
| @ApiOperation("查询CustomizeModule列表") | @ApiOperation("查询CustomizeModule列表") | ||||
| @GetMapping(value = "/list") | @GetMapping(value = "/list") | ||||
| public ResultData getList() { | |||||
| public ResultData getList(Integer themeType) { | |||||
| logger.debug("[" + getIpAddr() + "] WxCustomizeModuleController::getList"); | logger.debug("[" + getIpAddr() + "] WxCustomizeModuleController::getList"); | ||||
| try { | try { | ||||
| WxCustomizeModule wxCustomizeModule = new WxCustomizeModule(); | WxCustomizeModule wxCustomizeModule = new WxCustomizeModule(); | ||||
| wxCustomizeModule.updateTenantInfo(getTenantInfo()); | wxCustomizeModule.updateTenantInfo(getTenantInfo()); | ||||
| if(wxCustomizeModule.getThemeType() == null){ | |||||
| if(themeType == null){ | |||||
| wxCustomizeModule.setThemeType(EnumThemeType.C.getCode()); | wxCustomizeModule.setThemeType(EnumThemeType.C.getCode()); | ||||
| } | } | ||||
| wxCustomizeModule.setIsUsing(EnumYesOrNo.YES.getCode()); | wxCustomizeModule.setIsUsing(EnumYesOrNo.YES.getCode()); | ||||
| List<WxCustomizeModule> list = wxCustomizeModuleService.findList(wxCustomizeModule); | List<WxCustomizeModule> list = wxCustomizeModuleService.findList(wxCustomizeModule); | ||||
| if(list == null || list.size() < 4 || list.size() > 8){ | if(list == null || list.size() < 4 || list.size() > 8){ | ||||
| list = wxCustomizeModuleService.findDefault(wxCustomizeModule); | |||||
| WxAppinfo cAppInfo = null; | |||||
| if(EnumThemeType.C.getCode().equals(wxCustomizeModule.getThemeType())){ | |||||
| cAppInfo = wxAppinfoService.getCAppInfo(getTenantInfo(), EnumAppPlat.WX); | |||||
| if(cAppInfo == null){ | |||||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND.getCode(),"未找到微信C端小程序"); | |||||
| } | |||||
| }else if(EnumThemeType.TT_C.getCode().equals(wxCustomizeModule.getThemeType())){ | |||||
| cAppInfo = wxAppinfoService.getCAppInfo(getTenantInfo(), EnumAppPlat.TOUTIAO); | |||||
| if(cAppInfo == null){ | |||||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND.getCode(),"未找到抖音C端小程序"); | |||||
| } | |||||
| } | |||||
| if(cAppInfo == null){ | |||||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND.getCode(),"未找到C端小程序"); | |||||
| } | |||||
| list = wxCustomizeModuleService.findDefault(wxCustomizeModule,cAppInfo); | |||||
| } | } | ||||
| return new ResultData(list); | return new ResultData(list); | ||||
| }catch (Exception e){ | }catch (Exception e){ | ||||
| @@ -63,10 +63,10 @@ public enum EnumCouponType { | |||||
| return message; | return message; | ||||
| } | } | ||||
| //只有抖音卷才能同步poi | |||||
| public static List<Integer> getSpuSyncType(){ | |||||
| public static List<Integer> getDouYinType(){ | |||||
| List<Integer> typeList = new ArrayList<>(); | List<Integer> typeList = new ArrayList<>(); | ||||
| typeList.add(COUPON_DOUYIN.getCode()); | typeList.add(COUPON_DOUYIN.getCode()); | ||||
| return typeList; | return typeList; | ||||
| } | } | ||||
| } | } | ||||
| @@ -5,11 +5,12 @@ package com.iformall.enums; | |||||
| */ | */ | ||||
| public enum EnumThemeType { | public enum EnumThemeType { | ||||
| // 1-B端, 2-C端, 3-服务号, 4-订阅号 | |||||
| // | |||||
| A(0, "A端"), | A(0, "A端"), | ||||
| B(1, "B端"), | B(1, "B端"), | ||||
| C(2, "C端"), | |||||
| C(2, "微信C端"), | |||||
| TT_C(3, "抖音C端"), | |||||
| ; | ; | ||||
| public static EnumThemeType getEnum(Integer code) { | public static EnumThemeType getEnum(Integer code) { | ||||
| @@ -88,10 +88,4 @@ public interface WxAppinfoService { | |||||
| WxAppinfo getCAppInfoFromRedis(String tenantId, EnumAppPlat appPlat); | WxAppinfo getCAppInfoFromRedis(String tenantId, EnumAppPlat appPlat); | ||||
| /** | |||||
| * 修改所有C端风格 | |||||
| * | |||||
| * @param | |||||
| */ | |||||
| void updateCMouldType(TenantEntity tenantEntity, Integer mouldType); | |||||
| } | } | ||||
| @@ -23,7 +23,7 @@ public interface WxCustomizeModuleService { | |||||
| */ | */ | ||||
| int updateDel(WxCustomizeModule record); | int updateDel(WxCustomizeModule record); | ||||
| List<WxCustomizeModule> findDefault(WxCustomizeModule record); | |||||
| List<WxCustomizeModule> findDefault(WxCustomizeModule record, WxAppinfo cAppInfo); | |||||
| ResultData updateDefault(WxCustomizeModule record); | |||||
| ResultData updateDefault(WxCustomizeModule record, WxAppinfo cAppInfo); | |||||
| } | } | ||||
| @@ -10,6 +10,7 @@ import com.iformall.domain.po.WxProjectConfig; | |||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.enums.EnumAppPlat; | import com.iformall.enums.EnumAppPlat; | ||||
| import com.iformall.enums.EnumAppType; | import com.iformall.enums.EnumAppType; | ||||
| import com.iformall.enums.EnumCouponType; | |||||
| import com.iformall.enums.EnumPayWay; | import com.iformall.enums.EnumPayWay; | ||||
| import com.iformall.mapper.WxAppinfoMapper; | import com.iformall.mapper.WxAppinfoMapper; | ||||
| import com.iformall.service.WxAppinfoService; | import com.iformall.service.WxAppinfoService; | ||||
| @@ -45,6 +46,8 @@ public class WxAppinfoServiceImpl implements WxAppinfoService { | |||||
| WxAppinfo appinfoQ = new WxAppinfo(); | WxAppinfo appinfoQ = new WxAppinfo(); | ||||
| if (appPlat != null) { | if (appPlat != null) { | ||||
| appinfoQ.setPlat(appPlat.getCode()); | appinfoQ.setPlat(appPlat.getCode()); | ||||
| }else{ | |||||
| return null; | |||||
| } | } | ||||
| appinfoQ.updateTenantInfo(tenantEntity); | appinfoQ.updateTenantInfo(tenantEntity); | ||||
| @@ -62,6 +65,8 @@ public class WxAppinfoServiceImpl implements WxAppinfoService { | |||||
| WxAppinfo appinfoQ = new WxAppinfo(); | WxAppinfo appinfoQ = new WxAppinfo(); | ||||
| if (appPlat != null) { | if (appPlat != null) { | ||||
| appinfoQ.setPlat(appPlat.getCode()); | appinfoQ.setPlat(appPlat.getCode()); | ||||
| }else{ | |||||
| return null; | |||||
| } | } | ||||
| appinfoQ.updateTenantInfo(tenantEntity); | appinfoQ.updateTenantInfo(tenantEntity); | ||||
| @@ -75,7 +80,17 @@ public class WxAppinfoServiceImpl implements WxAppinfoService { | |||||
| @Override | @Override | ||||
| public WxAppinfo getCouponAppInfo(WxCoupon coupon) { | public WxAppinfo getCouponAppInfo(WxCoupon coupon) { | ||||
| return 111111111111111111; | |||||
| if(coupon != null && coupon.getType() != null){ | |||||
| //todo | |||||
| //抖音券---抖音平台 | |||||
| //其他---微信平台 | |||||
| if(EnumCouponType.getDouYinType().contains(coupon.getType())){ | |||||
| return this.getCAppInfo(coupon,EnumAppPlat.TOUTIAO); | |||||
| }else{ | |||||
| return this.getCAppInfo(coupon,EnumAppPlat.WX); | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -172,6 +187,9 @@ public class WxAppinfoServiceImpl implements WxAppinfoService { | |||||
| @Override | @Override | ||||
| public WxAppinfo getCAppInfoFromRedis(String tenantId, EnumAppPlat plat) { | public WxAppinfo getCAppInfoFromRedis(String tenantId, EnumAppPlat plat) { | ||||
| WxAppinfo record = null; | WxAppinfo record = null; | ||||
| if(plat == null){ | |||||
| return null; | |||||
| } | |||||
| String key = Constant.appinfoPrev + tenantId + "-" + plat | String key = Constant.appinfoPrev + tenantId + "-" + plat | ||||
| + "-" + EnumAppType.C.getCode(); | + "-" + EnumAppType.C.getCode(); | ||||
| record = RedisCacheUtils.getCacheObject(wxAppinfoRedisTemplate, key, WxAppinfo.class); | record = RedisCacheUtils.getCacheObject(wxAppinfoRedisTemplate, key, WxAppinfo.class); | ||||
| @@ -186,19 +204,6 @@ public class WxAppinfoServiceImpl implements WxAppinfoService { | |||||
| return record; | return record; | ||||
| } | } | ||||
| @Override | |||||
| @Transactional(rollbackFor = {Exception.class}) | |||||
| public void updateCMouldType(TenantEntity tenantEntity, Integer mouldType) { | |||||
| WxAppinfo appinfoQ = new WxAppinfo(); | |||||
| appinfoQ.updateTenantInfo(tenantEntity); | |||||
| appinfoQ.setType(EnumAppType.C.getCode()); | |||||
| List<WxAppinfo> appList = wxAppinfoMapper.selectList(new QueryWrapper(appinfoQ)); | |||||
| for (WxAppinfo appinfo:appList) { | |||||
| appinfo.setMouldType(mouldType); | |||||
| this.saveOrUpdate(appinfo); | |||||
| } | |||||
| } | |||||
| private void deleteRedis(Long id){ | private void deleteRedis(Long id){ | ||||
| WxAppinfo record = this.getById(id); | WxAppinfo record = this.getById(id); | ||||
| if(record != null){ | if(record != null){ | ||||
| @@ -634,8 +634,7 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| if(record.getSalePrice() != null && record.getSalePrice() > 0) { | if(record.getSalePrice() != null && record.getSalePrice() > 0) { | ||||
| //todo 目前模式下券只能在一个平台下卖,即一个广场只有一个C端 | |||||
| WxAppinfo cAppInfo = wxAppinfoService.getCAppInfo(record, null); | |||||
| WxAppinfo cAppInfo = wxAppinfoService.getCouponAppInfo(record); | |||||
| if (cAppInfo == null) { | if (cAppInfo == null) { | ||||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | ||||
| } | } | ||||
| @@ -57,9 +57,7 @@ public class WxCustomizeModuleServiceImpl implements WxCustomizeModuleService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public List<WxCustomizeModule> findDefault(WxCustomizeModule record) { | |||||
| //获取风格 | |||||
| WxAppinfo cAppInfo = wxAppinfoService.getCAppInfo(record, null); | |||||
| public List<WxCustomizeModule> findDefault(WxCustomizeModule record, WxAppinfo cAppInfo) { | |||||
| //获取主题 | //获取主题 | ||||
| WxThemeMall wxThemeMall = new WxThemeMall(); | WxThemeMall wxThemeMall = new WxThemeMall(); | ||||
| wxThemeMall.setTenantId(record.getTenantId()); | wxThemeMall.setTenantId(record.getTenantId()); | ||||
| @@ -88,8 +86,8 @@ public class WxCustomizeModuleServiceImpl implements WxCustomizeModuleService { | |||||
| @Override | @Override | ||||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | ||||
| public ResultData updateDefault(WxCustomizeModule record) { | |||||
| List<WxCustomizeModule> aDefault = this.findDefault(record); | |||||
| public ResultData updateDefault(WxCustomizeModule record, WxAppinfo cAppInfo) { | |||||
| List<WxCustomizeModule> aDefault = this.findDefault(record, cAppInfo); | |||||
| //删除旧数据 | //删除旧数据 | ||||
| wxCustomizeModuleMapper.updateDelByTenantId(record); | wxCustomizeModuleMapper.updateDelByTenantId(record); | ||||
| //创建新数据 | //创建新数据 | ||||