Commit fe6f7c80 by danmo

Merge remote-tracking branch 'origin/back_end_dev' into back_end_dev

2 parents 68c8c334 31a7ee7a
package com.linkwechat.web.controller.wecom; package com.linkwechat.web.controller.wecom;
import cn.hutool.core.collection.CollectionUtil;
import com.linkwechat.common.annotation.Log; import com.linkwechat.common.annotation.Log;
import com.linkwechat.common.core.controller.BaseController; import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.AjaxResult; import com.linkwechat.common.core.domain.AjaxResult;
...@@ -7,6 +8,7 @@ import com.linkwechat.common.core.page.TableDataInfo; ...@@ -7,6 +8,7 @@ import com.linkwechat.common.core.page.TableDataInfo;
import com.linkwechat.common.enums.BusinessType; import com.linkwechat.common.enums.BusinessType;
import com.linkwechat.common.exception.wecom.WeComException; import com.linkwechat.common.exception.wecom.WeComException;
import com.linkwechat.common.utils.StringUtils; import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.common.utils.file.FileUtils;
import com.linkwechat.wecom.domain.WeCommunityNewGroup; import com.linkwechat.wecom.domain.WeCommunityNewGroup;
import com.linkwechat.wecom.domain.WeEmpleCode; import com.linkwechat.wecom.domain.WeEmpleCode;
import com.linkwechat.wecom.domain.dto.WeCommunityNewGroupDto; import com.linkwechat.wecom.domain.dto.WeCommunityNewGroupDto;
...@@ -21,9 +23,17 @@ import org.springframework.stereotype.Controller; ...@@ -21,9 +23,17 @@ import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
/** /**
* 社群运营 新客自动拉群 Controller * 社群运营 新客自动拉群 Controller
...@@ -36,25 +46,28 @@ import java.util.stream.Collectors; ...@@ -36,25 +46,28 @@ import java.util.stream.Collectors;
@RequestMapping(value = "communityNewGroup") @RequestMapping(value = "communityNewGroup")
public class WeCommunityNewGroupController extends BaseController { public class WeCommunityNewGroupController extends BaseController {
@Autowired @Autowired
private IWeCommunityNewGroupService weCommunityNewGroupService; private IWeCommunityNewGroupService weCommunityNewGroupService;
/** /**
* 查询新客自动拉群列表 * 查询新客自动拉群列表
*/ */
@ApiOperation(value = "查询新客自动拉群列表",httpMethod = "GET") @ApiOperation(value = "查询新客自动拉群列表", httpMethod = "GET")
@PreAuthorize("@ss.hasPermi('wecom:communityNewGroup:list')") @PreAuthorize("@ss.hasPermi('wecom:communityNewGroup:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(WeCommunityNewGroup communityNewGroup) { public TableDataInfo list(@RequestParam(value = "empleCodeName", required = false) String empleCodeName
, @RequestParam(value = "createBy", required = false) String createBy
, @RequestParam(value = "beginTime", required = false) String beginTime
, @RequestParam(value = "endTime", required = false) String endTime) {
startPage(); startPage();
List<WeCommunityNewGroupVo> communityNewGroupVos = weCommunityNewGroupService.selectWeCommunityNewGroupList(communityNewGroup); List<WeCommunityNewGroupVo> communityNewGroupVos = weCommunityNewGroupService.selectWeCommunityNewGroupList(empleCodeName, createBy, beginTime, endTime);
return getDataTable(communityNewGroupVos); return getDataTable(communityNewGroupVos);
} }
/** /**
* 获取新客自动拉群详细信息 * 获取新客自动拉群详细信息
*/ */
@ApiOperation(value = "获取新客自动拉群详细信息",httpMethod = "GET") @ApiOperation(value = "获取新客自动拉群详细信息", httpMethod = "GET")
@PreAuthorize("@ss.hasPermi('wecom:communityNewGroup:query')") @PreAuthorize("@ss.hasPermi('wecom:communityNewGroup:query')")
@GetMapping(value = "/{id}") @GetMapping(value = "/{id}")
public AjaxResult<WeCommunityNewGroupVo> getInfo(@PathVariable("newGroupId") @ApiParam("主键ID") Long newGroupId) { public AjaxResult<WeCommunityNewGroupVo> getInfo(@PathVariable("newGroupId") @ApiParam("主键ID") Long newGroupId) {
...@@ -64,7 +77,7 @@ public class WeCommunityNewGroupController extends BaseController { ...@@ -64,7 +77,7 @@ public class WeCommunityNewGroupController extends BaseController {
/** /**
* 修改新客自动拉群 * 修改新客自动拉群
*/ */
@ApiOperation(value = "修改新客自动拉群",httpMethod = "PUT") @ApiOperation(value = "修改新客自动拉群", httpMethod = "PUT")
@PreAuthorize("@ss.hasPermi('wecom:communityNewGroup:edit')") @PreAuthorize("@ss.hasPermi('wecom:communityNewGroup:edit')")
@Log(title = "新客自动拉群", businessType = BusinessType.UPDATE) @Log(title = "新客自动拉群", businessType = BusinessType.UPDATE)
@PutMapping("/update") @PutMapping("/update")
...@@ -77,7 +90,7 @@ public class WeCommunityNewGroupController extends BaseController { ...@@ -77,7 +90,7 @@ public class WeCommunityNewGroupController extends BaseController {
/** /**
* 删除新客自动拉群 * 删除新客自动拉群
*/ */
@ApiOperation(value = "删除新客自动拉群",httpMethod = "DELETE") @ApiOperation(value = "删除新客自动拉群", httpMethod = "DELETE")
@PreAuthorize("@ss.hasPermi('wecom:communityNewGroup:remove')") @PreAuthorize("@ss.hasPermi('wecom:communityNewGroup:remove')")
@Log(title = "新客自动拉群", businessType = BusinessType.DELETE) @Log(title = "新客自动拉群", businessType = BusinessType.DELETE)
@DeleteMapping("/delete/{ids}") @DeleteMapping("/delete/{ids}")
...@@ -90,7 +103,7 @@ public class WeCommunityNewGroupController extends BaseController { ...@@ -90,7 +103,7 @@ public class WeCommunityNewGroupController extends BaseController {
/** /**
* 新增新客自动拉群 * 新增新客自动拉群
*/ */
@ApiOperation(value = "新增新客自动拉群",httpMethod = "POST") @ApiOperation(value = "新增新客自动拉群", httpMethod = "POST")
@PreAuthorize("@ss.hasPermi('wecom:communityNewGroup:add')") @PreAuthorize("@ss.hasPermi('wecom:communityNewGroup:add')")
@Log(title = "新客自动拉群", businessType = BusinessType.INSERT) @Log(title = "新客自动拉群", businessType = BusinessType.INSERT)
@PostMapping("/add") @PostMapping("/add")
...@@ -100,9 +113,9 @@ public class WeCommunityNewGroupController extends BaseController { ...@@ -100,9 +113,9 @@ public class WeCommunityNewGroupController extends BaseController {
return AjaxResult.success(); return AjaxResult.success();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
if (e instanceof WeComException){ if (e instanceof WeComException) {
return AjaxResult.error(e.getMessage()); return AjaxResult.error(e.getMessage());
}else { } else {
return AjaxResult.error("请求接口异常!"); return AjaxResult.error("请求接口异常!");
} }
} }
...@@ -110,4 +123,72 @@ public class WeCommunityNewGroupController extends BaseController { ...@@ -110,4 +123,72 @@ public class WeCommunityNewGroupController extends BaseController {
} }
/**
* 员工活码批量下载
*
* @param ids 新客自动拉群ids
* @param request 请求
* @param response 输出
* @throws Exception
*/
@ApiOperation(value = "员工活码批量下载", httpMethod = "GET")
@PreAuthorize("@ss.hasPermi('wecom:code:downloadBatch')")
@Log(title = "员工活码批量下载", businessType = BusinessType.OTHER)
@GetMapping("/downloadBatch")
public void downloadBatch(String ids, HttpServletRequest request, HttpServletResponse response) {
List<String> idList = Arrays.stream(Optional.ofNullable(ids).orElse("").split(","))
.filter(StringUtils::isNotEmpty).collect(Collectors.toList());
try {
List<WeCommunityNewGroupVo> weCommunityNewGroupVos = weCommunityNewGroupService.selectWeCommunityNewGroupByIds(idList);
//zip输出流
ZipOutputStream zos = new ZipOutputStream(response.getOutputStream());
if (CollectionUtil.isNotEmpty(weCommunityNewGroupVos)) {
for (WeCommunityNewGroupVo communityNewGroupVo : weCommunityNewGroupVos) {
String qrCode = communityNewGroupVo.getQrCode();
if (StringUtils.isEmpty(qrCode)) {
continue;
}
URL url = new URL(qrCode);
//每个二维码名称
String fileName = communityNewGroupVo.getEmpleCodeName() + communityNewGroupVo.getActivityScene() + ".jpg";
zos.putNextEntry(new ZipEntry(fileName));
InputStream fis = url.openConnection().getInputStream();
byte[] buffer = new byte[1024];
int r = 0;
while ((r = fis.read(buffer)) != -1) {
zos.write(buffer, 0, r);
}
fis.close();
}
}
//关闭zip输出流
zos.flush();
zos.close();
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
@ApiOperation(value = "员工活码下载", httpMethod = "GET")
@PreAuthorize("@ss.hasPermi('wecom:code:download')")
@Log(title = "员工活码下载", businessType = BusinessType.OTHER)
@GetMapping("/download")
public void download(String id, HttpServletRequest request, HttpServletResponse response) {
WeCommunityNewGroupVo communityNewGroupVo = weCommunityNewGroupService.selectWeCommunityNewGroupById(Long.valueOf(id));
if (StringUtils.isEmpty(communityNewGroupVo.getQrCode())) {
return;
} else {
try {
FileUtils.downloadFile(communityNewGroupVo.getQrCode(), response.getOutputStream());
} catch (IOException e) {
e.printStackTrace();
}
}
}
} }
...@@ -79,7 +79,7 @@ public class WePosterController extends BaseController { ...@@ -79,7 +79,7 @@ public class WePosterController extends BaseController {
poster.setMediaType(null); poster.setMediaType(null);
wePosterService.generateSimpleImg(poster); wePosterService.generateSimpleImg(poster);
wePosterService.saveOrUpdate(poster); wePosterService.saveOrUpdate(poster);
List<WePosterSubassembly> posterSubassemblyList = wePosterSubassemblyService.lambdaQuery().eq(WePosterSubassembly::getPosterId, poster.getId()).eq(WePosterSubassembly::getDelFlag, 1).list(); List<WePosterSubassembly> posterSubassemblyList = wePosterSubassemblyService.lambdaQuery().eq(WePosterSubassembly::getPosterId, poster.getId()).eq(WePosterSubassembly::getDelFlag, 0).list();
Map<Long, WePosterSubassembly> posterSubassemblyMap = posterSubassemblyList.stream().collect(Collectors.toMap(WePosterSubassembly::getId, p -> p)); Map<Long, WePosterSubassembly> posterSubassemblyMap = posterSubassemblyList.stream().collect(Collectors.toMap(WePosterSubassembly::getId, p -> p));
if(!CollectionUtils.isEmpty(poster.getPosterSubassemblyList())) { if(!CollectionUtils.isEmpty(poster.getPosterSubassemblyList())) {
List<WePosterSubassembly> insertList = new ArrayList<>(); List<WePosterSubassembly> insertList = new ArrayList<>();
...@@ -104,8 +104,7 @@ public class WePosterController extends BaseController { ...@@ -104,8 +104,7 @@ public class WePosterController extends BaseController {
} }
List<WePosterSubassembly> deleteList = new ArrayList<>(posterSubassemblyMap.values()); List<WePosterSubassembly> deleteList = new ArrayList<>(posterSubassemblyMap.values());
if (!CollectionUtils.isEmpty(deleteList)) { if (!CollectionUtils.isEmpty(deleteList)) {
deleteList.forEach(wePosterSubassembly -> wePosterSubassembly.setDelFlag(1)); wePosterSubassemblyService.update(Wrappers.lambdaUpdate(WePosterSubassembly.class).set(WePosterSubassembly::getDelFlag,1).in(WePosterSubassembly::getId,deleteList.stream().map(WePosterSubassembly::getId).collect(Collectors.toList())));
wePosterSubassemblyService.updateBatchById(deleteList);
} }
return AjaxResult.success("修改成功"); return AjaxResult.success("修改成功");
} }
......
spring.cloud.nacos.config.server-addr=${NACOS_SERVER:119.45.28.29:10848} spring.cloud.nacos.config.server-addr=${NACOS_SERVER:119.45.28.29:10848}
spring.cloud.nacos.config.namespace=627a666a-76b2-42ad-a1b0-70a12d2c73fd spring.cloud.nacos.config.namespace=627a666a-76b2-42ad-a1b0-70a12d2c73fd
spring.application.name=link-wechat spring.application.name=link-wechat
spring.cloud.nacos.config.file-extension=yaml
spring.cloud.nacos.config.username=dev
spring.cloud.nacos.config.password=dev
\ No newline at end of file \ No newline at end of file
spring.cloud.nacos.config.file-extension=yaml
\ No newline at end of file \ No newline at end of file
...@@ -149,8 +149,6 @@ ...@@ -149,8 +149,6 @@
</dependency> </dependency>
<!--防止进入swagger页面报类型转换错误,排除2.9.2中的引用,手动增加1.5.21版本--> <!--防止进入swagger页面报类型转换错误,排除2.9.2中的引用,手动增加1.5.21版本-->
<dependency> <dependency>
<groupId>io.swagger</groupId> <groupId>io.swagger</groupId>
...@@ -245,6 +243,23 @@ ...@@ -245,6 +243,23 @@
<artifactId>cos_api</artifactId> <artifactId>cos_api</artifactId>
<version>5.6.24</version> <version>5.6.24</version>
</dependency> </dependency>
<!-- 增加RSA PKCS1解密支持 -->
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.68</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpg-jdk15on</artifactId>
<version>1.68</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk15on</artifactId>
<version>1.68</version>
</dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file \ No newline at end of file
...@@ -97,12 +97,16 @@ public class ElasticSearch { ...@@ -97,12 +97,16 @@ public class ElasticSearch {
return; return;
} }
CreateIndexRequest request = new CreateIndexRequest(idxName); CreateIndexRequest request = new CreateIndexRequest(idxName);
GetIndexRequest getIndexRequest = new GetIndexRequest(idxName);
buildSetting(request); buildSetting(request);
request.mapping(builder); request.mapping(builder);
// request.settings() 手工指定Setting // request.settings() 手工指定Setting
CreateIndexResponse res = restHighLevelClient.indices().create(request, RequestOptions.DEFAULT); boolean exists = restHighLevelClient.indices().exists(getIndexRequest, RequestOptions.DEFAULT);
if (!res.isAcknowledged()) { if (!exists) {
log.info("初始化失败"); CreateIndexResponse res = restHighLevelClient.indices().create(request, RequestOptions.DEFAULT);
if (!res.isAcknowledged()) {
log.info("初始化失败");
}
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
......
package com.linkwechat.common.utils.wecom; package com.linkwechat.common.utils.wecom;
import sun.security.util.DerInputStream; import org.bouncycastle.openssl.PEMKeyPair;
import sun.security.util.DerValue; import org.bouncycastle.openssl.PEMParser;
import org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter;
import javax.crypto.BadPaddingException; import javax.crypto.BadPaddingException;
import javax.crypto.Cipher; import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException; import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException; import javax.crypto.NoSuchPaddingException;
import java.io.IOException; import java.io.IOException;
import java.math.BigInteger; import java.io.Reader;
import java.security.InvalidKeyException; import java.io.StringReader;
import java.security.KeyFactory; import java.nio.charset.StandardCharsets;
import java.security.NoSuchAlgorithmException; import java.security.*;
import java.security.PrivateKey;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.RSAPrivateCrtKeySpec;
import java.util.Base64; import java.util.Base64;
/** /**
...@@ -26,51 +24,42 @@ public class RSAUtil { ...@@ -26,51 +24,42 @@ public class RSAUtil {
/** /**
* RSA pkcs1 2048bit 解密工具, * RSA pkcs1 2048bit 解密工具,
* 获取私钥PrivateKey * 获取私钥PrivateKey
*
* @param privKeyPEM 2048bit pkcs1格式,base64编码后的RSA字符串 * @param privKeyPEM 2048bit pkcs1格式,base64编码后的RSA字符串
* @return PrivateKey,用于解密 decryptRSA * @return PrivateKey, 用于解密 decryptRSA
* @throws IOException 异常 * @throws IOException 异常
* @throws NoSuchAlgorithmException 异常
* @throws InvalidKeySpecException 异常
*/ */
public static PrivateKey getPrivateKey(String privKeyPEM) throws IOException, NoSuchAlgorithmException, InvalidKeySpecException { public static PrivateKey getPrivateKey(String privKeyPEM) throws IOException {
String privKeyPEMnew = privKeyPEM.replaceAll("\\r\\n", "")//看看保存到数据库的这个字符是不是有\r,如果没有,那就只需要替换掉"\\n" PrivateKey privateKey = null;
.replaceAll("\n", "") Reader privateKeyReader = new StringReader(privKeyPEM);
.replace("-----BEGIN RSA PRIVATE KEY-----", "") PEMParser privatePemParser = new PEMParser(privateKeyReader);
.replace("-----END RSA PRIVATE KEY-----", ""); Object privateObject = privatePemParser.readObject();
byte[] bytes = java.util.Base64.getDecoder().decode(privKeyPEMnew); if (privateObject instanceof PEMKeyPair) {
DerInputStream derReader = new DerInputStream(bytes); PEMKeyPair pemKeyPair = (PEMKeyPair) privateObject;
DerValue[] seq = derReader.getSequence(0); JcaPEMKeyConverter converter = new JcaPEMKeyConverter().setProvider("BC");
BigInteger modulus = seq[1].getBigInteger(); privateKey = converter.getPrivateKey(pemKeyPair.getPrivateKeyInfo());
BigInteger publicExp = seq[2].getBigInteger(); }
BigInteger privateExp = seq[3].getBigInteger();
BigInteger prime1 = seq[4].getBigInteger();
BigInteger prime2 = seq[5].getBigInteger();
BigInteger exp1 = seq[6].getBigInteger();
BigInteger exp2 = seq[7].getBigInteger();
BigInteger crtCoef = seq[8].getBigInteger();
RSAPrivateCrtKeySpec keySpec = new RSAPrivateCrtKeySpec(modulus, publicExp, privateExp, prime1, prime2, exp1, exp2, crtCoef);
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
PrivateKey privateKey = keyFactory.generatePrivate(keySpec);
return privateKey; return privateKey;
} }
/** /**
* RSA pkcs1 2048bit 解密工具, * RSA pkcs1 2048bit 解密工具,
* @param str 被解密的字符串 *
* @param str 被解密的字符串
* @param privateKey 私钥对象 从 getPrivateKey 获取 * @param privateKey 私钥对象 从 getPrivateKey 获取
* @return 解密后数据 * @return 解密后数据
* @throws NoSuchPaddingException 异常 * @throws NoSuchPaddingException 异常
* @throws NoSuchAlgorithmException 异常 * @throws NoSuchAlgorithmException 异常
* @throws InvalidKeyException 异常 * @throws InvalidKeyException 异常
* @throws BadPaddingException 异常 * @throws BadPaddingException 异常
* @throws IllegalBlockSizeException 异常 * @throws IllegalBlockSizeException 异常
*/ */
public static String decryptRSA(String str, PrivateKey privateKey) throws NoSuchPaddingException, public static String decryptRSA(String str, PrivateKey privateKey) throws NoSuchPaddingException,
NoSuchAlgorithmException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException { NoSuchAlgorithmException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException, NoSuchProviderException {
Cipher cipher = Cipher.getInstance("RSA"); Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
cipher.init(Cipher.DECRYPT_MODE, privateKey); Cipher rsa = Cipher.getInstance("RSA/ECB/PKCS1Padding", "BC");
byte[] randomkeybyte = Base64.getDecoder().decode(str); rsa.init(Cipher.DECRYPT_MODE, privateKey);
byte[] finalrandomkeybyte = cipher.doFinal(randomkeybyte); byte[] utf8 = rsa.doFinal(Base64.getDecoder().decode(str));
return new String(finalrandomkeybyte); return new String(utf8, StandardCharsets.UTF_8);
} }
} }
...@@ -5,7 +5,6 @@ import com.alibaba.fastjson.JSONArray; ...@@ -5,7 +5,6 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.linkwechat.common.config.CosConfig; import com.linkwechat.common.config.CosConfig;
import com.linkwechat.common.config.RuoYiConfig; import com.linkwechat.common.config.RuoYiConfig;
import com.linkwechat.common.constant.Constants;
import com.linkwechat.common.constant.WeConstans; import com.linkwechat.common.constant.WeConstans;
import com.linkwechat.common.core.redis.RedisCache; import com.linkwechat.common.core.redis.RedisCache;
import com.linkwechat.common.utils.DateUtils; import com.linkwechat.common.utils.DateUtils;
......
...@@ -21,7 +21,8 @@ public interface WeCommunityNewGroupMapper extends BaseMapper<WeCommunityNewGrou ...@@ -21,7 +21,8 @@ public interface WeCommunityNewGroupMapper extends BaseMapper<WeCommunityNewGrou
* @param communityNewGroup 搜索信息 * @param communityNewGroup 搜索信息
* @return {@link WeCommunityNewGroup}s * @return {@link WeCommunityNewGroup}s
*/ */
List<WeCommunityNewGroupVo> selectWeCommunityNewGroupList(WeCommunityNewGroup communityNewGroup); List<WeCommunityNewGroupVo> selectWeCommunityNewGroupList(@Param("empleCodeName") String empleCodeName, @Param("createBy") String createBy
,@Param("beginTime") String beginTime, @Param("endTime") String endTime);
/** /**
* 获取新客自动拉群详细信息 * 获取新客自动拉群详细信息
...@@ -38,4 +39,12 @@ public interface WeCommunityNewGroupMapper extends BaseMapper<WeCommunityNewGrou ...@@ -38,4 +39,12 @@ public interface WeCommunityNewGroupMapper extends BaseMapper<WeCommunityNewGrou
*/ */
int batchRemoveWeCommunityNewGroupIds(List<String> idList); int batchRemoveWeCommunityNewGroupIds(List<String> idList);
/**
* 通过id查询新客自动拉群信息列表
*
* @param ids id列表
* @return {@link WeCommunityNewGroup} 新客自动拉群信息
*/
List<WeCommunityNewGroupVo> selectWeCommunityNewGroupByIds(@Param("ids") List<String> ids);
} }
...@@ -26,13 +26,13 @@ public interface IWeCommunityNewGroupService extends IService<WeCommunityNewGrou ...@@ -26,13 +26,13 @@ public interface IWeCommunityNewGroupService extends IService<WeCommunityNewGrou
/** /**
* 查询新客自动拉群列表 * 查询新客自动拉群列表
* *
* @param communityNewGroup 搜索信息
* @return {@link WeCommunityNewGroup}s * @return {@link WeCommunityNewGroup}s
*/ */
List<WeCommunityNewGroupVo> selectWeCommunityNewGroupList(WeCommunityNewGroup communityNewGroup); List<WeCommunityNewGroupVo> selectWeCommunityNewGroupList(String empleCodeName, String createBy, String beginTime, String endTime);
/** /**
* 获取新客自动拉群详细信息 * 获取新客自动拉群详细信息
*
* @param newGroupId 主键id * @param newGroupId 主键id
* @return {@link WeCommunityNewGroupVo} 自动拉群信息 * @return {@link WeCommunityNewGroupVo} 自动拉群信息
*/ */
...@@ -40,6 +40,7 @@ public interface IWeCommunityNewGroupService extends IService<WeCommunityNewGrou ...@@ -40,6 +40,7 @@ public interface IWeCommunityNewGroupService extends IService<WeCommunityNewGrou
/** /**
* 修改新客自动拉群 * 修改新客自动拉群
*
* @param communityNewGroupDto 信息 * @param communityNewGroupDto 信息
* @return 结果 * @return 结果
*/ */
...@@ -51,5 +52,22 @@ public interface IWeCommunityNewGroupService extends IService<WeCommunityNewGrou ...@@ -51,5 +52,22 @@ public interface IWeCommunityNewGroupService extends IService<WeCommunityNewGrou
* @param idList id列表 * @param idList id列表
* @return * @return
*/ */
int batchRemoveWeCommunityNewGroupIds(List<String> idList); int batchRemoveWeCommunityNewGroupIds(List<String> idList);
/**
* 通过id查询新客自动拉群信息
*
* @param id id
* @return {@link WeCommunityNewGroup} 新客自动拉群信息
*/
WeCommunityNewGroupVo selectWeCommunityNewGroupById(long id);
/**
* 通过id查询新客自动拉群信息列表
*
* @param ids id列表
* @return {@link WeCommunityNewGroup} 新客自动拉群信息
*/
List<WeCommunityNewGroupVo> selectWeCommunityNewGroupByIds(List<String> ids);
} }
...@@ -32,7 +32,7 @@ import java.util.stream.Collectors; ...@@ -32,7 +32,7 @@ import java.util.stream.Collectors;
*/ */
@Service @Service
@Slf4j @Slf4j
public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewGroupMapper, WeCommunityNewGroup> implements IWeCommunityNewGroupService { public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewGroupMapper, WeCommunityNewGroup> implements IWeCommunityNewGroupService {
@Autowired @Autowired
private WeGroupCodeMapper weGroupCodeMapper; private WeGroupCodeMapper weGroupCodeMapper;
...@@ -61,7 +61,7 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewG ...@@ -61,7 +61,7 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewG
//检查群活码是否存在 //检查群活码是否存在
WeGroupCode weGroupCode = weGroupCodeMapper.selectWeGroupCodeById(communityNewGroupDto.getGroupCodeId()); WeGroupCode weGroupCode = weGroupCodeMapper.selectWeGroupCodeById(communityNewGroupDto.getGroupCodeId());
if(null!=weGroupCode){ if (null != weGroupCode) {
throw new WeComException("群活码不存在!"); throw new WeComException("群活码不存在!");
} }
WeEmpleCode weEmpleCode = getWeEmpleCode(communityNewGroupDto); WeEmpleCode weEmpleCode = getWeEmpleCode(communityNewGroupDto);
...@@ -71,7 +71,7 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewG ...@@ -71,7 +71,7 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewG
WeExternalContactDto qrCode = weEmpleCodeService.getQrCode(weContactWay); WeExternalContactDto qrCode = weEmpleCodeService.getQrCode(weContactWay);
//保存新客自动拉群信息 //保存新客自动拉群信息
WeCommunityNewGroup communityNewGroup=new WeCommunityNewGroup(); WeCommunityNewGroup communityNewGroup = new WeCommunityNewGroup();
communityNewGroup.setNewGroupId(weGroupCode.getId()); communityNewGroup.setNewGroupId(weGroupCode.getId());
communityNewGroup.setEmpleCodeName(communityNewGroupDto.getActivityScene()); communityNewGroup.setEmpleCodeName(communityNewGroupDto.getActivityScene());
communityNewGroup.setDelFlag(0); communityNewGroup.setDelFlag(0);
...@@ -115,9 +115,9 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewG ...@@ -115,9 +115,9 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewG
} }
@Override @Override
public List<WeCommunityNewGroupVo> selectWeCommunityNewGroupList(WeCommunityNewGroup communityNewGroup) { public List<WeCommunityNewGroupVo> selectWeCommunityNewGroupList(String empleCodeName, String createBy, String beginTime, String endTime) {
List<WeCommunityNewGroupVo> weCommunityNewGroupVos = weCommunityNewGroupMapper.selectWeCommunityNewGroupList(communityNewGroup); List<WeCommunityNewGroupVo> weCommunityNewGroupVos = weCommunityNewGroupMapper.selectWeCommunityNewGroupList(empleCodeName, createBy, beginTime, endTime);
if(CollectionUtil.isNotEmpty(weCommunityNewGroupVos)){ if (CollectionUtil.isNotEmpty(weCommunityNewGroupVos)) {
List<Long> newGroupIdList = weCommunityNewGroupVos.stream().map(WeCommunityNewGroupVo::getNewGroupId).collect(Collectors.toList()); List<Long> newGroupIdList = weCommunityNewGroupVos.stream().map(WeCommunityNewGroupVo::getNewGroupId).collect(Collectors.toList());
List<WeEmpleCodeUseScop> useScopList = iWeEmpleCodeUseScopService.selectWeEmpleCodeUseScopListByIds(newGroupIdList); List<WeEmpleCodeUseScop> useScopList = iWeEmpleCodeUseScopService.selectWeEmpleCodeUseScopListByIds(newGroupIdList);
List<WeEmpleCodeTag> tagList = weEmpleCodeTagService.selectWeEmpleCodeTagListByIds(newGroupIdList); List<WeEmpleCodeTag> tagList = weEmpleCodeTagService.selectWeEmpleCodeTagListByIds(newGroupIdList);
...@@ -139,7 +139,7 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewG ...@@ -139,7 +139,7 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewG
@Override @Override
public WeCommunityNewGroupVo selectWeCommunityNewGroupById(Long newGroupId) { public WeCommunityNewGroupVo selectWeCommunityNewGroupById(Long newGroupId) {
WeCommunityNewGroupVo weCommunityNewGroupVo = weCommunityNewGroupMapper.selectWeCommunityNewGroupById(newGroupId); WeCommunityNewGroupVo weCommunityNewGroupVo = weCommunityNewGroupMapper.selectWeCommunityNewGroupById(newGroupId);
if(null!=weCommunityNewGroupVo){ if (null != weCommunityNewGroupVo) {
List<WeGroupCodeActual> weGroupCodeActuals = getWeGroupCodeActuals(weCommunityNewGroupVo); List<WeGroupCodeActual> weGroupCodeActuals = getWeGroupCodeActuals(weCommunityNewGroupVo);
weCommunityNewGroupVo.setWeGroupUserScops(weGroupCodeActuals); weCommunityNewGroupVo.setWeGroupUserScops(weGroupCodeActuals);
List<WeEmpleCodeUseScop> useScopList = iWeEmpleCodeUseScopService.selectWeEmpleCodeUseScopListByIds(Lists.newArrayList(weCommunityNewGroupVo.getNewGroupId())); List<WeEmpleCodeUseScop> useScopList = iWeEmpleCodeUseScopService.selectWeEmpleCodeUseScopListByIds(Lists.newArrayList(weCommunityNewGroupVo.getNewGroupId()));
...@@ -166,13 +166,13 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewG ...@@ -166,13 +166,13 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewG
//检查群活码是否存在 //检查群活码是否存在
WeGroupCode weGroupCode = weGroupCodeMapper.selectWeGroupCodeById(communityNewGroupDto.getGroupCodeId()); WeGroupCode weGroupCode = weGroupCodeMapper.selectWeGroupCodeById(communityNewGroupDto.getGroupCodeId());
if(null!=weGroupCode){ if (null != weGroupCode) {
throw new WeComException("群活码不存在!"); throw new WeComException("群活码不存在!");
} }
//查询新客自动拉群信息 //查询新客自动拉群信息
WeCommunityNewGroup communityNewGroup = weCommunityNewGroupMapper.selectById(communityNewGroupDto.getGroupCodeId()); WeCommunityNewGroup communityNewGroup = weCommunityNewGroupMapper.selectById(communityNewGroupDto.getGroupCodeId());
if(null!=communityNewGroup){ if (null != communityNewGroup) {
throw new WeComException("信息不存在!"); throw new WeComException("信息不存在!");
} }
...@@ -216,4 +216,13 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewG ...@@ -216,4 +216,13 @@ public class WeCommunityNewGroupServiceImpl extends ServiceImpl<WeCommunityNewG
return weCommunityNewGroupMapper.batchRemoveWeCommunityNewGroupIds(idList); return weCommunityNewGroupMapper.batchRemoveWeCommunityNewGroupIds(idList);
} }
@Override
public WeCommunityNewGroupVo selectWeCommunityNewGroupById(long id) {
return weCommunityNewGroupMapper.selectWeCommunityNewGroupById(id);
}
@Override
public List<WeCommunityNewGroupVo> selectWeCommunityNewGroupByIds(List<String> ids) {
return weCommunityNewGroupMapper.selectWeCommunityNewGroupByIds(ids);
}
} }
...@@ -126,13 +126,24 @@ public class WePosterServiceImpl extends ServiceImpl<WePosterMapper, WePoster> i ...@@ -126,13 +126,24 @@ public class WePosterServiceImpl extends ServiceImpl<WePosterMapper, WePoster> i
poster.setSampleImgPath(poster.getBackgroundImgPath()); poster.setSampleImgPath(poster.getBackgroundImgPath());
return poster.getBackgroundImgPath(); return poster.getBackgroundImgPath();
} }
Map<Long, Font> fontMap = poster.getPosterSubassemblyList().stream().filter(wePosterSubassembly -> wePosterSubassembly.getType().equals(1)) Set<String> existFontId = new HashSet<>();
Map<String, Font> fontMap = poster.getPosterSubassemblyList().stream().filter(wePosterSubassembly -> wePosterSubassembly.getType().equals(1))
.peek(wePosterSubassembly -> { .peek(wePosterSubassembly -> {
if(wePosterSubassembly.getFontId() == null){ if (wePosterSubassembly.getFontId() == null) {
wePosterSubassembly.setFontId(0L); wePosterSubassembly.setFontId(0L);
} }
}) })
.collect(Collectors.toMap(WePosterSubassembly::getFontId, wePosterSubassembly -> posterFontService.getFont(wePosterSubassembly.getFontId(), wePosterSubassembly.getFontSize(),wePosterSubassembly.getFontStyle()))); .filter(wePosterSubassembly -> {
if(existFontId.contains(wePosterSubassembly.getFontId()+"_"+wePosterSubassembly.getFontSize()+"_"+wePosterSubassembly.getFontStyle())){
return false;
}else {
existFontId.add(wePosterSubassembly.getFontId()+"_"+wePosterSubassembly.getFontSize()+"_"+wePosterSubassembly.getFontStyle());
return true;
}
})
.collect(Collectors.toMap(wePosterSubassembly -> {
return wePosterSubassembly.getFontId()+"_"+wePosterSubassembly.getFontSize()+"_"+wePosterSubassembly.getFontStyle();
}, wePosterSubassembly -> posterFontService.getFont(wePosterSubassembly.getFontId(), wePosterSubassembly.getFontSize(),wePosterSubassembly.getFontStyle())));
Map<String, NetFileUtils.FileCallable> fileCallableMap = poster.getPosterSubassemblyList().stream().map(WePosterSubassembly::getImgPath).filter(StringUtils::isNotBlank).distinct().collect(Collectors.toMap(s->s, NetFileUtils::getNetFile)); Map<String, NetFileUtils.FileCallable> fileCallableMap = poster.getPosterSubassemblyList().stream().map(WePosterSubassembly::getImgPath).filter(StringUtils::isNotBlank).distinct().collect(Collectors.toMap(s->s, NetFileUtils::getNetFile));
if (CollectionUtils.isEmpty(fileCallableMap)) { if (CollectionUtils.isEmpty(fileCallableMap)) {
fileCallableMap = new HashMap<>(); fileCallableMap = new HashMap<>();
...@@ -151,7 +162,7 @@ public class WePosterServiceImpl extends ServiceImpl<WePosterMapper, WePoster> i ...@@ -151,7 +162,7 @@ public class WePosterServiceImpl extends ServiceImpl<WePosterMapper, WePoster> i
poster.setHeight(backgroundImg.getHeight()); poster.setHeight(backgroundImg.getHeight());
poster.getPosterSubassemblyList().forEach(wePosterSubassembly -> { poster.getPosterSubassemblyList().forEach(wePosterSubassembly -> {
if (wePosterSubassembly.getType().equals(1)) { if (wePosterSubassembly.getType().equals(1)) {
Font font = fontMap.get(wePosterSubassembly.getFontId()); Font font = fontMap.get(wePosterSubassembly.getFontId()+"_"+wePosterSubassembly.getFontSize()+"_"+wePosterSubassembly.getFontStyle());
FontMetrics fontMetrics = ImageUtils.getFontMetrics(font); FontMetrics fontMetrics = ImageUtils.getFontMetrics(font);
Color color; Color color;
if (StringUtils.isNotBlank(wePosterSubassembly.getFontColor())) { if (StringUtils.isNotBlank(wePosterSubassembly.getFontColor())) {
......
...@@ -257,7 +257,7 @@ public class WeSensitiveServiceImpl implements IWeSensitiveService { ...@@ -257,7 +257,7 @@ public class WeSensitiveServiceImpl implements IWeSensitiveService {
private void addHitSensitiveList(List<JSONObject> json, WeSensitive weSensitive) { private void addHitSensitiveList(List<JSONObject> json, WeSensitive weSensitive) {
elasticSearch.createIndex2(WeConstans.WECOM_SENSITIVE_HIT_INDEX, getSensitiveHitMapping()); elasticSearch.createIndex2(WeConstans.WECOM_SENSITIVE_HIT_INDEX, getSensitiveHitMapping());
boolean sendMessage = false; boolean sendMessage = false;
if (weSensitive.getAlertFlag().equals(1)) { if (weSensitive.getAlertFlag().equals(1) && CollectionUtils.isNotEmpty(json)) {
//发送消息通知给相应的审计人 //发送消息通知给相应的审计人
WeCorpAccount weCorpAccount = weCorpAccountService.findValidWeCorpAccount(); WeCorpAccount weCorpAccount = weCorpAccountService.findValidWeCorpAccount();
String auditUserId = weSensitive.getAuditUserId(); String auditUserId = weSensitive.getAuditUserId();
...@@ -268,7 +268,7 @@ public class WeSensitiveServiceImpl implements IWeSensitiveService { ...@@ -268,7 +268,7 @@ public class WeSensitiveServiceImpl implements IWeSensitiveService {
pushDto.setTouser(auditUserId); pushDto.setTouser(auditUserId);
pushDto.setMsgtype(MessageType.TEXT.getMessageType()); pushDto.setMsgtype(MessageType.TEXT.getMessageType());
pushDto.setText(textMessageDto); pushDto.setText(textMessageDto);
weMessagePushClient.sendMessageToUser(pushDto,weCorpAccount.getAgentId()); weMessagePushClient.sendMessageToUser(pushDto, weCorpAccount.getAgentId());
sendMessage = true; sendMessage = true;
} }
//批量提交插入记录 //批量提交插入记录
......
...@@ -5,23 +5,21 @@ ...@@ -5,23 +5,21 @@
<mapper namespace="com.linkwechat.wecom.mapper.WeCommunityNewGroupMapper"> <mapper namespace="com.linkwechat.wecom.mapper.WeCommunityNewGroupMapper">
<sql id="selectSql"> <sql id="selectSql">
SELECT SELECT new_group_id,
new_group_id, emple_code_name,
emple_code_name, group_code_id,
group_code_id, create_by,
create_by, create_time,
create_time, update_by,
update_by, update_time,
update_time, del_flag,
del_flag, activity_scene,
activity_scene, welcome_msg,
welcome_msg, qr_code,
qr_code, is_join_confirm_friends,
is_join_confirm_friends, media_id,
media_id, join_friend_nums
join_friend_nums FROM we_community_new_group
FROM
we_community_new_group
</sql> </sql>
<update id="batchRemoveWeCommunityNewGroupIds"> <update id="batchRemoveWeCommunityNewGroupIds">
update we_community_new_group set update we_community_new_group set
...@@ -29,16 +27,29 @@ ...@@ -29,16 +27,29 @@
where new_group_id in where new_group_id in
<foreach collection="ids" item="id" index="index" <foreach collection="ids" item="id" index="index"
separator="," open="(" close=")"> separator="," open="(" close=")">
#{newGroupId} #{id}
</foreach> </foreach>
</update> </update>
<select id="selectWeCommunityNewGroupList" <select id="selectWeCommunityNewGroupList"
resultType="com.linkwechat.wecom.domain.vo.WeCommunityNewGroupVo"> resultType="com.linkwechat.wecom.domain.vo.WeCommunityNewGroupVo">
<include refid="selectSql"/> <include refid="selectSql"/>
<where> <where>
emple_code_name LIKE CONCAT("%",#{empleCodeName},"%") AND del_flag = 0 del_flag = 0
</where> <if test="empleCodeName!=null and empleCodeName!=''">
AND emple_code_name LIKE CONCAT("%",#{empleCodeName},"%")
</if>
<if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
AND date_format(create_time,'%y%m%d') &gt;= date_format(#{beginTime},'%y%m%d')
</if>
<if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
AND date_format(create_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
</if>
<if test="createBy!=null and createBy!=''">
AND create_by LIKE CONCAT("%",#{createBy},"%")
</if>
</where>
</select> </select>
<select id="selectWeCommunityNewGroupById" <select id="selectWeCommunityNewGroupById"
...@@ -49,4 +60,15 @@ ...@@ -49,4 +60,15 @@
</where> </where>
</select> </select>
<select id="selectWeCommunityNewGroupByIds" resultType="com.linkwechat.wecom.domain.vo.WeCommunityNewGroupVo">
<include refid="selectSql"/>
<where>
new_group_id in
<foreach collection="ids" item="id" index="index"
separator="," open="(" close=")">
#{id}
</foreach>
</where>
</select>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
AND wcm.create_by=#{sender} AND wcm.create_by=#{sender}
</if> </if>
</where> </where>
ORDER BY wcmo.create_time DESC
</select> </select>
<select id="findCustomerMessagePushDetail" <select id="findCustomerMessagePushDetail"
resultType="com.linkwechat.wecom.domain.vo.CustomerMessagePushVo"> resultType="com.linkwechat.wecom.domain.vo.CustomerMessagePushVo">
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
chat_name chat_name
) )
VALUES VALUES
<foreach collection="list" item="item" separator="," index="index" > <foreach collection="customers" item="item" separator="," index="index" >
(#{item.messgaeResultId}, (#{item.messgaeResultId},
#{item.messageId}, #{item.messageId},
#{item.externalUserid}, #{item.externalUserid},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!