Commit ef8e0f0a by ext.shengxiyong1

提交相关代码

1 parent d468c921
package com.linkwechat.web.controller.wecom;
import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.wecom.domain.WeApp;
import com.linkwechat.wecom.service.IWeAppService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/wecom/weapp")
public class WeAppController extends BaseController {
@Autowired
IWeAppService iWeAppService;
@GetMapping("/list")
public AjaxResult list() {
return AjaxResult.success(
iWeAppService.list()
);
}
@PostMapping("/addWeApp")
public AjaxResult addWeApp(@RequestBody WeApp weApp){
iWeAppService.addWeApp(weApp);
return AjaxResult.success();
}
@PutMapping("/updateWeApp")
public AjaxResult updateWeApp(@RequestBody WeApp weApp){
iWeAppService.updateWeApp(weApp);
return AjaxResult.success();
}
}
package com.linkwechat.wecom.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.linkwechat.common.utils.SnowFlakeUtil;
import lombok.AllArgsConstructor;
import lombok.experimental.SuperBuilder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
import java.util.List;
/**
* @description: 自建应用相关
* @author: HaoN
* @create: 2021-01-26 18:38
**/
@Data
@TableName("we_app")
@SuperBuilder
@AllArgsConstructor
@NoArgsConstructor
public class WeApp {
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id= SnowFlakeUtil.nextId();
/**应用id**/
private String agentId;
/**应用密钥**/
private String agentSecret;
/**应用类型(1:自建应用;2:小程序)**/
private Integer appType;
/**应用创建时间**/
private Date createTime;
/**删除标志(0代表存在 2代表删除)**/
private String delFlag;
/**帐号状态(0正常 1停用)**/
private String status;
/**可见范围部门id,使用逗号隔开**/
private String allowPartys;
/**可见范围人员id,使用逗号隔开**/
private String allowUserinfos;
/**应用名称**/
private String agentName;
/**企业应用描述**/
private String description;
/**应用头像**/
private String squareLogoUrl;
@TableField(exist = false)
private String logoMediaid;
}
package com.linkwechat.wecom.domain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
@Data
@TableName("we_scan_emple_code_count")
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class WeScanEmpleCodeCount {
@TableId
private Long id;
private String externalUserid;
private String userId;
private Date createTime;
private Long empleCodeId;
}
package com.linkwechat.wecom.domain.vo;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class SenderInfo implements Serializable {
private static final long serialVersionUID = 3912731370147355807L;
/**
* 跟进员工user_id
*/
private String userId;
/**
* 客户external_userid
*/
private String customerList;
}
package com.linkwechat.wecom.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
@ApiModel("老客标签建群列表接口简略信息")
@Data
public class WePresTagTaskListVO implements Serializable {
private static final long serialVersionUID = -2266869943970611146L;
@ApiModelProperty("任务id")
private Long taskId;
@ApiModelProperty("任务名")
private String taskName;
@ApiModelProperty("标签名列表")
private List<String> tagList;
@ApiModelProperty("发送类型 0: 企业群发 1: 个人群发")
private Integer sendType;
// @ApiModelProperty("群活码id")
// private String codeId;
//
// @ApiModelProperty("群活码URL")
// private String codeUrl;
@ApiModelProperty("当前群人数")
private Integer totalMember;
@ApiModelProperty("创建时间")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date createTime;
@ApiModelProperty("创建者")
@JsonFormat(pattern = "yyyy-MM-dd")
private String createBy;
@JsonIgnore
private String tagListStr;
}
package com.linkwechat.wecom.factory;
import com.linkwechat.common.constant.WeConstans;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
* @author danmo
* @description 企微回调策略
* @date 2020/11/8 17:17
**/
@Service
public class WeEventHandle {
@Autowired
private Map<String, WeCallBackEventFactory> weCallBackEventFactoryMap;
public WeCallBackEventFactory factory(String eventType) {
if (!WeConstans.eventRoute.containsKey(eventType)) {
return null;
}
String resolveClass = WeConstans.eventRoute.get(eventType);
if (!weCallBackEventFactoryMap.containsKey(resolveClass)) {
return null;
}
return weCallBackEventFactoryMap.get(resolveClass);
}
}
package com.linkwechat.wecom.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linkwechat.wecom.domain.WeApp;
/**
* @description: 自建应用相关
* @author: HaoN
* @create: 2021-01-26 18:43
**/
public interface WeAppMapper extends BaseMapper<WeApp> {
}
\ No newline at end of file \ No newline at end of file
package com.linkwechat.wecom.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linkwechat.wecom.domain.WeScanEmpleCodeCount;
public interface WeScanEmpleCodeCountMapper extends BaseMapper<WeScanEmpleCodeCount> {
}
package com.linkwechat.wecom.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.linkwechat.wecom.domain.WeApp;
/**
* @description:
* @author: HaoN
* @create: 2021-01-26 18:44
**/
public interface IWeAppService extends IService<WeApp> {
void addWeApp(WeApp weApp);
void updateWeApp(WeApp weApp);
}
package com.linkwechat.wecom.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.linkwechat.wecom.domain.WeScanEmpleCodeCount;
public interface IWeScanEmpleCodeCountService extends IService<WeScanEmpleCodeCount> {
}
package com.linkwechat.wecom.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.linkwechat.common.constant.Constants;
import com.linkwechat.common.exception.wecom.WeComException;
import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.wecom.client.WeAppClient;
import com.linkwechat.wecom.domain.WeApp;
import com.linkwechat.wecom.domain.dto.WeAppDetailDto;
import com.linkwechat.wecom.mapper.WeAppMapper;
import com.linkwechat.wecom.service.IWeAccessTokenService;
import com.linkwechat.wecom.service.IWeAppService;
import com.linkwechat.wecom.service.IWeDepartmentService;
import com.linkwechat.wecom.service.IWeUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
/**
* @description:
* @author: HaoN
* @create: 2021-01-26 18:44
**/
@Service
public class WeAppServiceImpl extends ServiceImpl<WeAppMapper, WeApp> implements IWeAppService {
@Autowired
WeAppClient weAppClient;
@Autowired
IWeDepartmentService iWeDepartmentService;
@Autowired
IWeUserService iWeUserService;
@Autowired
IWeAccessTokenService iWeAccessTokenService;
/**
* 保存应用
* @param weApp
*/
@Override
@Transactional
public void addWeApp(WeApp weApp) {
if(null !=this.getOne(new LambdaQueryWrapper<WeApp>()
.eq(WeApp::getAgentId, weApp.getAgentId())
.eq(WeApp::getDelFlag, Constants.SUCCESS))){
throw new WeComException("AgentId已经存在");
}
weApp.setCreateTime(new Date());
if(this.save(weApp)){
WeAppDetailDto weAppDetailDto
= weAppClient.findAgentById(weApp.getAgentId());
if(null != weAppDetailDto){
weApp.setAgentName(weAppDetailDto.getName());
weApp.setCreateTime(new Date());
weApp.setSquareLogoUrl(weAppDetailDto.getSquare_logo_url());
weApp.setDescription(weAppDetailDto.getDescription());
weApp.setAllowPartys(StringUtils.join(weAppDetailDto.getAllow_partys().getPartyid(),","));
weApp.setAllowUserinfos(StringUtils.join(weAppDetailDto.getAllow_userinfos().getUser(),","));
this.updateById(weApp);
}
}
}
@Override
@Transactional
public void updateWeApp(WeApp weApp) {
if(this.updateById(weApp)){
weAppClient.updateAgentById(
WeAppDetailDto.builder()
.agentid(weApp.getAgentId())
.logo_mediaid(weApp.getLogoMediaid())
.description(weApp.getDescription())
.name(weApp.getAgentName())
.build(),weApp.getAgentId()
);
}
}
}
package com.linkwechat.wecom.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.linkwechat.wecom.domain.WeScanEmpleCodeCount;
import com.linkwechat.wecom.mapper.WeScanEmpleCodeCountMapper;
import com.linkwechat.wecom.service.IWeScanEmpleCodeCountService;
import org.springframework.stereotype.Service;
@Service
public class WeScanEmpleCodeCountServiceImpl extends ServiceImpl<WeScanEmpleCodeCountMapper, WeScanEmpleCodeCount>
implements IWeScanEmpleCodeCountService {
}
<?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.linkwechat.wecom.mapper.WeAppMapper">
</mapper>
\ No newline at end of file \ No newline at end of file
<?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.linkwechat.wecom.mapper.WeScanEmpleCodeCountMapper">
</mapper>
\ No newline at end of file \ No newline at end of file
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!