Commit 3ca4d962 by 刘鹏飞

Merge remote-tracking branch 'origin/feature/coco_new-刘鹏飞' into develop

parents 2f5633d7 8e410187
...@@ -1951,7 +1951,7 @@ public class OrderSdkAdapter { ...@@ -1951,7 +1951,7 @@ public class OrderSdkAdapter {
* *
* @return * @return
*/ */
private Integer getOldOrderAccountType(int newOrderAccountType) { public Integer getOldOrderAccountType(int newOrderAccountType) {
// 新订单服务枚举 OrderSettlementType // 新订单服务枚举 OrderSettlementType
switch (newOrderAccountType) { switch (newOrderAccountType) {
case 1: case 1:
......
...@@ -17,12 +17,35 @@ import lombok.Data; ...@@ -17,12 +17,35 @@ import lombok.Data;
*/ */
@Data @Data
public class CouponCodeBaseDto { public class CouponCodeBaseDto {
/**
* 版本号
*/
private Integer ver; private Integer ver;
// 71代表核销
/**
* 操作类型:71核销,0查询,3冲正
*/
private Integer reqtype; private Integer reqtype;
/**
* 商户号
*/
private String partnerId; private String partnerId;
/**
* 门店号
*/
private String store_id; private String store_id;
/**
* 线下pos编号, 除coco外,其他商户必填
*/
private String station_id; private String station_id;
/**
* 操作员编号,除coco外,其他商户必填
*/
private String operator_id; private String operator_id;
// 组织机构ID,(String 类型的集合) // 组织机构ID,(String 类型的集合)
......
...@@ -18,11 +18,30 @@ import java.util.List; ...@@ -18,11 +18,30 @@ import java.util.List;
*/ */
@Data @Data
public class CouponCodeVerificationDto extends CouponCodeBaseDto { public class CouponCodeVerificationDto extends CouponCodeBaseDto {
/**
* 流水号
*/
private String trans_id; private String trans_id;
/**
* 核销时间:yyyy-MM-dd
*/
private String business_date; private String business_date;
/**
* 渠道,例如:pickup,delivery
*/
private String channel; private String channel;
/**
* 会员编号
*/
private String memberId; private String memberId;
/**
* 核销交易信息
*/
private List<CouponCodeVerificationTransDto> transactions; private List<CouponCodeVerificationTransDto> transactions;
} }
...@@ -2,6 +2,8 @@ package cn.freemud.entities.dto; ...@@ -2,6 +2,8 @@ package cn.freemud.entities.dto;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal;
/** /**
* All rights Reserved, Designed By www.freemud.cn * All rights Reserved, Designed By www.freemud.cn
* *
...@@ -16,8 +18,44 @@ import lombok.Data; ...@@ -16,8 +18,44 @@ import lombok.Data;
*/ */
@Data @Data
public class CouponCodeVerificationProductDto { public class CouponCodeVerificationProductDto {
private Integer seq ;
private String pID; /**
* 核销数量
*/
private Integer consume_num ; private Integer consume_num ;
/**
* 商品编号
*/
private String pID;
/**
* BigDecimal, 暂未使用
*/
private BigDecimal redeem_price;
/**
* 商品序号或者行数
*/
private Integer seq ;
/**
* 商品名称
*/
private String productName ;
/**
* 线下原价,单位:分
*/
private Integer initPrice ;
/**
* 优惠后价格,单位:分
*/
private Integer nowPrice ;
/**
* 应收金额,单位:分
*/
private Integer payMoney ;
} }
...@@ -19,8 +19,41 @@ import java.util.List; ...@@ -19,8 +19,41 @@ import java.util.List;
*/ */
@Data @Data
public class CouponCodeVerificationTransDto { public class CouponCodeVerificationTransDto {
/**
* 券号
*/
private String code; private String code;
private String ebcode; //private String ebcode;
private Integer totalAmount;
/**
* 实收金额单位:分
*/
private Integer pay_amount;
/**
* 商品信息
*/
private List<CouponCodeVerificationProductDto> products; private List<CouponCodeVerificationProductDto> products;
/**
* 总优惠金额单位:分
*/
private Integer totalAmount;
/**
* 订单号,coco核销使用
*/
private String orderNumber;
/**
* 应收金额,单位:分,coco核销使用
*/
private Integer amountRec;
/**
* 实收金额,单位:分
*/
private Integer amountPaid;
} }
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
package cn.freemud.entities.dto; package cn.freemud.entities.dto;
import com.freemud.application.sdk.api.ordercenter.response.orderInfo.OrderCostResp; import com.freemud.application.sdk.api.ordercenter.response.orderInfo.OrderCostResp;
import com.freemud.application.sdk.api.ordercenter.response.orderInfo.OrderSettlementResp;
import com.freemud.sdk.api.assortment.order.response.order.QueryOrdersResponse; import com.freemud.sdk.api.assortment.order.response.order.QueryOrdersResponse;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
...@@ -196,6 +197,8 @@ public class QueryOrdersResponseDto { ...@@ -196,6 +197,8 @@ public class QueryOrdersResponseDto {
private List<ProductBean> productList; private List<ProductBean> productList;
private List<RefundBean> refundList; private List<RefundBean> refundList;
private List<OrderSettlementResp> orderSettlementDetailList;
private AddDeliveryInfo addInfo; private AddDeliveryInfo addInfo;
private List<OrderCostResp> orderCostDetailList; private List<OrderCostResp> orderCostDetailList;
......
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @Title: OrderRelationFactory
* @Description:
* @author: pengfei.liu
* @date: 2020/11/23
* @version V1.0
* @Copyright: 2020 www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
*/
package cn.freemud.service.coupon;
public interface CouponRelationFactory {
/**
* 获取优惠券核销参数构建实现类
* @param partnerId
* @return
*/
CouponRelationService getVerificationCouponService(String partnerId);
}
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @Title: OrderRelationService
* @Description:
* @author: pengfei.liu
* @date: 2020/11/23
* @version V1.0
* @Copyright: 2020 www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
*/
package cn.freemud.service.coupon;
import cn.freemud.base.entity.BaseResponse;
import cn.freemud.entities.dto.QueryOrdersResponseDto;
import cn.freemud.entities.vo.CreateOrderVo;
import cn.freemud.entities.vo.QueryOrderResponseVo;
import cn.freemud.enums.CouponReqType;
import com.freemud.application.sdk.api.storecenter.response.StoreResponse;
import com.freemud.sdk.api.assortment.order.response.order.QueryOrderByIdResponse;
import java.util.List;
public interface CouponRelationService {
/**
* 获取优惠券核销参数构建实现类
* @param
*/
BaseResponse verificationCoupon(List<QueryOrdersResponseDto.DataBean.OrderBean.AccountBean> accountList,
QueryOrdersResponseDto.DataBean.OrderBean orderBean,
CouponReqType couponReqType);
}
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @Title: OrderRelationFactoryImpl
* @Description:
* @author: pengfei.liu
* @date: 2020/11/23
* @version V1.0
* @Copyright: 2020 www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
*/
package cn.freemud.service.coupon.impl;
import cn.freemud.service.coupon.CouponRelationFactory;
import cn.freemud.service.coupon.CouponRelationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class CounponRelationFactoryImpl implements CouponRelationFactory {
/**
* coco商户
*/
@Value("#{'${coco.partnerId}'.split(',')}")
private List<String> cocoPartnerId;
/**
* coco的订单相关
*/
@Autowired
@Qualifier("cocoCouponRelationService")
CouponRelationService cocoCouponRelationService;
/**
* 平台的订单相关
*/
@Autowired
@Qualifier("platformCouponRelationService")
CouponRelationService platformCouponRelationService;
@Override
public CouponRelationService getVerificationCouponService(String partnerId) {
if(cocoPartnerId.contains(partnerId)){
return cocoCouponRelationService;
}else{
return platformCouponRelationService;
}
}
}
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @Title: PlatformOrderRelationServiceImpl
* @Description:
* @author: pengfei.liu
* @date: 2020/11/23
* @version V1.0
* @Copyright: 2020 www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
*/
package cn.freemud.service.coupon.impl;
import cn.freemud.adapter.CouponAdapter;
import cn.freemud.base.entity.BaseResponse;
import cn.freemud.entities.dto.CouponCodeResponseDto;
import cn.freemud.entities.dto.CouponCodeVerificationDto;
import cn.freemud.entities.dto.CouponCodeVerificationProductDto;
import cn.freemud.entities.dto.QueryOrdersResponseDto;
import cn.freemud.entities.vo.CreateOrderVo;
import cn.freemud.entities.vo.QueryOrderResponseVo;
import cn.freemud.enums.ActivityChannelEnum;
import cn.freemud.enums.CouponReqType;
import cn.freemud.enums.OrderAccountType;
import cn.freemud.enums.ResponseResult;
import cn.freemud.service.coupon.CouponRelationFactory;
import cn.freemud.service.coupon.CouponRelationService;
import cn.freemud.service.impl.StoreServiceImpl;
import cn.freemud.service.order.OrderRelationService;
import cn.freemud.service.thirdparty.CouponOfflineClient;
import cn.freemud.utils.LogUtil;
import cn.freemud.utils.PropertyConvertUtil;
import cn.freemud.utils.ResponseUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.freemud.application.sdk.api.couponcenter.offline.service.OfflineCouponSdkService;
import com.freemud.application.sdk.api.log.ErrorLog;
import com.freemud.application.sdk.api.log.ThirdPartyLog;
import com.freemud.application.sdk.api.service.EmailAlertService;
import com.freemud.application.sdk.api.storecenter.response.StoreResponse;
import com.freemud.sdk.api.assortment.order.response.order.QueryOrderByIdResponse;
import com.google.common.base.Throwables;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
@Service("platformCouponRelationService")
public class PlatformCouponRelationServiceImpl implements CouponRelationService {
@Autowired
private CouponAdapter couponAdapter;
@Autowired
private CouponOfflineClient couponOfflineClient;
@Autowired
private EmailAlertService emailAlertService;
@Autowired
private StoreServiceImpl storeService;
@Override
public BaseResponse verificationCoupon(List<QueryOrdersResponseDto.DataBean.OrderBean.AccountBean> accountList, QueryOrdersResponseDto.DataBean.OrderBean orderBean, CouponReqType couponReqType) {
for (QueryOrdersResponseDto.DataBean.OrderBean.AccountBean accountBean : accountList) {
List<CouponCodeVerificationProductDto> products = new ArrayList<>();
//商品券核销核销参数
if (OrderAccountType.PRODUCT_COUPON.getCode().equals(accountBean.getType())) {
for (int i = 0; i < orderBean.getProductList().size(); i++) {
QueryOrdersResponseDto.DataBean.OrderBean.ProductBean productBean = orderBean.getProductList().get(i);
String pid = StringUtils.isNotBlank(productBean.getSpecification()) ? productBean.getSpecification() : productBean.getProductId();
if (!org.springframework.util.CollectionUtils.isEmpty(orderBean.getProductList().get(i).getDiscountList())) {
List<QueryOrdersResponseDto.DataBean.OrderBean.ProductBean.ProductDiscount> discounts = orderBean.getProductList().get(i).getDiscountList().stream().
filter(productDiscount -> productDiscount.getDiscountId().equals(accountBean.getAccountId())).collect(Collectors.toList());
for (QueryOrdersResponseDto.DataBean.OrderBean.ProductBean.ProductDiscount productDiscount : discounts) {
if (productDiscount.getDiscountType() == null || productDiscount.getDiscountType() == 0) {
continue;
}
CouponCodeVerificationProductDto couponCodeVerificationProductDto = new CouponCodeVerificationProductDto();
couponCodeVerificationProductDto.setPID(pid);
couponCodeVerificationProductDto.setConsume_num(productDiscount.getDiscountQty());
couponCodeVerificationProductDto.setSeq(i + 1);
products.add(couponCodeVerificationProductDto);
}
}
}
}
Integer orderType = orderBean.getType();
ActivityChannelEnum activityChannelEnum = PropertyConvertUtil.orderTypeEnumConvert2ActivityChannel(orderType);
if (activityChannelEnum == null) {
activityChannelEnum = ActivityChannelEnum.pickup;
}
if (OrderAccountType.COUPON.getCode().equals(accountBean.getType())
|| OrderAccountType.PRODUCT_COUPON.getCode().equals(accountBean.getType())
|| OrderAccountType.DISCOUNT_COUPON.getCode().equals(accountBean.getType())) {
CouponCodeVerificationDto couponCodeVerificationDto = couponAdapter.convert2CouponCodeVerificationDto(activityChannelEnum, accountBean.getAccountId(), orderBean.getOid(), orderBean.getCompanyId(), orderBean.getShopId(), orderBean.getUserId(), products, accountBean.getPrice().intValue(),couponReqType);
// 核销券新增参数:组织机构ID
couponCodeVerificationDto.setChannel_codes(storeService.getOrgIdsArr(orderBean.getCompanyId(), orderBean.getShopId()));
try {
//71.券核销
for (int i = 2; i >= 0; i--) {
LogUtil.info("核销券码开始==", JSON.toJSONString(couponCodeVerificationDto), null);
CouponCodeResponseDto couponCodeResponseDto = couponOfflineClient.verification(couponCodeVerificationDto);
LogUtil.info("核销券码返回==", JSON.toJSONString(couponCodeVerificationDto), null);
ThirdPartyLog.infoConvertJson(System.currentTimeMillis(), System.currentTimeMillis(), "/api", couponCodeVerificationDto, couponCodeResponseDto);
if (Objects.equals(couponCodeResponseDto.getStatusCode(), ResponseResult.SUCCESS.getCode())) {
LogUtil.info("CouponReverseServiceImpl", JSON.toJSONString(couponCodeVerificationDto), JSON.toJSONString(couponCodeResponseDto));
break;
}
if (!Objects.equals(couponCodeResponseDto.getStatusCode(), ResponseResult.SUCCESS.getCode())) {
emailAlertService.sendEmailAlert("核销券码失败", String.format("request:%s \r\nresponse:%s", JSONObject.toJSONString(couponCodeVerificationDto), JSONObject.toJSONString(couponCodeResponseDto)));
return ResponseUtil.error(ResponseResult.COUPON_VERIFICATION_FAIL);
}
}
} catch (Exception ex) {
emailAlertService.sendEmailAlert("核销券码异常", String.format("request:%s \r\nexception:%s", JSONObject.toJSONString(couponCodeVerificationDto), Throwables.getStackTraceAsString(ex)));
ErrorLog.printErrorLog("verification_error", "/api", couponCodeVerificationDto, ex);
return ResponseUtil.error(ResponseResult.COUPON_VERIFICATION_FAIL);
}
}
}
return ResponseUtil.success();
}
}
...@@ -9,6 +9,8 @@ import cn.freemud.entities.vo.ActivityCouponBean; ...@@ -9,6 +9,8 @@ import cn.freemud.entities.vo.ActivityCouponBean;
import cn.freemud.enums.*; import cn.freemud.enums.*;
import cn.freemud.service.CouponActivityService; import cn.freemud.service.CouponActivityService;
import cn.freemud.service.StoreService; import cn.freemud.service.StoreService;
import cn.freemud.service.coupon.CouponRelationFactory;
import cn.freemud.service.coupon.CouponRelationService;
import cn.freemud.service.thirdparty.CouponClient; import cn.freemud.service.thirdparty.CouponClient;
import cn.freemud.service.thirdparty.CouponOfflineClient; import cn.freemud.service.thirdparty.CouponOfflineClient;
import cn.freemud.utils.LogUtil; import cn.freemud.utils.LogUtil;
...@@ -29,6 +31,7 @@ import com.google.gson.Gson; ...@@ -29,6 +31,7 @@ import com.google.gson.Gson;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.*; import java.util.*;
...@@ -41,6 +44,12 @@ import java.util.stream.Collectors; ...@@ -41,6 +44,12 @@ import java.util.stream.Collectors;
@Service @Service
public class CouponActivityServiceImpl implements CouponActivityService { public class CouponActivityServiceImpl implements CouponActivityService {
/**
* coco商户
*/
@Value("#{'${coco.partnerId}'.split(',')}")
private List<String> cocoPartnerId;
@Autowired @Autowired
private CouponAdapter couponAdapter; private CouponAdapter couponAdapter;
@Autowired @Autowired
...@@ -52,6 +61,9 @@ public class CouponActivityServiceImpl implements CouponActivityService { ...@@ -52,6 +61,9 @@ public class CouponActivityServiceImpl implements CouponActivityService {
@Autowired @Autowired
private StoreServiceImpl storeService; private StoreServiceImpl storeService;
@Autowired
private CouponRelationFactory couponRelationFactory;
/** /**
* 核销优惠券 * 核销优惠券
* *
...@@ -63,67 +75,10 @@ public class CouponActivityServiceImpl implements CouponActivityService { ...@@ -63,67 +75,10 @@ public class CouponActivityServiceImpl implements CouponActivityService {
if (CollectionUtils.isEmpty(accountList) || CollectionUtils.isEmpty(orderBean.getProductList())) { if (CollectionUtils.isEmpty(accountList) || CollectionUtils.isEmpty(orderBean.getProductList())) {
return ResponseUtil.success(); return ResponseUtil.success();
} }
for (QueryOrdersResponseDto.DataBean.OrderBean.AccountBean accountBean : accountList) {
List<CouponCodeVerificationProductDto> products = new ArrayList<>();
//商品券核销核销参数
if (OrderAccountType.PRODUCT_COUPON.getCode().equals(accountBean.getType())) {
for (int i = 0; i < orderBean.getProductList().size(); i++) {
QueryOrdersResponseDto.DataBean.OrderBean.ProductBean productBean = orderBean.getProductList().get(i);
String pid = StringUtils.isNotBlank(productBean.getSpecification()) ? productBean.getSpecification() : productBean.getProductId();
if (!org.springframework.util.CollectionUtils.isEmpty(orderBean.getProductList().get(i).getDiscountList())) {
List<QueryOrdersResponseDto.DataBean.OrderBean.ProductBean.ProductDiscount> discounts = orderBean.getProductList().get(i).getDiscountList().stream().
filter(productDiscount -> productDiscount.getDiscountId().equals(accountBean.getAccountId())).collect(Collectors.toList());
for (QueryOrdersResponseDto.DataBean.OrderBean.ProductBean.ProductDiscount productDiscount : discounts) {
if (productDiscount.getDiscountType() == null || productDiscount.getDiscountType() == 0) {
continue;
}
CouponCodeVerificationProductDto couponCodeVerificationProductDto = new CouponCodeVerificationProductDto();
couponCodeVerificationProductDto.setPID(pid);
couponCodeVerificationProductDto.setConsume_num(productDiscount.getDiscountQty());
couponCodeVerificationProductDto.setSeq(i + 1);
products.add(couponCodeVerificationProductDto);
}
}
}
}
Integer orderType = orderBean.getType(); // 平台走老的逻辑,cooc定制参数
ActivityChannelEnum activityChannelEnum = PropertyConvertUtil.orderTypeEnumConvert2ActivityChannel(orderType); CouponRelationService couponRelationService = couponRelationFactory.getVerificationCouponService(orderBean.getCompanyId());
if (activityChannelEnum == null) { return couponRelationService.verificationCoupon(accountList,orderBean,couponReqType);
activityChannelEnum = ActivityChannelEnum.pickup;
}
if (OrderAccountType.COUPON.getCode().equals(accountBean.getType())
|| OrderAccountType.PRODUCT_COUPON.getCode().equals(accountBean.getType())
|| OrderAccountType.DISCOUNT_COUPON.getCode().equals(accountBean.getType())) {
CouponCodeVerificationDto couponCodeVerificationDto = couponAdapter.convert2CouponCodeVerificationDto(activityChannelEnum, accountBean.getAccountId(), orderBean.getOid(), orderBean.getCompanyId(), orderBean.getShopId(), orderBean.getUserId(), products, accountBean.getPrice().intValue(),couponReqType);
// 核销券新增参数:组织机构ID
couponCodeVerificationDto.setChannel_codes(storeService.getOrgIdsArr(orderBean.getCompanyId(), orderBean.getShopId()));
try {
//71.券核销
for (int i = 2; i >= 0; i--) {
LogUtil.info("核销券码开始==", JSON.toJSONString(couponCodeVerificationDto), null);
CouponCodeResponseDto couponCodeResponseDto = couponOfflineClient.verification(couponCodeVerificationDto);
LogUtil.info("核销券码返回==", JSON.toJSONString(couponCodeVerificationDto), null);
ThirdPartyLog.infoConvertJson(System.currentTimeMillis(), System.currentTimeMillis(), "/api", couponCodeVerificationDto, couponCodeResponseDto);
if (Objects.equals(couponCodeResponseDto.getStatusCode(), ResponseResult.SUCCESS.getCode())) {
LogUtil.info("CouponReverseServiceImpl", JSON.toJSONString(couponCodeVerificationDto), JSON.toJSONString(couponCodeResponseDto));
break;
}
if (!Objects.equals(couponCodeResponseDto.getStatusCode(), ResponseResult.SUCCESS.getCode())) {
emailAlertService.sendEmailAlert("核销券码失败", String.format("request:%s \r\nresponse:%s", JSONObject.toJSONString(couponCodeVerificationDto), JSONObject.toJSONString(couponCodeResponseDto)));
return ResponseUtil.error(ResponseResult.COUPON_VERIFICATION_FAIL);
}
}
} catch (Exception ex) {
emailAlertService.sendEmailAlert("核销券码异常", String.format("request:%s \r\nexception:%s", JSONObject.toJSONString(couponCodeVerificationDto), Throwables.getStackTraceAsString(ex)));
ErrorLog.printErrorLog("verification_error", "/api", couponCodeVerificationDto, ex);
return ResponseUtil.error(ResponseResult.COUPON_VERIFICATION_FAIL);
}
}
}
return ResponseUtil.success();
} }
@Override @Override
......
...@@ -58,6 +58,8 @@ import cn.freemud.interceptor.ServiceException; ...@@ -58,6 +58,8 @@ import cn.freemud.interceptor.ServiceException;
import cn.freemud.management.thirdparty.MulitiPaymentClient; import cn.freemud.management.thirdparty.MulitiPaymentClient;
import cn.freemud.redis.RedisCache; import cn.freemud.redis.RedisCache;
import cn.freemud.service.*; import cn.freemud.service.*;
import cn.freemud.service.coupon.CouponRelationFactory;
import cn.freemud.service.coupon.CouponRelationService;
import cn.freemud.service.order.OrderRelationFactory; import cn.freemud.service.order.OrderRelationFactory;
import cn.freemud.service.order.OrderRelationService; import cn.freemud.service.order.OrderRelationService;
import cn.freemud.service.thirdparty.*; import cn.freemud.service.thirdparty.*;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment