| @@ -88,6 +88,19 @@ public class WxMerchantSubsidyController extends BaseController { | |||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @ApiOperation("交易列表") | |||||
| @GetMapping("summary") | |||||
| @SystemControllerLog(description = "结算-总计") | |||||
| public ResultData summary(@ModelAttribute WxMerchantSubsidyVo wxMerchantSubsidy) { | |||||
| logger.debug("[" + getIpAddr() + "] subsidy::summary"); | |||||
| if (null == wxMerchantSubsidy) { | |||||
| wxMerchantSubsidy = new WxMerchantSubsidyVo(); | |||||
| } | |||||
| wxMerchantSubsidy.setTenantId(getTenantId()); | |||||
| Map<String, Long> data = wxMerchantSubsidyService.summary(wxMerchantSubsidy); | |||||
| return new ResultData(data); | |||||
| } | |||||
| @ApiOperation("更新补贴记录") | @ApiOperation("更新补贴记录") | ||||
| @PostMapping("updateSubsidied") | @PostMapping("updateSubsidied") | ||||
| @SystemControllerLog(description = "商户-更新补贴记录") | @SystemControllerLog(description = "商户-更新补贴记录") | ||||
| @@ -100,7 +100,7 @@ public class WxMerchantSubsidy extends BaseEntity { | |||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| protected String statusStr; | protected String statusStr; | ||||
| @Excel(name = "冻结状态", width = 20, orderNum = "8", replace = {"冻结中_1", "正常_0"}) | |||||
| @Excel(name = "冻结状态", width = 20, orderNum = "8", replace = {"冻结中_1", "正常_0", " _-1"}) | |||||
| @io.swagger.annotations.ApiModelProperty(value = "是否冻结", name = "freeze") | @io.swagger.annotations.ApiModelProperty(value = "是否冻结", name = "freeze") | ||||
| private Integer freeze; | private Integer freeze; | ||||
| @@ -126,11 +126,11 @@ public class WxMerchantSubsidy extends BaseEntity { | |||||
| return subsidyStr; | return subsidyStr; | ||||
| } | } | ||||
| @Excel(name = "结算类型", width = 20, orderNum = "4", replace = {"自主结算_1", "微信结算_2"}) | |||||
| @Excel(name = "结算类型", width = 20, orderNum = "4", replace = {"自主结算_1", "微信结算_2", " _-1"}) | |||||
| @io.swagger.annotations.ApiModelProperty(value = "结算类型1自主结算2微信结算", name = "type") | @io.swagger.annotations.ApiModelProperty(value = "结算类型1自主结算2微信结算", name = "type") | ||||
| private Integer type; | private Integer type; | ||||
| @Excel(name = "结算来源", width = 20, orderNum = "3", replace = {"补贴_0", "卡消费_1", "券核销_2", "砍价核销_3", "拼团核销_4", , "收银分账_5"}) | |||||
| @Excel(name = "结算来源", width = 20, orderNum = "3", replace = {"补贴_0", "卡消费_1", "券核销_2", "砍价核销_3", "拼团核销_4", "收银分账_5", " _-1"}) | |||||
| @io.swagger.annotations.ApiModelProperty(value = "结算来源0补贴1卡消费2券核销3砍价核销4拼团核销5收银分账", name = "source") | @io.swagger.annotations.ApiModelProperty(value = "结算来源0补贴1卡消费2券核销3砍价核销4拼团核销5收银分账", name = "source") | ||||
| private Integer source; | private Integer source; | ||||
| } | } | ||||
| @@ -61,6 +61,8 @@ public interface WxMerchantSubsidyService { | |||||
| /** | /** | ||||
| * 补贴流水导出 | * 补贴流水导出 | ||||
| */ | */ | ||||
| void exportData(WxMerchantSubsidy wxMerchantSubsidy, HttpServletRequest request, HttpServletResponse response); | |||||
| void exportData(WxMerchantSubsidyVo wxMerchantSubsidy, HttpServletRequest request, HttpServletResponse response); | |||||
| Map<String, Long> summary(WxMerchantSubsidyVo wxMerchantSubsidy); | |||||
| } | } | ||||
| @@ -17,8 +17,11 @@ import org.springframework.stereotype.Service; | |||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
| import java.math.BigDecimal; | |||||
| import java.util.HashMap; | |||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Map; | import java.util.Map; | ||||
| import java.util.stream.Collectors; | |||||
| @Service | @Service | ||||
| @@ -75,10 +78,27 @@ public class WxMerchantSubsidyServiceImpl implements WxMerchantSubsidyService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public void exportData(WxMerchantSubsidy wxMerchantSubsidy, HttpServletRequest request, HttpServletResponse response) { | |||||
| public void exportData(WxMerchantSubsidyVo wxMerchantSubsidy, HttpServletRequest request, HttpServletResponse response) { | |||||
| List<WxMerchantSubsidyVo> list = wxMerchantSubsidyMapper.findVoList(wxMerchantSubsidy); | List<WxMerchantSubsidyVo> list = wxMerchantSubsidyMapper.findVoList(wxMerchantSubsidy); | ||||
| Map<String, Long> summary = summary(wxMerchantSubsidy); | |||||
| Long subsidy = summary.get("subsidy"); | |||||
| String subsidyStr = new BigDecimal(subsidy).divide(new BigDecimal(100)).toPlainString(); | |||||
| WxMerchantSubsidyVo merchantSubsidy = new WxMerchantSubsidyVo(); | |||||
| merchantSubsidy.setSubsidyStr(subsidyStr); | |||||
| merchantSubsidy.setSource(-1); | |||||
| merchantSubsidy.setType(-1); | |||||
| merchantSubsidy.setFreeze(-1); | |||||
| list.add(merchantSubsidy); | |||||
| excelService.exportExcel(list, null, "结算记录", WxMerchantSubsidyVo.class, "结算记录.xlsx", response, false); | excelService.exportExcel(list, null, "结算记录", WxMerchantSubsidyVo.class, "结算记录.xlsx", response, false); | ||||
| } | } | ||||
| @Override | |||||
| public Map<String, Long> summary(WxMerchantSubsidyVo wxMerchantSubsidy) { | |||||
| Long subsidy = wxMerchantSubsidyMapper.findVoList(wxMerchantSubsidy).stream().collect(Collectors.summingLong(WxMerchantSubsidy::getSubsidy)); | |||||
| Map<String, Long> data = new HashMap<>(); | |||||
| data.put("subsidy", subsidy); | |||||
| return data; | |||||
| } | |||||
| } | } | ||||