Browse Source

// theme

release_toaliyun_real
xhxu 3 years ago
parent
commit
24434ba800
12 changed files with 148 additions and 80 deletions
  1. +24
    -12
      mallinkAdmin/src/main/java/com/iformall/controller/app/WxAppinfoController.java
  2. +41
    -4
      mallinkAdmin/src/main/java/com/iformall/controller/basic/WxCustomizeModuleController.java
  3. +21
    -20
      mallinkAdmin/src/main/java/com/iformall/controller/basic/WxMiniappThemeController.java
  4. +8
    -8
      mallinkBApi/src/main/java/com/iformall/controller/WxInfoController.java
  5. +24
    -3
      mallinkCApi/src/main/java/com/iformall/controller/WxCustomizeModuleController.java
  6. +2
    -2
      mallinkService/src/main/java/com/iformall/enums/EnumCouponType.java
  7. +3
    -2
      mallinkService/src/main/java/com/iformall/enums/EnumThemeType.java
  8. +0
    -6
      mallinkService/src/main/java/com/iformall/service/WxAppinfoService.java
  9. +2
    -2
      mallinkService/src/main/java/com/iformall/service/WxCustomizeModuleService.java
  10. +19
    -14
      mallinkService/src/main/java/com/iformall/service/impl/WxAppinfoServiceImpl.java
  11. +1
    -2
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java
  12. +3
    -5
      mallinkService/src/main/java/com/iformall/service/impl/WxCustomizeModuleServiceImpl.java

+ 24
- 12
mallinkAdmin/src/main/java/com/iformall/controller/app/WxAppinfoController.java View File

@@ -184,31 +184,43 @@ public class WxAppinfoController extends BaseController {
@GetMapping("/getAppMouldType")
public ResultData getAppMouldType(Integer plat) {
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);
// if(byCode == null){
// 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()));
}

