developrelease_toaliyun_real
| @@ -15,6 +15,7 @@ import com.iformall.enums.EnumCouponSendSendType; | |||||
| import com.iformall.enums.EnumCouponSendStatus; | import com.iformall.enums.EnumCouponSendStatus; | ||||
| import com.iformall.enums.EnumCouponSendType; | import com.iformall.enums.EnumCouponSendType; | ||||
| import com.iformall.enums.EnumCouponStatus; | import com.iformall.enums.EnumCouponStatus; | ||||
| import com.iformall.exception.MallinkException; | |||||
| import com.iformall.service.WxCouponActionLogService; | import com.iformall.service.WxCouponActionLogService; | ||||
| import com.iformall.service.WxCouponSendService; | import com.iformall.service.WxCouponSendService; | ||||
| import com.iformall.service.WxCouponService; | import com.iformall.service.WxCouponService; | ||||
| @@ -145,7 +146,11 @@ public class WxCouponSendController extends BaseController { | |||||
| if (wxCouponSend == null) { | if (wxCouponSend == null) { | ||||
| return new ResultData(ErrorCode.COUPON_SEND_IS_INVALID); | return new ResultData(ErrorCode.COUPON_SEND_IS_INVALID); | ||||
| } | } | ||||
| try { | |||||
| wxCouponSendService.updateInvalid(wxCouponSend); | wxCouponSendService.updateInvalid(wxCouponSend); | ||||
| } catch (MallinkException e) { | |||||
| return new ResultData(e.getErrorCode(),e.getMessage()) ; | |||||
| } | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @@ -2,6 +2,7 @@ package com.iformall.controller.mem; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.annotation.SystemControllerLog; | import com.iformall.annotation.SystemControllerLog; | ||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.Result; | import com.iformall.common.Result; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.controller.base.BaseController; | import com.iformall.controller.base.BaseController; | ||||
| @@ -13,6 +14,7 @@ import com.iformall.service.WxCreditHistoryService; | |||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| import io.swagger.annotations.ApiImplicitParams; | import io.swagger.annotations.ApiImplicitParams; | ||||
| import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
| import org.apache.commons.lang3.StringUtils; | |||||
| 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; | ||||
| @@ -20,6 +22,7 @@ import org.springframework.web.bind.annotation.*; | |||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
| import java.util.Objects; | |||||
| @RestController | @RestController | ||||
| @RequestMapping("wxCreditHistory") | @RequestMapping("wxCreditHistory") | ||||
| @@ -49,8 +52,11 @@ public class WxCreditHistoryController extends BaseController { | |||||
| @ApiImplicitParam(name = "spend", value = "消费金额", dataType = "int", paramType = "query", required = true), | @ApiImplicitParam(name = "spend", value = "消费金额", dataType = "int", paramType = "query", required = true), | ||||
| @ApiImplicitParam(name = "userId", value = "会员Id", dataType = "long", paramType = "query", required = true)}) | @ApiImplicitParam(name = "userId", value = "会员Id", dataType = "long", paramType = "query", required = true)}) | ||||
| @SystemControllerLog(description = "积分历史-根据商户ID和消费金额获取所增加积分") | @SystemControllerLog(description = "积分历史-根据商户ID和消费金额获取所增加积分") | ||||
| public ResultData findByMerchantIdAndSpend(@RequestParam Long merchantId, @RequestParam String spendStr,@RequestParam Long userId) { | |||||
| public ResultData findByMerchantIdAndSpend(Long merchantId, String spendStr,Long userId) { | |||||
| logger.debug("[" + getIpAddr() + "] WxCreditHistoryController::findByMerchantIdAndSpend"); | logger.debug("[" + getIpAddr() + "] WxCreditHistoryController::findByMerchantIdAndSpend"); | ||||
| if(Objects.isNull(merchantId)|| StringUtils.isEmpty(spendStr)||Objects.isNull(userId)) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL) ; | |||||
| } | |||||
| return new ResultData(wxCreditHistoryService.findByMerchantIdAndSpend(merchantId, spendStr, userId,getTenantId())); | return new ResultData(wxCreditHistoryService.findByMerchantIdAndSpend(merchantId, spendStr, userId,getTenantId())); | ||||
| } | } | ||||
| @@ -3,6 +3,9 @@ package com.iformall.service.test; | |||||
| import com.alibaba.fastjson.JSON; | import com.alibaba.fastjson.JSON; | ||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.domain.vo.WxBillAll; | import com.iformall.domain.vo.WxBillAll; | ||||
| import com.iformall.enums.EnumSettleRecordWay; | |||||
| import com.iformall.enums.EnumSettleStatus; | |||||
| import com.iformall.mapper.WxBillSettleMapper; | |||||
| import com.iformall.service.*; | import com.iformall.service.*; | ||||
| import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
| import org.apache.shiro.SecurityUtils; | import org.apache.shiro.SecurityUtils; | ||||
| @@ -27,6 +30,8 @@ import org.springframework.test.web.servlet.setup.MockMvcBuilders; | |||||
| import org.springframework.web.context.WebApplicationContext; | import org.springframework.web.context.WebApplicationContext; | ||||
| import javax.annotation.Resource; | import javax.annotation.Resource; | ||||
| import java.math.BigDecimal; | |||||
| import java.util.Date; | |||||
| @Slf4j | @Slf4j | ||||
| @AutoConfigureMockMvc | @AutoConfigureMockMvc | ||||
| @@ -61,6 +66,10 @@ public class Test { | |||||
| private WxBillSettleService wxBillSettleService; | private WxBillSettleService wxBillSettleService; | ||||
| @Autowired | @Autowired | ||||
| private WxBillAllService wxBillAllService; | private WxBillAllService wxBillAllService; | ||||
| @Autowired | |||||
| private WxBillSettleMapper wxBillSettleMapper; | |||||
| @Autowired | |||||
| private WxBillSettleRecordService wxBillSettleRecordService; | |||||
| @Before | @Before | ||||
| public void setUp() { | public void setUp() { | ||||
| @@ -87,11 +96,29 @@ public class Test { | |||||
| public void levelList() { | public void levelList() { | ||||
| // WxBillSettle settle = wxBillSettleService.getById(328411851323572224l); | // WxBillSettle settle = wxBillSettleService.getById(328411851323572224l); | ||||
| // log.debug("data:{}", JSON.toJSONString(settle)); | // log.debug("data:{}", JSON.toJSONString(settle)); | ||||
| WxBillAll wxBillAll = new WxBillAll(); | |||||
| wxBillAll.setMerchantId(324754110547066880l); | |||||
| wxBillAll.setTenantId("456"); | |||||
| wxBillAll.setBillTypeValue(10); | |||||
| log.debug("data:{}", JSON.toJSONString( wxBillAllService.listBill(wxBillAll))); | |||||
| // WxBillAll wxBillAll = new WxBillAll(); | |||||
| // wxBillAll.setMerchantId(324754110547066880l); | |||||
| // wxBillAll.setTenantId("456"); | |||||
| // wxBillAll.setBillTypeValue(10); | |||||
| // log.debug("data:{}", JSON.toJSONString( wxBillAllService.listBill(wxBillAll))); | |||||
| WxBillSettle wxBillSettle = wxBillSettleService.getById(330875180045271040l); | |||||
| WxBillSettleRecord settleRecord = new WxBillSettleRecord(); | |||||
| settleRecord.setSettleId(wxBillSettle.getId()); | |||||
| settleRecord.setSettleMoney(wxBillSettle.getBalance()); | |||||
| settleRecord.setSettleTime(new Date()); | |||||
| settleRecord.setSettleWay(EnumSettleRecordWay.WEBCAT.getCode()); | |||||
| settleRecord.setTenantId(wxBillSettle.getTenantId()); | |||||
| BigDecimal money = new BigDecimal(settleRecord.getSettleMoney()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP); | |||||
| settleRecord.setDetail(EnumSettleRecordWay.getEnum(settleRecord.getSettleWay()).getMessage()+"收款"+money.toString()+"元"); | |||||
| wxBillSettleRecordService.saveOrUpdate(settleRecord,null,wxBillSettle.getId()); | |||||
| wxBillSettle.setUpdatetime(new Date()); | |||||
| wxBillSettle.setStatus(EnumSettleStatus.FINISH.getCode()); | |||||
| wxBillSettleMapper.updateByPrimaryKeySelective(wxBillSettle); | |||||
| } | } | ||||
| @@ -43,6 +43,7 @@ import tk.mybatis.mapper.entity.Example; | |||||
| import javax.annotation.Resource; | import javax.annotation.Resource; | ||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.HashMap; | |||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Map; | import java.util.Map; | ||||
| @@ -173,4 +174,25 @@ public class WebTest { | |||||
| log.info("respMap -> {}", JSON.toJSONString(respMap)); | log.info("respMap -> {}", JSON.toJSONString(respMap)); | ||||
| } | } | ||||
| @Test | |||||
| public void add() throws Exception { | |||||
| Map<String, Object> params = new HashMap<>(); | |||||
| params.put("creditNum", "1"); | |||||
| params.put("creditType", "12"); | |||||
| params.put("cuserId", "329879374400159744"); | |||||
| params.put("operatorType", "4"); | |||||
| MvcResult result = mockMvc.perform( | |||||
| MockMvcRequestBuilders.post("/wxCreditHistory/add") | |||||
| .contentType(MediaType.APPLICATION_JSON_UTF8) | |||||
| .content(JSON.toJSONString(params)) | |||||
| ) | |||||
| .andExpect(MockMvcResultMatchers.status().isOk()) | |||||
| .andDo(MockMvcResultHandlers.print()) | |||||
| .andReturn(); | |||||
| String responseStr = result.getResponse().getContentAsString(); | |||||
| ObjectMapper mapper = new ObjectMapper(); | |||||
| Map<String, String> respMap = mapper.readValue(responseStr, Map.class); | |||||
| log.info("respMap -> {}", JSON.toJSONString(respMap)); | |||||
| } | |||||
| } | } | ||||
| @@ -49,7 +49,7 @@ public class WxCouponSendController extends BaseController { | |||||
| public ResultData list(WxCouponSend wxCouponSend, Integer pageNum, Integer pageSize) { | public ResultData list(WxCouponSend wxCouponSend, Integer pageNum, Integer pageSize) { | ||||
| logger.debug("[" + getIpAddr() + "] WxCouponSendController::list"); | logger.debug("[" + getIpAddr() + "] WxCouponSendController::list"); | ||||
| if (Objects.isNull(wxCouponSend.getSendType())) { | if (Objects.isNull(wxCouponSend.getSendType())) { | ||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||||
| } | } | ||||
| wxCouponSend.setTenantId(getTenantId()); | wxCouponSend.setTenantId(getTenantId()); | ||||
| wxCouponSend.setMerchantId(getUser().getMerchantId()); | wxCouponSend.setMerchantId(getUser().getMerchantId()); | ||||
| @@ -78,20 +78,18 @@ public class WxCouponSendController extends BaseController { | |||||
| public ResultData handSel(@RequestBody Map<String, Object> params) { | public ResultData handSel(@RequestBody Map<String, Object> params) { | ||||
| logger.debug("[" + getIpAddr() + "] WxCouponSendController::handSel"); | logger.debug("[" + getIpAddr() + "] WxCouponSendController::handSel"); | ||||
| if (CollectionUtils.isEmpty(params)) { | if (CollectionUtils.isEmpty(params)) { | ||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||||
| } | |||||
| WxCUser cu = wxCUserMapper.selectByPrimaryKey(params.get("cUserId")); | |||||
| if (Objects.isNull(cu)) { | |||||
| throw new MallinkException(ErrorCode.USER_IS_EMPTY); | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||||
| } | } | ||||
| Object cUserId = params.get("cUserId") ; | |||||
| if (!params.containsKey("wxCouponSendIds")) { | if (!params.containsKey("wxCouponSendIds")) { | ||||
| throw new MallinkException(ErrorCode.COUPON_IS_EMPTY); | |||||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY); | |||||
| } | } | ||||
| List<String> wxCouponSendIds = (List<String>) params.get("wxCouponSendIds"); | List<String> wxCouponSendIds = (List<String>) params.get("wxCouponSendIds"); | ||||
| if (CollectionUtils.isEmpty(wxCouponSendIds)) { | if (CollectionUtils.isEmpty(wxCouponSendIds)) { | ||||
| throw new MallinkException(ErrorCode.COUPON_IS_EMPTY); | |||||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY); | |||||
| } | } | ||||
| WxCouponSend wxCouponSend = new WxCouponSend(); | WxCouponSend wxCouponSend = new WxCouponSend(); | ||||
| @@ -99,7 +97,15 @@ public class WxCouponSendController extends BaseController { | |||||
| wxCouponSend.setTenantId(getTenantId()); | wxCouponSend.setTenantId(getTenantId()); | ||||
| wxCouponSend.setSendType(EnumCouponSendSendType.MERCHANT.getCode()); | wxCouponSend.setSendType(EnumCouponSendSendType.MERCHANT.getCode()); | ||||
| wxCouponSend.setStatus(EnumCouponSendStatus.VALID.getCode()); | wxCouponSend.setStatus(EnumCouponSendStatus.VALID.getCode()); | ||||
| wxCouponSendService.handSel(wxCouponSend, cu); | |||||
| try { | |||||
| wxCouponSendService.handSel(wxCouponSend, cUserId); | |||||
| } catch (MallinkException e) { | |||||
| logger.error("注异常: " + e.getMessage()); | |||||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||||
| } catch (Exception e) { | |||||
| logger.error("注异常: " + e.getMessage()); | |||||
| return new ResultData(ErrorCode.COUPON_HANDSEL_VERIFY, e.getMessage()); | |||||
| } | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @@ -193,6 +193,7 @@ public enum ErrorCode{ | |||||
| COUPON_ORDER_IS_LATER_THAN_VALIDDATE(4007, "卡券使用期已结束"), | COUPON_ORDER_IS_LATER_THAN_VALIDDATE(4007, "卡券使用期已结束"), | ||||
| COUPON_ORDER_IS_PRE_VERIFY(4008, "卡券已被预核销"), | COUPON_ORDER_IS_PRE_VERIFY(4008, "卡券已被预核销"), | ||||
| COUPON_SEND_LIMIT_VERIFY(4009, "商户购券数错误"), | COUPON_SEND_LIMIT_VERIFY(4009, "商户购券数错误"), | ||||
| COUPON_HANDSEL_VERIFY(4010, "商户发券异常"), | |||||
| /** | /** | ||||
| * 卡 | * 卡 | ||||
| @@ -235,6 +236,7 @@ public enum ErrorCode{ | |||||
| MP_TEMPLATE_SEND_FAILED(11009, "公众号模板消息发送失败"), | MP_TEMPLATE_SEND_FAILED(11009, "公众号模板消息发送失败"), | ||||
| UNIFORM_SEND_FAILED(11010, "小程序统一消息发送失败"), | UNIFORM_SEND_FAILED(11010, "小程序统一消息发送失败"), | ||||
| USER_LOGIN_FAILED(11011, "微信用户未登录或登录有问题"), | USER_LOGIN_FAILED(11011, "微信用户未登录或登录有问题"), | ||||
| USER_NOT_AUTH_PHONE(11011, "用户小程序未授权手机号码"), | |||||
| /** | /** | ||||
| * POS | * POS | ||||
| @@ -93,7 +93,11 @@ public interface WxCouponSendService { | |||||
| */ | */ | ||||
| void backMerchantRemainInventory(Long id, Integer merchantRemain, Integer merchantSend ,Integer number); | void backMerchantRemainInventory(Long id, Integer merchantRemain, Integer merchantSend ,Integer number); | ||||
| void handSel(WxCouponSend wxCouponSend, WxCUser user) ; | |||||
| /** | |||||
| * | |||||
| * @param wxCouponSend | |||||
| */ | |||||
| void handSel(WxCouponSend wxCouponSend,Object cUserId) ; | |||||
| } | } | ||||
| @@ -16,6 +16,7 @@ import com.iformall.mapper.*; | |||||
| import com.iformall.mq.MqBaseProducer; | import com.iformall.mq.MqBaseProducer; | ||||
| import com.iformall.service.*; | import com.iformall.service.*; | ||||
| import com.iformall.utils.DateUtils; | import com.iformall.utils.DateUtils; | ||||
| import com.iformall.utils.JsonUtil; | |||||
| import com.iformall.utils.PriceUtil; | import com.iformall.utils.PriceUtil; | ||||
| import com.iformall.utils.WordUtil; | import com.iformall.utils.WordUtil; | ||||
| import org.apache.commons.collections.CollectionUtils; | import org.apache.commons.collections.CollectionUtils; | ||||
| @@ -253,21 +254,32 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||||
| updateBillOtherDeposit(bill); | updateBillOtherDeposit(bill); | ||||
| } | } | ||||
| } else if (billTypeValue == EnumBillTypeParam.SETTLE.getCode().intValue()) { | } else if (billTypeValue == EnumBillTypeParam.SETTLE.getCode().intValue()) { | ||||
| logger.info("更新结算单id:{}",(Long)bill.get("id")); | |||||
| WxBillSettleRecord settleRecord = new WxBillSettleRecord(); | |||||
| settleRecord.setSettleId((Long)bill.get("id")); | |||||
| settleRecord.setSettleMoney((Long) bill.get("owe")); | |||||
| settleRecord.setSettleTime(new Date()); | |||||
| settleRecord.setSettleWay(EnumSettleRecordWay.WEBCAT.getCode()); | |||||
| BigDecimal money = new BigDecimal(settleRecord.getSettleMoney()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP); | |||||
| settleRecord.setDetail(EnumSettleRecordWay.getEnum(settleRecord.getSettleWay()).getMessage()+"收款"+money.toString()+"元"); | |||||
| wxBillSettleRecordService.saveOrUpdate(settleRecord,null,(Long)bill.get("userId")); | |||||
| WxBillSettle wxBillSettle = new WxBillSettle(); | |||||
| wxBillSettle.setId(settleRecord.getSettleId()); | |||||
| wxBillSettle.setStatus(EnumSettleStatus.FINISH.getCode()); | |||||
| wxBillSettleMapper.updateByPrimaryKeySelective(wxBillSettle); | |||||
| try { | |||||
| logger.info("更新结算单id:{}", JsonUtil.obj2Json(bill)); | |||||
| WxBillSettle wxBillSettle = wxBillSettleService.getById((Long)bill.get("id")); | |||||
| WxBillSettleRecord settleRecord = new WxBillSettleRecord(); | |||||
| settleRecord.setSettleId((Long)bill.get("id")); | |||||
| settleRecord.setSettleMoney(wxBillSettle.getBalance()); | |||||
| settleRecord.setSettleTime(new Date()); | |||||
| settleRecord.setSettleWay(EnumSettleRecordWay.WEBCAT.getCode()); | |||||
| settleRecord.setTenantId(wxBillSettle.getTenantId()); | |||||
| BigDecimal money = new BigDecimal(settleRecord.getSettleMoney()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP); | |||||
| settleRecord.setDetail(EnumSettleRecordWay.getEnum(settleRecord.getSettleWay()).getMessage()+"收款"+money.toString()+"元"); | |||||
| wxBillSettleRecordService.saveOrUpdate(settleRecord,null,(Long)bill.get("userId")); | |||||
| wxBillSettle.setUpdatetime(new Date()); | |||||
| wxBillSettle.setStatus(EnumSettleStatus.FINISH.getCode()); | |||||
| wxBillSettleMapper.updateByPrimaryKeySelective(wxBillSettle); | |||||
| logger.info("更新结算单success"); | |||||
| }catch (Exception e){ | |||||
| logger.error("结算单error",e); | |||||
| e.printStackTrace(); | |||||
| } | |||||
| }else{ | }else{ | ||||
| logger.info("账单类型不存在"); | logger.info("账单类型不存在"); | ||||
| } | } | ||||
| @@ -128,23 +128,20 @@ public class WxBillDepositServiceImpl implements WxBillDepositService { | |||||
| return new ResultData(ErrorCode.BILL_RENT_DEPOSIT_IS_NOT_FOUND); | return new ResultData(ErrorCode.BILL_RENT_DEPOSIT_IS_NOT_FOUND); | ||||
| } | } | ||||
| Long addpay = wxBillDeposit.getPay(); | Long addpay = wxBillDeposit.getPay(); | ||||
| wxBillDeposit.setPayDate(record.getPayDate()); | |||||
| wxBillDeposit.setPay(record.getPay()); | wxBillDeposit.setPay(record.getPay()); | ||||
| wxBillDeposit.setReceivePay(record.getReceivePay()); | wxBillDeposit.setReceivePay(record.getReceivePay()); | ||||
| wxBillDeposit.setOwe(record.getReceivePay()-record.getPay()); | wxBillDeposit.setOwe(record.getReceivePay()-record.getPay()); | ||||
| if (record.getPay().equals(record.getReceivePay())) { | if (record.getPay().equals(record.getReceivePay())) { | ||||
| wxBillDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); | wxBillDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); | ||||
| Date payDate = record.getPayDate(); | |||||
| Date receiveDate = wxBillDeposit.getReceiveDate(); | Date receiveDate = wxBillDeposit.getReceiveDate(); | ||||
| wxBillDeposit.setExpiredDay(0L); | wxBillDeposit.setExpiredDay(0L); | ||||
| if (payDate.after(receiveDate)) { | |||||
| int expiredDay = DateUtils.daysBetween(receiveDate, payDate); | |||||
| if (date.after(receiveDate)) { | |||||
| int expiredDay = DateUtils.daysBetween(receiveDate, date); | |||||
| wxBillDeposit.setExpiredDay((long) expiredDay); | wxBillDeposit.setExpiredDay((long) expiredDay); | ||||
| } | } | ||||
| } | } | ||||
| wxBillDeposit.setPayDate(record.getPayDate()); | |||||
| wxBillDeposit.setPayDate(date); | |||||
| wxBillDeposit.setUpdatetime(date); | wxBillDeposit.setUpdatetime(date); | ||||
| wxBillDeposit.setUpdatetime(new Date()); | |||||
| wxBillDeposit.setPayWay(record.getPayWay()); | wxBillDeposit.setPayWay(record.getPayWay()); | ||||
| try { | try { | ||||
| wxBillDepositMapper.updateByPrimaryKeySelective(wxBillDeposit); | wxBillDepositMapper.updateByPrimaryKeySelective(wxBillDeposit); | ||||
| @@ -128,21 +128,19 @@ public class WxBillPropertyDepositServiceImpl implements WxBillPropertyDepositSe | |||||
| return new ResultData(ErrorCode.BILL_PROPERTY_DEPOSIT_IS_NOT_FOUND); | return new ResultData(ErrorCode.BILL_PROPERTY_DEPOSIT_IS_NOT_FOUND); | ||||
| } | } | ||||
| Long addpay = wxBillDeposit.getPay(); | Long addpay = wxBillDeposit.getPay(); | ||||
| wxBillDeposit.setPayDate(record.getPayDate()); | |||||
| wxBillDeposit.setPay(record.getPay()); | wxBillDeposit.setPay(record.getPay()); | ||||
| wxBillDeposit.setReceivePay(record.getReceivePay()); | wxBillDeposit.setReceivePay(record.getReceivePay()); | ||||
| wxBillDeposit.setOwe(record.getReceivePay()-record.getPay()); | wxBillDeposit.setOwe(record.getReceivePay()-record.getPay()); | ||||
| if (record.getPay().equals(record.getReceivePay())) { | if (record.getPay().equals(record.getReceivePay())) { | ||||
| wxBillDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); | wxBillDeposit.setStatus(EnumBillRentStatus.PAID.getCode()); | ||||
| Date payDate = record.getPayDate(); | |||||
| Date receiveDate = wxBillDeposit.getReceiveDate(); | Date receiveDate = wxBillDeposit.getReceiveDate(); | ||||
| wxBillDeposit.setExpiredDay(0L); | wxBillDeposit.setExpiredDay(0L); | ||||
| if (payDate.after(receiveDate)) { | |||||
| int expiredDay = DateUtils.daysBetween(receiveDate, payDate); | |||||
| if (date.after(receiveDate)) { | |||||
| int expiredDay = DateUtils.daysBetween(receiveDate, date); | |||||
| wxBillDeposit.setExpiredDay((long) expiredDay); | wxBillDeposit.setExpiredDay((long) expiredDay); | ||||
| } | } | ||||
| } | } | ||||
| wxBillDeposit.setPayDate(record.getPayDate()); | |||||
| wxBillDeposit.setPayDate(date); | |||||
| wxBillDeposit.setUpdatetime(date); | wxBillDeposit.setUpdatetime(date); | ||||
| wxBillDeposit.setPayWay(record.getPayWay()); | wxBillDeposit.setPayWay(record.getPayWay()); | ||||
| try { | try { | ||||
| @@ -44,13 +44,13 @@ public class WxBillSettleRecordServiceImpl implements WxBillSettleRecordService | |||||
| record.setId(idWorker.nextId()); | record.setId(idWorker.nextId()); | ||||
| //清算完成 | //清算完成 | ||||
| if(record.getSettleMoney().intValue() == abs(record.getBalance().intValue())){ | |||||
| if(record.getSettleMoney()!= null && record.getBalance()!=null && record.getSettleMoney().intValue() == abs(record.getBalance().intValue())){ | |||||
| WxBillSettle wxBillSettle = new WxBillSettle(); | WxBillSettle wxBillSettle = new WxBillSettle(); | ||||
| wxBillSettle.setId(record.getSettleId()); | wxBillSettle.setId(record.getSettleId()); | ||||
| wxBillSettle.setStatus(EnumSettleStatus.FINISH.getCode()); | wxBillSettle.setStatus(EnumSettleStatus.FINISH.getCode()); | ||||
| wxBillSettleMapper.updateByPrimaryKeySelective(wxBillSettle); | wxBillSettleMapper.updateByPrimaryKeySelective(wxBillSettle); | ||||
| } | } | ||||
| if(record.getBalance() < 0){ | |||||
| if(record.getBalance()!=null && record.getBalance() < 0){ | |||||
| record.setSettleMoney(-record.getSettleMoney()); | record.setSettleMoney(-record.getSettleMoney()); | ||||
| } | } | ||||
| @@ -61,7 +61,8 @@ public class WxBillSettleRecordServiceImpl implements WxBillSettleRecordService | |||||
| record.setUserName(mallUserInfo.getName()); | record.setUserName(mallUserInfo.getName()); | ||||
| }else if(bUserId != null){ | }else if(bUserId != null){ | ||||
| WxMerchantBUser wxMerchantBUser = wxMerchantBUserMapper.selectByPrimaryKey(bUserId); | WxMerchantBUser wxMerchantBUser = wxMerchantBUserMapper.selectByPrimaryKey(bUserId); | ||||
| record.setUserName(wxMerchantBUser.getName()); | |||||
| if(wxMerchantBUser!=null) | |||||
| record.setUserName(wxMerchantBUser.getName()); | |||||
| } | } | ||||
| wxBillSettleRecordMapper.insertSelective(record); | wxBillSettleRecordMapper.insertSelective(record); | ||||
| }else{ | }else{ | ||||
| @@ -6,6 +6,7 @@ import com.github.pagehelper.PageInfo; | |||||
| import com.google.common.collect.Lists; | import com.google.common.collect.Lists; | ||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.domain.po.msg.AppUniformMsg; | import com.iformall.domain.po.msg.AppUniformMsg; | ||||
| import com.iformall.domain.po.msg.MpAppMsg; | import com.iformall.domain.po.msg.MpAppMsg; | ||||
| @@ -56,6 +57,8 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { | |||||
| @Autowired | @Autowired | ||||
| WxCUserMapper wxCUserMapper; | WxCUserMapper wxCUserMapper; | ||||
| @Autowired | @Autowired | ||||
| WxCUserBasicInfoMapper wxCUserBasicInfoMapper; | |||||
| @Autowired | |||||
| WxAppinfoService wxAppinfoService; | WxAppinfoService wxAppinfoService; | ||||
| @Autowired | @Autowired | ||||
| WxAuthorizerInfoMapper authorizerInfoMapper; | WxAuthorizerInfoMapper authorizerInfoMapper; | ||||
| @@ -599,17 +602,29 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { | |||||
| @Override | @Override | ||||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | ||||
| public void handSel(WxCouponSend wxCouponSend, WxCUser user) { | |||||
| public void handSel(WxCouponSend wxCouponSend, Object cUserId) { | |||||
| WxCUser cu = wxCUserMapper.selectByPrimaryKey(cUserId); | |||||
| if (Objects.isNull(cu)) { | |||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||||
| } | |||||
| WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectByPrimaryKey(cu.getId()); | |||||
| if (Objects.isNull(wxCUserBasicInfo)) { | |||||
| throw new MallinkException(ErrorCode.USER_NOT_AUTH_PHONE); | |||||
| } | |||||
| List<WxCouponSendVo> couponSendList = wxCouponSendMapper.findListVo(wxCouponSend); | List<WxCouponSendVo> couponSendList = wxCouponSendMapper.findListVo(wxCouponSend); | ||||
| if (CollectionUtils.isEmpty(couponSendList)) { | if (CollectionUtils.isEmpty(couponSendList)) { | ||||
| throw new MallinkException(ErrorCode.COUPON_IS_EMPTY); | throw new MallinkException(ErrorCode.COUPON_IS_EMPTY); | ||||
| } | } | ||||
| couponSendList.forEach(cs -> { | couponSendList.forEach(cs -> { | ||||
| // 发放免费券 | // 发放免费券 | ||||
| WxCouponOrder couponOrder = wxOrderService.sendFreeCouponToUser(user.getId(), cs.getCouponId(), cs); | |||||
| wxCouponActionLogService.addOne(user.getTenantId(), cs.getCouponId(), couponOrder.getId(), cs.getSendType(), cs.getId()); | |||||
| WxCouponOrder couponOrder = wxOrderService.sendFreeCouponToUser(cu.getId(), cs.getCouponId(), cs); | |||||
| if (couponOrder != null) { | if (couponOrder != null) { | ||||
| sendMsgForSendCoupon(cs.getTenantId(), cs, couponOrder, user); | |||||
| wxCouponActionLogService.addOne(cu.getTenantId(), cs.getCouponId(), couponOrder.getId(), cs.getSendType(), cs.getId()); | |||||
| sendMsgForSendCoupon(cs.getTenantId(), cs, couponOrder, cu); | |||||
| } else { | |||||
| logger.warn("handSel couponOrder is null"); | |||||
| } | } | ||||
| }); | }); | ||||
| } | } | ||||
| @@ -213,8 +213,12 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||||
| } else if (wxCUserBasicInfo != null && wxCUserBasicInfo.getCredit() != null && wxCUserBasicInfo.getCredit() > 0) { | } else if (wxCUserBasicInfo != null && wxCUserBasicInfo.getCredit() != null && wxCUserBasicInfo.getCredit() > 0) { | ||||
| currentCreditAmount = wxCUserBasicInfo.getCredit(); | currentCreditAmount = wxCUserBasicInfo.getCredit(); | ||||
| } | } | ||||
| record.setCreditAmount(currentCreditAmount); | |||||
| record.setCreditNum(0); | |||||
| if (record.getCreditAmount() == null) { | |||||
| record.setCreditAmount(currentCreditAmount); | |||||
| } | |||||
| if (record.getCreditNum() == null) { | |||||
| record.setCreditNum(0); | |||||
| } | |||||
| int creditChangeNumOrigin = creditIncrement(record); | int creditChangeNumOrigin = creditIncrement(record); | ||||
| int creditChangeNum = creditChangeNumOrigin ; | int creditChangeNum = creditChangeNumOrigin ; | ||||
| @@ -732,14 +732,10 @@ | |||||
| <if test=" null == sortColumns"> order by totalOwe desc </if> | <if test=" null == sortColumns"> order by totalOwe desc </if> | ||||
| </select> | </select> | ||||
| <!--union all | |||||
| select pay_amount money,mm.id from wx_profit_sharing_order pso | |||||
| left join wx_merchant mm on pso.merchant_id=mm.id | |||||
| where pso.sharing_status !=5 | |||||
| --> | |||||
| <select id="getReceiveAndPayBillAsPage" parameterType="com.iformall.domain.vo.WxBillAll" resultType="hashmap"> | <select id="getReceiveAndPayBillAsPage" parameterType="com.iformall.domain.vo.WxBillAll" resultType="hashmap"> | ||||
| select m.id,m.name,ws.shop_number shopNumber,ws.type,m.link_person linkPerson,m.link_phone linkPhone, | |||||
| xb.title business,rc.rental_start_date rentalStartDate,rc.rental_end_date rentalEndDate, | |||||
| select tt.* from ( | |||||
| select m.tenant_id,m.id,m.name,ws.shop_number shopNumber,ws.type,m.link_person linkPerson,m.link_phone linkPhone, | |||||
| xb.title business,rc.rental_start_date rentalStartDate,rc.rental_end_date rentalEndDate,rc.rent_shop_type, | |||||
| round( | round( | ||||
| (select sum(bill.receive_pay) from ( | (select sum(bill.receive_pay) from ( | ||||
| @@ -816,14 +812,15 @@ | |||||
| from wx_merchant m left join wx_merchant_shop wms on wms.merchant_id = m.id left join wx_shop ws on wms.shop_id = ws.id | from wx_merchant m left join wx_merchant_shop wms on wms.merchant_id = m.id left join wx_shop ws on wms.shop_id = ws.id | ||||
| left join wx_business xb on(m.business_id = xb.id) | left join wx_business xb on(m.business_id = xb.id) | ||||
| left join wx_rent_contract rc on(rc.merchant_id = m.id) | left join wx_rent_contract rc on(rc.merchant_id = m.id) | ||||
| where 1=1 | |||||
| <if test=" null != tenantId"> and m.tenant_id = #{tenantId} </if> | |||||
| <if test=" null != merchantId"> and m.id = #{merchantId} </if> | |||||
| <if test=" null != merchantName"> and m.name like concat('%', #{merchantName},'%') </if> | |||||
| <if test=" null != rentShopType"> and rc.rent_shop_type = #{rentShopType} </if> | |||||
| ) tt where tt.receivePay >0 and tt.payOut>0 | |||||
| <if test=" null != tenantId"> and tt.tenant_id = #{tenantId} </if> | |||||
| <if test=" null != merchantId"> and tt.id = #{merchantId} </if> | |||||
| <if test=" null != merchantName"> and tt.name like concat('%', #{merchantName},'%') </if> | |||||
| <if test=" null != rentShopType"> and tt.rent_shop_type = #{rentShopType} </if> | |||||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | <if test=" null != sortColumns"> order by ${sortColumns} </if> | ||||
| <if test=" null == sortColumns"> order by m.id desc </if> | |||||
| <if test=" null == sortColumns"> order by tt.id desc </if> | |||||
| </select> | </select> | ||||
| <select id="allDepositList" parameterType="com.iformall.domain.vo.WxBillAll" resultType="hashmap"> | <select id="allDepositList" parameterType="com.iformall.domain.vo.WxBillAll" resultType="hashmap"> | ||||