Merge remote-tracking branch 'origin/main'

# Conflicts:
#	nakadai/src/main/java/com/huoran/nakadai/controller/SupplierClassificationController.java
main
cheney 11 months ago
commit b9c74832e3
  1. 70
      competition/src/main/java/com/huoran/competition/controller/CompetitionClassificationController.java
  2. 4
      competition/src/main/java/com/huoran/competition/controller/CompetitionController.java
  3. 7
      competition/src/main/java/com/huoran/competition/entity/Competition.java
  4. 43
      competition/src/main/java/com/huoran/competition/entity/CompetitionClassification.java
  5. 3
      competition/src/main/java/com/huoran/competition/entity/req/AfterLoginPageCompetitionListReq.java
  6. 7
      competition/src/main/java/com/huoran/competition/entity/vo/CompetitionVO.java
  7. 16
      competition/src/main/java/com/huoran/competition/mapper/CompetitionClassificationMapper.java
  8. 5
      competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionClassificationMapper.xml
  9. 25
      competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionMapper.xml
  10. 16
      competition/src/main/java/com/huoran/competition/service/CompetitionClassificationService.java
  11. 20
      competition/src/main/java/com/huoran/competition/service/impl/CompetitionClassificationServiceImpl.java
  12. 2
      competition/src/test/java/CodeGenerator.java
  13. 3
      nakadai/src/main/java/com/huoran/nakadai/controller/EnterpriseCertificationController.java
  14. 92
      nakadai/src/main/java/com/huoran/nakadai/controller/PlatformTeamAccountController.java
  15. 106
      nakadai/src/main/java/com/huoran/nakadai/controller/SupplierClassificationController.java
  16. 9
      nakadai/src/main/java/com/huoran/nakadai/entity/EnterpriseCertification.java
  17. 5
      nakadai/src/main/java/com/huoran/nakadai/entity/SupplierClassification.java
  18. 1
      nakadai/src/main/java/com/huoran/nakadai/entity/SupplierClassificationConfig.java
  19. 6
      nakadai/src/main/java/com/huoran/nakadai/entity/req/EnterpriseCertificationLIstReq.java
  20. 8
      nakadai/src/main/java/com/huoran/nakadai/entity/req/TeamInfo.java
  21. 35
      nakadai/src/main/java/com/huoran/nakadai/entity/vo/TeamClassificationVO.java
  22. 7
      nakadai/src/main/java/com/huoran/nakadai/mapper/PlatformTeamMapper.java
  23. 2
      nakadai/src/main/java/com/huoran/nakadai/mapper/SupplierClassificationConfigMapper.java
  24. 12
      nakadai/src/main/java/com/huoran/nakadai/mapper/xml/EnterpriseCertificationMapper.xml
  25. 28
      nakadai/src/main/java/com/huoran/nakadai/mapper/xml/PlatformTeamMapper.xml
  26. 3
      nakadai/src/main/java/com/huoran/nakadai/mapper/xml/SupplierClassificationConfigMapper.xml
  27. 8
      nakadai/src/main/java/com/huoran/nakadai/service/PlatformTeamService.java
  28. 3
      nakadai/src/main/java/com/huoran/nakadai/service/SupplierClassificationConfigService.java
  29. 12
      nakadai/src/main/java/com/huoran/nakadai/service/impl/PlatformTeamServiceImpl.java
  30. 4
      nakadai/src/main/java/com/huoran/nakadai/service/impl/SupplierClassificationConfigServiceImpl.java
  31. 6
      nakadai/src/main/java/com/huoran/nakadai/utils/WeChatUtil.java

@ -0,0 +1,70 @@
package com.huoran.competition.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.huoran.api.UserClient;
import com.huoran.common.response.R;
import com.huoran.common.utils.TokenUtils;
import com.huoran.competition.entity.CompetitionClassification;
import com.huoran.competition.service.CompetitionClassificationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
* @描述活动活动分类控制类
* @作者: Rong
* @日期: 2023-12-27
*/
@RestController
@RequestMapping("/competitionClassification")
@Api(value = "活动分类:CompetitionClassificationController", tags = "活动分类")
public class CompetitionClassificationController {
@Autowired
public CompetitionClassificationService service;
@Autowired
private UserClient userClient;
@PostMapping("/categoryList")
@ApiOperation(value = "分类列表", response = CompetitionClassification.class)
public R categoryList() {
List<CompetitionClassification> list = service.list( null);
return R.ok().put("page",list);
}
@PostMapping("/save")
@ApiOperation(value = "自定义新增活动分类", response = CompetitionClassification.class)
public R save(@RequestBody @ApiParam(name = "活动活动分类对象", value = "传入json格式", required = true) CompetitionClassification competitionClassification, HttpServletRequest request) {
String accountId = TokenUtils.getIdByJwtToken(request);
competitionClassification.setAccountId(Integer.valueOf(accountId));
boolean addState = service.save(competitionClassification);
return addState ? R.ok() : R.error("新增失败");
}
@PostMapping("/update")
@ApiOperation(value = "修改活动分类", response = CompetitionClassification.class)
public R update(@RequestBody @ApiParam(name = "活动活动分类对象", value = "传入json格式", required = true) CompetitionClassification competitionClassification, HttpServletRequest request) {
String accountId = TokenUtils.getIdByJwtToken(request);
competitionClassification.setAccountId(Integer.valueOf(accountId));
boolean updateState = service.updateById(competitionClassification);
return updateState ? R.ok() : R.error("编辑失败");
}
@PostMapping("/batchDeletion")
@ApiOperation(value = "批量删除活动分类", response = CompetitionClassification.class)
public R batchDeletion(@ApiParam(name = "ids", value = "主键", required = true) @RequestBody List<Integer> ids) {
boolean delState = service.removeByIds(ids);
return delState ? R.ok() : R.error("删除失败");
}
}

