From a18db59df7440f360e4a8b146a344ddfb2ad6ec7 Mon Sep 17 00:00:00 2001 From: xhxu Date: Tue, 4 Jan 2022 16:56:47 +0800 Subject: [PATCH] =?UTF-8?q?/=E3=80=81update?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/app/WxAppinfoController.java | 27 ++++++++++--------- .../iformall/service/WxAppinfoService.java | 7 +++++ .../service/impl/WxAppinfoServiceImpl.java | 27 +++++++++++++++---- 3 files changed, 43 insertions(+), 18 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/app/WxAppinfoController.java b/mallinkAdmin/src/main/java/com/iformall/controller/app/WxAppinfoController.java index ee92d4f17..360038fc4 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/app/WxAppinfoController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/app/WxAppinfoController.java @@ -149,14 +149,14 @@ 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 byCode = EnumAppPlat.getByCode(plat); - if(byCode == null){ - return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); - } - WxAppinfo cAppInfo = wxAppinfoService.getCAppInfoFromRedis(ifParentUpdateAloneTenantInfo().getTenantId(), byCode); +// 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(ifParentUpdateAloneTenantInfo().getTenantId(), null); return new ResultData(cAppInfo); } @@ -167,11 +167,12 @@ public class WxAppinfoController extends BaseController { if(appinfo == null || appinfo.getId() == null || 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); +// WxAppinfo updateAppinfo = new WxAppinfo(); +// updateAppinfo.setId(appinfo.getId()); +// updateAppinfo.setMouldType(appinfo.getMouldType()); +// updateAppinfo.updateTenantInfo(ifParentUpdateAloneTenantInfo()); +// wxAppinfoService.saveOrUpdate(updateAppinfo); + wxAppinfoService.updateCMouldType(ifParentUpdateAloneTenantInfo(),appinfo.getMouldType()); return new ResultData(); } diff --git a/mallinkService/src/main/java/com/iformall/service/WxAppinfoService.java b/mallinkService/src/main/java/com/iformall/service/WxAppinfoService.java index 703d11567..002dc0514 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxAppinfoService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxAppinfoService.java @@ -82,4 +82,11 @@ public interface WxAppinfoService { WxAppinfo getByIdFromRedis(Long id); WxAppinfo getCAppInfoFromRedis(String tenantId, EnumAppPlat appPlat); + + /** + * 修改所有C端风格 + * + * @param + */ + void updateCMouldType(TenantEntity tenantEntity, Integer mouldType); } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxAppinfoServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxAppinfoServiceImpl.java index e4fef2cac..83c2cfd7d 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxAppinfoServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxAppinfoServiceImpl.java @@ -22,6 +22,7 @@ import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.ValueOperations; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.util.List; import java.util.concurrent.TimeUnit; @@ -41,11 +42,11 @@ public class WxAppinfoServiceImpl implements WxAppinfoService { public WxAppinfo getCAppInfo(TenantEntity tenantEntity,EnumAppPlat appPlat) { WxAppinfo appInfo = null; WxAppinfo appinfoQ = new WxAppinfo(); - if (null == appPlat) { - appinfoQ.setPlat(EnumAppPlat.WX.getCode()); - }else { - appinfoQ.setPlat(appPlat.getCode()); - } +// if (null == appPlat) { +// appinfoQ.setPlat(EnumAppPlat.WX.getCode()); +// }else { +// appinfoQ.setPlat(appPlat.getCode()); +// } appinfoQ.updateTenantInfo(tenantEntity); appinfoQ.setType(EnumAppType.C.getCode()); @@ -164,6 +165,19 @@ 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 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){ @@ -174,6 +188,9 @@ public class WxAppinfoServiceImpl implements WxAppinfoService { String key3 = Constant.appinfoPrev + record.getTenantId() + "-" + EnumAppPlat.getByCode(record.getPlat()) + "-" + record.getType(); RedisCacheUtils.removeCache(wxAppinfoRedisTemplate, key3); + String key4 = Constant.appinfoPrev + record.getTenantId() + + "-" + null + "-" + record.getType(); + RedisCacheUtils.removeCache(wxAppinfoRedisTemplate, key4); } } }