| @@ -19,6 +19,7 @@ public class MyBatisConfiguration { | |||
| MultiTenancy multiTenancy = new MultiTenancy(); | |||
| Properties properties = new Properties(); | |||
| properties.setProperty("tenantIdColumn", "tenant_id"); | |||
| properties.setProperty("subTenantIdColumn", "sub_tenant_id"); | |||
| properties.setProperty("dialect", "mysql"); | |||
| properties.setProperty("tenantInfo", "com.iformall.tenant.TenantInfoImpl"); | |||
| multiTenancy.setProperties(properties); | |||
| @@ -66,9 +66,11 @@ public class BaseController { | |||
| public TenantEntity getTenantInfo(){ | |||
| Session session = SecurityUtils.getSubject().getSession(); | |||
| String tenantId = (String)session.getAttribute(UserSession.tenantId); | |||
| String subTenantId = (String)session.getAttribute(UserSession.subTenantId); | |||
| TenantEntity tenantEntity = new TenantEntity(){{ | |||
| setTenantId(tenantId); | |||
| setSubTenantId(subTenantId); | |||
| }}; | |||
| return tenantEntity; | |||
| } | |||
| @@ -33,7 +33,7 @@ public class WxMallController extends BaseController { | |||
| @SystemControllerLog(description = "商城-查询") | |||
| public ResultData mallinfoExt() { | |||
| logger.debug("[" + getIpAddr() + "] WxMallController::mallinfoExt"); | |||
| return new ResultData(wxMallService.getByTenantIdExt(getTenantId())); | |||
| return new ResultData(wxMallService.getByTenantInfoExt(getTenantInfo())); | |||
| } | |||
| @ApiOperation("查询当前mall的信息") | |||
| @@ -41,7 +41,7 @@ public class WxMallController extends BaseController { | |||
| @SystemControllerLog(description = "商城-当前查询") | |||
| public ResultData mallinfo() { | |||
| logger.debug("[" + getIpAddr() + "] WxMallController::mallinfo"); | |||
| return new ResultData(wxMallService.getByTenantId(getTenantId())); | |||
| return new ResultData(wxMallService.getByTenantInfo(getTenantInfo())); | |||
| } | |||
| @@ -22,7 +22,7 @@ public class WxMerchantBUserController extends BaseController { | |||
| @ApiOperation("手机号是否存在") | |||
| @GetMapping("/hasphone") | |||
| @ApiImplicitParam(name = "phone", value = "phone", dataType = "String", paramType = "query", required = true) | |||
| public ResultData hasphone(String phone) { | |||
| public ResultData hasPhone(String phone) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantBUserController::hasphone"); | |||
| boolean has = wxMerchantBUserService.hasPhone(getTenantInfo(), phone); | |||
| return new ResultData(Result.SUCCESS, "查询成功", has); | |||
| @@ -14,7 +14,7 @@ import com.iformall.domain.vo.WxMerchantTradeVo; | |||
| import com.iformall.domain.vo.WxMerchantVo; | |||
| import com.iformall.service.QrCodeService; | |||
| import com.iformall.service.WxMerchantService; | |||
| import com.iformall.service.WxScoreRulesService; | |||
| import com.iformall.utils.Constant; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| @@ -40,8 +40,6 @@ public class WxMerchantController extends BaseController { | |||
| private WxMerchantService wxMerchantService; | |||
| @Autowired | |||
| private QrCodeService qrCodeService; | |||
| @Autowired | |||
| private WxScoreRulesService wxScoreRulesService; | |||
| @UserDataRuleAnnotation("merchant_list") | |||
| @ApiOperation("分页列表接口") | |||
| @@ -124,12 +122,11 @@ public class WxMerchantController extends BaseController { | |||
| public ResultData addMerchant(@RequestBody WxMerchant wxMerchant) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::addMerchant"); | |||
| wxMerchant.updateTenantInfo(getTenantInfo()); | |||
| ResultData resultData = wxMerchantService.addMerchant(wxMerchant, getUserId()); | |||
| if(resultData.code == 200){ | |||
| //加载二维码图片 | |||
| String pageUrl = "pages/index/index"; | |||
| String pageUrl = Constant.mainPageUrl; | |||
| String param = "t:md:"+resultData.data; | |||
| ResultData resultQrCode = qrCodeService.uploadQrcode(wxMerchant,1,pageUrl,param,0,"","","店铺详情"); | |||
| Map<String,String> map = (Map)resultQrCode.data; | |||
| @@ -32,6 +32,7 @@ public class WxMerchantShopController extends BaseController { | |||
| public ResultData queryShopList(@ModelAttribute WxMerchantShop wxMerchantShop, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantShopController::queryShopList"); | |||
| if (null == wxMerchantShop) wxMerchantShop = new WxMerchantShop(); | |||
| wxMerchantShop.updateTenantInfo(getTenantInfo()); | |||
| final PageInfo<WxShop> page = wxMerchantShopService.queryShopList(wxMerchantShop, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @@ -226,7 +226,7 @@ public class WxCarController extends BaseController { | |||
| } | |||
| } | |||
| // check End | |||
| coupon.updateTenantInfo(getTenantInfo()); | |||
| coupon.updateTenantInfo(tenantEntity); | |||
| ResultData resultData = wxCouponService.saveOrUpdate(coupon); | |||
| if (resultData.code != ResultData.SUCCESS){ | |||
| @@ -35,6 +35,8 @@ import java.util.Map; | |||
| @RestController | |||
| @RequestMapping("wxPropertyContract") | |||
| public class WxPropertyContractController extends BaseController { | |||
| private Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxPropertyContractService wxPropertyContractService; | |||
| @Autowired | |||
| @@ -44,8 +46,6 @@ public class WxPropertyContractController extends BaseController { | |||
| @Autowired | |||
| private WxRentPropertyContractService wxRentPropertyContractService; | |||
| private Logger logger = LoggerFactory.getLogger(WxPropertyContractController.class); | |||
| @UserDataRuleAnnotation("property_contract_list") | |||
| @GetMapping("/list") | |||
| @ApiImplicitParams({ | |||
| @@ -186,6 +186,7 @@ public class WxPropertyContractController extends BaseController { | |||
| @SystemControllerLog(description = "物业合同-终止合同") | |||
| public ResultData endContract(@RequestBody WxPropertyContract wxPropertyContract) { | |||
| logger.debug("[" + getIpAddr() + "] WxRentContractController::endContract"); | |||
| wxPropertyContract.updateTenantInfo(getTenantInfo()); | |||
| wxPropertyContractService.endContract(wxPropertyContract); | |||
| return new ResultData(); | |||
| } | |||
| @@ -173,23 +173,23 @@ public class WxRentContractController extends BaseController { | |||
| @PostMapping("update") | |||
| @SystemControllerLog(description = "租赁合同-更新") | |||
| public ResultData update(@RequestBody WxRentContract wxRentContract) { | |||
| public ResultData update(@RequestBody WxRentContract rentContract) { | |||
| logger.debug("[" + getIpAddr() + "] WxRentContractController::update"); | |||
| if(StringUtils.isBlank(wxRentContract.getBusDiscountRatio())){ | |||
| wxRentContract.setBusDiscountTime(new Integer(0)); | |||
| if(StringUtils.isBlank(rentContract.getBusDiscountRatio())){ | |||
| rentContract.setBusDiscountTime(new Integer(0)); | |||
| } | |||
| MallUserInfo user = getUser(); | |||
| wxRentContract.updateTenantInfo(user); | |||
| wxRentContract.setAdjustPeriodHandle(); | |||
| wxRentContract.setRentPriceHandle(); | |||
| Date oldDate = wxRentContract.getRentalStartDate(); | |||
| if(wxRentContract.getRentStartType()!=null && wxRentContract.getRentStartType().equals(EnumRentStartType.STARTTIME.getCode())){ | |||
| wxRentContract.setRentalStartDate(wxRentContract.getStartDate()); | |||
| rentContract.updateTenantInfo(user); | |||
| rentContract.setAdjustPeriodHandle(); | |||
| rentContract.setRentPriceHandle(); | |||
| Date oldDate = rentContract.getRentalStartDate(); | |||
| if(rentContract.getRentStartType()!=null && rentContract.getRentStartType().equals(EnumRentStartType.STARTTIME.getCode())){ | |||
| rentContract.setRentalStartDate(rentContract.getStartDate()); | |||
| } | |||
| ResultData update = null; | |||
| try { | |||
| update = wxRentContractService.update(wxRentContract, user.getId(), user.getName(), EnumFromType.OTHER.getCode(), oldDate); | |||
| update = wxRentContractService.update(rentContract, user.getId(), user.getName(), EnumFromType.OTHER.getCode(), oldDate); | |||
| } catch (MallinkException e) { | |||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR); | |||
| } | |||
| @@ -387,6 +387,7 @@ public class WxRentContractController extends BaseController { | |||
| @SystemControllerLog(description = "租赁合同-终止合同") | |||
| public ResultData endContract(@RequestBody WxRentContract wxRentContract) { | |||
| logger.debug("[" + getIpAddr() + "] WxRentContractController::endContract"); | |||
| wxRentContract.updateTenantInfo(getTenantInfo()); | |||
| wxRentContractService.endContract(wxRentContract); | |||
| return new ResultData(); | |||
| } | |||
| @@ -3,6 +3,7 @@ package com.iformall.controller.datatower; | |||
| import com.iformall.annotation.SystemControllerLog; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.service.WxChartDataService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| @@ -11,10 +12,7 @@ import io.swagger.annotations.ApiOperation; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestParam; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.util.Map; | |||
| @@ -72,7 +70,9 @@ public class WxChartDataController extends BaseController { | |||
| public ResultData queryData(@RequestParam Map<String, String> params) { | |||
| String chart = params.get("chart"); | |||
| logger.info("[" + getIpAddr() + "] WxChartDataController::queryData chart: " + chart); | |||
| params.put("tenantId",super.getTenantId()); | |||
| TenantEntity tenantEntity = getTenantInfo(); | |||
| params.put("tenantId",tenantEntity.getTenantId()); | |||
| params.put("subTenantId", tenantEntity.getSubTenantId()); | |||
| ResultData data = wxChartDataService.queryData(params); | |||
| logger.info("[" + getIpAddr() + "] WxChartDataController::queryData chart: " + chart + " end"); | |||
| return data; | |||
| @@ -57,6 +57,7 @@ public class WxMerchantTradeDailyController extends BaseController { | |||
| @SystemControllerLog(description = "商户解单-数据汇总") | |||
| public ResultData summary(@ModelAttribute WxMerchantTradeDaily wxMerchantTradeDaily) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantTradeDailyController::summary"); | |||
| wxMerchantTradeDaily.updateTenantInfo(getTenantInfo()); | |||
| return wxMerchantTradeDailyService.summary(wxMerchantTradeDaily); | |||
| } | |||
| @@ -294,12 +294,12 @@ public class WxUserStructureController extends BaseController { | |||
| public ResultData findUserCount(Date startTime, Date endTime, Integer reportType) { | |||
| logger.debug("[" + getIpAddr() + "] WxUserStructureController::findUserCount"); | |||
| TenantEntity tenantEntity = getTenantInfo(); | |||
| //昨日同比 | |||
| Map<String, Object> map = new HashMap<>(); | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| dto.updateTenantInfo(getTenantInfo()); | |||
| dto.updateTenantInfo(tenantEntity); | |||
| dto.setEndTime(new Date()); | |||
| //微信用户数据 | |||
| long wxTotalCount = wxCUserService.findCount(dto);//总量 | |||
| @@ -352,7 +352,7 @@ public class WxUserStructureController extends BaseController { | |||
| reportType = EnumUserCountReportType.DAY.getCode(); | |||
| } | |||
| dto.updateTenantInfo(getTenantInfo()); | |||
| dto.updateTenantInfo(tenantEntity); | |||
| dto.setStartTime(startTime); | |||
| dto.setEndTime(endTime); | |||
| dto.setReportType(reportType); | |||
| @@ -424,7 +424,7 @@ public class WxUserStructureController extends BaseController { | |||
| && wxCountList.get(0).getTotalCount() != null | |||
| && wxCountList.get(0).getTotalCount() == 0) { | |||
| WxCUserBasicInfoDto pdto = new WxCUserBasicInfoDto(); | |||
| pdto.updateTenantInfo(getTenantInfo()); | |||
| pdto.updateTenantInfo(tenantEntity); | |||
| pdto.setEndTime(startTime); | |||
| wxCountList.get(0).setTotalCount(wxCUserService.findCount(pdto)); | |||
| } | |||
| @@ -440,7 +440,7 @@ public class WxUserStructureController extends BaseController { | |||
| && memCountList.get(0).getTotalCount() != null | |||
| && memCountList.get(0).getTotalCount() == 0) { | |||
| WxCUserBasicInfoDto pdto = new WxCUserBasicInfoDto(); | |||
| pdto.updateTenantInfo(getTenantInfo()); | |||
| pdto.updateTenantInfo(tenantEntity); | |||
| pdto.setEndTime(startTime); | |||
| memCountList.get(0).setTotalCount(wxCUserBasicInfoService.findCount(pdto)); | |||
| } | |||
| @@ -149,14 +149,14 @@ public class KwMeterController extends BaseController { | |||
| } | |||
| private KwBox addOrBind(KwBox kwBox) { | |||
| private KwBox addOrBind(KwBox kwBox, TenantEntity tenantEntity) { | |||
| KwBox record = new KwBox(); | |||
| record.setImei(kwBox.getImei()); | |||
| record.setStatus(EnumBoxStatus.VALID.getCode()); | |||
| List<KwBox> list = kwBoxService.findList(record); | |||
| if (list.size() > 0) return list.get(0); | |||
| kwBox.updateTenantInfo(getTenantInfo()); | |||
| kwBox.updateTenantInfo(tenantEntity); | |||
| kwBox.setStatus(EnumBoxStatus.VALID.getCode()); | |||
| kwBoxService.saveOrUpdate(kwBox); | |||
| return kwBox; | |||
| @@ -177,9 +177,9 @@ public class KwMeterController extends BaseController { | |||
| kwMerchantMeterService.saveOrUpdate(kwMerchantMeter); | |||
| } | |||
| private void addOrUpdate(KwMeter kwMeter) { | |||
| private void addOrUpdate(KwMeter kwMeter, TenantEntity tenantEntity) { | |||
| KwMeter record = new KwMeter(); | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| record.updateTenantInfo(tenantEntity); | |||
| record.setAddress(kwMeter.getAddress()); | |||
| record.setStatus(EnumMeterStatus.VALID.getCode()); | |||
| List<KwMeter> kwMeters = kwMeterService.findList(record); | |||
| @@ -196,6 +196,8 @@ public class KwMeterController extends BaseController { | |||
| return new ResultData(ErrorCode.EXCEL_IMPORT_ERROR); | |||
| } | |||
| TenantEntity tenantEntity = getTenantInfo(); | |||
| try { | |||
| XSSFWorkbook workbook = new XSSFWorkbook(mFile.getInputStream()); | |||
| XSSFSheet sheet = workbook.getSheetAt(0); | |||
| @@ -234,7 +236,7 @@ public class KwMeterController extends BaseController { | |||
| String imei = c.getStringCellValue(); | |||
| KwBox kwBox = new KwBox(); | |||
| kwBox.setImei(imei); | |||
| kwBox = addOrBind(kwBox); | |||
| kwBox = addOrBind(kwBox, tenantEntity); | |||
| kwMeter.setBindStatus(EnumMeterBindStatus.BIND.getCode()); | |||
| kwMeter.setBoxId(kwBox.getId()); | |||
| } else { | |||
| @@ -243,7 +245,7 @@ public class KwMeterController extends BaseController { | |||
| } | |||
| kwMeter.setStatus(EnumMeterStatus.VALID.getCode()); | |||
| kwMeter.setOnlineStatus(EnumMeterOnlineStatus.OFFLINE.getCode()); | |||
| addOrUpdate(kwMeter); | |||
| addOrUpdate(kwMeter, tenantEntity); | |||
| c = row.getCell(7,Row.MissingCellPolicy.RETURN_BLANK_AS_NULL); | |||
| if (c != null && c.getCellType() == CellType.STRING ) { | |||
| @@ -44,8 +44,8 @@ public class WxScreenAdController extends BaseController { | |||
| @SystemControllerLog(description = "广告屏-广告列表") | |||
| public Result list(@ModelAttribute WxScreenAd wxScreenAd, Integer pageNum, Integer pageSize) { | |||
| if (wxScreenAd == null) wxScreenAd = new WxScreenAd(); | |||
| wxScreenAd.updateTenantInfo(getTenantInfo()); | |||
| wxScreenAd.setStatus(EnumScreenAdStatus.VALID.getCode()); | |||
| wxScreenAd.updateTenantInfo(getTenantInfo()); | |||
| return new ResultData(wxScreenAdService.listAsPage(wxScreenAd,pageNum,pageSize)); | |||
| } | |||
| @@ -17,6 +17,7 @@ import com.iformall.service.QrCodeService; | |||
| import com.iformall.service.WxCouponChannelService; | |||
| import com.iformall.service.WxCouponService; | |||
| import com.iformall.service.WxFlowService; | |||
| import com.iformall.utils.Constant; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| @@ -80,7 +81,7 @@ public class WxCouponChannelController extends BaseController { | |||
| WxCouponChannel couponChannel = (WxCouponChannel)resultData.data; | |||
| //生成二维码 | |||
| if(couponChannel!=null){ | |||
| String pageUrl = "pages/index/index"; | |||
| String pageUrl = Constant.mainPageUrl; | |||
| String param = couponChannel.getWeappScene(); | |||
| ResultData resultDataQ = qrCodeService.uploadQrcode(couponChannel,1,pageUrl,param,0,"","","券"); | |||
| Map<String,String> map = (Map)resultDataQ.data; | |||
| @@ -52,8 +52,8 @@ public class WxFloatingLayerController extends BaseController { | |||
| @SystemControllerLog(description = "新增") | |||
| public ResultData add(@RequestBody WxFloatingLayer wxFloatingLayer) { | |||
| logger.debug("[" + getIpAddr() + "] WxFloatingLayerController::add"); | |||
| wxFloatingLayer.setStatus(EnumFloatingLayerStatus.STATUS_THROW_IN.getCode()); | |||
| wxFloatingLayer.updateTenantInfo(getTenantInfo()); | |||
| wxFloatingLayer.setStatus(EnumFloatingLayerStatus.STATUS_THROW_IN.getCode()); | |||
| try { | |||
| return wxFloatingLayerService.saveOrUpdate(wxFloatingLayer); | |||
| } catch (MallinkException e) { | |||
| @@ -36,9 +36,9 @@ public class WxQuestionController extends BaseController { | |||
| public Result getQuestionConfig() { | |||
| logger.debug("[" + getIpAddr() + "] WxQuestionController::getQuestionConfig"); | |||
| WxQuestionConfig wxQuestionConfig = new WxQuestionConfig(); | |||
| WxQuestion wxQuestion = new WxQuestion(); | |||
| wxQuestionConfig.updateTenantInfo(getTenantInfo()); | |||
| wxQuestion.updateTenantInfo(getTenantInfo()); | |||
| WxQuestion wxQuestion = new WxQuestion(); | |||
| wxQuestion.updateTenantInfo(wxQuestionConfig); | |||
| List<WxQuestionConfig> list = wxQuestionService.findConfigList(wxQuestionConfig); | |||
| if (list.size() > 0) { | |||
| @@ -175,17 +175,18 @@ public class WxCUserBasicInfoController extends BaseController { | |||
| @SystemControllerLog(description = "会员管理-更新") | |||
| public ResultData update(@RequestBody WxCUserBasicInfo wxCUserBasicInfo) { | |||
| logger.debug("[" + getIpAddr() + "] WxCUserBasicInfoController::update"); | |||
| TenantEntity tenantEntity = getTenantInfo(); | |||
| WxCUserBasicInfo oldInfo = wxCUserBasicInfoService.getById(wxCUserBasicInfo.getId()); | |||
| if (!oldInfo.getPhone().equals(wxCUserBasicInfo.getPhone())) { | |||
| if (checkUniquePhone(wxCUserBasicInfo.getPhone(), getTenantInfo()) > 0) { | |||
| if (checkUniquePhone(wxCUserBasicInfo.getPhone(), tenantEntity) > 0) { | |||
| return new ResultData(ErrorCode.USER_PHONE_IS_FOUND.getCode(), "手机号已存在"); | |||
| } | |||
| } | |||
| wxCUserBasicInfo.updateTenantInfo(getTenantInfo()); | |||
| wxCUserBasicInfo.updateTenantInfo(tenantEntity); | |||
| if (StringUtils.isNotBlank(wxCUserBasicInfo.getTagIds())) { | |||
| WxCUserTags record = new WxCUserTags(); | |||
| record.setUserId(oldInfo.getId()); | |||
| record.updateTenantInfo(getTenantInfo()); | |||
| record.updateTenantInfo(tenantEntity); | |||
| PageInfo<WxCUserTags> page = wxCUserTagsService.listAsPage(record, 1, 1); | |||
| if (page.getSize() > 0) { | |||
| WxCUserTags t = page.getList().get(0); | |||
| @@ -19,6 +19,7 @@ import com.iformall.mapper.WxCUserBasicInfoMapper; | |||
| import com.iformall.service.WxCUserBasicInfoService; | |||
| import com.iformall.utils.DataUtil; | |||
| import com.iformall.utils.DateUtils; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| @@ -58,8 +59,9 @@ public class WxCUserDataController extends BaseController { | |||
| @SystemControllerLog(description = "会员首页-报表数据-查询用户数量接口") | |||
| public ResultData findUserCountData() { | |||
| logger.debug("[" + getIpAddr() + "] WxCUserDataController::findUserCountData"); | |||
| TenantEntity tenantEntity = getTenantInfo(); | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| dto.updateTenantInfo(getTenantInfo()); | |||
| dto.updateTenantInfo(tenantEntity); | |||
| long allCount = wxCUserService.findCount(dto);//总数 | |||
| Calendar c = Calendar.getInstance(); | |||
| c.set(Calendar.HOUR_OF_DAY, 0); | |||
| @@ -139,7 +141,7 @@ public class WxCUserDataController extends BaseController { | |||
| //Date startDate = DateUtils.getDateFromString(startdate + " 00:00:00","yyyy-MM-dd HH:mm:ss").getTime(); | |||
| //Date endDate = DateUtils.getDateFromString(systemTime + " 23:59:59","yyyy-MM-dd HH:mm:ss").getTime(); | |||
| WxCUserBasicInfoDto wxCUserBasicInfoDto = new WxCUserBasicInfoDto(); | |||
| wxCUserBasicInfoDto.updateTenantInfo(getTenantInfo()); | |||
| wxCUserBasicInfoDto.updateTenantInfo(tenantEntity); | |||
| wxCUserBasicInfoDto.setStartTime(null); | |||
| wxCUserBasicInfoDto.setEndTime(null); | |||
| map.put("growCount", wxCUserBasicInfoService.findGrowUserCount(wxCUserBasicInfoDto)); | |||
| @@ -155,6 +157,7 @@ public class WxCUserDataController extends BaseController { | |||
| @SystemControllerLog(description = "会员首页-报表数据-查询用户活跃量") | |||
| public ResultData findUserVisitData() { | |||
| logger.debug("[" + getIpAddr() + "] WxCUserDataController::findUserVisitData"); | |||
| TenantEntity tenantEntity = getTenantInfo(); | |||
| HashMap<String, Object> params = new HashMap<>(); | |||
| Calendar c = Calendar.getInstance(); | |||
| c.add(Calendar.DAY_OF_YEAR, -1); | |||
| @@ -166,9 +169,12 @@ public class WxCUserDataController extends BaseController { | |||
| Date startTime = c.getTime(); | |||
| params.put("startTime", startTime); | |||
| params.put("endTime", endTime); | |||
| params.put("tenantId", getTenantId()); | |||
| params.put("tenantId", tenantEntity.getTenantId()); | |||
| if (StringUtils.isNotBlank(tenantEntity.getSubTenantId())) { | |||
| params.put("subTenantId", tenantEntity.getSubTenantId()); | |||
| } | |||
| MarkingCouponDataReportDto markingCouponDataReportDto = new MarkingCouponDataReportDto(); | |||
| markingCouponDataReportDto.updateTenantInfo(getTenantInfo()); | |||
| markingCouponDataReportDto.updateTenantInfo(tenantEntity); | |||
| markingCouponDataReportDto.setStartTime(startTime); | |||
| markingCouponDataReportDto.setEndTime(endTime); | |||
| List<TouchUsersReportVo> list = wxUserVisitService.touchUsersReportList(markingCouponDataReportDto); | |||
| @@ -28,11 +28,11 @@ import java.util.Objects; | |||
| @RestController | |||
| @RequestMapping("wxCreditHistory") | |||
| public class WxCreditHistoryController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxCreditHistoryService wxCreditHistoryService; | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @@ -42,6 +42,7 @@ public class WxCreditHistoryController extends BaseController { | |||
| public ResultData list(@ModelAttribute WxCreditHistory wxCreditHistory, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxCreditHistoryController::list"); | |||
| if (null == wxCreditHistory) wxCreditHistory = new WxCreditHistory(); | |||
| wxCreditHistory.updateTenantInfo(getTenantInfo()); | |||
| final PageInfo<WxCreditHistoryVo> page = wxCreditHistoryService.listAsPageMore(wxCreditHistory, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @@ -57,7 +57,7 @@ public class WxScoreRulesController extends BaseController { | |||
| @ApiOperation("更新积分开关状态") | |||
| @PostMapping("updateCreditLocked") | |||
| @SystemControllerLog(description = "更新积分开关状态") | |||
| public ResultData 更新积分开关状态(@RequestBody WxScoreRules wxScoreRules) { | |||
| public ResultData updateCreditLocked(@RequestBody WxScoreRules wxScoreRules) { | |||
| logger.debug("[" + getIpAddr() + "] WxScoreRulesController::updateCreditLocked"); | |||
| if (null == wxScoreRules.getId()) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "id不能为空"); | |||
| @@ -6,6 +6,7 @@ import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.po.msg.WxMsg; | |||
| import com.iformall.service.WxMsgService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| @@ -81,7 +81,7 @@ public class WxMsgModelController extends BaseController { | |||
| @ApiOperation("获取所有数据") | |||
| @GetMapping("getmodellist") | |||
| @SystemControllerLog(description = "短信模板-获取所有数据") | |||
| public ResultData getmodellist() { | |||
| public ResultData getModelList() { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgModelController::getmodellist"); | |||
| return wxMsgModelService.getModelList(getTenantInfo()); | |||
| } | |||
| @@ -82,8 +82,8 @@ public class WxMsgSignatureController extends BaseController { | |||
| @ApiOperation("获取所有数据") | |||
| @GetMapping("getsignaturelist") | |||
| @SystemControllerLog(description = "消息签名-获取所有") | |||
| public ResultData getmodellist() { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgSignatureController::getmodellist"); | |||
| public ResultData getsignaturelist() { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgSignatureController::getsignaturelist"); | |||
| return wxMsgSignatureService.getSignatureList(getTenantInfo()); | |||
| } | |||
| @@ -74,14 +74,16 @@ public class WxMsgValidationcodeController extends BaseController { | |||
| @GetMapping("sendvalidationcode") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "tenantId", value = "租户ID", dataType = "String", paramType = "query"), | |||
| @ApiImplicitParam(name = "subTenantId", value = "子租户ID", dataType = "String", paramType = "query"), | |||
| @ApiImplicitParam(name = "phone", value = "手机号", dataType = "String", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "type", value = "场景", dataType = "Integer", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "appid", value = "appid", dataType = "String", paramType = "query", required = true)}) | |||
| public ResultData sendvalidationcode(String tenantId, String phone, Integer type, String appid) { | |||
| public ResultData sendvalidationcode(String tenantId, String subTenantId, String phone, Integer type, String appid) { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgValidationcodeController::sendvalidationcode"); | |||
| WxMsgValidationcode wxMsgValidationcode = new WxMsgValidationcode(); | |||
| wxMsgValidationcode.updateTenantInfo(new TenantEntity(){{ | |||
| setTenantId(tenantId); | |||
| setSubTenantId(subTenantId); | |||
| }}); | |||
| wxMsgValidationcode.setPhone(phone); | |||
| wxMsgValidationcode.setType(type); | |||
| @@ -92,15 +94,17 @@ public class WxMsgValidationcodeController extends BaseController { | |||
| @GetMapping("hasvalidationcode") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "tenantId", value = "租户ID", dataType = "String", paramType = "query"), | |||
| @ApiImplicitParam(name = "subTenantId", value = "子租户ID", dataType = "String", paramType = "query"), | |||
| @ApiImplicitParam(name = "phone", value = "手机号", dataType = "String", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "type", value = "场景", dataType = "Integer", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "code", value = "验证码", dataType = "String", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "appid", value = "appid", dataType = "String", paramType = "query", required = true)}) | |||
| public ResultData hasvalidationcode(String tenantId, String phone, Integer type, String code, String appid) { | |||
| public ResultData hasvalidationcode(String tenantId, String subTenantId, String phone, Integer type, String code, String appid) { | |||
| logger.debug("[" + getIpAddr() + "] WxMsgValidationcodeController::hasvalidationcode"); | |||
| WxMsgValidationcode wxMsgValidationcode = new WxMsgValidationcode(); | |||
| wxMsgValidationcode.updateTenantInfo(new TenantEntity(){{ | |||
| setTenantId(tenantId); | |||
| setSubTenantId(subTenantId); | |||
| }}); | |||
| wxMsgValidationcode.setPhone(phone); | |||
| wxMsgValidationcode.setType(type); | |||
| @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray; | |||
| import com.iformall.annotation.SystemControllerLog; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.po.WxPayAccountBill; | |||
| import com.iformall.domain.vo.WxBillAll; | |||
| import com.iformall.domain.vo.WxBillExcelTemplate; | |||
| import com.iformall.service.WxBillAllService; | |||
| @@ -53,6 +54,8 @@ public class WxBillAllController extends BaseController { | |||
| @SystemControllerLog(description = "账单总览-列表") | |||
| public ResultData list(@ModelAttribute WxBillAll wxBillAll, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillAllController::list"); | |||
| wxBillAll.updateTenantInfo(getTenantInfo()); | |||
| WxPayAccountBill wxPayAccountBill = wxPayAccountBillService.getByTenantInfo(wxBillAll); | |||
| if (null == wxBillAll) { | |||
| wxBillAll = new WxBillAll(); | |||
| } | |||
| @@ -85,6 +85,7 @@ public class WxBillDailyController extends BaseController { | |||
| public ResultData update(@RequestBody WxBillDaily wxBillDaily) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillDailyController::update"); | |||
| MallUserInfo user = getUser(); | |||
| wxBillDaily.updateTenantInfo(user); | |||
| wxBillDaily.setUserId(user.getId()); | |||
| return wxBillDailyService.saveOrUpdate(wxBillDaily, user); | |||
| } | |||
| @@ -60,6 +60,7 @@ public class WxBillOtherController extends BaseController { | |||
| public ResultData update(@RequestBody WxBillOther wxBillOther) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillOtherController::update"); | |||
| MallUserInfo user = getUser(); | |||
| wxBillOther.updateTenantInfo(user); | |||
| wxBillOther.setUserId(user.getId()); | |||
| return wxBillOtherService.saveOrUpdate(wxBillOther, user); | |||
| } | |||
| @@ -17,7 +17,6 @@ import org.springframework.web.bind.annotation.*; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.util.Map; | |||
| /** | |||
| * @author gongbiao | |||
| @@ -60,6 +59,7 @@ public class WxBillOtherDepositController extends BaseController { | |||
| public ResultData update(@RequestBody WxBillOtherDeposit wxBillOtherDeposit) { | |||
| logger.debug("[" + getIpAddr() + "] WxBillOtherDepositController::update"); | |||
| MallUserInfo user = getUser(); | |||
| wxBillOtherDeposit.updateTenantInfo(user); | |||
| wxBillOtherDeposit.setUserId(user.getId()); | |||
| return wxBillOtherDepositService.saveOrUpdate(wxBillOtherDeposit, user); | |||
| } | |||
| @@ -158,6 +158,14 @@ public class HomeController extends BaseController { | |||
| logger.error("mall未启用"); | |||
| return new ResultData(Result.ERROR, "mall未启用"); | |||
| } | |||
| Map map = new HashMap(); | |||
| if (mall.getGroupSupport().equals(EnumGroupSupport.SUPPORT.getCode()) && | |||
| StringUtils.isBlank(info.getSubTenantId())) { | |||
| // 集团用户获取子商场 | |||
| List<WxMall> mallList = mallService.getSubByParentTenantId(info.getTenantId()); | |||
| map.put("subMalls", JSON.toJSONString(mallList)); | |||
| map.put("group", EnumGroupSupport.SUPPORT.getCode()); | |||
| } | |||
| try { | |||
| String cookieName = URLEncoder.encode(info.getUsername(), "utf-8"); | |||
| @@ -166,7 +174,6 @@ public class HomeController extends BaseController { | |||
| unameCookie.setMaxAge(3600); | |||
| response.addCookie(unameCookie); | |||
| Map map = new HashMap(); | |||
| map.put("username", info.getUsername()); | |||
| map.put("withWechat", info.getWithWechat()); | |||
| data.data = map; | |||
| @@ -185,6 +192,31 @@ public class HomeController extends BaseController { | |||
| return isInMobile; | |||
| } | |||
| @PostMapping("/selectMall") | |||
| @ApiOperation(value = "用户选中子广场及父广场", notes = "{\"tenantId\":\"string\",\"subTenantId\":\"string\"}") | |||
| public ResultData selectMall(@RequestBody Map<String, String> map) { | |||
| logger.debug(map.toString()); | |||
| String tenantId = map.get("tenantId"); | |||
| String subTenantId = map.get("subTenantId"); | |||
| if (StringUtils.isBlank(tenantId)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "tenantId不能为空"); | |||
| } | |||
| MallUserInfo userInfo = getUser(); | |||
| if (userInfo.getTenantId().equalsIgnoreCase(tenantId)) { | |||
| Session session = SecurityUtils.getSubject().getSession(); | |||
| session.setAttribute(UserSession.tenantId, tenantId); | |||
| if (StringUtils.isNotBlank(subTenantId)) { | |||
| session.setAttribute(UserSession.subTenantId, subTenantId); | |||
| } else { | |||
| session.setAttribute(UserSession.subTenantId, null); | |||
| } | |||
| } | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("B端登录") | |||
| @PostMapping("/bHidLogin") | |||
| public ResultData bLogin(@RequestBody MallUserInfo user, HttpServletResponse response) { | |||
| @@ -255,6 +287,12 @@ public class HomeController extends BaseController { | |||
| logger.error("mall未启用"); | |||
| return new ResultData(Result.ERROR, "mall未启用"); | |||
| } | |||
| Map map = new HashMap(); | |||
| if (mall.getGroupSupport().equals(EnumGroupSupport.SUPPORT.getCode())) { | |||
| List<WxMall> mallList = mallService.getSubByParentTenantId(mall.getTenantId()); | |||
| map.put("subMalls", JSON.toJSONString(mallList)); | |||
| map.put("group", EnumGroupSupport.SUPPORT.getCode()); | |||
| } | |||
| try { | |||
| String cookieName = URLEncoder.encode(info.getUsername(), "utf-8"); | |||
| Cookie unameCookie = new Cookie("uname", cookieName); | |||
| @@ -262,7 +300,6 @@ public class HomeController extends BaseController { | |||
| unameCookie.setMaxAge(3600); | |||
| response.addCookie(unameCookie); | |||
| Map map = new HashMap(); | |||
| map.put("username", info.getUsername()); | |||
| map.put("withWechat", info.getWithWechat()); | |||
| data.data = map; | |||
| @@ -355,6 +392,12 @@ public class HomeController extends BaseController { | |||
| logger.error("mall未启用"); | |||
| return new ResultData(Result.ERROR, "mall未启用"); | |||
| } | |||
| Map map = new HashMap(); | |||
| if (mall.getGroupSupport().equals(EnumGroupSupport.SUPPORT.getCode())) { | |||
| List<WxMall> mallList = mallService.getSubByParentTenantId(mall.getTenantId()); | |||
| map.put("subMalls", JSON.toJSONString(mallList)); | |||
| map.put("group", EnumGroupSupport.SUPPORT.getCode()); | |||
| } | |||
| String cookieName = URLEncoder.encode(info.getUsername(), "utf-8"); | |||
| Cookie unameCookie = new Cookie("uname", cookieName); | |||
| @@ -362,7 +405,6 @@ public class HomeController extends BaseController { | |||
| unameCookie.setMaxAge(3600); | |||
| response.addCookie(unameCookie); | |||
| Map map = new HashMap(); | |||
| map.put("username", info.getUsername()); | |||
| map.put("withWechat", info.getWithWechat()); | |||
| @@ -58,7 +58,7 @@ public class SysMenuController extends BaseController { | |||
| logger.debug("[" + getIpAddr() + "] MallPermissionController::nav"); | |||
| MallUserInfo user = getUser(); | |||
| List<MallPermission> menuList = mallPermissionService.getUserMenuList(user, 0L, true); | |||
| Set<String> permissions = mallUserInfoService.getUserPermissions(user); | |||
| Set<String> permissions = mallUserInfoService.getUserPermissions(user, true); | |||
| Map map = new HashMap<>(); | |||
| map.put("menuList", menuList); | |||
| map.put("permissions", permissions); | |||
| @@ -72,8 +72,14 @@ public class SysMenuController extends BaseController { | |||
| public ResultData getList() { | |||
| logger.debug("[" + getIpAddr() + "] MallPermissionController::list"); | |||
| MallUserInfo user = getUser(); | |||
| if (user.checkGroupAdmin()) { | |||
| TenantEntity tenantEntity = getTenantInfo(); | |||
| if (StringUtils.isNotBlank(tenantEntity.getSubTenantId())) { | |||
| user.setSubTenantId(tenantEntity.getSubTenantId()); | |||
| } | |||
| } | |||
| List<MallPermission> menuList = mallPermissionService.getUserMenuList(user, 0L, false); | |||
| Set<String> permissions = mallUserInfoService.getUserPermissions(user); | |||
| Set<String> permissions = mallUserInfoService.getUserPermissions(user, false); | |||
| Map map = new HashMap<>(); | |||
| map.put("menuList", menuList); | |||
| map.put("permissions", permissions); | |||
| @@ -38,7 +38,11 @@ public class UploadController extends BaseController { | |||
| private QrCodeService qrCodeService; | |||
| private String getFileName(TenantEntity tenantEntity, String fileName) { | |||
| fileName = tenantEntity.getTenantId() + "/" + fileName; | |||
| if (StringUtils.isBlank(tenantEntity.getSubTenantId())) { | |||
| fileName = tenantEntity.getTenantId() + "/" + fileName; | |||
| } else { | |||
| fileName = tenantEntity.getTenantId() + "/" + tenantEntity.getSubTenantId() + "/" +fileName; | |||
| } | |||
| return fileName; | |||
| } | |||
| @@ -71,7 +75,7 @@ public class UploadController extends BaseController { | |||
| } | |||
| System.out.println(fileName); | |||
| ResultData data = qrCodeService.awsUpload(multiReq.getInputStream(), metadata, fileName, getTenantInfo()); | |||
| ResultData data = qrCodeService.awsUpload(multiReq.getInputStream(), metadata, fileName, tenantEntity); | |||
| return data; | |||
| } | |||
| @@ -8,12 +8,15 @@ import com.iformall.common.ResultData; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.po.MallUserAction; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.po.WxMall; | |||
| import com.iformall.domain.vo.MallUserInfoVo; | |||
| import com.iformall.enums.EnumGroupSupport; | |||
| import com.iformall.enums.EnumMallUserAction; | |||
| import com.iformall.enums.EnumUserAdmin; | |||
| import com.iformall.service.MallUserActionService; | |||
| import com.iformall.service.MallUserInfoService; | |||
| import com.iformall.service.MallUserRoleService; | |||
| import com.iformall.service.WxMallService; | |||
| import com.iformall.shiro.UserSession; | |||
| import com.iformall.shiro.UseriFormallToken; | |||
| import com.iformall.utils.TOTP; | |||
| @@ -69,6 +72,9 @@ public class WechatLoginController extends BaseController { | |||
| @Autowired | |||
| private MallUserActionService mallUserActionService; | |||
| @Autowired | |||
| private WxMallService mallService; | |||
| @Autowired | |||
| @Qualifier("openRedisTemplate") | |||
| RedisTemplate<String, String> openRedisTemplate; | |||
| @@ -149,6 +155,35 @@ public class WechatLoginController extends BaseController { | |||
| if(menus != null) { | |||
| info.setMenus(menus); | |||
| } | |||
| WxMall mall = mallService.getByTenantInfo(info); | |||
| if (mall == null) { | |||
| ret.put("code", Result.ERROR); | |||
| ret.put("message", "未配置相应的mall"); | |||
| log.info("用户登录失败-4,返回登录"); | |||
| try { | |||
| String errCode = URLEncoder.encode(JSON.toJSONString(ret), "utf-8"); | |||
| response.sendRedirect("https://" + host + "/#/login?errcode=" + errCode); | |||
| } catch (Exception e) { | |||
| log.error(e.getMessage()); | |||
| } | |||
| } | |||
| if (!mall.isValid()) { | |||
| ret.put("code", Result.ERROR); | |||
| ret.put("message", "mall未启用"); | |||
| log.info("用户登录失败-5,返回登录"); | |||
| try { | |||
| String errCode = URLEncoder.encode(JSON.toJSONString(ret), "utf-8"); | |||
| response.sendRedirect("https://" + host + "/#/login?errcode=" + errCode); | |||
| } catch (Exception e) { | |||
| log.error(e.getMessage()); | |||
| } | |||
| } | |||
| Map map = new HashMap(); | |||
| if (mall.getGroupSupport().equals(EnumGroupSupport.SUPPORT.getCode())) { | |||
| List<WxMall> mallList = mallService.getSubByParentTenantId(mall.getTenantId()); | |||
| map.put("subMalls", JSON.toJSONString(mallList)); | |||
| map.put("group", EnumGroupSupport.SUPPORT.getCode()); | |||
| } | |||
| try { | |||
| String cookieName = URLEncoder.encode(info.getUsername(), "utf-8"); | |||
| Cookie unameCookie = new Cookie("uname", cookieName); | |||
| @@ -284,6 +319,36 @@ public class WechatLoginController extends BaseController { | |||
| if(menus != null) { | |||
| info.setMenus(menus); | |||
| } | |||
| Map<String, Object> ret = new HashMap<>(); | |||
| WxMall mall = mallService.getByTenantInfo(info); | |||
| if (mall == null) { | |||
| ret.put("code", Result.ERROR); | |||
| ret.put("message", "未配置相应的mall"); | |||
| log.info("用户登录失败-4,返回登录"); | |||
| try { | |||
| String errCode = URLEncoder.encode(JSON.toJSONString(ret), "utf-8"); | |||
| response.sendRedirect("https://" + host + "/#/login?errcode=" + errCode); | |||
| } catch (Exception e) { | |||
| log.error(e.getMessage()); | |||
| } | |||
| } | |||
| if (!mall.isValid()) { | |||
| ret.put("code", Result.ERROR); | |||
| ret.put("message", "mall未启用"); | |||
| log.info("用户登录失败-5,返回登录"); | |||
| try { | |||
| String errCode = URLEncoder.encode(JSON.toJSONString(ret), "utf-8"); | |||
| response.sendRedirect("https://" + host + "/#/login?errcode=" + errCode); | |||
| } catch (Exception e) { | |||
| log.error(e.getMessage()); | |||
| } | |||
| } | |||
| Map map = new HashMap(); | |||
| if (mall.getGroupSupport().equals(EnumGroupSupport.SUPPORT.getCode())) { | |||
| List<WxMall> mallList = mallService.getSubByParentTenantId(mall.getTenantId()); | |||
| map.put("subMalls", JSON.toJSONString(mallList)); | |||
| map.put("group", EnumGroupSupport.SUPPORT.getCode()); | |||
| } | |||
| // 登录cookie | |||
| String cookieName = URLEncoder.encode(info.getUsername(), "utf-8"); | |||
| Cookie unameCookie = new Cookie("uname", cookieName); | |||
| @@ -380,6 +445,9 @@ public class WechatLoginController extends BaseController { | |||
| if(StringUtils.isBlank(userInfo.getTenantId())) { | |||
| userInfo.setTenantId(user.getTenantId()); | |||
| } | |||
| if(StringUtils.isBlank(userInfo.getSubTenantId())) { | |||
| userInfo.setSubTenantId(user.getSubTenantId()); | |||
| } | |||
| if(userInfo.getId() == null && userInfo.getUsername() == null) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| } | |||
| @@ -5,6 +5,7 @@ import javax.annotation.Resource; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.enums.EnumMallUserStatus; | |||
| import com.iformall.service.MallUserInfoService; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.apache.shiro.SecurityUtils; | |||
| import org.apache.shiro.authc.*; | |||
| import org.apache.shiro.authz.AuthorizationInfo; | |||
| @@ -30,7 +31,7 @@ public class MyShiroRealm extends AuthorizingRealm { | |||
| @Override | |||
| protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principalCollection) { | |||
| MallUserInfo user= (MallUserInfo) SecurityUtils.getSubject().getPrincipal(); | |||
| Set<String> permissionSet = userService.getUserPermissions(user); | |||
| Set<String> permissionSet = userService.getUserPermissions(user, true); | |||
| SimpleAuthorizationInfo info = new SimpleAuthorizationInfo(); | |||
| info.setStringPermissions(permissionSet); | |||
| return info; | |||
| @@ -65,6 +66,9 @@ public class MyShiroRealm extends AuthorizingRealm { | |||
| session.setAttribute(UserSession.userInfo, user); | |||
| session.setAttribute(UserSession.userId, user.getId()); | |||
| session.setAttribute(UserSession.tenantId, user.getTenantId()); | |||
| if (StringUtils.isNotBlank(user.getSubTenantId())) { | |||
| session.setAttribute(UserSession.subTenantId, user.getSubTenantId()); | |||
| } | |||
| return authenticationInfo; | |||
| } | |||
| @@ -8,4 +8,6 @@ public class UserSession { | |||
| public static String tenantId ="TENANT_ID"; | |||
| public static String subTenantId ="SUB_TENANT_ID"; | |||
| } | |||
| @@ -22,8 +22,22 @@ public class TenantInfoImpl implements TenantInfo { | |||
| return tenantId; | |||
| } | |||
| @Override | |||
| public String getSubTenantId() { | |||
| String subTenantId = null; | |||
| try { | |||
| subTenantId = (String) SecurityUtils.getSubject().getSession().getAttribute(UserSession.subTenantId); | |||
| } catch (InvalidSessionException e) { | |||
| logger.error("InvalidSession: " + e.getMessage()); | |||
| } | |||
| return subTenantId; | |||
| } | |||
| @Override | |||
| public boolean doTableFilter(String tableName) { | |||
| if ("wx_mall".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("mall_permission".equals(tableName)) { | |||
| return true; | |||
| } | |||
| @@ -78,8 +92,69 @@ public class TenantInfoImpl implements TenantInfo { | |||
| if ("wx_data_rule_target".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_logic_permission".equals(tableName)) { | |||
| return true; | |||
| } | |||
| return false; | |||
| } | |||
| if ("wx_logic_permission".equals(tableName)) { | |||
| @Override | |||
| public boolean doTableFilterSub(String tableName) { | |||
| if ("wx_mall".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_appinfo".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_authorizer_info".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_c_user".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_c_user_basic_info".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_c_user_car".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_c_user_from_b".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_c_user_tags".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_question".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_question_config".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_question_log".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_user_visit".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_level_config".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_score_rules".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("view_coupon_data".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("view_touch_user".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_weapp_audit_status".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_weapp_code_status".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_weapp_release_status".equals(tableName)) { | |||
| return true; | |||
| } | |||
| return false; | |||
| @@ -42,7 +42,11 @@ public class Uploader { | |||
| private AmazonS3 s3 = null; | |||
| private String getFileName(TenantEntity tenantEntity, String fileName) { | |||
| fileName = tenantEntity.getTenantId() + "/" + fileName; | |||
| if (StringUtils.isBlank(tenantEntity.getSubTenantId())) { | |||
| fileName = tenantEntity.getTenantId() + "/" + fileName; | |||
| } else { | |||
| fileName = tenantEntity.getTenantId() + "/" + tenantEntity.getSubTenantId() + "/" + fileName; | |||
| } | |||
| return fileName; | |||
| } | |||
| @@ -77,9 +81,11 @@ public class Uploader { | |||
| MultipartFile multiReq= ((MultipartHttpServletRequest) this.request).getFile("upfile"); | |||
| Session session = SecurityUtils.getSubject().getSession(); | |||
| String tenantId = (String)session.getAttribute(UserSession.tenantId); | |||
| String subTenantId = (String)session.getAttribute(UserSession.subTenantId); | |||
| TenantEntity tenantEntity = new TenantEntity(){{ | |||
| setTenantId(tenantId); | |||
| }}; | |||
| setTenantId(tenantId); | |||
| setSubTenantId(subTenantId); | |||
| }}; | |||
| if (StringUtils.isBlank(tenantId)) { | |||
| logger.error("TENANT is null"); | |||
| } | |||
| @@ -14,6 +14,7 @@ public class MyBatisConfiguration { | |||
| MultiTenancy multiTenancy = new MultiTenancy(); | |||
| Properties properties = new Properties(); | |||
| properties.setProperty("tenantIdColumn", "tenant_id"); | |||
| properties.setProperty("subTenantIdColumn", "sub_tenant_id"); | |||
| properties.setProperty("dialect", "mysql"); | |||
| properties.setProperty("tenantInfo", "com.iformall.tenant.TenantInfoImpl"); | |||
| multiTenancy.setProperties(properties); | |||
| @@ -99,8 +99,10 @@ public class BaseController { | |||
| public TenantEntity getTenantInfo() { | |||
| HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); | |||
| String tenantId = (String) request.getAttribute(Constant.TENANT_ID); | |||
| String subTenantId = (String) request.getAttribute(Constant.SUB_TENANT_ID); | |||
| TenantEntity tenantEntity = new TenantEntity() {{ | |||
| setTenantId(tenantId); | |||
| setSubTenantId(subTenantId); | |||
| }}; | |||
| return tenantEntity; | |||
| } | |||
| @@ -3,6 +3,7 @@ package com.iformall.controller; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxMerchantBUser; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.pay.WxPayConstant; | |||
| import com.iformall.service.PosBrunService; | |||
| @@ -47,18 +48,6 @@ public class PosController extends BaseController { | |||
| return posService.checkUserPassword(user, phone, password); | |||
| } | |||
| @ApiOperation(value = "获取会员折扣/优惠券/消费卡是否启用") | |||
| @PostMapping("getPosMemConfig") | |||
| public ResultData getPosMemConfig() { | |||
| return posService.getPosMemConfig(getTenantId()); | |||
| } | |||
| @ApiOperation(value = "获取注册二维码及小票二维码规则") | |||
| @PostMapping("getQrCode") | |||
| public ResultData getQrCode() { | |||
| return posService.getQrCode(getTenantId()); | |||
| } | |||
| @ApiOperation(value = "券独立核销-1-检查", notes = "{\"couponOrderId\":\"string\"}") | |||
| @PostMapping("checkCouponOrderForIndepentVerify") | |||
| public ResultData checkCouponOrderForIndepentVerify(@RequestBody Map<String, String> params) { | |||
| @@ -53,7 +53,11 @@ public class UploadController extends BaseController { | |||
| private AmazonS3 s3 = null; | |||
| private String getFileName(TenantEntity tenantEntity, String fileName) { | |||
| fileName = tenantEntity.getTenantId() + "/" + fileName; | |||
| if (StringUtils.isBlank(tenantEntity.getSubTenantId())) { | |||
| fileName = tenantEntity.getTenantId() + "/" + fileName; | |||
| } else { | |||
| fileName = tenantEntity.getTenantId() + "/" + tenantEntity.getSubTenantId() + "/" + fileName; | |||
| } | |||
| return fileName; | |||
| } | |||
| @@ -118,7 +118,7 @@ public class WxCUserController extends BaseController { | |||
| wxCUserBasicInfoService.update(wxCUserBasicInfo); | |||
| wxScoreRulesService.addScore(EnumScoreType.COMPLETE_INFO, wxCUserBasicInfo); | |||
| //增加积分 | |||
| addCredit(wxCUserBasicInfo, EnumScoreType.COMPLETE_INFO, wxCUserFromBDto.getUserId()); | |||
| addCredit(wxCUserBasicInfo, EnumScoreType.COMPLETE_INFO, wxCUserFromBDto.getUserId(), wxCUserFromB); | |||
| wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_IMPORT, wxCUserBasicInfo); | |||
| //新增来自B端的会员关联数据 | |||
| wxCUserFromB = new WxCUserFromB(); | |||
| @@ -179,7 +179,7 @@ public class WxCUserController extends BaseController { | |||
| wxCUserBasicInfoService.update(wxCUserBasicInfo); | |||
| wxScoreRulesService.addScore(EnumScoreType.COMPLETE_INFO, wxCUserBasicInfo); | |||
| //增加积分 | |||
| addCredit(wxCUserBasicInfo, EnumScoreType.COMPLETE_INFO, wxCUserFromBDto.getUserId()); | |||
| addCredit(wxCUserBasicInfo, EnumScoreType.COMPLETE_INFO, wxCUserFromBDto.getUserId(), wxCUserFromB); | |||
| wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_IMPORT, wxCUserBasicInfo); | |||
| //更新B端来源会员 | |||
| wxCUserFromB.setInfo(JSONObject.toJSONString(wxCUserBasicInfo)); | |||
| @@ -188,10 +188,10 @@ public class WxCUserController extends BaseController { | |||
| return new ResultData(); | |||
| } | |||
| private void addCredit(WxCUserBasicInfo wxCUserBasicInfo, EnumScoreType enumScoreType, Long userId) { | |||
| private void addCredit(WxCUserBasicInfo wxCUserBasicInfo, EnumScoreType enumScoreType, Long userId, TenantEntity tenantEntity) { | |||
| WxCreditHistory wxCreditHistory = new WxCreditHistory(); | |||
| wxCreditHistory.setCUserId(wxCUserBasicInfo.getId()); | |||
| wxCreditHistory.updateTenantInfo(getTenantInfo()); | |||
| wxCreditHistory.updateTenantInfo(tenantEntity); | |||
| wxCreditHistory.setCreateDate(new Date()); | |||
| wxCreditHistory.setCreditType(enumScoreType.getCode()); | |||
| wxCreditHistory.setOperatorType(EnumUserType.BUSER.getCode()); | |||
| @@ -5,6 +5,7 @@ import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.WxCouponActionLogVo; | |||
| import com.iformall.domain.vo.WxCouponSendVo; | |||
| import com.iformall.enums.EnumCouponSendSendType; | |||
| @@ -18,6 +19,7 @@ import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| 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; | |||
| @@ -65,7 +67,7 @@ public class WxCouponSendController extends BaseController { | |||
| final PageInfo<WxCouponSendVo> page = wxCouponSendService.listAsPage(wxCouponSend, pageNum, pageSize); | |||
| for (WxCouponSendVo cs : page.getList()) { | |||
| cs.setSendCount(wxCouponActionLogService.getCountByChannelId(getTenantInfo(), cs.getSendType(), cs.getId())); | |||
| cs.setSendCount(wxCouponActionLogService.getCountByChannelId(wxCouponSend, cs.getSendType(), cs.getId())); | |||
| } | |||
| return new ResultData(page); | |||
| } | |||
| @@ -134,7 +136,11 @@ public class WxCouponSendController extends BaseController { | |||
| cal.add(Calendar.DATE, 1); | |||
| params.put("endDate", cal.getTime()); | |||
| } | |||
| params.put("tenantId", getTenantId()); | |||
| TenantEntity tenantEntity = getTenantInfo(); | |||
| params.put("tenantId", tenantEntity.getTenantId()); | |||
| if (StringUtils.isNotBlank(tenantEntity.getSubTenantId())) { | |||
| params.put("subTenantId", tenantEntity.getSubTenantId()); | |||
| } | |||
| params.put("channelType", channelType); | |||
| params.put("merchantId", getUser().getMerchantId()); | |||
| PageInfo<WxCouponActionLogVo> data = wxCouponActionLogService.getActionLog(params, pageNum, pageSize); | |||
| @@ -8,6 +8,7 @@ import com.iformall.domain.po.WxCUserBasicInfo; | |||
| import com.iformall.domain.po.WxCreditHistory; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.domain.po.WxMerchantBUser; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.WxCreditHistoryVo; | |||
| import com.iformall.enums.EnumMerchantStatus; | |||
| import com.iformall.enums.EnumScoreType; | |||
| @@ -12,6 +12,7 @@ import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.enums.EnumEnableType; | |||
| import com.iformall.enums.EnumMallUserStatus; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.*; | |||
| @@ -70,6 +71,9 @@ public class WxInfoController extends BaseController { | |||
| @Autowired | |||
| WxBuserTokenService wxBuserTokenService; | |||
| @Autowired | |||
| WxMerchantBUserService merchantBUserService; | |||
| @AuthIgnore | |||
| @ApiOperation("获取OPENID") | |||
| @PostMapping("getOpenId") | |||
| @@ -87,6 +91,10 @@ public class WxInfoController extends BaseController { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "bUserId不能为空"); | |||
| } | |||
| String scene = param.get("scene"); | |||
| WxMerchantBUser buUser = merchantBUserService.getById(Long.valueOf(userId)); | |||
| if (buUser == null) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "登录用户未找到"); | |||
| } | |||
| WxAppinfo wxAppinfo = getAppInfo(appId); | |||
| // 通过authorizerInfo得到tenant_id | |||
| WxAuthorizerInfo wxAuthorizerInfo = null; | |||
| @@ -96,6 +104,9 @@ public class WxInfoController extends BaseController { | |||
| if (wxAuthorizerInfo == null) { | |||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | |||
| } | |||
| if (!wxAuthorizerInfo.getEnable().equals(EnumEnableType.Enable.getCode())) { | |||
| return new ResultData(ErrorCode.APP_ID_NOT_ENABLE); | |||
| } | |||
| if (isFmOpen) { | |||
| wxMaService = getWeappService(appId); | |||
| } else { | |||
| @@ -164,7 +175,10 @@ public class WxInfoController extends BaseController { | |||
| token = oldUser.createToken(new Date()); | |||
| resultMap.put("token", token); | |||
| request.setAttribute(Constant.LOGIN_USER_KEY, oldUser.getId()); | |||
| request.setAttribute(Constant.TENANT_ID, oldUser.getTenantId()); | |||
| request.setAttribute(Constant.TENANT_ID, buUser.getTenantId()); | |||
| if (StringUtils.isNotBlank(buUser.getSubTenantId())) { | |||
| request.setAttribute(Constant.SUB_TENANT_ID, buUser.getSubTenantId()); | |||
| } | |||
| oldUser.setRegisterIp(ipaddress); | |||
| oldUser.setSessionKey(session_key); | |||
| @@ -177,7 +191,7 @@ public class WxInfoController extends BaseController { | |||
| oldUser.setOpenAppId(wxAuthorizerInfo.getOpenAppid()); | |||
| } | |||
| if (StringUtils.isBlank(oldUser.getScene()) || | |||
| oldUser.getScene().equals("undefined")) { // from pages/index/index onLoad.options.scene | |||
| oldUser.getScene().equals(Constant.UNDEFINED)) { // from pages/index/index onLoad.options.scene | |||
| oldUser.setScene(scene); | |||
| } | |||
| oldUser.setLoginCount(oldUser.getLoginCount() + 1); | |||
| @@ -191,7 +205,7 @@ public class WxInfoController extends BaseController { | |||
| newUser.setSessionKey(session_key); | |||
| if (StringUtils.isBlank(newUser.getScene()) || | |||
| newUser.getScene().equals("undefined")) { // from pages/index/index onLoad.options.scene | |||
| newUser.getScene().equals(Constant.UNDEFINED)) { // from pages/index/index onLoad.options.scene | |||
| newUser.setScene(scene); | |||
| } | |||
| newUser.setLoginCount(0); | |||
| @@ -199,7 +213,10 @@ public class WxInfoController extends BaseController { | |||
| wxBuserTokenService.saveOrUpdate(newUser); | |||
| resultMap.put("token", token); | |||
| request.setAttribute(Constant.LOGIN_USER_KEY, newUser.getId()); | |||
| request.setAttribute(Constant.TENANT_ID, newUser.getTenantId()); | |||
| request.setAttribute(Constant.TENANT_ID, buUser.getTenantId()); | |||
| if (StringUtils.isNotBlank(buUser.getSubTenantId())) { | |||
| request.setAttribute(Constant.SUB_TENANT_ID, buUser.getSubTenantId()); | |||
| } | |||
| } | |||
| return new ResultData(resultMap); | |||
| @@ -249,6 +266,12 @@ public class WxInfoController extends BaseController { | |||
| private Map<String,String> getOpenIdInfo(String appId, String code) { | |||
| WxAppinfo wxAppinfo = getAppInfo(appId); | |||
| if (wxAppinfo == null) { | |||
| throw new MallinkException(ErrorCode.APP_ID_NOT_FOUND); | |||
| } | |||
| if (!wxAppinfo.getEnable().equals(EnumEnableType.Enable.getCode())) { | |||
| throw new MallinkException(ErrorCode.APP_ID_NOT_ENABLE); | |||
| } | |||
| WxMaService wxMaService = null; | |||
| if(isFmOpen) { | |||
| wxMaService = getWeappService(appId); | |||
| @@ -1,11 +1,14 @@ | |||
| package com.iformall.controller; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.iformall.annotation.AuthIgnore; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxAppinfo; | |||
| import com.iformall.domain.po.WxMall; | |||
| import com.iformall.domain.po.WxMerchantBUser; | |||
| import com.iformall.enums.EnumGroupSupport; | |||
| import com.iformall.service.WxAppinfoService; | |||
| import com.iformall.service.WxMallService; | |||
| import io.swagger.annotations.Api; | |||
| @@ -25,6 +28,7 @@ import javax.servlet.http.HttpServletResponse; | |||
| import java.io.IOException; | |||
| import java.io.PrintWriter; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| @RestController | |||
| @@ -66,14 +70,19 @@ public class WxMallController extends BaseController { | |||
| @GetMapping("/mallInfo") | |||
| @ApiImplicitParam(name = "appId", value = "appId", dataType = "String", paramType = "query", required = true) | |||
| public ResultData getMallInfo(String appId) { | |||
| WxAppinfo appInfo = wxAppinfoService.getByAppId(appId); | |||
| if (appInfo == null) { | |||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | |||
| } | |||
| WxMall mall = wxMallService.getByTenantId(appInfo.getTenantId()); | |||
| WxMerchantBUser buUser = getUser(); | |||
| WxMall mall = wxMallService.getByTenantInfo(buUser); | |||
| if (mall == null) { | |||
| return new ResultData(ErrorCode.MALL_INFO_NOT_FOUND); | |||
| } | |||
| if(!mall.isValid()) { | |||
| logger.error("mall未启用"); | |||
| return new ResultData(Result.ERROR, "mall未启用"); | |||
| } | |||
| if (mall.getGroupSupport().equals(EnumGroupSupport.SUPPORT.getCode())) { | |||
| List<WxMall> mallList = wxMallService.getSubByParentTenantId(mall.getTenantId()); | |||
| mall.setSubMalls(mallList); | |||
| } | |||
| return new ResultData(Result.SUCCESS, "查询成功", mall); | |||
| } | |||
| @@ -8,6 +8,7 @@ import com.iformall.domain.po.WxMall; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.domain.po.WxMerchantBUser; | |||
| import com.iformall.domain.po.WxScoreRules; | |||
| import com.iformall.domain.vo.WxMerchantBuInfoVo; | |||
| import com.iformall.enums.EnumCreditLockedStatus; | |||
| import com.iformall.enums.EnumMerchantBUserStatus; | |||
| import com.iformall.enums.EnumMerchantStatus; | |||
| @@ -26,6 +27,7 @@ import org.springframework.web.context.request.ServletRequestAttributes; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| @RestController | |||
| @@ -71,7 +73,7 @@ public class WxMerchantBUserController extends BaseController { | |||
| return new ResultData(ErrorCode.MCH_INFO_NOT_FOUND); | |||
| } | |||
| WxMall mall = wxMallService.getByTenantId(merchant.getTenantId()); | |||
| WxMall mall = wxMallService.getByTenantInfo(merchant); | |||
| if (mall == null){ | |||
| return new ResultData(ErrorCode.MALL_INFO_NOT_FOUND); | |||
| } | |||
| @@ -81,13 +83,14 @@ public class WxMerchantBUserController extends BaseController { | |||
| if (scoreRules.getCreditLocked().equals(EnumCreditLockedStatus.CLOSE.getCode())) { | |||
| resultMap.put("creditLocked", EnumCreditLockedStatus.CLOSE.getCode()); | |||
| } | |||
| resultMap.put("tenant_id",merchant.getTenantId()); | |||
| resultMap.put("sub_tenant_id",merchant.getSubTenantId()); | |||
| resultMap.put("phone", user.getPhone()); | |||
| resultMap.put("name", user.getName()); | |||
| resultMap.put("merchant_name", merchant.getName()); | |||
| resultMap.put("merchant_img_url", merchant.getImgUrl()); | |||
| resultMap.put("mall_name", mall.getName()); | |||
| resultMap.put("service_phone", mall.getServicePhone()); | |||
| resultMap.put("tenant_id",merchant.getTenantId()); | |||
| resultMap.put("merchant_id",merchant.getId()); | |||
| resultMap.put("is_admin",merchant.getIsAdmin()); | |||
| resultMap.put("businessId", merchant.getBusinessId()); | |||
| @@ -136,63 +139,135 @@ public class WxMerchantBUserController extends BaseController { | |||
| HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); | |||
| String ipaddress = IPUtil.getIpAddr(request); | |||
| if (!StringUtils.isBlank(latitude) && !StringUtils.isBlank(longitude)) { | |||
| if (StringUtils.isNotBlank(latitude) && StringUtils.isNotBlank(longitude)) { | |||
| logger.info("B端用户: " + phone + " 登录 IP" + ipaddress + ", 经纬度(" + longitude + "," + latitude + ")"); | |||
| } | |||
| WxMerchantBUser user = new WxMerchantBUser(); | |||
| user.setAppId(appId); | |||
| user.setPhone(phone); | |||
| user.setStatus(EnumMerchantBUserStatus.VALID.getCode()); | |||
| WxMerchantBUser user1 = null; | |||
| try { | |||
| user1 = wxMerchantBUserService.getBUserByAppId(user); | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage()); | |||
| WxMerchantBUser userQ = new WxMerchantBUser(); | |||
| userQ.setAppId(appId); | |||
| userQ.setPhone(phone); | |||
| userQ.setStatus(EnumMerchantBUserStatus.VALID.getCode()); | |||
| List<WxMerchantBUser> orgList = wxMerchantBUserService.getBUserByAppId(userQ); | |||
| if (orgList.size() == 1) { | |||
| // 集团内只发现一个用户 | |||
| WxMerchantBUser orgUser = orgList.get(0); | |||
| if (orgUser != null) { | |||
| // check password | |||
| if (orgUser.getUserPwd().equalsIgnoreCase(password)) { | |||
| // check merchant 状态 | |||
| ResultData merchantStatus = checkMerchantStatus(orgUser); | |||
| if (merchantStatus != null) return merchantStatus; | |||
| try { | |||
| wxMerchantBUserService.saveOrUpdate(orgUser); | |||
| } catch (Exception e) { | |||
| logger.error("B端用户更新用户信息失败, e:" + e.getMessage()); | |||
| return new ResultData(ErrorCode.DB_FAIL.getCode(), "数据库保存失败,e:" + e.getMessage()); | |||
| } | |||
| Map<String, Object> resultMap = new HashMap<>(); | |||
| resultMap.put("bUserId", orgUser.getId()); | |||
| resultMap.put("logined", true); | |||
| return new ResultData(resultMap); | |||
| } else { | |||
| return new ResultData(ErrorCode.PASSWORD_ERROR); | |||
| } | |||
| } else { | |||
| logger.error("B端用户不存在, phone: " + phone); | |||
| return new ResultData(ErrorCode.USER_IS_EMPTY); | |||
| } | |||
| } else if (orgList.size() > 1) { | |||
| // 集团内发现多个用户, 系统会保证密码一致 | |||
| WxMerchantBUser orgUser = orgList.get(0); | |||
| if (orgUser != null) { | |||
| // check password | |||
| if (orgUser.getUserPwd().equalsIgnoreCase(password)) { | |||
| // 返回多个(商场+商户) | |||
| List<WxMerchantBuInfoVo> merchantListInfo = wxMerchantBUserService.getMerchantInfoByBUser(userQ); | |||
| Map<String, Object> resultMap = new HashMap<>(); | |||
| resultMap.put("merchantList", merchantListInfo); | |||
| resultMap.put("logined", true); | |||
| return new ResultData(resultMap); | |||
| } else { | |||
| logger.error(ErrorCode.PASSWORD_ERROR.getMessage()); | |||
| return new ResultData(ErrorCode.PASSWORD_ERROR); | |||
| } | |||
| } else { | |||
| logger.error("B端用户不存在, phone: " + phone); | |||
| return new ResultData(ErrorCode.USER_IS_EMPTY); | |||
| } | |||
| } else { | |||
| logger.error("B端用户不存在, phone: " + phone); | |||
| return new ResultData(ErrorCode.USER_IS_EMPTY); | |||
| } | |||
| } | |||
| if (user1 != null) { | |||
| // check merchant 状态 | |||
| WxMerchant merchant = null; | |||
| try { | |||
| merchant = wxMerchantService.getById(user1.getMerchantId()); | |||
| } catch (Exception e) { | |||
| logger.error(ErrorCode.DB_FAIL.getMessage() + ": " + user1.getMerchantId() + e.getMessage()); | |||
| return new ResultData(ErrorCode.DB_FAIL); | |||
| } | |||
| if (merchant == null) { | |||
| logger.error(ErrorCode.MERCHANT_INFO_NOT_FOUND.getMessage() + ": " + user1.getMerchantId()); | |||
| return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND); | |||
| } | |||
| if (merchant.getStatus().equals(EnumMerchantStatus.NOT_VALID.getCode())) { | |||
| logger.error(ErrorCode.MERCHANT_INFO_NOT_VALID.getMessage() + ": " + user1.getMerchantId()); | |||
| return new ResultData(ErrorCode.MERCHANT_INFO_NOT_VALID); | |||
| } | |||
| // check password | |||
| if (user1.getUserPwd().equalsIgnoreCase(password)) { | |||
| @AuthIgnore | |||
| @PostMapping("/selectMerchant") | |||
| @ApiOperation(value = "选择商户", notes = "{" + | |||
| "\"buUserId\":\"string\"," + | |||
| "\"merchantId\":\"string\"}") | |||
| public ResultData selectMerchant(@RequestBody Map<String, String> map) { | |||
| String buUserIdStr = map.get("buUserId"); | |||
| String merchantIdStr = map.get("merchantId"); | |||
| if (StringUtils.isBlank(buUserIdStr)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "buUserId不能为空"); | |||
| } | |||
| if (StringUtils.isBlank(merchantIdStr)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "merchantId不能为空"); | |||
| } | |||
| WxMerchantBUser userQ = new WxMerchantBUser(); | |||
| userQ.setId(Long.valueOf(buUserIdStr)); | |||
| userQ.setMerchantId(Long.valueOf(merchantIdStr)); | |||
| List<WxMerchantBUser> orgList = wxMerchantBUserService.getBUserByAppId(userQ); | |||
| if (orgList.size() == 1) { | |||
| WxMerchantBUser orgUser = orgList.get(0); | |||
| if (orgUser != null) { | |||
| ResultData merchantStatus = checkMerchantStatus(orgUser); | |||
| if (merchantStatus != null) return merchantStatus; | |||
| try { | |||
| wxMerchantBUserService.saveOrUpdate(user1); | |||
| wxMerchantBUserService.saveOrUpdate(orgUser); | |||
| } catch (Exception e) { | |||
| logger.error("B端用户更新用户信息失败, e:" + e.getMessage()); | |||
| return new ResultData(ErrorCode.DB_FAIL.getCode(), "数据库保存失败,e:" + e.getMessage()); | |||
| } | |||
| Map<String, Object> resultMap = new HashMap<>(); | |||
| resultMap.put("bUserId", user1.getId()); | |||
| resultMap.put("bUserId", orgUser.getId()); | |||
| resultMap.put("logined", true); | |||
| return new ResultData(resultMap); | |||
| } else { | |||
| return new ResultData(ErrorCode.PASSWORD_ERROR); | |||
| logger.error("B端用户不存在"); | |||
| return new ResultData(ErrorCode.USER_IS_EMPTY); | |||
| } | |||
| } else { | |||
| logger.error("B端用户不存在, phone: " + phone); | |||
| return new ResultData(ErrorCode.USER_IS_EMPTY); | |||
| return new ResultData(ErrorCode.USER_NO_PERMISSION); | |||
| } | |||
| } | |||
| private ResultData checkMerchantStatus(WxMerchantBUser orgUser) { | |||
| WxMerchant merchant = null; | |||
| try { | |||
| merchant = wxMerchantService.getById(orgUser.getMerchantId()); | |||
| } catch (Exception e) { | |||
| logger.error(ErrorCode.DB_FAIL.getMessage() + ": " + orgUser.getMerchantId() + e.getMessage()); | |||
| return new ResultData(ErrorCode.DB_FAIL); | |||
| } | |||
| if (merchant == null) { | |||
| logger.error(ErrorCode.MERCHANT_INFO_NOT_FOUND.getMessage() + ": " + orgUser.getMerchantId()); | |||
| return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND); | |||
| } | |||
| if (!merchant.checkStatus()) { | |||
| logger.error(ErrorCode.MERCHANT_INFO_NOT_VALID.getMessage() + ": " + orgUser.getMerchantId()); | |||
| return new ResultData(ErrorCode.MERCHANT_INFO_NOT_VALID); | |||
| } | |||
| return null; | |||
| } | |||
| @AuthIgnore | |||
| @ApiOperation(value = "修改密码", notes = "{\"appId\",\"string\", \"phone\",\"string\",\"code\",\"string\",\"pwd\",\"string\"}") | |||
| @ApiOperation(value = "修改密码,集团版会修改集团下同一手机号的密码", notes = "{\"appId\",\"string\", \"phone\",\"string\",\"code\",\"string\",\"pwd\",\"string\"}") | |||
| @PostMapping("/updatepwd") | |||
| public ResultData updatepwd(@RequestBody Map<String, String> params) { | |||
| // String phone,String code,String pwd | |||
| @@ -20,6 +20,8 @@ import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import java.util.List; | |||
| @RestController | |||
| @RequestMapping("wxMsgValidationcode") | |||
| @Api(description="短信验证相关接口") | |||
| @@ -49,11 +51,12 @@ public class WxMsgValidationcodeController extends BaseController { | |||
| userQ.setPhone(phone); | |||
| userQ.setStatus(EnumMerchantBUserStatus.VALID.getCode()); | |||
| WxMerchantBUser user=wxMerchantBUserService.getBUserByAppId(userQ); | |||
| if (user==null) { | |||
| List<WxMerchantBUser> orgUserList = wxMerchantBUserService.getBUserByAppId(userQ); | |||
| if (orgUserList.size() <= 0) { | |||
| logger.error("B端用户不存在, phone: " + phone); | |||
| return new ResultData(ErrorCode.USER_IS_EMPTY); | |||
| } | |||
| WxMerchantBUser user = orgUserList.get(0); | |||
| WxMerchant merchant = wxMerchantService.getById(user.getMerchantId()); | |||
| if (merchant==null) { | |||
| @@ -77,14 +80,16 @@ public class WxMsgValidationcodeController extends BaseController { | |||
| @GetMapping("hasvalidationcode") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "tenantId", value = "租户ID", dataType = "String", paramType = "query"), | |||
| @ApiImplicitParam(name = "subTenantId", value = "子租户ID", dataType = "String", paramType = "query"), | |||
| @ApiImplicitParam(name = "phone", value = "手机号", dataType = "String", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "type", value = "场景", dataType = "Integer", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "code", value = "验证码", dataType = "String", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "appid", value = "appid", dataType = "String", paramType = "query", required = true)}) | |||
| public ResultData hasvalidationcode(String tenantId, String phone, Integer type, String code, String appid) { | |||
| public ResultData hasvalidationcode(String tenantId, String subTenantId, String phone, Integer type, String code, String appid) { | |||
| WxMsgValidationcode wxMsgValidationcode = new WxMsgValidationcode(); | |||
| wxMsgValidationcode.updateTenantInfo(new TenantEntity(){{ | |||
| setTenantId(tenantId); | |||
| setSubTenantId(subTenantId); | |||
| }}); | |||
| wxMsgValidationcode.setPhone(phone); | |||
| wxMsgValidationcode.setType(EnumMsgModel.VALIDATION_CODE.getCode()); | |||
| @@ -26,8 +26,24 @@ public class TenantInfoImpl implements TenantInfo { | |||
| return tenantId; | |||
| } | |||
| @Override | |||
| public String getSubTenantId() { | |||
| String subTenantId = null; | |||
| try { | |||
| HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); | |||
| subTenantId = (String) request.getAttribute(Constant.SUB_TENANT_ID); | |||
| return subTenantId; | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage()); | |||
| } | |||
| return subTenantId; | |||
| } | |||
| @Override | |||
| public boolean doTableFilter(String tableName) { | |||
| if ("wx_mall".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("mall_permission".equals(tableName)) { | |||
| return true; | |||
| } | |||
| @@ -72,6 +88,62 @@ public class TenantInfoImpl implements TenantInfo { | |||
| return false; | |||
| } | |||
| @Override | |||
| public boolean doTableFilterSub(String tableName) { | |||
| if ("wx_mall".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_appinfo".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_authorizer_info".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_c_user".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_c_user_basic_info".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_c_user_car".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_c_user_from_b".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_c_user_tags".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_buser".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_user_visit".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_level_config".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_score_rules".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("view_coupon_data".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("view_touch_user".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_weapp_audit_status".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_weapp_code_status".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_weapp_release_status".equals(tableName)) { | |||
| return true; | |||
| } | |||
| return false; | |||
| } | |||
| @Override | |||
| public boolean doMappedStatementFIlter(MappedStatement ms) { | |||
| if ("com.iformall.mapper.WxMerchantBUserMapper.getByToken".equals(ms.getId())) | |||
| @@ -14,6 +14,7 @@ public class MyBatisConfiguration { | |||
| MultiTenancy multiTenancy = new MultiTenancy(); | |||
| Properties properties = new Properties(); | |||
| properties.setProperty("tenantIdColumn", "tenant_id"); | |||
| properties.setProperty("subTenantIdColumn", "sub_tenant_id"); | |||
| properties.setProperty("dialect", "mysql"); | |||
| properties.setProperty("tenantInfo", "com.iformall.tenant.TenantInfoImpl"); | |||
| multiTenancy.setProperties(properties); | |||
| @@ -79,8 +79,10 @@ public class BaseController { | |||
| public TenantEntity getTenantInfo() { | |||
| HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); | |||
| String tenantId = (String) request.getAttribute(Constant.TENANT_ID); | |||
| String subTenantId = (String) request.getAttribute(Constant.SUB_TENANT_ID); | |||
| TenantEntity tenantEntity = new TenantEntity() {{ | |||
| setTenantId(tenantId); | |||
| setSubTenantId(subTenantId); | |||
| }}; | |||
| return tenantEntity; | |||
| } | |||
| @@ -100,7 +102,13 @@ public class BaseController { | |||
| if (user == null) { | |||
| throw new MallinkException(ErrorCode.USER_IS_EMPTY); | |||
| } | |||
| user.updateTenantInfo(getTenantInfo()); | |||
| TenantEntity tenantEntity = getTenantInfo(); | |||
| if (user.getTenantId() == null) { | |||
| user.setTenantId(tenantEntity.getTenantId()); | |||
| } | |||
| if (user.getSubTenantId() == null) { | |||
| user.setSubTenantId(tenantEntity.getSubTenantId()); | |||
| } | |||
| return user; | |||
| } | |||
| @@ -13,8 +13,10 @@ import com.amazonaws.services.s3.model.ObjectMetadata; | |||
| import com.amazonaws.services.s3.model.PutObjectRequest; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.config.AwsProperty; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import io.swagger.annotations.Api; | |||
| 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; | |||
| @@ -100,6 +102,15 @@ public class UploadController extends BaseController { | |||
| return data; | |||
| } | |||
| private String getFileName(TenantEntity tenantEntity, String fileName) { | |||
| if (StringUtils.isBlank(tenantEntity.getSubTenantId())) { | |||
| fileName = tenantEntity.getTenantId() + "/" + fileName; | |||
| } else { | |||
| fileName = tenantEntity.getTenantId() + "/" + tenantEntity.getSubTenantId() + "/" + fileName; | |||
| } | |||
| return fileName; | |||
| } | |||
| /** | |||
| * 上传文件 | |||
| * | |||
| @@ -112,6 +123,8 @@ public class UploadController extends BaseController { | |||
| public ResultData awsfileUpload(@RequestParam("file") MultipartFile multiReq) { | |||
| logger.info("[" + getIpAddr() + "] UploadController::awsfileUpload"); | |||
| TenantEntity tenantEntity = getTenantInfo(); | |||
| ObjectMetadata metadata = new ObjectMetadata(); | |||
| metadata.setContentType(multiReq.getContentType()); | |||
| metadata.setContentLength(multiReq.getSize()); | |||
| @@ -122,9 +135,10 @@ public class UploadController extends BaseController { | |||
| String fileName = UUID.randomUUID().toString(); | |||
| int dot = multiReq.getOriginalFilename().lastIndexOf('.'); | |||
| if (dot >= 0) { | |||
| fileName = getTenantId() + "/" + fileName + multiReq.getOriginalFilename().substring(dot, multiReq.getOriginalFilename().length()); | |||
| String fileFormat = multiReq.getOriginalFilename().substring(dot, multiReq.getOriginalFilename().length()); | |||
| fileName = getFileName(tenantEntity, fileName + fileFormat); | |||
| } else { | |||
| fileName = getTenantId() + "/" + fileName; | |||
| fileName = getFileName(tenantEntity, fileName); | |||
| } | |||
| ResultData data = awsUpload(multiReq, metadata, fileName); | |||
| @@ -143,6 +157,8 @@ public class UploadController extends BaseController { | |||
| public ResultData awsFilesUpload(@RequestParam("files") MultipartFile[] files) { | |||
| logger.info("[" + getIpAddr() + "] UploadController::awsFilesUpload"); | |||
| TenantEntity tenantEntity = getTenantInfo(); | |||
| if (files.length > 0) { | |||
| ResultData data = new ResultData(); | |||
| List<Map<String, String>> dataList = new ArrayList<Map<String, String>>(); | |||
| @@ -161,9 +177,10 @@ public class UploadController extends BaseController { | |||
| String fileName = UUID.randomUUID().toString(); | |||
| int dot = multipartFile.getOriginalFilename().lastIndexOf('.'); | |||
| if (dot >= 0) { | |||
| fileName = getTenantId() + "/" + fileName + multipartFile.getOriginalFilename().substring(dot, multipartFile.getOriginalFilename().length()); | |||
| String fileFormat = multipartFile.getOriginalFilename().substring(dot, multipartFile.getOriginalFilename().length()); | |||
| fileName = getFileName(tenantEntity, fileName + fileFormat); | |||
| } else { | |||
| fileName = getTenantId() + "/" + fileName; | |||
| fileName = getFileName(tenantEntity, fileName); | |||
| } | |||
| ResultData data1 = awsUpload(multipartFile, metadata, fileName); | |||
| @@ -42,8 +42,8 @@ public class WxActivityJoinController extends BaseController { | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxActivityJoin wxActivityJoin, Integer pageNum, Integer pageSize) { | |||
| if (null == wxActivityJoin) wxActivityJoin = new WxActivityJoin(); | |||
| wxActivityJoin.setUserId(getUserId()); | |||
| wxActivityJoin.updateTenantInfo(getTenantInfo()); | |||
| wxActivityJoin.setUserId(getUserId()); | |||
| wxActivityJoin.setSortColumns(BaseEntity.SortField.CreateTime_DESC); | |||
| final PageInfo<WxActivity> page = wxActivityJoinService.clistAsPage(wxActivityJoin, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| @@ -6,6 +6,7 @@ import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.domain.po.WxCampaign; | |||
| import com.iformall.domain.po.WxCouponChannel; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.WxCouponChannelVo; | |||
| import com.iformall.enums.EnumCampaignStatus; | |||
| import com.iformall.enums.EnumCouponChannelType; | |||
| @@ -45,9 +46,8 @@ public class WxCampaignController extends BaseController { | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxCampaign wxCampaign, Integer pageNum, Integer pageSize) { | |||
| if (null == wxCampaign) wxCampaign = new WxCampaign(); | |||
| wxCampaign.setStatus(EnumCampaignStatus.STATUS_THROW_IN.getCode()); | |||
| wxCampaign.updateTenantInfo(getTenantInfo()); | |||
| wxCampaign.setStatus(EnumCampaignStatus.STATUS_THROW_IN.getCode()); | |||
| wxCampaign.setSortColumns(BaseEntity.SortField.SortNum_ASC, BaseEntity.SortField.CreateTime_ASC); | |||
| final PageInfo<WxCampaign> page = wxCampaignService.clistAsPage(wxCampaign, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| @@ -269,7 +269,7 @@ public class WxCarController extends BaseController { | |||
| } | |||
| } | |||
| private ResultData etcpBindCar(Map<String, String> paramMap, WxPark park) { | |||
| private ResultData etcpBindCar(Map<String, String> paramMap, WxPark park, Long cuUserId) { | |||
| String etcpToken = paramMap.get("etcpToken"); | |||
| if (StringUtils.isBlank(etcpToken)) { | |||
| logger.error("etcpToken为空"); | |||
| @@ -296,7 +296,7 @@ public class WxCarController extends BaseController { | |||
| } | |||
| JSONObject retObj = JSON.parseObject(ret); | |||
| if (retObj.getIntValue("code") == 0) { | |||
| addCarInfoToDB(carNumber, EnumCarVendor.CAR_ETCP); | |||
| addCarInfoToDB(carNumber, EnumCarVendor.CAR_ETCP, park, cuUserId); | |||
| JSONObject dataObj = retObj.getJSONObject("data"); | |||
| return new ResultData(dataObj); | |||
| } else { | |||
| @@ -306,14 +306,14 @@ public class WxCarController extends BaseController { | |||
| } | |||
| } | |||
| private ResultData bindCar(Map<String, String> paramMap, WxPark park) { | |||
| private ResultData bindCar(Map<String, String> paramMap, WxPark park, Long cuUserId) { | |||
| String carNumber = paramMap.get("carNumber"); | |||
| if (StringUtils.isBlank(carNumber)) { | |||
| logger.error("carNumber为空"); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "carNumber为空"); | |||
| } | |||
| try { | |||
| addCarInfoToDB(carNumber, EnumCarVendor.getEnum(park.getVendorType())); | |||
| addCarInfoToDB(carNumber, EnumCarVendor.getEnum(park.getVendorType()), park, cuUserId); | |||
| } catch (MallinkException e) { | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| } catch (Exception e) { | |||
| @@ -322,12 +322,12 @@ public class WxCarController extends BaseController { | |||
| return new ResultData(); | |||
| } | |||
| private void addCarInfoToDB(String carNumber, EnumCarVendor carVendor) { | |||
| private void addCarInfoToDB(String carNumber, EnumCarVendor carVendor, WxPark park, Long cuUserId) { | |||
| // 插入车牌 | |||
| Date curr = new Date(); | |||
| WxCUserCar userCar = new WxCUserCar(); | |||
| userCar.setCUserId(getUserId()); | |||
| userCar.updateTenantInfo(getTenantInfo()); | |||
| userCar.updateTenantInfo(park); | |||
| userCar.setCarNumber(carNumber); | |||
| userCar.setVendorType(carVendor.getCode()); | |||
| userCar.setCreateDate(curr); | |||
| @@ -337,11 +337,11 @@ public class WxCarController extends BaseController { | |||
| // 成长值 | |||
| wxScoreRulesService.addScore(EnumScoreType.BIND_CAR, userCar); | |||
| //增加积分 | |||
| addCredit(); | |||
| wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_CAR, getUserId()); | |||
| addCredit(park, cuUserId); | |||
| wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_CAR,getUserId()); | |||
| } | |||
| private ResultData tjdBindCar(@RequestBody Map<String, String> paramMap, WxPark park) { | |||
| private ResultData tjdBindCar(@RequestBody Map<String, String> paramMap, WxPark park, Long cuUserId) { | |||
| String carNumber = paramMap.get("carNumber"); | |||
| if (StringUtils.isBlank(carNumber)) { | |||
| logger.error("carNumber为空"); | |||
| @@ -370,7 +370,7 @@ public class WxCarController extends BaseController { | |||
| JSONObject retObj = JSON.parseObject(ret); | |||
| retObj.put("vendor", park.getVendorType()); | |||
| if (retObj.getString("returnCode").equalsIgnoreCase(EnumTJDCode.SUCCESS.getMessage())) { | |||
| ResultData e = tjdInsertToDB(carNumber, newCarId, retObj); | |||
| ResultData e = tjdInsertToDB(carNumber, newCarId, retObj, park, cuUserId); | |||
| if (e != null) return e; | |||
| return new ResultData(retObj); | |||
| } else { | |||
| @@ -378,14 +378,14 @@ public class WxCarController extends BaseController { | |||
| } | |||
| } | |||
| private ResultData tjdInsertToDB(String carNumber, Long newCarId, JSONObject retObj) { | |||
| private ResultData tjdInsertToDB(String carNumber, Long newCarId, JSONObject retObj, WxPark park, Long cuUserId) { | |||
| String carId = retObj.getString("carId"); | |||
| // 插入车牌 | |||
| Date curr = new Date(); | |||
| WxCUserCar userCar = new WxCUserCar(); | |||
| userCar.setId(newCarId); | |||
| userCar.setCUserId(getUserId()); | |||
| userCar.updateTenantInfo(getTenantInfo()); | |||
| userCar.setCUserId(cuUserId); | |||
| userCar.updateTenantInfo(park); | |||
| userCar.setCarNumber(carNumber); | |||
| userCar.setVendorType(EnumCarVendor.CAR_TJD.getCode()); | |||
| JSONObject jo = new JSONObject(); | |||
| @@ -397,7 +397,7 @@ public class WxCarController extends BaseController { | |||
| wxCUserCarService.save(userCar); | |||
| wxScoreRulesService.addScore(EnumScoreType.BIND_CAR, userCar); | |||
| //增加积分 | |||
| addCredit(); | |||
| addCredit(park, cuUserId); | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage()); | |||
| return new ResultData(ErrorCode.DB_FAIL.getCode(), "TJD保存车牌失败, e:" + e.getMessage()); | |||
| @@ -408,14 +408,14 @@ public class WxCarController extends BaseController { | |||
| } | |||
| //-----增加积分start----- | |||
| private void addCredit() { | |||
| private void addCredit(WxPark park, Long cuUserId){ | |||
| WxCreditHistory wxCreditHistory = new WxCreditHistory(); | |||
| wxCreditHistory.setCUserId(getUserId()); | |||
| wxCreditHistory.updateTenantInfo(getTenantInfo()); | |||
| wxCreditHistory.setCUserId(cuUserId); | |||
| wxCreditHistory.updateTenantInfo(park); | |||
| wxCreditHistory.setCreateDate(new Date()); | |||
| wxCreditHistory.setCreditType(EnumScoreType.BIND_CAR.getCode()); | |||
| wxCreditHistory.setOperatorType(EnumUserType.CUSER.getCode()); | |||
| wxCreditHistory.setOperatorId(getUserId()); | |||
| wxCreditHistory.setOperatorId(cuUserId); | |||
| wxCreditHistoryService.saveOrUpdate(wxCreditHistory); | |||
| } | |||
| @@ -436,13 +436,13 @@ public class WxCarController extends BaseController { | |||
| // 1, get mall's park | |||
| WxPark park = getCurrentPark(getTenantInfo()); | |||
| if (park.getVendorType().equals(EnumCarVendor.CAR_ETCP.getCode())) { | |||
| return etcpUnbindCar(paramMap, park); | |||
| return etcpUnbindCar(paramMap, park, getUserId()); | |||
| } else { | |||
| return unbindCar(paramMap, park); | |||
| return unbindCar(paramMap, park, getUserId()); | |||
| } | |||
| } | |||
| private ResultData etcpUnbindCar(Map<String, String> paramMap, WxPark park) { | |||
| private ResultData etcpUnbindCar(Map<String, String> paramMap, WxPark park, Long cuUserId) { | |||
| String etcpToken = paramMap.get("etcpToken"); | |||
| if (StringUtils.isBlank(etcpToken)) { | |||
| logger.error("etcpToken为空"); | |||
| @@ -472,8 +472,8 @@ public class WxCarController extends BaseController { | |||
| if (retObj.getIntValue("code") == 0) { | |||
| try { | |||
| WxCUserCar userCar = new WxCUserCar(); | |||
| userCar.setCUserId(getUserId()); | |||
| userCar.updateTenantInfo(getTenantInfo()); | |||
| userCar.setCUserId(cuUserId); | |||
| userCar.updateTenantInfo(park); | |||
| userCar.setCarNumber(carNumber); | |||
| wxCUserCarService.deleteByObj(userCar); | |||
| } catch (Exception e) { | |||
| @@ -489,7 +489,7 @@ public class WxCarController extends BaseController { | |||
| } | |||
| } | |||
| private ResultData unbindCar(Map<String, String> paramMap, WxPark park) { | |||
| private ResultData unbindCar(Map<String, String> paramMap, WxPark park, Long cuUserId) { | |||
| String carNumber = paramMap.get("carNumber"); | |||
| if (StringUtils.isBlank(carNumber)) { | |||
| logger.error("carNumber为空"); | |||
| @@ -497,8 +497,8 @@ public class WxCarController extends BaseController { | |||
| } | |||
| try { | |||
| WxCUserCar userCar = new WxCUserCar(); | |||
| userCar.updateTenantInfo(getTenantInfo()); | |||
| userCar.setCUserId(getUserId()); | |||
| userCar.updateTenantInfo(park); | |||
| userCar.setCUserId(cuUserId); | |||
| userCar.setCarNumber(carNumber); | |||
| wxCUserCarService.deleteByObj(userCar); | |||
| } catch (Exception e) { | |||
| @@ -516,7 +516,7 @@ public class WxCarController extends BaseController { | |||
| } | |||
| WxCUserCar queryOne = new WxCUserCar(); | |||
| queryOne.setCarNumber(carNumber); | |||
| queryOne.updateTenantInfo(getTenantInfo()); | |||
| queryOne.updateTenantInfo(park); | |||
| queryOne.setCUserId(getUserId()); | |||
| WxCUserCar userCar = wxCUserCarService.getOne(queryOne); | |||
| if (userCar != null) { | |||
| @@ -727,7 +727,7 @@ public class WxCarController extends BaseController { | |||
| WxCouponOrderCarCVo userCar = null; | |||
| WxCouponOrder userCarQ = new WxCouponOrder(); | |||
| userCarQ.updateTenantInfo(getTenantInfo()); | |||
| userCarQ.updateTenantInfo(park); | |||
| userCarQ.setCUserId(getUserId()); | |||
| userCarQ.setId(couponOrderId); | |||
| userCarQ.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_USE_WAIT.getCode()); | |||
| @@ -775,7 +775,7 @@ public class WxCarController extends BaseController { | |||
| // 券状态设为已使用 | |||
| WxCouponOrder couponOrder = new WxCouponOrder(); | |||
| couponOrder.setId(userCar.getId()); | |||
| couponOrder.updateTenantInfo(getTenantInfo()); | |||
| couponOrder.updateTenantInfo(park); | |||
| couponOrder.setUpdateDate(new Date()); | |||
| couponOrder.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_USED.getCode()); | |||
| try { | |||
| @@ -85,7 +85,7 @@ public class WxMallController extends BaseController { | |||
| @ApiOperation("商场信息") | |||
| @GetMapping("/mallInfo") | |||
| public ResultData getMallInfo() { | |||
| WxMall mall = wxMallService.getByTenantId(getTenantId()); | |||
| WxMall mall = wxMallService.getByTenantInfo(getTenantInfo()); | |||
| if (mall == null) { | |||
| return new ResultData(ErrorCode.MALL_INFO_NOT_FOUND); | |||
| } | |||
| @@ -4,7 +4,7 @@ import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.dto.WxMerchantDto; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.WxMerchantVo; | |||
| import com.iformall.enums.EnumMerchantPublic; | |||
| import com.iformall.enums.EnumMerchantStatus; | |||
| @@ -40,6 +40,7 @@ public class WxMerchantController extends BaseController { | |||
| public ResultData list(@ModelAttribute WxMerchantDto wxMerchantDto, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::list"); | |||
| if (null == wxMerchantDto) wxMerchantDto = new WxMerchantDto(); | |||
| wxMerchantDto.updateTenantInfo(getTenantInfo()); | |||
| wxMerchantDto.setMerchantStatus(EnumMerchantStatus.VALID.getCode()); | |||
| wxMerchantDto.setIsPublic(EnumMerchantPublic.PUBLIC.getCode()); | |||
| return new ResultData(wxMerchantService.listAsPageCVo(wxMerchantDto, pageNum, pageSize)); | |||
| @@ -58,7 +59,11 @@ public class WxMerchantController extends BaseController { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| } | |||
| HashMap<String, String> params = new HashMap<String, String>(); | |||
| params.put("tenantId", getTenantId()); | |||
| TenantEntity tenantEntity = getTenantInfo(); | |||
| params.put("tenantId", tenantEntity.getTenantId()); | |||
| if (StringUtils.isNotBlank(tenantEntity.getSubTenantId())) { | |||
| params.put("subTenantId", tenantEntity.getSubTenantId()); | |||
| } | |||
| params.put("merchantCode", codeMD5); | |||
| WxMerchantVo wxMerchant = wxMerchantService.getMerchantInfo(params); | |||
| return new ResultData(wxMerchant); | |||
| @@ -3,7 +3,6 @@ package com.iformall.controller; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxCUser; | |||
| import com.iformall.domain.po.WxPark; | |||
| import com.iformall.service.WxParkService; | |||
| import io.swagger.annotations.Api; | |||
| @@ -13,7 +13,6 @@ import com.iformall.service.WxCUserTagsService; | |||
| import com.iformall.service.WxQuestionService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import net.sf.saxon.trans.Err; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| @@ -59,7 +58,7 @@ public class WxQuestionController extends BaseController { | |||
| if (wxQuestionConfig.getStatus().equals(EnumQuestionConfigStatus.ON.getCode()) | |||
| && questionIds.size() > 0) { | |||
| WxQuestion wxQuestion = new WxQuestion(); | |||
| wxQuestion.updateTenantInfo(getTenantInfo()); | |||
| wxQuestion.updateTenantInfo(wxQuestionConfig); | |||
| wxQuestion.setIds(questionIds); | |||
| List<WxQuestion> listQuestion = wxQuestionService.findList(wxQuestion); | |||
| if (listQuestion.size() > 0) { | |||
| @@ -69,7 +68,7 @@ public class WxQuestionController extends BaseController { | |||
| WxQuestion x = q.next(); | |||
| wxQuestionLog.setQuestionId(x.getId()); | |||
| wxQuestionLog.setUserId(getUserId()); | |||
| wxQuestionLog.updateTenantInfo(getTenantInfo()); | |||
| wxQuestionLog.updateTenantInfo(wxQuestionConfig); | |||
| if(wxQuestionService.findLogList(wxQuestionLog).size()>0){ | |||
| q.remove(); | |||
| @@ -15,10 +15,7 @@ import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.WxCUserVo; | |||
| import com.iformall.domain.vo.WxLevelMerchantCVo; | |||
| import com.iformall.enums.EnumAssignTagsTrigger; | |||
| import com.iformall.enums.EnumLevelConfigDiscountStatus; | |||
| import com.iformall.enums.EnumScoreType; | |||
| import com.iformall.enums.EnumUserType; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.service.*; | |||
| import com.iformall.service.wechat.FmOpenService; | |||
| import com.iformall.utils.Constant; | |||
| @@ -43,6 +40,7 @@ import java.util.Date; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import java.util.stream.Collectors; | |||
| @RestController | |||
| @RequestMapping("/api/user") | |||
| @@ -92,6 +90,9 @@ public class WxUserGrantController extends BaseController { | |||
| @Autowired | |||
| WxCreditHistoryService wxCreditHistoryService; | |||
| @Autowired | |||
| WxMallService mallService; | |||
| /** | |||
| * 微信消息服务验证 | |||
| * | |||
| @@ -160,6 +161,12 @@ public class WxUserGrantController extends BaseController { | |||
| if (wxAuthorizerInfo == null) { | |||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | |||
| } | |||
| // 集团版,获取子集团list | |||
| List<WxMall> mallList = null; | |||
| if (wxAuthorizerInfo.getGroupSupport().equals(EnumGroupSupport.SUPPORT.getCode())) { | |||
| mallList = mallService.getSubByParentTenantId(wxAuthorizerInfo.getTenantId()); | |||
| resultMap.put("subMalls", JSON.toJSONString(mallList)); | |||
| } | |||
| if (isFmOpen) { | |||
| wxMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); | |||
| @@ -241,7 +248,30 @@ public class WxUserGrantController extends BaseController { | |||
| resultMap.put("token", token); | |||
| request.setAttribute(Constant.LOGIN_USER_KEY, oldUser.getId()); | |||
| request.setAttribute(Constant.TENANT_ID, oldUser.getTenantId()); | |||
| request.setAttribute(Constant.TENANT_ID, wxAuthorizerInfo.getTenantId()); | |||
| // 老用户,给出来已选中的mall | |||
| if (mallList != null) { | |||
| WxMall selectedMall = null; | |||
| if (StringUtils.isNotBlank(oldUser.getSubTenantId())) { | |||
| final String lastSubTenant = oldUser.getSubTenantId(); | |||
| List<WxMall> selMallList = mallList.stream().filter(ml -> ml.getTenantId().equalsIgnoreCase(lastSubTenant)).collect(Collectors.toList()); | |||
| if (selMallList.size() > 0) { | |||
| selectedMall = selMallList.get(0); | |||
| } | |||
| } | |||
| if (selectedMall == null){ | |||
| WxMall firstMall = mallList.get(0); | |||
| if (firstMall != null) { | |||
| selectedMall = firstMall; | |||
| } | |||
| } | |||
| if (selectedMall != null) { | |||
| request.setAttribute(Constant.SUB_TENANT_ID, selectedMall.getTenantId()); | |||
| resultMap.put("selectedMall", selectedMall.getTenantId()); | |||
| oldUser.setSubTenantId(selectedMall.getTenantId()); | |||
| } | |||
| } | |||
| oldUser.setRegisterIp(ipaddress); | |||
| oldUser.setSessionKey(session_key); | |||
| @@ -254,11 +284,11 @@ public class WxUserGrantController extends BaseController { | |||
| oldUser.setOpenAppId(wxAuthorizerInfo.getOpenAppid()); | |||
| } | |||
| if (StringUtils.isBlank(oldUser.getSceneAddress()) || | |||
| oldUser.getSceneAddress().equalsIgnoreCase("undefined")) { // from app.js onLaunch.options.scene | |||
| oldUser.getSceneAddress().equalsIgnoreCase(Constant.UNDEFINED)) { // from app.js onLaunch.options.scene | |||
| oldUser.setSceneAddress(sceneAddress); | |||
| } | |||
| if (StringUtils.isBlank(oldUser.getScene()) || | |||
| oldUser.getScene().equals("undefined")) { // from pages/index/index onLoad.options.scene | |||
| oldUser.getScene().equals(Constant.UNDEFINED)) { // from pages/index/index onLoad.options.scene | |||
| oldUser.setScene(scene); | |||
| } | |||
| if (StringUtils.isNotBlank(longitude)) { | |||
| @@ -286,12 +316,12 @@ public class WxUserGrantController extends BaseController { | |||
| token = newUser.createToken(new Date()); | |||
| newUser.setRegisterIp(ipaddress); | |||
| if (StringUtils.isBlank(newUser.getSceneAddress()) || | |||
| newUser.getSceneAddress().equalsIgnoreCase("undefined")) { // from app.js onLaunch.options.scene | |||
| if (StringUtils.isNotBlank(sceneAddress) && | |||
| !sceneAddress.equalsIgnoreCase(Constant.UNDEFINED)) { // from app.js onLaunch.options.scene | |||
| newUser.setSceneAddress(sceneAddress); | |||
| } | |||
| if (StringUtils.isBlank(newUser.getScene()) || | |||
| newUser.getScene().equals("undefined")) { // from pages/index/index onLoad.options.scene | |||
| if (StringUtils.isNotBlank(scene) && | |||
| !scene.equals(Constant.UNDEFINED)) { // from pages/index/index onLoad.options.scene | |||
| newUser.setScene(scene); | |||
| } | |||
| newUser.setSessionKey(session_key); | |||
| @@ -314,6 +344,15 @@ public class WxUserGrantController extends BaseController { | |||
| resultMap.put("token", token); | |||
| request.setAttribute(Constant.LOGIN_USER_KEY, newUser.getId()); | |||
| request.setAttribute(Constant.TENANT_ID, newUser.getTenantId()); | |||
| if (mallList != null) { | |||
| WxMall firstMall = mallList.get(0); | |||
| if (firstMall != null) { | |||
| // 默认选中第一个mall, 或者经纬度最近的那个 | |||
| request.setAttribute(Constant.SUB_TENANT_ID, firstMall.getTenantId()); | |||
| resultMap.put("selectedMall", firstMall.getTenantId()); | |||
| newUser.setSubTenantId(firstMall.getTenantId()); | |||
| } | |||
| } | |||
| // 登录后处理 | |||
| int score = wxCUserService.actionAfterLogin(newUser, null); | |||
| @@ -323,6 +362,33 @@ public class WxUserGrantController extends BaseController { | |||
| return new ResultData(resultMap); | |||
| } | |||
| @PostMapping("/selectMall") | |||
| @ApiOperation(value = "用户选中子广场", notes = "{\"tenantId\":\"string\",\"subTenantId\":\"string\"}") | |||
| public ResultData selectMall(@RequestBody Map<String, String> map) { | |||
| logger.debug(map.toString()); | |||
| String tenantId = map.get("tenantId"); | |||
| String subTenantId = map.get("subTenantId"); | |||
| if (StringUtils.isBlank(tenantId)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "tenantId不能为空"); | |||
| } | |||
| if (StringUtils.isBlank(subTenantId)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "subTenantId不能为空"); | |||
| } | |||
| WxCUser user = getUser(); | |||
| if (user.getTenantId().equalsIgnoreCase(tenantId)) { | |||
| HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); | |||
| request.setAttribute(Constant.TENANT_ID, tenantId); | |||
| request.setAttribute(Constant.SUB_TENANT_ID, subTenantId); | |||
| user.setSubTenantId(subTenantId); | |||
| userTokenService.saveOrUpdate(user); | |||
| } | |||
| return new ResultData(); | |||
| } | |||
| @PostMapping("/updateScene") | |||
| @ApiOperation(value = "用户更新scene", notes = "{\"scene\":\"string\"}") | |||
| public ResultData updateScene(@RequestBody Map<String, String> map) { | |||
| @@ -331,8 +397,9 @@ public class WxUserGrantController extends BaseController { | |||
| String scene = map.get("scene"); | |||
| WxCUser user = getUser(); | |||
| if (StringUtils.isBlank(user.getScene())) { | |||
| if(StringUtils.isNotBlank(scene)) { | |||
| if (StringUtils.isBlank(user.getScene()) || | |||
| user.getScene().equalsIgnoreCase(Constant.UNDEFINED)) { | |||
| if(StringUtils.isNotBlank(scene) && scene.equalsIgnoreCase(Constant.UNDEFINED)) { | |||
| user.setScene(scene); | |||
| wxCUserService.updateScene(user); | |||
| } | |||
| @@ -383,10 +450,16 @@ public class WxUserGrantController extends BaseController { | |||
| private void updateAppAccessToken(WxAppinfo wxAppinfo, WxMaService wxMaService) { | |||
| try { | |||
| String accessToken = wxMaService.getAccessToken(true); | |||
| wxAppinfo.setAccessToken(accessToken); | |||
| wxAppinfo.setLastTokenTime(new Date()); | |||
| wxAppinfo.setExpiresIn(7200); | |||
| wxAppinfoService.saveOrUpdate(wxAppinfo); | |||
| WxAppinfo updateApp = new WxAppinfo(); | |||
| updateApp.setId(wxAppinfo.getId()); | |||
| updateApp.setAccessToken(accessToken); | |||
| updateApp.setLastTokenTime(new Date()); | |||
| updateApp.setExpiresIn(7200); | |||
| wxAppinfo.setAccessToken(updateApp.getAccessToken()); | |||
| wxAppinfo.setLastTokenTime(updateApp.getLastTokenTime()); | |||
| wxAppinfo.setExpiresIn(updateApp.getExpiresIn()); | |||
| wxAppinfoService.saveOrUpdate(updateApp); | |||
| } catch (WxErrorException e) { | |||
| logger.error(e.getMessage()); | |||
| } catch (Exception e) { | |||
| @@ -434,6 +507,15 @@ public class WxUserGrantController extends BaseController { | |||
| WxMaUserInfo userInfo = wxMaService.getUserService().getUserInfo(session_key, encryptedData, iv); | |||
| if (userInfo != null) { | |||
| logger.debug(userInfo.toString()); | |||
| WxCUser updateUser = new WxCUser(); | |||
| updateUser.setId(user.getId()); | |||
| updateUser.setUnionId(userInfo.getUnionId()); | |||
| updateUser.setNickName(userInfo.getNickName()); | |||
| updateUser.setGender(Integer.parseInt(userInfo.getGender())); | |||
| updateUser.setAvatarUrl(userInfo.getAvatarUrl()); | |||
| updateUser.setProvince(userInfo.getProvince()); | |||
| updateUser.setCity(userInfo.getCity()); | |||
| updateUser.setLanguage(userInfo.getLanguage()); | |||
| user.setUnionId(userInfo.getUnionId()); | |||
| user.setNickName(userInfo.getNickName()); | |||
| user.setGender(Integer.parseInt(userInfo.getGender())); | |||
| @@ -441,7 +523,7 @@ public class WxUserGrantController extends BaseController { | |||
| user.setProvince(userInfo.getProvince()); | |||
| user.setCity(userInfo.getCity()); | |||
| user.setLanguage(userInfo.getLanguage()); | |||
| wxCUserService.saveOrUpdate(user); | |||
| wxCUserService.saveOrUpdate(updateUser); | |||
| if(bFirstNickName) { | |||
| // 首次获取昵称 | |||
| @@ -681,7 +763,7 @@ public class WxUserGrantController extends BaseController { | |||
| public ResultData carCount() { | |||
| WxCUser user = getUser(); | |||
| WxCUserCar userCar = new WxCUserCar(); | |||
| userCar.updateTenantInfo(getTenantInfo()); | |||
| userCar.updateTenantInfo(user); | |||
| userCar.setCUserId(user.getId()); | |||
| Integer count = wxCUserCarService.countUserCar(userCar); | |||
| if (count > 0) { | |||
| @@ -761,11 +843,14 @@ public class WxUserGrantController extends BaseController { | |||
| if (wxCUserBasicInfoService.getById(getUserId()) == null) | |||
| return new ResultData(ErrorCode.USER_IS_NOT_MEMBER); | |||
| TenantEntity tenantEntity = getTenantInfo(); | |||
| if (wxCUserBasicInfo.getName() != null || | |||
| wxCUserBasicInfo.getBirthdate() != null || | |||
| wxCUserBasicInfo.getSex() != null || | |||
| wxCUserBasicInfo.getAddress() != null) { | |||
| WxCUserBasicInfo record = new WxCUserBasicInfo(); | |||
| record.updateTenantInfo(tenantEntity); | |||
| record.setName(wxCUserBasicInfo.getName()); | |||
| record.setBirthdate(wxCUserBasicInfo.getBirthdate()); | |||
| record.setSex(wxCUserBasicInfo.getSex()); | |||
| @@ -777,7 +862,7 @@ public class WxUserGrantController extends BaseController { | |||
| //增加积分 | |||
| WxCreditHistory wxCreditHistory = new WxCreditHistory(); | |||
| wxCreditHistory.setCUserId(record.getId()); | |||
| wxCreditHistory.updateTenantInfo(getTenantInfo()); | |||
| wxCreditHistory.updateTenantInfo(tenantEntity); | |||
| wxCreditHistory.setCreateDate(new Date()); | |||
| wxCreditHistory.setCreditType(EnumScoreType.COMPLETE_INFO.getCode()); | |||
| wxCreditHistory.setOperatorType(EnumUserType.CUSER.getCode()); | |||
| @@ -796,7 +881,6 @@ public class WxUserGrantController extends BaseController { | |||
| @RequestMapping("/getDiscountInfo") | |||
| @ApiOperation(value = "获取用户折扣率", notes = "") | |||
| public ResultData getDiscountInfo() { | |||
| WxCUser user = getUser(); | |||
| List<WxLevelConfig> levelList = wxLevelConfigService.getByTenantId(user.getTenantId()); | |||
| @@ -811,6 +895,7 @@ public class WxUserGrantController extends BaseController { | |||
| } | |||
| } | |||
| WxLevelMerchant levelMerchant = new WxLevelMerchant(); | |||
| levelMerchant.updateTenantInfo(getTenantInfo()); | |||
| levelMerchant.setLevelId(levelId); | |||
| List<WxLevelMerchantCVo> levelMerchantList = wxLevelConfigService.findListCVo(levelMerchant); | |||
| @@ -62,6 +62,9 @@ public class AuthorizationInterceptor extends HandlerInterceptorAdapter { | |||
| //设置userId到request里,后续根据userId,获取用户信息 | |||
| request.setAttribute(Constant.LOGIN_USER_KEY, wxCUser.getId()); | |||
| request.setAttribute(Constant.TENANT_ID, wxCUser.getTenantId()); | |||
| if (StringUtils.isNotBlank(wxCUser.getSubTenantId())) { | |||
| request.setAttribute(Constant.SUB_TENANT_ID, wxCUser.getSubTenantId()); | |||
| } | |||
| return true; | |||
| } | |||
| @@ -26,8 +26,24 @@ public class TenantInfoImpl implements TenantInfo { | |||
| return tenantId; | |||
| } | |||
| @Override | |||
| public String getSubTenantId() { | |||
| String subTenantId = null; | |||
| try { | |||
| HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); | |||
| subTenantId = (String) request.getAttribute(Constant.SUB_TENANT_ID); | |||
| return subTenantId; | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage()); | |||
| } | |||
| return subTenantId; | |||
| } | |||
| @Override | |||
| public boolean doTableFilter(String tableName) { | |||
| if ("wx_mall".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("mall_permission".equals(tableName)) { | |||
| return true; | |||
| } | |||
| @@ -72,6 +88,68 @@ public class TenantInfoImpl implements TenantInfo { | |||
| return false; | |||
| } | |||
| @Override | |||
| public boolean doTableFilterSub(String tableName) { | |||
| if ("wx_mall".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_appinfo".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_authorizer_info".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_c_user".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_c_user_basic_info".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_c_user_car".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_c_user_from_b".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_c_user_tags".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_question".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_question_config".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_question_log".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_user_visit".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_level_config".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_score_rules".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("view_coupon_data".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("view_touch_user".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_weapp_audit_status".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_weapp_code_status".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_weapp_release_status".equals(tableName)) { | |||
| return true; | |||
| } | |||
| return false; | |||
| } | |||
| @Override | |||
| public boolean doMappedStatementFIlter(MappedStatement ms) { | |||
| if ("com.iformall.mapper.WxCUserMapper.getByToken".equals(ms.getId())) | |||
| @@ -173,24 +173,29 @@ public class WxCarETCPCallBackController extends BaseController { | |||
| // 根据orderId获取入场信息,确定租户ID | |||
| String orderId = paramMap.get(ETCPUtil.ETCP_ORDER_ID); | |||
| String etcpTime = paramMap.get(ETCPUtil.ETCP_TIME); | |||
| HashMap<String, String> map = new HashMap<String, String>(); | |||
| map.put("synId", orderId); | |||
| map.put("plateNumber", carNumber); | |||
| String tenantId = wxCarCmdLogService.getTenantIdBySynId(map); | |||
| WxCarCmdLog carCmdLogQ = new WxCarCmdLog(); | |||
| carCmdLogQ.setVendorType(EnumCarVendor.CAR_ETCP.getCode()); | |||
| carCmdLogQ.setCmdType(EnumCarCmd.CAR_ETCP_CALLBACK_PARK_IN.getCode()); | |||
| carCmdLogQ.setSynId(orderId); | |||
| carCmdLogQ.setPlateNumber(carNumber); | |||
| WxCarCmdLog tenantInfo = wxCarCmdLogService.getTenantInfoBySynId(carCmdLogQ); | |||
| String tenantId = null; | |||
| /// if not found syn_id, maybe use user_car to get tenantId | |||
| if(StringUtils.isBlank(tenantId)) { | |||
| if(tenantInfo == null) { | |||
| WxCUserCar queryOne = new WxCUserCar(); | |||
| queryOne.setCarNumber(carNumber); | |||
| WxCUserCar userCar = wxCUserCarService.getOnlyOne(queryOne); | |||
| if(userCar != null) { | |||
| tenantId = userCar.getTenantId(); | |||
| } | |||
| if (StringUtils.isNotBlank(tenantId)) { | |||
| carCmdLogQ.setTenantId(tenantId); | |||
| } | |||
| } else { | |||
| carCmdLogQ.updateTenantInfo(tenantInfo); | |||
| } | |||
| // 检查是否有重复数据 | |||
| if(StringUtils.isNotBlank(tenantId)) { | |||
| map.put("tenantId", tenantId); | |||
| } | |||
| String paidServiceFee = paramMap.get(ETCPUtil.ETCP_PAID_SERVICE_FEE); | |||
| String fee = paramMap.get(ETCPUtil.ETCP_FEE); | |||
| Date feeTime = null; | |||
| @@ -202,19 +207,24 @@ public class WxCarETCPCallBackController extends BaseController { | |||
| logger.error("解析fee time出错" + etcpTime); | |||
| } | |||
| } | |||
| map.put("plateNumber", carNumber); | |||
| map.put("orderId", orderId); | |||
| map.put("fee", fee); | |||
| map.put("feeTime", etcpTime); | |||
| WxCarCmdLog carCmdLog = wxCarCmdLogService.getByOrderId(map); | |||
| carCmdLogQ.setCmdType(EnumCarCmd.CAR_ETCP_CALLBACK_PAY_MANUAL.getCode()); | |||
| carCmdLogQ.setPlateNumber(carNumber); | |||
| carCmdLogQ.setOrderId(orderId); | |||
| carCmdLogQ.setFee(fee); | |||
| carCmdLogQ.setFeeTime(etcpTime); | |||
| WxCarCmdLog carCmdLog = wxCarCmdLogService.getByOrderId(carCmdLogQ); | |||
| if(carCmdLog != null) { | |||
| logger.error("ETCP order paid 已入库: " + orderId); | |||
| } | |||
| Date currentDate = new Date(); | |||
| WxCarCmdLog wxCarCmdLog = new WxCarCmdLog(); | |||
| if(StringUtils.isNotBlank(tenantId)) { | |||
| wxCarCmdLog.setTenantId(tenantId); | |||
| if (tenantInfo != null) { | |||
| wxCarCmdLog.updateTenantInfo(tenantInfo); | |||
| } else { | |||
| if (StringUtils.isNotBlank(tenantId)) { | |||
| wxCarCmdLog.setTenantId(tenantId); | |||
| } | |||
| } | |||
| if(carCmdLog != null) { | |||
| // 如果有15分钟的已支付的数据,自动覆盖 | |||
| @@ -290,7 +300,6 @@ public class WxCarETCPCallBackController extends BaseController { | |||
| wxCarCmdLog.setUpdateDate(currentDate); | |||
| String etcpParkId = paramMap.get(ETCPUtil.ETCP_PARK_ID); | |||
| String tenantId = null; | |||
| WxPark parkQ = new WxPark(); | |||
| parkQ.setVendorType(EnumCarVendor.CAR_ETCP.getCode()); | |||
| parkQ.setParkingId(etcpParkId); | |||
| @@ -299,13 +308,11 @@ public class WxCarETCPCallBackController extends BaseController { | |||
| logger.error("etcpParkInCallback: ETCP车场未找到" + etcpParkId); | |||
| //return new Result(ErrorCode.CAR_PARK_NOT_FOUND.getCode(), "ETCP车场未找到"+ etcpParkId); | |||
| } else { | |||
| tenantId = park.getTenantId(); | |||
| wxCarCmdLog.updateTenantInfo(park); | |||
| } | |||
| String carNumber = paramMap.get(ETCPUtil.ETCP_CAR_NUMBER); | |||
| String synId = paramMap.get(ETCPUtil.ETCP_SYN_ID); | |||
| String parkId = paramMap.get(ETCPUtil.ETCP_PARK_ID); | |||
| String parkName = paramMap.get(ETCPUtil.ETCP_PARK_NAME); | |||
| String userType = paramMap.get(ETCPUtil.ETCP_USER_TYPE); | |||
| String entranceTime = paramMap.get(ETCPUtil.ETCP_ENTRANCE_TIME); | |||
| @@ -316,8 +323,11 @@ public class WxCarETCPCallBackController extends BaseController { | |||
| HashMap<String, Object> map = new HashMap<String, Object>(); | |||
| map.put("synId", synId); | |||
| map.put("cmdType", EnumCarCmd.CAR_ETCP_CALLBACK_PARK_IN.getCode()); | |||
| if(tenantId != null) { | |||
| map.put("tenantId", tenantId); | |||
| if (StringUtils.isNotBlank(wxCarCmdLog.getTenantId())) { | |||
| map.put("tenantId", wxCarCmdLog.getTenantId()); | |||
| } | |||
| if (StringUtils.isNotBlank(wxCarCmdLog.getSubTenantId())) { | |||
| map.put("subTenantId", wxCarCmdLog.getSubTenantId()); | |||
| } | |||
| WxCarCmdLog carCmdLog = wxCarCmdLogService.getBySynId(map); | |||
| if(carCmdLog != null) { | |||
| @@ -338,13 +348,16 @@ public class WxCarETCPCallBackController extends BaseController { | |||
| if (!StringUtils.isBlank(carNumber)) { | |||
| // 根据车牌查找用户 | |||
| WxCUserCar userCarQ = new WxCUserCar(); | |||
| userCarQ.setTenantId(tenantId); | |||
| if (StringUtils.isNotBlank(wxCarCmdLog.getTenantId())) { | |||
| userCarQ.setTenantId(wxCarCmdLog.getTenantId()); | |||
| } | |||
| userCarQ.setCarNumber(carNumber); | |||
| userCarQ.setVendorType(EnumCarVendor.CAR_ETCP.getCode()); | |||
| // TODO 可能多用户关联同一张车牌 | |||
| List<WxCUserCar> userCarList = wxCUserCarService.getList(userCarQ); | |||
| boolean bFirst = true; | |||
| for (WxCUserCar userCar : userCarList) { | |||
| userCar.setSubTenantId(park.getSubTenantId()); | |||
| wxCouponSendService.sendCouponToUser(EnumCouponSendSendType.CAR_STOP, userCar); | |||
| WxCUser cUser = wxCUserService.getById(userCar.getCUserId()); | |||
| if(cUser != null){ | |||
| @@ -363,7 +376,7 @@ public class WxCarETCPCallBackController extends BaseController { | |||
| WxCarPayRecord record = new WxCarPayRecord(); | |||
| record.setVendorType(wxCarCmdLog.getVendorType()); | |||
| record.setSynId(synId); | |||
| record.setParkId(parkId); | |||
| record.setParkId(etcpParkId); | |||
| record.setParkName(parkName); | |||
| record.setUserType(userType); | |||
| record.setPlateNumber(carNumber); | |||
| @@ -373,7 +386,7 @@ public class WxCarETCPCallBackController extends BaseController { | |||
| record.setFixParkingId(fixParkingId); | |||
| record.setRemainingDays(remainingDays); | |||
| record.setPhone(phoneStrs); | |||
| record.setTenantId(tenantId); | |||
| record.updateTenantInfo(wxCarCmdLog); | |||
| WxCarPayRecord query = new WxCarPayRecord(); | |||
| query.setSynId(synId); | |||
| @@ -426,7 +439,6 @@ public class WxCarETCPCallBackController extends BaseController { | |||
| String exitTime = paramMap.get(ETCPUtil.ETCP_EXIT_TIME); | |||
| String stayedTime = paramMap.get(ETCPUtil.ETCP_STAYED_TIME); | |||
| String carNumber = paramMap.get(ETCPUtil.ETCP_CAR_NUMBER); | |||
| String parkId = paramMap.get(ETCPUtil.ETCP_PARK_ID); | |||
| String parkName = paramMap.get(ETCPUtil.ETCP_PARK_NAME); | |||
| String userType = paramMap.get(ETCPUtil.ETCP_USER_TYPE); | |||
| String entranceTime = paramMap.get(ETCPUtil.ETCP_ENTRANCE_TIME); | |||
| @@ -445,7 +457,7 @@ public class WxCarETCPCallBackController extends BaseController { | |||
| } | |||
| record.setVendorType(wxCarCmdLog.getVendorType()); | |||
| record.setSynId(synId); | |||
| record.setParkId(parkId); | |||
| record.setParkId(etcpParkId); | |||
| record.setParkName(parkName); | |||
| record.setUserType(userType); | |||
| record.setPlateNumber(carNumber); | |||
| @@ -164,6 +164,7 @@ public class WxCarTJDCallBackController extends BaseController { | |||
| List<WxCUserCar> userCarList = wxCUserCarService.getList(userCarQ); | |||
| boolean bFirst = true; | |||
| for (WxCUserCar userCar : userCarList) { | |||
| userCar.setSubTenantId(park.getSubTenantId()); | |||
| wxCouponSendService.sendCouponToUser(EnumCouponSendSendType.CAR_STOP, userCar); | |||
| WxCUser cUser = wxCUserService.getById(userCar.getCUserId()); | |||
| if(cUser != null){ | |||
| @@ -13,9 +13,7 @@ import com.iformall.enums.EnumBoxRegisterStatus; | |||
| import com.iformall.service.kw.KwBoxCmdHistoryService; | |||
| import com.iformall.service.kw.KwBoxService; | |||
| import com.iformall.utils.HashUtil; | |||
| import com.iformall.utils.Utility; | |||
| import com.sun.crypto.provider.HmacSHA1; | |||
| import io.netty.util.internal.StringUtil; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| @@ -119,9 +119,10 @@ public class WxDeviceScreenAdController extends BaseController { | |||
| @SystemControllerLog(description = "广告屏-基础信息") | |||
| public Result info(@RequestParam String deviceId) { | |||
| WxDevice wxDevice = findDevice(deviceId); | |||
| if (wxDevice == null) | |||
| if (wxDevice == null) { | |||
| return new ResultData(ErrorCode.DEVICE_NOT_FOUND); | |||
| return new ResultData(wxMallService.getByTenantId(wxDevice.getTenantId())); | |||
| } | |||
| return new ResultData(wxMallService.getByTenantInfo(wxDevice)); | |||
| } | |||
| } | |||
| @@ -28,7 +28,7 @@ public class MyShiroRealm extends AuthorizingRealm { | |||
| @Override | |||
| protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principalCollection) { | |||
| MallUserInfo user= (MallUserInfo) SecurityUtils.getSubject().getPrincipal(); | |||
| Set<String> permissionSet = userService.getUserPermissions(user); | |||
| Set<String> permissionSet = userService.getUserPermissions(user, true); | |||
| SimpleAuthorizationInfo info = new SimpleAuthorizationInfo(); | |||
| info.setStringPermissions(permissionSet); | |||
| return info; | |||
| @@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.PromotionCalc; | |||
| import com.iformall.domain.vo.WxCouponOrderCVo; | |||
| import com.iformall.domain.vo.WxLevelMerchantCVo; | |||
| @@ -87,35 +88,45 @@ public class PosServiceImpl implements PosService { | |||
| throw new MallinkException(ErrorCode.MALL_INFO_NOT_FOUND); | |||
| } | |||
| PosMallConfig config = posMallConfigService.getByTenantId(tenantId); | |||
| TenantEntity tenantEntity = mall.getTenantInfo(); | |||
| PosMallConfig config = posMallConfigService.getByTenantInfo(tenantEntity); | |||
| if (config == null) { | |||
| logger.error(ErrorCode.MALL_INFO_NOT_FOUND.getMessage()); | |||
| throw new MallinkException(ErrorCode.MALL_INFO_NOT_FOUND); | |||
| } | |||
| WxMerchantBUser user = new WxMerchantBUser(); | |||
| user.setTenantId(tenantId); | |||
| user.setPhone(phone); | |||
| user.setStatus(EnumMerchantBUserStatus.VALID.getCode()); | |||
| WxMerchantBUser user1 = null; | |||
| WxMerchantBUser userQ = new WxMerchantBUser(); | |||
| userQ.updateTenantInfo(tenantEntity); | |||
| userQ.setPhone(phone); | |||
| userQ.setStatus(EnumMerchantBUserStatus.VALID.getCode()); | |||
| WxMerchantBUser orgUser = null; | |||
| List<WxMerchantBUser> orgUserList = null; | |||
| try { | |||
| user1 = merchantBUserService.getBUserByAppId(user); | |||
| orgUserList = merchantBUserService.getBUserByAppId(userQ); | |||
| } catch (Exception e) { | |||
| String errMessage = ErrorCode.MERCHANT_BUSER_NOT_VALID.getMessage() + "phone: " + phone + ", " +e.getMessage(); | |||
| throw new MallinkException(ErrorCode.MERCHANT_BUSER_NOT_VALID.getCode(), errMessage); | |||
| } | |||
| if (user1 != null) { | |||
| if (orgUserList.size() > 0) { | |||
| orgUser = orgUserList.get(0); | |||
| } | |||
| if (orgUser != null) { | |||
| // check merchant 状态 | |||
| WxMerchant merchant = checkAndGetMerchant(user1.getMerchantId()); | |||
| WxMerchant merchant = checkAndGetMerchant(orgUser.getMerchantId()); | |||
| // check password | |||
| if (user1.getUserPwd().equalsIgnoreCase(password)) { | |||
| retMap.put(WxPayConstant.TENANT_ID, user1.getTenantId()); | |||
| if (orgUser.getUserPwd().equalsIgnoreCase(password)) { | |||
| if (StringUtils.isBlank(orgUser.getSubTenantId())) { | |||
| retMap.put(WxPayConstant.TENANT_ID, orgUser.getTenantId()); | |||
| } else { | |||
| retMap.put(WxPayConstant.TENANT_ID, orgUser.getSubTenantId()); | |||
| } | |||
| retMap.put(WxPayConstant.MALL_NAME, mall.getName()); | |||
| retMap.put(WxPayConstant.MERCHANT_ID, String.valueOf(user1.getMerchantId())); | |||
| retMap.put(WxPayConstant.MERCHANT_ID, String.valueOf(orgUser.getMerchantId())); | |||
| retMap.put(WxPayConstant.MERCHANT_NAME, merchant.getName()); | |||
| retMap.put(WxPayConstant.MERCHANT_IMG, merchant.getImgUrl()); | |||
| retMap.put(WxPayConstant.BUSER_ID, String.valueOf(user1.getId())); | |||
| retMap.put(WxPayConstant.BUSER_ID, String.valueOf(orgUser.getId())); | |||
| JSONObject qrCodeInfo = new JSONObject(); | |||
| qrCodeInfo.put(WxPayConstant.REG_QRCODE_URL, mall.getImgQrcodeWeapp()); | |||
| @@ -188,8 +199,15 @@ public class PosServiceImpl implements PosService { | |||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_CAST_ERROR); | |||
| } | |||
| WxMall mall = mallService.getByTenantId(tenantId); | |||
| if (mall == null) { | |||
| logger.error(ErrorCode.MALL_INFO_NOT_FOUND.getMessage()); | |||
| throw new MallinkException(ErrorCode.MALL_INFO_NOT_FOUND); | |||
| } | |||
| TenantEntity tenantEntity = mall.getTenantInfo(); | |||
| // 1. POS 支持 配置 | |||
| PosMallConfig config = posMallConfigService.getByTenantId(tenantId); | |||
| PosMallConfig config = posMallConfigService.getByTenantInfo(tenantEntity); | |||
| if (config == null) { | |||
| logger.error(ErrorCode.POS_CONFIG_NOT_FOUND.getMessage()); | |||
| throw new MallinkException(ErrorCode.POS_CONFIG_NOT_FOUND); | |||
| @@ -284,7 +302,7 @@ public class PosServiceImpl implements PosService { | |||
| errParam2(WxPayConstant.MEM_ID, WxPayConstant.MEM_PHONE); | |||
| } | |||
| // 10. 获取会员信息 | |||
| user = getMemUser(tenantId, memIdStr, memPhoneStr); | |||
| user = getMemUser(merchant, memIdStr, memPhoneStr); | |||
| } | |||
| if (user == null) { | |||
| @@ -309,12 +327,15 @@ public class PosServiceImpl implements PosService { | |||
| promotionCalc.setPromotionAmount(0); | |||
| promotionCalc.setAmountLeftAfterPay(orderAmountLeft); | |||
| // 12. 会员折扣 | |||
| JSONObject discountObj = getMemLevelDiscount(promotionCalc, config.getDiscount(), tenantId, user, merchantId); | |||
| JSONObject discountObj = getMemLevelDiscount(promotionCalc, config.getDiscount(), tenantEntity, user, merchantId); | |||
| promotionInfo.put(WxPayConstant.MEMBER_DISCOUNT, discountObj); | |||
| // 14. 获取用户可用券列表 | |||
| if (!config.getCoupon().equals(EnumPosCouponEnableType.Disable.getCode())) { | |||
| Map<String, Object> coQ = new HashMap<>(); | |||
| coQ.put("tenantId", tenantId); | |||
| if (StringUtils.isNotBlank(tenantEntity.getSubTenantId())) { | |||
| coQ.put("subTenantId", tenantEntity.getSubTenantId()); | |||
| } | |||
| coQ.put("cUserId", user.getId()); | |||
| coQ.put("merchantId", merchantId); | |||
| List<WxCouponOrderCVo> avaCoList = couponOrderMapper.findAvailCouponOrder(coQ); | |||
| @@ -663,7 +684,7 @@ public class PosServiceImpl implements PosService { | |||
| return couponOrderCVo; | |||
| } | |||
| private WxCUser getMemUser(String tenantId, String memIdStr, String memPhoneStr) { | |||
| private WxCUser getMemUser(TenantEntity tenantEntity, String memIdStr, String memPhoneStr) { | |||
| WxCUser user = null; | |||
| if (StringUtils.isNotBlank(memIdStr)) { | |||
| Long memId; | |||
| @@ -678,7 +699,7 @@ public class PosServiceImpl implements PosService { | |||
| } | |||
| if (StringUtils.isNotBlank(memPhoneStr)) { | |||
| WxCUser q = new WxCUser(); | |||
| q.setTenantId(tenantId); | |||
| q.updateTenantInfo(tenantEntity); | |||
| q.setPhone(memPhoneStr); | |||
| user = cUserService.getByObject(q); | |||
| } | |||
| @@ -689,18 +710,18 @@ public class PosServiceImpl implements PosService { | |||
| * 会员折扣 | |||
| * @param promotionCalc | |||
| * @param discountConfig | |||
| * @param tenantId | |||
| * @param tenantEntity | |||
| * @param user | |||
| * @param merchantId | |||
| * @return | |||
| */ | |||
| private JSONObject getMemLevelDiscount(PromotionCalc promotionCalc, Integer discountConfig, String tenantId, WxCUser user, Long merchantId) { | |||
| private JSONObject getMemLevelDiscount(PromotionCalc promotionCalc, Integer discountConfig, TenantEntity tenantEntity, WxCUser user, Long merchantId) { | |||
| JSONObject discountObj = new JSONObject(); | |||
| Integer discount = 100; | |||
| if (discountConfig.equals(EnumPosEnableType.Enable.getCode())) { | |||
| String level = WxLevelConfigService.DEFAULT_LEVEL; | |||
| // 1. 会员级别Level | |||
| List<WxLevelConfig> levelList = levelConfigService.getByTenantId(tenantId); | |||
| List<WxLevelConfig> levelList = levelConfigService.getByTenantId(tenantEntity.getTenantId()); | |||
| Long levelId = 0L; | |||
| for (WxLevelConfig levelConfig : levelList) { | |||
| if (user.getScore() >= levelConfig.getPoints()) { | |||
| @@ -712,7 +733,7 @@ public class PosServiceImpl implements PosService { | |||
| // 2. 会员级别对应折扣discount | |||
| WxLevelMerchant levelMerchant = new WxLevelMerchant(); | |||
| levelMerchant.setTenantId(tenantId); | |||
| levelMerchant.updateTenantInfo(tenantEntity); | |||
| levelMerchant.setLevelId(levelId); | |||
| levelMerchant.setMerchantId(merchantId); | |||
| List<WxLevelMerchantCVo> levelMerchantList = levelConfigService.findListCVo(levelMerchant); | |||
| @@ -798,8 +819,16 @@ public class PosServiceImpl implements PosService { | |||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_CAST_ERROR); | |||
| } | |||
| WxMall mall = mallService.getByTenantId(tenantId); | |||
| if (mall == null) { | |||
| logger.error(ErrorCode.MALL_INFO_NOT_FOUND.getMessage()); | |||
| throw new MallinkException(ErrorCode.MALL_INFO_NOT_FOUND); | |||
| } | |||
| TenantEntity tenantEntity = mall.getTenantInfo(); | |||
| // 1. POS 支持 配置 | |||
| PosMallConfig config = posMallConfigService.getByTenantId(tenantId); | |||
| PosMallConfig config = posMallConfigService.getByTenantInfo(tenantEntity); | |||
| if (config == null) { | |||
| logger.error(ErrorCode.POS_CONFIG_NOT_FOUND.getMessage()); | |||
| throw new MallinkException(ErrorCode.POS_CONFIG_NOT_FOUND); | |||
| @@ -880,7 +909,7 @@ public class PosServiceImpl implements PosService { | |||
| errParam2(WxPayConstant.MEM_ID, WxPayConstant.MEM_PHONE); | |||
| } | |||
| // 10. 获取会员信息 | |||
| WxCUser user = getMemUser(tenantId, memIdStr, memPhoneStr); | |||
| WxCUser user = getMemUser(merchant, memIdStr, memPhoneStr); | |||
| if (user == null) { | |||
| logger.error(ErrorCode.USER_NOT_MEMBER.getMessage()); | |||
| throw new MallinkException(ErrorCode.USER_NOT_MEMBER); | |||
| @@ -903,12 +932,15 @@ public class PosServiceImpl implements PosService { | |||
| promotionCalc.setPromotionAmount(0); | |||
| promotionCalc.setAmountLeftAfterPay(orderAmountLeft); | |||
| // 12. 会员折扣 | |||
| JSONObject discountObj = getMemLevelDiscount(promotionCalc, config.getDiscount(), tenantId, user, merchantId); | |||
| JSONObject discountObj = getMemLevelDiscount(promotionCalc, config.getDiscount(), tenantEntity, user, merchantId); | |||
| promotionInfo.put(WxPayConstant.MEMBER_DISCOUNT, discountObj); | |||
| // 14. 获取用户可用券列表 | |||
| if (!config.getCoupon().equals(EnumPosCouponEnableType.Disable.getCode())) { | |||
| Map<String, Object> coQ = new HashMap<>(); | |||
| coQ.put("tenantId", tenantId); | |||
| if (StringUtils.isNotBlank(tenantEntity.getSubTenantId())) { | |||
| coQ.put("subTenantId", tenantEntity.getSubTenantId()); | |||
| } | |||
| coQ.put("cUserId", user.getId()); | |||
| coQ.put("merchantId", merchantId); | |||
| List<WxCouponOrderCVo> avaCoList = couponOrderMapper.findAvailCouponOrder(coQ); | |||
| @@ -1144,7 +1176,7 @@ public class PosServiceImpl implements PosService { | |||
| throw new MallinkException(ErrorCode.POS_COUPON_REFUND_ERROR.getCode(), errMesg); | |||
| } | |||
| // 10. 获取会员信息 | |||
| WxCUser user = getMemUser(tenantId, memIdStr, memPhoneStr); | |||
| WxCUser user = getMemUser(merchant, memIdStr, memPhoneStr); | |||
| if (user == null) { | |||
| logger.error(ErrorCode.USER_NOT_MEMBER.getMessage()); | |||
| throw new MallinkException(ErrorCode.USER_NOT_MEMBER); | |||
| @@ -1186,7 +1218,7 @@ public class PosServiceImpl implements PosService { | |||
| int num = 0; | |||
| // 1. insert posOrderId | |||
| PosCouponOrderVerify posCouponOrderVerify = new PosCouponOrderVerify(); | |||
| posCouponOrderVerify.setTenantId(couponOrderCVo.getTenantId()); | |||
| posCouponOrderVerify.updateTenantInfo(couponOrderCVo); | |||
| posCouponOrderVerify.setCouponOrderId(couponOrderCVo.getId()); | |||
| posCouponOrderVerify.setPosOrderId(posOrderId); | |||
| posCouponOrderVerify.setOrderFrom(EnumOrderFrom.POS.getCode()); | |||
| @@ -1204,7 +1236,7 @@ public class PosServiceImpl implements PosService { | |||
| try { | |||
| WxCouponOrder couponOrder = new WxCouponOrder(); | |||
| couponOrder.setId(couponOrderCVo.getId()); | |||
| couponOrder.setTenantId(couponOrderCVo.getTenantId()); | |||
| couponOrder.updateTenantInfo(couponOrderCVo); | |||
| couponOrder.setCouponOrderStatus(EnumCouponOrderStatus.POS_PRE_VERIFY.getCode()); | |||
| couponOrder.setBUserId(buUserId); | |||
| couponOrder.setVerifyType(EnumCouponVerifyType.VERIFY_POS_PAY.getCode()); | |||
| @@ -1230,7 +1262,7 @@ public class PosServiceImpl implements PosService { | |||
| int num = 0; | |||
| // 1. update posOrderId | |||
| PosCouponOrderVerify posCouponOrderVerify = new PosCouponOrderVerify(); | |||
| posCouponOrderVerify.setTenantId(couponOrderCVo.getTenantId()); | |||
| posCouponOrderVerify.updateTenantInfo(couponOrderCVo); | |||
| posCouponOrderVerify.setCouponOrderId(couponOrderCVo.getId()); | |||
| posCouponOrderVerify.setPosOrderId(posOrderId); | |||
| posCouponOrderVerify.setState(EnumEnableType.Enable.getCode()); | |||
| @@ -1254,7 +1286,7 @@ public class PosServiceImpl implements PosService { | |||
| try { | |||
| WxCouponOrder couponOrder = new WxCouponOrder(); | |||
| couponOrder.setId(couponOrderCVo.getId()); | |||
| couponOrder.setTenantId(couponOrderCVo.getTenantId()); | |||
| couponOrder.updateTenantInfo(couponOrderCVo); | |||
| couponOrder.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_USE_WAIT.getCode()); | |||
| couponOrder.setUpdateDate(new Date()); | |||
| num = couponOrderMapper.cancelVerifyCouponOrder(couponOrder); | |||
| @@ -1281,7 +1313,7 @@ public class PosServiceImpl implements PosService { | |||
| int num = 0; | |||
| // 1. insert posOrderId | |||
| PosCouponOrderVerify posCouponOrderVerify = new PosCouponOrderVerify(); | |||
| posCouponOrderVerify.setTenantId(couponOrderCVo.getTenantId()); | |||
| posCouponOrderVerify.updateTenantInfo(couponOrderCVo); | |||
| posCouponOrderVerify.setCouponOrderId(couponOrderCVo.getId()); | |||
| posCouponOrderVerify.setPosOrderId(posOrderId); | |||
| posCouponOrderVerify.setOrderFrom(EnumOrderFrom.POS.getCode()); | |||
| @@ -1297,7 +1329,7 @@ public class PosServiceImpl implements PosService { | |||
| try { | |||
| WxCouponOrder couponOrder = new WxCouponOrder(); | |||
| couponOrder.setId(couponOrderCVo.getId()); | |||
| couponOrder.setTenantId(couponOrderCVo.getTenantId()); | |||
| couponOrder.updateTenantInfo(couponOrderCVo); | |||
| if (actionType.equals(EnumPosActionType.VERIFY_INDEPENT)) { | |||
| couponOrder.setVerifyType(EnumCouponVerifyType.VERIFY_POS_INDEPENDENT.getCode()); | |||
| couponOrder.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_USED.getCode()); | |||
| @@ -1331,7 +1363,7 @@ public class PosServiceImpl implements PosService { | |||
| creditHistory.setOperatorId(buUserId); | |||
| creditHistory.setCUserId(couponOrderCVo.getcUserId()); | |||
| creditHistory.setCreateDate(new Date()); | |||
| creditHistory.setTenantId(couponOrderCVo.getTenantId()); | |||
| creditHistory.updateTenantInfo(couponOrderCVo); | |||
| creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); | |||
| creditHistory.setCouponId(couponOrderCVo.getCouponId()); | |||
| creditHistory.setBusinessId(coupon.getBusiness()); | |||
| @@ -1358,7 +1390,7 @@ public class PosServiceImpl implements PosService { | |||
| creditHistory.setOperatorId(buUserId); | |||
| creditHistory.setCUserId(memId); | |||
| creditHistory.setCreateDate(new Date()); | |||
| creditHistory.setTenantId(merchant.getTenantId()); | |||
| creditHistory.updateTenantInfo(merchant); | |||
| creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); | |||
| creditHistory.setBusinessId(merchant.getBusinessId()); | |||
| creditHistory.setSpend(payment); | |||
| @@ -1389,7 +1421,7 @@ public class PosServiceImpl implements PosService { | |||
| creditHistory.setOperatorType(EnumUserType.BUSER.getCode()); | |||
| creditHistory.setOperatorId(buUserId); | |||
| creditHistory.setCUserId(couponOrderCVo.getcUserId()); | |||
| creditHistory.setTenantId(couponOrderCVo.getTenantId()); | |||
| creditHistory.updateTenantInfo(couponOrderCVo); | |||
| creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); | |||
| creditHistory.setCouponId(couponOrderCVo.getCouponId()); | |||
| int num = creditHistoryService.cancelCredit(creditHistory); | |||
| @@ -1404,7 +1436,7 @@ public class PosServiceImpl implements PosService { | |||
| // 2. 成长值历史回退 | |||
| try { | |||
| WxScoreHistory scoreHistory = new WxScoreHistory(); | |||
| scoreHistory.setTenantId(couponOrderCVo.getTenantId()); | |||
| scoreHistory.updateTenantInfo(couponOrderCVo); | |||
| scoreHistory.setScoreType(EnumScoreType.CONSUMPTION.getCode()); | |||
| scoreHistory.setCUserId(couponOrderCVo.getcUserId()); | |||
| scoreHistory.setOrderId(couponOrderCVo.getOrderId()); | |||
| @@ -1420,7 +1452,7 @@ public class PosServiceImpl implements PosService { | |||
| // 3. update posOrderId | |||
| PosCouponOrderVerify posCouponOrderVerify = new PosCouponOrderVerify(); | |||
| posCouponOrderVerify.setTenantId(couponOrderCVo.getTenantId()); | |||
| posCouponOrderVerify.updateTenantInfo(couponOrderCVo); | |||
| posCouponOrderVerify.setCouponOrderId(couponOrderCVo.getId()); | |||
| posCouponOrderVerify.setPosOrderId(posOrderId); | |||
| posCouponOrderVerify.setState(EnumEnableType.Enable.getCode()); | |||
| @@ -1444,7 +1476,7 @@ public class PosServiceImpl implements PosService { | |||
| try { | |||
| WxCouponOrder couponOrder = new WxCouponOrder(); | |||
| couponOrder.setId(couponOrderCVo.getId()); | |||
| couponOrder.setTenantId(couponOrderCVo.getTenantId()); | |||
| couponOrder.updateTenantInfo(couponOrderCVo); | |||
| couponOrder.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_USE_WAIT.getCode()); | |||
| couponOrder.setUpdateDate(new Date()); | |||
| num = couponOrderMapper.cancelVerifyCouponOrder(couponOrder); | |||
| @@ -1481,7 +1513,14 @@ public class PosServiceImpl implements PosService { | |||
| } else { | |||
| retMap.put(WxPayConstant.TENANT_ID, tenantId); | |||
| } | |||
| PosMallConfig config = posMallConfigService.getByTenantId(tenantId); | |||
| WxMall mall = mallService.getByTenantId(tenantId); | |||
| if (mall == null) { | |||
| logger.error(ErrorCode.MALL_INFO_NOT_FOUND.getMessage()); | |||
| throw new MallinkException(ErrorCode.MALL_INFO_NOT_FOUND); | |||
| } | |||
| TenantEntity tenantEntity = mall.getTenantInfo(); | |||
| PosMallConfig config = posMallConfigService.getByTenantInfo(tenantEntity); | |||
| if (config == null) { | |||
| logger.error(ErrorCode.POS_CONFIG_NOT_FOUND.getMessage()); | |||
| throw new MallinkException(ErrorCode.POS_CONFIG_NOT_FOUND); | |||
| @@ -1558,7 +1597,7 @@ public class PosServiceImpl implements PosService { | |||
| throw new MallinkException(ErrorCode.CARD_IS_NOT_FOUND); | |||
| } | |||
| if (StringUtils.isNotBlank(memIdStr) || StringUtils.isNotBlank(memPhoneStr)) { | |||
| WxCUser cuUser = getMemUser(tenantId, memIdStr, memPhoneStr); | |||
| WxCUser cuUser = getMemUser(merchant, memIdStr, memPhoneStr); | |||
| if (cuUser == null) { | |||
| logger.error(ErrorCode.USER_NOT_MEMBER.getMessage()); | |||
| throw new MallinkException(ErrorCode.USER_NOT_MEMBER); | |||
| @@ -1578,7 +1617,7 @@ public class PosServiceImpl implements PosService { | |||
| WxCardSpend record = new WxCardSpend(); | |||
| record.setPayFrom(EnumCardSpendFrom.POS.getCode()); | |||
| record.setTenantId(merchant.getTenantId()); | |||
| record.updateTenantInfo(merchant); | |||
| record.setCardId(cardId); | |||
| record.setOwnerId(couponOrder.getOwnerId()); | |||
| record.setMerchantId(merchantId); | |||
| @@ -1626,7 +1665,15 @@ public class PosServiceImpl implements PosService { | |||
| } else { | |||
| retMap.put(WxPayConstant.TENANT_ID, tenantId); | |||
| } | |||
| PosMallConfig config = posMallConfigService.getByTenantId(tenantId); | |||
| WxMall mall = mallService.getByTenantId(tenantId); | |||
| if (mall == null) { | |||
| logger.error(ErrorCode.MALL_INFO_NOT_FOUND.getMessage()); | |||
| throw new MallinkException(ErrorCode.MALL_INFO_NOT_FOUND); | |||
| } | |||
| TenantEntity tenantEntity = mall.getTenantInfo(); | |||
| PosMallConfig config = posMallConfigService.getByTenantInfo(tenantEntity); | |||
| if (config == null) { | |||
| logger.error(ErrorCode.POS_CONFIG_NOT_FOUND.getMessage()); | |||
| throw new MallinkException(ErrorCode.POS_CONFIG_NOT_FOUND); | |||
| @@ -1795,7 +1842,15 @@ public class PosServiceImpl implements PosService { | |||
| if (StringUtils.isBlank(tenantId)) { | |||
| errParam(WxPayConstant.TENANT_ID); | |||
| } | |||
| PosMallConfig config = posMallConfigService.getByTenantId(tenantId); | |||
| WxMall mall = mallService.getByTenantId(tenantId); | |||
| if (mall == null) { | |||
| logger.error(ErrorCode.MALL_INFO_NOT_FOUND.getMessage()); | |||
| throw new MallinkException(ErrorCode.MALL_INFO_NOT_FOUND); | |||
| } | |||
| TenantEntity tenantEntity = mall.getTenantInfo(); | |||
| PosMallConfig config = posMallConfigService.getByTenantInfo(tenantEntity); | |||
| if (config == null) { | |||
| logger.error(ErrorCode.POS_CONFIG_NOT_FOUND.getMessage()); | |||
| throw new MallinkException(ErrorCode.POS_CONFIG_NOT_FOUND); | |||
| @@ -2012,7 +2067,7 @@ public class PosServiceImpl implements PosService { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| Long id = idWorker.nextId(); | |||
| setId(id); | |||
| setTenantId(merchantBUser.getTenantId()); | |||
| updateTenantInfo(merchantBUser); | |||
| setCUserId(memId); | |||
| setOrderId(order.getId()); | |||
| setCreateTime(curDate); | |||
| @@ -2058,7 +2113,7 @@ public class PosServiceImpl implements PosService { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| Long id = idWorker.nextId(); | |||
| setId(id); | |||
| setTenantId(merchantBUser.getTenantId()); | |||
| updateTenantInfo(merchantBUser); | |||
| setCUserId(memId); | |||
| setBUserId(merchantBUser.getId()); | |||
| setOrderId(order.getId()); | |||
| @@ -2143,7 +2198,7 @@ public class PosServiceImpl implements PosService { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| Long id = idWorker.nextId(); | |||
| setId(id); | |||
| setTenantId(buUser.getTenantId()); | |||
| updateTenantInfo(buUser); | |||
| setCUserId(memId); | |||
| setBUserId(buUser.getId()); | |||
| setOrderId(order.getId()); | |||
| @@ -2206,7 +2261,7 @@ public class PosServiceImpl implements PosService { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| Long id = idWorker.nextId(); | |||
| setId(id); | |||
| setTenantId(buUser.getTenantId()); | |||
| updateTenantInfo(buUser); | |||
| setCUserId(memId); | |||
| setOrderId(order.getId()); | |||
| setCreateTime(curDate); | |||
| @@ -2269,7 +2324,7 @@ public class PosServiceImpl implements PosService { | |||
| // 1. pay order | |||
| // 查找支付订单 | |||
| WxPayOrder payOrderQ = new WxPayOrder() {{ | |||
| setTenantId(refundOrder.getTenantId()); | |||
| updateTenantInfo(refundOrder); | |||
| setCUserId(refundOrder.getCUserId()); | |||
| setOrderId(refundOrder.getId()); | |||
| setPayOrderStatus(EnumPayStatus.PAY_STATUS_SUCCESS.getCode()); | |||
| @@ -2292,7 +2347,7 @@ public class PosServiceImpl implements PosService { | |||
| Long id = idWorker.nextId(); | |||
| setId(id); | |||
| setRefundId(String.valueOf(id)); | |||
| setTenantId(buUser.getTenantId()); | |||
| updateTenantInfo(buUser); | |||
| setCUserId(memId); | |||
| setOrderId(refundOrder.getId()); | |||
| setCreateTime(curDate); | |||
| @@ -2360,7 +2415,7 @@ public class PosServiceImpl implements PosService { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| Long orderId = idWorker.nextId(); | |||
| setId(orderId); | |||
| setTenantId(merchantBUser.getTenantId()); | |||
| updateTenantInfo(merchantBUser); | |||
| setOrderNumber(orderId); | |||
| setType(EnumOrderType.POSPAY.getCode()); | |||
| setProductId(merchantBUser.getId()); | |||
| @@ -2439,7 +2494,7 @@ public class PosServiceImpl implements PosService { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| Long orderId = idWorker.nextId(); | |||
| setId(orderId); | |||
| setTenantId(buUser.getTenantId()); | |||
| updateTenantInfo(buUser); | |||
| setType(EnumOrderType.POSPAY.getCode()); | |||
| setProductId(buUser.getId()); | |||
| setCUserId(memId); | |||
| @@ -58,7 +58,7 @@ public class PosAppTest { | |||
| private static final String phone = "13120223636"; | |||
| private static final String password = "drpos345"; | |||
| private static final String posSN = "1"; | |||
| private static final String posSN = "WDPS0110GW175210001"; | |||
| /* | |||
| 可用的交易券, 支付可用(1, 2, 6), 核销可用(4, 6, 8, 9) | |||
| @@ -55,6 +55,7 @@ public class BillNotificationSchedule { | |||
| List<Map<String, Object>> oweBillList = wxBillAllMapper.getOweBill(); | |||
| for (Map<String, Object> bill : oweBillList) { | |||
| String tenantId = bill.get("tenantId").toString(); | |||
| String subTenantId = bill.get("subTenantId").toString(); | |||
| logger.info("欠缴账单:" + JSONObject.toJSONString(bill)); | |||
| BigDecimal owe = (BigDecimal) bill.get("owe"); | |||
| BigDecimal price = owe.divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); | |||
| @@ -69,6 +70,7 @@ public class BillNotificationSchedule { | |||
| wxMsgRecord.setReceiver(phone); | |||
| wxMsgRecord.updateTenantInfo(new TenantEntity(){{ | |||
| setTenantId(tenantId); | |||
| setSubTenantId(subTenantId); | |||
| }}); | |||
| Map<String, String> map = new HashedMap(); | |||
| map.put("price", price.toString()); | |||
| @@ -84,6 +86,7 @@ public class BillNotificationSchedule { | |||
| List<Map<String, Object>> waitBillList = wxBillAllMapper.getWaitPayBill(); | |||
| for (Map<String, Object> bill : waitBillList) { | |||
| String tenantId = bill.get("tenantId").toString(); | |||
| String subTenantId = bill.get("subTenantId").toString(); | |||
| logger.info("待缴账单账单:" + JSONObject.toJSONString(bill)); | |||
| String receiveDate = bill.get("receiveDate").toString(); | |||
| @@ -100,6 +103,7 @@ public class BillNotificationSchedule { | |||
| wxMsgRecord.setReceiver(phone); | |||
| wxMsgRecord.updateTenantInfo(new TenantEntity(){{ | |||
| setTenantId(tenantId); | |||
| setSubTenantId(subTenantId); | |||
| }}); | |||
| Map<String, String> map = new HashedMap(); | |||
| map.put("price", price.toString()); | |||
| @@ -12,6 +12,7 @@ import com.iformall.enums.EnumCarCmd; | |||
| import com.iformall.enums.EnumChartType; | |||
| import com.iformall.mapper.*; | |||
| import com.iformall.utils.DateUtils; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| @@ -80,6 +81,9 @@ public class ChartDataSchedule { | |||
| for (WxMall wxMall : wxMalls) { | |||
| TenantEntity tenantEntity = wxMall.getTenantInfo(); | |||
| params.put("tenantId", tenantEntity.getTenantId()); | |||
| if (StringUtils.isNotBlank(tenantEntity.getSubTenantId())) { | |||
| params.put("subTenantId", wxMall.getTenantId()); | |||
| } | |||
| wxChartDataEntity.updateTenantInfo(tenantEntity); | |||
| wxChartDataEntity.setType(EnumChartType.CAR_OUT.getCode()); | |||
| int count = wxChartDataMapper.selectCount(new QueryWrapper(wxChartDataEntity)); | |||
| @@ -139,6 +143,9 @@ public class ChartDataSchedule { | |||
| for (WxMall wxMall : wxMalls) { | |||
| TenantEntity tenantEntity = wxMall.getTenantInfo(); | |||
| params.put("tenantId", tenantEntity.getTenantId()); | |||
| if (StringUtils.isNotBlank(tenantEntity.getSubTenantId())) { | |||
| params.put("subTenantId", tenantEntity.getSubTenantId()); | |||
| } | |||
| wxChartDataEntity.updateTenantInfo(tenantEntity); | |||
| wxChartDataEntity.setType(EnumChartType.SALE_COUPON_PRICE.getCode()); | |||
| int count = wxChartDataMapper.selectCount(new QueryWrapper(wxChartDataEntity)); | |||
| @@ -170,6 +177,9 @@ public class ChartDataSchedule { | |||
| for (WxMall wxMall : wxMalls) { | |||
| TenantEntity tenantEntity = wxMall.getTenantInfo(); | |||
| params.put("tenantId", tenantEntity.getTenantId()); | |||
| if (StringUtils.isNotBlank(tenantEntity.getSubTenantId())) { | |||
| params.put("subTenantId", tenantEntity.getSubTenantId()); | |||
| } | |||
| wxChartDataEntity.updateTenantInfo(tenantEntity); | |||
| wxChartDataEntity.setType(EnumChartType.MERCHANT_TRADE.getCode()); | |||
| @@ -12,6 +12,7 @@ import com.iformall.mq.MqBaseProducer; | |||
| import com.iformall.service.*; | |||
| import com.iformall.utils.CreditUtil; | |||
| import org.apache.commons.collections.CollectionUtils; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| @@ -96,12 +97,12 @@ public class CouponSendSchedule { | |||
| //查找所有couponSendConfig | |||
| Map<String, Integer> mallConfigMap = getAllCouponSendConfig(EnumCouponSendSendType.TIMED.getCode()); | |||
| mallList.stream().forEach(mall -> { | |||
| TenantEntity tenantEntity = mall.getTenantInfo(); | |||
| //判断启用状态,状态为关闭时跳过不执行 | |||
| if (isCouponSendDisable(mallConfigMap, mall)) { | |||
| logger.info("定时发券: {}发券状态关闭, 任务跳过不执行", mall.getName()); | |||
| return; | |||
| } | |||
| TenantEntity tenantEntity = mall.getTenantInfo(); | |||
| WxLevelConfig wxLevelConfig = new WxLevelConfig(); | |||
| wxLevelConfig.updateTenantInfo(tenantEntity); | |||
| List<WxLevelConfig> levelConfigList = WxLevelConfigMapper.findList(wxLevelConfig); | |||
| @@ -160,6 +161,9 @@ public class CouponSendSchedule { | |||
| int sentCount = couponSendList.stream().map(cs -> { | |||
| Map params = new HashMap<String, Object>(); | |||
| params.put("tenantId", cs.getTenantId()); | |||
| if (StringUtils.isNotBlank(cs.getSubTenantId())) { | |||
| params.put("subTenantId", cs.getSubTenantId()); | |||
| } | |||
| params.put("cUserId", cu.getId()); | |||
| params.put("couponId", cs.getCouponId()); | |||
| params.put("startTime", startTime); | |||
| @@ -293,6 +293,7 @@ public enum ErrorCode{ | |||
| REFUND_ORDER_BUSER_IS_NULL(12015, "B端用户不存在"), | |||
| REFUND_ORDER_BUSER_NOT_EQUAL(12016, "B端用户无操作权限"), | |||
| APP_ID_NOT_ENABLE(12019, "APP未启用"), | |||
| APP_ID_NOT_FOUND(12020, "APPID没找到"), | |||
| MCH_INFO_NOT_FOUND(12021, "微信商户平台信息没找到"), | |||
| MCH_INFO_NOT_EQUAL(12022, "微信商户平台信息不对应"), | |||
| @@ -133,6 +133,20 @@ public class MallUserInfo extends TenantEntity { | |||
| } | |||
| return false; | |||
| } | |||
| /** | |||
| * 是否集团管理员 | |||
| * @return | |||
| */ | |||
| public boolean checkGroupAdmin() { | |||
| if(StringUtils.isBlank(getTenantId())) { | |||
| return false; | |||
| } | |||
| if(StringUtils.isBlank(getSubTenantId()) && | |||
| isAdmin.equals(EnumUserAdmin.ADMIN.getCode())) { | |||
| return true; | |||
| } | |||
| return false; | |||
| } | |||
| } | |||
| @@ -40,5 +40,9 @@ public class WxAppinfo extends BaseTenantEntity { | |||
| private Integer type; | |||
| @io.swagger.annotations.ApiModelProperty(value="支付ID,参看wx_pay_account_bill",name="payBillId") | |||
| private Long payBillId; | |||
| @io.swagger.annotations.ApiModelProperty(value="集团支持(0:不支持,1支持)",name="groupSupport") | |||
| private Integer groupSupport; | |||
| @io.swagger.annotations.ApiModelProperty(value="是否启用(0:启用,1禁用)",name="enable") | |||
| private Integer enable; | |||
| } | |||
| @@ -69,5 +69,9 @@ public class WxAuthorizerInfo extends BaseTenantEntity { | |||
| private String accessToken; | |||
| @io.swagger.annotations.ApiModelProperty(value="accessToken过期时间",name="accessTokenExpire") | |||
| private Date accessTokenExpire; | |||
| @io.swagger.annotations.ApiModelProperty(value="集团支持(0:不支持,1支持)",name="groupSupport") | |||
| private Integer groupSupport; | |||
| @io.swagger.annotations.ApiModelProperty(value="是否启用(0:启用,1禁用)",name="enable") | |||
| private Integer enable; | |||
| } | |||
| @@ -1,5 +1,6 @@ | |||
| package com.iformall.domain.po; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import lombok.Data; | |||
| @@ -24,5 +25,25 @@ public class WxCarCmdLog extends TenantEntity { | |||
| private Date updateDate; | |||
| @io.swagger.annotations.ApiModelProperty(value="命令请求或者结果及相应花费的时间",name="cmdJson") | |||
| private String cmdJson; | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value="synId",name="synId") | |||
| private String synId; | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value="车牌",name="plateNumber") | |||
| private String plateNumber; | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value="停车费",name="fee") | |||
| private String fee; | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value="orderId",name="orderId") | |||
| private String orderId; | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value="feeTime",name="feeTime") | |||
| private String feeTime; | |||
| } | |||
| @@ -24,6 +24,9 @@ public class WxChartDataEntity extends TenantEntity { | |||
| sb.append("WxChartDataEntity{") | |||
| .append("id=").append(id) | |||
| .append(", tenantId='").append(getTenantId()).append('\''); | |||
| if (getSubTenantId() != null) { | |||
| sb.append(", subTenantId='").append(getSubTenantId()).append('\''); | |||
| } | |||
| sb.append(", type=").append(type) | |||
| .append(", result='").append(result).append('\'') | |||
| .append(", querytime=").append(querytime) | |||
| @@ -1,5 +1,6 @@ | |||
| package com.iformall.domain.po; | |||
| import com.alibaba.fastjson.annotation.JSONField; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.fasterxml.jackson.annotation.JsonProperty; | |||
| @@ -7,6 +8,7 @@ import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import java.math.BigDecimal; | |||
| import java.util.Date; | |||
| @@ -21,6 +23,8 @@ public class WxMall extends BaseEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| @io.swagger.annotations.ApiModelProperty(value="父租户ID",name="parentTenantId") | |||
| private String parentTenantId; | |||
| @io.swagger.annotations.ApiModelProperty(value="商场名",name="name") | |||
| private String name; | |||
| @TableField(value = "`group`") | |||
| @@ -73,12 +77,22 @@ public class WxMall extends BaseEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value = "启用结束时间", name = "validEnd") | |||
| private Date validEnd; | |||
| @io.swagger.annotations.ApiModelProperty(value="集团支持(0:不支持,1支持)",name="groupSupport") | |||
| private Integer groupSupport; | |||
| @io.swagger.annotations.ApiModelProperty(value="经度",name="longitude") | |||
| private BigDecimal longitude; | |||
| @io.swagger.annotations.ApiModelProperty(value="纬度",name="latitude") | |||
| private BigDecimal latitude; | |||
| @TableField(exist = false) | |||
| protected List<WxMallBuilding> buildings; | |||
| @TableField(exist = false) | |||
| private boolean valid; | |||
| @TableField(exist = false) | |||
| protected List<WxMall> subMalls; | |||
| public boolean isValid() { | |||
| if(saleType != null) { | |||
| if(validStart != null && validEnd != null) { | |||
| @@ -109,13 +123,25 @@ public class WxMall extends BaseEntity { | |||
| private String tenantInfo; | |||
| public TenantEntity getTenantInfo() { | |||
| TenantEntity mul = new TenantEntity(); | |||
| mul.setTenantId(getTenantId()); | |||
| return mul; | |||
| if (StringUtils.isBlank(getParentTenantId())) { | |||
| TenantEntity single = new TenantEntity(); | |||
| single.setTenantId(getTenantId()); | |||
| return single; | |||
| } else { | |||
| TenantEntity mul = new TenantEntity(); | |||
| mul.setTenantId(getParentTenantId()); | |||
| mul.setSubTenantId(getTenantId()); | |||
| return mul; | |||
| } | |||
| } | |||
| public void setTenantInfo(TenantEntity tenantInfo) { | |||
| setTenantId(tenantInfo.getTenantId()); | |||
| if (StringUtils.isBlank(tenantInfo.getSubTenantId())) { | |||
| setTenantId(tenantInfo.getTenantId()); | |||
| } else { | |||
| setTenantId(tenantInfo.getSubTenantId()); | |||
| setParentTenantId(tenantInfo.getTenantId()); | |||
| } | |||
| } | |||
| } | |||
| @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.fasterxml.jackson.annotation.JsonProperty; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| /** | |||
| * @author Stormeye | |||
| @@ -15,16 +16,26 @@ public class BaseTenantEntity extends BaseEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value="子租户ID",name="subTenantId") | |||
| private String subTenantId; | |||
| @TableField(exist = false) | |||
| @JsonProperty(access = JsonProperty.Access.READ_ONLY) | |||
| private TenantEntity tenantInfo; | |||
| public void updateTenantInfo(TenantEntity info) { | |||
| setTenantId(info.getTenantId()); | |||
| if (StringUtils.isNotBlank(info.getSubTenantId())) { | |||
| setSubTenantId(info.getSubTenantId()); | |||
| } | |||
| } | |||
| public void updateTenantInfo(BaseTenantEntity info) { | |||
| setTenantId(info.getTenantId()); | |||
| if (StringUtils.isNotBlank(info.getSubTenantId())) { | |||
| setSubTenantId(info.getSubTenantId()); | |||
| } | |||
| } | |||
| public TenantEntity getTenantInfo() { | |||
| @@ -2,6 +2,7 @@ package com.iformall.domain.po.base; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| /** | |||
| * @author Stormeye | |||
| @@ -13,11 +14,20 @@ public class TenantEntity extends BaseEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| @io.swagger.annotations.ApiModelProperty(value="子租户ID",name="subTenantId") | |||
| private String subTenantId; | |||
| public void updateTenantInfo(TenantEntity info) { | |||
| setTenantId(info.getTenantId()); | |||
| if (StringUtils.isNotBlank(info.getSubTenantId())) { | |||
| setSubTenantId(info.getSubTenantId()); | |||
| } | |||
| } | |||
| public void updateTenantInfo(BaseTenantEntity info) { | |||
| setTenantId(info.getTenantId()); | |||
| if (StringUtils.isNotBlank(info.getSubTenantId())) { | |||
| setSubTenantId(info.getSubTenantId()); | |||
| } | |||
| } | |||
| } | |||
| @@ -33,6 +33,13 @@ public class InvestBaseEntity extends TenantEntity { | |||
| @JsonProperty(access = JsonProperty.Access.READ_ONLY) | |||
| private String tenantId; | |||
| /** | |||
| * 子租户ID | |||
| */ | |||
| @io.swagger.annotations.ApiModelProperty(value = "子租户ID", name = "subTenantId") | |||
| @JsonProperty(access = JsonProperty.Access.READ_ONLY) | |||
| private String subTenantId; | |||
| /** | |||
| * 创建时间 | |||
| */ | |||
| @@ -27,6 +27,10 @@ public class BaseMsg extends BaseEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="租户id",name="tenantId") | |||
| private String tenantId; | |||
| @TableField(exist = false) | |||
| @io.swagger.annotations.ApiModelProperty(value="子租户id",name="subTenantId") | |||
| private String subTenantId; | |||
| @io.swagger.annotations.ApiModelProperty(value="唯一标识",name="uuid") | |||
| @TableField(exist = false) | |||
| private String uuid; | |||
| @@ -53,15 +57,18 @@ public class BaseMsg extends BaseEntity { | |||
| public void updateTenantInfo(TenantEntity tenantEntity) { | |||
| setTenantId(tenantEntity.getTenantId()); | |||
| setSubTenantId(tenantEntity.getSubTenantId()); | |||
| } | |||
| public void updateTenantInfo(BaseTenantEntity tenantEntity) { | |||
| setTenantId(tenantEntity.getTenantId()); | |||
| setSubTenantId(tenantEntity.getSubTenantId()); | |||
| } | |||
| public TenantEntity getTenantInfo() { | |||
| return new TenantEntity() {{ | |||
| setTenantId(tenantId); | |||
| setSubTenantId(subTenantId); | |||
| }}; | |||
| } | |||
| @@ -12,6 +12,8 @@ public class FmInsideCLoginMsg extends BaseMsg{ | |||
| @io.swagger.annotations.ApiModelProperty(value = "租户ID", name = "tenantId") | |||
| private String tenantId; | |||
| @io.swagger.annotations.ApiModelProperty(value="子租户id",name="subTenantId") | |||
| private String subTenantId; | |||
| @io.swagger.annotations.ApiModelProperty(value = "用户ID", name = "cUserId") | |||
| private Long cUserId; | |||
| @@ -12,6 +12,8 @@ public class FmInsideCouponVerifyMsg extends BaseMsg{ | |||
| @io.swagger.annotations.ApiModelProperty(value = "租户ID", name = "tenantId") | |||
| private String tenantId; | |||
| @io.swagger.annotations.ApiModelProperty(value="子租户id",name="subTenantId") | |||
| private String subTenantId; | |||
| @io.swagger.annotations.ApiModelProperty(value = "券包ID", name = "couponOrderId") | |||
| private Long couponOrderId; | |||
| @io.swagger.annotations.ApiModelProperty(value = "B端用户ID", name = "bUserId") | |||
| @@ -11,6 +11,8 @@ public class FmInsideOrderSuccessMsg extends BaseMsg{ | |||
| @io.swagger.annotations.ApiModelProperty(value = "租户ID", name = "tenantId") | |||
| private String tenantId; | |||
| @io.swagger.annotations.ApiModelProperty(value="子租户id",name="subTenantId") | |||
| private String subTenantId; | |||
| @io.swagger.annotations.ApiModelProperty(value = "成功订单ID", name = "orderId") | |||
| private Long orderId; | |||
| @io.swagger.annotations.ApiModelProperty(value = "券ID", name = "couponId") | |||
| @@ -22,6 +22,8 @@ public class WxMsg extends BaseMsg { | |||
| @io.swagger.annotations.ApiModelProperty(value = "租户ID", name = "tenantId") | |||
| private String tenantId; | |||
| @io.swagger.annotations.ApiModelProperty(value="子租户ID",name="subTenantId") | |||
| private String subTenantId; | |||
| @io.swagger.annotations.ApiModelProperty(value = "模板id", name = "modelId") | |||
| private Long modelId; | |||
| @io.swagger.annotations.ApiModelProperty(value = "内容", name = "msg") | |||
| @@ -0,0 +1,26 @@ | |||
| package com.iformall.domain.vo; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import io.swagger.annotations.ApiModelProperty; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| @Data | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxMerchantBuInfoVo extends TenantEntity { | |||
| @ApiModelProperty(value="广场名",name="tenantName") | |||
| private String tenantName; | |||
| @ApiModelProperty(value="商户ID",name="merchantId") | |||
| private Long merchantId; | |||
| @ApiModelProperty(value="商户名",name="merchantName") | |||
| private String merchantName; | |||
| @ApiModelProperty(value="商户图片",name="imgUrl") | |||
| private String imgUrl; | |||
| @ApiModelProperty(value="b端用户ID",name="buUserId") | |||
| private Long buUserId; | |||
| } | |||
| @@ -0,0 +1,36 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| * Created by Stormeye on 2019/09/21 | |||
| */ | |||
| public enum EnumGroupSupport { | |||
| NOT_SUPPORT(0, "不支持"), | |||
| SUPPORT(1, "支持"), | |||
| ; | |||
| public static EnumGroupSupport getEnum(Integer code) { | |||
| for (EnumGroupSupport value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumGroupSupport(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -28,6 +28,6 @@ public interface KwMerchantMeterMapper extends CommonMapper<KwMerchantMeter, Lon | |||
| int unbindBatch(@Param("merchantId")Long merchantId); | |||
| int unbind(@Param("meterId")Long meterId); | |||
| List<MerchantMeterVo> getMerchantMeter(@Param("tenantId") String tenantId); | |||
| List<MerchantMeterVo> getMerchantMeter(@Param("tenantId") String tenantId, @Param("subTenantId") String subTenantId); | |||
| } | |||
| @@ -8,9 +8,10 @@ public interface PosMallConfigMapper extends CommonMapper<PosMallConfig, Long> { | |||
| List<PosMallConfig> findList(PosMallConfig posMallConfig); | |||
| @Deprecated | |||
| PosMallConfig getByTenantId(String tenantId); | |||
| PosMallConfig getByTenantInfo(String tenantId); | |||
| PosMallConfig getByTenantInfo(String tenantId, String subTenantId); | |||
| @@ -11,8 +11,8 @@ public interface WxBusinessMapper extends CommonMapper<WxBusiness, String> { | |||
| List<WxBusiness> findList(WxBusiness wxBusiness); | |||
| List<WxBusiness> findListAll(); | |||
| List<WxBusiness> findListForMerchant(@Param("tenantId") String tenantId); | |||
| List<WxBusiness> findListForCoupon(@Param("tenantId") String tenantId); | |||
| List<WxBusiness> findListForMerchant(@Param("tenantId") String tenantId, @Param("subTenantId") String subTenantId); | |||
| List<WxBusiness> findListForCoupon(@Param("tenantId") String tenantId, @Param("subTenantId") String subTenantId); | |||
| List<Map<String,Object>> businessDataList(WxBusiness wxBusiness); | |||
| @@ -2,7 +2,6 @@ package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxCampaign; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import java.util.List; | |||
| @@ -15,7 +14,7 @@ public interface WxCampaignMapper extends CommonMapper<WxCampaign, Long> { | |||
| List<WxCampaign> findCList(WxCampaign wxCampaign); | |||
| int getMaxSortNum(String tenantId); | |||
| int getMaxSortNum(String tenantId, String subTenantId); | |||
| List<WxCampaign> queryNotify(WxCampaign wxCampaign); | |||
| @@ -24,11 +24,11 @@ public interface WxCarCmdLogMapper extends CommonMapper<WxCarCmdLog, Long> { | |||
| List<Map<String,Object>> queryPlateNumberList(Map<String,Object> carParams); | |||
| List<String> queryTenantIdBySynId(HashMap<String,String> params); | |||
| List<WxCarCmdLog> queryTenantInfoBySynId(WxCarCmdLog wxCarCmdLog); | |||
| Long queryWeekCarPayCount(HashMap<String,Object> params); | |||
| WxCarCmdLog queryByOrderId(HashMap<String,String> params); | |||
| WxCarCmdLog queryByOrderId(WxCarCmdLog carCmdLog); | |||
| WxCarCmdLog queryBySynId(HashMap<String,Object> params); | |||
| } | |||
| @@ -33,10 +33,10 @@ public interface WxCouponActionLogMapper extends CommonMapper<WxCouponActionLog, | |||
| * @param endTime | |||
| * @return | |||
| */ | |||
| int getCountByDateLimit(@Param("tenantId")String tenantId,@Param("startTime") Date startTime,@Param("endTime")Date endTime); | |||
| int getCountByDateLimit(@Param("tenantId")String tenantId,@Param("subTenantId")String subTenantId,@Param("startTime") Date startTime,@Param("endTime")Date endTime); | |||
| int getCountByChannelId(@Param("tenantId")String tenantId,@Param("channelType") int channelType,@Param("channelId")Long channelId); | |||
| int getCountByChannelId(@Param("tenantId")String tenantId,@Param("subTenantId")String subTenantId,@Param("channelType") int channelType,@Param("channelId")Long channelId); | |||
| /** | |||
| * 每人每天最多可接收多少张券 | |||
| @@ -60,7 +60,7 @@ public interface WxCouponOrderMapper extends CommonMapper<WxCouponOrder, Long> { | |||
| * @param endTime | |||
| * @return | |||
| */ | |||
| List<CUserDateAmountVo> queryPriceTotalGroup(@Param("tenantId")String tenantId, @Param("startTime") Date startTime, @Param("endTime")Date endTime); | |||
| List<CUserDateAmountVo> queryPriceTotalGroup(@Param("tenantId")String tenantId, @Param("subTenantId")String subTenantId, @Param("startTime") Date startTime, @Param("endTime")Date endTime); | |||
| List<MarkingSceneDataVo> queryForSceneRepotyHistoryVerified(HashMap<String,Object> params); | |||
| @@ -11,6 +11,10 @@ public interface WxMallMapper extends CommonMapper<WxMall, Long> { | |||
| WxMall getByTenantId(String tenantId); | |||
| WxMall getByTenantInfo(WxMall wxMall); | |||
| String queryMenusByTenantId(String tenantId); | |||
| String queryMenusByTenantInfo(WxMall wxMall); | |||
| } | |||
| @@ -3,11 +3,13 @@ package com.iformall.mapper; | |||
| import java.util.*; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxMerchantBUser; | |||
| import com.iformall.domain.vo.WxMerchantBuInfoVo; | |||
| public interface WxMerchantBUserMapper extends CommonMapper<WxMerchantBUser, Long> { | |||
| List<WxMerchantBUser> findList(WxMerchantBUser wxMerchantBUser); | |||
| List<WxMerchantBuInfoVo> findSelMerchantList(WxMerchantBUser wxMerchantBUser); | |||
| WxMerchantBUser findByToken(String token); | |||
| @@ -192,5 +192,5 @@ public interface MallUserInfoService { | |||
| * @param record | |||
| * @return | |||
| */ | |||
| Set<String> getUserPermissions(MallUserInfo record); | |||
| Set<String> getUserPermissions(MallUserInfo record, boolean boolNav); | |||
| } | |||
| @@ -45,12 +45,12 @@ public interface WxCarCmdLogService { | |||
| /** | |||
| * 根据synId获取tenantId | |||
| * @param params | |||
| * @param carCmdLog | |||
| * @return | |||
| */ | |||
| String getTenantIdBySynId(HashMap<String, String> params); | |||
| WxCarCmdLog getTenantInfoBySynId(WxCarCmdLog carCmdLog); | |||
| WxCarCmdLog getByOrderId(HashMap<String, String> params); | |||
| WxCarCmdLog getByOrderId(WxCarCmdLog carCmdLog); | |||
| WxCarCmdLog getBySynId(HashMap<String, Object> params); | |||