developrelease_toaliyun_real
| @@ -7,9 +7,9 @@ import com.iformall.common.Result; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.domain.vo.MallUserInfoVo; | import com.iformall.domain.vo.MallUserInfoVo; | ||||
| import com.iformall.enums.EnumMallUserStatus; | |||||
| import com.iformall.enums.EnumMsgModel; | |||||
| import com.iformall.enums.*; | |||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.mq.MqBaseProducer; | |||||
| import com.iformall.service.*; | import com.iformall.service.*; | ||||
| import com.iformall.shiro.UserSession; | import com.iformall.shiro.UserSession; | ||||
| import com.iformall.shiro.UseriFormallToken; | import com.iformall.shiro.UseriFormallToken; | ||||
| @@ -66,6 +66,26 @@ public class HomeController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private WxMsgValidationcodeService wxMsgValidationcodeService; | private WxMsgValidationcodeService wxMsgValidationcodeService; | ||||
| @Autowired | |||||
| private MqBaseProducer mqBaseProducer; | |||||
| // @ApiOperation("发送邮件") | |||||
| // @GetMapping("test") | |||||
| // public ResultData test() throws Exception { | |||||
| // String msg = "<!DOCTYPE html><html><head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width,initial-scale=1.0\"><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /><meta name=\"viewport\" content=\"initial-scale=1.0, user-scalable=no\" /><meta name=\"renderer\" content=\"webkit\"><meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\"><title>富茂审批邮件</title><title></title><script> document.documentElement.style.fontSize = document.documentElement.clientWidth / 7.5 + 'px';</script></head>\n" + | |||||
| // "<body><div id=\"box\"><header style=\"height:140px;width:100%;display:flex;background:rgba(31,47,62,1);border-radius:15px 15px 0px 0px;\"><img style=\"height:auto;width:292px;display:flex;align-self: center;justify-content: center;margin-left: 40px;\" src=\"https://s3.cn-northwest-1.amazonaws.com.cn/iformall-net/cimg/changrong-logo.png\"/>\n" + | |||||
| // "</header><content><div style=\"font-size:26px;font-family:MicrosoftYaHei-Bold;font-weight:bold;color:rgba(85,85,85,1);line-height: 32px;margin-top: 56px;margin-left: 55px;\">审批通过通知</div><div style=\"font-size:18px;font-family:MicrosoftYaHei;font-weight:400;color:rgba(85,85,85,1);margin-left: 55px;margin-top: 36px;\">编号<span>123231232323</span>的合同已经审批通过,请登录,<a href=\"http://mall.youlane.cn\">长融后台</a>跟进后续工作</div></content></div></body></html>"; | |||||
| // MailMsg mailMsg = new MailMsg(); | |||||
| // mailMsg.setHtml(true); | |||||
| // mailMsg.setFrom("luozukai1988@126.com"); | |||||
| // mailMsg.setTo(new String[]{"luozukai@iformall.com"}); | |||||
| // mailMsg.setSubject("富茂测试邮件"); | |||||
| // mailMsg.setMsgType(EnumMsgRecordType.EMAIL.getCode()); | |||||
| // mailMsg.setMsg(msg); | |||||
| // mqBaseProducer.sendMessage(mailMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(),EnumMsgMqKey.DEFAULT.getCode()); | |||||
| // return new ResultData(); | |||||
| // } | |||||
| @GetMapping("/captcha.jpg") | @GetMapping("/captcha.jpg") | ||||
| public void captcha(HttpServletResponse response)throws ServletException, IOException { | public void captcha(HttpServletResponse response)throws ServletException, IOException { | ||||
| logger.debug("[" + getIpAddr() + "] HomeController::captcha"); | logger.debug("[" + getIpAddr() + "] HomeController::captcha"); | ||||
| @@ -2,8 +2,10 @@ package com.iformall.controller; | |||||
| import com.iformall.common.Result; | import com.iformall.common.Result; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.MailMsg; | |||||
| import com.iformall.domain.po.WxCoupon; | import com.iformall.domain.po.WxCoupon; | ||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| import com.iformall.mq.MqBaseProducer; | |||||
| import com.iformall.service.WxCouponService; | import com.iformall.service.WxCouponService; | ||||
| import com.iformall.utils.DateUtils; | import com.iformall.utils.DateUtils; | ||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| @@ -14,7 +16,10 @@ import org.apache.commons.collections.map.HashedMap; | |||||
| 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.mail.javamail.MimeMessageHelper; | |||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
| import javax.mail.internet.MimeMessage; | |||||
| import java.text.SimpleDateFormat; | import java.text.SimpleDateFormat; | ||||
| import java.util.*; | import java.util.*; | ||||
| @@ -27,7 +32,6 @@ public class WxCouponController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private WxCouponService wxCouponService; | private WxCouponService wxCouponService; | ||||
| @ApiOperation("分页列表接口") | @ApiOperation("分页列表接口") | ||||
| @GetMapping("listCoupon") | @GetMapping("listCoupon") | ||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @@ -12,7 +12,6 @@ import com.iformall.domain.po.WxPayOrder; | |||||
| import com.iformall.enums.EnumPayStatus; | import com.iformall.enums.EnumPayStatus; | ||||
| import com.iformall.enums.EnumPayWay; | import com.iformall.enums.EnumPayWay; | ||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.service.WxCouponService; | |||||
| import com.iformall.service.WxOrderService; | import com.iformall.service.WxOrderService; | ||||
| import com.iformall.service.WxPayOrderService; | import com.iformall.service.WxPayOrderService; | ||||
| import com.iformall.utils.IPUtil; | import com.iformall.utils.IPUtil; | ||||
| @@ -44,9 +43,6 @@ public class WxPayOrderController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private WxOrderService wxOrderService; | private WxOrderService wxOrderService; | ||||
| @Autowired | |||||
| private WxCouponService wxCouponService; | |||||
| @ApiOperation(value = "发起微信小程序支付订单", notes = "{\"orderId\":\"string\"}") | @ApiOperation(value = "发起微信小程序支付订单", notes = "{\"orderId\":\"string\"}") | ||||
| @RequestMapping(value = "/create", method = RequestMethod.POST) | @RequestMapping(value = "/create", method = RequestMethod.POST) | ||||
| public ResultData _create(@RequestBody Map<String, String> paramMap, HttpServletRequest request) throws Exception { | public ResultData _create(@RequestBody Map<String, String> paramMap, HttpServletRequest request) throws Exception { | ||||
| @@ -374,7 +374,7 @@ public enum ErrorCode{ | |||||
| * 拼团 | * 拼团 | ||||
| */ | */ | ||||
| ORDER_GROUP_COOPERATING_FAILD(28001, "参团失败"), | ORDER_GROUP_COOPERATING_FAILD(28001, "参团失败"), | ||||
| ORDER_GROUP_COOPERATING_FINISHED(28002, "拼团人数已满"), | |||||
| ; | ; | ||||
| private int code; | private int code; | ||||
| @@ -19,6 +19,9 @@ public class WxCoupon implements Serializable { | |||||
| @Transient | @Transient | ||||
| protected List<Long> ids; | protected List<Long> ids; | ||||
| @Transient | |||||
| protected List<Long> notinTypes; | |||||
| @Transient | @Transient | ||||
| protected String sortColumns; | protected String sortColumns; | ||||
| @@ -662,4 +665,12 @@ public class WxCoupon implements Serializable { | |||||
| public void setXtime(String xtime) { | public void setXtime(String xtime) { | ||||
| this.xtime = xtime; | this.xtime = xtime; | ||||
| } | } | ||||
| public List<Long> getNotinTypes() { | |||||
| return notinTypes; | |||||
| } | |||||
| public void setNotinTypes(List<Long> notinTypes) { | |||||
| this.notinTypes = notinTypes; | |||||
| } | |||||
| } | } | ||||
| @@ -117,6 +117,18 @@ public class WxCouponOrderBVo extends WxCouponOrder{ | |||||
| @Transient | @Transient | ||||
| private Date endDate; | private Date endDate; | ||||
| @Transient | |||||
| private Long couponId; | |||||
| @Override | |||||
| public Long getCouponId() { | |||||
| return couponId; | |||||
| } | |||||
| @Override | |||||
| public void setCouponId(Long couponId) { | |||||
| this.couponId = couponId; | |||||
| } | |||||
| public Date getStartDate() { | public Date getStartDate() { | ||||
| return startDate; | return startDate; | ||||
| @@ -14,6 +14,8 @@ import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.context.annotation.Profile; | import org.springframework.context.annotation.Profile; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import java.util.UUID; | |||||
| /** | /** | ||||
| * @Auther: Stormeye | * @Auther: Stormeye | ||||
| * @Date: 2019-01-31 | * @Date: 2019-01-31 | ||||
| @@ -34,6 +36,7 @@ public class RabbitMqMessageProducer implements MqBaseProducer { | |||||
| @Override | @Override | ||||
| public void sendMessage(BaseMsg data, String topic, String tags, String keys) { | public void sendMessage(BaseMsg data, String topic, String tags, String keys) { | ||||
| try { | try { | ||||
| data.setUuid(UUID.randomUUID().toString()); | |||||
| wxMsgRecordService.save(data); | wxMsgRecordService.save(data); | ||||
| rabbitTemplate.convertAndSend(topic, JsonUtil.obj2Json(data)); | rabbitTemplate.convertAndSend(topic, JsonUtil.obj2Json(data)); | ||||
| @@ -59,6 +59,7 @@ public class RocketMqMessageProducer implements MqBaseProducer { | |||||
| @Override | @Override | ||||
| public void sendMessage(BaseMsg data, String topic, String tags, String keys) { | public void sendMessage(BaseMsg data, String topic, String tags, String keys) { | ||||
| try { | try { | ||||
| data.setUuid(UUID.randomUUID().toString()); | |||||
| wxMsgRecordService.save(data); | wxMsgRecordService.save(data); | ||||
| byte[] messageBody = JsonUtil.obj2Json(data).getBytes(RemotingHelper.DEFAULT_CHARSET); | byte[] messageBody = JsonUtil.obj2Json(data).getBytes(RemotingHelper.DEFAULT_CHARSET); | ||||
| @@ -35,7 +35,7 @@ public class SendEmailServiceImpl implements MsgSendService { | |||||
| public void send(BaseMsg baseMsg) throws Exception{ | public void send(BaseMsg baseMsg) throws Exception{ | ||||
| MailMsg mailMsg = (MailMsg)baseMsg; | MailMsg mailMsg = (MailMsg)baseMsg; | ||||
| if(mailMsg.isHtml()){ | |||||
| if(mailMsg.isHtml()){ //html邮件 | |||||
| MimeMessage message = sender.createMimeMessage(); | MimeMessage message = sender.createMimeMessage(); | ||||
| MimeMessageHelper helper = new MimeMessageHelper(message, true); | MimeMessageHelper helper = new MimeMessageHelper(message, true); | ||||
| helper.setFrom(from); | helper.setFrom(from); | ||||
| @@ -29,7 +29,7 @@ public class WxMsgRecordServiceImpl implements WxMsgRecordService { | |||||
| } | } | ||||
| msgRecord.setMsgType(data.getMsgType()); | msgRecord.setMsgType(data.getMsgType()); | ||||
| msgRecord.setUuid(UUID.randomUUID().toString()); | |||||
| msgRecord.setUuid(data.getUuid()); | |||||
| msgRecord.setMsgJson(JsonUtil.obj2Json(data)); | msgRecord.setMsgJson(JsonUtil.obj2Json(data)); | ||||
| msgRecord.setId(idWorker.nextId()); | msgRecord.setId(idWorker.nextId()); | ||||
| wxMsgRecordMapper.save(msgRecord); | wxMsgRecordMapper.save(msgRecord); | ||||
| @@ -99,6 +99,9 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| @Autowired | @Autowired | ||||
| WxOrderPressMapper wxOrderPressMapper; | WxOrderPressMapper wxOrderPressMapper; | ||||
| @Autowired | |||||
| WxOrderGroupMapper wxOrderGroupMapper; | |||||
| @Override | @Override | ||||
| public PageInfo<WxOrder> listAsPage(WxOrder record, Integer pageIndex, Integer pageSize) { | public PageInfo<WxOrder> listAsPage(WxOrder record, Integer pageIndex, Integer pageSize) { | ||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxOrderMapper.findList(record)); | return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxOrderMapper.findList(record)); | ||||
| @@ -354,7 +357,13 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| logger.error("商户不存在, couponId: " + couponIdStr); | logger.error("商户不存在, couponId: " + couponIdStr); | ||||
| throw new MallinkException(ErrorCode.MERCHANT_INFO_NOT_FOUND); | throw new MallinkException(ErrorCode.MERCHANT_INFO_NOT_FOUND); | ||||
| } | } | ||||
| if (!orderGroupId.equals(0L)) { | |||||
| WxOrderGroup group = wxOrderGroupMapper.selectByPrimaryKey(orderGroupId); | |||||
| if (group.getStatus().equals(EnumOrderStatus.ORDER_STATUS_COOPERATING_COMPLETE.getCode())) { | |||||
| logger.error("下订单拼团人数已满>>>" + orderGroupId); | |||||
| throw new MallinkException(ErrorCode.ORDER_GROUP_COOPERATING_FINISHED); | |||||
| } | |||||
| } | |||||
| // 减库存操作 | // 减库存操作 | ||||
| stockReduce(user, coupon, couponIdStr); | stockReduce(user, coupon, couponIdStr); | ||||
| @@ -121,6 +121,19 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||||
| logger.error("pay order, order not allow, repaymentReq: " + record.toString() + ", payWay: " + payWay.toString()); | logger.error("pay order, order not allow, repaymentReq: " + record.toString() + ", payWay: " + payWay.toString()); | ||||
| throw new MallinkException(ErrorCode.ORDER_IS_NOT_FIND); | throw new MallinkException(ErrorCode.ORDER_IS_NOT_FIND); | ||||
| } | } | ||||
| if (!order.getOrderGroupId().equals(0L) && | |||||
| order.getOrderStatus().equals(EnumOrderStatus.ORDER_STATUS_COOPERATING_COMPLETE.getCode())) { | |||||
| logger.error("支付时拼团已满>>" + order.getOrderGroupId()); | |||||
| throw new MallinkException(ErrorCode.ORDER_GROUP_COOPERATING_FINISHED); | |||||
| } | |||||
| WxCoupon wxCoupon = wxCouponMapper.selectByPrimaryKey(order.getProductId()); | |||||
| if (wxCoupon.getType().equals(EnumCouponType.COUPON_GROUP.getCode()) && | |||||
| wxCoupon.getStatus().equals(EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode())) { | |||||
| logger.error("券已经下架了>>>" + order.getProductId()); | |||||
| throw new MallinkException(ErrorCode.COUPON_CHANNEL_IS_TAKE_OFF); | |||||
| } | |||||
| if(order.getPressEndDate() == null) { | if(order.getPressEndDate() == null) { | ||||
| // 非砍价券 | // 非砍价券 | ||||
| if (order.getOrderStatus() == EnumOrderStatus.ORDER_STATUS_PAYMENT_SUCCESS.getCode()) { | if (order.getOrderStatus() == EnumOrderStatus.ORDER_STATUS_PAYMENT_SUCCESS.getCode()) { | ||||
| @@ -313,7 +313,12 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| logger.info("id:{},启动审批流成功 ,是否补录:{}",record.getId().toString(),record.getMerchantId() != null); | logger.info("id:{},启动审批流成功 ,是否补录:{}",record.getId().toString(),record.getMerchantId() != null); | ||||
| } | } | ||||
| // 保存调整金额(预账单调整) | |||||
| if(!CollectionUtils.isEmpty(record.getPreviewBillRentList())){ | |||||
| for (WxBillRent wxBillRent:record.getPreviewBillRentList()) { | |||||
| wxBillRentMapper.update(wxBillRent); | |||||
| } | |||||
| } | |||||
| WxRentContract wxRentContract = (WxRentContract)resultData.data; | WxRentContract wxRentContract = (WxRentContract)resultData.data; | ||||
| wxRentContract.setPreviewBillRentList(resultList); | wxRentContract.setPreviewBillRentList(resultList); | ||||
| return new ResultData(wxRentContract); | return new ResultData(wxRentContract); | ||||
| @@ -183,6 +183,13 @@ | |||||
| #{idItem} | #{idItem} | ||||
| </foreach> | </foreach> | ||||
| </if> | </if> | ||||
| <if test=" null != notinTypes "> | |||||
| and type not in | |||||
| <foreach collection="notinTypes" index="index" item="typeItem" open="(" separator="," close=")"> | |||||
| #{typeItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | <if test=" null != sortColumns">order by ${sortColumns}</if> | ||||
| </sql> | </sql> | ||||
| @@ -358,6 +358,9 @@ | |||||
| <if test=" null != id "> | <if test=" null != id "> | ||||
| and co.id = #{id} | and co.id = #{id} | ||||
| </if> | </if> | ||||
| <if test=" null != couponId "> | |||||
| and c.id = #{couponId} | |||||
| </if> | |||||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | <if test=" null != sortColumns"> order by ${sortColumns} </if> | ||||
| @@ -233,7 +233,7 @@ | |||||
| from wx_coupon c,wx_order o | from wx_coupon c,wx_order o | ||||
| left join wx_coupon_order co on co.order_id = o.id | left join wx_coupon_order co on co.order_id = o.id | ||||
| left join wx_coupon_action_log cal on cal.coupon_order_id = co.id | left join wx_coupon_action_log cal on cal.coupon_order_id = co.id | ||||
| where o.product_id = c.id | |||||
| where o.product_id = c.id and c.type!=9 | |||||
| <if test="cUserId != null"> | <if test="cUserId != null"> | ||||
| and o.c_user_id = #{cUserId} | and o.c_user_id = #{cUserId} | ||||
| </if> | </if> | ||||