Commit ec4795a4 by zhengyunfei

二次开发

parent 1c569b7b
...@@ -186,9 +186,29 @@ public class OrderMainAppController { ...@@ -186,9 +186,29 @@ public class OrderMainAppController {
public Result cancelOrder(@RequestBody JSONObject json) { public Result cancelOrder(@RequestBody JSONObject json) {
//1. 将前台传过来的json对象转换成具有业务属性的 Java 对象 //1. 将前台传过来的json对象转换成具有业务属性的 Java 对象
OrderMain user = JSONObject.toJavaObject(json, OrderMain.class); OrderMain user = JSONObject.toJavaObject(json, OrderMain.class);
return this.orderService.cancelOrder(user); return this.orderService.cancelOrder(user);
}
/**
* 申请退款
*/
@RequestMapping(value = "/refundOrder", method = RequestMethod.POST)
@ResponseBody
public Result refundOrder(@RequestBody JSONObject json) {
//1. 将前台传过来的json对象转换成具有业务属性的 Java 对象
OrderMain user = JSONObject.toJavaObject(json, OrderMain.class);
return this.orderService.refundOrder(user);
}
/**
* 退货
*/
@RequestMapping(value = "/saveCourierNumber", method = RequestMethod.POST)
@ResponseBody
public Result saveCourierNumber(@RequestBody JSONObject json) {
//1. 将前台传过来的json对象转换成具有业务属性的 Java 对象
OrderMain user = JSONObject.toJavaObject(json, OrderMain.class);
return this.orderService.saveCourierNumber(user);
} }
......
...@@ -100,7 +100,7 @@ public class WxController { ...@@ -100,7 +100,7 @@ public class WxController {
@RequestMapping(value = "/wxRefund", method = RequestMethod.POST) @RequestMapping(value = "/wxRefund", method = RequestMethod.POST)
public Result wxRefund(Integer userId, Integer orderId, HttpServletRequest request) { public Result wxRefund(Integer userId, Integer orderId, HttpServletRequest request) {
try { try {
return wxService.wxRefund(userId, orderId, request); return wxService.wxRefund(userId, orderId,"", request);
} catch (Exception e) { } catch (Exception e) {
return new Result(103); return new Result(103);
} }
......
...@@ -31,6 +31,10 @@ public class OrderMainController { ...@@ -31,6 +31,10 @@ public class OrderMainController {
public String loanList(Model model) { public String loanList(Model model) {
return "order/loanList"; return "order/loanList";
} }
@RequestMapping(value = "/refundList")
public String refundList(Model model) {
return "order/refundList";
}
@RequestMapping(value = "/vipList") @RequestMapping(value = "/vipList")
public String vipList(Model model) { public String vipList(Model model) {
...@@ -155,6 +159,60 @@ public class OrderMainController { ...@@ -155,6 +159,60 @@ public class OrderMainController {
/** /**
* 团购退款订单列表
*/
@RequestMapping(value = "/findPageRefundList", method = RequestMethod.POST)
@ResponseBody
public Result findPageRefundList(@RequestBody OrderMain item) {
//这里对返回对象用Map处理,map.pageinfo=>分页信息;map.items=>结果数据集;
Map<String,Object> rmap = new HashMap<String,Object>();
//传入当前页数,适配PC端Layui分页
if(item.getCurpage() != null || item.getPagesize() != null) {
PageInfo pinfo = new PageInfo();
if(item.getCurpage() != null) {
pinfo.setCurPage(item.getCurpage());
}
if(item.getPagesize() != null) {
pinfo.setPageSize(item.getPagesize());
}
item.setPageinfo(pinfo);
}
// 1.查询前 需要对分页对象 做处理,主要是 分页 开始记录数 limit arg0开始记录,arg1每页几条记录
PageInfo pinfo = item.getPageinfo();
if(pinfo == null) {
pinfo = new PageInfo();
item.setPageinfo(pinfo);
}else{
// 分页开始记录数
int curRecord = (pinfo.getCurPage() - 1) * pinfo.getPageSize();
pinfo.setCurRecord(curRecord);
item.setPageinfo(pinfo);
}
// 2.1 执行主表 查询
List<OrderMain> items=this.orderService.selectByParamPageRefundGroupList(item);
// 3.将查询结果的 分页数据封装后返回
int totalRs = pinfo.getTotalRecords(); //总记录数
int totalPs = 0; //总页数
if(totalRs % pinfo.getPageSize() == 0){ //总页数计算
totalPs = totalRs / pinfo.getPageSize() ;
}else{
totalPs = 1 + totalRs / pinfo.getPageSize() ;
}
pinfo.setTotalPages(totalPs);
// 4.将分页对象、结果集合 封装后返回前台
rmap.put("pageinfo", pinfo);
rmap.put("items", items);
return Result.success(rmap);
}
/**
* 多参数查询列表 * 多参数查询列表
*/ */
@RequestMapping(value = "/findByParam", method = RequestMethod.POST) @RequestMapping(value = "/findByParam", method = RequestMethod.POST)
...@@ -255,7 +313,34 @@ public class OrderMainController { ...@@ -255,7 +313,34 @@ public class OrderMainController {
} }
/**
* 退款申请通过
*/
@RequestMapping(value = "/refundApplicationPass",method = RequestMethod.POST)
@ResponseBody
public Result refundApplicationPass(@RequestBody JSONObject json){
OrderMain user = JSONObject.toJavaObject(json,OrderMain.class);
return this.orderService.refundApplicationPass(user);
}
/**
* 退款申请拒绝
*/
@RequestMapping(value = "/refundApplicationRefuse",method = RequestMethod.POST)
@ResponseBody
public Result refundApplicationRefuse(@RequestBody JSONObject json){
OrderMain user = JSONObject.toJavaObject(json,OrderMain.class);
return this.orderService.refundApplicationRefuse(user);
}
/**
* 已收到退回货物,开始退款
*/
@RequestMapping(value = "/receive",method = RequestMethod.POST)
@ResponseBody
public Result refundReceive(@RequestBody JSONObject json){
OrderMain user = JSONObject.toJavaObject(json,OrderMain.class);
return this.orderService.refundReceive(user);
}
/** /**
* 订单已完成 * 订单已完成
...@@ -272,7 +357,7 @@ public class OrderMainController { ...@@ -272,7 +357,7 @@ public class OrderMainController {
/** /**
* @积分兑换 商品 * 积分兑换 商品
*/ */
@RequestMapping(value = "/integralPay", method = RequestMethod.POST) @RequestMapping(value = "/integralPay", method = RequestMethod.POST)
public Result integralPay(Integer userId, Integer orderId){ public Result integralPay(Integer userId, Integer orderId){
......
...@@ -77,7 +77,7 @@ public class TaskJob { ...@@ -77,7 +77,7 @@ public class TaskJob {
// 循环退款 // 循环退款
orderMains.forEach(orderMain -> { orderMains.forEach(orderMain -> {
try { try {
wxService.wxRefund(orderMain.getCustomerid(), orderMain.getId(), null); wxService.wxRefund(orderMain.getCustomerid(), orderMain.getId(), "拼团失败", null);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -22,4 +22,6 @@ public interface OrderMainDao extends BaseMapper<OrderMain> { ...@@ -22,4 +22,6 @@ public interface OrderMainDao extends BaseMapper<OrderMain> {
List<OrderMain> selectByGroupOrderId(Long id); List<OrderMain> selectByGroupOrderId(Long id);
OrderMain getLastOrderAddres(Integer userId); OrderMain getLastOrderAddres(Integer userId);
List<OrderMain> selectByParamPageRefundGroupList(OrderMain item);
} }
...@@ -60,13 +60,18 @@ public class OrderMain { ...@@ -60,13 +60,18 @@ public class OrderMain {
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(JsonInclude.Include.NON_NULL)
private String endDate; private String endDate;
//订单状态[10:待付款 20:待发货 30:待收货 90:已完成 99:已拒绝/关闭 100:取消/退款] //订单状态[10:待付款 20:待发货 30:待收货 90:已完成 99:已拒绝/关闭 100:取消 101退款申请中 102待退货 103待退款 104退款成功 105退款拒绝]
public static final Integer STATUS_NOPAY = 10; public static final Integer STATUS_NOPAY = 10;
public static final Integer STATUS_YESPAY = 20; public static final Integer STATUS_YESPAY = 20;
public static final Integer STATUS_WAITING = 30; public static final Integer STATUS_WAITING = 30;
public static final Integer STATUS_COMPLETE = 90; public static final Integer STATUS_COMPLETE = 90;
public static final Integer STATUS_REFUSEED = 99; public static final Integer STATUS_REFUSEED = 99;
public static final Integer STATUS_CANCEL = 100; public static final Integer STATUS_CANCEL = 100;
public static final Integer STATUS_APPLICATION = 101;
public static final Integer STATUS_RETURN_GOODS = 102;
public static final Integer STATUS_REFUND = 103;
public static final Integer STATUS_REFUND_SUC = 104;
public static final Integer STATUS_REFUND_REFUSE = 105;
//数据库字段 //数据库字段
private Integer id; // id主键 private Integer id; // id主键
...@@ -88,9 +93,12 @@ public class OrderMain { ...@@ -88,9 +93,12 @@ public class OrderMain {
private Double dactscore; // 订单实付积分[整数] private Double dactscore; // 订单实付积分[整数]
private Integer ipaystatus; // 支付状态[0:未支付1:支付成功2:支付失败] private Integer ipaystatus; // 支付状态[0:未支付1:支付成功2:支付失败]
private Date tpaytime; // 支付时间[yyyy-MM-dd hh:mm:ss] private Date tpaytime; // 支付时间[yyyy-MM-dd hh:mm:ss]
private Integer irefundstatus; // 退款状态[0:待退款1:已退款2:退款失败] private String refundorderno;
private Integer irefundstatus; // 退款状态[101退款申请中 102待退货 103待退款 104退款成功 105退款拒绝]
private Date trefundtime; // 退款时间[yyyy-MM-dd hh:mm:ss] private Date trefundtime; // 退款时间[yyyy-MM-dd hh:mm:ss]
private String srefundreason; // 退款理由 private String srefundreason; // 退款理由
private String srefundpic; // 退款图片
private String couriernumber; // 退货快递单号
private Integer istatus; // 订单状态 private Integer istatus; // 订单状态
private Integer itype; // 订单类型 //10 外卖订单 20 团购订单 private Integer itype; // 订单类型 //10 外卖订单 20 团购订单
private Integer ipaytype; // 支付方式[10:微信支付.20:支付宝支付.30积分支付] private Integer ipaytype; // 支付方式[10:微信支付.20:支付宝支付.30积分支付]
...@@ -126,6 +134,9 @@ public class OrderMain { ...@@ -126,6 +134,9 @@ public class OrderMain {
private Long groupBuyId; private Long groupBuyId;
@TableField(exist = false) @TableField(exist = false)
private String groupBuyName;
@TableField(exist = false)
private Integer appflag; private Integer appflag;
@TableField(exist = false) @TableField(exist = false)
......
...@@ -15,7 +15,7 @@ public interface WxService { ...@@ -15,7 +15,7 @@ public interface WxService {
void notify(HttpServletRequest request, HttpServletResponse response) throws IOException, JDOMException; void notify(HttpServletRequest request, HttpServletResponse response) throws IOException, JDOMException;
Result wxRefund(Integer userId, Integer orderId, HttpServletRequest request) throws Exception; Result wxRefund(Integer userId, Integer orderId, String srefundreason, HttpServletRequest request) throws Exception;
void wxRefundNotify(HttpServletRequest request, HttpServletResponse response) throws IOException, JDOMException; void wxRefundNotify(HttpServletRequest request, HttpServletResponse response) throws IOException, JDOMException;
} }
...@@ -121,6 +121,7 @@ public class GroupBuyServiceimpl implements GroupBuyService { ...@@ -121,6 +121,7 @@ public class GroupBuyServiceimpl implements GroupBuyService {
public List<Product> productList(Product item) { public List<Product> productList(Product item) {
DocCatalog catalog = docCatalogDao.selectOne(Wrappers.<DocCatalog>lambdaQuery().like(DocCatalog::getSname, "团购")); DocCatalog catalog = docCatalogDao.selectOne(Wrappers.<DocCatalog>lambdaQuery().like(DocCatalog::getSname, "团购"));
item.setCatalogid(catalog.getId()); item.setCatalogid(catalog.getId());
item.setIstatus(1);
return productDao.selectByParamPageList(item); return productDao.selectByParamPageList(item);
} }
......
package com.yunniu.farming.webadmin.service.impl; package com.yunniu.farming.webadmin.service.impl;
import com.alibaba.fastjson.JSON;
import com.yunniu.farming.result.Result; import com.yunniu.farming.result.Result;
import com.yunniu.farming.util.DateTools; import com.yunniu.farming.util.DateTools;
import com.yunniu.farming.util.DateUtils; import com.yunniu.farming.util.DateUtils;
...@@ -14,9 +15,12 @@ import com.yunniu.farming.webadmin.model.Integralrec; ...@@ -14,9 +15,12 @@ import com.yunniu.farming.webadmin.model.Integralrec;
import com.yunniu.farming.webadmin.model.OrderMain; import com.yunniu.farming.webadmin.model.OrderMain;
import com.yunniu.farming.webadmin.model.OrderSub; import com.yunniu.farming.webadmin.model.OrderSub;
import com.yunniu.farming.webadmin.service.GroupOrderService; import com.yunniu.farming.webadmin.service.GroupOrderService;
import com.yunniu.farming.webadmin.service.WxService;
import com.yunniu.farming.wx.WxConfigUtil; import com.yunniu.farming.wx.WxConfigUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -27,7 +31,7 @@ import java.util.HashMap; ...@@ -27,7 +31,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@Slf4j
@Service @Service
public class OrderMainServiceImpl { public class OrderMainServiceImpl {
...@@ -47,6 +51,10 @@ public class OrderMainServiceImpl { ...@@ -47,6 +51,10 @@ public class OrderMainServiceImpl {
@Autowired @Autowired
private GroupOrderService orderService; private GroupOrderService orderService;
@Autowired
@Lazy
private WxService wxService;
/** /**
* 分页查询所有数据 * 分页查询所有数据
...@@ -54,7 +62,6 @@ public class OrderMainServiceImpl { ...@@ -54,7 +62,6 @@ public class OrderMainServiceImpl {
*/ */
public List<OrderMain> selectByParamPageList(OrderMain doc) { public List<OrderMain> selectByParamPageList(OrderMain doc) {
return this.orderMainDao.selectByParamPageList(doc); return this.orderMainDao.selectByParamPageList(doc);
} }
...@@ -278,7 +285,51 @@ public class OrderMainServiceImpl { ...@@ -278,7 +285,51 @@ public class OrderMainServiceImpl {
} }
/**
* 更改订单退款申请通过
*/
public Result refundApplicationPass(OrderMain order) {
if(order.getId() == null){
return Result.error();
}
order.setIrefundstatus(OrderMain.STATUS_RETURN_GOODS);
this.orderMainDao.updateById(order);
return Result.success("成功");
}
/**
* 更改订单退款申请通过
*/
public Result refundApplicationRefuse(OrderMain order) {
if(order.getId() == null){
return Result.error();
}
order.setIrefundstatus(OrderMain.STATUS_REFUND_REFUSE);
this.orderMainDao.updateById(order);
return Result.success("成功");
}
/**
* 已收到退回货物,开始退款
* @param order
* @return
*/
@Transactional(rollbackFor = Exception.class)
public Result refundReceive(OrderMain order) {
// 根据id获取订单信息
OrderMain orderMain = this.orderMainDao.selectById(order.getId());
orderMain.setIrefundstatus(OrderMain.STATUS_REFUND);
this.orderMainDao.updateById(orderMain);
log.info("收货成功,开始退款:{}", JSON.toJSONString(orderMain));
try {
wxService.wxRefund(orderMain.getCustomerid(), orderMain.getId(), "用户申请退款", null);
} catch (Exception e) {
throw new RuntimeException(e);
}
return null;
}
@Transactional(rollbackFor = Exception.class)
public Result cancelOrder(OrderMain order) { public Result cancelOrder(OrderMain order) {
if(order.getId() == null){ if(order.getId() == null){
...@@ -288,8 +339,12 @@ public class OrderMainServiceImpl { ...@@ -288,8 +339,12 @@ public class OrderMainServiceImpl {
OrderMain orderMain = this.orderMainDao.selectById(order.getId()); OrderMain orderMain = this.orderMainDao.selectById(order.getId());
//已支付订单 无法取消 //已支付订单 无法取消
if(orderMain.getIpaystatus().equals(OrderMain.FLAG_Y)){ if(orderMain.getIpaystatus().equals(OrderMain.PAY_STATUS_OK)){
return Result.error("订单已支付,无法取消"); try {
wxService.wxRefund(orderMain.getCustomerid(), orderMain.getId(), "用户申请退款", null);
} catch (Exception e) {
throw new RuntimeException(e);
}
} }
//已取消 //已取消
...@@ -473,4 +528,31 @@ public class OrderMainServiceImpl { ...@@ -473,4 +528,31 @@ public class OrderMainServiceImpl {
return Result.success(this.orderMainDao.getLastOrderAddres(userId)); return Result.success(this.orderMainDao.getLastOrderAddres(userId));
} }
/**
* 申请退款
* @param order
* @return
*/
@Transactional(rollbackFor = Exception.class)
public Result refundOrder(OrderMain order) {
OrderMain orderMain = this.orderMainDao.selectById(order.getId());
orderMain.setSrefundreason(order.getSrefundreason());
orderMain.setSrefundpic(order.getSrefundpic());
orderMain.setIrefundstatus(OrderMain.STATUS_APPLICATION);
this.orderMainDao.updateById(orderMain);
return Result.success("成功");
}
public List<OrderMain> selectByParamPageRefundGroupList(OrderMain item) {
return this.orderMainDao.selectByParamPageRefundGroupList(item);
}
public Result saveCourierNumber(OrderMain order) {
OrderMain orderMain = this.orderMainDao.selectById(order.getId());
orderMain.setIrefundstatus(OrderMain.STATUS_RETURN_GOODS);
orderMain.setCouriernumber(order.getCouriernumber());
this.orderMainDao.updateById(orderMain);
return Result.success("成功");
}
} }
...@@ -234,15 +234,16 @@ public class WxServiceImpl implements WxService { ...@@ -234,15 +234,16 @@ public class WxServiceImpl implements WxService {
* @return * @return
*/ */
@Override @Override
public Result wxRefund(Integer userId, Integer orderId, HttpServletRequest request) throws Exception { public Result wxRefund(Integer userId, Integer orderId, String srefundreason, HttpServletRequest request) throws Exception {
OrderMain order = orderMainDao.selectByPrimaryKey(orderId); OrderMain order = orderMainDao.selectByPrimaryKey(orderId);
if (order == null || !order.getCustomerid().equals(userId)) { if (order == null || !order.getCustomerid().equals(userId)) {
return new Result(102); return new Result(102);
} }
order.setSdef1("R" + StringHelper.getOrderno()); // 退款单号 order.setSdef1("R" + StringHelper.getOrderno()); // 退款单号
order.setSrefundreason("拼团失败"); // 退款理由 order.setSrefundreason(srefundreason); // 退款理由
order.setIrefundstatus(0); order.setIrefundstatus(0);
order.setTrefundtime(new Date()); order.setTrefundtime(new Date());
order.setRefundorderno(StringHelper.getOrderno());
orderMainDao.updateById(order); orderMainDao.updateById(order);
double tradeMoney = order.getDactmoney(); double tradeMoney = order.getDactmoney();
...@@ -259,6 +260,7 @@ public class WxServiceImpl implements WxService { ...@@ -259,6 +260,7 @@ public class WxServiceImpl implements WxService {
//parameters.put("profit_sharing", "Y"); //parameters.put("profit_sharing", "Y");
// 用户端实际ip // 用户端实际ip
parameters.put("notify_url", WxConfigUtil.refund_notify_url); // 接收微信支付异步通知回调地址 parameters.put("notify_url", WxConfigUtil.refund_notify_url); // 接收微信支付异步通知回调地址
parameters.put("out_refund_no", order.getRefundorderno());
System.out.println("sign=====" + parameters); System.out.println("sign=====" + parameters);
// 设置签名 // 设置签名
String sign = WxUtil.createSignMD5(parameters); String sign = WxUtil.createSignMD5(parameters);
...@@ -267,8 +269,8 @@ public class WxServiceImpl implements WxService { ...@@ -267,8 +269,8 @@ public class WxServiceImpl implements WxService {
// 封装请求参数结束 // 封装请求参数结束
String requestXML = WxUtil.getRequestXml(parameters); String requestXML = WxUtil.getRequestXml(parameters);
System.out.println(requestXML); System.out.println(requestXML);
// 调用统一下单接口 // 调用申请退款接口
String result = WxUtil.httpsRequest(WxConfigUtil.REFUND_ORDER_URL, "POST", requestXML); String result = WxUtil.doRefund(WxConfigUtil.REFUND_ORDER_URL, requestXML);
System.out.println(result); System.out.println(result);
Map<String, String> map = XMLUtil.doXMLParse(result); Map<String, String> map = XMLUtil.doXMLParse(result);
if (!"SUCCESS".equals(map.get("result_code"))){ if (!"SUCCESS".equals(map.get("result_code"))){
......
...@@ -20,6 +20,21 @@ import java.security.NoSuchAlgorithmException; ...@@ -20,6 +20,21 @@ import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom; import java.security.SecureRandom;
import java.util.*; import java.util.*;
import java.io.File;
import java.io.InputStream;
import java.security.KeyStore;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.conn.ssl.SSLContexts;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.springframework.core.io.ClassPathResource;
public class WxUtil { public class WxUtil {
private static final String SYMBOLS = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; private static final String SYMBOLS = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
...@@ -247,6 +262,51 @@ public class WxUtil { ...@@ -247,6 +262,51 @@ public class WxUtil {
return null; return null;
} }
public static String doRefund(String url, String data) throws Exception {
KeyStore keyStore = KeyStore.getInstance("PKCS12");
// 指定证书路径
String path = "apiclient_cert.p12";
ClassPathResource classPathResource = new ClassPathResource(path);
//读取本机存放的PKCS12证书文件
InputStream stream = classPathResource.getInputStream();
String mchId = WxConfigUtil.MCH_ID;
try {
//指定PKCS12的密码(商户ID)
keyStore.load(stream, mchId.toCharArray());
} finally {
stream.close();
}
SSLContext sslcontext = SSLContexts.custom().loadKeyMaterial(keyStore, mchId.toCharArray()).build();
//指定TLS版本
SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory( sslcontext,new String[] { "TLSv1.2"},null,SSLConnectionSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER);
//设置httpclient的SSLSocketFactory
CloseableHttpClient httpclient = HttpClients.custom().setSSLSocketFactory(sslsf).build();
try {
HttpPost httpost = new HttpPost(url); // 设置响应头信息
httpost.addHeader("Connection", "keep-alive");
httpost.addHeader("Accept", "*/*");
httpost.addHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
httpost.addHeader("Host", "api.mch.weixin.qq.com");
httpost.addHeader("X-Requested-With", "XMLHttpRequest");
httpost.addHeader("Cache-Control", "max-age=0");
httpost.addHeader("User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0) ");
httpost.setEntity(new StringEntity(data, "UTF-8"));
CloseableHttpResponse response = httpclient.execute(httpost);
try {
HttpEntity entity = response.getEntity();
String jsonStr = EntityUtils.toString(response.getEntity(), "UTF-8");
EntityUtils.consume(entity);
return jsonStr;
} finally {
response.close();
}
} finally {
httpclient.close();
}
}
public static JSONObject httpsRequest(String requestUrl, String requestMethod) { public static JSONObject httpsRequest(String requestUrl, String requestMethod) {
JSONObject jsonObject = null; JSONObject jsonObject = null;
......
#spring.datasource.url=jdbc:mysql://152.136.113.101:3306/farming?autoReconnect=true&useUnicode=true&allowMultiQueries=true&characterEncoding=utf-8&serverTimezone=GMT%2B8 #spring.datasource.url=jdbc:mysql://152.136.113.101:3306/farming?autoReconnect=true&useUnicode=true&allowMultiQueries=true&characterEncoding=utf-8&serverTimezone=GMT%2B8
#spring.datasource.username=root #spring.datasource.username=root
#spring.datasource.password=Root_123456 #spring.datasource.password=Root_123456
spring.datasource.url=jdbc:mysql://localhost:3306/farming?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai #spring.datasource.url=jdbc:mysql://localhost:3306/farming?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
spring.datasource.username=farming #spring.datasource.username=farming
spring.datasource.password=PKWB6psxa7FBApZB #spring.datasource.password=PKWB6psxa7FBApZB
#spring.datasource.url=jdbc:mysql://db1.prd.jianghuxx.com:3317/farming?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai spring.datasource.url=jdbc:mysql://db1.prd.jianghuxx.com:3317/farming?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
#spring.datasource.username=root spring.datasource.username=root
#spring.datasource.password=4f9fa23639242790 spring.datasource.password=4f9fa23639242790
#7LwimZ27FqEnzIPg #7LwimZ27FqEnzIPg
##47.101.199.10 ##47.101.199.10
spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
......
...@@ -26,6 +26,8 @@ ...@@ -26,6 +26,8 @@
<result column="istatus" property="istatus" jdbcType="INTEGER"/> <result column="istatus" property="istatus" jdbcType="INTEGER"/>
<result column="itype" property="itype" jdbcType="INTEGER"/> <result column="itype" property="itype" jdbcType="INTEGER"/>
<result column="srefundreason" property="srefundreason" jdbcType="VARCHAR"/> <result column="srefundreason" property="srefundreason" jdbcType="VARCHAR"/>
<result column="srefundpic" property="srefundpic" jdbcType="VARCHAR"/>
<result column="couriernumber" property="couriernumber" jdbcType="VARCHAR"/>
<result column="productid" property="productid" jdbcType="INTEGER"/> <result column="productid" property="productid" jdbcType="INTEGER"/>
<result column="ipaytype" property="ipaytype" jdbcType="INTEGER"/> <result column="ipaytype" property="ipaytype" jdbcType="INTEGER"/>
<result column="sremark" property="sremark" jdbcType="VARCHAR"/> <result column="sremark" property="sremark" jdbcType="VARCHAR"/>
...@@ -124,6 +126,9 @@ ...@@ -124,6 +126,9 @@
ordermain.dactscore, ordermain.dactscore,
ordermain.ipaystatus, ordermain.ipaystatus,
ordermain.irefundstatus, ordermain.irefundstatus,
ordermain.srefundreason,
ordermain.srefundpic,
ordermain.couriernumber,
ordermain.tpaytime, ordermain.tpaytime,
ordermain.trefundtime, ordermain.trefundtime,
ordermain.istatus, ordermain.istatus,
...@@ -182,22 +187,85 @@ ...@@ -182,22 +187,85 @@
ORDER BY tordertime DESC ORDER BY tordertime DESC
</select> </select>
<!-- 带参数分页查询 S --> <resultMap id="ResultMap" type="com.yunniu.farming.webadmin.model.OrderMain">
<select id="selectByParamPageList" resultMap="BaseResultMap" <id column="id" property="id" jdbcType="INTEGER"/>
parameterType="com.yunniu.farming.webadmin.model.OrderMain"> <result column="customerid" property="customerid" jdbcType="INTEGER"/>
SELECT <result column="addressid" property="addressid" jdbcType="INTEGER"/>
<include refid="Full_Column_List"/> <result column="sorderno" property="sorderno" jdbcType="VARCHAR"/>
<!-- 关联子表信息 --> <result column="scusaddr" property="scusaddr" jdbcType="VARCHAR"/>
, <result column="scuname" property="scuname" jdbcType="VARCHAR"/>
sub.id AS zid, <result column="scuphone" property="scuphone" jdbcType="VARCHAR"/>
<result column="sprovince" property="sprovince" jdbcType="VARCHAR"/>
<result column="scity" property="scity" jdbcType="VARCHAR"/>
<result column="sregion" property="sregion" jdbcType="VARCHAR"/>
<result column="sorderdate" property="sorderdate" jdbcType="CHAR"/>
<result column="tordertime" property="tordertime" jdbcType="TIMESTAMP"/>
<result column="tovertime" property="tovertime" jdbcType="TIMESTAMP"/>
<result column="dplanmoney" property="dplanmoney" jdbcType="DECIMAL"/>
<result column="dactmoney" property="dactmoney" jdbcType="DECIMAL"/>
<result column="dactscore" property="dactscore" jdbcType="DECIMAL"/>
<result column="ipaystatus" property="ipaystatus" jdbcType="INTEGER"/>
<result column="group_order_id" property="groupOrderId" jdbcType="INTEGER"/>
<result column="irefundstatus" property="irefundstatus" jdbcType="INTEGER"/>
<result column="tpaytime" property="tpaytime" jdbcType="TIMESTAMP"/>
<result column="trefundtime" property="trefundtime" jdbcType="TIMESTAMP"/>
<result column="istatus" property="istatus" jdbcType="INTEGER"/>
<result column="itype" property="itype" jdbcType="INTEGER"/>
<result column="srefundreason" property="srefundreason" jdbcType="VARCHAR"/>
<result column="srefundpic" property="srefundpic" jdbcType="VARCHAR"/>
<result column="couriernumber" property="couriernumber" jdbcType="VARCHAR"/>
<result column="productid" property="productid" jdbcType="INTEGER"/>
<result column="ipaytype" property="ipaytype" jdbcType="INTEGER"/>
<result column="sremark" property="sremark" jdbcType="VARCHAR"/>
<result column="sdef1" property="sdef1" jdbcType="VARCHAR"/>
<result column="sdef2" property="sdef2" jdbcType="VARCHAR"/>
<result column="sdef3" property="sdef3" jdbcType="VARCHAR"/>
<result column="sdef4" property="sdef4" jdbcType="VARCHAR"/>
<result column="sdef5" property="sdef5" jdbcType="VARCHAR"/>
<result column="idef6" property="idef6" jdbcType="INTEGER"/>
<result column="idef7" property="idef7" jdbcType="INTEGER"/>
<result column="ddef8" property="ddef8" jdbcType="DECIMAL"/>
<result column="ddef9" property="ddef9" jdbcType="DECIMAL"/>
<result column="ddef10" property="ddef10" jdbcType="TIMESTAMP"/>
<result column="groupBuyId" property="groupBuyId" jdbcType="BIGINT"/>
<result column="groupBuyName" property="groupBuyName" jdbcType="VARCHAR"/>
<association property="customer" column="customerid" select="selectCustomer"/>
<!-- FRICE TODO 一对多 关联查询 -->
<collection property="subs" ofType="com.yunniu.farming.webadmin.model.OrderSub" select="selectOrderSub" column="id"/>
</resultMap>
<resultMap id="subs" type="com.yunniu.farming.webadmin.model.OrderSub">
<result column="zid" property="id" jdbcType="INTEGER"/>
<result column="zmainid" property="mainid" jdbcType="INTEGER"/>
<result column="zproductid" property="productid" jdbcType="INTEGER"/>
<result column="zipronum" property="ipronum" jdbcType="INTEGER"/>
<result column="zdprosum" property="dprosum" jdbcType="DECIMAL"/>
<result column="zsgoodprice" property="sgoodprice" jdbcType="DECIMAL"/>
<!-- 以下为商品相关字段 -->
<result column="zsproductname" property="sproductname" jdbcType="VARCHAR"/>
<result column="zspshortpic" property="spshortpic" jdbcType="VARCHAR"/>
</resultMap>
<select id="selectOrderSub" resultMap="subs">
select sub.id AS zid,
sub.mainid AS zmainid,
sub.ipronum AS zipronum, sub.ipronum AS zipronum,
sub.dprosum AS zdprosum, sub.dprosum AS zdprosum,
sub.productid AS zproductid, sub.productid AS zproductid,
sub.sgoodprice AS zsgoodprice, sub.sgoodprice AS zsgoodprice,
sub.sproductname AS zsproductname, sub.sproductname AS zsproductname,
sub.spshortpic AS zspshortpic sub.spshortpic AS zspshortpic
from order_sub sub
where mainid = #{id}
</select>
<!-- 带参数分页查询 S -->
<select id="selectByParamPageList" resultMap="ResultMap"
parameterType="com.yunniu.farming.webadmin.model.OrderMain">
SELECT
<include refid="Full_Column_List"/>
<!-- 关联子表信息 -->
FROM order_main ordermain FROM order_main ordermain
LEFT JOIN order_sub sub ON ordermain.id = sub.mainid
<where> <where>
<if test="appflag == null or appflag == ''"> <if test="appflag == null or appflag == ''">
ordermain.itype = 10 ordermain.itype = 10
...@@ -336,4 +404,50 @@ ...@@ -336,4 +404,50 @@
and sdef3 is not null and sdef3 is not null
order by tordertime desc limit 1 order by tordertime desc limit 1
</select> </select>
<select id="selectByParamPageRefundGroupList" resultMap="ResultMap">
SELECT
<include refid="Full_Column_List"/>
<!-- 关联子表信息 -->
,gb.id as groupBuyId
,gb.group_buy_title as groupBuyName
FROM order_main ordermain
left join group_order go on ordermain.group_order_id = go.id
left join group_buy gb on go.group_buy_id = gb.id
<where>
ordermain.group_order_id IS NOT NULL
AND ordermain.irefundstatus IS NOT NULL
<if test="id != null">
AND ordermain.id = #{id,jdbcType=INTEGER}
</if>
<if test="customerid != null">
AND ordermain.customerid = #{customerid,jdbcType=INTEGER}
</if>
<if test="istatus != null">
AND ordermain.istatus = #{istatus,jdbcType=INTEGER}
</if>
<if test="irefundstatus != null">
AND ordermain.irefundstatus = #{irefundstatus,jdbcType=INTEGER}
</if>
<if test="itype != null">
AND ordermain.itype = #{itype,jdbcType=INTEGER}
</if>
<if test="ipaytype != null">
AND ordermain.ipaytype = #{ipaytype,jdbcType=INTEGER}
</if>
<if test="sorderno != null and sorderno != ''">
AND ordermain.sorderno = #{sorderno,jdbcType=VARCHAR}
</if>
<if test="beginDate != null">
AND ordermain.sorderdate <![CDATA[ >= ]]> #{beginDate,jdbcType=VARCHAR}
</if>
<if test="endDate != null">
AND ordermain.sorderdate <![CDATA[ <= ]]> #{endDate,jdbcType=VARCHAR}
</if>
</where>
<!-- 以时间倒序显示 -->
ORDER BY ordermain.tordertime DESC
</select>
</mapper> </mapper>
...@@ -422,7 +422,8 @@ ...@@ -422,7 +422,8 @@
groupBuy.areaIdList = areaIdList; groupBuy.areaIdList = areaIdList;
groupBuy.products = products; groupBuy.products = products;
groupBuy.goodsImgArr = goodsImgArr; groupBuy.goodsImgArr = goodsImgArr;
groupBuy.groupBuyPic = groupBuyPic; // groupBuy.groupBuyPic = groupBuyPic;
groupBuy.groupBuyPic = "https://ns-strategy.cdn.bcebos.com/ns-strategy/upload/fc_big_pic/part-00069-829.jpg";
groupBuy.startTime = startTime; groupBuy.startTime = startTime;
groupBuy.endTime = endTime; groupBuy.endTime = endTime;
$.ajax({ $.ajax({
......
...@@ -62,6 +62,13 @@ ...@@ -62,6 +62,13 @@
<span></span> <span></span>
{{# } }} {{# } }}
</script> </script>
<script type="text/html" id="istatus">
{{#if (d.istatus == 3) { }}
<span>已下架</span>
{{# }else if(d.istatus == 1){ }}
<span>在售</span>
{{# } }}
</script>
<!--<script type="text/javascript" th:src="@{/js/upload_img/js/updateimg.js}"></script>--> <!--<script type="text/javascript" th:src="@{/js/upload_img/js/updateimg.js}"></script>-->
...@@ -125,6 +132,7 @@ ...@@ -125,6 +132,7 @@
{field: 'catalogName', title: '分类'}, {field: 'catalogName', title: '分类'},
{field: 'doldprice', title: '原价'}, {field: 'doldprice', title: '原价'},
{field: 'dsaleprice', title: '售价'}, {field: 'dsaleprice', title: '售价'},
{field: 'istatus', title: '状态', toolbar: '#istatus'},
] ]
] ]
}); });
......
...@@ -82,7 +82,13 @@ ...@@ -82,7 +82,13 @@
<script type="text/html" id="table-handle"> <script type="text/html" id="table-handle">
<i class="layui-icon layui-icon-form" lay-event="orderDetail" title="订单详情"></i> <i class="layui-icon layui-icon-form" lay-event="orderDetail" title="订单详情"></i>
{{#if (d.istatus == 0 || d.istatus == 10) { }} <!-- 101退款申请中 102待退货 103待退款 104退款成功 105退款拒绝-->
{{#if (d.irefundstatus == 101) { }}
<i class="layui-icon layui-icon-ok" lay-event="pass" title="退款申请通过"></i>
<i class="layui-icon layui-icon-close" lay-event="refuse" title="退款申请拒绝"></i>
{{# }else if(d.irefundstatus == 102){ }}
<i class="layui-icon layui-icon-component" lay-event="receive" title="退款已收货"></i>
{{# }else if (d.istatus == 0 || d.istatus == 10) { }}
{{# }else if(d.istatus == 20){ }} {{# }else if(d.istatus == 20){ }}
<i class="layui-icon layui-icon-ok-circle" lay-event="deliver" title="发货"></i> <i class="layui-icon layui-icon-ok-circle" lay-event="deliver" title="发货"></i>
{{# }else if(d.istatus == 30){ }} {{# }else if(d.istatus == 30){ }}
...@@ -183,7 +189,7 @@ ...@@ -183,7 +189,7 @@
,{ ,{
title: "订单状态", title: "订单状态",
width: 100, width: 200,
templet: function(d) { templet: function(d) {
var str = ""; var str = "";
...@@ -193,7 +199,7 @@ ...@@ -193,7 +199,7 @@
if (d.ipaystatus == 1) itype = "<span class='layui-badge'>支付成功</span>"; if (d.ipaystatus == 1) itype = "<span class='layui-badge'>支付成功</span>";
if (d.ipaystatus == 2) itype = "<span class='layui-badge layui-bg-gray'>支付失败</span>"; if (d.ipaystatus == 2) itype = "<span class='layui-badge layui-bg-gray'>支付失败</span>";
str += ' <span>' + itype + '</span>'; str += ' <span>' + itype + '</span>';
//订单状态 //订单状态 10:待付款 20:待发货 30:待收货 90:已完成 99:已拒绝/关闭 100:取消
var status = ""; var status = "";
if (d.istatus == 10) status = "<span class='layui-badge layui-bg-orange'>待付款</span>"; if (d.istatus == 10) status = "<span class='layui-badge layui-bg-orange'>待付款</span>";
if (d.istatus == 20) status = "<span class='layui-badge layui-bg-orange'>待发货</span>"; if (d.istatus == 20) status = "<span class='layui-badge layui-bg-orange'>待发货</span>";
...@@ -201,15 +207,34 @@ ...@@ -201,15 +207,34 @@
if (d.istatus == 90) status = "<span class='layui-badge layui-bg-green'>已完成</span>"; if (d.istatus == 90) status = "<span class='layui-badge layui-bg-green'>已完成</span>";
if (d.istatus == 99) status = "<span class='layui-badge layui-bg-gray'>交易关闭</span>"; if (d.istatus == 99) status = "<span class='layui-badge layui-bg-gray'>交易关闭</span>";
if (d.istatus == 100) status = "<span class='layui-badge layui-bg-black'>已取消</span>"; if (d.istatus == 100) status = "<span class='layui-badge layui-bg-black'>已取消</span>";
str += ' <span>' + status + '</span>'; str += ' <span>' + status + '</span>';
// 101退款申请中 102待退货 103待退款 104退款成功
var refundStatus = "";
if (d.irefundstatus == 101) refundStatus = "<span class='layui-badge layui-bg-red'>退款申请中</span>";
if (d.irefundstatus == 102) refundStatus = "<span class='layui-badge layui-bg-orange'>待退货</span>";
if (d.irefundstatus == 103) refundStatus = "<span class='layui-badge layui-bg-orange'>待退款</span>";
if (d.irefundstatus == 104) refundStatus = "<span class='layui-badge layui-bg-green'>退款成功</span>";
if (d.irefundstatus == 105) refundStatus = "<span class='layui-badge layui-bg-cyan'>退款拒绝</span>";
str += ' <span>' + refundStatus + '</span>';
str += '</div>'; str += '</div>';
return str ? str : ""; return str ? str : "";
} }
} }
, {field: 'tordertime', width: 100, title: '下单日期'} , {field: 'tordertime', width: 100, title: '下单日期'}
, {field: 'sremark', width: 100,title: '备注'} , {field: 'sremark', width: 100,title: '备注'}
, {field: 'trefundtime', width: 100, title: '退款时间'}
,{
width: 100,
title: "退款图片",
align: "center",
templet: function(d) {
return d.srefundpic ? '<div><img id="zi' + d.id + '" src="' + d.srefundpic +
'" onmouseover="bigImg(this)" onmouseout="smallImg()" onclick="tolook(src)" style="height:20px;"></div>' :
'';
}
}
, {field: 'srefundreason', width: 100, title: '退款理由'}
, {field: 'couriernumber', width: 120, title: '退款快递单号'}
, {field: 'scusaddr', width: 100, title: '地址'} , {field: 'scusaddr', width: 100, title: '地址'}
, {field: 'scuname', width: 100, title: '联系姓名'} , {field: 'scuname', width: 100, title: '联系姓名'}
, {field: 'scuphone', width: 100, title: '联系电话'} , {field: 'scuphone', width: 100, title: '联系电话'}
...@@ -461,6 +486,77 @@ ...@@ -461,6 +486,77 @@
iframeBtn.click();//模拟iframe页面层的提交按钮点击 iframeBtn.click();//模拟iframe页面层的提交按钮点击
} }
}); });
} else if (obj.event === 'pass') {
var id = obj.data.id;
layer.confirm('确定审核通过吗?', function (index) {
var param = {};
param.id = id;
$.ajax({
url: "refundApplicationPass",
data: JSON.stringify(param),
type: "POST",
dataType: "json",
contentType: "application/json;charset=utf-8",
success: function (result) {
if (result.code == 100) {
layer.msg(result.msg, {icon: 6, time: 1000}, function () {
layer.close(index);
table.reload('tableId');
});
} else {
layer.msg(result.msg, {icon: 5});
}
}
});
});
} else if (obj.event === 'refuse') {
var id = obj.data.id;
layer.confirm( '确定审核拒绝吗?', function (index) {
var param = {};
param.id = id;
$.ajax({
url: "refundApplicationRefuse",
data: JSON.stringify(param),
type: "POST",
dataType: "json",
contentType: "application/json;charset=utf-8",
success: function (result) {
if (result.code == 100) {
layer.msg(result.msg, {icon: 6, time: 1000}, function () {
layer.close(index);
table.reload('tableId');
});
} else {
layer.msg(result.msg, {icon: 5});
}
}
});
});
} else if (obj.event === 'receive') {
var id = obj.data.id;
layer.confirm( '确定已收到退回的货物吗? 确定后将进行退款!', function (index) {
var param = {};
param.id = id;
$.ajax({
url: "receive",
data: JSON.stringify(param),
type: "POST",
dataType: "json",
contentType: "application/json;charset=utf-8",
success: function (result) {
if (result.code == 100) {
layer.msg(result.msg, {icon: 6, time: 1000}, function () {
layer.close(index);
table.reload('tableId');
});
} else {
layer.msg(result.msg, {icon: 5});
}
}
});
});
} }
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment