241019更新
This commit is contained in:
@@ -0,0 +1,115 @@
|
||||
package com.gxwebsoft.cms.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.cms.service.DesignCategoryService;
|
||||
import com.gxwebsoft.cms.entity.DesignCategory;
|
||||
import com.gxwebsoft.cms.param.DesignCategoryParam;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设计征集报名分类控制器
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-10-10 09:23:25
|
||||
*/
|
||||
@Api(tags = "设计征集报名分类管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/cms/design-category")
|
||||
public class DesignCategoryController extends BaseController {
|
||||
@Resource
|
||||
private DesignCategoryService designCategoryService;
|
||||
|
||||
@ApiOperation("分页查询设计征集报名分类")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<DesignCategory>> page(DesignCategoryParam param) {
|
||||
// 使用关联查询
|
||||
return success(designCategoryService.pageRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("查询全部设计征集报名分类")
|
||||
@GetMapping()
|
||||
public ApiResult<List<DesignCategory>> list(DesignCategoryParam param) {
|
||||
// 使用关联查询
|
||||
return success(designCategoryService.listRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('cms:designCategory:list')")
|
||||
@ApiOperation("根据id查询设计征集报名分类")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<DesignCategory> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(designCategoryService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@ApiOperation("添加设计征集报名分类")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody DesignCategory designCategory) {
|
||||
// 记录当前登录用户id
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
designCategory.setUserId(loginUser.getUserId());
|
||||
}
|
||||
if (designCategoryService.save(designCategory)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("修改设计征集报名分类")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody DesignCategory designCategory) {
|
||||
if (designCategoryService.updateById(designCategory)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("删除设计征集报名分类")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (designCategoryService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量添加设计征集报名分类")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<DesignCategory> list) {
|
||||
if (designCategoryService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量修改设计征集报名分类")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<DesignCategory> batchParam) {
|
||||
if (batchParam.update(designCategoryService, "id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量删除设计征集报名分类")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (designCategoryService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -207,6 +207,8 @@ public class WebsiteController extends BaseController {
|
||||
|
||||
// 网站导航
|
||||
final NavigationParam navigationParam = new NavigationParam();
|
||||
// 所有导航
|
||||
website.setNavigations(navigationService.listRel(navigationParam));
|
||||
navigationParam.setHide(0);
|
||||
navigationParam.setTop(0);
|
||||
navigationParam.setBottom(null);
|
||||
|
||||
57
src/main/java/com/gxwebsoft/cms/entity/DesignCategory.java
Normal file
57
src/main/java/com/gxwebsoft/cms/entity/DesignCategory.java
Normal file
@@ -0,0 +1,57 @@
|
||||
package com.gxwebsoft.cms.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import java.io.Serializable;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 设计征集报名分类
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-10-10 09:23:25
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "DesignCategory对象", description = "设计征集报名分类")
|
||||
@TableName("cms_design_category")
|
||||
public class DesignCategory implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty(value = "用户ID")
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
||||
private Integer sortNumber;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String comments;
|
||||
|
||||
@ApiModelProperty(value = "状态, 0已发布, 1待审核 2已驳回 3违规内容")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||
@TableLogic
|
||||
private Integer deleted;
|
||||
|
||||
@ApiModelProperty(value = "租户id")
|
||||
private Integer tenantId;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
}
|
||||
@@ -1,10 +1,8 @@
|
||||
package com.gxwebsoft.cms.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import java.io.Serializable;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@@ -27,6 +25,8 @@ public class DesignCollect implements Serializable {
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
private Integer categoryId;
|
||||
|
||||
private String title;
|
||||
|
||||
private String content;
|
||||
@@ -58,4 +58,6 @@ public class DesignCollect implements Serializable {
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private DesignCategory category;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.gxwebsoft.cms.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.gxwebsoft.cms.entity.DesignCategory;
|
||||
import com.gxwebsoft.cms.param.DesignCategoryParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设计征集报名分类Mapper
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-10-10 09:23:25
|
||||
*/
|
||||
public interface DesignCategoryMapper extends BaseMapper<DesignCategory> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param param 查询参数
|
||||
* @return List<DesignCategory>
|
||||
*/
|
||||
List<DesignCategory> selectPageRel(@Param("page") IPage<DesignCategory> page,
|
||||
@Param("param") DesignCategoryParam param);
|
||||
|
||||
/**
|
||||
* 查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<User>
|
||||
*/
|
||||
List<DesignCategory> selectListRel(@Param("param") DesignCategoryParam param);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.gxwebsoft.cms.mapper.DesignCategoryMapper">
|
||||
|
||||
<!-- 关联查询sql -->
|
||||
<sql id="selectSql">
|
||||
SELECT a.*
|
||||
FROM cms_design_category a
|
||||
<where>
|
||||
<if test="param.id != null">
|
||||
AND a.id = #{param.id}
|
||||
</if>
|
||||
<if test="param.title != null">
|
||||
AND a.title LIKE CONCAT('%', #{param.title}, '%')
|
||||
</if>
|
||||
<if test="param.userId != null">
|
||||
AND a.user_id = #{param.userId}
|
||||
</if>
|
||||
<if test="param.sortNumber != null">
|
||||
AND a.sort_number = #{param.sortNumber}
|
||||
</if>
|
||||
<if test="param.comments != null">
|
||||
AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
|
||||
</if>
|
||||
<if test="param.status != null">
|
||||
AND a.status = #{param.status}
|
||||
</if>
|
||||
<if test="param.deleted != null">
|
||||
AND a.deleted = #{param.deleted}
|
||||
</if>
|
||||
<if test="param.deleted == null">
|
||||
AND a.deleted = 0
|
||||
</if>
|
||||
<if test="param.createTimeStart != null">
|
||||
AND a.create_time >= #{param.createTimeStart}
|
||||
</if>
|
||||
<if test="param.createTimeEnd != null">
|
||||
AND a.create_time <= #{param.createTimeEnd}
|
||||
</if>
|
||||
<if test="param.keywords != null">
|
||||
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<!-- 分页查询 -->
|
||||
<select id="selectPageRel" resultType="com.gxwebsoft.cms.entity.DesignCategory">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
<!-- 查询全部 -->
|
||||
<select id="selectListRel" resultType="com.gxwebsoft.cms.entity.DesignCategory">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -10,6 +10,9 @@
|
||||
<if test="param.id != null">
|
||||
AND a.id = #{param.id}
|
||||
</if>
|
||||
<if test="param.categoryId != null">
|
||||
AND a.category_id = #{param.categoryId}
|
||||
</if>
|
||||
<if test="param.title != null">
|
||||
AND a.title LIKE CONCAT('%', #{param.title}, '%')
|
||||
</if>
|
||||
@@ -48,6 +51,7 @@
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY a.sort_number ASC, a.id DESC
|
||||
</sql>
|
||||
|
||||
<!-- 分页查询 -->
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.gxwebsoft.cms.param;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import com.gxwebsoft.common.core.annotation.QueryField;
|
||||
import com.gxwebsoft.common.core.annotation.QueryType;
|
||||
import com.gxwebsoft.common.core.web.BaseParam;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 设计征集报名分类查询参数
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-10-10 09:23:25
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@ApiModel(value = "DesignCategoryParam对象", description = "设计征集报名分类查询参数")
|
||||
public class DesignCategoryParam extends BaseParam {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer id;
|
||||
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty(value = "用户ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer sortNumber;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String comments;
|
||||
|
||||
@ApiModelProperty(value = "状态, 0已发布, 1待审核 2已驳回 3违规内容")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer deleted;
|
||||
|
||||
}
|
||||
@@ -26,6 +26,8 @@ public class DesignCollectParam extends BaseParam {
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer id;
|
||||
|
||||
private Integer categoryId;
|
||||
|
||||
private String title;
|
||||
|
||||
private String content;
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.gxwebsoft.cms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.cms.entity.DesignCategory;
|
||||
import com.gxwebsoft.cms.param.DesignCategoryParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设计征集报名分类Service
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-10-10 09:23:25
|
||||
*/
|
||||
public interface DesignCategoryService extends IService<DesignCategory> {
|
||||
|
||||
/**
|
||||
* 分页关联查询
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return PageResult<DesignCategory>
|
||||
*/
|
||||
PageResult<DesignCategory> pageRel(DesignCategoryParam param);
|
||||
|
||||
/**
|
||||
* 关联查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<DesignCategory>
|
||||
*/
|
||||
List<DesignCategory> listRel(DesignCategoryParam param);
|
||||
|
||||
/**
|
||||
* 根据id查询
|
||||
*
|
||||
* @param id
|
||||
* @return DesignCategory
|
||||
*/
|
||||
DesignCategory getByIdRel(Integer id);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.gxwebsoft.cms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gxwebsoft.cms.mapper.DesignCategoryMapper;
|
||||
import com.gxwebsoft.cms.service.DesignCategoryService;
|
||||
import com.gxwebsoft.cms.entity.DesignCategory;
|
||||
import com.gxwebsoft.cms.param.DesignCategoryParam;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设计征集报名分类Service实现
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-10-10 09:23:25
|
||||
*/
|
||||
@Service
|
||||
public class DesignCategoryServiceImpl extends ServiceImpl<DesignCategoryMapper, DesignCategory> implements DesignCategoryService {
|
||||
|
||||
@Override
|
||||
public PageResult<DesignCategory> pageRel(DesignCategoryParam param) {
|
||||
PageParam<DesignCategory, DesignCategoryParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||
List<DesignCategory> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DesignCategory> listRel(DesignCategoryParam param) {
|
||||
List<DesignCategory> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<DesignCategory, DesignCategoryParam> page = new PageParam<>();
|
||||
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DesignCategory getByIdRel(Integer id) {
|
||||
DesignCategoryParam param = new DesignCategoryParam();
|
||||
param.setId(id);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.gxwebsoft.cms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gxwebsoft.cms.mapper.DesignCollectMapper;
|
||||
import com.gxwebsoft.cms.service.DesignCategoryService;
|
||||
import com.gxwebsoft.cms.service.DesignCollectService;
|
||||
import com.gxwebsoft.cms.entity.DesignCollect;
|
||||
import com.gxwebsoft.cms.param.DesignCollectParam;
|
||||
@@ -9,6 +10,7 @@ import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -19,12 +21,17 @@ import java.util.List;
|
||||
*/
|
||||
@Service
|
||||
public class DesignCollectServiceImpl extends ServiceImpl<DesignCollectMapper, DesignCollect> implements DesignCollectService {
|
||||
@Resource
|
||||
private DesignCategoryService designCategoryService;
|
||||
|
||||
@Override
|
||||
public PageResult<DesignCollect> pageRel(DesignCollectParam param) {
|
||||
PageParam<DesignCollect, DesignCollectParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||
List<DesignCollect> list = baseMapper.selectPageRel(page, param);
|
||||
for (DesignCollect designCollect : list) {
|
||||
designCollect.setCategory(designCategoryService.getByIdRel(designCollect.getCategoryId()));
|
||||
}
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
|
||||
@@ -172,6 +172,17 @@ public class FileController extends BaseController {
|
||||
FileServerUtil.preview(file, getPdfOutDir(), config.getOpenOfficeHome(), response, request);
|
||||
}
|
||||
|
||||
@ApiOperation("下载原文件")
|
||||
@GetMapping("/qrcode/{dir}/{name:.+}")
|
||||
public void qrcode(@PathVariable("dir") String dir, @PathVariable("name") String name,
|
||||
HttpServletResponse response, HttpServletRequest request) {
|
||||
String path = dir + "/" + name;
|
||||
// FileRecord record = fileRecordService.getByIdPath(path);
|
||||
File file = new File(getUploadDir(), path);
|
||||
// String fileName = record == null ? file.getName() : record.getName();
|
||||
FileServerUtil.preview(file, true, name, null, null, response, request);
|
||||
}
|
||||
|
||||
@ApiOperation("下载原文件")
|
||||
@GetMapping("/download/{dir}/{name:.+}")
|
||||
public void download(@PathVariable("dir") String dir, @PathVariable("name") String name,
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.gxwebsoft.shop.controller;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@@ -23,6 +25,7 @@ import javax.annotation.Resource;
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static com.gxwebsoft.common.core.constants.RedisConstants.ACCESS_TOKEN_KEY;
|
||||
|
||||
@@ -52,12 +55,13 @@ public class DealerUserController extends BaseController {
|
||||
return fail("请先登录");
|
||||
}
|
||||
|
||||
final DealerUser dealerUser = dealerUserService.getOne(new LambdaQueryWrapper<DealerUser>().eq(DealerUser::getUserId, loginUserId).last("limit 1"));
|
||||
final DealerUser dealerUser = dealerUserService.getByUserId(loginUserId);
|
||||
|
||||
// 生成小程序码
|
||||
String apiUrl = "https://api.weixin.qq.com/wxa/getwxacode?access_token=" + getAccessToken();
|
||||
String apiUrl = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=" + getAccessToken();
|
||||
final HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("path", "package/dealer/invite?id=" + loginUserId);
|
||||
map.put("scene", loginUserId);
|
||||
map.put("page", "package/dealer/invite");
|
||||
map.put("env_version", "trial"); // 正式版为"release",体验版为"trial",开发版为"develop"
|
||||
|
||||
// 获取图片 Buffer
|
||||
@@ -65,7 +69,7 @@ public class DealerUserController extends BaseController {
|
||||
.body(JSON.toJSONString(map))
|
||||
.execute().bodyBytes();
|
||||
|
||||
// 保存的文件名称
|
||||
// // 保存的文件名称
|
||||
final String fileName = loginUserId.toString().concat(".png");
|
||||
// 保存路径
|
||||
String filePath = getUploadDir().concat("user-code/") + fileName;
|
||||
@@ -77,7 +81,7 @@ public class DealerUserController extends BaseController {
|
||||
dealerUserService.updateById(dealerUser);
|
||||
return success("操作成功", qrcode);
|
||||
}
|
||||
return success(dealerUser);
|
||||
return success(qrCode);
|
||||
}
|
||||
|
||||
@ApiOperation("分页查询分销商用户记录表")
|
||||
@@ -104,11 +108,15 @@ public class DealerUserController extends BaseController {
|
||||
.last("limit 1")
|
||||
);
|
||||
// 上级分销商
|
||||
if (dealerUser != null) {
|
||||
final DealerUser dealerUser1 = dealerUserService.getOne(new LambdaQueryWrapper<DealerUser>()
|
||||
.eq(DealerUser::getUserId, dealerUser.getRefereeId())
|
||||
.eq(DealerUser::getIsDelete, 0));
|
||||
if (dealerUser1 != null) {
|
||||
dealerUser.setDealerName(dealerUser1.getRealName());
|
||||
dealerUser.setDealerUser(dealerUser1);
|
||||
}
|
||||
}
|
||||
return success(dealerUser);
|
||||
}
|
||||
|
||||
@@ -181,7 +189,20 @@ public class DealerUserController extends BaseController {
|
||||
JSONObject response = JSON.parseObject(value);
|
||||
return response.getString("access_token");
|
||||
}
|
||||
|
||||
String apiUrl = "https://api.weixin.qq.com/cgi-bin/token";
|
||||
// 组装url参数
|
||||
String url = apiUrl.concat("?grant_type=client_credential")
|
||||
.concat("&appid=").concat("wx309c034f7556aeb1")
|
||||
.concat("&secret=").concat("c8fa9e5ee2edc8c0bbd5f9c38df244ec");
|
||||
// 执行get请求
|
||||
String result = HttpUtil.get(url);
|
||||
// 解析access_token
|
||||
JSONObject response = JSON.parseObject(result);
|
||||
if (response.getString("access_token") != null) {
|
||||
// 存入缓存
|
||||
redisUtil.set(key, result, 7000L, TimeUnit.SECONDS);
|
||||
return response.getString("access_token");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -96,7 +96,13 @@ public class GoodsController extends BaseController {
|
||||
goods.setPrice(goods.getSalePrice());
|
||||
}
|
||||
// 店铺信息
|
||||
goods.setMerchant(merchantService.getOne(new LambdaUpdateWrapper<Merchant>().eq(Merchant::getMerchantId, goods.getMerchantId())));
|
||||
if (goods.getMerchantId() != null) {
|
||||
Merchant merchant = merchantService.getById(goods.getMerchantId());
|
||||
goods.setMerchant(merchant);
|
||||
if (merchant != null) {
|
||||
goods.setMerchantName(merchant.getMerchantName());
|
||||
}
|
||||
}
|
||||
|
||||
return success(goods);
|
||||
}
|
||||
|
||||
@@ -5,8 +5,10 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.gxwebsoft.common.core.security.JwtUtil;
|
||||
import com.gxwebsoft.common.core.utils.RequestUtil;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.shop.entity.DealerUser;
|
||||
import com.gxwebsoft.shop.entity.Merchant;
|
||||
import com.gxwebsoft.shop.entity.MerchantAccount;
|
||||
import com.gxwebsoft.shop.service.DealerUserService;
|
||||
import com.gxwebsoft.shop.service.MerchantApplyService;
|
||||
import com.gxwebsoft.shop.entity.MerchantApply;
|
||||
import com.gxwebsoft.shop.param.MerchantApplyParam;
|
||||
@@ -47,6 +49,8 @@ public class MerchantApplyController extends BaseController {
|
||||
private MerchantService merchantService;
|
||||
@Resource
|
||||
private RequestUtil requestUtil;
|
||||
@Resource
|
||||
private DealerUserService dealerUserService;
|
||||
|
||||
@ApiOperation("分页查询商户入驻申请")
|
||||
@GetMapping("/page")
|
||||
@@ -115,6 +119,7 @@ public class MerchantApplyController extends BaseController {
|
||||
case "供应商" -> 34;
|
||||
default -> gradeId;
|
||||
};
|
||||
loingUser.setGradeName(one.getShopType());
|
||||
} else {
|
||||
final Merchant merchant = new Merchant();
|
||||
BeanUtils.copyProperties(merchantApply, merchant);
|
||||
@@ -129,9 +134,11 @@ public class MerchantApplyController extends BaseController {
|
||||
case "供应商" -> 34;
|
||||
default -> gradeId;
|
||||
};
|
||||
loingUser.setGradeName(merchant.getShopType());
|
||||
}
|
||||
loingUser.setGradeId(gradeId);
|
||||
|
||||
|
||||
// TODO 创建商户账号
|
||||
requestUtil.setAccessToken(JwtUtil.getAccessToken(request));
|
||||
requestUtil.setTenantId(getTenantId().toString());
|
||||
@@ -141,6 +148,31 @@ public class MerchantApplyController extends BaseController {
|
||||
// TODO 更新用户表的商户ID
|
||||
requestUtil.updateUserMerchantId(user);
|
||||
|
||||
DealerUser check = dealerUserService.getByUserId(merchantApply.getUserId());
|
||||
if (check == null) {
|
||||
DealerUser dealerUser = new DealerUser();
|
||||
dealerUser.setUserId(merchantApply.getUserId());
|
||||
dealerUser.setRealName(merchantApply.getRealName());
|
||||
dealerUser.setMobile(merchantApply.getPhone());
|
||||
dealerUserService.save(dealerUser);
|
||||
User parentUser = requestUtil.getParent(merchantApply.getUserId());
|
||||
if (parentUser != null) {
|
||||
dealerUser.setRefereeId(parentUser.getUserId());
|
||||
if (merchantApply.getRefereeId() != null) {
|
||||
// 上级
|
||||
DealerUser dealerUser1 = dealerUserService.getByUserId(merchantApply.getRefereeId());
|
||||
dealerUser1.setFirstNum(dealerUser1.getFirstNum() + 1);
|
||||
dealerUserService.updateById(dealerUser1);
|
||||
|
||||
if (dealerUser1.getRefereeId() != null && dealerUser1.getRefereeId() != 0) {
|
||||
DealerUser dealerUser2 = dealerUserService.getByUserId(dealerUser1.getRefereeId());
|
||||
dealerUser2.setSecondNum(dealerUser2.getSecondNum() + 1);
|
||||
dealerUserService.updateById(dealerUser2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// TODO 驳回
|
||||
|
||||
|
||||
@@ -282,6 +282,7 @@ public class OrderController extends BaseController {
|
||||
d.setDateTime(DateUtil.date());
|
||||
d.setUserId(getLoginUser().getUserId());
|
||||
d.setExpirationTime(order.getExpirationTime());
|
||||
d.setTotalNum(d.getCartNum());
|
||||
});
|
||||
orderGoodsService.saveBatch(order.getGoodsList());
|
||||
}
|
||||
@@ -355,11 +356,11 @@ public class OrderController extends BaseController {
|
||||
return success("下单成功", orderService.createWxOrder(order));
|
||||
}
|
||||
}
|
||||
String filepath = uploadPath + "qrcode/" + getTenantId();
|
||||
String filepath = uploadPath + "qr/";
|
||||
if (!FileUtil.exist(filepath)) FileUtil.mkdir(filepath);
|
||||
String filename = "/friendPay_" + order.getOrderId() + ".png";
|
||||
weChatController.makeQr(request, filepath + filename, "orderId=" + order.getOrderId(), "package/order/friendPay");
|
||||
return success("下单成功", "file/qrcode/" + getTenantId() + filename);
|
||||
return success("下单成功", "file/qr"+ filename);
|
||||
}
|
||||
return fail("支付失败");
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class WeChatController extends BaseController {
|
||||
@ApiOperation("好友代付二维码")
|
||||
@PostMapping("/friend-pay-qr")
|
||||
public ApiResult<String> makeFriendPayQr(@RequestBody Order order, HttpServletRequest request){
|
||||
String filepath = uploadPath + "qrcode/" + getTenantId();
|
||||
String filepath = uploadPath + "qr/";
|
||||
if (!FileUtil.exist(filepath)) FileUtil.mkdir(filepath);
|
||||
String filename = "/friendPay_" + order.getOrderId() + ".png";
|
||||
if (FileUtil.exist(filepath + "/" + filename)) return success("生成成功", "file/qrcode/" + getTenantId() + filename);
|
||||
@@ -54,7 +54,7 @@ public class WeChatController extends BaseController {
|
||||
} catch (IOException | WxErrorException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return success("生成成功", "file/qrcode/" + getTenantId() + filename);
|
||||
return success("生成成功", "file/qr" + filename);
|
||||
}
|
||||
|
||||
public void makeQr(HttpServletRequest request, String filename, String scene, String page) throws IOException, WxErrorException {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.gxwebsoft.shop.entity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
@@ -10,6 +12,7 @@ import java.util.Date;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@@ -123,4 +126,6 @@ public class MerchantApply implements Serializable {
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer refereeId;
|
||||
}
|
||||
|
||||
@@ -113,4 +113,7 @@ public class OrderGoods implements Serializable {
|
||||
|
||||
@TableField(exist = false)
|
||||
private Goods goods;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer cartNum;
|
||||
}
|
||||
|
||||
@@ -39,4 +39,5 @@ public interface DealerUserService extends IService<DealerUser> {
|
||||
*/
|
||||
DealerUser getByIdRel(Integer id);
|
||||
|
||||
DealerUser getByUserId(Integer userId);
|
||||
}
|
||||
|
||||
@@ -44,4 +44,11 @@ public class DealerUserServiceImpl extends ServiceImpl<DealerUserMapper, DealerU
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
@Override
|
||||
public DealerUser getByUserId(Integer userId) {
|
||||
DealerUserParam param = new DealerUserParam();
|
||||
param.setUserId(userId);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -93,6 +93,13 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
||||
if (d.getPriceGift()) d.setShowGift(true);
|
||||
}
|
||||
}
|
||||
if (d.getMerchantId() != null) {
|
||||
Merchant merchant = merchantService.getById(d.getMerchantId());
|
||||
d.setMerchant(merchant);
|
||||
if (merchant != null) {
|
||||
d.setMerchantName(merchant.getMerchantName());
|
||||
}
|
||||
}
|
||||
// d.setGoodsSkus(collectSkus.get(d.getGoodsId()));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -134,6 +134,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
||||
if (!CollectionUtils.isEmpty(orderGoodsList)) {
|
||||
for (OrderGoods orderGoods : orderGoodsList) {
|
||||
Goods goods = goodsService.getById(orderGoods.getGoodsId());
|
||||
if (goods != null) {
|
||||
if (param.getLoginUser() != null) {
|
||||
// 经销商
|
||||
if (param.getLoginUser().getGradeId().equals(33)) {
|
||||
@@ -144,6 +145,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
||||
if (goods.getPriceGift()) goods.setShowGift(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
orderGoods.setGoods(goods);
|
||||
}
|
||||
d.setGoodsList(orderGoodsList);
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
# 数据源配置
|
||||
spring:
|
||||
datasource:
|
||||
url: jdbc:mysql://47.119.165.234:3308/modules?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8
|
||||
username: modules
|
||||
password: 8YdLnk7KsPAyDXGA
|
||||
url: jdbc:mysql://47.119.165.234:3308/nbg?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8
|
||||
username: nbg
|
||||
password: 5jk3J2Ah6LxCXksb
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
# 数据源配置
|
||||
spring:
|
||||
datasource:
|
||||
url: jdbc:mysql://127.0.0.1:3308/modules?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8
|
||||
username: modules
|
||||
password: 8YdLnk7KsPAyDXGA
|
||||
url: jdbc:mysql://127.0.0.1:3308/nbg?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8
|
||||
username: nbg
|
||||
password: 5jk3J2Ah6LxCXksb
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
|
||||
@@ -25,7 +25,8 @@ socketio:
|
||||
config:
|
||||
# 生产环境接口
|
||||
server-url: https://server.gxwebsoft.com/api
|
||||
upload-path: /www/wwwroot/file.ws/
|
||||
# upload-path: /www/wwwroot/file.ws/
|
||||
upload-path: /www/jar/nbg/file/
|
||||
|
||||
# 阿里云OSS云存储
|
||||
endpoint: https://oss-cn-shenzhen.aliyuncs.com
|
||||
|
||||
@@ -37,10 +37,10 @@ public class CmsGenerator {
|
||||
// 是否在xml中添加二级缓存配置
|
||||
private static final boolean ENABLE_CACHE = false;
|
||||
// 数据库连接配置
|
||||
private static final String DB_URL = "jdbc:mysql://47.119.165.234:3308/modules?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8";
|
||||
private static final String DB_URL = "jdbc:mysql://47.119.165.234:3308/nbg?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8";
|
||||
private static final String DB_DRIVER = "com.mysql.cj.jdbc.Driver";
|
||||
private static final String DB_USERNAME = "modules";
|
||||
private static final String DB_PASSWORD = "8YdLnk7KsPAyDXGA";
|
||||
private static final String DB_USERNAME = "nbg";
|
||||
private static final String DB_PASSWORD = "5jk3J2Ah6LxCXksb";
|
||||
// 包名
|
||||
private static final String PACKAGE_NAME = "com.gxwebsoft";
|
||||
// 模块名
|
||||
@@ -71,8 +71,8 @@ public class CmsGenerator {
|
||||
// "cms_mp_field"
|
||||
// "cms_mp_ad"
|
||||
// "cms_components"
|
||||
"cms_design_collect",
|
||||
"cms_design_sign_up"
|
||||
// "cms_design_collect",
|
||||
"cms_design_category"
|
||||
|
||||
};
|
||||
// 需要去除的表前缀
|
||||
|
||||
@@ -38,10 +38,10 @@ public class ShopGenerator {
|
||||
// 是否在xml中添加二级缓存配置
|
||||
private static final boolean ENABLE_CACHE = false;
|
||||
// 数据库连接配置
|
||||
private static final String DB_URL = "jdbc:mysql://47.119.165.234:3308/modules?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8";
|
||||
private static final String DB_URL = "jdbc:mysql://47.119.165.234:3308/nbg?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8";
|
||||
private static final String DB_DRIVER = "com.mysql.cj.jdbc.Driver";
|
||||
private static final String DB_USERNAME = "modules";
|
||||
private static final String DB_PASSWORD = "8YdLnk7KsPAyDXGA";
|
||||
private static final String DB_USERNAME = "nbg";
|
||||
private static final String DB_PASSWORD = "5jk3J2Ah6LxCXksb";
|
||||
// 包名
|
||||
private static final String PACKAGE_NAME = "com.gxwebsoft";
|
||||
// 模块名
|
||||
|
||||
2240
websoft-modules.log
Normal file
2240
websoft-modules.log
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user