Merge branch 'score-shop' of http://120.27.238.55:7000/r/xzx into score-shop
18 files modified
1 files added
| | |
| | | <!--<version>5.3</version>--> |
| | | <!--</dependency>--> |
| | | |
| | | <!-- https://mvnrepository.com/artifact/com.github.jai-imageio/jai-imageio-core --> |
| | | <dependency> |
| | | <groupId>com.github.jai-imageio</groupId> |
| | | <artifactId>jai-imageio-core</artifactId> |
| | | <version>1.4.0</version> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
| | |
| | | }
|
| | | }
|
| | | } catch (Exception e) {
|
| | | log.error("报错:", e);
|
| | | return null;
|
| | | }
|
| | | log.debug("生成海报成功,路径:" + imgPath);
|
| | |
| | | return openid;
|
| | | }
|
| | |
|
| | | public String generateAcode(String scene,String path,String imgName,String width){
|
| | | return generateAcode(scene, path, imgName, width, null);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 生成小程序码
|
| | |
| | | * @param imgName 图片唯一名称
|
| | | * @return
|
| | | */
|
| | | public String generateAcode(String scene,String path,String imgName,String width){
|
| | | public String generateAcode(String scene,String path,String imgName,String width, Integer type){
|
| | | String urlPrefix=businessUtil.getViewUrl();
|
| | | String imgPath=Constants.IMG_UPLOAD_PATH+imgName;
|
| | | if(!FileUtil.exist(imgPath)){
|
| | | //调用二维码接口
|
| | | String url = StrFormatter.format("https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token={}", getAccessToken());
|
| | |
|
| | | cn.hutool.json.JSONObject obj = JSONUtil.createObj();
|
| | | //最大32个可见字符,只支持数字,大小写英文以及部分特殊字符:!#$&'()*+,/:;=?@-._~,
|
| | | // 其它字符请自行编码为合法字符(因不支持%,中文无法使用 urlencode 处理,请使用其他编码方式)
|
| | | obj.put("scene", scene);
|
| | | //必须是已经发布的小程序存在的页面(否则报错),例如 pages/index/index,
|
| | | // 根路径前不要填加 /,不能携带参数(参数请放在scene字段里),如果不填写这个字段,默认跳主页面
|
| | | obj.put("path", path);
|
| | | //调用二维码接口
|
| | | String url = null;
|
| | | if (type == null) {
|
| | | // 该接口无数量限制,但是 scene 传参最大字符长度为32个字符
|
| | | url = StrFormatter.format("https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token={}", getAccessToken());
|
| | | obj.put("scene", scene);
|
| | | obj.put("path", path);
|
| | | } else {
|
| | | // 该接口存在数量限制, 总共可生成10w个, 但参数是接在path后面
|
| | | url = StrFormatter.format("https://api.weixin.qq.com/wxa/getwxacode?access_token={}", getAccessToken());
|
| | | obj.put("path", path + "?" + scene );
|
| | | }
|
| | |
|
| | | //最小 280px,最大 1280px
|
| | | obj.put("width", width);
|
| | | obj.put("auto_color", false);
|
| | |
| | |
|
| | |
|
| | | #log
|
| | | project.log.path=xzx/logs
|
| | | project.log.path=/xzx/logs
|
| | | logstash.server.url=localhost:4560
|
| | |
|
| | | #spring
|
| | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.Map; |
| | | |
| | | @Slf4j |
| | | @RestController |
| | |
| | | return Result.success(); |
| | | } |
| | | |
| | | @ApiOperation("订单状态数量") |
| | | @PostMapping(value = "/orderStatusCnt") |
| | | public JsonResult<Map<Integer, Integer>> orderStatusCnt(HttpServletRequest request) { |
| | | return JsonResult.success(jhyOrderService.orderStatusCount(getUserId(request))); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.xzx.gc.entity.JhyOrder; |
| | | import com.xzx.gc.order.dto.JhyOrderListDto; |
| | | import com.xzx.gc.order.vo.JhyOrderListVo; |
| | | import com.xzx.gc.order.vo.JhyStatusCountVo; |
| | | import com.xzx.gc.util.GcMapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springframework.stereotype.Repository; |
| | |
| | | public interface JhyOrderMapper extends GcMapper<JhyOrder> { |
| | | |
| | | List<JhyOrderListVo> selectJhyOrderList(@Param("record") JhyOrderListDto jhyOrderListDto); |
| | | |
| | | List<JhyStatusCountVo> selectOrderStatusCount(@Param("userId") String userId); |
| | | } |
| | |
| | | // 根据订单总积分, 1:40比例,换算成环保币,返对应百分比 |
| | | if (StrUtil.isNotBlank(coinStr) && !"0".equals(coinStr)) { |
| | | BigDecimal coinRatio = new BigDecimal(coinStr).divide(BigDecimal.valueOf(100), 2, BigDecimal.ROUND_DOWN); |
| | | BigDecimal totalCoin = totalScore.divide(new BigDecimal(40), 2, BigDecimal.ROUND_DOWN); |
| | | BigDecimal totalCoin = totalScore.divide(new BigDecimal(50), 2, BigDecimal.ROUND_DOWN); |
| | | |
| | | BigDecimal returnCoin = totalCoin.multiply(coinRatio).setScale(2, BigDecimal.ROUND_DOWN); |
| | | totalReturnCoin = totalReturnCoin.add(returnCoin); |
| | |
| | | import com.xzx.gc.order.mapper.*; |
| | | import com.xzx.gc.order.vo.JhyOrderDetailsVo; |
| | | import com.xzx.gc.order.vo.JhyOrderListVo; |
| | | import com.xzx.gc.order.vo.JhyStatusCountVo; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | |
| | | @Slf4j |
| | | @Service |
| | |
| | | order.setStatus(JhyOrder.ORDER_STATUS_CANCEL); |
| | | } |
| | | |
| | | order.setJhyId(null); |
| | | jhyOrderMapper.updateByPrimaryKey(order); |
| | | } |
| | | |
| | |
| | | |
| | | distribService.distribRecord(order.getId(), order.getUserId()); |
| | | } |
| | | |
| | | public Map<Integer, Integer> orderStatusCount(String userId) { |
| | | List<JhyStatusCountVo> count = jhyOrderMapper.selectOrderStatusCount(userId); |
| | | |
| | | Map<Integer, Integer> map = new HashMap<>(); |
| | | for (int i = 1; i < 6; i++) { |
| | | if (CollUtil.isNotEmpty(count)) { |
| | | boolean flag = false; |
| | | for (JhyStatusCountVo jhyStatusCountVo : count) { |
| | | if (i == jhyStatusCountVo.getStatus()) { |
| | | map.put(i, jhyStatusCountVo.getCnt()); |
| | | flag = true; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if (flag) { |
| | | continue; |
| | | } |
| | | } |
| | | |
| | | map.put(i, 0); |
| | | } |
| | | |
| | | return map; |
| | | } |
| | | } |
New file |
| | |
| | | package com.xzx.gc.order.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "JhyStatucCountVo", description = "") |
| | | public class JhyStatusCountVo { |
| | | |
| | | private Integer status; |
| | | |
| | | private Integer cnt; |
| | | } |
| | |
| | | group by a.id |
| | | order by a.receiving_time desc, a.id desc |
| | | </select> |
| | | |
| | | <select id="selectOrderStatusCount" resultType="com.xzx.gc.order.vo.JhyStatusCountVo"> |
| | | select |
| | | status, |
| | | count(1) cnt |
| | | from xzx_jhy_order where status=1 |
| | | union all |
| | | select |
| | | status, |
| | | count(1) cnt |
| | | from xzx_jhy_order |
| | | where user_id=#{userId} |
| | | group by status |
| | | </select> |
| | | </mapper> |
| | |
| | | import com.xzx.gc.common.utils.SpringUtil;
|
| | | import com.xzx.gc.common.utils.gdmap.GdMapUtil;
|
| | | import com.xzx.gc.common.utils.gdmap.GdTraceUtil;
|
| | | import com.xzx.gc.common.utils.image.GraphicsUtils;
|
| | | import com.xzx.gc.entity.*;
|
| | | import com.xzx.gc.model.order.FenceDto;
|
| | | import com.xzx.gc.model.user.AccountVo;
|
| | |
| | |
|
| | | }
|
| | |
|
| | | @Autowired
|
| | | private GraphicsUtils graphicsUtils;
|
| | |
|
| | | @Test
|
| | | public void haibaoTest() {
|
| | | String imageName = "/test.jpg";
|
| | | String path = "/Users/helius/Desktop/acode.jpg";
|
| | | String avatar = "https://thirdwx.qlogo.cn/mmopen/vi_32/POgEwh4mIHO4nibH0KlMECNjjGxQUq24ZEaGT4poC6icRiccVGKSyXwibcPq4BWmiaIGuG1icwxaQX6grC9VemZoJ8rg/132";
|
| | | String backgroundUrl = "/Users/helius/Desktop/user_share_poster_bg.png";
|
| | |
|
| | | graphicsUtils.generatePoster(imageName, path, avatar, backgroundUrl, "15200889645", 100, 340, 57, 94, 230, 160, 40); }
|
| | |
|
| | | }
|
| | |
| | | package com.xzx.gc.user.controller; |
| | | |
| | | import cn.hutool.core.codec.Base64; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.xzx.gc.common.constant.CommonEnum; |
| | | import com.xzx.gc.common.constant.Constants; |
| | | import com.xzx.gc.common.dto.log.OperationAppLog; |
| | |
| | | @ApiOperation(value="分銷系統管理--新增团长", notes="test: 仅0有正确返回") |
| | | public JsonResult adddistrib(@RequestBody AdddistribDto model, HttpServletRequest request) { |
| | | String id = model.getId(); |
| | | AccountInfo accountInfo = accountMapper.selectByPrimaryKey(id); |
| | | if(ObjectUtil.isEmpty(accountInfo)){ |
| | | return JsonResult.failMessage("账户不存在!"); |
| | | List<String> ids = StrUtil.split(id, ','); |
| | | // AccountInfo accountInfo = accountMapper.selectByPrimaryKey(id); |
| | | List<AccountInfo> accountInfos = accountMapper.selectAccountInfoByIds(ids); |
| | | if (CollUtil.isNotEmpty(accountInfos)) { |
| | | for (AccountInfo accountInfo : accountInfos) { |
| | | // if(ObjectUtil.isEmpty(accountInfo)){ |
| | | // return JsonResult.failMessage("账户不存在!"); |
| | | // } |
| | | if(ObjectUtil.isEmpty(accountInfo.getIsHead()) |
| | | || accountInfo.getIsHead() == 1){ |
| | | return JsonResult.failMessage(accountInfo.getAccountName() + "账户不能重复添加!"); |
| | | } |
| | | if(ObjectUtil.isEmpty(accountInfo.getDelFlag()) |
| | | || accountInfo.getDelFlag() == 1){ |
| | | return JsonResult.failMessage(accountInfo.getAccountName() + "账户已删除!"); |
| | | } |
| | | if(ObjectUtil.isEmpty(accountInfo.getIsProhibit()) |
| | | || "1".equals(accountInfo.getIsProhibit())){ |
| | | return JsonResult.failMessage(accountInfo.getAccountName() + "账户已冻结!"); |
| | | } |
| | | //团员不能当团长 |
| | | String userId = accountInfo.getUserId(); |
| | | UserHeadRelate userHeadRelate = userHeadRelateMapper.selectMemberByUserId(userId); |
| | | if(ObjectUtil.isNotEmpty(userHeadRelate)){ |
| | | return JsonResult.failMessage(accountInfo.getAccountName() + "账户不能申请成为团长!"); |
| | | } |
| | | // distribService.adddistrib(accountInfo.getAccountId()); |
| | | |
| | | accountInfo.setIsHead(1); |
| | | accountMapper.updateByPrimaryKey(accountInfo); |
| | | OperationAppLog build = OperationAppLog.builder().appPrograme(CommonEnum.后台.getValue()).opreateName(getAdminName(request)) |
| | | .methodName(Constants.USER_MODUL_NAME).operateAction("分銷系統管理--新增团长-"+id).build(); |
| | | mqUtil.sendApp(build); |
| | | } |
| | | |
| | | return JsonResult.success("操作成功!"); |
| | | } else { |
| | | return JsonResult.failMessage("参数错误"); |
| | | } |
| | | if(ObjectUtil.isEmpty(accountInfo.getIsHead()) |
| | | || accountInfo.getIsHead() == 1){ |
| | | return JsonResult.failMessage("账户不能重复添加!"); |
| | | } |
| | | if(ObjectUtil.isEmpty(accountInfo.getDelFlag()) |
| | | || accountInfo.getDelFlag() == 1){ |
| | | return JsonResult.failMessage("账户已删除!"); |
| | | } |
| | | if(ObjectUtil.isEmpty(accountInfo.getIsProhibit()) |
| | | || accountInfo.getIsProhibit() == "1"){ |
| | | return JsonResult.failMessage("账户已冻结!"); |
| | | } |
| | | //团员不能当团长 |
| | | String userId = accountInfo.getUserId(); |
| | | UserHeadRelate userHeadRelate = userHeadRelateMapper.selectMemberByUserId(userId); |
| | | if(ObjectUtil.isNotEmpty(userHeadRelate)){ |
| | | return JsonResult.failMessage("账户不能申请成为团长!"); |
| | | } |
| | | distribService.adddistrib(model); |
| | | OperationAppLog build = OperationAppLog.builder().appPrograme(CommonEnum.后台.getValue()).opreateName(getAdminName(request)) |
| | | .methodName(Constants.USER_MODUL_NAME).operateAction("分銷系統管理--新增团长-"+id).build(); |
| | | mqUtil.sendApp(build); |
| | | return JsonResult.success("操作成功!"); |
| | | |
| | | } |
| | | |
| | | @ApiOperation(value = "团长列表") |
| | |
| | | List<List<String>> rows = new ArrayList<>(); |
| | | List<String> header=new ArrayList<>(); |
| | | //标题 |
| | | header=CollUtil.newArrayList( "团长名称", "手机号", "身份", "团员数量", "交易单数", "累计收益积分", "累计收益(元)", "累计订单重量(kg)","累计数量(家电)"); |
| | | header=CollUtil.newArrayList( "团长名称", "手机号", "身份", "团员数量", "交易单数", "累计积分收益", "累计环保币收益", "累计订单重量(kg)","累计订单数量(家电)"); |
| | | rows.add(header); |
| | | Map<String, Object> stringObjectMap = distribService.distribDataExport(distribDataListDto); |
| | | List<DistribDataListVo> distribDataListVos = (List<DistribDataListVo>) stringObjectMap.get("data"); |
| | |
| | | break; |
| | | case 1: |
| | | map.put("icon", "../../images/icon_team.png"); |
| | | map.put("name", "集物员订单列表"); |
| | | map.put("name", "集物员订单"); |
| | | map.put("path", "../../collectPersonnel/GCOrderForm/index"); |
| | | break; |
| | | case 2: |
| | |
| | | String selectOrderExportByHeadUserId(@Param("accountId")String id, @Param("record")ExportDistribDataListDto distribDataListDto); |
| | | |
| | | String selectJDSLExportByHeadUserId(@Param("accountId")String id, @Param("record")ExportDistribDataListDto distribDataListDto); |
| | | |
| | | List<AccountInfo> selectAccountInfoByIds(@Param("list") List<String> list); |
| | | } |
| | | |
| | |
| | | return data; |
| | | } |
| | | |
| | | public void adddistrib(AdddistribDto model) { |
| | | String id = model.getId(); |
| | | public void adddistrib(String id) { |
| | | AccountInfo accountInfo = accountMapper.selectByPrimaryKey(id); |
| | | accountInfo.setIsHead(1); |
| | | accountMapper.updateByPrimaryKey(accountInfo); |
| | |
| | | public Map<String,String> generate(UserInfo userInfo){
|
| | | //海报图名称
|
| | | String userId=userInfo.getUserId();
|
| | | String imageName="/user_" + userId + "_poster.jpg";
|
| | | String imageName="/user_" + userId + "_poster_1.jpg";
|
| | | //二维码图名称
|
| | | String imgName="/user_" + userId + "_acode.jpg";
|
| | | String s1 = wxUtil.generateAcode("poster=" + userInfo.getMobilePhone(), "pages/login/login", imgName, "800px");
|
| | | String imgName="/user_" + userId + "_acode_1.jpg";
|
| | | String s1 = wxUtil.generateAcode("poster=" + userInfo.getMobilePhone() +"&chiefId=" + userInfo.getUserId(), "pages/login/login", imgName, "800px", 1);
|
| | | if(StrUtil.isBlank(s1)){
|
| | | throw new RestException("生成分享海报失败");
|
| | | }
|
| | |
| | | ) |
| | | </select> |
| | | |
| | | <select id="selectAccountInfoByIds" resultType="com.xzx.gc.entity.AccountInfo"> |
| | | select * from xzx_account_info |
| | | where account_id in |
| | | <foreach collection="list" index="index" item="id" separator="," open="(" close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </select> |
| | | </mapper> |
| | |
| | | import cn.hutool.core.collection.CollUtil;
|
| | | import cn.hutool.core.convert.Convert;
|
| | | import cn.hutool.core.io.FileUtil;
|
| | | import cn.hutool.core.text.StrFormatter;
|
| | | import cn.hutool.core.thread.ThreadUtil;
|
| | | import cn.hutool.core.util.RandomUtil;
|
| | | import cn.hutool.core.util.StrUtil;
|
| | | import cn.hutool.http.HttpRequest;
|
| | | import cn.hutool.json.JSONUtil;
|
| | | import com.xzx.gc.GcUserApplication;
|
| | | import com.xzx.gc.common.Result;
|
| | |
| | | import com.xzx.gc.common.constant.Constants;
|
| | | import com.xzx.gc.common.utils.RedisUtil;
|
| | | import com.xzx.gc.common.utils.gdmap.GdTraceUtil;
|
| | | import com.xzx.gc.common.utils.wxpay.WxUtil;
|
| | | import com.xzx.gc.entity.*;
|
| | | import com.xzx.gc.user.mapper.UserBatchMapper;
|
| | | import com.xzx.gc.user.service.*;
|
| | | import lombok.extern.slf4j.Slf4j;
|
| | | import org.junit.Test;
|
| | | import org.junit.runner.RunWith;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | |
| | | import org.springframework.test.context.ActiveProfiles;
|
| | | import org.springframework.test.context.junit4.SpringRunner;
|
| | |
|
| | | import java.io.File;
|
| | | import java.io.InputStream;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Comparator;
|
| | | import java.util.List;
|
| | |
| | | import java.util.stream.Collectors;
|
| | |
|
| | |
|
| | | @Slf4j
|
| | | @RunWith(SpringRunner.class)
|
| | | @SpringBootTest(classes = {GcUserApplication.class})
|
| | | @ActiveProfiles(profiles = {"temp"})
|
| | | @ActiveProfiles(profiles = {"xc"})
|
| | | public class SpringTest {
|
| | |
|
| | |
|
| | |
| | | }
|
| | |
|
| | |
|
| | | @Autowired
|
| | | private WxUtil wxUtil;
|
| | |
|
| | | @Test
|
| | | public void acodeTest() {
|
| | |
|
| | | String path = "pages/login/login?poster=18390984915&chiefId=YH1417670707298828288";
|
| | | String imgPath = "/Users/helius/Desktop/YH1417670707298828288_acode.jpg";
|
| | |
|
| | | String url = StrFormatter.format("https://api.weixin.qq.com/wxa/getwxacode?access_token={}", wxUtil.getAccessToken());
|
| | | cn.hutool.json.JSONObject obj = JSONUtil.createObj();
|
| | | obj.put("path", path);
|
| | | //最小 280px,最大 1280px
|
| | | obj.put("width", "800px");
|
| | | obj.put("auto_color", false);
|
| | | cn.hutool.json.JSONObject obj2 = JSONUtil.createObj();
|
| | | obj2.put("r", 0);
|
| | | obj2.put("g", 0);
|
| | | obj2.put("b", 0);
|
| | | obj.put("line_color", obj2);
|
| | | //是否需要透明底色,为 true 时,生成透明底色的小程序码
|
| | | obj.put("is_hyaline", false);
|
| | | try {
|
| | | InputStream inputStream = HttpRequest.post(url).body(obj.toString(), "application/json").execute().bodyStream();
|
| | | File file = new File(imgPath);
|
| | | FileUtil.writeFromStream(inputStream, file);
|
| | | long uploadUrl = FileUtil.size(file);
|
| | | //小于10kb重新生成
|
| | | if(uploadUrl<= Constants.MIN_FILE_SIZE){
|
| | | log.error("生成微信小程序码失败:图片大小异常:{}",uploadUrl);
|
| | | }
|
| | | } catch (Exception e) {
|
| | | log.error("生成微信小程序码失败",e);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | | }
|
| | |
| | | import cn.hutool.core.io.FileUtil;
|
| | | import cn.hutool.core.lang.Console;
|
| | | import cn.hutool.core.text.StrFormatter;
|
| | | import cn.hutool.core.thread.ThreadUtil;
|
| | | import cn.hutool.core.util.NumberUtil;
|
| | | import cn.hutool.http.HttpRequest;
|
| | | import cn.hutool.json.JSONUtil;
|
| | | import com.xzx.gc.common.constant.Constants;
|
| | | import com.xzx.gc.common.utils.wxpay.WxUtil;
|
| | | import org.junit.Test;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | |
|
| | | import java.io.File;
|
| | | import java.io.InputStream;
|
| | | import java.util.concurrent.*;
|
| | |
|
| | | public class ThreadTest {
|