| @@ -1,5 +1,6 @@ | |||||
| package com.iformall.controller.sys; | package com.iformall.controller.sys; | ||||
| import com.alibaba.fastjson.JSON; | |||||
| import com.google.code.kaptcha.Constants; | import com.google.code.kaptcha.Constants; | ||||
| import com.google.code.kaptcha.Producer; | import com.google.code.kaptcha.Producer; | ||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| @@ -7,6 +8,7 @@ import com.iformall.common.Result; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.controller.base.BaseController; | import com.iformall.controller.base.BaseController; | ||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.domain.vo.MallUserInfoVo; | import com.iformall.domain.vo.MallUserInfoVo; | ||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| @@ -25,6 +27,7 @@ import org.apache.shiro.SecurityUtils; | |||||
| import org.apache.shiro.authc.DisabledAccountException; | import org.apache.shiro.authc.DisabledAccountException; | ||||
| import org.apache.shiro.authc.UnknownAccountException; | import org.apache.shiro.authc.UnknownAccountException; | ||||
| import org.apache.shiro.authc.UsernamePasswordToken; | import org.apache.shiro.authc.UsernamePasswordToken; | ||||
| import org.apache.shiro.session.Session; | |||||
| import org.apache.shiro.subject.Subject; | import org.apache.shiro.subject.Subject; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| @@ -144,9 +147,9 @@ public class HomeController extends BaseController { | |||||
| if(isLogin) { | if(isLogin) { | ||||
| MallUserInfo info = (MallUserInfo) SecurityUtils.getSubject().getSession().getAttribute(UserSession.userInfo); | MallUserInfo info = (MallUserInfo) SecurityUtils.getSubject().getSession().getAttribute(UserSession.userInfo); | ||||
| info.protectInfos(); | info.protectInfos(); | ||||
| mallUserActionService.saveActionInfo(info.getTenantId(), EnumMallUserAction.CONTROLLER.getCode(), ipaddress, info.getId(), "用户登录"); | |||||
| mallUserActionService.saveActionInfo(info, EnumMallUserAction.CONTROLLER.getCode(), ipaddress, info.getId(), "用户登录"); | |||||
| WxMall mall = mallService.getByTenantId(info.getTenantId()); | |||||
| WxMall mall = mallService.getByTenantInfo(info); | |||||
| if(mall == null) { | if(mall == null) { | ||||
| logger.error("未配置相应的mall"); | logger.error("未配置相应的mall"); | ||||
| return new ResultData(Result.ERROR, "未配置相应的mall"); | return new ResultData(Result.ERROR, "未配置相应的mall"); | ||||
| @@ -238,9 +241,9 @@ public class HomeController extends BaseController { | |||||
| MallUserInfo info = (MallUserInfo) SecurityUtils.getSubject().getSession().getAttribute(UserSession.userInfo); | MallUserInfo info = (MallUserInfo) SecurityUtils.getSubject().getSession().getAttribute(UserSession.userInfo); | ||||
| info.protectInfos(); | info.protectInfos(); | ||||
| mallUserActionService.saveActionInfo(info.getTenantId(), EnumMallUserAction.CONTROLLER.getCode(), ipaddress, info.getId(), "用户登录"); | |||||
| mallUserActionService.saveActionInfo(info, EnumMallUserAction.CONTROLLER.getCode(), ipaddress, info.getId(), "用户登录"); | |||||
| WxMall mall = mallService.getByTenantId(info.getTenantId()); | |||||
| WxMall mall = mallService.getByTenantInfo(info); | |||||
| if (mall == null) { | if (mall == null) { | ||||
| logger.error("未配置相应的mall"); | logger.error("未配置相应的mall"); | ||||
| return new ResultData(Result.ERROR, "未配置相应的mall"); | return new ResultData(Result.ERROR, "未配置相应的mall"); | ||||
| @@ -297,7 +300,7 @@ public class HomeController extends BaseController { | |||||
| } | } | ||||
| WxMsgValidationcode wxMsgValidationcode = new WxMsgValidationcode(); | WxMsgValidationcode wxMsgValidationcode = new WxMsgValidationcode(); | ||||
| wxMsgValidationcode.setPhone(phone); | wxMsgValidationcode.setPhone(phone); | ||||
| wxMsgValidationcode.setTenantId(user.getTenantId()); | |||||
| wxMsgValidationcode.updateTenantInfo(user); | |||||
| wxMsgValidationcode.setType(EnumMsgModel.VALIDATION_CODE.getCode()); | wxMsgValidationcode.setType(EnumMsgModel.VALIDATION_CODE.getCode()); | ||||
| return wxMsgValidationcodeService.sendvalidationcode(wxMsgValidationcode); | return wxMsgValidationcodeService.sendvalidationcode(wxMsgValidationcode); | ||||
| } | } | ||||
| @@ -338,9 +341,9 @@ public class HomeController extends BaseController { | |||||
| MallUserInfo info = (MallUserInfo) SecurityUtils.getSubject().getSession().getAttribute(UserSession.userInfo); | MallUserInfo info = (MallUserInfo) SecurityUtils.getSubject().getSession().getAttribute(UserSession.userInfo); | ||||
| info.protectInfos(); | info.protectInfos(); | ||||
| mallUserActionService.saveActionInfo(info.getTenantId(), EnumMallUserAction.CONTROLLER.getCode(), ipaddress, info.getId(), "用户手机号登录"); | |||||
| mallUserActionService.saveActionInfo(info, EnumMallUserAction.CONTROLLER.getCode(), ipaddress, info.getId(), "用户手机号登录"); | |||||
| WxMall mall = mallService.getByTenantId(info.getTenantId()); | |||||
| WxMall mall = mallService.getByTenantInfo(info); | |||||
| if (mall == null) { | if (mall == null) { | ||||
| logger.error("未配置相应的mall"); | logger.error("未配置相应的mall"); | ||||
| return new ResultData(Result.ERROR, "未配置相应的mall"); | return new ResultData(Result.ERROR, "未配置相应的mall"); | ||||
| @@ -8,6 +8,7 @@ import com.iformall.common.ResultData; | |||||
| import com.iformall.controller.base.BaseController; | import com.iformall.controller.base.BaseController; | ||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.domain.po.base.BaseEntity; | import com.iformall.domain.po.base.BaseEntity; | ||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.enums.EnumUserAdmin; | import com.iformall.enums.EnumUserAdmin; | ||||
| import com.iformall.service.MallRolePermissionService; | import com.iformall.service.MallRolePermissionService; | ||||
| import com.iformall.service.MallRoleService; | import com.iformall.service.MallRoleService; | ||||
| @@ -51,14 +52,13 @@ public class MallRoleController extends BaseController { | |||||
| @SystemControllerLog(description = "用户管理-role列表") | @SystemControllerLog(description = "用户管理-role列表") | ||||
| public ResultData list(MallRole sysRole, Integer pageNum, Integer pageSize) { | public ResultData list(MallRole sysRole, Integer pageNum, Integer pageSize) { | ||||
| logger.debug("[" + getIpAddr() + "] MallRoleController::list"); | logger.debug("[" + getIpAddr() + "] MallRoleController::list"); | ||||
| String tenantId = getTenantId(); | |||||
| sysRole.setTenantId(tenantId); | |||||
| sysRole.updateTenantInfo(getTenantInfo()); | |||||
| sysRole.setSortColumns(BaseEntity.SortField.Id_DESC); | sysRole.setSortColumns(BaseEntity.SortField.Id_DESC); | ||||
| final PageInfo<MallRole> page = sysRoleService.listAsPage(sysRole, pageNum, pageSize); | final PageInfo<MallRole> page = sysRoleService.listAsPage(sysRole, pageNum, pageSize); | ||||
| for (MallRole r : page.getList()) { | for (MallRole r : page.getList()) { | ||||
| MallRolePermission p = new MallRolePermission(); | MallRolePermission p = new MallRolePermission(); | ||||
| p.setRoleId(r.getId()); | p.setRoleId(r.getId()); | ||||
| p.setTenantId(tenantId); | |||||
| p.updateTenantInfo(sysRole); | |||||
| List<MallRolePermission> pers = sysRolePermissionService.getList(p); | List<MallRolePermission> pers = sysRolePermissionService.getList(p); | ||||
| String menus = ""; | String menus = ""; | ||||
| for (MallRolePermission rp : pers) { | for (MallRolePermission rp : pers) { | ||||
| @@ -108,12 +108,11 @@ public class MallRoleController extends BaseController { | |||||
| if (currentUser.getIsAdmin().equals(EnumUserAdmin.Normal.getCode())) { | if (currentUser.getIsAdmin().equals(EnumUserAdmin.Normal.getCode())) { | ||||
| return new ResultData(ErrorCode.USER_NOT_ADMIN.getCode(), "只有系统管理员才能保存角色"); | return new ResultData(ErrorCode.USER_NOT_ADMIN.getCode(), "只有系统管理员才能保存角色"); | ||||
| } | } | ||||
| String tenantId = currentUser.getTenantId(); | |||||
| int count = checkUnique(sysRole.getName(), tenantId); | |||||
| int count = checkUnique(sysRole.getName(), currentUser); | |||||
| if (sysRole.getId() == null && count > 0) { | if (sysRole.getId() == null && count > 0) { | ||||
| return new ResultData(ResultData.ERROR, "角色名已存在"); | return new ResultData(ResultData.ERROR, "角色名已存在"); | ||||
| } | } | ||||
| sysRole.setTenantId(tenantId); | |||||
| sysRole.updateTenantInfo(currentUser); | |||||
| sysRoleService.saveOrUpdate(sysRole); | sysRoleService.saveOrUpdate(sysRole); | ||||
| if (StringUtils.isNoneBlank(sysRole.getMenus())) { | if (StringUtils.isNoneBlank(sysRole.getMenus())) { | ||||
| String[] menuIds = sysRole.getMenus().split(","); | String[] menuIds = sysRole.getMenus().split(","); | ||||
| @@ -121,7 +120,7 @@ public class MallRoleController extends BaseController { | |||||
| for (String mId : menuIds) { | for (String mId : menuIds) { | ||||
| mIds.add(Long.valueOf(mId)); | mIds.add(Long.valueOf(mId)); | ||||
| } | } | ||||
| sysRolePermissionService.savePermissions(tenantId, sysRole.getId(), mIds.toArray(new Long[]{})); | |||||
| sysRolePermissionService.savePermissions(currentUser, sysRole.getId(), mIds.toArray(new Long[]{})); | |||||
| } | } | ||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @@ -147,10 +146,10 @@ public class MallRoleController extends BaseController { | |||||
| return new ResultData(Result.SUCCESS, "删除成功", null); | return new ResultData(Result.SUCCESS, "删除成功", null); | ||||
| } | } | ||||
| private int checkUnique(String name, String tenantId) { | |||||
| private int checkUnique(String name, TenantEntity tenantEntity) { | |||||
| MallRole role = new MallRole(); | MallRole role = new MallRole(); | ||||
| role.setName(name); | role.setName(name); | ||||
| role.setTenantId(tenantId); | |||||
| role.updateTenantInfo(tenantEntity); | |||||
| return sysRoleService.countList(role); | return sysRoleService.countList(role); | ||||
| } | } | ||||
| @@ -130,7 +130,7 @@ public class MallUserInfoController extends BaseController { | |||||
| Assert.notNull(userInfo.getPassword(), "密码不能为空"); | Assert.notNull(userInfo.getPassword(), "密码不能为空"); | ||||
| PasswordHelper passwordHelper = new PasswordHelper(); | PasswordHelper passwordHelper = new PasswordHelper(); | ||||
| passwordHelper.encryptPassword(userInfo); | passwordHelper.encryptPassword(userInfo); | ||||
| userInfo.updateTenantInfo(getTenantInfo()); | |||||
| userInfo.updateTenantInfo(currentUser); | |||||
| // 无法创建超管 | // 无法创建超管 | ||||
| userInfo.setIsAdmin(EnumUserAdmin.Normal.getCode()); | userInfo.setIsAdmin(EnumUserAdmin.Normal.getCode()); | ||||
| userInfoService.saveOrUpdate(userInfo); | userInfoService.saveOrUpdate(userInfo); | ||||
| @@ -169,7 +169,7 @@ public class MallUserInfoController extends BaseController { | |||||
| bChangedPhone = true; | bChangedPhone = true; | ||||
| } | } | ||||
| userInfo.updateTenantInfo(getTenantInfo()); | |||||
| userInfo.updateTenantInfo(currentUser); | |||||
| if (StringUtils.isNotBlank(userInfo.getPassword()) && userInfo.getPassword().length() > 0) { | if (StringUtils.isNotBlank(userInfo.getPassword()) && userInfo.getPassword().length() > 0) { | ||||
| PasswordHelper passwordHelper = new PasswordHelper(); | PasswordHelper passwordHelper = new PasswordHelper(); | ||||
| passwordHelper.encryptPassword(userInfo); | passwordHelper.encryptPassword(userInfo); | ||||
| @@ -251,7 +251,7 @@ public class MallUserInfoController extends BaseController { | |||||
| } | } | ||||
| MallUserInfo updateUserInfo = new MallUserInfo(); | MallUserInfo updateUserInfo = new MallUserInfo(); | ||||
| updateUserInfo.setId(userInfo.getId()); | updateUserInfo.setId(userInfo.getId()); | ||||
| updateUserInfo.updateTenantInfo(getTenantInfo()); | |||||
| updateUserInfo.updateTenantInfo(currentUser); | |||||
| updateUserInfo.setStatus(userInfo.getStatus()); | updateUserInfo.setStatus(userInfo.getStatus()); | ||||
| userInfoService.saveOrUpdate(userInfo); | userInfoService.saveOrUpdate(userInfo); | ||||
| return new ResultData(); | return new ResultData(); | ||||
| @@ -332,7 +332,7 @@ public class MallUserInfoController extends BaseController { | |||||
| } | } | ||||
| WxMsgValidationcode wxMsgValidationcode = new WxMsgValidationcode(); | WxMsgValidationcode wxMsgValidationcode = new WxMsgValidationcode(); | ||||
| wxMsgValidationcode.setTenantId(user.getTenantId()); | |||||
| wxMsgValidationcode.updateTenantInfo(user); | |||||
| wxMsgValidationcode.setPhone(user.getPhone()); | wxMsgValidationcode.setPhone(user.getPhone()); | ||||
| wxMsgValidationcode.setType(type); | wxMsgValidationcode.setType(type); | ||||
| return wxMsgValidationcodeService.sendvalidationcode(wxMsgValidationcode); | return wxMsgValidationcodeService.sendvalidationcode(wxMsgValidationcode); | ||||
| @@ -9,6 +9,7 @@ import com.iformall.domain.po.MallPermission; | |||||
| import com.iformall.domain.po.MallRole; | import com.iformall.domain.po.MallRole; | ||||
| import com.iformall.domain.po.MallRolePermission; | import com.iformall.domain.po.MallRolePermission; | ||||
| import com.iformall.domain.po.MallUserInfo; | import com.iformall.domain.po.MallUserInfo; | ||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.enums.EnumMenuType; | import com.iformall.enums.EnumMenuType; | ||||
| import com.iformall.enums.EnumPermissionType; | import com.iformall.enums.EnumPermissionType; | ||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| @@ -157,7 +157,7 @@ public class WechatLoginController extends BaseController { | |||||
| response.addCookie(unameCookie); | response.addCookie(unameCookie); | ||||
| MallUserAction action = new MallUserAction(); | MallUserAction action = new MallUserAction(); | ||||
| action.setTenantId(info.getTenantId()); | |||||
| action.updateTenantInfo(info); | |||||
| action.setType(EnumMallUserAction.CONTROLLER.getCode()); | action.setType(EnumMallUserAction.CONTROLLER.getCode()); | ||||
| action.setIp(ipaddress); | action.setIp(ipaddress); | ||||
| action.setUserId(info.getId()); | action.setUserId(info.getId()); | ||||
| @@ -292,7 +292,7 @@ public class WechatLoginController extends BaseController { | |||||
| response.addCookie(unameCookie); | response.addCookie(unameCookie); | ||||
| MallUserAction action = new MallUserAction(); | MallUserAction action = new MallUserAction(); | ||||
| action.setTenantId(info.getTenantId()); | |||||
| action.updateTenantInfo(info); | |||||
| action.setType(EnumMallUserAction.CONTROLLER.getCode()); | action.setType(EnumMallUserAction.CONTROLLER.getCode()); | ||||
| action.setIp(ipaddress); | action.setIp(ipaddress); | ||||
| action.setUserId(info.getId()); | action.setUserId(info.getId()); | ||||
| @@ -1,13 +1,9 @@ | |||||
| package com.iformall.controller.sys; | package com.iformall.controller.sys; | ||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.Result; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.controller.base.BaseController; | import com.iformall.controller.base.BaseController; | ||||
| import com.iformall.domain.po.WxAdminLog; | import com.iformall.domain.po.WxAdminLog; | ||||
| import com.iformall.service.WxAdminLogService; | import com.iformall.service.WxAdminLogService; | ||||
| import io.swagger.annotations.ApiImplicitParam; | |||||
| import io.swagger.annotations.ApiImplicitParams; | |||||
| import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| @@ -26,8 +22,7 @@ public class WxAdminLogController extends BaseController { | |||||
| @PostMapping("pvlog") | @PostMapping("pvlog") | ||||
| public ResultData pvLog(@RequestBody WxAdminLog wxAdminLog) { | public ResultData pvLog(@RequestBody WxAdminLog wxAdminLog) { | ||||
| logger.debug("[" + getIpAddr() + "] WxAdminLogController::pvLog"); | logger.debug("[" + getIpAddr() + "] WxAdminLogController::pvLog"); | ||||
| String tenantId = getTenantId(); | |||||
| wxAdminLog.setTenantId(tenantId); | |||||
| wxAdminLog.updateTenantInfo(getTenantInfo()); | |||||
| wxAdminLogService.saveLogCount(wxAdminLog); | wxAdminLogService.saveLogCount(wxAdminLog); | ||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @@ -3,6 +3,7 @@ package com.iformall.controller.sys; | |||||
| import com.iformall.annotation.SystemControllerLog; | import com.iformall.annotation.SystemControllerLog; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.controller.base.BaseController; | import com.iformall.controller.base.BaseController; | ||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.domain.po.WxBusiness; | import com.iformall.domain.po.WxBusiness; | ||||
| import com.iformall.domain.po.WxSubBusiness; | import com.iformall.domain.po.WxSubBusiness; | ||||
| import com.iformall.domain.vo.WxBusinessDataVo; | import com.iformall.domain.vo.WxBusinessDataVo; | ||||
| @@ -42,7 +43,7 @@ public class WxBusinessController extends BaseController { | |||||
| @SystemControllerLog(description = "业态-全列表") | @SystemControllerLog(description = "业态-全列表") | ||||
| public ResultData listAll() { | public ResultData listAll() { | ||||
| logger.debug("[" + getIpAddr() + "] WxBusinessController::getList"); | logger.debug("[" + getIpAddr() + "] WxBusinessController::getList"); | ||||
| final List<WxBusiness> busList = wxBusinessService.findListAll(getTenantId(),null); | |||||
| final List<WxBusiness> busList = wxBusinessService.findListAll(getTenantInfo(),null); | |||||
| return new ResultData(busList); | return new ResultData(busList); | ||||
| } | } | ||||
| @@ -67,7 +67,6 @@ public class WxImportTemplateController extends BaseController { | |||||
| final MallUserInfo user = getUser(); | final MallUserInfo user = getUser(); | ||||
| String userId = typeStr + "_" + user.getId(); | String userId = typeStr + "_" + user.getId(); | ||||
| String importKey = Constant.importMemPrev + userId; | String importKey = Constant.importMemPrev + userId; | ||||
| final String tenantId = getTenantId(); | |||||
| //查询当前用户得到的值是否为空,为空继续,不为空,返回模板正在导入 | //查询当前用户得到的值是否为空,为空继续,不为空,返回模板正在导入 | ||||
| Boolean allCount = stringRedisTemplate.opsForHash().hasKey(importKey, "allCount"); | Boolean allCount = stringRedisTemplate.opsForHash().hasKey(importKey, "allCount"); | ||||
| @@ -21,13 +21,13 @@ | |||||
| <result column="press_current_value" jdbcType="INTEGER" property="pressCurrentValue"/> | <result column="press_current_value" jdbcType="INTEGER" property="pressCurrentValue"/> | ||||
| <result column="order_group_id" jdbcType="BIGINT" property="orderGroupId"/> | <result column="order_group_id" jdbcType="BIGINT" property="orderGroupId"/> | ||||
| <result column="form_id" jdbcType="VARCHAR" property="formId"/> | <result column="form_id" jdbcType="VARCHAR" property="formId"/> | ||||
| <result column="real_payment" jdbcType="INTEGER" property="realPayment"/> | |||||
| <result column="total_payment" jdbcType="INTEGER" property="totalPayment"/> | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`order_number`,`tenant_id`,`c_user_id`,`coupon_channel_id`,`product_id`,`type`,`payment_type`,`payment`,`payment_time`,`order_status`,`create_date`,`update_date`,`detail`, | `id`,`order_number`,`tenant_id`,`c_user_id`,`coupon_channel_id`,`product_id`,`type`,`payment_type`,`payment`,`payment_time`,`order_status`,`create_date`,`update_date`,`detail`, | ||||
| `press_end_date`,`press_current_num`,`press_current_value`,`order_group_id`,`form_id`,`real_payment` | |||||
| `press_end_date`,`press_current_num`,`press_current_value`,`order_group_id`,`form_id`,`total_payment` | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||