@PostMapping("updateAppMouldType")
@SystemControllerLog(description = "修改小程序首页风格")
@SystemControllerLog(description = "修改微信小程序首页风格")
public ResultData updateAppMouldType(@RequestBody WxAppinfo appinfo) {
logger.debug("[" + getIpAddr() + "] WxAppinfoController::updateAppMouldType");
if(appinfo.getMouldType() == 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();
}



+ 41
- 4
mallinkAdmin/src/main/java/com/iformall/controller/basic/WxCustomizeModuleController.java View File

@@ -6,9 +6,12 @@ import com.iformall.common.ErrorCode;
import com.iformall.common.Result;
import com.iformall.common.ResultData;
import com.iformall.controller.base.BaseController;
import com.iformall.domain.po.WxAppinfo;
import com.iformall.domain.po.WxCustomizeModule;
import com.iformall.enums.EnumAppPlat;
import com.iformall.enums.EnumThemeType;
import com.iformall.enums.EnumYesOrNo;
import com.iformall.service.WxAppinfoService;
import com.iformall.service.WxCustomizeModuleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@@ -30,15 +33,18 @@ public class WxCustomizeModuleController extends BaseController {
@Autowired
WxCustomizeModuleService wxCustomizeModuleService;

@Autowired
WxAppinfoService wxAppinfoService;

@ApiOperation("查询CustomizeModule列表")
@GetMapping(value = "/getDesc")
@SystemControllerLog(description = "查询CustomizeModule列表")
public ResultData getDesc() {
public ResultData getDesc(Integer themeType) {
logger.debug("[" + getIpAddr() + "] WxCustomizeModuleController::getDesc");
try {
WxCustomizeModule wxCustomizeModule = new WxCustomizeModule();
wxCustomizeModule.updateTenantInfo(getTenantInfo());
if(wxCustomizeModule.getThemeType() == null){
if(themeType == null){
wxCustomizeModule.setThemeType(EnumThemeType.C.getCode());
}
wxCustomizeModule.setIsUsing(EnumYesOrNo.YES.getCode());
@@ -92,7 +98,23 @@ public class WxCustomizeModuleController extends BaseController {
if(wxCustomizeModule.getThemeType() == null){
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);
return new ResultData(page);
}catch (Exception e){
@@ -113,7 +135,22 @@ public class WxCustomizeModuleController extends BaseController {
if(wxCustomizeModule.getThemeType() == null){
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查询接口")


+ 21
- 20
mallinkAdmin/src/main/java/com/iformall/controller/basic/WxMiniappThemeController.java View File

@@ -6,33 +6,18 @@ import com.iformall.annotation.TenantIgnore;
import com.iformall.common.ErrorCode;
import com.iformall.common.Result;
import com.iformall.common.ResultData;
import com.iformall.config.WechatWebProperties;
import com.iformall.controller.base.BaseController;
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.service.*;
import com.iformall.shiro.PasswordHelper;
import com.iformall.utils.Constant;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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 java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;

@RestController
@Api(description = "MiniappTheme相关接口")
@RequestMapping("wxMiniappTheme")
@@ -59,8 +44,22 @@ public class WxMiniappThemeController extends BaseController {
if(wxMiniappTheme.getType() == null){
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);
if(page.getList() != null && page.getList().size() > 0){
@@ -111,9 +110,7 @@ public class WxMiniappThemeController extends BaseController {

wxThemeMall.setTenantId(getTenantInfo().getTenantId());
wxThemeMall.setMouldType(theme.getMouldType());
if(wxThemeMall.getThemeType() == null){
wxThemeMall.setThemeType(EnumThemeType.C.getCode());
}
wxThemeMall.setThemeType(theme.getType());

wxMiniappThemeService.updateEffect(wxThemeMall);
return new ResultData(Result.SUCCESS);
@@ -141,10 +138,14 @@ public class WxMiniappThemeController extends BaseController {
if(wxMiniappTheme == null){
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL);
}

wxMiniappTheme.setTenantId(getTenantInfo().getTenantId());
if(wxMiniappTheme.getType() == null){
wxMiniappTheme.setType(EnumThemeType.C.getCode());
}
if(wxMiniappTheme.getMouldType() == null){
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"请确认模板类型");
}
wxMiniappThemeService.saveOrUpdate(wxMiniappTheme);
return new ResultData();
}


+ 8
- 8
mallinkBApi/src/main/java/com/iformall/controller/WxInfoController.java View File

@@ -525,14 +525,14 @@ public class WxInfoController extends BaseController {
@GetMapping("/getAppMouldType")
public ResultData getAppMouldType(Integer plat) {
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()));
}


+ 24
- 3
mallinkCApi/src/main/java/com/iformall/controller/WxCustomizeModuleController.java View File

@@ -2,9 +2,12 @@ package com.iformall.controller;

import com.iformall.common.ErrorCode;
import com.iformall.common.ResultData;
import com.iformall.domain.po.WxAppinfo;
import com.iformall.domain.po.WxCustomizeModule;
import com.iformall.enums.EnumAppPlat;
import com.iformall.enums.EnumThemeType;
import com.iformall.enums.EnumYesOrNo;
import com.iformall.service.WxAppinfoService;
import com.iformall.service.WxCustomizeModuleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -25,20 +28,38 @@ public class WxCustomizeModuleController extends BaseController {
@Autowired
WxCustomizeModuleService wxCustomizeModuleService;

@Autowired
WxAppinfoService wxAppinfoService;

@ApiOperation("查询CustomizeModule列表")
@GetMapping(value = "/list")
public ResultData getList() {
public ResultData getList(Integer themeType) {
logger.debug("[" + getIpAddr() + "] WxCustomizeModuleController::getList");
try {
WxCustomizeModule wxCustomizeModule = new WxCustomizeModule();
wxCustomizeModule.updateTenantInfo(getTenantInfo());
if(wxCustomizeModule.getThemeType() == null){
if(themeType == null){
wxCustomizeModule.setThemeType(EnumThemeType.C.getCode());
}
wxCustomizeModule.setIsUsing(EnumYesOrNo.YES.getCode());
List<WxCustomizeModule> list = wxCustomizeModuleService.findList(wxCustomizeModule);
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);
}catch (Exception e){


+ 2
- 2
mallinkService/src/main/java/com/iformall/enums/EnumCouponType.java View File

@@ -63,10 +63,10 @@ public enum EnumCouponType {
return message;
}

//只有抖音卷才能同步poi
public static List<Integer> getSpuSyncType(){
public static List<Integer> getDouYinType(){
List<Integer> typeList = new ArrayList<>();
typeList.add(COUPON_DOUYIN.getCode());
return typeList;
}

}

+ 3
- 2
mallinkService/src/main/java/com/iformall/enums/EnumThemeType.java View File

@@ -5,11 +5,12 @@ package com.iformall.enums;
*/
public enum EnumThemeType {

// 1-B端, 2-C端, 3-服务号, 4-订阅号
//

A(0, "A端"),
B(1, "B端"),
C(2, "C端"),
C(2, "微信C端"),
TT_C(3, "抖音C端"),
;

public static EnumThemeType getEnum(Integer code) {


+ 0
- 6
mallinkService/src/main/java/com/iformall/service/WxAppinfoService.java View File

@@ -88,10 +88,4 @@ public interface WxAppinfoService {

WxAppinfo getCAppInfoFromRedis(String tenantId, EnumAppPlat appPlat);

/**
* 修改所有C端风格
*
* @param
*/
void updateCMouldType(TenantEntity tenantEntity, Integer mouldType);
}

+ 2
- 2
mallinkService/src/main/java/com/iformall/service/WxCustomizeModuleService.java View File

@@ -23,7 +23,7 @@ public interface WxCustomizeModuleService {
*/
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);
}

+ 19
- 14
mallinkService/src/main/java/com/iformall/service/impl/WxAppinfoServiceImpl.java View File

@@ -10,6 +10,7 @@ import com.iformall.domain.po.WxProjectConfig;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.enums.EnumAppPlat;
import com.iformall.enums.EnumAppType;
import com.iformall.enums.EnumCouponType;
import com.iformall.enums.EnumPayWay;
import com.iformall.mapper.WxAppinfoMapper;
import com.iformall.service.WxAppinfoService;
@@ -45,6 +46,8 @@ public class WxAppinfoServiceImpl implements WxAppinfoService {
WxAppinfo appinfoQ = new WxAppinfo();
if (appPlat != null) {
appinfoQ.setPlat(appPlat.getCode());
}else{
return null;
}

appinfoQ.updateTenantInfo(tenantEntity);
@@ -62,6 +65,8 @@ public class WxAppinfoServiceImpl implements WxAppinfoService {
WxAppinfo appinfoQ = new WxAppinfo();
if (appPlat != null) {
appinfoQ.setPlat(appPlat.getCode());
}else{
return null;
}

appinfoQ.updateTenantInfo(tenantEntity);
@@ -75,7 +80,17 @@ public class WxAppinfoServiceImpl implements WxAppinfoService {
@Override
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
@@ -172,6 +187,9 @@ public class WxAppinfoServiceImpl implements WxAppinfoService {
@Override
public WxAppinfo getCAppInfoFromRedis(String tenantId, EnumAppPlat plat) {
WxAppinfo record = null;
if(plat == null){
return null;
}
String key = Constant.appinfoPrev + tenantId + "-" + plat
+ "-" + EnumAppType.C.getCode();
record = RedisCacheUtils.getCacheObject(wxAppinfoRedisTemplate, key, WxAppinfo.class);
@@ -186,19 +204,6 @@ public class WxAppinfoServiceImpl implements WxAppinfoService {
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){
WxAppinfo record = this.getById(id);
if(record != null){


+ 1
- 2
mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java View File

@@ -634,8 +634,7 @@ public class WxCouponServiceImpl implements WxCouponService {
return new ResultData();
}
if(record.getSalePrice() != null && record.getSalePrice() > 0) {
//todo 目前模式下券只能在一个平台下卖,即一个广场只有一个C端
WxAppinfo cAppInfo = wxAppinfoService.getCAppInfo(record, null);
WxAppinfo cAppInfo = wxAppinfoService.getCouponAppInfo(record);
if (cAppInfo == null) {
return new ResultData(ErrorCode.APP_ID_NOT_FOUND);
}


+ 3
- 5
mallinkService/src/main/java/com/iformall/service/impl/WxCustomizeModuleServiceImpl.java View File

@@ -57,9 +57,7 @@ public class WxCustomizeModuleServiceImpl implements WxCustomizeModuleService {
}

@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.setTenantId(record.getTenantId());
@@ -88,8 +86,8 @@ public class WxCustomizeModuleServiceImpl implements WxCustomizeModuleService {

@Override
@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);
//创建新数据


Loading…
Cancel
Save