!111 2022-1-26 Carl

Merge pull request !111 from Admin/sit-Carl-V3
This commit is contained in:
Admin 2022-01-26 08:38:35 +00:00 committed by Gitee
commit 3eef3b59cc
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
5 changed files with 43 additions and 25 deletions

View File

@ -21,7 +21,7 @@ public class MemberService {
public String memberGet(MemberGetEntity memberGetEntity)throws Exception {
public JSONObject memberGet(MemberGetEntity memberGetEntity)throws Exception {
Map<String, String> paramMap = MapRemoveNullUtil.setConditionMap(memberGetEntity);
paramMap.put("id",StringUtil.toString(memberGetEntity.getId()).equals("0")?null:StringUtil.toString(memberGetEntity.getId()));
MapRemoveNullUtil.removeNullEntry(paramMap);
@ -31,9 +31,9 @@ public class MemberService {
JSONObject json = JSONObject.parseObject(jsonObject.getString("data"));
String id = json.getString("id");
jsonObject.put("xaccessToken", SmartJWTUtil.generateToken(id));
return jsonObject.toJSONString();
return jsonObject;
}else {
return sb;
return jsonObject;
}
}
public String memberCheck(MemberCheckEntity memberCheckEntity)throws Exception {
@ -42,7 +42,7 @@ public class MemberService {
return SmartHttpUtil.sendPostForm(url+"check",paramMap,null);
}
public String memberAdd(MemberAddEntity memberAddEntity)throws Exception {
public JSONObject memberAdd(MemberAddEntity memberAddEntity){
Map<String, String> paramMap = MapRemoveNullUtil.setConditionMap(memberAddEntity);
paramMap.put("cityId",StringUtil.toString(memberAddEntity.getCityId()).equals("0")?null:StringUtil.toString(memberAddEntity.getCityId()));
paramMap.put("gender",StringUtil.toString(memberAddEntity.getGender()).equals("0")?null:StringUtil.toString(memberAddEntity.getGender()));
@ -50,7 +50,16 @@ public class MemberService {
paramMap.put("provinceId",StringUtil.toString(memberAddEntity.getProvinceId()).equals("0")?null:StringUtil.toString(memberAddEntity.getProvinceId()));
MapRemoveNullUtil.removeNullEntry(paramMap);
net.sf.json.JSONObject jsonObject = net.sf.json.JSONObject.fromObject(paramMap);
return SmartHttpUtil.httpPostRaw(url+"add",jsonObject.toString(),null,"utf-8");
String sb = SmartHttpUtil.httpPostRaw(url+"add",jsonObject.toString(),null,"utf-8");
JSONObject jsonObjectResult = JSONObject.parseObject(sb);
if(jsonObjectResult.getString("code").equals("0")){
JSONObject json = JSONObject.parseObject(jsonObjectResult.getString("data"));
String id = json.getString("id");
jsonObjectResult.put("xaccessToken", SmartJWTUtil.generateToken(id));
return jsonObjectResult;
}else {
return jsonObjectResult;
}
}
public String memberUpdateMemberLevel(MemberUpdateMemberLevelEntity memberUpdateMemberLevelEntity)throws Exception {

View File

@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.log4j.Log4j2;
import net.lab1024.smartadmin.common.anno.OperateLog;
import net.lab1024.smartadmin.common.constant.ResponseCodeConst;
import net.lab1024.smartadmin.common.domain.ResponseDTO;
@ -15,8 +14,6 @@ import net.lab1024.smartadmin.module.system.royalcanin.couponConfig.CouponConfig
import net.lab1024.smartadmin.module.system.royalcanin.couponConfig.CouponConfigGetEntity;
import net.lab1024.smartadmin.module.system.royalcanin.domain.RoyalcaninOperateLogEntity;
import net.lab1024.smartadmin.module.system.royalcanin.domain.RoyalcaninOperateLogService;
import net.lab1024.smartadmin.module.system.royalcanin.good.model.OrderEntity;
import net.lab1024.smartadmin.module.system.royalcanin.good.model.ProductMasterQueryEntity;
import net.lab1024.smartadmin.module.system.royalcanin.good.service.GoodService;
import net.lab1024.smartadmin.module.system.royalcanin.good.service.OrderService;
import net.lab1024.smartadmin.module.system.royalcanin.member.*;
@ -28,8 +25,6 @@ import net.lab1024.smartadmin.module.system.royalcanin.memberAddress.MemberAddre
import net.lab1024.smartadmin.module.system.royalcanin.memberAddress.MemberAddressUpdateEntity;
import net.lab1024.smartadmin.module.system.royalcanin.orderMaster.AddOrSaveEntity;
import net.lab1024.smartadmin.module.system.royalcanin.orderMaster.QueryEntity;
import net.lab1024.smartadmin.util.MapRemoveNullUtil;
import net.lab1024.smartadmin.util.SmartHttpUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@ -38,7 +33,6 @@ import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat;
import java.util.Map;
@Api(tags = {SwaggerTagConst.Admin.MANAGER_MALL_API})
@ -80,13 +74,13 @@ public class TransitionController {
switch (type)
{
case "get":
result = memberService.memberGet(objectMapper.convertValue(object,MemberGetEntity.class));
result = memberService.memberGet(objectMapper.convertValue(object,MemberGetEntity.class)).toString();
break;
case "check":
result = memberService.memberCheck(objectMapper.convertValue(object,MemberCheckEntity.class));
break;
case "add":
result = memberService.memberAdd(objectMapper.convertValue(object,MemberAddEntity.class));
result = memberService.memberAdd(objectMapper.convertValue(object,MemberAddEntity.class)).toString();
break;
case "updateMemberLevel":
result = memberService.memberUpdateMemberLevel(objectMapper.convertValue(object, MemberUpdateMemberLevelEntity.class));
@ -105,7 +99,7 @@ public class TransitionController {
@ApiOperation(value = "登录或注册", notes = "会员查询,登录注册")
@PostMapping("royalcanin/regOrLogin")
public ResponseDTO<String> regOrLogin(@RequestParam String phoneNumber) throws Exception {
public ResponseDTO regOrLogin(@RequestParam String phoneNumber) throws Exception {
MemberCheckEntity memberCheckEntity = new MemberCheckEntity();
memberCheckEntity.setMobile(phoneNumber);
JSONObject jsonObject = JSONObject.parseObject(memberService.memberCheck(memberCheckEntity));

View File

@ -136,13 +136,14 @@ public class OrderController {
@ApiOperation(value = "微信支付H5订单", notes = "生成H5订单")
@PostMapping("royalcanin/generateOrderWXH5")
public Map<String, String> generateOrderWXH5(@RequestBody List<OrdersEntity> ordersEntityList) throws Exception {
public ResponseDTO<Map<String, String>> generateOrderWXH5(@RequestBody List<OrdersEntity> ordersEntityList) throws Exception {
StringBuffer productId = new StringBuffer();
StringBuffer productName = new StringBuffer();
String memberId = "";
String mobile = "";
int buyCount = 0;
double total_fee = 0 ;
double basePoint = 0 ;
WxPayEntity wxPayEntity = new WxPayEntity();
JSONArray orderDatilListJson = new JSONArray();
OrdersEntity ordersEntity = new OrdersEntity();
@ -157,14 +158,23 @@ public class OrderController {
orderDatilListEntity.setEcPrice(ordersEntitys.getPayAmount());
orderDatilListJson.add(orderDatilListEntity);
if(ordersEntitys.getCouponCode() != "" && ordersEntitys.getCouponCode() != null) {
ordersEntity.setCouponAmount(ordersEntitys.getCouponAmount());
ordersEntity.setCouponCode(ordersEntitys.getCouponCode());
ordersEntity.setCouponName(ordersEntitys.getCouponName());
ordersEntity.setCouponId(ordersEntitys.getCouponId());
CouponGetAllEntity couponGetAllEntity = new CouponGetAllEntity ();
couponGetAllEntity.setMemberId(ordersEntitys.getMemberId());
couponGetAllEntity.setCouponCode(ordersEntitys.getCouponCode());
String couponInfo = couponService.couponGetAll(couponGetAllEntity);
JSONObject jsonObject = JSONObject.parseObject(couponInfo);
com.alibaba.fastjson.JSONArray jsonArray = JSONObject.parseArray(jsonObject.getString("data"));
JSONObject jsonObjectData = (JSONObject)jsonArray.get(0);
ordersEntity.setCouponAmount(jsonObjectData.getString("couponAmount") == null ?jsonObjectData.getString("discount"):jsonObjectData.getString("couponAmount"));
ordersEntity.setCouponCode(jsonObjectData.getString("couponCode"));
ordersEntity.setCouponName(jsonObjectData.getString("couponName"));
ordersEntity.setCouponId(jsonObjectData.getString("couponId"));
total_fee = total_fee + orderService.couponTotal(ordersEntitys.getCouponTypeId(),Double.parseDouble(ordersEntitys.getCouponAmount()),Double.parseDouble(ordersEntitys.getPayAmount()),ordersEntitys.getBuyCount());
}else{
total_fee = total_fee + Double.parseDouble(ordersEntitys.getPayAmount()) * ordersEntitys.getBuyCount() ;
}
basePoint = basePoint + ordersEntitys.getBasePoint();
orderAddress.setAddressCityName(ordersEntitys.getOrderAddress().getAddressCityName());
orderAddress.setAddressCountyName(ordersEntitys.getOrderAddress().getAddressCountyName());
orderAddress.setAddressDetailInfo(ordersEntitys.getOrderAddress().getAddressDetailInfo());
@ -173,7 +183,6 @@ public class OrderController {
orderAddress.setAddressProvinceName(ordersEntitys.getOrderAddress().getAddressProvinceName());
productId.append(ordersEntitys.getProductCode()+",");
productName.append(ordersEntitys.getProductName()+",");
memberId = ordersEntitys.getMemberId();
mobile = ordersEntitys.getPhoneNumber();
buyCount = buyCount + ordersEntitys.getBuyCount();
@ -187,14 +196,20 @@ public class OrderController {
ordersEntity.setBuyCount(buyCount);
ordersEntity.setOrderNo(GenerateSequenceUtil.generateSequenceNo());
ordersEntity.setOrderStatus("0");
ordersEntity.setBasePoint(basePoint);
if(orderService.generateOrder(ordersEntity,orderDatilListJson) == 1){
wxPayEntity.setProduct_id(ordersEntity.getProductCode());
wxPayEntity.setTotal_fee(StringUtil.toString(total_fee));
wxPayEntity.setOut_trade_no(ordersEntity.getOrderNo());
return wxpayService.dounifiedOrder(wxPayEntity);
}else {
return null;
Map<String, String> returnMap = new HashMap<>();
returnMap.put("orderNumber",ordersEntity.getOrderNo());
returnMap.put("orderAmount",ordersEntity.getOrderAmount());
return ResponseDTO.succData(wxpayService.dounifiedOrder(wxPayEntity));
}
return ResponseDTO.wrap(OrderResponseCodeConst.GENERATE_ORDER_FAIL);
}
@ApiOperation(value = "重新支付", notes = "重新支付")

View File

@ -19,7 +19,7 @@ public class MyConfig implements WXPayConfig {
public String notify_url = "https://royalcanincn.escase.cn/jc/royalcanin/royalcanin/updateOrderWX";
// 微信支付h5 回调地址
public static String NOTIFY_URL_H5 = "https://www.XXXXXX.com/server/weixin/WxQuery";
public static String NOTIFY_URL_H5 = "https://shop.royalcanin.com.cn/myorder/usertion?";
// 请求地址
public static String UFDODER_URL = "https://api.mch.weixin.qq.com/pay/unifiedorder";

View File

@ -194,7 +194,7 @@ public class WxpayService {
if (returnCode.equals("SUCCESS")) {
returnMap.put("ok", "200");
//拼接返回跳转地址
String url= config.NOTIFY_URL_H5;
String url= config.NOTIFY_URL_H5+"orderNumber="+wxPayEntity.getOut_trade_no() ;
returnMap.put("url", response.get("mweb_url")+"&redirect_url="+url);
} else {
returnMap.put("ok", "201");