| @@ -10,6 +10,7 @@ import com.iformall.service.pay.PayServiceFactory; | |||||
| import com.iformall.service.pay.service.pay.PayAdapterService; | import com.iformall.service.pay.service.pay.PayAdapterService; | ||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| import io.swagger.annotations.ApiImplicitParams; | |||||
| import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| @@ -86,7 +87,6 @@ public class ProductOrderController extends BaseController { | |||||
| return new ResultData(record.getOrderNumber()); | return new ResultData(record.getOrderNumber()); | ||||
| } | } | ||||
| @AuthIgnore | |||||
| @ApiOperation("根据id查询接口") | @ApiOperation("根据id查询接口") | ||||
| @GetMapping("/findByNumber") | @GetMapping("/findByNumber") | ||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | ||||
| @@ -110,7 +110,6 @@ public class ProductOrderController extends BaseController { | |||||
| return new ResultData(productOrder); | return new ResultData(productOrder); | ||||
| } | } | ||||
| @AuthIgnore | |||||
| @ApiOperation(value = "创建支付", notes = "") | @ApiOperation(value = "创建支付", notes = "") | ||||
| @PostMapping("createPay") | @PostMapping("createPay") | ||||
| public ResultData createPay(@RequestBody ProductOrderPay record){ | public ResultData createPay(@RequestBody ProductOrderPay record){ | ||||
| @@ -148,10 +147,11 @@ public class ProductOrderController extends BaseController { | |||||
| } | } | ||||
| @AuthIgnore | |||||
| @ApiOperation("根据id查询接口") | @ApiOperation("根据id查询接口") | ||||
| @GetMapping("/findStatus") | @GetMapping("/findStatus") | ||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "String", paramType = "query", required = true) | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "orderNumber", value = "orderNumber", dataType = "String", paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "payVendor", value = "payVendor", dataType = "int", paramType = "query", required = true)}) | |||||
| public ResultData findStatus(String orderNumber,Integer payVendor) { | public ResultData findStatus(String orderNumber,Integer payVendor) { | ||||
| logger.debug("[" + getIpAddr() + "] ProductOrderController::findStatus"); | logger.debug("[" + getIpAddr() + "] ProductOrderController::findStatus"); | ||||
| @@ -23,8 +23,10 @@ public class Product extends TenantEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value="EnumProductType",name="type") | @io.swagger.annotations.ApiModelProperty(value="EnumProductType",name="type") | ||||
| private Integer type; | private Integer type; | ||||
| @io.swagger.annotations.ApiModelProperty(value="套餐表(level_package,project_package_detail)ID,",name="extraId") | |||||
| @io.swagger.annotations.ApiModelProperty(value="每个项目套餐表ID,",name="extraId") | |||||
| private Long extraId; | private Long extraId; | ||||
| @TableField(exist = false) | |||||
| private Object extraInfo; | |||||
| @io.swagger.annotations.ApiModelProperty(value="",name="coverImg") | @io.swagger.annotations.ApiModelProperty(value="",name="coverImg") | ||||
| private String coverImg; | private String coverImg; | ||||
| @@ -56,7 +58,4 @@ public class Product extends TenantEntity { | |||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| private Date endDate; | private Date endDate; | ||||
| @TableField(exist = false) | |||||
| private LevelPackage levelPackage; | |||||
| } | } | ||||
| @@ -2,19 +2,16 @@ package com.iformall.service.impl; | |||||
| import com.github.pagehelper.PageHelper; | import com.github.pagehelper.PageHelper; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.domain.po.LevelPackage; | |||||
| import com.iformall.domain.po.Product; | import com.iformall.domain.po.Product; | ||||
| import com.iformall.enums.EnumProductType; | import com.iformall.enums.EnumProductType; | ||||
| import com.iformall.mapper.ProductMapper; | import com.iformall.mapper.ProductMapper; | ||||
| import com.iformall.service.ProductService; | import com.iformall.service.ProductService; | ||||
| import com.iformall.service.sm.LevelPackageService; | |||||
| import com.iformall.service.payProduct.PayProductFactory; | |||||
| import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import java.util.Date; | |||||
| import java.util.List; | import java.util.List; | ||||
| @Service | @Service | ||||
| @@ -25,9 +22,9 @@ public class ProductServiceImpl implements ProductService { | |||||
| @Autowired | @Autowired | ||||
| ProductMapper productMapper; | ProductMapper productMapper; | ||||
| @Autowired | @Autowired | ||||
| LevelPackageService levelPackageService; | |||||
| PayProductFactory payProductFactory; | |||||
| @Override | @Override | ||||
| public PageInfo<Product> listAsPage(Product record, Integer pageIndex, Integer pageSize) { | public PageInfo<Product> listAsPage(Product record, Integer pageIndex, Integer pageSize) { | ||||
| @@ -44,8 +41,7 @@ public class ProductServiceImpl implements ProductService { | |||||
| List<Product> list = productMapper.findList(record); | List<Product> list = productMapper.findList(record); | ||||
| for (Product prod: list) { | for (Product prod: list) { | ||||
| if(EnumProductType.product_2.getCode().equals(prod.getType())){ | if(EnumProductType.product_2.getCode().equals(prod.getType())){ | ||||
| LevelPackage levelPackage = levelPackageService.getDetailById(prod.getExtraId(),projectType); | |||||
| prod.setLevelPackage(levelPackage); | |||||
| prod.setExtraInfo(payProductFactory.getPayAdapterService(prod.getProjectType()).getProductExtroInfo(prod)); | |||||
| } | } | ||||
| } | } | ||||
| return list; | return list; | ||||
| @@ -0,0 +1,61 @@ | |||||
| package com.iformall.service.payProduct; | |||||
| import java.util.Map; | |||||
| import java.util.concurrent.ConcurrentHashMap; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.stereotype.Service; | |||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.enums.EnumProject; | |||||
| import com.iformall.exception.MallinkException; | |||||
| import com.iformall.service.payProduct.service.PayProductService; | |||||
| import com.iformall.service.payProduct.service.impl.CommonPayProductService; | |||||
| import com.iformall.service.payProduct.service.impl.HBPayProductService; | |||||
| import com.iformall.service.payProduct.service.impl.HKPayProductService; | |||||
| import com.iformall.service.payProduct.service.impl.HYPayProductService; | |||||
| import com.iformall.service.payProduct.service.impl.HYuPayProductService; | |||||
| import com.iformall.service.payProduct.service.impl.ZXPayProductService; | |||||
| /** | |||||
| * 支付套餐 | |||||
| * @author Administrator | |||||
| */ | |||||
| @Service | |||||
| public class PayProductFactory { | |||||
| private Map<Integer,PayProductService> serviceMap = null; | |||||
| @Autowired | |||||
| CommonPayProductService commonPayProductService; | |||||
| @Autowired | |||||
| HYPayProductService hYPayProductService; | |||||
| @Autowired | |||||
| HBPayProductService hBPayProductService; | |||||
| @Autowired | |||||
| HYuPayProductService hYuPayProductService; | |||||
| @Autowired | |||||
| HKPayProductService hKPayProductService; | |||||
| @Autowired | |||||
| ZXPayProductService zXPayProductService; | |||||
| private Map<Integer,PayProductService> getServiceMap() { | |||||
| if (null == serviceMap) { | |||||
| serviceMap = new ConcurrentHashMap<Integer,PayProductService>(); | |||||
| serviceMap.put(EnumProject.PROJECT_0.getCode(), commonPayProductService); | |||||
| serviceMap.put(EnumProject.PROJECT_1.getCode(), hBPayProductService); | |||||
| serviceMap.put(EnumProject.PROJECT_2.getCode(), hYPayProductService); | |||||
| serviceMap.put(EnumProject.PROJECT_3.getCode(), hYuPayProductService); | |||||
| serviceMap.put(EnumProject.PROJECT_4.getCode(), hKPayProductService); | |||||
| serviceMap.put(EnumProject.PROJECT_5.getCode(), zXPayProductService); | |||||
| } | |||||
| return serviceMap; | |||||
| } | |||||
| public PayProductService getPayAdapterService(Integer productProject) throws MallinkException{ | |||||
| PayProductService service = getServiceMap().get(productProject); | |||||
| if (null == service) { | |||||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"["+productProject+"] 支付套餐service未找到"); | |||||
| } | |||||
| return service; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,8 @@ | |||||
| package com.iformall.service.payProduct.service; | |||||
| import com.iformall.domain.po.Product; | |||||
| public interface PayProductService { | |||||
| public Object getProductExtroInfo(Product product); | |||||
| } | |||||
| @@ -0,0 +1,17 @@ | |||||
| package com.iformall.service.payProduct.service.impl; | |||||
| import org.springframework.stereotype.Service; | |||||
| import com.iformall.domain.po.Product; | |||||
| import com.iformall.service.payProduct.service.PayProductService; | |||||
| //慧影支付套餐 | |||||
| @Service | |||||
| public class CommonPayProductService implements PayProductService{ | |||||
| @Override | |||||
| public Object getProductExtroInfo(Product product) { | |||||
| return null; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,17 @@ | |||||
| package com.iformall.service.payProduct.service.impl; | |||||
| import org.springframework.stereotype.Service; | |||||
| import com.iformall.domain.po.Product; | |||||
| import com.iformall.service.payProduct.service.PayProductService; | |||||
| //慧播支付套餐 | |||||
| @Service | |||||
| public class HBPayProductService implements PayProductService{ | |||||
| @Override | |||||
| public Object getProductExtroInfo(Product product) { | |||||
| return null; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,17 @@ | |||||
| package com.iformall.service.payProduct.service.impl; | |||||
| import org.springframework.stereotype.Service; | |||||
| import com.iformall.domain.po.Product; | |||||
| import com.iformall.service.payProduct.service.PayProductService; | |||||
| //慧侃支付套餐 | |||||
| @Service | |||||
| public class HKPayProductService implements PayProductService{ | |||||
| @Override | |||||
| public Object getProductExtroInfo(Product product) { | |||||
| return null; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,18 @@ | |||||
| package com.iformall.service.payProduct.service.impl; | |||||
| import org.springframework.stereotype.Service; | |||||
| import com.iformall.domain.po.Product; | |||||
| import com.iformall.service.payProduct.service.PayProductService; | |||||
| //慧影支付套餐 | |||||
| @Service | |||||
| public class HYPayProductService implements PayProductService{ | |||||
| @Override | |||||
| public Object getProductExtroInfo(Product product) { | |||||
| //慧影套餐表project_package_detail, 现在暂时不搞那么复杂 | |||||
| return null; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,17 @@ | |||||
| package com.iformall.service.payProduct.service.impl; | |||||
| import org.springframework.stereotype.Service; | |||||
| import com.iformall.domain.po.Product; | |||||
| import com.iformall.service.payProduct.service.PayProductService; | |||||
| //慧语支付套餐 | |||||
| @Service | |||||
| public class HYuPayProductService implements PayProductService{ | |||||
| @Override | |||||
| public Object getProductExtroInfo(Product product) { | |||||
| return null; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,17 @@ | |||||
| package com.iformall.service.payProduct.service.impl; | |||||
| import org.springframework.stereotype.Service; | |||||
| import com.iformall.domain.po.Product; | |||||
| import com.iformall.service.payProduct.service.PayProductService; | |||||
| //智象支付套餐 | |||||
| @Service | |||||
| public class ZXPayProductService implements PayProductService{ | |||||
| @Override | |||||
| public Object getProductExtroInfo(Product product) { | |||||
| return null; | |||||
| } | |||||
| } | |||||