@ -51,6 +51,9 @@ public class CompetitionController {
@Autowired @Autowired
private UserClient userClient; private UserClient userClient;
@Autowired
public CompetitionClassificationService competitionClassificationService;
@Autowired @Autowired
private CompetitionService competitionService; private CompetitionService competitionService;
@ -150,6 +153,7 @@ public class CompetitionController {
public R getCompetition(@ApiParam(name = "competitionId", value = "活动ID", required = true) @RequestParam("competitionId") String competitionId, HttpServletRequest request) { public R getCompetition(@ApiParam(name = "competitionId", value = "活动ID", required = true) @RequestParam("competitionId") String competitionId, HttpServletRequest request) {
String accountId = TokenUtils.getIdByJwtToken(request); String accountId = TokenUtils.getIdByJwtToken(request);
Competition competition = competitionService.getById(competitionId); Competition competition = competitionService.getById(competitionId);
// 查询活动报名表 // 查询活动报名表
QueryWrapper<CompetitionRegistration> wrapper = new QueryWrapper<>(); QueryWrapper<CompetitionRegistration> wrapper = new QueryWrapper<>();
wrapper.eq("competition_id", competitionId); wrapper.eq("competition_id", competitionId);

@ -108,6 +108,9 @@ public class Competition implements Serializable {
@ApiModelProperty(value = "数量上限限制") @ApiModelProperty(value = "数量上限限制")
private Integer quantityLimit; private Integer quantityLimit;
@ApiModelProperty(value = "活动分类id")
private Integer classificationId;
@ApiModelProperty(value = "邀请码") @ApiModelProperty(value = "邀请码")
private String invitationCode; private String invitationCode;
@ -137,6 +140,8 @@ public class Competition implements Serializable {
@TableField(exist = false) @TableField(exist = false)
private CompetitionRegistration competitionRegistration; private CompetitionRegistration competitionRegistration;
@ApiModelProperty(value = "活动分类名称")
@TableField(exist = false)
private String classificationName;
} }

@ -0,0 +1,43 @@
package com.huoran.competition.entity;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @描述活动分类
* @作者: Rong
* @日期: 2023-12-27
*/
@Data
@ApiModel(value = "活动分类")
@TableName("c_competition_classification")
public class CompetitionClassification implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.AUTO)
@ApiModelProperty(value = "活动分类主键")
private Integer id;
@ApiModelProperty(value = "活动分类名称")
private String classificationName;
@ApiModelProperty(value = "创建人")
private Integer accountId;
@ApiModelProperty(value = "创建时间")
@TableField(fill = FieldFill.INSERT)
private Date createTime;
@ApiModelProperty(value = "更新时间")
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateTime;
}

@ -35,4 +35,7 @@ public class AfterLoginPageCompetitionListReq extends PageReq{
@ApiModelProperty(value = "读取的列表(0:首页活动/1.已报名活动)", example = "5") @ApiModelProperty(value = "读取的列表(0:首页活动/1.已报名活动)", example = "5")
private Integer listType; private Integer listType;
@ApiModelProperty(value = "活动分类id")
private Integer classificationId;
} }

@ -153,4 +153,11 @@ public class CompetitionVO implements Serializable {
@ApiModelProperty(value = "是否展示报名人员(0否,1是)") @ApiModelProperty(value = "是否展示报名人员(0否,1是)")
private String whetherToShowApplicants; private String whetherToShowApplicants;
@ApiModelProperty(value = "分类名称")
private String classificationName;
@ApiModelProperty(value = "活动分类id")
private Integer classificationId;
} }

@ -0,0 +1,16 @@
package com.huoran.competition.mapper;
import com.huoran.competition.entity.CompetitionClassification;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 活动分类 Mapper 接口
* </p>
*
* @author cheney
* @since 2023-12-27
*/
public interface CompetitionClassificationMapper extends BaseMapper<CompetitionClassification> {
}

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.huoran.competition.mapper.CompetitionClassificationMapper">
</mapper>

