diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9e8ec2a --- /dev/null +++ b/.gitignore @@ -0,0 +1,22 @@ +.DS_Store +node_modules +/dist + +# local env files +.env.local +.env.*.local + +# Log files +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Editor directories and files +.idea +.vscode +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw* +target \ No newline at end of file diff --git a/admin-hanhai-vue/.env.development b/admin-hanhai-vue/.env.development index 5690da3..a7a7eb0 100644 --- a/admin-hanhai-vue/.env.development +++ b/admin-hanhai-vue/.env.development @@ -1,5 +1,5 @@ NODE_ENV=development -VUE_APP_API_BASE_URL=https://admin.hhlm1688.com/api/ +VUE_APP_API_BASE_URL=http://localhost:8081/api/ VUE_APP_CAS_BASE_URL=http://cas.example.org:8443/cas VUE_APP_ONLINE_BASE_URL=http://fileview.jeecg.com/onlinePreview diff --git a/admin-hanhai-vue/.env.production b/admin-hanhai-vue/.env.production index ed67425..9e94d96 100644 --- a/admin-hanhai-vue/.env.production +++ b/admin-hanhai-vue/.env.production @@ -1,4 +1,4 @@ NODE_ENV=production -VUE_APP_API_BASE_URL=https://admin.hhlm1688.com/api/ +VUE_APP_API_BASE_URL=http://localhost:8081/api/ VUE_APP_CAS_BASE_URL=http://localhost:8888/cas VUE_APP_ONLINE_BASE_URL=http://fileview.jeecg.com/onlinePreview \ No newline at end of file diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/cityGift/controller/CityGiftController.java b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/cityGift/controller/CityGiftController.java new file mode 100644 index 0000000..d786db9 --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/cityGift/controller/CityGiftController.java @@ -0,0 +1,171 @@ +package org.jeecg.modules.cityGift.controller; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.common.util.oConvertUtils; +import org.jeecg.modules.cityGift.entity.CityGift; +import org.jeecg.modules.cityGift.service.ICityGiftService; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.extern.slf4j.Slf4j; + +import org.jeecgframework.poi.excel.ExcelImportUtil; +import org.jeecgframework.poi.excel.def.NormalExcelConstants; +import org.jeecgframework.poi.excel.entity.ExportParams; +import org.jeecgframework.poi.excel.entity.ImportParams; +import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; +import org.jeecg.common.system.base.controller.JeecgController; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springframework.web.servlet.ModelAndView; +import com.alibaba.fastjson.JSON; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.jeecg.common.aspect.annotation.AutoLog; + + /** + * @Description: 礼物表 + * @Author: jeecg-boot + * @Date: 2025-06-18 + * @Version: V1.0 + */ +@Api(tags="礼物表") +@RestController +@RequestMapping("/cityGift/cityGift") +@Slf4j +public class CityGiftController extends JeecgController { + @Autowired + private ICityGiftService cityGiftService; + + /** + * 分页列表查询 + * + * @param cityGift + * @param pageNo + * @param pageSize + * @param req + * @return + */ + //@AutoLog(value = "礼物表-分页列表查询") + @ApiOperation(value="礼物表-分页列表查询", notes="礼物表-分页列表查询") + @GetMapping(value = "/list") + public Result> queryPageList(CityGift cityGift, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(cityGift, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + IPage pageList = cityGiftService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 添加 + * + * @param cityGift + * @return + */ + @AutoLog(value = "礼物表-添加") + @ApiOperation(value="礼物表-添加", notes="礼物表-添加") + @PostMapping(value = "/add") + public Result add(@RequestBody CityGift cityGift) { + cityGiftService.save(cityGift); + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param cityGift + * @return + */ + @AutoLog(value = "礼物表-编辑") + @ApiOperation(value="礼物表-编辑", notes="礼物表-编辑") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) + public Result edit(@RequestBody CityGift cityGift) { + cityGiftService.updateById(cityGift); + return Result.OK("编辑成功!"); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @AutoLog(value = "礼物表-通过id删除") + @ApiOperation(value="礼物表-通过id删除", notes="礼物表-通过id删除") + @DeleteMapping(value = "/delete") + public Result delete(@RequestParam(name="id",required=true) String id) { + cityGiftService.removeById(id); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @AutoLog(value = "礼物表-批量删除") + @ApiOperation(value="礼物表-批量删除", notes="礼物表-批量删除") + @DeleteMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name="ids",required=true) String ids) { + this.cityGiftService.removeByIds(Arrays.asList(ids.split(","))); + return Result.OK("批量删除成功!"); + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + //@AutoLog(value = "礼物表-通过id查询") + @ApiOperation(value="礼物表-通过id查询", notes="礼物表-通过id查询") + @GetMapping(value = "/queryById") + public Result queryById(@RequestParam(name="id",required=true) String id) { + CityGift cityGift = cityGiftService.getById(id); + if(cityGift==null) { + return Result.error("未找到对应数据"); + } + return Result.OK(cityGift); + } + + /** + * 导出excel + * + * @param request + * @param cityGift + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, CityGift cityGift) { + return super.exportXls(request, cityGift, CityGift.class, "礼物表"); + } + + /** + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, CityGift.class); + } + +} diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/cityGift/entity/CityGift.java b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/cityGift/entity/CityGift.java new file mode 100644 index 0000000..b65fc0c --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/cityGift/entity/CityGift.java @@ -0,0 +1,79 @@ +package org.jeecg.modules.cityGift.entity; + +import java.io.Serializable; +import java.io.UnsupportedEncodingException; +import java.util.Date; +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.springframework.format.annotation.DateTimeFormat; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.jeecg.common.aspect.annotation.Dict; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + * @Description: 礼物表 + * @Author: jeecg-boot + * @Date: 2025-06-18 + * @Version: V1.0 + */ +@Data +@TableName("city_gift") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="city_gift对象", description="礼物表") +public class CityGift implements Serializable { + private static final long serialVersionUID = 1L; + + /**主键*/ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "主键") + private java.lang.String id; + /**创建人*/ + @ApiModelProperty(value = "创建人") + private java.lang.String createBy; + /**创建日期*/ + @ApiModelProperty(value = "创建日期") + private java.util.Date createTime; + /**更新人*/ + @ApiModelProperty(value = "更新人") + private java.lang.String updateBy; + /**更新日期*/ + @ApiModelProperty(value = "更新日期") + private java.util.Date updateTime; + /**类型*/ + @Excel(name = "类型", width = 15) + @ApiModelProperty(value = "类型") + private java.lang.Integer type; + /**标题*/ + @Excel(name = "标题", width = 15) + @ApiModelProperty(value = "标题") + private java.lang.String title; + /**图片*/ + @Excel(name = "图片", width = 15) + @ApiModelProperty(value = "图片") + private java.lang.String img; + /**关联商品*/ + @Excel(name = "关联商品", width = 15, dictTable = "city_shopping", dicText = "name", dicCode = "id") + @Dict(dictTable = "city_shopping", dicText = "name", dicCode = "id") + @ApiModelProperty(value = "关联商品") + private java.lang.String shopId; + /**红包金额*/ + @Excel(name = "红包金额", width = 15) + @ApiModelProperty(value = "红包金额") + private java.math.BigDecimal price; + /**概率值*/ + @Excel(name = "概率值", width = 15) + @ApiModelProperty(value = "概率值") + private java.math.BigDecimal num; + /**中奖人数*/ + @Excel(name = "中奖人数", width = 15) + @ApiModelProperty(value = "中奖人数") + private java.lang.Integer giveNum; +} diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/cityGift/mapper/CityGiftMapper.java b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/cityGift/mapper/CityGiftMapper.java new file mode 100644 index 0000000..4b69645 --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/cityGift/mapper/CityGiftMapper.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.cityGift.mapper; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.cityGift.entity.CityGift; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Description: 礼物表 + * @Author: jeecg-boot + * @Date: 2025-06-18 + * @Version: V1.0 + */ +public interface CityGiftMapper extends BaseMapper { + +} diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/cityGift/mapper/xml/CityGiftMapper.xml b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/cityGift/mapper/xml/CityGiftMapper.xml new file mode 100644 index 0000000..0066cb4 --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/cityGift/mapper/xml/CityGiftMapper.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/cityGift/service/ICityGiftService.java b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/cityGift/service/ICityGiftService.java new file mode 100644 index 0000000..53c7967 --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/cityGift/service/ICityGiftService.java @@ -0,0 +1,14 @@ +package org.jeecg.modules.cityGift.service; + +import org.jeecg.modules.cityGift.entity.CityGift; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * @Description: 礼物表 + * @Author: jeecg-boot + * @Date: 2025-06-18 + * @Version: V1.0 + */ +public interface ICityGiftService extends IService { + +} diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/cityGift/service/impl/CityGiftServiceImpl.java b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/cityGift/service/impl/CityGiftServiceImpl.java new file mode 100644 index 0000000..237d9d5 --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/cityGift/service/impl/CityGiftServiceImpl.java @@ -0,0 +1,19 @@ +package org.jeecg.modules.cityGift.service.impl; + +import org.jeecg.modules.cityGift.entity.CityGift; +import org.jeecg.modules.cityGift.mapper.CityGiftMapper; +import org.jeecg.modules.cityGift.service.ICityGiftService; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +/** + * @Description: 礼物表 + * @Author: jeecg-boot + * @Date: 2025-06-18 + * @Version: V1.0 + */ +@Service +public class CityGiftServiceImpl extends ServiceImpl implements ICityGiftService { + +} diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/cityGift/vue/CityGiftList.vue b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/cityGift/vue/CityGiftList.vue new file mode 100644 index 0000000..31f4aa0 --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/cityGift/vue/CityGiftList.vue @@ -0,0 +1,209 @@ + + + + \ No newline at end of file diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/cityGift/vue/modules/CityGiftForm.vue b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/cityGift/vue/modules/CityGiftForm.vue new file mode 100644 index 0000000..0b7d808 --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/cityGift/vue/modules/CityGiftForm.vue @@ -0,0 +1,134 @@ + + + \ No newline at end of file diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/cityGift/vue/modules/CityGiftModal.Style#Drawer.vue b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/cityGift/vue/modules/CityGiftModal.Style#Drawer.vue new file mode 100644 index 0000000..bcf4d4d --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/cityGift/vue/modules/CityGiftModal.Style#Drawer.vue @@ -0,0 +1,84 @@ + + + + + \ No newline at end of file diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/cityGift/vue/modules/CityGiftModal.vue b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/cityGift/vue/modules/CityGiftModal.vue new file mode 100644 index 0000000..39fe99a --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/cityGift/vue/modules/CityGiftModal.vue @@ -0,0 +1,60 @@ + + + \ No newline at end of file diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/cityGift/vue3/CityGift.api.ts b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/cityGift/vue3/CityGift.api.ts new file mode 100644 index 0000000..a6b0b9a --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/cityGift/vue3/CityGift.api.ts @@ -0,0 +1,61 @@ +import {defHttp} from '/@/utils/http/axios'; +import {Modal} from 'ant-design-vue'; + +enum Api { + list = '/cityGift/cityGift/list', + save='/cityGift/cityGift/add', + edit='/cityGift/cityGift/edit', + deleteOne = '/cityGift/cityGift/delete', + deleteBatch = '/cityGift/cityGift/deleteBatch', + importExcel = '/cityGift/cityGift/importExcel', + exportXls = '/cityGift/cityGift/exportXls', +} +/** + * 导出api + * @param params + */ +export const getExportUrl = Api.exportXls; +/** + * 导入api + */ +export const getImportUrl = Api.importExcel; +/** + * 列表接口 + * @param params + */ +export const list = (params) => + defHttp.get({url: Api.list, params}); + +/** + * 删除单个 + */ +export const deleteOne = (params,handleSuccess) => { + return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => { + handleSuccess(); + }); +} +/** + * 批量删除 + * @param params + */ +export const batchDelete = (params, handleSuccess) => { + Modal.confirm({ + title: '确认删除', + content: '是否删除选中数据', + okText: '确认', + cancelText: '取消', + onOk: () => { + return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => { + handleSuccess(); + }); + } + }); +} +/** + * 保存或者更新 + * @param params + */ +export const saveOrUpdate = (params, isUpdate) => { + let url = isUpdate ? Api.edit : Api.save; + return defHttp.post({url: url, params}); +} diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/cityGift/vue3/CityGift.data.ts b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/cityGift/vue3/CityGift.data.ts new file mode 100644 index 0000000..bc2aa17 --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/cityGift/vue3/CityGift.data.ts @@ -0,0 +1,89 @@ +import {BasicColumn} from '/@/components/Table'; +import {FormSchema} from '/@/components/Table'; +import { rules} from '/@/utils/helper/validator'; +import { render } from '/@/utils/common/renderUtils'; +//列表数据 +export const columns: BasicColumn[] = [ + { + title: '类型', + align:"center", + dataIndex: 'type' + }, + { + title: '标题', + align:"center", + dataIndex: 'title' + }, + { + title: '图片', + align:"center", + dataIndex: 'img', + customRender:render.renderAvatar, + }, + { + title: '关联商品', + align:"center", + dataIndex: 'shopId_dictText' + }, + { + title: '红包金额', + align:"center", + dataIndex: 'price' + }, + { + title: '概率值', + align:"center", + dataIndex: 'num' + }, + { + title: '中奖人数', + align:"center", + dataIndex: 'giveNum' + }, +]; +//查询数据 +export const searchFormSchema: FormSchema[] = [ +]; +//表单数据 +export const formSchema: FormSchema[] = [ + { + label: '类型', + field: 'type', + component: 'InputNumber', + }, + { + label: '标题', + field: 'title', + component: 'Input', + }, + { + label: '图片', + field: 'img', + component: 'JImageUpload', + componentProps:{ + }, + }, + { + label: '关联商品', + field: 'shopId', + component: 'JSearchSelect', + componentProps:{ + dict:"city_shopping,name,id" + }, + }, + { + label: '红包金额', + field: 'price', + component: 'InputNumber', + }, + { + label: '概率值', + field: 'num', + component: 'InputNumber', + }, + { + label: '中奖人数', + field: 'giveNum', + component: 'InputNumber', + }, +]; diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/cityGift/vue3/CityGiftList.vue b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/cityGift/vue3/CityGiftList.vue new file mode 100644 index 0000000..6237235 --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/cityGift/vue3/CityGiftList.vue @@ -0,0 +1,162 @@ + + + + + \ No newline at end of file diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/cityGift/vue3/components/CityGiftModal.vue b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/cityGift/vue3/components/CityGiftModal.vue new file mode 100644 index 0000000..9cd1284 --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/cityGift/vue3/components/CityGiftModal.vue @@ -0,0 +1,58 @@ + + + + + \ No newline at end of file diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/hanHaiMember/controller/HanHaiMemberController.java b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/hanHaiMember/controller/HanHaiMemberController.java index 1692442..9067108 100644 --- a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/hanHaiMember/controller/HanHaiMemberController.java +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/hanHaiMember/controller/HanHaiMemberController.java @@ -39,7 +39,7 @@ import org.jeecg.common.aspect.annotation.AutoLog; /** * @Description: 用户账户表 * @Author: jeecg-boot - * @Date: 2024-10-29 + * @Date: 2025-06-18 * @Version: V1.0 */ @Api(tags="用户账户表") diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/hanHaiMember/entity/HanHaiMember.java b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/hanHaiMember/entity/HanHaiMember.java index cb864d6..4a351f2 100644 --- a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/hanHaiMember/entity/HanHaiMember.java +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/hanHaiMember/entity/HanHaiMember.java @@ -20,7 +20,7 @@ import lombok.experimental.Accessors; /** * @Description: 用户账户表 * @Author: jeecg-boot - * @Date: 2024-10-29 + * @Date: 2025-06-18 * @Version: V1.0 */ @Data @@ -166,7 +166,8 @@ public class HanHaiMember implements Serializable { @ApiModelProperty(value = "邀请时间") private java.util.Date vtime; /**会员*/ - @Excel(name = "会员", width = 15) + @Excel(name = "会员", width = 15, dicCode = "is_pay_no") + @Dict(dicCode = "is_pay_no") @ApiModelProperty(value = "会员") private java.lang.Integer isPay; /**是否关注公众号*/ @@ -205,4 +206,20 @@ public class HanHaiMember implements Serializable { @Excel(name = "地址", width = 15) @ApiModelProperty(value = "地址") private java.lang.String address; + /**初中学校名称*/ + @Excel(name = "初中学校名称", width = 15) + @ApiModelProperty(value = "初中学校名称") + private java.lang.String czSchool; + /**高中学校名称*/ + @Excel(name = "高中学校名称", width = 15) + @ApiModelProperty(value = "高中学校名称") + private java.lang.String gzSchool; + /**是否客服*/ + @Excel(name = "是否客服", width = 15) + @ApiModelProperty(value = "是否客服") + private java.lang.String isFu; + /**微信二维码*/ + @Excel(name = "微信二维码", width = 15) + @ApiModelProperty(value = "微信二维码") + private java.lang.String wxCode; } diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/hanHaiMember/mapper/HanHaiMemberMapper.java b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/hanHaiMember/mapper/HanHaiMemberMapper.java index fcd5fd1..28e5172 100644 --- a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/hanHaiMember/mapper/HanHaiMemberMapper.java +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/hanHaiMember/mapper/HanHaiMemberMapper.java @@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; /** * @Description: 用户账户表 * @Author: jeecg-boot - * @Date: 2024-10-29 + * @Date: 2025-06-18 * @Version: V1.0 */ public interface HanHaiMemberMapper extends BaseMapper { diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/hanHaiMember/service/IHanHaiMemberService.java b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/hanHaiMember/service/IHanHaiMemberService.java index 1148c37..d7d82ce 100644 --- a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/hanHaiMember/service/IHanHaiMemberService.java +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/hanHaiMember/service/IHanHaiMemberService.java @@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.extension.service.IService; /** * @Description: 用户账户表 * @Author: jeecg-boot - * @Date: 2024-10-29 + * @Date: 2025-06-18 * @Version: V1.0 */ public interface IHanHaiMemberService extends IService { diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/hanHaiMember/service/impl/HanHaiMemberServiceImpl.java b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/hanHaiMember/service/impl/HanHaiMemberServiceImpl.java index 7fb38e7..59eeffb 100644 --- a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/hanHaiMember/service/impl/HanHaiMemberServiceImpl.java +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/hanHaiMember/service/impl/HanHaiMemberServiceImpl.java @@ -10,7 +10,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; /** * @Description: 用户账户表 * @Author: jeecg-boot - * @Date: 2024-10-29 + * @Date: 2025-06-18 * @Version: V1.0 */ @Service diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/hanHaiMember/vue/HanHaiMemberList.vue b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/hanHaiMember/vue/HanHaiMemberList.vue index cf5e30b..d2a8844 100644 --- a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/hanHaiMember/vue/HanHaiMemberList.vue +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/hanHaiMember/vue/HanHaiMemberList.vue @@ -10,19 +10,19 @@ - - + + @@ -170,11 +170,6 @@ dataIndex: 'headImage', scopedSlots: {customRender: 'imgSlot'} }, - { - title:'真实姓名', - align:"center", - dataIndex: 'name' - }, { title:'手机号码', align:"center", @@ -185,35 +180,20 @@ align:"center", dataIndex: 'appletOpenid' }, - { - title:'身份证号码', - align:"center", - dataIndex: 'idCard' - }, { title:'是否实名认证', align:"center", dataIndex: 'idCardOpen' }, - { - title:'粉丝人数', - align:"center", - dataIndex: 'intentionNum' - }, { title:'邀请人', align:"center", dataIndex: 'shareId_dictText' }, - { - title:'邀请时间', - align:"center", - dataIndex: 'vtime' - }, { title:'会员', align:"center", - dataIndex: 'isPay' + dataIndex: 'isPay_dictText' }, { title:'余额', @@ -240,6 +220,28 @@ align:"center", dataIndex: 'address' }, + { + title:'初中学校名称', + align:"center", + dataIndex: 'czSchool' + }, + { + title:'高中学校名称', + align:"center", + dataIndex: 'gzSchool' + }, + { + title:'是否客服', + align:"center", + dataIndex: 'isFu', + customRender: (text) => (text ? filterMultiDictText(this.dictOptions['isFu'], text) : ''), + }, + { + title:'微信二维码', + align:"center", + dataIndex: 'wxCode', + scopedSlots: {customRender: 'imgSlot'} + }, { title: '操作', dataIndex: 'action', @@ -262,6 +264,7 @@ } }, created() { + this.$set(this.dictOptions, 'isFu', [{text:'是',value:'Y'},{text:'否',value:'N'}]) this.getSuperFieldList(); }, computed: { @@ -277,20 +280,20 @@ fieldList.push({type:'datetime',value:'createTime',text:'创建日期'}) fieldList.push({type:'string',value:'nickName',text:'昵称',dictCode:''}) fieldList.push({type:'string',value:'headImage',text:'用户头像',dictCode:''}) - fieldList.push({type:'string',value:'name',text:'真实姓名',dictCode:''}) fieldList.push({type:'string',value:'phone',text:'手机号码',dictCode:''}) fieldList.push({type:'string',value:'appletOpenid',text:'小程序标识',dictCode:''}) - fieldList.push({type:'string',value:'idCard',text:'身份证号码',dictCode:''}) fieldList.push({type:'int',value:'idCardOpen',text:'是否实名认证',dictCode:'card_open_state'}) - fieldList.push({type:'int',value:'intentionNum',text:'粉丝人数',dictCode:''}) fieldList.push({type:'sel_search',value:'shareId',text:'邀请人',dictTable:"han_hai_member", dictText:'nick_name', dictCode:'id'}) - fieldList.push({type:'datetime',value:'vtime',text:'邀请时间'}) - fieldList.push({type:'int',value:'isPay',text:'会员',dictCode:''}) + fieldList.push({type:'int',value:'isPay',text:'会员',dictCode:'is_pay_no'}) fieldList.push({type:'BigDecimal',value:'price',text:'余额',dictCode:''}) fieldList.push({type:'BigDecimal',value:'integerPrice',text:'积分',dictCode:''}) fieldList.push({type:'string',value:'sex',text:'性别',dictCode:''}) fieldList.push({type:'int',value:'yearDate',text:'出生年',dictCode:''}) fieldList.push({type:'string',value:'address',text:'地址',dictCode:''}) + fieldList.push({type:'string',value:'czSchool',text:'初中学校名称',dictCode:''}) + fieldList.push({type:'string',value:'gzSchool',text:'高中学校名称',dictCode:''}) + fieldList.push({type:'switch',value:'isFu',text:'是否客服'}) + fieldList.push({type:'Text',value:'wxCode',text:'微信二维码',dictCode:''}) this.superFieldList = fieldList } } diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/hanHaiMember/vue/modules/HanHaiMemberForm.vue b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/hanHaiMember/vue/modules/HanHaiMemberForm.vue index 18557f1..9ea4ccc 100644 --- a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/hanHaiMember/vue/modules/HanHaiMemberForm.vue +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/hanHaiMember/vue/modules/HanHaiMemberForm.vue @@ -13,11 +13,6 @@ - - - - - @@ -28,34 +23,19 @@ - - - - - - - - - - - - - - - - + @@ -83,6 +63,26 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/hanHaiMember/vue3/HanHaiMember.data.ts b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/hanHaiMember/vue3/HanHaiMember.data.ts index 3d6dd18..ab8410c 100644 --- a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/hanHaiMember/vue3/HanHaiMember.data.ts +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/hanHaiMember/vue3/HanHaiMember.data.ts @@ -20,11 +20,6 @@ export const columns: BasicColumn[] = [ dataIndex: 'headImage', customRender:render.renderAvatar, }, - { - title: '真实姓名', - align:"center", - dataIndex: 'name' - }, { title: '手机号码', align:"center", @@ -35,35 +30,20 @@ export const columns: BasicColumn[] = [ align:"center", dataIndex: 'appletOpenid' }, - { - title: '身份证号码', - align:"center", - dataIndex: 'idCard' - }, { title: '是否实名认证', align:"center", dataIndex: 'idCardOpen' }, - { - title: '粉丝人数', - align:"center", - dataIndex: 'intentionNum' - }, { title: '邀请人', align:"center", dataIndex: 'shareId_dictText' }, - { - title: '邀请时间', - align:"center", - dataIndex: 'vtime' - }, { title: '会员', align:"center", - dataIndex: 'isPay' + dataIndex: 'isPay_dictText' }, { title: '余额', @@ -90,6 +70,30 @@ export const columns: BasicColumn[] = [ align:"center", dataIndex: 'address' }, + { + title: '初中学校名称', + align:"center", + dataIndex: 'czSchool' + }, + { + title: '高中学校名称', + align:"center", + dataIndex: 'gzSchool' + }, + { + title: '是否客服', + align:"center", + dataIndex: 'isFu', + customRender:({text}) => { + return render.renderSwitch(text, [{text:'是',value:'Y'},{text:'否',value:'N'}]) + }, + }, + { + title: '微信二维码', + align:"center", + dataIndex: 'wxCode', + customRender:render.renderAvatar, + }, ]; //查询数据 export const searchFormSchema: FormSchema[] = [ @@ -97,12 +101,6 @@ export const searchFormSchema: FormSchema[] = [ label: "昵称", field: "nickName", component: 'Input', - colProps: {span: 6}, - }, - { - label: "真实姓名", - field: "name", - component: 'Input', colProps: {span: 6}, }, { @@ -120,6 +118,15 @@ export const searchFormSchema: FormSchema[] = [ }, colProps: {span: 6}, }, + { + label: "会员", + field: "isPay", + component: 'JDictSelectTag', + componentProps:{ + dictCode:"is_pay_no" + }, + colProps: {span: 6}, + }, ]; //表单数据 export const formSchema: FormSchema[] = [ @@ -135,11 +142,6 @@ export const formSchema: FormSchema[] = [ componentProps:{ }, }, - { - label: '真实姓名', - field: 'name', - component: 'Input', - }, { label: '手机号码', field: 'phone', @@ -150,21 +152,11 @@ export const formSchema: FormSchema[] = [ field: 'appletOpenid', component: 'Input', }, - { - label: '身份证号码', - field: 'idCard', - component: 'Input', - }, { label: '是否实名认证', field: 'idCardOpen', component: 'InputNumber', }, - { - label: '粉丝人数', - field: 'intentionNum', - component: 'InputNumber', - }, { label: '邀请人', field: 'shareId', @@ -173,15 +165,13 @@ export const formSchema: FormSchema[] = [ dict:"han_hai_member,nick_name,id" }, }, - { - label: '邀请时间', - field: 'vtime', - component: 'Input', - }, { label: '会员', field: 'isPay', - component: 'InputNumber', + component: 'JDictSelectTag', + componentProps:{ + dictCode:"is_pay_no" + }, }, { label: '余额', @@ -208,4 +198,28 @@ export const formSchema: FormSchema[] = [ field: 'address', component: 'Input', }, + { + label: '初中学校名称', + field: 'czSchool', + component: 'Input', + }, + { + label: '高中学校名称', + field: 'gzSchool', + component: 'Input', + }, + { + label: '是否客服', + field: 'isFu', + component: 'JSwitch', + componentProps:{ + }, + }, + { + label: '微信二维码', + field: 'wxCode', + component: 'JImageUpload', + componentProps:{ + }, + }, ]; diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/service/impl/AppletLoginServiceImpl.java b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/service/impl/AppletLoginServiceImpl.java index 9179923..987026d 100644 --- a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/service/impl/AppletLoginServiceImpl.java +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/service/impl/AppletLoginServiceImpl.java @@ -141,7 +141,7 @@ public class AppletLoginServiceImpl implements AppletLoginService { cityMoneyLog.setTitle("推荐好友获得随机奖金"); cityMoneyLogService.save(cityMoneyLog); //增加奖金 - BigDecimal price = hanHaiMember.getPrice().add(new BigDecimal(5)); + BigDecimal price = hanHaiMember.getPrice().add(bigDecimal); hanHaiMember.setPrice(price); } diff --git a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/service/YaoDuApiService.java b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/service/YaoDuApiService.java index 7e231d2..2f06b30 100644 --- a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/service/YaoDuApiService.java +++ b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/service/YaoDuApiService.java @@ -227,4 +227,34 @@ public interface YaoDuApiService { //编辑我的店铺商品 Result editShopGoods(String token, CityShopping goods); + + //我的租房 + Result getMyRent(String token,PageBean pageBean); + + //编辑我的租房 + Result editMyRent(String token, CityHome home); + + //删除我的租房 + Result deleteMyRent(String token, String id); + + //我的招聘 + Result getMyJob(String token,PageBean pageBean); + + //编辑我的招聘 + Result editMyJob(String token, CityJob job); + + //删除我的招聘 + Result deleteMyJob(String token, String id); + + + + //新-获取我的客服信息列表 + Result getMyService(PageBean pageBean); + + //新-获取大转盘抽奖列表 + Result getLuckDrawList(); + + //新-大转抽奖 + Result luckDraw(String token); + } diff --git a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/service/impl/YaoDuApiServiceImpl.java b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/service/impl/YaoDuApiServiceImpl.java index 351bd28..9b563d4 100644 --- a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/service/impl/YaoDuApiServiceImpl.java +++ b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/service/impl/YaoDuApiServiceImpl.java @@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.TypeReference; import com.aliyun.oss.OSS; import com.aliyun.oss.OSSClientBuilder; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.fasterxml.jackson.databind.ObjectMapper; import com.google.gson.Gson; @@ -55,6 +56,8 @@ import org.jeecg.modules.cityComment.entity.CityComment; import org.jeecg.modules.cityComment.service.ICityCommentService; import org.jeecg.modules.cityConf.entity.CityConf; import org.jeecg.modules.cityConf.service.ICityConfService; +import org.jeecg.modules.cityGift.entity.CityGift; +import org.jeecg.modules.cityGift.service.ICityGiftService; import org.jeecg.modules.cityHome.entity.CityHome; import org.jeecg.modules.cityHome.service.ICityHomeService; import org.jeecg.modules.cityIcon.entity.CityIcon; @@ -84,6 +87,7 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; +import org.springframework.transaction.interceptor.TransactionAspectSupport; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; import org.springframework.web.client.RestTemplate; @@ -91,6 +95,7 @@ import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.commons.CommonsMultipartFile; import javax.annotation.Resource; +import javax.transaction.Transactional; import java.io.*; import java.math.BigDecimal; import java.net.HttpURLConnection; @@ -177,6 +182,8 @@ public class YaoDuApiServiceImpl implements YaoDuApiService { private ICitySignLogService citySignLogService; @Resource private ICityMoneyLogService cityMoneyLogService; + @Resource + private ICityGiftService cityGiftService; //流水记录 @Resource @@ -197,7 +204,8 @@ public class YaoDuApiServiceImpl implements YaoDuApiService { private static final String APP_ID = "wxa4d29e67e8a58d38"; private static final String APP_SECRET = "866e4ba72bd86a4c79403b6b1341461b"; private static final String TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + APP_ID + "&secret=" + APP_SECRET; - private static final String TEMPLATE_MESSAGE_URL = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="; + private static final String TEMPLATE_MESSAGE_URL = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token="; +// String url = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=%s"; //缓存 @@ -1319,8 +1327,9 @@ public class YaoDuApiServiceImpl implements YaoDuApiService { try { String accessToken = getAccessToken2(); if (accessToken != null && !accessToken.isEmpty()) { - this.sendTemplateMessage2(accessToken, openid, templateId, createTemplateData()); - return Result.OK("发送成功"); + Map templateData = createTemplateData(); + this.sendTemplateMessage2(accessToken, openid, templateId,templateData ); + return Result.OK("发送成功", templateData); } else { return Result.error("无法获取Access Token"); } @@ -1333,20 +1342,20 @@ public class YaoDuApiServiceImpl implements YaoDuApiService { private Map createTemplateData() { Map data = new HashMap<>(); - data.put("first", new HashMap() {{ - put("value", "Hello, this is a test message!"); + data.put("thing1", new HashMap() {{ + put("value", "收到评论通知"); put("color", "#173177"); }}); - data.put("keyword1", new HashMap() {{ - put("value", "Keyword1 Value"); + data.put("thing2", new HashMap() {{ + put("value", "评论人"); put("color", "#173177"); }}); - data.put("keyword2", new HashMap() {{ - put("value", "Keyword2 Value"); + data.put("thing3", new HashMap() {{ + put("value", "评论内容"); put("color", "#173177"); }}); - data.put("remark", new HashMap() {{ - put("value", "This is a remark."); + data.put("time4", new HashMap() {{ + put("value", "2020-06-08 11:20:05"); put("color", "#173177"); }}); return data; @@ -1374,6 +1383,14 @@ public class YaoDuApiServiceImpl implements YaoDuApiService { requestBody.put("template_id", templateId); requestBody.put("data", data); + requestBody.put("miniprogram", new HashMap() {{ + put("appid", appid); + put("page", "pages/index/index"); + }}); + + //输出请求体 + System.out.println("Request Body: " + JSON.toJSONString(requestBody)); + ObjectMapper objectMapper = new ObjectMapper(); String jsonRequest = objectMapper.writeValueAsString(requestBody); @@ -1413,7 +1430,9 @@ public class YaoDuApiServiceImpl implements YaoDuApiService { //创建一个新的集合 List newRecords = new ArrayList<>(); for (CityShopping record : records) { - record.setShopId(cityShopService.getById(record.getShopId()).getTitle()); + CityShop byId = cityShopService.getById(record.getShopId()); + record.setShopId(byId.getTitle()); + record.setShop(byId); newRecords.add(record); } page1.setRecords(newRecords); @@ -1485,14 +1504,14 @@ public class YaoDuApiServiceImpl implements YaoDuApiService { Date startDate = Date.from(startOfDay.atZone(ZoneId.systemDefault()).toInstant()); Date endDate = Date.from(endOfDay.atZone(ZoneId.systemDefault()).toInstant()); - CitySignLog one = citySignLogService.lambdaQuery() + List list = citySignLogService.lambdaQuery() .eq(CitySignLog::getUserId, hanHaiMember.getId()) .between(CitySignLog::getCreateTime, startDate, endDate) - .one(); - if(one==null){ - return Result.OK(true); + .list(); + if(list.size()>0){ + return Result.OK(false); } - return Result.OK(false); + return Result.OK(true); } //点击签到 @@ -1651,7 +1670,7 @@ public class YaoDuApiServiceImpl implements YaoDuApiService { Page page1 = cityShoppingService.lambdaQuery() .eq(CityShopping::getShopId, shopId) .eq(CityShopping::getIsOpen, "Y") - .eq(CityShopping::getClassName, 0) +// .eq(CityShopping::getClassName, 0) .orderByDesc(CityShopping::getCreateTime) .page(page); return Result.OK(page1); @@ -1686,4 +1705,209 @@ public class YaoDuApiServiceImpl implements YaoDuApiService { cityShoppingService.saveOrUpdate(goods); return Result.OK("修改成功"); } + + + //我的租房 + @Override + public Result getMyRent(String token,PageBean pageBean){ + HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); + Page page = new Page(pageBean.getPageNo(), pageBean.getPageSize()); + Page page1 = cityHomeService + .lambdaQuery() + .eq(CityHome::getUserId, hanHaiMember.getId()) + .orderByDesc(CityHome::getCreateTime) + .page(page); + return Result.OK(page1); + } + + //编辑我的租房 + @Override + public Result editMyRent(String token, CityHome bean){ + HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); + CityHome cityHome = cityHomeService.getById(bean.getId()); + if(null==cityHome){ + return Result.error("租房不存在"); + } + cityHomeService.saveOrUpdate(bean); + return Result.OK("修改成功"); + } + + //删除我的租房 + @Override + public Result deleteMyRent(String token, String id){ + HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); + CityHome cityHome = cityHomeService.getById(id); + if(null==cityHome){ + return Result.error("租房不存在"); + } + cityHomeService.removeById(id); + return Result.OK("删除成功"); + } + + //我的招聘 + @Override + public Result getMyJob(String token,PageBean pageBean){ + HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); + Page page = new Page(pageBean.getPageNo(), pageBean.getPageSize()); + Page page1 = cityJobService + .lambdaQuery() + .eq(CityJob::getUserId, hanHaiMember.getId()) + .orderByDesc(CityJob::getCreateTime) + .page(page); + return Result.OK(page1); + } + + //编辑我的招聘 + @Override + public Result editMyJob(String token, CityJob bean){ + HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); + CityJob cityJob = cityJobService.getById(bean.getId()); + if(null==cityJob){ + return Result.error("招聘不存在"); + } + cityJobService.saveOrUpdate(bean); + return Result.OK("修改成功"); + } + + //删除我的招聘 + @Override + public Result deleteMyJob(String token, String id){ + HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); + CityJob cityJob = cityJobService.getById(id); + if(null==cityJob){ + return Result.error("招聘不存在"); + } + cityJobService.removeById(id); + return Result.OK("删除成功"); + } + + + + + + + //新-获取我的客服信息列表 + @Override + public Result getMyService(PageBean pageBean){ + List y = hanHaiMemberService.lambdaQuery() + .eq(HanHaiMember::getIsFu, "Y") + .list(); + return Result.OK("客服列表查询成功", y); + } + + //新-获取大转盘抽奖列表 + @Override + public Result getLuckDrawList(){ + List list = cityGiftService.list(); + return Result.OK("大转盘信息查询成功",list); + } + + + @Override + @Transactional + public Result luckDraw(String token) { + // 1. 验证用户token有效性 + HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); + if (hanHaiMember == null) { + return Result.error("用户未登录或token已过期"); + } + + // 2. 检查用户积分 + BigDecimal integral = hanHaiMember.getIntegerPrice(); + if (integral == null || integral.compareTo(new BigDecimal(1)) < 0) { + return Result.error("积分不足,需要1积分才能抽奖"); + } + + try { + // 3. 获取所有有效礼品(可以添加状态过滤) + List gifts = cityGiftService.list(); + + if (gifts == null || gifts.isEmpty()) { + return Result.error("暂无可用奖品"); + } + + // 4. 计算总概率值 + BigDecimal totalProbability = gifts.stream() + .map(CityGift::getNum) + .reduce(BigDecimal.ZERO, BigDecimal::add); + + // 5. 生成随机数 + BigDecimal random = new BigDecimal(Math.random()).multiply(totalProbability); + BigDecimal accumulated = BigDecimal.ZERO; + + // 6. 根据概率抽奖 + CityGift winningGift = null; + for (CityGift gift : gifts) { + accumulated = accumulated.add(gift.getNum()); + if (random.compareTo(accumulated) < 0) { + winningGift = gift; + break; + } + } + + // 7. 如果没有抽中任何奖品(理论上不应该发生) + if (winningGift == null) { + winningGift = gifts.get(0); // 默认返回第一个奖品 + } + + // 8. 扣除用户积分 + //增加流水记录 + CityIntgerWater intgerWater = new CityIntgerWater(); + intgerWater.setCreateTime(new Date()); + intgerWater.setIntger(new BigDecimal(5)); + intgerWater.setType(0); + intgerWater.setUserId(hanHaiMember.getId()); + intgerWater.setTitle("大转盘抽奖消耗积分"); + cityIntgerWaterService.save(intgerWater); + + + + + + + hanHaiMember.setIntegerPrice(integral.subtract(new BigDecimal(5))); + boolean updateSuccess = hanHaiMemberService.updateById(hanHaiMember); + if (!updateSuccess) { + throw new RuntimeException("积分扣除失败"); + } + + // 9. 记录中奖信息(如果需要) + if (winningGift.getType() == 0) { + //创建现金红包流水 + CityMoneyLog cityMoneyLog = new CityMoneyLog(); + cityMoneyLog.setCreateTime(new Date()); + cityMoneyLog.setPrice(winningGift.getPrice()); + cityMoneyLog.setState(1); + cityMoneyLog.setType(1); + cityMoneyLog.setUserId(hanHaiMember.getId()); + cityMoneyLog.setTitle("大转盘抽奖获得奖励"); + cityMoneyLogService.save(cityMoneyLog); + + //增加奖金 + BigDecimal price = hanHaiMember.getPrice().add(winningGift.getPrice()); + hanHaiMember.setPrice(price); + hanHaiMemberService.updateById(hanHaiMember); + + } + + // 如果是实物奖品,可能需要处理发货逻辑 + if (winningGift.getType() == 2) { // 假设2表示实物奖品 + // 调用发货逻辑... + } + + // 10. 返回结果 + Map result = new HashMap<>(); + result.put("gift", winningGift); + result.put("remainingIntegral", integral.subtract(new BigDecimal(1))); + + return Result.OK(result); + + } catch (Exception e) { + // 记录错误日志 +// log.error("抽奖失败: {}", e.getMessage(), e); + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + return Result.error("抽奖失败,请稍后再试"); + } + } + } diff --git a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/yaoduapi/YaoDuApiTokenController.java b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/yaoduapi/YaoDuApiTokenController.java index 4cf6753..0fe3d96 100644 --- a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/yaoduapi/YaoDuApiTokenController.java +++ b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/yaoduapi/YaoDuApiTokenController.java @@ -302,5 +302,94 @@ public class YaoDuApiTokenController { public Result editShopGoods(@RequestHeader("X-Access-Token") String token, CityShopping goods){ return yaoDuApiService.editShopGoods(token,goods); } + + + //我的租房 + @ApiOperation(value="我的租房") + @GetMapping("/getMyRent") + public Result getMyRent(@RequestHeader("X-Access-Token") String token,PageBean pageBean){ + return yaoDuApiService.getMyRent(token,pageBean); + } + + //编辑我的租房 + @ApiOperation(value="编辑我的租房") + @PostMapping("/editMyRent") + public Result editMyRent(@RequestHeader("X-Access-Token") String token, CityHome home){ + return yaoDuApiService.editMyRent(token,home); + } + + //删除我的租房 + @ApiOperation(value="删除我的租房") + @PostMapping("/deleteMyRent") + public Result deleteMyRent(@RequestHeader("X-Access-Token") String token, String id){ + return yaoDuApiService.deleteMyRent(token,id); + } + + //我的招聘 + @ApiOperation(value="我的招聘") + @GetMapping("/getMyJob") + public Result getMyJob(@RequestHeader("X-Access-Token") String token,PageBean pageBean){ + return yaoDuApiService.getMyJob(token,pageBean); + } + + //编辑我的招聘 + @ApiOperation(value="编辑我的招聘") + @PostMapping("/editMyJob") + public Result editMyJob(@RequestHeader("X-Access-Token") String token, CityJob job){ + return yaoDuApiService.editMyJob(token,job); + } + + //删除我的招聘 + @ApiOperation(value="删除我的招聘") + @PostMapping("/deleteMyJob") + public Result deleteMyJob(@RequestHeader("X-Access-Token") String token, String id){ + return yaoDuApiService.deleteMyJob(token,id); + } + + + + + + //新-获取我的客服信息列表 + @ApiOperation(value="新-获取我的客服信息列表") + @GetMapping("/getMyService") + public Result getMyService(PageBean pageBean){ + return yaoDuApiService.getMyService(pageBean); + } + + //新-获取大转盘抽奖列表 + @ApiOperation(value="新-获取大转盘抽奖列表") + @GetMapping("/getLuckDrawList") + public Result getLuckDrawList(){ + return yaoDuApiService.getLuckDrawList(); + } + + //新-大转抽奖 + @ApiOperation(value="新-大转抽奖") + @PostMapping("/luckDraw") + public Result luckDraw(@RequestHeader("X-Access-Token") String token){ + return yaoDuApiService.luckDraw(token); + } + + + + + + + + + + + + + + + + + + + + + }