| | |
| | | @ApiModelProperty(value = "密码") |
| | | private String password; |
| | | |
| | | @ApiModelProperty(value = "省市列表") |
| | | @ApiModelProperty(value = "负责区域") |
| | | private List<TCrmBranchArea> responsibleBranchAreas; |
| | | |
| | | @ApiModelProperty(value = "管辖区域") |
| | | private List<TCrmBranchArea> branchAreas; |
| | | |
| | | @ApiModelProperty(value = "职位薪资列表") |
| | |
| | | @Excel(name = "剩余积分数", width = 20,needMerge = true) |
| | | private Integer userPoints; |
| | | |
| | | @Excel(name = "负责区域", width = 20,needMerge = true) |
| | | private String responsibleAreaNames; |
| | | |
| | | @Excel(name = "管辖区域", width = 20,needMerge = true) |
| | | private String areaNames; |
| | | |
| | |
| | | @TableField("status") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "类型 1=省公司负责人 2=地区经理 3=城市经理") |
| | | @TableField("person_type") |
| | | private Integer personType; |
| | | |
| | | @ApiModelProperty(value = "关联上级人员id") |
| | | @TableField("correlation_person_id") |
| | | private Long correlationPersonId; |
| | | |
| | | } |
| | |
| | | @TableField("city_code") |
| | | private String cityCode; |
| | | |
| | | @ApiModelProperty(value = "区县名称") |
| | | @TableField("district_name") |
| | | private String districtName; |
| | | |
| | | @ApiModelProperty(value = "区县code") |
| | | @TableField("district_code") |
| | | private String districtCode; |
| | | |
| | | @ApiModelProperty(value = "类型 1=负责区域 2=管辖区域") |
| | | @TableField("area_type") |
| | | private Integer areaType; |
| | | |
| | | } |
| | |
| | | return R.fail(dto.getPhone()+"-账号已存在"); |
| | | } |
| | | List<TCrmBranchArea> branchAreas = dto.getBranchAreas(); |
| | | // 判断是否已存在这些区域 |
| | | if(!CollectionUtils.isEmpty(branchAreas)){ |
| | | List<String> branchAreaCityCodes = branchAreas.stream().map(TCrmBranchArea::getCityCode).collect(Collectors.toList()); |
| | | |
| | | if(dto.getPersonType() != 1 && CollectionUtils.isEmpty(branchAreas)){ |
| | | return R.fail("请选择管辖区域"); |
| | | } |
| | | List<TCrmBranchArea> responsibleBranchAreas = dto.getResponsibleBranchAreas(); |
| | | if(dto.getPersonType() != 3 && CollectionUtils.isEmpty(responsibleBranchAreas)){ |
| | | return R.fail("请选择负责区域"); |
| | | } |
| | | if(dto.getPersonType() != 3){ |
| | | // 判断是否已存在这些区域 |
| | | List<String> branchAreaCityCodes = responsibleBranchAreas.stream().map(TCrmBranchArea::getCityCode).collect(Collectors.toList()); |
| | | if(!CollectionUtils.isEmpty(branchAreaCityCodes)){ |
| | | long count = crmBranchAreaService.count(Wrappers.lambdaQuery(TCrmBranchArea.class).in(TCrmBranchArea::getCityCode, branchAreaCityCodes)); |
| | | long count = crmBranchAreaService.count(Wrappers.lambdaQuery(TCrmBranchArea.class) |
| | | .in(TCrmBranchArea::getCityCode, branchAreaCityCodes) |
| | | .eq(TCrmBranchArea::getAreaType,1)); |
| | | if(count > 0){ |
| | | return R.fail("区域已存在"); |
| | | return R.fail("负责区域已存在"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | this.save(dto); |
| | | // 添加区域 |
| | | branchAreas.forEach(t -> t.setBranchId(dto.getId())); |
| | | for (TCrmBranchArea branchArea : branchAreas) { |
| | | branchArea.setBranchId(dto.getId()); |
| | | branchArea.setAreaType(2); |
| | | } |
| | | for (TCrmBranchArea responsibleBranchArea : responsibleBranchAreas) { |
| | | responsibleBranchArea.setBranchId(dto.getId()); |
| | | responsibleBranchArea.setAreaType(1); |
| | | } |
| | | branchAreas.addAll(responsibleBranchAreas); |
| | | crmBranchAreaService.saveBatch(branchAreas); |
| | | // 添加职位薪资 |
| | | List<TCrmBranchSalary> branchSalaries = dto.getBranchSalaries(); |
| | |
| | | } |
| | | SysUser user = sysUserService.selectUserById(dto.getUserId()); |
| | | List<TCrmBranchArea> branchAreas = dto.getBranchAreas(); |
| | | // 判断是否已存在这些区域 |
| | | if(!CollectionUtils.isEmpty(branchAreas)){ |
| | | List<String> branchAreaCityCodes = branchAreas.stream().map(TCrmBranchArea::getCityCode).collect(Collectors.toList()); |
| | | long count = crmBranchAreaService.count(Wrappers.lambdaQuery(TCrmBranchArea.class).in(TCrmBranchArea::getCityCode, branchAreaCityCodes) |
| | | .ne(TCrmBranchArea::getBranchId, dto.getId())); |
| | | if(count > 0){ |
| | | return R.fail("区域存在重复"); |
| | | if(dto.getPersonType() != 1 && CollectionUtils.isEmpty(branchAreas)){ |
| | | return R.fail("请选择管辖区域"); |
| | | } |
| | | List<TCrmBranchArea> responsibleBranchAreas = dto.getResponsibleBranchAreas(); |
| | | if(dto.getPersonType() != 3 && CollectionUtils.isEmpty(responsibleBranchAreas)){ |
| | | return R.fail("请选择负责区域"); |
| | | } |
| | | if(dto.getPersonType() != 3){ |
| | | // 判断是否已存在这些区域 |
| | | List<String> branchAreaCityCodes = responsibleBranchAreas.stream().map(TCrmBranchArea::getCityCode).collect(Collectors.toList()); |
| | | if(!CollectionUtils.isEmpty(branchAreaCityCodes)){ |
| | | long count = crmBranchAreaService.count(Wrappers.lambdaQuery(TCrmBranchArea.class) |
| | | .in(TCrmBranchArea::getCityCode, branchAreaCityCodes) |
| | | .eq(TCrmBranchArea::getAreaType,1) |
| | | .ne(TCrmBranchArea::getBranchId, dto.getId())); |
| | | if(count > 0){ |
| | | return R.fail("负责区域已存在"); |
| | | } |
| | | } |
| | | } |
| | | this.updateById(dto); |
| | | // 删除区域 |
| | | crmBranchAreaService.remove(Wrappers.lambdaQuery(TCrmBranchArea.class).eq(TCrmBranchArea::getBranchId, dto.getId())); |
| | | // 添加区域 |
| | | branchAreas.forEach(t -> t.setBranchId(dto.getId())); |
| | | // 添加区域 |
| | | for (TCrmBranchArea branchArea : branchAreas) { |
| | | branchArea.setBranchId(dto.getId()); |
| | | branchArea.setAreaType(2); |
| | | } |
| | | for (TCrmBranchArea responsibleBranchArea : responsibleBranchAreas) { |
| | | responsibleBranchArea.setBranchId(dto.getId()); |
| | | responsibleBranchArea.setAreaType(1); |
| | | } |
| | | branchAreas.addAll(responsibleBranchAreas); |
| | | crmBranchAreaService.saveBatch(branchAreas); |
| | | // 删除职位薪资 |
| | | crmBranchSalaryService.remove(Wrappers.lambdaQuery(TCrmBranchSalary.class).eq(TCrmBranchSalary::getBranchId, dto.getId())); |
| | |
| | | .in(TCrmBranchSalary::getBranchId, branchIds)); |
| | | for (TCrmBranchExport crmBranchExport : list) { |
| | | List<TCrmBranchArea> tCrmBranchAreas = crmBranchAreaList.stream().filter(t -> t.getBranchId().equals(crmBranchExport.getId())).collect(Collectors.toList()); |
| | | // 管辖区域 |
| | | StringBuilder stringBuilder = new StringBuilder(); |
| | | // 特殊区域 |
| | | StringBuilder stringBuilderResponsible = new StringBuilder(); |
| | | for (TCrmBranchArea tCrmBranchArea : tCrmBranchAreas) { |
| | | stringBuilder.append(tCrmBranchArea.getProvinceName()).append("-").append(tCrmBranchArea.getCityName()).append(","); |
| | | if(tCrmBranchArea.getAreaType() == 1){ |
| | | stringBuilderResponsible.append(tCrmBranchArea.getProvinceName()).append("-").append(tCrmBranchArea.getCityName()).append(","); |
| | | }else { |
| | | stringBuilder.append(tCrmBranchArea.getProvinceName()).append("-").append(tCrmBranchArea.getCityName()).append(","); |
| | | } |
| | | } |
| | | // 去除',' |
| | | stringBuilder.deleteCharAt(stringBuilder.length()-1); |
| | | crmBranchExport.setAreaNames(stringBuilder.toString()); |
| | | |
| | | stringBuilderResponsible.deleteCharAt(stringBuilderResponsible.length()-1); |
| | | crmBranchExport.setResponsibleAreaNames(stringBuilderResponsible.toString()); |
| | | // 职位薪资 |
| | | List<TCrmBranchSalary> crmBranchSalariesList = crmBranchSalaries.stream().filter(t -> t.getBranchId().equals(crmBranchExport.getId())).collect(Collectors.toList()); |
| | | crmBranchExport.setCrmBranchSalaries(crmBranchSalariesList); |
| | |
| | | <result column="province_code" property="provinceCode" /> |
| | | <result column="city_name" property="cityName" /> |
| | | <result column="city_code" property="cityCode" /> |
| | | <result column="district_name" property="districtName" /> |
| | | <result column="district_code" property="districtCode" /> |
| | | <result column="area_type" property="areaType" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, branch_id, province_name, province_code, city_name, city_code |
| | | id, branch_id, province_name, province_code, city_name, city_code,district_name, district_code, area_type |
| | | </sql> |
| | | |
| | | </mapper> |
| | |
| | | <result column="points_commission" property="pointsCommission" /> |
| | | <result column="user_points" property="userPoints" /> |
| | | <result column="status" property="status" /> |
| | | <result column="person_type" property="personType" /> |
| | | <result column="correlation_person_id" property="correlationPersonId" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="update_time" property="updateTime" /> |
| | | <result column="create_by" property="createBy" /> |
| | |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, user_id, branch_name, user_name, phone, money_commission, points_commission, user_points, status, create_time, update_time, create_by, update_by, disabled |
| | | id, user_id, branch_name, user_name, phone, money_commission, points_commission, user_points, status, |
| | | person_type, correlation_person_id,create_time, update_time, create_by, update_by, disabled |
| | | </sql> |
| | | <select id="pageList" resultType="com.ruoyi.system.vo.TCrmBranchVO"> |
| | | select id, user_id, branch_name, user_name, phone, money_commission, points_commission, |
| | | user_points, status, create_time, update_time, create_by, update_by, disabled |
| | | user_points, status, person_type, correlation_person_id,create_time, update_time, create_by, update_by, disabled |
| | | from t_crm_branch |
| | | <where> |
| | | <if test="query.branchName != null and query.branchName != ''"> |
| | |
| | | </select> |
| | | <select id="exportList" resultType="com.ruoyi.system.export.TCrmBranchExport"> |
| | | select id, user_id, branch_name, user_name, phone, money_commission, points_commission, |
| | | user_points, status, create_time, update_time, create_by, update_by, disabled |
| | | user_points, status,person_type, correlation_person_id, create_time, update_time, create_by, update_by, disabled |
| | | from t_crm_branch |
| | | <where> |
| | | <if test="query.branchName != null and query.branchName != ''"> |