|
@@ -204,14 +204,15 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
|
|
row.createCell(12).setCellValue(vo.getFrozen());
|
|
row.createCell(12).setCellValue(vo.getFrozen());
|
|
}
|
|
}
|
|
|
|
|
|
- //先把读进来的图片放到一个ByteArrayOutputStream中,以便产生ByteArray
|
|
|
|
- ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();
|
|
|
|
|
|
+
|
|
|
|
|
|
//查询 图片 url
|
|
//查询 图片 url
|
|
List<String> imageUrlList = reportSettlementMapper.getAccountImagesBytedance(accountId,paramsVo.getUploadYears());
|
|
List<String> imageUrlList = reportSettlementMapper.getAccountImagesBytedance(accountId,paramsVo.getUploadYears());
|
|
|
|
|
|
if (!Check.isNull(imageUrlList)){
|
|
if (!Check.isNull(imageUrlList)){
|
|
for (int j = 0; j < imageUrlList.size(); j++) {
|
|
for (int j = 0; j < imageUrlList.size(); j++) {
|
|
|
|
+ //先把读进来的图片放到一个ByteArrayOutputStream中,以便产生ByteArray
|
|
|
|
+ ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();
|
|
String imagePath = imageUrlList.get(j);
|
|
String imagePath = imageUrlList.get(j);
|
|
//通过图片网络地址 获取输入流
|
|
//通过图片网络地址 获取输入流
|
|
/* InputStream is = createExcelByTemplate.getInputStreamByUrl(imagePath);
|
|
/* InputStream is = createExcelByTemplate.getInputStreamByUrl(imagePath);
|
|
@@ -220,8 +221,6 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
|
|
URL url = new URL(imagePath);
|
|
URL url = new URL(imagePath);
|
|
Image imageTookittitle = Toolkit.getDefaultToolkit().createImage(url);
|
|
Image imageTookittitle = Toolkit.getDefaultToolkit().createImage(url);
|
|
BufferedImage bufferImg = createExcelByTemplate.toBufferedImage(imageTookittitle);
|
|
BufferedImage bufferImg = createExcelByTemplate.toBufferedImage(imageTookittitle);
|
|
-
|
|
|
|
-
|
|
|
|
ImageIO.write(bufferImg, imagePath.substring(imagePath.lastIndexOf(".") + 1), byteArrayOut);
|
|
ImageIO.write(bufferImg, imagePath.substring(imagePath.lastIndexOf(".") + 1), byteArrayOut);
|
|
int startIndex = settlementList.size() +6;
|
|
int startIndex = settlementList.size() +6;
|
|
//anchor主要用于设置图片的属性
|
|
//anchor主要用于设置图片的属性
|
|
@@ -394,14 +393,15 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
|
|
row.createCell(12).setCellValue(vo.getBalance());
|
|
row.createCell(12).setCellValue(vo.getBalance());
|
|
}
|
|
}
|
|
|
|
|
|
- //先把读进来的图片放到一个ByteArrayOutputStream中,以便产生ByteArray
|
|
|
|
- ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();
|
|
|
|
|
|
+
|
|
|
|
|
|
//查询 图片 url
|
|
//查询 图片 url
|
|
List<String> imageUrlList = reportSettlementMapper.getAccountImagesBytedance(accountId,paramsVo.getUploadYears());
|
|
List<String> imageUrlList = reportSettlementMapper.getAccountImagesBytedance(accountId,paramsVo.getUploadYears());
|
|
|
|
|
|
if (!Check.isNull(imageUrlList)){
|
|
if (!Check.isNull(imageUrlList)){
|
|
for (int j = 0; j < imageUrlList.size(); j++) {
|
|
for (int j = 0; j < imageUrlList.size(); j++) {
|
|
|
|
+ //先把读进来的图片放到一个ByteArrayOutputStream中,以便产生ByteArray
|
|
|
|
+ ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();
|
|
String imagePath = imageUrlList.get(j);
|
|
String imagePath = imageUrlList.get(j);
|
|
//通过图片网络地址 获取输入流
|
|
//通过图片网络地址 获取输入流
|
|
/* InputStream is = createExcelByTemplate.getInputStreamByUrl(imagePath);
|
|
/* InputStream is = createExcelByTemplate.getInputStreamByUrl(imagePath);
|
|
@@ -410,11 +410,9 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
|
|
URL url = new URL(imagePath);
|
|
URL url = new URL(imagePath);
|
|
Image imageTookittitle = Toolkit.getDefaultToolkit().createImage(url);
|
|
Image imageTookittitle = Toolkit.getDefaultToolkit().createImage(url);
|
|
BufferedImage bufferImg = createExcelByTemplate.toBufferedImage(imageTookittitle);
|
|
BufferedImage bufferImg = createExcelByTemplate.toBufferedImage(imageTookittitle);
|
|
-
|
|
|
|
ImageIO.write(bufferImg, imagePath.substring(imagePath.lastIndexOf(".") + 1), byteArrayOut);
|
|
ImageIO.write(bufferImg, imagePath.substring(imagePath.lastIndexOf(".") + 1), byteArrayOut);
|
|
//anchor主要用于设置图片的属性
|
|
//anchor主要用于设置图片的属性
|
|
int startIndex = settlementList.size()+7;
|
|
int startIndex = settlementList.size()+7;
|
|
-
|
|
|
|
HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 255, 255, (short) 2, startIndex+(5*j)+50*j, (short) 10, startIndex+(5*j)+50*(j+1));
|
|
HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 255, 255, (short) 2, startIndex+(5*j)+50*j, (short) 10, startIndex+(5*j)+50*(j+1));
|
|
//HSSFClientAnchor anchor2 = new HSSFClientAnchor(0, 0, 255, 255, (short) 5, settlementList.size() + 40, (short) 10, 40 * 2);
|
|
//HSSFClientAnchor anchor2 = new HSSFClientAnchor(0, 0, 255, 255, (short) 5, settlementList.size() + 40, (short) 10, 40 * 2);
|
|
anchor.setAnchorType(ClientAnchor.AnchorType.DONT_MOVE_AND_RESIZE);
|
|
anchor.setAnchorType(ClientAnchor.AnchorType.DONT_MOVE_AND_RESIZE);
|
|
@@ -722,22 +720,22 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
|
|
*
|
|
*
|
|
* @description: 给运营发送消息
|
|
* @description: 给运营发送消息
|
|
*
|
|
*
|
|
- * @param userId
|
|
|
|
|
|
+ * @param
|
|
* @return: org.jeecg.common.api.vo.Result
|
|
* @return: org.jeecg.common.api.vo.Result
|
|
* @author: zianY
|
|
* @author: zianY
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
- public Result sendMessageToOperate(String userId) {
|
|
|
|
|
|
+ public Result sendMessageToOperate() {
|
|
int month = Calendar.getInstance().get(Calendar.MONTH) + 1;
|
|
int month = Calendar.getInstance().get(Calendar.MONTH) + 1;
|
|
int productNum = 0;
|
|
int productNum = 0;
|
|
int accountNum = 0;
|
|
int accountNum = 0;
|
|
String productInfo = null;
|
|
String productInfo = null;
|
|
- String message = "运营人{0},您好!您{1}月份有{2}个产品的账户需要进行媒体后台消耗截图上传,共计{3}个账户。产品分别为:{4}。请及时上传,多谢配合!";
|
|
|
|
|
|
+ String message = "{0},您好!您{1}月份有{2}个产品的账户需要进行媒体后台消耗截图上传,共计{3}个账户。产品分别为:{4}。请及时上传,多谢配合!";
|
|
|
|
|
|
//查询所有 运营绑定的账户
|
|
//查询所有 运营绑定的账户
|
|
List<Map<String,Object>> userList = reportSettlementMapper.getAccountOperateUserId();
|
|
List<Map<String,Object>> userList = reportSettlementMapper.getAccountOperateUserId();
|
|
for (Map<String, Object> userMap : userList) {
|
|
for (Map<String, Object> userMap : userList) {
|
|
- userId = userMap.get("userId").toString();
|
|
|
|
|
|
+ String userId = userMap.get("userId").toString();
|
|
//查询运营下的 账户 和 产品信息
|
|
//查询运营下的 账户 和 产品信息
|
|
List<Map<String,Object>> productList = reportSettlementMapper.getAccountAndProductByOperate(userId);
|
|
List<Map<String,Object>> productList = reportSettlementMapper.getAccountAndProductByOperate(userId);
|
|
if (Check.isNull(productList)){
|
|
if (Check.isNull(productList)){
|
|
@@ -750,13 +748,44 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
|
|
productInfo = StringUtils.join(product.toArray(),"、");
|
|
productInfo = StringUtils.join(product.toArray(),"、");
|
|
|
|
|
|
//发送微信通知
|
|
//发送微信通知
|
|
- JSONObject jsonObject = mailLogMapper.getWChatIdByUserId("f990f815ecef43fab9cbe1bb22bb6d63");
|
|
|
|
|
|
+ JSONObject jsonObject = mailLogMapper.getWChatIdByUserId(userId);
|
|
String msg = MessageFormat.format(message,userMap.get("userName").toString(),month,productNum,accountNum,productInfo);
|
|
String msg = MessageFormat.format(message,userMap.get("userName").toString(),month,productNum,accountNum,productInfo);
|
|
corpWexinUtils.sendMessageByWeChatId(jsonObject,msg);
|
|
corpWexinUtils.sendMessageByWeChatId(jsonObject,msg);
|
|
}
|
|
}
|
|
return Result.successMsg("成功",null);
|
|
return Result.successMsg("成功",null);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public Result sendMessageToOperateDemo(String userId) {
|
|
|
|
+ int month = Calendar.getInstance().get(Calendar.MONTH) + 1;
|
|
|
|
+ int productNum = 0;
|
|
|
|
+ int accountNum = 0;
|
|
|
|
+ String productInfo = null;
|
|
|
|
+ String message = "{0},您好!您{1}月份有{2}个产品的账户需要进行媒体后台消耗截图上传,共计{3}个账户。产品分别为:{4}。请及时上传,多谢配合!";
|
|
|
|
+
|
|
|
|
+ //查询所有 运营绑定的账户
|
|
|
|
+ List<Map<String,Object>> userList = reportSettlementMapper.getAccountOperateUserId();
|
|
|
|
+ for (Map<String, Object> userMap : userList) {
|
|
|
|
+ String realUserId = userMap.get("userId").toString();
|
|
|
|
+ //查询运营下的 账户 和 产品信息
|
|
|
|
+ List<Map<String,Object>> productList = reportSettlementMapper.getAccountAndProductByOperate(realUserId);
|
|
|
|
+ if (Check.isNull(productList)){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ //产品名称
|
|
|
|
+ List product = productList.stream().map(map -> map.get("productName")).distinct().collect(Collectors.toList());
|
|
|
|
+ productNum = product.size();
|
|
|
|
+ accountNum = productList.size();
|
|
|
|
+ productInfo = StringUtils.join(product.toArray(),"、");
|
|
|
|
+
|
|
|
|
+ //发送微信通知
|
|
|
|
+ JSONObject jsonObject = mailLogMapper.getWChatIdByUserId(Check.isNull(userId) ? "f990f815ecef43fab9cbe1bb22bb6d63" : userId);
|
|
|
|
+ String msg = MessageFormat.format(message,userMap.get("userName").toString(),month,productNum,accountNum,productInfo);
|
|
|
|
+ corpWexinUtils.sendMessageByWeChatId(jsonObject,msg);
|
|
|
|
+ }
|
|
|
|
+ return Result.successMsg("发送微信通知成功-test",null);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
@Resource
|