Compare commits
No commits in common. 'main' and 'master' have entirely different histories.
@ -0,0 +1,30 @@
|
||||
|
||||
.DS_Store
|
||||
node_modules/
|
||||
dist/
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
**/*.log
|
||||
|
||||
tests/**/coverage/
|
||||
tests/e2e/reports
|
||||
selenium-debug.log
|
||||
|
||||
# Editor directories and files
|
||||
.idea
|
||||
.vscode
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.local
|
||||
target/
|
||||
# Created by .ignore support plugin (hsz.mobi)
|
||||
*.iml
|
||||
*.iws
|
||||
# out
|
||||
**/out/
|
||||
package-lock.json
|
||||
yarn.lock
|
||||
|
@ -0,0 +1,73 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
@ -0,0 +1,12 @@
|
||||
@echo off
|
||||
echo.
|
||||
echo [信息] 清理工程target生成路径。
|
||||
echo.
|
||||
|
||||
%~d0
|
||||
cd %~dp0
|
||||
|
||||
cd ..
|
||||
call mvn clean
|
||||
|
||||
pause
|
@ -0,0 +1,14 @@
|
||||
@echo off
|
||||
echo.
|
||||
echo [信息] 使用Jar命令运行Web工程。
|
||||
echo.
|
||||
|
||||
cd %~dp0
|
||||
cd ../ruoyi-admin/target
|
||||
|
||||
set JAVA_OPTS=-Xms256m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
|
||||
|
||||
java -jar %JAVA_OPTS% ruoyi-admin.jar
|
||||
|
||||
cd bin
|
||||
pause
|
@ -0,0 +1,23 @@
|
||||
package com.bs;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
|
||||
/**
|
||||
* 启动程序
|
||||
*
|
||||
* @author bs
|
||||
*/
|
||||
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
|
||||
@EnableConfigurationProperties
|
||||
public class BsApplication
|
||||
{
|
||||
public static void main(String[] args)
|
||||
{
|
||||
// System.setProperty("spring.devtools.restart.enabled", "false");
|
||||
SpringApplication.run(BsApplication.class, args);
|
||||
System.out.println("(♥◠‿◠)ノ゙ 启动成功 ლ(´ڡ`ლ)゙ ");
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.bs;
|
||||
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||
|
||||
/**
|
||||
* web容器中进行部署
|
||||
*
|
||||
* @author bs
|
||||
*/
|
||||
public class BsServletInitializer extends SpringBootServletInitializer
|
||||
{
|
||||
@Override
|
||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
|
||||
{
|
||||
return application.sources(BsApplication.class);
|
||||
}
|
||||
}
|
@ -0,0 +1,94 @@
|
||||
package com.bs.cm.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.bs.common.annotation.Excel;
|
||||
import com.bs.common.core.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 附件信息对象 cm_attach
|
||||
*
|
||||
* @author bs
|
||||
* @date 2024-03-03
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
@TableName("cm_attach")
|
||||
@Data
|
||||
public class CmAttach extends BaseEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 用户id */
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
@ApiModelProperty(value = "id")
|
||||
private Long id;
|
||||
|
||||
/** 文件组id */
|
||||
|
||||
@Excel(name = "文件组id")
|
||||
@ApiModelProperty(value = "文件组id")
|
||||
private String fileId;
|
||||
|
||||
/** 文件排序 */
|
||||
|
||||
@Excel(name = "文件排序")
|
||||
@ApiModelProperty(value = "文件排序")
|
||||
private Integer fileSort;
|
||||
|
||||
/** 文件名称(编译后) */
|
||||
|
||||
@Excel(name = "文件名称", readConverterExp = "编=译后")
|
||||
@ApiModelProperty(value = "文件名称(编译后)")
|
||||
private String attachName;
|
||||
|
||||
/** 文件类型 */
|
||||
|
||||
@Excel(name = "文件类型")
|
||||
@ApiModelProperty(value = "文件类型")
|
||||
private String attachFileType;
|
||||
|
||||
/** 文件编码类型 */
|
||||
|
||||
@Excel(name = "文件编码类型")
|
||||
@ApiModelProperty(value = "文件编码类型")
|
||||
private String attachContentType;
|
||||
|
||||
/** 文件大小 */
|
||||
|
||||
@Excel(name = "文件大小")
|
||||
@ApiModelProperty(value = "文件大小")
|
||||
private Long attachFileSize;
|
||||
|
||||
/** 文件路径 */
|
||||
|
||||
@Excel(name = "文件路径")
|
||||
@ApiModelProperty(value = "文件路径")
|
||||
private String attachFileUrl;
|
||||
|
||||
/** 文件名(原始) */
|
||||
|
||||
@Excel(name = "文件名", readConverterExp = "原=始")
|
||||
@ApiModelProperty(value = "文件名(原始)")
|
||||
private String oldName;
|
||||
|
||||
/** 文件版本号 */
|
||||
|
||||
@Excel(name = "文件版本号")
|
||||
@ApiModelProperty(value = "文件版本号")
|
||||
private String versionNo;
|
||||
|
||||
/** 备注 */
|
||||
|
||||
@Excel(name = "备注")
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.bs.cm.mapper;
|
||||
|
||||
import com.bs.common.mybatis.mapper.BaseMapperX;
|
||||
import com.bs.cm.domain.CmAttach;
|
||||
|
||||
/**
|
||||
* 附件信息Mapper接口
|
||||
*
|
||||
* @author bs
|
||||
* @date 2024-03-03
|
||||
*/
|
||||
public interface CmAttachMapper extends BaseMapperX<CmAttach> {
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.bs.cm.service;
|
||||
|
||||
import com.bs.cm.domain.CmAttach;
|
||||
import com.github.yulichang.base.MPJBaseService;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 附件信息Service接口
|
||||
*
|
||||
* @author bs
|
||||
* @date 2024-03-03
|
||||
*/
|
||||
public interface ICmAttachService extends MPJBaseService<CmAttach>{
|
||||
|
||||
List<CmAttach> uploadFileBatch(MultipartFile[] files, String fileId);
|
||||
}
|
@ -0,0 +1,175 @@
|
||||
package com.bs.df.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.bs.common.annotation.Anonymous;
|
||||
import com.bs.df.domain.DfBrokerProduct;
|
||||
import com.bs.df.domain.DfProductInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.bs.common.annotation.Log;
|
||||
import com.bs.common.core.controller.BaseController;
|
||||
import com.bs.common.core.domain.AjaxResult;
|
||||
import com.bs.common.core.page.TableDataInfo;
|
||||
import com.bs.common.enums.BusinessType;
|
||||
import com.bs.common.utils.poi.ExcelUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import cn.hutool.core.lang.Validator;
|
||||
import com.bs.df.domain.DfProductRecommend;
|
||||
import com.bs.df.service.IDfProductRecommendService;
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 代理产品推荐Controller
|
||||
*
|
||||
* @author bs
|
||||
* @date 2024-09-16
|
||||
*/
|
||||
@Api(tags = "代理产品推荐")
|
||||
@RestController
|
||||
@RequestMapping("/product/recommend")
|
||||
public class DfProductRecommendController extends BaseController {
|
||||
@Resource
|
||||
private IDfProductRecommendService dfProductRecommendService;
|
||||
|
||||
/**
|
||||
* 分页查询代理产品推荐列表
|
||||
*/
|
||||
@ApiOperation("分页查询代理产品推荐列表")
|
||||
@GetMapping("/pageList")
|
||||
public TableDataInfo pageList(DfProductRecommend dfProductRecommend) {
|
||||
startPage();
|
||||
LambdaQueryWrapper<DfProductRecommend> queryWrapper = new LambdaQueryWrapper();
|
||||
condition(queryWrapper,dfProductRecommend);
|
||||
List<DfProductRecommend> list = dfProductRecommendService.list(queryWrapper);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询代理产品推荐列表
|
||||
*/
|
||||
@ApiOperation("查询代理产品推荐列表")
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(DfProductRecommend dfProductRecommend) {
|
||||
LambdaQueryWrapper<DfProductRecommend> queryWrapper = new LambdaQueryWrapper();
|
||||
condition(queryWrapper,dfProductRecommend);
|
||||
List<DfProductRecommend> list = dfProductRecommendService.list(queryWrapper);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出代理产品推荐列表
|
||||
*/
|
||||
@ApiOperation("导出代理产品推荐列表")
|
||||
@Log(title = "代理产品推荐导出", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, DfProductRecommend dfProductRecommend) {
|
||||
LambdaQueryWrapper<DfProductRecommend> queryWrapper = new LambdaQueryWrapper();
|
||||
condition(queryWrapper,dfProductRecommend);
|
||||
List<DfProductRecommend> list = dfProductRecommendService.list(queryWrapper);
|
||||
ExcelUtil<DfProductRecommend> util = new ExcelUtil<DfProductRecommend>(DfProductRecommend. class);
|
||||
util.exportExcel(response, list, "代理产品推荐数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取代理产品推荐详细信息
|
||||
*/
|
||||
@ApiOperation("获取代理产品推荐详细信息")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") String id) {
|
||||
return success(dfProductRecommendService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改代理产品推荐
|
||||
*/
|
||||
@ApiOperation("修改代理产品推荐")
|
||||
@Log(title = "代理产品推荐修改", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/editByProducts")
|
||||
public AjaxResult editByProducts(@RequestBody DfProductRecommend dfProductRecommend) {
|
||||
for (Long productId : dfProductRecommend.getIds()) {
|
||||
DfProductRecommend productRecommend = new DfProductRecommend();
|
||||
productRecommend.setProductId(String.valueOf(productId));
|
||||
productRecommend.setUserId(dfProductRecommend.getUserId());
|
||||
dfProductRecommendService.save(productRecommend);
|
||||
}
|
||||
return toAjax(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增代理产品推荐
|
||||
*/
|
||||
@ApiOperation("新增代理产品推荐")
|
||||
@Log(title = "代理产品推荐新增", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody DfProductRecommend dfProductRecommend) {
|
||||
return toAjax(dfProductRecommendService.save(dfProductRecommend));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改代理产品推荐
|
||||
*/
|
||||
@ApiOperation("修改代理产品推荐")
|
||||
@Log(title = "代理产品推荐修改", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody DfProductRecommend dfProductRecommend) {
|
||||
return toAjax(dfProductRecommendService.updateById(dfProductRecommend));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除代理产品推荐
|
||||
*/
|
||||
@ApiOperation("删除代理产品推荐")
|
||||
@Log(title = "代理产品推荐删除", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable List<Long> ids) {
|
||||
return toAjax(dfProductRecommendService.removeBatchByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除代理产品推荐
|
||||
*/
|
||||
@ApiOperation("移除代理产品推荐")
|
||||
@Log(title = "代理产品推荐移除", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/delInfoByRecommend")
|
||||
public AjaxResult delInfoByRecommend(@RequestBody DfProductRecommend dfProductRecommend) {
|
||||
boolean remove = dfProductRecommendService.remove(new LambdaQueryWrapper<DfProductRecommend>().in(DfProductRecommend::getProductId, dfProductRecommend.getIds())
|
||||
.eq(DfProductRecommend::getUserId, dfProductRecommend.getUserId()));
|
||||
return toAjax(remove);
|
||||
}
|
||||
|
||||
/**
|
||||
* 条件设置
|
||||
*/
|
||||
private void condition (LambdaQueryWrapper<DfProductRecommend> queryWrapper,DfProductRecommend dfProductRecommend){
|
||||
|
||||
|
||||
//主键
|
||||
if(Validator.isNotEmpty(dfProductRecommend.getId())){
|
||||
queryWrapper.eq(DfProductRecommend::getId,dfProductRecommend.getId());
|
||||
}
|
||||
|
||||
//用户id
|
||||
if(Validator.isNotEmpty(dfProductRecommend.getUserId())){
|
||||
queryWrapper.eq(DfProductRecommend::getUserId,dfProductRecommend.getUserId());
|
||||
}
|
||||
|
||||
//产品id
|
||||
if(Validator.isNotEmpty(dfProductRecommend.getProductId())){
|
||||
queryWrapper.eq(DfProductRecommend::getProductId,dfProductRecommend.getProductId());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,150 @@
|
||||
package com.bs.df.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.bs.common.annotation.Excel;
|
||||
import com.bs.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
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.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* 业务线索对象 df_biz_clue
|
||||
*
|
||||
* @author bs
|
||||
* @date 2024-04-06
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
@TableName("df_biz_clue")
|
||||
@Data
|
||||
public class DfBizClue extends BaseEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** id */
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
@ApiModelProperty(value = "id")
|
||||
private Long id;
|
||||
|
||||
/** 数据类型0客户1经纪 */
|
||||
|
||||
@Excel(name = "数据类型",dictType = "product_classify")
|
||||
@ApiModelProperty(value = "数据类型")
|
||||
private String dataType;
|
||||
|
||||
/** 线索类型 */
|
||||
|
||||
@Excel(name = "线索类型",dictType = "clue_type")
|
||||
@ApiModelProperty(value = "线索类型")
|
||||
private String clueType;
|
||||
|
||||
/** 用户id */
|
||||
|
||||
@ApiModelProperty(value = "用户id")
|
||||
private Long userId;
|
||||
|
||||
/** 用户的唯一标识 */
|
||||
|
||||
@ApiModelProperty(value = "用户的唯一标识")
|
||||
private String openId;
|
||||
|
||||
/** 公众号绑定id */
|
||||
|
||||
@ApiModelProperty(value = "公众号绑定id")
|
||||
private String unionId;
|
||||
|
||||
@ApiModelProperty(value = "平台来源")
|
||||
private String fromType;
|
||||
|
||||
/** 用户昵称 */
|
||||
|
||||
@Excel(name = "用户昵称")
|
||||
@ApiModelProperty(value = "用户昵称")
|
||||
private String nickName;
|
||||
|
||||
/** 用户名称 */
|
||||
|
||||
@ApiModelProperty(value = "用户名称")
|
||||
private String userName;
|
||||
|
||||
/** 浏览时间 */
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "浏览时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "浏览时间")
|
||||
private Date browseTime;
|
||||
|
||||
|
||||
@Excel(name = "业务链接")
|
||||
@ApiModelProperty(value = "业务链接")
|
||||
private String businessLinks;
|
||||
|
||||
@Excel(name = "头像链接")
|
||||
@ApiModelProperty(value = "头像链接")
|
||||
private String avatarLink;
|
||||
|
||||
@Excel(name = "手机号")
|
||||
@ApiModelProperty(value = "手机号")
|
||||
private String phone;
|
||||
|
||||
@ApiModelProperty(value = "分享用户")
|
||||
private String shareUser;
|
||||
|
||||
@ApiModelProperty(value = "订单id")
|
||||
private String orderId;
|
||||
|
||||
/** 访问数量 */
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer visitsNum;
|
||||
|
||||
/** 客户数量 */
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer userNum;
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<String> avatarLinks;
|
||||
|
||||
|
||||
/**
|
||||
* 0产品、1名片、2文章
|
||||
*
|
||||
* */
|
||||
|
||||
@TableField(exist = false)
|
||||
private String classify;
|
||||
|
||||
@TableField(exist = false)
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" )
|
||||
private Date createTimeVo;
|
||||
|
||||
/**
|
||||
* 为1时查询
|
||||
*
|
||||
* */
|
||||
@TableField(exist = false)
|
||||
private String hasOrder;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String oldUserId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String newUserId;
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
private Long brokerId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String realName;
|
||||
|
||||
}
|
@ -0,0 +1,113 @@
|
||||
package com.bs.df.domain;
|
||||
|
||||
import com.bs.common.annotation.Excel;
|
||||
import com.bs.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
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.ApiModelProperty;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 代理商经纪对象 df_broker
|
||||
*
|
||||
* @author bs
|
||||
* @date 2024-04-06
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
@TableName("df_broker")
|
||||
@Data
|
||||
public class DfBroker extends BaseEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** id */
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
@ApiModelProperty(value = "id")
|
||||
private Long id;
|
||||
|
||||
/** 父级id */
|
||||
|
||||
//@Excel(name = "上级代理商")
|
||||
@ApiModelProperty(value = "父级id")
|
||||
private Long parentId;
|
||||
|
||||
@Excel(name = "上级代理商")
|
||||
@ApiModelProperty(value = "代理商名称")
|
||||
@TableField(exist = false)
|
||||
private String parentName;
|
||||
|
||||
/** 代理商名称 */
|
||||
|
||||
@Excel(name = "代理商名称")
|
||||
@ApiModelProperty(value = "代理商名称")
|
||||
private String brokerName;
|
||||
|
||||
/** 地址 */
|
||||
|
||||
@Excel(name = "地址")
|
||||
@ApiModelProperty(value = "地址")
|
||||
private String brokerAddress;
|
||||
|
||||
/** 简介 */
|
||||
|
||||
@Excel(name = "简介")
|
||||
@ApiModelProperty(value = "简介")
|
||||
private String brokerDesc;
|
||||
|
||||
/** 显示顺序 */
|
||||
|
||||
@Excel(name = "显示顺序")
|
||||
@ApiModelProperty(value = "显示顺序")
|
||||
private Long orderNum;
|
||||
|
||||
/** 负责人 */
|
||||
|
||||
@Excel(name = "负责人")
|
||||
@ApiModelProperty(value = "负责人")
|
||||
private String chargePerson;
|
||||
|
||||
/** 联系电话 */
|
||||
|
||||
@Excel(name = "联系电话")
|
||||
@ApiModelProperty(value = "联系电话")
|
||||
private String contactPhone;
|
||||
|
||||
/** 邮箱 */
|
||||
|
||||
@Excel(name = "邮箱")
|
||||
@ApiModelProperty(value = "邮箱")
|
||||
private String email;
|
||||
|
||||
/** 是否机构 */
|
||||
|
||||
@Excel(name = "是否机构",dictType = "sys_yes_no")
|
||||
@ApiModelProperty(value = "是否机构")
|
||||
private String isInstitution;
|
||||
|
||||
/** 状态 */
|
||||
|
||||
@Excel(name = "状态",dictType = "df_broker_staus")
|
||||
@ApiModelProperty(value = "状态")
|
||||
private String staus;
|
||||
|
||||
/** 备注 */
|
||||
|
||||
@Excel(name = "备注")
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<DfBroker> children;
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
private Boolean isTopLevel;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
package com.bs.df.domain;
|
||||
|
||||
import com.bs.common.annotation.Excel;
|
||||
import com.bs.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
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.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* 代理产品权限对象 df_broker_product
|
||||
*
|
||||
* @author bs
|
||||
* @date 2024-04-06
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
@TableName("df_broker_product")
|
||||
@Data
|
||||
public class DfBrokerProduct extends BaseEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** id */
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
@ApiModelProperty(value = "id")
|
||||
private Long id;
|
||||
|
||||
/** 代理id */
|
||||
|
||||
@Excel(name = "代理id")
|
||||
@ApiModelProperty(value = "代理id")
|
||||
private Long brokerId;
|
||||
|
||||
/** 产品id */
|
||||
|
||||
@Excel(name = "产品id")
|
||||
@ApiModelProperty(value = "产品id")
|
||||
private Long productId;
|
||||
|
||||
/** 用户id */
|
||||
|
||||
@Excel(name = "用户id")
|
||||
@ApiModelProperty(value = "用户id")
|
||||
private String userId;
|
||||
|
||||
/** 代理商类型 */
|
||||
|
||||
// @Excel(name = "代理商类型")
|
||||
// @ApiModelProperty(value = "代理商类型")
|
||||
// private String type;
|
||||
|
||||
/** 备注 */
|
||||
|
||||
@Excel(name = "备注")
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
/** 状态0草稿1上架 */
|
||||
|
||||
@ApiModelProperty(value = "状态")
|
||||
private String staus;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String brokerName;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,186 @@
|
||||
package com.bs.df.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.bs.common.annotation.Excel;
|
||||
import com.bs.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
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.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* 客户订单对象 df_order
|
||||
*
|
||||
* @author bs
|
||||
* @date 2024-04-06
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
@TableName("df_order")
|
||||
@Data
|
||||
public class DfOrder extends BaseEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** id */
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
@ApiModelProperty(value = "id")
|
||||
private Long id;
|
||||
|
||||
/** 订单号 */
|
||||
|
||||
@Excel(name = "订单号")
|
||||
@ApiModelProperty(value = "订单号")
|
||||
private String orderNo;
|
||||
|
||||
/** 客户id */
|
||||
|
||||
//@Excel(name = "客户id")
|
||||
@ApiModelProperty(value = "客户id")
|
||||
private Long userId;
|
||||
|
||||
// @ApiModelProperty(value = "访客id")
|
||||
// private Long openId;
|
||||
|
||||
/** 客户id */
|
||||
|
||||
@Excel(name = "客户")
|
||||
private String userName;
|
||||
|
||||
|
||||
/** 经纪id */
|
||||
|
||||
//@Excel(name = "经纪id")
|
||||
@ApiModelProperty(value = "经纪id")
|
||||
private Long brokerId;
|
||||
|
||||
@Excel(name = "经纪人")
|
||||
@TableField(exist = false)
|
||||
private String brokerName;
|
||||
|
||||
@Excel(name = "经纪人电话")
|
||||
@TableField(exist = false)
|
||||
private String brokerPhone;
|
||||
|
||||
/** 产品id */
|
||||
|
||||
//@Excel(name = "产品id")
|
||||
@ApiModelProperty(value = "产品id")
|
||||
private Long productId;
|
||||
|
||||
/** 产品名称 */
|
||||
|
||||
@Excel(name = "产品名称")
|
||||
@ApiModelProperty(value = "产品名称")
|
||||
private String productName;
|
||||
|
||||
/** 提交时间 */
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "提交时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "提交时间")
|
||||
private Date submitTime;
|
||||
|
||||
/** 申请额(万元) */
|
||||
|
||||
@Excel(name = "申请额")
|
||||
@ApiModelProperty(value = "申请额(万元)")
|
||||
private BigDecimal applyAmount;
|
||||
|
||||
/** 授信额(万元) */
|
||||
|
||||
@Excel(name = "授信额")
|
||||
@ApiModelProperty(value = "授信额(万元)")
|
||||
private BigDecimal limitAmount;
|
||||
|
||||
/** 放款额(万元) */
|
||||
|
||||
@Excel(name = "放款额")
|
||||
@ApiModelProperty(value = "放款额(万元)")
|
||||
private BigDecimal loanAmount;
|
||||
|
||||
/** 放款利率 */
|
||||
|
||||
@Excel(name = "放款利率")
|
||||
@ApiModelProperty(value = "放款利率")
|
||||
private BigDecimal loanRate;
|
||||
|
||||
/** 贷款期限(月) */
|
||||
|
||||
@Excel(name = "贷款期限")
|
||||
@ApiModelProperty(value = "贷款期限(月)")
|
||||
private Long loadMonth;
|
||||
|
||||
/** 是否首贷 */
|
||||
|
||||
@Excel(name = "是否首贷")
|
||||
@ApiModelProperty(value = "是否首贷")
|
||||
private String isFirst;
|
||||
|
||||
/** 可结算金额(万元) */
|
||||
|
||||
@Excel(name = "可结算金额")
|
||||
@ApiModelProperty(value = "可结算金额(万元)")
|
||||
private Long settleAmount;
|
||||
|
||||
/** 状态 */
|
||||
|
||||
@Excel(name = "状态")
|
||||
@ApiModelProperty(value = "状态")
|
||||
private String staus;
|
||||
|
||||
/** 联系方式 */
|
||||
|
||||
@Excel(name = "联系方式")
|
||||
@ApiModelProperty(value = "联系方式")
|
||||
private String phone;
|
||||
|
||||
/** 备注 */
|
||||
|
||||
@Excel(name = "备注")
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty(value = "分享用户")
|
||||
private String shareUser;
|
||||
|
||||
/** 用户的唯一标识 */
|
||||
|
||||
@ApiModelProperty(value = "用户的唯一标识")
|
||||
private String openId;
|
||||
|
||||
/** 公众号绑定id */
|
||||
|
||||
@ApiModelProperty(value = "公众号绑定id")
|
||||
private String unionId;
|
||||
|
||||
@ApiModelProperty(value = "平台来源")
|
||||
private String fromType;
|
||||
|
||||
@TableField(exist = false)
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" )
|
||||
private Date createTimeVo;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@TableField(exist = false)
|
||||
private Date submitTimeBegin;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@TableField(exist = false)
|
||||
private Date submitTimeEnd;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String orderByColumn;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String isAsc;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String userOrProduct;
|
||||
|
||||
}
|
@ -0,0 +1,99 @@
|
||||
package com.bs.df.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.bs.cm.domain.CmAttach;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.bs.common.annotation.Excel;
|
||||
import com.bs.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
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.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* 产品文章对象 df_product_article
|
||||
*
|
||||
* @author bs
|
||||
* @date 2024-04-06
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
@TableName("df_product_article")
|
||||
@Data
|
||||
public class DfProductArticle extends BaseEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 文章id */
|
||||
@TableId(value = "id",type = IdType.ASSIGN_UUID)
|
||||
@ApiModelProperty(value = "文章id")
|
||||
private String id;
|
||||
|
||||
/** 文章分类0产品文章1经纪文章 */
|
||||
|
||||
@Excel(name = "文章分类",dictType = "product_classify")
|
||||
@ApiModelProperty(value = "文章分类0产品文章1经纪文章")
|
||||
private String articleType;
|
||||
|
||||
/** 文章类型 */
|
||||
|
||||
@Excel(name = "文章类型",dictType = "article_kind")
|
||||
@ApiModelProperty(value = "文章类型")
|
||||
private String articleKind;
|
||||
|
||||
/** 文章标题 */
|
||||
|
||||
@Excel(name = "文章标题")
|
||||
@ApiModelProperty(value = "文章标题")
|
||||
private String articleTitle;
|
||||
|
||||
/** 发布时间 */
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "发布时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "发布时间")
|
||||
private Date publishTime;
|
||||
|
||||
/** 文章正文 */
|
||||
|
||||
@Excel(name = "文章正文")
|
||||
@ApiModelProperty(value = "文章正文")
|
||||
private String articleContent;
|
||||
|
||||
/** 状态0草稿1上架 */
|
||||
|
||||
@Excel(name = "状态",dictType = "product_status")
|
||||
@ApiModelProperty(value = "状态0草稿1上架")
|
||||
private String status;
|
||||
|
||||
/** 备注 */
|
||||
|
||||
@Excel(name = "备注")
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
@Excel(name = "序号")
|
||||
@ApiModelProperty(value = "序号")
|
||||
private String serialNumber;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String publishTimeBegin;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String publishTimeEnd;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String[] ids;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<CmAttach> files;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String orderByColumn;
|
||||
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
package com.bs.df.domain;
|
||||
|
||||
import com.bs.cm.domain.CmAttach;
|
||||
import com.bs.common.annotation.Excel;
|
||||
import com.bs.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
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.ApiModelProperty;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 产品朋友圈对象 df_product_moment
|
||||
*
|
||||
* @author bs
|
||||
* @date 2024-04-06
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
@TableName("df_product_moment")
|
||||
@Data
|
||||
public class DfProductMoment extends BaseEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 朋友圈id */
|
||||
@TableId(value = "id",type = IdType.ASSIGN_UUID)
|
||||
@ApiModelProperty(value = "朋友圈id")
|
||||
private String id;
|
||||
|
||||
/** 朋友圈分类0产品朋友圈1经纪朋友圈 */
|
||||
|
||||
@Excel(name = "朋友圈分类",dictType = "product_classify")
|
||||
@ApiModelProperty(value = "朋友圈分类0产品朋友圈1经纪朋友圈")
|
||||
private String momentType;
|
||||
|
||||
/** 朋友圈类型 */
|
||||
|
||||
@Excel(name = "朋友圈类型",dictType = "moment_kind")
|
||||
@ApiModelProperty(value = "朋友圈类型")
|
||||
private String momentKind;
|
||||
|
||||
/** 朋友圈标题 */
|
||||
|
||||
@Excel(name = "朋友圈标题")
|
||||
@ApiModelProperty(value = "朋友圈标题")
|
||||
private String momentTitle;
|
||||
|
||||
/** 朋友圈正文 */
|
||||
|
||||
@Excel(name = "朋友圈正文")
|
||||
@ApiModelProperty(value = "朋友圈正文")
|
||||
private String momentContent;
|
||||
|
||||
/** 状态0草稿1上架 */
|
||||
|
||||
@Excel(name = "状态",dictType = "product_status")
|
||||
@ApiModelProperty(value = "状态0草稿1上架")
|
||||
private String status;
|
||||
|
||||
/** 备注 */
|
||||
|
||||
@Excel(name = "备注")
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String[] ids;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<CmAttach> files;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String orderByColumn;
|
||||
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
package com.bs.df.domain;
|
||||
|
||||
import com.bs.cm.domain.CmAttach;
|
||||
import com.bs.common.annotation.Excel;
|
||||
import com.bs.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
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.ApiModelProperty;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 产品海报对象 df_product_poster
|
||||
*
|
||||
* @author bs
|
||||
* @date 2024-04-06
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
@TableName("df_product_poster")
|
||||
@Data
|
||||
public class DfProductPoster extends BaseEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 海报id */
|
||||
@TableId(value = "id",type = IdType.ASSIGN_UUID)
|
||||
@ApiModelProperty(value = "海报id")
|
||||
private String id;
|
||||
|
||||
/** 产品id */
|
||||
|
||||
//@Excel(name = "产品id")
|
||||
@ApiModelProperty(value = "产品id")
|
||||
private Long productId;
|
||||
|
||||
@Excel(name = "产品名称")
|
||||
@TableField(exist = false)
|
||||
private String productName;
|
||||
|
||||
/** 海报分类0产品海报1经纪海报 */
|
||||
|
||||
@Excel(name = "海报分类",dictType = "product_classify")
|
||||
@ApiModelProperty(value = "海报分类0产品海报1经纪海报")
|
||||
private String posterType;
|
||||
|
||||
/** 海报名称 */
|
||||
|
||||
@Excel(name = "海报名称")
|
||||
@ApiModelProperty(value = "海报名称")
|
||||
private String posterName;
|
||||
|
||||
/** 海报标签 */
|
||||
|
||||
@Excel(name = "海报标签",dictType = "poster_tag")
|
||||
@ApiModelProperty(value = "海报标签")
|
||||
private String posterTag;
|
||||
|
||||
/** 海报图片id */
|
||||
|
||||
@Excel(name = "海报图片")
|
||||
@ApiModelProperty(value = "海报图片id")
|
||||
private String posterFileId;
|
||||
|
||||
/** 状态0草稿1上架 */
|
||||
|
||||
@Excel(name = "状态",dictType = "product_status")
|
||||
@ApiModelProperty(value = "状态0草稿1上架")
|
||||
private String status;
|
||||
|
||||
/** 备注 */
|
||||
|
||||
@Excel(name = "备注")
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
@Excel(name = "序号")
|
||||
@ApiModelProperty(value = "序号")
|
||||
private String serialNumber;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String[] ids;
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<CmAttach> files;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String orderByColumn;
|
||||
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package com.bs.df.domain;
|
||||
|
||||
import com.bs.common.annotation.Excel;
|
||||
import com.bs.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
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.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* 代理产品推荐对象 df_product_recommend
|
||||
*
|
||||
* @author bs
|
||||
* @date 2024-09-16
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
@TableName("df_product_recommend")
|
||||
@Data
|
||||
public class DfProductRecommend extends BaseEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private Long id;
|
||||
|
||||
/** 用户id */
|
||||
|
||||
@Excel(name = "用户id")
|
||||
@ApiModelProperty(value = "用户id")
|
||||
private String userId;
|
||||
|
||||
/** 产品id */
|
||||
|
||||
@Excel(name = "产品id")
|
||||
@ApiModelProperty(value = "产品id")
|
||||
private String productId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Long[] ids;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package com.bs.df.domain;
|
||||
|
||||
import com.bs.common.annotation.Excel;
|
||||
import com.bs.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
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.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* 客户经纪对象 df_user_broker
|
||||
*
|
||||
* @author bs
|
||||
* @date 2024-04-06
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
@TableName("df_user_broker")
|
||||
@Data
|
||||
public class DfUserBroker extends BaseEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** id */
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
@ApiModelProperty(value = "id")
|
||||
private Long id;
|
||||
|
||||
/** 客户id */
|
||||
|
||||
@Excel(name = "客户id")
|
||||
@ApiModelProperty(value = "客户id")
|
||||
private Long userId;
|
||||
|
||||
/** 经纪id */
|
||||
|
||||
@Excel(name = "经纪id")
|
||||
@ApiModelProperty(value = "经纪id")
|
||||
private Long brokerId;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.bs.df.mapper;
|
||||
|
||||
import com.bs.common.mybatis.mapper.BaseMapperX;
|
||||
import com.bs.df.domain.DfBizClue;
|
||||
import com.bs.df.domain.DfOrder;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 业务线索Mapper接口
|
||||
*
|
||||
* @author bs
|
||||
* @date 2024-04-06
|
||||
*/
|
||||
public interface DfBizClueMapper extends BaseMapperX<DfBizClue> {
|
||||
|
||||
Boolean insertClue(@Param("dfBizClue") DfBizClue dfBizClue);
|
||||
|
||||
Boolean updateClue(@Param("dfBizClue") DfBizClue dfBizClue);
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.bs.df.mapper;
|
||||
|
||||
import com.bs.common.mybatis.mapper.BaseMapperX;
|
||||
import com.bs.df.domain.DfBroker;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 代理商经纪Mapper接口
|
||||
*
|
||||
* @author bs
|
||||
* @date 2024-04-06
|
||||
*/
|
||||
public interface DfBrokerMapper extends BaseMapperX<DfBroker> {
|
||||
|
||||
void updateByNull(@Param("dfBroker") DfBroker dfBroker);
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.bs.df.mapper;
|
||||
|
||||
import com.bs.common.mybatis.mapper.BaseMapperX;
|
||||
import com.bs.df.domain.DfBrokerProduct;
|
||||
|
||||
/**
|
||||
* 代理产品权限Mapper接口
|
||||
*
|
||||
* @author bs
|
||||
* @date 2024-04-06
|
||||
*/
|
||||
public interface DfBrokerProductMapper extends BaseMapperX<DfBrokerProduct> {
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.bs.df.mapper;
|
||||
|
||||
import com.bs.common.mybatis.mapper.BaseMapperX;
|
||||
import com.bs.df.domain.DfOrder;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 客户订单Mapper接口
|
||||
*
|
||||
* @author bs
|
||||
* @date 2024-04-06
|
||||
*/
|
||||
public interface DfOrderMapper extends BaseMapperX<DfOrder> {
|
||||
|
||||
Boolean insertOrder(@Param("dfOrder")DfOrder dfOrder);
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.bs.df.mapper;
|
||||
|
||||
import com.bs.common.mybatis.mapper.BaseMapperX;
|
||||
import com.bs.df.domain.DfProductArticle;
|
||||
|
||||
/**
|
||||
* 产品文章Mapper接口
|
||||
*
|
||||
* @author bs
|
||||
* @date 2024-04-06
|
||||
*/
|
||||
public interface DfProductArticleMapper extends BaseMapperX<DfProductArticle> {
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.bs.df.mapper;
|
||||
|
||||
import com.bs.common.mybatis.mapper.BaseMapperX;
|
||||
import com.bs.df.domain.DfProductInfo;
|
||||
|
||||
/**
|
||||
* 产品信息Mapper接口
|
||||
*
|
||||
* @author bs
|
||||
* @date 2024-04-06
|
||||
*/
|
||||
public interface DfProductInfoMapper extends BaseMapperX<DfProductInfo> {
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.bs.df.mapper;
|
||||
|
||||
import com.bs.common.mybatis.mapper.BaseMapperX;
|
||||
import com.bs.df.domain.DfProductMoment;
|
||||
|
||||
/**
|
||||
* 产品朋友圈Mapper接口
|
||||
*
|
||||
* @author bs
|
||||
* @date 2024-04-06
|
||||
*/
|
||||
public interface DfProductMomentMapper extends BaseMapperX<DfProductMoment> {
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.bs.df.mapper;
|
||||
|
||||
import com.bs.common.mybatis.mapper.BaseMapperX;
|
||||
import com.bs.df.domain.DfProductPoster;
|
||||
|
||||
/**
|
||||
* 产品海报Mapper接口
|
||||
*
|
||||
* @author bs
|
||||
* @date 2024-04-06
|
||||
*/
|
||||
public interface DfProductPosterMapper extends BaseMapperX<DfProductPoster> {
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.bs.df.mapper;
|
||||
|
||||
import com.bs.common.mybatis.mapper.BaseMapperX;
|
||||
import com.bs.df.domain.DfProductRecommend;
|
||||
|
||||
/**
|
||||
* 代理产品推荐Mapper接口
|
||||
*
|
||||
* @author bs
|
||||
* @date 2024-09-16
|
||||
*/
|
||||
public interface DfProductRecommendMapper extends BaseMapperX<DfProductRecommend> {
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.bs.df.mapper;
|
||||
|
||||
import com.bs.common.mybatis.mapper.BaseMapperX;
|
||||
import com.bs.df.domain.DfUserBroker;
|
||||
|
||||
/**
|
||||
* 客户经纪Mapper接口
|
||||
*
|
||||
* @author bs
|
||||
* @date 2024-04-06
|
||||
*/
|
||||
public interface DfUserBrokerMapper extends BaseMapperX<DfUserBroker> {
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.bs.df.service;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseService;
|
||||
import com.bs.df.domain.DfBizClue;
|
||||
|
||||
/**
|
||||
* 业务线索Service接口
|
||||
*
|
||||
* @author bs
|
||||
* @date 2024-04-06
|
||||
*/
|
||||
public interface IDfBizClueService extends MPJBaseService<DfBizClue>{
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.bs.df.service;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseService;
|
||||
import com.bs.df.domain.DfBrokerProduct;
|
||||
|
||||
/**
|
||||
* 代理产品权限Service接口
|
||||
*
|
||||
* @author bs
|
||||
* @date 2024-04-06
|
||||
*/
|
||||
public interface IDfBrokerProductService extends MPJBaseService<DfBrokerProduct>{
|
||||
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package com.bs.df.service;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseService;
|
||||
import com.bs.df.domain.DfBroker;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 代理商经纪Service接口
|
||||
*
|
||||
* @author bs
|
||||
* @date 2024-04-06
|
||||
*/
|
||||
public interface IDfBrokerService extends MPJBaseService<DfBroker>{
|
||||
|
||||
/**
|
||||
* 通过用户id获取相对应的代理商权限
|
||||
* @return 代理商权限
|
||||
*/
|
||||
public List<Long> filterByUser();
|
||||
|
||||
/**
|
||||
* 通过用户id获取相对应的代理商权限
|
||||
* @return 代理商权限
|
||||
*/
|
||||
public List<Long> filterByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 通过代理商id获取相对应的子代理
|
||||
* @return 代理商权限
|
||||
*/
|
||||
public List<DfBroker> findAllSubordinates(Long brokerId);
|
||||
|
||||
/**
|
||||
* 通过用户id获取相对应的产品id
|
||||
* @return 产品id
|
||||
*/
|
||||
public List<Long> getProductIdsByBrokerId();
|
||||
|
||||
/**
|
||||
* 通过用户id获取相对应的产品id
|
||||
* @return 产品id
|
||||
*/
|
||||
public List<Long> getProductIdsByBrokerIdByUserId(Long userId);
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.bs.df.service;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseService;
|
||||
import com.bs.df.domain.DfProductArticle;
|
||||
|
||||
/**
|
||||
* 产品文章Service接口
|
||||
*
|
||||
* @author bs
|
||||
* @date 2024-04-06
|
||||
*/
|
||||
public interface IDfProductArticleService extends MPJBaseService<DfProductArticle>{
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.bs.df.service;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseService;
|
||||
import com.bs.df.domain.DfProductInfo;
|
||||
|
||||
/**
|
||||
* 产品信息Service接口
|
||||
*
|
||||
* @author bs
|
||||
* @date 2024-04-06
|
||||
*/
|
||||
public interface IDfProductInfoService extends MPJBaseService<DfProductInfo>{
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.bs.df.service;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseService;
|
||||
import com.bs.df.domain.DfProductMoment;
|
||||
|
||||
/**
|
||||
* 产品朋友圈Service接口
|
||||
*
|
||||
* @author bs
|
||||
* @date 2024-04-06
|
||||
*/
|
||||
public interface IDfProductMomentService extends MPJBaseService<DfProductMoment>{
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.bs.df.service;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseService;
|
||||
import com.bs.df.domain.DfProductPoster;
|
||||
|
||||
/**
|
||||
* 产品海报Service接口
|
||||
*
|
||||
* @author bs
|
||||
* @date 2024-04-06
|
||||
*/
|
||||
public interface IDfProductPosterService extends MPJBaseService<DfProductPoster>{
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.bs.df.service;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseService;
|
||||
import com.bs.df.domain.DfProductRecommend;
|
||||
|
||||
/**
|
||||
* 代理产品推荐Service接口
|
||||
*
|
||||
* @author bs
|
||||
* @date 2024-09-16
|
||||
*/
|
||||
public interface IDfProductRecommendService extends MPJBaseService<DfProductRecommend>{
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.bs.df.service;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseService;
|
||||
import com.bs.df.domain.DfUserBroker;
|
||||
|
||||
/**
|
||||
* 客户经纪Service接口
|
||||
*
|
||||
* @author bs
|
||||
* @date 2024-04-06
|
||||
*/
|
||||
public interface IDfUserBrokerService extends MPJBaseService<DfUserBroker>{
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.bs.df.service.impl;
|
||||
|
||||
import com.bs.df.mapper.DfBizClueMapper;
|
||||
import com.bs.df.domain.DfBizClue;
|
||||
import com.bs.df.service.IDfBizClueService;
|
||||
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
/**
|
||||
* 业务线索Service业务层处理
|
||||
*
|
||||
* @author bs
|
||||
* @date 2024-04-06
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class DfBizClueServiceImpl extends MPJBaseServiceImpl<DfBizClueMapper, DfBizClue> implements IDfBizClueService {
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.bs.df.service.impl;
|
||||
|
||||
import com.bs.df.mapper.DfBrokerProductMapper;
|
||||
import com.bs.df.domain.DfBrokerProduct;
|
||||
import com.bs.df.service.IDfBrokerProductService;
|
||||
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
/**
|
||||
* 代理产品权限Service业务层处理
|
||||
*
|
||||
* @author bs
|
||||
* @date 2024-04-06
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class DfBrokerProductServiceImpl extends MPJBaseServiceImpl<DfBrokerProductMapper, DfBrokerProduct> implements IDfBrokerProductService {
|
||||
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
package com.bs.df.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.bs.common.core.domain.entity.SysUser;
|
||||
import com.bs.common.utils.SecurityUtils;
|
||||
import com.bs.df.domain.DfBrokerProduct;
|
||||
import com.bs.df.mapper.DfBrokerMapper;
|
||||
import com.bs.df.domain.DfBroker;
|
||||
import com.bs.df.service.IDfBrokerProductService;
|
||||
import com.bs.df.service.IDfBrokerService;
|
||||
import com.bs.system.service.ISysUserService;
|
||||
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 代理商经纪Service业务层处理
|
||||
*
|
||||
* @author bs
|
||||
* @date 2024-04-06
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class DfBrokerServiceImpl extends MPJBaseServiceImpl<DfBrokerMapper, DfBroker> implements IDfBrokerService {
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
@Autowired
|
||||
private IDfBrokerService dfBrokerService;
|
||||
@Autowired
|
||||
private IDfBrokerProductService dfBrokerProductService;
|
||||
public List<Long> filterByUser() {
|
||||
//SecurityUtils.getUserId();
|
||||
SysUser sysUser = userService.selectUserById(SecurityUtils.getUserId());
|
||||
Long deptId = sysUser.getDeptId();
|
||||
List<DfBroker> allSubordinates = findAllSubordinates(deptId);
|
||||
List<Long> brokerIds = allSubordinates.stream()
|
||||
.map(DfBroker::getId)
|
||||
.collect(Collectors.toList());
|
||||
brokerIds.add(deptId);
|
||||
return brokerIds;
|
||||
}
|
||||
|
||||
public List<Long> filterByUserId(Long userId) {
|
||||
SysUser sysUser = userService.selectUserById(userId);
|
||||
Long deptId = sysUser.getDeptId();
|
||||
List<DfBroker> allSubordinates = findAllSubordinates(deptId);
|
||||
List<Long> brokerIds = allSubordinates.stream()
|
||||
.map(DfBroker::getId)
|
||||
.collect(Collectors.toList());
|
||||
brokerIds.add(deptId);
|
||||
return brokerIds;
|
||||
}
|
||||
|
||||
public List<DfBroker> findAllSubordinates(Long brokerId) {
|
||||
List<DfBroker> result = new ArrayList<>();
|
||||
// 查询当前brokerId的所有下级
|
||||
List<DfBroker> subordinates = dfBrokerService.list(new LambdaQueryWrapper<DfBroker>().eq(DfBroker::getParentId, brokerId));
|
||||
result.addAll(subordinates);
|
||||
for (DfBroker subordinate : subordinates) {
|
||||
List<DfBroker> subSubordinates = findAllSubordinates(subordinate.getId());
|
||||
result.addAll(subSubordinates);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<Long> getProductIdsByBrokerId() {
|
||||
List<Long> longs = filterByUser();
|
||||
List<DfBrokerProduct> list = dfBrokerProductService.list(new LambdaQueryWrapper<DfBrokerProduct>()
|
||||
.in(DfBrokerProduct::getBrokerId, longs)
|
||||
.eq(DfBrokerProduct::getStaus, "1")
|
||||
.or()
|
||||
.in(DfBrokerProduct::getUserId, SecurityUtils.getUserId()));
|
||||
return list.stream().map(DfBrokerProduct::getProductId).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public List<Long> getProductIdsByBrokerIdByUserId(Long UserId) {
|
||||
List<Long> longs = filterByUserId(UserId);
|
||||
List<DfBrokerProduct> list = dfBrokerProductService.list(new LambdaQueryWrapper<DfBrokerProduct>()
|
||||
.in(DfBrokerProduct::getBrokerId, longs)
|
||||
.eq(DfBrokerProduct::getStaus, "1"));
|
||||
return list.stream().map(DfBrokerProduct::getProductId).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package com.bs.df.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.bs.common.utils.DateUtils;
|
||||
import com.bs.common.utils.StringUtils;
|
||||
import com.bs.df.mapper.DfOrderMapper;
|
||||
import com.bs.df.domain.DfOrder;
|
||||
import com.bs.df.service.IDfOrderService;
|
||||
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 客户订单Service业务层处理
|
||||
*
|
||||
* @author bs
|
||||
* @date 2024-04-06
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class DfOrderServiceImpl extends MPJBaseServiceImpl<DfOrderMapper, DfOrder> implements IDfOrderService {
|
||||
@Resource
|
||||
private IDfOrderService dfOrderService;
|
||||
@Override
|
||||
public String getBillNumber(String billPrefix) {
|
||||
String billNo = "";
|
||||
if (StringUtils.isBlank(billPrefix)) {
|
||||
billPrefix = "DD";
|
||||
}
|
||||
String billDate = DateUtils.dateTimeNow("yyyyMMdd");
|
||||
List<DfOrder> lsBill = dfOrderService.list(new LambdaQueryWrapper<DfOrder>().like(DfOrder::getOrderNo, billPrefix + billDate)
|
||||
.orderByDesc(DfOrder::getId));
|
||||
if (lsBill.size() == 0) {
|
||||
billNo = billPrefix + billDate + String.format("%04d", 1);
|
||||
return billNo;
|
||||
}
|
||||
Long id = lsBill.get(0).getId();
|
||||
billNo = billPrefix + billDate + String.format("%04d", id + 1);
|
||||
return billNo;
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.bs.df.service.impl;
|
||||
|
||||
import com.bs.df.mapper.DfProductArticleMapper;
|
||||
import com.bs.df.domain.DfProductArticle;
|
||||
import com.bs.df.service.IDfProductArticleService;
|
||||
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
/**
|
||||
* 产品文章Service业务层处理
|
||||
*
|
||||
* @author bs
|
||||
* @date 2024-04-06
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class DfProductArticleServiceImpl extends MPJBaseServiceImpl<DfProductArticleMapper, DfProductArticle> implements IDfProductArticleService {
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.bs.df.service.impl;
|
||||
|
||||
import com.bs.df.mapper.DfProductInfoMapper;
|
||||
import com.bs.df.domain.DfProductInfo;
|
||||
import com.bs.df.service.IDfProductInfoService;
|
||||
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
/**
|
||||
* 产品信息Service业务层处理
|
||||
*
|
||||
* @author bs
|
||||
* @date 2024-04-06
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class DfProductInfoServiceImpl extends MPJBaseServiceImpl<DfProductInfoMapper, DfProductInfo> implements IDfProductInfoService {
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.bs.df.service.impl;
|
||||
|
||||
import com.bs.df.mapper.DfProductMomentMapper;
|
||||
import com.bs.df.domain.DfProductMoment;
|
||||
import com.bs.df.service.IDfProductMomentService;
|
||||
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
/**
|
||||
* 产品朋友圈Service业务层处理
|
||||
*
|
||||
* @author bs
|
||||
* @date 2024-04-06
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class DfProductMomentServiceImpl extends MPJBaseServiceImpl<DfProductMomentMapper, DfProductMoment> implements IDfProductMomentService {
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.bs.df.service.impl;
|
||||
|
||||
import com.bs.df.mapper.DfProductPosterMapper;
|
||||
import com.bs.df.domain.DfProductPoster;
|
||||
import com.bs.df.service.IDfProductPosterService;
|
||||
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
/**
|
||||
* 产品海报Service业务层处理
|
||||
*
|
||||
* @author bs
|
||||
* @date 2024-04-06
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class DfProductPosterServiceImpl extends MPJBaseServiceImpl<DfProductPosterMapper, DfProductPoster> implements IDfProductPosterService {
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.bs.df.service.impl;
|
||||
|
||||
import com.bs.df.mapper.DfProductRecommendMapper;
|
||||
import com.bs.df.domain.DfProductRecommend;
|
||||
import com.bs.df.service.IDfProductRecommendService;
|
||||
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
/**
|
||||
* 代理产品推荐Service业务层处理
|
||||
*
|
||||
* @author bs
|
||||
* @date 2024-09-16
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class DfProductRecommendServiceImpl extends MPJBaseServiceImpl<DfProductRecommendMapper, DfProductRecommend> implements IDfProductRecommendService {
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.bs.df.service.impl;
|
||||
|
||||
import com.bs.df.mapper.DfUserBrokerMapper;
|
||||
import com.bs.df.domain.DfUserBroker;
|
||||
import com.bs.df.service.IDfUserBrokerService;
|
||||
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
/**
|
||||
* 客户经纪Service业务层处理
|
||||
*
|
||||
* @author bs
|
||||
* @date 2024-04-06
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class DfUserBrokerServiceImpl extends MPJBaseServiceImpl<DfUserBrokerMapper, DfUserBroker> implements IDfUserBrokerService {
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.bs.df.utils;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
public class HtmlUtils {
|
||||
|
||||
// 定义 HTML 标签的正则表达式
|
||||
private static final Pattern HTML_TAG_PATTERN = Pattern.compile("<[^>]+>");
|
||||
|
||||
// 去除 HTML 标签的方法
|
||||
public static String stripHtmlTags(String html) {
|
||||
if (html == null || html.trim().isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
Matcher matcher = HTML_TAG_PATTERN.matcher(html);
|
||||
return matcher.replaceAll("");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,179 @@
|
||||
package com.bs.system.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.bs.common.annotation.Log;
|
||||
import com.bs.common.core.controller.BaseController;
|
||||
import com.bs.common.core.domain.AjaxResult;
|
||||
import com.bs.common.core.page.TableDataInfo;
|
||||
import com.bs.common.enums.BusinessType;
|
||||
import com.bs.common.utils.poi.ExcelUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import cn.hutool.core.lang.Validator;
|
||||
import com.bs.system.domain.DfArea;
|
||||
import com.bs.system.service.IDfAreaService;
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 全国城市Controller
|
||||
*
|
||||
* @author bs
|
||||
* @date 2024-04-13
|
||||
*/
|
||||
@Api(tags = "全国城市")
|
||||
@RestController
|
||||
@RequestMapping("/system/area")
|
||||
public class DfAreaController extends BaseController {
|
||||
@Resource
|
||||
private IDfAreaService dfAreaService;
|
||||
|
||||
/**
|
||||
* 分页查询全国城市列表
|
||||
*/
|
||||
@ApiOperation("分页查询全国城市列表")
|
||||
@GetMapping("/pageList")
|
||||
public TableDataInfo pageList(DfArea dfArea) {
|
||||
startPage();
|
||||
LambdaQueryWrapper<DfArea> queryWrapper = new LambdaQueryWrapper();
|
||||
condition(queryWrapper,dfArea);
|
||||
List<DfArea> list = dfAreaService.list(queryWrapper);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询全国城市列表
|
||||
*/
|
||||
@ApiOperation("查询全国城市列表")
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(DfArea dfArea) {
|
||||
LambdaQueryWrapper<DfArea> queryWrapper = new LambdaQueryWrapper();
|
||||
condition(queryWrapper,dfArea);
|
||||
List<DfArea> list = dfAreaService.list(queryWrapper);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出全国城市列表
|
||||
*/
|
||||
@ApiOperation("导出全国城市列表")
|
||||
@Log(title = "全国城市导出", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, DfArea dfArea) {
|
||||
LambdaQueryWrapper<DfArea> queryWrapper = new LambdaQueryWrapper();
|
||||
condition(queryWrapper,dfArea);
|
||||
List<DfArea> list = dfAreaService.list(queryWrapper);
|
||||
ExcelUtil<DfArea> util = new ExcelUtil<DfArea>(DfArea. class);
|
||||
util.exportExcel(response, list, "全国城市数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取全国城市详细信息
|
||||
*/
|
||||
@ApiOperation("获取全国城市详细信息")
|
||||
@GetMapping(value = "/{areaId}")
|
||||
public AjaxResult getInfo(@PathVariable("areaId") String areaId) {
|
||||
return success(dfAreaService.getById(areaId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增全国城市
|
||||
*/
|
||||
@ApiOperation("新增全国城市")
|
||||
@Log(title = "全国城市新增", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody DfArea dfArea) {
|
||||
return toAjax(dfAreaService.save(dfArea));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改全国城市
|
||||
*/
|
||||
@ApiOperation("修改全国城市")
|
||||
@Log(title = "全国城市修改", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody DfArea dfArea) {
|
||||
return toAjax(dfAreaService.updateById(dfArea));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除全国城市
|
||||
*/
|
||||
@ApiOperation("删除全国城市")
|
||||
@Log(title = "全国城市删除", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{areaIds}")
|
||||
public AjaxResult remove(@PathVariable List<Long> areaIds) {
|
||||
return toAjax(dfAreaService.removeBatchByIds(areaIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 条件设置
|
||||
*/
|
||||
private void condition (LambdaQueryWrapper<DfArea> queryWrapper,DfArea dfArea){
|
||||
|
||||
|
||||
//${column.columnComment}
|
||||
if(Validator.isNotEmpty(dfArea.getAreaId())){
|
||||
queryWrapper.eq(DfArea::getAreaId,dfArea.getAreaId());
|
||||
}
|
||||
|
||||
//${column.columnComment}
|
||||
if(Validator.isNotEmpty(dfArea.getParentId())){
|
||||
queryWrapper.eq(DfArea::getParentId,dfArea.getParentId());
|
||||
}
|
||||
|
||||
//${column.columnComment}
|
||||
if(Validator.isNotEmpty(dfArea.getName())){
|
||||
queryWrapper.eq(DfArea::getName,dfArea.getName());
|
||||
}
|
||||
|
||||
//${column.columnComment}
|
||||
if(Validator.isNotEmpty(dfArea.getTenantId())){
|
||||
queryWrapper.eq(DfArea::getTenantId,dfArea.getTenantId());
|
||||
}
|
||||
|
||||
//${column.columnComment}
|
||||
if(Validator.isNotEmpty(dfArea.getCreateDept())){
|
||||
queryWrapper.eq(DfArea::getCreateDept,dfArea.getCreateDept());
|
||||
}
|
||||
|
||||
//${column.columnComment}
|
||||
if(Validator.isNotEmpty(dfArea.getCreateBy())){
|
||||
queryWrapper.eq(DfArea::getCreateBy,dfArea.getCreateBy());
|
||||
}
|
||||
|
||||
//${column.columnComment}
|
||||
if(Validator.isNotEmpty(dfArea.getCreateTime())){
|
||||
queryWrapper.eq(DfArea::getCreateTime,dfArea.getCreateTime());
|
||||
}
|
||||
|
||||
//${column.columnComment}
|
||||
if(Validator.isNotEmpty(dfArea.getUpdateBy())){
|
||||
queryWrapper.eq(DfArea::getUpdateBy,dfArea.getUpdateBy());
|
||||
}
|
||||
|
||||
//${column.columnComment}
|
||||
if(Validator.isNotEmpty(dfArea.getUpdateTime())){
|
||||
queryWrapper.eq(DfArea::getUpdateTime,dfArea.getUpdateTime());
|
||||
}
|
||||
|
||||
//${column.columnComment}
|
||||
if(Validator.isNotEmpty(dfArea.getDelFlag())){
|
||||
queryWrapper.eq(DfArea::getDelFlag,dfArea.getDelFlag());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package com.bs.system.domain;
|
||||
|
||||
import com.bs.common.annotation.Excel;
|
||||
import com.bs.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
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.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* 全国城市对象 df_area
|
||||
*
|
||||
* @author bs
|
||||
* @date 2024-04-13
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
@TableName("df_area")
|
||||
@Data
|
||||
public class DfArea extends BaseEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** $column.columnComment */
|
||||
@TableId(value = "area_id",type = IdType.AUTO)
|
||||
@ApiModelProperty(value = "${column.columnComment}")
|
||||
private String areaId;
|
||||
|
||||
/** $column.columnComment */
|
||||
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
@ApiModelProperty(value = "${column.columnComment}")
|
||||
private String parentId;
|
||||
|
||||
/** $column.columnComment */
|
||||
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
@ApiModelProperty(value = "${column.columnComment}")
|
||||
private String name;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.bs.system.mapper;
|
||||
|
||||
import com.bs.common.mybatis.mapper.BaseMapperX;
|
||||
import com.bs.system.domain.DfArea;
|
||||
|
||||
/**
|
||||
* 全国城市Mapper接口
|
||||
*
|
||||
* @author bs
|
||||
* @date 2024-04-13
|
||||
*/
|
||||
public interface DfAreaMapper extends BaseMapperX<DfArea> {
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.bs.system.service;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseService;
|
||||
import com.bs.system.domain.DfArea;
|
||||
|
||||
/**
|
||||
* 全国城市Service接口
|
||||
*
|
||||
* @author bs
|
||||
* @date 2024-04-13
|
||||
*/
|
||||
public interface IDfAreaService extends MPJBaseService<DfArea>{
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.bs.system.service.impl;
|
||||
|
||||
import com.bs.system.mapper.DfAreaMapper;
|
||||
import com.bs.system.domain.DfArea;
|
||||
import com.bs.system.service.IDfAreaService;
|
||||
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
/**
|
||||
* 全国城市Service业务层处理
|
||||
*
|
||||
* @author bs
|
||||
* @date 2024-04-13
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class DfAreaServiceImpl extends MPJBaseServiceImpl<DfAreaMapper, DfArea> implements IDfAreaService {
|
||||
|
||||
}
|
@ -0,0 +1,94 @@
|
||||
package com.bs.web.controller.common;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import javax.annotation.Resource;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.FastByteArrayOutputStream;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.google.code.kaptcha.Producer;
|
||||
import com.bs.common.config.BsConfig;
|
||||
import com.bs.common.constant.CacheConstants;
|
||||
import com.bs.common.constant.Constants;
|
||||
import com.bs.common.core.domain.AjaxResult;
|
||||
import com.bs.common.core.redis.RedisCache;
|
||||
import com.bs.common.utils.sign.Base64;
|
||||
import com.bs.common.utils.uuid.IdUtils;
|
||||
import com.bs.system.service.ISysConfigService;
|
||||
|
||||
/**
|
||||
* 验证码操作处理
|
||||
*
|
||||
* @author bs
|
||||
*/
|
||||
@RestController
|
||||
public class CaptchaController
|
||||
{
|
||||
@Resource(name = "captchaProducer")
|
||||
private Producer captchaProducer;
|
||||
|
||||
@Resource(name = "captchaProducerMath")
|
||||
private Producer captchaProducerMath;
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
@Autowired
|
||||
private ISysConfigService configService;
|
||||
/**
|
||||
* 生成验证码
|
||||
*/
|
||||
@GetMapping("/captchaImage")
|
||||
public AjaxResult getCode(HttpServletResponse response) throws IOException
|
||||
{
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
boolean captchaEnabled = configService.selectCaptchaEnabled();
|
||||
ajax.put("captchaEnabled", captchaEnabled);
|
||||
if (!captchaEnabled)
|
||||
{
|
||||
return ajax;
|
||||
}
|
||||
|
||||
// 保存验证码信息
|
||||
String uuid = IdUtils.simpleUUID();
|
||||
String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + uuid;
|
||||
|
||||
String capStr = null, code = null;
|
||||
BufferedImage image = null;
|
||||
|
||||
// 生成验证码
|
||||
String captchaType = BsConfig.getCaptchaType();
|
||||
if ("math".equals(captchaType))
|
||||
{
|
||||
String capText = captchaProducerMath.createText();
|
||||
capStr = capText.substring(0, capText.lastIndexOf("@"));
|
||||
code = capText.substring(capText.lastIndexOf("@") + 1);
|
||||
image = captchaProducerMath.createImage(capStr);
|
||||
}
|
||||
else if ("char".equals(captchaType))
|
||||
{
|
||||
capStr = code = captchaProducer.createText();
|
||||
image = captchaProducer.createImage(capStr);
|
||||
}
|
||||
|
||||
redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
|
||||
// 转换流信息写出
|
||||
FastByteArrayOutputStream os = new FastByteArrayOutputStream();
|
||||
try
|
||||
{
|
||||
ImageIO.write(image, "jpg", os);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
|
||||
ajax.put("uuid", uuid);
|
||||
ajax.put("img", Base64.encode(os.toByteArray()));
|
||||
return ajax;
|
||||
}
|
||||
}
|
@ -0,0 +1,120 @@
|
||||
package com.bs.web.controller.monitor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisCallback;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.bs.common.constant.CacheConstants;
|
||||
import com.bs.common.core.domain.AjaxResult;
|
||||
import com.bs.common.utils.StringUtils;
|
||||
import com.bs.system.domain.SysCache;
|
||||
|
||||
/**
|
||||
* 缓存监控
|
||||
*
|
||||
* @author bs
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/monitor/cache")
|
||||
public class CacheController
|
||||
{
|
||||
@Autowired
|
||||
private RedisTemplate<String, String> redisTemplate;
|
||||
|
||||
private final static List<SysCache> caches = new ArrayList<SysCache>();
|
||||
{
|
||||
caches.add(new SysCache(CacheConstants.LOGIN_TOKEN_KEY, "用户信息"));
|
||||
caches.add(new SysCache(CacheConstants.SYS_CONFIG_KEY, "配置信息"));
|
||||
caches.add(new SysCache(CacheConstants.SYS_DICT_KEY, "数据字典"));
|
||||
caches.add(new SysCache(CacheConstants.CAPTCHA_CODE_KEY, "验证码"));
|
||||
caches.add(new SysCache(CacheConstants.REPEAT_SUBMIT_KEY, "防重提交"));
|
||||
caches.add(new SysCache(CacheConstants.RATE_LIMIT_KEY, "限流处理"));
|
||||
caches.add(new SysCache(CacheConstants.PWD_ERR_CNT_KEY, "密码错误次数"));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||
@GetMapping()
|
||||
public AjaxResult getInfo() throws Exception
|
||||
{
|
||||
Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info());
|
||||
Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats"));
|
||||
Object dbSize = redisTemplate.execute((RedisCallback<Object>) connection -> connection.dbSize());
|
||||
|
||||
Map<String, Object> result = new HashMap<>(3);
|
||||
result.put("info", info);
|
||||
result.put("dbSize", dbSize);
|
||||
|
||||
List<Map<String, String>> pieList = new ArrayList<>();
|
||||
commandStats.stringPropertyNames().forEach(key -> {
|
||||
Map<String, String> data = new HashMap<>(2);
|
||||
String property = commandStats.getProperty(key);
|
||||
data.put("name", StringUtils.removeStart(key, "cmdstat_"));
|
||||
data.put("value", StringUtils.substringBetween(property, "calls=", ",usec"));
|
||||
pieList.add(data);
|
||||
});
|
||||
result.put("commandStats", pieList);
|
||||
return AjaxResult.success(result);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||
@GetMapping("/getNames")
|
||||
public AjaxResult cache()
|
||||
{
|
||||
return AjaxResult.success(caches);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||
@GetMapping("/getKeys/{cacheName}")
|
||||
public AjaxResult getCacheKeys(@PathVariable String cacheName)
|
||||
{
|
||||
Set<String> cacheKeys = redisTemplate.keys(cacheName + "*");
|
||||
return AjaxResult.success(cacheKeys);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||
@GetMapping("/getValue/{cacheName}/{cacheKey}")
|
||||
public AjaxResult getCacheValue(@PathVariable String cacheName, @PathVariable String cacheKey)
|
||||
{
|
||||
String cacheValue = redisTemplate.opsForValue().get(cacheKey);
|
||||
SysCache sysCache = new SysCache(cacheName, cacheKey, cacheValue);
|
||||
return AjaxResult.success(sysCache);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||
@DeleteMapping("/clearCacheName/{cacheName}")
|
||||
public AjaxResult clearCacheName(@PathVariable String cacheName)
|
||||
{
|
||||
Collection<String> cacheKeys = redisTemplate.keys(cacheName + "*");
|
||||
redisTemplate.delete(cacheKeys);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||
@DeleteMapping("/clearCacheKey/{cacheKey}")
|
||||
public AjaxResult clearCacheKey(@PathVariable String cacheKey)
|
||||
{
|
||||
redisTemplate.delete(cacheKey);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||
@DeleteMapping("/clearCacheAll")
|
||||
public AjaxResult clearCacheAll()
|
||||
{
|
||||
Collection<String> cacheKeys = redisTemplate.keys("*");
|
||||
redisTemplate.delete(cacheKeys);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package com.bs.web.controller.monitor;
|
||||
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.bs.common.core.domain.AjaxResult;
|
||||
import com.bs.framework.web.domain.Server;
|
||||
|
||||
/**
|
||||
* 服务器监控
|
||||
*
|
||||
* @author bs
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/monitor/server")
|
||||
public class ServerController
|
||||
{
|
||||
@PreAuthorize("@ss.hasPermi('monitor:server:list')")
|
||||
@GetMapping()
|
||||
public AjaxResult getInfo() throws Exception
|
||||
{
|
||||
Server server = new Server();
|
||||
server.copyTo();
|
||||
return AjaxResult.success(server);
|
||||
}
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
package com.bs.web.controller.monitor;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.bs.common.annotation.Log;
|
||||
import com.bs.common.core.controller.BaseController;
|
||||
import com.bs.common.core.domain.AjaxResult;
|
||||
import com.bs.common.core.page.TableDataInfo;
|
||||
import com.bs.common.enums.BusinessType;
|
||||
import com.bs.common.utils.poi.ExcelUtil;
|
||||
import com.bs.framework.web.service.SysPasswordService;
|
||||
import com.bs.system.domain.SysLogininfor;
|
||||
import com.bs.system.service.ISysLogininforService;
|
||||
|
||||
/**
|
||||
* 系统访问记录
|
||||
*
|
||||
* @author bs
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/monitor/logininfor")
|
||||
public class SysLogininforController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysLogininforService logininforService;
|
||||
|
||||
@Autowired
|
||||
private SysPasswordService passwordService;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:logininfor:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysLogininfor logininfor)
|
||||
{
|
||||
startPage();
|
||||
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "登录日志", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('monitor:logininfor:export')")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysLogininfor logininfor)
|
||||
{
|
||||
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
||||
ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
|
||||
util.exportExcel(response, list, "登录日志");
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
|
||||
@Log(title = "登录日志", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{infoIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] infoIds)
|
||||
{
|
||||
return toAjax(logininforService.deleteLogininforByIds(infoIds));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
|
||||
@Log(title = "登录日志", businessType = BusinessType.CLEAN)
|
||||
@DeleteMapping("/clean")
|
||||
public AjaxResult clean()
|
||||
{
|
||||
logininforService.cleanLogininfor();
|
||||
return success();
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:logininfor:unlock')")
|
||||
@Log(title = "账户解锁", businessType = BusinessType.OTHER)
|
||||
@GetMapping("/unlock/{userName}")
|
||||
public AjaxResult unlock(@PathVariable("userName") String userName)
|
||||
{
|
||||
passwordService.clearLoginRecordCache(userName);
|
||||
return success();
|
||||
}
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package com.bs.web.controller.monitor;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.bs.common.annotation.Log;
|
||||
import com.bs.common.core.controller.BaseController;
|
||||
import com.bs.common.core.domain.AjaxResult;
|
||||
import com.bs.common.core.page.TableDataInfo;
|
||||
import com.bs.common.enums.BusinessType;
|
||||
import com.bs.common.utils.poi.ExcelUtil;
|
||||
import com.bs.system.domain.SysOperLog;
|
||||
import com.bs.system.service.ISysOperLogService;
|
||||
|
||||
/**
|
||||
* 操作日志记录
|
||||
*
|
||||
* @author bs
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/monitor/operlog")
|
||||
public class SysOperlogController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysOperLogService operLogService;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:operlog:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysOperLog operLog)
|
||||
{
|
||||
startPage();
|
||||
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "操作日志", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('monitor:operlog:export')")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysOperLog operLog)
|
||||
{
|
||||
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
||||
ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
|
||||
util.exportExcel(response, list, "操作日志");
|
||||
}
|
||||
|
||||
@Log(title = "操作日志", businessType = BusinessType.DELETE)
|
||||
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
|
||||
@DeleteMapping("/{operIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] operIds)
|
||||
{
|
||||
return toAjax(operLogService.deleteOperLogByIds(operIds));
|
||||
}
|
||||
|
||||
@Log(title = "操作日志", businessType = BusinessType.CLEAN)
|
||||
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
|
||||
@DeleteMapping("/clean")
|
||||
public AjaxResult clean()
|
||||
{
|
||||
operLogService.cleanOperLog();
|
||||
return success();
|
||||
}
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
package com.bs.web.controller.monitor;
|
||||
|
||||
import cn.hutool.core.lang.Validator;
|
||||
import com.bs.common.annotation.Log;
|
||||
import com.bs.common.constant.CacheConstants;
|
||||
import com.bs.common.core.controller.BaseController;
|
||||
import com.bs.common.core.domain.AjaxResult;
|
||||
import com.bs.common.core.domain.model.LoginUser;
|
||||
import com.bs.common.core.page.TableDataInfo;
|
||||
import com.bs.common.core.redis.RedisCache;
|
||||
import com.bs.common.enums.BusinessType;
|
||||
import com.bs.common.utils.StringUtils;
|
||||
import com.bs.system.domain.SysUserOnline;
|
||||
import com.bs.system.service.ISysUserOnlineService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 在线用户监控
|
||||
*
|
||||
* @author bs
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/monitor/online")
|
||||
public class SysUserOnlineController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysUserOnlineService userOnlineService;
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:online:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(String ipaddr, String userName)
|
||||
{
|
||||
Collection<String> keys = redisCache.keys(CacheConstants.LOGIN_TOKEN_KEY + "*");
|
||||
List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>();
|
||||
for (String key : keys)
|
||||
{
|
||||
LoginUser user = redisCache.getCacheObject(key);
|
||||
if (Validator.isNotEmpty(ipaddr) && Validator.isNotEmpty(userName))
|
||||
{
|
||||
userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user));
|
||||
}
|
||||
else if (Validator.isNotEmpty(ipaddr))
|
||||
{
|
||||
userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user));
|
||||
}
|
||||
else if (Validator.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser()))
|
||||
{
|
||||
userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user));
|
||||
}
|
||||
else
|
||||
{
|
||||
userOnlineList.add(userOnlineService.loginUserToUserOnline(user));
|
||||
}
|
||||
}
|
||||
Collections.reverse(userOnlineList);
|
||||
userOnlineList.removeAll(Collections.singleton(null));
|
||||
return getDataTable(userOnlineList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 强退用户
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')")
|
||||
@Log(title = "在线用户", businessType = BusinessType.FORCE)
|
||||
@DeleteMapping("/{tokenId}")
|
||||
public AjaxResult forceLogout(@PathVariable String tokenId)
|
||||
{
|
||||
redisCache.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + tokenId);
|
||||
return success();
|
||||
}
|
||||
}
|
@ -0,0 +1,133 @@
|
||||
package com.bs.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.bs.common.annotation.Log;
|
||||
import com.bs.common.core.controller.BaseController;
|
||||
import com.bs.common.core.domain.AjaxResult;
|
||||
import com.bs.common.core.page.TableDataInfo;
|
||||
import com.bs.common.enums.BusinessType;
|
||||
import com.bs.common.utils.poi.ExcelUtil;
|
||||
import com.bs.system.domain.SysConfig;
|
||||
import com.bs.system.service.ISysConfigService;
|
||||
|
||||
/**
|
||||
* 参数配置 信息操作处理
|
||||
*
|
||||
* @author bs
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/config")
|
||||
public class SysConfigController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysConfigService configService;
|
||||
|
||||
/**
|
||||
* 获取参数配置列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:config:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysConfig config)
|
||||
{
|
||||
startPage();
|
||||
List<SysConfig> list = configService.selectConfigList(config);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "参数管理", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:config:export')")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysConfig config)
|
||||
{
|
||||
List<SysConfig> list = configService.selectConfigList(config);
|
||||
ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
|
||||
util.exportExcel(response, list, "参数数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据参数编号获取详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:config:query')")
|
||||
@GetMapping(value = "/{configId}")
|
||||
public AjaxResult getInfo(@PathVariable Long configId)
|
||||
{
|
||||
return success(configService.selectConfigById(configId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据参数键名查询参数值
|
||||
*/
|
||||
@GetMapping(value = "/configKey/{configKey}")
|
||||
public AjaxResult getConfigKey(@PathVariable String configKey)
|
||||
{
|
||||
return success(configService.selectConfigByKey(configKey));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增参数配置
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:config:add')")
|
||||
@Log(title = "参数管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysConfig config)
|
||||
{
|
||||
if (!configService.checkConfigKeyUnique(config))
|
||||
{
|
||||
return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||
}
|
||||
config.setCreateBy(getUsername());
|
||||
return toAjax(configService.insertConfig(config));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改参数配置
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:config:edit')")
|
||||
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysConfig config)
|
||||
{
|
||||
if (!configService.checkConfigKeyUnique(config))
|
||||
{
|
||||
return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||
}
|
||||
config.setUpdateBy(getUsername());
|
||||
return toAjax(configService.updateConfig(config));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除参数配置
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:config:remove')")
|
||||
@Log(title = "参数管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{configIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] configIds)
|
||||
{
|
||||
configService.deleteConfigByIds(configIds);
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新参数缓存
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:config:remove')")
|
||||
@Log(title = "参数管理", businessType = BusinessType.CLEAN)
|
||||
@DeleteMapping("/refreshCache")
|
||||
public AjaxResult refreshCache()
|
||||
{
|
||||
configService.resetConfigCache();
|
||||
return success();
|
||||
}
|
||||
}
|
@ -0,0 +1,121 @@
|
||||
package com.bs.web.controller.system;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.bs.common.annotation.Log;
|
||||
import com.bs.common.core.controller.BaseController;
|
||||
import com.bs.common.core.domain.AjaxResult;
|
||||
import com.bs.common.core.domain.entity.SysDictData;
|
||||
import com.bs.common.core.page.TableDataInfo;
|
||||
import com.bs.common.enums.BusinessType;
|
||||
import com.bs.common.utils.StringUtils;
|
||||
import com.bs.common.utils.poi.ExcelUtil;
|
||||
import com.bs.system.service.ISysDictDataService;
|
||||
import com.bs.system.service.ISysDictTypeService;
|
||||
|
||||
/**
|
||||
* 数据字典信息
|
||||
*
|
||||
* @author bs
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/dict/data")
|
||||
public class SysDictDataController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysDictDataService dictDataService;
|
||||
|
||||
@Autowired
|
||||
private ISysDictTypeService dictTypeService;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysDictData dictData)
|
||||
{
|
||||
startPage();
|
||||
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "字典数据", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:export')")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysDictData dictData)
|
||||
{
|
||||
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
||||
ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
|
||||
util.exportExcel(response, list, "字典数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询字典数据详细
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:query')")
|
||||
@GetMapping(value = "/{dictCode}")
|
||||
public AjaxResult getInfo(@PathVariable Long dictCode)
|
||||
{
|
||||
return success(dictDataService.selectDictDataById(dictCode));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字典类型查询字典数据信息
|
||||
*/
|
||||
@GetMapping(value = "/type/{dictType}")
|
||||
public AjaxResult dictType(@PathVariable String dictType)
|
||||
{
|
||||
List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
|
||||
if (StringUtils.isNull(data))
|
||||
{
|
||||
data = new ArrayList<SysDictData>();
|
||||
}
|
||||
return success(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增字典类型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:add')")
|
||||
@Log(title = "字典数据", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysDictData dict)
|
||||
{
|
||||
dict.setCreateBy(getUsername());
|
||||
return toAjax(dictDataService.insertDictData(dict));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存字典类型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:edit')")
|
||||
@Log(title = "字典数据", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysDictData dict)
|
||||
{
|
||||
dict.setUpdateBy(getUsername());
|
||||
return toAjax(dictDataService.updateDictData(dict));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除字典类型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
||||
@Log(title = "字典类型", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{dictCodes}")
|
||||
public AjaxResult remove(@PathVariable Long[] dictCodes)
|
||||
{
|
||||
dictDataService.deleteDictDataByIds(dictCodes);
|
||||
return success();
|
||||
}
|
||||
}
|
@ -0,0 +1,131 @@
|
||||
package com.bs.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.bs.common.annotation.Log;
|
||||
import com.bs.common.core.controller.BaseController;
|
||||
import com.bs.common.core.domain.AjaxResult;
|
||||
import com.bs.common.core.domain.entity.SysDictType;
|
||||
import com.bs.common.core.page.TableDataInfo;
|
||||
import com.bs.common.enums.BusinessType;
|
||||
import com.bs.common.utils.poi.ExcelUtil;
|
||||
import com.bs.system.service.ISysDictTypeService;
|
||||
|
||||
/**
|
||||
* 数据字典信息
|
||||
*
|
||||
* @author bs
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/dict/type")
|
||||
public class SysDictTypeController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysDictTypeService dictTypeService;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysDictType dictType)
|
||||
{
|
||||
startPage();
|
||||
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "字典类型", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:export')")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysDictType dictType)
|
||||
{
|
||||
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
||||
ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
|
||||
util.exportExcel(response, list, "字典类型");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询字典类型详细
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:query')")
|
||||
@GetMapping(value = "/{dictId}")
|
||||
public AjaxResult getInfo(@PathVariable Long dictId)
|
||||
{
|
||||
return success(dictTypeService.selectDictTypeById(dictId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增字典类型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:add')")
|
||||
@Log(title = "字典类型", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysDictType dict)
|
||||
{
|
||||
if (!dictTypeService.checkDictTypeUnique(dict))
|
||||
{
|
||||
return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||
}
|
||||
dict.setCreateBy(getUsername());
|
||||
return toAjax(dictTypeService.insertDictType(dict));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改字典类型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:edit')")
|
||||
@Log(title = "字典类型", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysDictType dict)
|
||||
{
|
||||
if (!dictTypeService.checkDictTypeUnique(dict))
|
||||
{
|
||||
return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||
}
|
||||
dict.setUpdateBy(getUsername());
|
||||
return toAjax(dictTypeService.updateDictType(dict));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除字典类型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
||||
@Log(title = "字典类型", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{dictIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] dictIds)
|
||||
{
|
||||
dictTypeService.deleteDictTypeByIds(dictIds);
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新字典缓存
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
||||
@Log(title = "字典类型", businessType = BusinessType.CLEAN)
|
||||
@DeleteMapping("/refreshCache")
|
||||
public AjaxResult refreshCache()
|
||||
{
|
||||
dictTypeService.resetDictCache();
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字典选择框列表
|
||||
*/
|
||||
@GetMapping("/optionselect")
|
||||
public AjaxResult optionselect()
|
||||
{
|
||||
List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
|
||||
return success(dictTypes);
|
||||
}
|
||||
}
|
@ -0,0 +1,129 @@
|
||||
package com.bs.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.bs.common.annotation.Log;
|
||||
import com.bs.common.core.controller.BaseController;
|
||||
import com.bs.common.core.domain.AjaxResult;
|
||||
import com.bs.common.core.page.TableDataInfo;
|
||||
import com.bs.common.enums.BusinessType;
|
||||
import com.bs.common.utils.poi.ExcelUtil;
|
||||
import com.bs.system.domain.SysPost;
|
||||
import com.bs.system.service.ISysPostService;
|
||||
|
||||
/**
|
||||
* 岗位信息操作处理
|
||||
*
|
||||
* @author bs
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/post")
|
||||
public class SysPostController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysPostService postService;
|
||||
|
||||
/**
|
||||
* 获取岗位列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:post:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysPost post)
|
||||
{
|
||||
startPage();
|
||||
List<SysPost> list = postService.selectPostList(post);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "岗位管理", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:post:export')")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysPost post)
|
||||
{
|
||||
List<SysPost> list = postService.selectPostList(post);
|
||||
ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
|
||||
util.exportExcel(response, list, "岗位数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据岗位编号获取详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:post:query')")
|
||||
@GetMapping(value = "/{postId}")
|
||||
public AjaxResult getInfo(@PathVariable Long postId)
|
||||
{
|
||||
return success(postService.selectPostById(postId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增岗位
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:post:add')")
|
||||
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysPost post)
|
||||
{
|
||||
if (!postService.checkPostNameUnique(post))
|
||||
{
|
||||
return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||
}
|
||||
else if (!postService.checkPostCodeUnique(post))
|
||||
{
|
||||
return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||
}
|
||||
post.setCreateBy(getUsername());
|
||||
return toAjax(postService.insertPost(post));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改岗位
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:post:edit')")
|
||||
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysPost post)
|
||||
{
|
||||
if (!postService.checkPostNameUnique(post))
|
||||
{
|
||||
return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||
}
|
||||
else if (!postService.checkPostCodeUnique(post))
|
||||
{
|
||||
return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||
}
|
||||
post.setUpdateBy(getUsername());
|
||||
return toAjax(postService.updatePost(post));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除岗位
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:post:remove')")
|
||||
@Log(title = "岗位管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{postIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] postIds)
|
||||
{
|
||||
return toAjax(postService.deletePostByIds(postIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取岗位选择框列表
|
||||
*/
|
||||
@GetMapping("/optionselect")
|
||||
public AjaxResult optionselect()
|
||||
{
|
||||
List<SysPost> posts = postService.selectPostAll();
|
||||
return success(posts);
|
||||
}
|
||||
}
|
@ -0,0 +1,147 @@
|
||||
package com.bs.web.controller.system;
|
||||
|
||||
import cn.hutool.core.lang.Validator;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.bs.common.annotation.Log;
|
||||
import com.bs.common.config.BsConfig;
|
||||
import com.bs.common.core.controller.BaseController;
|
||||
import com.bs.common.core.domain.AjaxResult;
|
||||
import com.bs.common.core.domain.entity.SysTenant;
|
||||
import com.bs.common.core.domain.entity.SysUser;
|
||||
import com.bs.common.core.domain.model.LoginUser;
|
||||
import com.bs.common.enums.BusinessType;
|
||||
import com.bs.common.utils.SecurityUtils;
|
||||
import com.bs.common.utils.file.FileUploadUtils;
|
||||
import com.bs.common.utils.file.MimeTypeUtils;
|
||||
import com.bs.framework.web.service.TokenService;
|
||||
import com.bs.system.service.ISysUserService;
|
||||
import com.bs.system.service.SysTenantService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 个人信息 业务处理
|
||||
*
|
||||
* @author bs
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/user/profile")
|
||||
public class SysProfileController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
@Autowired
|
||||
private SysTenantService sysTenantService;
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
/**
|
||||
* 个人信息
|
||||
*/
|
||||
@GetMapping
|
||||
public AjaxResult profile()
|
||||
{
|
||||
LoginUser loginUser = getLoginUser();
|
||||
SysUser user = loginUser.getUser();
|
||||
AjaxResult ajax = AjaxResult.success(user);
|
||||
ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername()));
|
||||
ajax.put("postGroup", userService.selectUserPostGroup(loginUser.getUsername()));
|
||||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户
|
||||
*/
|
||||
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult updateProfile(@RequestBody SysUser user)
|
||||
{
|
||||
LoginUser loginUser = getLoginUser();
|
||||
SysUser sysUser = loginUser.getUser();
|
||||
user.setUserName(sysUser.getUserName());
|
||||
if (Validator.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
|
||||
{
|
||||
return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||
}
|
||||
if (Validator.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
|
||||
{
|
||||
return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||
}
|
||||
user.setUserId(sysUser.getUserId());
|
||||
user.setPassword(null);
|
||||
user.setAvatar(null);
|
||||
user.setDeptId(null);
|
||||
if (userService.updateUserProfile(user) > 0)
|
||||
{
|
||||
// 更新缓存用户信息
|
||||
sysUser.setNickName(user.getNickName());
|
||||
sysUser.setPhonenumber(user.getPhonenumber());
|
||||
sysUser.setEmail(user.getEmail());
|
||||
sysUser.setSex(user.getSex());
|
||||
tokenService.setLoginUser(loginUser);
|
||||
return success();
|
||||
}
|
||||
return error("修改个人信息异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置密码
|
||||
*/
|
||||
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/updatePwd")
|
||||
public AjaxResult updatePwd(String oldPassword, String newPassword)
|
||||
{
|
||||
LoginUser loginUser = getLoginUser();
|
||||
String userName = loginUser.getUsername();
|
||||
String password = loginUser.getPassword();
|
||||
if (!SecurityUtils.matchesPassword(oldPassword, password))
|
||||
{
|
||||
return error("修改密码失败,旧密码错误");
|
||||
}
|
||||
if (SecurityUtils.matchesPassword(newPassword, password))
|
||||
{
|
||||
return error("新密码不能与旧密码相同");
|
||||
}
|
||||
if (userService.resetUserPwd(userName, SecurityUtils.encryptPassword(newPassword)) > 0)
|
||||
{
|
||||
SysUser user = userService.getOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUserName, userName));
|
||||
//如果是租户管理员,密码写一份到租户信息
|
||||
if(user.getIsTenantAdmin().equals("Y")){
|
||||
SysTenant sysTenant = sysTenantService.getById(user.getTenantId());
|
||||
sysTenant.setPassword(newPassword);
|
||||
sysTenantService.updateById(sysTenant);
|
||||
}
|
||||
// 更新缓存用户密码
|
||||
loginUser.getUser().setPassword(SecurityUtils.encryptPassword(newPassword));
|
||||
tokenService.setLoginUser(loginUser);
|
||||
return success();
|
||||
}
|
||||
return error("修改密码异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 头像上传
|
||||
*/
|
||||
@Log(title = "用户头像", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/avatar")
|
||||
public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) throws Exception
|
||||
{
|
||||
if (!file.isEmpty())
|
||||
{
|
||||
LoginUser loginUser = getLoginUser();
|
||||
String avatar = FileUploadUtils.upload(BsConfig.getAvatarPath(), file, MimeTypeUtils.IMAGE_EXTENSION);
|
||||
if (userService.updateUserAvatar(loginUser.getUsername(), avatar))
|
||||
{
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("imgUrl", avatar);
|
||||
// 更新缓存用户头像
|
||||
loginUser.getUser().setAvatar(avatar);
|
||||
tokenService.setLoginUser(loginUser);
|
||||
return ajax;
|
||||
}
|
||||
}
|
||||
return error("上传图片异常,请联系管理员");
|
||||
}
|
||||
}
|
@ -0,0 +1,135 @@
|
||||
package com.bs.web.controller.system;
|
||||
|
||||
import cn.hutool.core.lang.Validator;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.bs.common.constant.Constants;
|
||||
import com.bs.common.core.domain.entity.SysRole;
|
||||
import com.bs.common.core.domain.entity.SysTenant;
|
||||
import com.bs.common.core.domain.entity.SysUser;
|
||||
import com.bs.common.core.domain.model.LoginUser;
|
||||
import com.bs.framework.web.service.SysLoginService;
|
||||
import com.bs.framework.web.service.SysPermissionService;
|
||||
import com.bs.framework.web.service.TokenService;
|
||||
import com.bs.system.domain.SysUserRole;
|
||||
import com.bs.system.mapper.SysRoleMapper;
|
||||
import com.bs.system.mapper.SysUserMapper;
|
||||
import com.bs.system.mapper.SysUserRoleMapper;
|
||||
import com.bs.system.service.ISysUserService;
|
||||
import io.swagger.util.Json;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.bs.common.core.controller.BaseController;
|
||||
import com.bs.common.core.domain.AjaxResult;
|
||||
import com.bs.common.core.domain.model.RegisterBody;
|
||||
import com.bs.common.utils.StringUtils;
|
||||
import com.bs.framework.web.service.SysRegisterService;
|
||||
import com.bs.system.service.ISysConfigService;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 注册验证
|
||||
*
|
||||
* @author bs
|
||||
*/
|
||||
@RestController
|
||||
public class SysRegisterController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private SysRegisterService registerService;
|
||||
|
||||
@Autowired
|
||||
private ISysConfigService configService;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
@Autowired
|
||||
private SysUserMapper userMapper;
|
||||
|
||||
@Autowired
|
||||
private SysLoginService loginService;
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
@Autowired
|
||||
private SysUserRoleMapper sysUserRoleMapper;
|
||||
@Autowired
|
||||
private SysRoleMapper sysRoleMapper;
|
||||
@Autowired
|
||||
private SysPermissionService permissionService;
|
||||
@PostMapping("/register")
|
||||
public AjaxResult register(@RequestBody RegisterBody user)
|
||||
{
|
||||
// if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser"))))
|
||||
// {
|
||||
// return error("当前系统没有开启注册功能!");
|
||||
// }
|
||||
String msg = registerService.register(user);
|
||||
if (Validator.isNotEmpty(msg)) {
|
||||
return error(msg);
|
||||
}
|
||||
LambdaQueryWrapper<SysUser> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SysUser::getUserName,user.getUsername());
|
||||
List<SysUser> sysUsers = userMapper.selectList(wrapper);
|
||||
SysUser sysUser = sysUsers.get(0);
|
||||
userService.insertUserAuth(sysUser.getUserId(), new Long[]{2L});
|
||||
LoginUser loginUser = createLoginUser(sysUser, null);
|
||||
String token = tokenService.createToken(loginUser);
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put(Constants.TOKEN, token);
|
||||
return ajax;
|
||||
}
|
||||
|
||||
@GetMapping("/ceshi")
|
||||
public AjaxResult ceshi()
|
||||
{
|
||||
// if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser"))))
|
||||
// {
|
||||
// return error("当前系统没有开启注册功能!");
|
||||
// }
|
||||
RegisterBody user = new RegisterBody();
|
||||
user.setPassword("123456");
|
||||
user.setUsername("测试手机号5");
|
||||
user.setPhonenumber("18396103855");
|
||||
// INSERT INTO sys_user (user_id, dept_id, user_name, nick_name, email, phonenumber, sex, avatar, password, status, review_status,
|
||||
// tenant_id, user_type, create_time)
|
||||
// VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
// 09:56:48.703 [http-nio-8089-exec-19] DEBUG c.b.s.m.S.insertNew - [debug,137] - ==> Parameters: 1737683808874(Long), 0(Long),
|
||||
// 测试手机号2(String), 测试手机号2(String), null, 18396103859(String), null, null
|
||||
|
||||
String msg = registerService.register(user);
|
||||
if (Validator.isNotEmpty(msg)) {
|
||||
return error(msg);
|
||||
}
|
||||
LambdaQueryWrapper<SysUser> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SysUser::getUserName,user.getUsername());
|
||||
List<SysUser> sysUsers = userMapper.selectList(wrapper);
|
||||
SysUser sysUser = sysUsers.get(0);
|
||||
userService.insertUserAuth(sysUser.getUserId(), new Long[]{2L});
|
||||
LoginUser loginUser = createLoginUser(sysUser, null);
|
||||
String token = tokenService.createToken(loginUser);
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put(Constants.TOKEN, token);
|
||||
return ajax;
|
||||
}
|
||||
|
||||
public LoginUser createLoginUser(SysUser user, SysTenant tenant) {
|
||||
//查询用户下的权限
|
||||
LambdaQueryWrapper<SysUserRole> userRoleWrapper = new LambdaQueryWrapper<>();
|
||||
userRoleWrapper.select(SysUserRole::getRoleId);
|
||||
userRoleWrapper.eq(SysUserRole::getUserId,user.getUserId());
|
||||
List<Object> roleIds = sysUserRoleMapper.selectObjs(userRoleWrapper);
|
||||
//查询用户下的权限
|
||||
LambdaQueryWrapper<SysRole> roleWrapper = new LambdaQueryWrapper<>();
|
||||
roleWrapper.in(SysRole::getRoleId,roleIds);
|
||||
user.setRoles(sysRoleMapper.selectList(roleWrapper));
|
||||
return new LoginUser(user.getUserId(), user.getDeptId(), user, permissionService.getMenuPermission(user));
|
||||
}
|
||||
}
|
@ -0,0 +1,262 @@
|
||||
package com.bs.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.bs.common.annotation.Log;
|
||||
import com.bs.common.core.controller.BaseController;
|
||||
import com.bs.common.core.domain.AjaxResult;
|
||||
import com.bs.common.core.domain.entity.SysDept;
|
||||
import com.bs.common.core.domain.entity.SysRole;
|
||||
import com.bs.common.core.domain.entity.SysUser;
|
||||
import com.bs.common.core.domain.model.LoginUser;
|
||||
import com.bs.common.core.page.TableDataInfo;
|
||||
import com.bs.common.enums.BusinessType;
|
||||
import com.bs.common.utils.StringUtils;
|
||||
import com.bs.common.utils.poi.ExcelUtil;
|
||||
import com.bs.framework.web.service.SysPermissionService;
|
||||
import com.bs.framework.web.service.TokenService;
|
||||
import com.bs.system.domain.SysUserRole;
|
||||
import com.bs.system.service.ISysDeptService;
|
||||
import com.bs.system.service.ISysRoleService;
|
||||
import com.bs.system.service.ISysUserService;
|
||||
|
||||
/**
|
||||
* 角色信息
|
||||
*
|
||||
* @author bs
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/role")
|
||||
public class SysRoleController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysRoleService roleService;
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
@Autowired
|
||||
private SysPermissionService permissionService;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
@Autowired
|
||||
private ISysDeptService deptService;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:role:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysRole role)
|
||||
{
|
||||
startPage();
|
||||
List<SysRole> list = roleService.selectRoleList(role);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "角色管理", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:role:export')")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysRole role)
|
||||
{
|
||||
List<SysRole> list = roleService.selectRoleList(role);
|
||||
ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class);
|
||||
util.exportExcel(response, list, "角色数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据角色编号获取详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:query')")
|
||||
@GetMapping(value = "/{roleId}")
|
||||
public AjaxResult getInfo(@PathVariable Long roleId)
|
||||
{
|
||||
roleService.checkRoleDataScope(roleId);
|
||||
return success(roleService.selectRoleById(roleId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增角色
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:add')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysRole role)
|
||||
{
|
||||
if (!roleService.checkRoleNameUnique(role))
|
||||
{
|
||||
return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||
}
|
||||
else if (!roleService.checkRoleKeyUnique(role))
|
||||
{
|
||||
return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
||||
}
|
||||
role.setCreateBy(getUsername());
|
||||
return toAjax(roleService.insertRole(role));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存角色
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysRole role)
|
||||
{
|
||||
roleService.checkRoleAllowed(role);
|
||||
roleService.checkRoleDataScope(role.getRoleId());
|
||||
if (!roleService.checkRoleNameUnique(role))
|
||||
{
|
||||
return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||
}
|
||||
else if (!roleService.checkRoleKeyUnique(role))
|
||||
{
|
||||
return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
||||
}
|
||||
role.setUpdateBy(getUsername());
|
||||
|
||||
if (roleService.updateRole(role) > 0)
|
||||
{
|
||||
// 更新缓存用户权限
|
||||
LoginUser loginUser = getLoginUser();
|
||||
if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin())
|
||||
{
|
||||
loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser()));
|
||||
loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName()));
|
||||
tokenService.setLoginUser(loginUser);
|
||||
}
|
||||
return success();
|
||||
}
|
||||
return error("修改角色'" + role.getRoleName() + "'失败,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存数据权限
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/dataScope")
|
||||
public AjaxResult dataScope(@RequestBody SysRole role)
|
||||
{
|
||||
roleService.checkRoleAllowed(role);
|
||||
roleService.checkRoleDataScope(role.getRoleId());
|
||||
return toAjax(roleService.authDataScope(role));
|
||||
}
|
||||
|
||||
/**
|
||||
* 状态修改
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/changeStatus")
|
||||
public AjaxResult changeStatus(@RequestBody SysRole role)
|
||||
{
|
||||
roleService.checkRoleAllowed(role);
|
||||
roleService.checkRoleDataScope(role.getRoleId());
|
||||
role.setUpdateBy(getUsername());
|
||||
return toAjax(roleService.updateRoleStatus(role));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除角色
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:remove')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{roleIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] roleIds)
|
||||
{
|
||||
return toAjax(roleService.deleteRoleByIds(roleIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取角色选择框列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:query')")
|
||||
@GetMapping("/optionselect")
|
||||
public AjaxResult optionselect()
|
||||
{
|
||||
return success(roleService.selectRoleAll());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询已分配用户角色列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:list')")
|
||||
@GetMapping("/authUser/allocatedList")
|
||||
public TableDataInfo allocatedList(SysUser user)
|
||||
{
|
||||
startPage();
|
||||
List<SysUser> list = userService.selectAllocatedList(user);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询未分配用户角色列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:list')")
|
||||
@GetMapping("/authUser/unallocatedList")
|
||||
public TableDataInfo unallocatedList(SysUser user)
|
||||
{
|
||||
startPage();
|
||||
List<SysUser> list = userService.selectUnallocatedList(user);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消授权用户
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||
@PutMapping("/authUser/cancel")
|
||||
public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole)
|
||||
{
|
||||
return toAjax(roleService.deleteAuthUser(userRole));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量取消授权用户
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||
@PutMapping("/authUser/cancelAll")
|
||||
public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds)
|
||||
{
|
||||
return toAjax(roleService.deleteAuthUsers(roleId, userIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量选择用户授权
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||
@PutMapping("/authUser/selectAll")
|
||||
public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds)
|
||||
{
|
||||
roleService.checkRoleDataScope(roleId);
|
||||
return toAjax(roleService.insertAuthUsers(roleId, userIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取对应角色部门树列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:query')")
|
||||
@GetMapping(value = "/deptTree/{roleId}")
|
||||
public AjaxResult deptTree(@PathVariable("roleId") Long roleId)
|
||||
{
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
|
||||
ajax.put("depts", deptService.selectDeptTreeList(new SysDept()));
|
||||
return ajax;
|
||||
}
|
||||
}
|
@ -0,0 +1,231 @@
|
||||
package com.bs.web.controller.system;
|
||||
|
||||
import cn.hutool.core.lang.Validator;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.bs.common.annotation.Log;
|
||||
import com.bs.common.config.BsConfig;
|
||||
import com.bs.common.core.controller.BaseController;
|
||||
import com.bs.common.core.domain.AjaxResult;
|
||||
import com.bs.common.core.domain.entity.TenantConfig;
|
||||
import com.bs.common.core.page.TableDataInfo;
|
||||
import com.bs.common.enums.BusinessType;
|
||||
import com.bs.common.utils.file.FileUploadUtils;
|
||||
import com.bs.common.utils.file.MimeTypeUtils;
|
||||
import com.bs.common.utils.poi.ExcelUtil;
|
||||
import com.bs.system.service.ITenantConfigService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 租户配置Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-04-02
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/tenant/config")
|
||||
public class TenantConfigController extends BaseController {
|
||||
@Autowired
|
||||
private ITenantConfigService tenantConfigService;
|
||||
|
||||
/**
|
||||
* 分页查询租户配置列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('tenant:config:pageList')")
|
||||
@GetMapping("/pageList")
|
||||
public TableDataInfo pageList(TenantConfig tenantConfig) {
|
||||
startPage();
|
||||
LambdaQueryWrapper<TenantConfig> queryWrapper = new LambdaQueryWrapper();
|
||||
condition(queryWrapper, tenantConfig);
|
||||
List<TenantConfig> list = tenantConfigService.list(queryWrapper);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询租户配置列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('tenant:config:list')")
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(TenantConfig tenantConfig) {
|
||||
LambdaQueryWrapper<TenantConfig> queryWrapper = new LambdaQueryWrapper();
|
||||
condition(queryWrapper, tenantConfig);
|
||||
List<TenantConfig> list = tenantConfigService.list(queryWrapper);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出租户配置列表
|
||||
*/
|
||||
@Log(title = "租户配置导出", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, TenantConfig tenantConfig) {
|
||||
LambdaQueryWrapper<TenantConfig> queryWrapper = new LambdaQueryWrapper();
|
||||
condition(queryWrapper, tenantConfig);
|
||||
List<TenantConfig> list = tenantConfigService.list(queryWrapper);
|
||||
ExcelUtil<TenantConfig> util = new ExcelUtil<TenantConfig>(TenantConfig.class);
|
||||
util.exportExcel(response, list, "租户配置数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取租户配置详细信息
|
||||
*/
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") String id) {
|
||||
TenantConfig tenantConfig = tenantConfigService.getById(id);
|
||||
tenantConfig.setTenantId(tenantConfig.getId()) ;
|
||||
return success(tenantConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增租户配置
|
||||
*/
|
||||
@Log(title = "租户配置新增", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody TenantConfig tenantConfig) {
|
||||
tenantConfig.setId(tenantConfig.getTenantId()) ;
|
||||
return toAjax(tenantConfigService.save(tenantConfig));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改租户配置
|
||||
*/
|
||||
@Log(title = "租户配置修改", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody TenantConfig tenantConfig) {
|
||||
tenantConfig.setId(tenantConfig.getTenantId()) ;
|
||||
return toAjax(tenantConfigService.updateById(tenantConfig));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除租户配置
|
||||
*/
|
||||
@Log(title = "租户配置删除", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable List<Long> ids) {
|
||||
return toAjax(tenantConfigService.removeBatchByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 租户logo图片上传
|
||||
*/
|
||||
@Log(title = "租户logo图片上传", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/logo")
|
||||
public AjaxResult avatar(@RequestParam("tenantLogo") MultipartFile file) throws Exception {
|
||||
if (!file.isEmpty()) {
|
||||
String logo = FileUploadUtils.upload(BsConfig.getUploadPath(), file, MimeTypeUtils.IMAGE_EXTENSION);
|
||||
AjaxResult ajax = success();
|
||||
ajax.put("imgUrl", logo);
|
||||
return ajax;
|
||||
}
|
||||
return error("上传图片异常,请联系管理员");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 条件设置
|
||||
*/
|
||||
private void condition(LambdaQueryWrapper<TenantConfig> queryWrapper, TenantConfig tenantConfig) {
|
||||
|
||||
|
||||
//${column.columnComment}
|
||||
if (Validator.isNotEmpty(tenantConfig.getId())) {
|
||||
queryWrapper.eq(TenantConfig::getId, tenantConfig.getId());
|
||||
}
|
||||
|
||||
//开始时间
|
||||
if (tenantConfig.getStartData() != null) {
|
||||
queryWrapper.eq(TenantConfig::getStartData, tenantConfig.getStartData());
|
||||
}
|
||||
|
||||
//结束时间
|
||||
if (tenantConfig.getStopData() != null) {
|
||||
queryWrapper.eq(TenantConfig::getStopData, tenantConfig.getStopData());
|
||||
}
|
||||
|
||||
//是否限制用户数
|
||||
if (Validator.isNotEmpty(tenantConfig.getIsUserAstrict())) {
|
||||
queryWrapper.eq(TenantConfig::getIsUserAstrict, tenantConfig.getIsUserAstrict());
|
||||
}
|
||||
|
||||
//用户数
|
||||
if (tenantConfig.getUserQuantity() != null) {
|
||||
queryWrapper.eq(TenantConfig::getUserQuantity, tenantConfig.getUserQuantity());
|
||||
}
|
||||
|
||||
//是否限制在线数
|
||||
if (Validator.isNotEmpty(tenantConfig.getIsOnLine())) {
|
||||
queryWrapper.eq(TenantConfig::getIsOnLine, tenantConfig.getIsOnLine());
|
||||
}
|
||||
|
||||
//在线数
|
||||
if (tenantConfig.getOnLineUserQuantity() != null) {
|
||||
queryWrapper.eq(TenantConfig::getOnLineUserQuantity, tenantConfig.getOnLineUserQuantity());
|
||||
}
|
||||
|
||||
//是否定义系统名称
|
||||
if (Validator.isNotEmpty(tenantConfig.getIsDefinitionName())) {
|
||||
queryWrapper.eq(TenantConfig::getIsDefinitionName, tenantConfig.getIsDefinitionName());
|
||||
}
|
||||
|
||||
//系统名称
|
||||
if (Validator.isNotEmpty(tenantConfig.getSysName())) {
|
||||
queryWrapper.like(TenantConfig::getSysName, tenantConfig.getSysName());
|
||||
}
|
||||
|
||||
//是否定义系统logo
|
||||
if (Validator.isNotEmpty(tenantConfig.getIsDefinitionLogo())) {
|
||||
queryWrapper.eq(TenantConfig::getIsDefinitionLogo, tenantConfig.getIsDefinitionLogo());
|
||||
}
|
||||
|
||||
//系统log
|
||||
if (Validator.isNotEmpty(tenantConfig.getSysLog())) {
|
||||
queryWrapper.eq(TenantConfig::getSysLog, tenantConfig.getSysLog());
|
||||
}
|
||||
|
||||
//是否定义系统色调
|
||||
if (Validator.isNotEmpty(tenantConfig.getIsDefinitionHue())) {
|
||||
queryWrapper.eq(TenantConfig::getIsDefinitionHue, tenantConfig.getIsDefinitionHue());
|
||||
}
|
||||
|
||||
//系统色调
|
||||
if (Validator.isNotEmpty(tenantConfig.getSysHue())) {
|
||||
queryWrapper.eq(TenantConfig::getSysHue, tenantConfig.getSysHue());
|
||||
}
|
||||
|
||||
//定制化数据,键值对{key:{type1:"",type2:"",value:""},key2:{type1:"",type2:"",value:""}}具体操作时候,做具体说明
|
||||
if (Validator.isNotEmpty(tenantConfig.getCustomizationFields())) {
|
||||
queryWrapper.eq(TenantConfig::getCustomizationFields, tenantConfig.getCustomizationFields());
|
||||
}
|
||||
|
||||
|
||||
//创建人员
|
||||
if (Validator.isNotEmpty(tenantConfig.getCreateBy())) {
|
||||
queryWrapper.eq(TenantConfig::getCreateBy, tenantConfig.getCreateBy());
|
||||
}
|
||||
|
||||
|
||||
//修改人员
|
||||
if (Validator.isNotEmpty(tenantConfig.getUpdateBy())) {
|
||||
queryWrapper.eq(TenantConfig::getUpdateBy, tenantConfig.getUpdateBy());
|
||||
}
|
||||
|
||||
|
||||
//部门ID
|
||||
if (Validator.isNotEmpty(tenantConfig.getCreateDept())) {
|
||||
queryWrapper.eq(TenantConfig::getCreateDept, tenantConfig.getCreateDept());
|
||||
}
|
||||
|
||||
//删除标示 默认为1 有效数据 ,0为无效已删除
|
||||
if (Validator.isNotEmpty(tenantConfig.getDelFlag())) {
|
||||
queryWrapper.eq(TenantConfig::getDelFlag, tenantConfig.getDelFlag());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,183 @@
|
||||
package com.bs.web.controller.tool;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.bs.common.core.controller.BaseController;
|
||||
import com.bs.common.core.domain.R;
|
||||
import com.bs.common.utils.StringUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
/**
|
||||
* swagger 用户测试方法
|
||||
*
|
||||
* @author bs
|
||||
*/
|
||||
@Api("用户信息管理")
|
||||
@RestController
|
||||
@RequestMapping("/test/user")
|
||||
public class TestController extends BaseController
|
||||
{
|
||||
private final static Map<Integer, UserEntity> users = new LinkedHashMap<Integer, UserEntity>();
|
||||
{
|
||||
users.put(1, new UserEntity(1, "admin", "admin123", "15888888888"));
|
||||
users.put(2, new UserEntity(2, "ry", "admin123", "15666666666"));
|
||||
}
|
||||
|
||||
@ApiOperation("获取用户列表")
|
||||
@GetMapping("/list")
|
||||
public R<List<UserEntity>> userList()
|
||||
{
|
||||
List<UserEntity> userList = new ArrayList<UserEntity>(users.values());
|
||||
return R.ok(userList);
|
||||
}
|
||||
|
||||
@ApiOperation("获取用户详细")
|
||||
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class)
|
||||
@GetMapping("/{userId}")
|
||||
public R<UserEntity> getUser(@PathVariable Integer userId)
|
||||
{
|
||||
if (!users.isEmpty() && users.containsKey(userId))
|
||||
{
|
||||
return R.ok(users.get(userId));
|
||||
}
|
||||
else
|
||||
{
|
||||
return R.fail("用户不存在");
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("新增用户")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "userId", value = "用户id", dataType = "Integer", dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name = "username", value = "登陆账号", dataType = "String", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "password", value = "用户密码", dataType = "String", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "mobile", value = "用户手机", dataType = "String", dataTypeClass = String.class)
|
||||
})
|
||||
@PostMapping("/save")
|
||||
public R<String> save(UserEntity user)
|
||||
{
|
||||
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
|
||||
{
|
||||
return R.fail("用户ID不能为空");
|
||||
}
|
||||
users.put(user.getUserId(), user);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ApiOperation("更新用户")
|
||||
@PutMapping("/update")
|
||||
public R<String> update(@RequestBody UserEntity user)
|
||||
{
|
||||
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
|
||||
{
|
||||
return R.fail("用户ID不能为空");
|
||||
}
|
||||
if (users.isEmpty() || !users.containsKey(user.getUserId()))
|
||||
{
|
||||
return R.fail("用户不存在");
|
||||
}
|
||||
users.remove(user.getUserId());
|
||||
users.put(user.getUserId(), user);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ApiOperation("删除用户信息")
|
||||
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class)
|
||||
@DeleteMapping("/{userId}")
|
||||
public R<String> delete(@PathVariable Integer userId)
|
||||
{
|
||||
if (!users.isEmpty() && users.containsKey(userId))
|
||||
{
|
||||
users.remove(userId);
|
||||
return R.ok();
|
||||
}
|
||||
else
|
||||
{
|
||||
return R.fail("用户不存在");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ApiModel(value = "UserEntity", description = "用户实体")
|
||||
class UserEntity
|
||||
{
|
||||
@ApiModelProperty("用户ID")
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty("登陆账号")
|
||||
private String username;
|
||||
|
||||
@ApiModelProperty("用户密码")
|
||||
private String password;
|
||||
|
||||
@ApiModelProperty("用户手机")
|
||||
private String mobile;
|
||||
|
||||
public UserEntity()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public UserEntity(Integer userId, String username, String password, String mobile)
|
||||
{
|
||||
this.userId = userId;
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
this.mobile = mobile;
|
||||
}
|
||||
|
||||
public Integer getUserId()
|
||||
{
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Integer userId)
|
||||
{
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getUsername()
|
||||
{
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username)
|
||||
{
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword()
|
||||
{
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password)
|
||||
{
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getMobile()
|
||||
{
|
||||
return mobile;
|
||||
}
|
||||
|
||||
public void setMobile(String mobile)
|
||||
{
|
||||
this.mobile = mobile;
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,132 @@
|
||||
package com.bs.web.utils;
|
||||
|
||||
import cn.hutool.json.JSONArray;
|
||||
import cn.hutool.json.JSONException;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.XML;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
class Sign {
|
||||
|
||||
@Resource
|
||||
private WeiXinUtil weiXinUtil;
|
||||
public static void main(String[] args) {
|
||||
String jsapi_ticket = " <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
|
||||
"<Root>\n" +
|
||||
" <Corporation Name=\"三明市***电脑贸易有限公司\"/>\n" +
|
||||
" <Corporation Name=\"三明市**运输有限公司\"/>\n" +
|
||||
" <Corporation Name=\"东山县****有限公司\"/>\n" +
|
||||
" <Corporation Name=\"中科**(福建)****有限公司\"/>\n" +
|
||||
" <Corporation Name=\"仙游县*****铜门加工厂\"/>\n" +
|
||||
" <Corporation Name=\"光泽县****开发有限公司\"/>\n" +
|
||||
" <Corporation Name=\"南安市******有限公司\"/>\n" +
|
||||
" <Corporation Name=\"南安市****加工厂\"/>\n" +
|
||||
" <Corporation Name=\"南安****有限公司\"/>\n" +
|
||||
" <Corporation Name=\"南靖县******有限公司\"/>\n" +
|
||||
"</Root>";
|
||||
|
||||
String s = convertXmlToJson(jsapi_ticket);
|
||||
Map<String, Object> mapJson = new HashMap<>();
|
||||
try {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapJson = mapper.readValue(s, Map.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Object messageJson = mapJson.get("Root");
|
||||
LinkedHashMap<String, Object> nestedMapNts = (LinkedHashMap<String, Object>) messageJson;
|
||||
LinkedHashMap<String, LinkedHashMap<String, Object>> nestedMapInfo = (LinkedHashMap<String, LinkedHashMap<String, Object>>) messageJson;
|
||||
Object corporation = nestedMapNts.get("Corporation");
|
||||
try {
|
||||
JSONArray jsonArray = new JSONArray(corporation);
|
||||
List<String> names = new ArrayList<>();
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
JSONObject jsonObject = jsonArray.getJSONObject(i);
|
||||
String name = jsonObject.getStr("Name");
|
||||
names.add(name);
|
||||
}
|
||||
System.out.println(names);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
public static Map<String, String> sign(String jsapi_ticket, String url) {
|
||||
Map<String, String> ret = new HashMap<String, String>();
|
||||
String nonce_str = create_nonce_str();
|
||||
String timestamp = create_timestamp();
|
||||
String string1;
|
||||
String signature = "";
|
||||
|
||||
//注意这里参数名必须全部小写,且必须有序
|
||||
string1 = "jsapi_ticket=" + jsapi_ticket +
|
||||
"&noncestr=" + nonce_str +
|
||||
"×tamp=" + timestamp +
|
||||
"&url=" + url;
|
||||
try
|
||||
{
|
||||
MessageDigest crypt = MessageDigest.getInstance("SHA-1");
|
||||
crypt.reset();
|
||||
crypt.update(string1.getBytes("UTF-8"));
|
||||
signature = byteToHex(crypt.digest());
|
||||
}
|
||||
catch (NoSuchAlgorithmException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch (UnsupportedEncodingException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
ret.put("url", url);
|
||||
ret.put("jsapi_ticket", jsapi_ticket);
|
||||
ret.put("nonceStr", nonce_str);
|
||||
ret.put("timestamp", timestamp);
|
||||
ret.put("signature", signature);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
private static String byteToHex(final byte[] hash) {
|
||||
Formatter formatter = new Formatter();
|
||||
for (byte b : hash)
|
||||
{
|
||||
formatter.format("%02x", b);
|
||||
}
|
||||
String result = formatter.toString();
|
||||
formatter.close();
|
||||
return result;
|
||||
}
|
||||
|
||||
private static String create_nonce_str() {
|
||||
return UUID.randomUUID().toString();
|
||||
}
|
||||
|
||||
private static String create_timestamp() {
|
||||
return Long.toString(System.currentTimeMillis() / 1000);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static String convertXmlToJson(String xmlString) {
|
||||
JSONObject jsonObject = XML.toJSONObject(xmlString); // 使用JSON库将XML字符串转换为JSONObject对象
|
||||
String jsonString = jsonObject.toString(); // 将JSONObject对象转换为JSON字符串
|
||||
return jsonString;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1 @@
|
||||
restart.include.json=/com.alibaba.fastjson.*.jar
|
@ -0,0 +1,68 @@
|
||||
# 数据源配置
|
||||
spring:
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
url: jdbc:mysql://localhost:3306/df-broker?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&rewriteBatchedStatements=true
|
||||
username: root
|
||||
password: root
|
||||
# url: jdbc:mysql://120.77.170.30:3306/df-broker?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&rewriteBatchedStatements=true
|
||||
# username: root
|
||||
# password: fastrise@chain
|
||||
# 从库数据源
|
||||
slave:
|
||||
# 从数据源开关/默认关闭
|
||||
enabled: false
|
||||
url:
|
||||
username:
|
||||
password:
|
||||
# 初始连接数
|
||||
initialSize: 5
|
||||
# 最小连接池数量
|
||||
minIdle: 10
|
||||
# 最大连接池数量
|
||||
maxActive: 20
|
||||
# 配置获取连接等待超时的时间
|
||||
maxWait: 60000
|
||||
# 配置连接超时时间
|
||||
connectTimeout: 30000
|
||||
# 配置网络超时时间
|
||||
socketTimeout: 60000
|
||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||
timeBetweenEvictionRunsMillis: 60000
|
||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||
minEvictableIdleTimeMillis: 300000
|
||||
# 配置一个连接在池中最大生存的时间,单位是毫秒
|
||||
maxEvictableIdleTimeMillis: 900000
|
||||
# 配置检测连接是否有效
|
||||
validationQuery: SELECT 1 FROM DUAL
|
||||
testWhileIdle: true
|
||||
testOnBorrow: false
|
||||
testOnReturn: false
|
||||
webStatFilter:
|
||||
enabled: true
|
||||
statViewServlet:
|
||||
enabled: true
|
||||
# 设置白名单,不填则允许所有访问
|
||||
allow:
|
||||
url-pattern: /druid/*
|
||||
# 控制台管理用户名和密码
|
||||
login-username: bs
|
||||
login-password: 123456
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
# 慢SQL记录
|
||||
log-slow-sql: true
|
||||
slow-sql-millis: 1000
|
||||
merge-sql: true
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
bs:
|
||||
tenant:
|
||||
#开启租户
|
||||
openTenant: true
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue