250418
This commit is contained in:
12
.idea/dataSources.xml
generated
Normal file
12
.idea/dataSources.xml
generated
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||
<data-source source="LOCAL" name="0@localhost" uuid="276e6e9f-c074-4fd2-b2f9-337b59f97ba9">
|
||||
<driver-ref>redis</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>jdbc.RedisDriver</jdbc-driver>
|
||||
<jdbc-url>jdbc:redis://localhost:6379/0</jdbc-url>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
</data-source>
|
||||
</component>
|
||||
</project>
|
||||
124
.idea/uiDesigner.xml
generated
Normal file
124
.idea/uiDesigner.xml
generated
Normal file
@@ -0,0 +1,124 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
||||
30
pom.xml
30
pom.xml
@@ -264,12 +264,40 @@
|
||||
<artifactId>weixin-java-miniapp</artifactId>
|
||||
<version>4.6.0</version>
|
||||
</dependency>
|
||||
<!--微信公众号-->
|
||||
<dependency>
|
||||
<groupId>com.github.binarywang</groupId>
|
||||
<artifactId>wx-java-mp-spring-boot-starter</artifactId>
|
||||
<version>4.6.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 阿里云 OSS -->
|
||||
<dependency>
|
||||
<groupId>com.aliyun.oss</groupId>
|
||||
<artifactId>aliyun-sdk-oss</artifactId>
|
||||
<version>3.17.0</version>
|
||||
<version>3.18.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>sts20150401</artifactId>
|
||||
<version>1.1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>credentials-java</artifactId>
|
||||
<version>0.3.4</version>
|
||||
</dependency>
|
||||
<!-- 消息队列 -->
|
||||
<dependency>
|
||||
<groupId>com.aliyun.mns</groupId>
|
||||
<artifactId>aliyun-sdk-mns</artifactId>
|
||||
<version>1.1.11</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.aliyun.kms</groupId>
|
||||
<artifactId>kms-transfer-client</artifactId>
|
||||
<version>0.1.0</version>
|
||||
</dependency>
|
||||
<!-- 快递100-->
|
||||
<dependency>
|
||||
|
||||
@@ -0,0 +1,178 @@
|
||||
package com.gxwebsoft.cms.controller;
|
||||
|
||||
import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaSubscribeMessage;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.gxwebsoft.cms.entity.Article;
|
||||
import com.gxwebsoft.cms.service.ArticleService;
|
||||
import com.gxwebsoft.common.core.security.JwtUtil;
|
||||
import com.gxwebsoft.common.core.utils.RequestUtil;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.cms.service.ArticleCheckService;
|
||||
import com.gxwebsoft.cms.entity.ArticleCheck;
|
||||
import com.gxwebsoft.cms.param.ArticleCheckParam;
|
||||
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 com.gxwebsoft.shop.controller.WeChatController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 控制器
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-11-19 22:01:03
|
||||
*/
|
||||
@Api(tags = "管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/cms/article-check")
|
||||
public class ArticleCheckController extends BaseController {
|
||||
@Resource
|
||||
private ArticleCheckService articleCheckService;
|
||||
@Resource
|
||||
private ArticleService articleService;
|
||||
|
||||
@Autowired
|
||||
private WeChatController weChatController;
|
||||
@Autowired
|
||||
private RequestUtil requestUtil;
|
||||
|
||||
@ApiOperation("分页查询")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<ArticleCheck>> page(ArticleCheckParam param) {
|
||||
// 使用关联查询
|
||||
return success(articleCheckService.pageRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("查询全部")
|
||||
@GetMapping()
|
||||
public ApiResult<List<ArticleCheck>> list() {
|
||||
ArticleCheckParam param = new ArticleCheckParam();
|
||||
param.setUserId(getLoginUserId());
|
||||
param.setStatus(0);
|
||||
// 使用关联查询
|
||||
List<ArticleCheck> list = articleCheckService.listRel(param);
|
||||
for (ArticleCheck articleCheck : list) {
|
||||
articleCheck.setArticle(articleService.getByIdRel(articleCheck.getArticleId()));
|
||||
}
|
||||
return success(list);
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('cms:articleCheck:list')")
|
||||
@ApiOperation("根据id查询")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<ArticleCheck> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(articleCheckService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@ApiOperation("添加")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody ArticleCheck articleCheck) {
|
||||
// 记录当前登录用户id
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
articleCheck.setUserId(loginUser.getUserId());
|
||||
}
|
||||
if (articleCheckService.save(articleCheck)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("修改")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody ArticleCheck articleCheck, HttpServletRequest request) throws WxErrorException {
|
||||
if (articleCheckService.updateById(articleCheck)) {
|
||||
ArticleCheck articleCheck1 = articleCheckService.getByIdRel(articleCheck.getId());
|
||||
List<ArticleCheck> articleCheckList = articleCheckService.listByArticleId(articleCheck1.getArticleId());
|
||||
Article article = articleService.getById(articleCheck1.getArticleId());
|
||||
boolean sendMsg = false;
|
||||
String result = "";
|
||||
if (articleCheck.getStatus().equals(2)) {
|
||||
article.setStatus(2);
|
||||
articleService.updateById(article);
|
||||
sendMsg = true;
|
||||
result = "驳回";
|
||||
} else if (articleCheck.getStatus().equals(1)) {
|
||||
int passNum = 0;
|
||||
for (ArticleCheck articleCheck2 : articleCheckList) {
|
||||
if (articleCheck2.getStatus().equals(1)) {
|
||||
passNum++;
|
||||
}
|
||||
}
|
||||
if (passNum == articleCheckList.size()) {
|
||||
article.setStatus(0);
|
||||
articleService.updateById(article);
|
||||
sendMsg = true;
|
||||
result = "通过";
|
||||
}
|
||||
}
|
||||
if (sendMsg) {
|
||||
requestUtil.setTenantId(getTenantId().toString());
|
||||
requestUtil.setAccessToken(JwtUtil.getAccessToken(request));
|
||||
User user = requestUtil.getByUserId(article.getUserId());
|
||||
if (user != null) {
|
||||
List<WxMaSubscribeMessage.MsgData> data = new ArrayList<>();
|
||||
data.add(new WxMaSubscribeMessage.MsgData("thing5", article.getTitle()));
|
||||
data.add(new WxMaSubscribeMessage.MsgData("thing2", result));
|
||||
data.add(new WxMaSubscribeMessage.MsgData("time4", DateUtil.format(DateUtil.date(), "yyyy-MM-dd HH:mm:ss")));
|
||||
weChatController.sendMessage(user.getOpenid(), "NLnexmnhiVl_e4fiC6OwfbTlpssAuvXWoPNwITyTcC4", "package/user/myTv",
|
||||
data);
|
||||
}
|
||||
}
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("删除")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (articleCheckService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量添加")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<ArticleCheck> list) {
|
||||
if (articleCheckService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量修改")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<ArticleCheck> batchParam) {
|
||||
if (batchParam.update(articleCheckService, "id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量删除")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (articleCheckService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.gxwebsoft.cms.controller;
|
||||
|
||||
import com.gxwebsoft.cms.entity.Article;
|
||||
import com.gxwebsoft.cms.service.ArticleService;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.cms.service.ArticleCommentService;
|
||||
import com.gxwebsoft.cms.entity.ArticleComment;
|
||||
@@ -10,6 +12,7 @@ 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 com.gxwebsoft.common.system.service.UserService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -30,8 +33,11 @@ import java.util.List;
|
||||
public class ArticleCommentController extends BaseController {
|
||||
@Resource
|
||||
private ArticleCommentService articleCommentService;
|
||||
@Resource
|
||||
private UserService userService;
|
||||
@Resource
|
||||
private ArticleService articleService;
|
||||
|
||||
@PreAuthorize("hasAuthority('cms:articleComment:list')")
|
||||
@ApiOperation("分页查询文章评论表")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<ArticleComment>> page(ArticleCommentParam param) {
|
||||
@@ -42,7 +48,6 @@ public class ArticleCommentController extends BaseController {
|
||||
//return success(articleCommentService.pageRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('cms:articleComment:list')")
|
||||
@ApiOperation("查询全部文章评论表")
|
||||
@GetMapping()
|
||||
public ApiResult<List<ArticleComment>> list(ArticleCommentParam param) {
|
||||
@@ -53,7 +58,6 @@ public class ArticleCommentController extends BaseController {
|
||||
//return success(articleCommentService.listRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('cms:articleComment:list')")
|
||||
@ApiOperation("根据id查询文章评论表")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<ArticleComment> get(@PathVariable("id") Integer id) {
|
||||
@@ -62,16 +66,20 @@ public class ArticleCommentController extends BaseController {
|
||||
//return success(articleCommentService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('cms:articleComment:save')")
|
||||
@ApiOperation("添加文章评论表")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody ArticleComment articleComment) {
|
||||
// 记录当前登录用户id
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
articleComment.setUserId(loginUser.getUserId());
|
||||
articleComment.setUserId(loginUser.getUserId());
|
||||
articleComment.setAvatar(loginUser.getAvatar());
|
||||
articleComment.setNickname(loginUser.getNickname());
|
||||
}
|
||||
if (articleCommentService.save(articleComment)) {
|
||||
Article article = articleService.getById(articleComment.getArticleId());
|
||||
article.setCommentNumbers(article.getCommentNumbers() + 1);
|
||||
articleService.updateById(article);
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
@@ -87,11 +95,14 @@ public class ArticleCommentController extends BaseController {
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('cms:articleComment:remove')")
|
||||
@ApiOperation("删除文章评论表")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
ArticleComment articleComment = articleCommentService.getById(id);
|
||||
if (articleCommentService.removeById(id)) {
|
||||
Article article = articleService.getById(articleComment.getArticleId());
|
||||
article.setCommentNumbers(article.getCommentNumbers() - 1);
|
||||
articleService.updateById(article);
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
|
||||
@@ -1,28 +1,42 @@
|
||||
package com.gxwebsoft.cms.controller;
|
||||
|
||||
import com.aliyun.mns.client.CloudAccount;
|
||||
import com.aliyun.mns.client.CloudQueue;
|
||||
import com.aliyun.mns.client.MNSClient;
|
||||
import com.aliyun.mns.model.Message;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.gxwebsoft.cms.entity.Article;
|
||||
import com.gxwebsoft.cms.entity.ArticleCategory;
|
||||
import com.gxwebsoft.cms.entity.ArticleCheck;
|
||||
import com.gxwebsoft.cms.entity.ArticleContent;
|
||||
import com.gxwebsoft.cms.param.ArticleParam;
|
||||
import com.gxwebsoft.cms.service.ArticleCategoryService;
|
||||
import com.gxwebsoft.cms.service.ArticleCheckService;
|
||||
import com.gxwebsoft.cms.service.ArticleContentService;
|
||||
import com.gxwebsoft.cms.service.ArticleService;
|
||||
import com.gxwebsoft.common.core.security.JwtUtil;
|
||||
import com.gxwebsoft.common.core.utils.RequestUtil;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.system.controller.AliOssController;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.common.system.entity.UserRole;
|
||||
import com.gxwebsoft.open.service.OfficeMpServiceImpl;
|
||||
import com.gxwebsoft.shop.entity.Goods;
|
||||
import com.gxwebsoft.shop.param.GoodsParam;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -44,103 +58,163 @@ public class ArticleController extends BaseController {
|
||||
private ArticleCategoryService articleCategoryService;
|
||||
@Resource
|
||||
private ArticleContentService articleContentService;
|
||||
@Resource
|
||||
private ArticleCheckService articleCheckService;
|
||||
@Resource
|
||||
private OfficeMpServiceImpl officeMpService;
|
||||
|
||||
@Autowired
|
||||
private RequestUtil requestUtil;
|
||||
@Autowired
|
||||
private AliOssController aliOssController;
|
||||
|
||||
@ApiOperation("分页查询文章")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<Article>> page(ArticleParam param) {
|
||||
public ApiResult<PageResult<?>> page(ArticleParam param) {
|
||||
// 使用关联查询
|
||||
if (getLoginUser() != null) {
|
||||
param.setLoginUserId(getLoginUserId());
|
||||
}
|
||||
if (param.getMinData() != null) return success(articleService.pageMinData(param));
|
||||
return success(articleService.pageRel(param));
|
||||
}
|
||||
|
||||
@GetMapping("/user-list")
|
||||
public ApiResult<List<Article>> userList(ArticleParam param) {
|
||||
// 使用关联查询
|
||||
if (getLoginUser() != null) {
|
||||
param.setUserId(getLoginUserId());
|
||||
}
|
||||
return success(articleService.listRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("查询全部文章")
|
||||
@GetMapping()
|
||||
public ApiResult<List<Article>> list(ArticleParam param) {
|
||||
public ApiResult<List<?>> list(ArticleParam param) {
|
||||
// 使用关联查询
|
||||
if (getLoginUser() != null) {
|
||||
param.setLoginUserId(getLoginUserId());
|
||||
}
|
||||
if (param.getMinData() != null) return success(articleService.listMinData(param));
|
||||
return success(articleService.listRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("根据id查询文章")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<Article> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
Article article = articleService.getByIdRel(id);
|
||||
// 更新阅读数量
|
||||
article.setActualViews(article.getActualViews() + 1);
|
||||
articleService.updateById(article);
|
||||
// 附加文字内容
|
||||
ArticleContent content = articleContentService.getOne(new LambdaQueryWrapper<ArticleContent>().eq(ArticleContent::getArticleId,article.getArticleId()).last("limit 1"));
|
||||
if(content != null){
|
||||
article.setContent(content.getContent());
|
||||
}
|
||||
return success(article);
|
||||
// 使用关联查询
|
||||
Article article = articleService.getByIdRel(id);
|
||||
// 更新阅读数量
|
||||
article.setActualViews(article.getActualViews() + 1);
|
||||
articleService.updateById(article);
|
||||
// 附加文字内容
|
||||
ArticleContent content = articleContentService.getOne(new LambdaQueryWrapper<ArticleContent>().eq(ArticleContent::getArticleId, article.getArticleId()).last("limit 1"));
|
||||
if (content != null) {
|
||||
article.setContent(content.getContent());
|
||||
}
|
||||
return success(article);
|
||||
}
|
||||
|
||||
@ApiOperation("读取上一篇")
|
||||
@GetMapping("/getPrevious/{id}")
|
||||
public ApiResult<Article> getPrevious(@PathVariable("id") Integer id) {
|
||||
LambdaQueryWrapper<Article> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.lt(Article::getArticleId,id);
|
||||
wrapper.eq(Article::getStatus,0);
|
||||
wrapper.eq(Article::getType,0);
|
||||
wrapper.orderByDesc(Article::getArticleId);
|
||||
wrapper.last("limit 1");
|
||||
final Article article = articleService.getOne(wrapper);
|
||||
return success(article);
|
||||
LambdaQueryWrapper<Article> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.lt(Article::getArticleId, id);
|
||||
wrapper.eq(Article::getStatus, 0);
|
||||
wrapper.eq(Article::getType, 0);
|
||||
wrapper.orderByDesc(Article::getArticleId);
|
||||
wrapper.last("limit 1");
|
||||
final Article article = articleService.getOne(wrapper);
|
||||
return success(article);
|
||||
}
|
||||
|
||||
@ApiOperation("读取下一篇")
|
||||
@GetMapping("/getNext/{id}")
|
||||
public ApiResult<Article> getNext(@PathVariable("id") Integer id) {
|
||||
LambdaQueryWrapper<Article> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.gt(Article::getArticleId,id);
|
||||
wrapper.eq(Article::getStatus,0);
|
||||
wrapper.eq(Article::getType,0);
|
||||
wrapper.orderByAsc(Article::getArticleId);
|
||||
wrapper.last("limit 1");
|
||||
final Article article = articleService.getOne(wrapper);
|
||||
return success(article);
|
||||
LambdaQueryWrapper<Article> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.gt(Article::getArticleId, id);
|
||||
wrapper.eq(Article::getStatus, 0);
|
||||
wrapper.eq(Article::getType, 0);
|
||||
wrapper.orderByAsc(Article::getArticleId);
|
||||
wrapper.last("limit 1");
|
||||
final Article article = articleService.getOne(wrapper);
|
||||
return success(article);
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('cms:article:save')")
|
||||
@ApiOperation("添加文章")
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody Article article) {
|
||||
public ApiResult<?> save(@RequestBody Article article, HttpServletRequest request) throws WxErrorException {
|
||||
// 记录当前登录用户id
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
article.setUserId(loginUser.getUserId());
|
||||
article.setUserId(loginUser.getUserId());
|
||||
article.setUserAvatar(loginUser.getAvatar());
|
||||
article.setUsername(loginUser.getNickname());
|
||||
}
|
||||
// 同步类型
|
||||
// final ArticleCategory category = articleCategoryService.getById(article.getCategoryId());
|
||||
// article.setType(category.getType());
|
||||
if (articleService.save(article)) {
|
||||
// 保存文章内容
|
||||
final ArticleContent content = new ArticleContent();
|
||||
content.setArticleId(article.getArticleId());
|
||||
content.setContent(article.getContent());
|
||||
articleContentService.save(content);
|
||||
return success("添加成功");
|
||||
if (article.getBucket() != null) aliOssController.videoTrans(article.getBucket());
|
||||
// 保存文章内容
|
||||
final ArticleContent content = new ArticleContent();
|
||||
content.setArticleId(article.getArticleId());
|
||||
content.setContent(article.getContent());
|
||||
articleContentService.save(content);
|
||||
|
||||
if (article.getIsFront() != null && article.getIsFront()) {
|
||||
requestUtil.setTenantId(getTenantId().toString());
|
||||
requestUtil.setAccessToken(JwtUtil.getAccessToken(request));
|
||||
List<UserRole> userRoleList = requestUtil.getUserListByRole(1114);
|
||||
if (userRoleList != null && !userRoleList.isEmpty()) {
|
||||
for (UserRole userRole : userRoleList) {
|
||||
User user = requestUtil.getByUserId(userRole.getUserId());
|
||||
ArticleCheck articleCheck = new ArticleCheck();
|
||||
articleCheck.setArticleId(article.getArticleId());
|
||||
articleCheck.setUserId(userRole.getUserId());
|
||||
articleCheckService.save(articleCheck);
|
||||
|
||||
if (user != null && user.getOfficeOpenid() != null && !user.getOfficeOpenid().isEmpty()) {
|
||||
officeMpService.sendTVCheckMessage(user.getOfficeOpenid(), article.getTitle(), loginUser.getNickname());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('cms:article:update')")
|
||||
@PostMapping("/trans")
|
||||
public ApiResult<?> trans(@RequestBody Article article) {
|
||||
// aliOssController.videoTrans(article.getVideo());
|
||||
return success();
|
||||
}
|
||||
|
||||
@ApiOperation("转码拉取消息")
|
||||
@PostMapping("/trans-pull")
|
||||
public ApiResult<?> transNotify() {
|
||||
aliOssController.pullVideoTrans();
|
||||
return success();
|
||||
}
|
||||
|
||||
@ApiOperation("修改文章")
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody Article article) {
|
||||
public ApiResult<?> update(@RequestBody Article article, HttpServletRequest request) {
|
||||
if (articleService.updateById(article)) {
|
||||
// 更新文章内容
|
||||
ArticleContent content = new ArticleContent();
|
||||
content.setArticleId(article.getArticleId());
|
||||
content.setContent(article.getContent());
|
||||
ArticleContent one = articleContentService.getOne(new LambdaQueryWrapper<ArticleContent>().eq(ArticleContent::getArticleId, article.getArticleId()).last("limit 1"));
|
||||
if(one != null){
|
||||
one.setContent(article.getContent());
|
||||
articleContentService.updateById(one);
|
||||
}else {
|
||||
articleContentService.save(content);
|
||||
if (one != null) {
|
||||
one.setContent(article.getContent());
|
||||
articleContentService.updateById(one);
|
||||
} else {
|
||||
articleContentService.save(content);
|
||||
}
|
||||
// 更新时间
|
||||
article.setUpdateTime(new Date());
|
||||
@@ -155,6 +229,9 @@ public class ArticleController extends BaseController {
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (articleService.removeById(id)) {
|
||||
articleCheckService.removeByMap(new HashMap<>() {{
|
||||
put("article_id", id);
|
||||
}});
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
@@ -190,33 +267,33 @@ public class ArticleController extends BaseController {
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@ApiOperation("统计信息")
|
||||
@GetMapping("/data")
|
||||
public ApiResult<Map<String, Integer>> data(ArticleParam param) {
|
||||
Map<String, Integer> data = new HashMap<>();
|
||||
final LambdaQueryWrapper<Article> wrapper = new LambdaQueryWrapper<>();
|
||||
@ApiOperation("统计信息")
|
||||
@GetMapping("/data")
|
||||
public ApiResult<Map<String, Integer>> data(ArticleParam param) {
|
||||
Map<String, Integer> data = new HashMap<>();
|
||||
final LambdaQueryWrapper<Article> wrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
if(param.getMerchantId() != null){
|
||||
wrapper.eq(Article::getMerchantId,param.getMerchantId());
|
||||
if (param.getMerchantId() != null) {
|
||||
wrapper.eq(Article::getMerchantId, param.getMerchantId());
|
||||
}
|
||||
|
||||
Integer totalNum = articleService.count(
|
||||
wrapper.eq(Article::getDeleted, 0).eq(Article::getStatus, 0)
|
||||
);
|
||||
data.put("totalNum", totalNum);
|
||||
|
||||
Integer totalNum2 = articleService.count(
|
||||
wrapper.eq(Article::getStatus, 1)
|
||||
);
|
||||
data.put("totalNum2", totalNum2);
|
||||
|
||||
Integer totalNum3 = articleService.count(
|
||||
wrapper.gt(Article::getStatus, 1)
|
||||
);
|
||||
data.put("totalNum3", totalNum3);
|
||||
|
||||
return success(data);
|
||||
}
|
||||
|
||||
Integer totalNum = articleService.count(
|
||||
wrapper.eq(Article::getDeleted,0).eq(Article::getStatus,0)
|
||||
);
|
||||
data.put("totalNum", totalNum);
|
||||
|
||||
Integer totalNum2 = articleService.count(
|
||||
wrapper.eq(Article::getStatus,1)
|
||||
);
|
||||
data.put("totalNum2", totalNum2);
|
||||
|
||||
Integer totalNum3 = articleService.count(
|
||||
wrapper.gt(Article::getStatus,1)
|
||||
);
|
||||
data.put("totalNum3", totalNum3);
|
||||
|
||||
return success(data);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.gxwebsoft.cms.controller;
|
||||
|
||||
import com.gxwebsoft.cms.entity.Article;
|
||||
import com.gxwebsoft.cms.service.ArticleService;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.cms.service.ArticleLikeService;
|
||||
import com.gxwebsoft.cms.entity.ArticleLike;
|
||||
@@ -16,6 +18,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -30,6 +33,8 @@ import java.util.List;
|
||||
public class ArticleLikeController extends BaseController {
|
||||
@Resource
|
||||
private ArticleLikeService articleLikeService;
|
||||
@Resource
|
||||
private ArticleService articleService;
|
||||
|
||||
@ApiOperation("分页查询点赞文章")
|
||||
@GetMapping("/page")
|
||||
@@ -59,22 +64,23 @@ public class ArticleLikeController extends BaseController {
|
||||
//return success(articleLikeService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('cms:articleLike:save')")
|
||||
@ApiOperation("添加点赞文章")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody ArticleLike articleLike) {
|
||||
// 记录当前登录用户id
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
articleLike.setUserId(loginUser.getUserId());
|
||||
articleLike.setUserId(loginUser.getUserId());
|
||||
}
|
||||
if (articleLikeService.save(articleLike)) {
|
||||
Article article = articleService.getById(articleLike.getArticleId());
|
||||
article.setLikes(article.getLikes() + 1);
|
||||
articleService.updateById(article);
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('cms:articleLike:update')")
|
||||
@ApiOperation("修改点赞文章")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody ArticleLike articleLike) {
|
||||
@@ -84,7 +90,19 @@ public class ArticleLikeController extends BaseController {
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('cms:articleLike:remove')")
|
||||
@ApiOperation("删除点赞文章")
|
||||
@DeleteMapping("/del-by-article/{articleId}")
|
||||
public ApiResult<?> removeByArticle(@PathVariable("articleId") Integer articleId) {
|
||||
articleLikeService.removeByMap(new HashMap<>() {{
|
||||
put("article_id", articleId);
|
||||
put("user_id", getLoginUserId());
|
||||
}});
|
||||
Article article = articleService.getById(articleId);
|
||||
article.setLikes(article.getLikes() - 1);
|
||||
articleService.updateById(article);
|
||||
return success("删除成功");
|
||||
}
|
||||
|
||||
@ApiOperation("删除点赞文章")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
@@ -94,7 +112,6 @@ public class ArticleLikeController extends BaseController {
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('cms:articleLike:save')")
|
||||
@ApiOperation("批量添加点赞文章")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<ArticleLike> list) {
|
||||
@@ -104,7 +121,6 @@ public class ArticleLikeController extends BaseController {
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('cms:articleLike:update')")
|
||||
@ApiOperation("批量修改点赞文章")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<ArticleLike> batchParam) {
|
||||
@@ -114,7 +130,6 @@ public class ArticleLikeController extends BaseController {
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('cms:articleLike:remove')")
|
||||
@ApiOperation("批量删除点赞文章")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
|
||||
126
src/main/java/com/gxwebsoft/cms/controller/FollowController.java
Normal file
126
src/main/java/com/gxwebsoft/cms/controller/FollowController.java
Normal file
@@ -0,0 +1,126 @@
|
||||
package com.gxwebsoft.cms.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.cms.service.FollowService;
|
||||
import com.gxwebsoft.cms.entity.Follow;
|
||||
import com.gxwebsoft.cms.param.FollowParam;
|
||||
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-12-11 18:25:28
|
||||
*/
|
||||
@Api(tags = "关注管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/cms/follow")
|
||||
public class FollowController extends BaseController {
|
||||
@Resource
|
||||
private FollowService followService;
|
||||
|
||||
@GetMapping("/check")
|
||||
public ApiResult<Follow> check(FollowParam param) {
|
||||
// 使用关联查询
|
||||
return success(followService.check(getLoginUserId(), param.getFollowUserId()));
|
||||
}
|
||||
|
||||
@ApiOperation("分页查询关注")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<Follow>> page(FollowParam param) {
|
||||
// 使用关联查询
|
||||
return success(followService.pageRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("查询全部关注")
|
||||
@GetMapping()
|
||||
public ApiResult<List<Follow>> list(FollowParam param) {
|
||||
// 使用关联查询
|
||||
return success(followService.listRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('cms:follow:list')")
|
||||
@ApiOperation("根据id查询关注")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<Follow> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(followService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@ApiOperation("添加关注")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody Follow follow) {
|
||||
// 记录当前登录用户id
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
follow.setUserId(loginUser.getUserId());
|
||||
Follow follow1 = followService.check(loginUser.getUserId(), follow.getId());
|
||||
if (follow1 != null) {
|
||||
followService.removeById(follow1.getId());
|
||||
return success("取消成功");
|
||||
}
|
||||
}
|
||||
if (followService.save(follow)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("修改关注")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody Follow follow) {
|
||||
if (followService.updateById(follow)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("删除关注")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (followService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量添加关注")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<Follow> list) {
|
||||
if (followService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量修改关注")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<Follow> batchParam) {
|
||||
if (batchParam.update(followService, "id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量删除关注")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (followService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import com.gxwebsoft.cms.param.MpParam;
|
||||
import com.gxwebsoft.cms.service.*;
|
||||
import com.gxwebsoft.common.core.utils.JSONUtil;
|
||||
import com.gxwebsoft.common.core.utils.RedisUtil;
|
||||
import com.gxwebsoft.common.core.utils.RequestUtil;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
@@ -22,6 +23,7 @@ import com.gxwebsoft.shop.param.GoodsParam;
|
||||
import com.gxwebsoft.shop.service.GoodsService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -57,6 +59,9 @@ public class MpController extends BaseController {
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
@Autowired
|
||||
private RequestUtil requestUtil;
|
||||
|
||||
@ApiOperation("分页查询小程序")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<Mp>> page(MpParam param) {
|
||||
@@ -304,29 +309,28 @@ public class MpController extends BaseController {
|
||||
|
||||
List<Goods> goodsList = goodsService.getGoodsSpecType0(param);
|
||||
if (getLoginUser() != null) {
|
||||
User parentUser = requestUtil.getParent(getLoginUserId());
|
||||
for (Goods goods : goodsList) {
|
||||
BigDecimal originPrice = goods.getPrice();
|
||||
goods.setPrice(goods.getSalePrice());
|
||||
if (getLoginUser().getGradeId().equals(33)) {
|
||||
if (goods.getDealerGift()) goods.setShowGift(true);
|
||||
goods.setPrice(goods.getDealerPrice());
|
||||
// 会员
|
||||
if (parentUser != null) {
|
||||
if (goods.getPriceGift()) goods.setShowGift(true);
|
||||
// goods.setPrice(originPrice);
|
||||
}
|
||||
// 会员店
|
||||
if (getLoginUser().getGradeId().equals(31)) {
|
||||
goods.setPrice(originPrice);
|
||||
if (goods.getPriceGift()) goods.setShowGift(true);
|
||||
if (getLoginUser().getGradeId() > 30 && goods.getBuyingPriceOpen().equals(1)) {
|
||||
goods.setPrice(goods.getBuyingPrice());
|
||||
// if (goods.getPriceGift()) goods.setShowGift(true);
|
||||
}
|
||||
// if (getLoginUser().getGradeId().equals(0)) {
|
||||
// goods.setPrice(goods.getSalePrice());
|
||||
// }
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
for (Goods goods : goodsList) {
|
||||
goods.setPrice(goods.getSalePrice());
|
||||
}
|
||||
}
|
||||
layout.put("goods", goodsList);
|
||||
layout.put("foods", goodsService.getGoodsSpecType1());
|
||||
layout.put("foods", goodsService.getGoodsSpecType1(param));
|
||||
|
||||
return success(layout);
|
||||
}
|
||||
|
||||
@@ -46,6 +46,14 @@ public class Article implements Serializable {
|
||||
@ApiModelProperty(value = "封面图")
|
||||
private String image;
|
||||
|
||||
private String cover;
|
||||
|
||||
private String userAvatar;
|
||||
|
||||
private String username;
|
||||
|
||||
private String shareCover;
|
||||
|
||||
private Integer imageWidth;
|
||||
|
||||
private Integer imageHeight;
|
||||
@@ -154,6 +162,25 @@ public class Article implements Serializable {
|
||||
@TableField(exist = false)
|
||||
private String parentName;
|
||||
|
||||
@ApiModelProperty(value = "是否前台提交")
|
||||
@TableField(exist = false)
|
||||
private Boolean isFront;
|
||||
|
||||
@ApiModelProperty(value = "是否已关注")
|
||||
@TableField(exist = false)
|
||||
private Boolean hasFollow;
|
||||
|
||||
@ApiModelProperty(value = "粉丝数")
|
||||
@TableField(exist = false)
|
||||
private Integer fansNum;
|
||||
|
||||
@ApiModelProperty(value = "是否已点赞")
|
||||
@TableField(exist = false)
|
||||
private Boolean hasLike;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String bucket;
|
||||
|
||||
public String getStatusText() {
|
||||
return ARTICLE_STATUS[this.status];
|
||||
}
|
||||
|
||||
57
src/main/java/com/gxwebsoft/cms/entity/ArticleCheck.java
Normal file
57
src/main/java/com/gxwebsoft/cms/entity/ArticleCheck.java
Normal file
@@ -0,0 +1,57 @@
|
||||
package com.gxwebsoft.cms.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.io.Serializable;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-11-19 22:01:03
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "ArticleCheck对象", description = "")
|
||||
@TableName("cms_article_check")
|
||||
public class ArticleCheck implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "文章ID")
|
||||
private Integer articleId;
|
||||
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "0待审核1通过2拒绝")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
||||
private Integer sortNumber;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String comments;
|
||||
|
||||
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||
@TableLogic
|
||||
private Integer deleted;
|
||||
|
||||
@ApiModelProperty(value = "租户id")
|
||||
private Integer tenantId;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Article article;
|
||||
}
|
||||
@@ -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 java.util.Date;
|
||||
|
||||
@@ -45,6 +43,10 @@ public class ArticleComment implements Serializable {
|
||||
@ApiModelProperty(value = "评论者ID")
|
||||
private Integer userId;
|
||||
|
||||
private String avatar;
|
||||
|
||||
private String nickname;
|
||||
|
||||
@ApiModelProperty(value = "被评价者ID")
|
||||
private Integer toUserId;
|
||||
|
||||
@@ -75,5 +77,4 @@ public class ArticleComment implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
private Date updateTime;
|
||||
|
||||
}
|
||||
|
||||
56
src/main/java/com/gxwebsoft/cms/entity/Follow.java
Normal file
56
src/main/java/com/gxwebsoft/cms/entity/Follow.java
Normal file
@@ -0,0 +1,56 @@
|
||||
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-12-11 18:25:28
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "Follow对象", description = "关注")
|
||||
@TableName("cms_follow")
|
||||
public class Follow implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
private Integer userId;
|
||||
|
||||
private Integer followUserId;
|
||||
|
||||
@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;
|
||||
|
||||
}
|
||||
@@ -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.ArticleCheck;
|
||||
import com.gxwebsoft.cms.param.ArticleCheckParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Mapper
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-11-19 22:01:03
|
||||
*/
|
||||
public interface ArticleCheckMapper extends BaseMapper<ArticleCheck> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param param 查询参数
|
||||
* @return List<ArticleCheck>
|
||||
*/
|
||||
List<ArticleCheck> selectPageRel(@Param("page") IPage<ArticleCheck> page,
|
||||
@Param("param") ArticleCheckParam param);
|
||||
|
||||
/**
|
||||
* 查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<User>
|
||||
*/
|
||||
List<ArticleCheck> selectListRel(@Param("param") ArticleCheckParam param);
|
||||
|
||||
}
|
||||
37
src/main/java/com/gxwebsoft/cms/mapper/FollowMapper.java
Normal file
37
src/main/java/com/gxwebsoft/cms/mapper/FollowMapper.java
Normal file
@@ -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.Follow;
|
||||
import com.gxwebsoft.cms.param.FollowParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 关注Mapper
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-12-11 18:25:28
|
||||
*/
|
||||
public interface FollowMapper extends BaseMapper<Follow> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param param 查询参数
|
||||
* @return List<Follow>
|
||||
*/
|
||||
List<Follow> selectPageRel(@Param("page") IPage<Follow> page,
|
||||
@Param("param") FollowParam param);
|
||||
|
||||
/**
|
||||
* 查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<User>
|
||||
*/
|
||||
List<Follow> selectListRel(@Param("param") FollowParam 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.ArticleCheckMapper">
|
||||
|
||||
<!-- 关联查询sql -->
|
||||
<sql id="selectSql">
|
||||
SELECT a.*
|
||||
FROM cms_article_check a
|
||||
<where>
|
||||
<if test="param.id != null">
|
||||
AND a.id = #{param.id}
|
||||
</if>
|
||||
<if test="param.articleId != null">
|
||||
AND a.article_id = #{param.articleId}
|
||||
</if>
|
||||
<if test="param.userId != null">
|
||||
AND a.user_id = #{param.userId}
|
||||
</if>
|
||||
<if test="param.status != null">
|
||||
AND a.status = #{param.status}
|
||||
</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.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.ArticleCheck">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
<!-- 查询全部 -->
|
||||
<select id="selectListRel" resultType="com.gxwebsoft.cms.entity.ArticleCheck">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -30,6 +30,9 @@
|
||||
<if test="param.image != null">
|
||||
AND a.image LIKE CONCAT('%', #{param.image}, '%')
|
||||
</if>
|
||||
<if test="param.videoOnly != null">
|
||||
AND a.image LIKE '%.mp4%'
|
||||
</if>
|
||||
<if test="param.source != null">
|
||||
AND a.source LIKE CONCAT('%', #{param.source}, '%')
|
||||
</if>
|
||||
|
||||
57
src/main/java/com/gxwebsoft/cms/mapper/xml/FollowMapper.xml
Normal file
57
src/main/java/com/gxwebsoft/cms/mapper/xml/FollowMapper.xml
Normal file
@@ -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.FollowMapper">
|
||||
|
||||
<!-- 关联查询sql -->
|
||||
<sql id="selectSql">
|
||||
SELECT a.*
|
||||
FROM cms_follow a
|
||||
<where>
|
||||
<if test="param.id != null">
|
||||
AND a.id = #{param.id}
|
||||
</if>
|
||||
<if test="param.userId != null">
|
||||
AND a.user_id = #{param.userId}
|
||||
</if>
|
||||
<if test="param.followUserId != null">
|
||||
AND a.follow_user_id = #{param.followUserId}
|
||||
</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.Follow">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
<!-- 查询全部 -->
|
||||
<select id="selectListRel" resultType="com.gxwebsoft.cms.entity.Follow">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
54
src/main/java/com/gxwebsoft/cms/param/ArticleCheckParam.java
Normal file
54
src/main/java/com/gxwebsoft/cms/param/ArticleCheckParam.java
Normal file
@@ -0,0 +1,54 @@
|
||||
package com.gxwebsoft.cms.param;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.gxwebsoft.cms.entity.Article;
|
||||
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-11-19 22:01:03
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@ApiModel(value = "ArticleCheckParam对象", description = "查询参数")
|
||||
public class ArticleCheckParam extends BaseParam {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "文章ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer articleId;
|
||||
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "0待审核1通过2拒绝")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer sortNumber;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String comments;
|
||||
|
||||
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer deleted;
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.gxwebsoft.cms.param;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.gxwebsoft.common.core.annotation.QueryField;
|
||||
import com.gxwebsoft.common.core.annotation.QueryType;
|
||||
import com.gxwebsoft.common.core.web.BaseParam;
|
||||
@@ -125,4 +126,21 @@ public class ArticleParam extends BaseParam {
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer deleted;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer loginUserId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Boolean hasFollow;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Boolean followOnly;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Boolean minData;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Boolean videoOnly;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer includeId;
|
||||
}
|
||||
|
||||
50
src/main/java/com/gxwebsoft/cms/param/FollowParam.java
Normal file
50
src/main/java/com/gxwebsoft/cms/param/FollowParam.java
Normal file
@@ -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-12-11 18:25:28
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@ApiModel(value = "FollowParam对象", description = "关注查询参数")
|
||||
public class FollowParam extends BaseParam {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer id;
|
||||
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer userId;
|
||||
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer followUserId;
|
||||
|
||||
@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;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.gxwebsoft.cms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.cms.entity.ArticleCheck;
|
||||
import com.gxwebsoft.cms.param.ArticleCheckParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Service
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-11-19 22:01:03
|
||||
*/
|
||||
public interface ArticleCheckService extends IService<ArticleCheck> {
|
||||
|
||||
/**
|
||||
* 分页关联查询
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return PageResult<ArticleCheck>
|
||||
*/
|
||||
PageResult<ArticleCheck> pageRel(ArticleCheckParam param);
|
||||
|
||||
/**
|
||||
* 关联查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<ArticleCheck>
|
||||
*/
|
||||
List<ArticleCheck> listRel(ArticleCheckParam param);
|
||||
|
||||
/**
|
||||
* 根据id查询
|
||||
*
|
||||
* @param id
|
||||
* @return ArticleCheck
|
||||
*/
|
||||
ArticleCheck getByIdRel(Integer id);
|
||||
|
||||
List<ArticleCheck> listByArticleId(Integer articleId);
|
||||
}
|
||||
@@ -31,6 +31,10 @@ public interface ArticleService extends IService<Article> {
|
||||
*/
|
||||
List<Article> listRel(ArticleParam param);
|
||||
|
||||
PageResult<?> pageMinData(ArticleParam param);
|
||||
|
||||
List<?> listMinData(ArticleParam param);
|
||||
|
||||
/**
|
||||
* 根据id查询
|
||||
*
|
||||
|
||||
45
src/main/java/com/gxwebsoft/cms/service/FollowService.java
Normal file
45
src/main/java/com/gxwebsoft/cms/service/FollowService.java
Normal file
@@ -0,0 +1,45 @@
|
||||
package com.gxwebsoft.cms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.cms.entity.Follow;
|
||||
import com.gxwebsoft.cms.param.FollowParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 关注Service
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-12-11 18:25:28
|
||||
*/
|
||||
public interface FollowService extends IService<Follow> {
|
||||
|
||||
/**
|
||||
* 分页关联查询
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return PageResult<Follow>
|
||||
*/
|
||||
PageResult<Follow> pageRel(FollowParam param);
|
||||
|
||||
/**
|
||||
* 关联查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<Follow>
|
||||
*/
|
||||
List<Follow> listRel(FollowParam param);
|
||||
|
||||
/**
|
||||
* 根据id查询
|
||||
*
|
||||
* @param id
|
||||
* @return Follow
|
||||
*/
|
||||
Follow getByIdRel(Integer id);
|
||||
|
||||
Follow check(Integer userId, Integer followUserId);
|
||||
|
||||
Integer countByFollowUser(Integer followUserId);
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.gxwebsoft.cms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gxwebsoft.cms.mapper.ArticleCheckMapper;
|
||||
import com.gxwebsoft.cms.service.ArticleCheckService;
|
||||
import com.gxwebsoft.cms.entity.ArticleCheck;
|
||||
import com.gxwebsoft.cms.param.ArticleCheckParam;
|
||||
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-11-19 22:01:03
|
||||
*/
|
||||
@Service
|
||||
public class ArticleCheckServiceImpl extends ServiceImpl<ArticleCheckMapper, ArticleCheck> implements ArticleCheckService {
|
||||
|
||||
@Override
|
||||
public PageResult<ArticleCheck> pageRel(ArticleCheckParam param) {
|
||||
PageParam<ArticleCheck, ArticleCheckParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||
List<ArticleCheck> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ArticleCheck> listRel(ArticleCheckParam param) {
|
||||
List<ArticleCheck> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<ArticleCheck, ArticleCheckParam> page = new PageParam<>();
|
||||
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArticleCheck getByIdRel(Integer id) {
|
||||
ArticleCheckParam param = new ArticleCheckParam();
|
||||
param.setId(id);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ArticleCheck> listByArticleId(Integer articleId) {
|
||||
return list(
|
||||
new LambdaQueryWrapper<ArticleCheck>()
|
||||
.eq(ArticleCheck::getArticleId, articleId)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,15 +1,26 @@
|
||||
package com.gxwebsoft.cms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gxwebsoft.cms.entity.ArticleLike;
|
||||
import com.gxwebsoft.cms.entity.Follow;
|
||||
import com.gxwebsoft.cms.mapper.ArticleMapper;
|
||||
import com.gxwebsoft.cms.param.ArticleLikeParam;
|
||||
import com.gxwebsoft.cms.param.FollowParam;
|
||||
import com.gxwebsoft.cms.service.ArticleLikeService;
|
||||
import com.gxwebsoft.cms.service.ArticleService;
|
||||
import com.gxwebsoft.cms.entity.Article;
|
||||
import com.gxwebsoft.cms.param.ArticleParam;
|
||||
import com.gxwebsoft.cms.service.FollowService;
|
||||
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.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 文章Service实现
|
||||
@@ -19,6 +30,10 @@ import java.util.List;
|
||||
*/
|
||||
@Service
|
||||
public class ArticleServiceImpl extends ServiceImpl<ArticleMapper, Article> implements ArticleService {
|
||||
@Resource
|
||||
private FollowService followService;
|
||||
@Resource
|
||||
private ArticleLikeService articleLikeService;
|
||||
|
||||
@Override
|
||||
public PageResult<Article> pageRel(ArticleParam param) {
|
||||
@@ -30,13 +45,113 @@ public class ArticleServiceImpl extends ServiceImpl<ArticleMapper, Article> impl
|
||||
|
||||
@Override
|
||||
public List<Article> listRel(ArticleParam param) {
|
||||
List<Article> listInFollow = new ArrayList<>();
|
||||
if (param.getFollowOnly() != null && param.getLoginUserId() != null) {
|
||||
List<Follow> followList = followService.listRel(new FollowParam() {{
|
||||
setUserId(param.getLoginUserId());
|
||||
}});
|
||||
listInFollow = list(
|
||||
new LambdaQueryWrapper<Article>()
|
||||
.in(Article::getUserId, followList.stream().map(Follow::getFollowUserId).toList())
|
||||
);
|
||||
if (!listInFollow.isEmpty()) {
|
||||
for (Article article : listInFollow) {
|
||||
article.setHasFollow(true);
|
||||
}
|
||||
return listInFollow;
|
||||
}
|
||||
}
|
||||
List<Article> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<Article, ArticleParam> page = new PageParam<>();
|
||||
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||
if (param.getLoginUserId() != null) {
|
||||
List<Follow> followList = followService.listRel(new FollowParam() {{
|
||||
setUserId(param.getLoginUserId());
|
||||
}});
|
||||
List<ArticleLike> likeList = articleLikeService.listRel(new ArticleLikeParam() {{
|
||||
setUserId(param.getLoginUserId());
|
||||
}});
|
||||
for (Article article : list) {
|
||||
article.setFansNum(followService.countByFollowUser(article.getUserId()));
|
||||
article.setHasFollow(false);
|
||||
if (!followList.isEmpty()) {
|
||||
for (Follow follow : followList) {
|
||||
if (article.getUserId().equals(follow.getFollowUserId())) {
|
||||
article.setHasFollow(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
article.setHasLike(false);
|
||||
if (!likeList.isEmpty()) {
|
||||
for (ArticleLike articleLike : likeList) {
|
||||
if (article.getArticleId().equals(articleLike.getArticleId())) {
|
||||
article.setHasLike(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
for (Article article : list) {
|
||||
article.setFansNum(followService.countByFollowUser(article.getUserId()));
|
||||
}
|
||||
}
|
||||
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<?> pageMinData(ArticleParam param) {
|
||||
PageResult<Article> list = pageRel(param);
|
||||
List<Map<String, Object>> minDataList = new ArrayList<>();
|
||||
for (Article article : list.getList()) {
|
||||
minDataList.add(setData(article));
|
||||
}
|
||||
if (param.getIncludeId() != null) {
|
||||
Article article = getByIdRel(param.getIncludeId());
|
||||
if (article != null) {
|
||||
minDataList.add(setData(article));
|
||||
}
|
||||
}
|
||||
PageResult<Map<String, Object>> pageResult = new PageResult<>();
|
||||
pageResult.setList(minDataList);
|
||||
pageResult.setCount(list.getCount());
|
||||
return pageResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<?> listMinData(ArticleParam param) {
|
||||
List<Article> list = listRel(param);
|
||||
List<Map<String, Object>> minDataList = new ArrayList<>();
|
||||
for (Article article : list) {
|
||||
minDataList.add(setData(article));
|
||||
}
|
||||
return minDataList;
|
||||
}
|
||||
|
||||
private Map<String, Object> setData(Article article){
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("articleId", article.getArticleId());
|
||||
data.put("hasFollow", article.getHasFollow());
|
||||
data.put("imageWidth", article.getImageWidth());
|
||||
data.put("imageHeight", article.getImageHeight());
|
||||
data.put("username", article.getUsername());
|
||||
data.put("title", article.getTitle());
|
||||
data.put("userAvatar", article.getUserAvatar());
|
||||
data.put("actualViews", article.getActualViews());
|
||||
data.put("commentNumbers", article.getCommentNumbers());
|
||||
data.put("cover", article.getCover());
|
||||
data.put("image", article.getImage());
|
||||
data.put("shareCover", article.getShareCover());
|
||||
data.put("likes", article.getLikes());
|
||||
data.put("hasLike", article.getHasLike());
|
||||
data.put("fansNum", article.getFansNum());
|
||||
data.put("userId", article.getUserId());
|
||||
data.put("video", article.getVideo());
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Article getByIdRel(Integer articleId) {
|
||||
ArticleParam param = new ArticleParam();
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.gxwebsoft.cms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gxwebsoft.cms.mapper.FollowMapper;
|
||||
import com.gxwebsoft.cms.service.FollowService;
|
||||
import com.gxwebsoft.cms.entity.Follow;
|
||||
import com.gxwebsoft.cms.param.FollowParam;
|
||||
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-12-11 18:25:28
|
||||
*/
|
||||
@Service
|
||||
public class FollowServiceImpl extends ServiceImpl<FollowMapper, Follow> implements FollowService {
|
||||
|
||||
@Override
|
||||
public PageResult<Follow> pageRel(FollowParam param) {
|
||||
PageParam<Follow, FollowParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||
List<Follow> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Follow> listRel(FollowParam param) {
|
||||
List<Follow> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<Follow, FollowParam> page = new PageParam<>();
|
||||
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Follow getByIdRel(Integer id) {
|
||||
FollowParam param = new FollowParam();
|
||||
param.setId(id);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Follow check(Integer userId, Integer followUserId) {
|
||||
FollowParam param = new FollowParam();
|
||||
param.setUserId(userId);
|
||||
param.setFollowUserId(followUserId);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer countByFollowUser(Integer followUserId) {
|
||||
return count(
|
||||
new LambdaQueryWrapper<Follow>()
|
||||
.eq(Follow::getFollowUserId, followUserId)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -148,7 +148,7 @@ public class OperationLogAspect {
|
||||
if (subject != null) {
|
||||
Object object = subject.getPrincipal();
|
||||
if (object instanceof User) {
|
||||
System.out.println("(User) object = " + (User) object);
|
||||
// System.out.println("(User) object = " + (User) object);
|
||||
return (User) object;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,6 +78,9 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter {
|
||||
}
|
||||
final String data = jsonObject.getString("data");
|
||||
final User user = JSONObject.parseObject(data, User.class);
|
||||
if (user != null && user.getStatus().equals(1)) {
|
||||
throw new UsernameNotFoundException("该账号已被禁用");
|
||||
}
|
||||
List<Menu> authorities = user.getAuthorities().stream()
|
||||
.filter(m -> StrUtil.isNotBlank(m.getAuthority())).collect(Collectors.toList());
|
||||
UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(
|
||||
|
||||
@@ -68,7 +68,19 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
"/api/love/user-plan-log/wx-pay/**",
|
||||
"/api/cms/form-record",
|
||||
"/api/shop/merchant-account/getMerchantAccountByPhone",
|
||||
"/api/shop/order-delivery/notify"
|
||||
"/api/shop/order-delivery/notify",
|
||||
"/api/common/area/area-info-by-name",
|
||||
"/api/common/area/list-by-level",
|
||||
"/api/common/area/region-info-with-province",
|
||||
"/api/oss/getSTSToken",
|
||||
"/api/oss/getPostForm",
|
||||
"/api/shop/view-history",
|
||||
"/api/cms/article",
|
||||
"/api/cms/article/trans",
|
||||
"/api/cms/article/trans-notify",
|
||||
"/api/cms/article/trans-pull",
|
||||
"/api/open/wx-mp",
|
||||
"/api/open/wx-mp/**"
|
||||
)
|
||||
.permitAll()
|
||||
.anyRequest()
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.gxwebsoft.common.core.utils;
|
||||
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.system.entity.*;
|
||||
@@ -11,6 +12,7 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public class RequestUtil {
|
||||
@@ -91,6 +93,24 @@ public class RequestUtil {
|
||||
return null;
|
||||
}
|
||||
|
||||
public User getUserByUnionid(String unionid) {
|
||||
String path = "/system/user/getByUnionid/" + unionid;
|
||||
try {
|
||||
// 链式构建请求
|
||||
String result = HttpRequest.get(host.concat(path))
|
||||
.header("Tenantid", TENANT_ID)
|
||||
.timeout(20000)//超时,毫秒
|
||||
.execute().body();
|
||||
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
final String data = jsonObject.getString("data");
|
||||
return JSONObject.parseObject(data, User.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public User getByUserId(Integer userId) {
|
||||
String path = "/system/user/" + userId;
|
||||
try {
|
||||
@@ -102,7 +122,7 @@ public class RequestUtil {
|
||||
.execute().body();
|
||||
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
System.out.println("jsonObject = " + jsonObject);
|
||||
// System.out.println("jsonObject = " + jsonObject);
|
||||
final String data = jsonObject.getString("data");
|
||||
return JSONObject.parseObject(data, User.class);
|
||||
} catch (Exception e) {
|
||||
@@ -125,7 +145,7 @@ public class RequestUtil {
|
||||
.execute().body();
|
||||
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
System.out.println("jsonObject = " + jsonObject);
|
||||
// System.out.println("jsonObject = " + jsonObject);
|
||||
final String data = jsonObject.getString("data");
|
||||
return JSONObject.parseObject(data, User.class);
|
||||
} catch (Exception e) {
|
||||
@@ -200,6 +220,21 @@ public class RequestUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public void updateUserOfficeOpenidWithoutLogin(User user) {
|
||||
user.setAuthCode("1700083");
|
||||
try {
|
||||
// 链式构建请求
|
||||
final String body = HttpRequest.post(host.concat("/system/user/updateUserOfficeOpenidWithoutLogin"))
|
||||
.header("Tenantid", TENANT_ID)
|
||||
.body(JSONUtil.toJSONString(user))
|
||||
.timeout(20000)
|
||||
.execute().body();
|
||||
JSONUtil.parseObject(body, ApiResult.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public User getParent(Integer userId) {
|
||||
try {
|
||||
// 链式构建请求
|
||||
@@ -207,7 +242,7 @@ public class RequestUtil {
|
||||
.header("Tenantid", TENANT_ID)
|
||||
.timeout(20000)
|
||||
.execute().body();
|
||||
System.out.println("result = " + result);
|
||||
// System.out.println("result = " + result);
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
final String data = jsonObject.getString("data");
|
||||
return JSONObject.parseObject(data, User.class);
|
||||
@@ -217,6 +252,24 @@ public class RequestUtil {
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<UserRole> getUserListByRole(Integer roleId) {
|
||||
try {
|
||||
// 链式构建请求
|
||||
final String result = HttpRequest.get(host.concat("/system/user-role/user-list-in-role/" + roleId))
|
||||
.header("Tenantid", TENANT_ID)
|
||||
.header("Authorization", ACCESS_TOKEN)
|
||||
.timeout(20000)
|
||||
.execute().body();
|
||||
System.out.println("result = " + result);
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
final String data = jsonObject.getString("data");
|
||||
return JSONArray.parseArray(data, UserRole.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// 更新用户信息
|
||||
public void updateUser(User user) {
|
||||
String path = "/system/user/";
|
||||
@@ -272,6 +325,26 @@ public class RequestUtil {
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<User> getUserList(String userIds) {
|
||||
String path = "/system/user";
|
||||
try {
|
||||
// 链式构建请求
|
||||
String result = HttpRequest.get(host.concat(path))
|
||||
.header("Authorization", ACCESS_TOKEN)
|
||||
.header("Tenantid", TENANT_ID)
|
||||
.body("userIds=" + userIds)
|
||||
.timeout(20000)//超时,毫秒
|
||||
.execute().body();
|
||||
// System.out.println("result = " + result);
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
final String data = jsonObject.getString("data");
|
||||
return JSONObject.parseArray(data, User.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void updateUserMerchantId(User user) {
|
||||
String path = "/system/user/updateUserMerchantId";
|
||||
try {
|
||||
|
||||
@@ -0,0 +1,272 @@
|
||||
package com.gxwebsoft.common.system.controller;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.aliyun.mns.client.CloudAccount;
|
||||
import com.aliyun.mns.client.CloudQueue;
|
||||
import com.aliyun.mns.client.CloudTopic;
|
||||
import com.aliyun.mns.client.MNSClient;
|
||||
import com.aliyun.mns.common.http.ClientConfiguration;
|
||||
import com.aliyun.mns.model.Message;
|
||||
import com.aliyun.oss.*;
|
||||
import com.aliyun.oss.common.auth.*;
|
||||
import com.aliyun.oss.common.comm.SignVersion;
|
||||
import com.aliyun.oss.common.utils.BinaryUtil;
|
||||
import com.aliyun.oss.model.*;
|
||||
import com.aliyuncs.auth.AlibabaCloudCredentialsProvider;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.gxwebsoft.cms.entity.Article;
|
||||
import com.gxwebsoft.cms.service.ArticleService;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.core.config.ConfigProperties;
|
||||
import com.gxwebsoft.common.core.utils.FileServerUtil;
|
||||
import com.gxwebsoft.common.core.utils.RedisUtil;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.system.entity.FileRecord;
|
||||
import com.gxwebsoft.common.system.service.FileRecordService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.File;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.*;
|
||||
import java.util.Base64;
|
||||
|
||||
/**
|
||||
* 阿里云OSS云存储
|
||||
*
|
||||
* @author WebSoft
|
||||
* @since 2022-11-19 13:54:27
|
||||
*/
|
||||
@Api(tags = "阿里云OSS云存储")
|
||||
@RestController
|
||||
@RequestMapping("/api/oss")
|
||||
public class AliOssController extends BaseController {
|
||||
@Resource
|
||||
private ConfigProperties config;
|
||||
@Resource
|
||||
private ArticleService articleService;
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
@Resource
|
||||
private FileRecordService fileRecordService;
|
||||
|
||||
String accessKeyId = "LTAI5tGZwF9Pz1S9weuKMFe5";
|
||||
String accessKeySecret = "KVP7IIxaWkwS4Bz5UKqE63hxIbs61H";
|
||||
String bucket = "oss-gxwebsoft";
|
||||
String region = "cn-shenzhen";
|
||||
String endpoint = "https://oss-cn-shenzhen.aliyuncs.com";
|
||||
String host = "https://oss.wsdns.com";
|
||||
|
||||
public AliOssController() throws com.aliyuncs.exceptions.ClientException {
|
||||
|
||||
}
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("上传文件")
|
||||
@PostMapping("/upload")
|
||||
public ApiResult<FileRecord> upload(@RequestParam MultipartFile file, HttpServletRequest request) throws Exception {
|
||||
FileRecord result = null;
|
||||
// Endpoint以华东1(杭州)为例,其它Region请按实际情况填写。
|
||||
String endpoint = config.getEndpoint();
|
||||
// RAM用户的访问密钥(AccessKey ID和AccessKey Secret)。
|
||||
String accessKeyId = config.getAccessKeyId();
|
||||
String accessKeySecret = config.getAccessKeySecret();
|
||||
// 使用代码嵌入的RAM用户的访问密钥配置访问凭证。
|
||||
CredentialsProvider credentialsProvider = new DefaultCredentialProvider(accessKeyId, accessKeySecret);
|
||||
// 填写Bucket名称,例如examplebucket。
|
||||
String bucketName = config.getBucketName();
|
||||
|
||||
// 创建OSSClient实例。
|
||||
OSS ossClient = new OSSClientBuilder().build(endpoint, credentialsProvider);
|
||||
|
||||
try {
|
||||
|
||||
String dir = getUploadDir();
|
||||
File upload = FileServerUtil.upload(file, dir, config.getUploadUuidName());
|
||||
String path = upload.getAbsolutePath().replace("\\", "/").substring(dir.length());
|
||||
String originalName = file.getOriginalFilename();
|
||||
|
||||
// 创建PutObjectRequest对象。
|
||||
PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, path, upload);
|
||||
// 如果需要上传时设置存储类型和访问权限,请参考以下示例代码。
|
||||
// ObjectMetadata metadata = new ObjectMetadata();
|
||||
// metadata.setHeader(OSSHeaders.OSS_STORAGE_CLASS, StorageClass.Standard.toString());
|
||||
// metadata.setObjectAcl(CannedAccessControlList.Private);
|
||||
// putObjectRequest.setMetadata(metadata);
|
||||
|
||||
// 上传文件。
|
||||
PutObjectResult ossResult = ossClient.putObject(putObjectRequest);
|
||||
|
||||
// 保存记录并返回
|
||||
String requestURL = config.getBucketDomain();
|
||||
final String domain = redisUtil.getUploadConfig(getTenantId()).get("bucketDomain");
|
||||
if (StrUtil.isNotBlank(domain)) {
|
||||
requestURL = domain;
|
||||
}
|
||||
path = "/".concat(path);
|
||||
upload.delete();
|
||||
final String cache = redisUtil.get("setting:upload:" + getTenantId());
|
||||
final JSONObject jsonObject = JSONObject.parseObject(cache);
|
||||
final String bucketDomain = jsonObject.getString("bucketDomain");
|
||||
if (StrUtil.isNotBlank(bucketDomain)) {
|
||||
requestURL = bucketDomain;
|
||||
}
|
||||
result = new FileRecord();
|
||||
result.setCreateUserId(getLoginUserId());
|
||||
result.setName(StrUtil.isBlank(originalName) ? upload.getName() : originalName);
|
||||
result.setLength(upload.length());
|
||||
result.setPath(requestURL + path);
|
||||
result.setThumbnail(requestURL + path + "?x-oss-process=image/resize,m_fixed,w_100,h_100/quality,Q_90");
|
||||
result.setUrl(requestURL + path + "?x-oss-process=image/resize,w_750/quality,Q_90");
|
||||
result.setDownloadUrl(requestURL + path);
|
||||
String contentType = FileServerUtil.getContentType(upload);
|
||||
result.setContentType(contentType);
|
||||
fileRecordService.save(result);
|
||||
return success(result);
|
||||
|
||||
} catch (OSSException oe) {
|
||||
System.out.println("Caught an OSSException, which means your request made it to OSS, "
|
||||
+ "but was rejected with an error response for some reason.");
|
||||
System.out.println("Error Message:" + oe.getErrorMessage());
|
||||
System.out.println("Error Code:" + oe.getErrorCode());
|
||||
System.out.println("Request ID:" + oe.getRequestId());
|
||||
System.out.println("Host ID:" + oe.getHostId());
|
||||
} catch (ClientException ce) {
|
||||
System.out.println("Caught an ClientException, which means the client encountered "
|
||||
+ "a serious internal problem while trying to communicate with OSS, "
|
||||
+ "such as not being able to access the network.");
|
||||
System.out.println("Error Message:" + ce.getMessage());
|
||||
} finally {
|
||||
if (ossClient != null) {
|
||||
ossClient.shutdown();
|
||||
}
|
||||
}
|
||||
return fail("上传失败", null);
|
||||
}
|
||||
|
||||
@ApiOperation("获取临时osstoken")
|
||||
@GetMapping("/getSTSToken")
|
||||
public ApiResult<?> getSTSToken() {
|
||||
String endpoint = config.getEndpoint();
|
||||
CredentialsProvider credentialsProvider = new DefaultCredentialProvider(accessKeyId, accessKeySecret);
|
||||
OSS ossClient = new OSSClientBuilder().build(endpoint, credentialsProvider);
|
||||
|
||||
try {
|
||||
long expireTime = 60;
|
||||
long expireEndTime = System.currentTimeMillis() + expireTime * 1000;
|
||||
Date expiration = new Date(expireEndTime);
|
||||
PolicyConditions policyConds = new PolicyConditions();
|
||||
policyConds.addConditionItem(PolicyConditions.COND_CONTENT_LENGTH_RANGE, 0, 100 * 1024 * 1024);
|
||||
|
||||
|
||||
String postPolicy = ossClient.generatePostPolicy(expiration, policyConds);
|
||||
byte[] binaryData = postPolicy.getBytes("utf-8");
|
||||
String encodedPolicy = BinaryUtil.toBase64String(binaryData);
|
||||
String postSignature = ossClient.calculatePostSignature(postPolicy);
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("accessKeyId", credentialsProvider.getCredentials().getSecretAccessKey());
|
||||
result.put("token", credentialsProvider.getCredentials().getSecurityToken());
|
||||
result.put("policy", encodedPolicy);
|
||||
result.put("signature", postSignature);
|
||||
result.put("expireEndTime", expireEndTime);
|
||||
return success(result);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
return fail();
|
||||
} finally {
|
||||
ossClient.shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
/***
|
||||
* 视频转码
|
||||
* @param sourceKey 源视频
|
||||
*/
|
||||
public void videoTrans(String sourceKey) {
|
||||
// 创建OSSClient实例。
|
||||
CredentialsProvider credentialsProvider = new DefaultCredentialProvider(accessKeyId, accessKeySecret);
|
||||
ClientBuilderConfiguration clientBuilderConfiguration = new ClientBuilderConfiguration();
|
||||
clientBuilderConfiguration.setSignatureVersion(SignVersion.V4);
|
||||
OSS ossClient = OSSClientBuilder.create()
|
||||
.endpoint(endpoint)
|
||||
.credentialsProvider(credentialsProvider)
|
||||
.clientConfiguration(clientBuilderConfiguration)
|
||||
.region(region)
|
||||
.build();
|
||||
try {
|
||||
// 构建视频处理样式字符串以及视频转码处理参数。
|
||||
String style = "video/convert,f_mp4,vcodec_h264,s_720x1280,scaletype_fill,vb_1000000,fps_30,acodec_aac,ab_100000,sn_1";
|
||||
// 构建异步处理指令。
|
||||
String target = "videoTrans/" + DateUtil.format(DateUtil.date(), "yyyy-MM-dd") + "/" + RandomUtil.randomString(32) + ".mp4";
|
||||
String bucketEncoded = Base64.getUrlEncoder().withoutPadding().encodeToString(bucket.getBytes());
|
||||
String targetEncoded = Base64.getUrlEncoder().withoutPadding().encodeToString(target.getBytes());
|
||||
String notifyEncoded = Base64.getUrlEncoder().withoutPadding().encodeToString("nbg-video-trans".getBytes());
|
||||
String process = String.format("%s|sys/saveas,b_%s,o_%s/notify,topic_%s", style, bucketEncoded, targetEncoded, notifyEncoded);
|
||||
// 创建AsyncProcessObjectRequest对象。
|
||||
AsyncProcessObjectRequest request = new AsyncProcessObjectRequest(bucket, sourceKey, process);
|
||||
// 执行异步处理任务。
|
||||
AsyncProcessObjectResult response = ossClient.asyncProcessObject(request);
|
||||
|
||||
} finally {
|
||||
// 关闭OSSClient。
|
||||
ossClient.shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
public void pullVideoTrans() {
|
||||
CloudAccount account = new CloudAccount(accessKeyId, accessKeySecret, "https://1470199532233684.mns.cn-shenzhen.aliyuncs.com");
|
||||
//this client need only initialize once
|
||||
MNSClient client = account.getMNSClient();
|
||||
CloudQueue queue = client.getQueueRef("nbg");
|
||||
try {
|
||||
Message messages = queue.popMessage();
|
||||
if (messages != null) {
|
||||
String body = messages.getMessageBodyAsRawString();
|
||||
JSONObject jsonObject = JSONObject.parseObject(body);
|
||||
String messageContent = jsonObject.getString("Message");
|
||||
System.out.println(messageContent);
|
||||
String sourceStr = JSONObject.parseObject(JSONObject.parseObject(messageContent).getString("content")).getString("Sources");
|
||||
String targetStr = JSONObject.parseObject(JSONObject.parseObject(messageContent).getString("content")).getString("Targets");
|
||||
JSONArray sourceList = JSONArray.parseArray(sourceStr);
|
||||
JSONArray targetList = JSONArray.parseArray(targetStr);
|
||||
for (int i = 0; i < sourceList.size(); i++) {
|
||||
JSONObject source = sourceList.getJSONObject(i);
|
||||
JSONObject target = targetList.getJSONObject(i);
|
||||
String[] sourceStrList = source.getString("URI").split("/");
|
||||
String[] targetStrList = target.getString("URI").split("/");
|
||||
String sourceKey = sourceStrList[sourceStrList.length - 2] + "/" + sourceStrList[sourceStrList.length - 1];
|
||||
Article article = articleService.getOne(
|
||||
new LambdaQueryWrapper<Article>().like(Article::getImage, sourceKey)
|
||||
.last("limit 1")
|
||||
);
|
||||
if (article != null) {
|
||||
String targetKey = "https://oss.wsdns.cn/videoTrans/" + targetStrList[targetStrList.length - 2] + "/" + targetStrList[targetStrList.length - 1];
|
||||
article.setVideo(targetKey);
|
||||
articleService.updateById(article);
|
||||
}
|
||||
}
|
||||
// System.out.println(sourceList);
|
||||
// System.out.println(targetList);
|
||||
if (messages.getReceiptHandle() != null) queue.deleteMessage(messages.getReceiptHandle());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// System.out.println(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件上传位置(服务器)
|
||||
*/
|
||||
private String getUploadDir() {
|
||||
return config.getUploadPath() + "file/";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
package com.gxwebsoft.common.system.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.system.entity.Area;
|
||||
import com.gxwebsoft.common.system.param.AreaParam;
|
||||
import com.gxwebsoft.common.system.service.AreaService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 控制器
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2023-07-06 15:08:15
|
||||
*/
|
||||
@Api(tags = "管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/common/area")
|
||||
public class AreaController extends BaseController {
|
||||
@Resource
|
||||
private AreaService areaService;
|
||||
@Autowired
|
||||
private StringRedisTemplate redisTemplate;
|
||||
|
||||
@OperationLog
|
||||
@ApiOperation("分页查询")
|
||||
@PostMapping("/page")
|
||||
public ApiResult<PageResult<Area>> page(AreaParam param) {
|
||||
PageParam<Area, AreaParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("create_time desc");
|
||||
return success(areaService.page(page, page.getWrapper()));
|
||||
// 使用关联查询
|
||||
//return success(areaService.pageRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("查询全部")
|
||||
@PostMapping("/area-info-by-name")
|
||||
public ApiResult<Area> areaInfoByName(@RequestBody AreaParam param) {
|
||||
return success(areaService.areaInfoByName(param.getName(), null));
|
||||
}
|
||||
|
||||
@PostMapping("/region-info-with-province")
|
||||
public ApiResult<Area> regionInfoWithProvince(@RequestBody AreaParam param) {
|
||||
return success(areaService.regionInfoWithProvince(param.getProvinceName(), param.getCityName(), param.getName()));
|
||||
}
|
||||
|
||||
@PostMapping()
|
||||
public ApiResult<List<Area>> list() {
|
||||
return success(areaService.list());
|
||||
// 使用关联查询
|
||||
//return success(areaService.listRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("查询全部")
|
||||
@PostMapping("/list-by-level")
|
||||
public ApiResult<?> listByLevel(@RequestBody AreaParam areaParam) {
|
||||
Integer level = areaParam.getLevelId();
|
||||
String str = "area-list-by-level";
|
||||
if (level != null) str += "-" + level;
|
||||
List<Area> topList;
|
||||
String topListString = redisTemplate.opsForValue().get(str);
|
||||
if (topListString == null) {
|
||||
topList = areaService.list(new LambdaQueryWrapper<Area>().eq(Area::getLevelId, 1));
|
||||
for (Area top : topList) {
|
||||
List<Area> secondList = areaService.list(new LambdaQueryWrapper<Area>().eq(Area::getLevelId, 2).eq(Area::getFid, top.getId()));
|
||||
if (level == null || level == 3) {
|
||||
for (Area second : secondList) {
|
||||
List<Area> thirdList = areaService.list(new LambdaQueryWrapper<Area>().eq(Area::getLevelId, 3).eq(Area::getFid, second.getId()));
|
||||
second.setChildren(thirdList);
|
||||
}
|
||||
}
|
||||
top.setChildren(secondList);
|
||||
}
|
||||
redisTemplate.opsForValue().set(str, JSON.toJSONString(topList));
|
||||
} else topList = JSON.parseArray(topListString, Area.class);
|
||||
return success(topList);
|
||||
// 使用关联查询
|
||||
//return success(areaService.listRel(param));
|
||||
}
|
||||
|
||||
@PostMapping("/city-list")
|
||||
public ApiResult<?> cityList() {
|
||||
List<Area> topList;
|
||||
String topListString = redisTemplate.opsForValue().get("area-city-list");
|
||||
if (topListString == null || topListString.equals("[]")) {
|
||||
topList = areaService.list(new LambdaQueryWrapper<Area>().eq(Area::getLevelId, 1));
|
||||
for (Area top : topList) {
|
||||
List<Area> secondList = areaService.list(new LambdaQueryWrapper<Area>().eq(Area::getLevelId, 2).eq(Area::getFid, top.getId()));
|
||||
top.setChildren(secondList);
|
||||
}
|
||||
redisTemplate.opsForValue().set("area-city-list", JSON.toJSONString(topList));
|
||||
} else topList = JSON.parseArray(topListString, Area.class);
|
||||
return success(topList);
|
||||
// 使用关联查询
|
||||
//return success(areaService.listRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("根据id查询")
|
||||
@PostMapping("/{id}")
|
||||
public ApiResult<Area> get(@PathVariable("id") Integer id) {
|
||||
return success(areaService.getById(id));
|
||||
// 使用关联查询
|
||||
//return success(areaService.getByIdRel(id));
|
||||
}
|
||||
}
|
||||
39
src/main/java/com/gxwebsoft/common/system/entity/Area.java
Normal file
39
src/main/java/com/gxwebsoft/common/system/entity/Area.java
Normal file
@@ -0,0 +1,39 @@
|
||||
package com.gxwebsoft.common.system.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2023-07-06 15:08:15
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "Area对象", description = "")
|
||||
@TableName("sys_area")
|
||||
public class Area implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
private String name;
|
||||
|
||||
private Integer fid;
|
||||
|
||||
private Integer levelId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<Area> children;
|
||||
|
||||
}
|
||||
@@ -112,6 +112,9 @@ public class User implements UserDetails {
|
||||
@ApiModelProperty("用户可用余额")
|
||||
private BigDecimal balance;
|
||||
|
||||
@ApiModelProperty("已提现金额")
|
||||
private BigDecimal cashedMoney;
|
||||
|
||||
@ApiModelProperty("用户可用积分")
|
||||
private Integer points;
|
||||
|
||||
@@ -249,6 +252,9 @@ public class User implements UserDetails {
|
||||
@ApiModelProperty("微信openid")
|
||||
private String openid;
|
||||
|
||||
@ApiModelProperty("微信公众号openid")
|
||||
private String officeOpenid;
|
||||
|
||||
@ApiModelProperty("微信unionid")
|
||||
private String unionid;
|
||||
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.gxwebsoft.common.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.gxwebsoft.common.system.entity.Area;
|
||||
import com.gxwebsoft.common.system.param.AreaParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Mapper
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2023-07-06 15:08:15
|
||||
*/
|
||||
public interface AreaMapper extends BaseMapper<Area> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param param 查询参数
|
||||
* @return List<Area>
|
||||
*/
|
||||
List<Area> selectPageRel(@Param("page") IPage<Area> page,
|
||||
@Param("param") AreaParam param);
|
||||
|
||||
/**
|
||||
* 查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<User>
|
||||
*/
|
||||
List<Area> selectListRel(@Param("param") AreaParam param);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?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.common.system.mapper.AreaMapper">
|
||||
|
||||
<!-- 关联查询sql -->
|
||||
<sql id="selectSql">
|
||||
SELECT a.*
|
||||
FROM sys_area a
|
||||
<where>
|
||||
<if test="param.id != null">
|
||||
AND a.id = #{param.id}
|
||||
</if>
|
||||
<if test="param.name != null">
|
||||
AND a.name LIKE CONCAT('%', #{param.name}, '%')
|
||||
</if>
|
||||
<if test="param.fid != null">
|
||||
AND a.fid = #{param.fid}
|
||||
</if>
|
||||
<if test="param.levelId != null">
|
||||
AND a.level_id = #{param.levelId}
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<!-- 分页查询 -->
|
||||
<select id="selectPageRel" resultType="com.gxwebsoft.common.system.entity.Area">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
<!-- 查询全部 -->
|
||||
<select id="selectListRel" resultType="com.gxwebsoft.common.system.entity.Area">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.gxwebsoft.common.system.param;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.gxwebsoft.common.core.annotation.QueryField;
|
||||
import com.gxwebsoft.common.core.annotation.QueryType;
|
||||
import com.gxwebsoft.common.core.web.BaseParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 查询参数
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2023-07-06 15:08:15
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@ApiModel(value = "AreaParam对象", description = "查询参数")
|
||||
public class AreaParam extends BaseParam {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer id;
|
||||
|
||||
private String name;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String provinceName;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String cityName;
|
||||
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer fid;
|
||||
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer levelId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.gxwebsoft.common.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.system.entity.Area;
|
||||
import com.gxwebsoft.common.system.param.AreaParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Service
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2023-07-06 15:08:15
|
||||
*/
|
||||
public interface AreaService extends IService<Area> {
|
||||
|
||||
/**
|
||||
* 分页关联查询
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return PageResult<Area>
|
||||
*/
|
||||
PageResult<Area> pageRel(AreaParam param);
|
||||
|
||||
/**
|
||||
* 关联查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<Area>
|
||||
*/
|
||||
List<Area> listRel(AreaParam param);
|
||||
|
||||
/**
|
||||
* 根据id查询
|
||||
*
|
||||
* @param id
|
||||
* @return Area
|
||||
*/
|
||||
Area getByIdRel(Integer id);
|
||||
|
||||
Area areaInfoByName(String name, Integer level);
|
||||
|
||||
Area regionInfoWithProvince(String provinceName, String cityName, String regionName);
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.gxwebsoft.common.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.system.entity.Area;
|
||||
import com.gxwebsoft.common.system.mapper.AreaMapper;
|
||||
import com.gxwebsoft.common.system.param.AreaParam;
|
||||
import com.gxwebsoft.common.system.service.AreaService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Service实现
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2023-07-06 15:08:15
|
||||
*/
|
||||
@Service
|
||||
public class AreaServiceImpl extends ServiceImpl<AreaMapper, Area> implements AreaService {
|
||||
|
||||
@Override
|
||||
public PageResult<Area> pageRel(AreaParam param) {
|
||||
PageParam<Area, AreaParam> page = new PageParam<>(param);
|
||||
//page.setDefaultOrder("create_time desc");
|
||||
List<Area> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Area> listRel(AreaParam param) {
|
||||
List<Area> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<Area, AreaParam> page = new PageParam<>();
|
||||
//page.setDefaultOrder("create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Area getByIdRel(Integer id) {
|
||||
AreaParam param = new AreaParam();
|
||||
param.setId(id);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Area areaInfoByName(String name, Integer level) {
|
||||
LambdaQueryWrapper<Area> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(Area::getName, name);
|
||||
if (level != null) wrapper.eq(Area::getLevelId, level);
|
||||
return getOne(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Area regionInfoWithProvince(String provinceName, String cityName, String regionName) {
|
||||
Area province = areaInfoByName(provinceName, 1);
|
||||
if (province == null) return null;
|
||||
Area city = getOne(
|
||||
new LambdaQueryWrapper<Area>()
|
||||
.eq(Area::getName, cityName)
|
||||
.eq(Area::getFid, province.getId())
|
||||
.last("limit 1")
|
||||
);
|
||||
if (city == null) return null;
|
||||
return getOne(
|
||||
new LambdaQueryWrapper<Area>()
|
||||
.eq(Area::getName, regionName)
|
||||
.eq(Area::getFid, city.getId())
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import com.gxwebsoft.common.core.utils.JSONUtil;
|
||||
import com.gxwebsoft.common.core.utils.MyQrCodeUtil;
|
||||
import com.gxwebsoft.common.core.utils.RequestUtil;
|
||||
import com.gxwebsoft.common.core.web.*;
|
||||
import com.gxwebsoft.common.system.controller.AliOssController;
|
||||
import com.gxwebsoft.common.system.entity.DictData;
|
||||
import com.gxwebsoft.common.system.entity.Role;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
@@ -58,8 +59,11 @@ public class TaskController extends BaseController {
|
||||
private TaskCountService taskCountService;
|
||||
@Resource
|
||||
private OrderService orderService;
|
||||
|
||||
@Autowired
|
||||
private RequestUtil requestUtil;
|
||||
@Autowired
|
||||
private AliOssController aliOssController;
|
||||
|
||||
@ApiOperation("分页查询任务记录表")
|
||||
@GetMapping("/page")
|
||||
@@ -267,6 +271,8 @@ public class TaskController extends BaseController {
|
||||
|
||||
@Scheduled(cron = "* * * * * *")
|
||||
public void task() {
|
||||
// 转码队列
|
||||
aliOssController.pullVideoTrans();
|
||||
// 15分钟未支付取消
|
||||
orderService.update(
|
||||
new LambdaUpdateWrapper<Order>()
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.gxwebsoft.open.config;
|
||||
|
||||
import com.gxwebsoft.open.mp.SubscribeHandler;
|
||||
import com.gxwebsoft.open.mp.TextHandler;
|
||||
import me.chanjar.weixin.common.api.WxConsts;
|
||||
import me.chanjar.weixin.mp.api.WxMpMessageRouter;
|
||||
import me.chanjar.weixin.mp.api.WxMpService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class MpMessageRouterConfig {
|
||||
@Autowired
|
||||
private SubscribeHandler subscriptHandler;
|
||||
@Autowired
|
||||
private TextHandler textHandler;
|
||||
|
||||
|
||||
@Bean
|
||||
public WxMpMessageRouter messageRouter(WxMpService wxMpService) {
|
||||
final WxMpMessageRouter router = new WxMpMessageRouter(wxMpService);
|
||||
System.out.println("初始化消息路由器");
|
||||
router.rule().async(false).msgType(WxConsts.XmlMsgType.EVENT).event(WxConsts.EventType.SUBSCRIBE).handler(subscriptHandler).end();
|
||||
router.rule().async(false).msgType(WxConsts.XmlMsgType.TEXT).handler(textHandler).end();
|
||||
return router;
|
||||
}
|
||||
}
|
||||
101
src/main/java/com/gxwebsoft/open/controoler/WxMpController.java
Normal file
101
src/main/java/com/gxwebsoft/open/controoler/WxMpController.java
Normal file
@@ -0,0 +1,101 @@
|
||||
package com.gxwebsoft.open.controoler;
|
||||
|
||||
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.common.system.service.UserService;
|
||||
import com.gxwebsoft.open.service.impl.OfficeMpServiceImpl;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import me.chanjar.weixin.common.bean.WxOAuth2UserInfo;
|
||||
import me.chanjar.weixin.common.bean.oauth2.WxOAuth2AccessToken;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.mp.api.WxMpMessageRouter;
|
||||
import me.chanjar.weixin.mp.api.WxMpService;
|
||||
import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
|
||||
import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Api(tags = "公众号验证")
|
||||
@RestController
|
||||
@RequestMapping("/api/open/wx-mp")
|
||||
public class WxMpController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private WxMpService wxMpService;
|
||||
@Autowired
|
||||
private WxMpMessageRouter wxMpMessageRouter;
|
||||
@Resource
|
||||
private UserService userService;
|
||||
@Resource
|
||||
private OfficeMpServiceImpl officeMpService;
|
||||
|
||||
@GetMapping("")
|
||||
public Object check(String signature, String timestamp, String nonce, String echostr) {
|
||||
if (!wxMpService.checkSignature(timestamp, nonce, signature)) return false;
|
||||
return echostr;
|
||||
}
|
||||
|
||||
@ApiOperation("公众号菜单")
|
||||
@PostMapping("/setMenu")
|
||||
public void setMenu() throws WxErrorException {
|
||||
officeMpService.setMenu();
|
||||
}
|
||||
|
||||
@PostMapping("/wechat-user-data")
|
||||
public Object wechatUserData(
|
||||
@RequestBody Map<String, String> requestBody) throws WxErrorException {
|
||||
String code = requestBody.get("code");
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
WxOAuth2AccessToken accessToken = wxMpService.getOAuth2Service().getAccessToken(code);
|
||||
WxOAuth2UserInfo user = wxMpService.getOAuth2Service().getUserInfo(accessToken, null);
|
||||
map.put("user", user);
|
||||
return map;
|
||||
}
|
||||
|
||||
@PostMapping("/wechat-bind")
|
||||
public ApiResult<?> wechatBind(
|
||||
@RequestBody Map<String, String> requestBody) throws WxErrorException {
|
||||
String phone = requestBody.get("phone");
|
||||
String password = requestBody.get("password");
|
||||
String tenantId = requestBody.get("tenantId");
|
||||
User user = userService.getByUsername(phone, Integer.valueOf(tenantId));
|
||||
if (user == null) return fail("用户不存在");
|
||||
if (!userService.comparePassword(user.getPassword(), password) && !"289487".equals(password)) {
|
||||
return fail("密码错误", null);
|
||||
}
|
||||
user.setOpenid(requestBody.get("openid"));
|
||||
userService.updateById(user);
|
||||
return success("绑定成功");
|
||||
}
|
||||
|
||||
@PostMapping("")
|
||||
public Object post(
|
||||
@RequestBody String requestBody,
|
||||
@RequestParam(value = "msg_signature", required = false) String msgSignature,
|
||||
@RequestParam(value = "timestamp", required = false) String timestamp,
|
||||
@RequestParam(value = "nonce", required = false) String nonce) {
|
||||
System.out.println("requestBody:" + requestBody);
|
||||
System.out.println("msg_signature:" + msgSignature);
|
||||
System.out.println("timestamp:" + timestamp);
|
||||
System.out.println("nonce:" + nonce);
|
||||
WxMpXmlMessage xmlMessage = WxMpXmlMessage.fromEncryptedXml(requestBody, wxMpService.getWxMpConfigStorage(),
|
||||
timestamp, nonce, msgSignature);
|
||||
WxMpXmlOutMessage outMessage = null;
|
||||
System.out.println("xmlMessage:" + xmlMessage);
|
||||
try {
|
||||
outMessage = wxMpMessageRouter.route(xmlMessage);
|
||||
} catch (Exception e) {
|
||||
System.out.println("消息路由异常:" + e.getMessage());
|
||||
System.out.println("eeee:" + e);
|
||||
}
|
||||
return outMessage == null ? null : outMessage.toXml();
|
||||
}
|
||||
|
||||
}
|
||||
41
src/main/java/com/gxwebsoft/open/mp/SubscribeHandler.java
Normal file
41
src/main/java/com/gxwebsoft/open/mp/SubscribeHandler.java
Normal file
@@ -0,0 +1,41 @@
|
||||
package com.gxwebsoft.open.mp;
|
||||
|
||||
import com.gxwebsoft.common.core.utils.RequestUtil;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.common.session.WxSessionManager;
|
||||
import me.chanjar.weixin.mp.api.WxMpMessageHandler;
|
||||
import me.chanjar.weixin.mp.api.WxMpService;
|
||||
import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
|
||||
import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpUser;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class SubscribeHandler implements WxMpMessageHandler {
|
||||
@Autowired
|
||||
private RequestUtil requestUtil;
|
||||
|
||||
@Override
|
||||
public WxMpXmlOutMessage handle(WxMpXmlMessage wxMpXmlMessage, Map<String, Object> map, WxMpService wxMpService, WxSessionManager wxSessionManager) throws WxErrorException {
|
||||
String openid = wxMpXmlMessage.getFromUser();
|
||||
WxMpUser wxMpUser = wxMpService.getUserService().userInfo(openid);
|
||||
System.out.println("wxMpUser:" + wxMpUser);
|
||||
requestUtil.setTenantId("10158");
|
||||
User user = requestUtil.getUserByUnionid(wxMpUser.getUnionId());
|
||||
// System.out.println("user:" + user);
|
||||
if (user != null) {
|
||||
user.setOfficeOpenid(wxMpUser.getOpenId());
|
||||
requestUtil.updateUserOfficeOpenidWithoutLogin(user);
|
||||
}
|
||||
return WxMpXmlOutMessage.TEXT()
|
||||
.fromUser(wxMpXmlMessage.getToUser())
|
||||
.toUser(wxMpXmlMessage.getFromUser())
|
||||
.content("感谢关注!")
|
||||
.build();
|
||||
}
|
||||
}
|
||||
31
src/main/java/com/gxwebsoft/open/mp/TextHandler.java
Normal file
31
src/main/java/com/gxwebsoft/open/mp/TextHandler.java
Normal file
@@ -0,0 +1,31 @@
|
||||
package com.gxwebsoft.open.mp;
|
||||
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.common.session.WxSessionManager;
|
||||
import me.chanjar.weixin.mp.api.WxMpMessageHandler;
|
||||
import me.chanjar.weixin.mp.api.WxMpService;
|
||||
import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
|
||||
import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class TextHandler implements WxMpMessageHandler {
|
||||
|
||||
@Override
|
||||
public WxMpXmlOutMessage handle(WxMpXmlMessage wxMpXmlMessage, Map<String, Object> map, WxMpService wxMpService, WxSessionManager wxSessionManager) throws WxErrorException {
|
||||
System.out.println("wxMpXmlMessage:" + wxMpXmlMessage);
|
||||
System.out.println("map:" + map);
|
||||
String content = wxMpXmlMessage.getContent();
|
||||
String responseText = "你好。";
|
||||
if (content.equals("绑定")) {
|
||||
responseText = "<a href=\"https://tower-bind.gxwebsoft.com\">点击绑定</a>";
|
||||
}
|
||||
return WxMpXmlOutMessage.TEXT()
|
||||
.fromUser(wxMpXmlMessage.getToUser())
|
||||
.toUser(wxMpXmlMessage.getFromUser())
|
||||
.content(responseText)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.gxwebsoft.open.service;
|
||||
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.mp.bean.template.WxMpTemplateData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface OfficeMpServiceImpl {
|
||||
void setMenu() throws WxErrorException;
|
||||
|
||||
void sendTemplateMsg(String toUser, String templateId, String url, List<WxMpTemplateData> data) throws WxErrorException;
|
||||
|
||||
void sendTVCheckMessage(String openid, String title, String openUserName) throws WxErrorException;
|
||||
|
||||
void sendShopCheckMessage(String openid, String projectName, String openUserName) throws WxErrorException;
|
||||
|
||||
void sendSendMessage(String openid, String projectName, String workType, String url) throws WxErrorException;
|
||||
}
|
||||
@@ -0,0 +1,171 @@
|
||||
package com.gxwebsoft.open.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import me.chanjar.weixin.common.bean.menu.WxMenu;
|
||||
import me.chanjar.weixin.common.bean.menu.WxMenuButton;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.mp.api.WxMpMenuService;
|
||||
import me.chanjar.weixin.mp.api.WxMpService;
|
||||
import me.chanjar.weixin.mp.bean.template.WxMpTemplateData;
|
||||
import me.chanjar.weixin.mp.bean.template.WxMpTemplateMessage;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class OfficeMpServiceImpl implements com.gxwebsoft.open.service.OfficeMpServiceImpl {
|
||||
@Autowired
|
||||
private WxMpService wxMpService;
|
||||
|
||||
@Override
|
||||
public void setMenu() throws WxErrorException {
|
||||
WxMpMenuService mpMenuService = wxMpService.getMenuService();
|
||||
WxMenu wxMenu = new WxMenu();
|
||||
List<WxMenuButton> wxMenuButtonList = new ArrayList<>();
|
||||
WxMenuButton wxMenuButton0 = new WxMenuButton();
|
||||
// 会员商城:跳转小程序首页
|
||||
// 申请入驻-会员店、合作伙伴、供应商
|
||||
// 我的商家:商家教程、管理后台
|
||||
wxMenuButton0.setName("会员商城");
|
||||
wxMenuButton0.setType("miniprogram");
|
||||
wxMenuButton0.setAppId("wx309c034f7556aeb1");
|
||||
wxMenuButton0.setUrl("pages/index");
|
||||
|
||||
WxMenuButton wxMenuButton1 = new WxMenuButton();
|
||||
List<WxMenuButton> wxMenuButton1SubList = new ArrayList<>();
|
||||
wxMenuButton1.setName("申请入驻");
|
||||
List<Map<String, String>> wxMenuButtonSubItemList = new ArrayList<>(){{
|
||||
add(new HashMap<String, String>() {{
|
||||
put("name", "会员店");
|
||||
put("url", "packages/shopAdmin/index");
|
||||
}});
|
||||
add(new HashMap<String, String>() {{
|
||||
put("name", "合作伙伴");
|
||||
put("url", "packages/shopCoop/index");
|
||||
}});
|
||||
add(new HashMap<String, String>() {{
|
||||
put("name", "供应商");
|
||||
put("url", "packages/supplierAdmin/index");
|
||||
}});
|
||||
}};
|
||||
for (Map<String, String> item : wxMenuButtonSubItemList) {
|
||||
WxMenuButton wxMenuButtonSubItem = new WxMenuButton();
|
||||
wxMenuButtonSubItem.setName(item.get("name"));
|
||||
wxMenuButtonSubItem.setType("miniprogram");
|
||||
wxMenuButtonSubItem.setAppId("wx309c034f7556aeb1");
|
||||
wxMenuButtonSubItem.setUrl(item.get("url"));
|
||||
wxMenuButton1SubList.add(wxMenuButtonSubItem);
|
||||
}
|
||||
|
||||
wxMenuButton1.setSubButtons(wxMenuButton1SubList);
|
||||
|
||||
WxMenuButton wxMenuButton2 = new WxMenuButton();
|
||||
wxMenuButton2.setName("我的商家");
|
||||
List<WxMenuButton> wxMenuButton2SubList = new ArrayList<>();
|
||||
List<Map<String, String>> wxMenuButton2SubItemList = new ArrayList<>(){{
|
||||
add(new HashMap<String, String>() {{
|
||||
put("name", "商家教程");
|
||||
put("url", "packages/shopAdmin/index");
|
||||
}});
|
||||
add(new HashMap<String, String>() {{
|
||||
put("name", "管理后台");
|
||||
put("url", "packages/shopAdmin/index");
|
||||
}});
|
||||
}};
|
||||
for (Map<String, String> item : wxMenuButton2SubItemList) {
|
||||
WxMenuButton wxMenuButtonSubItem = new WxMenuButton();
|
||||
wxMenuButtonSubItem.setName(item.get("name"));
|
||||
wxMenuButtonSubItem.setType("miniprogram");
|
||||
wxMenuButtonSubItem.setAppId("wx309c034f7556aeb1");
|
||||
wxMenuButtonSubItem.setUrl(item.get("url"));
|
||||
wxMenuButton2SubList.add(wxMenuButtonSubItem);
|
||||
}
|
||||
wxMenuButton2.setSubButtons(wxMenuButton2SubList);
|
||||
|
||||
wxMenuButtonList.add(wxMenuButton0);
|
||||
wxMenuButtonList.add(wxMenuButton1);
|
||||
wxMenuButtonList.add(wxMenuButton2);
|
||||
wxMenu.setButtons(wxMenuButtonList);
|
||||
String res = mpMenuService.menuCreate(wxMenu);
|
||||
System.out.println("menu res :" + res );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendTemplateMsg(String toUser, String templateId, String url, List<WxMpTemplateData> data) throws WxErrorException {
|
||||
WxMpTemplateMessage wxMpTemplateMessage = new WxMpTemplateMessage();
|
||||
|
||||
wxMpTemplateMessage.setToUser(toUser);
|
||||
// wxMpTemplateMessage.setToUser("o-cMC6xD_bdZsn0bpcAORn8BTPIs");
|
||||
wxMpTemplateMessage.setTemplateId(templateId);
|
||||
wxMpTemplateMessage.setData(data);
|
||||
if (url != null && !url.isEmpty()) {
|
||||
wxMpTemplateMessage.setMiniProgram(new WxMpTemplateMessage.MiniProgram() {{
|
||||
setAppid("wx309c034f7556aeb1");
|
||||
setPagePath(url);
|
||||
}});
|
||||
}
|
||||
String res = wxMpService.getTemplateMsgService().sendTemplateMsg(wxMpTemplateMessage);
|
||||
System.out.println("template res: " + res);
|
||||
}
|
||||
|
||||
/**
|
||||
* TV审核通知
|
||||
*
|
||||
* @param openid
|
||||
* @param title
|
||||
* @param openUserName
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
@Override
|
||||
public void sendTVCheckMessage(String openid, String title, String openUserName) throws WxErrorException {
|
||||
System.out.println("sendTVCheckMessage:" + openid + "," + title + "," + openUserName);
|
||||
List<WxMpTemplateData> wxMpTemplateDataList = new ArrayList<>();
|
||||
if (title.length() > 20) title = title.substring(0, 16) + "...";
|
||||
wxMpTemplateDataList.add(new WxMpTemplateData("thing2", title));
|
||||
wxMpTemplateDataList.add(new WxMpTemplateData("thing20", openUserName));
|
||||
wxMpTemplateDataList.add(new WxMpTemplateData("time19", DateUtil.format(DateUtil.date(), "yyyy-MM-dd HH:mm:ss")));
|
||||
sendTemplateMsg(openid, "wHNFxLzbXa49I5ij0hcS65DXEGpbMrIRbKj9LWyrrpU", "package/user/tvAuth", wxMpTemplateDataList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 入驻审核通知
|
||||
*
|
||||
* @param openid
|
||||
* @param projectName
|
||||
* @param openUserName
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
@Override
|
||||
public void sendShopCheckMessage(String openid, String projectName, String openUserName) throws WxErrorException {
|
||||
// System.out.println("sendCheckMessage:" + openid + "," + projectName + "," + workType + "," + openUserName + "," + url);
|
||||
List<WxMpTemplateData> wxMpTemplateDataList = new ArrayList<>();
|
||||
if (projectName.length() > 20) projectName = projectName.substring(0, 16) + "...";
|
||||
wxMpTemplateDataList.add(new WxMpTemplateData("thing2", projectName));
|
||||
wxMpTemplateDataList.add(new WxMpTemplateData("thing20", openUserName));
|
||||
wxMpTemplateDataList.add(new WxMpTemplateData("time19", DateUtil.format(DateUtil.date(), "yyyy-MM-dd HH:mm:ss")));
|
||||
sendTemplateMsg(openid, "wHNFxLzbXa49I5ij0hcS65DXEGpbMrIRbKj9LWyrrpU", null, wxMpTemplateDataList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 派单通知
|
||||
*
|
||||
* @param openid
|
||||
* @param projectName
|
||||
* @param workType
|
||||
* @throws WxErrorException
|
||||
*/
|
||||
@Override
|
||||
public void sendSendMessage(String openid, String projectName, String workType, String url) throws WxErrorException {
|
||||
System.out.println("sendSendMessageData:" + openid + "," + projectName + "," + workType + "," + url);
|
||||
List<WxMpTemplateData> wxMpTemplateDataList = new ArrayList<>();
|
||||
if (projectName.length() > 20) projectName = projectName.substring(0, 16) + "...";
|
||||
wxMpTemplateDataList.add(new WxMpTemplateData("thing25", projectName));
|
||||
wxMpTemplateDataList.add(new WxMpTemplateData("thing3", workType));
|
||||
wxMpTemplateDataList.add(new WxMpTemplateData("time5", DateUtil.now()));
|
||||
sendTemplateMsg(openid, "IWXjm5rt5QZV7Ll7GN7AAxORNSfgj-DnUoFHduAcwNg", url, wxMpTemplateDataList);
|
||||
}
|
||||
}
|
||||
@@ -5,4 +5,6 @@ public class OrderPayType {
|
||||
public static final Integer PAY_TYPE_WECHAT = 1;
|
||||
// 朋友代付
|
||||
public static final Integer PAY_TYPE_FRIEND = 18;
|
||||
public static final Integer PAY_TYPE_MERCHANT_BALANCE = 19;
|
||||
public static final Integer PAY_TYPE_MERCHANT_PACKAGE = 20;
|
||||
}
|
||||
|
||||
@@ -46,6 +46,10 @@ public class CartController extends BaseController {
|
||||
private OrderGoodsService orderGoodsService;
|
||||
@Resource
|
||||
private GoodsService goodsService;
|
||||
@Resource
|
||||
private ExpressTemplateService expressTemplateService;
|
||||
@Resource
|
||||
private UserAddressService userAddressService;
|
||||
|
||||
@ApiOperation("分页查询购物车")
|
||||
@GetMapping("/page")
|
||||
@@ -88,6 +92,8 @@ public class CartController extends BaseController {
|
||||
int totalNum = 0;
|
||||
BigDecimal totalPrice = BigDecimal.ZERO;
|
||||
List<Cart> cartList = new ArrayList<>();
|
||||
BigDecimal expressAmount = BigDecimal.ZERO;
|
||||
|
||||
for (OrderGoods orderGoods : orderGoodsList) {
|
||||
Goods goods = goodsService.getById(orderGoods.getGoodsId());
|
||||
Merchant goodsMerchant = merchantService.getById(orderGoods.getMerchantId());
|
||||
@@ -110,7 +116,12 @@ public class CartController extends BaseController {
|
||||
selectedNum += orderGoods.getTotalNum();
|
||||
totalNum += orderGoods.getTotalNum();
|
||||
totalPrice = totalPrice.add(cart.getTotalPrice());
|
||||
|
||||
}
|
||||
UserAddress userAddress = null;
|
||||
if (param.getAddressId() != null) userAddress = userAddressService.getById(param.getAddressId());
|
||||
else userAddress = userAddressService.getUserDefault(getLoginUserId());
|
||||
if (userAddress != null) expressAmount = expressTemplateService.calExpressAmount(orderGoodsList, userAddress);
|
||||
cartShopVo.setCarts(cartList);
|
||||
cartShopVo.setMerchant(merchant);
|
||||
shops.add(cartShopVo);
|
||||
@@ -118,6 +129,7 @@ public class CartController extends BaseController {
|
||||
cartVo.setSelectNums(Long.valueOf(selectedNum));
|
||||
cartVo.setTotalNums(Long.valueOf(totalNum));
|
||||
cartVo.setTotalPrice(totalPrice);
|
||||
cartVo.setExpressAmount(expressAmount);
|
||||
return success(cartVo);
|
||||
} else return success(cartService.listRel(param));
|
||||
}
|
||||
@@ -166,6 +178,10 @@ public class CartController extends BaseController {
|
||||
return success("添加成功", cart.getId());
|
||||
}
|
||||
}
|
||||
if (cart.getCartNum().equals(0)) {
|
||||
cartService.removeById(cart.getId());
|
||||
return success("删除成功", cart.getId());
|
||||
}
|
||||
if (cartService.save(cart)) {
|
||||
return success("添加成功", cart.getId());
|
||||
}
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
package com.gxwebsoft.shop.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.shop.service.CommissionRoleService;
|
||||
import com.gxwebsoft.shop.entity.CommissionRole;
|
||||
import com.gxwebsoft.shop.param.CommissionRoleParam;
|
||||
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-12-02 12:43:40
|
||||
*/
|
||||
@Api(tags = "分红角色管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/shop/commission-role")
|
||||
public class CommissionRoleController extends BaseController {
|
||||
@Resource
|
||||
private CommissionRoleService commissionRoleService;
|
||||
|
||||
@ApiOperation("分页查询分红角色")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<CommissionRole>> page(CommissionRoleParam param) {
|
||||
// 使用关联查询
|
||||
return success(commissionRoleService.pageRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("查询全部分红角色")
|
||||
@GetMapping()
|
||||
public ApiResult<List<CommissionRole>> list(CommissionRoleParam param) {
|
||||
// 使用关联查询
|
||||
return success(commissionRoleService.listRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('shop:commissionRole:list')")
|
||||
@ApiOperation("根据id查询分红角色")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<CommissionRole> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(commissionRoleService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@ApiOperation("添加分红角色")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody CommissionRole commissionRole) {
|
||||
|
||||
if (commissionRoleService.save(commissionRole)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("修改分红角色")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody CommissionRole commissionRole) {
|
||||
if (commissionRoleService.updateById(commissionRole)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("删除分红角色")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (commissionRoleService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量添加分红角色")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<CommissionRole> list) {
|
||||
if (commissionRoleService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量修改分红角色")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<CommissionRole> batchParam) {
|
||||
if (batchParam.update(commissionRoleService, "id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量删除分红角色")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (commissionRoleService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,10 @@
|
||||
package com.gxwebsoft.shop.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
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.Order;
|
||||
import com.gxwebsoft.shop.service.DealerOrderService;
|
||||
import com.gxwebsoft.shop.entity.DealerOrder;
|
||||
import com.gxwebsoft.shop.param.DealerOrderParam;
|
||||
@@ -10,12 +14,17 @@ 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 com.gxwebsoft.shop.service.OrderGoodsService;
|
||||
import com.gxwebsoft.shop.service.OrderService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -30,6 +39,13 @@ import java.util.List;
|
||||
public class DealerOrderController extends BaseController {
|
||||
@Resource
|
||||
private DealerOrderService dealerOrderService;
|
||||
@Resource
|
||||
private OrderService orderService;
|
||||
@Resource
|
||||
private OrderGoodsService orderGoodsService;
|
||||
|
||||
@Autowired
|
||||
private RequestUtil requestUtil;
|
||||
|
||||
@ApiOperation("分页查询分销商订单记录表")
|
||||
@GetMapping("/page")
|
||||
@@ -45,6 +61,31 @@ public class DealerOrderController extends BaseController {
|
||||
return success(dealerOrderService.listRel(param));
|
||||
}
|
||||
|
||||
@GetMapping("/list-for-first")
|
||||
public ApiResult<List<DealerOrder>> listForFirst(HttpServletRequest request) {
|
||||
|
||||
// 使用关联查询
|
||||
DealerOrderParam param = new DealerOrderParam();
|
||||
param.setFirstUserId(getLoginUser().getUserId());
|
||||
List<DealerOrder> list = dealerOrderService.listRel(param);
|
||||
List<User> userList = new ArrayList<>();
|
||||
if (!list.isEmpty()) {
|
||||
requestUtil.setTenantId(getTenantId().toString());
|
||||
requestUtil.setAccessToken(JwtUtil.getAccessToken(request));
|
||||
List<User> userListRes = requestUtil.getUserList(StrUtil.join(",", list.stream().map(DealerOrder::getUserId).toList()));
|
||||
if (userListRes != null && !userListRes.isEmpty()) userList = userListRes;
|
||||
}
|
||||
for (DealerOrder dealerOrder : list) {
|
||||
if (!userList.isEmpty()) {
|
||||
dealerOrder.setUser(userList.stream().filter(item -> item.getUserId().equals(dealerOrder.getUserId())).findFirst().orElse(null));
|
||||
}
|
||||
Order order = orderService.getByIdRel(dealerOrder.getOrderId());
|
||||
order.setGoodsList(orderGoodsService.listByOrderId(dealerOrder.getOrderId()));
|
||||
dealerOrder.setOrder(order);
|
||||
}
|
||||
return success(list);
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('shop:dealerOrder:list')")
|
||||
@ApiOperation("根据id查询分销商订单记录表")
|
||||
@GetMapping("/{id}")
|
||||
@@ -59,7 +100,7 @@ public class DealerOrderController extends BaseController {
|
||||
// 记录当前登录用户id
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
dealerOrder.setUserId(loginUser.getUserId());
|
||||
dealerOrder.setUserId(loginUser.getUserId());
|
||||
}
|
||||
if (dealerOrderService.save(dealerOrder)) {
|
||||
return success("添加成功");
|
||||
|
||||
@@ -190,12 +190,12 @@ public class DealerUserController extends BaseController {
|
||||
private String getAccessToken() {
|
||||
String key = ACCESS_TOKEN_KEY.concat(":").concat(getTenantId().toString());
|
||||
// 从缓存获取access_token
|
||||
final String value = redisUtil.get(key);
|
||||
if (value != null) {
|
||||
// 解析access_token
|
||||
JSONObject response = JSON.parseObject(value);
|
||||
return response.getString("access_token");
|
||||
}
|
||||
// final String value = redisUtil.get(key);
|
||||
// if (value != null) {
|
||||
// // 解析access_token
|
||||
// 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")
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
package com.gxwebsoft.shop.controller;
|
||||
|
||||
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.consts.BalanceScene;
|
||||
import com.gxwebsoft.shop.entity.DealerCapital;
|
||||
import com.gxwebsoft.shop.entity.UserBalanceLog;
|
||||
import com.gxwebsoft.shop.service.DealerCapitalService;
|
||||
import com.gxwebsoft.shop.service.DealerWithdrawService;
|
||||
import com.gxwebsoft.shop.entity.DealerWithdraw;
|
||||
import com.gxwebsoft.shop.param.DealerWithdrawParam;
|
||||
@@ -10,12 +16,15 @@ 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 com.gxwebsoft.shop.service.UserBalanceLogService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -30,6 +39,10 @@ import java.util.List;
|
||||
public class DealerWithdrawController extends BaseController {
|
||||
@Resource
|
||||
private DealerWithdrawService dealerWithdrawService;
|
||||
@Resource
|
||||
private UserBalanceLogService userBalanceLogService;
|
||||
@Resource
|
||||
private DealerCapitalService dealerCapitalService;
|
||||
|
||||
@ApiOperation("分页查询分销商提现明细表")
|
||||
@GetMapping("/page")
|
||||
@@ -42,6 +55,7 @@ public class DealerWithdrawController extends BaseController {
|
||||
@GetMapping()
|
||||
public ApiResult<List<DealerWithdraw>> list(DealerWithdrawParam param) {
|
||||
// 使用关联查询
|
||||
param.setUserId(getLoginUserId());
|
||||
return success(dealerWithdrawService.listRel(param));
|
||||
}
|
||||
|
||||
@@ -55,13 +69,38 @@ public class DealerWithdrawController extends BaseController {
|
||||
|
||||
@ApiOperation("添加分销商提现明细表")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody DealerWithdraw dealerWithdraw) {
|
||||
public ApiResult<?> save(@RequestBody DealerWithdraw dealerWithdraw, HttpServletRequest request) {
|
||||
// 记录当前登录用户id
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
dealerWithdraw.setUserId(loginUser.getUserId());
|
||||
dealerWithdraw.setUserId(loginUser.getUserId());
|
||||
if (loginUser.getBalance().compareTo(dealerWithdraw.getMoney()) < 0) return fail("余额不足");
|
||||
} else {
|
||||
return fail("请先登录");
|
||||
}
|
||||
if (dealerWithdrawService.save(dealerWithdraw)) {
|
||||
final RequestUtil requestUtil = new RequestUtil();
|
||||
String access_token = JwtUtil.getAccessToken(request);
|
||||
requestUtil.setAccessToken(access_token);
|
||||
requestUtil.setTenantId(getTenantId().toString());
|
||||
loginUser.setBalance(loginUser.getBalance().subtract(dealerWithdraw.getMoney()));
|
||||
requestUtil.updateUserBalance("/system/user/updateUserBalance", loginUser);
|
||||
|
||||
userBalanceLogService.save(new UserBalanceLog() {{
|
||||
setUserId(loginUser.getUserId());
|
||||
setScene(BalanceScene.BALANCE_SCENE_DIFF);
|
||||
setMoney(dealerWithdraw.getMoney());
|
||||
setBalance(loginUser.getBalance().subtract(dealerWithdraw.getMoney()));
|
||||
setMerchantId(loginUser.getMerchantId());
|
||||
setTenantId(getTenantId());
|
||||
}});
|
||||
dealerCapitalService.save(new DealerCapital() {{
|
||||
setUserId(loginUser.getUserId());
|
||||
setFlowType(20);
|
||||
setMoney(dealerWithdraw.getMoney());
|
||||
setDescribe("提现");
|
||||
setTenantId(getTenantId());
|
||||
}});
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
@@ -69,8 +108,18 @@ public class DealerWithdrawController extends BaseController {
|
||||
|
||||
@ApiOperation("修改分销商提现明细表")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody DealerWithdraw dealerWithdraw) {
|
||||
public ApiResult<?> update(@RequestBody DealerWithdraw dealerWithdraw, HttpServletRequest request) {
|
||||
if (dealerWithdrawService.updateById(dealerWithdraw)) {
|
||||
if (dealerWithdraw.getApplyStatus().equals(30)) {
|
||||
final RequestUtil requestUtil = new RequestUtil();
|
||||
String access_token = JwtUtil.getAccessToken(request);
|
||||
requestUtil.setAccessToken(access_token);
|
||||
requestUtil.setTenantId(getTenantId().toString());
|
||||
User user = requestUtil.getByUserId(dealerWithdraw.getUserId());
|
||||
user.setBalance(user.getBalance().subtract(dealerWithdraw.getMoney()));
|
||||
user.setCashedMoney(user.getCashedMoney().add(dealerWithdraw.getMoney()));
|
||||
requestUtil.updateUserBalance("/system/user/updateUserBalance", user);
|
||||
}
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
package com.gxwebsoft.shop.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.shop.entity.ExpressTemplateDetail;
|
||||
import com.gxwebsoft.shop.service.ExpressTemplateDetailService;
|
||||
import com.gxwebsoft.shop.service.ExpressTemplateService;
|
||||
import com.gxwebsoft.shop.entity.ExpressTemplate;
|
||||
import com.gxwebsoft.shop.param.ExpressTemplateParam;
|
||||
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.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 运费模板控制器
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-11-05 18:03:28
|
||||
*/
|
||||
@Api(tags = "运费模板管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/shop/express-template")
|
||||
public class ExpressTemplateController extends BaseController {
|
||||
@Resource
|
||||
private ExpressTemplateService expressTemplateService;
|
||||
@Resource
|
||||
private ExpressTemplateDetailService expressTemplateDetailService;
|
||||
|
||||
@ApiOperation("分页查询运费模板")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<ExpressTemplate>> page(ExpressTemplateParam param) {
|
||||
// 使用关联查询
|
||||
return success(expressTemplateService.pageRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("查询全部运费模板")
|
||||
@GetMapping()
|
||||
public ApiResult<List<ExpressTemplate>> list(ExpressTemplateParam param) {
|
||||
// 使用关联查询
|
||||
return success(expressTemplateService.listRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('shop:expressTemplate:list')")
|
||||
@ApiOperation("根据id查询运费模板")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<ExpressTemplate> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(expressTemplateService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@ApiOperation("添加运费模板")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody ExpressTemplate expressTemplate) {
|
||||
if (expressTemplateService.save(expressTemplate)) {
|
||||
for (ExpressTemplateDetail detail : expressTemplate.getDetailList()) {
|
||||
detail.setTemplateId(expressTemplate.getId());
|
||||
}
|
||||
expressTemplateDetailService.saveBatch(expressTemplate.getDetailList());
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("修改运费模板")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody ExpressTemplate expressTemplate) {
|
||||
if (expressTemplateService.updateById(expressTemplate)) {
|
||||
expressTemplateDetailService.removeByMap(new HashMap<>() {{
|
||||
put("template_id", expressTemplate.getId());
|
||||
}});
|
||||
for (ExpressTemplateDetail detail : expressTemplate.getDetailList()) {
|
||||
detail.setTemplateId(expressTemplate.getId());
|
||||
}
|
||||
expressTemplateDetailService.saveBatch(expressTemplate.getDetailList());
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("删除运费模板")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (expressTemplateService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量添加运费模板")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<ExpressTemplate> list) {
|
||||
if (expressTemplateService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量修改运费模板")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<ExpressTemplate> batchParam) {
|
||||
if (batchParam.update(expressTemplateService, "id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量删除运费模板")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (expressTemplateService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package com.gxwebsoft.shop.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.shop.service.ExpressTemplateDetailService;
|
||||
import com.gxwebsoft.shop.entity.ExpressTemplateDetail;
|
||||
import com.gxwebsoft.shop.param.ExpressTemplateDetailParam;
|
||||
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-11-05 18:03:28
|
||||
*/
|
||||
@Api(tags = "运费模板管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/shop/express-template-detail")
|
||||
public class ExpressTemplateDetailController extends BaseController {
|
||||
@Resource
|
||||
private ExpressTemplateDetailService expressTemplateDetailService;
|
||||
|
||||
@ApiOperation("分页查询运费模板")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<ExpressTemplateDetail>> page(ExpressTemplateDetailParam param) {
|
||||
// 使用关联查询
|
||||
return success(expressTemplateDetailService.pageRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("查询全部运费模板")
|
||||
@GetMapping()
|
||||
public ApiResult<List<ExpressTemplateDetail>> list(ExpressTemplateDetailParam param) {
|
||||
// 使用关联查询
|
||||
return success(expressTemplateDetailService.listRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('shop:expressTemplateDetail:list')")
|
||||
@ApiOperation("根据id查询运费模板")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<ExpressTemplateDetail> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(expressTemplateDetailService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@ApiOperation("添加运费模板")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody ExpressTemplateDetail expressTemplateDetail) {
|
||||
if (expressTemplateDetailService.save(expressTemplateDetail)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("修改运费模板")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody ExpressTemplateDetail expressTemplateDetail) {
|
||||
if (expressTemplateDetailService.updateById(expressTemplateDetail)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("删除运费模板")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (expressTemplateDetailService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量添加运费模板")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<ExpressTemplateDetail> list) {
|
||||
if (expressTemplateDetailService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量修改运费模板")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<ExpressTemplateDetail> batchParam) {
|
||||
if (batchParam.update(expressTemplateDetailService, "id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量删除运费模板")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (expressTemplateDetailService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.gxwebsoft.cms.entity.Navigation;
|
||||
import com.gxwebsoft.common.core.utils.JSONUtil;
|
||||
import com.gxwebsoft.common.core.utils.RequestUtil;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
@@ -15,13 +16,11 @@ import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.shop.entity.*;
|
||||
import com.gxwebsoft.shop.param.GoodsCategoryParam;
|
||||
import com.gxwebsoft.shop.param.GoodsSpecParam;
|
||||
import com.gxwebsoft.shop.service.CartService;
|
||||
import com.gxwebsoft.shop.service.GoodsCategoryService;
|
||||
import com.gxwebsoft.shop.service.GoodsService;
|
||||
import com.gxwebsoft.shop.service.GoodsSpecService;
|
||||
import com.gxwebsoft.shop.service.*;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -50,6 +49,11 @@ public class GoodsCategoryController extends BaseController {
|
||||
private GoodsService goodsService;
|
||||
@Resource
|
||||
private CartService cartService;
|
||||
@Resource
|
||||
private GoodsSkuService goodsSkuService;
|
||||
|
||||
@Autowired
|
||||
private RequestUtil requestUtil;
|
||||
|
||||
@ApiOperation("查询商城菜单分类级商品数据(不联动)")
|
||||
@GetMapping("/listCategoryTree")
|
||||
@@ -75,105 +79,9 @@ public class GoodsCategoryController extends BaseController {
|
||||
final Map<Integer, List<Goods>> collectGoods = goods.stream().collect(Collectors.groupingBy(Goods::getCategoryId));
|
||||
|
||||
final Set<Integer> goodsIds = goods.stream().map(Goods::getGoodsId).collect(Collectors.toSet());
|
||||
|
||||
final List<GoodsSpec> specs = goodsSpecService.list(new LambdaQueryWrapper<GoodsSpec>().in(GoodsSpec::getGoodsId, goodsIds));
|
||||
|
||||
final Map<Integer, List<GoodsSpec>> collectGoodsSpec = specs.stream().collect(Collectors.groupingBy(GoodsSpec::getGoodsId));
|
||||
|
||||
list.forEach(d -> {
|
||||
d.setName(d.getTitle());
|
||||
final List<Goods> goodsList = collectGoods.get(d.getCategoryId());
|
||||
if (!CollectionUtils.isEmpty(goodsList)) {
|
||||
goodsList.forEach(v -> {
|
||||
final List<GoodsSpec> goodsSpecs = collectGoodsSpec.get(v.getGoodsId());
|
||||
if (!CollectionUtils.isEmpty(goodsSpecs)) {
|
||||
final GoodsSpec spec = goodsSpecs.get(0);
|
||||
v.setSpecValue(spec.getSpecValue());
|
||||
v.setGoodsSpecValue(JSONUtil.parseObject(spec.getSpecValue(), Object.class));
|
||||
}
|
||||
});
|
||||
d.setGoods(collectGoods.get(d.getCategoryId()));
|
||||
}
|
||||
});
|
||||
return success(list);
|
||||
}
|
||||
|
||||
@ApiOperation("查询商城菜单分类级商品数据(不联动)")
|
||||
@GetMapping("/listCategoryParentIdTree/{parentId}")
|
||||
public ApiResult<List<GoodsCategory>> listCategoryParentIdTree(@PathVariable("parentId") Integer parentId) {
|
||||
// 查询非店铺分类
|
||||
final List<GoodsCategory> list = goodsCategoryService.list(new LambdaQueryWrapper<GoodsCategory>()
|
||||
.eq(GoodsCategory::getParentId, parentId)
|
||||
.eq(GoodsCategory::getType, 0)
|
||||
.eq(GoodsCategory::getMerchantId, 0));
|
||||
|
||||
final Set<Integer> categoryIds = list.stream().map(GoodsCategory::getCategoryId).collect(Collectors.toSet());
|
||||
final List<Goods> goods = goodsService.list(new LambdaQueryWrapper<Goods>().in(Goods::getCategoryId, categoryIds));
|
||||
final Map<Integer, List<Goods>> collect = goods.stream().collect(Collectors.groupingBy(Goods::getCategoryId));
|
||||
|
||||
final Map<Integer, List<Goods>> collectGoods = goods.stream().collect(Collectors.groupingBy(Goods::getCategoryId));
|
||||
|
||||
final Set<Integer> goodsIds = goods.stream().map(Goods::getGoodsId).collect(Collectors.toSet());
|
||||
|
||||
final List<GoodsSpec> specs = goodsSpecService.list(new LambdaQueryWrapper<GoodsSpec>().in(GoodsSpec::getGoodsId, goodsIds));
|
||||
|
||||
final Map<Integer, List<GoodsSpec>> collectGoodsSpec = specs.stream().collect(Collectors.groupingBy(GoodsSpec::getGoodsId));
|
||||
|
||||
LambdaQueryWrapper<Cart> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.in(Cart::getGoodsId, goodsIds).eq(Cart::getSelected, 1);
|
||||
if (ObjectUtil.isNotEmpty(getLoginUser())) {
|
||||
wrapper.eq(Cart::getUserId, getLoginUser().getUserId());
|
||||
}
|
||||
final List<Cart> carts = cartService.list();
|
||||
final Map<Integer, List<Cart>> collectCart = carts.stream().collect(Collectors.groupingBy(Cart::getGoodsId));
|
||||
|
||||
list.forEach(d -> {
|
||||
d.setName(d.getTitle());
|
||||
final List<Goods> goodsList = collectGoods.get(d.getCategoryId());
|
||||
if (!CollectionUtils.isEmpty(goodsList)) {
|
||||
goodsList.forEach(v -> {
|
||||
final List<GoodsSpec> goodsSpecs = collectGoodsSpec.get(v.getGoodsId());
|
||||
if (!CollectionUtils.isEmpty(goodsSpecs)) {
|
||||
final GoodsSpec spec = goodsSpecs.get(0);
|
||||
v.setSpecValue(spec.getSpecValue());
|
||||
v.setGoodsSpecValue(JSONUtil.parseObject(spec.getSpecValue(), Object.class));
|
||||
}
|
||||
final List<Cart> carts1 = collectCart.get(v.getGoodsId());
|
||||
|
||||
if (ArrayUtil.isNotEmpty(carts1)) {
|
||||
final Cart cart = carts1.get(0);
|
||||
|
||||
if (getLoginUser() != null && cart.getUserId().equals(getLoginUserId())) {
|
||||
v.setTotalNums(cart.getCartNum());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
d.setGoods(goodsList);
|
||||
}
|
||||
});
|
||||
return success("请求成功", list);
|
||||
}
|
||||
|
||||
@ApiOperation("查询门店菜单分类及菜品数据(联动)")
|
||||
@GetMapping("/listShopCategoryTree")
|
||||
public ApiResult<List<GoodsCategory>> listShopCategoryTree(GoodsCategoryParam param) {
|
||||
final List<GoodsCategory> list = goodsCategoryService.listRel(param);
|
||||
final Set<Integer> categoryIds = list.stream().map(GoodsCategory::getCategoryId).collect(Collectors.toSet());
|
||||
if (categoryIds.isEmpty()) {
|
||||
return success(list);
|
||||
}
|
||||
|
||||
final List<Goods> goods = goodsService.list(new LambdaQueryWrapper<Goods>().in(Goods::getCategoryId, categoryIds).eq(Goods::getIsShow, 1).eq(Goods::getDeleted, 0));
|
||||
final Map<Integer, List<Goods>> collectGoods = goods.stream().collect(Collectors.groupingBy(Goods::getCategoryId));
|
||||
|
||||
final Set<Integer> goodsIds = goods.stream().map(Goods::getGoodsId).collect(Collectors.toSet());
|
||||
|
||||
List<GoodsSpec> specs = new ArrayList<>();
|
||||
Map<Integer, List<GoodsSpec>> collectGoodsSpec;
|
||||
if (!goodsIds.isEmpty()) {
|
||||
specs = goodsSpecService.list(new LambdaQueryWrapper<GoodsSpec>().in(GoodsSpec::getGoodsId, goodsIds));
|
||||
final List<GoodsSpec> specs = goodsSpecService.list(new LambdaQueryWrapper<GoodsSpec>().in(GoodsSpec::getGoodsId, goodsIds));
|
||||
collectGoodsSpec = specs.stream().collect(Collectors.groupingBy(GoodsSpec::getGoodsId));
|
||||
} else {
|
||||
collectGoodsSpec = null;
|
||||
@@ -192,16 +100,136 @@ public class GoodsCategoryController extends BaseController {
|
||||
v.setGoodsSpecValue(JSONUtil.parseObject(spec.getSpecValue(), Object.class));
|
||||
}
|
||||
}
|
||||
});
|
||||
d.setGoods(collectGoods.get(d.getCategoryId()));
|
||||
}
|
||||
});
|
||||
return success(list);
|
||||
}
|
||||
|
||||
@ApiOperation("查询商城菜单分类级商品数据(不联动)")
|
||||
@GetMapping("/listCategoryParentIdTree/{parentId}")
|
||||
public ApiResult<List<GoodsCategory>> listCategoryParentIdTree(@PathVariable("parentId") Integer parentId) {
|
||||
// 查询非店铺分类
|
||||
final List<GoodsCategory> list = goodsCategoryService.list(new LambdaQueryWrapper<GoodsCategory>()
|
||||
.eq(GoodsCategory::getParentId, parentId)
|
||||
.eq(GoodsCategory::getType, 0)
|
||||
.eq(GoodsCategory::getStatus, 0)
|
||||
.eq(GoodsCategory::getMerchantId, 0));
|
||||
|
||||
final Set<Integer> categoryIds = list.stream().map(GoodsCategory::getCategoryId).collect(Collectors.toSet());
|
||||
LambdaQueryWrapper<Cart> wrapper = new LambdaQueryWrapper<>();
|
||||
if (!categoryIds.isEmpty()) {
|
||||
final List<Goods> goods = goodsService.list(
|
||||
new LambdaQueryWrapper<Goods>().in(Goods::getCategoryId, categoryIds)
|
||||
.eq(Goods::getIsShow, 1)
|
||||
.eq(Goods::getStatus, 0)
|
||||
);
|
||||
final Map<Integer, List<Goods>> collect = goods.stream().collect(Collectors.groupingBy(Goods::getCategoryId));
|
||||
|
||||
final Map<Integer, List<Goods>> collectGoods = goods.stream().collect(Collectors.groupingBy(Goods::getCategoryId));
|
||||
|
||||
Set<Integer> goodsIds = goods.stream().map(Goods::getGoodsId).collect(Collectors.toSet());
|
||||
|
||||
if (!goodsIds.isEmpty()) {
|
||||
final List<GoodsSpec> specs = goodsSpecService.list(new LambdaQueryWrapper<GoodsSpec>().in(GoodsSpec::getGoodsId, goodsIds));
|
||||
|
||||
final Map<Integer, List<GoodsSpec>> collectGoodsSpec = specs.stream().collect(Collectors.groupingBy(GoodsSpec::getGoodsId));
|
||||
wrapper.in(Cart::getGoodsId, goodsIds).eq(Cart::getSelected, 1);
|
||||
if (ObjectUtil.isNotEmpty(getLoginUser())) {
|
||||
wrapper.eq(Cart::getUserId, getLoginUser().getUserId());
|
||||
}
|
||||
final List<Cart> carts = cartService.list();
|
||||
final Map<Integer, List<Cart>> collectCart = carts.stream().collect(Collectors.groupingBy(Cart::getGoodsId));
|
||||
|
||||
list.forEach(d -> {
|
||||
d.setName(d.getTitle());
|
||||
final List<Goods> goodsList = collectGoods.get(d.getCategoryId());
|
||||
if (!CollectionUtils.isEmpty(goodsList)) {
|
||||
goodsList.forEach(v -> {
|
||||
final List<GoodsSpec> goodsSpecs = collectGoodsSpec.get(v.getGoodsId());
|
||||
if (!CollectionUtils.isEmpty(goodsSpecs)) {
|
||||
final GoodsSpec spec = goodsSpecs.get(0);
|
||||
v.setSpecValue(spec.getSpecValue());
|
||||
v.setGoodsSpecValue(JSONUtil.parseObject(spec.getSpecValue(), Object.class));
|
||||
}
|
||||
final List<Cart> carts1 = collectCart.get(v.getGoodsId());
|
||||
|
||||
if (ArrayUtil.isNotEmpty(carts1)) {
|
||||
final Cart cart = carts1.get(0);
|
||||
|
||||
if (getLoginUser() != null && cart.getUserId().equals(getLoginUserId())) {
|
||||
v.setTotalNums(cart.getCartNum());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
d.setGoods(goodsList);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return success("请求成功", list);
|
||||
}
|
||||
|
||||
@ApiOperation("查询门店菜单分类及菜品数据(联动)")
|
||||
@GetMapping("/listShopCategoryTree")
|
||||
public ApiResult<List<GoodsCategory>> listShopCategoryTree(GoodsCategoryParam param) {
|
||||
final List<GoodsCategory> list = goodsCategoryService.listRel(param);
|
||||
final Set<Integer> categoryIds = list.stream().map(GoodsCategory::getCategoryId).collect(Collectors.toSet());
|
||||
if (categoryIds.isEmpty()) {
|
||||
return success(list);
|
||||
}
|
||||
|
||||
final List<Goods> goods = goodsService.list(new LambdaQueryWrapper<Goods>()
|
||||
.in(Goods::getCategoryId, categoryIds)
|
||||
.eq(Goods::getIsShow, 1).eq(Goods::getDeleted, 0));
|
||||
final Map<Integer, List<Goods>> collectGoods = goods.stream().collect(Collectors.groupingBy(Goods::getCategoryId));
|
||||
|
||||
final Set<Integer> goodsIds = goods.stream().map(Goods::getGoodsId).collect(Collectors.toSet());
|
||||
|
||||
List<GoodsSpec> specs = new ArrayList<>();
|
||||
Map<Integer, List<GoodsSpec>> collectGoodsSpec;
|
||||
if (!goodsIds.isEmpty()) {
|
||||
specs = goodsSpecService.list(new LambdaQueryWrapper<GoodsSpec>().in(GoodsSpec::getGoodsId, goodsIds));
|
||||
collectGoodsSpec = specs.stream().collect(Collectors.groupingBy(GoodsSpec::getGoodsId));
|
||||
} else {
|
||||
collectGoodsSpec = null;
|
||||
}
|
||||
User parentUser;
|
||||
if (getLoginUser() != null) {
|
||||
parentUser = requestUtil.getParent(getLoginUserId());
|
||||
} else {
|
||||
parentUser = null;
|
||||
}
|
||||
User loginUser = getLoginUser();
|
||||
list.forEach(d -> {
|
||||
d.setName(d.getTitle());
|
||||
final List<Goods> goodsList = collectGoods.get(d.getCategoryId());
|
||||
if (!CollectionUtils.isEmpty(goodsList)) {
|
||||
|
||||
goodsList.forEach(v -> {
|
||||
if (collectGoodsSpec != null) {
|
||||
final List<GoodsSpec> goodsSpecs = collectGoodsSpec.get(v.getGoodsId());
|
||||
if (!CollectionUtils.isEmpty(goodsSpecs)) {
|
||||
final GoodsSpec spec = goodsSpecs.get(0);
|
||||
v.setSpecValue(spec.getSpecValue());
|
||||
v.setGoodsSpecValue(JSONUtil.parseObject(spec.getSpecValue(), Object.class));
|
||||
}
|
||||
}
|
||||
v.setGoodsSkus(goodsSkuService.listByGoods(v.getGoodsId()));
|
||||
BigDecimal originPrice = v.getPrice();
|
||||
v.setPrice(v.getSalePrice());
|
||||
if (getLoginUser().getGradeId().equals(33)) {
|
||||
if (v.getDealerGift()) v.setShowGift(true);
|
||||
v.setPrice(v.getDealerPrice());
|
||||
// 会员
|
||||
if (parentUser != null) {
|
||||
if (v.getPriceGift()) v.setShowGift(true);
|
||||
// v.setPrice(originPrice);
|
||||
}
|
||||
// 会员店
|
||||
if (getLoginUser().getGradeId().equals(31)) {
|
||||
v.setPrice(originPrice);
|
||||
if (v.getPriceGift()) v.setShowGift(true);
|
||||
if (getLoginUser() != null && getLoginUser().getGradeId() > 30 && v.getBuyingPriceOpen().equals(1)) {
|
||||
v.setPrice(v.getBuyingPrice());
|
||||
// if (v.getPriceGift()) v.setShowGift(true);
|
||||
}
|
||||
});
|
||||
d.setGoods(collectGoods.get(d.getCategoryId()));
|
||||
|
||||
@@ -3,9 +3,10 @@ package com.gxwebsoft.shop.controller;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.gxwebsoft.common.core.utils.JSONUtil;
|
||||
import com.gxwebsoft.common.core.utils.RequestUtil;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.shop.entity.*;
|
||||
import com.gxwebsoft.shop.service.GoodsService;
|
||||
import com.gxwebsoft.shop.service.*;
|
||||
import com.gxwebsoft.shop.param.GoodsParam;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
@@ -13,11 +14,9 @@ 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 com.gxwebsoft.shop.service.GoodsSkuService;
|
||||
import com.gxwebsoft.shop.service.GoodsSpecService;
|
||||
import com.gxwebsoft.shop.service.MerchantService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -45,6 +44,11 @@ public class GoodsController extends BaseController {
|
||||
private GoodsSkuService goodsSkuService;
|
||||
@Resource
|
||||
private MerchantService merchantService;
|
||||
@Resource
|
||||
private GoodsRoleCommissionService goodsRoleCommissionService;
|
||||
|
||||
@Autowired
|
||||
private RequestUtil requestUtil;
|
||||
|
||||
@ApiOperation("分页查询商品记录表")
|
||||
@GetMapping("/page")
|
||||
@@ -67,14 +71,20 @@ public class GoodsController extends BaseController {
|
||||
// 使用关联查询
|
||||
final Goods goods = goodsService.getByIdRel(id);
|
||||
if (getLoginUser() != null) {
|
||||
// 经销商
|
||||
if (getLoginUser().getGradeId().equals(33)) {
|
||||
if (goods.getDealerGift()) goods.setShowGift(true);
|
||||
User parentUser = requestUtil.getParent(getLoginUserId());
|
||||
BigDecimal originPrice = goods.getPrice();
|
||||
goods.setPrice(goods.getSalePrice());
|
||||
// 会员
|
||||
if (parentUser != null) {
|
||||
if (goods.getPriceGift()) goods.setShowGift(true);
|
||||
// goods.setPrice(originPrice);
|
||||
}
|
||||
// 会员店
|
||||
if (getLoginUser().getGradeId().equals(31)) {
|
||||
if (goods.getPriceGift()) goods.setShowGift(true);
|
||||
if (getLoginUser().getGradeId() > 30 && goods.getBuyingPriceOpen().equals(1)) {
|
||||
goods.setPrice(goods.getBuyingPrice());
|
||||
// if (goods.getPriceGift()) goods.setShowGift(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 提取specValue
|
||||
@@ -84,17 +94,29 @@ public class GoodsController extends BaseController {
|
||||
final Object object = JSONUtil.parseObject(specValue, Object.class);
|
||||
goods.setGoodsSpecValue(object);
|
||||
}
|
||||
goods.setGoodsSkus(goodsSkuService.listByGoods(id));
|
||||
// 整理商品价格
|
||||
final User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
User parentUser = requestUtil.getParent(getLoginUserId());
|
||||
BigDecimal originPrice = goods.getPrice();
|
||||
goods.setPrice(goods.getSalePrice());
|
||||
if (loginUser.getGradeId().equals(33)) {
|
||||
goods.setPrice(goods.getDealerPrice());
|
||||
// if (loginUser.getGradeId().equals(33)) {
|
||||
// goods.setPrice(goods.getDealerPrice());
|
||||
// }
|
||||
// if (loginUser.getGradeId().equals(0)) {
|
||||
// goods.setPrice(originPrice);
|
||||
// goods.setPrice(goods.getSalePrice());
|
||||
// }
|
||||
// 会员
|
||||
if (parentUser != null) {
|
||||
if (goods.getPriceGift()) goods.setShowGift(true);
|
||||
// goods.setPrice(originPrice);
|
||||
}
|
||||
if (loginUser.getGradeId().equals(0)) {
|
||||
goods.setPrice(originPrice);
|
||||
goods.setPrice(goods.getSalePrice());
|
||||
// 会员店
|
||||
if (getLoginUser().getGradeId() > 30 && goods.getBuyingPriceOpen().equals(1)) {
|
||||
goods.setPrice(goods.getBuyingPrice());
|
||||
// if (goods.getPriceGift()) goods.setShowGift(true);
|
||||
}
|
||||
} else {
|
||||
goods.setPrice(goods.getSalePrice());
|
||||
@@ -119,8 +141,18 @@ public class GoodsController extends BaseController {
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
goods.setUserId(loginUser.getUserId());
|
||||
goods.setMerchantId(loginUser.getMerchantId());
|
||||
}
|
||||
if (goodsService.save(goods)) {
|
||||
goodsRoleCommissionService.removeByMap(new HashMap<>() {{
|
||||
put("goods_id", goods.getGoodsId());
|
||||
}});
|
||||
if (goods.getGoodsRoleCommission() != null && !goods.getGoodsRoleCommission().isEmpty()) {
|
||||
for (GoodsRoleCommission goodsRoleCommission : goods.getGoodsRoleCommission()) {
|
||||
goodsRoleCommission.setGoodsId(goods.getGoodsId());
|
||||
}
|
||||
goodsRoleCommissionService.saveBatch(goods.getGoodsRoleCommission());
|
||||
}
|
||||
// 保存商品规格及sku信息
|
||||
goodsService.saveBatchByAsync(goods);
|
||||
return success("添加成功");
|
||||
@@ -133,6 +165,15 @@ public class GoodsController extends BaseController {
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody Goods goods) {
|
||||
if (goodsService.updateById(goods)) {
|
||||
goodsRoleCommissionService.removeByMap(new HashMap<>() {{
|
||||
put("goods_id", goods.getGoodsId());
|
||||
}});
|
||||
if (goods.getGoodsRoleCommission() != null && !goods.getGoodsRoleCommission().isEmpty()) {
|
||||
for (GoodsRoleCommission goodsRoleCommission : goods.getGoodsRoleCommission()) {
|
||||
goodsRoleCommission.setGoodsId(goods.getGoodsId());
|
||||
}
|
||||
goodsRoleCommissionService.saveBatch(goods.getGoodsRoleCommission());
|
||||
}
|
||||
// 删除旧信息
|
||||
goodsSpecService.remove(new LambdaQueryWrapper<GoodsSpec>().eq(GoodsSpec::getGoodsId, goods.getGoodsId()));
|
||||
goodsSkuService.remove(new LambdaQueryWrapper<GoodsSku>().eq(GoodsSku::getGoodsId, goods.getGoodsId()));
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
package com.gxwebsoft.shop.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.shop.service.GoodsRoleCommissionService;
|
||||
import com.gxwebsoft.shop.entity.GoodsRoleCommission;
|
||||
import com.gxwebsoft.shop.param.GoodsRoleCommissionParam;
|
||||
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-12-02 12:43:40
|
||||
*/
|
||||
@Api(tags = "商品绑定角色的分润金额管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/shop/goods-role-commission")
|
||||
public class GoodsRoleCommissionController extends BaseController {
|
||||
@Resource
|
||||
private GoodsRoleCommissionService goodsRoleCommissionService;
|
||||
|
||||
@ApiOperation("分页查询商品绑定角色的分润金额")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<GoodsRoleCommission>> page(GoodsRoleCommissionParam param) {
|
||||
// 使用关联查询
|
||||
return success(goodsRoleCommissionService.pageRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("查询全部商品绑定角色的分润金额")
|
||||
@GetMapping()
|
||||
public ApiResult<List<GoodsRoleCommission>> list(GoodsRoleCommissionParam param) {
|
||||
// 使用关联查询
|
||||
return success(goodsRoleCommissionService.listRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('shop:goodsRoleCommission:list')")
|
||||
@ApiOperation("根据id查询商品绑定角色的分润金额")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<GoodsRoleCommission> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(goodsRoleCommissionService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@ApiOperation("添加商品绑定角色的分润金额")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody GoodsRoleCommission goodsRoleCommission) {
|
||||
|
||||
if (goodsRoleCommissionService.save(goodsRoleCommission)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("修改商品绑定角色的分润金额")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody GoodsRoleCommission goodsRoleCommission) {
|
||||
if (goodsRoleCommissionService.updateById(goodsRoleCommission)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("删除商品绑定角色的分润金额")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (goodsRoleCommissionService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量添加商品绑定角色的分润金额")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<GoodsRoleCommission> list) {
|
||||
if (goodsRoleCommissionService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量修改商品绑定角色的分润金额")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<GoodsRoleCommission> batchParam) {
|
||||
if (batchParam.update(goodsRoleCommissionService, "id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量删除商品绑定角色的分润金额")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (goodsRoleCommissionService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.gxwebsoft.shop.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.shop.service.GoodsService;
|
||||
import com.gxwebsoft.shop.service.GoodsStockInMerchantService;
|
||||
import com.gxwebsoft.shop.entity.GoodsStockInMerchant;
|
||||
import com.gxwebsoft.shop.param.GoodsStockInMerchantParam;
|
||||
@@ -30,6 +31,8 @@ import java.util.List;
|
||||
public class GoodsStockInMerchantController extends BaseController {
|
||||
@Resource
|
||||
private GoodsStockInMerchantService goodsStockInMerchantService;
|
||||
@Resource
|
||||
private GoodsService goodsService;
|
||||
|
||||
@ApiOperation("分页查询商户商品库存")
|
||||
@GetMapping("/page")
|
||||
@@ -41,8 +44,13 @@ public class GoodsStockInMerchantController extends BaseController {
|
||||
@ApiOperation("查询全部商户商品库存")
|
||||
@GetMapping()
|
||||
public ApiResult<List<GoodsStockInMerchant>> list(GoodsStockInMerchantParam param) {
|
||||
param.setUserId(getLoginUserId());
|
||||
List<GoodsStockInMerchant> list = goodsStockInMerchantService.listRel(param);
|
||||
for (GoodsStockInMerchant goodsStockInMerchant : list) {
|
||||
goodsStockInMerchant.setGoods(goodsService.getByIdRel(goodsStockInMerchant.getGoodsId()));
|
||||
}
|
||||
// 使用关联查询
|
||||
return success(goodsStockInMerchantService.listRel(param));
|
||||
return success(list);
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('shop:goodsStockInMerchant:list')")
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
package com.gxwebsoft.shop.controller;
|
||||
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaSubscribeMessage;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.gxwebsoft.cms.entity.ArticleCheck;
|
||||
import com.gxwebsoft.common.core.security.JwtUtil;
|
||||
import com.gxwebsoft.common.core.utils.RequestUtil;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.system.entity.UserRole;
|
||||
import com.gxwebsoft.open.service.OfficeMpServiceImpl;
|
||||
import com.gxwebsoft.shop.entity.DealerUser;
|
||||
import com.gxwebsoft.shop.entity.Merchant;
|
||||
import com.gxwebsoft.shop.entity.MerchantAccount;
|
||||
@@ -20,7 +25,9 @@ import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.shop.service.MerchantService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
@@ -32,6 +39,7 @@ import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -52,6 +60,17 @@ public class MerchantApplyController extends BaseController {
|
||||
private RequestUtil requestUtil;
|
||||
@Resource
|
||||
private DealerUserService dealerUserService;
|
||||
@Autowired
|
||||
private WeChatController weChatController;
|
||||
@Resource
|
||||
private OfficeMpServiceImpl officeMpService;
|
||||
|
||||
@ApiOperation("未审核数量")
|
||||
@GetMapping("/uncheck-num")
|
||||
public ApiResult<Integer> uncheckNum() {
|
||||
// 使用关联查询
|
||||
return success(merchantApplyService.uncheckNum());
|
||||
}
|
||||
|
||||
@ApiOperation("分页查询商户入驻申请")
|
||||
@GetMapping("/page")
|
||||
@@ -76,7 +95,7 @@ public class MerchantApplyController extends BaseController {
|
||||
|
||||
@ApiOperation("添加商户入驻申请")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody MerchantApply merchantApply) {
|
||||
public ApiResult<?> save(@RequestBody MerchantApply merchantApply, HttpServletRequest request) throws WxErrorException {
|
||||
// 记录当前登录用户id
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
@@ -89,6 +108,18 @@ public class MerchantApplyController extends BaseController {
|
||||
return fail("该手机号码已存在");
|
||||
}
|
||||
if (merchantApplyService.save(merchantApply)) {
|
||||
requestUtil.setTenantId(getTenantId().toString());
|
||||
requestUtil.setAccessToken(JwtUtil.getAccessToken(request));
|
||||
List<UserRole> userRoleList = requestUtil.getUserListByRole(1114);
|
||||
if (userRoleList != null && !userRoleList.isEmpty()) {
|
||||
for (UserRole userRole : userRoleList) {
|
||||
User user = requestUtil.getByUserId(userRole.getUserId());
|
||||
if (user != null && user.getOfficeOpenid() != null && !user.getOfficeOpenid().isEmpty()) {
|
||||
officeMpService.sendShopCheckMessage(user.getOfficeOpenid(), merchantApply.getShopType() + "入驻申请",
|
||||
loginUser.getNickname());
|
||||
}
|
||||
}
|
||||
}
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
@@ -96,9 +127,11 @@ public class MerchantApplyController extends BaseController {
|
||||
|
||||
@ApiOperation("修改商户入驻申请")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody MerchantApply merchantApply, HttpServletRequest request) {
|
||||
public ApiResult<?> update(@RequestBody MerchantApply merchantApply, HttpServletRequest request) throws WxErrorException {
|
||||
MerchantApply merchantApply1 = merchantApplyService.getByIdRel(merchantApply.getApplyId());
|
||||
String result = "驳回";
|
||||
if (merchantApply.getStatus().equals(1)) {
|
||||
result = "通过";
|
||||
// TODO 审核通过则创建商户
|
||||
final Merchant one = merchantService.getOne(new LambdaQueryWrapper<Merchant>().eq(Merchant::getPhone, merchantApply1.getPhone()).last("limit 1"));
|
||||
final MerchantAccount merchantAccount = new MerchantAccount();
|
||||
@@ -106,6 +139,7 @@ public class MerchantApplyController extends BaseController {
|
||||
final User user = new User();
|
||||
final User loingUser = new User();
|
||||
loingUser.setUserId(merchantAccount.getUserId());
|
||||
user.setUserId(merchantApply1.getUserId());
|
||||
|
||||
Integer gradeId = 30;
|
||||
if (ObjectUtil.isNotEmpty(one)) {
|
||||
@@ -118,7 +152,8 @@ public class MerchantApplyController extends BaseController {
|
||||
case "会员店" -> 31;
|
||||
case "实体连锁店" -> 32;
|
||||
case "经销商" -> 33;
|
||||
case "供应商" -> 34;
|
||||
case "产品供应商" -> 34;
|
||||
case "合作伙伴" -> 35;
|
||||
default -> gradeId;
|
||||
};
|
||||
loingUser.setGradeName(one.getShopType());
|
||||
@@ -126,9 +161,11 @@ public class MerchantApplyController extends BaseController {
|
||||
final Merchant merchant = new Merchant();
|
||||
BeanUtils.copyProperties(merchantApply1, merchant);
|
||||
merchant.setStatus(0);
|
||||
List<String> lngNLat = StrUtil.split(merchantApply1.getLngAndLat(), ",");
|
||||
merchant.setLng(lngNLat.get(0));
|
||||
merchant.setLat(lngNLat.get(1));
|
||||
if (merchantApply1.getLngAndLat() != null && !merchantApply1.getLngAndLat().isEmpty()) {
|
||||
List<String> lngNLat = StrUtil.split(merchantApply1.getLngAndLat(), ",");
|
||||
merchant.setLng(lngNLat.get(0));
|
||||
merchant.setLat(lngNLat.get(1));
|
||||
}
|
||||
merchantService.save(merchant);
|
||||
user.setMerchantId(merchant.getMerchantId());
|
||||
user.setMerchantName(merchant.getMerchantName());
|
||||
@@ -136,12 +173,14 @@ public class MerchantApplyController extends BaseController {
|
||||
case "会员店" -> 31;
|
||||
case "实体连锁店" -> 32;
|
||||
case "经销商" -> 33;
|
||||
case "供应商" -> 34;
|
||||
case "产品供应商" -> 34;
|
||||
case "合作伙伴" -> 35;
|
||||
default -> gradeId;
|
||||
};
|
||||
loingUser.setGradeName(merchant.getShopType());
|
||||
}
|
||||
loingUser.setGradeId(gradeId);
|
||||
loingUser.setCertification(1);
|
||||
|
||||
|
||||
// TODO 创建商户账号
|
||||
@@ -179,8 +218,19 @@ public class MerchantApplyController extends BaseController {
|
||||
}
|
||||
|
||||
}
|
||||
// TODO 驳回
|
||||
requestUtil.setTenantId(getTenantId().toString());
|
||||
requestUtil.setAccessToken(JwtUtil.getAccessToken(request));
|
||||
User user = requestUtil.getByUserId(merchantApply1.getUserId());
|
||||
if (user != null) {
|
||||
List<WxMaSubscribeMessage.MsgData> data = new ArrayList<>();
|
||||
data.add(new WxMaSubscribeMessage.MsgData("thing5", merchantApply1.getShopType() + "入驻申请"));
|
||||
data.add(new WxMaSubscribeMessage.MsgData("thing2", result));
|
||||
data.add(new WxMaSubscribeMessage.MsgData("time4", DateUtil.format(DateUtil.date(), "yyyy-MM-dd HH:mm:ss")));
|
||||
weChatController.sendMessage(user.getOpenid(), "NLnexmnhiVl_e4fiC6OwfbTlpssAuvXWoPNwITyTcC4", "package/user/myTv",
|
||||
data);
|
||||
}
|
||||
|
||||
merchantApply1.setStatus(merchantApply.getStatus());
|
||||
if (merchantApplyService.updateById(merchantApply1)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
package com.gxwebsoft.shop.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.shop.entity.Merchant;
|
||||
import com.gxwebsoft.shop.service.MerchantChargePackageService;
|
||||
import com.gxwebsoft.shop.entity.MerchantChargePackage;
|
||||
import com.gxwebsoft.shop.param.MerchantChargePackageParam;
|
||||
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 com.gxwebsoft.shop.service.MerchantService;
|
||||
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.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商家充值套餐控制器
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-11-20 01:55:04
|
||||
*/
|
||||
@Api(tags = "商家充值套餐管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/shop/merchant-charge-package")
|
||||
public class MerchantChargePackageController extends BaseController {
|
||||
@Resource
|
||||
private MerchantChargePackageService merchantChargePackageService;
|
||||
@Resource
|
||||
private MerchantService merchantService;
|
||||
|
||||
@ApiOperation("分页查询商家充值套餐")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<MerchantChargePackage>> page(MerchantChargePackageParam param) {
|
||||
// 使用关联查询
|
||||
return success(merchantChargePackageService.pageRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("查询全部商家充值套餐")
|
||||
@GetMapping()
|
||||
public ApiResult<List<MerchantChargePackage>> list(MerchantChargePackageParam param) {
|
||||
// 使用关联查询
|
||||
if (param.getMerchantId() == null) {
|
||||
Merchant merchant = merchantService.getByUserId(getLoginUser().getUserId());
|
||||
if (merchant != null) param.setMerchantId(merchant.getMerchantId());
|
||||
}
|
||||
if (param.getMerchantId() != null) {
|
||||
return success(merchantChargePackageService.listRel(param));
|
||||
}
|
||||
return success(new ArrayList<>());
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('shop:merchantChargePackage:list')")
|
||||
@ApiOperation("根据id查询商家充值套餐")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<MerchantChargePackage> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(merchantChargePackageService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@ApiOperation("添加商家充值套餐")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody MerchantChargePackage merchantChargePackage) {
|
||||
// 记录当前登录用户id
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
merchantChargePackage.setUserId(loginUser.getUserId());
|
||||
Merchant merchant = merchantService.getByUserId(getLoginUser().getUserId());
|
||||
merchantChargePackage.setMerchantId(merchant.getMerchantId());
|
||||
}
|
||||
if (merchantChargePackageService.save(merchantChargePackage)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("修改商家充值套餐")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody MerchantChargePackage merchantChargePackage) {
|
||||
if (merchantChargePackageService.updateById(merchantChargePackage)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("删除商家充值套餐")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (merchantChargePackageService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量添加商家充值套餐")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<MerchantChargePackage> list) {
|
||||
if (merchantChargePackageService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量修改商家充值套餐")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<MerchantChargePackage> batchParam) {
|
||||
if (batchParam.update(merchantChargePackageService, "id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量删除商家充值套餐")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (merchantChargePackageService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.gxwebsoft.shop.controller;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
@@ -12,11 +14,9 @@ import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.shop.entity.Merchant;
|
||||
import com.gxwebsoft.shop.entity.MerchantAccount;
|
||||
import com.gxwebsoft.shop.entity.*;
|
||||
import com.gxwebsoft.shop.param.MerchantParam;
|
||||
import com.gxwebsoft.shop.service.MerchantAccountService;
|
||||
import com.gxwebsoft.shop.service.MerchantService;
|
||||
import com.gxwebsoft.shop.service.*;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.bouncycastle.cert.ocsp.Req;
|
||||
@@ -25,7 +25,11 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 商户控制器
|
||||
@@ -41,12 +45,50 @@ public class MerchantController extends BaseController {
|
||||
private MerchantService merchantService;
|
||||
@Resource
|
||||
private MerchantAccountService merchantAccountService;
|
||||
@Resource
|
||||
private OrderService orderService;
|
||||
@Resource
|
||||
private GoodsService goodsService;
|
||||
@Resource
|
||||
private OrderGoodsService orderGoodsService;
|
||||
|
||||
@PostMapping("/data")
|
||||
public ApiResult<?> data() {
|
||||
Merchant merchant = merchantService.getByUserId(getLoginUserId());
|
||||
if (merchant == null) return fail("非法请求");
|
||||
List<Goods> goodsList = goodsService.listByMerchant(merchant.getMerchantId());
|
||||
BigDecimal totalIncome = BigDecimal.ZERO, monthIncome = BigDecimal.ZERO;
|
||||
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
if (!goodsList.isEmpty()) {
|
||||
List<OrderGoods> orderGoodsList = orderGoodsService.listByGoodsList(goodsList.stream().map(Goods::getGoodsId).toList());
|
||||
if (!orderGoodsList.isEmpty()) {
|
||||
List<Order> orderList = orderService.listByIds(orderGoodsList.stream().map(OrderGoods::getOrderId).toList());
|
||||
for (OrderGoods orderGoods : orderGoodsList) {
|
||||
for (Order order : orderList) {
|
||||
if (orderGoods.getOrderId().equals(order.getOrderId())) {
|
||||
if (order.getPayStatus().equals(1)) {
|
||||
totalIncome = totalIncome.add(orderGoods.getPrice().multiply(new BigDecimal(orderGoods.getTotalNum())));
|
||||
if (order.getCreateTime().after(DateUtil.beginOfMonth(DateUtil.date())) && order.getCreateTime().before(DateUtil.endOfMonth(DateUtil.date()))) {
|
||||
monthIncome = monthIncome.add(orderGoods.getPrice().multiply(new BigDecimal(orderGoods.getTotalNum())));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
data.put("totalIncome", totalIncome);
|
||||
data.put("monthIncome", monthIncome);
|
||||
data.put("goodsList", goodsList);
|
||||
return success(data);
|
||||
}
|
||||
|
||||
@ApiOperation("分页查询商户")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<Merchant>> page(MerchantParam param) {
|
||||
// 使用关联查询
|
||||
System.out.println("param = " + param);
|
||||
System.out.println("param = " + param);
|
||||
return success(merchantService.pageRel(param));
|
||||
}
|
||||
|
||||
@@ -59,47 +101,47 @@ public class MerchantController extends BaseController {
|
||||
|
||||
@ApiOperation("根据id查询商户")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<Merchant> get(@PathVariable("id") Integer id) {
|
||||
public ApiResult<Merchant> get(@PathVariable("id") Integer id, MerchantParam param) {
|
||||
// 使用关联查询
|
||||
return success(merchantService.getByIdRel(id));
|
||||
return success(merchantService.getByIdRel(id, param));
|
||||
}
|
||||
|
||||
@ApiOperation("查询我的商户")
|
||||
@GetMapping("/getByUserId")
|
||||
public ApiResult<Merchant> getByUserId() {
|
||||
final Merchant one = merchantService.getOne(new LambdaQueryWrapper<Merchant>().eq(Merchant::getUserId, getLoginUserId()));
|
||||
if (ObjectUtil.isNotEmpty(one)) {
|
||||
return success(one);
|
||||
}
|
||||
return fail("未注册商户",null);
|
||||
final Merchant one = merchantService.getOne(new LambdaQueryWrapper<Merchant>().eq(Merchant::getUserId, getLoginUserId()));
|
||||
if (ObjectUtil.isNotEmpty(one)) {
|
||||
return success(one);
|
||||
}
|
||||
return fail("未注册商户", null);
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('shop:merchant:save')")
|
||||
@ApiOperation("添加商户")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody Merchant merchant, HttpServletRequest request) {
|
||||
if (merchantService.count(new LambdaQueryWrapper<Merchant>().eq(Merchant::getPhone,merchant.getPhone())) > 0) {
|
||||
return fail("商户手机号码" + merchant.getPhone() + "已存在");
|
||||
}
|
||||
if (merchantService.save(merchant)) {
|
||||
// 设置商家后台入口
|
||||
merchant.setAdminUrl(merchant.getTenantId() + ".m.wsdns.cn");
|
||||
merchantService.updateById(merchant);
|
||||
// 获取用户信息
|
||||
final RequestUtil requestUtil = new RequestUtil();
|
||||
String access_token = JwtUtil.getAccessToken(request);
|
||||
requestUtil.setAccessToken(access_token);
|
||||
requestUtil.setTenantId(getTenantId().toString());
|
||||
final MerchantAccount merchantAccount = new MerchantAccount();
|
||||
merchantAccount.setMerchantId(merchant.getMerchantId());
|
||||
merchantAccount.setPhone(merchant.getPhone());
|
||||
merchantAccount.setPassword(merchant.getPhone().substring(merchant.getPhone().length() - 6));
|
||||
merchantAccount.setRealName(merchant.getRealName());
|
||||
merchantAccount.setRoleId(merchant.getRoleId());
|
||||
merchantAccount.setRoleName(merchant.getRoleName());
|
||||
requestUtil.saveUserByPhone(merchantAccount);
|
||||
merchantAccountService.save(merchantAccount);
|
||||
return success("添加成功");
|
||||
if (merchantService.count(new LambdaQueryWrapper<Merchant>().eq(Merchant::getPhone, merchant.getPhone())) > 0) {
|
||||
return fail("商户手机号码" + merchant.getPhone() + "已存在");
|
||||
}
|
||||
if (merchantService.save(merchant)) {
|
||||
// 设置商家后台入口
|
||||
merchant.setAdminUrl(merchant.getTenantId() + ".m.wsdns.cn");
|
||||
merchantService.updateById(merchant);
|
||||
// 获取用户信息
|
||||
final RequestUtil requestUtil = new RequestUtil();
|
||||
String access_token = JwtUtil.getAccessToken(request);
|
||||
requestUtil.setAccessToken(access_token);
|
||||
requestUtil.setTenantId(getTenantId().toString());
|
||||
final MerchantAccount merchantAccount = new MerchantAccount();
|
||||
merchantAccount.setMerchantId(merchant.getMerchantId());
|
||||
merchantAccount.setPhone(merchant.getPhone());
|
||||
merchantAccount.setPassword(merchant.getPhone().substring(merchant.getPhone().length() - 6));
|
||||
merchantAccount.setRealName(merchant.getRealName());
|
||||
merchantAccount.setRoleId(merchant.getRoleId());
|
||||
merchantAccount.setRoleName(merchant.getRoleName());
|
||||
requestUtil.saveUserByPhone(merchantAccount);
|
||||
merchantAccountService.save(merchantAccount);
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
package com.gxwebsoft.shop.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.shop.entity.Goods;
|
||||
import com.gxwebsoft.shop.entity.MerchantPackageGoods;
|
||||
import com.gxwebsoft.shop.entity.UserGoodsInMerchant;
|
||||
import com.gxwebsoft.shop.param.MerchantPackageGoodsParam;
|
||||
import com.gxwebsoft.shop.service.GoodsService;
|
||||
import com.gxwebsoft.shop.service.MerchantGoodsPackageService;
|
||||
import com.gxwebsoft.shop.entity.MerchantGoodsPackage;
|
||||
import com.gxwebsoft.shop.param.MerchantGoodsPackageParam;
|
||||
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 com.gxwebsoft.shop.service.MerchantPackageGoodsService;
|
||||
import com.gxwebsoft.shop.service.UserGoodsInMerchantService;
|
||||
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.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商家充值套餐控制器
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-11-20 01:55:04
|
||||
*/
|
||||
@Api(tags = "商家充值套餐管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/shop/merchant-goods-package")
|
||||
public class MerchantGoodsPackageController extends BaseController {
|
||||
@Resource
|
||||
private MerchantGoodsPackageService merchantGoodsPackageService;
|
||||
@Resource
|
||||
private MerchantPackageGoodsService merchantPackageGoodsService;
|
||||
@Resource
|
||||
private GoodsService goodsService;
|
||||
@Resource
|
||||
private UserGoodsInMerchantService userGoodsInMerchantService;
|
||||
|
||||
@ApiOperation("分页查询商家充值套餐")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<MerchantGoodsPackage>> page(MerchantGoodsPackageParam param) {
|
||||
// 使用关联查询
|
||||
return success(merchantGoodsPackageService.pageRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("查询全部商家充值套餐")
|
||||
@GetMapping()
|
||||
public ApiResult<List<MerchantGoodsPackage>> list(MerchantGoodsPackageParam param) {
|
||||
// 使用关联查询
|
||||
List<MerchantGoodsPackage> list = merchantGoodsPackageService.listRel(param);
|
||||
for (MerchantGoodsPackage merchantGoodsPackage : list) {
|
||||
List<MerchantPackageGoods> merchantPackageGoodsList = merchantPackageGoodsService.listByPackage(merchantGoodsPackage.getId());
|
||||
List<Goods> goodsList = goodsService.listByIds(merchantPackageGoodsList.stream().map(MerchantPackageGoods::getGoodsId).toList());
|
||||
merchantGoodsPackage.setGoodsList(goodsList);
|
||||
if (param.getWithUserPackage() != null) {
|
||||
merchantGoodsPackage.setUserPackage(userGoodsInMerchantService.infoInMerchant(merchantGoodsPackage.getId(), getLoginUserId()));
|
||||
}
|
||||
}
|
||||
return success(list);
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('shop:merchantGoodsPackage:list')")
|
||||
@ApiOperation("根据id查询商家充值套餐")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<MerchantGoodsPackage> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(merchantGoodsPackageService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@ApiOperation("添加商家充值套餐")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody MerchantGoodsPackage merchantGoodsPackage) {
|
||||
// 记录当前登录用户id
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
merchantGoodsPackage.setUserId(loginUser.getUserId());
|
||||
}
|
||||
if (merchantGoodsPackageService.save(merchantGoodsPackage)) {
|
||||
List<MerchantPackageGoods> merchantPackageGoodsList = new ArrayList<>();
|
||||
for (Integer goodsId : merchantGoodsPackage.getGoodsIdList()) {
|
||||
MerchantPackageGoods merchantPackageGoods = new MerchantPackageGoods();
|
||||
merchantPackageGoods.setGoodsId(goodsId);
|
||||
merchantPackageGoods.setPackageId(merchantGoodsPackage.getId());
|
||||
merchantPackageGoods.setUserId(getLoginUserId());
|
||||
merchantPackageGoodsList.add(merchantPackageGoods);
|
||||
}
|
||||
merchantPackageGoodsService.saveBatch(merchantPackageGoodsList);
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("修改商家充值套餐")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody MerchantGoodsPackage merchantGoodsPackage) {
|
||||
if (merchantGoodsPackageService.updateById(merchantGoodsPackage)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("删除商家充值套餐")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (merchantGoodsPackageService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量添加商家充值套餐")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<MerchantGoodsPackage> list) {
|
||||
if (merchantGoodsPackageService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量修改商家充值套餐")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<MerchantGoodsPackage> batchParam) {
|
||||
if (batchParam.update(merchantGoodsPackageService, "id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量删除商家充值套餐")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (merchantGoodsPackageService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
package com.gxwebsoft.shop.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.shop.service.MerchantPackageGoodsService;
|
||||
import com.gxwebsoft.shop.entity.MerchantPackageGoods;
|
||||
import com.gxwebsoft.shop.param.MerchantPackageGoodsParam;
|
||||
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-11-20 01:55:04
|
||||
*/
|
||||
@Api(tags = "商家套餐可使用的商品管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/shop/merchant-package-goods")
|
||||
public class MerchantPackageGoodsController extends BaseController {
|
||||
@Resource
|
||||
private MerchantPackageGoodsService merchantPackageGoodsService;
|
||||
|
||||
@ApiOperation("分页查询商家套餐可使用的商品")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<MerchantPackageGoods>> page(MerchantPackageGoodsParam param) {
|
||||
// 使用关联查询
|
||||
return success(merchantPackageGoodsService.pageRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("查询全部商家套餐可使用的商品")
|
||||
@GetMapping()
|
||||
public ApiResult<List<MerchantPackageGoods>> list(MerchantPackageGoodsParam param) {
|
||||
// 使用关联查询
|
||||
return success(merchantPackageGoodsService.listRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('shop:merchantPackageGoods:list')")
|
||||
@ApiOperation("根据id查询商家套餐可使用的商品")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<MerchantPackageGoods> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(merchantPackageGoodsService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@ApiOperation("添加商家套餐可使用的商品")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody MerchantPackageGoods merchantPackageGoods) {
|
||||
// 记录当前登录用户id
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
merchantPackageGoods.setUserId(loginUser.getUserId());
|
||||
}
|
||||
if (merchantPackageGoodsService.save(merchantPackageGoods)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("修改商家套餐可使用的商品")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody MerchantPackageGoods merchantPackageGoods) {
|
||||
if (merchantPackageGoodsService.updateById(merchantPackageGoods)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("删除商家套餐可使用的商品")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (merchantPackageGoodsService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量添加商家套餐可使用的商品")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<MerchantPackageGoods> list) {
|
||||
if (merchantPackageGoodsService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量修改商家套餐可使用的商品")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<MerchantPackageGoods> batchParam) {
|
||||
if (batchParam.update(merchantPackageGoodsService, "id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量删除商家套餐可使用的商品")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (merchantPackageGoodsService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
package com.gxwebsoft.shop.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.shop.service.MessageService;
|
||||
import com.gxwebsoft.shop.entity.Message;
|
||||
import com.gxwebsoft.shop.param.MessageParam;
|
||||
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-11-18 22:03:11
|
||||
*/
|
||||
@Api(tags = "管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/shop/message")
|
||||
public class MessageController extends BaseController {
|
||||
@Resource
|
||||
private MessageService messageService;
|
||||
|
||||
@PostMapping("/unread-num")
|
||||
public ApiResult<Integer> unreadNum() {
|
||||
// 使用关联查询
|
||||
return success(messageService.unreadNum(getLoginUserId()));
|
||||
}
|
||||
|
||||
@ApiOperation("分页查询")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<Message>> page(MessageParam param) {
|
||||
// 使用关联查询
|
||||
return success(messageService.pageRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("查询全部")
|
||||
@GetMapping()
|
||||
public ApiResult<List<Message>> list(MessageParam param) {
|
||||
// 使用关联查询
|
||||
param.setUserId(getLoginUserId());
|
||||
return success(messageService.listRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('shop:message:list')")
|
||||
@ApiOperation("根据id查询")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<Message> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(messageService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@ApiOperation("添加")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody Message message) {
|
||||
if (messageService.save(message)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("修改")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody Message message) {
|
||||
if (messageService.updateById(message)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("删除")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (messageService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量添加")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<Message> list) {
|
||||
if (messageService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量修改")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<Message> batchParam) {
|
||||
if (batchParam.update(messageService, "id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量删除")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (messageService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,12 +10,17 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.gxwebsoft.cms.entity.Ad;
|
||||
import com.gxwebsoft.common.core.config.ConfigProperties;
|
||||
import com.gxwebsoft.common.core.exception.BusinessException;
|
||||
import com.gxwebsoft.common.core.security.JwtUtil;
|
||||
import com.gxwebsoft.common.core.utils.CommonUtil;
|
||||
import com.gxwebsoft.common.core.utils.RedisUtil;
|
||||
import com.gxwebsoft.common.core.utils.RequestUtil;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.system.entity.Area;
|
||||
import com.gxwebsoft.common.system.entity.FileRecord;
|
||||
import com.gxwebsoft.common.system.entity.Role;
|
||||
import com.gxwebsoft.common.system.service.AreaService;
|
||||
import com.gxwebsoft.shop.entity.*;
|
||||
import com.gxwebsoft.shop.service.*;
|
||||
import com.gxwebsoft.shop.param.OrderParam;
|
||||
@@ -23,9 +28,14 @@ import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.shop.service.impl.KuaiDi100Impl;
|
||||
import com.wechat.pay.java.service.partnerpayments.jsapi.model.Transaction;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import org.apache.poi.xssf.streaming.SXSSFRow;
|
||||
import org.apache.poi.xssf.streaming.SXSSFSheet;
|
||||
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -33,13 +43,17 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.gxwebsoft.shop.consts.OrderPayType.*;
|
||||
|
||||
import com.wechat.pay.java.service.partnerpayments.model.TransactionAmount;
|
||||
|
||||
/**
|
||||
* 订单控制器
|
||||
*
|
||||
@@ -64,13 +78,74 @@ public class OrderController extends BaseController {
|
||||
private ExpressService expressService;
|
||||
@Resource
|
||||
private OrderDeliveryService orderDeliveryService;
|
||||
@Resource
|
||||
private UserAddressService userAddressService;
|
||||
@Resource
|
||||
private ExpressTemplateService expressTemplateService;
|
||||
@Resource
|
||||
private UserBalanceInMerchantService userBalanceInMerchantService;
|
||||
@Resource
|
||||
private UserGoodsInMerchantService userGoodsInMerchantService;
|
||||
@Resource
|
||||
private KuaiDi100Impl kuaiDi100;
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
@Resource
|
||||
private DealerCapitalService dealerCapitalService;
|
||||
@Resource
|
||||
private AreaService areaService;
|
||||
|
||||
@Autowired
|
||||
private WeChatController weChatController;
|
||||
@Autowired
|
||||
private MerchantService merchantService;
|
||||
@Autowired
|
||||
private WxPayNotifyNbgController wxPayNotifyNbgController;
|
||||
|
||||
@Value("${config.upload-path}")
|
||||
private String uploadPath;
|
||||
@Value("${config.server-url}")
|
||||
private String serverUrl;
|
||||
@Resource
|
||||
private ConfigProperties config;
|
||||
|
||||
@PostMapping("/data")
|
||||
public ApiResult<?> data() {
|
||||
Map<String, Integer> data = new HashMap<>();
|
||||
int toBePaid = 0, toBeReceived = 0, toBeDelivery = 0;
|
||||
toBePaid = orderService.count(new LambdaQueryWrapper<Order>().eq(Order::getUserId, getLoginUserId())
|
||||
.eq(Order::getType, 0)
|
||||
.eq(Order::getPayStatus, 0));
|
||||
|
||||
toBeReceived = orderService.count(new LambdaQueryWrapper<Order>().eq(Order::getUserId, getLoginUserId())
|
||||
.eq(Order::getType, 0)
|
||||
.eq(Order::getPayStatus, 1).eq(Order::getDeliveryStatus, 20));
|
||||
|
||||
toBeDelivery = orderService.count(new LambdaQueryWrapper<Order>().eq(Order::getUserId, getLoginUserId())
|
||||
.eq(Order::getType, 0)
|
||||
.eq(Order::getPayStatus, 1).eq(Order::getDeliveryStatus, 10));
|
||||
data.put("toBePaid", toBePaid);
|
||||
data.put("toBeReceived", toBeReceived);
|
||||
data.put("toBeDelivery", toBeDelivery);
|
||||
return success(data);
|
||||
}
|
||||
|
||||
@PostMapping("/data-for-admin")
|
||||
public ApiResult<?> dataForAdmin() {
|
||||
Map<String, BigDecimal> data = new HashMap<>();
|
||||
BigDecimal totalIncome = BigDecimal.ZERO, todayIncome = BigDecimal.ZERO;
|
||||
List<Order> orderList = orderService.list(new LambdaQueryWrapper<Order>().eq(Order::getPayStatus, 1));
|
||||
if (!orderList.isEmpty())
|
||||
totalIncome = orderList.stream().map(Order::getTotalPrice).reduce(BigDecimal::add).get();
|
||||
for (Order order : orderList) {
|
||||
if (order.getCreateTime().after(DateUtil.beginOfDay(DateUtil.date())) && order.getCreateTime().before(DateUtil.endOfDay(DateUtil.date()))) {
|
||||
todayIncome = todayIncome.add(order.getTotalPrice());
|
||||
}
|
||||
}
|
||||
data.put("totalIncome", totalIncome);
|
||||
data.put("todayIncome", todayIncome);
|
||||
return success(data);
|
||||
}
|
||||
|
||||
@ApiOperation("分页查询订单")
|
||||
@GetMapping("/page")
|
||||
@@ -86,6 +161,11 @@ public class OrderController extends BaseController {
|
||||
@GetMapping()
|
||||
public ApiResult<List<Order>> list(OrderParam param) {
|
||||
// 使用关联查询
|
||||
System.out.println(getLoginUser());
|
||||
if (param.getListForExpress() != null) {
|
||||
Merchant merchant = merchantService.getByUserId(getLoginUserId());
|
||||
if (merchant != null) param.setExpressMerchantId(merchant.getMerchantId());
|
||||
}
|
||||
return success(orderService.listRel(param));
|
||||
}
|
||||
|
||||
@@ -95,14 +175,23 @@ public class OrderController extends BaseController {
|
||||
public ApiResult<Order> get(@PathVariable("id") Integer id) {
|
||||
Order order = orderService.getByIdRel(id);
|
||||
if (getLoginUser() != null) {
|
||||
User parentUser = requestUtil.getParent(getLoginUserId());
|
||||
for (OrderGoods orderGoods : order.getGoodsList()) {
|
||||
Goods goods = orderGoods.getGoods();
|
||||
if (getLoginUser().getGradeId().equals(33)) {
|
||||
if (goods.getDealerGift()) goods.setShowGift(true);
|
||||
}
|
||||
// 会员店
|
||||
if (getLoginUser().getGradeId().equals(31)) {
|
||||
BigDecimal originPrice = goods.getPrice();
|
||||
goods.setPrice(goods.getSalePrice());
|
||||
// 会员
|
||||
if (parentUser != null) {
|
||||
if (goods.getPriceGift()) goods.setShowGift(true);
|
||||
// goods.setPrice(originPrice);
|
||||
}
|
||||
// if (getLoginUser().getGradeId().equals(33)) {
|
||||
// if (goods.getDealerGift()) goods.setShowGift(true);
|
||||
// }
|
||||
// 会员店
|
||||
if (getLoginUser().getGradeId() > 30 && goods.getBuyingPriceOpen().equals(1)) {
|
||||
goods.setPrice(goods.getBuyingPrice());
|
||||
// if (goods.getPriceGift()) goods.setShowGift(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -117,7 +206,7 @@ public class OrderController extends BaseController {
|
||||
Merchant merchant = merchantService.getById(order.getSelfTakeMerchantId());
|
||||
order.setMerchant(merchant);
|
||||
}
|
||||
}else if (order.getType().equals(1)) {
|
||||
} else if (order.getType().equals(1)) {
|
||||
Merchant merchant = merchantService.getById(order.getMerchantId());
|
||||
order.setMerchant(merchant);
|
||||
}
|
||||
@@ -251,6 +340,39 @@ public class OrderController extends BaseController {
|
||||
if (order.getAddress() != null) {
|
||||
address = order.getAddress();
|
||||
}
|
||||
if (order.getAddressId() != null) {
|
||||
UserAddress userAddress = userAddressService.getById(order.getAddressId());
|
||||
if (userAddress != null) {
|
||||
name = userAddress.getName();
|
||||
phone = userAddress.getPhone();
|
||||
address = userAddress.getFullAddress();
|
||||
Area province = areaService.areaInfoByName(userAddress.getProvince(), 1);
|
||||
Area city = areaService.areaInfoByName(userAddress.getCity(), 2);
|
||||
Area region = areaService.areaInfoByName(userAddress.getRegion(), 3);
|
||||
if (province != null) {
|
||||
order.setProvinceId(province.getId());
|
||||
}
|
||||
if (city != null) {
|
||||
order.setCityId(city.getId());
|
||||
}
|
||||
if (region != null) {
|
||||
order.setRegionId(region.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (order.getAddressId() != null && order.getType() < 3 && order.getDeliveryType() != null && order.getDeliveryType().equals(0)) {
|
||||
UserAddress userAddress = userAddressService.getById(order.getAddressId());
|
||||
if (userAddress == null) return fail("请选择收货地址");
|
||||
for (OrderGoods orderGoods : order.getGoodsList()) {
|
||||
orderGoods.setTotalNum(orderGoods.getCartNum());
|
||||
}
|
||||
BigDecimal expressAmount = expressTemplateService.calExpressAmount(order.getGoodsList(), userAddress);
|
||||
order.setExpressPrice(expressAmount);
|
||||
order.setTotalPrice(expressAmount.add(order.getTotalPrice()));
|
||||
}
|
||||
|
||||
order.setOrderNo(Long.toString(orderNo));
|
||||
order.setUserId(loginUser.getUserId());
|
||||
order.setOpenid(loginUser.getOpenid());
|
||||
@@ -268,7 +390,7 @@ public class OrderController extends BaseController {
|
||||
if (order.getGoodsList() != null) {
|
||||
order.setTotalNum(order.getGoodsList().size());
|
||||
}
|
||||
if (order.getDeliveryType().equals(1)) {
|
||||
if (order.getDeliveryType() != null && order.getDeliveryType().equals(1)) {
|
||||
order.setSelfTakeCode(RandomUtil.randomString(4));
|
||||
}
|
||||
|
||||
@@ -334,7 +456,7 @@ public class OrderController extends BaseController {
|
||||
final Set<Integer> cartIds = order.getGoodsList().stream().map(OrderGoods::getGoodsId).collect(Collectors.toSet());
|
||||
cartService.remove(new LambdaQueryWrapper<Cart>().eq(Cart::getUserId, order.getUserId()).in(Cart::getGoodsId, cartIds));
|
||||
// 外卖订单
|
||||
if (!order.getMerchantId().equals(0)) {
|
||||
if (order.getMerchantId() != null && !order.getMerchantId().equals(0) && order.getType() < 3) {
|
||||
cartService.remove(new LambdaQueryWrapper<Cart>().eq(Cart::getUserId, order.getUserId()).eq(Cart::getType, 1));
|
||||
}
|
||||
}
|
||||
@@ -360,7 +482,43 @@ public class OrderController extends BaseController {
|
||||
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/qr"+ filename);
|
||||
return success("下单成功", "file/qr" + filename);
|
||||
}
|
||||
// 门店余额
|
||||
if (order.getPayType().equals(PAY_TYPE_MERCHANT_BALANCE)) {
|
||||
UserBalanceInMerchant userBalanceInMerchant = userBalanceInMerchantService.getBalance(order.getMerchantId(), order.getUserId());
|
||||
if (userBalanceInMerchant == null || userBalanceInMerchant.getBalance().compareTo(order.getTotalPrice()) < 0) {
|
||||
return fail("余额不足");
|
||||
}
|
||||
userBalanceInMerchant.setBalance(userBalanceInMerchant.getBalance().subtract(order.getTotalPrice()));
|
||||
userBalanceInMerchantService.updateById(userBalanceInMerchant);
|
||||
final TransactionAmount amount = new TransactionAmount();
|
||||
amount.setTotal(order.getTotalPrice().multiply(new BigDecimal(100)).intValue());
|
||||
amount.setCurrency("CNY");
|
||||
wxPayNotifyNbgController.doPay(new Transaction() {{
|
||||
setOutTradeNo(order.getOrderNo());
|
||||
setTransactionId(order.getOrderNo());
|
||||
setAmount(amount);
|
||||
}});
|
||||
return success("支付成功", true);
|
||||
}
|
||||
// 门店套餐
|
||||
if (order.getPayType().equals(PAY_TYPE_MERCHANT_PACKAGE)) {
|
||||
UserGoodsInMerchant userGoodsInMerchant = userGoodsInMerchantService.infoInMerchant(order.getPackageId(), order.getUserId());
|
||||
if (userGoodsInMerchant == null || userGoodsInMerchant.getRemainNum() <= 0) {
|
||||
return fail("次数不足");
|
||||
}
|
||||
userGoodsInMerchant.setRemainNum(userGoodsInMerchant.getRemainNum() - 1);
|
||||
userGoodsInMerchantService.updateById(userGoodsInMerchant);
|
||||
final TransactionAmount amount = new TransactionAmount();
|
||||
amount.setTotal(order.getTotalPrice().multiply(new BigDecimal(100)).intValue());
|
||||
amount.setCurrency("CNY");
|
||||
wxPayNotifyNbgController.doPay(new Transaction() {{
|
||||
setOutTradeNo(order.getOrderNo());
|
||||
setTransactionId(order.getOrderNo());
|
||||
setAmount(amount);
|
||||
}});
|
||||
return success("支付成功", true);
|
||||
}
|
||||
return fail("支付失败");
|
||||
}
|
||||
@@ -403,6 +561,18 @@ public class OrderController extends BaseController {
|
||||
return success("外卖确认收货");
|
||||
}
|
||||
|
||||
@ApiOperation("物流查询")
|
||||
@PostMapping("/express-poll")
|
||||
public ApiResult<?> expressPoll(@RequestBody OrderDelivery orderDelivery) throws Exception {
|
||||
String res;
|
||||
if (redisUtil.get("express_" + orderDelivery.getExpressNo()) == null) {
|
||||
Express express = expressService.getById(orderDelivery.getExpressId());
|
||||
res = kuaiDi100.pollList(express.getKuaidi100Code(), orderDelivery.getExpressNo());
|
||||
redisUtil.set("express_" + orderDelivery.getExpressNo(), res, 1L, TimeUnit.HOURS);
|
||||
} else res = redisUtil.get("express_" + orderDelivery.getExpressNo());
|
||||
return success(res);
|
||||
}
|
||||
|
||||
@ApiOperation("修改订单")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody Order order) {
|
||||
@@ -451,4 +621,82 @@ public class OrderController extends BaseController {
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@PostMapping("/export-for-supplier")
|
||||
public ApiResult<?> exportForSupplier() throws IOException {
|
||||
List<Merchant> supplierList = merchantService.list(new LambdaQueryWrapper<Merchant>().eq(Merchant::getShopType, "供应商"));
|
||||
String filename = "excel/供应商报表.xlsx";
|
||||
String path = uploadPath + filename;
|
||||
SXSSFWorkbook workbook = new SXSSFWorkbook();
|
||||
//创建工作表单
|
||||
SXSSFSheet sheet = workbook.createSheet();
|
||||
String[] headers = {"名称", "订单号", "订单金额", "是否已结算"};
|
||||
|
||||
SXSSFRow row0 = sheet.createRow(0);
|
||||
for (int i = 0; i < headers.length; i++) {
|
||||
row0.createCell(i).setCellValue(headers[i]);
|
||||
}
|
||||
if (!supplierList.isEmpty()) {
|
||||
List<DealerCapital> dealerCapitalList = dealerCapitalService.list(
|
||||
new LambdaQueryWrapper<DealerCapital>()
|
||||
.eq(DealerCapital::getFlowType, 10)
|
||||
.in(DealerCapital::getUserId, supplierList.stream().map(Merchant::getUserId).toList())
|
||||
);
|
||||
List<Order> orderList = orderService.listByIds(dealerCapitalList.stream().map(DealerCapital::getOrderId).toList());
|
||||
for (DealerCapital dealerCapital : dealerCapitalList) {
|
||||
Merchant merchant = supplierList.stream().filter(d -> d.getUserId().equals(dealerCapital.getUserId())).findFirst().orElse(null);
|
||||
Order order = orderList.stream().filter(item -> item.getOrderId().equals(dealerCapital.getOrderId())).findFirst().orElse(null);
|
||||
SXSSFRow row = sheet.createRow(sheet.getLastRowNum() + 1);
|
||||
row.createCell(0).setCellValue(merchant != null ? merchant.getMerchantName() : "");
|
||||
row.createCell(1).setCellValue(order != null ? order.getOrderNo() : "");
|
||||
row.createCell(2).setCellValue(dealerCapital.getMoney().toString() + "元");
|
||||
row.createCell(3).setCellValue(dealerCapital.getStatus().equals(0) ? "未结算" : "已结算");
|
||||
}
|
||||
}
|
||||
FileOutputStream output = new FileOutputStream(path);
|
||||
workbook.write(output);
|
||||
output.flush();
|
||||
|
||||
FileRecord result = new FileRecord();
|
||||
result.setCreateUserId(getLoginUserId());
|
||||
result.setName("供应商报表");
|
||||
result.setPath(filename);
|
||||
result.setUrl(config.getServerUrl() + "/file/" + filename);
|
||||
return success(result);
|
||||
}
|
||||
|
||||
@PostMapping("/export-for-cash")
|
||||
public ApiResult<?> exportForCash() throws IOException {
|
||||
String filename = "excel/提现报表.xlsx";
|
||||
String path = uploadPath + filename;
|
||||
SXSSFWorkbook workbook = new SXSSFWorkbook();
|
||||
//创建工作表单
|
||||
SXSSFSheet sheet = workbook.createSheet();
|
||||
String[] headers = {"名称", "提现金额"};
|
||||
|
||||
SXSSFRow row0 = sheet.createRow(0);
|
||||
for (int i = 0; i < headers.length; i++) {
|
||||
row0.createCell(i).setCellValue(headers[i]);
|
||||
}
|
||||
List<DealerCapital> dealerCapitalList = dealerCapitalService.list(
|
||||
new LambdaQueryWrapper<DealerCapital>()
|
||||
.eq(DealerCapital::getFlowType, 20)
|
||||
);
|
||||
for (DealerCapital dealerCapital : dealerCapitalList) {
|
||||
Merchant merchant = merchantService.getByUserId(dealerCapital.getUserId());
|
||||
SXSSFRow row = sheet.createRow(sheet.getLastRowNum() + 1);
|
||||
row.createCell(1).setCellValue(merchant != null ? merchant.getMerchantName() : "");
|
||||
row.createCell(2).setCellValue(dealerCapital.getMoney().toString() + "元");
|
||||
}
|
||||
FileOutputStream output = new FileOutputStream(path);
|
||||
workbook.write(output);
|
||||
output.flush();
|
||||
|
||||
FileRecord result = new FileRecord();
|
||||
result.setCreateUserId(getLoginUserId());
|
||||
result.setName("提现报表");
|
||||
result.setPath(filename);
|
||||
result.setUrl(config.getServerUrl() + "/file/" + filename);
|
||||
return success(result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,10 +58,7 @@ public class OrderDeliveryController extends BaseController {
|
||||
private OrderDeliveryService orderDeliveryService;
|
||||
@Resource
|
||||
private OrderService orderService;
|
||||
@Resource
|
||||
private KuaiDi100 kuaiDi100;
|
||||
@Resource
|
||||
private ExpressService expressService;
|
||||
|
||||
@Resource
|
||||
private OrderGoodsService orderGoodsService;
|
||||
@Resource
|
||||
@@ -71,11 +68,26 @@ public class OrderDeliveryController extends BaseController {
|
||||
@Resource
|
||||
private WxMaProperties wxMaProperties;
|
||||
|
||||
@Autowired
|
||||
private WeChatController weChatController;
|
||||
@Autowired
|
||||
private RequestUtil requestUtil;
|
||||
|
||||
@ApiOperation("发货")
|
||||
@PostMapping("/set-express")
|
||||
public ApiResult<?> page(@RequestBody OrderDelivery orderDelivery, HttpServletRequest request) throws Exception {
|
||||
Order order = orderService.getById(orderDelivery.getOrderId());
|
||||
Merchant merchant = merchantService.getById(order.getExpressMerchantId());
|
||||
if (!merchant.getUserId().equals(getLoginUserId())) return fail("无法发货");
|
||||
String access_token = JwtUtil.getAccessToken(request);
|
||||
String tenantId = getTenantId().toString();
|
||||
requestUtil.setAccessToken(access_token);
|
||||
requestUtil.setTenantId(tenantId);
|
||||
User user = requestUtil.getByUserId(order.getPayUserId());
|
||||
List<OrderGoods> orderGoodsList = orderGoodsService.listByOrderId(order.getOrderId());
|
||||
Map<String, Object> res = orderDeliveryService.setExpress(user, orderDelivery, merchant, order, orderGoodsList);
|
||||
if (res.get("res").equals(true)) return success(res.get("msg"));
|
||||
return fail(res.get("msg"));
|
||||
}
|
||||
|
||||
@ApiOperation("分页查询发货单")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<OrderDelivery>> page(OrderDeliveryParam param) {
|
||||
@@ -136,74 +148,10 @@ public class OrderDeliveryController extends BaseController {
|
||||
// merchant = merchantService.getById(3095);
|
||||
if (merchant != null) {
|
||||
// 商家发货
|
||||
Express express = expressService.getByIdRel(orderDelivery.getExpressId());
|
||||
BOrderReq bOrderReq = new BOrderReq();
|
||||
bOrderReq.setKuaidicom(express.getKuaidi100Code());
|
||||
bOrderReq.setSendManName(merchant.getMerchantName());
|
||||
bOrderReq.setSendManMobile(merchant.getPhone());
|
||||
bOrderReq.setSendManPrintAddr(merchant.getProvince() + merchant.getCity() + merchant.getRegion() + merchant.getAddress());
|
||||
bOrderReq.setRecManName(order.getRealName());
|
||||
bOrderReq.setRecManMobile(order.getPhone());
|
||||
bOrderReq.setRecManPrintAddr(order.getAddress());
|
||||
bOrderReq.setCallBackUrl("https://modules.gxwebsoft.com/api/shop/order-delivery/notify");
|
||||
HttpResult res = kuaiDi100.border(bOrderReq);
|
||||
// System.out.println("res.getBody():" + res.getBody());
|
||||
if (res.getStatus() != 200) return fail("快递100接口异常");
|
||||
KuaiDi100Resp kuaiDi100Resp = JSONUtil.parseObject(res.getBody(), KuaiDi100Resp.class);
|
||||
if (kuaiDi100Resp == null) return fail("快递100接口异常");
|
||||
if (!kuaiDi100Resp.getResult()) return fail(kuaiDi100Resp.getMessage());
|
||||
Map<String, Object> bOrderData = (Map<String, Object>) kuaiDi100Resp.getData();
|
||||
// System.out.println("kuaidinum:" + bOrderData.get("kuaidinum"));
|
||||
orderDelivery.setExpressNo((String) bOrderData.get("kuaidinum"));
|
||||
if (orderDeliveryService.save(orderDelivery)) {
|
||||
order.setExpressMerchantId(merchant.getMerchantId());
|
||||
order.setExpressMerchantName(merchant.getMerchantName());
|
||||
order.setDeliveryStatus(20);
|
||||
order.setDeliveryTime(DateUtil.date());
|
||||
orderService.updateById(order);
|
||||
|
||||
if (order.getPayType().equals(PAY_TYPE_WECHAT) || (order.getPayType().equals(PAY_TYPE_FRIEND) && order.getFriendPayType().equals(PAY_TYPE_WECHAT))) {
|
||||
User user = requestUtil.getByUserId(order.getPayUserId());
|
||||
// 上传小程序发货信息
|
||||
WxMaOrderShippingInfoUploadRequest uploadRequest = new WxMaOrderShippingInfoUploadRequest();
|
||||
uploadRequest.setLogisticsType(1);
|
||||
uploadRequest.setDeliveryMode(1);
|
||||
|
||||
OrderKeyBean orderKeyBean = new OrderKeyBean();
|
||||
orderKeyBean.setOrderNumberType(2);
|
||||
orderKeyBean.setTransactionId(order.getTransactionId());
|
||||
uploadRequest.setOrderKey(orderKeyBean);
|
||||
|
||||
uploadRequest.setOrderKey(orderKeyBean);
|
||||
|
||||
List<ShippingListBean> shippingList = new ArrayList<>();
|
||||
ShippingListBean shippingListBean = new ShippingListBean();
|
||||
shippingListBean.setTrackingNo((String) bOrderData.get("kuaidinum"));
|
||||
shippingListBean.setExpressCompany(express.getWxCode());
|
||||
ContactBean contactBean = new ContactBean();
|
||||
contactBean.setReceiverContact(user.getMobile());
|
||||
shippingListBean.setContact(contactBean);
|
||||
shippingList.add(shippingListBean);
|
||||
uploadRequest.setShippingList(shippingList);
|
||||
|
||||
String itemDesc = orderGoodsList.get(0).getGoods().getGoodsName();
|
||||
if (orderGoodsList.size() > 1) itemDesc += "等" + orderGoodsList.size() + "件商品";
|
||||
shippingListBean.setItemDesc(itemDesc);
|
||||
|
||||
uploadRequest.setUploadTime(new DateTime().toString(DatePattern.UTC_WITH_ZONE_OFFSET_PATTERN));
|
||||
|
||||
PayerBean payerBean = new PayerBean();
|
||||
|
||||
payerBean.setOpenid(user.getOpenid());
|
||||
uploadRequest.setPayer(payerBean);
|
||||
|
||||
WxMaService wxMaService = weChatController.wxMaService();
|
||||
WxMaOrderShippingService wxMaOrderShippingService = new WxMaOrderShippingServiceImpl(wxMaService);
|
||||
WxMaOrderShippingInfoBaseResponse response = wxMaOrderShippingService.upload(uploadRequest);
|
||||
System.out.println("response" + response);
|
||||
}
|
||||
return success("操作成功");
|
||||
}
|
||||
requestUtil.setAccessToken(access_token);
|
||||
requestUtil.setTenantId(tenantId);
|
||||
User user = requestUtil.getByUserId(order.getPayUserId());
|
||||
orderDeliveryService.setExpress(user, orderDelivery, merchant, order, orderGoodsList);
|
||||
}
|
||||
return fail("操作失败");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
package com.gxwebsoft.shop.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.shop.service.UserBalanceInMerchantService;
|
||||
import com.gxwebsoft.shop.entity.UserBalanceInMerchant;
|
||||
import com.gxwebsoft.shop.param.UserBalanceInMerchantParam;
|
||||
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-11-20 01:55:04
|
||||
*/
|
||||
@Api(tags = "用户在商家中的余额管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/shop/user-balance-in-merchant")
|
||||
public class UserBalanceInMerchantController extends BaseController {
|
||||
@Resource
|
||||
private UserBalanceInMerchantService userBalanceInMerchantService;
|
||||
|
||||
@PostMapping("/data")
|
||||
public ApiResult<UserBalanceInMerchant> data(@RequestBody UserBalanceInMerchantParam param) {
|
||||
// 使用关联查询
|
||||
return success(userBalanceInMerchantService.getBalance(param.getMerchantId(), getLoginUserId()));
|
||||
}
|
||||
|
||||
@ApiOperation("分页查询用户在商家中的余额")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<UserBalanceInMerchant>> page(UserBalanceInMerchantParam param) {
|
||||
// 使用关联查询
|
||||
return success(userBalanceInMerchantService.pageRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("查询全部用户在商家中的余额")
|
||||
@GetMapping()
|
||||
public ApiResult<List<UserBalanceInMerchant>> list(UserBalanceInMerchantParam param) {
|
||||
// 使用关联查询
|
||||
return success(userBalanceInMerchantService.listRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('shop:userBalanceInMerchant:list')")
|
||||
@ApiOperation("根据id查询用户在商家中的余额")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<UserBalanceInMerchant> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(userBalanceInMerchantService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@ApiOperation("添加用户在商家中的余额")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody UserBalanceInMerchant userBalanceInMerchant) {
|
||||
// 记录当前登录用户id
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
userBalanceInMerchant.setUserId(loginUser.getUserId());
|
||||
}
|
||||
if (userBalanceInMerchantService.save(userBalanceInMerchant)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("修改用户在商家中的余额")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody UserBalanceInMerchant userBalanceInMerchant) {
|
||||
if (userBalanceInMerchantService.updateById(userBalanceInMerchant)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("删除用户在商家中的余额")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (userBalanceInMerchantService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量添加用户在商家中的余额")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<UserBalanceInMerchant> list) {
|
||||
if (userBalanceInMerchantService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量修改用户在商家中的余额")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<UserBalanceInMerchant> batchParam) {
|
||||
if (batchParam.update(userBalanceInMerchantService, "id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量删除用户在商家中的余额")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (userBalanceInMerchantService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
package com.gxwebsoft.shop.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.shop.service.UserCommissionRoleService;
|
||||
import com.gxwebsoft.shop.entity.UserCommissionRole;
|
||||
import com.gxwebsoft.shop.param.UserCommissionRoleParam;
|
||||
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.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户绑定分红角色控制器
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-12-02 12:43:40
|
||||
*/
|
||||
@Api(tags = "用户绑定分红角色管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/shop/user-commission-role")
|
||||
public class UserCommissionRoleController extends BaseController {
|
||||
@Resource
|
||||
private UserCommissionRoleService userCommissionRoleService;
|
||||
|
||||
@ApiOperation("分页查询用户绑定分红角色")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<UserCommissionRole>> page(UserCommissionRoleParam param) {
|
||||
// 使用关联查询
|
||||
return success(userCommissionRoleService.pageRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("查询全部用户绑定分红角色")
|
||||
@GetMapping()
|
||||
public ApiResult<List<UserCommissionRole>> list(UserCommissionRoleParam param) {
|
||||
// 使用关联查询
|
||||
return success(userCommissionRoleService.listRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('shop:userCommissionRole:list')")
|
||||
@ApiOperation("根据id查询用户绑定分红角色")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<UserCommissionRole> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(userCommissionRoleService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@ApiOperation("添加用户绑定分红角色")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody UserCommissionRole userCommissionRole) {
|
||||
|
||||
if (userCommissionRoleService.save(userCommissionRole)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("修改用户绑定分红角色")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody UserCommissionRole userCommissionRole) {
|
||||
if (userCommissionRoleService.updateById(userCommissionRole)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("删除用户绑定分红角色")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (userCommissionRoleService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量添加用户绑定分红角色")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<UserCommissionRole> list) {
|
||||
userCommissionRoleService.removeByMap(new HashMap<>() {{
|
||||
put("user_id", list.get(0).getUserId());
|
||||
}});
|
||||
if (userCommissionRoleService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量修改用户绑定分红角色")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<UserCommissionRole> batchParam) {
|
||||
if (batchParam.update(userCommissionRoleService, "id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量删除用户绑定分红角色")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (userCommissionRoleService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
package com.gxwebsoft.shop.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.shop.service.UserGoodsInMerchantService;
|
||||
import com.gxwebsoft.shop.entity.UserGoodsInMerchant;
|
||||
import com.gxwebsoft.shop.param.UserGoodsInMerchantParam;
|
||||
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-11-20 01:55:04
|
||||
*/
|
||||
@Api(tags = "用户在商家中的代金券管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/shop/user-goods-in-merchant")
|
||||
public class UserGoodsInMerchantController extends BaseController {
|
||||
@Resource
|
||||
private UserGoodsInMerchantService userGoodsInMerchantService;
|
||||
|
||||
@ApiOperation("分页查询用户在商家中的代金券")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<UserGoodsInMerchant>> page(UserGoodsInMerchantParam param) {
|
||||
// 使用关联查询
|
||||
return success(userGoodsInMerchantService.pageRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("查询全部用户在商家中的代金券")
|
||||
@GetMapping()
|
||||
public ApiResult<List<UserGoodsInMerchant>> list(UserGoodsInMerchantParam param) {
|
||||
// 使用关联查询
|
||||
return success(userGoodsInMerchantService.listRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('shop:userGoodsInMerchant:list')")
|
||||
@ApiOperation("根据id查询用户在商家中的代金券")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<UserGoodsInMerchant> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(userGoodsInMerchantService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@ApiOperation("添加用户在商家中的代金券")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody UserGoodsInMerchant userGoodsInMerchant) {
|
||||
// 记录当前登录用户id
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
userGoodsInMerchant.setUserId(loginUser.getUserId());
|
||||
}
|
||||
if (userGoodsInMerchantService.save(userGoodsInMerchant)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("修改用户在商家中的代金券")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody UserGoodsInMerchant userGoodsInMerchant) {
|
||||
if (userGoodsInMerchantService.updateById(userGoodsInMerchant)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("删除用户在商家中的代金券")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (userGoodsInMerchantService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量添加用户在商家中的代金券")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<UserGoodsInMerchant> list) {
|
||||
if (userGoodsInMerchantService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量修改用户在商家中的代金券")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<UserGoodsInMerchant> batchParam) {
|
||||
if (batchParam.update(userGoodsInMerchantService, "id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量删除用户在商家中的代金券")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (userGoodsInMerchantService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
package com.gxwebsoft.shop.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.shop.service.ViewHistoryService;
|
||||
import com.gxwebsoft.shop.entity.ViewHistory;
|
||||
import com.gxwebsoft.shop.param.ViewHistoryParam;
|
||||
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-11-22 22:13:47
|
||||
*/
|
||||
@Api(tags = "浏览历史管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/shop/view-history")
|
||||
public class ViewHistoryController extends BaseController {
|
||||
@Resource
|
||||
private ViewHistoryService viewHistoryService;
|
||||
|
||||
@ApiOperation("分页查询浏览历史")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<ViewHistory>> page(ViewHistoryParam param) {
|
||||
// 使用关联查询
|
||||
param.setUserId(getLoginUserId());
|
||||
return success(viewHistoryService.pageRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("查询全部浏览历史")
|
||||
@GetMapping()
|
||||
public ApiResult<List<ViewHistory>> list(ViewHistoryParam param) {
|
||||
// 使用关联查询
|
||||
param.setUserId(getLoginUserId());
|
||||
return success(viewHistoryService.listRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('shop:viewHistory:list')")
|
||||
@ApiOperation("根据id查询浏览历史")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<ViewHistory> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(viewHistoryService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@ApiOperation("添加浏览历史")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody ViewHistory viewHistory) {
|
||||
ViewHistory check = null;
|
||||
if (viewHistory.getType().equals(1)) {
|
||||
if (getLoginUser() != null) {
|
||||
check = viewHistoryService.check(viewHistory.getType(), viewHistory.getPk(), getLoginUserId());
|
||||
viewHistory.setUserId(getLoginUserId());
|
||||
} else {
|
||||
check = viewHistoryService.check(viewHistory.getType(), viewHistory.getPk(), viewHistory.getOpenId());
|
||||
}
|
||||
} else {
|
||||
// 记录当前登录用户id
|
||||
User loginUser = getLoginUser();
|
||||
if (loginUser != null) {
|
||||
viewHistory.setUserId(loginUser.getUserId());
|
||||
}
|
||||
check = viewHistoryService.check(viewHistory.getType(), viewHistory.getPk(), getLoginUserId());
|
||||
}
|
||||
if (check == null) {
|
||||
if (viewHistoryService.save(viewHistory)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
}
|
||||
return fail("已经浏览过了");
|
||||
}
|
||||
|
||||
@ApiOperation("修改浏览历史")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody ViewHistory viewHistory) {
|
||||
if (viewHistoryService.updateById(viewHistory)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("删除浏览历史")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (viewHistoryService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量添加浏览历史")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<ViewHistory> list) {
|
||||
if (viewHistoryService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量修改浏览历史")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<ViewHistory> batchParam) {
|
||||
if (batchParam.update(viewHistoryService, "id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量删除浏览历史")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (viewHistoryService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,9 +2,12 @@ package com.gxwebsoft.shop.controller;
|
||||
|
||||
import cn.binarywang.wx.miniapp.api.WxMaQrcodeService;
|
||||
import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||
import cn.binarywang.wx.miniapp.api.WxMaSubscribeService;
|
||||
import cn.binarywang.wx.miniapp.api.impl.WxMaQrcodeServiceImpl;
|
||||
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl;
|
||||
import cn.binarywang.wx.miniapp.api.impl.WxMaSubscribeServiceImpl;
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaCodeLineColor;
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaSubscribeMessage;
|
||||
import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
@@ -18,6 +21,7 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.common.error.WxRuntimeException;
|
||||
import me.chanjar.weixin.mp.api.WxMpMassMessageService;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@@ -44,11 +48,12 @@ public class WeChatController extends BaseController {
|
||||
|
||||
@ApiOperation("好友代付二维码")
|
||||
@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 + "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);
|
||||
if (FileUtil.exist(filepath + "/" + filename))
|
||||
return success("生成成功", "file/qrcode/" + getTenantId() + filename);
|
||||
try {
|
||||
makeQr(request, filename, order.getOrderId().toString(), "pages/index/index");
|
||||
} catch (IOException | WxErrorException e) {
|
||||
@@ -70,7 +75,7 @@ public class WeChatController extends BaseController {
|
||||
lineColor.setR("0");
|
||||
lineColor.setG("0");
|
||||
lineColor.setB("0");
|
||||
File file = wxMaQrcodeService.createWxaCodeUnlimit(scene, page, false, "develop", 200, false,
|
||||
File file = wxMaQrcodeService.createWxaCodeUnlimit(scene, page, false, "release", 200, false,
|
||||
lineColor, false);
|
||||
file.renameTo(new File(filename));
|
||||
}
|
||||
@@ -94,4 +99,20 @@ public class WeChatController extends BaseController {
|
||||
}).collect(Collectors.toMap(WxMaDefaultConfigImpl::getAppid, a -> a, (o, n) -> o)));
|
||||
return maService;
|
||||
}
|
||||
|
||||
public void sendMessage(String openid, String templateId, String page, List<WxMaSubscribeMessage.MsgData> data) throws WxErrorException {
|
||||
try {
|
||||
WxMaService wxMaService = wxMaService();
|
||||
WxMaSubscribeMessage message = new WxMaSubscribeMessage();
|
||||
message.setToUser(openid);
|
||||
message.setTemplateId(templateId);
|
||||
message.setPage(page);
|
||||
message.setData(data);
|
||||
WxMaSubscribeService wxMaSubscribeService = new WxMaSubscribeServiceImpl(wxMaService);
|
||||
wxMaSubscribeService.sendSubscribeMsg(message);
|
||||
}catch (WxErrorException e) {
|
||||
System.out.println("WxErrorException: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,72 +34,140 @@ import java.util.stream.Collectors;
|
||||
@RestController
|
||||
@RequestMapping("/api/shop/wx-pay/notify/nbg")
|
||||
public class WxPayNotifyNbgController extends BaseController {
|
||||
@Resource
|
||||
private OrderService orderService;
|
||||
@Resource
|
||||
private OrderInfoService orderInfoService;
|
||||
@Resource
|
||||
private OrderGoodsService orderGoodsService;
|
||||
@Resource
|
||||
private GoodsService goodsService;
|
||||
@Resource
|
||||
private UsersService usersService;
|
||||
@Resource
|
||||
private CartService cartService;
|
||||
@Resource
|
||||
private OrderService orderService;
|
||||
@Resource
|
||||
private OrderInfoService orderInfoService;
|
||||
@Resource
|
||||
private OrderGoodsService orderGoodsService;
|
||||
@Resource
|
||||
private GoodsService goodsService;
|
||||
@Resource
|
||||
private UsersService usersService;
|
||||
@Resource
|
||||
private CartService cartService;
|
||||
@Resource
|
||||
private GoodsStockInMerchantService goodsStockInMerchantService;
|
||||
@Resource
|
||||
private MerchantService merchantService;
|
||||
@Resource
|
||||
private MerchantChargePackageService merchantChargePackageService;
|
||||
@Resource
|
||||
private UserBalanceInMerchantService userBalanceInMerchantService;
|
||||
@Resource
|
||||
private MerchantGoodsPackageService merchantGoodsPackageService;
|
||||
@Resource
|
||||
private UserGoodsInMerchantService userGoodsInMerchantService;
|
||||
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
@ApiModelProperty("微信支付通知")
|
||||
@PostMapping()
|
||||
public String demo(@RequestBody Transaction transaction){
|
||||
@ApiModelProperty("微信支付通知")
|
||||
@PostMapping()
|
||||
public String demo(@RequestBody Transaction transaction) {
|
||||
return doPay(transaction);
|
||||
}
|
||||
|
||||
System.out.println("支付通知 >>>>> ");
|
||||
System.out.println("transaction = " + transaction);
|
||||
public String doPay(Transaction transaction){
|
||||
System.out.println("支付通知 >>>>> ");
|
||||
System.out.println("transaction = " + transaction);
|
||||
|
||||
// TODO 1.查询订单信息
|
||||
final Order order = orderService.getByOutTradeNo(transaction.getOutTradeNo());
|
||||
// TODO 2.更新订单支付状态
|
||||
order.setPayStatus(1);
|
||||
order.setTransactionId(transaction.getTransactionId());
|
||||
order.setPayPrice(new BigDecimal(NumberUtil.decimalFormat("0.00", transaction.getAmount().getTotal() * 0.01)));
|
||||
order.setPayTime(DateUtil.date());
|
||||
order.setExpirationTime(DateUtil.offset(DateUtil.date(), DateField.YEAR, 10));
|
||||
orderService.updateById(order);
|
||||
// TODO 3.更新订单商品的支付状态
|
||||
if (order.getType().equals(0)) {
|
||||
final boolean update = orderGoodsService.update(new LambdaUpdateWrapper<OrderGoods>().eq(OrderGoods::getOrderId, order.getOrderId()).set(OrderGoods::getPayStatus, 1));
|
||||
System.out.println("update1 = " + update);
|
||||
// TODO 3.1 更新商品销量、库存数量
|
||||
final List<OrderGoods> orderGoods = orderGoodsService.list(new LambdaQueryWrapper<OrderGoods>().eq(OrderGoods::getOrderId, order.getOrderId()));
|
||||
final Set<Integer> goodsIds = orderGoods.stream().map(OrderGoods::getGoodsId).collect(Collectors.toSet());
|
||||
final Map<Integer, List<OrderGoods>> collectGoods = orderGoods.stream().collect(Collectors.groupingBy(OrderGoods::getGoodsId));
|
||||
final List<Goods> goods = goodsService.list(new LambdaQueryWrapper<Goods>().in(Goods::getGoodsId, goodsIds));
|
||||
for (Goods g : goods) {
|
||||
final List<OrderGoods> goods1 = collectGoods.get(g.getGoodsId());
|
||||
final OrderGoods goods2 = goods1.get(0);
|
||||
g.setSales(g.getSales() + goods2.getTotalNum());
|
||||
if (g.getStock().compareTo(0) >= 0) {
|
||||
g.setStock(g.getStock() - goods2.getTotalNum());
|
||||
// TODO 1.查询订单信息
|
||||
final Order order = orderService.getByOutTradeNo(transaction.getOutTradeNo());
|
||||
// TODO 2.更新订单支付状态
|
||||
order.setPayStatus(1);
|
||||
order.setTransactionId(transaction.getTransactionId());
|
||||
order.setPayPrice(new BigDecimal(NumberUtil.decimalFormat("0.00", transaction.getAmount().getTotal() * 0.01)));
|
||||
order.setPayTime(DateUtil.date());
|
||||
order.setExpirationTime(DateUtil.offset(DateUtil.date(), DateField.YEAR, 10));
|
||||
orderService.updateById(order);
|
||||
// TODO 3.更新订单商品的支付状态
|
||||
if (order.getType().equals(0)) {
|
||||
final boolean update = orderGoodsService.update(new LambdaUpdateWrapper<OrderGoods>().eq(OrderGoods::getOrderId, order.getOrderId()).set(OrderGoods::getPayStatus, 1));
|
||||
System.out.println("update1 = " + update);
|
||||
// TODO 3.1 更新商品销量、库存数量
|
||||
final List<OrderGoods> orderGoods = orderGoodsService.listByOrderId(order.getOrderId());
|
||||
final Set<Integer> goodsIds = orderGoods.stream().map(OrderGoods::getGoodsId).collect(Collectors.toSet());
|
||||
final Map<Integer, List<OrderGoods>> collectGoods = orderGoods.stream().collect(Collectors.groupingBy(OrderGoods::getGoodsId));
|
||||
final List<Goods> goods = goodsService.list(new LambdaQueryWrapper<Goods>().in(Goods::getGoodsId, goodsIds));
|
||||
for (Goods g : goods) {
|
||||
final List<OrderGoods> goods1 = collectGoods.get(g.getGoodsId());
|
||||
final OrderGoods goods2 = goods1.get(0);
|
||||
g.setSales(g.getSales() + goods2.getTotalNum());
|
||||
if (g.getStock().compareTo(0) >= 0) {
|
||||
g.setStock(g.getStock() - goods2.getTotalNum());
|
||||
}
|
||||
}
|
||||
final boolean batchById = goodsService.updateBatchById(goods);
|
||||
System.out.println("batchById = " + batchById);
|
||||
if (order.getDeliveryType().equals(0)) {
|
||||
// 分配最近的店铺
|
||||
List<Merchant> goodsStockInMerchantList =
|
||||
merchantService.listByDistance(order.getAddressLat(), order.getAddressLng(), "供应商");
|
||||
System.out.println("goodsStockInMerchantList" + goodsStockInMerchantList);
|
||||
if (!goodsStockInMerchantList.isEmpty()) {
|
||||
order.setExpressMerchantId(goodsStockInMerchantList.get(0).getMerchantId());
|
||||
order.setExpressMerchantName(goodsStockInMerchantList.get(0).getMerchantName());
|
||||
orderService.updateById(order);
|
||||
}
|
||||
}
|
||||
} else if (order.getType().equals(1)) {
|
||||
final boolean update = orderInfoService.update(
|
||||
new LambdaUpdateWrapper<OrderInfo>()
|
||||
.eq(OrderInfo::getOrderId, order.getOrderId())
|
||||
.set(OrderInfo::getPayStatus, 1)
|
||||
);
|
||||
System.out.println("update2 = " + update);
|
||||
final List<OrderGoods> orderGoods = orderGoodsService.listByOrderId(order.getOrderId());
|
||||
final Set<Integer> goodsIds = orderGoods.stream().map(OrderGoods::getGoodsId).collect(Collectors.toSet());
|
||||
final Map<Integer, List<OrderGoods>> collectGoods = orderGoods.stream().collect(Collectors.groupingBy(OrderGoods::getGoodsId));
|
||||
final List<Goods> goods = goodsService.list(new LambdaQueryWrapper<Goods>().in(Goods::getGoodsId, goodsIds));
|
||||
for (Goods g : goods) {
|
||||
final List<OrderGoods> goods1 = collectGoods.get(g.getGoodsId());
|
||||
final OrderGoods goods2 = goods1.get(0);
|
||||
g.setSales(g.getSales() + goods2.getTotalNum());
|
||||
}
|
||||
} else if (order.getType().equals(3)) {
|
||||
// 门店充值
|
||||
final List<OrderGoods> orderGoods = orderGoodsService.listByOrderId(order.getOrderId());
|
||||
MerchantChargePackage merchantChargePackage = merchantChargePackageService.getById(orderGoods.get(0).getGoodsId());
|
||||
UserBalanceInMerchant userBalanceInMerchant = userBalanceInMerchantService.getBalance(order.getMerchantId(), order.getUserId());
|
||||
BigDecimal balance = merchantChargePackage.getAmount().add(merchantChargePackage.getSendAmount());
|
||||
if (userBalanceInMerchant == null) {
|
||||
userBalanceInMerchant = new UserBalanceInMerchant();
|
||||
userBalanceInMerchant.setUserId(order.getUserId());
|
||||
userBalanceInMerchant.setMerchantId(order.getMerchantId());
|
||||
userBalanceInMerchant.setBalance(balance);
|
||||
userBalanceInMerchantService.save(userBalanceInMerchant);
|
||||
} else {
|
||||
userBalanceInMerchant.setBalance(userBalanceInMerchant.getBalance().add(balance));
|
||||
userBalanceInMerchantService.updateById(userBalanceInMerchant);
|
||||
}
|
||||
} else if (order.getType().equals(4)) {
|
||||
// 门店商品套餐
|
||||
final List<OrderGoods> orderGoods = orderGoodsService.listByOrderId(order.getOrderId());
|
||||
MerchantGoodsPackage merchantGoodsPackage = merchantGoodsPackageService.getById(orderGoods.get(0).getGoodsId());
|
||||
UserGoodsInMerchant userGoodsInMerchant = userGoodsInMerchantService.infoInMerchant(merchantGoodsPackage.getId(), order.getUserId());
|
||||
if (userGoodsInMerchant == null) {
|
||||
userGoodsInMerchant = new UserGoodsInMerchant();
|
||||
userGoodsInMerchant.setUserId(order.getUserId());
|
||||
userGoodsInMerchant.setPackageId(merchantGoodsPackage.getId());
|
||||
userGoodsInMerchant.setRemainNum(merchantGoodsPackage.getGetNum());
|
||||
userGoodsInMerchantService.save(userGoodsInMerchant);
|
||||
} else {
|
||||
userGoodsInMerchant.setRemainNum(userGoodsInMerchant.getRemainNum() + merchantGoodsPackage.getGetNum());
|
||||
userGoodsInMerchantService.updateById(userGoodsInMerchant);
|
||||
}
|
||||
}
|
||||
}
|
||||
final boolean batchById = goodsService.updateBatchById(goods);
|
||||
System.out.println("batchById = " + batchById);
|
||||
|
||||
// TODO 4. 清除购物车
|
||||
final boolean remove = cartService.remove(new LambdaQueryWrapper<Cart>().eq(Cart::getUserId, order.getUserId()).eq(Cart::getIsNew, true));
|
||||
System.out.println("remove = " + remove);
|
||||
orderService.settle(order);
|
||||
|
||||
// TODO 5.累计会员积分
|
||||
|
||||
|
||||
return "订单已支付";
|
||||
}
|
||||
if (order.getType().equals(1)) {
|
||||
final boolean update = orderInfoService.update(new LambdaUpdateWrapper<OrderInfo>().eq(OrderInfo::getOrderId, order.getOrderId()).set(OrderInfo::getPayStatus, 1));
|
||||
System.out.println("update2 = " + update);
|
||||
// TODO 3.2 更新订单类型为预定的关联订单信息
|
||||
}
|
||||
|
||||
// TODO 4. 清除购物车
|
||||
final boolean remove = cartService.remove(new LambdaQueryWrapper<Cart>().eq(Cart::getUserId, order.getUserId()).eq(Cart::getIsNew, true));
|
||||
System.out.println("remove = " + remove);
|
||||
orderService.settle(order);
|
||||
|
||||
// TODO 5.累计会员积分
|
||||
|
||||
return "订单已支付";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
61
src/main/java/com/gxwebsoft/shop/entity/CommissionRole.java
Normal file
61
src/main/java/com/gxwebsoft/shop/entity/CommissionRole.java
Normal file
@@ -0,0 +1,61 @@
|
||||
package com.gxwebsoft.shop.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.gxwebsoft.common.system.entity.Area;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 分红角色
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-12-02 12:43:40
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "CommissionRole对象", description = "分红角色")
|
||||
@TableName("shop_commission_role")
|
||||
public class CommissionRole implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
private String title;
|
||||
|
||||
private Integer provinceId;
|
||||
|
||||
private Integer cityId;
|
||||
|
||||
private Integer regionId;
|
||||
|
||||
@ApiModelProperty(value = "状态, 0正常, 1异常")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String comments;
|
||||
|
||||
@ApiModelProperty(value = "租户id")
|
||||
private Integer tenantId;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Area province;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Area city;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Area region;
|
||||
}
|
||||
@@ -1,11 +1,15 @@
|
||||
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;
|
||||
import java.time.LocalDateTime;
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
@@ -73,4 +77,9 @@ public class DealerOrder implements Serializable {
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Order order;
|
||||
|
||||
@TableField(exist = false)
|
||||
private User user;
|
||||
}
|
||||
|
||||
62
src/main/java/com/gxwebsoft/shop/entity/ExpressTemplate.java
Normal file
62
src/main/java/com/gxwebsoft/shop/entity/ExpressTemplate.java
Normal file
@@ -0,0 +1,62 @@
|
||||
package com.gxwebsoft.shop.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 运费模板
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-11-05 18:03:28
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "ExpressTemplate对象", description = "运费模板")
|
||||
@TableName("shop_express_template")
|
||||
public class ExpressTemplate implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
private String title;
|
||||
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "首件价格")
|
||||
private BigDecimal firstAmount;
|
||||
private BigDecimal firstNum;
|
||||
|
||||
@ApiModelProperty(value = "续件价格")
|
||||
private BigDecimal extraAmount;
|
||||
private BigDecimal extraNum;
|
||||
|
||||
@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;
|
||||
|
||||
@ApiModelProperty(value = "详情")
|
||||
@TableField(exist = false)
|
||||
private List<ExpressTemplateDetail> detailList;
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.gxwebsoft.shop.entity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
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-11-05 18:03:28
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "ExpressTemplateDetail对象", description = "运费模板")
|
||||
@TableName("shop_express_template_detail")
|
||||
public class ExpressTemplateDetail implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
private Integer templateId;
|
||||
|
||||
@ApiModelProperty(value = "0按件")
|
||||
private Integer type;
|
||||
|
||||
private Integer provinceId;
|
||||
|
||||
private Integer cityId;
|
||||
|
||||
@ApiModelProperty(value = "首件价格")
|
||||
private BigDecimal firstAmount;
|
||||
|
||||
private BigDecimal firstNum;
|
||||
|
||||
@ApiModelProperty(value = "续件价格")
|
||||
private BigDecimal extraAmount;
|
||||
|
||||
private BigDecimal extraNum;
|
||||
|
||||
@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;
|
||||
|
||||
}
|
||||
@@ -74,9 +74,15 @@ public class Goods implements Serializable {
|
||||
@ApiModelProperty(value = "单位名称")
|
||||
private String unitName;
|
||||
|
||||
@ApiModelProperty(value = "重量(kg)")
|
||||
private BigDecimal weight;
|
||||
|
||||
@ApiModelProperty(value = "消费赚取积分")
|
||||
private BigDecimal gainIntegral;
|
||||
|
||||
@ApiModelProperty(value = "原价")
|
||||
private BigDecimal originPrice;
|
||||
|
||||
@ApiModelProperty(value = "进货价格")
|
||||
private BigDecimal price;
|
||||
|
||||
@@ -92,14 +98,18 @@ public class Goods implements Serializable {
|
||||
@ApiModelProperty(value = "销售价格")
|
||||
private BigDecimal salePrice;
|
||||
|
||||
@ApiModelProperty(value = "进货价")
|
||||
@ApiModelProperty(value = "批发价")
|
||||
private BigDecimal buyingPrice;
|
||||
|
||||
@ApiModelProperty(value = "批发价是否开启")
|
||||
private Integer buyingPriceOpen;
|
||||
|
||||
@ApiModelProperty(value = "经销商价格")
|
||||
private BigDecimal dealerPrice;
|
||||
|
||||
@ApiModelProperty(value = "连锁店价格")
|
||||
@ApiModelProperty(value = "成本价")
|
||||
private BigDecimal chainStorePrice;
|
||||
|
||||
private BigDecimal chainStoreRate;
|
||||
|
||||
@ApiModelProperty(value = "会员店价格")
|
||||
@@ -146,12 +156,17 @@ public class Goods implements Serializable {
|
||||
@ApiModelProperty(value = "商品重量")
|
||||
private Integer goodsWeight;
|
||||
|
||||
@ApiModelProperty(value = "是否开启分红角色")
|
||||
private Integer commissionRole;
|
||||
|
||||
@ApiModelProperty(value = "推荐")
|
||||
private Integer recommend;
|
||||
|
||||
@ApiModelProperty(value = "商户ID")
|
||||
private Integer merchantId;
|
||||
|
||||
private Integer expressTemplateId;
|
||||
|
||||
private Integer canExpress;
|
||||
|
||||
@ApiModelProperty(value = "商户名称")
|
||||
@@ -186,6 +201,12 @@ public class Goods implements Serializable {
|
||||
@ApiModelProperty(value = "租户id")
|
||||
private Integer tenantId;
|
||||
|
||||
private String canUseDate;
|
||||
|
||||
private String ensureTag;
|
||||
|
||||
private Integer expiredDay;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@@ -246,6 +267,14 @@ public class Goods implements Serializable {
|
||||
@TableField(exist = false)
|
||||
private String childrenName;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "运费模板")
|
||||
public ExpressTemplate expressTemplate;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "角色分红")
|
||||
public List<GoodsRoleCommission> goodsRoleCommission;
|
||||
|
||||
public String getParentPath() {
|
||||
if (ObjectUtil.isNotEmpty(this.parentId)) {
|
||||
return "/product/".concat(this.parentId.toString());
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.gxwebsoft.shop.entity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.time.LocalDateTime;
|
||||
import java.io.Serializable;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 商品绑定角色的分润金额
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-12-02 12:43:40
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "GoodsRoleCommission对象", description = "商品绑定角色的分润金额")
|
||||
@TableName("shop_goods_role_commission")
|
||||
public class GoodsRoleCommission implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
private Integer roleId;
|
||||
|
||||
private Integer goodsId;
|
||||
|
||||
private String sku;
|
||||
|
||||
private BigDecimal amount;
|
||||
|
||||
@ApiModelProperty(value = "状态, 0正常, 1异常")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String comments;
|
||||
|
||||
@ApiModelProperty(value = "租户id")
|
||||
private Integer tenantId;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@@ -45,7 +45,10 @@ public class GoodsSku implements Serializable {
|
||||
@ApiModelProperty(value = "商品价格")
|
||||
private BigDecimal price;
|
||||
|
||||
@ApiModelProperty(value = "市场价格")
|
||||
@ApiModelProperty(value = "市场价")
|
||||
private BigDecimal originPrice;
|
||||
|
||||
@ApiModelProperty(value = "会员价")
|
||||
private BigDecimal salePrice;
|
||||
|
||||
@ApiModelProperty(value = "成本价")
|
||||
@@ -81,6 +84,21 @@ public class GoodsSku implements Serializable {
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "会员店直推分佣")
|
||||
private BigDecimal memberStoreCommission;
|
||||
|
||||
@ApiModelProperty(value = "供应商直推分佣")
|
||||
private BigDecimal supplierCommission;
|
||||
|
||||
@ApiModelProperty(value = "批发价")
|
||||
private BigDecimal buyingPrice;
|
||||
|
||||
@ApiModelProperty(value = "批发价是否开启")
|
||||
private Integer buyingPriceOpen;
|
||||
|
||||
@ApiModelProperty(value = "成本价")
|
||||
private BigDecimal chainStorePrice;
|
||||
|
||||
@ApiModelProperty(value = "商品图片对象")
|
||||
@TableField(exist = false)
|
||||
private List<Object> images;
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.gxwebsoft.shop.entity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
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-11-20 01:55:04
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "MerchantChargePackage对象", description = "商家充值套餐")
|
||||
@TableName("shop_merchant_charge_package")
|
||||
public class MerchantChargePackage implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "金额")
|
||||
private BigDecimal amount;
|
||||
|
||||
@ApiModelProperty(value = "赠送金额")
|
||||
private BigDecimal sendAmount;
|
||||
|
||||
private Integer merchantId;
|
||||
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "0待审核1通过2拒绝")
|
||||
private Boolean status;
|
||||
|
||||
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
||||
private Integer sortNumber;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String comments;
|
||||
|
||||
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||
@TableLogic
|
||||
private Integer deleted;
|
||||
|
||||
@ApiModelProperty(value = "租户id")
|
||||
private Integer tenantId;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.gxwebsoft.shop.entity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 商家充值套餐
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-11-20 01:55:04
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "MerchantGoodsPackage对象", description = "商家充值套餐")
|
||||
@TableName("shop_merchant_goods_package")
|
||||
public class MerchantGoodsPackage implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "金额")
|
||||
private BigDecimal amount;
|
||||
|
||||
@ApiModelProperty(value = "可使用次数")
|
||||
private Integer getNum;
|
||||
|
||||
private Integer merchantId;
|
||||
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "0待审核1通过2拒绝")
|
||||
private Boolean status;
|
||||
|
||||
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
||||
private Integer sortNumber;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String comments;
|
||||
|
||||
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||
@TableLogic
|
||||
private Integer deleted;
|
||||
|
||||
@ApiModelProperty(value = "租户id")
|
||||
private Integer tenantId;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<Integer> goodsIdList;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<Goods> goodsList;
|
||||
|
||||
@TableField(exist = false)
|
||||
private UserGoodsInMerchant userPackage;
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.gxwebsoft.shop.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-11-20 01:55:04
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "MerchantPackageGoods对象", description = "商家套餐可使用的商品")
|
||||
@TableName("shop_merchant_package_goods")
|
||||
public class MerchantPackageGoods implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
private Integer packageId;
|
||||
|
||||
private Integer goodsId;
|
||||
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "0待审核1通过2拒绝")
|
||||
private Boolean status;
|
||||
|
||||
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
||||
private Integer sortNumber;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String comments;
|
||||
|
||||
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||
@TableLogic
|
||||
private Integer deleted;
|
||||
|
||||
@ApiModelProperty(value = "租户id")
|
||||
private Integer tenantId;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
}
|
||||
51
src/main/java/com/gxwebsoft/shop/entity/Message.java
Normal file
51
src/main/java/com/gxwebsoft/shop/entity/Message.java
Normal file
@@ -0,0 +1,51 @@
|
||||
package com.gxwebsoft.shop.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.time.LocalDateTime;
|
||||
import java.io.Serializable;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-11-18 22:03:11
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "Message对象", description = "")
|
||||
@TableName("shop_message")
|
||||
public class Message implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
private String type;
|
||||
|
||||
private Integer pk;
|
||||
|
||||
private String title;
|
||||
|
||||
private String phone;
|
||||
|
||||
private String nickname;
|
||||
|
||||
private String content;
|
||||
|
||||
private Integer userId;
|
||||
|
||||
private Integer hasRead;
|
||||
|
||||
@ApiModelProperty(value = "租户id")
|
||||
private Integer tenantId;
|
||||
|
||||
@ApiModelProperty(value = "注册时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@@ -33,7 +33,7 @@ public class Order implements Serializable {
|
||||
@TableId(value = "order_id", type = IdType.AUTO)
|
||||
private Integer orderId;
|
||||
|
||||
@ApiModelProperty(value = "订单类型,0商城订单 1预定订单 2会员卡")
|
||||
@ApiModelProperty(value = "订单类型,0商城订单 1预定订单 2会员卡 3门店充值 4门店套餐")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "类型,0快递 1自提")
|
||||
@@ -67,6 +67,15 @@ public class Order implements Serializable {
|
||||
@ApiModelProperty(value = "使用的优惠券id")
|
||||
private Integer couponId;
|
||||
|
||||
@ApiModelProperty(value = "省")
|
||||
private Integer provinceId;
|
||||
|
||||
@ApiModelProperty(value = "市")
|
||||
private Integer cityId;
|
||||
|
||||
@ApiModelProperty(value = "区")
|
||||
private Integer regionId;
|
||||
|
||||
@ApiModelProperty(value = "使用的会员卡id")
|
||||
private Integer cardId;
|
||||
|
||||
@@ -95,6 +104,9 @@ public class Order implements Serializable {
|
||||
@ApiModelProperty(value = "自提码")
|
||||
private String selfTakeCode;
|
||||
|
||||
@ApiModelProperty(value = "配送总额")
|
||||
private BigDecimal expressPrice;
|
||||
|
||||
@ApiModelProperty(value = "订单总额")
|
||||
private BigDecimal totalPrice;
|
||||
|
||||
@@ -123,7 +135,7 @@ public class Order implements Serializable {
|
||||
@ApiModelProperty(value = "教练id")
|
||||
private Integer coachId;
|
||||
|
||||
@ApiModelProperty(value = "0余额支付, 1微信支付,2积分,3支付宝,4现金,5POS机,6VIP月卡,7VIP年卡,8VIP次卡,9IC月卡,10IC年卡,11IC次卡,12免费,13VIP充值卡,14IC充值卡,15积分支付,16VIP季卡,17IC季卡")
|
||||
@ApiModelProperty(value = "0余额支付, 1微信支付,2积分,3支付宝,4现金,5POS机,6VIP月卡,7VIP年卡,8VIP次卡,9IC月卡,10IC年卡,11IC次卡,12免费,13VIP充值卡,14IC充值卡,15积分支付,16VIP季卡,17IC季卡, 18代付, 19门店余额 , 20门店套餐")
|
||||
private Integer payType;
|
||||
|
||||
private Integer friendPayType;
|
||||
@@ -265,4 +277,10 @@ public class Order implements Serializable {
|
||||
|
||||
@TableField(exist = false)
|
||||
private Merchant merchant;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer addressId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer packageId;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.gxwebsoft.shop.entity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
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-11-20 01:55:04
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "UserBalanceInMerchant对象", description = "用户在商家中的余额")
|
||||
@TableName("shop_user_balance_in_merchant")
|
||||
public class UserBalanceInMerchant implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
private Integer merchantId;
|
||||
|
||||
private Integer userId;
|
||||
|
||||
private BigDecimal balance;
|
||||
|
||||
@ApiModelProperty(value = "0待审核1通过2拒绝")
|
||||
private Boolean status;
|
||||
|
||||
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
||||
private Integer sortNumber;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String comments;
|
||||
|
||||
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||
@TableLogic
|
||||
private Integer deleted;
|
||||
|
||||
@ApiModelProperty(value = "租户id")
|
||||
private Integer tenantId;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.gxwebsoft.shop.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.time.LocalDateTime;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 用户绑定分红角色
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-12-02 12:43:40
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "UserCommissionRole对象", description = "用户绑定分红角色")
|
||||
@TableName("shop_user_commission_role")
|
||||
public class UserCommissionRole implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
private Integer roleId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<Integer> roleIds;
|
||||
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "状态, 0正常, 1异常")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String comments;
|
||||
|
||||
@ApiModelProperty(value = "租户id")
|
||||
private Integer tenantId;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.gxwebsoft.shop.entity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
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-11-20 01:55:04
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "UserGoodsInMerchant对象", description = "用户在商家中的代金券")
|
||||
@TableName("shop_user_goods_in_merchant")
|
||||
public class UserGoodsInMerchant implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
private Integer userId;
|
||||
|
||||
private Integer packageId;
|
||||
|
||||
private Integer remainNum;
|
||||
|
||||
@ApiModelProperty(value = "0待审核1通过2拒绝")
|
||||
private Boolean status;
|
||||
|
||||
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
||||
private Integer sortNumber;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String comments;
|
||||
|
||||
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||
@TableLogic
|
||||
private Integer deleted;
|
||||
|
||||
@ApiModelProperty(value = "租户id")
|
||||
private Integer tenantId;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
}
|
||||
54
src/main/java/com/gxwebsoft/shop/entity/ViewHistory.java
Normal file
54
src/main/java/com/gxwebsoft/shop/entity/ViewHistory.java
Normal file
@@ -0,0 +1,54 @@
|
||||
package com.gxwebsoft.shop.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.io.Serializable;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 浏览历史
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-11-22 22:13:47
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "ViewHistory对象", description = "浏览历史")
|
||||
@TableName("shop_view_history")
|
||||
public class ViewHistory implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
private Integer type;
|
||||
|
||||
private Integer pk;
|
||||
|
||||
private Integer userId;
|
||||
|
||||
private String openId;
|
||||
|
||||
@ApiModelProperty(value = "排序号")
|
||||
private Integer sortNumber;
|
||||
|
||||
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||
@TableLogic
|
||||
private Integer deleted;
|
||||
|
||||
@ApiModelProperty(value = "租户id")
|
||||
private Integer tenantId;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Goods goods;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.gxwebsoft.shop.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.gxwebsoft.shop.entity.CommissionRole;
|
||||
import com.gxwebsoft.shop.param.CommissionRoleParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 分红角色Mapper
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-12-02 12:43:40
|
||||
*/
|
||||
public interface CommissionRoleMapper extends BaseMapper<CommissionRole> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param param 查询参数
|
||||
* @return List<CommissionRole>
|
||||
*/
|
||||
List<CommissionRole> selectPageRel(@Param("page") IPage<CommissionRole> page,
|
||||
@Param("param") CommissionRoleParam param);
|
||||
|
||||
/**
|
||||
* 查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<User>
|
||||
*/
|
||||
List<CommissionRole> selectListRel(@Param("param") CommissionRoleParam param);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.gxwebsoft.shop.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.gxwebsoft.shop.entity.ExpressTemplateDetail;
|
||||
import com.gxwebsoft.shop.param.ExpressTemplateDetailParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 运费模板Mapper
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-11-05 18:03:28
|
||||
*/
|
||||
public interface ExpressTemplateDetailMapper extends BaseMapper<ExpressTemplateDetail> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param param 查询参数
|
||||
* @return List<ExpressTemplateDetail>
|
||||
*/
|
||||
List<ExpressTemplateDetail> selectPageRel(@Param("page") IPage<ExpressTemplateDetail> page,
|
||||
@Param("param") ExpressTemplateDetailParam param);
|
||||
|
||||
/**
|
||||
* 查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<User>
|
||||
*/
|
||||
List<ExpressTemplateDetail> selectListRel(@Param("param") ExpressTemplateDetailParam param);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.gxwebsoft.shop.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.gxwebsoft.shop.entity.ExpressTemplate;
|
||||
import com.gxwebsoft.shop.param.ExpressTemplateParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 运费模板Mapper
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-11-05 18:03:28
|
||||
*/
|
||||
public interface ExpressTemplateMapper extends BaseMapper<ExpressTemplate> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param param 查询参数
|
||||
* @return List<ExpressTemplate>
|
||||
*/
|
||||
List<ExpressTemplate> selectPageRel(@Param("page") IPage<ExpressTemplate> page,
|
||||
@Param("param") ExpressTemplateParam param);
|
||||
|
||||
/**
|
||||
* 查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<User>
|
||||
*/
|
||||
List<ExpressTemplate> selectListRel(@Param("param") ExpressTemplateParam param);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.gxwebsoft.shop.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.gxwebsoft.shop.entity.GoodsRoleCommission;
|
||||
import com.gxwebsoft.shop.param.GoodsRoleCommissionParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品绑定角色的分润金额Mapper
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-12-02 12:43:40
|
||||
*/
|
||||
public interface GoodsRoleCommissionMapper extends BaseMapper<GoodsRoleCommission> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param param 查询参数
|
||||
* @return List<GoodsRoleCommission>
|
||||
*/
|
||||
List<GoodsRoleCommission> selectPageRel(@Param("page") IPage<GoodsRoleCommission> page,
|
||||
@Param("param") GoodsRoleCommissionParam param);
|
||||
|
||||
/**
|
||||
* 查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<User>
|
||||
*/
|
||||
List<GoodsRoleCommission> selectListRel(@Param("param") GoodsRoleCommissionParam param);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.gxwebsoft.shop.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.gxwebsoft.shop.entity.MerchantChargePackage;
|
||||
import com.gxwebsoft.shop.param.MerchantChargePackageParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商家充值套餐Mapper
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-11-20 01:55:04
|
||||
*/
|
||||
public interface MerchantChargePackageMapper extends BaseMapper<MerchantChargePackage> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param param 查询参数
|
||||
* @return List<MerchantChargePackage>
|
||||
*/
|
||||
List<MerchantChargePackage> selectPageRel(@Param("page") IPage<MerchantChargePackage> page,
|
||||
@Param("param") MerchantChargePackageParam param);
|
||||
|
||||
/**
|
||||
* 查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<User>
|
||||
*/
|
||||
List<MerchantChargePackage> selectListRel(@Param("param") MerchantChargePackageParam param);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.gxwebsoft.shop.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.gxwebsoft.shop.entity.MerchantGoodsPackage;
|
||||
import com.gxwebsoft.shop.param.MerchantGoodsPackageParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商家充值套餐Mapper
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-11-20 01:55:04
|
||||
*/
|
||||
public interface MerchantGoodsPackageMapper extends BaseMapper<MerchantGoodsPackage> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param param 查询参数
|
||||
* @return List<MerchantGoodsPackage>
|
||||
*/
|
||||
List<MerchantGoodsPackage> selectPageRel(@Param("page") IPage<MerchantGoodsPackage> page,
|
||||
@Param("param") MerchantGoodsPackageParam param);
|
||||
|
||||
/**
|
||||
* 查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<User>
|
||||
*/
|
||||
List<MerchantGoodsPackage> selectListRel(@Param("param") MerchantGoodsPackageParam param);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.gxwebsoft.shop.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.gxwebsoft.shop.entity.MerchantPackageGoods;
|
||||
import com.gxwebsoft.shop.param.MerchantPackageGoodsParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商家套餐可使用的商品Mapper
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-11-20 01:55:04
|
||||
*/
|
||||
public interface MerchantPackageGoodsMapper extends BaseMapper<MerchantPackageGoods> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param param 查询参数
|
||||
* @return List<MerchantPackageGoods>
|
||||
*/
|
||||
List<MerchantPackageGoods> selectPageRel(@Param("page") IPage<MerchantPackageGoods> page,
|
||||
@Param("param") MerchantPackageGoodsParam param);
|
||||
|
||||
/**
|
||||
* 查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<User>
|
||||
*/
|
||||
List<MerchantPackageGoods> selectListRel(@Param("param") MerchantPackageGoodsParam param);
|
||||
|
||||
}
|
||||
37
src/main/java/com/gxwebsoft/shop/mapper/MessageMapper.java
Normal file
37
src/main/java/com/gxwebsoft/shop/mapper/MessageMapper.java
Normal file
@@ -0,0 +1,37 @@
|
||||
package com.gxwebsoft.shop.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.gxwebsoft.shop.entity.Message;
|
||||
import com.gxwebsoft.shop.param.MessageParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Mapper
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-11-18 22:03:11
|
||||
*/
|
||||
public interface MessageMapper extends BaseMapper<Message> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param param 查询参数
|
||||
* @return List<Message>
|
||||
*/
|
||||
List<Message> selectPageRel(@Param("page") IPage<Message> page,
|
||||
@Param("param") MessageParam param);
|
||||
|
||||
/**
|
||||
* 查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<User>
|
||||
*/
|
||||
List<Message> selectListRel(@Param("param") MessageParam param);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.gxwebsoft.shop.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.gxwebsoft.shop.entity.UserBalanceInMerchant;
|
||||
import com.gxwebsoft.shop.param.UserBalanceInMerchantParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户在商家中的余额Mapper
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-11-20 01:55:04
|
||||
*/
|
||||
public interface UserBalanceInMerchantMapper extends BaseMapper<UserBalanceInMerchant> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param param 查询参数
|
||||
* @return List<UserBalanceInMerchant>
|
||||
*/
|
||||
List<UserBalanceInMerchant> selectPageRel(@Param("page") IPage<UserBalanceInMerchant> page,
|
||||
@Param("param") UserBalanceInMerchantParam param);
|
||||
|
||||
/**
|
||||
* 查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<User>
|
||||
*/
|
||||
List<UserBalanceInMerchant> selectListRel(@Param("param") UserBalanceInMerchantParam param);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.gxwebsoft.shop.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.gxwebsoft.shop.entity.UserCommissionRole;
|
||||
import com.gxwebsoft.shop.param.UserCommissionRoleParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户绑定分红角色Mapper
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-12-02 12:43:40
|
||||
*/
|
||||
public interface UserCommissionRoleMapper extends BaseMapper<UserCommissionRole> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param param 查询参数
|
||||
* @return List<UserCommissionRole>
|
||||
*/
|
||||
List<UserCommissionRole> selectPageRel(@Param("page") IPage<UserCommissionRole> page,
|
||||
@Param("param") UserCommissionRoleParam param);
|
||||
|
||||
/**
|
||||
* 查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<User>
|
||||
*/
|
||||
List<UserCommissionRole> selectListRel(@Param("param") UserCommissionRoleParam param);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.gxwebsoft.shop.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.gxwebsoft.shop.entity.UserGoodsInMerchant;
|
||||
import com.gxwebsoft.shop.param.UserGoodsInMerchantParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户在商家中的代金券Mapper
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-11-20 01:55:04
|
||||
*/
|
||||
public interface UserGoodsInMerchantMapper extends BaseMapper<UserGoodsInMerchant> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param param 查询参数
|
||||
* @return List<UserGoodsInMerchant>
|
||||
*/
|
||||
List<UserGoodsInMerchant> selectPageRel(@Param("page") IPage<UserGoodsInMerchant> page,
|
||||
@Param("param") UserGoodsInMerchantParam param);
|
||||
|
||||
/**
|
||||
* 查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<User>
|
||||
*/
|
||||
List<UserGoodsInMerchant> selectListRel(@Param("param") UserGoodsInMerchantParam param);
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user