| @@ -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,8 +66,10 @@ 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; | |||
| @@ -79,7 +80,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); | |||
| @@ -274,7 +275,7 @@ public class WxCUserBasicInfoController extends BaseController { | |||
| corder.updateTenantInfo(getTenantInfo()); | |||
| corder.setSortColumns(BaseEntity.SortField.CreateDate_DESC); | |||
| PageInfo<WxCouponOrder> page = wxCouponOrderService.listAsPage(corder, 1, Integer.MAX_VALUE); | |||
| if (page.getSize() > 0) { | |||
| //if (page.getSize() > 0) { | |||
| List<WxCouponOrder> list = page.getList(); | |||
| for (WxCouponOrder c : list) { | |||
| WxCoupon coupon = wxCouponService.getById(c.getCouponId()); | |||
| @@ -295,9 +296,7 @@ public class WxCUserBasicInfoController extends BaseController { | |||
| datalist.add(userTradeRecordVo); | |||
| } | |||
| excelService.exportExcel(datalist, null, "会员交易记录", UserTradeRecordVo.class, "会员交易记录.xlsx", response, false); | |||
| } | |||
| //} | |||
| } | |||
| @ApiOperation("会员记录导出总数") | |||
| @@ -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); | |||
| } | |||
| @@ -5,10 +5,12 @@ import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.po.WxScoreRules; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.enums.EnumCreditLockedStatus; | |||
| import com.iformall.service.WxScoreRulesService; | |||
| 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; | |||
| @@ -40,7 +42,11 @@ public class WxScoreRulesController extends BaseController { | |||
| @SystemControllerLog(description = "成长值-积分-配置-新增") | |||
| public ResultData add(@RequestBody WxScoreRules wxScoreRules) { | |||
| logger.debug("[" + getIpAddr() + "] WxScoreRulesController::add"); | |||
| wxScoreRules.updateTenantInfo(getTenantInfo()); | |||
| TenantEntity tenantEntity = getTenantInfo(); | |||
| if (StringUtils.isNotBlank(tenantEntity.getSubTenantId())) { | |||
| return new ResultData(ErrorCode.USER_NO_PERMISSION.getCode(), "广场用户无此权限"); | |||
| } | |||
| wxScoreRules.updateTenantInfo(tenantEntity); | |||
| wxScoreRulesService.saveOrUpdate(wxScoreRules); | |||
| return new ResultData(); | |||
| } | |||
| @@ -57,7 +63,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不能为空"); | |||
| @@ -65,7 +71,11 @@ public class WxScoreRulesController extends BaseController { | |||
| if (null == wxScoreRules.getCreditLocked()) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "creditLocked不能为空"); | |||
| } | |||
| wxScoreRules.updateTenantInfo(getTenantInfo()); | |||
| TenantEntity tenantEntity = getTenantInfo(); | |||
| if (StringUtils.isNotBlank(tenantEntity.getSubTenantId())) { | |||
| return new ResultData(ErrorCode.USER_NO_PERMISSION.getCode(), "广场用户无此权限"); | |||
| } | |||
| wxScoreRules.updateTenantInfo(tenantEntity); | |||
| try { | |||
| wxScoreRulesService.updateCreditLocked(wxScoreRules); | |||
| } catch (Exception e) { | |||
| @@ -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()); | |||
| } | |||
| @@ -110,6 +110,7 @@ public class WxMsgRecordController extends BaseController { | |||
| msg.setMsgType(wxMsgRecord.getMsgType()); | |||
| msg.setReceiver(wxMsgRecord.getReceiver()); | |||
| msg.setTenantId(wxMsgRecord.getTenantId()); | |||
| msg.updateTenantInfo(tenantEntity); | |||
| mqBaseProducer.sendMessage(msg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); | |||
| } | |||
| } | |||
| @@ -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) { | |||
| @@ -263,6 +295,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); | |||
| @@ -270,7 +308,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; | |||
| @@ -372,6 +409,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); | |||
| @@ -379,7 +422,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,13 +8,16 @@ 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.EnumMallUserStatus; | |||
| 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; | |||
| @@ -70,6 +73,9 @@ public class WechatLoginController extends BaseController { | |||
| @Autowired | |||
| private MallUserActionService mallUserActionService; | |||
| @Autowired | |||
| private WxMallService mallService; | |||
| @Autowired | |||
| @Qualifier("openRedisTemplate") | |||
| RedisTemplate<String, String> openRedisTemplate; | |||
| @@ -158,6 +164,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); | |||
| @@ -299,6 +334,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); | |||
| @@ -395,6 +460,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,78 @@ 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_cuser_floating_layer".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_data_rule_target".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_floating_layer".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"); | |||
| } | |||
| @@ -32,7 +32,7 @@ spring: | |||
| password: ENC(xPFDlgd6v8zUhJMbcKc0KmmQiqs9qHtk) | |||
| timeout: 3600 | |||
| expire: 1800 #30分钟 | |||
| database: 1 | |||
| database: 5 | |||
| defaultExpiration: 2592000 # 默认生命周期30天 | |||
| jedis: | |||
| pool: | |||
| @@ -117,7 +117,7 @@ jasypt: | |||
| password: oRqdnDbK5pj3eMmB | |||
| fm: | |||
| exception: false | |||
| exception: true | |||
| exception_emails: houtaikaifa@iformall.com | |||
| deploy: 1 | |||
| open: true | |||
| @@ -109,6 +109,5 @@ ueditor: | |||
| logging: | |||
| level: | |||
| tk.mybatis: debug | |||
| com.iformall.mapper: debug | |||
| path: ./logs/admin | |||
| @@ -109,6 +109,5 @@ ueditor: | |||
| logging: | |||
| level: | |||
| tk.mybatis: debug | |||
| com.iformall: debug | |||
| path: ./logs/admin | |||
| @@ -0,0 +1,516 @@ | |||
| -- wx_msg_model | |||
| update wx_msg_model set tenant_id = '4562' where tenant_id = '456111'; | |||
| ALTER TABLE `invest_customer` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `invest_demand` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `invest_follow_record` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `invest_message` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `invest_operate_record` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `invest_remind` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `invest_task` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `kw_box` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `kw_box_cmd_history` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) DEFAULT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `kw_merchant_meter` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) DEFAULT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `kw_meter` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) DEFAULT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `kw_meter_data` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) DEFAULT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `mall_resource` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) DEFAULT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `mall_role` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `mall_role_permission` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `mall_user_action` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `mall_user_info` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `pos_coupon_order_verify` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `pos_mall_config` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `pos_order` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `pos_pay_order` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `push_limit` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `schedule_job` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `schedule_job_log` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_activity` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_activity_join` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_admin_log` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_appinfo` | |||
| ADD COLUMN `group_support` smallint(2) DEFAULT 0 COMMENT '集团支持(0:不支持,1支持)', | |||
| ADD COLUMN `enable` smallint(2) DEFAULT 0 COMMENT '是否启用(0:启用,1禁用)', | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_authorizer_info` | |||
| ADD COLUMN `group_support` smallint(2) DEFAULT 0 COMMENT '集团支持(0:不支持,1支持)', | |||
| ADD COLUMN `enable` smallint(2) DEFAULT 0 COMMENT '是否启用(0:启用,1禁用)', | |||
| MODIFY COLUMN `tenant_id` varchar(5) DEFAULT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_bill_action` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_bill_daily` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_bill_other` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_bill_other_deposit` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_bill_property` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_bill_property_deposit` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_bill_rent` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_bill_rent_deposit` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_bill_settle` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_bill_settle_bill` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_bill_settle_record` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_brand` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_buser` | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_c_user` | |||
| ADD COLUMN `sub_tenant_id` bigint(20) NULL DEFAULT NULL COMMENT '上次访问的子租户ID' AFTER `tenant_id`, | |||
| CHANGE COLUMN `latitude` `latitude` decimal(10,6) DEFAULT NULL COMMENT '维度', | |||
| CHANGE COLUMN `longitude` `longitude` decimal(10,6) DEFAULT NULL COMMENT '经度', | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_c_user_basic_info` | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_c_user_car` | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_c_user_from_b` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_c_user_tags` | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_campaign` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_car_cmd_log` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_car_pay_record` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) COMMENT '租户ID'; | |||
| ALTER TABLE `wx_card_info` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_card_spend` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_card_transfer_info` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_chart_data` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_coupon` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_coupon_action_log` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_coupon_car` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_coupon_channel` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_coupon_inject` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_coupon_merchant` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_coupon_order` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_coupon_password` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_coupon_present` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_coupon_send` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_coupon_send_config` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_credit_history` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_date_amount_record` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_device` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_flow_config` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_flow_model` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_flow_record` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_game` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_game_action_log` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_level_config` | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_level_merchant` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_mall` | |||
| ADD COLUMN `parent_tenant_id` varchar(5) DEFAULT NULL COMMENT '父租户ID' AFTER `tenant_id`, | |||
| ADD COLUMN `group_support` smallint(2) DEFAULT 0 COMMENT '集团支持(0:不支持,1支持)', | |||
| ADD COLUMN `latitude` decimal(10,6) DEFAULT NULL COMMENT '维度' AFTER `img`, | |||
| ADD COLUMN `longitude` decimal(10,6) DEFAULT NULL COMMENT '经度' AFTER `latitude`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_mall_building` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_mall_floor` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_merchant` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_merchant_b_user` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_merchant_corp` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_merchant_power_bill_config` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_merchant_shop` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_merchant_subsidy` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; | |||
| ALTER TABLE `wx_merchant_subsidy` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| CHANGE COLUMN `tenant_id` `tenant_id` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_merchant_tax` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_merchant_trade_daily` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_msg` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_msg_callback` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_msg_config` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_msg_limit` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_msg_model` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_msg_record` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) DEFAULT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_msg_signature` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_msg_validationcode` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) DEFAULT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_msg_validationcode_model` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) DEFAULT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_order` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_order_group` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_order_press` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_park` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_pay_account` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_pay_account_bill` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_pay_bill` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_pay_order` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_power_bill_auto_config` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_prepayment` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_prepayment_history` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_profit_sharing_order` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_profit_sharing_receiver` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_profit_sharing_result` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_property_contract` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) DEFAULT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_question` | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_question_config` | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_question_log` | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_refund_order` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_rent_contract` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_score_validity_period` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_score_history` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| delete from wx_score_history where score_amount = 0; | |||
| ALTER TABLE `wx_score_rules` | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_screen_ad` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_shop` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_subsidy` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_template_msg` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_topic` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_user_data_rule` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_user_visit` | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_weapp_audit_status` | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_weapp_code_status` | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_weapp_release_status` | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| ALTER TABLE `wx_wiwide_info` | |||
| ADD COLUMN `sub_tenant_id` varchar(5) DEFAULT NULL COMMENT '子租户ID' AFTER `tenant_id`, | |||
| MODIFY COLUMN `tenant_id` varchar(5) NOT NULL COMMENT '租户ID'; | |||
| @@ -0,0 +1,2 @@ | |||
| INSERT INTO `mall_sale_type`(`id`,`name`, `type`, `period`, `menus`) | |||
| VALUES(100, '集团版', 100, 12, '[1, 2, 5, 6, 8, 10, 50, 101, 102, 104, 105, 106, 108, 203, 204, 206, 207, 501, 502, 503, 504, 505, 506, 507, 509, 511, 512, 513, 522, 523, 591, 595, 601, 611, 612, 621, 622, 623, 624, 625, 626, 627, 901, 902]'); | |||
| @@ -0,0 +1,3 @@ | |||
| update `mall_sale_type` set `menus` = | |||
| '[1, 2, 5, 6, 8, 10, 50, 101, 102, 104, 105, 106, 108, 203, 204, 206, 501, 502, 503, 504, 505, 506, 507, 509, 511, 512, 522, 523, 591, 595, 601, 611, 621, 622, 623, 624, 625, 626, 627, 901, 902]' | |||
| where id = 100; | |||
| @@ -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); | |||
| @@ -252,6 +269,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); | |||
| } | |||
| @@ -9,6 +9,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; | |||
| @@ -27,6 +28,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 | |||
| @@ -73,7 +75,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); | |||
| } | |||
| @@ -83,13 +85,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()); | |||
| @@ -138,63 +141,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 | |||
| @@ -459,6 +459,10 @@ public class WxMicroPayController extends BaseController { | |||
| logger.error("微信收款码/authCode不能为空"); | |||
| return new ResultData(ErrorCode.MICRO_PAY_NO_AUTHCODE.getCode(), "请提供微信收款码"); | |||
| } | |||
| if (!checkAuthCode(authCode)) { | |||
| logger.error("authCode不符合规则"); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "authCode不符合规则"); | |||
| } | |||
| WxPayOrder record = new WxPayOrder(); | |||
| record.updateTenantInfo(user); | |||
| @@ -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,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_cuser_floating_layer".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_buser".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_floating_layer".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())) | |||
| @@ -31,7 +31,7 @@ spring: | |||
| password: ENC(xPFDlgd6v8zUhJMbcKc0KmmQiqs9qHtk) | |||
| timeout: 3600 | |||
| expire: 1800 #30分钟 | |||
| database: 1 | |||
| database: 5 | |||
| defaultExpiration: 2592000 # 默认生命周期30天 | |||
| jedis: | |||
| pool: | |||
| @@ -110,7 +110,7 @@ wechat: | |||
| min-idle: 10 | |||
| fm: | |||
| exception: false | |||
| exception: true | |||
| exception_emails: houtaikaifa@iformall.com | |||
| deploy: 1 | |||
| open: true | |||
| @@ -125,6 +125,5 @@ pos: | |||
| logging: | |||
| level: | |||
| tk.mybatis: debug | |||
| com.iformall.mapper: debug | |||
| path: ./logs/b | |||
| @@ -102,6 +102,5 @@ pos: | |||
| logging: | |||
| level: | |||
| tk.mybatis: debug | |||
| com.iformall.mapper: debug | |||
| path: ./logs/b | |||
| @@ -102,6 +102,5 @@ pos: | |||
| logging: | |||
| level: | |||
| tk.mybatis: debug | |||
| com.iformall: debug | |||
| path: ./logs/b | |||
| @@ -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); | |||
| @@ -7,6 +7,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; | |||
| @@ -47,9 +48,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); | |||
| // TODO 缓存优化 | |||
| final PageInfo<WxCampaign> page = wxCampaignService.clistAsPage(wxCampaign, pageNum, pageSize); | |||
| @@ -256,14 +256,14 @@ public class WxCarController extends BaseController { | |||
| WxPark park = getCurrentPark(getTenantInfo()); | |||
| // 2. get vendor params | |||
| if (park.getVendorType() == EnumCarVendor.CAR_ETCP.getCode()) { | |||
| return etcpBindCar(paramMap, park); | |||
| return etcpBindCar(paramMap, park, getUserId()); | |||
| } else { | |||
| // 内部操作 | |||
| return bindCar(paramMap, park); | |||
| return bindCar(paramMap, park, getUserId()); | |||
| } | |||
| } | |||
| 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为空"); | |||
| @@ -290,7 +290,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 { | |||
| @@ -300,14 +300,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) { | |||
| @@ -316,12 +316,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); | |||
| @@ -331,11 +331,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为空"); | |||
| @@ -364,7 +364,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 { | |||
| @@ -372,14 +372,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(); | |||
| @@ -391,7 +391,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()); | |||
| @@ -402,14 +402,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); | |||
| } | |||
| @@ -430,13 +430,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为空"); | |||
| @@ -466,8 +466,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) { | |||
| @@ -483,7 +483,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为空"); | |||
| @@ -491,8 +491,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) { | |||
| @@ -510,7 +510,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) { | |||
| @@ -749,7 +749,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()); | |||
| @@ -797,7 +797,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 { | |||
| @@ -87,7 +87,7 @@ public class WxMallController extends BaseController { | |||
| @GetMapping("/mallInfo") | |||
| public ResultData getMallInfo() { | |||
| //TODO 缓存优化 | |||
| 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(); | |||
| @@ -16,10 +16,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; | |||
| @@ -44,6 +41,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") | |||
| @@ -95,6 +93,7 @@ public class WxUserGrantController extends BaseController { | |||
| @Autowired | |||
| private MemCouponFromDspService memCouponFromDspService; | |||
| WxMallService mallService; | |||
| /** | |||
| * 微信消息服务验证 | |||
| @@ -164,6 +163,15 @@ public class WxUserGrantController 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); | |||
| } | |||
| // 集团版,获取子集团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); | |||
| @@ -172,6 +180,9 @@ public class WxUserGrantController extends BaseController { | |||
| if (wxAppinfo == null) { | |||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | |||
| } | |||
| if (!wxAppinfo.getEnable().equals(EnumEnableType.Enable.getCode())) { | |||
| return new ResultData(ErrorCode.APP_ID_NOT_ENABLE); | |||
| } | |||
| wxMaService = getWeappServiceByAppInfo(wxAppinfo); | |||
| if (StringUtils.isBlank(wxAppinfo.getAccessToken())) { | |||
| @@ -250,7 +261,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); | |||
| @@ -263,11 +297,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)) { | |||
| @@ -295,12 +329,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); | |||
| @@ -323,6 +357,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); | |||
| @@ -332,6 +375,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) { | |||
| @@ -340,8 +410,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); | |||
| } | |||
| @@ -392,10 +463,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) { | |||
| @@ -443,6 +520,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())); | |||
| @@ -450,7 +536,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) { | |||
| // 首次获取昵称 | |||
| @@ -693,7 +779,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) { | |||
| @@ -773,11 +859,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()); | |||
| @@ -789,7 +878,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()); | |||
| @@ -808,7 +897,6 @@ public class WxUserGrantController extends BaseController { | |||
| @RequestMapping("/getDiscountInfo") | |||
| @ApiOperation(value = "获取用户折扣率", notes = "") | |||
| public ResultData getDiscountInfo() { | |||
| WxCUser user = getUser(); | |||
| List<WxLevelConfig> levelList = wxLevelConfigService.getByTenantId(user.getTenantId()); | |||
| @@ -823,6 +911,7 @@ public class WxUserGrantController extends BaseController { | |||
| } | |||
| } | |||
| WxLevelMerchant levelMerchant = new WxLevelMerchant(); | |||
| levelMerchant.updateTenantInfo(getTenantInfo()); | |||
| levelMerchant.setLevelId(levelId); | |||
| List<WxLevelMerchantCVo> levelMerchantList = wxLevelConfigService.findListCVo(levelMerchant); | |||
| @@ -65,6 +65,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,74 @@ 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_cuser_floating_layer".equals(tableName)) { | |||
| return true; | |||
| } | |||
| if ("wx_floating_layer".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())) | |||
| @@ -32,7 +32,7 @@ spring: | |||
| password: ENC(xPFDlgd6v8zUhJMbcKc0KmmQiqs9qHtk) | |||
| timeout: 3600 | |||
| expire: 1800 #30分钟 | |||
| database: 1 | |||
| database: 5 | |||
| jedis: | |||
| pool: | |||
| max-active: 200 | |||
| @@ -110,7 +110,7 @@ jasypt: | |||
| password: oRqdnDbK5pj3eMmB | |||
| fm: | |||
| exception: false | |||
| exception: true | |||
| exception_emails: houtaikaifa@iformall.com | |||
| deploy: 1 | |||
| open: true | |||
| @@ -118,6 +118,5 @@ fm: | |||
| logging: | |||
| level: | |||
| tk.mybatis: debug | |||
| com.iformall: debug | |||
| path: ./logs/c | |||
| @@ -96,6 +96,5 @@ fm: | |||
| logging: | |||
| level: | |||
| tk.mybatis: debug | |||
| com.iformall: debug | |||
| path: ./logs/c | |||
| @@ -96,6 +96,5 @@ fm: | |||
| logging: | |||
| level: | |||
| tk.mybatis: debug | |||
| com.iformall: debug | |||
| path: ./logs/c | |||
| @@ -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){ | |||
| @@ -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; | |||
| @@ -32,7 +32,7 @@ spring: | |||
| password: ENC(xPFDlgd6v8zUhJMbcKc0KmmQiqs9qHtk) | |||
| timeout: 3600 | |||
| expire: 1800 #30分钟 | |||
| database: 1 | |||
| database: 5 | |||
| defaultExpiration: 2592000 # 默认生命周期30天 | |||
| jedis: | |||
| pool: | |||
| @@ -116,7 +116,7 @@ jasypt: | |||
| password: oRqdnDbK5pj3eMmB | |||
| fm: | |||
| exception: false | |||
| exception: true | |||
| exception_emails: houtaikaifa@iformall.com | |||
| deploy: 1 | |||
| open: true | |||
| @@ -101,6 +101,5 @@ fm: | |||
| logging: | |||
| level: | |||
| tk.mybatis: debug | |||
| com.iformall.mapper: debug | |||
| path: ./logs/admin | |||
| @@ -101,6 +101,5 @@ fm: | |||
| logging: | |||
| level: | |||
| tk.mybatis: debug | |||
| com.iformall: debug | |||
| path: ./logs/admin | |||
| @@ -33,7 +33,7 @@ spring: | |||
| password: ENC(xPFDlgd6v8zUhJMbcKc0KmmQiqs9qHtk) | |||
| timeout: 3600 | |||
| expire: 1800 #30分钟 | |||
| database: 1 | |||
| database: 5 | |||
| defaultExpiration: 2592000 # 默认生命周期30天 | |||
| jedis: | |||
| pool: | |||
| @@ -110,7 +110,7 @@ jasypt: | |||
| password: oRqdnDbK5pj3eMmB | |||
| fm: | |||
| exception: false | |||
| exception: true | |||
| exception_emails: houtaikaifa@iformall.com | |||
| deploy: 1 | |||
| open: true | |||
| @@ -118,6 +118,5 @@ fm: | |||
| logging: | |||
| level: | |||
| tk.mybatis: debug | |||
| com.iformall.mapper: debug | |||
| path: ./logs/m | |||
| @@ -97,6 +97,5 @@ fm: | |||
| logging: | |||
| level: | |||
| tk.mybatis: debug | |||
| com.iformall: debug | |||
| path: ./logs/m | |||
| @@ -97,6 +97,5 @@ fm: | |||
| logging: | |||
| level: | |||
| tk.mybatis: debug | |||
| com.iformall: debug | |||
| path: ./logs/m | |||
| @@ -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; | |||
| @@ -90,35 +91,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()); | |||
| @@ -191,8 +202,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); | |||
| @@ -287,7 +305,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) { | |||
| @@ -312,12 +330,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); | |||
| @@ -666,7 +687,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; | |||
| @@ -681,7 +702,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); | |||
| } | |||
| @@ -692,18 +713,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()) { | |||
| @@ -715,7 +736,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); | |||
| @@ -801,8 +822,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); | |||
| @@ -883,7 +912,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); | |||
| @@ -906,12 +935,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); | |||
| @@ -1147,7 +1179,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); | |||
| @@ -1189,7 +1221,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()); | |||
| @@ -1207,7 +1239,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()); | |||
| @@ -1233,7 +1265,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()); | |||
| @@ -1257,7 +1289,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); | |||
| @@ -1284,7 +1316,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()); | |||
| @@ -1300,7 +1332,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()); | |||
| @@ -1334,7 +1366,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()); | |||
| @@ -1361,7 +1393,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); | |||
| @@ -1392,7 +1424,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); | |||
| @@ -1407,7 +1439,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()); | |||
| @@ -1423,7 +1455,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()); | |||
| @@ -1447,7 +1479,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); | |||
| @@ -1484,7 +1516,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); | |||
| @@ -1561,7 +1600,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); | |||
| @@ -1581,7 +1620,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); | |||
| @@ -1629,7 +1668,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); | |||
| @@ -1798,7 +1845,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); | |||
| @@ -2024,11 +2079,13 @@ public class PosServiceImpl implements PosService { | |||
| WxMerchantBUser merchantBUser, | |||
| WxOrder order, Long memId, | |||
| Long posPayOrderId, Integer neuPaymentAmount, Date neuPosPayOrderTime) { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| Long payOrderId = idWorker.nextId(); | |||
| WxPayOrder payOrder = new WxPayOrder() {{ | |||
| WxPayOrder payOrder = new WxPayOrder() {{ | |||
| Date curDate = new Date(); | |||
| setTenantId(merchantBUser.getTenantId()); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| Long id = idWorker.nextId(); | |||
| setId(id); | |||
| updateTenantInfo(merchantBUser); | |||
| setCUserId(memId); | |||
| setOrderId(order.getId()); | |||
| setCreateTime(curDate); | |||
| @@ -2075,6 +2132,7 @@ public class PosServiceImpl implements PosService { | |||
| Date curDate = new Date(); | |||
| setId(payOrderId); | |||
| setTenantId(merchantBUser.getTenantId()); | |||
| updateTenantInfo(merchantBUser); | |||
| setCUserId(memId); | |||
| setBUserId(merchantBUser.getId()); | |||
| setOrderId(order.getId()); | |||
| @@ -2160,6 +2218,7 @@ public class PosServiceImpl implements PosService { | |||
| Date curDate = new Date(); | |||
| setId(payOrderId); | |||
| setTenantId(buUser.getTenantId()); | |||
| updateTenantInfo(buUser); | |||
| setCUserId(memId); | |||
| setBUserId(buUser.getId()); | |||
| setOrderId(order.getId()); | |||
| @@ -2228,6 +2287,7 @@ public class PosServiceImpl implements PosService { | |||
| Date curDate = new Date(); | |||
| setId(payOrderId); | |||
| setTenantId(buUser.getTenantId()); | |||
| updateTenantInfo(buUser); | |||
| setCUserId(memId); | |||
| setOrderId(order.getId()); | |||
| setCreateTime(curDate); | |||
| @@ -2290,7 +2350,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()); | |||
| @@ -2314,6 +2374,7 @@ public class PosServiceImpl implements PosService { | |||
| setId(refundId); | |||
| setRefundId(String.valueOf(refundId)); | |||
| setTenantId(buUser.getTenantId()); | |||
| updateTenantInfo(buUser); | |||
| setCUserId(memId); | |||
| setOrderId(refundOrder.getId()); | |||
| setCreateTime(curDate); | |||
| @@ -2381,7 +2442,7 @@ public class PosServiceImpl implements PosService { | |||
| Date curr = new Date(); | |||
| String bodyStr = "POS支付, 金额: " + posAmount; | |||
| setId(orderId); | |||
| setTenantId(merchantBUser.getTenantId()); | |||
| updateTenantInfo(merchantBUser); | |||
| setOrderNumber(orderId); | |||
| setType(EnumOrderType.POSPAY.getCode()); | |||
| setProductId(merchantBUser.getId()); | |||
| @@ -2461,7 +2522,7 @@ public class PosServiceImpl implements PosService { | |||
| Date curr = new Date(); | |||
| String bodyStr = "POS退款, 金额: " + orderAmount; | |||
| setId(orderId); | |||
| setTenantId(buUser.getTenantId()); | |||
| updateTenantInfo(buUser); | |||
| setType(EnumOrderType.POSPAY.getCode()); | |||
| setProductId(buUser.getId()); | |||
| setCUserId(memId); | |||
| @@ -4,7 +4,11 @@ spring: | |||
| #include: rabbitMQ | |||
| # JDBC | |||
| datasource: | |||
| <<<<<<< HEAD | |||
| url: jdbc:mysql://zc349w82qvn56ftl5e64-rw4rm.rwlb.rds.aliyuncs.com:3306/mallink?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true | |||
| ======= | |||
| url: jdbc:mysql://202.165.179.86:3306/mallinkDevGroup1?characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useUnicode=true&useSSL=false&useAffectedRows=true | |||
| >>>>>>> develop | |||
| username: ENC(dZ8fmrtuBMQYaRytKQgTqg==) | |||
| password: ENC(IKH7HxMZwIqMttMc9+QsqWa1KMsJvTs4) | |||
| type: com.alibaba.druid.pool.DruidDataSource | |||
| @@ -31,7 +35,7 @@ spring: | |||
| password: ENC(xPFDlgd6v8zUhJMbcKc0KmmQiqs9qHtk) | |||
| timeout: 3600 | |||
| expire: 1800 #30分钟 | |||
| database: 1 | |||
| database: 5 | |||
| defaultExpiration: 2592000 # 默认生命周期30天 | |||
| jedis: | |||
| pool: | |||
| @@ -110,7 +114,7 @@ wechat: | |||
| min-idle: 10 | |||
| fm: | |||
| exception: false | |||
| exception: true | |||
| exception_emails: houtaikaifa@iformall.com | |||
| deploy: 1 | |||
| open: true | |||
| @@ -118,6 +122,5 @@ fm: | |||
| logging: | |||
| level: | |||
| tk.mybatis: debug | |||
| com.iformall.mapper: debug | |||
| path: ./logs/p | |||
| @@ -96,6 +96,5 @@ fm: | |||
| logging: | |||
| level: | |||
| tk.mybatis: debug | |||
| com.iformall.mapper: debug | |||
| path: ./logs/p | |||
| @@ -96,6 +96,5 @@ fm: | |||
| logging: | |||
| level: | |||
| tk.mybatis: debug | |||
| com.iformall: debug | |||
| path: ./logs/p | |||
| @@ -58,7 +58,7 @@ public class PosAppTest { | |||
| private static final String phone = "13120220020"; | |||
| private static final String password = "123456zz"; | |||
| 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); | |||
| @@ -33,7 +33,7 @@ spring: | |||
| password: ENC(xPFDlgd6v8zUhJMbcKc0KmmQiqs9qHtk) | |||
| timeout: 3600 | |||
| expire: 1800 #30分钟 | |||
| database: 1 | |||
| database: 5 | |||
| defaultExpiration: 2592000 # 默认生命周期30天 | |||
| jedis: | |||
| pool: | |||
| @@ -110,7 +110,7 @@ jasypt: | |||
| password: oRqdnDbK5pj3eMmB | |||
| fm: | |||
| exception: false | |||
| exception: true | |||
| exception_emails: houtaikaifa@iformall.com | |||
| deploy: 1 | |||
| open: true | |||
| @@ -100,6 +100,5 @@ fm: | |||
| logging: | |||
| level: | |||
| tk.mybatis: debug | |||
| com.iformall: debug | |||
| path: ./logs/s | |||
| @@ -307,6 +307,7 @@ public enum ErrorCode{ | |||
| REFUND_ORDER_BUSER_NOT_EQUAL(12016, "B端用户无操作权限"), | |||
| REFUND_NOT_ALLOW(12017, "退款订单不允许退款"), | |||
| 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; | |||
| } | |||