|
|
@ -30,6 +30,7 @@ import com.yxt.yythmall.biz.lpkgoods.LpkGoodsService; |
|
|
|
import com.yxt.yythmall.biz.ordorderdetails.OrdOrderDetailService; |
|
|
|
import com.yxt.yythmall.biz.shoppingcart.ShoppingCartService; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
import org.springframework.http.ResponseEntity; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
@ -48,6 +49,7 @@ public class OrdOrderService extends MybatisBaseService<OrdOrderMapper, OrdOrder |
|
|
|
|
|
|
|
private static final String OrderUrl="https://supervise.yxtsoft.com/lpkapi/empcardgift/generateTopEmpCard?mainSid="; |
|
|
|
private static final String or="https://supervise.yxtsoft.com/lpkapi/vegetablecellar/addGoods?mainSid="; |
|
|
|
private static final String payUrl="https://supervise.yxtsoft.com/lpkapi/empsreservoorder/getPreOrder"; |
|
|
|
@Autowired |
|
|
|
OrdOrderDetailService ordOrderDetailsService; |
|
|
|
@Autowired |
|
|
@ -62,12 +64,19 @@ public class OrdOrderService extends MybatisBaseService<OrdOrderMapper, OrdOrder |
|
|
|
OrdOrderDetailService ordOrderDetailService; |
|
|
|
@Autowired |
|
|
|
private FileUploadComponent fileUploadComponent; |
|
|
|
@Value("${weixin.miniprogram.appid:wx4724e3a3c27f36b5}") |
|
|
|
String appId; |
|
|
|
@Value("${weixin.miniprogram.secret:971fd3b8aa7b08ce3e8a5f3e502b1a8d}") |
|
|
|
String secret; |
|
|
|
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public ResultBean createOrder(OrdOrderDto dto) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
PayResult result=new PayResult(); |
|
|
|
if(StringUtils.isBlank(dto.getCustomerSid())){ |
|
|
|
return rb.setMsg("参数不全"); |
|
|
|
} |
|
|
|
Map<String,Object>map =new HashMap<>(); |
|
|
|
LpkCustomerVo vo= lpkCustomerService.getCustomerInfo(dto.getCustomerSid()).getData(); |
|
|
|
Map<String, Object> sendBody=buildMessageBody( vo.getSid(), vo.getWxMpOpenid(),dto.getTotalTee(),dto.getOrdOrderDetailsVoList(),OrderUrl); |
|
|
@ -151,9 +160,17 @@ public class OrdOrderService extends MybatisBaseService<OrdOrderMapper, OrdOrder |
|
|
|
public ResultBean createVegeOrder(OrdOrderDto dto) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
PayResult result=new PayResult(); |
|
|
|
if(StringUtils.isBlank(dto.getCustomerSid())){ |
|
|
|
return rb.setMsg("参数不全"); |
|
|
|
} |
|
|
|
if(StringUtils.isBlank(dto.getBrandId())){ |
|
|
|
return rb.setMsg("参数不全"); |
|
|
|
} |
|
|
|
|
|
|
|
List<OrdOrderDetailVo> ordOrderDetailVos=new ArrayList<>(); |
|
|
|
|
|
|
|
ShoppingCartQuery query=new ShoppingCartQuery(); |
|
|
|
|
|
|
|
query.setCustomerSid(dto.getCustomerSid()); |
|
|
|
query.setBrandId(dto.getBrandId()); |
|
|
|
List<ShoppingCartVo> vos=shoppingCartService.shoppingCartList(query).getData(); |
|
|
@ -262,6 +279,9 @@ public class OrdOrderService extends MybatisBaseService<OrdOrderMapper, OrdOrder |
|
|
|
public ResultBean createNewUserBagOrder(OrdOrderDto dto) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
PayResult result=new PayResult(); |
|
|
|
if(StringUtils.isBlank(dto.getCustomerSid())){ |
|
|
|
return rb.setMsg("参数不全"); |
|
|
|
} |
|
|
|
List<OrdOrderDetailVo> ordOrderDetailVos=new ArrayList<>(); |
|
|
|
|
|
|
|
List<GiftBagGoodss> vos=appletGiftBagService.getGoodsByBagSid(dto.getBagSid()).getData(); |
|
|
@ -379,6 +399,7 @@ public class OrdOrderService extends MybatisBaseService<OrdOrderMapper, OrdOrder |
|
|
|
mp_template_msg.put("name", name); |
|
|
|
mp_template_msg.put("timeRemarks", "10"); |
|
|
|
mp_template_msg.put("returnUrl", returnUrl); |
|
|
|
mp_template_msg.put("payUrl",payUrl); |
|
|
|
return mp_template_msg; |
|
|
|
} |
|
|
|
|
|
|
@ -412,6 +433,9 @@ public class OrdOrderService extends MybatisBaseService<OrdOrderMapper, OrdOrder |
|
|
|
public ResultBean<OrdOrderVo> getOrderDetails(String sid) { |
|
|
|
ResultBean rb=new ResultBean().fail(); |
|
|
|
OrdOrderVo pagging = baseMapper.getOrderDetails(sid); |
|
|
|
if(StringUtils.isBlank(sid)){ |
|
|
|
return rb.setMsg("参数不全"); |
|
|
|
} |
|
|
|
List<OrdOrderDetail> details=ordOrderDetailService.list(new QueryWrapper<OrdOrderDetail>().eq("orderSid",pagging.getSid())); |
|
|
|
if(StringUtils.isBlank(pagging.getMeet())){ |
|
|
|
pagging.setMeet(pagging.getTotalTee()); |
|
|
@ -466,6 +490,9 @@ public class OrdOrderService extends MybatisBaseService<OrdOrderMapper, OrdOrder |
|
|
|
} |
|
|
|
public ResultBean changePayState(String sid) { |
|
|
|
ResultBean rb=new ResultBean().fail(); |
|
|
|
if(StringUtils.isBlank(sid)){ |
|
|
|
return rb.setMsg("参数不全"); |
|
|
|
} |
|
|
|
OrdOrder order=baseMapper.selectOne(new QueryWrapper<OrdOrder>().eq("sid",sid)); |
|
|
|
if(order.getPayStatus()==2){ |
|
|
|
order.setPayStatus(3); |
|
|
@ -473,6 +500,16 @@ public class OrdOrderService extends MybatisBaseService<OrdOrderMapper, OrdOrder |
|
|
|
} |
|
|
|
return rb.success().setData(order); |
|
|
|
} |
|
|
|
public ResultBean getPreOrder(OrdOrderQuery query) { |
|
|
|
ResultBean rb=new ResultBean().fail(); |
|
|
|
if(StringUtils.isBlank(query.getMainSid())){ |
|
|
|
return rb.setMsg("参数不全"); |
|
|
|
} |
|
|
|
OrdOrder order=baseMapper.selectOne(new QueryWrapper<OrdOrder>().eq("mainSid",query.getMainSid())); |
|
|
|
order.setCreateTime(DateUtil.parse(query.getPayTime())); |
|
|
|
baseMapper.updateById(order); |
|
|
|
return rb.success().setData(order); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|