diff --git a/fuintAdmin/src/components/map/imgUpload.vue b/fuintAdmin/src/components/map/imgUpload.vue index 5a3daf29c..53870c0e0 100644 --- a/fuintAdmin/src/components/map/imgUpload.vue +++ b/fuintAdmin/src/components/map/imgUpload.vue @@ -17,11 +17,21 @@ :on-preview="handlePictureCardPreview" :class="{hide: this.fileList.length >= this.limit}" > - - + + + + + + + + + + + @@ -72,7 +82,8 @@ export default { type: Boolean, default: true }, - imgUrl:"" + imgUrl:"", + doorUrl:"", }, data() { return { @@ -86,7 +97,8 @@ export default { headers: { "Access-Token" : getToken(), }, - fileList: [] + fileList: [], + doorList:[], }; }, watch: { @@ -118,6 +130,7 @@ export default { }, }, created() { + // this.dialogImageUrl = this.baseUrl + this.imgUrl; this.handlePictureCardPreview(); }, methods: { @@ -194,7 +207,6 @@ export default { }, // 预览 handlePictureCardPreview(file) { - // console.log(file,this.baseUrl , this.imgUrl) if (this.imgUrl != "" && this.imgUrl != undefined){ this.dialogImageUrl = this.baseUrl + this.imgUrl; }else { @@ -202,6 +214,21 @@ export default { this.dialogImageUrl = file.url; } } + if (this.doorUrl != "" && this.doorUrl != undefined && this.doorUrl != []){ + let list = JSON.parse(this.doorUrl) + list.forEach(item => { + let data = {name:"",url:""} + data.name = item.split("/")[item.split("/").length-1] + data.url = this.baseUrl + item + this.fileList.push(data) + // this.dialogImageUrl = this.baseUrl + item; + // this.doorList.push(this.baseUrl + item); + }) + }else { + if (file!=undefined){ + this.dialogImageUrl = file.url; + } + } // this.dialogVisible = true; }, // 对象转成指定字符串分隔 diff --git a/fuintAdmin/src/views/staff/storeInfo/index.vue b/fuintAdmin/src/views/staff/storeInfo/index.vue index 6dc9d6b53..ecc2eeea2 100644 --- a/fuintAdmin/src/views/staff/storeInfo/index.vue +++ b/fuintAdmin/src/views/staff/storeInfo/index.vue @@ -7,12 +7,12 @@
店铺logo: - +
门头照: - +
@@ -62,7 +62,6 @@ import {listQRCode} from "@/api/staff/qrcode"; import {ljStoreInfo, updateStore} from "@/api/staff/store"; import mapComponment from "@/components/map/mapComponent.vue"; import imgUpload from "@/components/ImageUpload/index.vue" -import { getToken } from '@/utils/auth' import imgUpload1 from "@/components/map/imgUpload.vue" export default { @@ -80,15 +79,7 @@ export default { }, data(){ return{ - testImgUrl:"", - // 图片根目录 - imagePath: process.env.VUE_APP_SERVER_URL, - dataForm:{}, - // 上传地址 - uploadAction: process.env.VUE_APP_SERVER_URL + 'backendApi/file/upload', - uploadHeader: { 'Access-Token' : getToken() }, - // 隐藏上传 - hideUpload: false, + flag:false, // 上传文件列表 uploadFiles: [ {name:"nihao", @@ -138,15 +129,17 @@ export default { getImgUrl(val){ let list = val.split("/static") this.store.logo = "/static"+list[list.length-1] - // this.store.logo = val - console.log(this.store.logo) }, // 获取图片url地址 getDoorImgUrl(val){ - // console.log(val) - // let list = val.split("/") - // this.form.logo = list[list.length-1] - this.store.doorstepPhoto = val + let list = val.split(",") + let doorUrl = [] + list.forEach(item => { + doorUrl.push("/static"+item.split("/static")[1]) + }) + // console.log(list,doorUrl) + this.store.doorstepPhoto = JSON.stringify(doorUrl) + // this.store.doorstepPhoto = val }, getForm(data){ if (data != undefined){ @@ -160,6 +153,7 @@ export default { ljStoreInfo().then(response => { this.store = response.data console.log(response.data) + this.$emit("getUrl",this.store) this.form.lat = this.store.latitude; this.form.lng = this.store.longitude; this.form.address = this.store.address; @@ -167,6 +161,7 @@ export default { this.welfare = this.store.welfare.split(",") } this.$refs.mapRef.initAMap(); + this.flag = true; }) }, diff --git a/fuintBackend/configure/dev/application.properties b/fuintBackend/configure/dev/application.properties index c6d041c2c..55db77eed 100644 --- a/fuintBackend/configure/dev/application.properties +++ b/fuintBackend/configure/dev/application.properties @@ -1,4 +1,4 @@ -# 数据库配置 +# \u6570\u636E\u5E93\u914D\u7F6E spring.datasource.url=jdbc:mysql://192.168.1.3:3306/fuint-db?useUnicode=true&characterEncoding=UTF8&useSSL=false&allowMultiQueries=true @@ -10,102 +10,114 @@ spring.datasource.password=qqzcy@1014 #spring.datasource.password=root -# Redis配置 +# Redis\u914D\u7F6E spring.session.store-type=redis spring.session.redis.namespace=fuint -# Redis数据库索引(默认为0) +# Redis\u6570\u636E\u5E93\u7D22\u5F15\uFF08\u9ED8\u8BA4\u4E3A0\uFF09 spring.redis.database=0 -# Redis服务器地址(生产) +# Redis\u670D\u52A1\u5668\u5730\u5740(\u751F\u4EA7) spring.redis.host=localhost -# Redis服务器连接端口 +# Redis\u670D\u52A1\u5668\u8FDE\u63A5\u7AEF\u53E3 spring.redis.port=6379 -# Redis服务器连接密码(默认为空) +# Redis\u670D\u52A1\u5668\u8FDE\u63A5\u5BC6\u7801\uFF08\u9ED8\u8BA4\u4E3A\u7A7A\uFF09 spring.redis.password= -# 连接池最大连接数(使用负值表示没有限制) +# \u8FDE\u63A5\u6C60\u6700\u5927\u8FDE\u63A5\u6570\uFF08\u4F7F\u7528\u8D1F\u503C\u8868\u793A\u6CA1\u6709\u9650\u5236\uFF09 spring.redis.pool.max-active=-1 -# 连接池最大阻塞等待时间(使用负值表示没有限制) +# \u8FDE\u63A5\u6C60\u6700\u5927\u963B\u585E\u7B49\u5F85\u65F6\u95F4\uFF08\u4F7F\u7528\u8D1F\u503C\u8868\u793A\u6CA1\u6709\u9650\u5236\uFF09 spring.redis.pool.max-wait=-1 -# 连接池中的最大空闲连接 +# \u8FDE\u63A5\u6C60\u4E2D\u7684\u6700\u5927\u7A7A\u95F2\u8FDE\u63A5 spring.redis.pool.max-idle=8 -# 连接池中的最小空闲连接 +# \u8FDE\u63A5\u6C60\u4E2D\u7684\u6700\u5C0F\u7A7A\u95F2\u8FDE\u63A5 spring.redis.pool.min-idle=0 -# 连接超时时间(毫秒) +# \u8FDE\u63A5\u8D85\u65F6\u65F6\u95F4\uFF08\u6BEB\u79D2\uFF09 spring.redis.timeout=5000 -# 系统名称 -system.name = 蓝鲸智慧油站系统 +# \u7CFB\u7EDF\u540D\u79F0 +system.name = \u84DD\u9CB8\u667A\u6167\u6CB9\u7AD9\u7CFB\u7EDF -# 前端h5地址 +# \u524D\u7AEFh5\u5730\u5740 website.url=https://www.fuint.cn/h5/ -# 上传图片本地地址 +# \u4E0A\u4F20\u56FE\u7247\u672C\u5730\u5730\u5740 images.root=C:/fuintV3.0.1/fuintBackend/fuint-application/target/classes images.path=/static/uploadImages/ -# 上传图片服务器域名 -images.upload.url=http://192.168.1.6:8008 +# \u4E0A\u4F20\u56FE\u7247\u670D\u52A1\u5668\u57DF\u540D +images.upload.url=http://localhost:8080 -# 上传图片允许的大小(单位:MB) +# \u4E0A\u4F20\u56FE\u7247\u5141\u8BB8\u7684\u5927\u5C0F\uFF08\u5355\u4F4D\uFF1AMB\uFF09 images.upload.maxSize=5 -################## 定时脚本配置 ######################### -# 定时发送消息 +################## \u5B9A\u65F6\u811A\u672C\u914D\u7F6E ######################### +# \u5B9A\u65F6\u53D1\u9001\u6D88\u606F message.job.switch = 1 message.job.time = 0 0/1 * * * ? -# 卡券到期处理 +# \u5361\u5238\u5230\u671F\u5904\u7406 couponExpire.job.switch = 1 couponExpire.job.time = 0 0/1 * * * ? -# 订单超时取消 +# \u8BA2\u5355\u8D85\u65F6\u53D6\u6D88 orderCancel.job.switch = 1 orderCancel.job.time = 0 0/1 * * * ? -################## 阿里云短信配置 ####################### -# 短信接口模式[0-关闭 1-打开] +################## \u963F\u91CC\u4E91\u77ED\u4FE1\u914D\u7F6E ####################### +# \u77ED\u4FE1\u63A5\u53E3\u6A21\u5F0F[0-\u5173\u95ED 1-\u6253\u5F00] aliyun.sms.mode = 0 aliyun.sms.accessKeyId=LTAI4GJMjV123oXsrQJLnPZt aliyun.sms.accessKeySecret=eGVBL30u5Ypj234d7XODlwYKWTaGT -# 阿里云短信签名 -aliyun.sms.signName=延禾技术 +# \u963F\u91CC\u4E91\u77ED\u4FE1\u7B7E\u540D +aliyun.sms.signName=\u5EF6\u79BE\u6280\u672F -################## 阿里云OSS存储配置###################### -# 模式[0-关闭 1-打开] +################## \u963F\u91CC\u4E91OSS\u5B58\u50A8\u914D\u7F6E###################### +# \u6A21\u5F0F[0-\u5173\u95ED 1-\u6253\u5F00] aliyun.oss.mode = 0 aliyun.oss.accessKeyId = LTAI4GJMjVhBa212rQJLnPZtt aliyun.oss.accessKeySecret = eGVBL30u53456gXd7XODlwYKWTaGT aliyun.oss.endpoint = https://oss-cn-shenzhen.aliyuncs.com aliyun.oss.bucketName = fuint-application -# 上传文件夹 +# \u4E0A\u4F20\u6587\u4EF6\u5939 aliyun.oss.folder = uploads -# 访问域名 +# \u8BBF\u95EE\u57DF\u540D aliyun.oss.domain = https://fuint-application.oss-cn-shenzhen.aliyuncs.com -################## 微信相关配置 ########################## -# 公众号配置 +################## \u5FAE\u4FE1\u76F8\u5173\u914D\u7F6E ########################## +# \u516C\u4F17\u53F7\u914D\u7F6E weixin.official.appId=wxf4327ef05c27a0 weixin.official.appSecret=1f55e8749332234d9a074873d8e6a3 -# 小程序配置 -wxpay.appId = wxba517a9bac38fe92 -wxpay.appSecret = 8bfcce86abc4e2a461ecc781a09249a5 +# \u5C0F\u7A0B\u5E8F\u914D\u7F6E +#wxpay.appId = wxba517a9bac38fe92 +#wxpay.appSecret = 8bfcce86abc4e2a461ecc781a09249a5 +# \u8D22\u5229\u5B9D +#wxpay.appId = wx033c30e366eff6ac +#wxpay.appSecret = e46a9a5947380fb70a1aa33a5b427ba4 +# \u6765\u4E2A\u6CB9\u6167 +wxpay.appId = wxd8014eaf9bd72e93 +wxpay.appSecret = 0194125b13cece10d5f6cdd664847b55 wxpay.mchId=1636980812 wxpay.apiV2=34354320201030y323e432342343 wxpay.certPath=/usr/local/fuint/cert/apiclient_cert.p12 wxpay.domain=https://www.fuint.cn/fuint-application -################## 支付宝支付相关配置 ###################### -alipay.appId = 应用编号 -alipay.privateKey = 应用私钥 -alipay.publicKey = 支付宝公钥(通过应用公钥上传到支付宝开放平台换取支付宝公钥) +################## \u652F\u4ED8\u5B9D\u652F\u4ED8\u76F8\u5173\u914D\u7F6E ###################### +alipay.appId = \u5E94\u7528\u7F16\u53F7 +alipay.privateKey = \u5E94\u7528\u79C1\u94A5 +alipay.publicKey = \u652F\u4ED8\u5B9D\u516C\u94A5\uFF08\u901A\u8FC7\u5E94\u7528\u516C\u94A5\u4E0A\u4F20\u5230\u652F\u4ED8\u5B9D\u5F00\u653E\u5E73\u53F0\u6362\u53D6\u652F\u4ED8\u5B9D\u516C\u94A5\uFF09 alipay.serverUrl=https://openapi.alipay.com/gateway.do alipay.domain=https://www.fuint.cn/fuint-application/clientApi/pay/aliPayCallback -################ 微信订阅模板消息配置 ###################### -weixin.subMessage.orderCreated=[{'key':'time', 'name':'订单时间'},{'key':'orderSn', 'name':'订单号'},{'key':'remark', 'name':'备注信息'}] -weixin.subMessage.deliverGoods=[{'key':'receiver', 'name':'收货人'}, {'key':'orderSn', 'name':'订单号'}, {'key':'expressCompany', 'name':'快递公司'}, {'key':'expressNo', 'name':'快递单号'}] -weixin.subMessage.couponExpire=[{'key':'name', 'name':'卡券名称'}, {'key':'expireTime', 'name':'到期时间'},{'key':'tips', 'name':'温馨提示'}] -weixin.subMessage.couponArrival=[{'key':'name', 'name':'卡券名称'},{'key':'amount', 'name':'金额'},{'key':'tips', 'name':'温馨提示'}] -weixin.subMessage.balanceChange=[{'key':'amount', 'name':'变动金额'},{'key':'time', 'name':'变动时间'},{'key':'tips', 'name':'温馨提示'}] -weixin.subMessage.couponConfirm=[{'key':'name', 'name':'卡券名称'},{'key':'time', 'name':'核销时间'}] -weixin.subMessage.pointChange=[{'key':'amount', 'name':'变动数量'},{'key':'time', 'name':'变动时间'},{'key':'remark', 'name':'备注信息'}] +################ \u5FAE\u4FE1\u8BA2\u9605\u6A21\u677F\u6D88\u606F\u914D\u7F6E ###################### +weixin.subMessage.orderCreated=[{'key':'time', 'name':'\u8BA2\u5355\u65F6\u95F4'},{'key':'orderSn', 'name':'\u8BA2\u5355\u53F7'},{'key':'remark', 'name':'\u5907\u6CE8\u4FE1\u606F'}] +weixin.subMessage.deliverGoods=[{'key':'receiver', 'name':'\u6536\u8D27\u4EBA'}, {'key':'orderSn', 'name':'\u8BA2\u5355\u53F7'}, {'key':'expressCompany', 'name':'\u5FEB\u9012\u516C\u53F8'}, {'key':'expressNo', 'name':'\u5FEB\u9012\u5355\u53F7'}] +weixin.subMessage.couponExpire=[{'key':'name', 'name':'\u5361\u5238\u540D\u79F0'}, {'key':'expireTime', 'name':'\u5230\u671F\u65F6\u95F4'},{'key':'tips', 'name':'\u6E29\u99A8\u63D0\u793A'}] +weixin.subMessage.couponArrival=[{'key':'name', 'name':'\u5361\u5238\u540D\u79F0'},{'key':'amount', 'name':'\u91D1\u989D'},{'key':'tips', 'name':'\u6E29\u99A8\u63D0\u793A'}] +weixin.subMessage.balanceChange=[{'key':'amount', 'name':'\u53D8\u52A8\u91D1\u989D'},{'key':'time', 'name':'\u53D8\u52A8\u65F6\u95F4'},{'key':'tips', 'name':'\u6E29\u99A8\u63D0\u793A'}] +weixin.subMessage.couponConfirm=[{'key':'name', 'name':'\u5361\u5238\u540D\u79F0'},{'key':'time', 'name':'\u6838\u9500\u65F6\u95F4'}] +weixin.subMessage.pointChange=[{'key':'amount', 'name':'\u53D8\u52A8\u6570\u91CF'},{'key':'time', 'name':'\u53D8\u52A8\u65F6\u95F4'},{'key':'remark', 'name':'\u5907\u6CE8\u4FE1\u606F'}] + +# rocketmq\u914D\u7F6E +//1 +rocketmq.name-server=127.0.0.1:9876 +//2 +rocketmq.producer.group=provider \ No newline at end of file diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/controller/FyPayController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/controller/FyPayController.java index 2bd40875a..4f9ba1f4f 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/controller/FyPayController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/controller/FyPayController.java @@ -1,38 +1,39 @@ package com.fuint.api.fuyou.controller; +import com.fuint.api.fuyou.entity.Const; import com.fuint.api.fuyou.service.FyPayService; +import com.fuint.api.fuyou.util.Utils; +import com.fuint.business.order.service.OilOrderService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import java.util.Enumeration; -import java.util.HashMap; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; import java.util.Map; @RestController @RequestMapping("/api/fyPay") public class FyPayController { @Autowired - private FyPayService payService; + @Lazy + private OilOrderService orderService; // 接收支付平台异步通知的接口 @PostMapping("/notify") - public String notifyUrl(HttpServletRequest request,HttpServletResponse response) { - System.out.println("111+"+request); - System.out.println("222+"+response); -// Map paramMap = new HashMap<>(); -// Enumeration parameterNames = request.getParameterNames(); -// while(parameterNames.hasMoreElements()) { -// String parameterName = (String) parameterNames.nextElement(); -// paramMap.put(parameterName, request.getParameter(parameterName)); -// } -// boolean isSuccess = processNotify(paramMap); // 处理支付结果并返回成功或失败状态 -// if(isSuccess) { -// return "success"; // 返回成功状态,通知支付平台异步通知已成功接收 -// } else { -// return "fail"; // 返回失败状态,通知支付平台异步通知已失败 -// } - return "11111111"; + public String notifyUrl(HttpServletRequest request,HttpServletResponse response) throws UnsupportedEncodingException { + System.out.println("----------------收到支付回调--------"+request.getParameter("req")); + String notifyData = request.getParameter("req"); + String decode = URLDecoder.decode(notifyData, Const.charset); + Map reqMap = Utils.xmlStr2Map(decode); + if (reqMap.get("result_msg").equals("SUCCESS")){ + String orderNo = reqMap.get("mchnt_order_no"); + orderService.updateOrderStatus(orderNo,"paid"); + return "1"; + }else { + return "0"; + } } } \ No newline at end of file diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/controller/ActiveNewlywedsRecordsController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/controller/ActiveNewlywedsRecordsController.java new file mode 100644 index 000000000..96c783786 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/controller/ActiveNewlywedsRecordsController.java @@ -0,0 +1,115 @@ +package com.fuint.business.marketingActivity.activeNewlyweds.controller; + + + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.api.ApiController; +import com.baomidou.mybatisplus.extension.api.R; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.fuint.business.marketingActivity.activeNewlyweds.entity.ActiveNewlyweds; +import com.fuint.business.marketingActivity.activeNewlyweds.entity.ActiveNewlywedsRecords; +import com.fuint.business.marketingActivity.activeNewlyweds.service.ActiveNewlywedsRecordsService; +import com.fuint.common.dto.AccountInfo; +import com.fuint.common.util.TokenUtil; +import com.fuint.framework.web.BaseController; +import com.fuint.framework.web.ResponseObject; +import org.apache.ibatis.annotations.Param; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.io.Serializable; +import java.util.List; + +/** + * 新人有礼记录表(ActiveNewlywedsRecords)表控制层 + * + * @author makejava + * @since 2023-12-20 14:12:53 + */ +@RestController +@RequestMapping("business/marketingActivity/activeNewlywedsRecords") +public class ActiveNewlywedsRecordsController extends BaseController { + /** + * 服务对象 + */ + @Resource + private ActiveNewlywedsRecordsService activeNewlywedsRecordsService; + + /** + * 分页查询所有数据 + * @param pageNo + * @param pageSize + * @param activeNewlywedsRecords + * @return + */ + @GetMapping + public ResponseObject selectAll(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo, + @RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize, + @Param("activeNewlywedsRecords") ActiveNewlywedsRecords activeNewlywedsRecords) { + Page page = new Page(pageNo, pageSize); + return getSuccessResult(this.activeNewlywedsRecordsService.page(page, new QueryWrapper<>(activeNewlywedsRecords))); + } + + /** + * 判断是否已经参加过新人有礼活动接口 + * @param activeNewlywedsRecords + * @return + */ + @GetMapping("applet") + public ResponseObject isJoined(@Param("activeNewlywedsRecords") ActiveNewlywedsRecords activeNewlywedsRecords) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(ActiveNewlywedsRecords::getUserId,TokenUtil.getNowAccountInfo().getId()); + List list = this.activeNewlywedsRecordsService.list(queryWrapper); + if (list.size() == 0){ + return getSuccessResult("1"); + }else { + return getSuccessResult("0"); + } + } + + /** + * 通过主键查询单条数据 + * + * @param id 主键 + * @return 单条数据 + */ + @GetMapping("{id}") + public ResponseObject selectOne(@PathVariable Serializable id) { + return getSuccessResult(this.activeNewlywedsRecordsService.getById(id)); + } + + /** + * 新增数据 + * + * @param activeNewlywedsRecords 实体对象 + * @return 新增结果 + */ + @PostMapping + public ResponseObject insert(@RequestBody ActiveNewlywedsRecords activeNewlywedsRecords) { + return getSuccessResult(this.activeNewlywedsRecordsService.add(activeNewlywedsRecords)); + } + + /** + * 修改数据 + * + * @param activeNewlywedsRecords 实体对象 + * @return 修改结果 + */ + @PutMapping + public ResponseObject update(@RequestBody ActiveNewlywedsRecords activeNewlywedsRecords) { + return getSuccessResult(this.activeNewlywedsRecordsService.updateById(activeNewlywedsRecords)); + } + + /** + * 删除数据 + * + * @param idList 主键结合 + * @return 删除结果 + */ + @DeleteMapping + public ResponseObject delete(@RequestParam("idList") List idList) { + return getSuccessResult(this.activeNewlywedsRecordsService.removeByIds(idList)); + } +} + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/entity/ActiveNewlywedsRecords.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/entity/ActiveNewlywedsRecords.java new file mode 100644 index 000000000..1d2423184 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/entity/ActiveNewlywedsRecords.java @@ -0,0 +1,44 @@ +package com.fuint.business.marketingActivity.activeNewlyweds.entity; + +import java.util.Date; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; + +/** + * 新人有礼记录表(ActiveNewlywedsRecords)表实体类 + * + * @author makejava + * @since 2023-12-20 14:12:54 + */ +@SuppressWarnings("serial") +@Data +public class ActiveNewlywedsRecords extends Model { + //主键id + @TableId(type = IdType.AUTO) + private Integer id; + //活动id + private Integer activeNewlywedsId; + //所属连锁店id + private Integer chainStoreId; + //所属店铺id + private Integer storeId; + //用户id + private Integer userId; + //创建者 + private String createBy; + //创建时间 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date createTime; + //更新者 + private String updateBy; + //更新时间 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date updateTime; + } + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/mapper/ActiveNewlywedsRecordsMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/mapper/ActiveNewlywedsRecordsMapper.java new file mode 100644 index 000000000..baad355a1 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/mapper/ActiveNewlywedsRecordsMapper.java @@ -0,0 +1,15 @@ +package com.fuint.business.marketingActivity.activeNewlyweds.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.fuint.business.marketingActivity.activeNewlyweds.entity.ActiveNewlywedsRecords; + +/** + * 新人有礼记录表(ActiveNewlywedsRecords)表数据库访问层 + * + * @author makejava + * @since 2023-12-20 14:12:53 + */ +public interface ActiveNewlywedsRecordsMapper extends BaseMapper { + +} + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/ActiveNewlywedsRecordsService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/ActiveNewlywedsRecordsService.java new file mode 100644 index 000000000..509436b60 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/ActiveNewlywedsRecordsService.java @@ -0,0 +1,21 @@ +package com.fuint.business.marketingActivity.activeNewlyweds.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.fuint.business.marketingActivity.activeNewlyweds.entity.ActiveNewlywedsRecords; + +/** + * 新人有礼记录表(ActiveNewlywedsRecords)表服务接口 + * + * @author makejava + * @since 2023-12-20 14:12:54 + */ +public interface ActiveNewlywedsRecordsService extends IService { + + /** + * 新增数据 + * @param activeNewlywedsRecords + * @return + */ + boolean add(ActiveNewlywedsRecords activeNewlywedsRecords); +} + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/impl/ActiveNewlywedsRecordsServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/impl/ActiveNewlywedsRecordsServiceImpl.java new file mode 100644 index 000000000..db9a238ce --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeNewlyweds/service/impl/ActiveNewlywedsRecordsServiceImpl.java @@ -0,0 +1,105 @@ +package com.fuint.business.marketingActivity.activeNewlyweds.service.impl; + +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.fuint.business.marketingActivity.activeNewlyweds.controller.vo.ActiveNewlywedsVO; +import com.fuint.business.marketingActivity.activeNewlyweds.entity.ActiveNewlyweds; +import com.fuint.business.marketingActivity.activeNewlyweds.entity.ActiveNewlywedsChild; +import com.fuint.business.marketingActivity.activeNewlyweds.mapper.ActiveNewlywedsRecordsMapper; +import com.fuint.business.marketingActivity.activeNewlyweds.entity.ActiveNewlywedsRecords; +import com.fuint.business.marketingActivity.activeNewlyweds.service.ActiveNewlywedsRecordsService; +import com.fuint.business.marketingActivity.activeNewlyweds.service.ActiveNewlywedsService; +import com.fuint.business.marketingActivity.cardExchange.entity.CardExchangeRecord; +import com.fuint.business.marketingActivity.cardExchange.service.CardExchangeRecordService; +import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorableRecord; +import com.fuint.business.marketingActivity.cardFavorable.mapper.CardFavorableRecordMapper; +import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableRecordService; +import com.fuint.business.userManager.service.LJUserService; +import com.fuint.business.userManager.vo.LJUserVo; +import com.fuint.common.dto.AccountInfo; +import com.fuint.common.util.TokenUtil; +import com.sun.xml.bind.v2.TODO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 新人有礼记录表(ActiveNewlywedsRecords)表服务实现类 + * + * @author makejava + * @since 2023-12-20 14:12:54 + */ +@Service("activeNewlywedsRecordsService") +public class ActiveNewlywedsRecordsServiceImpl extends ServiceImpl implements ActiveNewlywedsRecordsService { + + @Resource + private ActiveNewlywedsService activeNewlywedsService; + @Resource + private CardFavorableRecordService cardFavorableRecordService; + @Resource + private CardExchangeRecordService cardExchangeRecordService; + @Resource + private LJUserService userService; + /** + * 新增数据 + * @param activeNewlywedsRecords + * @return + */ + @Override + @Transactional + public boolean add(ActiveNewlywedsRecords activeNewlywedsRecords) { + boolean save = false; + //用户信息 + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + Integer userId = nowAccountInfo.getId(); + LJUserVo ljUserVo = userService.selectUserById(userId); + //保存新人有礼记录 + ActiveNewlywedsVO activeNewlyweds = activeNewlywedsService.getOneById(1); + activeNewlywedsRecords.setActiveNewlywedsId(activeNewlyweds.getId()); + activeNewlywedsRecords.setChainStoreId(nowAccountInfo.getChainStoreId()); + activeNewlywedsRecords.setStoreId(nowAccountInfo.getStoreId()); + activeNewlywedsRecords.setUserId(userId); + save = save(activeNewlywedsRecords); + //优惠券 + CardFavorableRecord cardFavorableRecord = new CardFavorableRecord(); + List activeNewlywedsChildList = activeNewlyweds.getActiveNewlywedsChildList(); + if (CollectionUtils.isNotEmpty(activeNewlywedsChildList)){ + for (ActiveNewlywedsChild activeNewlywedsChild : activeNewlywedsChildList) { + if (activeNewlywedsChild.getActiveGift().equals("1")){ + cardFavorableRecord.setCardFavorableId(activeNewlywedsChild.getActiveNewlywedsId()); + cardFavorableRecord.setChainStorId(nowAccountInfo.getChainStoreId()); + cardFavorableRecord.setStoreId(nowAccountInfo.getStoreId()); + cardFavorableRecord.setMtUserId(userId); + cardFavorableRecord.setName(ljUserVo.getName()); + cardFavorableRecord.setMobile(ljUserVo.getMobile()); + cardFavorableRecord.setName(nowAccountInfo.getRealName()); + cardFavorableRecord.setExchangeFrom("新人发券"); + save = cardFavorableRecordService.save(cardFavorableRecord); + }else { + //兑换券 + CardExchangeRecord cardExchangeRecord = new CardExchangeRecord(); + cardExchangeRecord.setCardExchangeId(activeNewlywedsChild.getActiveNewlywedsId()); + cardExchangeRecord.setChainStorId(nowAccountInfo.getChainStoreId()); + cardExchangeRecord.setStoreId(nowAccountInfo.getStoreId()); + cardExchangeRecord.setMtUserId(userId); + cardExchangeRecord.setName(ljUserVo.getName()); + cardExchangeRecord.setMobile(ljUserVo.getMobile()); + cardExchangeRecord.setExchangeName(activeNewlywedsChild.getGiftCardName()); + cardExchangeRecord.setExchangeFrom("新人领券"); + cardExchangeRecord.setGiftName(activeNewlywedsChild.getGiftCardName()); + cardExchangeRecord.setDescription(activeNewlywedsChild.getGiftCardDetail()); + save = cardExchangeRecordService.save(cardExchangeRecord); + } + } + //积分 + //成长值 TODO + } + // + + return save; + } +} + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/controller/ActiveRecommendRecordsController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/controller/ActiveRecommendRecordsController.java new file mode 100644 index 000000000..f22f8664f --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/controller/ActiveRecommendRecordsController.java @@ -0,0 +1,99 @@ +package com.fuint.business.marketingActivity.activeRecommend.controller; + + + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.fuint.business.marketingActivity.activeRecommend.entity.ActiveRecommendRecords; +import com.fuint.business.marketingActivity.activeRecommend.service.ActiveRecommendRecordsService; +import com.fuint.framework.web.BaseController; +import com.fuint.framework.web.ResponseObject; +import org.apache.ibatis.annotations.Param; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.io.Serializable; +import java.util.List; + +/** + * 邀请有礼记录表(ActiveRecommendRecords)表控制层 + * + * @author makejava + * @since 2023-12-20 14:13:16 + */ +@RestController +@RequestMapping("business/marketingActivity/activeRecommendRecords") +public class ActiveRecommendRecordsController extends BaseController { + /** + * 服务对象 + */ + @Resource + private ActiveRecommendRecordsService activeRecommendRecordsService; + + /** + * 小程序端查询邀请记录 + * @param pageNo + * @param pageSize + * @param activeRecommendRecords + * @return + */ + @GetMapping + public ResponseObject selectAll(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo, + @RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize, + @Param("activeRecommendRecords") ActiveRecommendRecords activeRecommendRecords) { + Page page = new Page(pageNo, pageSize); + return getSuccessResult(this.activeRecommendRecordsService.select(page, activeRecommendRecords)); + } + + /** + * 小程序端查询券总额 + * @return + */ + @GetMapping("selectAllAmount") + public ResponseObject selectAllAmount() { + return getSuccessResult(this.activeRecommendRecordsService.selectAllAmount()); + } + + /** + * 通过主键查询单条数据 + * + * @param id 主键 + * @return 单条数据 + */ + @GetMapping("{id}") + public ResponseObject selectOne(@PathVariable Serializable id) { + return getSuccessResult(this.activeRecommendRecordsService.getById(id)); + } + + /** + * 新增邀请记录接口 + * @param activeRecommendRecords 实体对象 + * @return 新增结果 + */ + @PostMapping + public ResponseObject insert(@RequestBody ActiveRecommendRecords activeRecommendRecords) { + return getSuccessResult(this.activeRecommendRecordsService.add(activeRecommendRecords)); + } + + /** + * 修改数据 + * + * @param activeRecommendRecords 实体对象 + * @return 修改结果 + */ + @PutMapping + public ResponseObject update(@RequestBody ActiveRecommendRecords activeRecommendRecords) { + return getSuccessResult(this.activeRecommendRecordsService.updateById(activeRecommendRecords)); + } + + /** + * 删除数据 + * + * @param idList 主键结合 + * @return 删除结果 + */ + @DeleteMapping + public ResponseObject delete(@RequestParam("idList") List idList) { + return getSuccessResult(this.activeRecommendRecordsService.removeByIds(idList)); + } +} + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/entity/ActiveRecommendRecords.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/entity/ActiveRecommendRecords.java new file mode 100644 index 000000000..de9da036c --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/entity/ActiveRecommendRecords.java @@ -0,0 +1,139 @@ +package com.fuint.business.marketingActivity.activeRecommend.entity; + +import java.util.Date; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; + +/** + * 邀请有礼记录表(ActiveRecommendRecords)表实体类 + * + * @author makejava + * @since 2023-12-20 14:13:16 + */ +@SuppressWarnings("serial") +@Data +public class ActiveRecommendRecords extends Model { + //主键id + @TableId(type = IdType.AUTO) + private Integer id; + //活动id + private Integer activeNewlywedsId; + //所属连锁店id + private Integer chainStoreId; + //所属店铺id + private Integer storeId; + //用户id + private String userId; + //被邀请人id + private String inviteeUserId; + //被邀请人姓名 + private String inviteeUserName; + //创建者 + private String createBy; + //创建时间 + @JsonFormat(pattern = "yyyy-MM-dd ") + private Date createTime; + //更新者 + private String updateBy; + //更新时间 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date updateTime; + + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getActiveNewlywedsId() { + return activeNewlywedsId; + } + + public void setActiveNewlywedsId(Integer activeNewlywedsId) { + this.activeNewlywedsId = activeNewlywedsId; + } + + public Integer getChainStoreId() { + return chainStoreId; + } + + public void setChainStoreId(Integer chainStoreId) { + this.chainStoreId = chainStoreId; + } + + public Integer getStoreId() { + return storeId; + } + + public void setStoreId(Integer storeId) { + this.storeId = storeId; + } + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public String getInviteeUserId() { + return inviteeUserId; + } + + public void setInviteeUserId(String inviteeUserId) { + this.inviteeUserId = inviteeUserId; + } + + public String getCreateBy() { + return createBy; + } + + public void setCreateBy(String createBy) { + this.createBy = createBy; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public String getUpdateBy() { + return updateBy; + } + + public void setUpdateBy(String updateBy) { + this.updateBy = updateBy; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + /** + * 获取主键值 + * + * @return 主键值 + */ + @Override + protected Serializable pkVal() { + return this.id; + } + } + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/mapper/ActiveRecommendRecordsMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/mapper/ActiveRecommendRecordsMapper.java new file mode 100644 index 000000000..9363f1f3e --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/mapper/ActiveRecommendRecordsMapper.java @@ -0,0 +1,15 @@ +package com.fuint.business.marketingActivity.activeRecommend.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.fuint.business.marketingActivity.activeRecommend.entity.ActiveRecommendRecords; + +/** + * 邀请有礼记录表(ActiveRecommendRecords)表数据库访问层 + * + * @author makejava + * @since 2023-12-20 14:13:16 + */ +public interface ActiveRecommendRecordsMapper extends BaseMapper { + +} + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/service/ActiveRecommendRecordsService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/service/ActiveRecommendRecordsService.java new file mode 100644 index 000000000..9c9957f34 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/service/ActiveRecommendRecordsService.java @@ -0,0 +1,37 @@ +package com.fuint.business.marketingActivity.activeRecommend.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.fuint.business.marketingActivity.activeRecommend.entity.ActiveRecommendRecords; + +/** + * 邀请有礼记录表(ActiveRecommendRecords)表服务接口 + * + * @author makejava + * @since 2023-12-20 14:13:16 + */ +public interface ActiveRecommendRecordsService extends IService { + + /** + * 小程序端查询邀请记录 + * @param page + * @param activeRecommendRecords + * @return + */ + IPage select(Page page, ActiveRecommendRecords activeRecommendRecords); + + /** + * 小程序端查询券总额 + * @return + */ + double selectAllAmount(); + + /** + * 新增邀请记录接口 + * @param activeRecommendRecords + * @return + */ + boolean add(ActiveRecommendRecords activeRecommendRecords); +} + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/service/impl/ActiveRecommendRecordsServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/service/impl/ActiveRecommendRecordsServiceImpl.java new file mode 100644 index 000000000..5a493dce4 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/service/impl/ActiveRecommendRecordsServiceImpl.java @@ -0,0 +1,138 @@ +package com.fuint.business.marketingActivity.activeRecommend.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.fuint.business.marketingActivity.activeRecommend.entity.ActiveRecommendChild; +import com.fuint.business.marketingActivity.activeRecommend.mapper.ActiveRecommendRecordsMapper; +import com.fuint.business.marketingActivity.activeRecommend.entity.ActiveRecommendRecords; +import com.fuint.business.marketingActivity.activeRecommend.service.ActiveRecommendRecordsService; +import com.fuint.business.marketingActivity.activeRecommend.service.ActiveRecommendService; +import com.fuint.business.marketingActivity.activeRecommend.vo.ActiveRecommendRecordsVO; +import com.fuint.business.marketingActivity.activeRecommend.vo.ActiveRecommendVO; +import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableService; +import com.fuint.common.dto.AccountInfo; +import com.fuint.common.util.TokenUtil; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 邀请有礼记录表(ActiveRecommendRecords)表服务实现类 + * + * @author makejava + * @since 2023-12-20 14:13:16 + */ +@Service("activeRecommendRecordsService") +public class ActiveRecommendRecordsServiceImpl extends ServiceImpl implements ActiveRecommendRecordsService { + + @Resource + private ActiveRecommendService activeRecommendService; + @Resource + private CardFavorableService cardFavorableService; + /** + * 小程序端查询邀请记录 + * @param page + * @param activeRecommendRecords + * @return + */ + @Override + public IPage select(Page page, ActiveRecommendRecords activeRecommendRecords) { + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + Integer userId = nowAccountInfo.getId(); + Integer storeId = nowAccountInfo.getStoreId(); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(ActiveRecommendRecords::getUserId,userId); + queryWrapper.eq(ActiveRecommendRecords::getStoreId,storeId); + /*IPage page1 = page(page, queryWrapper); + List records = page1.getRecords(); + List collect = records.stream().map(s -> { + ActiveRecommendRecordsVO activeRecommendRecordsVO = new ActiveRecommendRecordsVO(); + + s.getActiveNewlywedsId() + BeanUtils.copyProperties(s, activeRecommendRecordsVO); + return activeRecommendRecordsVO; + }).collect(Collectors.toList()); + page1.setRecords(collect);*/ + /*//券总额 + double discountAmount = 0.0; + //推荐有礼活动 + ActiveRecommendVO activeRecommendVO = activeRecommendService.getOneById(1); + //活动所送推荐人的优惠券 + List activeRecommendChildList = activeRecommendVO.getActiveRecommendChildList(); + if(CollectionUtils.isNotEmpty(activeRecommendChildList)){ + for (ActiveRecommendChild activeRecommendChild : activeRecommendChildList) { + if (activeRecommendChild.getActiveGift().equals("0")){ + //券数量 + Integer giftCardTotal = activeRecommendChild.getGiftCardTotal(); + //券id + Integer vouchersId = activeRecommendChild.getVouchersId(); + //券总额 + discountAmount += (cardFavorableService.getById(vouchersId).getDiscountAmount() * giftCardTotal); + } + } + } + IPage page1 = page(page, queryWrapper); + List records = page1.getRecords();*/ + return page(page, queryWrapper); + } + + @Override + public double selectAllAmount() { + //券总额 + double discountAmount = 0.0; + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + Integer userId = nowAccountInfo.getId(); + Integer storeId = nowAccountInfo.getStoreId(); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(ActiveRecommendRecords::getUserId,userId); + queryWrapper.eq(ActiveRecommendRecords::getStoreId,storeId); + List list = list(queryWrapper); + if (CollectionUtils.isNotEmpty(list)){ + //邀请人数 + int size = list.size(); + //推荐有礼活动 + ActiveRecommendVO activeRecommendVO = activeRecommendService.getOneById(1); + //活动所送推荐人的优惠券 + List activeRecommendChildList = activeRecommendVO.getActiveRecommendChildList(); + if(CollectionUtils.isNotEmpty(activeRecommendChildList)){ + for (ActiveRecommendChild activeRecommendChild : activeRecommendChildList) { + if (activeRecommendChild.getActiveGift().equals("1")){ + //券数量 + Integer giftCardTotal = activeRecommendChild.getGiftCardTotal(); + //券id + Integer vouchersId = activeRecommendChild.getVouchersId(); + //券总额 + discountAmount += (cardFavorableService.getById(vouchersId).getDiscountAmount() * giftCardTotal * size); + } + } + } + } + return discountAmount; + } + + /** + * 新增邀请记录接口 + * @param activeRecommendRecords + * @return + */ + @Override + public boolean add(ActiveRecommendRecords activeRecommendRecords) { + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + Integer userId = nowAccountInfo.getId(); + Integer storeId = nowAccountInfo.getStoreId(); + //邀请人id TODO + activeRecommendRecords.setUserId(userId.toString()); + activeRecommendRecords.setStoreId(storeId); + //被邀请人id + activeRecommendRecords.setInviteeUserId(userId.toString()); + activeRecommendRecords.setInviteeUserName(nowAccountInfo.getRealName()); + return save(activeRecommendRecords); + } +} + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/service/impl/ActiveRecommendServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/service/impl/ActiveRecommendServiceImpl.java index 9e9445459..073a350dc 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/service/impl/ActiveRecommendServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/activeRecommend/service/impl/ActiveRecommendServiceImpl.java @@ -197,9 +197,13 @@ public class ActiveRecommendServiceImpl extends ServiceImpl idList) { + return getSuccessResult(this.cardFavorableRecordService.drawDown(idList)); + } + + /** + * 小程序端判断是否领取优惠券 + * @return 新增结果 + */ + @GetMapping("isDrawDown") + public ResponseObject isDrawDown() { + return getSuccessResult(this.cardFavorableRecordService.isDrawDown()); + } + /** * 修改数据 * diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/service/CardFavorableRecordService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/service/CardFavorableRecordService.java index fca3063fa..337b0c8d1 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/service/CardFavorableRecordService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/service/CardFavorableRecordService.java @@ -7,6 +7,7 @@ import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorableRe import com.fuint.business.marketingActivity.cardFavorable.vo.CardFavorableRecordVO; import java.io.Serializable; +import java.util.List; import java.util.Map; /** @@ -34,5 +35,17 @@ public interface CardFavorableRecordService extends IService selectCount(CardFavorableRecord cardFavorableRecord); + /** + * 小程序端优惠券领取接口 + * @param idList + * @return + */ + boolean drawDown(List idList); + + /** + * 小程序端判断是否领取优惠券 + * @return + */ + boolean isDrawDown(); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/service/impl/CardFavorableRecordServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/service/impl/CardFavorableRecordServiceImpl.java index 5aa184c39..cb5898ce3 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/service/impl/CardFavorableRecordServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFavorable/service/impl/CardFavorableRecordServiceImpl.java @@ -2,6 +2,7 @@ package com.fuint.business.marketingActivity.cardFavorable.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorable; @@ -9,6 +10,9 @@ import com.fuint.business.marketingActivity.cardFavorable.mapper.CardFavorableRe import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorableRecord; import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableRecordService; import com.fuint.business.marketingActivity.cardFavorable.vo.CardFavorableRecordVO; +import com.fuint.business.userManager.service.LJUserService; +import com.fuint.business.userManager.vo.LJUserVo; +import com.fuint.common.dto.AccountInfo; import com.fuint.common.util.TokenUtil; import org.apache.commons.lang3.ObjectUtils; import org.springframework.stereotype.Service; @@ -30,6 +34,8 @@ public class CardFavorableRecordServiceImpl extends ServiceImpl idList) { + boolean save = false; + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + Integer userId = nowAccountInfo.getId(); + LJUserVo ljUserVo = userService.selectUserById(userId); + //优惠券 + for (Integer id : idList) { + CardFavorableRecord cardFavorableRecord = new CardFavorableRecord(); + cardFavorableRecord.setCardFavorableId(id); + cardFavorableRecord.setChainStorId(nowAccountInfo.getChainStoreId()); + cardFavorableRecord.setStoreId(nowAccountInfo.getStoreId()); + cardFavorableRecord.setMtUserId(userId); + cardFavorableRecord.setName(ljUserVo.getName()); + cardFavorableRecord.setMobile(ljUserVo.getMobile()); + cardFavorableRecord.setName(nowAccountInfo.getRealName()); + cardFavorableRecord.setExchangeFrom("店铺发券"); + save = save(cardFavorableRecord); + } + return save; + } + + /** + * 小程序端判断是否领取优惠券 + * @return + */ + @Override + public boolean isDrawDown() { + boolean isDrawDown = false; + //登录用户信息 + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(CardFavorableRecord::getMtUserId,nowAccountInfo.getId()); + queryWrapper.eq(CardFavorableRecord::getStoreId,nowAccountInfo.getStoreId()); + //如果领过券 就不让领了 + List list = list(queryWrapper); + if (CollectionUtils.isNotEmpty(list) && list.size() == 0){ + isDrawDown = true; + } + return isDrawDown; + } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/controller/CardValueRecordController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/controller/CardValueRecordController.java index ddc34a210..7d6284521 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/controller/CardValueRecordController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/controller/CardValueRecordController.java @@ -74,7 +74,7 @@ public class CardValueRecordController extends BaseController { /** * 储值卡充值 * - * @param cardValueRecord 实体对象 + * @param cardValueRecordDTO 实体对象 * @return 新增结果 */ @PostMapping diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/impl/CardValueRecordServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/impl/CardValueRecordServiceImpl.java index 81c9a9c52..398a6cb02 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/impl/CardValueRecordServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/impl/CardValueRecordServiceImpl.java @@ -26,6 +26,8 @@ import com.fuint.business.userManager.vo.LJUserVo; import com.fuint.common.dto.AccountInfo; import com.fuint.common.util.RocketUtil; import com.fuint.common.util.TokenUtil; +import com.fuint.repository.mapper.MtStaffMapper; +import com.fuint.repository.model.MtStaff; import io.lettuce.core.dynamic.annotation.Param; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -73,6 +75,8 @@ public class CardValueRecordServiceImpl extends ServiceImpl map){ + String orderNo = map.get("orderNo"); + String status = map.get("status"); + return getSuccessResult(orderService.updateOrderStatus(orderNo,status)); + } + /** * 信息统计 diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/OilOrderService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/OilOrderService.java index 3294a3964..61469540a 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/OilOrderService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/OilOrderService.java @@ -84,7 +84,15 @@ public interface OilOrderService extends IService { * 小程序订单支付 * @param map */ - public boolean appletPay(Map map); + public Map appletPay(Map map); + + /** + * 根据订单号修改订单支付状态 + * @param orderNo + * @param status + * @return + */ + public int updateOrderStatus(String orderNo,String status); /** * 添加油品跟踪信息 diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/OilOrderServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/OilOrderServiceImpl.java index 12fc57803..e640b6f26 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/OilOrderServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/OilOrderServiceImpl.java @@ -435,7 +435,7 @@ public class OilOrderServiceImpl extends ServiceImpl i private OilNumberService oilNumberService; @Override - public boolean appletPay(Map map) { + public Map appletPay(Map map) { String orderNo = map.get("orderNo"); // 支付金额 Integer payAmount = (int) (Double.valueOf(map.get("payAmount"))*100); @@ -482,10 +482,13 @@ public class OilOrderServiceImpl extends ServiceImpl i } if (result){ - return false; + return null; } oilOrder.setTankId(tankId); + + Map applet = null; + if (!map.get("payAmount").equals("0")) { // 调用支付接口 // 判断是否开启支付规则 @@ -522,7 +525,8 @@ public class OilOrderServiceImpl extends ServiceImpl i // 调用支付接口 try { - fyPayService.applet(map1); + applet = fyPayService.applet(map1); + applet.put("orderNo",orderNo); } catch (Exception e) { e.printStackTrace(); } @@ -536,7 +540,21 @@ public class OilOrderServiceImpl extends ServiceImpl i oilOrder.setOrderStatus("paid"); baseMapper.updateById(oilOrder); } - return true; + return applet; + } + + @Override + public int updateOrderStatus(String orderNo, String status) { + int row = 0; + OilOrder oilOrder = this.selectOilOrderByOrderNo(orderNo); + if (ObjectUtil.isNotEmpty(oilOrder)){ + oilOrder.setOrderStatus(status); + if (status.equals("paid")){ + oilOrder.setPayTime(new Date()); + } + row = baseMapper.updateById(oilOrder); + } + return 0; } @Autowired @@ -625,7 +643,7 @@ public class OilOrderServiceImpl extends ServiceImpl i Integer dieselGrowthValue = null; Integer naturalGrowthValue = null; LJStore store = storeService.selectStoreByStoreId(storeId); - UserBalance balance = userBalanceService.selectUserBalance(userid,store.getChainStoreId()); + UserBalance balance = userBalanceService.selectUserBalance(userid); int growth = balance.getGrowthValue(); balance.setRefuelMoney(refuelMoney); // 查询会员等级列表信息 @@ -685,7 +703,7 @@ public class OilOrderServiceImpl extends ServiceImpl i AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); // 根据用户id查询用户余额信息 LJStore store = storeService.selectStoreByStoreId(storeId); - UserBalance balance = userBalanceService.selectUserBalance(userId,store.getChainStoreId()); + UserBalance balance = userBalanceService.selectUserBalance(userId); // 修改余额信息 Double beforeBalance = balance.getCardBalance(); Double afterBalance = beforeBalance - amount; diff --git a/fuintBackend/fuint-application/src/main/resources/application.properties b/fuintBackend/fuint-application/src/main/resources/application.properties index 8797f5ad3..d9ef9d458 100644 --- a/fuintBackend/fuint-application/src/main/resources/application.properties +++ b/fuintBackend/fuint-application/src/main/resources/application.properties @@ -1,7 +1,8 @@ # \u57FA\u672C\u914D\u7F6E -server.port=8008 +server.port=8080 env.profile=dev -env.properties.path=D:/code/oilSystem/fuintBackend/configure/ +env.properties.path=D:/workspaces/oilSystem/fuintBackend/configure/ + # \u6570\u636E\u5E93\u914D\u7F6E spring.datasource.type=com.zaxxer.hikari.HikariDataSource @@ -20,7 +21,7 @@ spring.servlet.multipart.max-request-size=10MB # mybatis\u914D\u7F6E mybatis-plus.mapper-locations = classpath*:/mapper/*Mapper.xml,classpath*:com/fuint/**/xml/*Mapper.xml -# �����Զ��������� +# \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u0536\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD mybatis-plus.configuration.intercepts=com.example.MyInterceptor # \u9ED8\u8BA4\u65F6\u95F4\u683C\u5F0F spring.jackson.date-format=yyyy-MM-dd HH:mm:ss diff --git a/gasStation-uni/manifest.json b/gasStation-uni/manifest.json index 685ba1e3b..045488d30 100644 --- a/gasStation-uni/manifest.json +++ b/gasStation-uni/manifest.json @@ -50,7 +50,7 @@ /* 小程序特有相关 */ "mp-weixin" : { "output-path" : "dist/myapp", - "appid" : "wxba517a9bac38fe92", + "appid" : "wxd8014eaf9bd72e93", "setting" : { "urlCheck" : false, "es6" : true, diff --git a/gasStation-uni/pages.json b/gasStation-uni/pages.json index 7ef309ffb..dba892e58 100644 --- a/gasStation-uni/pages.json +++ b/gasStation-uni/pages.json @@ -151,6 +151,13 @@ "navigationBarTitleText": "支付订单", "navigationStyle": "custom" } + }, + { + "path": "orderSuccess/index", + "style": { + "navigationBarTitleText": "支付完成页", + "navigationStyle": "custom" + } } ] }, diff --git a/gasStation-uni/pages/index/index.vue b/gasStation-uni/pages/index/index.vue index 674ab6fdc..ec2ae5b13 100644 --- a/gasStation-uni/pages/index/index.vue +++ b/gasStation-uni/pages/index/index.vue @@ -104,7 +104,7 @@ - + 立即领取 @@ -122,9 +122,10 @@ export default { data() { return { + joinmsg: '', msg: "1", show: false, - shows: true, + shows: '', title: '', oilTypeList: '', columns: [ @@ -184,12 +185,66 @@ this.getOilType(); }, onShow() { + this.isJoined() // this.isExistStoreId(); }, components: { tabbar }, methods: { + //判断是否是新人 + isJoined() { + request({ + url: 'business/marketingActivity/activeNewlywedsRecords/applet', + method: 'get', + }).then(res => { + console.log("11111" + res) + if (res.code == 200 && res.data == 1) { + this.shows = true + } else { + this.shows = false + } + }) + }, + //立即领取 + drawDown() { + /* this.shows = false */ + request({ + url: 'business/marketingActivity/activeNewlywedsRecords', + method: 'post', + data: { + + } + }).then(res => { + console.log("11111" + res) + if (res.code == 200 && res.data == true) { + this.shows = false + uni.showToast({ + title: '领取成功!' + }) + } else { + this.shows = false + uni.showToast({ + title: '领取失败!' + }) + } + + /* if (res.code == 200 && res.data == 1) { + this.shows = true + } else { + this.shows = false + } */ + }) + }, + //查询新人有礼礼品 + selectActiveNewlyweds() { + request({ + url: 'business/marketingActivity/activeNewlyweds/applet', + method: 'get', + }).then(res => { + console.log("11111" + res) + }) + }, isExistStoreId() { if (uni.getStorageSync("storeId") != "") { this.getStore(uni.getStorageSync("storeId")); @@ -243,6 +298,14 @@ _this.welfare.push(response.data.welfare) } } + if (response.data.doorstepPhoto != undefined && response.data + .doorstepPhoto != null && response.data.doorstepPhoto != "") { + let list = JSON.parse(response.data.doorstepPhoto) + _this.list3 = []; + list.forEach(item => { + _this.list3.push(_this.baseUrl + item) + }) + } }).catch((res) => { uni.showLoading({ title: res + "---" + 1 @@ -268,14 +331,18 @@ "lat": res.latitude }, }).then((response) => { - _this.distance = (Math.ceil(response.data.distance)).toFixed(1) + _this.distance = (Math.ceil(response.data.distance)) + .toFixed(1) _this.store = response.data.store uni.setStorageSync("storeId", response.data.store.id) - uni.setStorageSync("chainStoreId", response.data.store.chainStoreId) + uni.setStorageSync("chainStoreId", response.data.store + .chainStoreId) let welfare = response.data.store.welfare - if (welfare != undefined && welfare != null && welfare != "") { + if (welfare != undefined && welfare != null && + welfare != "") { if (welfare.includes(",")) { - _this.welfare = response.data.store.welfare.split(",") + _this.welfare = response.data.store.welfare + .split(",") } else { _this.welfare.push(response.data.store.welfare) } @@ -342,12 +409,13 @@ cancel() { this.show = false }, - onOverlay() { + /* onOverlay() { + this.drawDown(); this.shows = false uni.showToast({ title: '领取成功' }) - }, + }, */ goActivity() { // 去活动页 uni.navigateTo({ @@ -667,4 +735,4 @@ color: white; margin: 0 auto; } - + \ No newline at end of file diff --git a/gasStation-uni/pages/my/my.vue b/gasStation-uni/pages/my/my.vue index 11c1a125f..f7b13d23b 100644 --- a/gasStation-uni/pages/my/my.vue +++ b/gasStation-uni/pages/my/my.vue @@ -263,9 +263,12 @@ url: '/business/userManager/user/getUserBalance', method: 'get', }).then(res => { - console.log(res) + // console.log(res,111222) if (res.code == 200) { this.cardBalance = res.data.cardBalance, + /* if (res.data.refuelMoney!=null && res.data.refuelMoney!=""){ + this.refuelMoney = JSON.parse(res.data.refuelMoney); + } */ this.refuelMoney = JSON.parse(res.data.refuelMoney); } }) @@ -276,7 +279,7 @@ method: 'get', params: this.query }).then(res => { - console.log(res) + // console.log(res) if (res.code == 200) { this.cardsList = res.data.records } @@ -285,13 +288,13 @@ // 查询我的积分 getUserInfoList() { request({ - url: '/business/userManager/user/getByUniApp', + url: 'business/userManager/user/getByUniApp', method: 'get', params: { chainStoreId: this.chainStoreId } }).then((res) => { - if (res.code == 200) { + if (res.code == 200 && res.data!=null) { this.myPoints = res.data.points } }) @@ -469,4 +472,4 @@ .centenr-size { font-size: 14px; } - \ No newline at end of file + diff --git a/gasStation-uni/pages/refuel/refuel.vue b/gasStation-uni/pages/refuel/refuel.vue index f82e57553..fb5038d53 100644 --- a/gasStation-uni/pages/refuel/refuel.vue +++ b/gasStation-uni/pages/refuel/refuel.vue @@ -8,7 +8,8 @@ - + + {{store.name}}{{store.description ? "("+store.description+")" : ""}} diff --git a/gasStation-uni/pagesHome/activeIn/index.vue b/gasStation-uni/pagesHome/activeIn/index.vue index 9aaf11b90..f27f34cfd 100644 --- a/gasStation-uni/pagesHome/activeIn/index.vue +++ b/gasStation-uni/pagesHome/activeIn/index.vue @@ -158,7 +158,7 @@ - + 去参与 - + + + {{item.createTime}} @@ -62,9 +65,12 @@ + + \ No newline at end of file