From a7e125ab1a6e2c260fa24fe71b47e029d2ccb7a9 Mon Sep 17 00:00:00 2001 From: lizhenhua <1075222162@qq.com> Date: Sat, 27 Sep 2025 14:18:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E5=8A=9F=E8=83=BD=E6=9F=A5?= =?UTF-8?q?=E7=9C=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sharedstation/auth/entity/PigxUser.java | 287 +++++++ .../exception/CodedException.java | 5 + .../exception/LeCheckedException.java | 35 + .../sharedstation/exception/LeException.java | 36 + .../core/reportforms/beans/CanteenRecord.java | 32 +- .../core/reportforms/beans/OrgConsume.java | 2 + .../reportforms/beans/ReportOrderInfoVo.java | 50 ++ .../controller/reportformsController.java | 56 ++ .../reportforms/mapper/OrgConsumeMapper.java | 11 + .../core/reportforms/mapper/PlaceMapper.java | 19 + .../service/impl/reportformsServiceImpl.java | 90 ++ .../service/reportformsService.java | 10 + .../mapper/reportforms/OrgConsumerMapper.xml | 796 ++++++++++++------ .../mapper/reportforms/placeMapper.xml | 84 ++ 14 files changed, 1240 insertions(+), 273 deletions(-) create mode 100644 bonus-modules/bonus-shared-station/src/main/java/com/bonus/sharedstation/auth/entity/PigxUser.java create mode 100644 bonus-modules/bonus-shared-station/src/main/java/com/bonus/sharedstation/exception/CodedException.java create mode 100644 bonus-modules/bonus-shared-station/src/main/java/com/bonus/sharedstation/exception/LeCheckedException.java create mode 100644 bonus-modules/bonus-shared-station/src/main/java/com/bonus/sharedstation/exception/LeException.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/ReportOrderInfoVo.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/mapper/PlaceMapper.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/resources/mapper/reportforms/placeMapper.xml diff --git a/bonus-modules/bonus-shared-station/src/main/java/com/bonus/sharedstation/auth/entity/PigxUser.java b/bonus-modules/bonus-shared-station/src/main/java/com/bonus/sharedstation/auth/entity/PigxUser.java new file mode 100644 index 00000000..3d79b69e --- /dev/null +++ b/bonus-modules/bonus-shared-station/src/main/java/com/bonus/sharedstation/auth/entity/PigxUser.java @@ -0,0 +1,287 @@ +package com.bonus.sharedstation.auth.entity; + +import lombok.Generated; + +public class PigxUser { + private Long id; + private Long merchantId; + private Long canteenEffId; + private Long custEffId; + private Long dishesEffId; + private String roleCode; + private String username; + + @Generated + public static PigxUserBuilder builder() { + return new PigxUserBuilder(); + } + + @Generated + public Long getId() { + return this.id; + } + + @Generated + public Long getMerchantId() { + return this.merchantId; + } + + @Generated + public Long getCanteenEffId() { + return this.canteenEffId; + } + + @Generated + public Long getCustEffId() { + return this.custEffId; + } + + @Generated + public Long getDishesEffId() { + return this.dishesEffId; + } + + @Generated + public String getRoleCode() { + return this.roleCode; + } + + @Generated + public String getUsername() { + return this.username; + } + + @Generated + public void setId(final Long id) { + this.id = id; + } + + @Generated + public void setMerchantId(final Long merchantId) { + this.merchantId = merchantId; + } + + @Generated + public void setCanteenEffId(final Long canteenEffId) { + this.canteenEffId = canteenEffId; + } + + @Generated + public void setCustEffId(final Long custEffId) { + this.custEffId = custEffId; + } + + @Generated + public void setDishesEffId(final Long dishesEffId) { + this.dishesEffId = dishesEffId; + } + + @Generated + public void setRoleCode(final String roleCode) { + this.roleCode = roleCode; + } + + @Generated + public void setUsername(final String username) { + this.username = username; + } + + @Generated + public boolean equals(final Object o) { + if (o == this) { + return true; + } else if (!(o instanceof PigxUser)) { + return false; + } else { + PigxUser other = (PigxUser)o; + if (!other.canEqual(this)) { + return false; + } else { + label95: { + Object this$id = this.getId(); + Object other$id = other.getId(); + if (this$id == null) { + if (other$id == null) { + break label95; + } + } else if (this$id.equals(other$id)) { + break label95; + } + + return false; + } + + Object this$merchantId = this.getMerchantId(); + Object other$merchantId = other.getMerchantId(); + if (this$merchantId == null) { + if (other$merchantId != null) { + return false; + } + } else if (!this$merchantId.equals(other$merchantId)) { + return false; + } + + Object this$canteenEffId = this.getCanteenEffId(); + Object other$canteenEffId = other.getCanteenEffId(); + if (this$canteenEffId == null) { + if (other$canteenEffId != null) { + return false; + } + } else if (!this$canteenEffId.equals(other$canteenEffId)) { + return false; + } + + label74: { + Object this$custEffId = this.getCustEffId(); + Object other$custEffId = other.getCustEffId(); + if (this$custEffId == null) { + if (other$custEffId == null) { + break label74; + } + } else if (this$custEffId.equals(other$custEffId)) { + break label74; + } + + return false; + } + + label67: { + Object this$dishesEffId = this.getDishesEffId(); + Object other$dishesEffId = other.getDishesEffId(); + if (this$dishesEffId == null) { + if (other$dishesEffId == null) { + break label67; + } + } else if (this$dishesEffId.equals(other$dishesEffId)) { + break label67; + } + + return false; + } + + Object this$roleCode = this.getRoleCode(); + Object other$roleCode = other.getRoleCode(); + if (this$roleCode == null) { + if (other$roleCode != null) { + return false; + } + } else if (!this$roleCode.equals(other$roleCode)) { + return false; + } + + Object this$username = this.getUsername(); + Object other$username = other.getUsername(); + if (this$username == null) { + if (other$username != null) { + return false; + } + } else if (!this$username.equals(other$username)) { + return false; + } + + return true; + } + } + } + + @Generated + protected boolean canEqual(final Object other) { + return other instanceof PigxUser; + } + + + @Generated + public String toString() { + Long var10000 = this.getId(); + return "PigxUser(id=" + var10000 + ", merchantId=" + this.getMerchantId() + ", canteenEffId=" + this.getCanteenEffId() + ", custEffId=" + this.getCustEffId() + ", dishesEffId=" + this.getDishesEffId() + ", roleCode=" + this.getRoleCode() + ", username=" + this.getUsername() + ")"; + } + + @Generated + public PigxUser(final Long id, final Long merchantId, final Long canteenEffId, final Long custEffId, final Long dishesEffId, final String roleCode, final String username) { + this.id = id; + this.merchantId = merchantId; + this.canteenEffId = canteenEffId; + this.custEffId = custEffId; + this.dishesEffId = dishesEffId; + this.roleCode = roleCode; + this.username = username; + } + + @Generated + public PigxUser() { + } + + @Generated + public static class PigxUserBuilder { + @Generated + private Long id; + @Generated + private Long merchantId; + @Generated + private Long canteenEffId; + @Generated + private Long custEffId; + @Generated + private Long dishesEffId; + @Generated + private String roleCode; + @Generated + private String username; + + @Generated + PigxUserBuilder() { + } + + @Generated + public PigxUserBuilder id(final Long id) { + this.id = id; + return this; + } + + @Generated + public PigxUserBuilder merchantId(final Long merchantId) { + this.merchantId = merchantId; + return this; + } + + @Generated + public PigxUserBuilder canteenEffId(final Long canteenEffId) { + this.canteenEffId = canteenEffId; + return this; + } + + @Generated + public PigxUserBuilder custEffId(final Long custEffId) { + this.custEffId = custEffId; + return this; + } + + @Generated + public PigxUserBuilder dishesEffId(final Long dishesEffId) { + this.dishesEffId = dishesEffId; + return this; + } + + @Generated + public PigxUserBuilder roleCode(final String roleCode) { + this.roleCode = roleCode; + return this; + } + + @Generated + public PigxUserBuilder username(final String username) { + this.username = username; + return this; + } + + @Generated + public PigxUser build() { + return new PigxUser(this.id, this.merchantId, this.canteenEffId, this.custEffId, this.dishesEffId, this.roleCode, this.username); + } + + @Generated + public String toString() { + return "PigxUser.PigxUserBuilder(id=" + this.id + ", merchantId=" + this.merchantId + ", canteenEffId=" + this.canteenEffId + ", custEffId=" + this.custEffId + ", dishesEffId=" + this.dishesEffId + ", roleCode=" + this.roleCode + ", username=" + this.username + ")"; + } + } +} diff --git a/bonus-modules/bonus-shared-station/src/main/java/com/bonus/sharedstation/exception/CodedException.java b/bonus-modules/bonus-shared-station/src/main/java/com/bonus/sharedstation/exception/CodedException.java new file mode 100644 index 00000000..8f96d8dc --- /dev/null +++ b/bonus-modules/bonus-shared-station/src/main/java/com/bonus/sharedstation/exception/CodedException.java @@ -0,0 +1,5 @@ +package com.bonus.sharedstation.exception; + +public interface CodedException { + Integer getCode(); +} diff --git a/bonus-modules/bonus-shared-station/src/main/java/com/bonus/sharedstation/exception/LeCheckedException.java b/bonus-modules/bonus-shared-station/src/main/java/com/bonus/sharedstation/exception/LeCheckedException.java new file mode 100644 index 00000000..b5670aba --- /dev/null +++ b/bonus-modules/bonus-shared-station/src/main/java/com/bonus/sharedstation/exception/LeCheckedException.java @@ -0,0 +1,35 @@ +package com.bonus.sharedstation.exception; + +import com.bonus.common.houqin.constant.RetCodeEnum; + +public class LeCheckedException extends BizException { + private static final Integer DEFAULT_ERROR_CODE = 40004; + + public LeCheckedException(String message) { + super(DEFAULT_ERROR_CODE, message); + } + + public LeCheckedException(RetCodeEnum retCodeEnum, String message) { + super(retCodeEnum.getKey(), message); + } + + public LeCheckedException(Integer code, String message) { + super(code, message); + } + + public LeCheckedException(Throwable cause) { + super(cause); + } + + public LeCheckedException(RetCodeEnum retCodeEnum, Throwable cause) { + super(retCodeEnum.getKey(), cause); + } + + public LeCheckedException(String message, Throwable cause) { + super(message, cause); + } + + public LeCheckedException(RetCodeEnum retCodeEnum, String message, Throwable cause) { + super(retCodeEnum.getKey(), message, cause); + } +} diff --git a/bonus-modules/bonus-shared-station/src/main/java/com/bonus/sharedstation/exception/LeException.java b/bonus-modules/bonus-shared-station/src/main/java/com/bonus/sharedstation/exception/LeException.java new file mode 100644 index 00000000..bcdade3e --- /dev/null +++ b/bonus-modules/bonus-shared-station/src/main/java/com/bonus/sharedstation/exception/LeException.java @@ -0,0 +1,36 @@ +package com.bonus.sharedstation.exception; + + +import com.bonus.common.houqin.constant.RetCodeEnum; + +public class LeException extends BizRuntimeException { + private static final Integer DEFAULT_ERROR_CODE = 40004; + + public LeException(String message) { + super(DEFAULT_ERROR_CODE, message); + } + + public LeException(RetCodeEnum retCodeEnum, String message) { + super(retCodeEnum.getKey(), message); + } + + public LeException(Integer code, String message) { + super(code, message); + } + + public LeException(Throwable cause) { + super(cause); + } + + public LeException(RetCodeEnum retCodeEnum, Throwable cause) { + super(retCodeEnum.getKey(), cause); + } + + public LeException(String message, Throwable cause) { + super(message, cause); + } + + public LeException(RetCodeEnum retCodeEnum, String message, Throwable cause) { + super(retCodeEnum.getKey(), message, cause); + } +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/CanteenRecord.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/CanteenRecord.java index ab4fa8fd..f74471f1 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/CanteenRecord.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/CanteenRecord.java @@ -1,27 +1,51 @@ package com.bonus.canteen.core.reportforms.beans; +import com.bonus.common.core.annotation.Excel; import com.bonus.common.core.web.domain.BaseEntity; import lombok.Data; -import java.util.List; - - @Data public class CanteenRecord extends BaseEntity { private Long orgId; // 主键ID private String orgName; + @Excel(name = "用户姓名") private String custName; // 姓名 + @Excel(name = "用户编号") private String custId; // 用户编号 + @Excel(name = "所属组织") private String orgFullName; // 所属组织 private String flowTypeName; // 消费情况 - private String consumeSource; // 订单类型 + private String consumeSource; private String ordDate; // 就餐日期 + @Excel(name = "订单金额") private Double amount; // 订单金额 private String phone; // 用户手机号 + @Excel(name = "下单时间") private String ordTime; // 下单时间 private String remark; // 备注 private String startPayTime; private String endPayTime; private String flowType; + private String totalConsume; + private String totalRefund; private String[] selectedOrg; + + // 导出用的字段 + @Excel(name = "订单类型") + private String flowTypeText; + + // 在查询或封装数据时,给 flowTypeText 赋值 + public void setFlowTypeTextByFlowType() { + if ("110".equals(flowType)) { + this.flowTypeText = "消费"; + } else if ("120".equals(flowType)) { + this.flowTypeText = "补助"; + } else if ("130".equals(flowType)) { + this.flowTypeText = "退款"; + } else { + this.flowTypeText = flowType; + } + } + + } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/OrgConsume.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/OrgConsume.java index 387e901f..33f1326e 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/OrgConsume.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/OrgConsume.java @@ -25,6 +25,8 @@ public class OrgConsume { private Integer flowType; private String payTime; private String orgFullName; + private String walletId; + /** * 1:APP预定 2:驿站消费 3:食堂消费 4:超市消费 */ diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/ReportOrderInfoVo.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/ReportOrderInfoVo.java new file mode 100644 index 00000000..39de8b6a --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/beans/ReportOrderInfoVo.java @@ -0,0 +1,50 @@ +package com.bonus.canteen.core.reportforms.beans; + +import com.bonus.common.core.annotation.Excel; +import com.bonus.common.core.web.domain.BaseEntity; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class ReportOrderInfoVo extends BaseEntity { + + private String startTime; + private String endTime; + private String[] selectedOrg; + private String[] gzselectedOrg; + + // 分页字段 + private Integer pageNum = 1; + private Integer pageSize = 10; + + private Long orderId; + private Long custId; + @Excel(name = "用户账号") + private String custNum; + @Excel(name = "用户姓名") + private String custName; + @Excel(name = "用户手机号") + private String mobile; + private String orgName; + @Excel(name = "所属组织") + private String orgFullName; + @Excel(name = "交易余额") + private BigDecimal payableAmount; + private BigDecimal payableAmountAll; + private BigDecimal realAmount; + private String payTime; + private Long areaId; + @Excel(name = "消费地") + private String areaName; + private Long diningPlaceId; + @Excel(name = "工作地") + private String workAreaName; + @Excel(name = "交易次数") + private int tradeNum; + private int tradeNumAll; + @Excel(name = "订单类型") + private String orderType; + + +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/controller/reportformsController.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/controller/reportformsController.java index c1996448..2f5b8093 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/controller/reportformsController.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/controller/reportformsController.java @@ -2,6 +2,7 @@ package com.bonus.canteen.core.reportforms.controller; import com.bonus.canteen.core.reportforms.beans.CanteenOrg; import com.bonus.canteen.core.reportforms.beans.CanteenRecord; import com.bonus.canteen.core.reportforms.beans.OrgConsume; +import com.bonus.canteen.core.reportforms.beans.ReportOrderInfoVo; import com.bonus.canteen.core.reportforms.service.reportformsService; import com.bonus.common.core.utils.poi.ExcelUtil; import com.bonus.common.core.web.controller.BaseController; @@ -12,6 +13,8 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import java.io.UnsupportedEncodingException; +import java.math.BigDecimal; +import java.math.RoundingMode; import java.util.List; import java.net.URLDecoder; import java.nio.charset.StandardCharsets; @@ -140,4 +143,57 @@ public class reportformsController extends BaseController { return service.getOrgTree(); } + @GetMapping("/areatree") + public List getOrgareatree() { + List orgareatree = service.getOrgareatree(); + return orgareatree; + } + + + /** + * 查询订单区域不匹配列表 + */ + @PostMapping("/getplaceList") + public TableDataInfo getplaceList(@RequestBody ReportOrderInfoVo reportOrderInfoVo) { + int pageNum = reportOrderInfoVo.getPageNum() != null ? reportOrderInfoVo.getPageNum() : 1; + int pageSize = reportOrderInfoVo.getPageSize() != null ? reportOrderInfoVo.getPageSize() : 10; + int offset = (pageNum - 1) * pageSize; + int count =service.selectOrderMismatchListCount(reportOrderInfoVo); + List list = service.selectOrderMismatchList(reportOrderInfoVo, offset, pageSize); + // 封装返回给前端 + return new TableDataInfo(list, count); + } + /** + * 人员报表查询导出功能 + * @param orgConsume + * @return + */ + @PostMapping("/consume/placeexportExcel") + public void placeexportExcel(HttpServletResponse response, ReportOrderInfoVo 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. 查询数据 + List peoplelist = service.placeexportExcel(orgConsume); + + /// 分 -> 元 + peoplelist.forEach(record -> { + if (record.getPayableAmount() != null) { + record.setPayableAmount( + record.getPayableAmount().divide(new BigDecimal(100), 2, RoundingMode.HALF_UP) + ); + } + }); + // 3. 导出 Excel + ExcelUtil util = new ExcelUtil<>(ReportOrderInfoVo.class); + util.exportExcel(response, peoplelist, "人员导出数据详情"); + } + } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/mapper/OrgConsumeMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/mapper/OrgConsumeMapper.java index f29d814b..9e6b79da 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/mapper/OrgConsumeMapper.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/mapper/OrgConsumeMapper.java @@ -5,6 +5,7 @@ import com.bonus.canteen.core.menu.vo.AppletWeekCanteenVO; import com.bonus.canteen.core.reportforms.beans.CanteenOrg; import com.bonus.canteen.core.reportforms.beans.CanteenRecord; import com.bonus.canteen.core.reportforms.beans.OrgConsume; +import com.bonus.canteen.core.reportforms.beans.ReportOrderInfoVo; import org.apache.ibatis.annotations.MapKey; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -47,4 +48,14 @@ public interface OrgConsumeMapper { List> selectReserveRecordsFromDatabase(OrgConsume orgConsume); List getlistForH5Special(OrgConsume orgConsume); + + List selectOrderMismatchList( @Param("vo") ReportOrderInfoVo reportOrderInfoVo, @Param("offset")int offset, @Param("pageSize") int pageSize); + + // 查询总数 + int selectOrderMismatchListCount(ReportOrderInfoVo reportOrderInfoVo); + + ReportOrderInfoVo selectOrderMismatchListTotal(ReportOrderInfoVo reportOrderInfoVo); + + List selectAllareaOrgs(); + } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/mapper/PlaceMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/mapper/PlaceMapper.java new file mode 100644 index 00000000..b116b269 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/mapper/PlaceMapper.java @@ -0,0 +1,19 @@ +package com.bonus.canteen.core.reportforms.mapper; + +import com.bonus.canteen.core.reportforms.beans.CanteenOrg; +import com.bonus.canteen.core.reportforms.beans.CanteenRecord; +import com.bonus.canteen.core.reportforms.beans.OrgConsume; +import com.bonus.canteen.core.reportforms.beans.ReportOrderInfoVo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.math.BigDecimal; +import java.util.List; +import java.util.Map; + +@Mapper +public interface PlaceMapper { + + + List placeexportExcel(ReportOrderInfoVo orgConsume); +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/service/impl/reportformsServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/service/impl/reportformsServiceImpl.java index ebf7c9b7..5c3db279 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/service/impl/reportformsServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/service/impl/reportformsServiceImpl.java @@ -3,7 +3,9 @@ package com.bonus.canteen.core.reportforms.service.impl; import com.bonus.canteen.core.reportforms.beans.CanteenOrg; import com.bonus.canteen.core.reportforms.beans.CanteenRecord; import com.bonus.canteen.core.reportforms.beans.OrgConsume; +import com.bonus.canteen.core.reportforms.beans.ReportOrderInfoVo; import com.bonus.canteen.core.reportforms.mapper.OrgConsumeMapper; +import com.bonus.canteen.core.reportforms.mapper.PlaceMapper; import com.bonus.canteen.core.reportforms.service.reportformsService; import com.bonus.common.houqin.utils.SM4EncryptUtils; import org.springframework.stereotype.Service; @@ -18,6 +20,9 @@ import java.util.stream.Collectors; public class reportformsServiceImpl implements reportformsService { @Resource private OrgConsumeMapper mapper; + + @Resource + private PlaceMapper placemapper; @Override public List getOrgConsumeList(OrgConsume orgConsume) { // 查询食堂、超市、消费补扣的所有数据信息 @@ -143,6 +148,49 @@ public class reportformsServiceImpl implements reportformsService { .collect(Collectors.toList()); return orgConsumes; } + + @Override + public List selectOrderMismatchList(ReportOrderInfoVo reportOrderInfoVo, int pageNum, int pageSize) { + List reportOrderInfoVos = mapper.selectOrderMismatchList(reportOrderInfoVo, pageNum, pageSize) + .stream() + .peek(c -> { + if (c.getCustName() != null && !c.getCustName().isEmpty()) { + try { + c.setCustName(SM4EncryptUtils.sm4Decrypt(c.getCustName())); + if (c.getMobile() != null) { + String phone = SM4EncryptUtils.sm4Decrypt(c.getMobile()); + if (phone.length() == 11) { + phone = phone.substring(0, 3) + "****" + phone.substring(7); + } + c.setMobile(phone); + } + + } catch (Exception e) { + e.printStackTrace(); + } + } + }) + .collect(Collectors.toList()); + // 查询全表合计 + ReportOrderInfoVo totalVo = mapper.selectOrderMismatchListTotal(reportOrderInfoVo); + if (totalVo != null) { + ReportOrderInfoVo totalRow = new ReportOrderInfoVo(); + totalRow.setCustNum("合计"); + totalRow.setTradeNum(totalVo.getTradeNum()); + totalRow.setPayableAmount(totalVo.getPayableAmount()); + // 其它字段按需填充空或默认值 + reportOrderInfoVos.add(totalRow); + } + + + return reportOrderInfoVos; + } + + @Override + public int selectOrderMismatchListCount(ReportOrderInfoVo reportOrderInfoVo) { + return mapper.selectOrderMismatchListCount(reportOrderInfoVo); + } + @Override public List getlistByH5list(OrgConsume orgConsume) { if ("宏源工业园".equals(orgConsume.getOrgName())) { @@ -248,6 +296,48 @@ public class reportformsServiceImpl implements reportformsService { List all = mapper.selectAllOrgs(); return buildTree(all, -1L); // 假设顶级 super_id = 0 } + @Override + public List getOrgareatree() { + List all = mapper.selectAllareaOrgs(); + return buildAreaTree(all, 378915229716713472L); // 假设顶级 super_id = 0 + } + + @Override + public List placeexportExcel(ReportOrderInfoVo orgConsume) { + List reportOrderInfoVos = placemapper.placeexportExcel(orgConsume) + .stream() + .peek(c -> { + if (c.getCustName() != null && !c.getCustName().isEmpty()) { + try { + c.setCustName(SM4EncryptUtils.sm4Decrypt(c.getCustName())); + if (c.getMobile() != null) { + String phone = SM4EncryptUtils.sm4Decrypt(c.getMobile()); + c.setMobile(phone); + } + + } catch (Exception e) { + e.printStackTrace(); + } + } + }) + .collect(Collectors.toList()); + return reportOrderInfoVos; + } + + + private List buildAreaTree(List list, Long parentId) { + System.err.println("parentId = " + parentId); + List tree = new ArrayList<>(); + for (CanteenOrg org : list) { + System.err.println("orgId=" + org.getOrgId() + ", superId=" + org.getSuperId()); + if ((parentId == null && org.getSuperId() == null) + || (parentId != null && parentId.equals(org.getSuperId()))) { + org.setChildren(buildAreaTree(list, org.getOrgId())); + tree.add(org); + } + } + return tree; + } private List buildTree(List list, Long parentId) { diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/service/reportformsService.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/service/reportformsService.java index 215fe531..70297e92 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/service/reportformsService.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/reportforms/service/reportformsService.java @@ -3,6 +3,7 @@ package com.bonus.canteen.core.reportforms.service; import com.bonus.canteen.core.reportforms.beans.CanteenOrg; import com.bonus.canteen.core.reportforms.beans.CanteenRecord; import com.bonus.canteen.core.reportforms.beans.OrgConsume; +import com.bonus.canteen.core.reportforms.beans.ReportOrderInfoVo; import java.util.List; @@ -22,4 +23,13 @@ public interface reportformsService { List getOrgTree(); List getDeductionlist(OrgConsume orgConsume); + + List selectOrderMismatchList(ReportOrderInfoVo reportOrderInfoVo,int pageNum, int pageSize); + + + int selectOrderMismatchListCount(ReportOrderInfoVo reportOrderInfoVo); + + List getOrgareatree(); + + List placeexportExcel(ReportOrderInfoVo orgConsume); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/reportforms/OrgConsumerMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/reportforms/OrgConsumerMapper.xml index 701b7302..62f1a172 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/reportforms/OrgConsumerMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/reportforms/OrgConsumerMapper.xml @@ -150,10 +150,103 @@ SELECT area_name, org_name FROM area_org_map + - @@ -493,6 +525,7 @@ t.flow_real_amount / 100 AS amount, t.ord_time, t.pay_time, + t.walletId, t.remark FROM ( @@ -506,8 +539,10 @@ f.ord_time, d.pay_time, f.cust_id, + atwd.wallet_id as walletId, f.remark FROM report_account_flow f + left join acc_trade_wallet_detail atwd on atwd.trade_id = f.flow_id INNER JOIN report_account_flow_detail d ON f.flow_id = d.flow_id LEFT JOIN device_info di ON f.mch_sn = di.device_sn LEFT JOIN device_bind bd ON di.device_id = bd.device_id @@ -529,12 +564,14 @@ f.ord_time, at.trade_time AS pay_time, f.cust_id, + atwd.wallet_id as walletId, f.remark FROM report_account_flow f INNER JOIN acc_trade at ON at.cust_id = f.cust_id AND at.trade_type = 130 AND DATE(at.trade_time) = DATE(f.pay_time) + left join acc_trade_wallet_detail atwd on atwd.trade_id = f.flow_id LEFT JOIN device_info di ON f.mch_sn = di.device_sn LEFT JOIN device_bind bd ON di.device_id = bd.device_id LEFT JOIN alloc_canteen aa ON aa.canteen_id = bd.canteen_id @@ -666,9 +703,11 @@ f.source_type, f.remark, f.flow_id, + atwd.wallet_id as walletId, f.flow_type, f.pay_time as payTime FROM report_account_flow f + left join acc_trade_wallet_detail atwd on atwd.trade_id = f.flow_id LEFT JOIN device_info di ON f.mch_sn = di.device_sn LEFT JOIN device_bind bd ON di.device_id = bd.device_id LEFT JOIN alloc_canteen aa ON aa.canteen_id = bd.canteen_id @@ -708,72 +747,291 @@ + + a.flow_id AS order_id, + a.cust_id, + a.flow_amount AS payable_amount, + replace(a.flow_real_amount,'-','') AS real_amount, + a.pay_time, + bd.canteen_id, + a.mch_sn + FROM report_account_flow a + LEFT JOIN device_info di ON a.mch_sn = di.device_sn + LEFT JOIN device_bind bd ON di.device_id = bd.device_id + WHERE a.pay_time >= #{vo.startTime} AND a.pay_time <= #{vo.endTime} AND a.remark LIKE '%支付' + ) a + LEFT JOIN report_order_info_snapshot ros ON ros.order_id = a.order_id + LEFT JOIN alloc_canteen ac ON ac.canteen_id = a.canteen_id + LEFT JOIN cust_info ci ON ci.cust_id = a.cust_id + LEFT JOIN cust_org co ON co.org_id = ci.org_id + JOIN cust_dining_place p ON p.cust_id = ci.cust_id AND p.type = 'area' + LEFT JOIN alloc_area ar ON ar.area_id = ac.area_id + LEFT JOIN alloc_area ap ON ap.area_id = p.dining_place_id + WHERE ac.area_id != p.dining_place_id + + + AND ac.area_id IN + + #{id} + + + + + AND p.dining_place_id IN + + #{id} + + + ) a + GROUP BY cust_id, area_name, work_area_name,order_type + ORDER BY a.pay_time DESC + LIMIT #{offset}, #{pageSize} + + + + + + diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/reportforms/placeMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/reportforms/placeMapper.xml new file mode 100644 index 00000000..efbfa3fb --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/reportforms/placeMapper.xml @@ -0,0 +1,84 @@ + + + + + +