* master: 修改配置星巴克 肯德基 会员充值 话费 微信商户号 修改配置星巴克 肯德基 会员充值 话费 微信商户号 # Conflicts: # hai-cweb/src/main/java/com/cweb/controller/pay/CzOrderController.java # hai-cweb/src/main/java/com/cweb/controller/pay/ThirdOrderController.javadev-discount
parent
681dbf91b4
commit
4f93b703d6
@ -0,0 +1,211 @@ |
||||
package com.web.controller.business; |
||||
|
||||
import com.alibaba.excel.EasyExcel; |
||||
import com.github.pagehelper.PageHelper; |
||||
import com.github.pagehelper.PageInfo; |
||||
import com.hai.common.exception.ErrorCode; |
||||
import com.hai.common.exception.ErrorHelp; |
||||
import com.hai.common.exception.SysCode; |
||||
import com.hai.common.security.UserCenter; |
||||
import com.hai.common.utils.ResponseMsgUtil; |
||||
import com.hai.entity.HighOrder; |
||||
import com.hai.enum_type.OrderStatusEnum; |
||||
import com.hai.enum_type.UserObjectTypeEnum; |
||||
import com.hai.model.ResponseData; |
||||
import com.hai.model.UserInfoModel; |
||||
import com.hai.order.model.OrderThirdPartyModel; |
||||
import com.hai.order.service.OrderService; |
||||
import com.hai.order.type.OrderPayType; |
||||
import com.hai.service.OutRechargeOrderService; |
||||
import com.hai.service.impl.OutRechargeOrderServiceImpl; |
||||
import com.web.config.SysConst; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
import org.springframework.stereotype.Controller; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RequestMethod; |
||||
import org.springframework.web.bind.annotation.RequestParam; |
||||
import org.springframework.web.bind.annotation.ResponseBody; |
||||
|
||||
import javax.annotation.Resource; |
||||
import javax.servlet.http.HttpServletRequest; |
||||
import java.io.File; |
||||
import java.util.ArrayList; |
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
@Controller |
||||
@RequestMapping(value = "mobileRecharge") |
||||
@Api(value = "话费充值业务") |
||||
public class OrderMobileRechargeController { |
||||
|
||||
private static Logger log = LoggerFactory.getLogger(OrderMobileRechargeController.class); |
||||
|
||||
@Resource |
||||
private UserCenter userCenter; |
||||
|
||||
@Resource |
||||
private OutRechargeOrderService outRechargeOrderService; |
||||
|
||||
|
||||
@Resource |
||||
private OrderService orderService; |
||||
|
||||
|
||||
@RequestMapping(value = "/getOrderList", method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询话费订单列表") |
||||
public ResponseData getOrderList(@RequestParam(name = "orderNo", required = false) String orderNo, |
||||
@RequestParam(name = "memPhone", required = false) String memPhone, |
||||
@RequestParam(name = "memCardNo", required = false) String memCardNo, |
||||
@RequestParam(name = "payType", required = false) Integer payType, |
||||
@RequestParam(name = "status", required = false) Integer status, |
||||
@RequestParam(name = "companyId", required = false) Long companyId, |
||||
@RequestParam(name = "createTimeS", required = false) Long createTimeS, |
||||
@RequestParam(name = "createTimeE", required = false) Long createTimeE, |
||||
@RequestParam(name = "payTimeS", required = false) Long payTimeS, |
||||
@RequestParam(name = "payTimeE", required = false) Long payTimeE, |
||||
@RequestParam(name = "finishTimeS", required = false) Long finishTimeS, |
||||
@RequestParam(name = "finishTimeE", required = false) Long finishTimeE, |
||||
@RequestParam(name = "pageNum", required = true) Integer pageNum, |
||||
@RequestParam(name = "pageSize", required = true) Integer pageSize, |
||||
HttpServletRequest request) { |
||||
try { |
||||
|
||||
UserInfoModel userInfoModel = userCenter.getSessionModel(UserInfoModel.class); |
||||
if (userInfoModel == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); |
||||
} |
||||
Map<String,Object> map = new HashMap<>(); |
||||
if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type0.getType())) { |
||||
map.put("companyId" , companyId); |
||||
} else if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type1.getType())) { |
||||
map.put("companyId", userInfoModel.getBsCompany().getId()); |
||||
} else { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); |
||||
} |
||||
map.put("createTimeS", createTimeS); |
||||
map.put("createTimeE", createTimeE); |
||||
map.put("payTimeS", payTimeS); |
||||
map.put("payTimeE", payTimeE); |
||||
map.put("finishTimeS", finishTimeS); |
||||
map.put("finishTimeE", finishTimeE); |
||||
map.put("orderNo", orderNo); |
||||
map.put("memPhone", memPhone); |
||||
map.put("memCardNo", memCardNo); |
||||
map.put("productType", 9); |
||||
map.put("status", status); |
||||
map.put("payType", payType); |
||||
|
||||
PageHelper.startPage(pageNum,pageSize); |
||||
return ResponseMsgUtil.success(new PageInfo<>(orderService.getOrderList(map))); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("OrderCouponController --> getOrderList() error!", e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value = "/exportMobilePartyOrderList", method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "导出话费订单列表") |
||||
public ResponseData exportMobilePartyOrderList(@RequestParam(name = "orderNo", required = false) String orderNo, |
||||
@RequestParam(name = "memPhone", required = false) String memPhone, |
||||
@RequestParam(name = "memCardNo", required = false) String memCardNo, |
||||
@RequestParam(name = "payType", required = false) Integer payType, |
||||
@RequestParam(name = "status", required = false) Integer status, |
||||
@RequestParam(name = "companyId", required = false) Long companyId, |
||||
@RequestParam(name = "createTimeS", required = false) Long createTimeS, |
||||
@RequestParam(name = "createTimeE", required = false) Long createTimeE, |
||||
@RequestParam(name = "payTimeS", required = false) Long payTimeS, |
||||
@RequestParam(name = "payTimeE", required = false) Long payTimeE, |
||||
@RequestParam(name = "productType", required = false) Integer productType, |
||||
@RequestParam(name = "finishTimeS", required = false) Long finishTimeS, |
||||
@RequestParam(name = "finishTimeE", required = false) Long finishTimeE) { |
||||
try { |
||||
|
||||
UserInfoModel userInfoModel = userCenter.getSessionModel(UserInfoModel.class); |
||||
if (userInfoModel == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); |
||||
} |
||||
Map<String,Object> map = new HashMap<>(); |
||||
if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type0.getType())) { |
||||
map.put("companyId" , companyId); |
||||
} else if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type1.getType())) { |
||||
map.put("companyId", userInfoModel.getBsCompany().getId()); |
||||
} else { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); |
||||
} |
||||
map.put("createTimeS", createTimeS); |
||||
map.put("createTimeE", createTimeE); |
||||
map.put("payTimeS", payTimeS); |
||||
map.put("payTimeE", payTimeE); |
||||
map.put("finishTimeS", finishTimeS); |
||||
map.put("finishTimeE", finishTimeE); |
||||
map.put("orderNo", orderNo); |
||||
map.put("memPhone", memPhone); |
||||
map.put("memCardNo", memCardNo); |
||||
map.put("productType", productType); |
||||
map.put("status", status); |
||||
map.put("payType", payType); |
||||
|
||||
// 查询数据
|
||||
List<HighOrder> orderList = orderService.getOrderList(map); |
||||
|
||||
List<OrderThirdPartyModel> dataList = new ArrayList<>(); |
||||
OrderThirdPartyModel model; |
||||
|
||||
for (HighOrder thirdPartyModel : orderList) { |
||||
model = new OrderThirdPartyModel(); |
||||
model.setOrderNo(thirdPartyModel.getOrderNo()); |
||||
model.setMemPhone(thirdPartyModel.getMemPhone()); |
||||
model.setTitle(thirdPartyModel.getTitle()); |
||||
model.setTotalPrice(thirdPartyModel.getTotalPrice()); |
||||
model.setTotalDeductionPrice(thirdPartyModel.getTotalDeductionPrice()); |
||||
model.setDeductionProductPrice(thirdPartyModel.getDeductionProductPrice()); |
||||
model.setPayablePrice(thirdPartyModel.getPayablePrice()); |
||||
model.setPayPrice(thirdPartyModel.getPayPrice()); |
||||
model.setPayType(OrderPayType.getDataByType(thirdPartyModel.getPayType()).getName()); |
||||
model.setOrderStatus(OrderStatusEnum.getNameByType(thirdPartyModel.getOrderStatus())); |
||||
model.setCreateTime(thirdPartyModel.getCreateTime()); |
||||
model.setPayTime(thirdPartyModel.getPayTime()); |
||||
dataList.add(model); |
||||
} |
||||
|
||||
String fileUrl = SysConst.getSysConfig().getFileUrl() + "temporary/"; |
||||
String pathName = System.currentTimeMillis()+".xlsx"; |
||||
File file = new File(fileUrl); |
||||
if (!file.exists()) { |
||||
file.mkdirs(); |
||||
} |
||||
|
||||
EasyExcel.write(fileUrl+pathName) |
||||
.head(OrderThirdPartyModel.class) |
||||
.sheet("交易订单") |
||||
.doWrite(dataList); |
||||
return ResponseMsgUtil.success(pathName); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("OrderCouponController --> getOrderList() error!", e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value="/getMobileOrderDetail",method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询话费订单详情") |
||||
public ResponseData getMobileOrderDetail(@RequestParam(name = "orderNo", required = true) String orderNo) { |
||||
try { |
||||
|
||||
return ResponseMsgUtil.success(outRechargeOrderService.findByOrderNo(orderNo)); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("OrderExtController -> getGasOrderDetail() error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue