parent
2c5da04cc1
commit
6e9a7e361c
|
|
@ -7,6 +7,7 @@ import com.ghy.common.core.page.TableDataInfo;
|
||||||
import com.ghy.common.enums.BusinessType;
|
import com.ghy.common.enums.BusinessType;
|
||||||
import com.ghy.common.utils.ShiroUtils;
|
import com.ghy.common.utils.ShiroUtils;
|
||||||
import com.ghy.common.utils.poi.ExcelUtil;
|
import com.ghy.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ghy.goods.domain.DeptGoodsCategory;
|
||||||
import com.ghy.goods.domain.Goods;
|
import com.ghy.goods.domain.Goods;
|
||||||
import com.ghy.goods.service.DeptGoodsCategoryService;
|
import com.ghy.goods.service.DeptGoodsCategoryService;
|
||||||
import com.ghy.goods.service.GoodsService;
|
import com.ghy.goods.service.GoodsService;
|
||||||
|
|
@ -73,7 +74,9 @@ public class GoodsController extends BaseController {
|
||||||
@GetMapping("/add")
|
@GetMapping("/add")
|
||||||
public String add(ModelMap mmap) {
|
public String add(ModelMap mmap) {
|
||||||
Long parentId = ShiroUtils.getSysUser().getParentId();
|
Long parentId = ShiroUtils.getSysUser().getParentId();
|
||||||
mmap.put("deptGoodsCategories", deptGoodsCategoryService.list(parentId));
|
DeptGoodsCategory category = new DeptGoodsCategory();
|
||||||
|
category.setDeptId(parentId);
|
||||||
|
mmap.put("deptGoodsCategories", deptGoodsCategoryService.list(category));
|
||||||
return PREFIX + "/add";
|
return PREFIX + "/add";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -97,7 +100,9 @@ public class GoodsController extends BaseController {
|
||||||
@GetMapping("/edit/{goodsId}")
|
@GetMapping("/edit/{goodsId}")
|
||||||
public String edit(@PathVariable("goodsId") Long goodsId, ModelMap mmap) {
|
public String edit(@PathVariable("goodsId") Long goodsId, ModelMap mmap) {
|
||||||
Long parentId = ShiroUtils.getSysUser().getParentId();
|
Long parentId = ShiroUtils.getSysUser().getParentId();
|
||||||
mmap.put("deptGoodsCategories", deptGoodsCategoryService.list(parentId));
|
DeptGoodsCategory category = new DeptGoodsCategory();
|
||||||
|
category.setDeptId(parentId);
|
||||||
|
mmap.put("deptGoodsCategories", deptGoodsCategoryService.list(category));
|
||||||
mmap.put("goods", goodsService.selectById(goodsId));
|
mmap.put("goods", goodsService.selectById(goodsId));
|
||||||
return PREFIX + "/edit";
|
return PREFIX + "/edit";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,13 @@
|
||||||
package com.ghy.web.controller.goods;
|
package com.ghy.web.controller.goods;
|
||||||
|
|
||||||
|
import com.ghy.common.annotation.Log;
|
||||||
import com.ghy.common.core.controller.BaseController;
|
import com.ghy.common.core.controller.BaseController;
|
||||||
import com.ghy.common.core.domain.AjaxResult;
|
import com.ghy.common.core.domain.AjaxResult;
|
||||||
import com.ghy.common.core.domain.Ztree;
|
import com.ghy.common.core.domain.Ztree;
|
||||||
|
import com.ghy.common.enums.BusinessType;
|
||||||
|
import com.ghy.common.utils.ShiroUtils;
|
||||||
import com.ghy.goods.domain.DeptGoodsCategory;
|
import com.ghy.goods.domain.DeptGoodsCategory;
|
||||||
import com.ghy.goods.domain.GoodsCategory;
|
|
||||||
import com.ghy.goods.service.DeptGoodsCategoryService;
|
import com.ghy.goods.service.DeptGoodsCategoryService;
|
||||||
import com.ghy.goods.service.GoodsCategoryService;
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.ModelMap;
|
import org.springframework.ui.ModelMap;
|
||||||
|
|
@ -21,15 +22,12 @@ public class GoodsDeptCategoryController extends BaseController {
|
||||||
|
|
||||||
private static final String PREFIX = "goods/deptcategory";
|
private static final String PREFIX = "goods/deptcategory";
|
||||||
|
|
||||||
@Resource
|
|
||||||
GoodsCategoryService goodsCategoryService;
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
DeptGoodsCategoryService deptGoodsCategoryService;
|
DeptGoodsCategoryService deptGoodsCategoryService;
|
||||||
|
|
||||||
@RequiresPermissions("goods:deptcategory:view")
|
@RequiresPermissions("goods:deptcategory:view")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public String goodsCategory() {
|
public String DeptGoodsCategory() {
|
||||||
return PREFIX + "/deptcategory";
|
return PREFIX + "/deptcategory";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -43,19 +41,21 @@ public class GoodsDeptCategoryController extends BaseController {
|
||||||
/**
|
/**
|
||||||
* 商品类别表
|
* 商品类别表
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("goods:goods:list")
|
@RequiresPermissions("goods:deptcategory:list")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public List<GoodsCategory> list(GoodsCategory category) {
|
public List<DeptGoodsCategory> list(DeptGoodsCategory category) {
|
||||||
return goodsCategoryService.selectGoodsCategoryList(category);
|
Long parentId = ShiroUtils.getSysUser().getParentId();
|
||||||
|
category.setDeptId(parentId);
|
||||||
|
return deptGoodsCategoryService.list(category);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/tree")
|
@GetMapping("/tree")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public List<Ztree> goodsDeptCategoryTree() {
|
public List<Ztree> goodsDeptCategoryTree() {
|
||||||
// Long parentId = ShiroUtils.getSysUser().getParentId();
|
Long parentId = ShiroUtils.getSysUser().getParentId();
|
||||||
// List<Ztree> ztrees = goodsDeptCategoryService.tree(parentId);
|
return deptGoodsCategoryService.tree(parentId);
|
||||||
return goodsCategoryService.selectCategoryTree(null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/app/list")
|
@PostMapping("/app/list")
|
||||||
|
|
@ -64,4 +64,18 @@ public class GoodsDeptCategoryController extends BaseController {
|
||||||
return AjaxResult.success(deptGoodsCategoryService.appList(deptGoodsCategory.getDeptId()));
|
return AjaxResult.success(deptGoodsCategoryService.appList(deptGoodsCategory.getDeptId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除子公司商品类别接口
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("goods:deptcategory:remove")
|
||||||
|
@Log(title = "子公司商品类别管理", businessType = BusinessType.DELETE)
|
||||||
|
@PostMapping("/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids) {
|
||||||
|
try {
|
||||||
|
return toAjax(deptGoodsCategoryService.delete(ids));
|
||||||
|
} catch (Exception e) {
|
||||||
|
return error(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.ghy.web.controller.pay;
|
||||||
|
|
||||||
import com.ghy.common.adapay.AdapayService;
|
import com.ghy.common.adapay.AdapayService;
|
||||||
import com.ghy.common.adapay.callback.PayCallback;
|
import com.ghy.common.adapay.callback.PayCallback;
|
||||||
|
import com.ghy.common.adapay.model.PayParam;
|
||||||
import com.ghy.common.core.controller.BaseController;
|
import com.ghy.common.core.controller.BaseController;
|
||||||
import com.ghy.common.core.domain.AjaxResult;
|
import com.ghy.common.core.domain.AjaxResult;
|
||||||
import com.ghy.order.domain.OrderMaster;
|
import com.ghy.order.domain.OrderMaster;
|
||||||
|
|
@ -42,8 +43,9 @@ public class AlipayController extends BaseController {
|
||||||
Map<String, Object> map;
|
Map<String, Object> map;
|
||||||
try {
|
try {
|
||||||
// TODO 订单里需要补充支付金额、tittle、简要描述、分账信息、description
|
// TODO 订单里需要补充支付金额、tittle、简要描述、分账信息、description
|
||||||
map = adapayService.alipayQrPay(payCallback, orderMaster.getCode(), "orderMaster.get支付金额",
|
PayParam payParam = new PayParam(orderMaster.getCode(),
|
||||||
"orderMaster.getTittle()", "orderMaster.get简要描述", "orderMaster.getDivMember", "orderMaster.getDescription");
|
"orderMaster.get支付金额", "orderMaster.getTittle()", "orderMaster.get商品描述信息");
|
||||||
|
map = adapayService.alipayQrPay(payParam, payCallback, null, null, null);
|
||||||
} catch (BaseAdaPayException e) {
|
} catch (BaseAdaPayException e) {
|
||||||
logger.error("获取微信用户信息失败", e);
|
logger.error("获取微信用户信息失败", e);
|
||||||
return AjaxResult.error();
|
return AjaxResult.error();
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,8 @@ package com.ghy.web.controller.pay;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.ghy.common.adapay.AdapayService;
|
import com.ghy.common.adapay.AdapayService;
|
||||||
import com.ghy.common.adapay.callback.PayCallback;
|
import com.ghy.common.adapay.callback.PayCallback;
|
||||||
import com.ghy.common.adapay.callback.model.WxLiteExpend;
|
import com.ghy.common.adapay.model.PayParam;
|
||||||
|
import com.ghy.common.adapay.model.WxpayExpend;
|
||||||
import com.ghy.common.config.WxConfig;
|
import com.ghy.common.config.WxConfig;
|
||||||
import com.ghy.common.core.controller.BaseController;
|
import com.ghy.common.core.controller.BaseController;
|
||||||
import com.ghy.common.core.domain.AjaxResult;
|
import com.ghy.common.core.domain.AjaxResult;
|
||||||
|
|
@ -56,13 +57,14 @@ public class WxPayController extends BaseController {
|
||||||
}
|
}
|
||||||
String openId = wxUser.getString("openid");
|
String openId = wxUser.getString("openid");
|
||||||
//调用adapay微信公众号支付.
|
//调用adapay微信公众号支付.
|
||||||
WxLiteExpend expend = new WxLiteExpend();
|
WxpayExpend expend = new WxpayExpend();
|
||||||
expend.setOpenId(openId);
|
expend.setOpenId(openId);
|
||||||
Map<String, Object> map;
|
Map<String, Object> map;
|
||||||
try {
|
try {
|
||||||
// TODO 订单里需要补充支付金额、tittle、简要描述、分账信息、description
|
// TODO 订单里需要补充支付金额、tittle、简要描述、分账信息、description
|
||||||
map = adapayService.wxPubPay(payCallback, expend, orderMaster.getCode(), "orderMaster.get支付金额",
|
PayParam payParam = new PayParam(orderMaster.getCode(),
|
||||||
"orderMaster.getTittle()", "orderMaster.get简要描述", "orderMaster.getDivMember", "orderMaster.getDescription");
|
"orderMaster.get支付金额", "orderMaster.getTittle()", "orderMaster.get商品描述信息");
|
||||||
|
map = adapayService.wxLitePay(payParam, payCallback, expend, null, null);
|
||||||
} catch (BaseAdaPayException e) {
|
} catch (BaseAdaPayException e) {
|
||||||
logger.error("获取微信用户信息失败", e);
|
logger.error("获取微信用户信息失败", e);
|
||||||
return AjaxResult.error();
|
return AjaxResult.error();
|
||||||
|
|
@ -85,20 +87,18 @@ public class WxPayController extends BaseController {
|
||||||
logger.info("code is " + code);
|
logger.info("code is " + code);
|
||||||
//测试时前端不带订单号.
|
//测试时前端不带订单号.
|
||||||
// String orderId = request.getParameter("orderId");
|
// String orderId = request.getParameter("orderId");
|
||||||
// 查询回订单信息。如果订单不存在,则退出.
|
// TODO 查询回订单信息。如果订单不存在,则退出.
|
||||||
try {
|
try {
|
||||||
JSONObject wxUser = WxUtils.getOpenid(code, wxConfig.getAppId(), wxConfig.getSecret());
|
JSONObject wxUser = WxUtils.getOpenid(code, wxConfig.getAppId(), wxConfig.getSecret());
|
||||||
String openId = wxUser.getString("openid");
|
String openId = wxUser.getString("openid");
|
||||||
logger.info("open id is " + openId);
|
logger.info("open id is " + openId);
|
||||||
//调用adapay微信公众号支付.
|
//调用adapay微信公众号支付.
|
||||||
WxLiteExpend expend = new WxLiteExpend();
|
WxpayExpend expend = new WxpayExpend();
|
||||||
expend.setOpenId(openId);
|
expend.setOpenId(openId);
|
||||||
Map<String, Object> map = adapayService.wxPubPay(payCallback, expend, "wxPay123456" + Math.ceil(Math.random() * 100), "1.00",
|
Map<String, Object> map;
|
||||||
"测试商品", "测试商品detail", null, "description");
|
// TODO 订单里需要补充支付金额、tittle、简要描述、分账信息、description
|
||||||
//拼接消息给前端.前端通过JSAPI调用微信支付
|
PayParam payParam = new PayParam("订单号", "支付金额", "商品标题", "商品描述信息");
|
||||||
map.forEach((key, value) -> {
|
map = adapayService.wxPubPay(payParam, payCallback, expend, null, null);
|
||||||
logger.info("key is " + key + ", value is " + value);
|
|
||||||
});
|
|
||||||
return AjaxResult.success(map);
|
return AjaxResult.success(map);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package com.ghy.web.core;
|
package com.ghy.web.core;
|
||||||
|
|
||||||
import com.ghy.common.adapay.callback.PayCallback;
|
import com.ghy.common.adapay.callback.PayCallback;
|
||||||
import com.ghy.common.adapay.callback.model.PayReply;
|
import com.ghy.common.adapay.model.PayReply;
|
||||||
import com.ghy.order.service.OrderDetailService;
|
import com.ghy.order.service.OrderDetailService;
|
||||||
import com.ghy.order.service.OrderMasterService;
|
import com.ghy.order.service.OrderMasterService;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,158 @@
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
package com.ghy.common.adapay;
|
package com.ghy.common.adapay;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.ghy.common.adapay.callback.DrawCashCallback;
|
import com.ghy.common.adapay.callback.DrawCashCallback;
|
||||||
import com.ghy.common.adapay.callback.PayCallback;
|
import com.ghy.common.adapay.callback.PayCallback;
|
||||||
import com.ghy.common.adapay.callback.RefundCallback;
|
import com.ghy.common.adapay.callback.RefundCallback;
|
||||||
import com.ghy.common.adapay.callback.mapping.DrawCashReplyMapping;
|
import com.ghy.common.adapay.callback.mapping.DrawCashReplyMapping;
|
||||||
import com.ghy.common.adapay.callback.mapping.PayReplyMapping;
|
import com.ghy.common.adapay.callback.mapping.PayReplyMapping;
|
||||||
import com.ghy.common.adapay.callback.mapping.RefundReplyMapping;
|
import com.ghy.common.adapay.callback.mapping.RefundReplyMapping;
|
||||||
import com.ghy.common.adapay.callback.model.Expend;
|
import com.ghy.common.adapay.model.*;
|
||||||
import com.ghy.common.adapay.callback.model.WxLiteExpend;
|
|
||||||
import com.huifu.adapay.core.exception.BaseAdaPayException;
|
import com.huifu.adapay.core.exception.BaseAdaPayException;
|
||||||
import com.huifu.adapay.model.*;
|
import com.huifu.adapay.model.*;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
@ -15,9 +15,11 @@ import org.apache.commons.lang3.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
@ -32,6 +34,41 @@ public class AdapayService {
|
||||||
@Resource
|
@Resource
|
||||||
private AdapayProperties adapayProperties;
|
private AdapayProperties adapayProperties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建余额支付请求
|
||||||
|
* 商户利用该接口进行余额支付,支持同一商户下的商户-用户,用户-商户,用户-用户间的账户余额支付
|
||||||
|
*
|
||||||
|
* @param orderNo [必填]请求订单号,只能为英文、数字或者下划线的一种或多种组合,保证在app_id下唯一
|
||||||
|
* @param outMemberId [必填]出账用户的member_id, 若为商户本身时,请传入0
|
||||||
|
* @param inMemberId [必填]入账用户的member_id, 若为商户本身时,请传入0
|
||||||
|
* @param transAmt [必填]交易金额,必须大于0,人民币为元,保留两位小数点,如"0.10"、"100.05"等
|
||||||
|
* @param goodsTitle [必填]商品名称
|
||||||
|
* @param goodsDesc [必填]商品描述
|
||||||
|
* @param payMode 支付模式,delay- 延时分账模式(值为 delay 时,div_members 字段必须为空);
|
||||||
|
* 值为空时并且div_mermbers不为空时,表示实时分账;
|
||||||
|
* 值为空时并且div_mermbers也为空时,表示不分账;
|
||||||
|
* @param divMembers 分账对象信息列表,最多仅支持7个分账方
|
||||||
|
* @return 成功时同步返回交易结果的 JSON
|
||||||
|
*/
|
||||||
|
public Map<String, Object> balancePay(@NotNull String orderNo, @NotNull String outMemberId, @NotNull String inMemberId,
|
||||||
|
@NotNull String transAmt, @NotNull String goodsTitle, @NotNull String goodsDesc,
|
||||||
|
String payMode, Collection<DivMember> divMembers) throws BaseAdaPayException {
|
||||||
|
Map<String, Object> balanceParam = new HashMap<>(10);
|
||||||
|
balanceParam.put("app_id", adapayProperties.getAppId());
|
||||||
|
balanceParam.put("adapay_func_code", "settle_accounts.balancePay");
|
||||||
|
balanceParam.put("order_no", orderNo);
|
||||||
|
balanceParam.put("out_member_id", outMemberId);
|
||||||
|
balanceParam.put("in_member_id", inMemberId);
|
||||||
|
balanceParam.put("trans_amt", transAmt);
|
||||||
|
balanceParam.put("goods_title", goodsTitle);
|
||||||
|
balanceParam.put("goods_desc", goodsDesc);
|
||||||
|
balanceParam.put("pay_mode", payMode);
|
||||||
|
if (!CollectionUtils.isEmpty(divMembers)) {
|
||||||
|
balanceParam.put("div_members", divMembers);
|
||||||
|
}
|
||||||
|
return AdapayCommon.requestAdapay(balanceParam);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建结算账户对象 https://docs.adapay.tech/api/trade.html#settle-account-create
|
* 创建结算账户对象 https://docs.adapay.tech/api/trade.html#settle-account-create
|
||||||
* 创建结算账户对象是为一个已创建用户对象创建结算账户,用于对用户分账金额的结算,目前仅支持绑定银行卡结算账户。
|
* 创建结算账户对象是为一个已创建用户对象创建结算账户,用于对用户分账金额的结算,目前仅支持绑定银行卡结算账户。
|
||||||
|
|
@ -60,6 +97,7 @@ public class AdapayService {
|
||||||
case "1":
|
case "1":
|
||||||
Assert.isTrue(StringUtils.isNoneBlank(bankCode, provCode, areaCode),
|
Assert.isTrue(StringUtils.isNoneBlank(bankCode, provCode, areaCode),
|
||||||
"[bankCode, provCode, areaCode] cannot be empty !");
|
"[bankCode, provCode, areaCode] cannot be empty !");
|
||||||
|
break;
|
||||||
case "2":
|
case "2":
|
||||||
Assert.hasText(cardId, "cardId is blank !");
|
Assert.hasText(cardId, "cardId is blank !");
|
||||||
accountInfo.put("cert_type", "00");
|
accountInfo.put("cert_type", "00");
|
||||||
|
|
@ -153,54 +191,47 @@ public class AdapayService {
|
||||||
/**
|
/**
|
||||||
* 支付宝正扫支付
|
* 支付宝正扫支付
|
||||||
*/
|
*/
|
||||||
public Map<String, Object> alipayQrPay(PayCallback callback, String orderNo, String payAmt,
|
public Map<String, Object> alipayQrPay(PayParam payParam, PayCallback callback, AlipayExpend expend, DeviceInfo deviceInfo,
|
||||||
String goodsTittle, String goodsDesc, String divMembers, String description) throws BaseAdaPayException {
|
Collection<DivMember> divMembers) throws BaseAdaPayException {
|
||||||
return pay(callback, PayChannelEnum.ALIPAY_QR.getCode(), null, orderNo, payAmt, goodsTittle, goodsDesc, divMembers, description);
|
return pay("alipay_qr", payParam, callback, expend, deviceInfo, divMembers);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 微信公众号支付
|
* 微信公众号支付
|
||||||
*/
|
*/
|
||||||
public Map<String, Object> wxPubPay(PayCallback callback, WxLiteExpend expend, String orderNo, String payAmt,
|
public Map<String, Object> wxPubPay(PayParam payParam, PayCallback callback, WxpayExpend expend, DeviceInfo deviceInfo,
|
||||||
String goodsTittle, String goodsDesc, String divMembers, String description) throws BaseAdaPayException {
|
Collection<DivMember> divMembers) throws BaseAdaPayException {
|
||||||
return pay(callback, PayChannelEnum.WX_PUB.getCode(), expend, orderNo, payAmt, goodsTittle, goodsDesc, divMembers, description);
|
return pay("wx_pub", payParam, callback, expend, deviceInfo, divMembers);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 微信小程序支付
|
* 微信小程序支付
|
||||||
*/
|
*/
|
||||||
public Map<String, Object> wxLitePay(PayCallback callback, WxLiteExpend expend, String orderNo, String payAmt,
|
public Map<String, Object> wxLitePay(PayParam payParam, PayCallback callback, WxpayExpend expend, DeviceInfo deviceInfo,
|
||||||
String goodsTittle, String goodsDesc, String divMembers, String description) throws BaseAdaPayException {
|
Collection<DivMember> divMembers) throws BaseAdaPayException {
|
||||||
return pay(callback, PayChannelEnum.WX_LITE.getCode(), expend, orderNo, payAmt, goodsTittle, goodsDesc, divMembers, description);
|
return pay("wx_lite", payParam, callback, expend, deviceInfo, divMembers);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param callback [必填项]处理支付结果的回调接口
|
* @param payChannel [必填项]支付渠道,详见 https://docs.adapay.tech/api/appendix.html#id2
|
||||||
* @param orderNo [必填项]订单号
|
* @param payParam [必填项]支付参数
|
||||||
* @param payAmt [必填项]交易金额,必须大于0,保留两位小数点,如"0.10"、"100.05"
|
* @param callback [必填项]处理支付结果的回调接口
|
||||||
* @param goodsTittle [必填项]商品名称
|
* @param expend 支付渠道额外参数 https://docs.adapay.tech/api/appendix.html#expend
|
||||||
* @param goodsDesc [必填项]商品描述信息,微信小程序和微信公众号该字段最大长度42个字符
|
* @param deviceInfo 前端设备信息 https://docs.adapay.tech/api/appendix.html#deviceinfo
|
||||||
* @param payChannel [必填项]支付渠道,详见 https://docs.adapay.tech/api/appendix.html#id2
|
* @param divMembers 分账对象信息列表 https://docs.adapay.tech/api/appendix.html#divmembers
|
||||||
* @param expend 支付渠道额外参数,条件可输入,详见 https://docs.adapay.tech/api/appendix.html#expend
|
|
||||||
* @param divMembers 分账对象信息列表,最多仅支持7个分账方,json 数组形式,详见 https://docs.adapay.tech/api/appendix.html#divmembers
|
|
||||||
* @param description 订单附加说明
|
|
||||||
* @return 同步返回一个 支付对象,详见 https://docs.adapay.tech/api/trade.html#id2
|
* @return 同步返回一个 支付对象,详见 https://docs.adapay.tech/api/trade.html#id2
|
||||||
*/
|
*/
|
||||||
public Map<String, Object> pay(PayCallback callback, String payChannel, Expend expend, String orderNo, String payAmt,
|
public Map<String, Object> pay(String payChannel, PayParam payParam, PayCallback callback, Expend expend,
|
||||||
String goodsTittle, String goodsDesc, String divMembers, String description) throws BaseAdaPayException {
|
DeviceInfo deviceInfo, Collection<DivMember> divMembers) throws BaseAdaPayException {
|
||||||
Map<String, Object> paymentParams = new HashMap<>(16);
|
JSONObject paymentParams = payParam.toJSONObject();
|
||||||
paymentParams.put("app_id", adapayProperties.getAppId());
|
paymentParams.put("app_id", adapayProperties.getAppId());
|
||||||
paymentParams.put("notify_url", adapayProperties.getNotifyUrl());
|
paymentParams.put("notify_url", adapayProperties.getNotifyUrl());
|
||||||
paymentParams.put("order_no", orderNo);
|
|
||||||
paymentParams.put("pay_channel", payChannel);
|
paymentParams.put("pay_channel", payChannel);
|
||||||
paymentParams.put("pay_amt", payAmt);
|
|
||||||
paymentParams.put("goods_title", goodsTittle);
|
|
||||||
paymentParams.put("goods_desc", goodsDesc);
|
|
||||||
paymentParams.put("div_members", divMembers);
|
paymentParams.put("div_members", divMembers);
|
||||||
paymentParams.put("description", description);
|
paymentParams.put("device_info", deviceInfo);
|
||||||
paymentParams.put("expend", expend);
|
paymentParams.put("expend", expend);
|
||||||
PayReplyMapping.putCallback(orderNo, callback);
|
PayReplyMapping.putCallback(payParam.getOrderNo(), callback);
|
||||||
logger.info("paymentParams=" + paymentParams);
|
logger.debug("paymentParams: {}", paymentParams.toJSONString());
|
||||||
return Payment.create(paymentParams);
|
return Payment.create(paymentParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package com.ghy.common.adapay.callback;
|
package com.ghy.common.adapay.callback;
|
||||||
|
|
||||||
import com.ghy.common.adapay.callback.model.DrawCashReply;
|
import com.ghy.common.adapay.model.DrawCashReply;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理提现结果的接口
|
* 处理提现结果的接口
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package com.ghy.common.adapay.callback;
|
package com.ghy.common.adapay.callback;
|
||||||
|
|
||||||
import com.ghy.common.adapay.callback.model.PayReply;
|
import com.ghy.common.adapay.model.PayReply;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理支付结果的回调接口
|
* 处理支付结果的回调接口
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package com.ghy.common.adapay.callback;
|
package com.ghy.common.adapay.callback;
|
||||||
|
|
||||||
import com.ghy.common.adapay.callback.model.RefundReply;
|
import com.ghy.common.adapay.model.RefundReply;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理退款结果的回调接口
|
* 处理退款结果的回调接口
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ package com.ghy.common.adapay.callback.mapping;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.ghy.common.adapay.callback.DrawCashCallback;
|
import com.ghy.common.adapay.callback.DrawCashCallback;
|
||||||
import com.ghy.common.adapay.callback.Event;
|
import com.ghy.common.adapay.callback.Event;
|
||||||
import com.ghy.common.adapay.callback.model.DrawCashReply;
|
import com.ghy.common.adapay.model.DrawCashReply;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ package com.ghy.common.adapay.callback.mapping;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.ghy.common.adapay.callback.Event;
|
import com.ghy.common.adapay.callback.Event;
|
||||||
import com.ghy.common.adapay.callback.PayCallback;
|
import com.ghy.common.adapay.callback.PayCallback;
|
||||||
import com.ghy.common.adapay.callback.model.PayReply;
|
import com.ghy.common.adapay.model.PayReply;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ package com.ghy.common.adapay.callback.mapping;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.ghy.common.adapay.callback.Event;
|
import com.ghy.common.adapay.callback.Event;
|
||||||
import com.ghy.common.adapay.callback.RefundCallback;
|
import com.ghy.common.adapay.callback.RefundCallback;
|
||||||
import com.ghy.common.adapay.callback.model.RefundReply;
|
import com.ghy.common.adapay.model.RefundReply;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.ghy.common.adapay.callback.model;
|
package com.ghy.common.adapay.model;
|
||||||
|
|
||||||
import com.alibaba.fastjson.annotation.JSONField;
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
@ -11,7 +11,7 @@ import lombok.EqualsAndHashCode;
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public class AlipayQrExpend extends Expend {
|
public class AlipayExpend extends Expend {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 优惠信息
|
* 优惠信息
|
||||||
|
|
@ -20,11 +20,32 @@ public class AlipayQrExpend extends Expend {
|
||||||
private PromotionDetail promotionDetail;
|
private PromotionDetail promotionDetail;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 花呗分期数
|
* 花呗分期数 String(2)
|
||||||
* 支付金额大于等于 100 元时,可不指定分期数,用户可自由选择分期数;
|
* 支付金额大于等于 100 元时,可不指定分期数,用户可自由选择分期数;
|
||||||
* 支付金额小于 100 元时,必须指定分期数,否则不支持花呗分期支付;
|
* 支付金额小于 100 元时,必须指定分期数,否则不支持花呗分期支付;
|
||||||
* 指定分期数后用户不能更分期数;分期数目前只支持 3、6、12。花呗分期的手续费由用户自己承担。
|
* 指定分期数后用户不能更分期数;分期数目前只支持 3、6、12。花呗分期的手续费由用户自己承担。
|
||||||
*/
|
*/
|
||||||
@JSONField(name = "hb_fq_num")
|
@JSONField(name = "hb_fq_num")
|
||||||
private PromotionDetail hbFqNum;
|
private String hbFqNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 买家的支付宝用户 id
|
||||||
|
* pay_channel = alipay_pub 或 alipay_lite 时必填
|
||||||
|
*/
|
||||||
|
@JSONField(name = "buyer_id")
|
||||||
|
private String buyerId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 买家支付宝账号
|
||||||
|
*/
|
||||||
|
@JSONField(name = "buyer_logon_id")
|
||||||
|
private String buyerLogonId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 扫码设备读出的条形码或者二维码信息
|
||||||
|
* pay_channel = alipay_scan 时必填
|
||||||
|
*/
|
||||||
|
@JSONField(name = "auth_code")
|
||||||
|
private String authCode;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
package com.ghy.common.adapay.model;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 前端设备信息 https://docs.adapay.tech/api/appendix.html#deviceinfo
|
||||||
|
*
|
||||||
|
* @author HH 2022/5/12
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class DeviceInfo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型,1 :手机, 2 :平板, 3:手表, 4:PC
|
||||||
|
*/
|
||||||
|
@JSONField(name = "device_type")
|
||||||
|
private String deviceType;
|
||||||
|
/**
|
||||||
|
* [必填]交易设备所在的公网 IP
|
||||||
|
*/
|
||||||
|
@JSONField(name = "device_ip")
|
||||||
|
private String deviceIp;
|
||||||
|
/**
|
||||||
|
* 终端设备号,收单机构为商户终端分配的唯一编号。当pay_channel的值为alipay_scan或wx_scan时必填。
|
||||||
|
*/
|
||||||
|
@JSONField(name = "device_id")
|
||||||
|
private String deviceId;
|
||||||
|
/**
|
||||||
|
* 交易设备 MAC
|
||||||
|
*/
|
||||||
|
@JSONField(name = "device_mac")
|
||||||
|
private String deviceMac;
|
||||||
|
/**
|
||||||
|
* 交易设备 imei
|
||||||
|
*/
|
||||||
|
@JSONField(name = "device_imei")
|
||||||
|
private String deviceImei;
|
||||||
|
/**
|
||||||
|
* 交易设备 IMSI
|
||||||
|
*/
|
||||||
|
@JSONField(name = "device_imsi")
|
||||||
|
private String deviceImsi;
|
||||||
|
/**
|
||||||
|
* 交易设备 ICCID
|
||||||
|
*/
|
||||||
|
@JSONField(name = "device_iccId")
|
||||||
|
private String deviceIccId;
|
||||||
|
/**
|
||||||
|
* 交易设备 WIFI MAC
|
||||||
|
*/
|
||||||
|
@JSONField(name = "deviceWifiMac")
|
||||||
|
private String device_wifi_mac;
|
||||||
|
/**
|
||||||
|
* 交易设备 GPS
|
||||||
|
*/
|
||||||
|
@JSONField(name = "promotion_detail")
|
||||||
|
private String promotionDetail;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,47 @@
|
||||||
|
package com.ghy.common.adapay.model;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分账对象信息
|
||||||
|
*
|
||||||
|
* @author HH 2022/5/12
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class DivMember {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分账用户 Member 对象的 id;若是商户本身时传入"0"
|
||||||
|
*/
|
||||||
|
@JSONField(name = "member_id")
|
||||||
|
private String memberId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分账金额,精确到分,如 "0.50"、"1.00" 等
|
||||||
|
* 分账总金额必须等于主交易金额,金额不能为 "0.00"
|
||||||
|
*/
|
||||||
|
private String amount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否手续费承担方,N-否,Y-是,手续费承担方有且只能有一个
|
||||||
|
*/
|
||||||
|
@JSONField(name = "fee_flag")
|
||||||
|
private String feeFlag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构造方法
|
||||||
|
*
|
||||||
|
* @param memberId 分账用户 Member 对象的 id;若是商户本身时传入"0"
|
||||||
|
* @param amount 分账金额,精确到分,如 "0.50"、"1.00" 等 分账总金额必须等于主交易金额,金额不能为 "0.00"
|
||||||
|
* @param feeFlag 是否手续费承担方,N-否,Y-是,手续费承担方有且只能有一个
|
||||||
|
*/
|
||||||
|
public DivMember(@NotNull String memberId, @NotNull String amount, boolean feeFlag) {
|
||||||
|
this.memberId = memberId;
|
||||||
|
this.amount = amount;
|
||||||
|
this.feeFlag = feeFlag ? "Y" : "N";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.ghy.common.adapay.callback.model;
|
package com.ghy.common.adapay.model;
|
||||||
|
|
||||||
import com.alibaba.fastjson.annotation.JSONField;
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
package com.ghy.common.adapay.callback.model;
|
package com.ghy.common.adapay.model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 所有支付渠道扩展参数的父类
|
* 所有支付渠道扩展参数的父类
|
||||||
|
* https://docs.adapay.tech/api/appendix.html#expend
|
||||||
*
|
*
|
||||||
* @author HH 2022/3/31
|
* @author HH 2022/3/31
|
||||||
*/
|
*/
|
||||||
|
|
@ -0,0 +1,83 @@
|
||||||
|
package com.ghy.common.adapay.model;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付参数
|
||||||
|
*
|
||||||
|
* @author HH 2022/5/12
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class PayParam {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请求订单号,只能为英文、数字或者下划线的一种或多种组合,保证在app_id下唯一
|
||||||
|
*/
|
||||||
|
@JSONField(name = "order_no")
|
||||||
|
private String orderNo;
|
||||||
|
/**
|
||||||
|
* 交易金额,必须大于0,保留两位小数点,如0.10、100.05等
|
||||||
|
*/
|
||||||
|
@JSONField(name = "pay_amt")
|
||||||
|
private String payAmt;
|
||||||
|
/**
|
||||||
|
* 支付模式,delay- 延时分账模式(值为 delay 时,div_members 字段必须为空);
|
||||||
|
* 值为空时并且div_members不为空时,表示实时分账;
|
||||||
|
* 值为空时并且div_members也为空时,表示不分账;
|
||||||
|
*/
|
||||||
|
@JSONField(name = "pay_mode")
|
||||||
|
private String payMode;
|
||||||
|
/**
|
||||||
|
* 商品标题
|
||||||
|
*/
|
||||||
|
@JSONField(name = "goods_title")
|
||||||
|
private String goodsTittle;
|
||||||
|
/**
|
||||||
|
* 商品描述信息,微信小程序和微信公众号该字段最大长度42个字符
|
||||||
|
*/
|
||||||
|
@JSONField(name = "goods_desc")
|
||||||
|
private String goodsDesc;
|
||||||
|
/**
|
||||||
|
* 订单附加说明 最大长度128个字符
|
||||||
|
*/
|
||||||
|
private String description;
|
||||||
|
/**
|
||||||
|
* 订单失效时间,输入格式:yyyyMMddHHmmss,最长失效时间为微信、支付宝:反扫类:3分钟;非反扫类:2小时;
|
||||||
|
* 云闪付:1天,值为空时默认最长时效时间
|
||||||
|
*/
|
||||||
|
@JSONField(name = "time_expire")
|
||||||
|
private String timeExpire;
|
||||||
|
/**
|
||||||
|
* 手续费收取模式:O-商户手续费账户扣取手续费,I-交易金额中扣取手续费;值为空时,默认值为I;
|
||||||
|
* 若为O时,分账对象列表中不支持传入手续费承担方
|
||||||
|
*/
|
||||||
|
@JSONField(name = "fee_mode")
|
||||||
|
private String feeMode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 包含所有必填参数的构造器,其它参数按需set
|
||||||
|
*
|
||||||
|
* @param orderNo [必填项]请求订单号,只能为英文、数字或者下划线的一种或多种组合,保证在app_id下唯一
|
||||||
|
* @param payAmt [必填项]交易金额,必须大于0,保留两位小数点,如"0.10"、"100.05"
|
||||||
|
* @param goodsTittle [必填项]商品名称
|
||||||
|
* @param goodsDesc [必填项]商品描述信息,微信小程序和微信公众号该字段最大长度42个字符
|
||||||
|
*/
|
||||||
|
public PayParam(String orderNo, String payAmt, String goodsTittle, String goodsDesc) {
|
||||||
|
boolean noneBlank = StringUtils.isNoneBlank(orderNo, payAmt, goodsTittle, goodsDesc);
|
||||||
|
Assert.isTrue(noneBlank, "PayParam [orderNo, payChannel, payAmt, goodsTittle, goodsDesc] cannot be empty!");
|
||||||
|
this.orderNo = orderNo;
|
||||||
|
this.payAmt = payAmt;
|
||||||
|
this.goodsTittle = goodsTittle;
|
||||||
|
this.goodsDesc = goodsDesc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JSONObject toJSONObject() {
|
||||||
|
String jsonString = JSON.toJSONString(this);
|
||||||
|
return JSON.parseObject(jsonString);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.ghy.common.adapay.callback.model;
|
package com.ghy.common.adapay.model;
|
||||||
|
|
||||||
import com.alibaba.fastjson.annotation.JSONField;
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.ghy.common.adapay.callback.model;
|
package com.ghy.common.adapay.model;
|
||||||
|
|
||||||
import com.alibaba.fastjson.annotation.JSONField;
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.ghy.common.adapay.callback.model;
|
package com.ghy.common.adapay.model;
|
||||||
|
|
||||||
import com.alibaba.fastjson.annotation.JSONField;
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.ghy.common.adapay.callback.model;
|
package com.ghy.common.adapay.model;
|
||||||
|
|
||||||
import com.alibaba.fastjson.annotation.JSONField;
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
@ -11,13 +11,20 @@ import lombok.EqualsAndHashCode;
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public class WxLiteExpend extends Expend {
|
public class WxpayExpend extends Expend {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [必填]微信用户关注商家公众号的 openid
|
* 微信用户关注商家公众号的 openid
|
||||||
|
* pay_channel = wx_lite 或 wx_pub 时必填
|
||||||
*/
|
*/
|
||||||
@JSONField(name = "open_id")
|
@JSONField(name = "open_id")
|
||||||
private String openId;
|
private String openId;
|
||||||
|
/**
|
||||||
|
* 扫码设备读出的条形码或者二维码信息
|
||||||
|
* pay_channel = wx_scan 时必填
|
||||||
|
*/
|
||||||
|
@JSONField(name = "auth_code")
|
||||||
|
private String authCode;
|
||||||
/**
|
/**
|
||||||
* 当前微信小程序的 appid
|
* 当前微信小程序的 appid
|
||||||
*/
|
*/
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
package com.ghy.goods.domain;
|
package com.ghy.goods.domain;
|
||||||
|
|
||||||
import com.ghy.common.annotation.Excel;
|
import com.ghy.common.annotation.Excel;
|
||||||
import com.ghy.common.core.domain.BaseEntity;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -11,7 +11,8 @@ import java.util.List;
|
||||||
* 分公司使用类目
|
* 分公司使用类目
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class DeptGoodsCategory extends BaseEntity {
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class DeptGoodsCategory extends GoodsCategory {
|
||||||
|
|
||||||
@Excel(name = "序列", cellType = Excel.ColumnType.NUMERIC)
|
@Excel(name = "序列", cellType = Excel.ColumnType.NUMERIC)
|
||||||
private Long deptGoodsCategoryId;
|
private Long deptGoodsCategoryId;
|
||||||
|
|
@ -19,18 +20,6 @@ public class DeptGoodsCategory extends BaseEntity {
|
||||||
@Excel(name = "分公司id", cellType = Excel.ColumnType.NUMERIC)
|
@Excel(name = "分公司id", cellType = Excel.ColumnType.NUMERIC)
|
||||||
private Long deptId;
|
private Long deptId;
|
||||||
|
|
||||||
@Excel(name = "类别id", cellType = Excel.ColumnType.NUMERIC)
|
|
||||||
private Long goodsCategoryId;
|
|
||||||
@Excel(name = "类别编码", cellType = Excel.ColumnType.STRING)
|
|
||||||
private String goodsCategoryCode;
|
|
||||||
@Excel(name = "类别名称", cellType = Excel.ColumnType.STRING)
|
|
||||||
private String goodsCategoryName;
|
|
||||||
@Excel(name = "类别类型. 1.服务类 2.商品类", cellType = Excel.ColumnType.STRING)
|
|
||||||
private Integer type;
|
|
||||||
|
|
||||||
@Excel(name = "排序", cellType = Excel.ColumnType.STRING)
|
|
||||||
private Integer categorySort;
|
|
||||||
|
|
||||||
@Excel(name = "一级分销扣点比例", cellType = Excel.ColumnType.STRING)
|
@Excel(name = "一级分销扣点比例", cellType = Excel.ColumnType.STRING)
|
||||||
private String oneRate;
|
private String oneRate;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ public interface DeptGoodsCategoryMapper {
|
||||||
* @param category 商品入参
|
* @param category 商品入参
|
||||||
* @return 商品集合
|
* @return 商品集合
|
||||||
*/
|
*/
|
||||||
List<DeptGoodsCategory> selectDeptGoodsCategoryList(DeptGoodsCategory category);
|
List<DeptGoodsCategory> selectList(DeptGoodsCategory category);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,9 @@ public interface DeptGoodsCategoryService {
|
||||||
/**
|
/**
|
||||||
* 用deptId查询出该公司的所有类目
|
* 用deptId查询出该公司的所有类目
|
||||||
*
|
*
|
||||||
* @param deptId 公司ID
|
* @param category 查询条件
|
||||||
*/
|
*/
|
||||||
List<DeptGoodsCategory> list(Long deptId);
|
List<DeptGoodsCategory> list(DeptGoodsCategory category);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增一条分公司类目
|
* 新增一条分公司类目
|
||||||
|
|
@ -56,4 +56,6 @@ public interface DeptGoodsCategoryService {
|
||||||
* @return 父子层级的list
|
* @return 父子层级的list
|
||||||
*/
|
*/
|
||||||
List<DeptGoodsCategory> appList(Long deptId);
|
List<DeptGoodsCategory> appList(Long deptId);
|
||||||
|
|
||||||
|
int delete(String ids);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,18 @@
|
||||||
package com.ghy.goods.service.impl;
|
package com.ghy.goods.service.impl;
|
||||||
|
|
||||||
import com.ghy.common.core.domain.Ztree;
|
import com.ghy.common.core.domain.Ztree;
|
||||||
|
import com.ghy.common.core.text.Convert;
|
||||||
import com.ghy.common.utils.StringUtils;
|
import com.ghy.common.utils.StringUtils;
|
||||||
import com.ghy.goods.domain.DeptGoodsCategory;
|
import com.ghy.goods.domain.DeptGoodsCategory;
|
||||||
import com.ghy.goods.domain.GoodsCategory;
|
|
||||||
import com.ghy.goods.mapper.DeptGoodsCategoryMapper;
|
import com.ghy.goods.mapper.DeptGoodsCategoryMapper;
|
||||||
import com.ghy.goods.service.DeptGoodsCategoryService;
|
import com.ghy.goods.service.DeptGoodsCategoryService;
|
||||||
import com.ghy.goods.service.GoodsCategoryService;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.*;
|
import java.util.Arrays;
|
||||||
import java.util.stream.Collectors;
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author clunt
|
* @author clunt
|
||||||
|
|
@ -22,30 +22,12 @@ import java.util.stream.Collectors;
|
||||||
@Service
|
@Service
|
||||||
public class DeptGoodsCategoryServiceImpl implements DeptGoodsCategoryService {
|
public class DeptGoodsCategoryServiceImpl implements DeptGoodsCategoryService {
|
||||||
|
|
||||||
@Resource
|
|
||||||
private GoodsCategoryService goodsCategoryService;
|
|
||||||
@Resource
|
@Resource
|
||||||
private DeptGoodsCategoryMapper deptGoodsCategoryMapper;
|
private DeptGoodsCategoryMapper deptGoodsCategoryMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DeptGoodsCategory> list(Long deptId) {
|
public List<DeptGoodsCategory> list(DeptGoodsCategory category) {
|
||||||
DeptGoodsCategory query = new DeptGoodsCategory();
|
return deptGoodsCategoryMapper.selectList(category);
|
||||||
query.setDeptId(deptId);
|
|
||||||
List<DeptGoodsCategory> result = deptGoodsCategoryMapper.selectDeptGoodsCategoryList(query);
|
|
||||||
if (result.isEmpty())
|
|
||||||
return result;
|
|
||||||
Set<Long> goodsCategoryIdSet = result.stream().map(DeptGoodsCategory::getGoodsCategoryId).filter(Objects::nonNull).collect(Collectors.toSet());
|
|
||||||
List<GoodsCategory> goodsCategoryList = goodsCategoryService.selectByIds(goodsCategoryIdSet);
|
|
||||||
Map<Long, GoodsCategory> goodsCategoryMap = goodsCategoryList.stream().collect(Collectors.toMap(GoodsCategory::getGoodsCategoryId, x -> x));
|
|
||||||
result.forEach(x -> {
|
|
||||||
GoodsCategory goodsCategory = goodsCategoryMap.get(x.getGoodsCategoryId());
|
|
||||||
if (goodsCategory != null) {
|
|
||||||
x.setGoodsCategoryName(goodsCategory.getGoodsCategoryName());
|
|
||||||
x.setGoodsCategoryCode(goodsCategory.getGoodsCategoryCode());
|
|
||||||
x.setType(goodsCategory.getType());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -100,6 +82,12 @@ public class DeptGoodsCategoryServiceImpl implements DeptGoodsCategoryService {
|
||||||
return goodsCategoryList;
|
return goodsCategoryList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int delete(String ids) {
|
||||||
|
Long[] array = Convert.toLongArray(ids);
|
||||||
|
return delete(Arrays.asList(array));
|
||||||
|
}
|
||||||
|
|
||||||
private void fillChild(List<DeptGoodsCategory> goodsCategoryList) {
|
private void fillChild(List<DeptGoodsCategory> goodsCategoryList) {
|
||||||
List<DeptGoodsCategory> childList;
|
List<DeptGoodsCategory> childList;
|
||||||
for (DeptGoodsCategory deptGoodsCategory : goodsCategoryList) {
|
for (DeptGoodsCategory deptGoodsCategory : goodsCategoryList) {
|
||||||
|
|
|
||||||
|
|
@ -30,11 +30,13 @@ public class GoodsCategoryServiceImpl implements GoodsCategoryService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int insertGoodsCategory(GoodsCategory goodsCategory) {
|
public int insertGoodsCategory(GoodsCategory goodsCategory) {
|
||||||
|
setLevel(goodsCategory);
|
||||||
return goodsCategoryMapper.insertCategoryGoods(goodsCategory);
|
return goodsCategoryMapper.insertCategoryGoods(goodsCategory);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int updateGoodsCategory(GoodsCategory goodsCategory) {
|
public int updateGoodsCategory(GoodsCategory goodsCategory) {
|
||||||
|
setLevel(goodsCategory);
|
||||||
return goodsCategoryMapper.updateGoodsCategory(goodsCategory);
|
return goodsCategoryMapper.updateGoodsCategory(goodsCategory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -106,7 +108,7 @@ public class GoodsCategoryServiceImpl implements GoodsCategoryService {
|
||||||
*/
|
*/
|
||||||
public List<Ztree> initZtree(List<GoodsCategory> goodsCategoryList, List<String> roleDeptList) {
|
public List<Ztree> initZtree(List<GoodsCategory> goodsCategoryList, List<String> roleDeptList) {
|
||||||
|
|
||||||
List<Ztree> ztrees = new ArrayList<Ztree>();
|
List<Ztree> ztrees = new ArrayList<>();
|
||||||
for (GoodsCategory goodsCategory : goodsCategoryList) {
|
for (GoodsCategory goodsCategory : goodsCategoryList) {
|
||||||
if (UserConstants.CATEGORY_NORMAL.equals(goodsCategory.getStatus())) {
|
if (UserConstants.CATEGORY_NORMAL.equals(goodsCategory.getStatus())) {
|
||||||
Ztree ztree = new Ztree();
|
Ztree ztree = new Ztree();
|
||||||
|
|
@ -121,5 +123,13 @@ public class GoodsCategoryServiceImpl implements GoodsCategoryService {
|
||||||
return ztrees;
|
return ztrees;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setLevel(GoodsCategory goodsCategory) {
|
||||||
|
Long parentId = goodsCategory.getParentCategoryId();
|
||||||
|
GoodsCategory parent;
|
||||||
|
if (parentId == null || (parent = goodsCategoryMapper.selectById(parentId)) == null) {
|
||||||
|
goodsCategory.setLevel(1);
|
||||||
|
} else {
|
||||||
|
goodsCategory.setLevel(parent.getLevel() + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,11 @@
|
||||||
<result property="deptGoodsCategoryId" column="dept_goods_category_id"/>
|
<result property="deptGoodsCategoryId" column="dept_goods_category_id"/>
|
||||||
<result property="deptId" column="dept_id"/>
|
<result property="deptId" column="dept_id"/>
|
||||||
<result property="goodsCategoryId" column="goods_category_id"/>
|
<result property="goodsCategoryId" column="goods_category_id"/>
|
||||||
<result property="goodsCategoryName" column="goods_category_name"/>
|
<result property="goodsCategoryName" column="goods_category_name"/>
|
||||||
<result property="parentCategoryId" column="parent_category_id" />
|
<result property="parentCategoryId" column="parent_category_id" />
|
||||||
|
<result property="level" column="level" />
|
||||||
|
<result property="status" column="status" />
|
||||||
|
<result property="type" column="type" />
|
||||||
<result property="categorySort" column="category_sort"/>
|
<result property="categorySort" column="category_sort"/>
|
||||||
<result property="oneRate" column="one_rate"/>
|
<result property="oneRate" column="one_rate"/>
|
||||||
<result property="twoRate" column="two_rate"/>
|
<result property="twoRate" column="two_rate"/>
|
||||||
|
|
@ -25,11 +28,15 @@
|
||||||
FROM dept_goods_category
|
FROM dept_goods_category
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
<sql id="selectJoin">
|
||||||
|
SELECT dgc.dept_goods_category_id, dgc.dept_id, dgc.goods_category_id, dgc.category_sort,
|
||||||
|
dgc.one_rate, dgc.two_rate, dgc.three_rate, dgc.create_by, dgc.create_time, dgc.remark,
|
||||||
|
gc.goods_category_name, gc.level, gc.parent_category_id, gc.type, gc.status
|
||||||
|
FROM dept_goods_category dgc LEFT JOIN goods_category gc ON dgc.goods_category_id = gc.goods_category_id
|
||||||
|
</sql>
|
||||||
|
|
||||||
<select id="appList" parameterType="com.ghy.goods.domain.DeptGoodsCategory" resultMap="DeptGoodsCategoryResult">
|
<select id="appList" parameterType="com.ghy.goods.domain.DeptGoodsCategory" resultMap="DeptGoodsCategoryResult">
|
||||||
SELECT dgc.dept_goods_category_id, dgc.dept_id, dgc.goods_category_id, gc.goods_category_name, gc.parent_category_id, dgc.category_sort,
|
<include refid="selectJoin"/>
|
||||||
dgc.one_rate, dgc.two_rate, dgc.three_rate, dgc.create_by, dgc.create_time, dgc.remark
|
|
||||||
FROM dept_goods_category dgc
|
|
||||||
LEFT JOIN goods_category gc on gc.goods_category_id = dgc.goods_category_id
|
|
||||||
<where>
|
<where>
|
||||||
dgc.dept_id = #{deptId}
|
dgc.dept_id = #{deptId}
|
||||||
<if test="goodsCategoryId == null ">
|
<if test="goodsCategoryId == null ">
|
||||||
|
|
@ -45,7 +52,6 @@
|
||||||
<update id="updateDeptGoodsCategory" parameterType="com.ghy.goods.domain.DeptGoodsCategory">
|
<update id="updateDeptGoodsCategory" parameterType="com.ghy.goods.domain.DeptGoodsCategory">
|
||||||
UPDATE dept_goods_category
|
UPDATE dept_goods_category
|
||||||
<set>
|
<set>
|
||||||
<if test="deptId != null and goodsCategoryCode != ''">dept_id = #{deptId},</if>
|
|
||||||
<if test="goodsCategoryId != null">goods_category_id = #{goodsCategoryId},</if>
|
<if test="goodsCategoryId != null">goods_category_id = #{goodsCategoryId},</if>
|
||||||
<if test="categorySort != null">category_sort = #{categorySort},</if>
|
<if test="categorySort != null">category_sort = #{categorySort},</if>
|
||||||
<if test="oneRate != null and oneRate != ''">one_rate = #{oneRate},</if>
|
<if test="oneRate != null and oneRate != ''">one_rate = #{oneRate},</if>
|
||||||
|
|
@ -76,7 +82,7 @@
|
||||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||||
create_time
|
create_time
|
||||||
)values(
|
)values(
|
||||||
<if test="deptId != null and goodsCategoryCode != ''">#{deptId},</if>
|
<if test="deptId != null and deptId != ''">#{deptId},</if>
|
||||||
<if test="goodsCategoryId != null">#{goodsCategoryId},</if>
|
<if test="goodsCategoryId != null">#{goodsCategoryId},</if>
|
||||||
<if test="categorySort != null">#{categorySort},</if>
|
<if test="categorySort != null">#{categorySort},</if>
|
||||||
<if test="oneRate != null and oneRate != ''">#{oneRate},</if>
|
<if test="oneRate != null and oneRate != ''">#{oneRate},</if>
|
||||||
|
|
@ -87,11 +93,17 @@
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<select id="selectDeptGoodsCategoryList" parameterType="com.ghy.goods.domain.DeptGoodsCategory" resultMap="DeptGoodsCategoryResult">
|
<select id="selectList" parameterType="com.ghy.goods.domain.DeptGoodsCategory" resultMap="DeptGoodsCategoryResult">
|
||||||
<include refid="selectDeptGoodsCategory" />
|
<include refid="selectJoin"/>
|
||||||
<where>
|
<where>
|
||||||
<if test="deptId != null">
|
<if test="deptId != null">
|
||||||
AND dept_id = #{deptId}
|
AND dgc.dept_id = #{deptId}
|
||||||
|
</if>
|
||||||
|
<if test="goodsCategoryName != null and goodsCategoryName != ''">
|
||||||
|
AND gc.goods_category_name LIKE concat('%', #{goodsCategoryName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="status != null and status != ''">
|
||||||
|
AND gc.status LIKE concat('%', #{status}, '%')
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
<sql id="selectGoodsCategory">
|
<sql id="selectGoodsCategory">
|
||||||
SELECT goods_category_id, goods_category_code, goods_category_name, parent_category_id,
|
SELECT goods_category_id, goods_category_code, goods_category_name, parent_category_id,
|
||||||
level, type, status, create_by, create_time, remark
|
level, type, status, create_by, create_time, remark, category_sort
|
||||||
FROM goods_category
|
FROM goods_category
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
|
@ -84,12 +84,12 @@
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<select id="selectByGoodsCategoryName" parameterType="long" resultMap="GoodsCategoryResult">
|
<select id="selectByGoodsCategoryName" parameterType="String" resultMap="GoodsCategoryResult">
|
||||||
<include refid="selectGoodsCategory"/>
|
<include refid="selectGoodsCategory"/>
|
||||||
WHERE goods_category_name = #{goodsCategoryName} LIMIT 1
|
WHERE goods_category_name = #{goodsCategoryName} LIMIT 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectByGoodsCategoryCode" parameterType="long" resultMap="GoodsCategoryResult">
|
<select id="selectByGoodsCategoryCode" parameterType="String" resultMap="GoodsCategoryResult">
|
||||||
<include refid="selectGoodsCategory"/>
|
<include refid="selectGoodsCategory"/>
|
||||||
WHERE goods_category_code = #{goodsCategoryCode} LIMIT 1
|
WHERE goods_category_code = #{goodsCategoryCode} LIMIT 1
|
||||||
</select>
|
</select>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue