Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/HongRuiTang
1个文件已删除
16个文件已添加
145个文件已修改
| | |
| | | |
| | | String ACTIVITY_END = "活动已经结束"; |
| | | |
| | | String ACTIVITY_SE_ERROR = "开始时间不能大于结束时间"; |
| | | |
| | | String ACTIVITY_GOODS_NULL = "商品已被抢完"; |
| | | |
| | | String ACTIVITY_GOODS_BEYOND = "超出商品购买限制"; |
| | |
| | | String TRANS_NOT_MYSELF = "不能转移给自己"; |
| | | |
| | | String GOODS_SURE_FAILED = "商品没有确认次数"; |
| | | |
| | | String BIRTHDAYCARD_NO_GIFT = "请先配置礼物再开启"; |
| | | } |
| | |
| | | @ApiModelProperty(value = "userId",hidden = true) |
| | | private Long userId; |
| | | |
| | | @ApiModelProperty(value = "openid", hidden = true) |
| | | private String openid; |
| | | |
| | | @ApiModelProperty(value = "终端IP", hidden = true) |
| | | private String spbillCreateIp; |
| | | } |
| | |
| | | @Data |
| | | public class AppEditUserDto extends AppBaseDto{ |
| | | |
| | | @ApiModelProperty(value = "修改类型1.昵称2.头像3.性别4.生日") |
| | | @ApiModelProperty(value = "修改类型1.昵称2.头像3.性别4.生日5.姓名") |
| | | private Integer editType; |
| | | |
| | | @ApiModelProperty(value = "修改值 性别0=男,1=女,2=未知 生日YYYY-MM-DD ") |
New file |
| | |
| | | package com.ruoyi.system.api.domain.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @ClassName CodeGetDto |
| | | * @Description TODO |
| | | * @Author jqs |
| | | * @Date 2023/8/3 12:53 |
| | | * @Version 1.0 |
| | | */ |
| | | @Data |
| | | public class CodeGetDto { |
| | | |
| | | private String url; |
| | | |
| | | private String fileName; |
| | | } |
| | |
| | | private Integer serviceCount; |
| | | |
| | | @ApiModelProperty(value = "下次跟进时间") |
| | | private Date nextTaskTime; |
| | | private String nextTaskTime; |
| | | |
| | | @ApiModelProperty(value = "活动时间") |
| | | private Date activityTime; |
| | |
| | | @TableField("auth_flag") |
| | | private Integer authFlag; |
| | | |
| | | @TableField("shop_code") |
| | | private String shopCode; |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.shopId; |
New file |
| | |
| | | package com.ruoyi.system.api.domain.poji.shop; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | public class ShopProportionVo { |
| | | /** |
| | | * 分成id |
| | | */ |
| | | private Long proportionId; |
| | | |
| | | /** |
| | | * 商户id |
| | | */ |
| | | private Long shopId; |
| | | /** |
| | | * 商户类型 |
| | | */ |
| | | private Integer shopType; |
| | | /** |
| | | * 分成比例 |
| | | */ |
| | | private BigDecimal proportionPercent; |
| | | |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value="使用有效期") |
| | | private Date deadlineTime; |
| | | |
| | | @ApiModelProperty(value="使用范围1.全场2.指定商品") |
| | | private Integer useScope; |
| | | |
| | | @ApiModelProperty(value = "关联商品id") |
| | | private String relGoodsIds; |
| | | |
| | | } |
| | |
| | | package com.ruoyi.system.api.factory; |
| | | |
| | | import com.ruoyi.system.api.domain.dto.CodeGetDto; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | |
| | | { |
| | | return R.fail("上传文件失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<String> getAppOrderTotal(CodeGetDto codeGetDto) { |
| | | return R.fail("获取二维码失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.system.api.domain.dto.AppShopGoodsGetDto; |
| | | import com.ruoyi.system.api.domain.dto.GoodsTotalChangeDto; |
| | | import com.ruoyi.system.api.domain.poji.goods.Goods; |
| | | import com.ruoyi.system.api.domain.poji.goods.GoodsFile; |
| | | import com.ruoyi.system.api.domain.poji.goods.ShopGoods; |
| | |
| | | public R<List<MerGoodsPriceListVo>> listGoodsPriceByGoodsId(String goodsIds) { |
| | | return R.fail("获取商品列表失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R changeGoodsTotal(List<GoodsTotalChangeDto> goodsTotalChangeDtoList) { |
| | | return R.fail("改变商品统计失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.system.api.domain.dto.*; |
| | | import com.ruoyi.system.api.domain.poji.shop.ShopProportionVo; |
| | | import com.ruoyi.system.api.domain.vo.*; |
| | | import com.ruoyi.system.api.model.QwH5LoginVo; |
| | | import com.ruoyi.system.api.model.QwUserDetailDto; |
| | |
| | | @Override |
| | | public R<Shop> getShop(Long shopId) { |
| | | return R.fail("获取商户失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<String> getShopSubMchId(Long shopId) { |
| | | return R.fail("获取微信商户号失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | |
| | | public R editMgtShopStaff(MgtShopStaffEditDto mgtShopStaffEditDto) { |
| | | return R.fail("修改员工失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<ShopProportionVo> getShopProportion(Long shopId) { |
| | | return R.fail("获取商户分成信息失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.system.api.service; |
| | | |
| | | import com.ruoyi.system.api.domain.dto.CodeGetDto; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestPart; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | |
| | | */ |
| | | @PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) |
| | | public R<SysFile> upload(@RequestPart(value = "file") MultipartFile file); |
| | | |
| | | /** |
| | | * @description 生成二维码 |
| | | * @author jqs |
| | | * @date 2023/8/3 12:57 |
| | | * @param codeGetDto |
| | | * @return R<String> |
| | | */ |
| | | @PostMapping("/file/getCodeUrl") |
| | | public R<String> getAppOrderTotal(@RequestBody CodeGetDto codeGetDto); |
| | | } |
| | |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.system.api.domain.dto.AppShopGoodsGetDto; |
| | | import com.ruoyi.system.api.domain.dto.GoodsTotalChangeDto; |
| | | import com.ruoyi.system.api.domain.poji.goods.Goods; |
| | | import com.ruoyi.system.api.domain.poji.goods.GoodsFile; |
| | | import com.ruoyi.system.api.domain.poji.goods.ShopGoods; |
| | |
| | | * @param goodsIds |
| | | * @return R<List<MerGoodsPriceListVo>> |
| | | */ |
| | | @PostMapping("/listGoodsPriceByGoodsId") |
| | | @PostMapping("/goods/listGoodsPriceByGoodsId") |
| | | public R<List<MerGoodsPriceListVo>> listGoodsPriceByGoodsId(@RequestBody String goodsIds); |
| | | |
| | | |
| | | @PostMapping("/goods/changeGoodsTotal") |
| | | public R changeGoodsTotal(@RequestBody List<GoodsTotalChangeDto> goodsTotalChangeDtoList); |
| | | } |
| | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.system.api.domain.dto.*; |
| | | import com.ruoyi.system.api.domain.poji.shop.Shop; |
| | | import com.ruoyi.system.api.domain.poji.shop.ShopProportionVo; |
| | | import com.ruoyi.system.api.domain.vo.*; |
| | | import com.ruoyi.system.api.factory.RemoteShopFallbackFactory; |
| | | import com.ruoyi.system.api.model.QwH5LoginVo; |
| | |
| | | |
| | | @PostMapping("/shop/getShop") |
| | | public R<Shop> getShop(@RequestBody Long shopId); |
| | | |
| | | @PostMapping("/shop/getShopSubMchId") |
| | | public R<String> getShopSubMchId(@RequestBody Long shopId); |
| | | |
| | | |
| | | @PostMapping("/shop/getShopByUserId") |
| | | public R<ShopRelUserVo> getShopByUserId(@RequestBody Long userId); |
| | |
| | | */ |
| | | @PostMapping("/shop/editMgtShopStaff") |
| | | public R editMgtShopStaff(@RequestBody MgtShopStaffEditDto mgtShopStaffEditDto); |
| | | |
| | | /** |
| | | * 获取商户分成 |
| | | * @param shopId |
| | | * @return |
| | | */ |
| | | @PostMapping("/shop/getShopProportion") |
| | | R<ShopProportionVo> getShopProportion(@RequestBody Long shopId); |
| | | } |
| | |
| | | public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { |
| | | HttpServletRequest request = (HttpServletRequest) servletRequest; |
| | | HttpServletResponse response = (HttpServletResponse) servletResponse; |
| | | |
| | | String requestUrl = request.getRequestURI(); |
| | | String requestUrlUpperCase = requestUrl.toUpperCase(); |
| | | if(requestUrlUpperCase.contains("EXPORT") |
| | | ||requestUrlUpperCase.contains("IMPORTTEMPLATE") |
| | | ){ |
| | | filterChain.doFilter(request, response); |
| | | return; |
| | | } |
| | | RepeatedlyRequestWrapper wrapper = new RepeatedlyRequestWrapper(request, response); |
| | | getRequestParams(wrapper); |
| | | |
| | |
| | | |
| | | // 返回的结果 |
| | | String content = responseWrapper.getTextContent(); |
| | | String requestUrl = request.getRequestURI(); |
| | | log.info("-------------------- Response Data ----------------------"); |
| | | log.info(requestUrl + " -> " + content); |
| | | |
| | |
| | | package com.ruoyi.common.core.utils; |
| | | |
| | | import java.util.*; |
| | | |
| | | import org.springframework.util.AntPathMatcher; |
| | | import com.ruoyi.common.core.constant.Constants; |
| | | import com.ruoyi.common.core.text.StrFormatter; |
| | | import org.springframework.util.AntPathMatcher; |
| | | |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 字符串工具类 |
| | |
| | | } |
| | | return result.toArray(new String[0]); |
| | | } |
| | | |
| | | public static boolean checkString(String originalString, String targetString) { |
| | | // 使用逗号分隔字符串 |
| | | String[] stringArray = originalString.split(","); |
| | | // 转换为列表 |
| | | List<String> stringList = Arrays.asList(stringArray); |
| | | // 检查目标字符串是否在列表中 |
| | | return stringList.contains(targetString); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.common.security.utils; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | import com.ruoyi.system.api.domain.poji.sys.SysUser; |
| | | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; |
| | | import com.ruoyi.common.core.constant.SecurityConstants; |
| | | import com.ruoyi.common.core.constant.TokenConstants; |
| | |
| | | return SecurityContextHolder.get(SecurityConstants.LOGIN_USER, LoginUser.class); |
| | | } |
| | | |
| | | public static SysUser getSysUser() |
| | | { |
| | | return getLoginUser().getSysUser(); |
| | | } |
| | | |
| | | /** |
| | | * 获取请求token |
| | | */ |
New file |
| | |
| | | package com.ruoyi.file.controller; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.file.service.ActivityCodeService; |
| | | import com.ruoyi.system.api.domain.dto.CodeGetDto; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * @ClassName FileController |
| | | * @Description TODO |
| | | * @Author jqs |
| | | * @Date 2023/8/3 12:50 |
| | | * @Version 1.0 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/file") |
| | | public class FileController { |
| | | |
| | | |
| | | @Resource |
| | | private ActivityCodeService activityCodeService; |
| | | |
| | | @PostMapping("/getCodeUrl") |
| | | public R<String> getAppOrderTotal(@RequestBody CodeGetDto codeGetDto){ |
| | | String url = null; |
| | | try { |
| | | url = activityCodeService.createActivityCode(codeGetDto.getUrl(),codeGetDto.getFileName()); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return R.ok(url); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | package com.ruoyi.file.service; |
| | | |
| | | import me.chanjar.weixin.common.error.WxErrorException; |
| | | |
| | | import java.io.FileNotFoundException; |
| | | |
| | | /** |
| | | * @ClassName ActivityCodeService |
| | | * @Description TODO |
| | |
| | | |
| | | |
| | | /** |
| | | * @description 生成活动二维码 |
| | | * @description 生成二维码 |
| | | * @author jqs |
| | | * @date 2023/7/26 19:09 |
| | | * @param activityId |
| | | * @return void |
| | | * @date 2023/8/3 12:44 |
| | | * @param url |
| | | * @return String |
| | | */ |
| | | public String createActivityCode(String activityId); |
| | | public String createActivityCode(String url, String fileName) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * @description 生成活动二维码 |
| | | * @description 生成微信活动二维码 |
| | | * @author jqs |
| | | * @date 2023/7/26 19:09 |
| | | * @param activityId |
| | | * @return void |
| | | */ |
| | | public String createActivityCode(String activityId,String backImageUrl) throws WxErrorException, FileNotFoundException; |
| | | public String createActivityWxCode(String activityId); |
| | | |
| | | |
| | | /** |
| | | * @description 生成活动海报 |
| | | * @author jqs |
| | | * @date 2023/7/26 19:09 |
| | | * @param activityId |
| | | * @return void |
| | | */ |
| | | public String createActivityPoster(String activityId, String backImageUrl) throws Exception; |
| | | |
| | | } |
| | |
| | | import cn.hutool.core.img.ImgUtil; |
| | | import cn.hutool.extra.qrcode.QrCodeUtil; |
| | | import com.ruoyi.file.utils.OBSUploadUtils; |
| | | import me.chanjar.weixin.common.error.WxErrorException; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | |
| | | |
| | | /** |
| | | * @description 生成二维码 |
| | | * @author jqs |
| | | * @date 2023/8/3 12:44 |
| | | * @param url |
| | | * @return String |
| | | */ |
| | | @Override |
| | | public String createActivityCode(String url, String fileName) throws Exception { |
| | | File qrCodeFile = new File("/home/image/qrcode.png");// 生成二维码 |
| | | QrCodeUtil.generate(url, 100, 100, qrCodeFile); |
| | | InputStream codeStream = new FileInputStream(qrCodeFile); |
| | | String fileUrl = OBSUploadUtils.uploadInputStream(codeStream,fileName); |
| | | return fileUrl; |
| | | } |
| | | |
| | | /** |
| | | * @description 生成活动二维码 |
| | | * @author jqs |
| | | * @date 2023/7/26 19:09 |
| | |
| | | * @return void |
| | | */ |
| | | @Override |
| | | public String createActivityCode(String activityId){ |
| | | public String createActivityWxCode(String activityId){ |
| | | |
| | | WxMaQrcodeService wxMaQrcodeService = wxMaService.getQrcodeService(); |
| | | String scene = activityId; |
| | |
| | | * @return void |
| | | */ |
| | | @Override |
| | | public String createActivityCode(String activityId,String backImageUrl) throws WxErrorException, FileNotFoundException { |
| | | |
| | | |
| | | public String createActivityPoster(String activityId,String backImageUrl) throws Exception { |
| | | String fileUrl = null; |
| | | File qrCodeFile = new File("/home/image/qrcode.png"); |
| | | // 二维码内容 |
| | | String text = ""+activityId; |
| | | String text = "https://wxapp.hhhrt.cn/mini/activity?"+activityId; |
| | | // 生成二维码 |
| | | QrCodeUtil.generate(text, 100, 100, qrCodeFile); |
| | | File backFile ; |
| | | QrCodeUtil.generate(text, 200, 200, qrCodeFile); |
| | | ByteArrayOutputStream out = new ByteArrayOutputStream(); |
| | | InputStream codeStream = new FileInputStream(qrCodeFile); |
| | | InputStream backStream = new FileInputStream(qrCodeFile); |
| | | backImageUrl = backImageUrl.replace("https://hongruitang.oss-cn-beijing.aliyuncs.com/",""); |
| | | InputStream backStream = OBSUploadUtils.getOSSInputStream(backImageUrl); |
| | | // 将图片合成在一起 |
| | | ImgUtil.pressImage( |
| | | backStream, // 主图片 |
| | | out, // 输出图片 |
| | | ImgUtil.read(codeStream).getScaledInstance(516, 516, Image.SCALE_DEFAULT), //水印图片 |
| | | ImgUtil.read(codeStream).getScaledInstance(200, 200, Image.SCALE_DEFAULT), //水印图片 |
| | | 0, //x坐标修正值。 默认在中间,偏移量相对于中间偏移 |
| | | 0, //y坐标修正值。 默认在中间,偏移量相对于中间偏移 |
| | | 350, //y坐标修正值。 默认在中间,偏移量相对于中间偏移 |
| | | 1.0f |
| | | ); |
| | | InputStream inputStream = new ByteArrayInputStream(out.toByteArray()); |
| | | fileUrl = OBSUploadUtils.uploadInputStream(inputStream,activityId); |
| | | return fileUrl; |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.file.utils; |
| | | |
| | | import cn.hutool.extra.qrcode.QrCodeUtil; |
| | | import com.aliyun.oss.ClientException; |
| | | import com.aliyun.oss.OSS; |
| | | import com.aliyun.oss.OSSClientBuilder; |
| | | import com.aliyun.oss.OSSException; |
| | | import com.aliyun.oss.model.OSSObject; |
| | | import com.aliyun.oss.model.PutObjectRequest; |
| | | import com.aliyun.oss.model.PutObjectResult; |
| | | import com.ruoyi.common.core.utils.uuid.IdUtils; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.File; |
| | | import java.io.InputStream; |
| | | import java.io.*; |
| | | import java.util.Calendar; |
| | | |
| | | /** |
| | |
| | | */ |
| | | public class OBSUploadUtils { |
| | | |
| | | public static void main(String[] args) throws Exception { |
| | | String fileUrl = null; |
| | | File qrCodeFile = new File("/home/image/qrcode.png"); |
| | | // 二维码内容 |
| | | String text = "https://wxapp.hhhrt.cn/mini/coupon"; |
| | | // 生成二维码 |
| | | QrCodeUtil.generate(text, 100, 100, qrCodeFile); |
| | | InputStream codeStream = new FileInputStream(qrCodeFile); |
| | | fileUrl = OBSUploadUtils.uploadInputStream(codeStream,"couponCode"); |
| | | System.out.println(fileUrl); |
| | | } |
| | | |
| | | protected static OSS createOss(){ |
| | | // Endpoint以华东1(杭州)为例,其它Region请按实际情况填写。 |
| | |
| | | String prefix = fileName.substring(fileName.lastIndexOf(".")); |
| | | String objectName = filePath + uuid + prefix; |
| | | InputStream inputStream = file.getInputStream(); |
| | | // 创建PutObjectRequest对象。 |
| | | PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, objectName, inputStream); |
| | | // 设置该属性可以返回response。如果不设置,则返回的response为空。 |
| | | putObjectRequest.setProcess("true"); |
| | | // 创建PutObject请求。 |
| | | result = ossClient.putObject(putObjectRequest); |
| | | // 如果上传成功,则返回200。 |
| | | System.out.println(fileName + "上传返回" + result.getResponse().getStatusCode()); |
| | | return result.getResponse().getUri(); |
| | | } catch (OSSException oe) { |
| | | System.out.println("Caught an OSSException, which means your request made it to OSS, " |
| | | + "but was rejected with an error response for some reason."); |
| | | System.out.println("Error Message:" + oe.getErrorMessage()); |
| | | System.out.println("Error Code:" + oe.getErrorCode()); |
| | | System.out.println("Request ID:" + oe.getRequestId()); |
| | | System.out.println("Host ID:" + oe.getHostId()); |
| | | } catch (ClientException ce) { |
| | | System.out.println("Caught an ClientException, which means the client encountered " |
| | | + "a serious internal problem while trying to communicate with OSS, " |
| | | + "such as not being able to access the network."); |
| | | System.out.println("Error Message:" + ce.getMessage()); |
| | | } finally { |
| | | if (ossClient != null) { |
| | | ossClient.shutdown(); |
| | | } |
| | | } |
| | | return result.getResponse().getErrorResponseAsString(); |
| | | } |
| | | |
| | | public static String uploadInputStream (InputStream inputStream,String fileName) throws Exception { |
| | | |
| | | // 填写Object完整路径,完整路径中不能包含Bucket名称,例如exampledir/exampleobject.txt。 |
| | | String bucketName = "hongruitang"; |
| | | Calendar calendar = Calendar.getInstance(); |
| | | // 获取当前年 |
| | | String year = String.valueOf(calendar.get(Calendar.YEAR)); |
| | | // 获取当前月 |
| | | String month = String.valueOf(calendar.get(Calendar.MONTH) + 1); |
| | | // 获取当前日 |
| | | String day = String.valueOf(calendar.get(Calendar.DATE)); |
| | | String filePath = year+"/"+month+"/"+day+"/"; |
| | | String uuid = IdUtils.fastSimpleUUID(); |
| | | // 创建OSSClient实例。 |
| | | OSS ossClient = createOss(); |
| | | PutObjectResult result = null; |
| | | try { |
| | | |
| | | System.out.println(fileName + "开始上传"); |
| | | String objectName = filePath + fileName + ".jpg"; |
| | | // 创建PutObjectRequest对象。 |
| | | PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, objectName, inputStream); |
| | | // 设置该属性可以返回response。如果不设置,则返回的response为空。 |
| | |
| | | return result.getResponse().getErrorResponseAsString(); |
| | | } |
| | | |
| | | public static void getOSSFile(String key) throws Exception { |
| | | |
| | | |
| | | public static InputStream getOSSInputStream(String key) throws Exception { |
| | | String bucketName = "hongruitang"; |
| | | // 创建OSSClient实例。 |
| | | OSS ossClient = createOss(); |
| | | OSSObject ossObject = ossClient.getObject(bucketName,key); |
| | | InputStream inputStream = ossObject.getObjectContent(); |
| | | return inputStream; |
| | | } |
| | | |
| | | } |
| | |
| | | @ApiOperation(value = "导出活动参与记录列表") |
| | | public void exportPageMgtActivityRecord( MgtActivityRecordPageDto mgtActivityRecordPageDto, HttpServletResponse response) { |
| | | Page<MgtActivityRecordPageVo> page = new Page<>(); |
| | | page.setSize(2000); |
| | | if(page.getSize()>5000){ |
| | | page.setSize(5000); |
| | | page.setCurrent(1); |
| | | } |
| | | List<MgtActivityRecordPageVo> activityRecordPageVoList = activityService.pageMgtActivityRecord(page,mgtActivityRecordPageDto); |
| | | ExcelUtil<MgtActivityRecordPageVo> util = new ExcelUtil<MgtActivityRecordPageVo>(MgtActivityRecordPageVo.class); |
| | | util.exportExcel(response, activityRecordPageVoList, "商品列表"); |
| | |
| | | @ApiOperation(value = "导出商品列表") |
| | | public void exportPageMgtGoods( MgtGoodsPageDto mgtGoodsPageDto, HttpServletResponse response) { |
| | | Page<MgtGoodsPageVo> page = new Page<>(); |
| | | page.setSize(2000); |
| | | if(page.getSize()>5000){ |
| | | page.setSize(5000); |
| | | page.setCurrent(1); |
| | | } |
| | | List<MgtGoodsPageVo> mgtGoodsPageVoList = goodsService.pageMgtGoods(page,mgtGoodsPageDto); |
| | | ExcelUtil<MgtGoodsPageVo> util = new ExcelUtil<MgtGoodsPageVo>(MgtGoodsPageVo.class); |
| | | util.exportExcel(response, mgtGoodsPageVoList, "商品列表"); |
| | |
| | | */ |
| | | @TableField("activity_introduce") |
| | | private String activityIntroduce; |
| | | |
| | | /** |
| | | * 活动二维码 |
| | | */ |
| | | @TableField("activity_code") |
| | | private String activityCode; |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | |
| | | package com.ruoyi.goods.domain.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
| | | import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | |
| | | private Integer serviceNum; |
| | | |
| | | @ApiModelProperty(value = "商品售价") |
| | | @JsonSerialize(using = ToStringSerializer.class) |
| | | private BigDecimal salesPrice; |
| | | |
| | | @ApiModelProperty(value = "商品详情") |
| | |
| | | private Integer availableBuyNum; |
| | | |
| | | @ApiModelProperty(value = "商品活动价") |
| | | @JsonSerialize(using = ToStringSerializer.class) |
| | | private BigDecimal activityPrice; |
| | | |
| | | @ApiModelProperty(value = "售罄标记0否1是") |
| | |
| | | package com.ruoyi.goods.domain.vo; |
| | | |
| | | import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
| | | import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | |
| | | private String goodsNurses; |
| | | |
| | | @ApiModelProperty(value = "商品售价") |
| | | @JsonSerialize(using = ToStringSerializer.class) |
| | | private BigDecimal salesPrice; |
| | | |
| | | @ApiModelProperty(value = "购买数量") |
| | |
| | | package com.ruoyi.goods.domain.vo; |
| | | |
| | | import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
| | | import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | |
| | | private String goodsNurses; |
| | | |
| | | @ApiModelProperty(value = "商品售价") |
| | | @JsonSerialize(using = ToStringSerializer.class) |
| | | private BigDecimal salesPrice; |
| | | |
| | | @ApiModelProperty(value = "商品活动价") |
| | | @JsonSerialize(using = ToStringSerializer.class) |
| | | private BigDecimal activityPrice; |
| | | |
| | | @ApiModelProperty(value = "活动销售数量") |
| | |
| | | private Integer salesNumber; |
| | | |
| | | @ApiModelProperty(value = "已售比例") |
| | | @JsonSerialize(using = ToStringSerializer.class) |
| | | private BigDecimal salesPercent; |
| | | |
| | | @ApiModelProperty(value = "结束时间戳") |
| | |
| | | package com.ruoyi.goods.domain.vo; |
| | | |
| | | import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
| | | import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | |
| | | private String goodsNurses; |
| | | |
| | | @ApiModelProperty(value = "商品售价") |
| | | @JsonSerialize(using = ToStringSerializer.class) |
| | | private BigDecimal salesPrice; |
| | | |
| | | @ApiModelProperty(value = "活动售价") |
| | | @JsonSerialize(using = ToStringSerializer.class) |
| | | private BigDecimal activityPrice; |
| | | |
| | | @ApiModelProperty(value = "活动id") |
| | |
| | | |
| | | @ApiModelProperty(value = "商品数量") |
| | | private Integer goodsNum; |
| | | |
| | | @ApiModelProperty(value = "活动二维码地址") |
| | | private String activityCode; |
| | | } |
| | |
| | | package com.ruoyi.goods.domain.vo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
| | | import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | |
| | | private String goodsNurses; |
| | | |
| | | @ApiModelProperty(value = "商品建议售价") |
| | | @JsonSerialize(using = ToStringSerializer.class) |
| | | private BigDecimal suggestSalesPrice;; |
| | | |
| | | @ApiModelProperty(value = "商品售价") |
| | | @JsonSerialize(using = ToStringSerializer.class) |
| | | private BigDecimal salesPrice;; |
| | | |
| | | @ApiModelProperty(value="周期次数标记0否1是") |
| | |
| | | package com.ruoyi.goods.domain.vo; |
| | | |
| | | import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
| | | import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | |
| | | private String goodsType; |
| | | |
| | | @ApiModelProperty(value = "商品售价") |
| | | @JsonSerialize(using = ToStringSerializer.class) |
| | | private BigDecimal salesPrice;; |
| | | |
| | | @ApiModelProperty(value = "秒杀活动价") |
| | | @JsonSerialize(using = ToStringSerializer.class) |
| | | private BigDecimal activityPrice; |
| | | |
| | | @ApiModelProperty(value = "秒杀活动订金") |
| | | @JsonSerialize(using = ToStringSerializer.class) |
| | | private BigDecimal activitySubscription; |
| | | |
| | | @ApiModelProperty(value = "秒杀活动库存") |
| | |
| | | @ApiModelProperty(value = "创建时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date createTime; |
| | | |
| | | @ApiModelProperty(value = "活动二维码地址") |
| | | private String activityCode; |
| | | |
| | | @ApiModelProperty(value = "背景海报地址") |
| | | private String propagandaPoster; |
| | | } |
| | |
| | | package com.ruoyi.goods.domain.vo; |
| | | |
| | | import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
| | | import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | |
| | | private String goodsIntroduction; |
| | | |
| | | @ApiModelProperty(value = "建议售价") |
| | | @JsonSerialize(using = ToStringSerializer.class) |
| | | private BigDecimal salesPrice; |
| | | |
| | | @ApiModelProperty(value = "最低售价") |
| | | @JsonSerialize(using = ToStringSerializer.class) |
| | | private BigDecimal mininumPrice; |
| | | |
| | | @ApiModelProperty(value = "订金") |
| | | @JsonSerialize(using = ToStringSerializer.class) |
| | | private BigDecimal subscription; |
| | | |
| | | @ApiModelProperty(value = "商品详情") |
| | |
| | | package com.ruoyi.goods.domain.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
| | | import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; |
| | | import com.ruoyi.common.core.annotation.Excel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | |
| | | |
| | | @Excel(name = "商品建议售价", width = 30) |
| | | @ApiModelProperty(value = "商品建议售价") |
| | | @JsonSerialize(using = ToStringSerializer.class) |
| | | private BigDecimal suggestSalesPrice;; |
| | | |
| | | @Excel(name = "最低售价", width = 30) |
| | | @ApiModelProperty(value = "最低售价") |
| | | @JsonSerialize(using = ToStringSerializer.class) |
| | | private BigDecimal mininumPrice;; |
| | | |
| | | @Excel(name = "销量", width = 30) |
| | |
| | | |
| | | @Excel(name = "销售额", width = 30) |
| | | @ApiModelProperty(value = "销售额") |
| | | @JsonSerialize(using = ToStringSerializer.class) |
| | | private BigDecimal buyMoneyTotal; |
| | | |
| | | @Excel(name = "是否推荐", width = 30) |
| | |
| | | package com.ruoyi.goods.domain.vo; |
| | | |
| | | import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
| | | import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | |
| | | private Integer buyNumCount; |
| | | |
| | | @ApiModelProperty(value = "销售额") |
| | | @JsonSerialize(using = ToStringSerializer.class) |
| | | private BigDecimal buyMoneyTotal; |
| | | |
| | | |
| | |
| | | public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { |
| | | HttpServletRequest request = (HttpServletRequest) servletRequest; |
| | | HttpServletResponse response = (HttpServletResponse) servletResponse; |
| | | |
| | | String requestUrl = request.getRequestURI(); |
| | | String requestUrlUpperCase = requestUrl.toUpperCase(); |
| | | if(requestUrlUpperCase.contains("EXPORT") |
| | | ||requestUrlUpperCase.contains("IMPORTTEMPLATE") |
| | | ){ |
| | | filterChain.doFilter(request, response); |
| | | return; |
| | | } |
| | | RepeatedlyRequestWrapper wrapper = new RepeatedlyRequestWrapper(request, response); |
| | | getRequestParams(wrapper); |
| | | |
| | |
| | | |
| | | // 返回的结果 |
| | | String content = responseWrapper.getTextContent(); |
| | | String requestUrl = request.getRequestURI(); |
| | | log.info("-------------------- Response Data ----------------------"); |
| | | log.info(requestUrl + " -> " + content); |
| | | |
| | |
| | | import com.ruoyi.system.api.domain.vo.MgtSimpleShopVo; |
| | | import com.ruoyi.system.api.domain.vo.MgtUserIdByKeywordVo; |
| | | import com.ruoyi.system.api.service.RemoteConfigService; |
| | | import com.ruoyi.system.api.service.RemoteFileService; |
| | | import com.ruoyi.system.api.service.RemoteMemberService; |
| | | import com.ruoyi.system.api.service.RemoteShopService; |
| | | import org.redisson.api.RLock; |
| | |
| | | @Autowired |
| | | private RedissonClient redissonClient; |
| | | |
| | | @Resource |
| | | private RemoteFileService remoteFileService; |
| | | |
| | | /** |
| | | * @param mgtActivityEditDto |
| | | * @return void |
| | |
| | | Activity activity; |
| | | // 获取当前时间 |
| | | Date nowTime = new Date(); |
| | | if(mgtActivityEditDto.getActivityStartTime().compareTo(mgtActivityEditDto.getActivityEndTime())>0){ |
| | | throw new ServiceException(AppErrorConstant.ACTIVITY_SE_ERROR); |
| | | } |
| | | // 如果活动ID不为空,则表示修改活动信息 |
| | | if (StringUtils.isNotBlank(mgtActivityEditDto.getActivityId())) { |
| | | // 获取活动信息 |
| | |
| | | activityTotal.setRefundTotal(0); |
| | | activityTotal.setOrderMoneyTotal(BigDecimal.ZERO); |
| | | activityTotalService.save(activityTotal); |
| | | CodeGetDto codeGetDto = new CodeGetDto(); |
| | | String url = "https://wxapp.hhhrt.cn/mini/activity?activityId="+activityId; |
| | | codeGetDto.setUrl(url); |
| | | codeGetDto.setFileName("activity-"+activityId); |
| | | String codeUrl = remoteFileService.getAppOrderTotal(codeGetDto).getData(); |
| | | activity.setActivityCode(codeUrl); |
| | | } |
| | | // 获取活动开始时间和结束时间 |
| | | Date activityStartTime = mgtActivityEditDto.getActivityStartTime(); |
| | |
| | | try { |
| | | lock.lock(30, TimeUnit.SECONDS); |
| | | if(agStockChangeDto.getChangeType()==1){ |
| | | //减少销量增加库存 |
| | | activityMapper.addActivityGoodsStock(agStockChangeDto); |
| | | }else{ |
| | | //更新库存 |
| | | //增加销量减少库存 |
| | | activityMapper.subActivityGoodsStock(agStockChangeDto); |
| | | } |
| | | } finally { |
| | |
| | | WHEN 1 THEN '是' |
| | | ELSE '否' |
| | | END recommendFlag, |
| | | ta.create_time createTime |
| | | ta.create_time createTime, |
| | | ta.activity_code activityCode, |
| | | ta.propaganda_poster propagandaPoster |
| | | FROM t_activity ta |
| | | INNER JOIN t_activity_total tat ON ta.activity_id = tat.activity_id |
| | | WHERE ta.del_flag = 0 |
| | |
| | | AND FIND_IN_SET(#{param.shopId}, ta.applicable_shop) > 0 |
| | | </if> |
| | | <if test="param.activityStartTime!=null and param.activityStartTime != ''"> |
| | | AND ta.activity_start_time >= #{param.activityStartTime} |
| | | AND Date(ta.activity_start_time) >= #{param.activityStartTime} |
| | | </if> |
| | | <if test="param.activityEndTime!=null and param.activityEndTime != ''"> |
| | | AND ta.activity_start_time <= #{param.activityEndTime} |
| | | AND Date(ta.activity_start_time) <= #{param.activityEndTime} |
| | | </if> |
| | | <if test="param.activityStatus!=null"> |
| | | AND ta.activity_status = #{param.activityStatus} |
| | |
| | | AND FIND_IN_SET(#{param.userIds}, user_id) > 0 |
| | | </if> |
| | | <if test="param.createStartTime!=null and param.createStartTime != ''"> |
| | | AND Date(ta.create_time) >= #{param.createStartTime} |
| | | AND Date(create_time) >= #{param.createStartTime} |
| | | </if> |
| | | <if test="param.createEndTime!=null and param.createEndTime != ''"> |
| | | AND Date(ta.create_time) <= #{param.createEndTime} |
| | | AND Date(create_time) <= #{param.createEndTime} |
| | | </if> |
| | | <if test="param.orderFlag!=null and param.orderFlag == 1"> |
| | | AND order_id IS NOT NULL |
| | |
| | | WHEN 2 THEN '已结束' |
| | | END activityStatus, |
| | | ta.propaganda_poster propagandaPoster, |
| | | COUNT(ag.activity_id) goodsNum |
| | | COUNT(ag.activity_id) goodsNum, |
| | | ta.activity_code activityCode |
| | | FROM t_activity ta |
| | | LEFT JOIN t_activity_goods ag ON ta.activity_id = ag.activity_id AND ag.del_flag = 0 |
| | | WHERE ta.del_flag = 0 AND shop_flag = 1 OR (shop_flag = 2 AND FIND_IN_SET(#{param.shopId}, ta.applicable_shop) > 0) |
| | |
| | | |
| | | @RequestMapping(value = "/addMerMember", method = RequestMethod.POST) |
| | | @ApiOperation(value = "新增会员") |
| | | public R addMerMember(@RequestBody MerMemberAddDto merMemberAddDto) { |
| | | public R<Long> addMerMember(@RequestBody MerMemberAddDto merMemberAddDto) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | merMemberAddDto.setUserId(userId); |
| | | memberService.addMerMember(merMemberAddDto); |
| | |
| | | * @return R |
| | | */ |
| | | @PostMapping("/changeIntegral") |
| | | public R signShare(@RequestBody IntegralChangeDto integralChangeDto) { |
| | | public R changeIntegral(@RequestBody IntegralChangeDto integralChangeDto) { |
| | | memberService.changeIntegral(integralChangeDto); |
| | | return R.ok(); |
| | | } |
| | |
| | | @ApiOperation(value = "导出会员列表") |
| | | public void exportPageMgtMember(MgtMemberPageDto mgtMemberPageDto, HttpServletResponse response) { |
| | | Page<MgtMemberPageVo> page = new Page<>(); |
| | | page.setSize(2000); |
| | | if(page.getSize()>5000){ |
| | | page.setSize(5000); |
| | | page.setCurrent(1); |
| | | } |
| | | List<MgtMemberPageVo> mgtShopPageVoList = memberService.pageMgtMember(page,mgtMemberPageDto); |
| | | ExcelUtil<MgtMemberPageVo> util = new ExcelUtil<MgtMemberPageVo>(MgtMemberPageVo.class); |
| | | util.exportExcel(response, mgtShopPageVoList, "用户管理"); |
| | |
| | | Long userId = SecurityUtils.getUserId(); |
| | | mgtMemberIntegralPageDto.setUserId(userId); |
| | | Page<MgtMemberIntegralPageVo> page = new Page<>(); |
| | | page.setSize(2000); |
| | | if(page.getSize()>5000){ |
| | | page.setSize(5000); |
| | | page.setCurrent(1); |
| | | } |
| | | List<MgtMemberIntegralPageVo> mgtMemberIntegralPageVoList = integralRecordService.pageMgtMemberIntegral(page,mgtMemberIntegralPageDto); |
| | | return R.ok(page.setRecords(mgtMemberIntegralPageVoList)); |
| | | } |
| | |
| | | Long userId = SecurityUtils.getUserId(); |
| | | mgtMemberBrowsePageDto.setUserId(userId); |
| | | Page<MgtMemberBrowsePageVo> page = new Page<>(); |
| | | page.setSize(2000); |
| | | if(page.getSize()>5000){ |
| | | page.setSize(5000); |
| | | page.setCurrent(1); |
| | | } |
| | | List<MgtMemberBrowsePageVo> mgtMemberBrowsePageVoList = browseRecordService.pageMgtMemberBrowse(page,mgtMemberBrowsePageDto); |
| | | ExcelUtil<MgtMemberBrowsePageVo> util = new ExcelUtil<MgtMemberBrowsePageVo>(MgtMemberBrowsePageVo.class); |
| | | util.exportExcel(response, mgtMemberBrowsePageVoList, "用户浏览记录"); |
| | |
| | | Long userId = SecurityUtils.getUserId(); |
| | | memberSuggestPageDto.setUserId(userId); |
| | | Page<MgtMemberSuggestPageVo> page = new Page<>(); |
| | | page.setSize(2000); |
| | | if(page.getSize()>5000){ |
| | | page.setSize(5000); |
| | | page.setCurrent(1); |
| | | } |
| | | List<MgtMemberSuggestPageVo> mgtMemberSuggestPageVoList = memberSuggestService.pageMgtMemberSuggest(page,memberSuggestPageDto); |
| | | ExcelUtil<MgtMemberSuggestPageVo> util = new ExcelUtil<MgtMemberSuggestPageVo>(MgtMemberSuggestPageVo.class); |
| | | util.exportExcel(response, mgtMemberSuggestPageVoList, "用户建议列表"); |
| | |
| | | int todayMonth = today.getMonthValue(); |
| | | if (birthdayMonth == todayMonth) { |
| | | appBirthdayCardVo = birthdayCardService.getUserBirthdayCard(userId,member.getRelationShopId()); |
| | | appBirthdayCardVo.setCheckBirthdayCard(1); |
| | | appBirthdayCardVo.setHaveBirthdayFlag(1); |
| | | appBirthdayCardVo.setInBirthdayFlag(1); |
| | | } else { |
| | |
| | | |
| | | |
| | | @ApiModelProperty(value = "用户昵称") |
| | | private String nickName; |
| | | private String realName; |
| | | |
| | | @ApiModelProperty(value = "手机号码") |
| | | private String phonenumber; |
| | |
| | | private Long editUserId; |
| | | |
| | | @ApiModelProperty(value = "用户昵称") |
| | | private String nickName; |
| | | private String realName; |
| | | |
| | | @ApiModelProperty(value = "手机号码") |
| | | private String phonenumber; |
| | |
| | | * 下次跟进时间 |
| | | */ |
| | | @TableField("next_task_time") |
| | | private Date nextTaskTime; |
| | | private String nextTaskTime; |
| | | /** |
| | | * 总服务次数 |
| | | */ |
| | |
| | | private Long userId; |
| | | |
| | | @ApiModelProperty(value = "用户名称") |
| | | private String nickName; |
| | | private String realName; |
| | | |
| | | @ApiModelProperty(value = "手机号码") |
| | | private String phonenumber; |
| | |
| | | private Long userId; |
| | | |
| | | @ApiModelProperty(value = "用户名称") |
| | | private String nickName; |
| | | private String realName; |
| | | |
| | | @ApiModelProperty(value = "手机号码") |
| | | private String phonenumber; |
| | |
| | | private Date lastTaskTime; |
| | | |
| | | @ApiModelProperty(value = "下次跟进任务时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date nextTaskTime; |
| | | private String nextTaskTime; |
| | | |
| | | @ApiModelProperty(value = "最近消费时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | |
| | | @Excel(name = "平台响应时间", width = 30) |
| | | @ApiModelProperty(value = "平台响应时间") |
| | | private String responseTime; |
| | | @Excel(name = "回复商户名", width = 30) |
| | | @ApiModelProperty(value = "回复商户名") |
| | | private String replayShopName; |
| | | @ApiModelProperty(value = "商户id") |
| | | private Long shopId; |
| | | @Excel(name = "商户名", width = 30) |
| | | @ApiModelProperty(value = "商户名") |
| | | private String shopName; |
| | | @Excel(name = "商户回复人姓名", width = 30) |
| | | @ApiModelProperty(value = "商户回复人姓名") |
| | | private String shopReplayUserName; |
| | |
| | | public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { |
| | | HttpServletRequest request = (HttpServletRequest) servletRequest; |
| | | HttpServletResponse response = (HttpServletResponse) servletResponse; |
| | | |
| | | String requestUrl = request.getRequestURI(); |
| | | String requestUrlUpperCase = requestUrl.toUpperCase(); |
| | | if(requestUrlUpperCase.contains("EXPORT") |
| | | ||requestUrlUpperCase.contains("IMPORTTEMPLATE") |
| | | ){ |
| | | filterChain.doFilter(request, response); |
| | | return; |
| | | } |
| | | RepeatedlyRequestWrapper wrapper = new RepeatedlyRequestWrapper(request, response); |
| | | getRequestParams(wrapper); |
| | | |
| | |
| | | |
| | | // 返回的结果 |
| | | String content = responseWrapper.getTextContent(); |
| | | String requestUrl = request.getRequestURI(); |
| | | log.info("-------------------- Response Data ----------------------"); |
| | | log.info(requestUrl + " -> " + content); |
| | | |
| | |
| | | * @param |
| | | * @return List<MerMemberCouponVo> |
| | | */ |
| | | List<MerMemberCouponVo> listMerShopGoodsMemberCoupon(MerGoodsCouponListDto merGoodsCouponListDto); |
| | | List<MerMemberCouponVo> listMerShopGoodsMemberCoupon(@Param("param") MerGoodsCouponListDto merGoodsCouponListDto); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.core.utils.uuid.IdUtils; |
| | | import com.ruoyi.member.domain.dto.MerBirthdayEditDto; |
| | |
| | | import com.ruoyi.member.service.birthday.BirthdayCardService; |
| | | import com.ruoyi.member.service.birthday.BirthdayGiftService; |
| | | import com.ruoyi.member.service.member.MemberGiftRecordService; |
| | | import com.ruoyi.system.api.constant.AppErrorConstant; |
| | | import com.ruoyi.system.api.domain.dto.BirthdayGiftSendDto; |
| | | import com.ruoyi.system.api.domain.dto.MgtBaseBathDto; |
| | | import com.ruoyi.system.api.domain.poji.member.MemberGiftRecord; |
| | |
| | | } |
| | | birthdayCard.setCardStatus(merBirthdayEditDto.getCardStatus()); |
| | | this.saveOrUpdate(birthdayCard); |
| | | List<BirthdayGift> birthdayGiftList = birthdayGiftService.listByCardId(birthdayCard.getCardId()); |
| | | if(merBirthdayEditDto.getCardStatus()==1){ |
| | | if(birthdayGiftList==null||birthdayGiftList.isEmpty()){ |
| | | throw new ServiceException(AppErrorConstant.BIRTHDAYCARD_NO_GIFT); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | if (plBirthdayCard != null && plBirthdayCard.getCardStatus()==1) { |
| | | // 获取生日卡对应的生日礼物列表 |
| | | List<BirthdayGift> birthdayGiftList = birthdayGiftService.listByCardId(plBirthdayCard.getCardId()); |
| | | if(!birthdayGiftList.isEmpty()){ |
| | | if(birthdayGiftList!=null&&!birthdayGiftList.isEmpty()){ |
| | | // 遍历生日礼物列表 |
| | | for (BirthdayGift birthdayGift : birthdayGiftList) { |
| | | winningProbability = birthdayGift.getWinningProbability(); |
| | |
| | | @Override |
| | | public Integer checkBirthdayCard(Long shopId){ |
| | | // 获取平台生日卡信息 |
| | | BirthdayCard plBirthdayCard = birthdayCardMapper.getPlatformBirthdayCard(shopId); |
| | | // 如果生日卡存在 |
| | | Boolean platformBirthdayCardOpen = true; |
| | | BirthdayCard plBirthdayCard = birthdayCardMapper.getMerShopBirthdayCard(0L); |
| | | if (plBirthdayCard == null || plBirthdayCard.getCardStatus()!=1) { |
| | | return 0; |
| | | platformBirthdayCardOpen = false; |
| | | }else{ |
| | | if(plBirthdayCard.getAreaFlag()==2&&!StringUtils.checkString(plBirthdayCard.getApplicableShop(),shopId.toString())){ |
| | | platformBirthdayCardOpen = false; |
| | | } |
| | | } |
| | | BirthdayCard shopBirthdayCard = birthdayCardMapper.getMerShopBirthdayCard(shopId); |
| | | // 如果生日卡存在 |
| | | Boolean shopBirthdayCardOpen = true; |
| | | if (shopBirthdayCard == null || shopBirthdayCard.getCardStatus()!=1) { |
| | | shopBirthdayCardOpen = false; |
| | | } |
| | | Integer marketingStatus = remoteShopService.getShopMarketingStatus(shopId).getData(); |
| | | if(marketingStatus<=1){ |
| | | shopBirthdayCardOpen = false; |
| | | } |
| | | if(!platformBirthdayCardOpen||!shopBirthdayCardOpen){ |
| | | return 1; |
| | | }else{ |
| | | return 0; |
| | | } |
| | | return 1; |
| | | } |
| | | } |
| | |
| | | if(StringUtils.isNotBlank(relGoodsIds)){ |
| | | //获取指定商品列表 |
| | | List<MerGoodsPriceListVo> goodsList = remoteGoodsService.listGoodsPriceByGoodsId(relGoodsIds).getData(); |
| | | if(!goodsList.isEmpty()){ |
| | | if(goodsList!=null&&!goodsList.isEmpty()){ |
| | | merCouponGetVo.setRelGoodsList(goodsList); |
| | | } |
| | | } |
| | |
| | | String memberCouponId; |
| | | Integer sendUserTotal; |
| | | for(Long userId : userIdList){ |
| | | if(coupon.getCouponFrom()==2){ |
| | | for(int i=0;i<coupon.getLimitNumber();i++){ |
| | | memberCouponId = IdUtils.simpleUUID(); |
| | | memberCoupon = new MemberCoupon(); |
| | | memberCoupon.setId(memberCouponId); |
| | |
| | | } |
| | | memberCouponRecordService.updateMemberCouponRecord(coupon,userId,1); |
| | | } |
| | | }else{ |
| | | memberCouponId = IdUtils.simpleUUID(); |
| | | memberCoupon = new MemberCoupon(); |
| | | memberCoupon.setId(memberCouponId); |
| | | memberCoupon.setDelFlag(0); |
| | | memberCoupon.setCouponId(coupon.getCouponId()); |
| | | memberCoupon.setUserId(userId); |
| | | memberCoupon.setShopId(coupon.getShopId()); |
| | | memberCoupon.setCouponType(coupon.getCouponType()); |
| | | memberCoupon.setCouponStatus(coupon.getCouponStatus()); |
| | | memberCoupon.setCouponName(coupon.getCouponName()); |
| | | memberCoupon.setSendType(coupon.getSendType()); |
| | | memberCoupon.setSendTarget(coupon.getSendTarget()); |
| | | memberCoupon.setSendTimeType(coupon.getSendTimeType()); |
| | | memberCoupon.setSendTime(coupon.getSendTime()); |
| | | memberCoupon.setMoneyThreshold(coupon.getMoneyThreshold()); |
| | | memberCoupon.setDiscountMoney(coupon.getDiscountMoney()); |
| | | memberCoupon.setDiscountPercent(coupon.getDiscountPercent()); |
| | | memberCoupon.setUseScope(coupon.getUseScope()); |
| | | memberCoupon.setValidTimeType(coupon.getValidTimeType()); |
| | | memberCoupon.setValidStartTime(coupon.getValidStartTime()); |
| | | memberCoupon.setValidEndTime(coupon.getValidEndTime()); |
| | | memberCoupon.setValidDay(coupon.getValidDay()); |
| | | memberCoupon.setCouponFrom(coupon.getCouponFrom()); |
| | | memberCoupon.setReceiveTime(nowTime); |
| | | memberCoupon.setRelGoodsIds(coupon.getRelGoodsIds()); |
| | | //有效期处理1.时间段2.领取之日起 |
| | | if(coupon.getValidTimeType()==1){ |
| | | memberCoupon.setDeadlineTime(coupon.getValidEndTime()); |
| | | }else if(coupon.getValidTimeType()==2){ |
| | | memberCoupon.setDeadlineTime(DateUtils.addDays(nowTime,coupon.getValidDay())); |
| | | } |
| | | memberCouponList.add(memberCoupon); |
| | | sendTotal = sendTotal + 1; |
| | | if(coupon.getSendType()==1){ |
| | | sendUserTotal = memberCouponService.totalMemberCouponByUserAndCoupon(userId,coupon.getCouponId()); |
| | | if(sendUserTotal!=null&&sendUserTotal>0){ |
| | | }else{ |
| | | sendPerson = sendPerson + 1; |
| | | } |
| | | } |
| | | memberCouponRecordService.updateMemberCouponRecord(coupon,userId,1); |
| | | } |
| | | } |
| | | memberCouponService.saveBatch(memberCouponList); |
| | | //处理优惠券统计 |
| | | if(sendTotal>0){ |
| | |
| | | case 4: |
| | | member.setBirthday(editValue); |
| | | break; |
| | | case 5: |
| | | member.setRealName(editValue); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | |
| | | Member member = this.getByUserId(userId); |
| | | // 设置MerMemberInfoVo对象的属性值 |
| | | merMemberInfoVo.setUserId(userId); |
| | | merMemberInfoVo.setNickName(member.getNickName()); |
| | | merMemberInfoVo.setRealName(member.getRealName()); |
| | | merMemberInfoVo.setPhonenumber(member.getMobile()); |
| | | merMemberInfoVo.setAvatar(member.getAvatar()); |
| | | merMemberInfoVo.setBirthday(member.getBirthday()); |
| | |
| | | MerMemberBasicFileVo merMemberBasicFileVo = new MerMemberBasicFileVo(); |
| | | Member member = this.getByUserId(userId); |
| | | BeanUtils.copyProperties(member, merMemberBasicFileVo); |
| | | merMemberBasicFileVo.setNickName(member.getNickName()); |
| | | merMemberBasicFileVo.setRealName(member.getRealName()); |
| | | merMemberBasicFileVo.setPhonenumber(member.getMobile()); |
| | | merMemberBasicFileVo.setCreateTime(member.getCreateTime()); |
| | | /*List<MemberNurse> memberNurseList = memberNurseService.listByUserId(userId); |
| | |
| | | * @param merMemberAddDto |
| | | */ |
| | | @Override |
| | | public void addMerMember(MerMemberAddDto merMemberAddDto) { |
| | | public Long addMerMember(MerMemberAddDto merMemberAddDto) { |
| | | String phoneNumber = merMemberAddDto.getPhonenumber(); |
| | | Member oldMember = this.getByMobile(phoneNumber); |
| | | // Check if the member already exists |
| | |
| | | sysUser = new SysUser(); |
| | | sysUser.setUserName(memberId); |
| | | sysUser.setUserType("03"); |
| | | sysUser.setNickName(merMemberAddDto.getNickName()); |
| | | sysUser.setNickName(merMemberAddDto.getRealName()); |
| | | sysUser.setAvatar("https://hongruitang.oss-cn-beijing.aliyuncs.com/default.png"); |
| | | String password = "hongruitang"; |
| | | sysUser.setPassword(SecurityUtils.encryptPassword(password)); |
| | |
| | | member.setUserId(sysUser.getUserId()); |
| | | member.setDelFlag(0); |
| | | member.setFrozenFlag(0); |
| | | member.setNickName(merMemberAddDto.getNickName()); |
| | | member.setRealName(merMemberAddDto.getNickName()); |
| | | member.setNickName(merMemberAddDto.getRealName()); |
| | | member.setRealName(merMemberAddDto.getRealName()); |
| | | member.setGender(merMemberAddDto.getGender()); |
| | | member.setMobile(phoneNumber); |
| | | member.setReferrer(merMemberAddDto.getReferrer()); |
| | |
| | | memberArchiveService.saveBatch(memberArchiveList); |
| | | } |
| | | } |
| | | return sysUser.getUserId(); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | } |
| | | // 更新用户信息 |
| | | member.setRealName(merMemberEditDto.getNickName()); |
| | | member.setRealName(merMemberEditDto.getRealName()); |
| | | member.setMobile(merMemberEditDto.getPhonenumber()); |
| | | member.setGender(merMemberEditDto.getGender()); |
| | | member.setReferrer(merMemberEditDto.getReferrer()); |
| | |
| | | String memberUserIds = mgtMemberRelDelDto.getMemberUserIds(); |
| | | String[] memberUserIdArr = memberUserIds.split(","); |
| | | for (String str : memberUserIdArr) { |
| | | Member member = this.getByUserId(Long.valueOf(str)); |
| | | member.setBindingFlag(0); |
| | | member.setUpdateTime(new Date()); |
| | | member.setUpdateUserId(mgtMemberRelDelDto.getUserId()); |
| | | this.saveOrUpdate(member); |
| | | LambdaUpdateWrapper<Member> updateWrapper = Wrappers.lambdaUpdate(); |
| | | updateWrapper.eq(Member::getUserId, str) |
| | | .set(Member::getBindingFlag, 0) |
| | | .set(Member::getRelationShopId,null) |
| | | .set(Member::getRelationShopName,null) |
| | | .set(Member::getUpdateUserId,mgtMemberRelDelDto.getUserId()) |
| | | .set(Member::getUpdateTime,new Date()); |
| | | this.update(updateWrapper); |
| | | } |
| | | } |
| | | } |
| | |
| | | mgtMemberGetVo.setCreateTime(member.getCreateTime()); |
| | | mgtMemberGetVo.setLastPayTime(memberTotal.getLastPayTime()); |
| | | mgtMemberGetVo.setGoodsType(member.getGoodsType()); |
| | | if(member.getBindingFlag()==1){ |
| | | mgtMemberGetVo.setRelationShopName(member.getRelationShopName()); |
| | | } |
| | | mgtMemberGetVo.setIntegral(memberTotal.getTotalIntegral()); |
| | | mgtMemberGetVo.setMemberFrom(member.getCustomerSource()); |
| | | mgtMemberGetVo.setTotalActivityCount(memberTotal.getTotalActivityCount()); |
| | |
| | | memberTotal.setUseableServiceCount(memberTotal.getUseableServiceCount() - memberTotalChangeDto.getServiceCount()); |
| | | memberTotal.setUsedServiceCount(memberTotal.getUsedServiceCount() + memberTotalChangeDto.getServiceCount()); |
| | | } else { |
| | | memberTotal.setUseableIntegral(memberTotal.getUseableIntegral() + memberTotalChangeDto.getServiceCount()); |
| | | memberTotal.setUseableServiceCount(memberTotal.getUseableServiceCount() + memberTotalChangeDto.getServiceCount()); |
| | | memberTotal.setTotalServiceCount(memberTotal.getTotalServiceCount() + memberTotalChangeDto.getServiceCount()); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.member.service.member.MemberSuggestService; |
| | | import com.ruoyi.system.api.domain.dto.AppSuggestPageDto; |
| | | import com.ruoyi.system.api.domain.dto.AppUserSuggestDto; |
| | | import com.ruoyi.system.api.domain.dto.MgtBaseBathDto; |
| | | import com.ruoyi.system.api.domain.dto.MgtShopIdByCodeDto; |
| | | import com.ruoyi.system.api.domain.poji.config.SysTag; |
| | | import com.ruoyi.system.api.domain.poji.sys.SysUser; |
| | | import com.ruoyi.system.api.domain.vo.MgtShopIdByCodeVo; |
| | | import com.ruoyi.system.api.domain.vo.MgtSimpleShopVo; |
| | | import com.ruoyi.system.api.service.RemoteConfigService; |
| | | import com.ruoyi.system.api.service.RemoteShopService; |
| | | import com.ruoyi.system.api.service.RemoteUserService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | mgtShopIdByCodeDto.setShopCityCode(memberSuggestPageDto.getShopCityCode()); |
| | | mgtShopIdByCodeDto.setShopAreaCode(memberSuggestPageDto.getShopAreaCode()); |
| | | MgtShopIdByCodeVo mgtShopIdByCodeVo = remoteShopService.getShopIdByCode(mgtShopIdByCodeDto).getData(); |
| | | if(StringUtils.isNotBlank(mgtShopIdByCodeVo.getShopIds())){ |
| | | memberSuggestPageDto.setShopIds(mgtShopIdByCodeVo.getShopIds()); |
| | | }else{ |
| | | return mgtMemberSuggestPageVoList; |
| | | } |
| | | } |
| | | //处理标签为正则方便sql判断 |
| | | if(StringUtils.isNotBlank(memberSuggestPageDto.getTags())){ |
| | |
| | | } |
| | | //获取返回结果 |
| | | mgtMemberSuggestPageVoList = memberSuggestMapper.pageMgtMemberSuggest(page, memberSuggestPageDto); |
| | | if(mgtMemberSuggestPageVoList!=null&&!mgtMemberSuggestPageVoList.isEmpty()){ |
| | | HashSet<Long> shopIdSet = new HashSet<>(); |
| | | for(MgtMemberSuggestPageVo mgtMemberSuggestPageVo : mgtMemberSuggestPageVoList){ |
| | | if(mgtMemberSuggestPageVo.getShopId()!=null){ |
| | | shopIdSet.add(mgtMemberSuggestPageVo.getShopId()); |
| | | } |
| | | } |
| | | String shopJoinedString = String.join(",", shopIdSet.stream().map(Object::toString).collect(Collectors.toList())); |
| | | MgtBaseBathDto mgtBaseBathDto = new MgtBaseBathDto(); |
| | | mgtBaseBathDto.setIds(shopJoinedString); |
| | | List<MgtSimpleShopVo> simpleShopVoList = remoteShopService.listShopSimpleVoByIds(mgtBaseBathDto).getData(); |
| | | Map<Long, MgtSimpleShopVo> shopMap = simpleShopVoList.stream() |
| | | .collect(Collectors.toMap(MgtSimpleShopVo::getShopId, Function.identity())); |
| | | for(MgtMemberSuggestPageVo mgtMemberSuggestPageVo : mgtMemberSuggestPageVoList){ |
| | | if(mgtMemberSuggestPageVo.getShopId()!=null){ |
| | | mgtMemberSuggestPageVo.setShopName(shopMap.get(mgtMemberSuggestPageVo.getShopId()).getShopName()); |
| | | } |
| | | } |
| | | } |
| | | return mgtMemberSuggestPageVoList; |
| | | } |
| | | |
| | |
| | | * 添加会员 |
| | | * @param merMemberAddDto |
| | | */ |
| | | void addMerMember(MerMemberAddDto merMemberAddDto); |
| | | Long addMerMember(MerMemberAddDto merMemberAddDto); |
| | | |
| | | /** |
| | | * 编辑会员 |
| | |
| | | <select id="listMerShopGoodsMemberCoupon" resultType="com.ruoyi.system.api.domain.vo.MerMemberCouponVo"> |
| | | SELECT |
| | | tuc.id memberCouponId, |
| | | tuc.use_scope, |
| | | tuc.rel_goods_ids relGoodsIds, |
| | | tuc.coupon_type couponType, |
| | | tuc.coupon_name couponName, |
| | | tuc.money_threshold moneyThreshold, |
| | |
| | | tuc.valid_start_time validStartTime, |
| | | tuc.deadline_time deadlineTime |
| | | FROM t_member_coupon tuc |
| | | WHERE tuc.del_flag = 0 AND tuc.coupon_status = 1 AND tuc.user_id = #{param.userId} AND tuc.coupon_type IN (1,2,3) |
| | | WHERE tuc.del_flag = 0 AND tuc.coupon_status = 1 AND tuc.user_id = #{param.memberUserId} AND tuc.coupon_type IN (1,2,3) |
| | | AND (tuc.coupon_from = 1 OR (tuc.coupon_from = 2 AND tuc.shop_id = #{param.shopId})) |
| | | <if test="param.goodsId!=null and param.goodsId!=''"> |
| | | AND (tuc.use_scope = 1 OR (tuc.use_scope = 2 AND FIND_IN_SET(#{param.goodsId}, rel_goods_ids) > 0)) |
| | | </if> |
| | | ORDER BY tuc.receive_time DESC |
| | | </select> |
| | | </mapper> |
| | |
| | | AND FIND_IN_SET(#{param.memberNurse},tm.member_nurse) > 0 |
| | | </if> |
| | | <if test="param.actStartDate!=null and param.actStartDate!=''"> |
| | | AND Date(tmt.last_pay_time) >= #{param.actStartDate} |
| | | AND Date(tmt.last_service_time) >= #{param.actStartDate} |
| | | </if> |
| | | <if test="param.actEndDate!=null and param.actEndDate!=''"> |
| | | AND Date(tmt.last_pay_time) <= #{param.actEndDate} |
| | | AND Date(tmt.last_service_time) <= #{param.actEndDate} |
| | | </if> |
| | | <if test="param.keyword != null and param.keyword != ''"> |
| | | AND (tm.real_name LIKE CONCAT('%',#{param.keyword},'%') OR tm.mobile LIKE CONCAT('%',#{param.keyword},'%') OR tm.referrer LIKE CONCAT('%',#{param.keyword},'%')) |
| | |
| | | <select id="pageMerCashMember" resultType="com.ruoyi.member.domain.vo.MerCashMemberPageVo"> |
| | | SELECT |
| | | tm.user_id userId, |
| | | tm.nick_name nickName, |
| | | tm.real_name nickName, |
| | | tm.mobile mobile |
| | | FROM t_member tm |
| | | WHERE tm.relation_shop_id = #{param.shopId} |
| | |
| | | tm.create_time createTime, |
| | | tmt.last_pay_time lastPayTime, |
| | | tm.goods_type goodsType, |
| | | tm.relation_shop_name relationShopName, |
| | | CASE binding_flag WHEN 1 THEN tm.relation_shop_name ELSE "" END relationShopName, |
| | | tmt.total_integral integral, |
| | | tm.referrer referrer, |
| | | tm.customer_source memberFrom, |
| | |
| | | LEFT JOIN t_member_total tmt ON tm.member_id = tmt.member_id |
| | | WHERE tm.del_flag = 0 |
| | | <if test="param.keyword != null and param.keyword != ''"> |
| | | AND (tm.member_no LIKE CONCAT('%',#{param.keyword},'%') OR tm.mobile LIKE CONCAT('%',#{param.keyword},'%') OR tm.real_name LIKE CONCAT('%',#{param.keyword},'%') OR tm.nick_name LIKE CONCAT('%',#{param.keyword},'%') OR FIND_IN_SET(#{param.keyword},tm.member_nurse) > 0) |
| | | AND (tm.user_id LIKE CONCAT('%',#{param.keyword},'%') OR tm.mobile LIKE CONCAT('%',#{param.keyword},'%') OR tm.real_name LIKE CONCAT('%',#{param.keyword},'%') OR tm.nick_name LIKE CONCAT('%',#{param.keyword},'%') OR FIND_IN_SET(#{param.keyword},tm.member_nurse) > 0) |
| | | </if> |
| | | <if test="param.belongDistrict != null and param.belongDistrict != ''"> |
| | | AND tm.belong_district = #{param.belongDistrict} |
| | |
| | | AND FIND_IN_SET(#{param.goodsType},tm.goods_type) > 0 |
| | | </if> |
| | | <if test="param.relationShopId != null and param.relationShopId != ''"> |
| | | AND tm.relation_shop_id = #{param.relationShopId} |
| | | AND tm.relation_shop_id = #{param.relationShopId} AND tm.binding_flag = 1 |
| | | </if> |
| | | <if test="param.memberFrom != null and param.memberFrom != ''"> |
| | | AND tm.customer_source = #{param.memberFrom} |
| | |
| | | AND tmt.total_integral <= #{param.endIntegral} |
| | | </if> |
| | | <if test="param.actStartDate != null and param.actStartDate != ''"> |
| | | AND Date(tmt.last_pay_time) >= #{param.actStartDate} |
| | | AND Date(tmt.last_service_time) >= #{param.actStartDate} |
| | | </if> |
| | | <if test="param.actEndDate != null and param.actEndDate != ''"> |
| | | AND Date(tmt.last_pay_time) <= #{param.actEndDate} |
| | | AND Date(tmt.last_service_time) <= #{param.actEndDate} |
| | | </if> |
| | | <if test="param.startPayCount != null and param.startPayCount != ''"> |
| | | AND tmt.total_pay_count >= #{param.startPayCount} |
| | |
| | | <if test="sendType != null and sendType == 4"> |
| | | AND tm.binding_flag = 0 |
| | | </if> |
| | | <if test="shopId != null and shopId != ''"> |
| | | <if test="shopId != null and shopId != '' and sendType != null and sendType != 4"> |
| | | AND tm.relation_shop_id = #{shopId} |
| | | </if> |
| | | </select> |
| | |
| | | AND tm.relation_shop_id = #{shopId} |
| | | </if> |
| | | <if test="actStartDate != null and actStartDate != ''"> |
| | | AND Date(tmt.last_pay_time) >= #{actStartDate} |
| | | AND Date(tmt.last_service_time) >= #{actStartDate} |
| | | </if> |
| | | <if test="actEndDate != null and actEndDate != ''"> |
| | | AND Date(tmt.last_pay_time) <= #{actEndDate} |
| | | AND Date(tmt.last_service_time) <= #{actEndDate} |
| | | </if> |
| | | </select> |
| | | |
| | |
| | | </foreach> |
| | | </if> |
| | | <if test="actStartDate != null and actStartDate != ''"> |
| | | AND Date(tmt.last_pay_time) >= #{actStartDate} |
| | | AND Date(tmt.last_service_time) >= #{actStartDate} |
| | | </if> |
| | | <if test="actEndDate != null and actEndDate != ''"> |
| | | AND Date(tmt.last_pay_time) <= #{actEndDate} |
| | | AND Date(tmt.last_service_time) <= #{actEndDate} |
| | | </if> |
| | | </select> |
| | | |
| | |
| | | tms.shop_replay_user_name shopReplayUserName, |
| | | tms.shop_replay_time shopReplayTime, |
| | | tms.shop_response_time shopResponseTime, |
| | | tms.suggest_tags suggestTags |
| | | tms.suggest_tags suggestTags, |
| | | tms.shop_id shopId |
| | | FROM |
| | | t_member_suggest tms |
| | | INNER JOIN t_member tm ON tms.create_user_id = tm.user_id |
New file |
| | |
| | | package com.ruoyi.order.config; |
| | | |
| | | import com.github.binarywang.wxpay.config.WxPayConfig; |
| | | import com.github.binarywang.wxpay.service.WxPayService; |
| | | import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl; |
| | | import lombok.AllArgsConstructor; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; |
| | | import org.springframework.boot.context.properties.EnableConfigurationProperties; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | /** |
| | | * @author Binary Wang |
| | | */ |
| | | @Configuration |
| | | @ConditionalOnClass(WxPayService.class) |
| | | @EnableConfigurationProperties(WxPayProperties.class) |
| | | @AllArgsConstructor |
| | | public class WxPayConfiguration { |
| | | |
| | | private WxPayProperties properties; |
| | | |
| | | // 分账特约商户 |
| | | private static String PLATFORM_TY_MAC_ID = ""; |
| | | |
| | | public static String getPlatformTyMacId() { |
| | | return PLATFORM_TY_MAC_ID; |
| | | } |
| | | |
| | | @Bean |
| | | @ConditionalOnMissingBean |
| | | public WxPayService wxService() { |
| | | WxPayConfig payConfig = new WxPayConfig(); |
| | | payConfig.setAppId(StringUtils.trimToNull(this.properties.getAppId())); |
| | | payConfig.setMchId(StringUtils.trimToNull(this.properties.getMchId())); |
| | | payConfig.setMchKey(StringUtils.trimToNull(this.properties.getMchKey())); |
| | | payConfig.setSubAppId(StringUtils.trimToNull(this.properties.getSubAppId())); |
| | | payConfig.setSubMchId(StringUtils.trimToNull(this.properties.getSubMchId())); |
| | | payConfig.setKeyPath(StringUtils.trimToNull(this.properties.getKeyPath())); |
| | | |
| | | // 平台特约商户号 |
| | | PLATFORM_TY_MAC_ID = this.properties.getPlatformTyMacId(); |
| | | |
| | | // 可以指定是否使用沙箱环境 |
| | | payConfig.setUseSandboxEnv(false); |
| | | |
| | | WxPayService wxPayService = new WxPayServiceImpl(); |
| | | wxPayService.setConfig(payConfig); |
| | | return wxPayService; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.config; |
| | | |
| | | import lombok.Data; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | |
| | | /** |
| | | * wxpay pay properties. |
| | | * |
| | | * @author Binary Wang |
| | | */ |
| | | @Data |
| | | @ConfigurationProperties(prefix = "wx.pay") |
| | | public class WxPayProperties { |
| | | /** |
| | | * 设置微信公众号或者小程序等的appid |
| | | */ |
| | | private String appId; |
| | | |
| | | /** |
| | | * 微信支付商户号 |
| | | */ |
| | | private String mchId; |
| | | |
| | | /** |
| | | * 微信支付商户密钥 |
| | | */ |
| | | private String mchKey; |
| | | |
| | | /** |
| | | * 平台特约商户号,用户平台收取服务费 |
| | | */ |
| | | private String platformTyMacId; |
| | | |
| | | /** |
| | | * 服务商模式下的子商户公众账号ID,普通模式请不要配置,请在配置文件中将对应项删除 |
| | | */ |
| | | private String subAppId; |
| | | |
| | | /** |
| | | * 服务商模式下的子商户号,普通模式请不要配置,最好是请在配置文件中将对应项删除 |
| | | */ |
| | | private String subMchId; |
| | | |
| | | /** |
| | | * apiclient_cert.p12文件的绝对路径,或者如果放在项目中,请以classpath:开头指定 |
| | | */ |
| | | private String keyPath; |
| | | |
| | | } |
| | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | import static org.reflections.Reflections.log; |
| | | |
| | | /** |
| | | * @author jqs34 |
| | | * @ClassName MerOrderController |
| | |
| | | Page<MerMemberNoClearOrderVo> page = new Page<>(); |
| | | page.setSize(merMemberNoClearOrderDto.getPageSize()); |
| | | page.setCurrent(merMemberNoClearOrderDto.getPageNum()); |
| | | log.info("merMemberNoClearOrderDto----"+merMemberNoClearOrderDto.toString()); |
| | | List<MerMemberNoClearOrderVo> merMemberNoClearOrderVoList = orderService.pageMerMemberOrder(page,merMemberNoClearOrderDto); |
| | | return R.ok(page.setRecords(merMemberNoClearOrderVoList)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/pageMerMemberPayOrder", method = RequestMethod.POST) |
| | | @ApiOperation(value = "获取商户端用户消费记录") |
| | | public R<Page<MerOrderPageVo>> pageMerMemberPayOrder(@RequestBody MerMemberNoClearOrderDto merOrderPageDto) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | merOrderPageDto.setUserId(userId); |
| | | Page<MerOrderPageVo> page = new Page<>(); |
| | | page.setSize(merOrderPageDto.getPageSize()); |
| | | page.setCurrent(merOrderPageDto.getPageNum()); |
| | | List<MerOrderPageVo> merOrderPageVoList = orderService.pageMerMemberPayOrder(page,merOrderPageDto); |
| | | return R.ok(page.setRecords(merOrderPageVoList)); |
| | | } |
| | | |
| | | } |
| | |
| | | Long userId = SecurityUtils.getUserId(); |
| | | mgtMemberServiceRecordPageDto.setUserId(userId); |
| | | Page<MgtMemberServiceRecordPageVo> page = new Page<>(); |
| | | page.setSize(2000); |
| | | if(page.getSize()>5000){ |
| | | page.setSize(5000); |
| | | page.setCurrent(1); |
| | | } |
| | | List<MgtMemberServiceRecordPageVo> list = userServiceRecordService.pageMgtMemberServiceRecord(page,mgtMemberServiceRecordPageDto); |
| | | ExcelUtil<MgtMemberServiceRecordPageVo> util = new ExcelUtil<MgtMemberServiceRecordPageVo>(MgtMemberServiceRecordPageVo.class); |
| | | util.exportExcel(response, list, "用户浏览记录"); |
| | |
| | | Long userId = SecurityUtils.getUserId(); |
| | | mgtMemberOrderPageDto.setUserId(userId); |
| | | Page<MgtMemberOrderPageVo> page = new Page<>(); |
| | | page.setSize(2000); |
| | | if(page.getSize()>5000){ |
| | | page.setSize(5000); |
| | | page.setCurrent(1); |
| | | } |
| | | List<MgtMemberOrderPageVo> mgtMemberOrderPageVoList = orderService.pageMgtMemberOrder(page,mgtMemberOrderPageDto); |
| | | if(!mgtMemberOrderPageVoList.isEmpty()){ |
| | | List<MgtOrderGoodsPageVo> mgtOrderGoodsVoList; |
| | |
| | | return R.ok(mgtOrderTotal); |
| | | } |
| | | |
| | | |
| | | |
| | | @RequestMapping(value = "/pageMgtActivityOrder", method = RequestMethod.POST) |
| | | @ApiOperation(value = "平台获取秒杀订单列表") |
| | | public R<Page<MgtActivityOrderPageVo>> pageMgtActivityOrder(@RequestBody MgtShopOrderPageDto mgtShopOrderPageDto) { |
| | |
| | | Long userId = SecurityUtils.getUserId(); |
| | | mgtShopOrderPageDto.setUserId(userId); |
| | | Page<MgtActivityOrderPageVo> page = new Page<>(); |
| | | page.setSize(2000); |
| | | if(page.getSize()>5000){ |
| | | page.setSize(5000); |
| | | page.setCurrent(1); |
| | | } |
| | | List<MgtActivityOrderPageVo> mgtActivityOrderPageVos = orderService.pageMgtActivityOrder(page,mgtShopOrderPageDto); |
| | | ExcelUtil<MgtActivityOrderPageVo> util = new ExcelUtil<MgtActivityOrderPageVo>(MgtActivityOrderPageVo.class); |
| | | util.exportExcel(response, mgtActivityOrderPageVos, "秒杀订单列表"); |
| | |
| | | Long userId = SecurityUtils.getUserId(); |
| | | mgtShopOrderPageDto.setUserId(userId); |
| | | Page<MgtShopOrderPageVo> page = new Page<>(); |
| | | page.setSize(2000); |
| | | if(page.getSize()>5000){ |
| | | page.setSize(5000); |
| | | page.setCurrent(1); |
| | | } |
| | | List<MgtShopOrderPageVo> shopOrderPageVoList = orderService.pageMgtShopOrder(page,mgtShopOrderPageDto); |
| | | ExcelUtil<MgtShopOrderPageVo> util = new ExcelUtil<MgtShopOrderPageVo>(MgtShopOrderPageVo.class); |
| | | util.exportExcel(response, shopOrderPageVoList, "门店订单列表"); |
| | |
| | | return R.ok(mgtOrderDetail); |
| | | } |
| | | |
| | | @RequestMapping(value = "/getMgtShopAllOrderTotal", method = RequestMethod.POST) |
| | | @ApiOperation(value = "获取商户订单统计") |
| | | public R<MgtShopAllOrderTotal> getMgtShopAllOrderTotal(@RequestBody MgtShopAllOrderPageDto mgtShopAllOrderPageDto) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | mgtShopAllOrderPageDto.setUserId(userId); |
| | | MgtShopAllOrderTotal shopAllOrderTotal = orderService.getMgtShopAllOrderTotal(mgtShopAllOrderPageDto); |
| | | return R.ok(shopAllOrderTotal); |
| | | } |
| | | |
| | | @RequestMapping(value = "/pageMgtShopAllOrder", method = RequestMethod.POST) |
| | | @ApiOperation(value = "平台获取商户订单记录") |
| | | public R<Page<MgtShopAllOrderPageVo>> pageMgtShopAllOrder(@RequestBody MgtShopAllOrderPageDto mgtShopAllOrderPageDto) { |
| | |
| | | import com.ruoyi.system.api.domain.dto.AppBaseGetDto; |
| | | import com.ruoyi.system.api.domain.dto.AppMemberBindingDto; |
| | | import com.ruoyi.system.api.domain.poji.member.Member; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | import com.ruoyi.system.api.service.RemoteConfigService; |
| | | import com.ruoyi.system.api.service.RemoteMemberService; |
| | | import io.swagger.annotations.Api; |
| | |
| | | @RequestMapping(value = "/placeOrder", method = RequestMethod.POST) |
| | | @ApiOperation(value = "创建订单") |
| | | public R<AppPlaceOrderVo> placeOrder(@RequestBody AppPlaceOrderDto appPlaceOrderDto) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | Long userId = loginUser.getUserid(); |
| | | appPlaceOrderDto.setUserId(userId); |
| | | appPlaceOrderDto.setSpbillCreateIp(loginUser.getIpaddr()); |
| | | |
| | | if(userId!=null){ |
| | | Member member = memberService.getMember(userId).getData(); |
| | | appPlaceOrderDto.setUserId(userId); |
| | | if(member!=null&&member.getRelationShopId()!=null){ |
| | | |
| | | if (member != null) { |
| | | appPlaceOrderDto.setOpenid(member.getMiniOpenid()); |
| | | appPlaceOrderDto.setShopId(member.getRelationShopId()); |
| | | } |
| | | if(member.getBindingFlag()!=1){ |
| | | //绑定商户 |
| | | AppMemberBindingDto appMemberBindingDto = new AppMemberBindingDto(); |
| | |
| | | memberService.updateMemberBinding(appMemberBindingDto); |
| | | } |
| | | } |
| | | } |
| | | AppPlaceOrderVo appPlaceOrderVo = orderService.placeOrder(appPlaceOrderDto); |
| | | return R.ok(appPlaceOrderVo); |
| | | } |
| | |
| | | package com.ruoyi.order.controller.miniapp; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.github.binarywang.wxpay.bean.ecommerce.*; |
| | | import com.github.binarywang.wxpay.bean.notify.WxPayNotifyV3Response; |
| | | import com.github.binarywang.wxpay.bean.profitsharingV3.ProfitSharingNotifyData; |
| | | import com.github.binarywang.wxpay.bean.profitsharingV3.ProfitSharingNotifyResult; |
| | | import com.github.binarywang.wxpay.exception.WxPayException; |
| | | import com.github.binarywang.wxpay.service.ProfitSharingV3Service; |
| | | import com.github.binarywang.wxpay.service.WxPayService; |
| | | import com.github.binarywang.wxpay.v3.auth.Verifier; |
| | | import com.github.binarywang.wxpay.v3.util.AesUtils; |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | | import com.ruoyi.order.domain.dto.AppSureOrderDto; |
| | | import com.ruoyi.order.domain.dto.WXPayNotifyDto; |
| | | import com.ruoyi.order.domain.vo.AppSureOrderVo; |
| | | import com.ruoyi.order.domain.vo.ProfitSharingNotifyNewResult; |
| | | import com.ruoyi.order.enums.WxPayNotifyEventTypeEnum; |
| | | import com.ruoyi.order.service.account.BackMessageService; |
| | | import com.ruoyi.order.service.order.OrderService; |
| | | import com.wechat.pay.contrib.apache.httpclient.notification.Notification; |
| | | import com.wechat.pay.contrib.apache.httpclient.notification.NotificationHandler; |
| | | import com.wechat.pay.contrib.apache.httpclient.notification.NotificationRequest; |
| | | import com.wechat.pay.java.core.Config; |
| | | import com.wechat.pay.java.core.RSAAutoCertificateConfig; |
| | | import com.wechat.pay.java.core.RSAConfig; |
| | | import com.wechat.pay.java.core.cipher.PrivacyEncryptor; |
| | | import com.wechat.pay.java.core.notification.NotificationConfig; |
| | | import com.wechat.pay.java.core.notification.NotificationParser; |
| | | import com.wechat.pay.java.core.notification.RequestParam; |
| | | import com.wechat.pay.java.service.partnerpayments.jsapi.model.Transaction; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import net.bytebuddy.asm.Advice; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.BufferedReader; |
| | | import java.io.IOException; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.HashMap; |
| | | import java.security.GeneralSecurityException; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * @program: ruoyi |
| | |
| | | @RestController |
| | | @RequestMapping("/app/notify") |
| | | public class NotifyController extends BaseController { |
| | | /** 商户号 */ |
| | | public static String merchantId = ""; |
| | | /** 商户API私钥路径 */ |
| | | public static String privateKeyPath = ""; |
| | | /** 商户证书序列号 */ |
| | | public static String merchantSerialNumber = ""; |
| | | /** 微信支付平台证书路径 */ |
| | | public static String wechatPayCertificatePath = ""; |
| | | /** 商户APIV3密钥 */ |
| | | public static String apiV3key = "..."; |
| | | |
| | | public static final String WECHAT_PAY_SERIAL = "Wechatpay-Serial"; |
| | | public static final String WECHAT_PAY_SIGNATURE = "Wechatpay-Signature"; |
| | | public static final String WECHAT_PAY_TIMESTAMP = "Wechatpay-Timestamp"; |
| | | public static final String WECHAT_PAY_NONCE = "Wechatpay-Nonce"; |
| | | |
| | | private static final Gson GSON = new GsonBuilder().create(); |
| | | |
| | | @Resource |
| | | private OrderService orderService; |
| | | |
| | | @RequestMapping(value = "/payNotify", method = RequestMethod.POST) |
| | | @ApiOperation(value = "微信支付通知") |
| | | public Map payNotify(HttpServletRequest request, HttpServletResponse response) { |
| | | Config config = |
| | | new RSAConfig.Builder() |
| | | .merchantId(merchantId) |
| | | .privateKeyFromPath(privateKeyPath) |
| | | .merchantSerialNumber(merchantSerialNumber) |
| | | .wechatPayCertificatesFromPath(wechatPayCertificatePath) |
| | | .build(); |
| | | @Autowired |
| | | private WxPayService wxService; |
| | | @Resource |
| | | private BackMessageService backMessageService; |
| | | |
| | | PrivacyEncryptor encryptor = config.createEncryptor(); |
| | | String wechatPayCertificateSerialNumber = encryptor.getWechatpaySerial(); |
| | | @PostMapping(value = "/payNotify") |
| | | @ApiOperation(value = "微信支付/退款通知") |
| | | public String payNotify(@RequestBody String notifyData, HttpServletRequest request, HttpServletResponse response) throws WxPayException { |
| | | |
| | | // 获取请求头 |
| | | SignatureHeader signatureHeader = getSignatureHeader(response); |
| | | |
| | | String nonoc=request.getHeader("Wechatpay-Nonce"); |
| | | String signature=request.getHeader("Wechatpay-Signature"); |
| | | String timestamp=request.getHeader("Wechatpay-Timestamp"); |
| | | String serial=request.getHeader("Wechatpay-Serial"); |
| | | String signatureType=request.getHeader("Wechatpay-Signature-Type"); |
| | | NotifyResponse responseData = GSON.fromJson(notifyData, NotifyResponse.class); |
| | | String eventType = responseData.getEventType(); |
| | | |
| | | String requestBody=""; |
| | | |
| | | try { |
| | | BufferedReader reader = request.getReader(); |
| | | String line = ""; |
| | | StringBuffer inputString = new StringBuffer(); |
| | | while ( (line = reader.readLine()) != null ) { |
| | | inputString.append(line); |
| | | int resultType = 1; |
| | | String resultMessage = ""; |
| | | if(WxPayNotifyEventTypeEnum.TRANSACTION_SUCCESS.getCode().equals(eventType)){ |
| | | PartnerTransactionsNotifyResult notifyResult = wxService.getEcommerceService().parsePartnerNotifyResult(notifyData, signatureHeader); |
| | | PartnerTransactionsResult result = notifyResult.getResult(); |
| | | // 支付通知回调 |
| | | if("SUCCESS".equals(result.getTradeState())){ |
| | | orderService.payBack(result); |
| | | } |
| | | if(inputString!=null && !"".equals(inputString)) { |
| | | requestBody = inputString.toString(); |
| | | resultMessage = GSON.toJson(notifyResult); |
| | | } else if(WxPayNotifyEventTypeEnum.REFUND_SUCCESS.getCode().equals(eventType) |
| | | || WxPayNotifyEventTypeEnum.REFUND_ABNORMAL.getCode().equals(eventType) |
| | | || WxPayNotifyEventTypeEnum.REFUND_CLOSED.getCode().equals(eventType)){ |
| | | |
| | | RefundNotifyResult result = wxService.getEcommerceService().parseRefundNotifyResult(notifyData, signatureHeader); |
| | | orderService.orderRefundBack(result); |
| | | resultType = 2; |
| | | resultMessage = GSON.toJson(result); |
| | | } |
| | | reader.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | // 保存支付/退款回调信息 |
| | | backMessageService.saveBackMessage(resultType, resultMessage); |
| | | |
| | | |
| | | return WxPayNotifyV3Response.success("成功"); |
| | | } |
| | | |
| | | RequestParam requestParam = new RequestParam.Builder() |
| | | .serialNumber(wechatPayCertificateSerialNumber) |
| | | .nonce(nonoc) |
| | | .signature(signature) |
| | | .timestamp(timestamp) |
| | | .body(requestBody) |
| | | .build(); |
| | | @PostMapping(value = "/profitSharingNotify") |
| | | @ApiOperation(value = "微信分账通知") |
| | | public String profitSharingNotify(@RequestBody String notifyData, HttpServletRequest request, HttpServletResponse response) throws WxPayException { |
| | | ProfitSharingV3Service sharingV3Service = wxService.getProfitSharingV3Service(); |
| | | // ProfitSharingNotifyResult |
| | | |
| | | NotificationConfig notifiConfig = new RSAAutoCertificateConfig.Builder() |
| | | .merchantId(merchantId) |
| | | .privateKeyFromPath(privateKeyPath) |
| | | .merchantSerialNumber(merchantSerialNumber) |
| | | .apiV3Key(apiV3key) |
| | | .build(); |
| | | |
| | | NotificationParser parser = new NotificationParser(notifiConfig); |
| | | |
| | | Transaction transaction = parser.parse(requestParam, Transaction.class); |
| | | // 获取请求头 |
| | | SignatureHeader signatureHeader = getSignatureHeader(response); |
| | | |
| | | |
| | | String tradeStateEnum=transaction.getTradeState().toString(); |
| | | if(tradeStateEnum.equals("success")){ |
| | | orderService.payBack(transaction); |
| | | ProfitSharingNotifyNewResult notifyResult = getProfitSharingNotifyData(notifyData, signatureHeader); |
| | | ProfitSharingNotifyResult result = notifyResult.getResult(); |
| | | |
| | | String eventType = notifyResult.getRawData().getEventType(); |
| | | if(WxPayNotifyEventTypeEnum.PROFIT_SHARING_SUCCESS.getCode().equals(eventType)){ |
| | | // 分账通知回调 |
| | | orderService.profitSharingBack(result); |
| | | } |
| | | |
| | | Map map=new HashMap(); |
| | | map.put("code","SUCCESS"); |
| | | map.put("message","成功"); |
| | | String resultMessage = GSON.toJson(notifyResult); |
| | | // 保存记录分账回调信息 |
| | | backMessageService.saveBackMessage(3, resultMessage); |
| | | |
| | | return map; |
| | | return WxPayNotifyV3Response.success("成功"); |
| | | } |
| | | |
| | | @RequestMapping(value = "/shareNotify", method = RequestMethod.POST) |
| | |
| | | return null; |
| | | } |
| | | |
| | | public ProfitSharingNotifyNewResult getProfitSharingNotifyData(String notifyData, SignatureHeader header) throws WxPayException { |
| | | if (Objects.nonNull(header) && !this.verifyNotifySign(header, notifyData)) { |
| | | throw new WxPayException("非法请求,头部信息验证失败"); |
| | | } |
| | | ProfitSharingNotifyData response = GSON.fromJson(notifyData, ProfitSharingNotifyData.class); |
| | | |
| | | ProfitSharingNotifyData.Resource resource = response.getResource(); |
| | | String cipherText = resource.getCipherText(); |
| | | String associatedData = resource.getAssociatedData(); |
| | | String nonce = resource.getNonce(); |
| | | String apiV3Key = this.wxService.getConfig().getApiV3Key(); |
| | | try { |
| | | String result = AesUtils.decryptToString(associatedData, nonce, cipherText, apiV3Key); |
| | | ProfitSharingNotifyResult profitSharingResult = GSON.fromJson(result, ProfitSharingNotifyResult.class); |
| | | |
| | | ProfitSharingNotifyNewResult notifyResult = new ProfitSharingNotifyNewResult(); |
| | | notifyResult.setRawData(response); |
| | | notifyResult.setResult(profitSharingResult); |
| | | return notifyResult; |
| | | } catch (GeneralSecurityException | IOException e) { |
| | | throw new WxPayException("解析报文异常!", e); |
| | | } |
| | | } |
| | | |
| | | private boolean verifyNotifySign(SignatureHeader header, String data) throws WxPayException { |
| | | String beforeSign = String.format("%s\n%s\n%s\n", |
| | | header.getTimeStamp(), |
| | | header.getNonce(), |
| | | data); |
| | | Verifier verifier = this.wxService.getConfig().getVerifier(); |
| | | if (verifier == null) { |
| | | throw new WxPayException("证书检验对象为空"); |
| | | } |
| | | return verifier.verify(header.getSerialNo(), |
| | | beforeSign.getBytes(StandardCharsets.UTF_8), header.getSigned()); |
| | | } |
| | | |
| | | private SignatureHeader getSignatureHeader(HttpServletResponse response){ |
| | | SignatureHeader signatureHeader = new SignatureHeader(); |
| | | signatureHeader.setSerialNo(response.getHeader(WECHAT_PAY_SERIAL)); |
| | | signatureHeader.setSigned(response.getHeader(WECHAT_PAY_SIGNATURE)); |
| | | signatureHeader.setNonce(response.getHeader(WECHAT_PAY_NONCE)); |
| | | signatureHeader.setTimeStamp(response.getHeader(WECHAT_PAY_TIMESTAMP)); |
| | | return signatureHeader; |
| | | } |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "支付备注") |
| | | private String payRemark; |
| | | |
| | | @ApiModelProperty(value = "支付方式1微信2现金3支付宝") |
| | | private Integer payType; |
| | | } |
| | |
| | | @ApiModelProperty(value = "改变金额") |
| | | private BigDecimal changeMoney; |
| | | |
| | | @ApiModelProperty(value = "支付方式") |
| | | @ApiModelProperty(value = "支付方式1微信2现金3支付宝") |
| | | private Integer payType; |
| | | |
| | | @ApiModelProperty(value = "订单备注") |
| | |
| | | |
| | | @ApiModelProperty(value = "实付金额") |
| | | private BigDecimal relPayMoney; |
| | | |
| | | @ApiModelProperty(value = "支付方式1微信2现金3支付宝") |
| | | private Integer payType; |
| | | } |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author jqs34 |
| | | * @ClassName MgtMemberOrderTotalDto |
| | |
| | | public class MgtMemberOrderTotalDto extends MgtBaseDto { |
| | | |
| | | @ApiModelProperty(value = "用户id") |
| | | private Long userId; |
| | | private Long memberUserId; |
| | | |
| | | @ApiModelProperty(value = "搜索关键词") |
| | | private String keyword; |
| | |
| | | @ApiModelProperty(value = "关键词") |
| | | private String keyword; |
| | | |
| | | @ApiModelProperty(value = "订单来源") |
| | | private Integer orderFrom; |
| | | |
| | | @ApiModelProperty(value = "订单状态0.已取消1.待支付2.待核销3.已完成") |
| | | private Integer orderStatus; |
| | | |
| | |
| | | import com.baomidou.mybatisplus.activerecord.Model; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | |
| | | @TableField("del_flag") |
| | | private String delFlag; |
| | | /** |
| | | * 回调类型1支付回调2退款回调 |
| | | * 回调类型 1支付回调 2退款回调 3、分账 |
| | | */ |
| | | @TableField("result_type") |
| | | private Integer resultType; |
| | |
| | | */ |
| | | @TableField("result_message") |
| | | private String resultMessage; |
| | | /** |
| | | * 回调时间 |
| | | */ |
| | | @TableField("create_time") |
| | | private Date createTime; |
| | | |
| | | |
| | | @Override |
| | |
| | | @TableField("shop_id") |
| | | private Long shopId; |
| | | /** |
| | | * 订单二级商户号 |
| | | */ |
| | | @TableField("sub_mch_id") |
| | | private String subMchId; |
| | | |
| | | /** |
| | | * 订单id |
| | | */ |
| | | @TableField("order_id") |
| | |
| | | * 回调时间 |
| | | */ |
| | | @TableField("back_time") |
| | | private Date backTime; |
| | | private String backTime; |
| | | |
| | | /** |
| | | * 微信退款订单id |
| | | */ |
| | | @TableField("wx_refund_id") |
| | | private String wxRefundId; |
| | | |
| | | /** |
| | | * 1、发起退款 2、已退款 |
| | | */ |
| | | @TableField("refund_status") |
| | | private Integer refundStatus; |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | |
| | | * 发起关联id |
| | | */ |
| | | @TableField("send_id") |
| | | private Long sendId; |
| | | private String sendId; |
| | | /** |
| | | * 发送报文 |
| | | */ |
| | |
| | | * 完成时间 |
| | | */ |
| | | @TableField("finish_time") |
| | | private Date finishTime; |
| | | private String finishTime; |
| | | |
| | | /** |
| | | * 微信分账/回退单号 |
| | | */ |
| | | @TableField("wx_order_id") |
| | | private String wxOrderId; |
| | | |
| | | |
| | | /** |
| | | * 分账失败原因 |
| | | 1、ACCOUNT_ABNORMAL : 分账接收账户异常 |
| | |
| | | */ |
| | | @TableField("goods_type") |
| | | private Integer goodsType; |
| | | |
| | | @TableField("goods_tag") |
| | | private String goodsTag; |
| | | /** |
| | | * 商品名称 |
| | | */ |
| | |
| | | @TableField("goods_name") |
| | | private String goodsName; |
| | | |
| | | @TableField("goods_tag") |
| | | private String goodsTag; |
| | | |
| | | @TableField("goods_introduction") |
| | | private String goodsIntroduction; |
| | | |
| | |
| | | package com.ruoyi.order.domain.vo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | |
| | | @ApiModelProperty(value="商品类型1周期2服务3体验4单品") |
| | | private Integer goodsType; |
| | | |
| | | @ApiModelProperty(value="商品标签") |
| | | private String goodsTag; |
| | | |
| | | @ApiModelProperty(value="商品名称") |
| | | private String goodsName; |
| | | |
| | | @ApiModelProperty(value="商品名称") |
| | | private String goodsIntroduction; |
| | | |
| | | @ApiModelProperty(value="商品图片") |
| | | private String goodsPicture; |
| | |
| | | @ApiModelProperty(value="消耗次数") |
| | | private Integer usedNum; |
| | | |
| | | @ApiModelProperty(value="消耗次数") |
| | | private Integer sureNum; |
| | | |
| | | } |
| | |
| | | private String packageStr; |
| | | |
| | | @ApiModelProperty(value = "签名方式") |
| | | private String tradeType; |
| | | private String signType; |
| | | |
| | | @ApiModelProperty(value = "签名") |
| | | private String paySign; |
| | |
| | | @ApiModelProperty(value = "商品简介") |
| | | private String goodsIntroduction; |
| | | |
| | | @ApiModelProperty(value="商品标签") |
| | | private String goodsTag; |
| | | |
| | | @ApiModelProperty(value="商品图片") |
| | | private String goodsPicture; |
| | | |
| | |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author jqs34 |
| | |
| | | @ApiModelProperty(value="应收订金") |
| | | private BigDecimal receivableDeposit; |
| | | |
| | | @ApiModelProperty(value="订单实际支付金额") |
| | | @ApiModelProperty(value="实收金额") |
| | | private BigDecimal receiveMoney; |
| | | |
| | | @ApiModelProperty(value="已收金额") |
| | | private BigDecimal payMoney; |
| | | |
| | | @ApiModelProperty(value="订单未支付金额") |
| | | @ApiModelProperty(value="未收金额") |
| | | private BigDecimal unPaidMoney; |
| | | |
| | | @ApiModelProperty(value="创建时间") |
New file |
| | |
| | | package com.ruoyi.order.domain.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @ClassName MerMemberOrderVo |
| | | * @Description TODO |
| | | * @Author jqs |
| | | * @Date 2023/8/5 16:08 |
| | | * @Version 1.0 |
| | | */ |
| | | @Data |
| | | public class MerMemberOrderVo { |
| | | |
| | | @ApiModelProperty(value = "订单id") |
| | | private String orderId; |
| | | |
| | | @ApiModelProperty(value="订单编号") |
| | | private String orderNo; |
| | | |
| | | @ApiModelProperty(value="订单状态") |
| | | private Integer orderStatus; |
| | | |
| | | @ApiModelProperty(value = "商品总价") |
| | | private BigDecimal orderGoodsMoney; |
| | | |
| | | @ApiModelProperty(value = "优惠券抵扣") |
| | | private BigDecimal couponDiscount; |
| | | |
| | | @ApiModelProperty(value="应付金额") |
| | | private BigDecimal receivableMoney; |
| | | |
| | | @ApiModelProperty(value="应收订金") |
| | | private BigDecimal receivableDeposit; |
| | | |
| | | @ApiModelProperty(value="实收金额") |
| | | private BigDecimal receiveMoney; |
| | | |
| | | @ApiModelProperty(value="已收金额") |
| | | private BigDecimal payMoney; |
| | | |
| | | @ApiModelProperty(value="未收金额") |
| | | private BigDecimal unPaidMoney; |
| | | |
| | | @ApiModelProperty(value="收款时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date receiveMoneyTime; |
| | | |
| | | @ApiModelProperty(value="收款金额") |
| | | private BigDecimal thisReceiveMoney; |
| | | |
| | | @ApiModelProperty(value="收款方式") |
| | | private String thisReceiveType; |
| | | } |
| | |
| | | @ApiModelProperty(value="订单来源") |
| | | private String orderFromDesc; |
| | | |
| | | @ApiModelProperty(value="活动名字") |
| | | private String activityName; |
| | | |
| | | @ApiModelProperty(value="订单商品列表") |
| | | private List<MerOrderGoodsPageVo> merOrderGoodsVoList; |
| | | } |
| | |
| | | @ApiModelProperty(value = "用户电话") |
| | | private String userMobile; |
| | | |
| | | @ApiModelProperty(value="实收金额") |
| | | private BigDecimal realReceiveMoney; |
| | | |
| | | @ApiModelProperty(value="已收金额") |
| | | private BigDecimal receiveMoney; |
| | | |
| | | @ApiModelProperty(value="未收金额") |
| | | private BigDecimal unReceiveMoney; |
| | | |
| | | @ApiModelProperty(value="支付方式1.全款2订金") |
| | | private Integer payType; |
| | | |
| | | @ApiModelProperty(value="结清标记0否1是") |
| | | private Integer closeFlag; |
| | | } |
| | |
| | | @ApiModelProperty(value="应收金额") |
| | | private BigDecimal receivableMoney; |
| | | |
| | | @Excel(name = "订单实际支付金额", width = 30) |
| | | @ApiModelProperty(value="订单实际支付金额") |
| | | private BigDecimal payMoney; |
| | | |
| | | @Excel(name = "订单实收金额", width = 30) |
| | | @ApiModelProperty(value = "实收金额") |
| | | private BigDecimal receiveMoney; |
| | | |
| | | @Excel(name = "订单未支付金额", width = 30) |
| | | @ApiModelProperty(value="订单未支付金额") |
| | | private BigDecimal unPaidMoney; |
| | |
| | | |
| | | @ApiModelProperty(value = "支付总金额") |
| | | private BigDecimal totalPayMoney; |
| | | |
| | | @ApiModelProperty(value = "实收金额") |
| | | private BigDecimal totalReceiveMoney; |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.domain.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @ClassName MgtShopAllOrderTotal |
| | | * @Description TODO |
| | | * @Author jqs |
| | | * @Date 2023/8/4 10:23 |
| | | * @Version 1.0 |
| | | */ |
| | | @Data |
| | | public class MgtShopAllOrderTotal { |
| | | |
| | | @ApiModelProperty(value = "订单总数") |
| | | private Integer orderTotal; |
| | | |
| | | @ApiModelProperty(value = "订单总金额") |
| | | private BigDecimal totalOrderMoney; |
| | | |
| | | @ApiModelProperty(value = "实收金额") |
| | | private BigDecimal totalReceiveMoney; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.domain.vo; |
| | | |
| | | import com.github.binarywang.wxpay.bean.profitsharingV3.ProfitSharingNotifyData; |
| | | import com.github.binarywang.wxpay.bean.profitsharingV3.ProfitSharingNotifyResult; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | @Data |
| | | @NoArgsConstructor |
| | | public class ProfitSharingNotifyNewResult implements Serializable { |
| | | private static final long serialVersionUID = -6602962275015706689L; |
| | | /** |
| | | * 源数据 |
| | | */ |
| | | private ProfitSharingNotifyData rawData; |
| | | |
| | | /** |
| | | * 解密后的数据 |
| | | */ |
| | | private ProfitSharingNotifyResult result; |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.enums; |
| | | |
| | | import com.ruoyi.order.enums.dict.IDict; |
| | | |
| | | public enum RefundStatusEnum implements IDict<Integer> { |
| | | /** |
| | | * 退款状态,枚举值: |
| | | * SUCCESS:退款成功 |
| | | * CLOSE:退款关闭 |
| | | * ABNORMAL:退款异常 |
| | | */ |
| | | SUCCESS(2, "SUCCESS"), |
| | | CLOSE(3, "CLOSE"), |
| | | ABNORMAL(4, "ABNORMAL"); |
| | | |
| | | RefundStatusEnum(Integer code, String text){ |
| | | init(code, text); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.enums; |
| | | |
| | | |
| | | import com.ruoyi.order.enums.dict.IDict; |
| | | |
| | | public enum WxPayNotifyEventTypeEnum implements IDict<String> { |
| | | /** |
| | | * 微信回调通知 |
| | | 支付成功通知的类型为 TRANSACTION.SUCCESS |
| | | 分账 PROFITSHARING.SUCCESS |
| | | */ |
| | | TRANSACTION_SUCCESS("TRANSACTION.SUCCESS", "TRANSACTION.SUCCESS"), |
| | | PROFIT_SHARING_SUCCESS("PROFITSHARING.SUCCESS", "PROFITSHARING.SUCCESS"), |
| | | REFUND_SUCCESS("REFUND.SUCCESS", "REFUND.SUCCESS"), |
| | | REFUND_ABNORMAL("REFUND.ABNORMAL", "REFUND.ABNORMAL"), |
| | | REFUND_CLOSED("REFUND.CLOSED", "REFUND.CLOSED"); |
| | | |
| | | WxPayNotifyEventTypeEnum(String code, String text){ |
| | | init(code, text); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.enums.dict; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 字典bean |
| | | * 只有code和text,可用于展示下拉框 |
| | | * |
| | | * @author luozhan |
| | | */ |
| | | @Data |
| | | public class DictBean<T> implements IDict<T> { |
| | | private final T code; |
| | | private final String text; |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.enums.dict; |
| | | |
| | | import java.lang.reflect.Field; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | | |
| | | |
| | | /** |
| | | * 字典接口 |
| | | * <p> |
| | | * 自定义的字典枚举类实现本接口后可省略属性code和text,以及对应的get方法 |
| | | * 在构造方法中只需调用init方法即可初始化 |
| | | * |
| | | * @author luozhan |
| | | * @date 2021-12 |
| | | */ |
| | | public interface IDict<T> { |
| | | /** |
| | | * 通过code获取value |
| | | * |
| | | * @param clazz 枚举class |
| | | * @param code code |
| | | * @return text |
| | | */ |
| | | static <T> String getTextByCode(Class<? extends IDict<T>> clazz, T code) { |
| | | return Stream.of(clazz.getEnumConstants()) |
| | | .filter((IDict<T> e) -> e.getCode().equals(code)) |
| | | .map(IDict::getText) |
| | | .findAny().orElse(""); |
| | | } |
| | | |
| | | /** |
| | | * 通过text获取code |
| | | * |
| | | * @param clazz 枚举class |
| | | * @param text text |
| | | * @return code |
| | | */ |
| | | static <T> T getCodeByText(Class<? extends IDict<T>> clazz, String text) { |
| | | return Stream.of(clazz.getEnumConstants()) |
| | | .filter((IDict<T> e) -> e.getText().equals(text)) |
| | | .map(IDict::getCode) |
| | | .findAny().orElse(null); |
| | | } |
| | | |
| | | /** |
| | | * 通过code获取字典枚举实例 |
| | | * |
| | | * @param clazz 枚举class |
| | | * @param code code |
| | | * @param <T> 字典code类型 |
| | | * @param <R> 枚举类型 |
| | | * @return 字典枚举实例 |
| | | */ |
| | | @SuppressWarnings("unchecked") |
| | | static <T, R extends IDict<T>> R getByCode(Class<? extends IDict<T>> clazz, T code) { |
| | | return Stream.of(clazz.getEnumConstants()) |
| | | .filter((IDict<T> e) -> (e.getCode().equals(code))) |
| | | .map(v -> (R) v) |
| | | .findAny() |
| | | .orElse(null); |
| | | } |
| | | |
| | | /** |
| | | * 获取给定的字典枚举项(常用下拉框数据请求) |
| | | * |
| | | * @param enums 可指定需要哪些项 |
| | | * @return List |
| | | */ |
| | | @SafeVarargs |
| | | static <T, E extends IDict<T>> List<IDict<T>> getItems(E... enums) { |
| | | return Stream.of(enums) |
| | | .map(DictPool::getDict) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | /** |
| | | * 获取所有字典枚举项,除开指定的枚举 |
| | | * |
| | | * @param exclude 指定排除的枚举 |
| | | * @return List |
| | | */ |
| | | @SafeVarargs |
| | | @SuppressWarnings("unchecked") |
| | | static <T, E extends IDict<T>> List<IDict<T>> getItemsExclude(E... exclude) { |
| | | Class<IDict<T>> clazz = (Class<IDict<T>>) exclude.getClass().getComponentType(); |
| | | IDict<T>[] allEnum = clazz.getEnumConstants(); |
| | | List<IDict<T>> excludeList = Arrays.asList(exclude); |
| | | return Stream.of(allEnum) |
| | | .filter(e -> !excludeList.contains(e)) |
| | | .map(DictPool::getDict) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | /** |
| | | * 获取所有字典枚举项(常用下拉框数据请求) |
| | | * 枚举值上标记@Deprecated的不会返回 |
| | | * |
| | | * @param clazz 字典枚举类 |
| | | * @return List |
| | | */ |
| | | static <T> List<IDict<T>> getAll(Class<? extends IDict<T>> clazz) { |
| | | Map<String, Field> fieldCache = Arrays.stream(clazz.getDeclaredFields()). |
| | | filter(Field::isEnumConstant). |
| | | collect(Collectors.toMap(Field::getName, Function.identity())); |
| | | IDict<T>[] allEnum = clazz.getEnumConstants(); |
| | | return Stream.of(allEnum) |
| | | .filter(e -> !fieldCache.get(((Enum<?>) e).name()).isAnnotationPresent(Deprecated.class)) |
| | | .map(DictPool::getDict) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | /** |
| | | * 初始化 |
| | | * |
| | | * @param code 字典编码 |
| | | * @param text 字典文本 |
| | | */ |
| | | default void init(T code, String text) { |
| | | DictPool.putDict(this, code, text); |
| | | } |
| | | |
| | | /** |
| | | * 获取编码 |
| | | * |
| | | * @return 编码 |
| | | */ |
| | | default T getCode() { |
| | | return DictPool.getDict(this).getCode(); |
| | | } |
| | | |
| | | /** |
| | | * 获取文本 |
| | | * |
| | | * @return 文本 |
| | | */ |
| | | default String getText() { |
| | | return DictPool.getDict(this).getText(); |
| | | } |
| | | |
| | | |
| | | @SuppressWarnings("all") |
| | | class DictPool { |
| | | private static final Map<IDict, DictBean> DICT_MAP = new ConcurrentHashMap<>(); |
| | | |
| | | private static final Map<String, Class<? extends IDict>> DICT_NAME_CLASS_MAP = new ConcurrentHashMap<>(); |
| | | |
| | | static <T> void putDict(IDict<T> dict, T code, String text) { |
| | | DICT_NAME_CLASS_MAP.put(dict.getClass().getName(), dict.getClass()); |
| | | DICT_MAP.put(dict, new DictBean<>(code, text)); |
| | | } |
| | | |
| | | public static List<IDict<Object>> getDict(String dictName) { |
| | | Class<? extends IDict> aClass = DICT_NAME_CLASS_MAP.get(dictName); |
| | | return IDict.getAll((Class<? extends IDict<Object>>) aClass); |
| | | } |
| | | |
| | | static <K extends IDict<T>, T> DictBean<T> getDict(K dict) { |
| | | return DICT_MAP.get(dict); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { |
| | | HttpServletRequest request = (HttpServletRequest) servletRequest; |
| | | HttpServletResponse response = (HttpServletResponse) servletResponse; |
| | | |
| | | String requestUrl = request.getRequestURI(); |
| | | String requestUrlUpperCase = requestUrl.toUpperCase(); |
| | | if(requestUrlUpperCase.contains("EXPORT") |
| | | ||requestUrlUpperCase.contains("IMPORTTEMPLATE") |
| | | ){ |
| | | filterChain.doFilter(request, response); |
| | | return; |
| | | } |
| | | RepeatedlyRequestWrapper wrapper = new RepeatedlyRequestWrapper(request, response); |
| | | getRequestParams(wrapper); |
| | | |
| | |
| | | |
| | | // 返回的结果 |
| | | String content = responseWrapper.getTextContent(); |
| | | String requestUrl = request.getRequestURI(); |
| | | log.info("-------------------- Response Data ----------------------"); |
| | | log.info(requestUrl + " -> " + content); |
| | | |
| | |
| | | * @param |
| | | * @return MgtOrderTotal |
| | | */ |
| | | MgtOrderTotal totalOrderFirst(); |
| | | MgtOrderTotal totalOrderFirst(@Param("param")MgtShopOrderPageDto mgtShopOrderPageDto); |
| | | |
| | | /** |
| | | * @description 统计门店订单总数 |
| | |
| | | * @date 2023/6/18 17:20 |
| | | */ |
| | | MgtBulletinBoardVo boardOrderTotal(); |
| | | |
| | | /** |
| | | * @description 活动人数统计 |
| | | * @author jqs |
| | | * @date 2023/8/3 21:12 |
| | | * @param |
| | | * @return Integer |
| | | */ |
| | | Integer activityUserTotal(); |
| | | |
| | | /** |
| | | * @description getTotalOrderTotalOrderFrom |
| | |
| | | * @description 商户端订单管理统计 |
| | | * @author jqs |
| | | * @date 2023/7/4 16:27 |
| | | * @param shopId |
| | | * @param merOrderPageDto |
| | | * @return MerTotalOrderVo |
| | | */ |
| | | MerTotalOrderVo totalMerOrder(@Param("param")MerOrderPageDto merOrderPageDto); |
| | |
| | | * @return Integer |
| | | */ |
| | | Integer countUserBuyGoodsNum(@Param("userId")Long userId, @Param("goodsId")String goodsId); |
| | | |
| | | |
| | | /** |
| | | * @description 获取商户订单统计 |
| | | * @author jqs |
| | | * @date 2023/8/4 10:25 |
| | | * @param mgtShopAllOrderPageDto |
| | | * @return MgtShopAllOrderTotal |
| | | */ |
| | | MgtShopAllOrderTotal getMgtShopAllOrderTotal(@Param("param")MgtShopAllOrderPageDto mgtShopAllOrderPageDto); |
| | | |
| | | |
| | | /** |
| | | * 分页获取消费记录 |
| | | * @param merOrderPageDto |
| | | * @return |
| | | */ |
| | | List<MerOrderPageVo> pageMerMemberPayOrder(Page page,@Param("param") MerMemberNoClearOrderDto merOrderPageDto); |
| | | } |
| | |
| | | */ |
| | | public interface BackMessageService extends IService<BackMessage> { |
| | | |
| | | /** |
| | | * 保存回调记录 |
| | | * @param resultType |
| | | * @param resultMessage |
| | | */ |
| | | void saveBackMessage(int resultType, String resultMessage); |
| | | } |
| | |
| | | import com.ruoyi.order.domain.pojo.account.OrderPayment; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * <p> |
| | | * 订单支付 服务类 |
| | |
| | | */ |
| | | public interface OrderPaymentService extends IService<OrderPayment> { |
| | | |
| | | /** |
| | | * 保存支付记录 |
| | | * @param userId |
| | | * @param shopId |
| | | * @param orderId |
| | | * @param payMoney |
| | | * @param endTime |
| | | * @param profitSharing |
| | | * @param openid |
| | | * @param goodsNames |
| | | * @param prepayId |
| | | */ |
| | | void saveOrderPayment(Long userId, Long shopId, String subMchId, String orderId, BigDecimal payMoney, Date endTime, String profitSharing, String openid, String goodsNames, String prepayId); |
| | | |
| | | /** |
| | | * |
| | | * @param orderId |
| | | * @return |
| | | */ |
| | | OrderPayment getByOrderId(String orderId); |
| | | } |
| | |
| | | */ |
| | | public interface PaymentMessageService extends IService<PaymentMessage> { |
| | | |
| | | /** |
| | | * 保存请求信息 |
| | | * @param sendType |
| | | * @param sendId |
| | | * @param sendMessage |
| | | * @param resultMessage |
| | | */ |
| | | void savePaymentMessage(String sendType, String sendId, String sendMessage, String resultMessage); |
| | | } |
| | |
| | | package com.ruoyi.order.service.account; |
| | | |
| | | import com.github.binarywang.wxpay.bean.ecommerce.ProfitSharingResult; |
| | | import com.ruoyi.order.domain.pojo.account.ProfitSharing; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface ProfitSharingService extends IService<ProfitSharing> { |
| | | |
| | | /** |
| | | * 创建按分账记录 |
| | | * @param shopId |
| | | * @param orderId |
| | | * @param orderMoney |
| | | * @param result |
| | | */ |
| | | void saveProfitSharing(Long shopId, String orderId, BigDecimal orderMoney, ProfitSharingResult result); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * <p> |
| | | * 回调报文 服务实现类 |
| | |
| | | @Service |
| | | public class BackMessageServiceImpl extends ServiceImpl<BackMessageMapper, BackMessage> implements BackMessageService { |
| | | |
| | | @Override |
| | | public void saveBackMessage(int resultType, String resultMessage) { |
| | | BackMessage backMessage = new BackMessage(); |
| | | backMessage.setDelFlag("0"); |
| | | backMessage.setResultType(resultType); |
| | | backMessage.setResultMessage(resultMessage); |
| | | backMessage.setCreateTime(new Date()); |
| | | this.saveOrUpdate(backMessage); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.order.service.impl.account; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.core.utils.uuid.IdUtils; |
| | | import com.ruoyi.order.domain.pojo.account.OrderPayment; |
| | | import com.ruoyi.order.mapper.account.OrderPaymentMapper; |
| | | import com.ruoyi.order.service.account.OrderPaymentService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class OrderPaymentServiceImpl extends ServiceImpl<OrderPaymentMapper, OrderPayment> implements OrderPaymentService { |
| | | |
| | | @Override |
| | | public void saveOrderPayment(Long userId, Long shopId, String subMchId, String orderId, BigDecimal payMoney, Date endTime, |
| | | String profitSharing, String openid, String goodsNames, String prepayId) { |
| | | OrderPayment payment = new OrderPayment(); |
| | | payment.setPaymentId(IdUtils.simpleUUID()); |
| | | payment.setUserId(userId); |
| | | payment.setShopId(shopId); |
| | | payment.setOrderId(orderId); |
| | | payment.setPayMoney(payMoney); |
| | | payment.setTimeExpire(endTime); |
| | | payment.setSubMchId(subMchId); |
| | | // 0 否 1、是 |
| | | payment.setProfitSharing("Y".equals(profitSharing) ? 1 : 0); |
| | | payment.setUserOpenId(openid); |
| | | payment.setGoodsNames(goodsNames); |
| | | payment.setPrepayId(prepayId); |
| | | payment.setCreateTime(new Date()); |
| | | payment.setDelFlag(0); |
| | | this.saveOrUpdate(payment); |
| | | } |
| | | |
| | | @Override |
| | | public OrderPayment getByOrderId(String orderId) { |
| | | LambdaQueryWrapper<OrderPayment> queryWrapper = Wrappers.lambdaQuery(); |
| | | queryWrapper.eq(OrderPayment::getOrderId, orderId) |
| | | .eq(OrderPayment::getDelFlag, 0) |
| | | .eq(OrderPayment::getPayStatus, 2) |
| | | .last(" limit 1 "); |
| | | return this.getOne(queryWrapper); |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * <p> |
| | | * 支付报文 服务实现类 |
| | |
| | | @Service |
| | | public class PaymentMessageServiceImpl extends ServiceImpl<PaymentMessageMapper, PaymentMessage> implements PaymentMessageService { |
| | | |
| | | @Override |
| | | public void savePaymentMessage(String sendType, String sendId, String sendMessage, String resultMessage) { |
| | | PaymentMessage paymentMessage = new PaymentMessage(); |
| | | paymentMessage.setDelFlag("0"); |
| | | paymentMessage.setSendType(sendType); |
| | | paymentMessage.setSendId(sendId); |
| | | paymentMessage.setSendMessage(sendMessage); |
| | | paymentMessage.setResultMessage(resultMessage); |
| | | paymentMessage.setCreateTime(new Date()); |
| | | this.saveOrUpdate(paymentMessage); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.order.service.impl.account; |
| | | |
| | | import com.github.binarywang.wxpay.bean.ecommerce.ProfitSharingResult; |
| | | import com.ruoyi.common.core.utils.uuid.IdUtils; |
| | | import com.ruoyi.order.domain.pojo.account.ProfitSharing; |
| | | import com.ruoyi.order.mapper.account.ProfitSharingMapper; |
| | | import com.ruoyi.order.service.account.ProfitSharingService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class ProfitSharingServiceImpl extends ServiceImpl<ProfitSharingMapper, ProfitSharing> implements ProfitSharingService { |
| | | |
| | | @Override |
| | | public void saveProfitSharing(Long shopId, String orderId, BigDecimal orderMoney, ProfitSharingResult result) { |
| | | ProfitSharing profitSharing = new ProfitSharing(); |
| | | profitSharing.setShareId(result.getOutOrderNo()); |
| | | profitSharing.setDelFlag(0); |
| | | profitSharing.setShareStatus("FINISHED".equals(result.getStatus()) ? 2 : 1); |
| | | profitSharing.setShopId(shopId); |
| | | profitSharing.setOrderId(orderId); |
| | | profitSharing.setOrderMoney(orderMoney); |
| | | |
| | | List<ProfitSharingResult.Receiver> receivers = result.getReceivers(); |
| | | if(null != receivers && !receivers.isEmpty()){ |
| | | ProfitSharingResult.Receiver receiver = receivers.get(0); |
| | | profitSharing.setReceiverAccount(receiver.getReceiverMchid()); |
| | | BigDecimal receiverAmount = new BigDecimal(receiver.getAmount()); |
| | | receiverAmount = receiverAmount.divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP); |
| | | profitSharing.setReceiverAmount(receiverAmount); |
| | | profitSharing.setSurpMoney(orderMoney.subtract(receiverAmount)); |
| | | profitSharing.setReceiverDescription(receiver.getDescription()); |
| | | profitSharing.setFinishFlag(0); |
| | | profitSharing.setFailReason(receiver.getFailReason()); |
| | | profitSharing.setDetailId(receiver.getDetailId()); |
| | | } |
| | | profitSharing.setCreateTime(new Date()); |
| | | |
| | | this.saveOrUpdate(profitSharing); |
| | | } |
| | | } |
| | |
| | | consumerGoods.setUsedNum(0); |
| | | consumerGoods.setCreateTime(new Date()); |
| | | consumerGoods.setGoodsType(goods.getGoodsType()); |
| | | consumerGoods.setGoodsTag(goods.getGoodsTags()); |
| | | consumerGoods.setGoodsIntroduction(goods.getGoodsIntroduction()); |
| | | consumerGoods.setGoodsPicture(goodsFile.getFileUrl()); |
| | | consumerGoods.setGoodsNurses(goods.getGoodsNurses()); |
| | |
| | | consumerGoods.setUsedNum(0); |
| | | consumerGoods.setCreateTime(new Date()); |
| | | consumerGoods.setGoodsType(goods.getGoodsType()); |
| | | consumerGoods.setGoodsTag(goods.getGoodsTags()); |
| | | consumerGoods.setGoodsIntroduction(goods.getGoodsIntroduction()); |
| | | consumerGoods.setGoodsPicture(goodsFile.getFileUrl()); |
| | | consumerGoods.setGoodsNurses(goods.getGoodsNurses()); |
| | |
| | | package com.ruoyi.order.service.impl.order; |
| | | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.github.binarywang.wxpay.bean.ecommerce.*; |
| | | import com.github.binarywang.wxpay.bean.ecommerce.ProfitSharingRequest.Receiver; |
| | | import com.github.binarywang.wxpay.bean.ecommerce.enums.TradeTypeEnum; |
| | | import com.github.binarywang.wxpay.bean.profitsharingV3.ProfitSharingNotifyResult; |
| | | import com.github.binarywang.wxpay.config.WxPayConfig; |
| | | import com.github.binarywang.wxpay.exception.WxPayException; |
| | | import com.github.binarywang.wxpay.service.WxPayService; |
| | | import com.google.common.base.Joiner; |
| | | import com.google.gson.Gson; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.utils.DateUtils; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.common.security.utils.CodeFactoryUtil; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.order.config.WxPayConfiguration; |
| | | import com.ruoyi.order.domain.dto.*; |
| | | import com.ruoyi.order.domain.pojo.account.OrderPayment; |
| | | import com.ruoyi.order.domain.pojo.account.OrderRefund; |
| | | import com.ruoyi.order.domain.pojo.account.ProfitSharing; |
| | | import com.ruoyi.order.domain.pojo.order.ConsumerGoods; |
| | | import com.ruoyi.order.domain.pojo.order.Order; |
| | | import com.ruoyi.order.domain.pojo.order.OrderGoods; |
| | | import com.ruoyi.order.domain.pojo.order.PayRecord; |
| | | import com.ruoyi.order.domain.vo.*; |
| | | import com.ruoyi.order.enums.RefundStatusEnum; |
| | | import com.ruoyi.order.enums.dict.IDict; |
| | | import com.ruoyi.order.mapper.order.OrderMapper; |
| | | import com.ruoyi.order.service.account.OrderPaymentService; |
| | | import com.ruoyi.order.service.account.OrderRefundService; |
| | | import com.ruoyi.order.service.account.PaymentMessageService; |
| | | import com.ruoyi.order.service.account.ProfitSharingService; |
| | | import com.ruoyi.order.service.order.*; |
| | | import com.ruoyi.system.api.constant.AppErrorConstant; |
| | | import com.ruoyi.system.api.constant.DelayTaskEnum; |
| | |
| | | import com.ruoyi.system.api.domain.poji.member.MemberCoupon; |
| | | import com.ruoyi.system.api.domain.poji.member.MemberGiftRecord; |
| | | import com.ruoyi.system.api.domain.poji.shop.Shop; |
| | | import com.ruoyi.system.api.domain.poji.shop.ShopProportionVo; |
| | | import com.ruoyi.system.api.domain.poji.sys.SysUser; |
| | | import com.ruoyi.system.api.domain.vo.*; |
| | | import com.ruoyi.system.api.service.*; |
| | | import com.wechat.pay.java.service.partnerpayments.jsapi.model.Transaction; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.redisson.api.RLock; |
| | | import org.redisson.api.RedissonClient; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.time.LocalDate; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | |
| | | * @since 2023-04-25 |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements OrderService { |
| | | |
| | | @Resource |
| | |
| | | @Autowired |
| | | private RedissonClient redissonClient; |
| | | |
| | | /** 商户号 */ |
| | | public static String merchantId = ""; |
| | | /** 商户API私钥路径 */ |
| | | public static String privateKeyPath = ""; |
| | | /** 商户证书序列号 */ |
| | | public static String merchantSerialNumber = ""; |
| | | /** 微信支付平台证书路径 */ |
| | | public static String wechatPayCertificatePath = ""; |
| | | /** 微信支付 APIv3 密钥 */ |
| | | public static String apiV3Key = ""; |
| | | /** 微信支付APPID */ |
| | | public static String appId=""; |
| | | /** 微信支付商户ID */ |
| | | public static String mchId=""; |
| | | /** 通知地址 */ |
| | | public static String notifyUrl=""; |
| | | @Autowired |
| | | private WxPayService wxService; |
| | | |
| | | @Resource |
| | | private PaymentMessageService paymentMessageService; |
| | | |
| | | @Resource |
| | | private OrderPaymentService orderPaymentService; |
| | | |
| | | @Resource |
| | | private ProfitSharingService profitSharingService; |
| | | |
| | | @Resource |
| | | private OrderRefundService orderRefundService; |
| | | |
| | | /** |
| | | * @description: buyGoods |
| | |
| | | Integer serviceNum; |
| | | Integer goodsNum = 0; |
| | | String memberCouponId; |
| | | Goods goods; |
| | | Goods goods = null; |
| | | GoodsFile goodsFile; |
| | | BigDecimal goodsPrice; |
| | | BigDecimal goodsTotalPrice; |
| | |
| | | HashSet<String> goodsTypeSet = new HashSet<>(); |
| | | //使用优惠券 |
| | | StringJoiner memberCouponSJ = new StringJoiner(","); |
| | | List<String> goodsNameList = new ArrayList<>(); |
| | | // 遍历购买的商品列表 |
| | | for (AppBuyGoodsDto appBuyGoodsDto : appBuyGoodsDtoList) { |
| | | appSureOrderGoodsVo = new AppSureOrderGoodsVo(); |
| | |
| | | memberCouponId = appBuyGoodsDto.getMemberCouponId(); |
| | | // 获取商品信息 |
| | | goods = goodsMap.get(goodsId); |
| | | goodsNameList.add(goods.getGoodsName()); |
| | | // 设置商品信息 |
| | | appSureOrderGoodsVo.setGoodsId(goodsId); |
| | | appSureOrderGoodsVo.setGoodsName(goods.getGoodsName()); |
| | |
| | | orderGoods.setServiceNum(serviceNum); |
| | | orderGoods.setGoodsType(goods.getGoodsType()); |
| | | orderGoods.setGoodsName(goods.getGoodsName()); |
| | | orderGoods.setGoodsTag(goods.getGoodsTags()); |
| | | orderGoods.setGoodsIntroduction(goods.getGoodsIntroduction()); |
| | | orderGoods.setGoodsPicture(goodsFile.getFileUrl()); |
| | | // 保存订单商品 |
| | |
| | | } |
| | | appPlaceOrderVo.setOrderId(orderId); |
| | | appPlaceOrderVo.setOrderNo(orderNo); |
| | | // 调用支付 |
| | | /* CombineTransactionsJsRequest request=new CombineTransactionsJsRequest(); |
| | | request.setCombineAppid(); |
| | | request.setCombineMchid(); |
| | | profitsSharingService.combineTransactions(request);*/ |
| | | |
| | | //构建预下单支付对象 |
| | | /*PrepayRequest request = new PrepayRequest(); |
| | | Amount amount = new Amount(); |
| | | amount.setTotal(Integer.parseInt(order.getPayMoney().multiply(new BigDecimal(100)).toString())); |
| | | request.setAmount(amount); |
| | | request.setAppid(this.appId); |
| | | request.setMchid(this.mchId); |
| | | request.setDescription(order.getGoodsInfo()); |
| | | request.setNotifyUrl(this.notifyUrl); |
| | | request.setOutTradeNo(order.getOrderId()); |
| | | Payer payer = new Payer(); |
| | | payer.setOpenid("oLTPCuN5a-nBD4rAL_fa********"); |
| | | request.setPayer(payer);*/ |
| | | //返回前端唤醒支付结果信息 |
| | | /*PrepayWithRequestPaymentResponse res = this.getJsApIResponse(request); |
| | | appPlaceOrderVo.setAppId(this.appId); |
| | | appPlaceOrderVo.setTimeStamp(res.getTimeStamp()); |
| | | appPlaceOrderVo.setNonceStr(res.getNonceStr()); |
| | | appPlaceOrderVo.setPackageStr(res.getPackageVal()); |
| | | appPlaceOrderVo.setTradeType(res.getSignType()); |
| | | appPlaceOrderVo.setPaySign(res.getPaySign());*/ |
| | | String goodsName = ""; |
| | | if (null != goods) { |
| | | goodsName = goods.getGoodsName(); |
| | | } |
| | | |
| | | // 小程序微信下单支付 |
| | | createWxPayInfo(appPlaceOrderVo, userId, order.getShopId(), goodsName, orderNo, |
| | | orderId, order.getPayMoney(), appPlaceOrderDto.getOpenid(), |
| | | appPlaceOrderDto.getSpbillCreateIp(), goodsNameList); |
| | | |
| | | |
| | | //减去优惠券 |
| | | if(memberCouponSJ!=null&&StringUtils.isNotBlank(memberCouponSJ.toString())){ |
| | | if (StringUtils.isNotBlank(memberCouponSJ.toString())) { |
| | | remoteCouponService.useMemberCoupon(memberCouponSJ.toString()); |
| | | } |
| | | //生成自动取消订单延时任务 |
| | |
| | | delayTask.setRedisKey(DelayTaskEnum.ORDER_AUTOMATIC_CANCEL.getCode() + "-" + orderId); |
| | | remoteConfigService.addDelayTask(delayTask); |
| | | appPlaceOrderVo.setEndTime(DateUtils.addMinutes(order.getCreateTime(),delayTime)); |
| | | |
| | | return appPlaceOrderVo; |
| | | } |
| | | |
| | | /** |
| | | * 小程序支付下单API |
| | | * @param appPlaceOrderVo |
| | | * @param userId |
| | | * @param shopId |
| | | * @param goodsName |
| | | * @param orderNo |
| | | * @param orderId |
| | | * @param payMoney |
| | | * @param openid |
| | | * @param payerClientIp |
| | | * @param goodsNameList |
| | | */ |
| | | private void createWxPayInfo(AppPlaceOrderVo appPlaceOrderVo, Long userId, Long shopId, |
| | | String goodsName, String orderNo, |
| | | String orderId, BigDecimal payMoney, |
| | | String openid, String payerClientIp, List<String> goodsNameList){ |
| | | try { |
| | | // 创建支付订单 |
| | | R<String> resultMch = remoteShopService.getShopSubMchId(shopId); |
| | | String subMchId = resultMch.getData(); |
| | | if (StringUtils.isEmpty(subMchId)) { |
| | | throw new ServiceException("获取微信商户号失败"); |
| | | } |
| | | WxPayConfig config = wxService.getConfig(); |
| | | config.setSubMchId(subMchId); |
| | | |
| | | PartnerTransactionsRequest request = new PartnerTransactionsRequest(); |
| | | request.setSpAppid(config.getAppId()); |
| | | request.setSpMchid(config.getMchId()); |
| | | request.setSubMchid(config.getSubMchId()); |
| | | // 商品描述 body |
| | | String description = goodsName + "-商品购买"; |
| | | |
| | | request.setDescription(description); |
| | | request.setOutTradeNo(orderNo); |
| | | request.setNotifyUrl(config.getNotifyUrl()); |
| | | // 结算信息 |
| | | PartnerTransactionsRequest.SettleInfo settleInfo = new PartnerTransactionsRequest.SettleInfo(); |
| | | settleInfo.setProfitSharing(true); |
| | | settleInfo.setSubsidyAmount(BigDecimal.ZERO); |
| | | request.setSettleInfo(settleInfo); |
| | | |
| | | // 订单总金额 |
| | | Integer totalFee = payMoney.multiply(new BigDecimal(100)).intValue(); |
| | | PartnerTransactionsRequest.Amount amount = new PartnerTransactionsRequest.Amount(); |
| | | amount.setTotal(totalFee); |
| | | amount.setCurrency("CNY"); |
| | | request.setAmount(amount); |
| | | |
| | | // 支付者 |
| | | PartnerTransactionsRequest.Payer payer = new PartnerTransactionsRequest.Payer(); |
| | | payer.setSpOpenid(openid); |
| | | request.setPayer(payer); |
| | | |
| | | // 场景信息 |
| | | PartnerTransactionsRequest.SceneInfo sceneInfo = new PartnerTransactionsRequest.SceneInfo(); |
| | | sceneInfo.setPayerClientIp(payerClientIp); |
| | | request.setSceneInfo(sceneInfo); |
| | | |
| | | TransactionsResult.JsapiResult result = wxService.getEcommerceService().partnerTransactions(TradeTypeEnum.JSAPI, request); |
| | | |
| | | // 请求参数 |
| | | Gson gson = new Gson(); |
| | | String payRequestJson = gson.toJson(request); |
| | | // 返回参数 |
| | | String payResponseJson = gson.toJson(result); |
| | | |
| | | // 支付相关信息返回 |
| | | appPlaceOrderVo.setAppId(result.getAppId()); |
| | | appPlaceOrderVo.setMchId(config.getMchId()); |
| | | appPlaceOrderVo.setTimeStamp(result.getTimeStamp()); |
| | | appPlaceOrderVo.setNonceStr(result.getNonceStr()); |
| | | appPlaceOrderVo.setPackageStr(result.getPackageValue()); |
| | | appPlaceOrderVo.setSignType(result.getSignType()); |
| | | appPlaceOrderVo.setPaySign(result.getPaySign()); |
| | | appPlaceOrderVo.setPrepayId(result.getPackageValue()); |
| | | |
| | | // 保存支付订单统一下单日志 |
| | | paymentMessageService.savePaymentMessage("1", orderId, payRequestJson, payResponseJson); |
| | | |
| | | // 保存支付订单统一下单支付记录 |
| | | orderPaymentService.saveOrderPayment(userId, shopId, subMchId, orderId, payMoney, |
| | | appPlaceOrderVo.getEndTime(), "Y", openid, |
| | | Joiner.on(";").join(goodsNameList), result.getPackageValue()); |
| | | } catch (WxPayException e) { |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | orderGoods.setCycleNumFlag(goods.getCycleNumFlag()); |
| | | orderGoods.setServiceNum(serviceNum); |
| | | orderGoods.setGoodsType(goods.getGoodsType()); |
| | | orderGoods.setGoodsTag(goods.getGoodsTags()); |
| | | orderGoods.setGoodsName(goods.getGoodsName()); |
| | | orderGoods.setGoodsIntroduction(goods.getGoodsIntroduction()); |
| | | orderGoods.setGoodsPicture(goodsFile.getFileUrl()); |
| | |
| | | @Override |
| | | public void cancelOrder(String orderId) { |
| | | Order order = this.getById(orderId); |
| | | // 订单状态-1.删除 0.已取消 1.待支付 2.待核销 3.已完成 |
| | | if (order.getOrderStatus() == 0) { |
| | | throw new ServiceException(AppErrorConstant.CANCEL_CANCEL_ORDER); |
| | | }else if (order.getOrderStatus() == 1) { |
| | | this.autoCancelOrder(orderId); |
| | | }else if(order.getOrderStatus() == 2){ |
| | | // 2.待核销 -> 订单退款 |
| | | this.refundOrder(orderId); |
| | | }else{ |
| | | throw new ServiceException(AppErrorConstant.CANCEL_ERROR_ORDER); |
| | |
| | | merVerifyOrderVo.setPayTime(order.getPayTime()); |
| | | merVerifyOrderVo.setUseTime(order.getUseTime()); |
| | | merVerifyOrderVo.setAppUserOrderGoodsPageVoList(appUserOrderGoodsPageVoList); |
| | | merVerifyOrderVo.setPayType(order.getPayType()); |
| | | merVerifyOrderVo.setRealReceiveMoney(order.getChangeReceivableMoney()); |
| | | if(order.getPayType()==1){ |
| | | merVerifyOrderVo.setReceiveMoney(order.getPayMoney()); |
| | | }else{ |
| | | if(order.getOfflinePayMoney()!=null){ |
| | | merVerifyOrderVo.setReceiveMoney(order.getOfflinePayMoney()); |
| | | }else{ |
| | | merVerifyOrderVo.setReceiveMoney(BigDecimal.ZERO); |
| | | } |
| | | } |
| | | merVerifyOrderVo.setUnReceiveMoney(merVerifyOrderVo.getRealReceiveMoney().subtract(order.getReceivableMoney())); |
| | | // 根据订单用户ID获取用户信息 |
| | | Member member = remoteMemberService.getMember(order.getUserId()).getData(); |
| | | merVerifyOrderVo.setUserId(order.getUserId()); |
| | |
| | | consumerGoods.setServiceNum(appUserOrderGoodsPageVo.getServiceNum()); |
| | | consumerGoods.setUsedNum(0); |
| | | consumerGoods.setGoodsType(appUserOrderGoodsPageVo.getGoodsType()); |
| | | consumerGoods.setGoodsTag(appUserOrderGoodsPageVo.getGoodsTag()); |
| | | consumerGoods.setCreateTime(nowTime); |
| | | consumerGoods.setGoodsIntroduction(goods.getGoodsIntroduction()); |
| | | consumerGoods.setGoodsPicture(appUserOrderGoodsPageVo.getGoodsPicture()); |
| | |
| | | consumerGoods.setServiceNum(appUserOrderGoodsPageVo.getServiceNum()); |
| | | consumerGoods.setUsedNum(0); |
| | | consumerGoods.setGoodsType(appUserOrderGoodsPageVo.getGoodsType()); |
| | | consumerGoods.setGoodsTag(appUserOrderGoodsPageVo.getGoodsTag()); |
| | | consumerGoods.setCreateTime(nowTime); |
| | | consumerGoods.setGoodsIntroduction(goods.getGoodsIntroduction()); |
| | | consumerGoods.setGoodsPicture(appUserOrderGoodsPageVo.getGoodsPicture()); |
| | |
| | | merVerifyOrderVo.setCreateTime(order.getCreateTime()); |
| | | merVerifyOrderVo.setPayTime(order.getPayTime()); |
| | | merVerifyOrderVo.setUseTime(order.getUseTime()); |
| | | merVerifyOrderVo.setPayType(order.getPayType()); |
| | | merVerifyOrderVo.setRealReceiveMoney(order.getChangeReceivableMoney()); |
| | | if(order.getPayType()==1){ |
| | | merVerifyOrderVo.setReceiveMoney(order.getPayMoney()); |
| | | }else{ |
| | | if(order.getOfflinePayMoney()!=null){ |
| | | merVerifyOrderVo.setReceiveMoney(order.getOfflinePayMoney()); |
| | | }else{ |
| | | merVerifyOrderVo.setReceiveMoney(BigDecimal.ZERO); |
| | | } |
| | | } |
| | | merVerifyOrderVo.setUnReceiveMoney(merVerifyOrderVo.getRealReceiveMoney().subtract(order.getReceivableMoney())); |
| | | Member member = remoteMemberService.getMember(order.getUserId()).getData(); |
| | | merVerifyOrderVo.setUserId(order.getUserId()); |
| | | merVerifyOrderVo.setUserName(member.getRealName()); |
| | |
| | | merVerifyOrderVo.setCloseFlag(order.getCloseFlag()); |
| | | // |
| | | if(order.getOrderFrom()==2){ |
| | | |
| | | //profitsSharingService.applyProfitSharing(); |
| | | } |
| | | |
| | |
| | | payRecord.setOrderId(order.getOrderId()); |
| | | payRecord.setPayMoney(merVerifyOrderDto.getRelPayMoney()); |
| | | payRecord.setPayTime(new Date()); |
| | | payRecord.setPayType(2); |
| | | payRecord.setPayType(merVerifyOrderDto.getPayType()); |
| | | payRecordService.save(payRecord); |
| | | return merVerifyOrderVo; |
| | | |
| | | submitProfitSharing(orderId, order.getOrderNo(), order.getShopId(), order.getOrderMoney()); |
| | | |
| | | return merVerifyOrderVo; |
| | | } |
| | | |
| | | private void submitProfitSharing(String orderId, String orderNo, Long shopId, BigDecimal orderMoney) { |
| | | String sendMessage = ""; |
| | | String resultMessage = ""; |
| | | try { |
| | | // 核销完成 开始分账(平台收取服务费) |
| | | OrderPayment payment = orderPaymentService.getByOrderId(orderId); |
| | | String transactionId = payment.getTransactionId(); |
| | | |
| | | // 平台特约商户号,用户平台收取服务费 |
| | | String platformTyMacId = WxPayConfiguration.getPlatformTyMacId(); |
| | | |
| | | R<String> resultMch = remoteShopService.getShopSubMchId(shopId); |
| | | String subMchId = resultMch.getData(); |
| | | if (!StringUtils.isEmpty(subMchId)) { |
| | | |
| | | |
| | | R<ShopProportionVo> resultShopProportion = remoteShopService.getShopProportion(shopId); |
| | | ShopProportionVo shopProportion = resultShopProportion.getData(); |
| | | if (null != shopProportion) { |
| | | ProfitSharingRequest request = new ProfitSharingRequest(); |
| | | request.setSubMchid(subMchId); |
| | | request.setTransactionId(transactionId); |
| | | request.setOutOrderNo(orderNo); |
| | | List<Receiver> receiverList = new ArrayList<>(); |
| | | |
| | | String description = "订单:" + orderNo + " 平台抽取佣金"; |
| | | BigDecimal proportionPercent = shopProportion.getProportionPercent(); |
| | | if (null == proportionPercent) { |
| | | proportionPercent = BigDecimal.ZERO; |
| | | } |
| | | |
| | | ProfitSharingResult result = new ProfitSharingResult(); |
| | | result.setOutOrderNo(orderNo); |
| | | result.setStatus("FINISHED"); |
| | | |
| | | // 计算分成金额 |
| | | int amount = orderMoney.multiply(proportionPercent).setScale(0, RoundingMode.UP).intValue(); |
| | | log.info("订单分账:{} 分账金额: {}", orderNo, amount); |
| | | if (amount > 0) { |
| | | // 分账创建 |
| | | Receiver receiver = new Receiver(); |
| | | receiver.setType("MERCHANT_ID"); |
| | | receiver.setReceiverAccount(platformTyMacId); |
| | | receiver.setAmount(amount); |
| | | receiver.setDescription(description); |
| | | |
| | | receiverList.add(receiver); |
| | | request.setReceivers(receiverList); |
| | | // 分账完成 |
| | | request.setFinish(true); |
| | | result = wxService.getEcommerceService().profitSharing(request); |
| | | } |
| | | |
| | | // 创建分账记录 |
| | | profitSharingService.saveProfitSharing(shopId, orderId, orderMoney, result); |
| | | |
| | | // 保存请求信息 |
| | | sendMessage = JSONObject.toJSONString(request); |
| | | resultMessage = JSONObject.toJSONString(result); |
| | | } else { |
| | | resultMessage = String.format("订单分账:%s 获取商户分成失败", orderNo); |
| | | log.info(resultMessage); |
| | | } |
| | | } else { |
| | | resultMessage = String.format("订单分账:%s 获取微信商户号失败", orderNo); |
| | | log.info(resultMessage); |
| | | } |
| | | } catch (WxPayException e) { |
| | | resultMessage = String.format("订单分账:%s 分账失败:%s", orderNo, e.getMessage()); |
| | | log.info(resultMessage); |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | // 保存分账信息 |
| | | paymentMessageService.savePaymentMessage("4", orderId, sendMessage, resultMessage); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | consumerGoods.setUsedNum(0); |
| | | consumerGoods.setGoodsType(goods.getGoodsType()); |
| | | consumerGoods.setGoodsTag(goods.getGoodsTags()); |
| | | consumerGoods.setCreateTime(new Date()); |
| | | consumerGoods.setGoodsIntroduction(goods.getGoodsIntroduction()); |
| | | goodsFile = remoteGoodsService.getGoodsFile(goods.getGoodsId()).getData(); |
| | |
| | | |
| | | |
| | | /** |
| | | * @param merVerifyPrizeDto |
| | | * @return MerVerifyAwardVo |
| | | * @description 确认核销奖品 |
| | | * @author jqs |
| | | * @date 2023/7/9 9:54 |
| | | * @param merVerifyPrizeDto |
| | | * @return MerVerifyAwardVo |
| | | */ |
| | | @Override |
| | | @Transactional |
| | |
| | | @Override |
| | | public List<MerMemberNoClearOrderVo> pageMerMemberNoClearOrder(Page page, MerMemberNoClearOrderDto merMemberNoClearOrderDto) { |
| | | List<MerMemberNoClearOrderVo> merMemberNoClearOrderVoList = orderMapper.pageMerMemberNoClearOrder(page, merMemberNoClearOrderDto.getMemberUserId()); |
| | | if (merMemberNoClearOrderVoList != null && !merMemberNoClearOrderVoList.isEmpty()) { |
| | | /*if (merMemberNoClearOrderVoList != null && !merMemberNoClearOrderVoList.isEmpty()) { |
| | | BigDecimal zeroBig = new BigDecimal("0.00"); |
| | | for (MerMemberNoClearOrderVo merMemberNoClearOrderVo : merMemberNoClearOrderVoList) { |
| | | merMemberNoClearOrderVo.setUnPaidMoney(merMemberNoClearOrderVo.getReceivableMoney().subtract(merMemberNoClearOrderVo.getPayMoney())); |
| | |
| | | merMemberNoClearOrderVo.setUnPaidMoney(zeroBig); |
| | | } |
| | | } |
| | | } |
| | | }*/ |
| | | return merMemberNoClearOrderVoList; |
| | | } |
| | | |
| | |
| | | payRecord.setOrderId(order.getOrderId()); |
| | | payRecord.setPayMoney(merCloseOrderDto.getPayMoney()); |
| | | payRecord.setPayTime(new Date()); |
| | | payRecord.setPayType(2); |
| | | payRecord.setPayType(merCloseOrderDto.getPayType()); |
| | | payRecordService.save(payRecord); |
| | | } |
| | | |
| | |
| | | orderGoods.setCycleNumFlag(goods.getCycleNumFlag()); |
| | | orderGoods.setServiceNum(serviceNum); |
| | | orderGoods.setGoodsType(goods.getGoodsType()); |
| | | orderGoods.setGoodsTag(goods.getGoodsTags()); |
| | | orderGoods.setGoodsName(goods.getGoodsName()); |
| | | orderGoods.setGoodsIntroduction(goods.getGoodsIntroduction()); |
| | | orderGoods.setGoodsPicture(goodsFile.getFileUrl()); |
| | |
| | | order.setOrderRemark(merNewOrderDto.getOrderRemark()); |
| | | order.setGoodsNum(goodsNum); |
| | | order.setCreateTime(nowTime); |
| | | order.setPayTime(nowTime); |
| | | order.setUseTime(nowTime); |
| | | order.setUseUserId(merNewOrderDto.getUserId()); |
| | | order.setPayMoney(merNewOrderDto.getPayMoney()); |
| | |
| | | consumerGoods.setServiceNum(appUserOrderGoodsPageVo.getServiceNum()); |
| | | consumerGoods.setUsedNum(0); |
| | | consumerGoods.setGoodsType(appUserOrderGoodsPageVo.getGoodsType()); |
| | | consumerGoods.setGoodsTag(appUserOrderGoodsPageVo.getGoodsTag()); |
| | | consumerGoods.setCreateTime(nowTime); |
| | | consumerGoods.setGoodsIntroduction(goods.getGoodsIntroduction()); |
| | | consumerGoods.setGoodsPicture(appUserOrderGoodsPageVo.getGoodsPicture()); |
| | |
| | | consumerGoods.setServiceNum(appUserOrderGoodsPageVo.getServiceNum()); |
| | | consumerGoods.setUsedNum(0); |
| | | consumerGoods.setGoodsType(appUserOrderGoodsPageVo.getGoodsType()); |
| | | consumerGoods.setGoodsTag(appUserOrderGoodsPageVo.getGoodsTag()); |
| | | consumerGoods.setCreateTime(nowTime); |
| | | consumerGoods.setGoodsIntroduction(goods.getGoodsIntroduction()); |
| | | consumerGoods.setGoodsPicture(appUserOrderGoodsPageVo.getGoodsPicture()); |
| | |
| | | if (orderFrom != null) { |
| | | if (orderFrom == 1) { |
| | | orderFromDesc = "商城订单"; |
| | | } else if(orderFrom == 2){ |
| | | |
| | | orderFromDesc = "店铺砍价活动("+merOrderPageVo.getActivityName()+")"; |
| | | } else { |
| | | orderFromDesc = "线下创建"; |
| | | } |
| | |
| | | } |
| | | } |
| | | MgtOrderTotal mgtOrderTotal = new MgtOrderTotal(); |
| | | MgtOrderTotal mgtOrderTotalFirst = orderMapper.totalOrderFirst(); |
| | | MgtOrderTotal mgtOrderTotalFirst = orderMapper.totalOrderFirst(mgtShopOrderPageDto); |
| | | MgtOrderTotal mgtOrderTotalSecond = orderMapper.totalOrderSecond(mgtShopOrderPageDto); |
| | | MgtOrderTotal mgtOrderTotalThird = orderMapper.totalOrderThird(mgtShopOrderPageDto); |
| | | mgtOrderTotal.setOrderTotal(mgtOrderTotalFirst.getOrderTotal()); |
| | |
| | | @Override |
| | | public MgtBulletinBoardVo boardOrderTotal() { |
| | | MgtBulletinBoardVo mgtBulletinBoardVo = orderMapper.boardOrderTotal(); |
| | | Integer activityUserTotal = orderMapper.activityUserTotal(); |
| | | mgtBulletinBoardVo.setActivityUserTotal(activityUserTotal); |
| | | return mgtBulletinBoardVo; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * @description 获取核销奖品 |
| | | * @author jqs |
| | | * @date 2023/7/8 17:46 |
| | | * @param verifyCode |
| | | * @param shopId |
| | | * @return MerVerifyAwardVo |
| | | * @description 获取核销奖品 |
| | | * @author jqs |
| | | * @date 2023/7/8 17:46 |
| | | */ |
| | | @Override |
| | | public MerVerifyAwardVo verifyPrize(String verifyCode,Long shopId){ |
| | |
| | | } |
| | | |
| | | /** |
| | | * @param merOrderPageDto |
| | | * @return MerTotalOrderVo |
| | | * @description 商户端订单管理统计 |
| | | * @author jqs |
| | | * @date 2023/7/31 10:53 |
| | | * @param merOrderPageDto |
| | | * @return MerTotalOrderVo |
| | | */ |
| | | @Override |
| | | public MerTotalOrderVo totalMerOrder(MerOrderPageDto merOrderPageDto) { |
| | | MerTotalOrderVo merTotalOrderVo = new MerTotalOrderVo(); |
| | | if (StringUtils.isNotBlank(merOrderPageDto.getKeyword())) { |
| | | MgtUserIdByKeywordDto userIdByKeywordDto = new MgtUserIdByKeywordDto(); |
| | | userIdByKeywordDto.setKeyword(merOrderPageDto.getKeyword()); |
| | | MgtUserIdByKeywordVo userIdByKeywordVo = remoteMemberService.getUserIdByKeyword(userIdByKeywordDto).getData(); |
| | | if (StringUtils.isNotBlank(userIdByKeywordVo.getUserIds())) { |
| | | List<Long> userIdList = Arrays.stream(userIdByKeywordVo.getUserIds().split(",")) |
| | | .map(Long::parseLong) |
| | | .collect(Collectors.toList()); |
| | | merOrderPageDto.setMemberUserIdList(userIdList); |
| | | merOrderPageDto.setMemberUserId(null); |
| | | } |
| | | } |
| | | merTotalOrderVo = orderMapper.totalMerOrder(merOrderPageDto); |
| | | return merTotalOrderVo; |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * @param orderId |
| | | * @return void |
| | | * @description 自动取消订单 |
| | | * @author jqs |
| | | * @date 2023/7/13 17:15 |
| | | * @param orderId |
| | | * @return void |
| | | */ |
| | | @Override |
| | | @Transactional |
| | |
| | | } |
| | | |
| | | /** |
| | | * @param transaction |
| | | * @return void |
| | | * @description 订单支付回调 |
| | | * @author jqs |
| | | * @date 2023/7/13 17:57 |
| | | * @param transaction |
| | | * @return void |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public void payBack(Transaction transaction) { |
| | | public void payBack(PartnerTransactionsResult transaction) { |
| | | // 更新订单状态 |
| | | String orderId=transaction.getOutTradeNo(); |
| | | Order order = this.getById(orderId); |
| | |
| | | if (haveGoods) { |
| | | memberTotalChangeDto.setGoodsOrderChange(1); |
| | | } |
| | | if(order.getOrderFrom()==2){ |
| | | memberTotalChangeDto.setActivityTime(order.getCreateTime()); |
| | | } |
| | | // 更新会员统计信息 |
| | | remoteMemberService.changeMemberTotal(memberTotalChangeDto); |
| | | // 如果订单来源于活动,则更新活动统计信息 |
| | |
| | | } |
| | | |
| | | /** |
| | | * @param orderId |
| | | * @return void |
| | | * @description 订单退款 |
| | | * @author jqs |
| | | * @date 2023/7/13 18:36 |
| | | * @param orderId |
| | | * @return void |
| | | */ |
| | | @Override |
| | | @Transactional |
| | |
| | | orderRefund.setOrderId(order.getOrderId()); |
| | | orderRefund.setUserId(order.getUserId()); |
| | | orderRefund.setShopId(order.getShopId()); |
| | | orderRefund.setRefundMoney(order.getPayMoney()); |
| | | orderRefund.setRefundMoney(order.getOnlinePayMoney()); |
| | | orderRefund.setOrderMoney(order.getPayMoney()); |
| | | orderRefund.setCreateTime(new Date()); |
| | | // 初始化各类商品的收款金额 |
| | |
| | | activityTotalChangeDto.setUserId(order.getUserId()); |
| | | remoteActivityService.changeActivityTotal(activityTotalChangeDto); |
| | | } |
| | | |
| | | // 用户取消订单退款 |
| | | BigDecimal onlinePayMoney = order.getOnlinePayMoney(); |
| | | if(BigDecimal.ZERO.compareTo(onlinePayMoney) < 0){ |
| | | // 订单支付金额大于0,可发起退款 |
| | | orderWxApplyRefund(orderId, refundId, onlinePayMoney, orderRefund); |
| | | } |
| | | |
| | | orderRefund.setRefundStatus(1); |
| | | orderRefundService.saveOrUpdate(orderRefund); |
| | | } |
| | | |
| | | /** |
| | | * 申请退款API |
| | | */ |
| | | private void orderWxApplyRefund(String orderId, String outRefundNo, BigDecimal payMoney, OrderRefund orderRefund){ |
| | | try { |
| | | // 创建支付订单 |
| | | OrderPayment orderPayment = orderPaymentService.getByOrderId(orderId); |
| | | if (null == orderPayment) { |
| | | return; |
| | | } |
| | | String subMchId = orderPayment.getSubMchId(); |
| | | WxPayConfig config = wxService.getConfig(); |
| | | |
| | | RefundsRequest request = new RefundsRequest(); |
| | | request.setSpAppid(config.getAppId()); |
| | | request.setSubMchid(subMchId); |
| | | request.setTransactionId(orderPayment.getTransactionId()); |
| | | request.setOutRefundNo(outRefundNo); |
| | | request.setReason("用户取消订单"); |
| | | // 订单金额 |
| | | int total = payMoney.multiply(new BigDecimal(100)).intValue(); |
| | | RefundsRequest.Amount amount = RefundsRequest.Amount.builder().refund(total).total(total).currency("CNY").build(); |
| | | request.setAmount(amount); |
| | | request.setNotifyUrl(config.getNotifyUrl()); |
| | | |
| | | RefundsResult result = wxService.getEcommerceService().refunds(request); |
| | | |
| | | // 微信退款id |
| | | orderRefund.setWxRefundId(result.getRefundId()); |
| | | |
| | | // 请求参数 |
| | | Gson gson = new Gson(); |
| | | String refundRequestJson = gson.toJson(request); |
| | | // 返回参数 |
| | | String refundResponseJson = gson.toJson(result); |
| | | |
| | | // 保存支付订单统一下单日志 |
| | | paymentMessageService.savePaymentMessage("3", orderId, refundRequestJson, refundResponseJson); |
| | | |
| | | } catch (WxPayException e) { |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @param staffTotalDto |
| | | * @return StaffActivityOrderTotalVo |
| | | * @description 员工端活动订单统计 |
| | | * @author jqs |
| | | * @date 2023/7/17 15:25 |
| | | * @param staffTotalDto |
| | | * @return StaffActivityOrderTotalVo |
| | | */ |
| | | @Override |
| | | public StaffActivityOrderTotalVo getStaffActivityOrderTotal(StaffTotalDto staffTotalDto){ |
| | |
| | | } |
| | | |
| | | /** |
| | | * @param staffTotalDto |
| | | * @return StaffActivityTotalVo |
| | | * @description 员工端活动统计 |
| | | * @author jqs |
| | | * @date 2023/7/17 15:51 |
| | | * @param staffTotalDto |
| | | * @return StaffActivityTotalVo |
| | | */ |
| | | @Override |
| | | public StaffActivityTotalVo getStaffActivityTotal(StaffTotalDto staffTotalDto){ |
| | |
| | | } |
| | | |
| | | /** |
| | | * @param staffTotalDto |
| | | * @return MerOrderDistributionTotalVo |
| | | * @description 员工端活动统计订单分布 |
| | | * @author jqs |
| | | * @date 2023/7/17 16:16 |
| | | * @param staffTotalDto |
| | | * @return MerOrderDistributionTotalVo |
| | | */ |
| | | @Override |
| | | public MerOrderDistributionTotalVo getStaffOrderDistributionTotal(StaffTotalDto staffTotalDto){ |
| | |
| | | |
| | | |
| | | /** |
| | | * @param staffTotalDto |
| | | * @return MerOrderTypeTotalVo |
| | | * @description 员工端活动统计销售占比 |
| | | * @author jqs |
| | | * @date 2023/7/17 17:03 |
| | | * @param staffTotalDto |
| | | * @return MerOrderTypeTotalVo |
| | | */ |
| | | @Override |
| | | public MerOrderTypeTotalVo getStaffOrderTypeTotal(StaffTotalDto staffTotalDto){ |
| | |
| | | } |
| | | |
| | | /** |
| | | * @param staffTotalDto |
| | | * @return StaffActivityDateMemberTotalVo |
| | | * @description 员工端获客人数 |
| | | * @author jqs |
| | | * @date 2023/7/17 18:42 |
| | | * @param staffTotalDto |
| | | * @return StaffActivityDateMemberTotalVo |
| | | */ |
| | | @Override |
| | | public StaffActivityDateMemberTotalVo getStaffActivityGetMemberTotal(StaffTotalDto staffTotalDto) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * @param staffTotalDto |
| | | * @return StaffActivityDateMemberTotalVo |
| | | * @description 员工端获客人数 |
| | | * @author jqs |
| | | * @date 2023/7/17 18:42 |
| | | * @param staffTotalDto |
| | | * @return StaffActivityDateMemberTotalVo |
| | | */ |
| | | @Override |
| | | public StaffActivityDateMemberTotalVo getStaffActivityMemberTotal(StaffTotalDto staffTotalDto) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * @description 获取时间段日期 |
| | | * @author jqs |
| | | * @date 2023/7/17 19:11 |
| | | * @param startDate |
| | | * @param endDate |
| | | * @return List<String> |
| | | * @description 获取时间段日期 |
| | | * @author jqs |
| | | * @date 2023/7/17 19:11 |
| | | */ |
| | | public static List<String> getDateRange(String startDate, String endDate) { |
| | | List<String> dateList = new ArrayList<>(); |
| | |
| | | } |
| | | |
| | | /** |
| | | * @param |
| | | * @return void |
| | | * @description 检查订单状态定时任务 |
| | | * @author jqs |
| | | * @date 2023/7/25 14:40 |
| | | * @param |
| | | * @return void |
| | | */ |
| | | @Override |
| | | public void checkOrderStatus(){ |
| | |
| | | for(Order order: orderList){ |
| | | autoTimeCancelOrder(order); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void profitSharingBack(ProfitSharingNotifyResult result) { |
| | | |
| | | try { |
| | | String outOrderNo = result.getOutOrderNo(); |
| | | ProfitSharing profitSharing = profitSharingService.getById(outOrderNo); |
| | | if(null != profitSharing){ |
| | | profitSharing.setWxOrderId(result.getOrderId()); |
| | | profitSharing.setFinishTime(result.getSuccessTime()); |
| | | profitSharing.setFinishFlag(1); |
| | | |
| | | profitSharingService.saveOrUpdate(profitSharing); |
| | | } |
| | | } catch (Exception e){ |
| | | |
| | | log.error("==分账回成功回调操作====【{}】========={}", result.getOutOrderNo(), e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void orderRefundBack(RefundNotifyResult result) { |
| | | try { |
| | | String outRefundNo = result.getOutRefundNo(); |
| | | String refundStatus = result.getRefundStatus(); |
| | | OrderRefund orderRefund = orderRefundService.getById(outRefundNo); |
| | | if(null != orderRefund){ |
| | | orderRefund.setWxRefundId(result.getRefundId()); |
| | | orderRefund.setBackTime(result.getSuccessTime()); |
| | | orderRefund.setRefundStatus(IDict.getCodeByText(RefundStatusEnum.class, refundStatus)); |
| | | orderRefundService.saveOrUpdate(orderRefund); |
| | | } |
| | | } catch (Exception e){ |
| | | |
| | | log.error("==退款回成功回调操作====【{}】========={}", result.getOutRefundNo(), e.getMessage()); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 获取商户订单统计 |
| | | * @author jqs |
| | | * @date 2023/8/4 10:25 |
| | | * @param mgtShopAllOrderPageDto |
| | | * @return MgtShopAllOrderTotal |
| | | */ |
| | | @Override |
| | | public MgtShopAllOrderTotal getMgtShopAllOrderTotal(MgtShopAllOrderPageDto mgtShopAllOrderPageDto){ |
| | | MgtShopAllOrderTotal shopAllOrderTotal = orderMapper.getMgtShopAllOrderTotal(mgtShopAllOrderPageDto); |
| | | return shopAllOrderTotal; |
| | | } |
| | | |
| | | /** |
| | | * 分页获取会员消费记录 |
| | | * @param merOrderPageDto |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<MerOrderPageVo> pageMerMemberPayOrder(Page page,MerMemberNoClearOrderDto merOrderPageDto){ |
| | | List<MerOrderPageVo> merOrderPageVoList = orderMapper.pageMerMemberPayOrder(page, merOrderPageDto); |
| | | if (merOrderPageVoList != null && !merOrderPageVoList.isEmpty()) { |
| | | Long userId; |
| | | Member member; |
| | | Integer orderFrom; |
| | | String orderFromDesc; |
| | | BigDecimal zeroBig = new BigDecimal("0.00"); |
| | | StringJoiner userIdSj = new StringJoiner(","); |
| | | for (MerOrderPageVo merOrderPageVo : merOrderPageVoList) { |
| | | userId = merOrderPageVo.getUserId(); |
| | | userIdSj.add(userId.toString()); |
| | | orderFrom = merOrderPageVo.getOrderFrom(); |
| | | if (orderFrom != null) { |
| | | if (orderFrom == 1) { |
| | | orderFromDesc = "商城订单"; |
| | | } else { |
| | | orderFromDesc = "线下创建"; |
| | | } |
| | | } else { |
| | | orderFromDesc = "商城订单"; |
| | | } |
| | | merOrderPageVo.setOrderFromDesc(orderFromDesc); |
| | | merOrderPageVo.setUnPaidMoney(merOrderPageVo.getPayMoney().subtract(merOrderPageVo.getReceiveMoney())); |
| | | if (merOrderPageVo.getUnPaidMoney() == null) { |
| | | merOrderPageVo.setUnPaidMoney(zeroBig); |
| | | } |
| | | } |
| | | MgtBaseBathDto mgtBaseBathDto = new MgtBaseBathDto(); |
| | | mgtBaseBathDto.setIds(userIdSj.toString()); |
| | | List<MgtSimpleMemberVo> simpleMemberVoList = remoteMemberService.listSimpleVoByIds(mgtBaseBathDto).getData(); |
| | | Map<Long, MgtSimpleMemberVo> userMap = simpleMemberVoList.stream() |
| | | .collect(Collectors.toMap(MgtSimpleMemberVo::getUserId, Function.identity())); |
| | | for (MerOrderPageVo merOrderPageVo : merOrderPageVoList) { |
| | | if(merOrderPageVo.getUserId()!=null&&userMap.get(merOrderPageVo.getUserId())!=null){ |
| | | merOrderPageVo.setUserName(userMap.get(merOrderPageVo.getUserId()).getRealName()); |
| | | merOrderPageVo.setNickName(userMap.get(merOrderPageVo.getUserId()).getNickName()); |
| | | merOrderPageVo.setUserMobile(userMap.get(merOrderPageVo.getUserId()).getUserMobile()); |
| | | }else{ |
| | | log.debug("订单merOrderPageVo"+merOrderPageVo.getOrderId()+"缺少用户"); |
| | | } |
| | | } |
| | | } |
| | | return merOrderPageVoList; |
| | | } |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.github.binarywang.wxpay.bean.ecommerce.PartnerTransactionsResult; |
| | | import com.github.binarywang.wxpay.bean.ecommerce.RefundNotifyResult; |
| | | import com.github.binarywang.wxpay.bean.profitsharingV3.ProfitSharingNotifyResult; |
| | | import com.ruoyi.order.domain.dto.*; |
| | | import com.ruoyi.order.domain.pojo.order.Order; |
| | | import com.ruoyi.order.domain.vo.*; |
| | |
| | | * @param Transaction transaction |
| | | * @return void |
| | | */ |
| | | void payBack(Transaction transaction); |
| | | void payBack(PartnerTransactionsResult transaction); |
| | | |
| | | /** |
| | | * 取消订单 |
| | |
| | | * @return void |
| | | */ |
| | | void checkOrderStatus(); |
| | | |
| | | /** |
| | | * 分账通知回调 |
| | | * @param result |
| | | */ |
| | | void profitSharingBack(ProfitSharingNotifyResult result); |
| | | |
| | | /** |
| | | * 订单退款回调 |
| | | * @param result |
| | | */ |
| | | void orderRefundBack(RefundNotifyResult result); |
| | | |
| | | /** |
| | | * @description 获取商户订单统计 |
| | | * @author jqs |
| | | * @date 2023/8/4 10:25 |
| | | * @param mgtShopAllOrderPageDto |
| | | * @return MgtShopAllOrderTotal |
| | | */ |
| | | MgtShopAllOrderTotal getMgtShopAllOrderTotal(MgtShopAllOrderPageDto mgtShopAllOrderPageDto); |
| | | |
| | | |
| | | /** |
| | | * 分页获取会员消费记录 |
| | | * @param merOrderPageDto |
| | | * @return |
| | | */ |
| | | List<MerOrderPageVo> pageMerMemberPayOrder(Page page,MerMemberNoClearOrderDto merOrderPageDto); |
| | | } |
| | |
| | | # 共享配置 |
| | | shared-configs: |
| | | - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} |
| | | |
| | | wx: |
| | | pay: |
| | | appId: #微信公众号或者小程序等的appid(平台) |
| | | mchId: #微信支付商户号(平台) |
| | | mchKey: #微信支付商户密钥(平台) |
| | | platformTyMacId: # 平台特约商户号,用户平台收取服务费 |
| | | subAppId: #服务商模式下的子商户公众账号ID (这个可以不用配置) |
| | | subMchId: #服务商模式下的子商户号 (二级商户号 也不用配置) |
| | | keyPath: # (商户平台 下载的V3证书)p12证书的位置,可以指定绝对路径,也可以指定类路径(以classpath:开头) |
| | |
| | | tcg.shop_id shopId, |
| | | tcg.goods_type goodsType, |
| | | tcg.goods_name goodsName, |
| | | tcg.goods_introduction goodsIntroduction, |
| | | tcg.goods_tag goodsTag, |
| | | tcg.goods_picture goodsPicture, |
| | | tcg.goods_nurses goodsNurses, |
| | | tcg.cycle_num_flag cycleNumFlag, |
| | |
| | | tog.goods_id goodsId, |
| | | tog.goods_name goodsName, |
| | | tog.goods_type goodsType, |
| | | tog.goods_tag goodsTag, |
| | | tog.buy_num buyNum, |
| | | tog.goods_price goodsPrice, |
| | | tog.goods_picture goodsPicture, |
| | |
| | | <result column="discountMoney" property="discountMoney"/> |
| | | <result column="receivableMoney" property="receivableMoney"/> |
| | | <result column="payMoney" property="payMoney"/> |
| | | <result column="receiveMoney" property="receiveMoney"/> |
| | | <result column="orderFrom" property="orderFrom" /> |
| | | <result column="orderFromDesc" property="orderFromDesc" /> |
| | | <result column="createTime" property="createTime" /> |
| | | <collection property="mgtOrderGoodsVoList" ofType="com.ruoyi.order.domain.vo.MgtOrderGoodsPageVo"> |
| | | <result column="goodsName" property="goodsName"/> |
| | |
| | | toc.coupon_money couponDiscount, |
| | | toc.receivable_money receivableMoney, |
| | | toc.receivable_deposit receivableDeposit, |
| | | toc.pay_money payMoney, |
| | | toc.change_receivable_money receiveMoney, |
| | | IFNULL(toc.offline_pay_money,0) payMoney, |
| | | toc.change_receivable_money-IFNULL(toc.offline_pay_money,0) unPaidMoney, |
| | | toc.create_time createTime |
| | | FROM t_order toc |
| | | WHERE toc.del_flag = 0 AND toc.user_id = #{userId} AND toc.order_status = 2 AND toc.close_flag = 0 |
| | | WHERE toc.del_flag = 0 AND toc.user_id = #{userId} AND toc.order_status >= 2 AND toc.close_flag = 0 |
| | | ORDER BY toc.create_time DESC |
| | | </select> |
| | | |
| | |
| | | tog.goods_type goodsType, |
| | | tog.buy_num buyNum, |
| | | toc.create_time createTime, |
| | | toc.order_from orderFrom |
| | | toc.order_from orderFrom, |
| | | toc.activity_name activityName |
| | | FROM t_order toc |
| | | INNER JOIN t_order_goods tog ON tog.order_id = toc.order_id |
| | | WHERE toc.del_flag = 0 AND toc.shop_id = #{param.shopId} |
| | |
| | | toc.order_status orderStatus, |
| | | toc.order_money orderGoodsMoney, |
| | | toc.coupon_money couponDiscount, |
| | | toc.receivable_money receivableMoney, |
| | | toc.receivable_money-toc.online_pay_money receivableMoney, |
| | | toc.receivable_deposit receivableDeposit, |
| | | toc.pay_money payMoney |
| | | FROM t_order toc |
| | | toc.change_receivable_money payMoney, |
| | | IFNULL(toc.offline_pay_money,0) receiveMoney, |
| | | IFNULL(toc.receivable_money-IFNULL(CASE toc.pay_type WHEN 1 THEN toc.online_pay_money WHEN 2 THEN IFNULL(toc.offline_pay_money,0) END,0),0) unpaidMoney, |
| | | tpr.pay_time receiveMoneyTime, |
| | | tpr.pay_money thisReceiveMoney, |
| | | CASE tpr.pay_type WHEN 1 THEN "微信" WHEN 2 THEN "现金" WHEN 3 THEN "支付宝" END thisReceiveType |
| | | FROM t_pay_record tpr |
| | | INNER JOIN t_order toc ON tpr.order_id = toc.order_id |
| | | WHERE toc.del_flag = 0 AND toc.user_id = #{userId} AND (toc.order_status = 2 OR toc.order_status = 3) |
| | | ORDER BY toc.create_time DESC |
| | | </select> |
| | |
| | | IFNULL(SUM(IFNULL(toc.order_money,0)),0) totalOrderMoney, |
| | | IFNULL(SUM(IFNULL(toc.receivable_money,0)),0) totalReceivableMoney, |
| | | IFNULL(SUM(IFNULL(toc.discount_money,0)),0) totalDiscountMoney, |
| | | IFNULL(SUM(IFNULL(toc.pay_money,0)),0) totalPayMoney |
| | | IFNULL(SUM(IFNULL(toc.pay_money,0)),0) totalPayMoney, |
| | | IFNULL(SUM(IFNULL(toc.change_receivable_money,0)),0) totalReceiveMoney |
| | | FROM t_order toc |
| | | WHERE toc.del_flag = 0 AND toc.user_id = #{param.userId} |
| | | WHERE toc.del_flag = 0 AND toc.user_id = #{param.memberUserId} |
| | | <if test="param.orderStatus != null"> |
| | | AND toc.order_status = #{param.orderStatus} |
| | | </if> |
| | |
| | | toc.discount_money discountMoney, |
| | | toc.receivable_money receivableMoney, |
| | | toc.pay_money payMoney, |
| | | toc.change_receivable_money receiveMoney, |
| | | tog.goods_name goodsName, |
| | | tog.buy_num buyNum, |
| | | toc.create_time createTime, |
| | |
| | | AND Date(toc.create_time) <= #{param.endOrderDate} |
| | | </if> |
| | | <if test="param.keyword != null and param.keyword != ''"> |
| | | AND toc.order_no LIKE CONCAT('%',#{param.keyword},'%') |
| | | AND (toc.order_no LIKE CONCAT('%',#{param.keyword},'%') OR tog.goods_name LIKE CONCAT('%',#{param.keyword},'%')) |
| | | </if> |
| | | ORDER BY toc.create_time DESC |
| | | </select> |
| | |
| | | |
| | | <select id="totalOrderFirst" resultType="com.ruoyi.order.domain.vo.MgtOrderTotal"> |
| | | SELECT |
| | | COUNT(order_id) orderTotal, |
| | | IFNULL(SUM(order_money),0) orderMoneyTotal |
| | | FROM t_order ORDER BY create_time DESC |
| | | COUNT(temp.order_id) orderTotal, |
| | | IFNULL(SUM(temp.order_money),0) orderMoneyTotal |
| | | FROM |
| | | (SELECT toc.order_id,toc.order_money,toc.pay_money |
| | | FROM t_order toc |
| | | INNER JOIN t_order_goods tog ON tog.order_id = toc.order_id |
| | | WHERE toc.del_flag = 0 AND (toc.order_from = 1 OR toc.order_from = 3) |
| | | <if test="param.orderStatus != null"> |
| | | AND toc.order_status = #{param.orderStatus} |
| | | </if> |
| | | <if test="param.goodsType != null and param.goodsType !=''"> |
| | | AND tog.goods_type = #{param.goodsType} |
| | | </if> |
| | | <if test="param.shopId != null and param.shopId != ''"> |
| | | AND toc.shop_id = #{param.shopId} |
| | | </if> |
| | | <if test="param.shopIds != null and param.shopIds != ''"> |
| | | AND FIND_IN_SET(toc.shop_id, #{param.shopIds}) > 0 |
| | | </if> |
| | | <if test="param.keyword != null and param.keyword != ''"> |
| | | AND (toc.order_no LIKE CONCAT('%',#{param.keyword},'%') OR toc.activity_name LIKE CONCAT('%',#{param.keyword},'%') OR FIND_IN_SET(toc.user_id, #{param.userIds}) > 0) |
| | | </if> |
| | | <if test="param.verifyStartTime != null and param.verifyStartTime != ''"> |
| | | AND Date(toc.use_time) >= #{param.verifyStartTime} |
| | | </if> |
| | | <if test="param.verifyEndTime != null and param.verifyEndTime != ''"> |
| | | AND Date(toc.use_time) <= #{param.verifyEndTime} |
| | | </if> |
| | | GROUP BY toc.order_id) AS temp |
| | | </select> |
| | | |
| | | <select id="totalOrderSecond" resultType="com.ruoyi.order.domain.vo.MgtOrderTotal"> |
| | |
| | | IFNULL(SUM(CASE WHEN order_from = 2 THEN 1 ELSE 0 END),0) activityOrderTotal |
| | | FROM t_order |
| | | WHERE del_flag = 0 |
| | | </select> |
| | | |
| | | <select id="activityUserTotal" resultType="java.lang.Integer"> |
| | | SELECT |
| | | COUNT(DISTINCT user_id) |
| | | FROM t_order |
| | | WHERE del_flag = 0 AND order_from = 2 |
| | | </select> |
| | | |
| | | <select id="getTotalOrderTotalOrderFrom" resultType="com.ruoyi.order.domain.vo.MgtTotalOrderTotalVo"> |
| | |
| | | SELECT |
| | | DATE(toc.create_time) AS mapKey, |
| | | COUNT(DISTINCT tog.order_id) AS mapValueFirst, |
| | | SUM(tog.order_money) AS mapValueSecond |
| | | SUM(tog.goods_receivable_money) AS mapValueSecond |
| | | FROM t_order toc |
| | | INNER JOIN t_order_goods tog ON toc.order_id = tog.order_id |
| | | WHERE toc.del_flag = 0 AND tog.del_flag = 0 AND tog.goods_type = #{param.goodsType} |
| | |
| | | FROM t_order |
| | | WHERE del_flag = 0 AND shop_id = #{param.shopId} |
| | | <if test="param.memberUserId != null and param.memberUserId != ''"> |
| | | AND toc.user_id = #{param.memberUserId} |
| | | AND user_id = #{param.memberUserId} |
| | | </if> |
| | | <if test="param.type != null and param.type ==1 "> |
| | | AND (toc.order_status = 2 OR toc.order_status = 3) |
| | | AND (order_status = 2 OR order_status = 3) |
| | | </if> |
| | | <if test="param.type != null and param.type ==2 "> |
| | | AND toc.order_status = 2 |
| | | AND order_status = 2 |
| | | </if> |
| | | <if test="param.type != null and param.type ==3 "> |
| | | AND toc.order_status = 3 |
| | | AND order_status = 3 |
| | | </if> |
| | | <if test="param.orderFrom != null and param.orderFrom != '' "> |
| | | AND toc.order_from = #{param.orderFrom} |
| | | AND order_from = #{param.orderFrom} |
| | | </if> |
| | | <if test="param.startOrderDate != null and param.startOrderDate != '' "> |
| | | AND Date(toc.create_time) >= #{param.startOrderDate} |
| | | AND Date(create_time) >= #{param.startOrderDate} |
| | | </if> |
| | | <if test="param.endOrderDate != null and param.endOrderDate != '' "> |
| | | AND Date(toc.create_time) <= #{param.endOrderDate} |
| | | AND Date(create_time) <= #{param.endOrderDate} |
| | | </if> |
| | | <if test="param.keyword != null and param.keyword != ''"> |
| | | AND (toc.order_no LIKE CONCAT('%',#{param.keyword},'%') OR tog.goods_name LIKE CONCAT('%',#{param.keyword},'%')) |
| | | AND order_no LIKE CONCAT('%',#{param.keyword},'%') |
| | | </if> |
| | | </select> |
| | | |
| | |
| | | INNER JOIN t_order_goods tog ON tog.order_id = toc.order_id |
| | | WHERE toc.del_flag = 0 AND toc.order_status > 1 AND toc.user_id = #{userId} AND tog.goods_id = #{goodsId} |
| | | </select> |
| | | |
| | | <select id="getMgtShopAllOrderTotal" resultType="com.ruoyi.order.domain.vo.MgtShopAllOrderTotal"> |
| | | SELECT |
| | | COUNT(DISTINCT toc.order_id) orderTotal, |
| | | IFNULL(SUM(toc.order_money),0) totalOrderMoney, |
| | | IFNULL(SUM(toc.change_receivable_money),0) totalReceiveMoney |
| | | FROM t_order toc |
| | | WHERE toc.del_flag = 0 AND (toc.order_from = 1 OR toc.order_from = 3) |
| | | <if test="param.orderFrom != null"> |
| | | AND toc.order_from = #{param.orderFrom} |
| | | </if> |
| | | <if test="param.orderStatus != null"> |
| | | AND toc.order_status = #{param.orderStatus} |
| | | </if> |
| | | <if test="param.orderNo != null and param.orderNo !=''"> |
| | | AND toc.order_no LIKE CONCAT('%',#{param.orderNo},'%') |
| | | </if> |
| | | <if test="param.shopId != null and param.shopId != ''"> |
| | | AND toc.shop_id = #{param.shopId} |
| | | </if> |
| | | <if test="param.startOrderDate != null and param.startOrderDate != '' "> |
| | | AND Date(toc.create_time) >= #{param.startOrderDate} |
| | | </if> |
| | | <if test="param.endOrderDate != null and param.endOrderDate != '' "> |
| | | AND Date(toc.create_time) <= #{param.endOrderDate} |
| | | </if> |
| | | ORDER BY toc.create_time DESC |
| | | </select> |
| | | |
| | | <select id="pageMerMemberPayOrder" resultMap="merOrderResultMap"> |
| | | SELECT |
| | | toc.user_id userId, |
| | | toc.order_id orderId, |
| | | toc.order_no orderNo, |
| | | toc.pay_type payType, |
| | | toc.order_status orderStatus, |
| | | toc.order_money orderGoodsMoney, |
| | | toc.coupon_money couponDiscount, |
| | | toc.receivable_money-toc.online_pay_money receivableMoney, |
| | | toc.receivable_deposit receivableDeposit, |
| | | toc.change_receivable_money payMoney, |
| | | IFNULL(toc.offline_pay_money,0) receiveMoney, |
| | | toc.order_remark orderRemark, |
| | | tog.goods_name goodsName, |
| | | tog.goods_type goodsType, |
| | | tog.buy_num buyNum, |
| | | toc.create_time createTime, |
| | | toc.order_from orderFrom |
| | | FROM t_order toc |
| | | INNER JOIN t_order_goods tog ON tog.order_id = toc.order_id |
| | | WHERE toc.del_flag = 0 AND (toc.order_status = 2 OR toc.order_status = 3) AND toc.shop_id = #{param.shopId} AND toc.user_id = #{param.memberUserId} |
| | | ORDER BY toc.create_time DESC |
| | | </select> |
| | | </mapper> |
| | |
| | | |
| | | <select id="getMgtMemberServiceTotal" resultType="com.ruoyi.order.domain.vo.MgtMemberServiceTotalVo"> |
| | | SELECT |
| | | COUNT(temp.consumerGoodsId), |
| | | COUNT(temp.consumerGoodsId) cycleTotal, |
| | | IFNULL(SUM(temp.cycleCount),0) cycleCount, |
| | | IFNULL(SUM(temp.surpCycleCount),0) surpCycleCount |
| | | FROM (SELECT |
| | |
| | | package com.ruoyi.shop.config; |
| | | |
| | | import com.github.binarywang.wxpay.config.WxPayConfig; |
| | | import com.github.binarywang.wxpay.service.WxPayService; |
| | | import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl; |
| | | import lombok.AllArgsConstructor; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; |
| | | import org.springframework.boot.context.properties.EnableConfigurationProperties; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | /** |
| | |
| | | public class WxPayConfiguration { |
| | | private WxPayProperties properties; |
| | | |
| | | @Bean |
| | | /*@Bean |
| | | @ConditionalOnMissingBean |
| | | public WxPayService wxService() { |
| | | WxPayConfig payConfig = new WxPayConfig(); |
| | |
| | | WxPayService wxPayService = new WxPayServiceImpl(); |
| | | wxPayService.setConfig(payConfig); |
| | | return wxPayService; |
| | | } |
| | | }*/ |
| | | |
| | | } |
| | |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.utils.bean.BeanUtils; |
| | | import com.ruoyi.shop.domain.pojo.shop.ShopAuthentication; |
| | | import com.ruoyi.shop.domain.pojo.shop.ShopProportion; |
| | | import com.ruoyi.shop.domain.pojo.shop.ShopRelUser; |
| | | import com.ruoyi.shop.domain.pojo.shop.ShopStaff; |
| | | import com.ruoyi.shop.service.shop.*; |
| | |
| | | import com.ruoyi.system.api.constant.AppErrorConstant; |
| | | import com.ruoyi.system.api.domain.dto.*; |
| | | import com.ruoyi.system.api.domain.poji.shop.Shop; |
| | | import com.ruoyi.system.api.domain.poji.shop.ShopProportionVo; |
| | | import com.ruoyi.system.api.domain.poji.sys.SysUser; |
| | | import com.ruoyi.system.api.domain.vo.*; |
| | | import com.ruoyi.system.api.model.QwH5LoginVo; |
| | |
| | | @Resource |
| | | private MemberTaskService memberTaskService; |
| | | |
| | | @Resource |
| | | private ShopAuthenticationService shopAuthenticationService; |
| | | |
| | | @Resource |
| | | private ShopProportionService shopProportionService; |
| | | |
| | | /** |
| | | * 企业微信H5登录 |
| | | * @param qwUserDetail |
| | |
| | | return R.ok(shop); |
| | | } |
| | | |
| | | @PostMapping("/getShopSubMchId") |
| | | public R<String> getShopSubMchId(@RequestBody Long shopId){ |
| | | String subMchid = ""; |
| | | ShopAuthentication authentication = shopAuthenticationService.getByShopId(shopId); |
| | | if(null != authentication){ |
| | | subMchid = authentication.getSubMchid(); |
| | | } |
| | | return R.ok(subMchid, ""); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取商户分成 |
| | | * @param shopId |
| | | * @return |
| | | */ |
| | | @PostMapping("/getShopProportion") |
| | | public R<ShopProportionVo> getShopProportion(@RequestBody Long shopId){ |
| | | ShopProportion shopProportion = shopProportionService.getByShopId(shopId); |
| | | |
| | | ShopProportionVo shopProportionVo = new ShopProportionVo(); |
| | | BeanUtils.copyBeanProp(shopProportionVo, shopProportion); |
| | | return R.ok(shopProportionVo); |
| | | } |
| | | |
| | | @PostMapping("/getShopByUserId") |
| | | public R<ShopRelUserVo> getShopByUserId(@RequestBody Long userId) |
| | |
| | | @ApiOperation(value = "导出商户列表") |
| | | public void exportPageMgtShop(MgtShopPageDto mgtShopPageDto, HttpServletResponse response) { |
| | | Page<MgtShopPageVo> page = new Page<>(); |
| | | page.setSize(2000); |
| | | if(page.getSize()>5000){ |
| | | page.setSize(5000); |
| | | page.setCurrent(1); |
| | | } |
| | | List<MgtShopPageVo> mgtShopPageVoList = shopService.pageMgtShop(page,mgtShopPageDto); |
| | | ExcelUtil<MgtShopPageVo> util = new ExcelUtil<MgtShopPageVo>(MgtShopPageVo.class); |
| | | util.exportExcel(response, mgtShopPageVoList, "用户订单列表"); |
| | |
| | | Long userId = SecurityUtils.getUserId(); |
| | | mgtShopSuggestPageDto.setUserId(userId); |
| | | Page<MgtShopSuggestPageVo> page = new Page<>(); |
| | | page.setSize(2000); |
| | | if(page.getSize()>5000){ |
| | | page.setSize(5000); |
| | | page.setCurrent(1); |
| | | } |
| | | List<MgtShopSuggestPageVo> mgtShopSuggestPageVoList = shopSuggestService.pageMgtShopSuggest(page,mgtShopSuggestPageDto); |
| | | ExcelUtil<MgtShopSuggestPageVo> util = new ExcelUtil<MgtShopSuggestPageVo>(MgtShopSuggestPageVo.class); |
| | | util.exportExcel(response, mgtShopSuggestPageVoList, "商户建议列表"); |
| | |
| | | @ApiModelProperty(value="跟踪类型1电话2手动") |
| | | private Integer followType; |
| | | |
| | | @ApiModelProperty(value="自定义跟进类型") |
| | | private String customeFollowType; |
| | | |
| | | @ApiModelProperty(value="拨打电话") |
| | | private String callPhone; |
| | | |
| | |
| | | @ApiModelProperty(value="跟踪类型1电话2手动") |
| | | private Integer followType; |
| | | |
| | | @ApiModelProperty(value="自定义跟进类型") |
| | | private String customeFollowType; |
| | | |
| | | |
| | | @ApiModelProperty(value="拨打电话") |
| | | private String callPhone; |
| | | |
| | |
| | | @ApiModelProperty(value="跟进类型") |
| | | private String followType; |
| | | |
| | | |
| | | @ApiModelProperty(value="跟进内容") |
| | | private String followContent; |
| | | |
| | |
| | | private String nextTaskContent; |
| | | |
| | | @ApiModelProperty(value="跟踪类型") |
| | | private String customFollowType; |
| | | private String customeFollowType; |
| | | |
| | | @ApiModelProperty(value="紧急程度") |
| | | private String emergencyState; |
| | |
| | | package com.ruoyi.shop.domain.pojo.task; |
| | | |
| | | |
| | | import java.util.Date; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.activerecord.Model; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import java.io.Serializable; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.Version; |
| | | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @TableField("create_time") |
| | | private Date createTime; |
| | | |
| | | @TableField("custome_follow_type") |
| | | private String customeFollowType; |
| | | |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | |
| | | package com.ruoyi.shop.domain.pojo.task; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import java.util.Date; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.activerecord.Model; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import java.io.Serializable; |
| | | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @TableField("create_time") |
| | | private Date createTime; |
| | | |
| | | @TableField("custome_follow_type") |
| | | private String customeFollowType; |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.id; |
| | |
| | | @TableField("create_time") |
| | | private Date createTime; |
| | | |
| | | @TableField("custom_follow_type") |
| | | private String customFollowType; |
| | | @TableField("custome_follow_type") |
| | | private String customeFollowType; |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | |
| | | @ApiModelProperty(value="紧急情况") |
| | | private String emergencyState;; |
| | | |
| | | |
| | | @ApiModelProperty(value = "跟进时间") |
| | | private String followTime; |
| | | } |
| | |
| | | @ApiModelProperty(value="跟踪类型1电话2手动") |
| | | private Integer followType; |
| | | |
| | | @ApiModelProperty(value="自定义跟进类型") |
| | | private String customeFollowType; |
| | | |
| | | @ApiModelProperty(value="电话时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date callTime; |
| | |
| | | @ApiModelProperty(value="跟踪类型1电话2手动") |
| | | private Integer followType; |
| | | |
| | | @ApiModelProperty(value="自定义跟进类型") |
| | | private String customeFollowType; |
| | | |
| | | @ApiModelProperty(value="电话时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date callTime; |
| | |
| | | @ApiModelProperty(value="跟踪类型1电话2手动") |
| | | private Integer followType; |
| | | |
| | | @ApiModelProperty(value="跟进类型") |
| | | private String customeFollowType; |
| | | |
| | | @ApiModelProperty(value="电话时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date callTime; |
| | |
| | | @ApiModelProperty(value="跟踪类型1电话2手动") |
| | | private Integer followType; |
| | | |
| | | @ApiModelProperty(value="自定义跟进类型") |
| | | private String customeFollowType; |
| | | |
| | | @ApiModelProperty(value="电话时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date callTime; |
| | |
| | | @ApiModelProperty(value="跟踪类型1电话2手动") |
| | | private String followType; |
| | | |
| | | @ApiModelProperty(value="自定义跟踪类型") |
| | | private String customeFollowType; |
| | | |
| | | @ApiModelProperty(value="电话时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date callTime; |
| | |
| | | @ApiModelProperty(value="跟踪类型1电话2手动") |
| | | private Integer followType; |
| | | |
| | | @ApiModelProperty(value="自定义跟进类型") |
| | | private String customeFollowType; |
| | | |
| | | @ApiModelProperty(value="电话时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date callTime; |
| | |
| | | private String followType; |
| | | |
| | | @ApiModelProperty(value="跟进类型") |
| | | private String customFollowType; |
| | | private String customeFollowType; |
| | | |
| | | @ApiModelProperty(value="电话时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
New file |
| | |
| | | package com.ruoyi.shop.enums; |
| | | |
| | | import com.ruoyi.shop.enums.dict.IDict; |
| | | |
| | | public enum WxApplyMentSignStateEnum implements IDict<Integer> { |
| | | /** |
| | | * 签约状态 |
| | | 1、UNSIGNED:未签约。该状态下,电商平台可查询获取签约链接,引导二级商户的超级管理员完成签约; |
| | | 2、SIGNED :已签约。指二级商户的超级管理员已完成签约。注意:若申请单被驳回,商户修改了商户主体名称、法人名称、超级管理员信息、主体类型等信息,则需重新签约。 |
| | | 3、NOT_SIGNABLE:不可签约。该状态下,暂不支持超级管理员签约。一般为申请单处于已驳回、已冻结、机器校验中状态,无法签约。 |
| | | */ |
| | | UNSIGNED(1, "UNSIGNED"), |
| | | SIGNED(2, "SIGNED"), |
| | | NOT_SIGNABLE(3, "NOT_SIGNABLE"); |
| | | |
| | | WxApplyMentSignStateEnum(Integer code, String text){ |
| | | init(code, text); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.shop.enums; |
| | | |
| | | import com.ruoyi.shop.enums.dict.IDict; |
| | | |
| | | public enum WxApplyMentStateEnum implements IDict<Integer> { |
| | | /** |
| | | * 审核状态 |
| | | 1:CHECKING:资料校验中 |
| | | 2:ACCOUNT_NEED_VERIFY:待账户验证 |
| | | 3:AUDITING:审核中 |
| | | 4:REJECTED:已驳回 |
| | | 5:NEED_SIGN:待签约 |
| | | 6:FINISH:完成 |
| | | 7:FROZEN:已冻结 |
| | | 8:CANCELED:已作废 |
| | | */ |
| | | CHECKING(1, "CHECKING"), |
| | | ACCOUNT_NEED_VERIFY(2, "ACCOUNT_NEED_VERIFY"), |
| | | AUDITING(3, "AUDITING"), |
| | | REJECTED(4, "REJECTED"), |
| | | NEED_SIGN(5, "NEED_SIGN"), |
| | | FINISH(6, "FINISH"), |
| | | FROZEN(7, "FROZEN"), |
| | | CANCELED(8, "CANCELED"); |
| | | |
| | | WxApplyMentStateEnum(Integer code, String text){ |
| | | init(code, text); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.shop.enums.dict; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 字典bean |
| | | * 只有code和text,可用于展示下拉框 |
| | | * |
| | | * @author luozhan |
| | | */ |
| | | @Data |
| | | public class DictBean<T> implements IDict<T> { |
| | | private final T code; |
| | | private final String text; |
| | | } |
New file |
| | |
| | | package com.ruoyi.shop.enums.dict; |
| | | |
| | | import java.lang.reflect.Field; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | | |
| | | |
| | | /** |
| | | * 字典接口 |
| | | * <p> |
| | | * 自定义的字典枚举类实现本接口后可省略属性code和text,以及对应的get方法 |
| | | * 在构造方法中只需调用init方法即可初始化 |
| | | * |
| | | * @author luozhan |
| | | * @date 2021-12 |
| | | */ |
| | | public interface IDict<T> { |
| | | /** |
| | | * 通过code获取value |
| | | * |
| | | * @param clazz 枚举class |
| | | * @param code code |
| | | * @return text |
| | | */ |
| | | static <T> String getTextByCode(Class<? extends IDict<T>> clazz, T code) { |
| | | return Stream.of(clazz.getEnumConstants()) |
| | | .filter((IDict<T> e) -> e.getCode().equals(code)) |
| | | .map(IDict::getText) |
| | | .findAny().orElse(""); |
| | | } |
| | | |
| | | /** |
| | | * 通过text获取code |
| | | * |
| | | * @param clazz 枚举class |
| | | * @param text text |
| | | * @return code |
| | | */ |
| | | static <T> T getCodeByText(Class<? extends IDict<T>> clazz, String text) { |
| | | return Stream.of(clazz.getEnumConstants()) |
| | | .filter((IDict<T> e) -> e.getText().equals(text)) |
| | | .map(IDict::getCode) |
| | | .findAny().orElse(null); |
| | | } |
| | | |
| | | /** |
| | | * 通过code获取字典枚举实例 |
| | | * |
| | | * @param clazz 枚举class |
| | | * @param code code |
| | | * @param <T> 字典code类型 |
| | | * @param <R> 枚举类型 |
| | | * @return 字典枚举实例 |
| | | */ |
| | | @SuppressWarnings("unchecked") |
| | | static <T, R extends IDict<T>> R getByCode(Class<? extends IDict<T>> clazz, T code) { |
| | | return Stream.of(clazz.getEnumConstants()) |
| | | .filter((IDict<T> e) -> (e.getCode().equals(code))) |
| | | .map(v -> (R) v) |
| | | .findAny() |
| | | .orElse(null); |
| | | } |
| | | |
| | | /** |
| | | * 获取给定的字典枚举项(常用下拉框数据请求) |
| | | * |
| | | * @param enums 可指定需要哪些项 |
| | | * @return List |
| | | */ |
| | | @SafeVarargs |
| | | static <T, E extends IDict<T>> List<IDict<T>> getItems(E... enums) { |
| | | return Stream.of(enums) |
| | | .map(DictPool::getDict) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | /** |
| | | * 获取所有字典枚举项,除开指定的枚举 |
| | | * |
| | | * @param exclude 指定排除的枚举 |
| | | * @return List |
| | | */ |
| | | @SafeVarargs |
| | | @SuppressWarnings("unchecked") |
| | | static <T, E extends IDict<T>> List<IDict<T>> getItemsExclude(E... exclude) { |
| | | Class<IDict<T>> clazz = (Class<IDict<T>>) exclude.getClass().getComponentType(); |
| | | IDict<T>[] allEnum = clazz.getEnumConstants(); |
| | | List<IDict<T>> excludeList = Arrays.asList(exclude); |
| | | return Stream.of(allEnum) |
| | | .filter(e -> !excludeList.contains(e)) |
| | | .map(DictPool::getDict) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | /** |
| | | * 获取所有字典枚举项(常用下拉框数据请求) |
| | | * 枚举值上标记@Deprecated的不会返回 |
| | | * |
| | | * @param clazz 字典枚举类 |
| | | * @return List |
| | | */ |
| | | static <T> List<IDict<T>> getAll(Class<? extends IDict<T>> clazz) { |
| | | Map<String, Field> fieldCache = Arrays.stream(clazz.getDeclaredFields()). |
| | | filter(Field::isEnumConstant). |
| | | collect(Collectors.toMap(Field::getName, Function.identity())); |
| | | IDict<T>[] allEnum = clazz.getEnumConstants(); |
| | | return Stream.of(allEnum) |
| | | .filter(e -> !fieldCache.get(((Enum<?>) e).name()).isAnnotationPresent(Deprecated.class)) |
| | | .map(DictPool::getDict) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | /** |
| | | * 初始化 |
| | | * |
| | | * @param code 字典编码 |
| | | * @param text 字典文本 |
| | | */ |
| | | default void init(T code, String text) { |
| | | DictPool.putDict(this, code, text); |
| | | } |
| | | |
| | | /** |
| | | * 获取编码 |
| | | * |
| | | * @return 编码 |
| | | */ |
| | | default T getCode() { |
| | | return DictPool.getDict(this).getCode(); |
| | | } |
| | | |
| | | /** |
| | | * 获取文本 |
| | | * |
| | | * @return 文本 |
| | | */ |
| | | default String getText() { |
| | | return DictPool.getDict(this).getText(); |
| | | } |
| | | |
| | | |
| | | @SuppressWarnings("all") |
| | | class DictPool { |
| | | private static final Map<IDict, DictBean> DICT_MAP = new ConcurrentHashMap<>(); |
| | | |
| | | private static final Map<String, Class<? extends IDict>> DICT_NAME_CLASS_MAP = new ConcurrentHashMap<>(); |
| | | |
| | | static <T> void putDict(IDict<T> dict, T code, String text) { |
| | | DICT_NAME_CLASS_MAP.put(dict.getClass().getName(), dict.getClass()); |
| | | DICT_MAP.put(dict, new DictBean<>(code, text)); |
| | | } |
| | | |
| | | public static List<IDict<Object>> getDict(String dictName) { |
| | | Class<? extends IDict> aClass = DICT_NAME_CLASS_MAP.get(dictName); |
| | | return IDict.getAll((Class<? extends IDict<Object>>) aClass); |
| | | } |
| | | |
| | | static <K extends IDict<T>, T> DictBean<T> getDict(K dict) { |
| | | return DICT_MAP.get(dict); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { |
| | | HttpServletRequest request = (HttpServletRequest) servletRequest; |
| | | HttpServletResponse response = (HttpServletResponse) servletResponse; |
| | | |
| | | String requestUrl = request.getRequestURI(); |
| | | String requestUrlUpperCase = requestUrl.toUpperCase(); |
| | | if(requestUrlUpperCase.contains("EXPORT") |
| | | ||requestUrlUpperCase.contains("IMPORTTEMPLATE") |
| | | ){ |
| | | filterChain.doFilter(request, response); |
| | | return; |
| | | } |
| | | RepeatedlyRequestWrapper wrapper = new RepeatedlyRequestWrapper(request, response); |
| | | getRequestParams(wrapper); |
| | | |
| | |
| | | |
| | | // 返回的结果 |
| | | String content = responseWrapper.getTextContent(); |
| | | String requestUrl = request.getRequestURI(); |
| | | log.info("-------------------- Response Data ----------------------"); |
| | | log.info(requestUrl + " -> " + content); |
| | | |
| | |
| | | * @param shopId |
| | | */ |
| | | void clearShopStaffRelation(@Param("shopId") Long shopId); |
| | | |
| | | /** |
| | | * @description |
| | | * @author jqs |
| | | * @date 2023/8/3 13:33 |
| | | * @param shopId |
| | | * @param codeUrl |
| | | * @return void |
| | | */ |
| | | void updateShopCodeUrl(@Param("shopId") Long shopId,@Param("codeUrl") String codeUrl); |
| | | } |
| | |
| | | package com.ruoyi.shop.scheduler; |
| | | |
| | | |
| | | import com.ruoyi.common.core.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.core.utils.uuid.IdUtils; |
| | | import com.ruoyi.shop.domain.pojo.shop.ShopAuthentication; |
| | | import com.ruoyi.shop.service.shop.ShopService; |
| | | import com.ruoyi.shop.service.task.ShopTaskService; |
| | | import com.ruoyi.system.api.domain.poji.shop.Shop; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | |
| | | @Resource |
| | | private ShopTaskService shopTaskService; |
| | | |
| | | @Resource |
| | | private ShopService shopService; |
| | | |
| | | |
| | | /** |
| | | * 定时检查跟进任务状态 |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 0 0/1 * * * ? |
| | | * 定时检查 每分钟检查一次 微信二级商户进件状态 |
| | | */ |
| | | @Scheduled(cron="0 0/1 * * * ?") |
| | | private void queryEcommerceApplyMentsStatus(){ |
| | | if(schedulerUtils.getSchedulerRun()) { |
| | | log.info("--------------------定时检查微信二级商户进件状态任务开始执行--------------------"); |
| | | shopService.queryEcommerceApplyMentsStatus(); |
| | | log.info("--------------------定时检查微信二级商户进件状态任务结束执行--------------------"); |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.shop.service.impl.shop; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.binarywang.wxpay.bean.ecommerce.ApplymentsStatusResult; |
| | | import com.google.common.base.Joiner; |
| | | import com.ruoyi.shop.domain.pojo.shop.ShopAuthentication; |
| | | import com.ruoyi.shop.enums.WxApplyMentSignStateEnum; |
| | | import com.ruoyi.shop.enums.WxApplyMentStateEnum; |
| | | import com.ruoyi.shop.enums.dict.IDict; |
| | | import com.ruoyi.shop.mapper.shop.ShopAuthenticationMapper; |
| | | import com.ruoyi.shop.service.shop.ShopAuthenticationService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class ShopAuthenticationServiceImpl extends ServiceImpl<ShopAuthenticationMapper, ShopAuthentication> implements ShopAuthenticationService { |
| | | |
| | | @Override |
| | | public List<ShopAuthentication> getShopAuthNeedUpdateStatus() { |
| | | List<Integer> auditStatusList = Arrays.asList(1, 2, 3, 5); |
| | | |
| | | LambdaQueryWrapper<ShopAuthentication> queryWrapper = Wrappers.lambdaQuery(); |
| | | queryWrapper.in(ShopAuthentication::getAuditStatus, auditStatusList); |
| | | queryWrapper.isNotNull(ShopAuthentication::getApplymentId); |
| | | return this.list(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public void updateAuditStatusByApplymentId(String applymentId, ApplymentsStatusResult result) { |
| | | // WxApplyMentStateEnum |
| | | String applymentState = result.getApplymentState(); |
| | | Integer auditStatus = IDict.getCodeByText(WxApplyMentStateEnum.class, applymentState); |
| | | |
| | | Integer signState = IDict.getCodeByText(WxApplyMentSignStateEnum.class, result.getSignState()); |
| | | |
| | | LambdaUpdateWrapper<ShopAuthentication> updateWrapper = Wrappers.lambdaUpdate(); |
| | | updateWrapper.eq(ShopAuthentication::getApplymentId, applymentId) |
| | | .set(ShopAuthentication::getAuditStatus, auditStatus) |
| | | .set(ShopAuthentication::getSignState, signState); |
| | | |
| | | if(WxApplyMentStateEnum.ACCOUNT_NEED_VERIFY.getCode().equals(auditStatus)){ |
| | | // ACCOUNT_NEED_VERIFY 待账户验证 |
| | | updateWrapper.set(ShopAuthentication::getLegalValidationUrl, result.getLegalValidationUrl()); |
| | | ApplymentsStatusResult.AccountValidation accountValidation = result.getAccountValidation(); |
| | | if(null != accountValidation) { |
| | | updateWrapper.set(ShopAuthentication::getAvAccountName, accountValidation.getAccountName()) |
| | | .set(ShopAuthentication::getAvAccountNo, accountValidation.getAccountNo()) |
| | | .set(ShopAuthentication::getAvPayAmount, accountValidation.getPayAmount()) |
| | | .set(ShopAuthentication::getDaNumber, accountValidation.getDestinationAccountNumber()) |
| | | .set(ShopAuthentication::getDaName, accountValidation.getDestinationAccountName()) |
| | | .set(ShopAuthentication::getDaBank, accountValidation.getDestinationAccountBank()) |
| | | .set(ShopAuthentication::getDaCity, accountValidation.getCity()) |
| | | .set(ShopAuthentication::getDaRemark, accountValidation.getRemark()) |
| | | .set(ShopAuthentication::getDaDeadline, accountValidation.getDeadline()); |
| | | } |
| | | } else if(WxApplyMentStateEnum.NEED_SIGN.getCode().equals(auditStatus)){ |
| | | // NEED_SIGN 待签约 |
| | | updateWrapper.set(ShopAuthentication::getSignUrl, result.getSignUrl()); |
| | | updateWrapper.set(ShopAuthentication::getSubMchid, result.getSubMchid()); |
| | | |
| | | } else if(WxApplyMentStateEnum.FINISH.getCode().equals(auditStatus)){ |
| | | // FINISH 完成 |
| | | updateWrapper.set(ShopAuthentication::getSubMchid, result.getSubMchid()); |
| | | |
| | | } else if(WxApplyMentStateEnum.REJECTED.getCode().equals(auditStatus) |
| | | || WxApplyMentStateEnum.FROZEN.getCode().equals(auditStatus)){ |
| | | List<ApplymentsStatusResult.AuditDetail> auditDetail = result.getAuditDetail(); |
| | | if(null != auditDetail && !auditDetail.isEmpty()){ |
| | | List<String> paramNameList = auditDetail.stream().map(ApplymentsStatusResult.AuditDetail::getParamName).collect(Collectors.toList()); |
| | | List<String> rejectReason = auditDetail.stream().map(ApplymentsStatusResult.AuditDetail::getRejectReason).collect(Collectors.toList()); |
| | | updateWrapper.set(ShopAuthentication::getAdParamName, Joiner.on(";").join(paramNameList)) |
| | | .set(ShopAuthentication::getAdRejectReason, Joiner.on(";").join(rejectReason)); |
| | | } |
| | | |
| | | } |
| | | this.update(updateWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public ShopAuthentication getByShopId(Long shopId) { |
| | | LambdaQueryWrapper<ShopAuthentication> queryWrapper = Wrappers.lambdaQuery(); |
| | | queryWrapper.eq(ShopAuthentication::getShopId, shopId) |
| | | .last(" limit 1 "); |
| | | return this.getOne(queryWrapper); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.shop.service.impl.shop; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.shop.domain.dto.MgtShopProportionEditDto; |
| | | import com.ruoyi.shop.domain.pojo.shop.ShopAuthentication; |
| | | import com.ruoyi.shop.domain.pojo.shop.ShopProportion; |
| | | import com.ruoyi.shop.mapper.shop.ShopProportionMapper; |
| | | import com.ruoyi.shop.service.shop.ShopProportionService; |
| | |
| | | shopProportionNew.setUpdateUserId(mgtShopProportionEditDto.getUserId()); |
| | | this.saveOrUpdate(shopProportionNew); |
| | | } |
| | | |
| | | @Override |
| | | public ShopProportion getByShopId(Long shopId) { |
| | | LambdaQueryWrapper<ShopProportion> queryWrapper = Wrappers.lambdaQuery(); |
| | | queryWrapper.eq(ShopProportion::getShopId, shopId) |
| | | .eq(ShopProportion::getDelFlag, 0) |
| | | .last(" limit 1 "); |
| | | return this.getOne(queryWrapper); |
| | | } |
| | | } |
| | |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.github.binarywang.wxpay.bean.ecommerce.ApplymentsResult; |
| | | import com.github.binarywang.wxpay.bean.ecommerce.ApplymentsStatusResult; |
| | | import com.github.binarywang.wxpay.exception.WxPayException; |
| | | import com.ruoyi.common.core.constant.CacheConstants; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | |
| | | import com.ruoyi.shop.domain.pojo.shop.*; |
| | | import com.ruoyi.shop.domain.pojo.task.ShopFile; |
| | | import com.ruoyi.shop.domain.vo.*; |
| | | import com.ruoyi.shop.enums.WxApplyMentStateEnum; |
| | | import com.ruoyi.shop.mapper.shop.ShopMapper; |
| | | import com.ruoyi.shop.service.shop.*; |
| | | import com.ruoyi.shop.service.task.MemberTaskService; |
| | |
| | | import com.ruoyi.system.api.domain.vo.*; |
| | | import com.ruoyi.system.api.service.*; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | |
| | | private RemoteSysStaffService remoteSysStaffService; |
| | | |
| | | @Resource |
| | | private RemoteFileService remoteFileService; |
| | | |
| | | @Resource |
| | | private ShopTaskService shopTaskService; |
| | | |
| | | @Resource |
| | |
| | | |
| | | /** |
| | | * 获取商户详情 |
| | | * |
| | | * @param shopId |
| | | * @return |
| | | */ |
| | |
| | | if(newShop){ |
| | | //生成商户关联记录 |
| | | initNewShop(shop,mgtEditShopDto.getUserId()); |
| | | CodeGetDto codeGetDto = new CodeGetDto(); |
| | | String url = "https://wxapp.hhhrt.cn/mini/activity?activityId="+shop.getShopId(); |
| | | codeGetDto.setUrl(url); |
| | | codeGetDto.setFileName("shop-"+shop.getShopId()); |
| | | String codeUrl = remoteFileService.getAppOrderTotal(codeGetDto).getData(); |
| | | shop.setShopCode(codeUrl); |
| | | this.saveOrUpdate(shop); |
| | | } |
| | | } |
| | | |
| | |
| | | merHomeShopTotalVo.setShopTurnover(orderVo.getShopTurnover()); |
| | | merHomeShopTotalVo.setCycleSurp(shopTotal.getUseableCyclePerson()); |
| | | merHomeShopTotalVo.setExplorationSurp(shopTotal.getUseableExperiencePerson()); |
| | | merHomeShopTotalVo.setPlatformBirthdayFlag(shop.getPlatformBirthdayFlag()); |
| | | merHomeShopTotalVo.setPlatformCouponFlag(shop.getPlatformCouponFlag()); |
| | | return merHomeShopTotalVo; |
| | | } |
| | | |
| | |
| | | shop.setUpdateTime(new Date()); |
| | | shopMapper.updateShop(shop); |
| | | } |
| | | |
| | | @Override |
| | | public void queryEcommerceApplyMentsStatus() { |
| | | List<ShopAuthentication> list = shopAuthenticationService.getShopAuthNeedUpdateStatus(); |
| | | list.forEach(item -> queryApplyStatusByApplymentId(item.getApplymentId(), item.getShopId())); |
| | | } |
| | | |
| | | /** |
| | | * 调用微信接口查询申请审核状态 |
| | | * @param applymentId |
| | | */ |
| | | private void queryApplyStatusByApplymentId(String applymentId, Long shopId) { |
| | | try { |
| | | if (StringUtils.isNotBlank(applymentId)) { |
| | | ApplymentsStatusResult result = wechatPayUtils.queryApplyStatusByApplymentId(applymentId); |
| | | shopAuthenticationService.updateAuditStatusByApplymentId(applymentId, result); |
| | | String applymentState = result.getApplymentState(); |
| | | if(WxApplyMentStateEnum.FINISH.getText().equals(applymentState)){ |
| | | applySuccessUpdateShopStatus(shopId); |
| | | } |
| | | } |
| | | } catch (WxPayException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 商户进件审核完成,更新商户状态 |
| | | * @param shopId |
| | | */ |
| | | private void applySuccessUpdateShopStatus(Long shopId){ |
| | | // 更新商户状态为正常 |
| | | Shop shop = this.getById(shopId); |
| | | Integer shopStatus = handelShopStatus(shop.getFrozenFlag(), shop.getCooperativeFlag(), 1); |
| | | LambdaUpdateWrapper<Shop> updateWrapper = Wrappers.lambdaUpdate(); |
| | | updateWrapper.eq(Shop::getShopId, shopId) |
| | | .set(Shop::getShopStatus, shopStatus) |
| | | .set(Shop::getAuthFlag, 1); |
| | | this.update(updateWrapper); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.shop.mapper.shop.ShopStaffMapper; |
| | | import com.ruoyi.shop.service.shop.ShopStaffService; |
| | | import com.ruoyi.system.api.domain.dto.AppEditUserDto; |
| | | import com.ruoyi.system.api.domain.dto.CodeGetDto; |
| | | import com.ruoyi.system.api.domain.dto.MerEditUserDto; |
| | | import com.ruoyi.system.api.domain.dto.MgtShopStaffEditDto; |
| | | import com.ruoyi.system.api.domain.poji.shop.Shop; |
| | | import com.ruoyi.system.api.domain.vo.MerStaffInfoVo; |
| | | import com.ruoyi.system.api.service.RemoteFileService; |
| | | import com.ruoyi.system.api.service.RemoteSysStaffService; |
| | | import com.ruoyi.system.api.service.RemoteUserService; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | @Resource |
| | | private RemoteSysStaffService remoteSysStaffService; |
| | | |
| | | @Resource |
| | | private RemoteFileService remoteFileService; |
| | | /** |
| | | * |
| | | * @param userId |
| | |
| | | merStaffInfoVo.setBusinessTime(shop.getBusinessStartTime()+"-"+shop.getBusinessEndTime()); |
| | | merStaffInfoVo.setShopType(shop.getShopType()); |
| | | merStaffInfoVo.setShopNumber(shop.getShopNumber()); |
| | | String shopCodeUrl = "https://wxapp.hhhrt.cn/mini/shop?shopId="+shop.getShopId(); |
| | | merStaffInfoVo.setShopCodeUrl(shopCodeUrl); |
| | | if(StringUtils.isNotBlank(shop.getShopCode())){ |
| | | merStaffInfoVo.setShopCodeUrl(shop.getShopCode()); |
| | | }else{ |
| | | CodeGetDto codeGetDto = new CodeGetDto(); |
| | | String url = "https://wxapp.hhhrt.cn/mini/activity?activityId="+shop.getShopId(); |
| | | codeGetDto.setUrl(url); |
| | | codeGetDto.setFileName("shop-"+shop.getShopId()); |
| | | String codeUrl = remoteFileService.getAppOrderTotal(codeGetDto).getData(); |
| | | merStaffInfoVo.setShopCodeUrl(codeUrl); |
| | | shopStaffMapper.updateShopCodeUrl(shop.getShopId(),codeUrl); |
| | | } |
| | | return merStaffInfoVo; |
| | | } |
| | | |
| | |
| | | agencyTaskRecord.setDelFlag(0); |
| | | agencyTaskRecord.setUserId(merFollowAgencyTaskDto.getUserId()); |
| | | agencyTaskRecord.setFollowType(merFollowAgencyTaskDto.getFollowType()); |
| | | agencyTaskRecord.setCustomeFollowType(merFollowAgencyTaskDto.getCustomeFollowType()); |
| | | agencyTaskRecord.setCallPhone(merFollowAgencyTaskDto.getCallPhone()); |
| | | agencyTaskRecord.setCallTime(followPhoneDto.getCallTime()); |
| | | agencyTaskRecord.setFollowContent(followPhoneDto.getFollowContent()); |
| | |
| | | } |
| | | }else{ |
| | | agencyTaskRecord = new AgencyTaskRecord(); |
| | | agencyTaskRecord.setTaskId(merFollowAgencyTaskDto.getTaskId()); |
| | | agencyTaskRecord.setDelFlag(0); |
| | | agencyTaskRecord.setUserId(merFollowAgencyTaskDto.getUserId()); |
| | | agencyTaskRecord.setFollowType(merFollowAgencyTaskDto.getFollowType()); |
| | | agencyTaskRecord.setCustomeFollowType(merFollowAgencyTaskDto.getCustomeFollowType()); |
| | | agencyTaskRecord.setFollowContent(merFollowAgencyTaskDto.getFollowContent()); |
| | | agencyTaskRecord.setCreateTime(new Date()); |
| | | //创建任务详情文件 |
| | | String picture = merFollowAgencyTaskDto.getPicture(); |
| | | String video = merFollowAgencyTaskDto.getVideo(); |
| | |
| | | import com.ruoyi.shop.service.task.MemberTaskService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.shop.service.task.TaskFileService; |
| | | import com.ruoyi.system.api.domain.dto.MemberTotalChangeDto; |
| | | import com.ruoyi.system.api.domain.vo.MemberTaskSimpleVo; |
| | | import com.ruoyi.system.api.service.RemoteMemberService; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | */ |
| | | @Override |
| | | public List<MerMemberTaskPageVo> pageMerMemberTask(Page page, MerMemberTaskPageDto merMemberTaskPageDto){ |
| | | String today = DateUtils.parseDateToStr("YYYY-MM-DD",new Date()); |
| | | List<MerMemberTaskPageVo> merMemberTaskPageVoList = memberTaskMapper.pageMerMemberTask(page, merMemberTaskPageDto); |
| | | if(merMemberTaskPageVoList!=null&&!merMemberTaskPageVoList.isEmpty()){ |
| | | String taskDate; |
| | | for(MerMemberTaskPageVo merMemberTaskPageVo : merMemberTaskPageVoList){ |
| | | taskDate = merMemberTaskPageVo.getTaskDate(); |
| | | if(today.equals(taskDate)){ |
| | | merMemberTaskPageVo.setTodayFlag(1); |
| | | }else{ |
| | | merMemberTaskPageVo.setTodayFlag(0); |
| | | } |
| | | } |
| | | } |
| | | return merMemberTaskPageVoList; |
| | | } |
| | | |
| | |
| | | memberTask.setTaskContent(merCreateMemberTaskDto.getTaskContent()); |
| | | memberTask.setCreateTime(new Date()); |
| | | this.saveOrUpdate(memberTask); |
| | | MemberTotalChangeDto memberTotalChangeDto = new MemberTotalChangeDto(); |
| | | memberTotalChangeDto.setNextTaskTime(merCreateMemberTaskDto.getTaskDate()); |
| | | remoteMemberService.changeMemberTotal(memberTotalChangeDto); |
| | | } |
| | | |
| | | /** |
| | |
| | | memberTaskRecord.setDelFlag(0); |
| | | memberTaskRecord.setUserId(merFollowMemberTaskDto.getUserId()); |
| | | memberTaskRecord.setFollowType(merFollowMemberTaskDto.getFollowType()); |
| | | memberTaskRecord.setCustomeFollowType(merFollowMemberTaskDto.getCustomeFollowType()); |
| | | memberTaskRecord.setCallPhone(merFollowMemberTaskDto.getCallPhone()); |
| | | memberTaskRecord.setFollowContent(followPhoneDto.getFollowContent()); |
| | | memberTaskRecord.setCallTime(followPhoneDto.getCallTime()); |
| | |
| | | memberTaskRecord.setDelFlag(0); |
| | | memberTaskRecord.setUserId(merFollowMemberTaskDto.getUserId()); |
| | | memberTaskRecord.setFollowType(merFollowMemberTaskDto.getFollowType()); |
| | | memberTaskRecord.setCustomeFollowType(merFollowMemberTaskDto.getCustomeFollowType()); |
| | | memberTaskRecord.setFollowContent(merFollowMemberTaskDto.getFollowContent()); |
| | | memberTaskRecord.setCreateTime(new Date()); |
| | | // 保存或更新会员任务记录 |
| | |
| | | } |
| | | memberTask.setCreateTime(new Date()); |
| | | this.saveOrUpdate(memberTask); |
| | | MemberTotalChangeDto memberTotalChangeDto = new MemberTotalChangeDto(); |
| | | memberTotalChangeDto.setNextTaskTime(merFollowMemberTaskDto.getNextTaskDate()); |
| | | remoteMemberService.changeMemberTotal(memberTotalChangeDto); |
| | | } |
| | | } |
| | | |
| | |
| | | shopTaskRecord.setTaskId(taskId); |
| | | shopTaskRecord.setUserId(mgtFollowShopTaskDto.getUserId()); |
| | | shopTaskRecord.setFollowType(2); |
| | | shopTaskRecord.setCustomFollowType(mgtFollowShopTaskDto.getFollowType()); |
| | | shopTaskRecord.setCustomeFollowType(mgtFollowShopTaskDto.getFollowType()); |
| | | shopTaskRecord.setFollowContent(mgtFollowShopTaskDto.getFollowContent()); |
| | | shopTaskRecord.setCreateTime(nowTime); |
| | | shopTaskRecordService.saveOrUpdate(shopTaskRecord); |
| | |
| | | shopTaskRecord.setUserId(staffFollowShopTaskDto.getUserId()); |
| | | shopTaskRecord.setFollowType(staffFollowShopTaskDto.getFollowType()); |
| | | shopTaskRecord.setFollowContent(staffFollowShopTaskDto.getFollowContent()); |
| | | shopTaskRecord.setCustomFollowType(staffFollowShopTaskDto.getCustomFollowType()); |
| | | shopTaskRecord.setCustomeFollowType(staffFollowShopTaskDto.getCustomeFollowType()); |
| | | shopTaskRecord.setCreateTime(new Date()); |
| | | // 保存或更新会员任务记录 |
| | | shopTaskRecordService.saveOrUpdate(shopTaskRecord); |
| | |
| | | package com.ruoyi.shop.service.shop; |
| | | |
| | | import com.github.binarywang.wxpay.bean.ecommerce.ApplymentsStatusResult; |
| | | import com.ruoyi.shop.domain.pojo.shop.ShopAuthentication; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface ShopAuthenticationService extends IService<ShopAuthentication> { |
| | | |
| | | /** |
| | | * 获取需要更新状态的 微信二级商户认证审核 |
| | | * @return |
| | | */ |
| | | List<ShopAuthentication> getShopAuthNeedUpdateStatus(); |
| | | |
| | | /** |
| | | * 修改微信审核状态 |
| | | * @param applymentId |
| | | * @param result |
| | | */ |
| | | void updateAuditStatusByApplymentId(String applymentId, ApplymentsStatusResult result); |
| | | |
| | | /** |
| | | * 获取商户认证信息 |
| | | * @param shopId |
| | | * @return |
| | | */ |
| | | ShopAuthentication getByShopId(Long shopId); |
| | | } |
| | |
| | | * @return void |
| | | */ |
| | | void editMgtShopProportion(MgtShopProportionEditDto mgtShopProportionEditDto); |
| | | |
| | | /** |
| | | * 获取商户分成比例 |
| | | * @param shopId |
| | | * @return |
| | | */ |
| | | ShopProportion getByShopId(Long shopId); |
| | | } |
| | |
| | | * @return void |
| | | */ |
| | | void editShopCustomStatus(StaffShopCCEditDto staffShopCCEditDto); |
| | | |
| | | /** |
| | | * 微信二级商户进件状态 定时任务检测 |
| | | */ |
| | | void queryEcommerceApplyMentsStatus(); |
| | | } |
| | |
| | | @Component |
| | | @AllArgsConstructor |
| | | public class WechatPayUtils { |
| | | |
| | | private final WxPayService wxService; |
| | | |
| | | /** |
| | | * 电商二级商户进件(提交申请单) |
| | | */ |
| | | public void ecommerceApply(ShopAuthentication shopAuthentication, String applyNumber, Shop shop) throws WxPayException { |
| | | public ApplymentsResult ecommerceApply(ShopAuthentication shopAuthentication, String applyNumber, Shop shop) throws WxPayException { |
| | | EcommerceService ecommerceService = wxService.getEcommerceService(); |
| | | ApplymentsRequest request = new ApplymentsRequest(); |
| | | //生成提交类 |
| | |
| | | request.setBusinessAdditionPics(shopAuthentication.getBaPics()); |
| | | request.setBusinessAdditionDesc(shopAuthentication.getBaDesc()); |
| | | |
| | | ApplymentsResult result = ecommerceService.createApply(request); |
| | | return ecommerceService.createApply(request); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 通过查询申请状态API查询二级商户入驻申请结果 |
| | | * @param applyNumber 业务申请编号 |
| | | * @param applymentId 微信支付申请单号 |
| | | * @return 申请状态 |
| | | * @throws WxPayException |
| | | */ |
| | | public ApplymentsStatusResult queryApplyStatusByOutRequestNo(String applyNumber) throws WxPayException { |
| | | return wxService.getEcommerceService().queryApplyStatusByOutRequestNo(applyNumber); |
| | | public ApplymentsStatusResult queryApplyStatusByApplymentId(String applymentId) throws WxPayException { |
| | | return wxService.getEcommerceService().queryApplyStatusByApplymentId(applymentId); |
| | | } |
| | | |
| | | } |
| | |
| | | ts.cooperation_end_time cooperationEndTime |
| | | FROM t_shop ts |
| | | WHERE ts.del_flag = 0 AND ts.belong_shop_id = #{param.shopId} |
| | | <if test="param.shopStatus!=null and param.shopStatus!=''"> |
| | | AND ts.shop_status = #{param.shopStatus} |
| | | <if test="param.shopStatus!=null and param.shopStatus==1"> |
| | | AND ts.shop_status = 1 |
| | | </if> |
| | | <if test="param.shopStatus!=null and param.shopStatus==2"> |
| | | AND ts.frozen_flag = 1 |
| | | </if> |
| | | <if test="param.shopStatus!=null and param.shopStatus==3"> |
| | | AND ts.cooperative_flag = 0 |
| | | </if> |
| | | <if test="param.keyword!=null and param.keyword!=''"> |
| | | AND (ts.shop_name LIKE CONCAT('%',#{param.keyword},'%') OR ts.shopowner_name LIKE CONCAT('%',#{param.keyword},'%') |
| | |
| | | </select> |
| | | |
| | | <select id="getNearbyShop" resultType="com.ruoyi.shop.domain.vo.AppNearShopVo"> |
| | | SELECT ts.shop_id shopId, ACOS( |
| | | COS(RADIANS(#{param.longitude})) * |
| | | COS(RADIANS(ts.shop_latitude)) * |
| | | COS(RADIANS(ts.shop_longitude) - RADIANS(#{param.latitude})) + |
| | | SIN(RADIANS(#{param.longitude})) * |
| | | SIN(RADIANS(ts.shop_latitude)) |
| | | ) * 6378 as distance |
| | | FROM t_shop ts WHERE ts.del_flag = 0 AND ts.shop_status = 1 |
| | | SELECT ts.shop_id shopId, |
| | | 6378.138 * 2 * ASIN(SQRT(POW(SIN(( |
| | | #{param.latitude} * PI() / 180 - ts.shop_latitude * PI() / 180) / 2), 2) |
| | | + COS(#{param.latitude} * PI() / 180) * COS(ts.shop_latitude * PI() / 180) * POW( |
| | | SIN((#{param.longitude} * PI() / 180 - ts.shop_longitude * PI() / 180) / 2), 2 |
| | | ))) AS distance |
| | | FROM t_shop ts |
| | | ORDER BY distance ASC LIMIT 1 |
| | | </select> |
| | | |
| | |
| | | UPDATE t_shop_staff SET del_flag = 1 WHERE del_flag = 0 AND shop_id = #{shopId} |
| | | </update> |
| | | |
| | | <update id="updateShopCodeUrl"> |
| | | UPDATE t_shop SET shop_code = #{codeUrl} WHERE shop_id = #{shopId} |
| | | </update> |
| | | </mapper> |
| | |
| | | tat.task_date taskDate, |
| | | tat.task_content taskContent, |
| | | tmtr.follow_content dealContent, |
| | | tat.emergency_state emergencyState |
| | | tat.emergency_state emergencyState, |
| | | tmtr.create_time followTime |
| | | FROM t_agency_task tat |
| | | LEFT JOIN t_agency_task_record tmtr ON tat.task_id = tmtr.task_id |
| | | WHERE tat.del_flag = 0 AND tat.shop_id = #{param.shopId} AND tat.agency_id = #{param.agencyId} |
| | |
| | | ORDER BY tat.task_date DESC |
| | | </select> |
| | | |
| | | <select id="pageMerAgencyTask" resultType="com.ruoyi.shop.domain.vo.MerAgencySimpleTaskRecordPageVo"> |
| | | <select id="pageMerAgencySimpleTaskRecord" resultType="com.ruoyi.shop.domain.vo.MerAgencySimpleTaskRecordPageVo"> |
| | | SELECT |
| | | tmtr.create_time createTime, |
| | | CASE tmtr.follow_type WHEN 1 THEN "电话跟进" WHEN 2 THEN "手动跟进" END followType, |
| | |
| | | tmtr.task_id taskId, |
| | | tmt.task_date taskDate, |
| | | tmtr.follow_type followType, |
| | | tmtr.custome_follow_type customeFollowType, |
| | | tmtr.call_time callTime, |
| | | tmtr.follow_content followContent, |
| | | tmtr.call_phone callPhone |
| | |
| | | tmtr.task_id taskId, |
| | | tmt.create_time createTime, |
| | | tmtr.follow_type followType, |
| | | tmtr.custome_follow_type customeFollowType, |
| | | tmtr.call_time callTime, |
| | | tmtr.follow_content followContent, |
| | | tmtr.call_phone callPhone |
| | |
| | | tmtr.task_id taskId, |
| | | tmt.create_time createTime, |
| | | tmtr.follow_type followType, |
| | | tmtr.custome_follow_type customeFollowType, |
| | | tmtr.call_time callTime, |
| | | tmtr.follow_content followContent, |
| | | tmtr.call_phone callPhone |
| | |
| | | tmt.task_content taskContent, |
| | | tmtr.follow_content dealContent, |
| | | tmt.emergency_state emergencyState, |
| | | CASE WHEN task_date = #{param.today} THEN 1 ELSE 0 END todayFlag |
| | | CASE tmt.task_status WHEN 1 THEN 1 WHEN 3 THEN 1 ELSE 0 END todayFlag |
| | | FROM t_member_task tmt |
| | | LEFT JOIN t_member_task_record tmtr ON tmt.task_id = tmtr.task_id |
| | | WHERE tmt.del_flag = 0 AND tmt.shop_id = #{param.shopId} AND tmt.user_id = #{param.memberUserId} |
| | |
| | | tmtr.follow_type followType, |
| | | tmtr.call_time callTime, |
| | | tmtr.follow_content followContent, |
| | | tmtr.custome_follow_type customeFollowType, |
| | | tmtr.call_phone callPhone |
| | | FROM t_member_task tmt |
| | | INNER JOIN t_member_task_record tmtr ON tmtr.task_id = tmt.task_id |
| | |
| | | tmtr.task_id taskId, |
| | | tmt.task_date taskDate, |
| | | tmtr.follow_type followType, |
| | | tmtr.custome_follow_type customeFollowType, |
| | | tmtr.call_time callTime, |
| | | tmtr.follow_content followContent, |
| | | tmtr.call_phone callPhone |
| | |
| | | tmtr.task_id taskId, |
| | | tmtr.create_time createTime, |
| | | CASE tmtr.follow_type WHEN 1 THEN "电话跟进" WHEN 2 THEN "手动跟进" END followType, |
| | | tmtr.custom_follow_type customFollowType, |
| | | tmtr.custome_follow_type customeFollowType, |
| | | tmtr.follow_content followContent, |
| | | tmtr.call_time callTime, |
| | | tmtr.call_phone callPhone |
| | |
| | | tmtr.task_id taskId, |
| | | tmtr.create_time createTime, |
| | | CASE tmtr.follow_type WHEN 1 THEN "电话跟进" WHEN 2 THEN "手动跟进" END followType, |
| | | tmtr.custom_follow_type customFollowType, |
| | | tmtr.custome_follow_type customeFollowType, |
| | | tmtr.follow_content followContent, |
| | | tmtr.call_time callTime, |
| | | tmtr.call_phone callPhone |
| | |
| | | tmtr.task_id taskId, |
| | | tmtr.create_time createTime, |
| | | CASE tmtr.follow_type WHEN 1 THEN "电话跟进" WHEN 2 THEN "手动跟进" END followType, |
| | | tmtr.custome_follow_type customeFollowType, |
| | | tmtr.follow_content followContent, |
| | | tmtr.call_time callTime, |
| | | tmtr.call_phone callPhone |
| | |
| | | Long userId = SecurityUtils.getUserId(); |
| | | mgtOperLogPageDto.setUserId(userId); |
| | | Page<MgtOperLogPageVo> page = new Page<>(); |
| | | page.setSize(2000); |
| | | if(page.getSize()>5000){ |
| | | page.setSize(5000); |
| | | page.setCurrent(1); |
| | | } |
| | | List<MgtOperLogPageVo> mgtOperLogPageVoList = customConfigService.pageOperLog(page, mgtOperLogPageDto); |
| | | ExcelUtil<MgtOperLogPageVo> util = new ExcelUtil<MgtOperLogPageVo>(MgtOperLogPageVo.class); |
| | | util.exportExcel(response, mgtOperLogPageVoList, "操作日志"); |
| | |
| | | Long userId = SecurityUtils.getUserId(); |
| | | mgtStaffSuggestPageDto.setUserId(userId); |
| | | Page<MgtStaffSuggestPageVo> page = new Page<>(); |
| | | page.setSize(2000); |
| | | if(page.getSize()>5000){ |
| | | page.setSize(5000); |
| | | page.setCurrent(1); |
| | | } |
| | | List<MgtStaffSuggestPageVo> staffSuggestPageVoList = staffSuggestService.pageMgtStaffSuggest(page,mgtStaffSuggestPageDto); |
| | | ExcelUtil<MgtStaffSuggestPageVo> util = new ExcelUtil<MgtStaffSuggestPageVo>(MgtStaffSuggestPageVo.class); |
| | | util.exportExcel(response, staffSuggestPageVoList, "员工建议列表"); |
| | |
| | | public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { |
| | | HttpServletRequest request = (HttpServletRequest) servletRequest; |
| | | HttpServletResponse response = (HttpServletResponse) servletResponse; |
| | | |
| | | String requestUrl = request.getRequestURI(); |
| | | String requestUrlUpperCase = requestUrl.toUpperCase(); |
| | | if(requestUrlUpperCase.contains("EXPORT") |
| | | ||requestUrlUpperCase.contains("IMPORTTEMPLATE") |
| | | ||requestUrlUpperCase.contains("GETAPPAGREEMENT")){ |
| | | filterChain.doFilter(request, response); |
| | | return; |
| | | } |
| | | RepeatedlyRequestWrapper wrapper = new RepeatedlyRequestWrapper(request, response); |
| | | getRequestParams(wrapper); |
| | | |
| | |
| | | |
| | | // 返回的结果 |
| | | String content = responseWrapper.getTextContent(); |
| | | String requestUrl = request.getRequestURI(); |
| | | log.info("-------------------- Response Data ----------------------"); |
| | | log.info(requestUrl + " -> " + content); |
| | | |
| | |
| | | import com.ruoyi.system.domain.pojo.config.CustomConfig; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.system.domain.vo.MgtOperLogPageVo; |
| | | import io.lettuce.core.dynamic.annotation.Param; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | mgtBulletinBoardVo.setSalesTotal(mgtBulletinBoardVoOrder.getSalesTotal()); |
| | | mgtBulletinBoardVo.setUnUseOrderTotal(mgtBulletinBoardVoOrder.getUnUseOrderTotal()); |
| | | mgtBulletinBoardVo.setActivityOrderTotal(mgtBulletinBoardVoOrder.getActivityOrderTotal()); |
| | | mgtBulletinBoardVo.setActivityUserTotal(mgtBulletinBoardVoOrder.getActivityUserTotal()); |
| | | // 获取活动信息 |
| | | MgtBulletinBoardVo mgtBulletinBoardVoActivity = remoteActivityService.boardActivityTotal().getData(); |
| | | mgtBulletinBoardVo.setActivityUserTotal(mgtBulletinBoardVoActivity.getActivityUserTotal()); |
| | | //MgtBulletinBoardVo mgtBulletinBoardVoActivity = remoteActivityService.boardActivityTotal().getData(); |
| | | //待回复建议数量 |
| | | Integer countA = remoteMemberService.getUnReplaySuggestVo().getData(); |
| | | Integer countB = remoteShopService.getUnReplaySuggestVo().getData(); |
| | |
| | | String editValue = appEditUserDto.getEditValue(); |
| | | switch (editType){ |
| | | case 1: |
| | | sysUser.setNickName(editValue); |
| | | sysUser.setUpdateTime(DateUtils.getNowDate()); |
| | | sysUser.setUpdateBy(String.valueOf(appEditUserDto.getUserId())); |
| | | userMapper.updateUser(sysUser); |
| | | break; |
| | | case 2: |
| | | sysUser.setAvatar(editValue); |
| | |
| | | break; |
| | | case 4: |
| | | break; |
| | | case 5: |
| | | sysUser.setNickName(editValue); |
| | | sysUser.setUpdateTime(DateUtils.getNowDate()); |
| | | sysUser.setUpdateBy(String.valueOf(appEditUserDto.getUserId())); |
| | | userMapper.updateUser(sysUser); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | |
| | | FROM sys_oper_log |
| | | WHERE operator_type = 1 AND del_flag = 0 |
| | | <if test="param.operContent != null and param.operContent !=''"> |
| | | oper_content LIKE concat('%', #{param.operContent}, '%') |
| | | AND oper_content LIKE concat('%', #{param.operContent}, '%') |
| | | </if> |
| | | <if test="param.operTitle != null and param.operTitle !=''"> |
| | | title = #{param.operTitle} |
| | | AND title = #{param.operTitle} |
| | | </if> |
| | | <if test="param.operStartTime!=null and param.operStartTime!=''"> |
| | | AND Date(oper_time) >= #{param.operStartTime} |
| | |
| | | su.nick_name nickName |
| | | FROM sys_dept sd |
| | | LEFT JOIN sys_user su ON sd.dept_id = su.dept_id |
| | | WHERE sd.del_flag = 0 AND su.del_flag = 0 |
| | | WHERE sd.del_flag = "0" AND su.del_flag = "0" AND su.status = "0" |
| | | </select> |
| | | |
| | | <select id="listMgtDeptStaffByDept" resultMap="deptStaffResultMap"> |
| | |
| | | su.nick_name nickName |
| | | FROM sys_dept sd |
| | | LEFT JOIN sys_user su ON sd.dept_id = su.dept_id |
| | | WHERE sd.del_flag = 0 AND su.del_flag = 0 AND sd.dept_id = #{deptId} |
| | | WHERE sd.del_flag = "0" AND su.del_flag = "0" AND sd.dept_id = #{deptId} |
| | | <if test="userId != null and userId != ''"> |
| | | AND su.user_id = #{userId} |
| | | </if> |