| @@ -76,7 +76,7 @@ public class BaseController { | |||||
| } | } | ||||
| /** | /** | ||||
| * 处理集团新增修改所需租户信息 | |||||
| * 处理集团新增修改所需租户信息(广场独立修改,集团修改全部) | |||||
| * ifParentUpdateTenantInfo | * ifParentUpdateTenantInfo | ||||
| */ | */ | ||||
| public TenantEntity ifParentUpdateTenantInfo() { | public TenantEntity ifParentUpdateTenantInfo() { | ||||
| @@ -88,6 +88,23 @@ public class BaseController { | |||||
| return info; | return info; | ||||
| } | } | ||||
| /** | |||||
| * 处理集团新增修改所需租户信息(各广场和集团独立修改) | |||||
| * ifParentUpdateTenantInfo | |||||
| */ | |||||
| public TenantEntity ifParentUpdateAloneTenantInfo(){ | |||||
| TenantEntity info = this.getTenantInfo(); | |||||
| if(StringUtils.isBlank(info.getTenantId())){ | |||||
| info.setTenantId(info.getParentTenantId()); | |||||
| info.setParentTenantId(null); | |||||
| } | |||||
| if(getUser().getTenantId().equals(info.getTenantId())){ | |||||
| return info; | |||||
| } | |||||
| new Exception("权限不足,只能独立操作"); | |||||
| return null; | |||||
| } | |||||
| public String getIpAddr() { | public String getIpAddr() { | ||||
| HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); | HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); | ||||
| String ipaddress = IPUtil.getIpAddr(request); | String ipaddress = IPUtil.getIpAddr(request); | ||||
| @@ -60,7 +60,7 @@ public class WxCampaignController extends BaseController { | |||||
| if (wxCampaign.getStatus() != null && wxCampaign.getStatus() == -1) { | if (wxCampaign.getStatus() != null && wxCampaign.getStatus() == -1) { | ||||
| wxCampaign.setStatus(null); | wxCampaign.setStatus(null); | ||||
| } | } | ||||
| wxCampaign.updateTenantInfo(getTenantInfo()); | |||||
| wxCampaign.updateTenantInfo(ifParentUpdateTenantInfo()); | |||||
| wxCampaign.setSortColumns(BaseEntity.SortField.CreateTime_DESC,BaseEntity.SortField.Id_DESC); | wxCampaign.setSortColumns(BaseEntity.SortField.CreateTime_DESC,BaseEntity.SortField.Id_DESC); | ||||
| final PageInfo<WxCampaign> page = wxCampaignService.listAsPage(wxCampaign, pageNum, pageSize); | final PageInfo<WxCampaign> page = wxCampaignService.listAsPage(wxCampaign, pageNum, pageSize); | ||||
| return new ResultData(page); | return new ResultData(page); | ||||
| @@ -78,7 +78,7 @@ public class WxCampaignController extends BaseController { | |||||
| wxCampaign.setCouponIds(JSONArray.toJSONString(new String[0])); | wxCampaign.setCouponIds(JSONArray.toJSONString(new String[0])); | ||||
| } | } | ||||
| wxCampaign.setStatus(EnumCampaignStatus.STATUS_THROW_IN.getCode()); | wxCampaign.setStatus(EnumCampaignStatus.STATUS_THROW_IN.getCode()); | ||||
| wxCampaign.updateTenantInfo(getTenantInfo()); | |||||
| wxCampaign.updateTenantInfo(ifParentUpdateAloneTenantInfo()); | |||||
| wxCampaignService.saveOrUpdate(wxCampaign); | wxCampaignService.saveOrUpdate(wxCampaign); | ||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @@ -89,7 +89,7 @@ public class WxCampaignController extends BaseController { | |||||
| public ResultData addByPath(@RequestBody WxCampaign wxCampaign) { | public ResultData addByPath(@RequestBody WxCampaign wxCampaign) { | ||||
| logger.debug("[" + getIpAddr() + "] WxCampaignController::addByPath"); | logger.debug("[" + getIpAddr() + "] WxCampaignController::addByPath"); | ||||
| wxCampaign.setStatus(EnumCampaignStatus.STATUS_THROW_IN.getCode()); | wxCampaign.setStatus(EnumCampaignStatus.STATUS_THROW_IN.getCode()); | ||||
| wxCampaign.updateTenantInfo(getTenantInfo()); | |||||
| wxCampaign.updateTenantInfo(ifParentUpdateAloneTenantInfo()); | |||||
| wxCampaignService.addForPath(wxCampaign); | wxCampaignService.addForPath(wxCampaign); | ||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @@ -99,7 +99,7 @@ public class WxCampaignController extends BaseController { | |||||
| @SystemControllerLog(description = "宣传页-id更新") | @SystemControllerLog(description = "宣传页-id更新") | ||||
| public ResultData update(@RequestBody WxCampaign wxCampaign) { | public ResultData update(@RequestBody WxCampaign wxCampaign) { | ||||
| logger.debug("[" + getIpAddr() + "] WxCampaignController::update"); | logger.debug("[" + getIpAddr() + "] WxCampaignController::update"); | ||||
| ifParentUpdateAloneTenantInfo(); | |||||
| if (StringUtils.isNotBlank(wxCampaign.getCouponIds())) { | if (StringUtils.isNotBlank(wxCampaign.getCouponIds())) { | ||||
| String[] arys = wxCampaign.getCouponIds().split(","); | String[] arys = wxCampaign.getCouponIds().split(","); | ||||
| wxCampaign.setCouponIds(JSON.toJSONString(arys)); | wxCampaign.setCouponIds(JSON.toJSONString(arys)); | ||||
| @@ -114,6 +114,7 @@ public class WxCampaignController extends BaseController { | |||||
| @SystemControllerLog(description = "宣传页-更新状态") | @SystemControllerLog(description = "宣传页-更新状态") | ||||
| public ResultData updateStatus(@RequestBody WxCampaign wxCampaign) { | public ResultData updateStatus(@RequestBody WxCampaign wxCampaign) { | ||||
| logger.debug("[" + getIpAddr() + "] WxCampaignController::updateStatus"); | logger.debug("[" + getIpAddr() + "] WxCampaignController::updateStatus"); | ||||
| ifParentUpdateAloneTenantInfo(); | |||||
| WxCampaign campaign = wxCampaignService.getById(wxCampaign.getId()); | WxCampaign campaign = wxCampaignService.getById(wxCampaign.getId()); | ||||
| // check coupon 状态 | // check coupon 状态 | ||||
| if (campaign.getType().equals(EnumCampaignType.STABLE.getCode())) { | if (campaign.getType().equals(EnumCampaignType.STABLE.getCode())) { | ||||
| @@ -146,6 +147,7 @@ public class WxCampaignController extends BaseController { | |||||
| @SystemControllerLog(description = "宣传页-删除") | @SystemControllerLog(description = "宣传页-删除") | ||||
| public ResultData delete(Long id) { | public ResultData delete(Long id) { | ||||
| logger.debug("[" + getIpAddr() + "] WxCampaignController::delete"); | logger.debug("[" + getIpAddr() + "] WxCampaignController::delete"); | ||||
| ifParentUpdateAloneTenantInfo(); | |||||
| wxCampaignService.deleteById(id); | wxCampaignService.deleteById(id); | ||||
| return new ResultData(Result.SUCCESS, "删除成功", null); | return new ResultData(Result.SUCCESS, "删除成功", null); | ||||
| } | } | ||||
| @@ -159,7 +161,6 @@ public class WxCampaignController extends BaseController { | |||||
| WxCampaign wxCampaign = wxCampaignService.getById(id); | WxCampaign wxCampaign = wxCampaignService.getById(id); | ||||
| if (wxCampaign != null) { | if (wxCampaign != null) { | ||||
| WxCouponChannel wxCouponChannel = new WxCouponChannel(); | WxCouponChannel wxCouponChannel = new WxCouponChannel(); | ||||
| wxCouponChannel.updateTenantInfo(getTenantInfo()); | |||||
| wxCouponChannel.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_CAMPAIN.getCode()); | wxCouponChannel.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_CAMPAIN.getCode()); | ||||
| wxCouponChannel.setSubTargetId(wxCampaign.getId()); | wxCouponChannel.setSubTargetId(wxCampaign.getId()); | ||||
| wxCouponChannel.setStatus(EnumCampaignStatus.STATUS_THROW_IN.getCode()); | wxCouponChannel.setStatus(EnumCampaignStatus.STATUS_THROW_IN.getCode()); | ||||
| @@ -57,10 +57,14 @@ public class WxCouponController extends BaseController { | |||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | ||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | ||||
| @SystemControllerLog(description = "券投放-列表") | @SystemControllerLog(description = "券投放-列表") | ||||
| public ResultData list(@ModelAttribute WxCoupon wxCoupon, Integer pageNum, Integer pageSize) { | |||||
| public ResultData list(@ModelAttribute WxCoupon wxCoupon, Integer pageNum, Integer pageSize,Integer type) { | |||||
| logger.debug("[" + getIpAddr() + "] WxCouponController::list"); | logger.debug("[" + getIpAddr() + "] WxCouponController::list"); | ||||
| if (wxCoupon == null) wxCoupon = new WxCoupon(); | if (wxCoupon == null) wxCoupon = new WxCoupon(); | ||||
| wxCoupon.updateTenantInfo(getTenantInfo()); | |||||
| if(null != null && type == 1){ | |||||
| wxCoupon.updateTenantInfo(ifParentUpdateTenantInfo()); | |||||
| }else{ | |||||
| wxCoupon.updateTenantInfo(getTenantInfo()); | |||||
| } | |||||
| return wxCouponService.list(wxCoupon, pageNum, pageSize); //全列表 | return wxCouponService.list(wxCoupon, pageNum, pageSize); //全列表 | ||||
| } | } | ||||
| @@ -61,7 +61,7 @@ public class AsyncTask { | |||||
| public void importExcelData(File file, MallUserInfo user, String importKey) { | public void importExcelData(File file, MallUserInfo user, String importKey) { | ||||
| ImportParams params = new ImportParams(); | ImportParams params = new ImportParams(); | ||||
| // 需要验证 | // 需要验证 | ||||
| params.setImportFields(new String[]{"姓名", "性别", "手机号*", "微信昵称", "学历", "生日", "地址", "上次活跃时间", "注册时间", "标签", "成长值", "积分"}); | |||||
| params.setImportFields(new String[]{"姓名", "性别", "手机号*", "微信昵称", "学历", "生日", "地址", "上次活跃时间", "注册时间", "成长值", "积分"}); | |||||
| IExcelDataHandler<CUserBaseInfoT> handler = new AsyncTask.UserExcelHandler(); | IExcelDataHandler<CUserBaseInfoT> handler = new AsyncTask.UserExcelHandler(); | ||||
| handler.setNeedHandlerFields(new String[]{"手机号*"}); | handler.setNeedHandlerFields(new String[]{"手机号*"}); | ||||
| params.setNeedVerify(true); | params.setNeedVerify(true); | ||||
| @@ -566,4 +566,29 @@ public class WxCUserBasicInfoController extends BaseController { | |||||
| return wxCUserBasicInfoService.updateStatus(wxCUserBasicInfo); | return wxCUserBasicInfoService.updateStatus(wxCUserBasicInfo); | ||||
| } | } | ||||
| @ApiOperation("根据手机号迁移") | |||||
| @PostMapping("/cuserOldToNew") | |||||
| @SystemControllerLog(description = "会员管理-迁移数据") | |||||
| public ResultData cuserOldToNew(@RequestBody Map<String,String> map) { | |||||
| logger.debug("[" + getIpAddr() + "] WxCUserBasicInfoController::cuserOldToNew"); | |||||
| String oldCuserPhone = (String) map.get("oldCuserPhone"); | |||||
| String newCuserPhone = (String) map.get("newCuserPhone"); | |||||
| if(StringUtils.isNotBlank(oldCuserPhone) && StringUtils.isNotBlank(newCuserPhone)){ | |||||
| WxCUserBasicInfo oldCuser = wxCUserBasicInfoService.findInfoByPhone(ifParentUpdateTenantInfo(), oldCuserPhone); | |||||
| WxCUserBasicInfo newCuser = wxCUserBasicInfoService.findInfoByPhone(ifParentUpdateTenantInfo(), newCuserPhone); | |||||
| if(null != oldCuser && null != newCuser){ | |||||
| if(!oldCuserPhone.equals(newCuserPhone)){ | |||||
| wxCUserBasicInfoService.cuserOldToNew(oldCuser.getId(),newCuser.getId()); | |||||
| return new ResultData(); | |||||
| }else{ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,"同一个用户"); | |||||
| } | |||||
| }else{ | |||||
| return new ResultData(ErrorCode.USER_IS_EMPTY); | |||||
| } | |||||
| }else{ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||||
| } | |||||
| } | |||||
| } | } | ||||
| @@ -1,4 +1,4 @@ | |||||
| update mall_sale_type set menus = '[1, 2, 5, 6, 8, 10, 50, 101, 102, 104, 105, 106, 108, 203, 204, 206, 207, 501, 502, 503, 504, 505, 506, 507, 511, 512, 522, 523, 509, 591, 595, 601, 621, 622, 623, 624, 625, 626, 627, 901, 902]' where id=100 | |||||
| update mall_sale_type set menus = '[1, 2, 5, 6, 8, 10, 50, 101, 102, 104, 105, 106, 108, 203, 204, 206, 207, 501, 502, 503, 504, 505, 506, 507, 511, 512, 522, 523, 509, 591, 595, 601, 605, 621, 622, 623, 624, 625, 626, 627, 671, 901, 902]' where id=100 | |||||
| CREATE DEFINER=`root`@`%` PROCEDURE `init_after_group`(IN tenantId VARCHAR(25),IN subTenantIds VARCHAR(250)) | CREATE DEFINER=`root`@`%` PROCEDURE `init_after_group`(IN tenantId VARCHAR(25),IN subTenantIds VARCHAR(250)) | ||||
| @@ -10,8 +10,7 @@ ADD COLUMN `final_tenant_id` varchar(5) NOT NULL COMMENT '归属租户ID' AFTER | |||||
| update wx_c_user_basic_info set final_tenant_id = parent_tenant_id; | update wx_c_user_basic_info set final_tenant_id = parent_tenant_id; | ||||
| update wx_c_user_basic_info set final_tenant_id = tenant_id where (parent_tenant_id is null or trim(parent_tenant_id) = ""); | update wx_c_user_basic_info set final_tenant_id = tenant_id where (parent_tenant_id is null or trim(parent_tenant_id) = ""); | ||||
| DROP INDEX `PHONE_UNIQUE`, | |||||
| ADD UNIQUE INDEX `PHONE_UNIQUE`(`final_tenant_id`, `phone`) USING BTREE; | |||||
| ALTER TABLE wx_c_user_basic_info ADD UNIQUE INDEX `PHONE_UNIQUE`(`final_tenant_id`, `phone`) USING BTREE; | |||||
| ALTER TABLE `wx_c_user_basic_info` | ALTER TABLE `wx_c_user_basic_info` | ||||
| @@ -72,5 +71,42 @@ ALTER TABLE `wx_c_user_car` | |||||
| ADD COLUMN `vendor_person_id` VARCHAR(100) DEFAULT NULL COMMENT '停车场的会员ID'; | ADD COLUMN `vendor_person_id` VARCHAR(100) DEFAULT NULL COMMENT '停车场的会员ID'; | ||||
| CREATE DEFINER=`root`@`%` PROCEDURE `cuser_old_to_new`(IN `oldCuserId` bigint,IN `newCuserId` bigint) | |||||
| BEGIN | |||||
| DECLARE err_flag INT DEFAULT FALSE; | |||||
| DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET err_flag = TRUE; | |||||
| UPDATE wx_c_user SET user_id = newCuserId WHERE user_id = oldCuserId ; | |||||
| UPDATE wx_activity_join SET user_id = newCuserId WHERE user_id = oldCuserId ; | |||||
| UPDATE wx_c_user_tags SET user_id = newCuserId WHERE user_id = oldCuserId ; | |||||
| UPDATE wx_game_action_log SET user_id = newCuserId WHERE user_id = oldCuserId ; | |||||
| UPDATE wx_order_group SET user_id = newCuserId WHERE user_id = oldCuserId ; | |||||
| UPDATE wx_order_press SET user_id = newCuserId WHERE user_id = oldCuserId ; | |||||
| UPDATE wx_question_log SET user_id = newCuserId WHERE user_id = oldCuserId ; | |||||
| UPDATE wx_c_user_car SET c_user_id = newCuserId WHERE c_user_id = oldCuserId ; | |||||
| UPDATE wx_c_user_from_b SET c_user_id = newCuserId WHERE c_user_id = oldCuserId ; | |||||
| UPDATE wx_coupon_order SET c_user_id = newCuserId WHERE c_user_id = oldCuserId ; | |||||
| UPDATE wx_credit_history SET c_user_id = newCuserId WHERE c_user_id = oldCuserId ; | |||||
| UPDATE wx_order SET c_user_id = newCuserId WHERE c_user_id = oldCuserId ; | |||||
| UPDATE wx_pay_order SET c_user_id = newCuserId WHERE c_user_id = oldCuserId ; | |||||
| UPDATE wx_refund_order SET c_user_id = newCuserId WHERE c_user_id = oldCuserId ; | |||||
| UPDATE wx_score_history SET c_user_id = newCuserId WHERE c_user_id = oldCuserId ; | |||||
| UPDATE wx_card_spend SET owner_id = newCuserId WHERE owner_id = oldCuserId ; | |||||
| UPDATE wx_coupon_order SET owner_id = newCuserId WHERE owner_id = oldCuserId ; | |||||
| UPDATE wx_credit_history SET operator_id = newCuserId WHERE operator_type in (1,2) and operator_id = oldCuserId ; | |||||
| UPDATE wx_c_user_basic_info SET phone = phone + '(作废)',`status` = 1 WHERE id = oldCuserId ; | |||||
| IF err_flag THEN | |||||
| ROLLBACK; | |||||
| ELSE | |||||
| COMMIT; | |||||
| END IF; | |||||
| END | |||||
| @@ -73,6 +73,7 @@ public interface WxCUserBasicInfoMapper extends CommonMapper<WxCUserBasicInfo, S | |||||
| */ | */ | ||||
| List<WxCUserBasicInfo> selectNotCUserList(); | List<WxCUserBasicInfo> selectNotCUserList(); | ||||
| void cuserOldToNew(@Param(value = "oldCuserId")Long oldCuserId, @Param(value = "newCuserId")Long newCuserId); | |||||
| } | } | ||||
| @@ -7,6 +7,6 @@ import org.apache.ibatis.annotations.Param; | |||||
| public interface WxProjectConfigMapper extends BaseMapper<WxProjectConfig> { | public interface WxProjectConfigMapper extends BaseMapper<WxProjectConfig> { | ||||
| void initAfterGroup(@Param(value = "tenantId")String tenantId, @Param(value = "subTenantIds")String subTenantIds); | void initAfterGroup(@Param(value = "tenantId")String tenantId, @Param(value = "subTenantIds")String subTenantIds); | ||||
| } | } | ||||
| @@ -168,5 +168,7 @@ public interface WxCUserBasicInfoService { | |||||
| List<WxCUserBasicInfo> findListByScore(TenantEntity tenantEntity, WxCUserBasicInfoDto wxCUserBasicInfoDto); | List<WxCUserBasicInfo> findListByScore(TenantEntity tenantEntity, WxCUserBasicInfoDto wxCUserBasicInfoDto); | ||||
| List<WxCUserBasicInfo> findBirthdayList(TenantEntity tenantEntity, String format, String format1); | List<WxCUserBasicInfo> findBirthdayList(TenantEntity tenantEntity, String format, String format1); | ||||
| void cuserOldToNew(Long oldCuserId, Long newCuserId); | |||||
| } | } | ||||
| @@ -1207,7 +1207,13 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc | |||||
| return wxCUserBasicInfoMapper.findBirthdayList(finalTenantId,format,format1); | return wxCUserBasicInfoMapper.findBirthdayList(finalTenantId,format,format1); | ||||
| } | } | ||||
| } | } | ||||
| @Override | |||||
| @Override | |||||
| public void cuserOldToNew(Long oldCuserId, Long newCuserId) { | |||||
| wxCUserBasicInfoMapper.cuserOldToNew(oldCuserId,newCuserId); | |||||
| } | |||||
| @Override | |||||
| public List<Object> selectListForExcelExport(Object queryParams, int page) { | public List<Object> selectListForExcelExport(Object queryParams, int page) { | ||||
| Map params = (Map) queryParams; | Map params = (Map) queryParams; | ||||
| WxCUserBasicInfo basicInfo = (WxCUserBasicInfo) params.get("basicInfo"); | WxCUserBasicInfo basicInfo = (WxCUserBasicInfo) params.get("basicInfo"); | ||||
| @@ -1065,4 +1065,8 @@ | |||||
| <select id="selectNotCUserList" resultMap="BaseResultMap"> | <select id="selectNotCUserList" resultMap="BaseResultMap"> | ||||
| select id,credit from wx_c_user_basic_info cub where not exists (select * from wx_c_user c where c.user_id=cub.id) and cub.credit is null | select id,credit from wx_c_user_basic_info cub where not exists (select * from wx_c_user c where c.user_id=cub.id) and cub.credit is null | ||||
| </select> | </select> | ||||
| <update id="cuserOldToNew" statementType="CALLABLE" > | |||||
| {call cuser_old_to_new(#{oldCuserId},#{newCuserId})} | |||||
| </update> | |||||
| </mapper> | </mapper> | ||||