|
@@ -1,6 +1,8 @@
|
|
|
package com.jpsoft.bus.modules.base.controller;
|
|
|
|
|
|
import com.github.pagehelper.Page;
|
|
|
+import com.jpsoft.bus.modules.bus.entity.CompanyInfo;
|
|
|
+import com.jpsoft.bus.modules.bus.service.CompanyInfoService;
|
|
|
import com.jpsoft.bus.modules.common.dto.MessageResult;
|
|
|
import com.jpsoft.bus.modules.common.dto.Sort;
|
|
|
import com.jpsoft.bus.modules.base.entity.PaymentInfo;
|
|
@@ -27,6 +29,9 @@ public class PaymentInfoController {
|
|
|
@Autowired
|
|
|
private PaymentInfoService paymentInfoService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private CompanyInfoService companyInfoService;
|
|
|
+
|
|
|
@ApiOperation(value="创建空记录")
|
|
|
@GetMapping("create")
|
|
|
public MessageResult<PaymentInfo> create(){
|
|
@@ -196,7 +201,7 @@ public class PaymentInfoController {
|
|
|
@ApiOperation(value="列表")
|
|
|
@RequestMapping(value = "pageList",method = RequestMethod.POST)
|
|
|
public MessageResult<Map> pageList(
|
|
|
- String id,
|
|
|
+ String companyId,String name,
|
|
|
@RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
|
|
|
@RequestParam(value="pageSize",defaultValue="20") int pageSize,
|
|
|
@RequestAttribute String subject){
|
|
@@ -209,17 +214,67 @@ public class PaymentInfoController {
|
|
|
Map<String,Object> searchParams = new HashMap<>();
|
|
|
|
|
|
List<Sort> sortList = new ArrayList<>();
|
|
|
- sortList.add(new Sort("id_","asc"));
|
|
|
+ sortList.add(new Sort("create_time","desc"));
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(companyId)) {
|
|
|
+ searchParams.put("companyId",companyId);
|
|
|
+ }
|
|
|
|
|
|
- if (StringUtils.isNotEmpty(id)) {
|
|
|
- searchParams.put("id","%" + id + "%");
|
|
|
+ if (StringUtils.isNotEmpty(name)) {
|
|
|
+ searchParams.put("name","%"+name+"%");
|
|
|
}
|
|
|
|
|
|
Page<PaymentInfo> page = paymentInfoService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
|
|
|
|
|
|
+ for (PaymentInfo paymentInfo:page) {
|
|
|
+ CompanyInfo companyInfo = companyInfoService.get(paymentInfo.getCompanyId());
|
|
|
+ if(companyInfo!=null){
|
|
|
+ paymentInfo.setCompanyName(companyInfo.getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
msgResult.setResult(true);
|
|
|
msgResult.setData(PojoUtils.pageWrapper(page));
|
|
|
|
|
|
return msgResult;
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation(value="修改是否支持微信支付宝支付")
|
|
|
+ @PostMapping("updateWechatPayOrAliPay")
|
|
|
+ public MessageResult<Integer> updateWechatPayOrAliPay(String id,Boolean wechatPay,Boolean aliPay, @RequestAttribute String subject) {
|
|
|
+ MessageResult<Integer> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ PaymentInfo paymentInfo = paymentInfoService.get(id);
|
|
|
+
|
|
|
+ if(paymentInfo!=null){
|
|
|
+ if(wechatPay!=null) {
|
|
|
+ paymentInfo.setIsOpenWechat(wechatPay);
|
|
|
+ }
|
|
|
+ if(aliPay!=null) {
|
|
|
+ paymentInfo.setIsOpenAlipay(aliPay);
|
|
|
+ }
|
|
|
+
|
|
|
+ paymentInfo.setUpdateBy(subject);
|
|
|
+ paymentInfo.setUpdateTime(new Date());
|
|
|
+
|
|
|
+ int count = paymentInfoService.update(paymentInfo);
|
|
|
+
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(count);
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage("更新失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch(Exception ex){
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
+
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
}
|