Merge branch 'master' of https://gitee.com/op-souls/ghy-all
This commit is contained in:
commit
fbb96f42d7
|
|
@ -0,0 +1,125 @@
|
|||
package com.ghy.web.controller.customer;
|
||||
|
||||
import com.ghy.common.core.controller.BaseController;
|
||||
import com.ghy.common.core.domain.AjaxResult;
|
||||
import com.ghy.common.utils.ExceptionUtil;
|
||||
import com.ghy.customer.domain.CustomerAddress;
|
||||
import com.ghy.customer.service.CustomerAddressService;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/customer/address")
|
||||
public class CustomerAddressController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private CustomerAddressService customerAddressService;
|
||||
|
||||
/**
|
||||
* @param customerAddress 筛选符合条件的地址list
|
||||
* @return 地址list
|
||||
*/
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
AjaxResult getCustomerAddressList(CustomerAddress customerAddress){
|
||||
try {
|
||||
return AjaxResult.success(customerAddressService.getCustomerAddressList(customerAddress));
|
||||
}catch (Exception e){
|
||||
return AjaxResult.error(ExceptionUtil.getExceptionMessage(e));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ids 地址id
|
||||
* @return 删除成功条数
|
||||
*/
|
||||
@PostMapping("/deleteByIds")
|
||||
@ResponseBody
|
||||
AjaxResult deleteByIds(String [] ids){
|
||||
try {
|
||||
customerAddressService.deleteByIds(ids);
|
||||
return AjaxResult.success("操作成功");
|
||||
}catch (Exception e){
|
||||
return AjaxResult.error(ExceptionUtil.getExceptionMessage(e));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param customerAddressId 地址id
|
||||
* @return 删除成功条数
|
||||
*/
|
||||
@PostMapping("/delete")
|
||||
@ResponseBody
|
||||
AjaxResult deleteByCustomerAddressId(Long customerAddressId){
|
||||
try {
|
||||
customerAddressService.deleteByCustomerAddressId(customerAddressId);
|
||||
return AjaxResult.success("操作成功");
|
||||
}catch (Exception e){
|
||||
return AjaxResult.error(ExceptionUtil.getExceptionMessage(e));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param customerId 消费者id
|
||||
* @return 消费者所有的地址list
|
||||
*/
|
||||
@PostMapping("/getByCustomerId")
|
||||
@ResponseBody
|
||||
AjaxResult selectByCustomerId(Long customerId){
|
||||
try {
|
||||
return AjaxResult.success(customerAddressService.selectByCustomerId(customerId));
|
||||
}catch (Exception e){
|
||||
return AjaxResult.error(ExceptionUtil.getExceptionMessage(e));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param customerAddressId 地址id
|
||||
* @return 地址
|
||||
*/
|
||||
@PostMapping("/getByCustomerAddressId")
|
||||
@ResponseBody
|
||||
AjaxResult selectByCustomerAddressId(Long customerAddressId){
|
||||
try {
|
||||
return AjaxResult.success(customerAddressService.selectByCustomerAddressId(customerAddressId));
|
||||
}catch (Exception e){
|
||||
return AjaxResult.error(ExceptionUtil.getExceptionMessage(e));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param customerAddress 地址信息
|
||||
* @return 新增成功条数
|
||||
*/
|
||||
@PostMapping("/insert")
|
||||
@ResponseBody
|
||||
AjaxResult insertCustomerAddress(CustomerAddress customerAddress){
|
||||
try {
|
||||
|
||||
return AjaxResult.success("操作成功");
|
||||
}catch (Exception e){
|
||||
return AjaxResult.error(ExceptionUtil.getExceptionMessage(e));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param customerAddress 修改地址信息
|
||||
* @return 修改成功条数
|
||||
*/
|
||||
@PostMapping("/update")
|
||||
@ResponseBody
|
||||
AjaxResult updateCustomerAddress(CustomerAddress customerAddress){
|
||||
try {
|
||||
customerAddressService.updateCustomerAddress(customerAddress);
|
||||
return AjaxResult.success("操作成功");
|
||||
}catch (Exception e){
|
||||
return AjaxResult.error(ExceptionUtil.getExceptionMessage(e));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -5,9 +5,8 @@ import com.ghy.common.constant.UserConstants;
|
|||
import com.ghy.common.core.controller.BaseController;
|
||||
import com.ghy.common.core.domain.AjaxResult;
|
||||
import com.ghy.common.core.domain.Ztree;
|
||||
import com.ghy.common.core.domain.entity.SysDept;
|
||||
import com.ghy.common.core.page.TableDataInfo;
|
||||
import com.ghy.common.enums.BusinessType;
|
||||
import com.ghy.common.utils.ShiroUtils;
|
||||
import com.ghy.goods.domain.GoodsCategory;
|
||||
import com.ghy.goods.service.GoodsCategoryService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
|
|
@ -42,8 +41,7 @@ public class GoodsCategoryController extends BaseController {
|
|||
* 新增部门
|
||||
*/
|
||||
@GetMapping("/add/{parentCategoryId}")
|
||||
public String add(@PathVariable("parentCategoryId") Long parentCategoryId, ModelMap mmap)
|
||||
{
|
||||
public String add(@PathVariable("parentCategoryId") Long parentCategoryId, ModelMap mmap) {
|
||||
mmap.put("goodsCategory", goodsCategoryService.selectById(parentCategoryId));
|
||||
return PREFIX + "/add";
|
||||
}
|
||||
|
|
@ -88,9 +86,9 @@ public class GoodsCategoryController extends BaseController {
|
|||
*/
|
||||
@RequiresPermissions("goods:category:remove")
|
||||
@Log(title = "商品类别管理", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/remove")
|
||||
@PostMapping("/remove/{ids}")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids) {
|
||||
public AjaxResult remove(@PathVariable("ids") String ids) {
|
||||
try {
|
||||
return toAjax(goodsCategoryService.deleteGoodsCategoryByIds(ids));
|
||||
} catch (Exception e) {
|
||||
|
|
@ -119,36 +117,41 @@ public class GoodsCategoryController extends BaseController {
|
|||
* 选择部门树
|
||||
*
|
||||
* @param categoryId 类目ID
|
||||
* @param excludeId 排除ID
|
||||
* @param excludeId 排除ID
|
||||
*/
|
||||
@GetMapping(value = { "/selectGoodsCategoryTree/{categoryId}", "/selectGoodsCategoryTree/{categoryId}/{excludeId}" })
|
||||
@GetMapping(value = {"/selectGoodsCategoryTree/{categoryId}", "/selectGoodsCategoryTree/{categoryId}/{excludeId}"})
|
||||
public String selectDeptTree(@PathVariable("categoryId") Long categoryId,
|
||||
@PathVariable(value = "excludeId", required = false) String excludeId, ModelMap mmap)
|
||||
{
|
||||
@PathVariable(value = "excludeId", required = false) String excludeId, ModelMap mmap) {
|
||||
mmap.put("goodsCategory", goodsCategoryService.selectById(categoryId));
|
||||
mmap.put("excludeId", excludeId);
|
||||
return PREFIX + "/tree";
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载部门列表树
|
||||
* 商品类目树
|
||||
*/
|
||||
@GetMapping("/treeData")
|
||||
@ResponseBody
|
||||
public List<Ztree> treeData()
|
||||
{
|
||||
public List<Ztree> treeData() {
|
||||
return goodsCategoryService.selectCategoryTree(new GoodsCategory());
|
||||
}
|
||||
|
||||
@GetMapping("/tree")
|
||||
@ResponseBody
|
||||
public List<Ztree> tree() {
|
||||
Long deptId = ShiroUtils.getSysUser().getDept().getParentId();
|
||||
return goodsCategoryService.tree(deptId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载部门列表树(排除下级)
|
||||
*/
|
||||
@GetMapping("/treeData/{excludeId}")
|
||||
@ResponseBody
|
||||
public List<Ztree> treeDataExcludeChild(@PathVariable(value = "excludeId", required = false) Long excludeId)
|
||||
{
|
||||
public List<Ztree> treeDataExcludeChild(@PathVariable(value = "excludeId", required = false) Long excludeId) {
|
||||
return goodsCategoryService.selectCategoryTree(new GoodsCategory());
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品类别表
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -4,10 +4,12 @@ import com.ghy.common.annotation.Log;
|
|||
import com.ghy.common.core.controller.BaseController;
|
||||
import com.ghy.common.core.domain.AjaxResult;
|
||||
import com.ghy.common.core.domain.Ztree;
|
||||
import com.ghy.common.core.text.Convert;
|
||||
import com.ghy.common.enums.BusinessType;
|
||||
import com.ghy.common.utils.ShiroUtils;
|
||||
import com.ghy.goods.domain.DeptGoodsCategory;
|
||||
import com.ghy.goods.service.DeptGoodsCategoryService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
|
|
@ -33,11 +35,37 @@ public class GoodsDeptCategoryController extends BaseController {
|
|||
|
||||
|
||||
@RequiresPermissions("goods:deptcategory:add")
|
||||
@GetMapping("/add/{id}")
|
||||
public String edit(@PathVariable(name = "id") Long id, ModelMap mmap) {
|
||||
@GetMapping("/add/1")
|
||||
public String add() {
|
||||
return PREFIX + "/add";
|
||||
}
|
||||
|
||||
@RequiresPermissions("goods:deptcategory:add")
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult add(String menuIds) {
|
||||
Long parentId = ShiroUtils.getSysUser().getDept().getParentId();
|
||||
Long[] categoryIds = Convert.toLongArray(menuIds);
|
||||
return deptGoodsCategoryService.batchAdd(parentId, categoryIds);
|
||||
}
|
||||
|
||||
@RequiresPermissions("goods:deptcategory:edit")
|
||||
@GetMapping("/edit/{id}")
|
||||
public String edit(@PathVariable("id") Long id, ModelMap mmap) {
|
||||
DeptGoodsCategory deptGoodsCategory = deptGoodsCategoryService.get(id);
|
||||
mmap.put("deptGoodsCategory", deptGoodsCategory);
|
||||
return PREFIX + "/edit";
|
||||
}
|
||||
|
||||
@RequiresPermissions("goods:deptcategory:edit")
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult edit(DeptGoodsCategory category) {
|
||||
category.setUpdateBy(getLoginName());
|
||||
deptGoodsCategoryService.edit(category);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品类别表
|
||||
*/
|
||||
|
|
@ -45,7 +73,7 @@ public class GoodsDeptCategoryController extends BaseController {
|
|||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public List<DeptGoodsCategory> list(DeptGoodsCategory category) {
|
||||
Long parentId = ShiroUtils.getSysUser().getParentId();
|
||||
Long parentId = ShiroUtils.getSysUser().getDept().getParentId();
|
||||
category.setDeptId(parentId);
|
||||
return deptGoodsCategoryService.list(category);
|
||||
}
|
||||
|
|
@ -53,9 +81,8 @@ public class GoodsDeptCategoryController extends BaseController {
|
|||
@GetMapping("/tree")
|
||||
@ResponseBody
|
||||
public List<Ztree> goodsDeptCategoryTree() {
|
||||
Long parentId = ShiroUtils.getSysUser().getParentId();
|
||||
Long parentId = ShiroUtils.getSysUser().getDept().getParentId();
|
||||
return deptGoodsCategoryService.tree(parentId);
|
||||
|
||||
}
|
||||
|
||||
@PostMapping("/app/list")
|
||||
|
|
@ -69,9 +96,9 @@ public class GoodsDeptCategoryController extends BaseController {
|
|||
*/
|
||||
@RequiresPermissions("goods:deptcategory:remove")
|
||||
@Log(title = "子公司商品类别管理", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/remove")
|
||||
@PostMapping("/remove/{ids}")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids) {
|
||||
public AjaxResult remove(@PathVariable("ids") String ids) {
|
||||
try {
|
||||
return toAjax(deptGoodsCategoryService.delete(ids));
|
||||
} catch (Exception e) {
|
||||
|
|
|
|||
|
|
@ -1,112 +1,121 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
|
||||
<head>
|
||||
<th:block th:include="include :: header('类目列表')" />
|
||||
<th:block th:include="include :: header('类目列表')"/>
|
||||
</head>
|
||||
<body class="gray-bg">
|
||||
<div class="container-div">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 search-collapse">
|
||||
<form id="dept-form">
|
||||
<div class="select-list">
|
||||
<ul>
|
||||
<li>
|
||||
类目名称:<input type="text" name="goodsCategoryName"/>
|
||||
</li>
|
||||
<li>
|
||||
类目状态:<select name="status" th:with="type=${@dict.getType('sys_normal_disable')}">
|
||||
<option value="">所有</option>
|
||||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
|
||||
</select>
|
||||
</li>
|
||||
<li>
|
||||
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.treeTable.search()"><i class="fa fa-search"></i> 搜索</a>
|
||||
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i> 重置</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="container-div">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 search-collapse">
|
||||
<form id="dept-form">
|
||||
<div class="select-list">
|
||||
<ul>
|
||||
<li>
|
||||
类目名称:<input type="text" name="goodsCategoryName"/>
|
||||
</li>
|
||||
<li>
|
||||
类目状态:<select name="status" th:with="type=${@dict.getType('sys_normal_disable')}">
|
||||
<option value="">所有</option>
|
||||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}"
|
||||
th:value="${dict.dictValue}"></option>
|
||||
</select>
|
||||
</li>
|
||||
<li>
|
||||
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.treeTable.search()"><i
|
||||
class="fa fa-search"></i> 搜索</a>
|
||||
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
|
||||
class="fa fa-refresh"></i> 重置</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="btn-group-sm" id="toolbar" role="group">
|
||||
<a class="btn btn-success" onclick="$.operate.add(1)" shiro:hasPermission="goods:category:add">
|
||||
<i class="fa fa-plus"></i> 新增
|
||||
</a>
|
||||
<a class="btn btn-primary" onclick="$.operate.edit()" shiro:hasPermission="goods:category:edit">
|
||||
<i class="fa fa-edit"></i> 修改
|
||||
</a>
|
||||
<a class="btn btn-info" id="expandAllBtn">
|
||||
<i class="fa fa-exchange"></i> 展开/折叠
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-sm-12 select-table table-striped">
|
||||
<table id="bootstrap-tree-table"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<th:block th:include="include :: footer" />
|
||||
<script th:inline="javascript">
|
||||
var addFlag = [[${@permission.hasPermi('goods:category:add')}]];
|
||||
var editFlag = [[${@permission.hasPermi('goods:category:edit')}]];
|
||||
var removeFlag = [[${@permission.hasPermi('goods:category:remove')}]];
|
||||
var datas = [[${@dict.getType('sys_normal_disable')}]];
|
||||
var prefix = ctx + "goods/category"
|
||||
<div class="btn-group-sm" id="toolbar" role="group">
|
||||
<a class="btn btn-success" onclick="$.operate.add(1)" shiro:hasPermission="goods:category:add">
|
||||
<i class="fa fa-plus"></i> 新增
|
||||
</a>
|
||||
<a class="btn btn-primary" onclick="$.operate.edit()" shiro:hasPermission="goods:category:edit">
|
||||
<i class="fa fa-edit"></i> 修改
|
||||
</a>
|
||||
<a class="btn btn-info" id="expandAllBtn">
|
||||
<i class="fa fa-exchange"></i> 展开/折叠
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-sm-12 select-table table-striped">
|
||||
<table id="bootstrap-tree-table"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<th:block th:include="include :: footer"/>
|
||||
<script th:inline="javascript">
|
||||
var addFlag = [[${@permission.hasPermi('goods:category:add')}]];
|
||||
var editFlag = [[${@permission.hasPermi('goods:category:edit')}]];
|
||||
var removeFlag = [[${@permission.hasPermi('goods:category:remove')}]];
|
||||
var datas = [[${@dict.getType('sys_normal_disable')}]];
|
||||
var prefix = ctx + "goods/category"
|
||||
|
||||
$(function() {
|
||||
var options = {
|
||||
code: "goodsCategoryId",
|
||||
parentCode: "parentCategoryId",
|
||||
uniqueId: "goodsCategoryId",
|
||||
url: prefix + "/list",
|
||||
createUrl: prefix + "/add/{id}",
|
||||
updateUrl: prefix + "/edit/{id}",
|
||||
removeUrl: prefix + "/remove/{id}",
|
||||
modalName: "类目",
|
||||
columns: [{
|
||||
field: 'selectItem',
|
||||
radio: true
|
||||
},
|
||||
{
|
||||
field: 'goodsCategoryName',
|
||||
title: '类目名称',
|
||||
align: "left"
|
||||
},
|
||||
{
|
||||
field: 'categorySort',
|
||||
title: '排序',
|
||||
align: "left"
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
title: '状态',
|
||||
align: "left",
|
||||
formatter: function(value, item, index) {
|
||||
return $.table.selectDictLabel(datas, item.status);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
title: '创建时间',
|
||||
align: "left"
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
align: 'left',
|
||||
formatter: function(value, row, index) {
|
||||
if (row.parentId != 0) {
|
||||
var actions = [];
|
||||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.goodsCategoryId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
|
||||
actions.push('<a class="btn btn-info btn-xs ' + addFlag + '" href="javascript:void(0)" onclick="$.operate.add(\'' + row.goodsCategoryId + '\')"><i class="fa fa-plus"></i>新增</a> ');
|
||||
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.goodsCategoryId + '\')"><i class="fa fa-trash"></i>删除</a>');
|
||||
return actions.join('');
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}]
|
||||
};
|
||||
$.treeTable.init(options);
|
||||
});
|
||||
</script>
|
||||
$(function () {
|
||||
var options = {
|
||||
code: "goodsCategoryId",
|
||||
parentCode: "parentCategoryId",
|
||||
uniqueId: "goodsCategoryId",
|
||||
url: prefix + "/list",
|
||||
createUrl: prefix + "/add/{id}",
|
||||
updateUrl: prefix + "/edit/{id}",
|
||||
removeUrl: prefix + "/remove/{id}",
|
||||
modalName: "类目",
|
||||
columns: [{
|
||||
field: 'selectItem',
|
||||
radio: true
|
||||
},
|
||||
{
|
||||
field: 'goodsCategoryName',
|
||||
title: '类目名称',
|
||||
align: "left"
|
||||
},
|
||||
{
|
||||
field: 'categorySort',
|
||||
title: '排序',
|
||||
align: "left"
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
title: '状态',
|
||||
align: "left",
|
||||
formatter: function (value, item, index) {
|
||||
return $.table.selectDictLabel(datas, item.status);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
title: '创建时间',
|
||||
align: "left"
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
align: 'left',
|
||||
formatter: function (value, row, index) {
|
||||
if (row.parentId !== 0) {
|
||||
var actions = [];
|
||||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.goodsCategoryId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
|
||||
actions.push('<a class="btn btn-info btn-xs ' + addFlag + '" href="javascript:void(0)" onclick="$.operate.add(\'' + row.goodsCategoryId + '\')"><i class="fa fa-plus"></i>新增</a> ');
|
||||
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="remove(\'' + row.goodsCategoryId + '\')"><i class="fa fa-trash"></i>删除</a>');
|
||||
return actions.join('');
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}]
|
||||
};
|
||||
$.treeTable.init(options);
|
||||
});
|
||||
|
||||
function remove(id) {
|
||||
$.modal.confirm("确认要删除吗", function () {
|
||||
$.operate.post(prefix + '/remove/' + id);
|
||||
})
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,87 +1,86 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<th:block th:include="include :: header('新增分公司类目')" />
|
||||
<th:block th:include="include :: ztree-css" />
|
||||
<th:block th:include="include :: header('新增分公司类目')"/>
|
||||
<th:block th:include="include :: ztree-css"/>
|
||||
</head>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-category-add">
|
||||
<div class="form-group">
|
||||
<div class="col-sm-8">
|
||||
<label class="check-box">
|
||||
<input type="checkbox" value="1">展开/折叠</label>
|
||||
<label class="check-box">
|
||||
<input type="checkbox" value="2">全选/全不选</label>
|
||||
<label class="check-box">
|
||||
<input type="checkbox" value="3" checked>父子联动</label>
|
||||
<div id="menuTrees" class="ztree ztree-border"></div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<th:block th:include="include :: footer" />
|
||||
<th:block th:include="include :: ztree-js" />
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
var url = ctx + "goods/deptcategory/tree";
|
||||
var options = {
|
||||
id: "menuTrees",
|
||||
url: url,
|
||||
check: { enable: true },
|
||||
expandLevel: 0
|
||||
};
|
||||
$.tree.init(options);
|
||||
});
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-category-add">
|
||||
<div class="form-group">
|
||||
<div class="col-sm-8">
|
||||
<label class="check-box">
|
||||
<input type="checkbox" value="1">展开/折叠</label>
|
||||
<label class="check-box">
|
||||
<input type="checkbox" value="2">全选/全不选</label>
|
||||
<label class="check-box">
|
||||
<input type="checkbox" value="3" checked>父子联动</label>
|
||||
<div id="menuTrees" class="ztree ztree-border"></div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
$('input').on('ifChanged', function(obj){
|
||||
var type = $(this).val();
|
||||
var checked = obj.currentTarget.checked;
|
||||
if (type == 1) {
|
||||
if (checked) {
|
||||
$._tree.expandAll(true);
|
||||
} else {
|
||||
$._tree.expandAll(false);
|
||||
}
|
||||
} else if (type == "2") {
|
||||
if (checked) {
|
||||
$._tree.checkAllNodes(true);
|
||||
} else {
|
||||
$._tree.checkAllNodes(false);
|
||||
}
|
||||
} else if (type == "3") {
|
||||
if (checked) {
|
||||
$._tree.setting.check.chkboxType = { "Y": "ps", "N": "ps" };
|
||||
} else {
|
||||
$._tree.setting.check.chkboxType = { "Y": "", "N": "" };
|
||||
}
|
||||
}
|
||||
})
|
||||
<th:block th:include="include :: footer"/>
|
||||
<th:block th:include="include :: ztree-js"/>
|
||||
|
||||
function add() {
|
||||
var menuIds = $.tree.getCheckedNodes("goodsCategoryId");
|
||||
$.ajax({
|
||||
cache : true,
|
||||
type : "POST",
|
||||
url : ctx + "system/role/edit",
|
||||
data : {
|
||||
"menuIds": menuIds
|
||||
},
|
||||
async : false,
|
||||
error : function(request) {
|
||||
$.modal.alertError("系统错误");
|
||||
},
|
||||
success : function(data) {
|
||||
$.operate.successCallback(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var url = ctx + "goods/category/tree";
|
||||
var options = {
|
||||
id: "menuTrees",
|
||||
url: url,
|
||||
check: {enable: true},
|
||||
expandLevel: 0
|
||||
};
|
||||
$.tree.init(options);
|
||||
});
|
||||
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
add();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
$('input').on('ifChanged', function (obj) {
|
||||
var type = $(this).val();
|
||||
var checked = obj.currentTarget.checked;
|
||||
if (type === 1) {
|
||||
if (checked) {
|
||||
$._tree.expandAll(true);
|
||||
} else {
|
||||
$._tree.expandAll(false);
|
||||
}
|
||||
} else if (type == "2") {
|
||||
if (checked) {
|
||||
$._tree.checkAllNodes(true);
|
||||
} else {
|
||||
$._tree.checkAllNodes(false);
|
||||
}
|
||||
} else if (type == "3") {
|
||||
if (checked) {
|
||||
$._tree.setting.check.chkboxType = {"Y": "ps", "N": "ps"};
|
||||
} else {
|
||||
$._tree.setting.check.chkboxType = {"Y": "", "N": ""};
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
function add() {
|
||||
var menuIds = $.tree.getCheckedNodes("id");
|
||||
$.ajax({
|
||||
cache: true,
|
||||
type: "POST",
|
||||
url: ctx + "goods/deptcategory/add?menuIds=" + menuIds,
|
||||
async: false,
|
||||
error: function (request) {
|
||||
$.modal.alertError("系统错误");
|
||||
},
|
||||
success: function (data) {
|
||||
$.operate.successCallback(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
add();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
</div>
|
||||
|
||||
<div class="btn-group-sm" id="toolbar" role="group">
|
||||
<a class="btn btn-primary" onclick="$.operate.add(1)" shiro:hasPermission="goods:category:edit">
|
||||
<a class="btn btn-primary" onclick="$.operate.add(1)" shiro:hasPermission="goods:category:add">
|
||||
<i class="fa fa-edit"></i> 修改
|
||||
</a>
|
||||
<a class="btn btn-info" id="expandAllBtn">
|
||||
|
|
@ -46,68 +46,89 @@
|
|||
</div>
|
||||
<th:block th:include="include :: footer"/>
|
||||
<script th:inline="javascript">
|
||||
var addFlag = [[${@permission.hasPermi('goods:category:add')}]];
|
||||
var editFlag = [[${@permission.hasPermi('goods:category:edit')}]];
|
||||
var removeFlag = [[${@permission.hasPermi('goods:category:remove')}]];
|
||||
var datas = [[${@dict.getType('sys_normal_disable')}]];
|
||||
var prefix = ctx + "goods/deptcategory"
|
||||
var addFlag = [[${@permission.hasPermi('goods:category:add')}]];
|
||||
var editFlag = [[${@permission.hasPermi('goods:category:edit')}]];
|
||||
var removeFlag = [[${@permission.hasPermi('goods:category:remove')}]];
|
||||
var datas = [[${@dict.getType('sys_normal_disable')}]];
|
||||
var prefix = ctx + "goods/deptcategory"
|
||||
|
||||
$(function() {
|
||||
var options = {
|
||||
code: "goodsCategoryId",
|
||||
parentCode: "parentCategoryId",
|
||||
uniqueId: "goodsCategoryId",
|
||||
url: prefix + "/list",
|
||||
addUrl: prefix + "/add/{id}",
|
||||
createUrl: prefix + "/add/{id}",
|
||||
updateUrl: prefix + "/edit/{id}",
|
||||
removeUrl: prefix + "/remove/{id}",
|
||||
modalName: "类目",
|
||||
columns: [{
|
||||
field: 'selectItem',
|
||||
radio: true
|
||||
},
|
||||
{
|
||||
field: 'goodsCategoryName',
|
||||
title: '类目名称',
|
||||
align: "left"
|
||||
},
|
||||
{
|
||||
field: 'categorySort',
|
||||
title: '排序',
|
||||
align: "left"
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
title: '状态',
|
||||
align: "left",
|
||||
formatter: function(value, item, index) {
|
||||
return $.table.selectDictLabel(datas, item.status);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
title: '创建时间',
|
||||
align: "left"
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
align: 'left',
|
||||
formatter: function(value, row, index) {
|
||||
if (row.parentId != 0) {
|
||||
var actions = [];
|
||||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.goodsCategoryId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
|
||||
actions.push('<a class="btn btn-info btn-xs ' + addFlag + '" href="javascript:void(0)" onclick="$.operate.add(\'' + row.goodsCategoryId + '\')"><i class="fa fa-plus"></i>新增</a> ');
|
||||
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.goodsCategoryId + '\')"><i class="fa fa-trash"></i>删除</a>');
|
||||
return actions.join('');
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}]
|
||||
};
|
||||
$.treeTable.init(options);
|
||||
});
|
||||
$(function () {
|
||||
var options = {
|
||||
code: "goodsCategoryId",
|
||||
parentCode: "parentCategoryId",
|
||||
uniqueId: "goodsCategoryId",
|
||||
url: prefix + "/list",
|
||||
addUrl: prefix + "/add/{id}",
|
||||
createUrl: prefix + "/add/{id}",
|
||||
updateUrl: prefix + "/edit/{id}",
|
||||
removeUrl: prefix + "/remove/{id}",
|
||||
modalName: "类目",
|
||||
columns: [{
|
||||
field: 'selectItem',
|
||||
radio: true
|
||||
},
|
||||
{
|
||||
field: 'goodsCategoryName',
|
||||
title: '类目名称',
|
||||
align: "left"
|
||||
},
|
||||
{
|
||||
field: 'oneRate',
|
||||
title: '一级分销扣点',
|
||||
align: "left"
|
||||
},
|
||||
{
|
||||
field: 'twoRate',
|
||||
title: '二级分销扣点',
|
||||
align: "left"
|
||||
},
|
||||
{
|
||||
field: 'threeRate',
|
||||
title: '三级分销扣点',
|
||||
align: "left"
|
||||
},
|
||||
// {
|
||||
// field: 'categorySort',
|
||||
// title: '排序',
|
||||
// align: "left"
|
||||
// },
|
||||
{
|
||||
field: 'status',
|
||||
title: '状态',
|
||||
align: "left",
|
||||
formatter: function (value, item, index) {
|
||||
return $.table.selectDictLabel(datas, item.status);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
title: '创建时间',
|
||||
align: "left"
|
||||
},
|
||||
{
|
||||
field: 'remark',
|
||||
title: '备注',
|
||||
align: "left"
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
align: 'left',
|
||||
formatter: function (value, row, index) {
|
||||
if (row.parentId !== 0) {
|
||||
var actions = [];
|
||||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.deptGoodsCategoryId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
|
||||
// actions.push('<a class="btn btn-info btn-xs ' + addFlag + '" href="javascript:void(0)" onclick="$.operate.add(\'' + row.deptGoodsCategoryId + '\')"><i class="fa fa-plus"></i>新增</a> ');
|
||||
// actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="remove(\'' + row.deptGoodsCategoryId + '\')"><i class="fa fa-trash"></i>删除</a>');
|
||||
return actions.join('');
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
$.treeTable.init(options);
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,98 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
|
||||
|
||||
<head>
|
||||
<th:block th:include="include :: header('修改商品类目')"/>
|
||||
<th:block th:include="include :: select2-css"/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="main-content">
|
||||
<form class="form-horizontal" id="form-deptGoodsCategory-edit" th:object="${deptGoodsCategory}">
|
||||
<input id="deptGoodsCategoryId" name="deptGoodsCategoryId" type="hidden" th:field="*{deptGoodsCategoryId}"/>
|
||||
<h4 class="form-header h4">基本信息</h4>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label is-required">类目名称:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="goodsCategoryName" placeholder="请输入商品名称" class="form-control" type="text" maxlength="30"
|
||||
th:field="*{goodsCategoryName}"
|
||||
disabled>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label is-required">一级分销扣点比例:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="oneRate" placeholder="请输入一级分销扣点比例" class="form-control" type="text" maxlength="12"
|
||||
th:field="*{oneRate}"
|
||||
required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label is-required">二级分销扣点比例:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="twoRate" placeholder="请输入二级分销扣点比例" class="form-control" type="text"
|
||||
th:field="*{twoRate}"
|
||||
maxlength="12" required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label is-required">三级分销扣点比例:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="threeRate" placeholder="请输入三级分销扣点比例" class="form-control" type="text" maxlength="12"
|
||||
th:field="*{threeRate}"
|
||||
required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4 class="form-header h4">其他信息</h4>
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="form-group">
|
||||
<label class="col-xs-2 control-label">备注:</label>
|
||||
<div class="col-xs-10">
|
||||
<textarea name="remark" maxlength="500" class="form-control" rows="3"
|
||||
th:field="*{remark}"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<th:block th:include="include :: footer"/>
|
||||
<th:block th:include="include :: select2-js"/>
|
||||
|
||||
<script type="text/javascript">
|
||||
var prefix = ctx + "goods/deptcategory";
|
||||
|
||||
$("#form-deptGoodsCategory-edit").validate({
|
||||
onkeyup: false,
|
||||
rules: {},
|
||||
messages: {},
|
||||
focusCleanup: true
|
||||
});
|
||||
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
var data = $("#form-deptGoodsCategory-edit").serializeArray();
|
||||
$.operate.saveTab(prefix + "/edit", data);
|
||||
$.modal.close();
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,136 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
|
||||
<head>
|
||||
<th:block th:include="include :: header('订单列表')"/>
|
||||
<th:block th:include="include :: layout-latest-css"/>
|
||||
<th:block th:include="include :: ztree-css"/>
|
||||
</head>
|
||||
<body class="gray-bg">
|
||||
|
||||
<div class="ui-layout-center">
|
||||
<div class="container-div">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 search-collapse">
|
||||
<form id="order-form">
|
||||
<input type="hidden" id="deptId" name="deptId">
|
||||
<input type="hidden" id="parentId" name="parentId">
|
||||
<div class="select-list">
|
||||
<ul>
|
||||
<li>
|
||||
订单号:<input type="text" name="code"/>
|
||||
</li>
|
||||
<li>
|
||||
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
|
||||
class="fa fa-search"></i> 搜索</a>
|
||||
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
|
||||
class="fa fa-refresh"></i> 重置</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="btn-group-sm" id="toolbar" role="group">
|
||||
<a class="btn btn-warning" onclick="$.table.exportExcel()"
|
||||
shiro:hasPermission="order:order:export">
|
||||
<i class="fa fa-download"></i> 导出
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-12 select-table table-striped">
|
||||
<table id="bootstrap-table"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<th:block th:include="include :: footer"/>
|
||||
<th:block th:include="include :: layout-latest-js"/>
|
||||
<th:block th:include="include :: ztree-js"/>
|
||||
<script th:inline="javascript">
|
||||
var editFlag = [[${@permission.hasPermi('order:order:edit')}]];
|
||||
var prefix = ctx + "order/master";
|
||||
|
||||
$(function () {
|
||||
var panehHidden = false;
|
||||
if ($(this).width() < 769) {
|
||||
panehHidden = true;
|
||||
}
|
||||
$('body').layout({initClosed: panehHidden, west__size: 185});
|
||||
// 回到顶部绑定
|
||||
if ($.fn.toTop !== undefined) {
|
||||
var opt = {
|
||||
win: $('.ui-layout-center'),
|
||||
doc: $('.ui-layout-center')
|
||||
};
|
||||
$('#scroll-up').toTop(opt);
|
||||
}
|
||||
queryOrderList();
|
||||
});
|
||||
|
||||
function queryOrderList() {
|
||||
var options = {
|
||||
url: prefix + "/list",
|
||||
exportUrl: prefix + "/export",
|
||||
sortName: "createTime",
|
||||
sortOrder: "desc",
|
||||
modalName: "订单",
|
||||
columns: [
|
||||
{
|
||||
checkbox: true
|
||||
},
|
||||
{
|
||||
field: 'id',
|
||||
title: '订单ID',
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
field: 'code',
|
||||
title: '订单号'
|
||||
},
|
||||
{
|
||||
field: 'customerId',
|
||||
title: '消费者ID'
|
||||
},
|
||||
{
|
||||
field: 'orderType',
|
||||
title: '订单类型'
|
||||
},
|
||||
{
|
||||
field: 'orderStatus',
|
||||
title: '订单状态'
|
||||
},
|
||||
{
|
||||
field: 'payType',
|
||||
title: '付款类型'
|
||||
},
|
||||
{
|
||||
field: 'payStatus',
|
||||
title: '付款状态'
|
||||
},
|
||||
{
|
||||
field: 'payTime',
|
||||
title: '付款时间'
|
||||
},
|
||||
{
|
||||
field: 'workerId',
|
||||
title: '接单师傅ID'
|
||||
},
|
||||
{
|
||||
field: 'revTime',
|
||||
title: '接单时间'
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
title: '创建时间',
|
||||
sortable: true
|
||||
}
|
||||
]
|
||||
};
|
||||
$.table.init(options);
|
||||
}
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -1,158 +0,0 @@
|
|||
package com.ghy;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.ghy.common.adapay.AdapayService;
|
||||
import com.ghy.common.adapay.model.DivMember;
|
||||
import com.ghy.common.adapay.model.PayParam;
|
||||
import com.ghy.goods.domain.DeptGoodsCategory;
|
||||
import com.ghy.goods.domain.Goods;
|
||||
import com.ghy.goods.domain.GoodsCategory;
|
||||
import com.ghy.goods.mapper.GoodsMapper;
|
||||
import com.ghy.goods.service.DeptGoodsCategoryService;
|
||||
import com.ghy.goods.service.GoodsCategoryService;
|
||||
import com.huifu.adapay.core.exception.BaseAdaPayException;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@SpringBootTest
|
||||
@RunWith(SpringRunner.class)
|
||||
public class TestApplication {
|
||||
|
||||
@Resource
|
||||
private AdapayService adapayService;
|
||||
@Resource
|
||||
private GoodsMapper goodsMapper;
|
||||
@Resource
|
||||
private GoodsCategoryService goodsCategoryService;
|
||||
@Resource
|
||||
private DeptGoodsCategoryService deptGoodsCategoryService;
|
||||
|
||||
@Test
|
||||
public void testGoodsCategoryService() {
|
||||
GoodsCategory goodsCategory = new GoodsCategory();
|
||||
goodsCategory.setGoodsCategoryCode("FRUIT");
|
||||
goodsCategory.setGoodsCategoryName("水果");
|
||||
goodsCategory.setLevel(1);
|
||||
goodsCategory.setType(1);
|
||||
goodsCategoryService.insertGoodsCategory(goodsCategory);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeptGoodsCategoryService() {
|
||||
// DeptGoodsCategory category = new DeptGoodsCategory();
|
||||
// category.setDeptId(1L);
|
||||
// category.setGoodsCategoryId(1L);
|
||||
// category.setCategorySort(1);
|
||||
// category.setOneRate("0.10");
|
||||
// category.setTwoRate("0.10");
|
||||
// category.setThreeRate("0.10");
|
||||
// deptGoodsCategoryService.add(category);
|
||||
// category.setGoodsCategoryId(2L);
|
||||
// category.setCategorySort(2);
|
||||
// deptGoodsCategoryService.add(category);
|
||||
// category.setGoodsCategoryId(3L);
|
||||
// category.setCategorySort(3);
|
||||
// deptGoodsCategoryService.add(category);
|
||||
|
||||
List<DeptGoodsCategory> list = deptGoodsCategoryService.list(null);
|
||||
list.forEach(System.out::println);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addGoods() {
|
||||
for (int i = 1; i < 11; i++) {
|
||||
Goods goods = new Goods();
|
||||
goods.setGoodsCode("GOODS0000" + i);
|
||||
goods.setGoodsName("神秘商品" + i);
|
||||
goods.setGoodsPrice(BigDecimal.valueOf(i));
|
||||
goods.setDiscountsPrice(BigDecimal.valueOf(i));
|
||||
goods.setGroupPrice(BigDecimal.valueOf(i));
|
||||
goods.setGoodsSort(i);
|
||||
goods.setDeptId(1L);
|
||||
goods.setStatus(0);
|
||||
goods.setDeptGoodsCategoryId(1L);
|
||||
goods.setGoodsNumber(i * 100);
|
||||
System.out.println(goods);
|
||||
goodsMapper.insertGoods(goods);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 转账
|
||||
*/
|
||||
@Test
|
||||
public void balancePay() throws BaseAdaPayException {
|
||||
String orderNo = "TEST_ORDER_" + System.currentTimeMillis();
|
||||
System.out.println("orderNo = " + orderNo);
|
||||
Map<String, Object> map = adapayService.balancePay(orderNo, "0", "HH",
|
||||
"10.00", "商品标题", "商品描述", null, null);
|
||||
System.out.println(JSON.toJSONString(map));
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付宝正扫支付
|
||||
*/
|
||||
@Test
|
||||
public void alipayQr() throws BaseAdaPayException {
|
||||
DivMember gqz = new DivMember("0", "10.00", false);
|
||||
DivMember hh = new DivMember("HH", "10.00", true);
|
||||
|
||||
String orderNo = "TEST_ORDER_" + System.currentTimeMillis();
|
||||
System.out.println("orderNo = " + orderNo);
|
||||
|
||||
PayParam payParam = new PayParam(orderNo, "20.00", "测试商品", "测试商品描述信息");
|
||||
|
||||
Map<String, Object> map = adapayService.alipayQrPay(payParam, reply -> System.out.println(JSON.toJSONString(reply)),
|
||||
null, null, Arrays.asList(gqz, hh));
|
||||
System.out.println(JSON.toJSONString(map));
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建实名用户
|
||||
*/
|
||||
@Test
|
||||
public void createMember() throws BaseAdaPayException {
|
||||
Map<String, Object> member = adapayService.createMember("LBW", "18788888888", "卢本伟",
|
||||
"450321199608081017", "广西省桂林市", "velkhana@qq.com", null, null);
|
||||
System.out.println(JSON.toJSONString(member));
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建结算账户
|
||||
*/
|
||||
@Test
|
||||
public void createSettleAccount() throws BaseAdaPayException {
|
||||
Map<String, Object> map = adapayService.createSettleAccount("HH", "6217921009538441", "黄皓", "2",
|
||||
"450321199608081017", "18777338398", null, null, null);
|
||||
System.out.println(JSON.toJSONString(map));
|
||||
}
|
||||
|
||||
/**
|
||||
* 提现
|
||||
*/
|
||||
@Test
|
||||
public void drawCash() throws BaseAdaPayException {
|
||||
Map<String, Object> map = adapayService.drawCash(reply -> System.out.println(JSON.toJSONString(reply)),
|
||||
"HH_DRAW_CASH0002", "T1", "198.00", "HH", null, null);
|
||||
System.out.println(JSON.toJSONString(map));
|
||||
}
|
||||
|
||||
/**
|
||||
* 退款
|
||||
*/
|
||||
@Test
|
||||
public void refund() throws BaseAdaPayException {
|
||||
Map<String, Object> map = adapayService.refund(reply -> System.out.println(JSON.toJSONString(reply)),
|
||||
"002112022051210564510370658738275037184", "REFUND002112022051210564510370658738275037184",
|
||||
"20.00");
|
||||
System.out.println(JSON.toJSONString(map));
|
||||
}
|
||||
}
|
||||
|
|
@ -21,6 +21,7 @@ import javax.annotation.Resource;
|
|||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
|
@ -34,6 +35,45 @@ public class AdapayService {
|
|||
@Resource
|
||||
private AdapayProperties adapayProperties;
|
||||
|
||||
/**
|
||||
* 支付确认
|
||||
* 适用于延时分账的场景。只有已支付完成且延时分账的Payment对象,才支持调用创建支付确认对象。
|
||||
* 支持一次全额或多次部分确认,多次部分确认时,当前确认金额 + 已确认金额 + 已撤销金额不能大于原支付金额。
|
||||
*
|
||||
* @param paymentId [必填] String(64) Adapay生成的支付对象id
|
||||
* @param orderNo [必填] String(64) 请求订单号,只能为英文、数字或者下划线的一种或多种组合,保证在app_id下唯一
|
||||
* @param confirmAmt [必填] String(14) 确认金额,必须大于0,保留两位小数点,如0.10、100.05等。必须小于等于原支付金额-已确认金额-已撤销金额
|
||||
* @return 成功时同步返回一个包含 支付确认对象的JSON https://docs.adapay.tech/api/trade.html#id54
|
||||
*/
|
||||
public Map<String, Object> paymentConfirm(@NotNull String paymentId, @NotNull String orderNo, @NotNull String confirmAmt) throws BaseAdaPayException {
|
||||
return paymentConfirm(paymentId, orderNo, confirmAmt, null, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付确认
|
||||
* 适用于延时分账的场景。只有已支付完成且延时分账的Payment对象,才支持调用创建支付确认对象。
|
||||
* 支持一次全额或多次部分确认,多次部分确认时,当前确认金额 + 已确认金额 + 已撤销金额不能大于原支付金额。
|
||||
*
|
||||
* @param paymentId [必填] String(64) Adapay生成的支付对象id
|
||||
* @param orderNo [必填] String(64) 请求订单号,只能为英文、数字或者下划线的一种或多种组合,保证在app_id下唯一
|
||||
* @param confirmAmt [必填] String(14) 确认金额,必须大于0,保留两位小数点,如0.10、100.05等。必须小于等于原支付金额-已确认金额-已撤销金额
|
||||
* @param description String(128) 附加说明
|
||||
* @param feeMode String(1) 手续费收取模式:O-商户手续费账户扣取手续费,I-交易金额中扣取手续费;值为空时,默认值为I;若为O时,分账对象列表中不支持传入手续费承担方
|
||||
* @param divMembers 分账对象信息列表,一次请求最多仅支持7个分账方。json对象 形式,详见 分账对象信息列表
|
||||
* @return 成功时同步返回一个包含 支付确认对象的JSON https://docs.adapay.tech/api/trade.html#id54
|
||||
*/
|
||||
public Map<String, Object> paymentConfirm(@NotNull String paymentId, @NotNull String orderNo, @NotNull String confirmAmt,
|
||||
String description, String feeMode, List<DivMember> divMembers) throws BaseAdaPayException {
|
||||
Map<String, Object> confirmParams = new HashMap<>();
|
||||
confirmParams.put("payment_id", paymentId);
|
||||
confirmParams.put("order_no", orderNo);
|
||||
confirmParams.put("confirm_amt", confirmAmt);
|
||||
confirmParams.put("div_members", divMembers);
|
||||
confirmParams.put("fee_mode", feeMode);
|
||||
confirmParams.put("description", description);
|
||||
return PaymentConfirm.create(confirmParams);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建余额支付请求
|
||||
* 商户利用该接口进行余额支付,支持同一商户下的商户-用户,用户-商户,用户-用户间的账户余额支付
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ public class PayParam {
|
|||
private String feeMode;
|
||||
|
||||
/**
|
||||
* 包含所有必填参数的构造器,其它参数按需set
|
||||
* 包含所有[必填参数]的构造器,其它参数按需set
|
||||
*
|
||||
* @param orderNo [必填项]请求订单号,只能为英文、数字或者下划线的一种或多种组合,保证在app_id下唯一
|
||||
* @param payAmt [必填项]交易金额,必须大于0,保留两位小数点,如"0.10"、"100.05"
|
||||
|
|
@ -80,4 +80,19 @@ public class PayParam {
|
|||
String jsonString = JSON.toJSONString(this);
|
||||
return JSON.parseObject(jsonString);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造一个延迟分账的支付参数
|
||||
*
|
||||
* @param orderNo [必填项]请求订单号,只能为英文、数字或者下划线的一种或多种组合,保证在app_id下唯一
|
||||
* @param payAmt [必填项]交易金额,必须大于0,保留两位小数点,如"0.10"、"100.05"
|
||||
* @param goodsTittle [必填项]商品名称
|
||||
* @param goodsDesc [必填项]商品描述信息,微信小程序和微信公众号该字段最大长度42个字符
|
||||
* @return 支付参数
|
||||
*/
|
||||
public static PayParam createDelayPay(String orderNo, String payAmt, String goodsTittle, String goodsDesc) {
|
||||
PayParam payParam = new PayParam(orderNo, payAmt, goodsTittle, goodsDesc);
|
||||
payParam.setPayMode("delay");
|
||||
return payParam;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,44 @@
|
|||
package com.ghy.customer.domain;
|
||||
|
||||
import com.ghy.common.annotation.Excel;
|
||||
import com.ghy.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author clunt
|
||||
* 消费者地址
|
||||
*/
|
||||
@Data
|
||||
public class CustomerAddress extends BaseEntity {
|
||||
|
||||
@Excel(name = "消费者地址id", cellType = Excel.ColumnType.NUMERIC)
|
||||
private Long customerAddressId;
|
||||
|
||||
@Excel(name = "消费者id", cellType = Excel.ColumnType.NUMERIC)
|
||||
private Long customerId;
|
||||
|
||||
@Excel(name = "收件人姓名", cellType = Excel.ColumnType.STRING)
|
||||
private String name;
|
||||
|
||||
@Excel(name = "收件人手机号", cellType = Excel.ColumnType.STRING)
|
||||
private String phone;
|
||||
|
||||
@Excel(name = "省", cellType = Excel.ColumnType.NUMERIC)
|
||||
private Long provinceId;
|
||||
|
||||
@Excel(name = "市", cellType = Excel.ColumnType.NUMERIC)
|
||||
private Long cityId;
|
||||
|
||||
@Excel(name = "区", cellType = Excel.ColumnType.NUMERIC)
|
||||
private Long countryId;
|
||||
|
||||
@Excel(name = "详细地址")
|
||||
private String address;
|
||||
|
||||
@Excel(name = "是否默认地址,0.普通地址, 1.默认地址", cellType = Excel.ColumnType.STRING)
|
||||
private Integer isDefault;
|
||||
|
||||
@Excel(name = "是否有效,0.有效, 1.无效", cellType = Excel.ColumnType.STRING)
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
package com.ghy.customer.mapper;
|
||||
|
||||
import com.ghy.customer.domain.CustomerAddress;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface CustomerAddressMapper {
|
||||
|
||||
/**
|
||||
* @param customerAddress 筛选符合条件的地址list
|
||||
* @return 地址list
|
||||
*/
|
||||
List<CustomerAddress> getCustomerAddressList(CustomerAddress customerAddress);
|
||||
|
||||
/**
|
||||
* @param ids 地址id
|
||||
* @return 删除成功条数
|
||||
*/
|
||||
int deleteByIds(String [] ids);
|
||||
|
||||
/**
|
||||
* @param customerAddressId 地址id
|
||||
* @return 删除成功条数
|
||||
*/
|
||||
int deleteByCustomerAddressId(Long customerAddressId);
|
||||
|
||||
/**
|
||||
* @param customerId 消费者id
|
||||
* @return 消费者所有的地址list
|
||||
*/
|
||||
List<CustomerAddress> selectByCustomerId(Long customerId);
|
||||
|
||||
/**
|
||||
* @param customerAddressId 地址id
|
||||
* @return 地址
|
||||
*/
|
||||
CustomerAddress selectByCustomerAddressId(Long customerAddressId);
|
||||
|
||||
/**
|
||||
* @param customerAddress 地址信息
|
||||
* @return 新增成功条数
|
||||
*/
|
||||
int insertCustomerAddress(CustomerAddress customerAddress);
|
||||
|
||||
/**
|
||||
* @param customerAddress 修改地址信息
|
||||
* @return 修改成功条数
|
||||
*/
|
||||
int updateCustomerAddress(CustomerAddress customerAddress);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
package com.ghy.customer.service;
|
||||
|
||||
import com.ghy.customer.domain.CustomerAddress;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface CustomerAddressService {
|
||||
|
||||
/**
|
||||
* @param customerAddress 筛选符合条件的地址list
|
||||
* @return 地址list
|
||||
*/
|
||||
List<CustomerAddress> getCustomerAddressList(CustomerAddress customerAddress);
|
||||
|
||||
/**
|
||||
* @param ids 地址id
|
||||
* @return 删除成功条数
|
||||
*/
|
||||
int deleteByIds(String [] ids);
|
||||
|
||||
/**
|
||||
* @param customerAddressId 地址id
|
||||
* @return 删除成功条数
|
||||
*/
|
||||
int deleteByCustomerAddressId(Long customerAddressId);
|
||||
|
||||
/**
|
||||
* @param customerId 消费者id
|
||||
* @return 消费者所有的地址list
|
||||
*/
|
||||
List<CustomerAddress> selectByCustomerId(Long customerId);
|
||||
|
||||
/**
|
||||
* @param customerAddressId 地址id
|
||||
* @return 地址
|
||||
*/
|
||||
CustomerAddress selectByCustomerAddressId(Long customerAddressId);
|
||||
|
||||
/**
|
||||
* @param customerAddress 地址信息
|
||||
* @return 新增成功条数
|
||||
*/
|
||||
int insertCustomerAddress(CustomerAddress customerAddress);
|
||||
|
||||
/**
|
||||
* @param customerAddress 修改地址信息
|
||||
* @return 修改成功条数
|
||||
*/
|
||||
int updateCustomerAddress(CustomerAddress customerAddress);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
package com.ghy.customer.service.impl;
|
||||
|
||||
import com.ghy.customer.domain.CustomerAddress;
|
||||
import com.ghy.customer.mapper.CustomerAddressMapper;
|
||||
import com.ghy.customer.service.CustomerAddressService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class CustomerAddressServiceImpl implements CustomerAddressService {
|
||||
|
||||
@Resource
|
||||
private CustomerAddressMapper customerAddressMapper;
|
||||
|
||||
@Override
|
||||
public List<CustomerAddress> getCustomerAddressList(CustomerAddress customerAddress) {
|
||||
return customerAddressMapper.getCustomerAddressList(customerAddress);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteByIds(String[] ids) {
|
||||
return customerAddressMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteByCustomerAddressId(Long customerAddressId) {
|
||||
return customerAddressMapper.deleteByCustomerAddressId(customerAddressId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CustomerAddress> selectByCustomerId(Long customerId) {
|
||||
return customerAddressMapper.selectByCustomerId(customerId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomerAddress selectByCustomerAddressId(Long customerAddressId) {
|
||||
return customerAddressMapper.selectByCustomerAddressId(customerAddressId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertCustomerAddress(CustomerAddress customerAddress) {
|
||||
return customerAddressMapper.insertCustomerAddress(customerAddress);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateCustomerAddress(CustomerAddress customerAddress) {
|
||||
return customerAddressMapper.updateCustomerAddress(customerAddress);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ghy.customer.mapper.CustomerAddressMapper">
|
||||
|
||||
<resultMap id="CustomerAddressResult" type="com.ghy.customer.domain.CustomerAddress">
|
||||
<result property="customerAddressId" column="customer_address_id" />
|
||||
<result property="customerId" column="customer_id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="phone" column="phone" />
|
||||
<result property="provinceId" column="province_id"/>
|
||||
<result property="cityId" column="city_id"/>
|
||||
<result property="countryId" column="country_id"/>
|
||||
<result property="address" column="address"/>
|
||||
<result property="status" column="status" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectCustomerAddress">
|
||||
SELECT customer_address_id, customer_id, name, phone, provinceId, cityId, countryId, status,
|
||||
address, create_by, create_time, remark
|
||||
FROM customer_address
|
||||
</sql>
|
||||
|
||||
<select id="getCustomerAddressList" resultMap="CustomerAddressResult">
|
||||
<include refid="selectCustomerAddress" />
|
||||
</select>
|
||||
|
||||
<delete id="deleteByIds">
|
||||
DELETE FROM customer_address WHERE customer_address_id IN
|
||||
<foreach collection="array" item="customerIds" open="(" separator="," close=")">
|
||||
#{customerAddressIds}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByCustomerAddressId" parameterType="Long">
|
||||
DELETE FROM customer_address WHERE customer_address_id = #{customerAddressId}
|
||||
</delete>
|
||||
|
||||
<select id="selectByCustomerId" resultMap="CustomerAddressResult">
|
||||
<include refid="selectCustomerAddress"/>
|
||||
<where>
|
||||
<if test="customerId != null and customerId != 0">
|
||||
AND customer_id = #{customerId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectByCustomerAddressId" resultMap="CustomerAddressResult">
|
||||
<include refid="selectCustomerAddress"/>
|
||||
<where>
|
||||
<if test="customerAddressId != null and customerAddressId != 0">
|
||||
AND customer_address_id = #{customerAddressId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="insertCustomerAddress" parameterType="com.ghy.customer.domain.CustomerAddress" useGeneratedKeys="true" keyProperty="customerAddressId">
|
||||
insert into customer_address(
|
||||
<if test="customerId != null and customerId != 0">customer_id,</if>
|
||||
<if test="name != null and name != ''">name,</if>
|
||||
<if test="phone != null and phone != ''">phone,</if>
|
||||
<if test="provinceId != null and provinceId != 0">province_id,</if>
|
||||
<if test="cityId != null and cityId != 0">city_id,</if>
|
||||
<if test="countryId != null and countryId != 0">country_id,</if>
|
||||
<if test="status != null and status != ''">status,</if>
|
||||
<if test="isDefault != null and isDefault != 0">is_default,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
<if test="remark != null and remark != ''">remark,</if>
|
||||
create_time
|
||||
)values(
|
||||
<if test="customerId != null and customerId != 0">${customerId},</if>
|
||||
<if test="name != null and name != ''">${name},</if>
|
||||
<if test="phone != null and phone != ''">${phone},</if>
|
||||
<if test="provinceId != null and provinceId != 0">${provinceId},</if>
|
||||
<if test="cityId != null and cityId != 0">${cityId},</if>
|
||||
<if test="countryId != null and countryId != 0">${countryId},</if>
|
||||
<if test="status != null">${status},</if>
|
||||
<if test="isDefault != null and isDefault != 0">${isDefault},</if>
|
||||
<if test="createBy != null and createBy != ''">${createBy},</if>
|
||||
<if test="remark != null and remark != ''">${remark},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateCustomerAddress" parameterType="com.ghy.customer.domain.CustomerAddress">
|
||||
update costomer_address
|
||||
<set>
|
||||
<if test="name != null and name != ''">name = ${name},</if>
|
||||
<if test="phone != null and phone != ''">phone = ${phone},</if>
|
||||
<if test="provinceId != null and provinceId != 0">province_id = ${provinceId},</if>
|
||||
<if test="cityId != null and cityId != 0">city_id = ${cityId},</if>
|
||||
<if test="countryId != null and countryId != 0">country_id = ${countryId},</if>
|
||||
<if test="address != null and address != ''">address = #{address},</if>
|
||||
<if test="isDefault != null and isDefault != ''">is_default = #{isDefault},</if>
|
||||
<if test="status != null and status != ''">status = #{status},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where customer_address_id = #{customerAddressId}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package com.ghy.goods.mapper;
|
||||
|
||||
import com.ghy.goods.domain.DeptGoodsCategory;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
|
@ -40,12 +41,31 @@ public interface DeptGoodsCategoryMapper {
|
|||
/**
|
||||
* 批量删除商品信息
|
||||
*
|
||||
* @param goodsCategoryId 需要删除的数据ID
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteDeptGoodsCategoryByIds(Collection<Long> goodsCategoryId);
|
||||
int deleteDeptGoodsCategoryByIds(@Param("ids") Collection<Long> ids);
|
||||
|
||||
|
||||
List<DeptGoodsCategory> appList(DeptGoodsCategory deptGoodsCategory);
|
||||
|
||||
/**
|
||||
* 用商品类目ID查一条分公司类目
|
||||
*
|
||||
* @param goodsCategoryId 商品类目
|
||||
*/
|
||||
DeptGoodsCategory selectOneByGoodsCategoryId(Long goodsCategoryId);
|
||||
|
||||
/**
|
||||
* 用分公司ID查询
|
||||
*
|
||||
* @param deptId 分公司ID
|
||||
*/
|
||||
List<DeptGoodsCategory> selectByDeptId(Long deptId);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
int deleteById(Long id);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.ghy.goods.service;
|
||||
|
||||
import com.ghy.common.core.domain.AjaxResult;
|
||||
import com.ghy.common.core.domain.Ztree;
|
||||
import com.ghy.goods.domain.DeptGoodsCategory;
|
||||
|
||||
|
|
@ -58,4 +59,20 @@ public interface DeptGoodsCategoryService {
|
|||
List<DeptGoodsCategory> appList(Long deptId);
|
||||
|
||||
int delete(String ids);
|
||||
|
||||
/**
|
||||
* 用商品类目ID查一条分公司类目
|
||||
*
|
||||
* @param goodsCategoryId 商品类目
|
||||
*/
|
||||
DeptGoodsCategory selectOneByGoodsCategoryId(Long goodsCategoryId);
|
||||
|
||||
/**
|
||||
* 全量保存分公司类目
|
||||
*
|
||||
* @param parentId 分公司ID
|
||||
* @param checked 选中的类目ID
|
||||
*/
|
||||
AjaxResult batchAdd(Long parentId, Long[] checked);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,4 +77,11 @@ public interface GoodsCategoryService {
|
|||
* @return
|
||||
*/
|
||||
List<GoodsCategory> selectByIds(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 获取所有的商品类目,并标记出当前公司拥有的类目
|
||||
*
|
||||
* @param deptId 分公司ID
|
||||
*/
|
||||
List<Ztree> tree(Long deptId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,21 @@
|
|||
package com.ghy.goods.service.impl;
|
||||
|
||||
import com.ghy.common.constant.UserConstants;
|
||||
import com.ghy.common.core.domain.AjaxResult;
|
||||
import com.ghy.common.core.domain.Ztree;
|
||||
import com.ghy.common.core.text.Convert;
|
||||
import com.ghy.common.utils.StringUtils;
|
||||
import com.ghy.goods.domain.DeptGoodsCategory;
|
||||
import com.ghy.goods.domain.GoodsCategory;
|
||||
import com.ghy.goods.mapper.DeptGoodsCategoryMapper;
|
||||
import com.ghy.goods.service.DeptGoodsCategoryService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author clunt
|
||||
|
|
@ -52,7 +55,10 @@ public class DeptGoodsCategoryServiceImpl implements DeptGoodsCategoryService {
|
|||
|
||||
@Override
|
||||
public List<Ztree> tree(Long parentId) {
|
||||
return null;
|
||||
DeptGoodsCategory category = new DeptGoodsCategory();
|
||||
category.setDeptId(parentId);
|
||||
List<DeptGoodsCategory> list = list(category);
|
||||
return initZtree(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -88,6 +94,35 @@ public class DeptGoodsCategoryServiceImpl implements DeptGoodsCategoryService {
|
|||
return delete(Arrays.asList(array));
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeptGoodsCategory selectOneByGoodsCategoryId(Long goodsCategoryId) {
|
||||
return deptGoodsCategoryMapper.selectOneByGoodsCategoryId(goodsCategoryId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult batchAdd(Long parentId, Long[] checked) {
|
||||
List<DeptGoodsCategory> oldList = deptGoodsCategoryMapper.selectByDeptId(parentId);
|
||||
Map<Long, Long> oldMap = oldList.stream().collect(Collectors.toMap(GoodsCategory::getGoodsCategoryId,
|
||||
DeptGoodsCategory::getDeptGoodsCategoryId));
|
||||
HashSet<Long> newSet = new HashSet<>(Arrays.asList(checked));
|
||||
Set<Long> intersection = oldList.stream().map(DeptGoodsCategory::getGoodsCategoryId).collect(Collectors.toSet());
|
||||
intersection.addAll(Arrays.asList(checked));
|
||||
for (Long id : intersection) {
|
||||
if (newSet.contains(id)) {
|
||||
if (!oldMap.containsKey(id)) {
|
||||
DeptGoodsCategory category = new DeptGoodsCategory();
|
||||
category.setDeptId(parentId);
|
||||
category.setGoodsCategoryId(id);
|
||||
deptGoodsCategoryMapper.insertDeptGoodsCategory(category);
|
||||
}
|
||||
} else if (oldMap.containsKey(id)) {
|
||||
deptGoodsCategoryMapper.deleteById(oldMap.get(id));
|
||||
}
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
private void fillChild(List<DeptGoodsCategory> goodsCategoryList) {
|
||||
List<DeptGoodsCategory> childList;
|
||||
for (DeptGoodsCategory deptGoodsCategory : goodsCategoryList) {
|
||||
|
|
@ -97,4 +132,19 @@ public class DeptGoodsCategoryServiceImpl implements DeptGoodsCategoryService {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<Ztree> initZtree(List<DeptGoodsCategory> list) {
|
||||
List<Ztree> ztrees = new ArrayList<>();
|
||||
for (GoodsCategory goodsCategory : list) {
|
||||
if (UserConstants.CATEGORY_NORMAL.equals(goodsCategory.getStatus())) {
|
||||
Ztree ztree = new Ztree();
|
||||
ztree.setId(goodsCategory.getGoodsCategoryId());
|
||||
ztree.setpId(goodsCategory.getParentCategoryId());
|
||||
ztree.setName(goodsCategory.getGoodsCategoryName());
|
||||
ztree.setTitle(goodsCategory.getGoodsCategoryName());
|
||||
ztrees.add(ztree);
|
||||
}
|
||||
}
|
||||
return ztrees;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@ package com.ghy.goods.service.impl;
|
|||
import com.ghy.common.constant.UserConstants;
|
||||
import com.ghy.common.core.domain.Ztree;
|
||||
import com.ghy.common.core.text.Convert;
|
||||
import com.ghy.goods.domain.Goods;
|
||||
import com.ghy.goods.domain.DeptGoodsCategory;
|
||||
import com.ghy.goods.domain.GoodsCategory;
|
||||
import com.ghy.goods.mapper.GoodsCategoryMapper;
|
||||
import com.ghy.goods.mapper.GoodsMapper;
|
||||
import com.ghy.goods.service.DeptGoodsCategoryService;
|
||||
import com.ghy.goods.service.GoodsCategoryService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.Assert;
|
||||
|
|
@ -15,6 +15,8 @@ import javax.annotation.Resource;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author clunt
|
||||
|
|
@ -23,10 +25,10 @@ import java.util.List;
|
|||
@Service
|
||||
public class GoodsCategoryServiceImpl implements GoodsCategoryService {
|
||||
|
||||
@Resource
|
||||
private GoodsMapper goodsMapper;
|
||||
@Resource
|
||||
GoodsCategoryMapper goodsCategoryMapper;
|
||||
@Resource
|
||||
DeptGoodsCategoryService deptGoodsCategoryService;
|
||||
|
||||
@Override
|
||||
public int insertGoodsCategory(GoodsCategory goodsCategory) {
|
||||
|
|
@ -60,8 +62,8 @@ public class GoodsCategoryServiceImpl implements GoodsCategoryService {
|
|||
public int deleteGoodsCategoryByIds(String ids) {
|
||||
Long[] idArray = Convert.toLongArray(ids);
|
||||
for (Long id : idArray) {
|
||||
Goods goods = goodsMapper.selectOneByGoodsCategoryId(id);
|
||||
Assert.isNull(goods, "正在被使用的商品类别不能删除");
|
||||
DeptGoodsCategory category = deptGoodsCategoryService.selectOneByGoodsCategoryId(id);
|
||||
Assert.isNull(category, "正在被使用的商品类别不能删除");
|
||||
}
|
||||
return goodsCategoryMapper.deleteGoodsCategoryByIds(idArray);
|
||||
}
|
||||
|
|
@ -89,25 +91,24 @@ public class GoodsCategoryServiceImpl implements GoodsCategoryService {
|
|||
return goodsCategoryMapper.selectByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 对象转类目树
|
||||
*
|
||||
* @param goodsCategoryList 类目列表
|
||||
* @return 树结构列表
|
||||
*/
|
||||
public List<Ztree> initZtree(List<GoodsCategory> goodsCategoryList) {
|
||||
return initZtree(goodsCategoryList, null);
|
||||
@Override
|
||||
public List<Ztree> tree(Long deptId) {
|
||||
List<GoodsCategory> goodsCategoryList = goodsCategoryMapper.selectGoodsCategoryList(null);
|
||||
DeptGoodsCategory category = new DeptGoodsCategory();
|
||||
category.setDeptId(deptId);
|
||||
Set<Long> usedSet = deptGoodsCategoryService.list(category).stream()
|
||||
.map(DeptGoodsCategory::getGoodsCategoryId).collect(Collectors.toSet());
|
||||
return initZtree(goodsCategoryList, usedSet);
|
||||
}
|
||||
|
||||
/**
|
||||
* 对象转部门树
|
||||
* List转带选中状态(checked)的ZTree
|
||||
*
|
||||
* @param goodsCategoryList 类目列表
|
||||
* @param roleDeptList 该列表无需校验
|
||||
* @return 树结构列表
|
||||
* @param goodsCategoryList 商品类目List
|
||||
* @param checked 选中的集合
|
||||
* @return
|
||||
*/
|
||||
public List<Ztree> initZtree(List<GoodsCategory> goodsCategoryList, List<String> roleDeptList) {
|
||||
|
||||
public List<Ztree> initZtree(List<GoodsCategory> goodsCategoryList, Collection<Long> checked) {
|
||||
List<Ztree> ztrees = new ArrayList<>();
|
||||
for (GoodsCategory goodsCategory : goodsCategoryList) {
|
||||
if (UserConstants.CATEGORY_NORMAL.equals(goodsCategory.getStatus())) {
|
||||
|
|
@ -116,7 +117,28 @@ public class GoodsCategoryServiceImpl implements GoodsCategoryService {
|
|||
ztree.setpId(goodsCategory.getParentCategoryId());
|
||||
ztree.setName(goodsCategory.getGoodsCategoryName());
|
||||
ztree.setTitle(goodsCategory.getGoodsCategoryName());
|
||||
ztrees.add(ztree);
|
||||
ztree.setChecked(checked.contains(goodsCategory.getGoodsCategoryId()));
|
||||
}
|
||||
}
|
||||
return ztrees;
|
||||
}
|
||||
|
||||
/**
|
||||
* 对象转部门树
|
||||
*
|
||||
* @param goodsCategoryList 类目列表
|
||||
* @return 树结构列表
|
||||
*/
|
||||
public List<Ztree> initZtree(List<GoodsCategory> goodsCategoryList) {
|
||||
List<Ztree> ztrees = new ArrayList<>();
|
||||
for (GoodsCategory goodsCategory : goodsCategoryList) {
|
||||
if (UserConstants.CATEGORY_NORMAL.equals(goodsCategory.getStatus())) {
|
||||
Ztree ztree = new Ztree();
|
||||
ztree.setId(goodsCategory.getGoodsCategoryId());
|
||||
ztree.setpId(goodsCategory.getParentCategoryId());
|
||||
ztree.setName(goodsCategory.getGoodsCategoryName());
|
||||
ztree.setTitle(goodsCategory.getGoodsCategoryName());
|
||||
ztrees.add(ztree);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,24 +52,28 @@
|
|||
<update id="updateDeptGoodsCategory" parameterType="com.ghy.goods.domain.DeptGoodsCategory">
|
||||
UPDATE dept_goods_category
|
||||
<set>
|
||||
<if test="goodsCategoryId != null">goods_category_id = #{goodsCategoryId},</if>
|
||||
<if test="categorySort != null">category_sort = #{categorySort},</if>
|
||||
<if test="oneRate != null and oneRate != ''">one_rate = #{oneRate},</if>
|
||||
<if test="twoRate != null and twoRate != ''">two_rate = #{twoRate},</if>
|
||||
<if test="threeRate != null and threeRate != ''">three_rate = #{threeRate},</if>
|
||||
<if test="remark != null and remark != ''">remark = #{remark},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
WHERE dept_goods_category_id = #{goodsCategoryId}
|
||||
WHERE dept_goods_category_id = #{deptGoodsCategoryId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteDeptGoodsCategoryByIds" parameterType="Long">
|
||||
DELETE FROM dept_goods_category WHERE dept_goods_category_id IN
|
||||
<foreach collection="array" item="goodsCategoryId" open="(" separator="," close=")">
|
||||
<foreach collection="ids" item="goodsCategoryId" open="(" separator="," close=")">
|
||||
#{goodsCategoryId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteById">
|
||||
DELETE FROM dept_goods_category WHERE dept_goods_category_id = #{id}
|
||||
</delete>
|
||||
|
||||
<insert id="insertDeptGoodsCategory" parameterType="com.ghy.goods.domain.DeptGoodsCategory" useGeneratedKeys="true"
|
||||
keyProperty="goodsCategoryId">
|
||||
insert into dept_goods_category(
|
||||
|
|
@ -103,13 +107,23 @@
|
|||
AND gc.goods_category_name LIKE concat('%', #{goodsCategoryName}, '%')
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
AND gc.status LIKE concat('%', #{status}, '%')
|
||||
AND gc.status = #{status}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectById" parameterType="long" resultMap="DeptGoodsCategoryResult">
|
||||
<include refid="selectJoin"/>
|
||||
WHERE dgc.dept_goods_category_id = #{deptGoodsCategoryId}
|
||||
</select>
|
||||
|
||||
<select id="selectOneByGoodsCategoryId" resultMap="DeptGoodsCategoryResult">
|
||||
<include refid="selectDeptGoodsCategory"/>
|
||||
WHERE dept_goods_category_id = #{deptGoodsCategoryId}
|
||||
WHERE goods_category_id = #{goodsCategoryId} LIMIT 1
|
||||
</select>
|
||||
|
||||
<select id="selectByDeptId" resultMap="DeptGoodsCategoryResult">
|
||||
<include refid="selectDeptGoodsCategory"/>
|
||||
WHERE dept_id = #{deptId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -7,9 +7,10 @@
|
|||
<result property="goodsCategoryCode" column="goods_category_code" />
|
||||
<result property="goodsCategoryName" column="goods_category_name" />
|
||||
<result property="parentCategoryId" column="parent_category_id" />
|
||||
<result property="categorySort" column="category_sort"/>
|
||||
<result property="level" column="level" />
|
||||
<result property="type" column="type" />
|
||||
<result property="status" column="status" />
|
||||
<result property="status" column="status" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
|
|
@ -29,6 +30,12 @@
|
|||
<if test="goodsCategoryCode != null and goodsCategoryCode != ''">
|
||||
AND goods_category_code like concat('%', #{goodsCategoryCode}, '%')
|
||||
</if>
|
||||
<if test="goodsCategoryName != null and goodsCategoryName != ''">
|
||||
AND goods_category_name LIKE concat('%', #{goodsCategoryName}, '%')
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
AND status = #{status}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public class OrderMaster extends BaseEntity {
|
|||
@Excel(name = "接单师傅id", cellType = Excel.ColumnType.NUMERIC)
|
||||
private Integer workerId;
|
||||
|
||||
@Excel(name = "付款时间间", cellType = Excel.ColumnType.STRING)
|
||||
@Excel(name = "付款时间", cellType = Excel.ColumnType.STRING)
|
||||
private String payTime;
|
||||
|
||||
@Excel(name = "接单时间", cellType = Excel.ColumnType.STRING)
|
||||
|
|
|
|||
Loading…
Reference in New Issue