| @@ -4,14 +4,11 @@ import com.alibaba.fastjson.JSON; | |||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| import com.iformall.common.InvestResultData; | import com.iformall.common.InvestResultData; | ||||
| import com.iformall.controller.base.BaseController; | import com.iformall.controller.base.BaseController; | ||||
| import com.iformall.domain.po.WxUserDataRule; | |||||
| import com.iformall.domain.vo.invest.InvestUserContext; | import com.iformall.domain.vo.invest.InvestUserContext; | ||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.service.WxUserDataRuleService; | |||||
| import com.iformall.service.invest.InvestHelper; | import com.iformall.service.invest.InvestHelper; | ||||
| import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.web.bind.WebDataBinder; | import org.springframework.web.bind.WebDataBinder; | ||||
| import org.springframework.web.bind.annotation.InitBinder; | import org.springframework.web.bind.annotation.InitBinder; | ||||
| @@ -23,9 +20,6 @@ import java.util.function.Function; | |||||
| @Slf4j | @Slf4j | ||||
| public class InvestBaseController extends BaseController { | public class InvestBaseController extends BaseController { | ||||
| @Autowired | |||||
| private WxUserDataRuleService wxUserDataRuleService; | |||||
| @InitBinder | @InitBinder | ||||
| public void InitBinder(WebDataBinder dataBinder) { | public void InitBinder(WebDataBinder dataBinder) { | ||||
| super.InitBinder(dataBinder); | super.InitBinder(dataBinder); | ||||
| @@ -39,6 +33,7 @@ public class InvestBaseController extends BaseController { | |||||
| public <R, T> InvestResultData<R> execute(T params, Function<T, R> function) { | public <R, T> InvestResultData<R> execute(T params, Function<T, R> function) { | ||||
| try { | try { | ||||
| log.debug("[" + getIpAddr() + "] request , params : {}", JSON.toJSONString(params)); | log.debug("[" + getIpAddr() + "] request , params : {}", JSON.toJSONString(params)); | ||||
| setUserRule(); | |||||
| InvestUserContext.setUser(getUser()); | InvestUserContext.setUser(getUser()); | ||||
| R r = function.apply(params); | R r = function.apply(params); | ||||
| return new InvestResultData(r); | return new InvestResultData(r); | ||||
| @@ -57,12 +52,8 @@ public class InvestBaseController extends BaseController { | |||||
| } | } | ||||
| } | } | ||||
| private void setDataRule() { | |||||
| WxUserDataRule userDataRule = wxUserDataRuleService.findByUserId(getUserId()); | |||||
| if (userDataRule == null) { | |||||
| log.info("用户的数据权限未配置"); | |||||
| } | |||||
| EnumInvestUserType investUserType = EnumInvestUserType.getEnum(userDataRule.getType()) ; | |||||
| private void setUserRule() { | |||||
| EnumInvestUserType investUserType = EnumInvestUserType.getEnum(getUser().getInvestRule()) ; | |||||
| InvestUserContext.setInvestUserType(investUserType); | InvestUserContext.setInvestUserType(investUserType); | ||||
| } | } | ||||
| @@ -26,10 +26,10 @@ public class InvestController extends InvestBaseController { | |||||
| private InvestBizService bizService ; | private InvestBizService bizService ; | ||||
| /** | /** | ||||
| * 用户列表 | |||||
| * 招商人员列表 | |||||
| */ | */ | ||||
| @ApiOperation("用户列表") | |||||
| @SystemControllerLog(description = "用户列表") | |||||
| @ApiOperation("招商人员列表") | |||||
| @SystemControllerLog(description = "招商人员列表") | |||||
| @PostMapping("/users") | @PostMapping("/users") | ||||
| public InvestResultData<Collection<MallUserInfo>> userList() { | public InvestResultData<Collection<MallUserInfo>> userList() { | ||||
| return execute(null, p -> bizService.queryUserList()); | return execute(null, p -> bizService.queryUserList()); | ||||
| @@ -41,6 +41,8 @@ public class MallUserInfo extends BaseEntity { | |||||
| private Integer status; | private Integer status; | ||||
| @io.swagger.annotations.ApiModelProperty(value="0 不是超管 1是超管",name="isAdmin") | @io.swagger.annotations.ApiModelProperty(value="0 不是超管 1是超管",name="isAdmin") | ||||
| private Integer isAdmin; | private Integer isAdmin; | ||||
| @io.swagger.annotations.ApiModelProperty(value="招商用户角色",name="investRule") | |||||
| private Integer investRule; | |||||
| @io.swagger.annotations.ApiModelProperty(value="昵称",name="nickName") | @io.swagger.annotations.ApiModelProperty(value="昵称",name="nickName") | ||||
| private String nickName; | private String nickName; | ||||
| @@ -2,8 +2,8 @@ package com.iformall.enums; | |||||
| public enum EnumInvestUserType { | public enum EnumInvestUserType { | ||||
| MANAGER(301, "招商管理人员"), | |||||
| USER(302, "招商人员"), | |||||
| MANAGER(0, "招商管理人员"), | |||||
| USER(1, "招商人员"), | |||||
| ; | ; | ||||
| public static EnumInvestUserType getEnum(Integer code) { | public static EnumInvestUserType getEnum(Integer code) { | ||||
| @@ -1,5 +1,6 @@ | |||||
| package com.iformall.service; | package com.iformall.service; | ||||
| import com.baomidou.mybatisplus.core.conditions.Wrapper; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.MallUserInfo; | import com.iformall.domain.po.MallUserInfo; | ||||
| @@ -83,6 +84,13 @@ public interface MallUserInfoService { | |||||
| */ | */ | ||||
| List<MallUserInfo> getByIds(Collection<? extends Serializable> ids); | List<MallUserInfo> getByIds(Collection<? extends Serializable> ids); | ||||
| /** | |||||
| * | |||||
| * @param queryWrapper | |||||
| * @return | |||||
| */ | |||||
| List<MallUserInfo> selectList(Wrapper<MallUserInfo> queryWrapper) ; | |||||
| /* | /* | ||||
| * 保存或更新实体 | * 保存或更新实体 | ||||
| * | * | ||||
| @@ -1,5 +1,6 @@ | |||||
| package com.iformall.service.impl; | package com.iformall.service.impl; | ||||
| import com.baomidou.mybatisplus.core.conditions.Wrapper; | |||||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||||
| import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; | ||||
| import com.github.pagehelper.PageHelper; | import com.github.pagehelper.PageHelper; | ||||
| @@ -74,6 +75,11 @@ public class MallUserInfoServiceImpl implements MallUserInfoService { | |||||
| return mallUserInfoMapper.selectBatchIds(ids) ; | return mallUserInfoMapper.selectBatchIds(ids) ; | ||||
| } | } | ||||
| @Override | |||||
| public List<MallUserInfo> selectList(Wrapper<MallUserInfo> queryWrapper) { | |||||
| return mallUserInfoMapper.selectList(queryWrapper) ; | |||||
| } | |||||
| @Override | @Override | ||||
| public MallUserInfo getByBOpenId(String openId, String tenantId) { | public MallUserInfo getByBOpenId(String openId, String tenantId) { | ||||
| return mallUserInfoMapper.selectByBOpenId(openId, tenantId); | return mallUserInfoMapper.selectByBOpenId(openId, tenantId); | ||||
| @@ -21,6 +21,10 @@ public interface InvestBizService { | |||||
| InvestPageResult<InvestMessageEntity> queryPageMessage(InvestMessageQuery params) ; | InvestPageResult<InvestMessageEntity> queryPageMessage(InvestMessageQuery params) ; | ||||
| /** | |||||
| * 获取招商用户 | |||||
| * @return | |||||
| */ | |||||
| Collection<MallUserInfo> queryUserList() ; | Collection<MallUserInfo> queryUserList() ; | ||||
| boolean saveCustomerAndDemand(InvestDemandDto customerDemandDto) ; | boolean saveCustomerAndDemand(InvestDemandDto customerDemandDto) ; | ||||
| @@ -13,5 +13,6 @@ import com.iformall.domain.po.invest.InvestDemandEntity; | |||||
| */ | */ | ||||
| public interface InvestDemandService extends IService<InvestDemandEntity>,InvestBaseService<InvestDemandEntity> { | public interface InvestDemandService extends IService<InvestDemandEntity>,InvestBaseService<InvestDemandEntity> { | ||||
| InvestDemandEntity getByCustomerId(Long customerId) ; | |||||
| } | } | ||||
| @@ -15,7 +15,6 @@ import com.iformall.enums.EnumNegotiationType; | |||||
| import com.iformall.service.MallUserInfoService; | import com.iformall.service.MallUserInfoService; | ||||
| import com.iformall.service.WxBrandService; | import com.iformall.service.WxBrandService; | ||||
| import com.iformall.service.WxShopService; | import com.iformall.service.WxShopService; | ||||
| import com.iformall.service.WxUserDataRuleService; | |||||
| import com.iformall.service.invest.*; | import com.iformall.service.invest.*; | ||||
| import org.apache.commons.collections.CollectionUtils; | import org.apache.commons.collections.CollectionUtils; | ||||
| import org.apache.commons.collections.MapUtils; | import org.apache.commons.collections.MapUtils; | ||||
| @@ -54,8 +53,6 @@ public class InvestBizServiceImpl implements InvestBizService { | |||||
| private WxBrandService brandService; | private WxBrandService brandService; | ||||
| @Autowired | @Autowired | ||||
| private MallUserInfoService userInfoService; | private MallUserInfoService userInfoService; | ||||
| @Autowired | |||||
| private WxUserDataRuleService wxUserDataRuleService; | |||||
| @Override | @Override | ||||
| public InvestPageResult<InvestDemandVo> queryPageDemand(InvestDemandQuery params) { | public InvestPageResult<InvestDemandVo> queryPageDemand(InvestDemandQuery params) { | ||||
| @@ -145,7 +142,7 @@ public class InvestBizServiceImpl implements InvestBizService { | |||||
| Collection<WxShop> shops = shopService.getByIds(getIds(taskList, InvestTaskEntity::getTargetId)); | Collection<WxShop> shops = shopService.getByIds(getIds(taskList, InvestTaskEntity::getTargetId)); | ||||
| Map<Long, WxShop> shopsMap = getMap(shops, WxShop::getId); | Map<Long, WxShop> shopsMap = getMap(shops, WxShop::getId); | ||||
| //3、用户信息 | //3、用户信息 | ||||
| Map<Long, MallUserInfo> usersMap = getMap(userInfoService.findList(null), MallUserInfo::getId); | |||||
| Map<Long, MallUserInfo> usersMap = getMap(this.queryUserList(), MallUserInfo::getId); | |||||
| List<InvestTaskVo> resultList = new ArrayList<>(); | List<InvestTaskVo> resultList = new ArrayList<>(); | ||||
| for (InvestTaskEntity item : taskList) { | for (InvestTaskEntity item : taskList) { | ||||
| WxShop shop = shopsMap.get(item.getTargetId()); | WxShop shop = shopsMap.get(item.getTargetId()); | ||||
| @@ -198,7 +195,7 @@ public class InvestBizServiceImpl implements InvestBizService { | |||||
| Collection<InvestFollowRecordEntity> recordList = recordPage.getRecords(); | Collection<InvestFollowRecordEntity> recordList = recordPage.getRecords(); | ||||
| //2、用户信息 | //2、用户信息 | ||||
| Map<Long, MallUserInfo> usersMap = getMap(userInfoService.findList(null), MallUserInfo::getId); | |||||
| Map<Long, MallUserInfo> usersMap = getMap(this.queryUserList(), MallUserInfo::getId); | |||||
| //3、客户 | //3、客户 | ||||
| Collection<InvestCustomerEntity> customers = customerService.listByIds(getIds(recordList, InvestFollowRecordEntity::getCustomerId)); | Collection<InvestCustomerEntity> customers = customerService.listByIds(getIds(recordList, InvestFollowRecordEntity::getCustomerId)); | ||||
| @@ -295,11 +292,9 @@ public class InvestBizServiceImpl implements InvestBizService { | |||||
| @Override | @Override | ||||
| public List<MallUserInfo> queryUserList() { | public List<MallUserInfo> queryUserList() { | ||||
| WxUserDataRule query = new WxUserDataRule(); | |||||
| query.setTenantId(InvestUserContext.getUser().getTenantId()); | |||||
| query.setType(EnumInvestUserType.USER.getCode()); | |||||
| List<WxUserDataRule> ruleList = wxUserDataRuleService.list(query); | |||||
| return userInfoService.getByIds(getIds(ruleList, WxUserDataRule::getUserId)); | |||||
| LambdaQueryWrapper<MallUserInfo> queryWrapper = new LambdaQueryWrapper<>(); | |||||
| queryWrapper.eq(MallUserInfo::getInvestRule, EnumInvestUserType.USER.getCode()); | |||||
| return userInfoService.selectList(queryWrapper); | |||||
| } | } | ||||
| @Transactional(rollbackFor = Exception.class) | @Transactional(rollbackFor = Exception.class) | ||||
| @@ -330,11 +325,11 @@ public class InvestBizServiceImpl implements InvestBizService { | |||||
| @Override | @Override | ||||
| public InvestDemandVo findDemandById(Long id) { | public InvestDemandVo findDemandById(Long id) { | ||||
| InvestDemandEntity demandEntity = demandService.getByIdNotNull(id); | |||||
| InvestCustomerEntity customerEntity = customerService.getByIdNotNull(demandEntity.getCustomerId()); | |||||
| InvestCustomerEntity customerEntity = customerService.getByIdNotNull(id); | |||||
| InvestDemandEntity demandEntity = demandService.getByCustomerId(customerEntity.getId()); | |||||
| WxBrand brand = brandService.getById(customerEntity.getBrandId()); | WxBrand brand = brandService.getById(customerEntity.getBrandId()); | ||||
| WxShop shop = shopService.getById(demandEntity.getTargetId()); | WxShop shop = shopService.getById(demandEntity.getTargetId()); | ||||
| Map<Long, MallUserInfo> usersMap = getMap(userInfoService.findList(null), MallUserInfo::getId); | |||||
| Map<Long, MallUserInfo> usersMap = getMap(this.queryUserList(), MallUserInfo::getId); | |||||
| return buildDemindItem(demandEntity, customerEntity, brand, shop, usersMap); | return buildDemindItem(demandEntity, customerEntity, brand, shop, usersMap); | ||||
| } | } | ||||
| @@ -342,7 +337,7 @@ public class InvestBizServiceImpl implements InvestBizService { | |||||
| public InvestTaskVo findTaskById(Long id) { | public InvestTaskVo findTaskById(Long id) { | ||||
| InvestTaskEntity taskEntity = taskService.getByIdNotNull(id); | InvestTaskEntity taskEntity = taskService.getByIdNotNull(id); | ||||
| WxShop shop = shopService.getById(taskEntity.getTargetId()); | WxShop shop = shopService.getById(taskEntity.getTargetId()); | ||||
| Map<Long, MallUserInfo> usersMap = getMap(userInfoService.findList(null), MallUserInfo::getId); | |||||
| Map<Long, MallUserInfo> usersMap = getMap(this.queryUserList(), MallUserInfo::getId); | |||||
| return buildTaskItem(taskEntity, shop, usersMap); | return buildTaskItem(taskEntity, shop, usersMap); | ||||
| } | } | ||||
| @@ -427,7 +422,7 @@ public class InvestBizServiceImpl implements InvestBizService { | |||||
| @Override | @Override | ||||
| public InvestFollowRecordVo findFollowRecordById(Long id) { | public InvestFollowRecordVo findFollowRecordById(Long id) { | ||||
| InvestFollowRecordEntity followRecordEntity = followRecordService.getByIdNotNull(id); | InvestFollowRecordEntity followRecordEntity = followRecordService.getByIdNotNull(id); | ||||
| Map<Long, MallUserInfo> usersMap = getMap(userInfoService.findList(null), MallUserInfo::getId); | |||||
| Map<Long, MallUserInfo> usersMap = getMap(this.queryUserList(), MallUserInfo::getId); | |||||
| InvestCustomerEntity customerEntity = customerService.getByIdNotNull(followRecordEntity.getCustomerId()); | InvestCustomerEntity customerEntity = customerService.getByIdNotNull(followRecordEntity.getCustomerId()); | ||||
| WxBrand brand = brandService.getById(customerEntity.getBrandId()); | WxBrand brand = brandService.getById(customerEntity.getBrandId()); | ||||
| return buildFollowRecordItem(usersMap, followRecordEntity, customerEntity, brand); | return buildFollowRecordItem(usersMap, followRecordEntity, customerEntity, brand); | ||||
| @@ -1,6 +1,7 @@ | |||||
| package com.iformall.service.invest.impl; | package com.iformall.service.invest.impl; | ||||
| import com.baomidou.mybatisplus.core.conditions.Wrapper; | import com.baomidou.mybatisplus.core.conditions.Wrapper; | ||||
| import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |||||
| import com.iformall.common.TableLog; | import com.iformall.common.TableLog; | ||||
| import com.iformall.domain.po.invest.InvestDemandEntity; | import com.iformall.domain.po.invest.InvestDemandEntity; | ||||
| import com.iformall.enums.EnumFollowType; | import com.iformall.enums.EnumFollowType; | ||||
| @@ -82,4 +83,12 @@ public class InvestDemandServiceImpl extends InvestBaseServiceImpl<InvestDemandD | |||||
| notSupport(); | notSupport(); | ||||
| return false ; | return false ; | ||||
| } | } | ||||
| @Override | |||||
| public InvestDemandEntity getByCustomerId(Long customerId) { | |||||
| if(Objects.isNull(customerId)) { | |||||
| return null ; | |||||
| } | |||||
| return getOne(new LambdaUpdateWrapper<InvestDemandEntity>().eq(InvestDemandEntity::getCustomerId,customerId)) ; | |||||
| } | |||||
| } | } | ||||
| @@ -11,6 +11,7 @@ | |||||
| <result column="last_login_time" jdbcType="TIMESTAMP" property="lastLoginTime"/> | <result column="last_login_time" jdbcType="TIMESTAMP" property="lastLoginTime"/> | ||||
| <result column="status" jdbcType="INTEGER" property="status"/> | <result column="status" jdbcType="INTEGER" property="status"/> | ||||
| <result column="is_admin" jdbcType="INTEGER" property="isAdmin"/> | <result column="is_admin" jdbcType="INTEGER" property="isAdmin"/> | ||||
| <result column="invest_rule" jdbcType="INTEGER" property="investRule"/> | |||||
| <result column="nick_name" jdbcType="VARCHAR" property="nickName"/> | <result column="nick_name" jdbcType="VARCHAR" property="nickName"/> | ||||
| <result column="phone" jdbcType="VARCHAR" property="phone"/> | <result column="phone" jdbcType="VARCHAR" property="phone"/> | ||||
| <result column="bopen_id" jdbcType="VARCHAR" property="bopenId"/> | <result column="bopen_id" jdbcType="VARCHAR" property="bopenId"/> | ||||
| @@ -19,11 +20,11 @@ | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allSafeColumns"> | <sql id="allSafeColumns"> | ||||
| `id`,`tenant_id`,`username`,`name`,`password`,`create_time`,`last_login_time`,`status`,`is_admin`,`nick_name`,`phone`,`web_open_id`,email | |||||
| `id`,`tenant_id`,`username`,`name`,`password`,`create_time`,`last_login_time`,`status`,`is_admin`,`invest_rule`,`nick_name`,`phone`,`web_open_id`,email | |||||
| </sql> | </sql> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`tenant_id`,`username`,`name`,`password`,`create_time`,`last_login_time`,`status`,`is_admin`,`nick_name`,`phone`, | |||||
| `id`,`tenant_id`,`username`,`name`,`password`,`create_time`,`last_login_time`,`status`,`is_admin`,`invest_rule`,`nick_name`,`phone`, | |||||
| `bopen_id`,`web_open_id`,email | `bopen_id`,`web_open_id`,email | ||||
| </sql> | </sql> | ||||
| @@ -68,6 +69,10 @@ | |||||
| <if test=" null != isAdmin "> | <if test=" null != isAdmin "> | ||||
| and `is_admin` = #{isAdmin} | and `is_admin` = #{isAdmin} | ||||
| </if> | </if> | ||||
| <if test=" null != investRule "> | |||||
| and `invest_rule` = #{investRule} | |||||
| </if> | |||||
| <if test=" null != phone and ''!=phone"> | <if test=" null != phone and ''!=phone"> | ||||
| and `phone` = #{phone} | and `phone` = #{phone} | ||||
| </if> | </if> | ||||
| @@ -262,6 +267,7 @@ | |||||
| <result column="last_login_time" jdbcType="TIMESTAMP" property="lastLoginTime"/> | <result column="last_login_time" jdbcType="TIMESTAMP" property="lastLoginTime"/> | ||||
| <result column="status" jdbcType="INTEGER" property="status"/> | <result column="status" jdbcType="INTEGER" property="status"/> | ||||
| <result column="is_admin" jdbcType="INTEGER" property="isAdmin"/> | <result column="is_admin" jdbcType="INTEGER" property="isAdmin"/> | ||||
| <result column="invest_rule" jdbcType="INTEGER" property="investRule"/> | |||||
| <result column="nick_name" jdbcType="VARCHAR" property="nickName"/> | <result column="nick_name" jdbcType="VARCHAR" property="nickName"/> | ||||
| <result column="phone" jdbcType="VARCHAR" property="phone"/> | <result column="phone" jdbcType="VARCHAR" property="phone"/> | ||||
| <result column="bopen_id" jdbcType="VARCHAR" property="bopenId"/> | <result column="bopen_id" jdbcType="VARCHAR" property="bopenId"/> | ||||
| @@ -275,12 +281,12 @@ | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allSafeVColumns"> | <sql id="allSafeVColumns"> | ||||
| u.`id`,u.`tenant_id`,u.`username`,u.`name`,u.`password`,u.`create_time`,u.`last_login_time`,u.`status`,u.`is_admin`,u.`nick_name`,u.`phone`, | |||||
| u.`id`,u.`tenant_id`,u.`username`,u.`name`,u.`password`,u.`create_time`,u.`last_login_time`,u.`status`,u.`is_admin`,u.`invest_rule`,u.`nick_name`,u.`phone`, | |||||
| m.`name` as mall_name, m.`group` as mall_group, m.`img_url`, m.`img_url_h`,email | m.`name` as mall_name, m.`group` as mall_group, m.`img_url`, m.`img_url_h`,email | ||||
| </sql> | </sql> | ||||
| <sql id="allVColumns"> | <sql id="allVColumns"> | ||||
| u.`id`,u.`tenant_id`,u.`username`,u.`name`,u.`password`,u.`create_time`,u.`last_login_time`,u.`status`,u.`is_admin`,u.`nick_name`,u.`phone`, | |||||
| u.`id`,u.`tenant_id`,u.`username`,u.`name`,u.`password`,u.`create_time`,u.`last_login_time`,u.`status`,u.`is_admin`,u.`invest_rule`,u.`nick_name`,u.`phone`, | |||||
| u.`bopen_id`,u.`web_open_id`, | u.`bopen_id`,u.`web_open_id`, | ||||
| m.`name` as mall_name, m.`group` as mall_group, m.`img_url`, m.`img_url_h`,email | m.`name` as mall_name, m.`group` as mall_group, m.`img_url`, m.`img_url_h`,email | ||||
| </sql> | </sql> | ||||