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("删除失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -182,13 +182,13 @@ public class WebsiteController extends BaseController {
|
|||||||
final String siteInfo = redisUtil.get(key);
|
final String siteInfo = redisUtil.get(key);
|
||||||
String access_token = JwtUtil.getAccessToken(request);
|
String access_token = JwtUtil.getAccessToken(request);
|
||||||
// 从缓存读取信息
|
// 从缓存读取信息
|
||||||
if(StrUtil.isNotBlank(siteInfo)){
|
if (StrUtil.isNotBlank(siteInfo)) {
|
||||||
return success(JSONObject.parseObject(siteInfo,Website.class));
|
return success(JSONObject.parseObject(siteInfo, Website.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 判断是否存在
|
// 判断是否存在
|
||||||
if (websiteService.count() == 0) {
|
if (websiteService.count() == 0) {
|
||||||
return fail("站点不存在",null);
|
return fail("站点不存在", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取站点信息
|
// 获取站点信息
|
||||||
@@ -207,6 +207,8 @@ public class WebsiteController extends BaseController {
|
|||||||
|
|
||||||
// 网站导航
|
// 网站导航
|
||||||
final NavigationParam navigationParam = new NavigationParam();
|
final NavigationParam navigationParam = new NavigationParam();
|
||||||
|
// 所有导航
|
||||||
|
website.setNavigations(navigationService.listRel(navigationParam));
|
||||||
navigationParam.setHide(0);
|
navigationParam.setHide(0);
|
||||||
navigationParam.setTop(0);
|
navigationParam.setTop(0);
|
||||||
navigationParam.setBottom(null);
|
navigationParam.setBottom(null);
|
||||||
@@ -220,7 +222,7 @@ public class WebsiteController extends BaseController {
|
|||||||
website.setBottomNavs(CommonUtil.toTreeData(bottomNavs, 0, Navigation::getParentId, Navigation::getNavigationId, Navigation::setChildren));
|
website.setBottomNavs(CommonUtil.toTreeData(bottomNavs, 0, Navigation::getParentId, Navigation::getNavigationId, Navigation::setChildren));
|
||||||
|
|
||||||
// 当前登录用户
|
// 当前登录用户
|
||||||
if(access_token != null){
|
if (access_token != null) {
|
||||||
final User loginUser = getLoginUser();
|
final User loginUser = getLoginUser();
|
||||||
website.setLoginUser(loginUser);
|
website.setLoginUser(loginUser);
|
||||||
}
|
}
|
||||||
@@ -229,7 +231,7 @@ public class WebsiteController extends BaseController {
|
|||||||
HashMap<String, Object> serverTime = new HashMap<>();
|
HashMap<String, Object> serverTime = new HashMap<>();
|
||||||
// 今天日期
|
// 今天日期
|
||||||
DateTime date = DateUtil.date();
|
DateTime date = DateUtil.date();
|
||||||
String today= DateUtil.today();
|
String today = DateUtil.today();
|
||||||
// 明天日期
|
// 明天日期
|
||||||
final DateTime dateTime = DateUtil.tomorrow();
|
final DateTime dateTime = DateUtil.tomorrow();
|
||||||
String tomorrow = DateUtil.format(dateTime, "yyyy-MM-dd");
|
String tomorrow = DateUtil.format(dateTime, "yyyy-MM-dd");
|
||||||
@@ -239,14 +241,14 @@ public class WebsiteController extends BaseController {
|
|||||||
// 今天星期几
|
// 今天星期几
|
||||||
final int week = DateUtil.thisDayOfWeek();
|
final int week = DateUtil.thisDayOfWeek();
|
||||||
final DateTime nextWeek = DateUtil.nextWeek();
|
final DateTime nextWeek = DateUtil.nextWeek();
|
||||||
serverTime.put("now",DateUtil.now());
|
serverTime.put("now", DateUtil.now());
|
||||||
serverTime.put("today",today);
|
serverTime.put("today", today);
|
||||||
serverTime.put("tomorrow",tomorrow);
|
serverTime.put("tomorrow", tomorrow);
|
||||||
serverTime.put("afterDay",afterDay);
|
serverTime.put("afterDay", afterDay);
|
||||||
serverTime.put("week",week);
|
serverTime.put("week", week);
|
||||||
serverTime.put("nextWeek",nextWeek);
|
serverTime.put("nextWeek", nextWeek);
|
||||||
website.setServerTime(serverTime);
|
website.setServerTime(serverTime);
|
||||||
redisUtil.set(key,website,1L, TimeUnit.DAYS);
|
redisUtil.set(key, website, 1L, TimeUnit.DAYS);
|
||||||
|
|
||||||
return success(website);
|
return success(website);
|
||||||
}
|
}
|
||||||
@@ -263,7 +265,7 @@ public class WebsiteController extends BaseController {
|
|||||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||||
final String data = jsonObject.getString("data");
|
final String data = jsonObject.getString("data");
|
||||||
final Company company = JSONObject.parseObject(data, Company.class);
|
final Company company = JSONObject.parseObject(data, Company.class);
|
||||||
if(company == null){
|
if (company == null) {
|
||||||
throw new BusinessException("站点不存在");
|
throw new BusinessException("站点不存在");
|
||||||
}
|
}
|
||||||
// 创建网站记录
|
// 创建网站记录
|
||||||
@@ -433,7 +435,7 @@ public class WebsiteController extends BaseController {
|
|||||||
|
|
||||||
@ApiOperation("获取服务器时间")
|
@ApiOperation("获取服务器时间")
|
||||||
@GetMapping("/getServerTime")
|
@GetMapping("/getServerTime")
|
||||||
public ApiResult<?> getServerTime(){
|
public ApiResult<?> getServerTime() {
|
||||||
// 服务器时间
|
// 服务器时间
|
||||||
final ServerTimeVO vo = new ServerTimeVO();
|
final ServerTimeVO vo = new ServerTimeVO();
|
||||||
final int hour = DateUtil.hour(DateUtil.date(), true);
|
final int hour = DateUtil.hour(DateUtil.date(), true);
|
||||||
@@ -448,7 +450,7 @@ public class WebsiteController extends BaseController {
|
|||||||
|
|
||||||
final User loginUser = getLoginUser();
|
final User loginUser = getLoginUser();
|
||||||
if (loginUser != null) {
|
if (loginUser != null) {
|
||||||
if (orderService.count(new LambdaQueryWrapper<Order>().eq(Order::getPayStatus,0)) > 0) {
|
if (orderService.count(new LambdaQueryWrapper<Order>().eq(Order::getPayStatus, 0)) > 0) {
|
||||||
vo.setHasNoPayOrder(true);
|
vo.setHasNoPayOrder(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -457,7 +459,7 @@ public class WebsiteController extends BaseController {
|
|||||||
|
|
||||||
@ApiOperation("获取未来一周的日期")
|
@ApiOperation("获取未来一周的日期")
|
||||||
@GetMapping("/getNext7day")
|
@GetMapping("/getNext7day")
|
||||||
public ApiResult<?> getNext7day(){
|
public ApiResult<?> getNext7day() {
|
||||||
List<Next7dayVO> dateList = new ArrayList<>();
|
List<Next7dayVO> dateList = new ArrayList<>();
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
SimpleDateFormat sdf2 = new SimpleDateFormat("MM-dd");
|
SimpleDateFormat sdf2 = new SimpleDateFormat("MM-dd");
|
||||||
@@ -482,7 +484,7 @@ public class WebsiteController extends BaseController {
|
|||||||
@DeleteMapping("/clearSiteInfo/{key}")
|
@DeleteMapping("/clearSiteInfo/{key}")
|
||||||
public ApiResult<?> clearSiteInfo(@PathVariable("key") String key) {
|
public ApiResult<?> clearSiteInfo(@PathVariable("key") String key) {
|
||||||
final String siteInfo = redisUtil.get(key);
|
final String siteInfo = redisUtil.get(key);
|
||||||
if(StrUtil.isNotBlank(siteInfo)){
|
if (StrUtil.isNotBlank(siteInfo)) {
|
||||||
// 清除指定key
|
// 清除指定key
|
||||||
redisUtil.delete(key);
|
redisUtil.delete(key);
|
||||||
// 清除小程序缓存
|
// 清除小程序缓存
|
||||||
|
|||||||
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;
|
package com.gxwebsoft.cms.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
@@ -27,6 +25,8 @@ public class DesignCollect implements Serializable {
|
|||||||
@TableId(value = "id", type = IdType.AUTO)
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
|
private Integer categoryId;
|
||||||
|
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
private String content;
|
private String content;
|
||||||
@@ -58,4 +58,6 @@ public class DesignCollect implements Serializable {
|
|||||||
@ApiModelProperty(value = "修改时间")
|
@ApiModelProperty(value = "修改时间")
|
||||||
private LocalDateTime updateTime;
|
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">
|
<if test="param.id != null">
|
||||||
AND a.id = #{param.id}
|
AND a.id = #{param.id}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="param.categoryId != null">
|
||||||
|
AND a.category_id = #{param.categoryId}
|
||||||
|
</if>
|
||||||
<if test="param.title != null">
|
<if test="param.title != null">
|
||||||
AND a.title LIKE CONCAT('%', #{param.title}, '%')
|
AND a.title LIKE CONCAT('%', #{param.title}, '%')
|
||||||
</if>
|
</if>
|
||||||
@@ -48,6 +51,7 @@
|
|||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
|
ORDER BY a.sort_number ASC, a.id DESC
|
||||||
</sql>
|
</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)
|
@QueryField(type = QueryType.EQ)
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
|
private Integer categoryId;
|
||||||
|
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
private String content;
|
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.gxwebsoft.cms.mapper.DesignCollectMapper;
|
import com.gxwebsoft.cms.mapper.DesignCollectMapper;
|
||||||
|
import com.gxwebsoft.cms.service.DesignCategoryService;
|
||||||
import com.gxwebsoft.cms.service.DesignCollectService;
|
import com.gxwebsoft.cms.service.DesignCollectService;
|
||||||
import com.gxwebsoft.cms.entity.DesignCollect;
|
import com.gxwebsoft.cms.entity.DesignCollect;
|
||||||
import com.gxwebsoft.cms.param.DesignCollectParam;
|
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 com.gxwebsoft.common.core.web.PageResult;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -19,12 +21,17 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class DesignCollectServiceImpl extends ServiceImpl<DesignCollectMapper, DesignCollect> implements DesignCollectService {
|
public class DesignCollectServiceImpl extends ServiceImpl<DesignCollectMapper, DesignCollect> implements DesignCollectService {
|
||||||
|
@Resource
|
||||||
|
private DesignCategoryService designCategoryService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<DesignCollect> pageRel(DesignCollectParam param) {
|
public PageResult<DesignCollect> pageRel(DesignCollectParam param) {
|
||||||
PageParam<DesignCollect, DesignCollectParam> page = new PageParam<>(param);
|
PageParam<DesignCollect, DesignCollectParam> page = new PageParam<>(param);
|
||||||
page.setDefaultOrder("sort_number asc, create_time desc");
|
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||||
List<DesignCollect> list = baseMapper.selectPageRel(page, param);
|
List<DesignCollect> list = baseMapper.selectPageRel(page, param);
|
||||||
|
for (DesignCollect designCollect : list) {
|
||||||
|
designCollect.setCategory(designCategoryService.getByIdRel(designCollect.getCategoryId()));
|
||||||
|
}
|
||||||
return new PageResult<>(list, page.getTotal());
|
return new PageResult<>(list, page.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -172,6 +172,17 @@ public class FileController extends BaseController {
|
|||||||
FileServerUtil.preview(file, getPdfOutDir(), config.getOpenOfficeHome(), response, request);
|
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("下载原文件")
|
@ApiOperation("下载原文件")
|
||||||
@GetMapping("/download/{dir}/{name:.+}")
|
@GetMapping("/download/{dir}/{name:.+}")
|
||||||
public void download(@PathVariable("dir") String dir, @PathVariable("name") String 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.core.io.FileUtil;
|
||||||
import cn.hutool.http.HttpRequest;
|
import cn.hutool.http.HttpRequest;
|
||||||
|
import cn.hutool.http.HttpResponse;
|
||||||
|
import cn.hutool.http.HttpUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
@@ -23,6 +25,7 @@ import javax.annotation.Resource;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import static com.gxwebsoft.common.core.constants.RedisConstants.ACCESS_TOKEN_KEY;
|
import static com.gxwebsoft.common.core.constants.RedisConstants.ACCESS_TOKEN_KEY;
|
||||||
|
|
||||||
@@ -48,16 +51,17 @@ public class DealerUserController extends BaseController {
|
|||||||
@GetMapping("/getDealerUserQrcode")
|
@GetMapping("/getDealerUserQrcode")
|
||||||
public ApiResult<?> getDealerUserQrcode() {
|
public ApiResult<?> getDealerUserQrcode() {
|
||||||
final Integer loginUserId = getLoginUserId();
|
final Integer loginUserId = getLoginUserId();
|
||||||
if(loginUserId == null){
|
if (loginUserId == null) {
|
||||||
return fail("请先登录");
|
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<>();
|
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"
|
map.put("env_version", "trial"); // 正式版为"release",体验版为"trial",开发版为"develop"
|
||||||
|
|
||||||
// 获取图片 Buffer
|
// 获取图片 Buffer
|
||||||
@@ -65,7 +69,7 @@ public class DealerUserController extends BaseController {
|
|||||||
.body(JSON.toJSONString(map))
|
.body(JSON.toJSONString(map))
|
||||||
.execute().bodyBytes();
|
.execute().bodyBytes();
|
||||||
|
|
||||||
// 保存的文件名称
|
// // 保存的文件名称
|
||||||
final String fileName = loginUserId.toString().concat(".png");
|
final String fileName = loginUserId.toString().concat(".png");
|
||||||
// 保存路径
|
// 保存路径
|
||||||
String filePath = getUploadDir().concat("user-code/") + fileName;
|
String filePath = getUploadDir().concat("user-code/") + fileName;
|
||||||
@@ -75,9 +79,9 @@ public class DealerUserController extends BaseController {
|
|||||||
final String qrcode = config.getFileServer().concat("/user-code/").concat(fileName);
|
final String qrcode = config.getFileServer().concat("/user-code/").concat(fileName);
|
||||||
dealerUser.setQrcode(qrcode);
|
dealerUser.setQrcode(qrcode);
|
||||||
dealerUserService.updateById(dealerUser);
|
dealerUserService.updateById(dealerUser);
|
||||||
return success("操作成功",qrcode);
|
return success("操作成功", qrcode);
|
||||||
}
|
}
|
||||||
return success(dealerUser);
|
return success(qrCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("分页查询分销商用户记录表")
|
@ApiOperation("分页查询分销商用户记录表")
|
||||||
@@ -104,11 +108,15 @@ public class DealerUserController extends BaseController {
|
|||||||
.last("limit 1")
|
.last("limit 1")
|
||||||
);
|
);
|
||||||
// 上级分销商
|
// 上级分销商
|
||||||
|
if (dealerUser != null) {
|
||||||
final DealerUser dealerUser1 = dealerUserService.getOne(new LambdaQueryWrapper<DealerUser>()
|
final DealerUser dealerUser1 = dealerUserService.getOne(new LambdaQueryWrapper<DealerUser>()
|
||||||
.eq(DealerUser::getUserId, dealerUser.getRefereeId())
|
.eq(DealerUser::getUserId, dealerUser.getRefereeId())
|
||||||
.eq(DealerUser::getIsDelete, 0));
|
.eq(DealerUser::getIsDelete, 0));
|
||||||
|
if (dealerUser1 != null) {
|
||||||
dealerUser.setDealerName(dealerUser1.getRealName());
|
dealerUser.setDealerName(dealerUser1.getRealName());
|
||||||
dealerUser.setDealerUser(dealerUser1);
|
dealerUser.setDealerUser(dealerUser1);
|
||||||
|
}
|
||||||
|
}
|
||||||
return success(dealerUser);
|
return success(dealerUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -181,7 +189,20 @@ public class DealerUserController extends BaseController {
|
|||||||
JSONObject response = JSON.parseObject(value);
|
JSONObject response = JSON.parseObject(value);
|
||||||
return response.getString("access_token");
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -86,17 +86,23 @@ public class GoodsController extends BaseController {
|
|||||||
// 整理商品价格
|
// 整理商品价格
|
||||||
final User loginUser = getLoginUser();
|
final User loginUser = getLoginUser();
|
||||||
if (loginUser != null) {
|
if (loginUser != null) {
|
||||||
if(loginUser.getGradeId().equals(33)){
|
if (loginUser.getGradeId().equals(33)) {
|
||||||
goods.setPrice(goods.getDealerPrice());
|
goods.setPrice(goods.getDealerPrice());
|
||||||
}
|
}
|
||||||
if(loginUser.getGradeId().equals(0)){
|
if (loginUser.getGradeId().equals(0)) {
|
||||||
goods.setPrice(goods.getSalePrice());
|
goods.setPrice(goods.getSalePrice());
|
||||||
}
|
}
|
||||||
}else {
|
} else {
|
||||||
goods.setPrice(goods.getSalePrice());
|
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);
|
return success(goods);
|
||||||
}
|
}
|
||||||
@@ -180,26 +186,26 @@ public class GoodsController extends BaseController {
|
|||||||
final LambdaQueryWrapper<Goods> wrapper = new LambdaQueryWrapper<>();
|
final LambdaQueryWrapper<Goods> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
|
||||||
if (param.getMerchantId() != null) {
|
if (param.getMerchantId() != null) {
|
||||||
wrapper.eq(Goods::getMerchantId,param.getMerchantId());
|
wrapper.eq(Goods::getMerchantId, param.getMerchantId());
|
||||||
}
|
}
|
||||||
|
|
||||||
Integer totalNum = goodsService.count(
|
Integer totalNum = goodsService.count(
|
||||||
wrapper.eq(Goods::getIsShow,1).gt(Goods::getStock,0)
|
wrapper.eq(Goods::getIsShow, 1).gt(Goods::getStock, 0)
|
||||||
);
|
);
|
||||||
data.put("totalNum", totalNum);
|
data.put("totalNum", totalNum);
|
||||||
|
|
||||||
Integer totalNum2 = goodsService.count(
|
Integer totalNum2 = goodsService.count(
|
||||||
wrapper.eq(Goods::getIsShow,0)
|
wrapper.eq(Goods::getIsShow, 0)
|
||||||
);
|
);
|
||||||
data.put("totalNum2", totalNum2);
|
data.put("totalNum2", totalNum2);
|
||||||
|
|
||||||
Integer totalNum3 = goodsService.count(
|
Integer totalNum3 = goodsService.count(
|
||||||
wrapper.eq(Goods::getStock,0)
|
wrapper.eq(Goods::getStock, 0)
|
||||||
);
|
);
|
||||||
data.put("totalNum3", totalNum3);
|
data.put("totalNum3", totalNum3);
|
||||||
|
|
||||||
// 下架已售罄的商品
|
// 下架已售罄的商品
|
||||||
goodsService.update(new LambdaUpdateWrapper<Goods>().eq(Goods::getStock,0).eq(Goods::getIsShow,1).set(Goods::getIsShow,0));
|
goodsService.update(new LambdaUpdateWrapper<Goods>().eq(Goods::getStock, 0).eq(Goods::getIsShow, 1).set(Goods::getIsShow, 0));
|
||||||
|
|
||||||
return success(data);
|
return success(data);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,8 +5,10 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||||||
import com.gxwebsoft.common.core.security.JwtUtil;
|
import com.gxwebsoft.common.core.security.JwtUtil;
|
||||||
import com.gxwebsoft.common.core.utils.RequestUtil;
|
import com.gxwebsoft.common.core.utils.RequestUtil;
|
||||||
import com.gxwebsoft.common.core.web.BaseController;
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
|
import com.gxwebsoft.shop.entity.DealerUser;
|
||||||
import com.gxwebsoft.shop.entity.Merchant;
|
import com.gxwebsoft.shop.entity.Merchant;
|
||||||
import com.gxwebsoft.shop.entity.MerchantAccount;
|
import com.gxwebsoft.shop.entity.MerchantAccount;
|
||||||
|
import com.gxwebsoft.shop.service.DealerUserService;
|
||||||
import com.gxwebsoft.shop.service.MerchantApplyService;
|
import com.gxwebsoft.shop.service.MerchantApplyService;
|
||||||
import com.gxwebsoft.shop.entity.MerchantApply;
|
import com.gxwebsoft.shop.entity.MerchantApply;
|
||||||
import com.gxwebsoft.shop.param.MerchantApplyParam;
|
import com.gxwebsoft.shop.param.MerchantApplyParam;
|
||||||
@@ -47,6 +49,8 @@ public class MerchantApplyController extends BaseController {
|
|||||||
private MerchantService merchantService;
|
private MerchantService merchantService;
|
||||||
@Resource
|
@Resource
|
||||||
private RequestUtil requestUtil;
|
private RequestUtil requestUtil;
|
||||||
|
@Resource
|
||||||
|
private DealerUserService dealerUserService;
|
||||||
|
|
||||||
@ApiOperation("分页查询商户入驻申请")
|
@ApiOperation("分页查询商户入驻申请")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@@ -115,6 +119,7 @@ public class MerchantApplyController extends BaseController {
|
|||||||
case "供应商" -> 34;
|
case "供应商" -> 34;
|
||||||
default -> gradeId;
|
default -> gradeId;
|
||||||
};
|
};
|
||||||
|
loingUser.setGradeName(one.getShopType());
|
||||||
} else {
|
} else {
|
||||||
final Merchant merchant = new Merchant();
|
final Merchant merchant = new Merchant();
|
||||||
BeanUtils.copyProperties(merchantApply, merchant);
|
BeanUtils.copyProperties(merchantApply, merchant);
|
||||||
@@ -129,9 +134,11 @@ public class MerchantApplyController extends BaseController {
|
|||||||
case "供应商" -> 34;
|
case "供应商" -> 34;
|
||||||
default -> gradeId;
|
default -> gradeId;
|
||||||
};
|
};
|
||||||
|
loingUser.setGradeName(merchant.getShopType());
|
||||||
}
|
}
|
||||||
loingUser.setGradeId(gradeId);
|
loingUser.setGradeId(gradeId);
|
||||||
|
|
||||||
|
|
||||||
// TODO 创建商户账号
|
// TODO 创建商户账号
|
||||||
requestUtil.setAccessToken(JwtUtil.getAccessToken(request));
|
requestUtil.setAccessToken(JwtUtil.getAccessToken(request));
|
||||||
requestUtil.setTenantId(getTenantId().toString());
|
requestUtil.setTenantId(getTenantId().toString());
|
||||||
@@ -141,6 +148,31 @@ public class MerchantApplyController extends BaseController {
|
|||||||
// TODO 更新用户表的商户ID
|
// TODO 更新用户表的商户ID
|
||||||
requestUtil.updateUserMerchantId(user);
|
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 驳回
|
// TODO 驳回
|
||||||
|
|
||||||
|
|||||||
@@ -282,6 +282,7 @@ public class OrderController extends BaseController {
|
|||||||
d.setDateTime(DateUtil.date());
|
d.setDateTime(DateUtil.date());
|
||||||
d.setUserId(getLoginUser().getUserId());
|
d.setUserId(getLoginUser().getUserId());
|
||||||
d.setExpirationTime(order.getExpirationTime());
|
d.setExpirationTime(order.getExpirationTime());
|
||||||
|
d.setTotalNum(d.getCartNum());
|
||||||
});
|
});
|
||||||
orderGoodsService.saveBatch(order.getGoodsList());
|
orderGoodsService.saveBatch(order.getGoodsList());
|
||||||
}
|
}
|
||||||
@@ -355,11 +356,11 @@ public class OrderController extends BaseController {
|
|||||||
return success("下单成功", orderService.createWxOrder(order));
|
return success("下单成功", orderService.createWxOrder(order));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String filepath = uploadPath + "qrcode/" + getTenantId();
|
String filepath = uploadPath + "qr/";
|
||||||
if (!FileUtil.exist(filepath)) FileUtil.mkdir(filepath);
|
if (!FileUtil.exist(filepath)) FileUtil.mkdir(filepath);
|
||||||
String filename = "/friendPay_" + order.getOrderId() + ".png";
|
String filename = "/friendPay_" + order.getOrderId() + ".png";
|
||||||
weChatController.makeQr(request, filepath + filename, "orderId=" + order.getOrderId(), "package/order/friendPay");
|
weChatController.makeQr(request, filepath + filename, "orderId=" + order.getOrderId(), "package/order/friendPay");
|
||||||
return success("下单成功", "file/qrcode/" + getTenantId() + filename);
|
return success("下单成功", "file/qr"+ filename);
|
||||||
}
|
}
|
||||||
return fail("支付失败");
|
return fail("支付失败");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public class WeChatController extends BaseController {
|
|||||||
@ApiOperation("好友代付二维码")
|
@ApiOperation("好友代付二维码")
|
||||||
@PostMapping("/friend-pay-qr")
|
@PostMapping("/friend-pay-qr")
|
||||||
public ApiResult<String> makeFriendPayQr(@RequestBody Order order, HttpServletRequest request){
|
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);
|
if (!FileUtil.exist(filepath)) FileUtil.mkdir(filepath);
|
||||||
String filename = "/friendPay_" + order.getOrderId() + ".png";
|
String filename = "/friendPay_" + order.getOrderId() + ".png";
|
||||||
if (FileUtil.exist(filepath + "/" + filename)) return success("生成成功", "file/qrcode/" + getTenantId() + filename);
|
if (FileUtil.exist(filepath + "/" + filename)) return success("生成成功", "file/qrcode/" + getTenantId() + filename);
|
||||||
@@ -54,7 +54,7 @@ public class WeChatController extends BaseController {
|
|||||||
} catch (IOException | WxErrorException e) {
|
} catch (IOException | WxErrorException e) {
|
||||||
e.printStackTrace();
|
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 {
|
public void makeQr(HttpServletRequest request, String filename, String scene, String page) throws IOException, WxErrorException {
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.gxwebsoft.shop.entity;
|
package com.gxwebsoft.shop.entity;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
@@ -10,6 +12,7 @@ import java.util.Date;
|
|||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import io.swagger.models.auth.In;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
@@ -123,4 +126,6 @@ public class MerchantApply implements Serializable {
|
|||||||
@ApiModelProperty(value = "创建时间")
|
@ApiModelProperty(value = "创建时间")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Integer refereeId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,4 +113,7 @@ public class OrderGoods implements Serializable {
|
|||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private Goods goods;
|
private Goods goods;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Integer cartNum;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,4 +39,5 @@ public interface DealerUserService extends IService<DealerUser> {
|
|||||||
*/
|
*/
|
||||||
DealerUser getByIdRel(Integer id);
|
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));
|
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.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()));
|
// d.setGoodsSkus(collectSkus.get(d.getGoodsId()));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -134,6 +134,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|||||||
if (!CollectionUtils.isEmpty(orderGoodsList)) {
|
if (!CollectionUtils.isEmpty(orderGoodsList)) {
|
||||||
for (OrderGoods orderGoods : orderGoodsList) {
|
for (OrderGoods orderGoods : orderGoodsList) {
|
||||||
Goods goods = goodsService.getById(orderGoods.getGoodsId());
|
Goods goods = goodsService.getById(orderGoods.getGoodsId());
|
||||||
|
if (goods != null) {
|
||||||
if (param.getLoginUser() != null) {
|
if (param.getLoginUser() != null) {
|
||||||
// 经销商
|
// 经销商
|
||||||
if (param.getLoginUser().getGradeId().equals(33)) {
|
if (param.getLoginUser().getGradeId().equals(33)) {
|
||||||
@@ -144,6 +145,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|||||||
if (goods.getPriceGift()) goods.setShowGift(true);
|
if (goods.getPriceGift()) goods.setShowGift(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
orderGoods.setGoods(goods);
|
orderGoods.setGoods(goods);
|
||||||
}
|
}
|
||||||
d.setGoodsList(orderGoodsList);
|
d.setGoodsList(orderGoodsList);
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
# 数据源配置
|
# 数据源配置
|
||||||
spring:
|
spring:
|
||||||
datasource:
|
datasource:
|
||||||
url: jdbc:mysql://47.119.165.234:3308/modules?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8
|
url: jdbc:mysql://47.119.165.234:3308/nbg?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8
|
||||||
username: modules
|
username: nbg
|
||||||
password: 8YdLnk7KsPAyDXGA
|
password: 5jk3J2Ah6LxCXksb
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
type: com.alibaba.druid.pool.DruidDataSource
|
type: com.alibaba.druid.pool.DruidDataSource
|
||||||
|
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
# 数据源配置
|
# 数据源配置
|
||||||
spring:
|
spring:
|
||||||
datasource:
|
datasource:
|
||||||
url: jdbc:mysql://127.0.0.1:3308/modules?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8
|
url: jdbc:mysql://127.0.0.1:3308/nbg?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8
|
||||||
username: modules
|
username: nbg
|
||||||
password: 8YdLnk7KsPAyDXGA
|
password: 5jk3J2Ah6LxCXksb
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
type: com.alibaba.druid.pool.DruidDataSource
|
type: com.alibaba.druid.pool.DruidDataSource
|
||||||
|
|
||||||
@@ -25,7 +25,8 @@ socketio:
|
|||||||
config:
|
config:
|
||||||
# 生产环境接口
|
# 生产环境接口
|
||||||
server-url: https://server.gxwebsoft.com/api
|
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云存储
|
# 阿里云OSS云存储
|
||||||
endpoint: https://oss-cn-shenzhen.aliyuncs.com
|
endpoint: https://oss-cn-shenzhen.aliyuncs.com
|
||||||
|
|||||||
@@ -37,10 +37,10 @@ public class CmsGenerator {
|
|||||||
// 是否在xml中添加二级缓存配置
|
// 是否在xml中添加二级缓存配置
|
||||||
private static final boolean ENABLE_CACHE = false;
|
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_DRIVER = "com.mysql.cj.jdbc.Driver";
|
||||||
private static final String DB_USERNAME = "modules";
|
private static final String DB_USERNAME = "nbg";
|
||||||
private static final String DB_PASSWORD = "8YdLnk7KsPAyDXGA";
|
private static final String DB_PASSWORD = "5jk3J2Ah6LxCXksb";
|
||||||
// 包名
|
// 包名
|
||||||
private static final String PACKAGE_NAME = "com.gxwebsoft";
|
private static final String PACKAGE_NAME = "com.gxwebsoft";
|
||||||
// 模块名
|
// 模块名
|
||||||
@@ -71,8 +71,8 @@ public class CmsGenerator {
|
|||||||
// "cms_mp_field"
|
// "cms_mp_field"
|
||||||
// "cms_mp_ad"
|
// "cms_mp_ad"
|
||||||
// "cms_components"
|
// "cms_components"
|
||||||
"cms_design_collect",
|
// "cms_design_collect",
|
||||||
"cms_design_sign_up"
|
"cms_design_category"
|
||||||
|
|
||||||
};
|
};
|
||||||
// 需要去除的表前缀
|
// 需要去除的表前缀
|
||||||
|
|||||||
@@ -38,10 +38,10 @@ public class ShopGenerator {
|
|||||||
// 是否在xml中添加二级缓存配置
|
// 是否在xml中添加二级缓存配置
|
||||||
private static final boolean ENABLE_CACHE = false;
|
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_DRIVER = "com.mysql.cj.jdbc.Driver";
|
||||||
private static final String DB_USERNAME = "modules";
|
private static final String DB_USERNAME = "nbg";
|
||||||
private static final String DB_PASSWORD = "8YdLnk7KsPAyDXGA";
|
private static final String DB_PASSWORD = "5jk3J2Ah6LxCXksb";
|
||||||
// 包名
|
// 包名
|
||||||
private static final String PACKAGE_NAME = "com.gxwebsoft";
|
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