袁野 3 years ago
commit 9abdc47b83
  1. 16
      hai-bweb/src/main/java/com/bweb/controller/ApiMerchantsController.java
  2. 91
      hai-bweb/src/main/java/com/bweb/controller/ApiProductController.java
  3. 42
      hai-bweb/src/main/java/com/bweb/controller/HighOpenApiController.java
  4. 20
      hai-bweb/src/main/java/com/bweb/controller/OutRechargeOrderController.java
  5. 42
      hai-service/src/main/java/com/hai/dao/ApiProductConfigMapperExt.java
  6. 2
      hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapperExt.java
  7. 60
      hai-service/src/main/java/com/hai/model/ApiProductConfigModel.java
  8. 15
      hai-service/src/main/java/com/hai/service/ApiMerchantsService.java
  9. 21
      hai-service/src/main/java/com/hai/service/ApiProductService.java
  10. 11
      hai-service/src/main/java/com/hai/service/impl/ApiMerchantsServiceImpl.java
  11. 13
      hai-service/src/main/java/com/hai/service/impl/ApiProductServiceImpl.java
  12. 12
      hai-service/src/main/resources/dev/commonConfig.properties

@ -11,6 +11,7 @@ import com.hai.common.security.UserCenter;
import com.hai.common.utils.*;
import com.hai.entity.ApiMerchants;
import com.hai.entity.ApiProduct;
import com.hai.entity.ApiProductConfig;
import com.hai.enum_type.ApiAmountRecordTypeEnum;
import com.hai.enum_type.CompanyAmountSourceTypeEnum;
import com.hai.model.HighMerchantModel;
@ -278,4 +279,19 @@ public class ApiMerchantsController {
}
}
@RequestMapping(value = "/getListMerchProduct", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询商户产品")
public ResponseData getListMerchProduct(@RequestParam(value = "merchantId", required = true) Long merchantId) {
try {
return ResponseMsgUtil.success(apiMerchantsService.getListMerchProduct(merchantId));
} catch (Exception e) {
log.error("ApiMerchantsController --> findById() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -10,10 +10,7 @@ import com.hai.common.security.SessionObject;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.PageUtil;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.ApiProduct;
import com.hai.entity.BsOperationLog;
import com.hai.entity.HighAgent;
import com.hai.entity.OutRechargePrice;
import com.hai.entity.*;
import com.hai.model.OutRechargePriceModel;
import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel;
@ -236,7 +233,7 @@ public class ApiProductController {
if (object == null ||
object.getJSONArray("productIds") == null ||
object.getInteger("discount") == null ||
object.getBigDecimal("discount") == null ||
object.getLong("merchantsId") == null
) {
log.error("ApiProductController -> configApiProduct() error!");
@ -253,4 +250,88 @@ public class ApiProductController {
}
}
@RequestMapping(value = "/editConfigApiProductByStatus", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "修改商户产品状态")
public ResponseData editConfigApiProductByStatus(@RequestBody JSONObject object, HttpServletRequest request) {
try {
if (object == null ||
object.getInteger("status") == null ||
object.getInteger("id") == null
) {
log.error("ApiProductController -> configApiProduct() error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
SessionObject sessionObject = userCenter.getSessionObject(request);
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject();
ApiProductConfig apiProductConfig = apiProductService.findProductConfigById(object.getLong("id"));
apiProductConfig.setStatus(object.getInteger("status"));
apiProductConfig.setOperatorName(userInfoModel.getSecUser().getUserName());
apiProductConfig.setOperatorId(userInfoModel.getSecUser().getId());
apiProductService.updateConfigApiProduct(apiProductConfig);
return ResponseMsgUtil.success("修改成功");
} catch (Exception e) {
log.error("ApiProductController --> editPriceStatus() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/updateConfigApiProduct", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "修改配置产品")
public ResponseData updateConfigApiProduct(@RequestBody JSONObject object) {
try {
if (object == null ||
object.getBigDecimal("discount") == null ||
object.getLong("id") == null
) {
log.error("ApiProductController -> configApiProduct() error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
ApiProductConfig apiProductConfig = apiProductService.findProductConfigById(object.getLong("id"));
ApiProduct apiProduct = apiProductService.findById(apiProductConfig.getProductId());
if (apiProductConfig.getStatus() == 101) {
log.error("ApiProductController -> configApiProduct() error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前状态错误");
}
apiProductConfig.setDiscount(object.getBigDecimal("discount"));
apiProductConfig.setDiscountPrice(apiProduct.getRechargePrice().multiply(object.getBigDecimal("discount")).divide(new BigDecimal(100)));
apiProductService.updateConfigApiProduct(apiProductConfig);
return ResponseMsgUtil.success("修改成功");
} catch (Exception e) {
log.error("ApiProductController --> insertPrice() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/findConfigProduct", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询配置产品")
public ResponseData findConfigProduct(@RequestParam(value = "id", required = true) Long id) {
try {
return ResponseMsgUtil.success(apiProductService.findProductConfigById(id));
} catch (Exception e) {
log.error("ApiMerchantsController --> findById() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -95,18 +95,18 @@ public class HighOpenApiController {
public ResponseData getGuizhouSinopecList(HttpServletRequest request) {
try {
// String ip = "";
// // 有的user可能使用代理,为处理用户使用代理的情况,使用x-forwarded-for
// if (request.getHeader("x-forwarded-for") == null) {
// ip = request.getRemoteAddr();
// } else {
// ip = request.getHeader("x-forwarded-for");
// }
//
// if (!secConfigService.isConfig("IP_WHITE" , ip)) {
// log.error("getGuizhouSinopec error!", "非法ip地址,请联系管理人员!");
// throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "非法ip地址,请联系管理人员!");
// }
String ip = "";
// 有的user可能使用代理,为处理用户使用代理的情况,使用x-forwarded-for
if (request.getHeader("x-forwarded-for") == null) {
ip = request.getRemoteAddr();
} else {
ip = request.getHeader("x-forwarded-for");
}
if (!secConfigService.isConfig("IP_WHITE" , ip)) {
log.error("getGuizhouSinopec error!", "非法ip地址,请联系管理人员!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "非法ip地址,请联系管理人员!");
}
// 获取token
String token = huiLianTongConfig.getToken();
@ -140,10 +140,10 @@ public class HighOpenApiController {
ip = request.getHeader("x-forwarded-for");
}
// if (!secConfigService.isConfig("IP_WHITE" , ip)) {
// log.error("getGuizhouSinopec error!", "非法ip地址,请联系管理人员!");
// throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "非法ip地址,请联系管理人员!");
// }
if (!secConfigService.isConfig("IP_WHITE" , ip)) {
log.error("getGuizhouSinopec error!", "非法ip地址,请联系管理人员!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "非法ip地址,请联系管理人员!");
}
// 获取token
String token = huiLianTongConfig.getToken();
@ -175,11 +175,11 @@ public class HighOpenApiController {
} else {
ip = request.getHeader("x-forwarded-for");
}
//
// if (!secConfigService.isConfig("IP_WHITE" , ip)) {
// log.error("couJointDist error!", "非法ip地址,请联系管理人员!");
// throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "非法ip地址,请联系管理人员!");
// }
if (!secConfigService.isConfig("IP_WHITE" , ip)) {
log.error("couJointDist error!", "非法ip地址,请联系管理人员!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "非法ip地址,请联系管理人员!");
}
// 获取token
String token = huiLianTongConfig.getToken();

@ -51,6 +51,7 @@ import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.function.IntFunction;
@Controller
@RequestMapping(value = "/outRechargeOrder")
@ -134,6 +135,7 @@ public class OutRechargeOrderController {
@RequestParam(name = "payStatus", required = false) Integer payStatus,
@RequestParam(name = "rechargeStatus", required = false) String rechargeStatus,
@RequestParam(name = "orderNo", required = false) String orderNo,
@RequestParam(name = "companyId", required = false) Long companyId,
@RequestParam(name = "operatorType", required = false) String operatorType,
@RequestParam(name = "laborUnionCard", required = false) String laborUnionCard,
@RequestParam(name = "rechargeContent", required = false) String rechargeContent,
@ -154,7 +156,16 @@ public class OutRechargeOrderController {
Map<String, Object> map = new HashMap<>();
map.put("companyId", userInfoModel.getBsCompany().getId());
if (companyId != null) {
map.put("companyId", companyId);
} else if (userInfoModel.getSecRole().getRoleType() != 1){
if (userInfoModel.getSecRole().getRoleType() == 7) {
map.put("companyId", 23);
} else {
map.put("companyId", userInfoModel.getBsCompany().getId());
}
}
map.put("rechargeStatus", rechargeStatus);
map.put("payStatus", payStatus);
map.put("orderNo", orderNo);
@ -189,6 +200,7 @@ public class OutRechargeOrderController {
public ResponseData exportOrderList(
@RequestParam(name = "payStatus", required = false) Integer payStatus,
@RequestParam(name = "rechargeStatus", required = false) String rechargeStatus,
@RequestParam(name = "companyId", required = false) Long companyId,
@RequestParam(name = "orderNo", required = false) String orderNo,
@RequestParam(name = "operatorType", required = false) String operatorType,
@RequestParam(name = "laborUnionCard", required = false) String laborUnionCard,
@ -209,7 +221,11 @@ public class OutRechargeOrderController {
Map<String, Object> map = new HashMap<>();
map.put("companyId", userInfoModel.getBsCompany().getId());
if (companyId != null) {
map.put("companyId", companyId);
} else if (userInfoModel.getSecRole().getRoleType() != 1){
map.put("companyId", userInfoModel.getBsCompany().getId());
}
map.put("rechargeStatus", rechargeStatus);
map.put("payStatus", payStatus);
map.put("orderNo", orderNo);

@ -1,7 +1,47 @@
package com.hai.dao;
import com.hai.model.ApiProductConfigModel;
import com.hai.model.OutUserOrderModel;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.type.JdbcType;
import java.util.List;
/**
* mapper扩展类
*/
public interface ApiProductConfigMapperExt {
}
@Select(value = {
"<script>",
" select ap.* , discount_price , apc.id as api_config_product_id , discount , apc.status as config_status from api_product ap join api_product_config apc on ap.id = apc.product_id where apc.status != 100",
" and merchants_id = #{merchantsId} " +
"</script>"
})
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="recharge_type", property="rechargeType", jdbcType=JdbcType.INTEGER),
@Result(column="recharge_platform", property="rechargePlatform", jdbcType=JdbcType.VARCHAR),
@Result(column="phone_recharge_type", property="phoneRechargeType", jdbcType=JdbcType.INTEGER),
@Result(column="operator_type", property="operatorType", jdbcType=JdbcType.INTEGER),
@Result(column="recharge_price", property="rechargePrice", jdbcType=JdbcType.DECIMAL),
@Result(column="product_id", property="productId", jdbcType=JdbcType.BIGINT),
@Result(column="api_config_product_id", property="apiConfigProductId", jdbcType=JdbcType.BIGINT),
@Result(column="sort", property="sort", jdbcType=JdbcType.INTEGER),
@Result(column="discount", property="discount", jdbcType=JdbcType.DECIMAL),
@Result(column="discount_price", property="discountPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="operator_id", property="operatorId", jdbcType=JdbcType.BIGINT),
@Result(column="operator_name", property="operatorName", jdbcType=JdbcType.VARCHAR),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="config_status", property="configStatus", jdbcType=JdbcType.INTEGER),
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
})
List<ApiProductConfigModel> getListMerchProduct(Long merchantsId);
}

@ -134,7 +134,7 @@ public interface OutRechargeOrderMapperExt {
@Select(value = {
"<script>",
"select sum(order_price) orderPrice, sum(pay_real_price) payRealPrice , count(*) count ",
"from out_recharge_order where pay_status in (2,3) and Identification_code = #{code}",
"from out_recharge_order where pay_status in (102,100) and company_id = 23",
"</script>"
})
@Results({

@ -0,0 +1,60 @@
package com.hai.model;
import com.hai.entity.ApiProduct;
import com.hai.entity.ApiProductConfig;
import java.math.BigDecimal;
public class ApiProductConfigModel extends ApiProduct {
/**
* 折扣比例
*/
private BigDecimal discount;
/**
* 折扣价格
*/
private BigDecimal discountPrice;
/**
* 主键
*/
private Long apiConfigProductId;
/**
* 101 正常 102 下架 100 删除
*/
private Integer configStatus;
public Integer getConfigStatus() {
return configStatus;
}
public void setConfigStatus(Integer configStatus) {
this.configStatus = configStatus;
}
public Long getApiConfigProductId() {
return apiConfigProductId;
}
public void setApiConfigProductId(Long apiConfigProductId) {
this.apiConfigProductId = apiConfigProductId;
}
public BigDecimal getDiscount() {
return discount;
}
public void setDiscount(BigDecimal discount) {
this.discount = discount;
}
public BigDecimal getDiscountPrice() {
return discountPrice;
}
public void setDiscountPrice(BigDecimal discountPrice) {
this.discountPrice = discountPrice;
}
}

@ -3,6 +3,8 @@ package com.hai.service;
import com.alibaba.fastjson.JSONObject;
import com.hai.entity.ApiAmountRecord;
import com.hai.entity.ApiMerchants;
import com.hai.entity.ApiProductConfig;
import com.hai.model.ApiProductConfigModel;
import java.math.BigDecimal;
import java.util.List;
@ -77,5 +79,18 @@ public interface ApiMerchantsService {
*/
List<ApiAmountRecord> getMerchRechargeData(Long merchantId);
/**
* @Author Sum1Dream
* @name getListMerchProduct.java
* @Description // 查询商户配置产品
* @Date 10:10 2022/6/9
* @Param [java.lang.Long]
* @return java.util.List<com.hai.entity.ApiProductConfig>
*/
List<ApiProductConfigModel> getListMerchProduct(Long merchantId);
}

@ -2,6 +2,7 @@ package com.hai.service;
import com.alibaba.fastjson.JSONObject;
import com.hai.entity.ApiProduct;
import com.hai.entity.ApiProductConfig;
import io.swagger.annotations.Api;
import java.util.List;
@ -65,4 +66,24 @@ public interface ApiProductService {
* @return void
*/
void configApiProduct(JSONObject object);
/**
* @Author Sum1Dream
* @name updateConfigApiProduct.java
* @Description // 修改配置产品
* @Date 11:17 2022/6/9
* @Param [com.alibaba.fastjson.JSONObject]
* @return void
*/
void updateConfigApiProduct(ApiProductConfig apiProductConfig);
/**
* @Author Sum1Dream
* @name findProductConfigById.java
* @Description // 查询配置产品
* @Date 11:02 2022/6/9
* @Param [java.lang.Long]
* @return com.hai.entity.ApiProductConfig
*/
ApiProductConfig findProductConfigById(Long id);
}

@ -7,7 +7,9 @@ import com.hai.common.security.UserCenter;
import com.hai.common.utils.RedisUtil;
import com.hai.dao.ApiAmountRecordMapper;
import com.hai.dao.ApiMerchantsMapper;
import com.hai.dao.ApiProductConfigMapper;
import com.hai.entity.*;
import com.hai.model.ApiProductConfigModel;
import com.hai.model.UserInfoModel;
import com.hai.service.ApiMerchantsService;
import org.apache.commons.collections4.MapUtils;
@ -37,6 +39,9 @@ public class ApiMerchantsServiceImpl implements ApiMerchantsService {
@Resource
private ApiAmountRecordMapper apiAmountRecordMapper;
@Resource
private ApiProductConfigMapper apiProductConfigMapper;
@Override
public void insertApiMerchants(ApiMerchants apiMerchants) {
apiMerchantsMapper.insert(apiMerchants);
@ -134,4 +139,10 @@ public class ApiMerchantsServiceImpl implements ApiMerchantsService {
example.createCriteria().andMchIdEqualTo(apiMerchants.getMchId());
return apiAmountRecordMapper.selectByExample(example);
}
@Override
public List<ApiProductConfigModel> getListMerchProduct(Long merchantId) {
return apiProductConfigMapper.getListMerchProduct(merchantId);
}
}

@ -112,7 +112,9 @@ public class ApiProductServiceImpl implements ApiProductService {
// 转换产品数组
JSONArray productsArray = object.getJSONArray("productIds");
ApiProductConfig apiProductConfig;
ApiProduct apiProduct;
for (Object productId : productsArray) {
apiProduct = apiProductMapper.selectByPrimaryKey(Long.valueOf(productId.toString()));
apiProductConfig = new ApiProductConfig();
apiProductConfig.setProductId(Long.valueOf(productId.toString()));
apiProductConfig.setCreateTime(new Date());
@ -120,9 +122,20 @@ public class ApiProductServiceImpl implements ApiProductService {
apiProductConfig.setOperatorName(sessionModel.getSecUser().getUserName());
apiProductConfig.setStatus(101);
apiProductConfig.setDiscount(object.getBigDecimal("discount"));
apiProductConfig.setDiscountPrice(apiProduct.getRechargePrice().multiply(object.getBigDecimal("discount")).divide(new BigDecimal(100)));
apiProductConfig.setMerchantsId(object.getLong("merchantsId"));
apiProductConfig.setUpdateTime(new Date());
apiProductConfigMapper.insert(apiProductConfig);
}
}
@Override
public ApiProductConfig findProductConfigById(Long id) {
return apiProductConfigMapper.selectByPrimaryKey(id);
}
@Override
public void updateConfigApiProduct(ApiProductConfig apiProductConfig) {
apiProductConfigMapper.updateByPrimaryKey(apiProductConfig);
}
}

@ -14,10 +14,10 @@ qinzhuSecret=ktxb49sh2jfhgn8g
qianzhuOrderNotify=https://hsg.dctpay.com/crest/qianzhu/orderNotify
# ???????
huiliantongUrl=https://gzapi.deepermobile.com.cn
huiliantongAppNo=guizhouhuilt
huiliantongAppkey=e0ja2Ex%2BmQ2hIPF6x%2BHA%3D
huiliantongAppsecret=52662415DDCE55C7BA34223BCF53877A
huiliantongUrl=https://gzapitest.deepermobile.com.cn:441
huiliantongAppNo=guizhouhltcs
huiliantongAppkey=g%2BNnjR54YSUWM2iKg%2Fd82A9x9hg2kYV7
huiliantongAppsecret=FA28E95ACABFA4B2B8E25857437B07F1
# ????????
HuiLianTongUnionCardUrl=http://hltgz.com:4010/api/v2/execute.json
@ -35,8 +35,8 @@ unionPayChannelid=D01X00000801226
unionPayMerid=83169055983W000
unionPayTermid=XS000103
unionPaySignKey=1dfk0i0fl7ild07l2k5oj8dddikkivd0
unionPayNotifyUrl=https://hsg.dctpay.com/crest/unionPay/notify
unionPayTelNotifyUrl=https://hsg.dctpay.com/crest/unionPay/notifyTel
unionPayNotifyUrl=https://hsgcs.dctpay.com/crest/unionPay/notify
unionPayTelNotifyUrl=https://hsgcs.dctpay.com/crest/unionPay/notifyTel
unionStagingPayUrl=https://mtest.eycard.cn/
unionStagingPayOrgId=ORG000000000001

Loading…
Cancel
Save