@ -81,13 +81,15 @@
) AS applicant_num, ) AS applicant_num,
c.is_open, c.is_open,
create_source, create_source,
( CASE create_source WHEN 0 THEN '平台创建' WHEN 1 THEN '组织创建' ELSE '无' END ) AS createSource ( CASE create_source WHEN 0 THEN '平台创建' WHEN 1 THEN '组织创建' ELSE '无' END ) AS createSource,
cla.classification_name,
c.classification_id
FROM FROM
c_competition c c_competition c
INNER JOIN c_competition_classification cla ON c.classification_id = cla.id
WHERE WHERE
1 = 1 1 = 1
<if test=" req.startTime!=null and req.endTime!=null "> <if test=" req.startTime!=null and req.endTime!=null ">
and create_time between #{req.startTime} and #{req.endTime} and create_time between #{req.startTime} and #{req.endTime}
</if> </if>
@ -696,16 +698,22 @@
( CASE create_source WHEN 0 THEN '平台创建' WHEN 1 THEN '组织创建' ELSE '无' END ) AS createSource, ( CASE create_source WHEN 0 THEN '平台创建' WHEN 1 THEN '组织创建' ELSE '无' END ) AS createSource,
IF IF
( (
( SELECT r.id FROM c_competition_registration r WHERE r.competition_id = c.id AND r.account_id = #{req.accountId} ) IS NULL, ( SELECT r.id FROM c_competition_registration r WHERE r.competition_id = c.id AND r.account_id = #{req.accountId} ) IS NULL,
1, 1,
0 0
) AS whetherToSignUp ) AS whetherToSignUp,
cla.classification_name,
c.classification_id
FROM FROM
c_competition c c_competition c
INNER JOIN c_competition_classification cla ON c.classification_id = cla.id
WHERE WHERE
c.is_open = 0 c.is_open = 0
AND c.publish_status = 1 AND c.publish_status = 1
<if test=" req.classificationId!=null ">
and c.classification_id=#{req.classificationId}
</if>
<if test=" req.startTime!=null and req.endTime!=null "> <if test=" req.startTime!=null and req.endTime!=null ">
and create_time between #{req.startTime} and #{req.endTime} and create_time between #{req.startTime} and #{req.endTime}
@ -771,10 +779,13 @@
c.is_open, c.is_open,
create_source, create_source,
( CASE create_source WHEN 0 THEN '平台创建' WHEN 1 THEN '组织创建' ELSE '无' END ) AS createSource, ( CASE create_source WHEN 0 THEN '平台创建' WHEN 1 THEN '组织创建' ELSE '无' END ) AS createSource,
( SELECT d.id FROM c_competition_user_del d WHERE d.account_id = r.account_id AND d.competition_id = c.id ) AS isDelCompetition ( SELECT d.id FROM c_competition_user_del d WHERE d.account_id = r.account_id AND d.competition_id = c.id ) AS isDelCompetition,
cla.classification_name,
c.classification_id
FROM FROM
c_competition_registration r c_competition_registration r
INNER JOIN c_competition c ON c.id = r.competition_id INNER JOIN c_competition c ON c.id = r.competition_id
INNER JOIN c_competition_classification cla ON c.classification_id = cla.id
WHERE WHERE
r.account_id = #{req.accountId} r.account_id = #{req.accountId}
@ -783,6 +794,10 @@
WHERE WHERE
t.isDelCompetition IS NULL t.isDelCompetition IS NULL
<if test=" req.classificationId!=null ">
and t.classification_id =#{req.classificationId}
</if>
<if test=" req.startTime!=null and req.endTime!=null "> <if test=" req.startTime!=null and req.endTime!=null ">
and t.create_time between #{req.startTime} and #{req.endTime} and t.create_time between #{req.startTime} and #{req.endTime}
</if> </if>

@ -0,0 +1,16 @@
package com.huoran.competition.service;
import com.huoran.competition.entity.CompetitionClassification;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 活动分类 服务类
* </p>
*
* @author cheney
* @since 2023-12-27
*/
public interface CompetitionClassificationService extends IService<CompetitionClassification> {
}

@ -0,0 +1,20 @@
package com.huoran.competition.service.impl;
import com.huoran.competition.entity.CompetitionClassification;
import com.huoran.competition.mapper.CompetitionClassificationMapper;
import com.huoran.competition.service.CompetitionClassificationService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 活动分类 服务实现类
* </p>
*
* @author cheney
* @since 2023-12-27
*/
@Service
public class CompetitionClassificationServiceImpl extends ServiceImpl<CompetitionClassificationMapper, CompetitionClassification> implements CompetitionClassificationService {
}

@ -60,7 +60,7 @@ public class CodeGenerator {
// 5、策略配置 // 5、策略配置
StrategyConfig strategy = new StrategyConfig(); StrategyConfig strategy = new StrategyConfig();
strategy.setInclude("c_competition_user_del"); strategy.setInclude("c_competition_classification");
strategy.setNaming(NamingStrategy.underline_to_camel);//数据库表映射到实体的命名策略 strategy.setNaming(NamingStrategy.underline_to_camel);//数据库表映射到实体的命名策略
strategy.setTablePrefix("c_"); //生成实体时去掉表前缀 strategy.setTablePrefix("c_"); //生成实体时去掉表前缀

@ -141,7 +141,7 @@ public class EnterpriseCertificationController {
wxMssVo.setRequest_url("https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=" + accessToken); wxMssVo.setRequest_url("https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=" + accessToken);
//将模板中的值一一赋值 发送到小程序的数据要转化为json格式 可以使用下面的方法直接拼接成JSONObject //将模板中的值一一赋值 发送到小程序的数据要转化为json格式 可以使用下面的方法直接拼接成JSONObject
//使用map结合模板 后续再加遍历拼接成JSONObject //使用map结合模板 后续再加遍历拼接成JSONObject
HashMap<String, Object> map = new HashMap<>(3); HashMap<String, Object> map = new HashMap<>(4);
map.put("thing1", details.getCompanyName());//公司名称 map.put("thing1", details.getCompanyName());//公司名称
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@ -153,6 +153,7 @@ public class EnterpriseCertificationController {
//通过:更改认证状态 认证状态(0默认未认证 1.认证中2.已认证) //通过:更改认证状态 认证状态(0默认未认证 1.认证中2.已认证)
enterpriseCertification.setAuthenticationStatus(2); enterpriseCertification.setAuthenticationStatus(2);
authenticationStatus = "通过"; authenticationStatus = "通过";
map.put("thing3", "无");//备注
break; break;
case 3: case 3:
//不通过 //不通过

@ -6,12 +6,16 @@ import com.huoran.common.exception.CustomException;
import com.huoran.common.exception.ExceptionEnum; import com.huoran.common.exception.ExceptionEnum;
import com.huoran.common.response.R; import com.huoran.common.response.R;
import com.huoran.common.utils.TokenUtils; import com.huoran.common.utils.TokenUtils;
import com.huoran.nakadai.entity.*; import com.huoran.nakadai.entity.PlatformTeam;
import com.huoran.nakadai.entity.PlatformTeamClassification;
import com.huoran.nakadai.entity.req.*; import com.huoran.nakadai.entity.req.*;
import com.huoran.nakadai.entity.res.PartnerAccountResp; import com.huoran.nakadai.entity.res.PartnerAccountResp;
import com.huoran.nakadai.entity.res.PlatformTeamAccountResp; import com.huoran.nakadai.entity.res.PlatformTeamAccountResp;
import com.huoran.nakadai.entity.vo.TeamMemberVo; import com.huoran.nakadai.entity.vo.TeamClassificationVO;
import com.huoran.nakadai.service.*; import com.huoran.nakadai.service.PlatformTeamAccountService;
import com.huoran.nakadai.service.PlatformTeamClassificationService;
import com.huoran.nakadai.service.PlatformTeamService;
import com.huoran.nakadai.service.SupplierClassificationConfigService;
import com.huoran.nakadai.utils.GenerateCodeUtil; import com.huoran.nakadai.utils.GenerateCodeUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -25,6 +29,7 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -51,34 +56,33 @@ public class PlatformTeamAccountController {
@Autowired @Autowired
public PlatformTeamClassificationService platformTeamClassificationService; public PlatformTeamClassificationService platformTeamClassificationService;
@Autowired
public SupplierClassificationConfigService supplierClassificationConfigService;
@Autowired @Autowired
private RedisTemplate<String, String> redisTemplate; private RedisTemplate<String, String> redisTemplate;
@PostMapping("/generateInvitationCode") @PostMapping("/generateInvitationCode")
@ApiOperation(value = "生成不同平台专属邀请码") @ApiOperation(value = "生成不同平台专属邀请码")
public R generateInvitationCode( public R generateInvitationCode(@ApiParam(name = "platformId", value = "平台id", required = true) @RequestParam("platformId") String platformId, HttpServletRequest request) {
@ApiParam(name = "platformId", value = "平台id", required = true)
@RequestParam("platformId") String platformId,HttpServletRequest request) {
//平台唯一标识码 //平台唯一标识码
String uniqueIdentification = platformId+TokenUtils.getIdByJwtToken(request)+"kindergartenInvitationCode"; String uniqueIdentification = platformId + TokenUtils.getIdByJwtToken(request) + "kindergartenInvitationCode";
//存在直接返回邀请码 //存在直接返回邀请码
String code = redisTemplate.opsForValue().get(uniqueIdentification); String code = redisTemplate.opsForValue().get(uniqueIdentification);
if (StringUtils.isEmpty(code)){ if (StringUtils.isEmpty(code)) {
code = GenerateCodeUtil.generateCode(); code = GenerateCodeUtil.generateCode();
redisTemplate.opsForValue().set(uniqueIdentification,code,7, TimeUnit.DAYS); redisTemplate.opsForValue().set(uniqueIdentification, code, 7, TimeUnit.DAYS);
} }
//过期时间 //过期时间
Long expireTime = redisTemplate.opsForValue().getOperations().getExpire(uniqueIdentification); Long expireTime = redisTemplate.opsForValue().getOperations().getExpire(uniqueIdentification);
return Objects.requireNonNull(R.ok().put("invitationCode", code)).put("expireTime",expireTime); return Objects.requireNonNull(R.ok().put("invitationCode", code)).put("expireTime", expireTime);
} }
@ApiOperation(value = "平台邀请二维码生成") @ApiOperation(value = "平台邀请二维码生成")
@GetMapping(value = "/generationQrCode",produces = "image/png") @GetMapping(value = "/generationQrCode", produces = "image/png")
public void generationQrCode( public void generationQrCode(@ApiParam(name = "url", value = "链接", required = true) @RequestParam String url, HttpServletResponse response) {
@ApiParam(name = "url", value = "链接", required = true) platformTeamAccountService.generationQrCode(url, response);
@RequestParam String url, HttpServletResponse response){
platformTeamAccountService.generationQrCode(url,response);
} }
@ -145,11 +149,7 @@ public class PlatformTeamAccountController {
@GetMapping("/removeOrganization") @GetMapping("/removeOrganization")
@ApiOperation(value = "移除组织") @ApiOperation(value = "移除组织")
public R removeOrganization( public R removeOrganization(@ApiParam(name = "teamId", value = "团队id") @RequestParam Integer teamId, @ApiParam(name = "manageId", value = "组织id") @RequestParam Integer manageId) {
@ApiParam(name = "teamId", value = "团队id")
@RequestParam Integer teamId,
@ApiParam(name = "manageId", value = "组织id")
@RequestParam Integer manageId) {
PlatformTeamClassification teamClassification = platformTeamClassificationService.getById(teamId); PlatformTeamClassification teamClassification = platformTeamClassificationService.getById(teamId);
if (teamClassification.getIsTeam() == 1) { if (teamClassification.getIsTeam() == 1) {
throw new CustomException(ExceptionEnum.PARTNER_REMOVAL); throw new CustomException(ExceptionEnum.PARTNER_REMOVAL);
@ -158,46 +158,40 @@ public class PlatformTeamAccountController {
platformTeamClassificationService.removeById(teamId); platformTeamClassificationService.removeById(teamId);
//TODO 删除该团队相关角色信息 //TODO 删除该团队相关角色信息
platformTeamAccountService.removeById(manageId); platformTeamAccountService.removeById(manageId);
boolean remove = platformTeamService.remove(new QueryWrapper<PlatformTeam>(). boolean remove = platformTeamService.remove(new QueryWrapper<PlatformTeam>().eq("manage_id", manageId).eq("classification_id", teamId));
eq("manage_id", manageId).
eq("classification_id", teamId));
return remove ? R.ok() : R.error(); return remove ? R.ok() : R.error();
} }
@ApiOperation(value = "后台更新团队状态,禁用无法查询到该组织") @ApiOperation(value = "后台更新团队状态,禁用无法查询到该组织")
@PostMapping("/updateTeamStatus") @PostMapping("/updateTeamStatus")
public R updateTeamStatus( public R updateTeamStatus(@RequestParam("teamId") @ApiParam(value = "团队id") Integer teamId, @RequestParam("isEnable") @ApiParam(value = "是否禁用(1->禁用,0->启用)") Integer isEnable) {
@RequestParam("teamId") @ApiParam(value = "团队id") Integer teamId,
@RequestParam("isEnable") @ApiParam(value = "是否禁用(1->禁用,0->启用)") Integer isEnable) {
PlatformTeamClassification platformTeamClassification = new PlatformTeamClassification(); PlatformTeamClassification platformTeamClassification = new PlatformTeamClassification();
platformTeamClassification.setId(teamId); platformTeamClassification.setId(teamId);
platformTeamClassification.setIsEnable(isEnable); platformTeamClassification.setIsEnable(isEnable);
boolean update = platformTeamClassificationService.updateById(platformTeamClassification); boolean update = platformTeamClassificationService.updateById(platformTeamClassification);
return update? R.ok() : R.error(); return update ? R.ok() : R.error();
} }
//================================以下接口为小程序调用=================================== //================================以下接口为小程序调用===================================
@ApiOperation(value = "幼教产品微信小程序回调登录") @ApiOperation(value = "幼教产品微信小程序回调登录")
@PostMapping("/weChatAppletCallbackByKindergarten") @PostMapping("/weChatAppletCallbackByKindergarten")
public R weChatAppletCallbackByKindergarten(@RequestBody @Valid AppletCallbackReq appletCallbackReq, HttpServletResponse response) throws Exception { public R weChatAppletCallbackByKindergarten(@RequestBody @Valid AppletCallbackReq appletCallbackReq, HttpServletResponse response) throws Exception {
Map<String ,Object> result = platformTeamAccountService.kindergartenWeChatAccountApplication(appletCallbackReq); Map<String, Object> result = platformTeamAccountService.kindergartenWeChatAccountApplication(appletCallbackReq);
return R.ok().put("data",result); return R.ok().put("data", result);
} }
@ApiOperation(value = "幼教产品微信小程序账号注册(根据openid)") @ApiOperation(value = "幼教产品微信小程序账号注册(根据openid)")
@PostMapping("/kindergartenWeChatApplication") @PostMapping("/kindergartenWeChatApplication")
public R kindergartenWeChatApplication(@RequestBody @Valid AppletCallbackReq appletCallbackReq) { public R kindergartenWeChatApplication(@RequestBody @Valid AppletCallbackReq appletCallbackReq) {
return platformTeamAccountService.kindergartenWeChatApplication(appletCallbackReq); return platformTeamAccountService.kindergartenWeChatApplication(appletCallbackReq);
} }
@ApiOperation(value = "获取当前平台用户的团队信息", response = PartnerAccountResp.class) @ApiOperation(value = "获取当前平台用户的团队信息", response = PartnerAccountResp.class)
@GetMapping("/getTeamsByPlatformId") @GetMapping("/getTeamsByPlatformId")
public R getTeamsByPlatformId( public R getTeamsByPlatformId(@ApiParam(name = "platformId", value = "平台id") @RequestParam Integer platformId, HttpServletRequest request) {
@ApiParam(name = "platformId", value = "平台id")
@RequestParam Integer platformId,HttpServletRequest request) {
String accountId = TokenUtils.getIdByJwtToken(request); String accountId = TokenUtils.getIdByJwtToken(request);
return platformTeamAccountService.getTeamsByPlatformId(accountId,platformId); return platformTeamAccountService.getTeamsByPlatformId(accountId, platformId);
} }
@PostMapping("/platformTeamAccountList") @PostMapping("/platformTeamAccountList")
@ -210,18 +204,36 @@ public class PlatformTeamAccountController {
@PostMapping("/updateTeamInfo") @PostMapping("/updateTeamInfo")
public R updateTeamInfo(@RequestBody TeamInfo teamInfo) { public R updateTeamInfo(@RequestBody TeamInfo teamInfo) {
PlatformTeamClassification platformTeamClassification = new PlatformTeamClassification(); PlatformTeamClassification platformTeamClassification = new PlatformTeamClassification();
BeanUtils.copyProperties(teamInfo,platformTeamClassification); BeanUtils.copyProperties(teamInfo, platformTeamClassification);
// 供应商角色下编辑分类
// 查询供应商的分类信息(只有当前团队为供应商才有supplierClassification数据)
Integer accountId = platformTeamService.getAccountIdByTeamId(teamInfo.getId());
//删除原有分类重新新增分类配置信息
supplierClassificationConfigService.deleteByAccountId(accountId);
//设置分类配置信息中的accountId
teamInfo.getSupplierClassificationConfigs().forEach(config -> config.setAccountId(accountId));
//新增分类配置信息
supplierClassificationConfigService.saveBatch(teamInfo.getSupplierClassificationConfigs());
boolean update = platformTeamClassificationService.updateById(platformTeamClassification); boolean update = platformTeamClassificationService.updateById(platformTeamClassification);
return update? R.ok() : R.error(); return update ?R.ok():R.error();
} }
@ApiOperation(value = "查询团队信息") @ApiOperation(value = "查询团队信息")
@GetMapping("/queryTeamInfo") @GetMapping("/queryTeamInfo")
public R queryTeamInfo( public R queryTeamInfo(@ApiParam(value = "团队id") @RequestParam("teamId") Integer teamId) {
@ApiParam(value = "团队id")
@RequestParam("teamId") Integer teamId) {
PlatformTeamClassification teamInfo = platformTeamClassificationService.getById(teamId); PlatformTeamClassification teamInfo = platformTeamClassificationService.getById(teamId);
return R.ok().put("teamInfo",teamInfo); //查询供应商的分类信息(只有当前团队为供应商才有supplierClassification数据)
List<TeamClassificationVO> supplierClassification = platformTeamService.getTeamClassificationVOByTeamId(teamId);
return R.ok().put("teamInfo", teamInfo).put("supplierClassification", supplierClassification);
} }
@PostMapping("/inviteJoinOrganization") @PostMapping("/inviteJoinOrganization")

@ -0,0 +1,106 @@
package com.huoran.nakadai.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.huoran.api.UserClient;
import com.huoran.common.response.R;
import com.huoran.common.utils.TokenUtils;
import com.huoran.nakadai.entity.SupplierClassification;
import com.huoran.nakadai.entity.req.SupplierClassificationReq;
import com.huoran.nakadai.service.SupplierClassificationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
/**
* @描述供应商分类信息控制类
* @作者: Rong
* @日期: 2023-12-27
*/
@RestController
@RequestMapping("/supplierClassification")
@Api(value = "供应商分类信息:SupplierClassificationController", tags = "供应商分类信息")
public class SupplierClassificationController {
@Autowired
public SupplierClassificationService service;
@Autowired
private UserClient userClient;
@PostMapping("/treeStructureList")
@ApiOperation(value = "树结构列表", response = SupplierClassification.class)
public R treeStructureList() {
/*QueryWrapper<SupplierClassification> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("parent_id", supplierClassification.getParentId());*/
List<SupplierClassification> list = service.list(null);
return R.ok().put("list", buildTree(list));
}
public List<SupplierClassification> buildTree(List<SupplierClassification> list) {
List<SupplierClassification> treeList = new ArrayList<SupplierClassification>();
List<SupplierClassification> children;
for (SupplierClassification address : list) {
if (address.getParentId() == 0) {
treeList.add(address);
}
children = new ArrayList<SupplierClassification>();
for (SupplierClassification node : list) {
if (node.getParentId() == address.getId()) {
children.add(node);
}
}
address.setChildren(children);
}
return treeList;
}
@PostMapping("/findById")
@ApiOperation(value = "查询详情", response = SupplierClassification.class)
public R findById(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) {
SupplierClassification supplierClassification = service.getById(id);
return R.ok().put("data", supplierClassification);
}
@PostMapping("/save")
@ApiOperation(value = "新增", response = SupplierClassification.class)
public R save(@RequestBody @ApiParam(name = "供应商分类信息对象", value = "传入json格式", required = true) SupplierClassification supplierClassification, HttpServletRequest request) {
String accountId = TokenUtils.getIdByJwtToken(request);
Integer schoolId = userClient.getSchoolIdByAccountId(accountId);
supplierClassification.setAccountId(Integer.valueOf(accountId));
boolean addState = service.save(supplierClassification);
return addState ? R.ok() : R.error("新增失败");
}
@PostMapping("/update")
@ApiOperation(value = "修改", response = SupplierClassification.class)
public R update(@RequestBody @ApiParam(name = "供应商分类信息对象", value = "传入json格式", required = true) SupplierClassification supplierClassification, HttpServletRequest request) {
String accountId = TokenUtils.getIdByJwtToken(request);
Integer schoolId = userClient.getSchoolIdByAccountId(accountId);
supplierClassification.setAccountId(Integer.valueOf(accountId));
boolean updateState = service.updateById(supplierClassification);
return updateState ? R.ok() : R.error("编辑失败");
}
@PostMapping("/batchDeletion")
@ApiOperation(value = "批量删除", response = SupplierClassification.class)
public R batchDeletion(@ApiParam(name = "ids", value = "主键", required = true) @RequestBody List<Integer> ids) {
boolean delState = service.removeByIds(ids);
return delState ? R.ok() : R.error("删除失败");
}
}

@ -129,4 +129,13 @@ public class EnterpriseCertification implements Serializable {
@ApiModelProperty(value = "微信唯一标识") @ApiModelProperty(value = "微信唯一标识")
private String openId; private String openId;
@ApiModelProperty(value = "供应商分类id")
@TableField(exist = false)
private Integer supplierClassificationId;
@ApiModelProperty(value = "供应商分类名称")
@TableField(exist = false)
private String supplierClassificationName;
} }

@ -1,5 +1,6 @@
package com.huoran.nakadai.entity; package com.huoran.nakadai.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
@ -54,13 +55,17 @@ public class SupplierClassification implements Serializable {
//使用@JsonIgnore注解,忽略此属性,前端不会拿到该属性 //使用@JsonIgnore注解,忽略此属性,前端不会拿到该属性
@JsonIgnore @JsonIgnore
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "创建时间")
@TableField(fill = FieldFill.INSERT)
private Date createTime; private Date createTime;
//使用@JsonIgnore注解,忽略此属性,前端不会拿到该属性 //使用@JsonIgnore注解,忽略此属性,前端不会拿到该属性
@JsonIgnore @JsonIgnore
@ApiModelProperty(value = "修改时间") @ApiModelProperty(value = "修改时间")
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateTime; private Date updateTime;
@ApiModelProperty(value = "子分类集合") @ApiModelProperty(value = "子分类集合")
@TableField(exist = false) @TableField(exist = false)
private List<SupplierClassification> children; private List<SupplierClassification> children;

@ -26,6 +26,7 @@ public class SupplierClassificationConfig implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键") @ApiModelProperty(value = "主键")
@TableId(value = "id", type = IdType.AUTO)
private Integer id; private Integer id;
@ApiModelProperty(value = "分类id") @ApiModelProperty(value = "分类id")

@ -47,6 +47,12 @@ public class EnterpriseCertificationLIstReq {
@ApiModelProperty(value = "市") @ApiModelProperty(value = "市")
private String city; private String city;
@ApiModelProperty(value = "供应商分类id")
private Integer supplierClassificationId;
/*@ApiModelProperty(value = "供应商分类名称")
private String supplierClassificationName;*/
@ApiModelProperty(value = "当前页数", name = "pageNum", example = "1", required = true) @ApiModelProperty(value = "当前页数", name = "pageNum", example = "1", required = true)
private Integer pageNum; private Integer pageNum;
@ApiModelProperty(value = "当前页需要显示的数量", name = "pageSize", example = "10", required = true) @ApiModelProperty(value = "当前页需要显示的数量", name = "pageSize", example = "10", required = true)

@ -1,10 +1,11 @@
package com.huoran.nakadai.entity.req; package com.huoran.nakadai.entity.req;
import com.baomidou.mybatisplus.annotation.IdType; import com.huoran.nakadai.entity.SupplierClassificationConfig;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.util.List;
@Data @Data
public class TeamInfo { public class TeamInfo {
@ -55,4 +56,7 @@ public class TeamInfo {
@ApiModelProperty(value = "phone") @ApiModelProperty(value = "phone")
private String phone; private String phone;
@ApiModelProperty(value = "供应商分类配置")
private List<SupplierClassificationConfig> supplierClassificationConfigs;
} }

@ -0,0 +1,35 @@
package com.huoran.nakadai.entity.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* <p>
* 幼教产业团队账号与分类中间表
* </p>
*
* @author chen
* @since 2023-12-12
*/
@Data
public class TeamClassificationVO {
@ApiModelProperty(value = "团队id")
private Integer teamId;
@ApiModelProperty(value = "账户id")
private Integer accountId;
@ApiModelProperty(value = "供应商分类id")
private Integer supplierClassificationId;
@ApiModelProperty(value = "供应商分类名称")
private String supplierClassificationName;
@ApiModelProperty(value = "供应商分类配置id")
private Integer classificationConfigId;
}

@ -2,7 +2,11 @@ package com.huoran.nakadai.mapper;
import com.huoran.nakadai.entity.PlatformTeam; import com.huoran.nakadai.entity.PlatformTeam;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.huoran.nakadai.entity.vo.TeamClassificationVO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* <p> * <p>
@ -14,5 +18,8 @@ import org.apache.ibatis.annotations.Mapper;
*/ */
@Mapper @Mapper
public interface PlatformTeamMapper extends BaseMapper<PlatformTeam> { public interface PlatformTeamMapper extends BaseMapper<PlatformTeam> {
List<TeamClassificationVO> getTeamClassificationVOByTeamId(@Param("teamId") Integer teamId);
Integer getAccountIdByTeamId(@Param("teamId") Integer teamId);
} }

@ -2,6 +2,7 @@ package com.huoran.nakadai.mapper;
import com.huoran.nakadai.entity.SupplierClassificationConfig; import com.huoran.nakadai.entity.SupplierClassificationConfig;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
/** /**
* <p> * <p>
@ -13,4 +14,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/ */
public interface SupplierClassificationConfigMapper extends BaseMapper<SupplierClassificationConfig> { public interface SupplierClassificationConfigMapper extends BaseMapper<SupplierClassificationConfig> {
boolean deleteByAccountId(@Param("accountId") Integer accountId);
} }

@ -46,7 +46,9 @@
cla.id AS teamId, cla.id AS teamId,
logo_url, logo_url,
brief_introduction, brief_introduction,
cla.create_time as organizationCreationTime cla.create_time AS organizationCreationTime,
cc.classification_id as supplierClassificationId,
sc.classification_name as supplierClassificationName
FROM FROM
hr_enterprise_certification c hr_enterprise_certification c
INNER JOIN hr_user_account a ON a.id = c.account_id INNER JOIN hr_user_account a ON a.id = c.account_id
@ -55,6 +57,8 @@
LEFT JOIN k_platform_team_account ta ON ta.account_id = a.id LEFT JOIN k_platform_team_account ta ON ta.account_id = a.id
LEFT JOIN k_platform_team t ON ta.manage_id = t.manage_id LEFT JOIN k_platform_team t ON ta.manage_id = t.manage_id
LEFT JOIN k_platform_team_classification cla ON cla.id = t.classification_id LEFT JOIN k_platform_team_classification cla ON cla.id = t.classification_id
LEFT JOIN supplier_classification_config cc ON cc.account_id = c.account_id
LEFT JOIN supplier_classification sc ON sc.id = cc.classification_id
AND is_team = 1 AND is_team = 1
AND cla.is_del = 0 AND cla.is_del = 0
WHERE WHERE
@ -62,7 +66,11 @@
AND u.is_del = 0 AND u.is_del = 0
) t ) t
WHERE WHERE
t.platform_source = #{req.platformSource} t.platform_source = #{req.platformSource}
<if test=" req.supplierClassificationId!= null">
and t.supplierClassificationId =#{req.supplierClassificationId}
</if>
<if test=" req.auditStatus!= null and req.auditStatus!= '' or req.auditStatus ==0"> <if test=" req.auditStatus!= null and req.auditStatus!= '' or req.auditStatus ==0">

@ -2,4 +2,32 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.huoran.nakadai.mapper.PlatformTeamMapper"> <mapper namespace="com.huoran.nakadai.mapper.PlatformTeamMapper">
<select id="getTeamClassificationVOByTeamId"
resultType="com.huoran.nakadai.entity.vo.TeamClassificationVO">
SELECT
ta.account_id AS accountId,
sc.classification_name AS supplierClassificationName,
sc.id AS supplierClassificationId,
t.id AS teamId,
cc.id AS classificationConfigId
FROM
k_platform_team t
INNER JOIN k_platform_team_account ta ON ta.manage_id = t.manage_id
INNER JOIN k_platform_team_classification c ON c.id = t.classification_id
INNER JOIN supplier_classification_config cc ON cc.account_id = ta.account_id
INNER JOIN supplier_classification sc ON sc.id = cc.classification_id
WHERE t.id = #{teamId} AND ta.platform_id = 6
</select>
<select id="getAccountIdByTeamId" resultType="java.lang.Integer">
SELECT
ta.account_id
FROM
k_platform_team t
INNER JOIN k_platform_team_account ta ON ta.manage_id = t.manage_id
INNER JOIN k_platform_team_classification c ON c.id = t.classification_id
WHERE
t.classification_id = #{teamId}
AND is_team = 1
</select>
</mapper> </mapper>

@ -2,4 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.huoran.nakadai.mapper.SupplierClassificationConfigMapper"> <mapper namespace="com.huoran.nakadai.mapper.SupplierClassificationConfigMapper">
<delete id="deleteByAccountId">
DELETE from supplier_classification_config WHERE account_id = #{accountId}
</delete>
</mapper> </mapper>

@ -1,7 +1,10 @@
package com.huoran.nakadai.service; package com.huoran.nakadai.service;
import com.huoran.nakadai.entity.PlatformTeam;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.huoran.nakadai.entity.PlatformTeam;
import com.huoran.nakadai.entity.vo.TeamClassificationVO;
import java.util.List;
/** /**
* <p> * <p>
@ -12,5 +15,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
* @since 2023-12-12 * @since 2023-12-12
*/ */
public interface PlatformTeamService extends IService<PlatformTeam> { public interface PlatformTeamService extends IService<PlatformTeam> {
List<TeamClassificationVO> getTeamClassificationVOByTeamId(Integer teamId);
//根据团队id获取团队负责人账号id
Integer getAccountIdByTeamId(Integer teamId);
} }

@ -12,5 +12,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
* @since 2023-12-27 * @since 2023-12-27
*/ */
public interface SupplierClassificationConfigService extends IService<SupplierClassificationConfig> { public interface SupplierClassificationConfigService extends IService<SupplierClassificationConfig> {
//删除用户的供应商配置信息
boolean deleteByAccountId(Integer accountId);
} }

@ -1,11 +1,14 @@
package com.huoran.nakadai.service.impl; package com.huoran.nakadai.service.impl;
import com.huoran.nakadai.entity.PlatformTeam; import com.huoran.nakadai.entity.PlatformTeam;
import com.huoran.nakadai.entity.vo.TeamClassificationVO;
import com.huoran.nakadai.mapper.PlatformTeamMapper; import com.huoran.nakadai.mapper.PlatformTeamMapper;
import com.huoran.nakadai.service.PlatformTeamService; import com.huoran.nakadai.service.PlatformTeamService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* <p> * <p>
* 幼教产业团队账号与分类中间表 服务实现类 * 幼教产业团队账号与分类中间表 服务实现类
@ -17,4 +20,13 @@ import org.springframework.stereotype.Service;
@Service @Service
public class PlatformTeamServiceImpl extends ServiceImpl<PlatformTeamMapper, PlatformTeam> implements PlatformTeamService { public class PlatformTeamServiceImpl extends ServiceImpl<PlatformTeamMapper, PlatformTeam> implements PlatformTeamService {
@Override
public List<TeamClassificationVO> getTeamClassificationVOByTeamId(Integer teamId) {
return baseMapper.getTeamClassificationVOByTeamId(teamId);
}
@Override
public Integer getAccountIdByTeamId(Integer teamId) {
return baseMapper.getAccountIdByTeamId(teamId);
}
} }

@ -17,4 +17,8 @@ import org.springframework.stereotype.Service;
@Service @Service
public class SupplierClassificationConfigServiceImpl extends ServiceImpl<SupplierClassificationConfigMapper, SupplierClassificationConfig> implements SupplierClassificationConfigService { public class SupplierClassificationConfigServiceImpl extends ServiceImpl<SupplierClassificationConfigMapper, SupplierClassificationConfig> implements SupplierClassificationConfigService {
@Override
public boolean deleteByAccountId(Integer accountId) {
return baseMapper.deleteByAccountId(accountId);
}
} }

@ -60,9 +60,9 @@ public class WeChatUtil {
// String appid = PropUtils.getProp("APPID"); // String appid = PropUtils.getProp("APPID");
// String appsecret = PropUtils.getProp("APPSECRET"); // String appsecret = PropUtils.getProp("APPSECRET");
// 微信小程序ID // 微信小程序ID
String appid = WeChatPropertiesUtil.PARTNER_WX_OPEN_APP_ID; String appid = WeChatPropertiesUtil.KINDERGARTEN_WX_OPEN_APP_ID;
// 微信小程序秘钥 // 微信小程序秘钥
String appsecret =WeChatPropertiesUtil.PARTNER_WX_OPEN_APP_SECRET; String appsecret =WeChatPropertiesUtil.KINDERGARTEN_WX_OPEN_APP_SECRET;
//构建url,用于向微信服务器请求用户的openId //构建url,用于向微信服务器请求用户的openId
StringBuffer url = new StringBuffer("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&"); StringBuffer url = new StringBuffer("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&");
@ -75,7 +75,7 @@ public class WeChatUtil {
HttpResponse httpResponse = client.execute(httpGet); HttpResponse httpResponse = client.execute(httpGet);
HttpEntity result = httpResponse.getEntity(); HttpEntity result = httpResponse.getEntity();
String resultStr = EntityUtils.toString(result); String resultStr = EntityUtils.toString(result);
System.out.println(resultStr); System.err.println(resultStr);
JSONObject resultJsonObject = JSONUtil.parseObj(resultStr); JSONObject resultJsonObject = JSONUtil.parseObj(resultStr);
String accessToken = (String) resultJsonObject.get("access_token"); String accessToken = (String) resultJsonObject.get("access_token");
return accessToken; return accessToken;

Loading…
Cancel
Save