Commit 6c3a78ce authored by 周健威's avatar 周健威

Merge remote-tracking branch 'origin/base-modify' into base-modify

parents c68a000e 73275032
package com.xxfc.platform.app.biz;
import com.alibaba.fastjson.JSON;
import com.github.wxiaoqi.security.common.msg.TableResultResponse;
import com.github.wxiaoqi.security.common.util.EntityUtils;
import com.github.wxiaoqi.security.common.util.Query;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.app.entity.vo.WithDrawRuleVo;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.stereotype.Service;
......@@ -12,6 +15,7 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
import tk.mybatis.mapper.entity.Example;
import java.util.List;
import java.util.Map;
/**
* 系统配置表
......@@ -35,7 +39,7 @@ public class CofigBiz extends BaseBiz<CofigMapper,Cofig> {
*/
public int updateConfig(Cofig cofig) {
EntityUtils.setUpdatedInfo(cofig);
return mapper.updateConfig(cofig);
return mapper.updateByPrimaryKeySelective(cofig);
}
public WithDrawRuleVo getWithDrawRule(){
......@@ -52,4 +56,22 @@ public class CofigBiz extends BaseBiz<CofigMapper,Cofig> {
withDrawRuleVo.setDescription(cofig.getValue());
return withDrawRuleVo;
}
public void updateConfigStatus(int id) {
Cofig cofig = new Cofig();
cofig.setId(id);
cofig.setIsDel(1);
mapper.updateByPrimaryKeySelective(cofig);
}
public TableResultResponse<Cofig> listWithPage(Map<String, Object> params) {
Query query = new Query(params);
Example example = new Example(Cofig.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("isDel",0);
PageDataVO<Cofig> cofigPage = PageDataVO.pageInfo(query.getPage(), query.getLimit(), () -> mapper.selectByExample(example));
return new TableResultResponse<>(cofigPage.getTotalCount(),cofigPage.getData()) ;
}
}
\ No newline at end of file
package com.xxfc.platform.app.rest.admin;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.msg.TableResultResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.xxfc.platform.app.biz.CofigBiz;
import com.xxfc.platform.app.entity.Cofig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
* @author libin
* @version 1.0
......@@ -20,6 +23,11 @@ import org.springframework.web.bind.annotation.RestController;
public class CofigAdminController extends BaseController<CofigBiz,Cofig> {
@Override
public TableResultResponse<Cofig> list(@RequestParam Map<String, Object> params) {
return getBaseBiz().listWithPage(params);
}
/**
* 修改通用配置
* @param cofig
......@@ -33,4 +41,11 @@ public class CofigAdminController extends BaseController<CofigBiz,Cofig> {
}
return ObjectRestResponse.createDefaultFail();
}
@Override
public ObjectRestResponse<Cofig> remove(@PathVariable int id) {
getBaseBiz().updateConfigStatus(id);
return ObjectRestResponse.succ();
}
}
\ No newline at end of file
......@@ -137,9 +137,29 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper,OrderPay> {
orderPay.setStatus(1);
orderPay.setSerialNumber(serialNumber);
int num=mapper.updateByExampleSelective(orderPay,example);
log.error("---支付回调处理---num====="+num+"----orderNo======="+orderNo);
if(num>0){
//支付成功,添加积分
OrderPay pay= list.get(0);
OrderPay newValue = mapper.selectOne(orderPay);
log.info("支付回调信息:newValue = {}", newValue);
if(newValue.getStatus() == 1) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("userId", newValue.getUserId());
jsonObject.put("amount", newValue.getAmount());
jsonObject.put("channelId", newValue.getOrderNo());
if(newValue.getChannel() == 1) {//租车
jsonObject.put("integralRuleCode", "RENTRV");
} else if(newValue.getChannel() == 2) { //旅游
jsonObject.put("integralRuleCode", "BUYROUT");
} else if(newValue.getChannel() == 3) { //会员
jsonObject.put("integralRuleCode", "BUYMEMBER");
}
log.info("支付订单号:orderNo = {}, orderType = {}", newValue.getOrderNo(), newValue.getChannel());
log.info("支付成功获取积分:发送消息 exchange = {}, routingKey = {}, json = {}", MQconstant.INTEGRAL_EXCHANGE, MQconstant.INTEGRAL_ROUTING_KEY, jsonObject.toJSONString());
mqServiceBiZ.sendMessage(MQconstant.INTEGRAL_EXCHANGE, MQconstant.INTEGRAL_ROUTING_KEY, jsonObject.toJSONString());
}
if(StringUtils.isNotBlank(pay.getNotifyUrl())){
String url=pay.getNotifyUrl();
Integer type=pay.getType()==null?1:pay.getType();
......@@ -152,23 +172,7 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper,OrderPay> {
result= HTTPUtils.doGet(url);
}
log.error("---支付回调处理---orderNo======="+orderNo+"---result==="+result);
//支付成功,添加积分
if(pay.getStatus() == 1) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("userId", pay.getUserId());
jsonObject.put("amount", pay.getAmount());
jsonObject.put("channelId", pay.getOrderNo());
if(pay.getChannel() == 1) {//租车
jsonObject.put("integralRuleCode", "RENTRV");
} else if(pay.getChannel() == 2) { //旅游
jsonObject.put("integralRuleCode", "BUYROUT");
} else if(pay.getChannel() == 3) { //会员
jsonObject.put("integralRuleCode", "BUYMEMBER");
}
log.info("支付订单号:orderNo = {}, orderType = {}", pay.getOrderNo(), pay.getChannel());
log.info("支付成功获取积分:发送消息 exchange = {}, routingKey = {}, json = {}", MQconstant.INTEGRAL_EXCHANGE, MQconstant.INTEGRAL_ROUTING_KEY, jsonObject.toJSONString());
mqServiceBiZ.sendMessage(MQconstant.INTEGRAL_EXCHANGE, MQconstant.INTEGRAL_ROUTING_KEY, jsonObject.toJSONString());
}
}
}
}
......
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