报表功能查看
This commit is contained in:
parent
324c53294f
commit
dfdd2e2a69
|
|
@ -19,6 +19,7 @@ public class OrgConsume {
|
||||||
private String endPayTime;//结束支付时间
|
private String endPayTime;//结束支付时间
|
||||||
private String custName;
|
private String custName;
|
||||||
private String custNameLike;
|
private String custNameLike;
|
||||||
|
private String remark;
|
||||||
|
|
||||||
private String flowId;
|
private String flowId;
|
||||||
private Integer flowType;
|
private Integer flowType;
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,11 @@ import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.net.URLDecoder;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping({"/api/v2/report"})
|
@RequestMapping({"/api/v2/report"})
|
||||||
public class reportformsController extends BaseController {
|
public class reportformsController extends BaseController {
|
||||||
|
|
@ -36,7 +40,17 @@ public class reportformsController extends BaseController {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/consume/exportExcel")
|
@PostMapping("/consume/exportExcel")
|
||||||
public void exportExcel(HttpServletResponse response, CanteenRecord orgConsume) {
|
public void exportExcel(HttpServletResponse response, CanteenRecord orgConsume) throws UnsupportedEncodingException {
|
||||||
|
if (orgConsume.getCustName() != null && !orgConsume.getCustName().trim().isEmpty()) {
|
||||||
|
try {
|
||||||
|
String decodedName = URLDecoder.decode(orgConsume.getCustName(), StandardCharsets.UTF_8.name());
|
||||||
|
orgConsume.setCustName(decodedName);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 出错时打印日志,但不要影响后续逻辑
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 1. 查询数据
|
// 1. 查询数据
|
||||||
List<CanteenRecord> peoplelist = service.getPeoplelist(orgConsume);
|
List<CanteenRecord> peoplelist = service.getPeoplelist(orgConsume);
|
||||||
// 2. 给 flowTypeText 赋值
|
// 2. 给 flowTypeText 赋值
|
||||||
|
|
@ -45,8 +59,10 @@ public class reportformsController extends BaseController {
|
||||||
record.setAmount(record.getAmount()/100);
|
record.setAmount(record.getAmount()/100);
|
||||||
if ("110".equals(record.getFlowType())) {
|
if ("110".equals(record.getFlowType())) {
|
||||||
record.setFlowTypeText("消费");
|
record.setFlowTypeText("消费");
|
||||||
|
record.setAmount(-record.getAmount());
|
||||||
} else if ("120".equals(record.getFlowType())) {
|
} else if ("120".equals(record.getFlowType())) {
|
||||||
record.setFlowTypeText("补助");
|
record.setFlowTypeText("补助");
|
||||||
|
record.setAmount(-record.getAmount());
|
||||||
} else if ("130".equals(record.getFlowType())) {
|
} else if ("130".equals(record.getFlowType())) {
|
||||||
record.setFlowTypeText("退款");
|
record.setFlowTypeText("退款");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -591,6 +591,38 @@
|
||||||
rf.flow_type AS flowType,
|
rf.flow_type AS flowType,
|
||||||
rf.pay_time AS payTime,
|
rf.pay_time AS payTime,
|
||||||
rf.ord_time AS ordTime,
|
rf.ord_time AS ordTime,
|
||||||
|
(SELECT SUM(rf2.flow_amount)
|
||||||
|
FROM report_account_flow rf2
|
||||||
|
LEFT JOIN cust_info ci2 ON rf2.cust_id = ci2.cust_id
|
||||||
|
LEFT JOIN cust_org co2 ON ci2.org_id = co2.org_id
|
||||||
|
WHERE rf2.flow_type IN (110, 120)
|
||||||
|
<if test="custName != null">
|
||||||
|
AND rf2.cust_id = ci.cust_id
|
||||||
|
</if>
|
||||||
|
<if test="selectedOrg != null and selectedOrg.length > 0">
|
||||||
|
AND co2.org_id IN
|
||||||
|
<foreach collection="selectedOrg" item="orgId" open="(" separator="," close=")">
|
||||||
|
#{orgId}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
AND rf2.pay_time >= #{startPayTime}
|
||||||
|
AND rf2.pay_time <= #{endPayTime}) AS totalConsume,
|
||||||
|
(SELECT SUM(rf3.flow_amount)
|
||||||
|
FROM report_account_flow rf3
|
||||||
|
LEFT JOIN cust_info ci3 ON rf3.cust_id = ci3.cust_id
|
||||||
|
LEFT JOIN cust_org co3 ON ci3.org_id = co3.org_id
|
||||||
|
WHERE rf3.flow_type = 130
|
||||||
|
<if test="custName != null">
|
||||||
|
AND rf3.cust_id = ci.cust_id
|
||||||
|
</if>
|
||||||
|
<if test="selectedOrg != null and selectedOrg.length > 0">
|
||||||
|
AND co3.org_id IN
|
||||||
|
<foreach collection="selectedOrg" item="orgId" open="(" separator="," close=")">
|
||||||
|
#{orgId}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
AND rf3.pay_time >= #{startPayTime}
|
||||||
|
AND rf3.pay_time <= #{endPayTime}) AS totalRefund,
|
||||||
rf.remark AS remark
|
rf.remark AS remark
|
||||||
FROM report_account_flow rf
|
FROM report_account_flow rf
|
||||||
LEFT JOIN cust_info ci ON rf.cust_id = ci.cust_id
|
LEFT JOIN cust_info ci ON rf.cust_id = ci.cust_id
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue