Browse Source

设置B端发券工作流

release_toaliyun_real
xiaohanzi 5 years ago
parent
commit
dffd2efbd7
3 changed files with 64 additions and 2 deletions
  1. +58
    -0
      mallinkBApi/src/main/java/com/iformall/controller/WxCouponController.java
  2. +2
    -0
      mallinkService/src/main/java/com/iformall/enums/EnumFlowKey.java
  3. +4
    -2
      mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java

+ 58
- 0
mallinkBApi/src/main/java/com/iformall/controller/WxCouponController.java View File

@@ -8,6 +8,7 @@ import com.iformall.common.ResultData;
import com.iformall.domain.po.WxCoupon;
import com.iformall.domain.po.WxCouponChannel;
import com.iformall.domain.po.WxCouponPassword;
import com.iformall.domain.po.WxFlowModel;
import com.iformall.domain.po.WxMerchant;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.domain.vo.WxCouponStatisVo;
@@ -101,6 +102,63 @@ public class WxCouponController extends BaseController {
return wxCouponService.list(wxCoupon, pageNum, pageSize); //全列表
}

private Map<String,Object> generateFlowParams(EnumFlowKey flowType,EnumCouponAppType approvalType, Long couponId,String remark) {
Map<String,Object> map = new HashMap<String,Object>();
map.put("businessId", String.valueOf(couponId));
map.put("businessType", flowType.getCode());
map.put("remark", remark);
List<Map> variablesList = new ArrayList<Map>();
Map contractTypeMap = new HashMap<String,Object>();
contractTypeMap.put("key","approvalType");
contractTypeMap.put("value",String.valueOf(approvalType.getCode()));
variablesList.add(contractTypeMap);
map.put("variables", variablesList);
return map;
}
private boolean hasFlow(EnumFlowKey flowType,TenantEntity tenantEntity) {
WxFlowModel wxFlowModel = new WxFlowModel();
wxFlowModel.setFlowType(flowType.getCode());
wxFlowModel.updateTenantInfo(tenantEntity);
List<WxFlowModel> flows = wxFlowService.getModelBybusiness(wxFlowModel);
if (null != flows && flows.size() > 0) {
return true;
}
return false;
}

@ApiOperation("查询是否有审批流程")
@PostMapping("hasFlow")
public ResultData hasFlow() {
if (hasFlow(EnumFlowKey.B_COUPON_MERCHANT_CREATE,getTenantInfo())) {
return new ResultData(1);
}else {
return new ResultData(0);
}
}
@ApiOperation("提交审批")
@PostMapping("apply")
public ResultData apply(@RequestBody WxCoupon wxCoupon) {
logger.debug("[" + getIpAddr() + "] WxCouponController::add");
if (wxCoupon.getId() == null) {
return new ResultData(ResultData.ERROR, "缺少id");
}
WxCoupon coupon = wxCouponService.getById(wxCoupon.getId());
if(coupon.getSourceType().intValue() != EnumCouponSourceType.COUPONSource_Bapi.getCode().intValue()){
return new ResultData(Result.ERROR,"非B端券,不能进行此操作");
}
if (!hasFlow(EnumFlowKey.B_COUPON_MERCHANT_CREATE,coupon)) {
return new ResultData(Result.ERROR,EnumFlowKey.B_COUPON_MERCHANT_CREATE.getMessage()+"未配置审批流程");
}
wxFlowService.start(generateFlowParams(EnumFlowKey.B_COUPON_MERCHANT_CREATE,EnumCouponAppType.PUT,wxCoupon.getId(),wxCoupon.getRemark()), getBuserId(), getUser().getName(), wxCoupon);
return new ResultData(Result.SUCCESS,"提交审批成功");
}
@ApiOperation("新增接口")
@PostMapping("add")
public ResultData add(@RequestBody WxCoupon wxCoupon) {


+ 2
- 0
mallinkService/src/main/java/com/iformall/enums/EnumFlowKey.java View File

@@ -20,6 +20,8 @@ public enum EnumFlowKey {
NEW_CARD_UPLINE(10, "卡审批"),
NEW_GROUP_UPLINE(11, "拼团"),
NEW_PRESS_UPLINE(12, "砍价审批"),
B_COUPON_MERCHANT_CREATE(22,"B端创建券"),

NEW_PRO_CONTRACT(13, "商铺物业合同签约"),
NEW_PRO_END(14, "商铺物业合同终止"),


+ 4
- 2
mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java View File

@@ -357,7 +357,8 @@ public class WxFlowServiceImpl implements WxFlowService {
} else if (EnumFlowKey.NEW_COUPON_UPLINE.getCode().equals(flowType)
|| EnumFlowKey.NEW_CARD_UPLINE.getCode().equals(flowType)
|| EnumFlowKey.NEW_GROUP_UPLINE.getCode().equals(flowType)
|| EnumFlowKey.NEW_PRESS_UPLINE.getCode().equals(flowType)) {
|| EnumFlowKey.NEW_PRESS_UPLINE.getCode().equals(flowType)
|| EnumFlowKey.B_COUPON_MERCHANT_CREATE.getCode().equals(flowType)) {
WxCoupon wxCoupon = new WxCoupon();
wxCoupon.setId(Long.parseLong(businessId));
wxCoupon.setUpdateDate(new Date());
@@ -409,7 +410,8 @@ public class WxFlowServiceImpl implements WxFlowService {
wxCouponMapper.updateById(wxCoupon);
//清除缓存
clearCache(wxCoupon);
}else if(EnumFlowKey.SETTLE.getCode().equals(flowType)){
} else if(EnumFlowKey.SETTLE.getCode().equals(flowType)){
WxBillSettle wxBillSettle = new WxBillSettle();
wxBillSettle.setId(Long.parseLong(businessId));
wxBillSettle.setApplyStatus(applyStatus);


Loading…
Cancel
Save