'提交代码'

dev-discount
199901012 4 years ago
parent b783e6fe6e
commit 77a6ac4ee1
  1. 23
      hai-bweb/src/test/common/ExcelModel.java
  2. 36
      hai-bweb/src/test/common/RegionTest.java
  3. 10
      hai-cweb/src/main/java/com/cweb/controller/HighCouponController.java
  4. 8
      hai-service/src/main/java/com/hai/service/HighDiscountAgentCodeService.java
  5. 14
      hai-service/src/main/java/com/hai/service/impl/HighDiscountAgentCodeServiceImpl.java
  6. 1
      hai-service/src/main/java/com/hai/service/impl/HighDiscountAgentRelServiceImpl.java

@ -9,25 +9,14 @@ import com.alibaba.excel.annotation.ExcelProperty;
*/ */
public class ExcelModel { public class ExcelModel {
@ExcelProperty("卡券编码") @ExcelProperty("二维码地址")
private String key; private String codeUrl;
@ExcelProperty("商品编码") public String getCodeUrl() {
private String name; return codeUrl;
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getName() {
return name;
} }
public void setName(String name) { public void setCodeUrl(String codeUrl) {
this.name = name; this.codeUrl = codeUrl;
} }
} }

@ -1,10 +1,15 @@
package common; package common;
import com.BWebApplication; import com.BWebApplication;
import com.alibaba.excel.EasyExcel;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.hai.common.Base64Util;
import com.hai.common.security.AESEncodeUtil;
import com.hai.entity.HighDiscountAgentCode;
import com.hai.entity.SecRegion; import com.hai.entity.SecRegion;
import com.hai.service.CommonService; import com.hai.service.CommonService;
import com.hai.service.HighDiscountAgentCodeService;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
@ -33,6 +38,9 @@ public class RegionTest {
@Resource @Resource
private CommonService commonService; private CommonService commonService;
@Resource
private HighDiscountAgentCodeService highDiscountAgentCodeService;
@Test @Test
public void addLogs(){ public void addLogs(){
try { try {
@ -67,4 +75,32 @@ public class RegionTest {
e.printStackTrace(); e.printStackTrace();
} }
} }
@Test
public void simpleWrite() throws Exception {
// 写法1
String fileName = "D:\\simpleWrite.xlsx";
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("discountAgentId", "");
List<HighDiscountAgentCode> codeList = highDiscountAgentCodeService.getDiscountCode(paramMap);
List<ExcelModel> list = new ArrayList<>();
ExcelModel excelModel;
Map<String,Object> map = new HashMap<>();
map.put("type", "DISCOUNT");
for (HighDiscountAgentCode code : codeList) {
excelModel = new ExcelModel();
map.put("id", code.getId());
String param = "https://hsg.dctpay.com/wx/?action=gogogo&id=" + Base64Util.encode(AESEncodeUtil.aesEncrypt(JSON.toJSONString(map)));
excelModel.setCodeUrl(param);
list.add(excelModel);
}
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,名字为模板 然后文件流会自动关闭
// 如果这里想使用03 则 传入excelType参数即可
EasyExcel.write(fileName, ExcelModel.class).sheet("模板").doWrite(list);
}
} }

