diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/constants/AccTradeTypeEnum.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/constants/AccTradeTypeEnum.java index 3d0a779..789b6c9 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/constants/AccTradeTypeEnum.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/constants/AccTradeTypeEnum.java @@ -1,5 +1,7 @@ package com.bonus.canteen.core.account.constants; +import com.bonus.canteen.core.pay.constants.PayTypeEnum; + public enum AccTradeTypeEnum { RECHARGE(10, "充值"), SUBSIDY(20, "补贴"), @@ -23,4 +25,13 @@ public enum AccTradeTypeEnum { public String getDesc() { return this.desc; } + + public static String getDescByKey(Integer targetKey) { + for (AccTradeTypeEnum tradeType : AccTradeTypeEnum.values()) { + if (tradeType.getKey().equals(targetKey)) { + return tradeType.getDesc(); + } + } + return ""; + } } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/controller/AccCardController.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/controller/AccCardController.java index 09ab9a4..004b7bf 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/controller/AccCardController.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/controller/AccCardController.java @@ -88,7 +88,7 @@ public class AccCardController extends BaseController { accCard.setOperationType(CardRecordTypeEnum.APPLY.getKey()); return toAjax(accCardService.insertAccCard(accCard)); } catch (Exception e) { - return error("系统错误, " + e.getMessage()); + return error(e.getMessage()); } } @@ -104,7 +104,7 @@ public class AccCardController extends BaseController { try { return toAjax(accCardService.updateAccCard(accCard)); } catch (Exception e) { - return error("系统错误, " + e.getMessage()); + return error(e.getMessage()); } } @@ -118,7 +118,7 @@ public class AccCardController extends BaseController { accCard.setOperationType(CardRecordTypeEnum.CHANGE.getKey()); return toAjax(accCardService.updateAccCard(accCard)); } catch (Exception e) { - return error("系统错误, " + e.getMessage()); + return error(e.getMessage()); } } @@ -133,7 +133,7 @@ public class AccCardController extends BaseController { accCard.setCardStatus(CardStatusEnum.LOSS.getKey()); return toAjax(accCardService.updateAccCard(accCard)); } catch (Exception e) { - return error("系统错误, " + e.getMessage()); + return error(e.getMessage()); } } @@ -148,7 +148,7 @@ public class AccCardController extends BaseController { accCard.setCardStatus(CardStatusEnum.NORMAL.getKey()); return toAjax(accCardService.updateAccCard(accCard)); } catch (Exception e) { - return error("系统错误, " + e.getMessage()); + return error(e.getMessage()); } } @@ -163,7 +163,7 @@ public class AccCardController extends BaseController { accCard.setCardStatus(CardStatusEnum.REFUND.getKey()); return toAjax(accCardService.updateAccCard(accCard)); } catch (Exception e) { - return error("系统错误, " + e.getMessage()); + return error(e.getMessage()); } } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/controller/AccTradeController.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/controller/AccTradeController.java index 9c50462..76fac5a 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/controller/AccTradeController.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/controller/AccTradeController.java @@ -2,6 +2,8 @@ package com.bonus.canteen.core.account.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; + +import com.bonus.canteen.core.account.domain.param.AccConsumeDetailQueryParam; import com.bonus.common.log.enums.OperaType; import com.bonus.canteen.core.common.annotation.PreventRepeatSubmit; import io.swagger.annotations.Api; @@ -116,4 +118,17 @@ public class AccTradeController extends BaseController { public AjaxResult remove(@PathVariable Long[] tradeIds) { return toAjax(accTradeService.deleteAccTradeByTradeIds(tradeIds)); } + + /** + * 账户消费记录 + */ + @ApiOperation(value = "账户消费记录") + //@PreventRepeatSubmit + //@RequiresPermissions("account:trade:remove") + @SysLog(title = "账户消费记录", businessType = OperaType.QUERY, logType = 1,module = "账户->账户消费记录") + @PostMapping("/consume/detail") + public TableDataInfo consumeDetail(@RequestBody AccConsumeDetailQueryParam param) { + startPage(); + return getDataTable(accTradeService.queryAccConsumeDetail(param)); + } } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/domain/param/AccConsumeDetailQueryParam.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/domain/param/AccConsumeDetailQueryParam.java new file mode 100644 index 0000000..d04236c --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/domain/param/AccConsumeDetailQueryParam.java @@ -0,0 +1,29 @@ +package com.bonus.canteen.core.account.domain.param; + +import com.bonus.common.core.web.domain.BaseEntity; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; +import java.util.List; + +@Data +public class AccConsumeDetailQueryParam extends BaseEntity { + @ApiModelProperty("查询组织id集合") + private List deptIdList; + @ApiModelProperty("开始时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime startDateTime; + @ApiModelProperty("结束时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime endDateTime; + @ApiModelProperty("交易类型") + private Integer tradeType; + private Integer walletId; + private String searchValue; + public AccConsumeDetailQueryParam() { + this.endDateTime = LocalDateTime.now().plusDays(7); + this.startDateTime = LocalDateTime.now().minusDays(7); + } +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/domain/vo/AccConsumeDetailVO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/domain/vo/AccConsumeDetailVO.java new file mode 100644 index 0000000..66eda63 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/domain/vo/AccConsumeDetailVO.java @@ -0,0 +1,67 @@ +package com.bonus.canteen.core.account.domain.vo; + +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +public class AccConsumeDetailVO implements Serializable { + private Long tradeId; + + /** + * 用户ID + */ + private Long userId; + + /** + * 用户昵称 + */ + private String nickName; + + /** + * 部门全名 + */ + private String deptFullName; + + /** + * 用户类型 + */ + private Integer userType; + + /** + * 支付时间 + */ + private LocalDateTime payTime; + + /** + * 下单时间 + */ + private LocalDateTime orderTime; + + /** + * 交易类型 + */ + private Integer tradeType; + + /** + * 钱包ID + */ + private Long walletId; + + /** + * 金额 + */ + private BigDecimal amount; + + /** + * 钱包余额 + */ + private BigDecimal walletBal; + + /** + * 来源类型 + */ + private Integer sourceType; +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/mapper/AccCardMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/mapper/AccCardMapper.java index 65a4b0a..392c49f 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/mapper/AccCardMapper.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/mapper/AccCardMapper.java @@ -13,6 +13,8 @@ public interface AccCardMapper { public int selectAccCardCountByUserId(Long userId); + public int selectAccCardCountByCardSerialNum(String serialNum); + /** * 查询人员卡片资料 * diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/mapper/AccTradeMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/mapper/AccTradeMapper.java index a056d31..6fd57eb 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/mapper/AccTradeMapper.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/mapper/AccTradeMapper.java @@ -3,7 +3,9 @@ package com.bonus.canteen.core.account.mapper; import java.util.List; import com.bonus.canteen.core.account.domain.AccTrade; import com.bonus.canteen.core.account.domain.bo.TradeAndWallerInfo; +import com.bonus.canteen.core.account.domain.param.AccConsumeDetailQueryParam; import com.bonus.canteen.core.account.domain.param.AccWalletOperationQueryParam; +import com.bonus.canteen.core.account.domain.vo.AccConsumeDetailVO; import com.bonus.canteen.core.account.domain.vo.AccOperationListVO; import com.bonus.canteen.core.account.domain.vo.AccTradeVo; import org.apache.ibatis.annotations.Param; @@ -74,4 +76,7 @@ public interface AccTradeMapper { List queryTradeAndWallerInfoByOrderNo(@Param("orderNo") String orderNo, @Param("accTradeType") Integer accTradeType); + + List queryAccConsumeDetail(@Param("param") AccConsumeDetailQueryParam param, + @Param("encryptedSearchValue") String encryptedSearchValue); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/service/IAccTradeService.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/service/IAccTradeService.java index f8b653c..182f63d 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/service/IAccTradeService.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/service/IAccTradeService.java @@ -3,9 +3,12 @@ package com.bonus.canteen.core.account.service; import com.bonus.canteen.core.account.constants.AccTradeTypeEnum; import com.bonus.canteen.core.account.domain.AccTrade; import com.bonus.canteen.core.account.domain.bo.TradeAndWallerInfo; +import com.bonus.canteen.core.account.domain.param.AccConsumeDetailQueryParam; import com.bonus.canteen.core.account.domain.param.AccWalletOperationQueryParam; +import com.bonus.canteen.core.account.domain.vo.AccConsumeDetailVO; import com.bonus.canteen.core.account.domain.vo.AccOperationListVO; import com.bonus.canteen.core.account.domain.vo.AccTradeVo; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -73,4 +76,6 @@ public interface IAccTradeService { List queryAccOperationList(AccWalletOperationQueryParam param); List queryTradeAndWallerInfoByOrderNo(String orderNo, AccTradeTypeEnum accTradeTypeEnum); + + List queryAccConsumeDetail(AccConsumeDetailQueryParam param); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/service/impl/AccCardServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/service/impl/AccCardServiceImpl.java index 04d84ab..15e6112 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/service/impl/AccCardServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/service/impl/AccCardServiceImpl.java @@ -78,16 +78,21 @@ public class AccCardServiceImpl implements IAccCardService { accCard.setUserId(accInfo.getUserId()); accCard.setCardStatus(CardStatusEnum.NORMAL.getKey()); accCard.setCardType(CardTypeEnum.IC_CARD.getKey()); - // 发卡前校验是否卡已存在, 已退卡的可以再发放 + // 发卡前校验是否此用户已有卡, 已退卡、已过期的可以再发放 int cardCountByUserId= accCardMapper.selectAccCardCountByUserId(accInfo.getUserId()); if (cardCountByUserId > 0) { - throw new ServiceException("用户(user_id=" + accInfo.getUserId() + ")已有卡, 不能再次发放"); + throw new ServiceException("此用户已有卡, 不能再次发放"); + } + // 发卡前校验是否卡号已存在, 卡号不能重复 + int cardCountByCardSerialNum= accCardMapper.selectAccCardCountByCardSerialNum(accCard.getSerialNum()); + if (cardCountByCardSerialNum > 0) { + throw new ServiceException("卡号已存在, 卡号不能重复"); } int count = accCardMapper.insertAccCard(accCard); saveAccCardChangeRecord(accCard); return count; } catch (Exception e) { - throw new ServiceException("发卡异常, " + e.getMessage()); + throw new ServiceException(e.getMessage()); } } @@ -131,6 +136,11 @@ public class AccCardServiceImpl implements IAccCardService { accCard.setUpdateBy(SecurityUtils.getUsername()); accCard.setUpdateTime(DateUtils.getNowDate()); try { + // 发卡前校验是否卡号已存在, 卡号不能重复 + int cardCountByCardSerialNum= accCardMapper.selectAccCardCountByCardSerialNum(accCard.getSerialNum()); + if (cardCountByCardSerialNum > 0) { + throw new ServiceException("卡号已存在, 卡号不能重复"); + } AccInfo accInfo = accInfoMapper.selectAccInfoById(accCard.getAccId()); checkAccInfoAndStatus(accInfo); int count = accCardMapper.updateAccCard(accCard); @@ -144,7 +154,7 @@ public class AccCardServiceImpl implements IAccCardService { } return count; } catch (Exception e) { - throw new ServiceException("更新异常, " + e.getMessage()); + throw new ServiceException(e.getMessage()); } } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/service/impl/AccTradeServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/service/impl/AccTradeServiceImpl.java index 5baa338..e96c39f 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/service/impl/AccTradeServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/service/impl/AccTradeServiceImpl.java @@ -4,7 +4,9 @@ import cn.hutool.core.collection.CollUtil; import com.bonus.canteen.core.account.constants.AccTradeTypeEnum; import com.bonus.canteen.core.account.domain.AccTrade; import com.bonus.canteen.core.account.domain.bo.TradeAndWallerInfo; +import com.bonus.canteen.core.account.domain.param.AccConsumeDetailQueryParam; import com.bonus.canteen.core.account.domain.param.AccWalletOperationQueryParam; +import com.bonus.canteen.core.account.domain.vo.AccConsumeDetailVO; import com.bonus.canteen.core.account.domain.vo.AccOperationListVO; import com.bonus.canteen.core.account.domain.vo.AccTradeVo; import com.bonus.canteen.core.account.mapper.AccTradeMapper; @@ -152,4 +154,10 @@ public class AccTradeServiceImpl implements IAccTradeService { public List queryTradeAndWallerInfoByOrderNo(String orderNo, AccTradeTypeEnum accTradeTypeEnum) { return accTradeMapper.queryTradeAndWallerInfoByOrderNo(orderNo, accTradeTypeEnum.getKey()); } + + @Override + public List queryAccConsumeDetail(AccConsumeDetailQueryParam param) { + String encryptedSearchValue = SM4EncryptUtils.sm4Encrypt(param.getSearchValue()); + return accTradeMapper.queryAccConsumeDetail(param, encryptedSearchValue); + } } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/controller/AllocCanteenController.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/controller/AllocCanteenController.java index 1f5f064..4d41346 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/controller/AllocCanteenController.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/controller/AllocCanteenController.java @@ -83,7 +83,7 @@ public class AllocCanteenController extends BaseController { try { return toAjax(allocCanteenService.insertAllocCanteen(allocCanteen)); } catch (Exception e) { - return error("系统错误, " + e.getMessage()); + return error(e.getMessage()); } } @@ -99,7 +99,7 @@ public class AllocCanteenController extends BaseController { try { return toAjax(allocCanteenService.updateAllocCanteen(allocCanteen)); } catch (Exception e) { - return error("系统错误, " + e.getMessage()); + return error(e.getMessage()); } } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/controller/AllocStallController.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/controller/AllocStallController.java index ffd4be9..2ec5200 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/controller/AllocStallController.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/controller/AllocStallController.java @@ -83,7 +83,7 @@ public class AllocStallController extends BaseController { try { return toAjax(allocStallService.insertAllocStall(allocStall)); } catch (Exception e) { - return error("系统错误, " + e.getMessage()); + return error(e.getMessage()); } } @@ -99,7 +99,7 @@ public class AllocStallController extends BaseController { try { return toAjax(allocStallService.updateAllocStall(allocStall)); } catch (Exception e) { - return error("系统错误, " + e.getMessage()); + return error(e.getMessage()); } } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/domain/AllocCanteenSuggestion.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/domain/AllocCanteenSuggestion.java index 5d8559e..8b74637 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/domain/AllocCanteenSuggestion.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/domain/AllocCanteenSuggestion.java @@ -19,9 +19,6 @@ import com.bonus.common.core.web.domain.BaseEntity; public class AllocCanteenSuggestion extends BaseEntity { private static final long serialVersionUID = 1L; - /** 主键自增 */ - private Long id; - /** 投诉建议id */ @Excel(name = "投诉建议id") @ApiModelProperty(value = "投诉建议id") diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/service/impl/AllocCanteenEvaluateServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/service/impl/AllocCanteenEvaluateServiceImpl.java index 4bd41b4..5603821 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/service/impl/AllocCanteenEvaluateServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/service/impl/AllocCanteenEvaluateServiceImpl.java @@ -52,6 +52,9 @@ public class AllocCanteenEvaluateServiceImpl implements IAllocCanteenEvaluateSer @Override public int insertAllocCanteenEvaluate(AllocCanteenEvaluate allocCanteenEvaluate) { allocCanteenEvaluate.setCreateTime(DateUtils.getNowDate()); + allocCanteenEvaluate.setCreateBy(SecurityUtils.getUsername()); + allocCanteenEvaluate.setUserId(SecurityUtils.getUserId()); + allocCanteenEvaluate.setEvaluateDate(DateUtils.getNowDate()); try { return allocCanteenEvaluateMapper.insertAllocCanteenEvaluate(allocCanteenEvaluate); } catch (Exception e) { @@ -68,6 +71,7 @@ public class AllocCanteenEvaluateServiceImpl implements IAllocCanteenEvaluateSer @Override public int updateAllocCanteenEvaluate(AllocCanteenEvaluate allocCanteenEvaluate) { allocCanteenEvaluate.setUpdateTime(DateUtils.getNowDate()); + allocCanteenEvaluate.setUpdateBy(SecurityUtils.getUsername()); try { return allocCanteenEvaluateMapper.updateAllocCanteenEvaluate(allocCanteenEvaluate); } catch (Exception e) { diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/service/impl/AllocCanteenServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/service/impl/AllocCanteenServiceImpl.java index 51dd96b..5222ab5 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/service/impl/AllocCanteenServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/service/impl/AllocCanteenServiceImpl.java @@ -67,11 +67,11 @@ public class AllocCanteenServiceImpl implements IAllocCanteenService { try { AllocCanteen checkResult = allocCanteenMapper.selectAllocCanteenByCanteenName(allocCanteen); if (Objects.nonNull(checkResult)) { - throw new ServiceException("食堂名称已存在"); + throw new ServiceException("该区域食堂名称已存在"); } return allocCanteenMapper.insertAllocCanteen(allocCanteen); } catch (Exception e) { - throw new ServiceException("新增食堂异常," + e.getMessage()); + throw new ServiceException(e.getMessage()); } } @@ -90,11 +90,11 @@ public class AllocCanteenServiceImpl implements IAllocCanteenService { .filter(item -> item.getAreaId().equals(allocCanteen.getAreaId())) .map(AllocCanteen::getCanteenName).collect(Collectors.toList()); if (otherCanteenNameList.contains(allocCanteen.getCanteenName())) { - throw new ServiceException("食堂名称已存在"); + throw new ServiceException("该区域食堂名称已存在"); } return allocCanteenMapper.updateAllocCanteen(allocCanteen); } catch (Exception e) { - throw new ServiceException("更新食堂异常," + e.getMessage()); + throw new ServiceException(e.getMessage()); } } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/service/impl/AllocCanteenSuggestionServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/service/impl/AllocCanteenSuggestionServiceImpl.java index 6961628..a4bdfc0 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/service/impl/AllocCanteenSuggestionServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/service/impl/AllocCanteenSuggestionServiceImpl.java @@ -1,8 +1,11 @@ package com.bonus.canteen.core.alloc.service.impl; import java.util.List; + +import com.bonus.canteen.core.nutrition.common.enums.YesOrNoEnum; import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.utils.DateUtils; +import com.bonus.common.security.utils.SecurityUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.bonus.canteen.core.alloc.mapper.AllocCanteenSuggestionMapper; @@ -51,6 +54,10 @@ public class AllocCanteenSuggestionServiceImpl implements IAllocCanteenSuggestio @Override public int insertAllocCanteenSuggestion(AllocCanteenSuggestion allocCanteenSuggestion) { allocCanteenSuggestion.setCreateTime(DateUtils.getNowDate()); + allocCanteenSuggestion.setCreateBy(SecurityUtils.getUsername()); + allocCanteenSuggestion.setUserId(SecurityUtils.getUserId()); + allocCanteenSuggestion.setSourceType(7L); + allocCanteenSuggestion.setReplyState(YesOrNoEnum.NO.key().longValue()); try { return allocCanteenSuggestionMapper.insertAllocCanteenSuggestion(allocCanteenSuggestion); } catch (Exception e) { @@ -67,6 +74,7 @@ public class AllocCanteenSuggestionServiceImpl implements IAllocCanteenSuggestio @Override public int updateAllocCanteenSuggestion(AllocCanteenSuggestion allocCanteenSuggestion) { allocCanteenSuggestion.setUpdateTime(DateUtils.getNowDate()); + allocCanteenSuggestion.setUpdateBy(SecurityUtils.getUsername()); try { return allocCanteenSuggestionMapper.updateAllocCanteenSuggestion(allocCanteenSuggestion); } catch (Exception e) { diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/service/impl/AllocStallServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/service/impl/AllocStallServiceImpl.java index 2e1e9af..e8b033c 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/service/impl/AllocStallServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/service/impl/AllocStallServiceImpl.java @@ -63,7 +63,7 @@ public class AllocStallServiceImpl implements IAllocStallService { try { AllocStall checkResult = allocStallMapper.selectAllocStallByStallName(allocStall); if (Objects.nonNull(checkResult)) { - throw new ServiceException("档口名称已存在"); + throw new ServiceException("该食堂档口名称已存在"); } int stallCount = allocStallMapper.insertAllocStall(allocStall); if (stallCount > 0 && !CollectionUtils.isEmpty(allocStall.getAllocStallMealtimeList())) { @@ -74,7 +74,7 @@ public class AllocStallServiceImpl implements IAllocStallService { } return stallCount; } catch (Exception e) { - throw new ServiceException("新增档口异常," + e.getMessage()); + throw new ServiceException(e.getMessage()); } } @@ -93,7 +93,7 @@ public class AllocStallServiceImpl implements IAllocStallService { .filter(item -> item.getCanteenId().equals(allocStall.getCanteenId())) .map(AllocStall::getStallName).collect(Collectors.toList()); if (otherStallNameList.contains(allocStall.getStallName())) { - throw new ServiceException("档口名称已存在"); + throw new ServiceException("该食堂档口名称已存在"); } int stallCount = allocStallMapper.updateAllocStall(allocStall); if (stallCount > 0 && !CollectionUtils.isEmpty(allocStall.getAllocStallMealtimeList())) { @@ -102,7 +102,7 @@ public class AllocStallServiceImpl implements IAllocStallService { } return stallCount; } catch (Exception e) { - throw new ServiceException("更新档口异常," + e.getMessage()); + throw new ServiceException(e.getMessage()); } } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/business/OrderBusiness.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/business/OrderBusiness.java index 77abb09..24735b7 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/business/OrderBusiness.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/business/OrderBusiness.java @@ -56,7 +56,7 @@ public class OrderBusiness { @Autowired private IAccWalletInfoService accWalletInfoService; - @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW) + @Transactional(rollbackFor = Exception.class) public List orderPlaceHandler(List orderInfoList) { if(CollUtil.isEmpty(orderInfoList)) { throw new ServiceException("订单明细不能为空"); @@ -128,6 +128,9 @@ public class OrderBusiness { for(OrderInfo orderInfo : orderInfoList) { deductFromWallets(orderInfo, subsidyWalletBal); } + } catch (ServiceException ex) { + log.error("订单支付异常", ex); + throw new ServiceException(ex.getMessage()); } catch (Exception ex) { log.error("订单支付异常", ex); throw new ServiceException("支付失败"); diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/constants/OrderTypeEnum.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/constants/OrderTypeEnum.java index c6603b1..c6d19ca 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/constants/OrderTypeEnum.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/constants/OrderTypeEnum.java @@ -4,7 +4,7 @@ public enum OrderTypeEnum { CURR_MEAL(1, "当餐点餐"), RESERVE_MEAL(2, "预订餐"), BOOK_MEAL(3, "自定义报餐"), - SHOP(4, "商城"), + SHOP(4, "商超"), RESERVE_SHOP(5, "预订商城"), ROOM(6, "包间"), TABLE(7, "餐桌"), diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/controller/OrderInfoController.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/controller/OrderInfoController.java index c9fbccf..071fea3 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/controller/OrderInfoController.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/controller/OrderInfoController.java @@ -70,6 +70,8 @@ public class OrderInfoController extends BaseController if(Objects.isNull(orderQueryParam) || CollUtil.isEmpty(orderQueryParam.getOrderTypeList())) { throw new ServiceException("订单类型不能为空"); } + orderQueryParam.setStartDateTime(orderQueryParam.getStartDate().atTime(0,0,0)); + orderQueryParam.setEndDateTime(orderQueryParam.getEndDate().atTime(23,59,59)); startPage(); List list = orderInfoService.selectOrderInfoList(orderQueryParam); return getDataTable(list); @@ -130,7 +132,18 @@ public class OrderInfoController extends BaseController @ResponseBody public AjaxResult addSave(@RequestBody @Valid OrderAddParam orderAddParam) { - return toAjax(orderInfoService.insertCanteenOrderInfo(orderAddParam)); + try { + orderInfoService.insertCanteenOrderInfo(orderAddParam); + }catch (ServiceException ex) { + if(Integer.valueOf(500001).equals(ex.getCode())) { + return AjaxResult.success(ex.getMessage()); + }else { + return AjaxResult.error(ex.getMessage()); + } + }catch (Exception ex) { + return AjaxResult.error("下单失败"); + } + return AjaxResult.success(); } @SysLog(title = "下单", module = "订单", businessType = OperaType.INSERT) diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/domain/OrderInfo.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/domain/OrderInfo.java index 5942266..b82d81f 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/domain/OrderInfo.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/domain/OrderInfo.java @@ -180,6 +180,12 @@ public class OrderInfo extends BaseEntity private String nickName; + private String phoneNumber; + + private String deptFullName; + + private String areaName; + List orderDetailList; public List of(OrderAddParam param) { diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/domain/OrderRefundHistoryVO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/domain/OrderRefundHistoryVO.java index cf2b7fe..53537bc 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/domain/OrderRefundHistoryVO.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/domain/OrderRefundHistoryVO.java @@ -14,11 +14,13 @@ public class OrderRefundHistoryVO implements Serializable { private Long orderId; private BigDecimal realAmount; private LocalDateTime payTime; - private String payType; + private Integer payType; + private String payTypeName; @JsonIgnore private Long tradeId; private BigDecimal actualAmount; - private String tradeType; + private Integer tradeType; + private String tradeTypeName; private LocalDateTime tradeTime; private String updateBy; } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/domain/param/OrderQueryParam.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/domain/param/OrderQueryParam.java index b7048dd..42b2ae0 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/domain/param/OrderQueryParam.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/domain/param/OrderQueryParam.java @@ -1,13 +1,16 @@ package com.bonus.canteen.core.order.domain.param; +import com.alibaba.excel.util.StringUtils; import com.bonus.common.core.annotation.Excel; import com.bonus.common.core.web.domain.BaseEntity; +import com.bonus.common.houqin.utils.SM4EncryptUtils; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import javax.validation.constraints.NotNull; import java.io.Serializable; +import java.time.LocalDate; import java.time.LocalDateTime; import java.time.temporal.ChronoUnit; import java.util.Date; @@ -52,6 +55,8 @@ public class OrderQueryParam implements Serializable /** 是否在线订单 1 是 2 否 */ private Integer isOnline; + private Long areaId; + /** 食堂id */ private Long canteenId; @@ -117,10 +122,29 @@ public class OrderQueryParam implements Serializable @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime endDateTime; + @ApiModelProperty("开始时间") + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDate startDate; + + @ApiModelProperty("结束时间") + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDate endDate; + private String searchValue; + private String custSearchInfo; + + private String goodsSearchInfo; + + private String encryptedCustSearchValue; + public OrderQueryParam() { this.endDateTime = LocalDateTime.now().plusDays(7); this.startDateTime = LocalDateTime.now().minusDays(7); + this.endDate = LocalDate.now().plusDays(7); + this.startDate = LocalDate.now().minusDays(7); + if(StringUtils.isNotBlank(custSearchInfo)) { + this.encryptedCustSearchValue = SM4EncryptUtils.sm4Encrypt(custSearchInfo); + } } } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/service/impl/OrderInfoServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/service/impl/OrderInfoServiceImpl.java index 07fe49e..903cdae 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/service/impl/OrderInfoServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/service/impl/OrderInfoServiceImpl.java @@ -12,6 +12,8 @@ import com.bonus.canteen.core.account.service.IAccInfoService; import com.bonus.canteen.core.account.service.IAccTradeService; import com.bonus.canteen.core.account.service.IAccWalletInfoService; import com.bonus.canteen.core.account.utils.AccRedisUtils; +import com.bonus.canteen.core.alloc.domain.AllocStall; +import com.bonus.canteen.core.alloc.service.IAllocStallService; import com.bonus.canteen.core.common.utils.MqUtil; import com.bonus.canteen.core.common.utils.RedisUtil; import com.bonus.canteen.core.order.business.OrderBusiness; @@ -30,9 +32,11 @@ import com.bonus.canteen.core.user.domain.DeviceMqPersonalUpdateMessageDTO; import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.utils.DateUtils; import com.bonus.common.core.utils.StringUtils; +import com.bonus.common.houqin.constant.DelFlagEnum; import com.bonus.common.houqin.constant.SourceTypeEnum; import com.bonus.common.houqin.mq.constant.LeMqConstant; import com.bonus.common.houqin.utils.JacksonUtil; +import com.bonus.common.houqin.utils.SM4EncryptUtils; import com.bonus.common.security.utils.SecurityUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -69,6 +73,8 @@ public class OrderInfoServiceImpl implements IOrderInfoService private OrderBusiness orderBusiness; @Autowired private IAccWalletInfoService accWalletInfoService; + @Autowired + private IAllocStallService allocStallService; /** * 查询订单 @@ -119,6 +125,7 @@ public class OrderInfoServiceImpl implements IOrderInfoService orderDetail.setOrderId(order.getOrderId()); List orderDetailList = orderDetailService.selectOrderDetailList(orderDetail); order.setOrderDetailList(orderDetailList); + order.setPhoneNumber(SM4EncryptUtils.sm4Decrypt(order.getPhoneNumber())); }); } return orderInfoList; @@ -135,6 +142,7 @@ public class OrderInfoServiceImpl implements IOrderInfoService AccInfoDetailsVO accInfoVO = this.accInfoService.queryAccInfoByUserId(orderAddParam.getUserId()); accInfoService.checkAccStatus(accInfoVO); List canteenOrderInfoList = new OrderInfo().of(orderAddParam); + checkStallStatus(canteenOrderInfoList); checkOrdersTotalAmount(canteenOrderInfoList, orderAddParam.getRealAmount()); List orderInfoList = orderBusiness.orderPlaceHandler(canteenOrderInfoList); try { @@ -142,13 +150,14 @@ public class OrderInfoServiceImpl implements IOrderInfoService orderBusiness.orderPay(orderInfoList); }catch (Exception ex) { orderBusiness.updateOrderPayFailed(orderInfoList); - throw new ServiceException(ex.getMessage()); + throw new ServiceException(ex.getMessage(), 500001); }finally { AccRedisUtils.unlockUpdateAccWalletBalance(orderAddParam.getUserId()); } return 1; } @Override + @Transactional(rollbackFor = {Exception.class}) public int insertDeviceOrderInfo(DeviceOrderAddParam orderAddParam) { log.info("[食堂设备下单]入参:{}", JacksonUtil.writeValueAsString(orderAddParam)); String paramMd5 = "sc:device_order_"+DigestUtil.md5Hex(JacksonUtil.writeValueAsString(orderAddParam)); @@ -159,6 +168,7 @@ public class OrderInfoServiceImpl implements IOrderInfoService AccInfoDetailsVO accInfoVO = this.accInfoService.queryAccInfoByUserId(orderAddParam.getUserId()); accInfoService.checkAccStatus(accInfoVO); List canteenOrderInfoList = new OrderInfo().of(orderAddParam); + checkStallStatus(canteenOrderInfoList); checkDeviceOrderExisting(canteenOrderInfoList); checkOrdersTotalAmount(canteenOrderInfoList, orderAddParam.getRealAmount()); List orderInfoList = orderBusiness.orderPlaceHandler(canteenOrderInfoList); @@ -175,6 +185,7 @@ public class OrderInfoServiceImpl implements IOrderInfoService } @Override + @Transactional(rollbackFor = {Exception.class}) public int insertShopOrderInfo(ShopOrderAddParam orderAddParam) { log.info("[超市下单]入参:{}", JacksonUtil.writeValueAsString(orderAddParam)); String paramMd5 = "sc:shop_order_"+DigestUtil.md5Hex(JacksonUtil.writeValueAsString(orderAddParam)); @@ -211,6 +222,25 @@ public class OrderInfoServiceImpl implements IOrderInfoService } } + private void checkStallStatus(List orderInfoList) { + if(CollUtil.isEmpty(orderInfoList)) { + throw new ServiceException("订单不能为空"); + } + for(OrderInfo orderInfo : orderInfoList) { + if(orderInfo.getIsOnline() == 1) { + AllocStall allocStall = allocStallService.selectAllocStallByStallId(orderInfo.getStallId()); + if(Objects.isNull(allocStall) || DelFlagEnum.DEL_TRUE.key().toString().equals(allocStall.getDelFlag())) { + throw new ServiceException("档口不存在"); + } + if(1 == allocStall.getBusinessState()) { + throw new ServiceException("档口已休息"); + } + + } + } + + } + @Override public void pay(Long orderId) { if(Objects.isNull(orderId) || orderId <= 0) { @@ -245,7 +275,14 @@ public class OrderInfoServiceImpl implements IOrderInfoService @Override public List orderRefundHistory(OrderRefundHistoryParam param) { - return orderInfoMapper.orderRefundHistory(param); + List list = orderInfoMapper.orderRefundHistory(param); + if(CollUtil.isNotEmpty(list)) { + list.forEach(orderRefundHistoryVO -> { + orderRefundHistoryVO.setPayTypeName(PayTypeEnum.getDescByKey(orderRefundHistoryVO.getPayType())); + orderRefundHistoryVO.setTradeTypeName(AccTradeTypeEnum.getDescByKey(orderRefundHistoryVO.getTradeType())); + }); + } + return list; } @Override diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/pay/constants/PayTypeEnum.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/pay/constants/PayTypeEnum.java index 7381ec8..2dc5b91 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/pay/constants/PayTypeEnum.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/pay/constants/PayTypeEnum.java @@ -119,5 +119,13 @@ public enum PayTypeEnum { return this.desc; } + public static String getDescByKey(Integer targetKey) { + for (PayTypeEnum payType : PayTypeEnum.values()) { + if (payType.getKey().equals(targetKey)) { + return payType.getDesc(); + } + } + return ""; + } } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/controller/SupermarketInfoController.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/controller/SupermarketInfoController.java index d6b50e8..9c617ec 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/controller/SupermarketInfoController.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/controller/SupermarketInfoController.java @@ -1,5 +1,9 @@ package com.bonus.canteen.core.supermarket.controller; +import com.bonus.canteen.core.order.domain.OrderInfo; +import com.bonus.canteen.core.order.domain.param.OrderQueryParam; +import com.bonus.canteen.core.order.service.IOrderInfoService; +import com.bonus.canteen.core.supermarket.domain.ShopOrderQueryParam; import com.bonus.canteen.core.supermarket.domain.SupermarketInfo; import com.bonus.canteen.core.supermarket.service.SupermarketInfoService; import com.bonus.common.core.utils.poi.ExcelUtil; @@ -10,10 +14,12 @@ import com.bonus.common.log.annotation.SysLog; import com.bonus.common.log.enums.OperaType; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; import java.util.List; /** @@ -28,6 +34,8 @@ import java.util.List; public class SupermarketInfoController extends BaseController { @Autowired private SupermarketInfoService supermarketInfoService; + @Autowired + private IOrderInfoService orderInfoService; /** * @author jsk @@ -86,4 +94,16 @@ public class SupermarketInfoController extends BaseController { return toAjax(supermarketInfoService.deleteSupermarketInfoBySupermarketId(supermarketInfo)); } + @ApiOperation(value = "查询超市订单列表") + @PostMapping("/order/list") + public TableDataInfo orderList(@RequestBody @Valid ShopOrderQueryParam shopOrderQueryParam) { + startPage(); + shopOrderQueryParam.setStartDateTime(shopOrderQueryParam.getStartDate().atTime(0,0,0)); + shopOrderQueryParam.setEndDateTime(shopOrderQueryParam.getEndDate().atTime(23,59,59)); + OrderQueryParam orderQueryParam = new OrderQueryParam(); + BeanUtils.copyProperties(shopOrderQueryParam, orderQueryParam); + List list = orderInfoService.selectOrderInfoList(orderQueryParam); + return getDataTable(list); + } + } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/domain/ShopOrderQueryParam.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/domain/ShopOrderQueryParam.java new file mode 100644 index 0000000..9303cd8 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/domain/ShopOrderQueryParam.java @@ -0,0 +1,137 @@ +package com.bonus.canteen.core.supermarket.domain; + +import com.alibaba.excel.util.StringUtils; +import com.bonus.common.houqin.utils.SM4EncryptUtils; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.Date; +import java.util.List; + +/** + * 订单对象 order_info + * + * @author ruoyi + * @date 2025-04-14 + */ + +@Data +public class ShopOrderQueryParam implements Serializable +{ + private static final long serialVersionUID = 1L; + + /** 设备订单号 */ + private String deviceOrderId; + + /** 设备sn */ + private String deviceSn; + + private Long orderId; + + private List orderIdList; + + private List deptIdList; + + /** 设备编号 */ + private String deviceNum; + + /** 人员编号 */ + private Long userId; + + /** 身份验证方式 1 刷卡 2 刷脸 3 扫码 */ + private Integer identityVerification; + + /** 订单来源类型 */ + private Integer sourceType; + + /** 是否在线订单 1 是 2 否 */ + private Integer isOnline; + + private Long areaId; + + /** 食堂id */ + private Long canteenId; + + private List canteenIdList; + + /** 档口id */ + private Long stallId; + + private List stallIdList; + + /** 餐次类型 1-早餐 2-午餐 3-晚餐 4-下午茶 5-夜宵 */ + private Integer mealtimeType; + + private List mealtimeTypeList; + + /** 订单日期 yyyy-MM-dd */ + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private Date orderDate; + + /** 下单时间 yyyy-MM-dd HH:mm:ss */ + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private Date orderTime; + + /** 订单类型 1 当餐 2 预订餐 3 报餐 4 商城 11 线下消费 12 自助餐 21 补扣 22 外部订单 */ + @NotNull(message = "订单类型不能为空") + private Integer orderType; + + private List orderTypeList; + + /** 订单状态 1 已下单 2 已完成 3 已取消 */ + private Integer orderState; + + private List orderStateList; + + /** 订单退款状态 1 未退单 2 已退单 3 部分退单 */ + private Integer orderRefundState; + + /** 扣款类型 1 下单扣款 2 核销扣款 */ + private Integer deductionType; + + /** 支付时间 yyyy-MM-dd HH:mm:ss */ + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private Date payTime; + + /** 支付方式 */ + private Integer payType; + + /** 支付渠道 */ + private Integer payChannel; + + /** 支付状态 1 待支付 2 支付中 3 支付成功 4 支付失败 5 支付取消 6 部分支付 */ + private Integer payState; + + private List payStateList; + + /** 评论状态 1 已评论 2 未评论 */ + private Integer commentState; + + @ApiModelProperty("开始时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime startDateTime; + + @ApiModelProperty("结束时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime endDateTime; + + @ApiModelProperty("开始时间") + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDate startDate; + + @ApiModelProperty("结束时间") + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDate endDate; + + private String custSearchInfo; + + public ShopOrderQueryParam() { + this.endDate = LocalDate.now().plusDays(7); + this.startDate = LocalDate.now().minusDays(7); + } +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/user/service/impl/UserAddrServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/user/service/impl/UserAddrServiceImpl.java index cd2b2ca..e80d729 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/user/service/impl/UserAddrServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/user/service/impl/UserAddrServiceImpl.java @@ -3,6 +3,7 @@ package com.bonus.canteen.core.user.service.impl; import java.util.List; import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.utils.DateUtils; +import com.bonus.common.houqin.utils.id.Id; import com.bonus.common.security.utils.SecurityUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -54,6 +55,7 @@ public class UserAddrServiceImpl implements IUserAddrService { public int insertUserAddr(UserAddr userAddr) { userAddr.setCreateTime(DateUtils.getNowDate()); userAddr.setUserId(SecurityUtils.getUserId()); + userAddr.setAddrId(Id.next()); try { return userAddrMapper.insertUserAddr(userAddr); } catch (Exception e) { diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/account/AccCardMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/account/AccCardMapper.xml index 8fdcc1b..7d9a317 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/account/AccCardMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/account/AccCardMapper.xml @@ -70,6 +70,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where user_id = #{userId} and card_status in (1,4,5) + + + + \ No newline at end of file diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/alloc/AllocCanteenSuggestionMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/alloc/AllocCanteenSuggestionMapper.xml index 5f8e2b1..bd9601c 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/alloc/AllocCanteenSuggestionMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/alloc/AllocCanteenSuggestionMapper.xml @@ -4,7 +4,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - @@ -22,7 +21,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select id, complaint_id, user_id, content, canteen_id, complaint_picture, source_type, mobile, reply_content, revision, reply_state, create_by, create_time, update_by, update_time from alloc_canteen_suggestion + select complaint_id, user_id, content, canteen_id, complaint_picture, source_type, mobile, + reply_content, revision, reply_state, create_by, create_time, update_by, update_time + from alloc_canteen_suggestion - where id = #{id} + where complaint_id = #{complaintId} - + insert into alloc_canteen_suggestion - complaint_id, user_id, content, canteen_id, @@ -65,7 +65,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update_time, - #{complaintId}, #{userId}, #{content}, #{canteenId}, @@ -85,7 +84,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update alloc_canteen_suggestion - complaint_id = #{complaintId}, user_id = #{userId}, content = #{content}, canteen_id = #{canteenId}, @@ -100,17 +98,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update_by = #{updateBy}, update_time = #{updateTime}, - where id = #{id} + where complaint_id = #{complaintId} - delete from alloc_canteen_suggestion where id = #{id} + delete from alloc_canteen_suggestion where complaint_id = #{complaintId} - delete from alloc_canteen_suggestion where id in - - #{id} + delete from alloc_canteen_suggestion where complaint_id in + + #{complaintId} \ No newline at end of file diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/order/OrderInfoMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/order/OrderInfoMapper.xml index da8d2b6..73959fb 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/order/OrderInfoMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/order/OrderInfoMapper.xml @@ -57,11 +57,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" oi.refund_amount, oi.order_time, oi.order_type, oi.order_state, oi.order_refund_state, oi.deduction_type, oi.pay_time, oi.pay_type, oi.pay_channel, oi.pay_state, oi.pay_param, oi.delivery_amount, oi.packing_amount, oi.delivery_type, oi.comment_state, oi.remark, - di.device_name, su.nick_name, oi.create_by, oi.create_time, oi.update_by, oi.update_time + di.device_name, su.nick_name, oi.create_by, oi.create_time, oi.update_by, oi.update_time, + su.phonenumber as phoneNumber, sd.dept_full_name, aa.area_name from order_info oi left join alloc_canteen ac on ac.canteen_id = oi.canteen_id left join alloc_stall ast on ast.stall_id = oi.stall_id + left join alloc_area aa on aa.area_id = ac.area_id left join sys_user su on oi.user_id = su.user_id + left join sys_dept sd on sd.dept_id = su.dept_id left join device_info di on oi.device_sn = di.device_sn @@ -83,6 +86,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and oi.source_type = #{sourceType} and oi.is_online = #{isOnline} and oi.canteen_id = #{canteenId} + and ac.area_id = #{areaId} and oi.canteen_id in @@ -148,6 +152,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and od.goods_name like concat('%', #{searchValue}, '%')) ) + + and ( + su.nick_name like CONCAT('%',#{custSearchInfo},'%') + or su.phonenumber = #{encryptedCustSearchValue} + or su.user_id like concat('%', #{custSearchInfo}, '%') + ) + + + and ( + EXISTS (select 1 from order_detail od + where oi.order_id = od.order_id + and od.goods_name like concat('%', #{goodsSearchInfo}, '%')) + ) + order by oi.create_time desc diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/report/AccReportMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/report/AccReportMapper.xml index dc4aa29..520496e 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/report/AccReportMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/report/AccReportMapper.xml @@ -132,6 +132,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" b.phonenumber, b.dept_id, b.dept_name, + b.dept_full_name, b.nick_name, c.wallet_bal_user as wallet_bal, c.wallet_bal_user as wallet_bal_now, diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/report/TradeReportMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/report/TradeReportMapper.xml index 2526943..750a71c 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/report/TradeReportMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/report/TradeReportMapper.xml @@ -52,6 +52,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" or su.user_id like concat('%', #{param.searchValue}, '%') ) + order by at2.trade_time desc