@ -11,6 +11,7 @@ import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.BsCompany; import com.hai.entity.BsCompany;
import com.hai.entity.HighCoupon; import com.hai.entity.HighCoupon;
import com.hai.entity.HighUserCoupon; import com.hai.entity.HighUserCoupon;
import com.hai.entity.SecRegion;
import com.hai.model.HighUserCouponModel; import com.hai.model.HighUserCouponModel;
import com.hai.model.HighUserModel; import com.hai.model.HighUserModel;
import com.hai.model.ResponseData; import com.hai.model.ResponseData;
@ -61,6 +62,9 @@ public class HighCouponController {
@Resource @Resource
private HighMerchantStoreService highMerchantStoreService; private HighMerchantStoreService highMerchantStoreService;
@Resource
private CommonService commonService;
@RequestMapping(value = "/getCouponList", method = RequestMethod.GET) @RequestMapping(value = "/getCouponList", method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "卡卷列表") @ApiOperation(value = "卡卷列表")
@ -73,7 +77,9 @@ public class HighCouponController {
@RequestParam(name = "pageSize", required = true) Integer pageSize) { @RequestParam(name = "pageSize", required = true) Integer pageSize) {
try { try {
BsCompany bsCompany = bsCompanyService.selectCompanyByRegion(regionId); SecRegion region = commonService.getRegionsById(Long.parseLong(regionId));
if (region != null && region.getParentId() != null) {
BsCompany bsCompany = bsCompanyService.selectCompanyByRegion(region.getParentId().toString());
if (bsCompany != null) { if (bsCompany != null) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("companyId", bsCompany.getId()); map.put("companyId", bsCompany.getId());
@ -86,7 +92,7 @@ public class HighCouponController {
PageHelper.startPage(pageNum, pageSize); PageHelper.startPage(pageNum, pageSize);
return ResponseMsgUtil.success(new PageInfo<>(highCouponService.getCouponList(map))); return ResponseMsgUtil.success(new PageInfo<>(highCouponService.getCouponList(map)));
} }
}
return ResponseMsgUtil.success(new PageInfo<>()); return ResponseMsgUtil.success(new PageInfo<>());
} catch (Exception e) { } catch (Exception e) {

@ -3,6 +3,7 @@ package com.hai.service;
import com.hai.entity.HighDiscountAgentCode; import com.hai.entity.HighDiscountAgentCode;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @Auther: 胡锐 * @Auther: 胡锐
@ -32,6 +33,13 @@ public interface HighDiscountAgentCodeService {
**/ **/
void updateCode(HighDiscountAgentCode highDiscountAgentCode); void updateCode(HighDiscountAgentCode highDiscountAgentCode);
/**
* @Author 胡锐
* @Description 查询
* @Date 2021/4/16 22:20
**/
List<HighDiscountAgentCode> getDiscountCode(Map<String,Object> map);
/** /**
* @Author 胡锐 * @Author 胡锐
* @Description 根据id 查询二维码 * @Description 根据id 查询二维码

@ -2,11 +2,14 @@ package com.hai.service.impl;
import com.hai.dao.HighDiscountAgentCodeMapper; import com.hai.dao.HighDiscountAgentCodeMapper;
import com.hai.entity.HighDiscountAgentCode; import com.hai.entity.HighDiscountAgentCode;
import com.hai.entity.HighDiscountAgentCodeExample;
import com.hai.service.HighDiscountAgentCodeService; import com.hai.service.HighDiscountAgentCodeService;
import org.apache.commons.collections4.MapUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @Auther: 胡锐 * @Auther: 胡锐
@ -34,6 +37,17 @@ public class HighDiscountAgentCodeServiceImpl implements HighDiscountAgentCodeSe
highDiscountAgentCodeMapper.updateByPrimaryKey(highDiscountAgentCode); highDiscountAgentCodeMapper.updateByPrimaryKey(highDiscountAgentCode);
} }
@Override
public List<HighDiscountAgentCode> getDiscountCode(Map<String, Object> map) {
HighDiscountAgentCodeExample example = new HighDiscountAgentCodeExample();
HighDiscountAgentCodeExample.Criteria criteria = example.createCriteria();
if (MapUtils.getLong(map, "discountAgentId") != null) {
criteria.andDiscountAgentIdEqualTo(MapUtils.getLong(map, "discountAgentId"));
}
return highDiscountAgentCodeMapper.selectByExample(example);
}
@Override @Override
public HighDiscountAgentCode getCodeById(Long id) { public HighDiscountAgentCode getCodeById(Long id) {
return highDiscountAgentCodeMapper.selectByPrimaryKey(id); return highDiscountAgentCodeMapper.selectByPrimaryKey(id);

@ -66,6 +66,7 @@ public class HighDiscountAgentRelServiceImpl implements HighDiscountAgentRelServ
String param = "https://hsg.dctpay.com/wx/?action=gogogo&id=" + Base64Util.encode(AESEncodeUtil.aesEncrypt(JSON.toJSONString(map))); String param = "https://hsg.dctpay.com/wx/?action=gogogo&id=" + Base64Util.encode(AESEncodeUtil.aesEncrypt(JSON.toJSONString(map)));
QRCodeGenerator.generateQRCodeImage(param, 350, 350, path + folder + qrCodeImg); QRCodeGenerator.generateQRCodeImage(param, 350, 350, path + folder + qrCodeImg);
code.setQrCode(qrCodeImg); code.setQrCode(qrCodeImg);
code.setExt1(param);
highDiscountAgentCodeService.updateCode(code); highDiscountAgentCodeService.updateCode(code);
} }
} }

Loading…
Cancel
Save