| @@ -56,7 +56,7 @@ import java.util.concurrent.TimeUnit; | |||||
| @RequestMapping("/wechat") | @RequestMapping("/wechat") | ||||
| @Slf4j | @Slf4j | ||||
| public class WechatLoginController extends BaseController { | public class WechatLoginController extends BaseController { | ||||
| private String WECHAT_PREV = "OPEN-"; | |||||
| private String WECHAT_PREV = "LOGIN:OPEN:"; | |||||
| @Autowired | @Autowired | ||||
| private WxMpService wxMpService; | private WxMpService wxMpService; | ||||
| @@ -84,7 +84,6 @@ public class WechatLoginController extends BaseController { | |||||
| log.debug("[" + getIpAddr() + "] MallUserInfoController::login"); | log.debug("[" + getIpAddr() + "] MallUserInfoController::login"); | ||||
| String host = request.getHeader("host"); | String host = request.getHeader("host"); | ||||
| log.debug("Host: " + host); | log.debug("Host: " + host); | ||||
| // host = getHost(host); | |||||
| String wechatUrl = wxMpService.buildQrConnectUrl("https://"+host+"/api/wechat/callback", "snsapi_login", "111"); | String wechatUrl = wxMpService.buildQrConnectUrl("https://"+host+"/api/wechat/callback", "snsapi_login", "111"); | ||||
| try { | try { | ||||
| response.sendRedirect(wechatUrl); | response.sendRedirect(wechatUrl); | ||||
| @@ -93,22 +92,6 @@ public class WechatLoginController extends BaseController { | |||||
| } | } | ||||
| } | } | ||||
| private String getHost(String host) { | |||||
| if(host.contains("iformall.com")) { | |||||
| if(host.contains("admintest")) { | |||||
| host = "admin.malls.iformall.com"; | |||||
| } else { | |||||
| host = "admintest.malls.iformall.com"; | |||||
| } | |||||
| } else if(host.contains("youlane.cn")) { | |||||
| host = "mall.youlane.cn"; | |||||
| } else { | |||||
| host = "admin.malls.iformall.com"; | |||||
| } | |||||
| return host; | |||||
| } | |||||
| @ApiOperation(value = "微信网页登录回调", notes = "请配置此callback到网页redirect_uri") | @ApiOperation(value = "微信网页登录回调", notes = "请配置此callback到网页redirect_uri") | ||||
| @GetMapping("callback") | @GetMapping("callback") | ||||
| public void getAccessToken(String code, String state, HttpServletRequest request, HttpServletResponse response) { | public void getAccessToken(String code, String state, HttpServletRequest request, HttpServletResponse response) { | ||||
| @@ -116,7 +99,6 @@ public class WechatLoginController extends BaseController { | |||||
| String host = request.getHeader("host"); | String host = request.getHeader("host"); | ||||
| log.debug("host: " + host); | log.debug("host: " + host); | ||||
| log.debug("code: " + code); | log.debug("code: " + code); | ||||
| // host = getHost(host); | |||||
| try { | try { | ||||
| WxMpOAuth2AccessToken accessToken = wxMpService.oauth2getAccessToken(code); | WxMpOAuth2AccessToken accessToken = wxMpService.oauth2getAccessToken(code); | ||||
| log.info("accessToken: " + accessToken.getAccessToken() + ", openId: " + accessToken.getOpenId() + ", unionId: " + accessToken.getUnionId()); | log.info("accessToken: " + accessToken.getAccessToken() + ", openId: " + accessToken.getOpenId() + ", unionId: " + accessToken.getUnionId()); | ||||
| @@ -207,14 +189,16 @@ public class WechatLoginController extends BaseController { | |||||
| } | } | ||||
| } else { | } else { | ||||
| // 跳转登录选择页面 | // 跳转登录选择页面 | ||||
| String key = WECHAT_PREV + TOTP.generateWechatOpen(accessToken.getOpenId()); | |||||
| String openId = accessToken.getOpenId(); | |||||
| String key = TOTP.generateWechatOpen(openId); | |||||
| String openKey = WECHAT_PREV + key; | |||||
| Boolean isAbsent = openRedisTemplate.<Boolean>execute(new RedisCallback<Boolean>() { | Boolean isAbsent = openRedisTemplate.<Boolean>execute(new RedisCallback<Boolean>() { | ||||
| @Override | @Override | ||||
| public Boolean doInRedis(RedisConnection connection) throws DataAccessException { | public Boolean doInRedis(RedisConnection connection) throws DataAccessException { | ||||
| RedisSerializer valueSerializer = openRedisTemplate.getValueSerializer(); | RedisSerializer valueSerializer = openRedisTemplate.getValueSerializer(); | ||||
| RedisSerializer keySerializer = openRedisTemplate.getKeySerializer(); | RedisSerializer keySerializer = openRedisTemplate.getKeySerializer(); | ||||
| Object obj = connection.execute("set", keySerializer.serialize(key), | |||||
| valueSerializer.serialize(key), | |||||
| Object obj = connection.execute("set", keySerializer.serialize(openKey), | |||||
| valueSerializer.serialize(openId), | |||||
| SafeEncoder.encode("NX"), | SafeEncoder.encode("NX"), | ||||
| SafeEncoder.encode("EX"), | SafeEncoder.encode("EX"), | ||||
| Protocol.toByteArray(60)); // 60s 过期时间 | Protocol.toByteArray(60)); // 60s 过期时间 | ||||
| @@ -251,7 +235,6 @@ public class WechatLoginController extends BaseController { | |||||
| log.error(e.getMessage()); | log.error(e.getMessage()); | ||||
| } | } | ||||
| } | } | ||||
| //return r; | |||||
| } catch (WxErrorException e) { | } catch (WxErrorException e) { | ||||
| log.error(e.getMessage()); | log.error(e.getMessage()); | ||||
| } | } | ||||
| @@ -273,10 +256,11 @@ public class WechatLoginController extends BaseController { | |||||
| String openKey = WECHAT_PREV + key; | String openKey = WECHAT_PREV + key; | ||||
| // 限时时间内查找到此用户openId | // 限时时间内查找到此用户openId | ||||
| if (openRedisTemplate.hasKey(WECHAT_PREV + key)){ | |||||
| if (openRedisTemplate.hasKey(openKey)){ | |||||
| log.info(openKey + " - 找不到"); | |||||
| String openId = openRedisTemplate.opsForValue().get(openKey); | String openId = openRedisTemplate.opsForValue().get(openKey); | ||||
| // 删除缓存 | |||||
| openRedisTemplate.delete(openKey); | openRedisTemplate.delete(openKey); | ||||
| log.info("KEY: " + openKey + " deleted"); | |||||
| MallUserInfo userInfo = mallUserInfoService.getByUsername(userName); | MallUserInfo userInfo = mallUserInfoService.getByUsername(userName); | ||||
| if(userInfo.getWebOpenId().equals(openId)) { | if(userInfo.getWebOpenId().equals(openId)) { | ||||
| @@ -315,10 +299,11 @@ public class WechatLoginController extends BaseController { | |||||
| } | } | ||||
| } else { | } else { | ||||
| // 登录失败 | // 登录失败 | ||||
| log.error("微信登录失败,未找到对应的openId"); | |||||
| return new ResultData(ErrorCode.WECHAT_LOGIN_KEY_OVERTIME); | |||||
| log.error("微信登录失败,用户微信未绑定:" + openId); | |||||
| return new ResultData(ErrorCode.WECHAT_LOGIN_NOT_BIND); | |||||
| } | } | ||||
| } | } | ||||
| log.error("微信登录失败,KEY已过期: "+ key); | |||||
| return new ResultData(ErrorCode.WECHAT_LOGIN_KEY_OVERTIME); | return new ResultData(ErrorCode.WECHAT_LOGIN_KEY_OVERTIME); | ||||
| } | } | ||||
| @@ -29,6 +29,15 @@ public class WxBillAllController extends BaseController | |||||
| private Logger logger = LoggerFactory.getLogger(WxBillAllController.class); | private Logger logger = LoggerFactory.getLogger(WxBillAllController.class); | ||||
| @GetMapping("oweBillCount") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name="contractId",value="合同id",dataType="long", paramType = "query",required=true), | |||||
| @ApiImplicitParam(name="type",value="类型1租赁合同2物业合同",dataType="int", paramType = "query",required=true)}) | |||||
| public ResultData oweBillCount(Long contractId,Integer type) { | |||||
| Long count = wxBillAllService.hasOweBill(contractId,type); | |||||
| return new ResultData(count); | |||||
| } | |||||
| @GetMapping("list") | @GetMapping("list") | ||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | ||||
| @@ -5,6 +5,7 @@ import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.WxMerchant; | import com.iformall.domain.po.WxMerchant; | ||||
| import com.iformall.domain.vo.WxMerchantVo; | import com.iformall.domain.vo.WxMerchantVo; | ||||
| import com.iformall.enums.EnumMerchantPublic; | |||||
| import com.iformall.enums.EnumMerchantStatus; | import com.iformall.enums.EnumMerchantStatus; | ||||
| import com.iformall.service.WxMerchantService; | import com.iformall.service.WxMerchantService; | ||||
| import com.iformall.utils.HashUtil; | import com.iformall.utils.HashUtil; | ||||
| @@ -39,6 +40,7 @@ public class WxMerchantController extends BaseController { | |||||
| logger.debug("[" + getIpAddr() + "] WxMerchantController::list"); | logger.debug("[" + getIpAddr() + "] WxMerchantController::list"); | ||||
| if (null == wxMerchant) wxMerchant = new WxMerchantVo(); | if (null == wxMerchant) wxMerchant = new WxMerchantVo(); | ||||
| wxMerchant.setMerchantStatus(EnumMerchantStatus.VALID.getCode()); | wxMerchant.setMerchantStatus(EnumMerchantStatus.VALID.getCode()); | ||||
| wxMerchant.setIsPublic(EnumMerchantPublic.PUBLIC.getCode()); | |||||
| return new ResultData(wxMerchantService.listAsPageCVo(wxMerchant, pageNum, pageSize)); | return new ResultData(wxMerchantService.listAsPageCVo(wxMerchant, pageNum, pageSize)); | ||||
| } | } | ||||
| @@ -2,10 +2,7 @@ package com.iformall.schedule; | |||||
| import com.iformall.domain.po.WxAppinfo; | import com.iformall.domain.po.WxAppinfo; | ||||
| import com.iformall.domain.po.WxOrder; | import com.iformall.domain.po.WxOrder; | ||||
| import com.iformall.enums.EnumAppType; | |||||
| import com.iformall.enums.EnumOrderStatus; | |||||
| import com.iformall.enums.EnumOrderType; | |||||
| import com.iformall.enums.EnumRefundStatus; | |||||
| import com.iformall.enums.*; | |||||
| import com.iformall.mapper.WxAppinfoMapper; | import com.iformall.mapper.WxAppinfoMapper; | ||||
| import com.iformall.mapper.WxOrderGroupMapper; | import com.iformall.mapper.WxOrderGroupMapper; | ||||
| import com.iformall.mapper.WxOrderMapper; | import com.iformall.mapper.WxOrderMapper; | ||||
| @@ -29,7 +26,8 @@ import java.util.Map; | |||||
| public class OrderExpiringSchedule { | public class OrderExpiringSchedule { | ||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | private final Logger logger = LoggerFactory.getLogger(this.getClass()); | ||||
| private final int TIME_OUT_VALUE = 15 * 60 * 1000; //15分钟 | |||||
| private final int NORMAL_TIME_OUT = 15 * 60 * 1000; //普通券 必须15分钟内支付 | |||||
| private final int PRESS_TIME_OUT = 15 * 60 * 1000; //砍价券 必须60分钟内支付 | |||||
| @Autowired | @Autowired | ||||
| WxOrderMapper wxOrderMapper; | WxOrderMapper wxOrderMapper; | ||||
| @@ -55,7 +53,7 @@ public class OrderExpiringSchedule { | |||||
| Map dateMap = new HashMap(); | Map dateMap = new HashMap(); | ||||
| Date curDate = new Date(); | Date curDate = new Date(); | ||||
| Date expireDate = new Date(curDate.getTime() - TIME_OUT_VALUE ); | |||||
| Date expireDate = new Date(curDate.getTime() - NORMAL_TIME_OUT ); | |||||
| // 券相关订单, 15分钟未支付, 订单过期 | // 券相关订单, 15分钟未支付, 订单过期 | ||||
| dateMap.put("type", EnumOrderType.COUPON.getCode()); | dateMap.put("type", EnumOrderType.COUPON.getCode()); | ||||
| @@ -65,19 +63,32 @@ public class OrderExpiringSchedule { | |||||
| try { | try { | ||||
| orderExpired(o); | orderExpired(o); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error(e.getMessage()); | |||||
| logger.error("券过期失败" + e.getMessage()); | |||||
| } | } | ||||
| }); | }); | ||||
| // 砍价相关订单, 已超过砍价结束时间, 订单过期 | |||||
| // 砍价相关订单, | |||||
| // 1. 如果已经砍价完成,必须60分钟内支付, 未支付,订单过期 | |||||
| Date pressExpireDate = new Date(curDate.getTime() - PRESS_TIME_OUT ); | |||||
| dateMap.put("type", EnumOrderType.COUPON.getCode()); | |||||
| dateMap.put("endDate", pressExpireDate); | |||||
| List<WxOrder> orderPresss = wxOrderMapper.findListOfCompleteUnPaidPressOrderByDate(dateMap); | |||||
| orderPresss.stream().forEach( o -> { | |||||
| try { | |||||
| orderPressExpired(o); | |||||
| } catch (Exception e) { | |||||
| logger.error("砍价券支付过期失败" + e.getMessage()); | |||||
| } | |||||
| }); | |||||
| // 2. 当前已超过砍价结束时间, 订单过期 | |||||
| dateMap.put("type", EnumOrderType.COUPON.getCode()); | dateMap.put("type", EnumOrderType.COUPON.getCode()); | ||||
| dateMap.put("endDate", curDate); | dateMap.put("endDate", curDate); | ||||
| List<WxOrder> orderPresss = wxOrderMapper.findListOfUnpaidPressOrderByDate(dateMap); | |||||
| orderPresss = wxOrderMapper.findListOfUnpaidPressOrderByDate(dateMap); | |||||
| orderPresss.stream().forEach( o -> { | orderPresss.stream().forEach( o -> { | ||||
| try { | try { | ||||
| orderPressExpired(o); | orderPressExpired(o); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error(e.getMessage()); | |||||
| logger.error("砍价券过期失败" +e.getMessage()); | |||||
| } | } | ||||
| }); | }); | ||||
| @@ -131,9 +142,7 @@ public class OrderExpiringSchedule { | |||||
| // 微信 关单 | // 微信 关单 | ||||
| wxOrderService.orderClose(updateOrder); | wxOrderService.orderClose(updateOrder); | ||||
| logger.info("\nFound " + order.getId() + "\n" | |||||
| + " create at " + order.getCreateDate() +"\n" | |||||
| + " expired at " + new Date()); | |||||
| logger.info("券订单: " + order.getId() + " create at " + order.getCreateDate() + " expired at " + new Date()); | |||||
| } | } | ||||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | ||||
| @@ -148,7 +157,7 @@ public class OrderExpiringSchedule { | |||||
| // 库存退回 | // 库存退回 | ||||
| wxOrderService.stockBack(order); | wxOrderService.stockBack(order); | ||||
| logger.info("\n砍价订单: " + order.getId() + " create at " + order.getCreateDate() + " expired at " + curDate); | |||||
| logger.info("砍价订单: " + order.getId() + " create at " + order.getCreateDate() + " expired at " + curDate); | |||||
| } | } | ||||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | ||||
| @@ -1,11 +1,16 @@ | |||||
| package com.iformall.domain.po; | package com.iformall.domain.po; | ||||
| import java.util.Map; | |||||
| /** | /** | ||||
| * @author luozukai | * @author luozukai | ||||
| * @date 2019/3/7 10:05 | * @date 2019/3/7 10:05 | ||||
| */ | */ | ||||
| public class MailMsg extends BaseMsg { | public class MailMsg extends BaseMsg { | ||||
| private static final long serialVersionUID = 923764283760321L; | private static final long serialVersionUID = 923764283760321L; | ||||
| // 模板id | |||||
| private Integer modelId; | |||||
| private String tenantId; | |||||
| private String[] to; | private String[] to; | ||||
| private String from; | private String from; | ||||
| @@ -21,6 +26,33 @@ public class MailMsg extends BaseMsg { | |||||
| private String rscPath; | private String rscPath; | ||||
| private String rscI; | private String rscI; | ||||
| //动态替换内容 | |||||
| private Map<String,String> dynamicContentMap; | |||||
| public String getTenantId() { | |||||
| return tenantId; | |||||
| } | |||||
| public void setTenantId(String tenantId) { | |||||
| this.tenantId = tenantId; | |||||
| } | |||||
| public Map<String, String> getDynamicContentMap() { | |||||
| return dynamicContentMap; | |||||
| } | |||||
| public void setDynamicContentMap(Map<String, String> dynamicContentMap) { | |||||
| this.dynamicContentMap = dynamicContentMap; | |||||
| } | |||||
| public Integer getModelId() { | |||||
| return modelId; | |||||
| } | |||||
| public void setModelId(Integer modelId) { | |||||
| this.modelId = modelId; | |||||
| } | |||||
| public String[] getTo() { | public String[] getTo() { | ||||
| return to; | return to; | ||||
| } | } | ||||
| @@ -140,6 +140,9 @@ public class WxMerchant implements Serializable { | |||||
| @io.swagger.annotations.ApiModelProperty(value = "类型", name = "type") | @io.swagger.annotations.ApiModelProperty(value = "类型", name = "type") | ||||
| private Integer type; | private Integer type; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "是否显示在C端", name = "isPublic") | |||||
| private Integer isPublic; | |||||
| public List<WxLevelConfig> getLevelConfigList() { | public List<WxLevelConfig> getLevelConfigList() { | ||||
| return levelConfigList; | return levelConfigList; | ||||
| } | } | ||||
| @@ -377,6 +380,14 @@ public class WxMerchant implements Serializable { | |||||
| this.type = type; | this.type = type; | ||||
| } | } | ||||
| public Integer getIsPublic() { | |||||
| return isPublic; | |||||
| } | |||||
| public void setIsPublic(Integer isPublic) { | |||||
| this.isPublic = isPublic; | |||||
| } | |||||
| public static enum Field | public static enum Field | ||||
| { | { | ||||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | ||||
| @@ -1,7 +1,5 @@ | |||||
| package com.iformall.domain.vo; | package com.iformall.domain.vo; | ||||
| import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | |||||
| import javax.persistence.Id; | import javax.persistence.Id; | ||||
| public class WxMerchantVo { | public class WxMerchantVo { | ||||
| private static final long serialVersionUID = 6687964942922444531L; | private static final long serialVersionUID = 6687964942922444531L; | ||||
| @@ -52,6 +50,16 @@ public class WxMerchantVo { | |||||
| @io.swagger.annotations.ApiModelProperty(value="楼层",name="floorName") | @io.swagger.annotations.ApiModelProperty(value="楼层",name="floorName") | ||||
| private String floorName; | private String floorName; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "是否显示在C端", name = "show") | |||||
| private Integer isPublic; | |||||
| public Integer getIsPublic() { | |||||
| return isPublic; | |||||
| } | |||||
| public void setIsPublic(Integer isPublic) { | |||||
| this.isPublic = isPublic; | |||||
| } | |||||
| public String getBuildingName() {return buildingName; } | public String getBuildingName() {return buildingName; } | ||||
| public void setBuildingName(String _building) { | public void setBuildingName(String _building) { | ||||
| @@ -0,0 +1,35 @@ | |||||
| package com.iformall.enums; | |||||
| /** | |||||
| * Created by Stormeye on 2018/08/09. | |||||
| */ | |||||
| public enum EnumMerchantPublic { | |||||
| PUBLIC(1, "公开"), | |||||
| PRIVATE(0, "私有"),; | |||||
| public static EnumMerchantPublic getEnum(Integer code) { | |||||
| for (EnumMerchantPublic value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumMerchantPublic(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -33,4 +33,6 @@ public interface WxBillPropertyMapper extends CommonMapper<WxBillProperty, Long> | |||||
| void update(WxBillProperty wxBillProperty); | void update(WxBillProperty wxBillProperty); | ||||
| void updatePreviewStatus(WxBillProperty record); | void updatePreviewStatus(WxBillProperty record); | ||||
| Long oweBillCount(Long contractId); | |||||
| } | } | ||||
| @@ -29,4 +29,6 @@ public interface WxBillRentMapper extends CommonMapper<WxBillRent, Long> { | |||||
| void update(WxBillRent record); | void update(WxBillRent record); | ||||
| void updatePreviewStatus(WxBillRent record); | void updatePreviewStatus(WxBillRent record); | ||||
| Long oweBillCount(Long contractId); | |||||
| } | } | ||||
| @@ -7,9 +7,9 @@ import com.iformall.domain.po.WxMsgModel; | |||||
| public interface WxMsgModelMapper extends CommonMapper<WxMsgModel, String> { | public interface WxMsgModelMapper extends CommonMapper<WxMsgModel, String> { | ||||
| List<WxMsgModel> findList(WxMsgModel wxMsgModel); | List<WxMsgModel> findList(WxMsgModel wxMsgModel); | ||||
| WxMsgModel findOneByModelId(WxMsgModel wxMsgModel); | |||||
| @@ -15,7 +15,9 @@ public interface WxOrderMapper extends CommonMapper<WxOrder, Long> { | |||||
| Integer countList(WxOrder wxOrder); | Integer countList(WxOrder wxOrder); | ||||
| List<WxOrder> findListOfUnpaidOrderByDate(Map dateMap); | List<WxOrder> findListOfUnpaidOrderByDate(Map dateMap); | ||||
| List<WxOrder> findListOfUnpaidPressOrderByDate(Map dateMap); | List<WxOrder> findListOfUnpaidPressOrderByDate(Map dateMap); | ||||
| List<WxOrder> findListOfCompleteUnPaidPressOrderByDate(Map dateMap); | |||||
| List<WxOrderCouponVo> findListOfCUser(WxOrder wxOrder); | List<WxOrderCouponVo> findListOfCUser(WxOrder wxOrder); | ||||
| WxOrderCouponVo selectDetailOfCUser(WxOrder wxOrder); | WxOrderCouponVo selectDetailOfCUser(WxOrder wxOrder); | ||||
| @@ -24,4 +24,6 @@ public interface WxBillAllService { | |||||
| void exportBill(HttpServletRequest request, HttpServletResponse response, WxBillAll wxBillAll); | void exportBill(HttpServletRequest request, HttpServletResponse response, WxBillAll wxBillAll); | ||||
| Object getBillInfo(WxBillAll wxBillAll); | Object getBillInfo(WxBillAll wxBillAll); | ||||
| Long hasOweBill(Long contractId,Integer type); | |||||
| } | } | ||||
| @@ -24,7 +24,7 @@ import java.util.Map; | |||||
| public class PushLimitServiceImpl implements PushLimitService { | public class PushLimitServiceImpl implements PushLimitService { | ||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | private final Logger logger = LoggerFactory.getLogger(this.getClass()); | ||||
| private String keyPrev = "pushlimit_"; | |||||
| private String keyPrev = "setting:pushlimit:"; | |||||
| @Autowired | @Autowired | ||||
| PushLimitMapper pushLimitMapper; | PushLimitMapper pushLimitMapper; | ||||
| @@ -2,6 +2,8 @@ package com.iformall.service.impl; | |||||
| import com.iformall.domain.po.BaseMsg; | import com.iformall.domain.po.BaseMsg; | ||||
| import com.iformall.domain.po.MailMsg; | import com.iformall.domain.po.MailMsg; | ||||
| import com.iformall.domain.po.WxMsgModel; | |||||
| import com.iformall.mapper.WxMsgModelMapper; | |||||
| import com.iformall.service.MsgSendService; | import com.iformall.service.MsgSendService; | ||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| @@ -15,6 +17,7 @@ import org.springframework.mail.javamail.MimeMessageHelper; | |||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import javax.mail.internet.MimeMessage; | import javax.mail.internet.MimeMessage; | ||||
| import java.io.File; | import java.io.File; | ||||
| import java.util.Map; | |||||
| /** | /** | ||||
| * 发送邮件 | * 发送邮件 | ||||
| @@ -31,9 +34,28 @@ public class SendEmailServiceImpl implements MsgSendService { | |||||
| @Value("${spring.mail.username}") | @Value("${spring.mail.username}") | ||||
| private String from; | private String from; | ||||
| @Autowired | |||||
| private WxMsgModelMapper wxMsgModelMapper; | |||||
| @Override | @Override | ||||
| public void send(BaseMsg baseMsg) throws Exception{ | public void send(BaseMsg baseMsg) throws Exception{ | ||||
| MailMsg mailMsg = (MailMsg)baseMsg; | MailMsg mailMsg = (MailMsg)baseMsg; | ||||
| //根据模板替换动态内容 | |||||
| if(mailMsg.getModelId() != null){ | |||||
| WxMsgModel msgModel = new WxMsgModel(); | |||||
| msgModel.setTenantId(mailMsg.getTenantId()); | |||||
| msgModel.setModelId(mailMsg.getModelId()); | |||||
| WxMsgModel wxMsgModel = wxMsgModelMapper.findOneByModelId(msgModel); | |||||
| if(wxMsgModel == null){ | |||||
| throw new Exception("模板id:"+mailMsg.getModelId()+"不存在"); | |||||
| } | |||||
| String msg = wxMsgModel.getContent(); | |||||
| for (Map.Entry<String, String> entry : mailMsg.getDynamicContentMap().entrySet()) { | |||||
| msg = msg.replace("{"+entry.getKey()+"}", entry.getValue()); | |||||
| } | |||||
| mailMsg.setMsg(msg); | |||||
| } | |||||
| if(mailMsg.isHtml()){ //html邮件 | if(mailMsg.isHtml()){ //html邮件 | ||||
| MimeMessage message = sender.createMimeMessage(); | MimeMessage message = sender.createMimeMessage(); | ||||
| @@ -515,4 +515,14 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||||
| result.put("paidInfoForPoint", paidInfoForPoint); | result.put("paidInfoForPoint", paidInfoForPoint); | ||||
| return result; | return result; | ||||
| } | } | ||||
| @Override | |||||
| public Long hasOweBill(Long contractId, Integer type) { | |||||
| if(type.intValue() == 1){ | |||||
| return wxBillRentMapper.oweBillCount(contractId); | |||||
| }else if(type.intValue() == 2){ | |||||
| return wxBillPropertyMapper.oweBillCount(contractId); | |||||
| } | |||||
| return 0l; | |||||
| } | |||||
| } | } | ||||
| @@ -189,6 +189,7 @@ 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); | ||||
| } | } | ||||
| wxBillDeposit.setReceivePay(record.getReceivePay()); | wxBillDeposit.setReceivePay(record.getReceivePay()); | ||||
| wxBillDeposit.setOwe(record.getReceivePay() - record.getPay()); | |||||
| wxBillDeposit.setUpdatetime(new Date()); | wxBillDeposit.setUpdatetime(new Date()); | ||||
| try { | try { | ||||
| wxBillDepositMapper.updateByPrimaryKeySelective(wxBillDeposit); | wxBillDepositMapper.updateByPrimaryKeySelective(wxBillDeposit); | ||||
| @@ -207,6 +207,7 @@ public class WxBillOtherDepositServiceImpl implements WxBillOtherDepositService | |||||
| return new ResultData(ErrorCode.BILL_OTHER_DEPOSIT_IS_NOT_FOUND); | return new ResultData(ErrorCode.BILL_OTHER_DEPOSIT_IS_NOT_FOUND); | ||||
| } | } | ||||
| wxBillDeposit.setReceivePay(record.getReceivePay()); | wxBillDeposit.setReceivePay(record.getReceivePay()); | ||||
| wxBillDeposit.setOwe(record.getReceivePay() - record.getPay()); | |||||
| wxBillDeposit.setUpdatetime(new Date()); | wxBillDeposit.setUpdatetime(new Date()); | ||||
| try { | try { | ||||
| wxBillOtherDepositMapper.updateByPrimaryKeySelective(wxBillDeposit); | wxBillOtherDepositMapper.updateByPrimaryKeySelective(wxBillDeposit); | ||||
| @@ -190,6 +190,7 @@ public class WxBillPropertyDepositServiceImpl implements WxBillPropertyDepositSe | |||||
| return new ResultData(ErrorCode.BILL_OTHER_DEPOSIT_IS_NOT_FOUND); | return new ResultData(ErrorCode.BILL_OTHER_DEPOSIT_IS_NOT_FOUND); | ||||
| } | } | ||||
| wxBillDeposit.setReceivePay(record.getReceivePay()); | wxBillDeposit.setReceivePay(record.getReceivePay()); | ||||
| wxBillDeposit.setOwe(record.getReceivePay() - record.getPay()); | |||||
| wxBillDeposit.setUpdatetime(new Date()); | wxBillDeposit.setUpdatetime(new Date()); | ||||
| try { | try { | ||||
| wxBillPropertyDepositMapper.updateByPrimaryKeySelective(wxBillDeposit); | wxBillPropertyDepositMapper.updateByPrimaryKeySelective(wxBillDeposit); | ||||
| @@ -27,6 +27,8 @@ import java.util.concurrent.TimeUnit; | |||||
| public class WxCUserServiceImpl implements WxCUserService { | public class WxCUserServiceImpl implements WxCUserService { | ||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | private final Logger logger = LoggerFactory.getLogger(this.getClass()); | ||||
| private String tokenPrev = "weapp:token:"; | |||||
| @Autowired | @Autowired | ||||
| WxCUserMapper wxCUserMapper; | WxCUserMapper wxCUserMapper; | ||||
| @@ -66,7 +68,7 @@ public class WxCUserServiceImpl implements WxCUserService { | |||||
| @Override | @Override | ||||
| public WxCUser getByToken(String token) { | public WxCUser getByToken(String token) { | ||||
| logger.info("获取用户信息start ..."); | logger.info("获取用户信息start ..."); | ||||
| String key = "token_" + token; | |||||
| String key = tokenPrev + token; | |||||
| ValueOperations<String, WxCUser> operations = cUserTokenRedisTemplate.opsForValue(); | ValueOperations<String, WxCUser> operations = cUserTokenRedisTemplate.opsForValue(); | ||||
| // 缓存 | // 缓存 | ||||
| @@ -99,7 +101,7 @@ public class WxCUserServiceImpl implements WxCUserService { | |||||
| user.setUpdateDate(curr); | user.setUpdateDate(curr); | ||||
| ret = wxCUserMapper.updateByPrimaryKeySelective(user); | ret = wxCUserMapper.updateByPrimaryKeySelective(user); | ||||
| } | } | ||||
| String key = "token_" + user.getToken(); | |||||
| String key = tokenPrev + user.getToken(); | |||||
| // 缓存已存在,删除 | // 缓存已存在,删除 | ||||
| boolean hasKey = cUserTokenRedisTemplate.hasKey(key); | boolean hasKey = cUserTokenRedisTemplate.hasKey(key); | ||||
| if(hasKey) { | if(hasKey) { | ||||
| @@ -73,7 +73,7 @@ public class WxChartServiceImpl implements WxChartDataService { | |||||
| if (StringUtils.isEmpty(startdate)) { | if (StringUtils.isEmpty(startdate)) { | ||||
| startdate = DateUtils.getSystemTime("yyyy-MM-dd") + " 00:00:00" ; | startdate = DateUtils.getSystemTime("yyyy-MM-dd") + " 00:00:00" ; | ||||
| } | } | ||||
| if(StringUtils.isBlank(enddate)){ | |||||
| if (StringUtils.isEmpty(enddate)) { | |||||
| enddate = DateUtils.getSystemTime("yyyy-MM-dd") + " 23:59:59"; | enddate = DateUtils.getSystemTime("yyyy-MM-dd") + " 23:59:59"; | ||||
| } | } | ||||
| @@ -1470,19 +1470,22 @@ public class WxChartServiceImpl implements WxChartDataService { | |||||
| WxCoupon wxCoupon = new WxCoupon(); | WxCoupon wxCoupon = new WxCoupon(); | ||||
| //默认时间本月第一天,截止到当天 | //默认时间本月第一天,截止到当天 | ||||
| if(paramsMap.get("startdate") == null || StringUtils.isBlank(paramsMap.get("startdate"))){ | |||||
| if (StringUtils.isEmpty(paramsMap.get("startdate"))) { | |||||
| Calendar c = Calendar.getInstance(); | Calendar c = Calendar.getInstance(); | ||||
| c.add(Calendar.MONTH, 0); | c.add(Calendar.MONTH, 0); | ||||
| c.set(Calendar.DAY_OF_MONTH,1); | c.set(Calendar.DAY_OF_MONTH,1); | ||||
| c.set(Calendar.HOUR_OF_DAY, 0); | |||||
| c.set(Calendar.MINUTE, 0); | |||||
| c.set(Calendar.SECOND, 0); | |||||
| wxCoupon.setStartdate(c.getTime()); | wxCoupon.setStartdate(c.getTime()); | ||||
| }else{ | }else{ | ||||
| Date startTime = DateUtils.stringToDate(startdate); | Date startTime = DateUtils.stringToDate(startdate); | ||||
| wxCoupon.setStartdate(startTime); | wxCoupon.setStartdate(startTime); | ||||
| } | } | ||||
| if(paramsMap.get("enddate") == null || StringUtils.isBlank(paramsMap.get("enddate"))){ | |||||
| wxCoupon.setEnddate(DateUtils.stringToDate(DateUtils.getSystemTime("yyyy-MM-dd") + " 23:59:59")); | |||||
| if (StringUtils.isEmpty(paramsMap.get("enddate"))) { | |||||
| wxCoupon.setEnddate(new Date()); | |||||
| }else{ | }else{ | ||||
| Date endTime = DateUtils.stringToDate(enddate); | |||||
| Date endTime = DateUtils.stringToDate(enddate, "yyyy-MM-dd HH:mm:ss"); | |||||
| wxCoupon.setEnddate(endTime); | wxCoupon.setEnddate(endTime); | ||||
| } | } | ||||
| @@ -1512,19 +1515,22 @@ public class WxChartServiceImpl implements WxChartDataService { | |||||
| Map<String,Object> result = new HashedMap(); | Map<String,Object> result = new HashedMap(); | ||||
| //默认时间本月第一天,截止到当天 | //默认时间本月第一天,截止到当天 | ||||
| if(paramsMap.get("startdate") == null || StringUtils.isBlank(paramsMap.get("startdate"))){ | |||||
| if (StringUtils.isEmpty(paramsMap.get("startdate"))) { | |||||
| Calendar c = Calendar.getInstance(); | Calendar c = Calendar.getInstance(); | ||||
| c.add(Calendar.MONTH, 0); | c.add(Calendar.MONTH, 0); | ||||
| c.set(Calendar.DAY_OF_MONTH,1); | c.set(Calendar.DAY_OF_MONTH,1); | ||||
| c.set(Calendar.HOUR_OF_DAY, 0); | |||||
| c.set(Calendar.MINUTE, 0); | |||||
| c.set(Calendar.SECOND, 0); | |||||
| wxCoupon.setStartdate(c.getTime()); | wxCoupon.setStartdate(c.getTime()); | ||||
| }else{ | }else{ | ||||
| Date startTime = DateUtils.stringToDate(startdate); | Date startTime = DateUtils.stringToDate(startdate); | ||||
| wxCoupon.setStartdate(startTime); | wxCoupon.setStartdate(startTime); | ||||
| } | } | ||||
| if(paramsMap.get("enddate") == null || StringUtils.isBlank(paramsMap.get("enddate"))){ | |||||
| wxCoupon.setEnddate(DateUtils.stringToDate(DateUtils.getSystemTime("yyyy-MM-dd") + " 23:59:59")); | |||||
| if (StringUtils.isEmpty(paramsMap.get("enddate"))) { | |||||
| wxCoupon.setEnddate(new Date()); | |||||
| }else{ | }else{ | ||||
| Date endTime = DateUtils.stringToDate(enddate); | |||||
| Date endTime = DateUtils.stringToDate(enddate, "yyyy-MM-dd HH:mm:ss"); | |||||
| wxCoupon.setEnddate(endTime); | wxCoupon.setEnddate(endTime); | ||||
| } | } | ||||
| List<WxCoupon> orderCountList = wxCouponService.findCouponOrderCount(wxCoupon); | List<WxCoupon> orderCountList = wxCouponService.findCouponOrderCount(wxCoupon); | ||||
| @@ -1566,19 +1572,22 @@ public class WxChartServiceImpl implements WxChartDataService { | |||||
| Map<String,Object> result = new HashedMap(); | Map<String,Object> result = new HashedMap(); | ||||
| //默认时间本月第一天,截止到当天 | //默认时间本月第一天,截止到当天 | ||||
| if(paramsMap.get("startdate") == null || StringUtils.isBlank(paramsMap.get("startdate"))){ | |||||
| if (StringUtils.isEmpty(paramsMap.get("startdate"))) { | |||||
| Calendar c = Calendar.getInstance(); | Calendar c = Calendar.getInstance(); | ||||
| c.add(Calendar.MONTH, 0); | c.add(Calendar.MONTH, 0); | ||||
| c.set(Calendar.DAY_OF_MONTH,1); | c.set(Calendar.DAY_OF_MONTH,1); | ||||
| c.set(Calendar.HOUR_OF_DAY, 0); | |||||
| c.set(Calendar.MINUTE, 0); | |||||
| c.set(Calendar.SECOND, 0); | |||||
| wxCoupon.setStartdate(c.getTime()); | wxCoupon.setStartdate(c.getTime()); | ||||
| }else{ | }else{ | ||||
| Date startTime = DateUtils.stringToDate(startdate); | Date startTime = DateUtils.stringToDate(startdate); | ||||
| wxCoupon.setStartdate(startTime); | wxCoupon.setStartdate(startTime); | ||||
| } | } | ||||
| if(paramsMap.get("enddate") == null || StringUtils.isBlank(paramsMap.get("enddate"))){ | |||||
| wxCoupon.setEnddate(DateUtils.stringToDate(DateUtils.getSystemTime("yyyy-MM-dd") + " 23:59:59")); | |||||
| if (StringUtils.isEmpty(paramsMap.get("enddate"))) { | |||||
| wxCoupon.setEnddate(new Date()); | |||||
| }else{ | }else{ | ||||
| Date endTime = DateUtils.stringToDate(enddate); | |||||
| Date endTime = DateUtils.stringToDate(enddate, "yyyy-MM-dd HH:mm:ss"); | |||||
| wxCoupon.setEnddate(endTime); | wxCoupon.setEnddate(endTime); | ||||
| } | } | ||||
| List<WxCoupon> pressSendHistory = wxCouponService.pressSendHistory(wxCoupon); | List<WxCoupon> pressSendHistory = wxCouponService.pressSendHistory(wxCoupon); | ||||
| @@ -1615,21 +1624,23 @@ public class WxChartServiceImpl implements WxChartDataService { | |||||
| Map<String, Object> result = new HashMap<>(); | Map<String, Object> result = new HashMap<>(); | ||||
| Date startTime = new Date(); | Date startTime = new Date(); | ||||
| Date endTime = startTime; | Date endTime = startTime; | ||||
| if (paramsMap.get("startdate") == null || StringUtils.isBlank(paramsMap.get("startdate"))) { | |||||
| if (StringUtils.isEmpty(paramsMap.get("startdate"))) { | |||||
| Calendar c = Calendar.getInstance(); | Calendar c = Calendar.getInstance(); | ||||
| c.add(Calendar.MONTH, 0); | c.add(Calendar.MONTH, 0); | ||||
| c.set(Calendar.DAY_OF_MONTH, 1); | c.set(Calendar.DAY_OF_MONTH, 1); | ||||
| c.set(Calendar.HOUR_OF_DAY, 0); | |||||
| c.set(Calendar.MINUTE, 0); | |||||
| c.set(Calendar.SECOND, 0); | |||||
| startTime = c.getTime(); | startTime = c.getTime(); | ||||
| params.put("startdate", startTime); | params.put("startdate", startTime); | ||||
| } else { | } else { | ||||
| startTime = DateUtils.stringToDate(startdate + " 00:00:00"); | startTime = DateUtils.stringToDate(startdate + " 00:00:00"); | ||||
| params.put("startdate", startTime); | params.put("startdate", startTime); | ||||
| } | } | ||||
| if (paramsMap.get("enddate") == null || StringUtils.isBlank(paramsMap.get("enddate"))) { | |||||
| if (StringUtils.isEmpty(paramsMap.get("enddate"))) { | |||||
| params.put("enddate", endTime); | params.put("enddate", endTime); | ||||
| } else { | } else { | ||||
| endTime = DateUtils.stringToDate(enddate + " 23:59:59"); | |||||
| params.put("enddate", endTime); | |||||
| params.put("enddate", paramsMap.get("enddate") + " 23:59:59"); | |||||
| } | } | ||||
| List<Map<String, Object>> successlist = wxOrderGroupMapper.queryOrderGroupSuccessCountAndTime(params); | List<Map<String, Object>> successlist = wxOrderGroupMapper.queryOrderGroupSuccessCountAndTime(params); | ||||
| @@ -1765,6 +1776,8 @@ public class WxChartServiceImpl implements WxChartDataService { | |||||
| calBegin.setTime(begin); | calBegin.setTime(begin); | ||||
| Calendar calEnd = Calendar.getInstance(); | Calendar calEnd = Calendar.getInstance(); | ||||
| calEnd.setTime(end); | calEnd.setTime(end); | ||||
| calEnd.add(Calendar.DAY_OF_MONTH, -1); | |||||
| end = calEnd.getTime(); | |||||
| while (calBegin.getTime().before(end)) { | while (calBegin.getTime().before(end)) { | ||||
| calBegin.add(Calendar.DAY_OF_MONTH, 1); | calBegin.add(Calendar.DAY_OF_MONTH, 1); | ||||
| map.put(format.format(calBegin.getTime()), 0L); | map.put(format.format(calBegin.getTime()), 0L); | ||||
| @@ -532,6 +532,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| if (wxMerchant.getId() == null) { | if (wxMerchant.getId() == null) { | ||||
| return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND); | return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND); | ||||
| } | } | ||||
| wxMerchantMapper.updateByPrimaryKeySelective(wxMerchant); | |||||
| wxLevelConfigService.batchSaveByMerchantId(wxMerchant.getTenantId(), wxMerchant.getId(), wxMerchant.getLevelConfigList()); | wxLevelConfigService.batchSaveByMerchantId(wxMerchant.getTenantId(), wxMerchant.getId(), wxMerchant.getLevelConfigList()); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("db failed: 账号操作失败, e:" + e.getMessage()); | logger.error("db failed: 账号操作失败, e:" + e.getMessage()); | ||||
| @@ -9,7 +9,6 @@ import com.iformall.domain.po.WxMsgConfig; | |||||
| import com.iformall.domain.po.WxMsgModel; | import com.iformall.domain.po.WxMsgModel; | ||||
| import com.iformall.domain.po.WxMsgValidationcodeModel; | import com.iformall.domain.po.WxMsgValidationcodeModel; | ||||
| import com.iformall.enums.EnumMsgSendStatus; | import com.iformall.enums.EnumMsgSendStatus; | ||||
| import com.iformall.enums.EnumMsgStatus; | |||||
| import com.iformall.mapper.*; | import com.iformall.mapper.*; | ||||
| import com.iformall.service.WxMsgCallbackService; | import com.iformall.service.WxMsgCallbackService; | ||||
| import com.iformall.utils.HMACSHA256; | import com.iformall.utils.HMACSHA256; | ||||
| @@ -163,8 +162,9 @@ public class WxMsgCallbackServiceImpl implements WxMsgCallbackService { | |||||
| sb.append(entry.getKey()).append("=").append(entry.getValue()); | sb.append(entry.getKey()).append("=").append(entry.getValue()); | ||||
| } | } | ||||
| sb.append("&secret=").append(wxMsgConfig.getSecret()); | sb.append("&secret=").append(wxMsgConfig.getSecret()); | ||||
| logger.info("message:" + sb.toString() + ",secret:" + wxMsgConfig.getSecret()); | |||||
| String sign_check = HMACSHA256.sha256_HMAC(sb.toString(), wxMsgConfig.getSecret()); | String sign_check = HMACSHA256.sha256_HMAC(sb.toString(), wxMsgConfig.getSecret()); | ||||
| logger.info("sign_check:" + sign_check); | |||||
| return sign_check.equalsIgnoreCase(param.get("sign")); | return sign_check.equalsIgnoreCase(param.get("sign")); | ||||
| } | } | ||||
| @@ -26,7 +26,7 @@ import java.util.List; | |||||
| public class WxScoreRulesServiceImpl implements WxScoreRulesService { | public class WxScoreRulesServiceImpl implements WxScoreRulesService { | ||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | private final Logger logger = LoggerFactory.getLogger(this.getClass()); | ||||
| private String keyPrev = "scorerules_"; | |||||
| private String keyPrev = "setting:scorerules:"; | |||||
| @Autowired | @Autowired | ||||
| WxScoreRulesMapper wxScoreRulesMapper; | WxScoreRulesMapper wxScoreRulesMapper; | ||||
| @@ -186,7 +186,7 @@ | |||||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type | need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type | ||||
| from wx_bill_other | from wx_bill_other | ||||
| union | union | ||||
| select id,merchant_id,shop_id,tenant_id,name,8 bill_type_value,'其他押金' bill_type,0 as | |||||
| select id,merchant_id,shop_id,tenant_id,comments as name,8 bill_type_value,'其他押金' bill_type,0 as | |||||
| need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type | need_pay,receive_pay,pay,owe,receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type | ||||
| from wx_bill_other_deposit | from wx_bill_other_deposit | ||||
| ) bill | ) bill | ||||
| @@ -131,7 +131,7 @@ | |||||
| <update id="updateInvalidStatusByRent" parameterType="com.iformall.domain.po.WxRentContract"> | <update id="updateInvalidStatusByRent" parameterType="com.iformall.domain.po.WxRentContract"> | ||||
| update wx_bill_property set status = 6 where property_contract_id in | update wx_bill_property set status = 6 where property_contract_id in | ||||
| (select id from wx_property_contract where rent_contract_id = #{id}) | (select id from wx_property_contract where rent_contract_id = #{id}) | ||||
| and status in(4,2) | |||||
| and status != 3 | |||||
| </update> | </update> | ||||
| <delete id="deletePreviewBill" parameterType="com.iformall.domain.po.WxPropertyContract"> | <delete id="deletePreviewBill" parameterType="com.iformall.domain.po.WxPropertyContract"> | ||||
| @@ -148,4 +148,10 @@ | |||||
| update wx_bill_property set is_preview = #{isPreview},merchant_id = #{merchantId} | update wx_bill_property set is_preview = #{isPreview},merchant_id = #{merchantId} | ||||
| where property_contract_id = #{propertyContractId} | where property_contract_id = #{propertyContractId} | ||||
| </update> | </update> | ||||
| <select id="oweBillCount" parameterType="java.lang.Long" resultType="java.lang.Long"> | |||||
| select count(br.id) from wx_bill_property br,wx_property_contract c | |||||
| where c.id = br.property_contract_id and br.status = 1 and c.id = #{contractId} | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||
| @@ -127,7 +127,7 @@ | |||||
| <update id="updateInvalidStatus" parameterType="com.iformall.domain.po.WxBillRent"> | <update id="updateInvalidStatus" parameterType="com.iformall.domain.po.WxBillRent"> | ||||
| update wx_bill_rent set status = 6 where rent_contract_id = #{rentContractId} | update wx_bill_rent set status = 6 where rent_contract_id = #{rentContractId} | ||||
| and status in(4,2) | |||||
| and status != 3 | |||||
| </update> | </update> | ||||
| <delete id="deletePreviewBill" parameterType="com.iformall.domain.po.WxRentContract"> | <delete id="deletePreviewBill" parameterType="com.iformall.domain.po.WxRentContract"> | ||||
| @@ -144,4 +144,10 @@ | |||||
| update wx_bill_rent set is_preview = #{isPreview},merchant_id = #{merchantId} | update wx_bill_rent set is_preview = #{isPreview},merchant_id = #{merchantId} | ||||
| where rent_contract_id = #{rentContractId} | where rent_contract_id = #{rentContractId} | ||||
| </update> | </update> | ||||
| <select id="oweBillCount" parameterType="java.lang.Long" resultType="java.lang.Long"> | |||||
| select count(br.id) from wx_bill_rent br,wx_rent_contract c where c.id = br.rent_contract_id | |||||
| and br.status = 1 and c.id = #{contractId} | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||
| @@ -713,11 +713,10 @@ | |||||
| </select> | </select> | ||||
| <select id="findSubsidyMoney" parameterType="com.iformall.domain.po.WxCoupon" resultType="Long"> | <select id="findSubsidyMoney" parameterType="com.iformall.domain.po.WxCoupon" resultType="Long"> | ||||
| select sum(subsidy_num) from wx_coupon c | |||||
| select sum(sc.subsidy) from wx_card_info ci | |||||
| left join wx_coupon c on c.id = ci.coupon_id | |||||
| left join wx_merchant_subsidy sc on sc.coupon_order_id = ci.id | |||||
| where c.type = 100 and c.create_date between #{startdate} and #{enddate} | where c.type = 100 and c.create_date between #{startdate} and #{enddate} | ||||
| <if test="id != null"> | |||||
| and c.id = #{id} | |||||
| </if> | |||||
| </select> | </select> | ||||
| <select id="findCountData" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap"> | <select id="findCountData" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap"> | ||||
| @@ -872,9 +871,10 @@ | |||||
| </select> | </select> | ||||
| <select id="findSumSubsidyMoney" parameterType="com.iformall.domain.po.WxCoupon" resultType="Long"> | <select id="findSumSubsidyMoney" parameterType="com.iformall.domain.po.WxCoupon" resultType="Long"> | ||||
| select sum(c.subsidy_num) from wx_coupon c,wx_coupon_order wco | |||||
| where wco.coupon_id = c.id | |||||
| and wco.create_date between #{startdate} and #{enddate} | |||||
| select sum(sc.subsidy) from wx_coupon c | |||||
| left join wx_coupon_order wo on wo.coupon_id = c.id | |||||
| left join wx_merchant_subsidy sc on sc.coupon_order_id = wo.id | |||||
| where c.type not in(8,9,100) and c.create_date between #{startdate} and #{enddate} | |||||
| </select> | </select> | ||||
| @@ -17,12 +17,13 @@ | |||||
| <result column="shop_type" jdbcType="INTEGER" property="shopType"/> | <result column="shop_type" jdbcType="INTEGER" property="shopType"/> | ||||
| <result column="brand" jdbcType="VARCHAR" property="brand"/> | <result column="brand" jdbcType="VARCHAR" property="brand"/> | ||||
| <result column="type" jdbcType="SMALLINT" property="type"/> | <result column="type" jdbcType="SMALLINT" property="type"/> | ||||
| <result column="is_public" jdbcType="SMALLINT" property="isPublic"/> | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`tenant_id`,`img_url`,`name`,`link_phone`,`create_date`,`update_date`,`car_vendor_type`,`car_params`,`status`,`link_person`, | `id`,`tenant_id`,`img_url`,`name`,`link_phone`,`create_date`,`update_date`,`car_vendor_type`,`car_params`,`status`,`link_person`, | ||||
| `business_id`,`shop_type`,`brand`,`type` | |||||
| `business_id`,`shop_type`,`brand`,`type`,`is_public` | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -75,6 +76,9 @@ | |||||
| </if> | </if> | ||||
| <if test=" null != type "> | <if test=" null != type "> | ||||
| and `type` = #{type} | and `type` = #{type} | ||||
| </if> | |||||
| <if test=" null != isPublic "> | |||||
| and `is_public` = #{isPublic} | |||||
| </if> | </if> | ||||
| <if test=" null != ids "> | <if test=" null != ids "> | ||||
| and id in | and id in | ||||
| @@ -96,7 +100,7 @@ | |||||
| m.id, | m.id, | ||||
| m.img_url,m.name,m.link_phone,m.status,m.business_id, | m.img_url,m.name,m.link_phone,m.status,m.business_id, | ||||
| s.addr,s.shop_number,s.baidu_poi, | s.addr,s.shop_number,s.baidu_poi, | ||||
| mb.building_name,mf.floor_name | |||||
| mb.building_name,mf.floor_name,m.is_public | |||||
| </sql> | </sql> | ||||
| <resultMap id="MerchantVoResultMap" type="com.iformall.domain.vo.WxMerchantVo"> | <resultMap id="MerchantVoResultMap" type="com.iformall.domain.vo.WxMerchantVo"> | ||||
| @@ -111,6 +115,7 @@ | |||||
| <result column="building_name" jdbcType="VARCHAR" property="buildingName"/> | <result column="building_name" jdbcType="VARCHAR" property="buildingName"/> | ||||
| <result column="floor_name" jdbcType="VARCHAR" property="floorName"/> | <result column="floor_name" jdbcType="VARCHAR" property="floorName"/> | ||||
| <result column="baidu_poi" jdbcType="VARCHAR" property="baiduPoi"/> | <result column="baidu_poi" jdbcType="VARCHAR" property="baiduPoi"/> | ||||
| <result column="is_public" jdbcType="SMALLINT" property="isPublic"/> | |||||
| </resultMap> | </resultMap> | ||||
| @@ -172,6 +177,11 @@ | |||||
| <if test=" null != floorName and ''!=floorName "> | <if test=" null != floorName and ''!=floorName "> | ||||
| and mf.`floor_name` like concat('%', #{floorName},'%') | and mf.`floor_name` like concat('%', #{floorName},'%') | ||||
| </if> | </if> | ||||
| <if test=" null != isPublic"> | |||||
| and m.`is_public` = #{isPublic} | |||||
| </if> | |||||
| </select> | </select> | ||||
| @@ -72,10 +72,20 @@ | |||||
| <include refid="dynamicWhereConditions" /> | <include refid="dynamicWhereConditions" /> | ||||
| </select> | </select> | ||||
| <select id="findOneByModelId" parameterType="com.iformall.domain.po.WxMsgModel" resultMap="BaseResultMap"> | |||||
| select <include refid="allColumns" /> from wx_msg_model | |||||
| where 1=1 | |||||
| <if test=" null != modelId"> | |||||
| and `model_id` = #{modelId} | |||||
| </if> | |||||
| <if test=" null != tenantId "> | |||||
| and `tenant_id`=#{tenantId} | |||||
| </if> | |||||
| limit 1 | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||
| @@ -99,29 +99,20 @@ | |||||
| <select id="queryOrderGroupMarketingList" parameterType="com.iformall.domain.vo.WxOrderGroupMarketing" | <select id="queryOrderGroupMarketingList" parameterType="com.iformall.domain.vo.WxOrderGroupMarketing" | ||||
| resultType="com.iformall.domain.vo.WxOrderGroupMarketing"> | resultType="com.iformall.domain.vo.WxOrderGroupMarketing"> | ||||
| select c.tenant_id,coupon_id,c.cover_img,title,c.price,c.sale_price,c.group_total_count,c.group_success_count, | select c.tenant_id,coupon_id,c.cover_img,title,c.price,c.sale_price,c.group_total_count,c.group_success_count, | ||||
| ROUND(IFNULL((c.group_success_count/c.group_total_count),0)*100) | |||||
| CONCAT(ROUND(IFNULL((c.group_success_count/c.group_total_count),0)*100),'%') | |||||
| group_transfer_ratio,c.success_people,c.verify_count, | group_transfer_ratio,c.success_people,c.verify_count, | ||||
| ROUND(IFNULL((verify_count/success_people),0)*100) verify_ratio,c.total_people from( | |||||
| CONCAT(ROUND(IFNULL((verify_count/success_people),0)*100),'%') verify_ratio,c.total_people from( | |||||
| select tenant_id,id coupon_id,cover_img,title,FORMAT(price/100,2) price,FORMAT(sale_price/100,2) sale_price, | select tenant_id,id coupon_id,cover_img,title,FORMAT(price/100,2) price,FORMAT(sale_price/100,2) sale_price, | ||||
| (select count(*) total from wx_order_group where coupon_id=c.id) group_total_count, | (select count(*) total from wx_order_group where coupon_id=c.id) group_total_count, | ||||
| (select count(*) total from wx_order_group where status=11 and coupon_id=c.id) group_success_count, | (select count(*) total from wx_order_group where status=11 and coupon_id=c.id) group_success_count, | ||||
| IFNULL((select success.total from ( | |||||
| select count(success.product_id) total,success.product_id from ( | |||||
| select product_id,c_user_id from wx_order | |||||
| where order_status=11 | |||||
| group by product_id,c_user_id) success | |||||
| group by success.product_id) success where success.product_id=c.id),0) success_people, | |||||
| IFNULL((select count(*) from wx_order where order_status=11 and product_id=c.id),0) success_people, | |||||
| (select count(*) total | (select count(*) total | ||||
| from wx_coupon_order where coupon_type=9 and coupon_order_status=1 and coupon_id=c.id) verify_count, | from wx_coupon_order where coupon_type=9 and coupon_order_status=1 and coupon_id=c.id) verify_count, | ||||
| IFNULL((select success.total from ( | |||||
| select count(success.product_id) total,success.product_id from ( | |||||
| select product_id,c_user_id from wx_order | |||||
| group by product_id,c_user_id) success | |||||
| group by success.product_id) success where success.product_id=c.id),0) total_people | |||||
| from wx_coupon c where type=9 | |||||
| IFNULL((select count(*) from wx_order where order_group_id!=0 and product_id=c.id),0) total_people | |||||
| from wx_coupon c where type=9 order by c.status,c.id desc | |||||
| ) c | ) c | ||||
| <where> | <where> | ||||
| <if test=" null != couponId "> | |||||
| <if test=" null != couponId and ''!=couponId"> | |||||
| and c.coupon_id=#{couponId} | and c.coupon_id=#{couponId} | ||||
| </if> | </if> | ||||
| </where> | </where> | ||||
| @@ -180,7 +171,7 @@ | |||||
| </select> | </select> | ||||
| <select id="queryOrderGroupPeopleCount" parameterType="hashmap" resultType="long"> | <select id="queryOrderGroupPeopleCount" parameterType="hashmap" resultType="long"> | ||||
| select count(*) from (select DISTINCT c_user_id from wx_order where order_group_id!=0 | |||||
| select count(*) from (select id from wx_order where order_group_id!=0 | |||||
| <if test=" null != tenantId"> | <if test=" null != tenantId"> | ||||
| and tenant_id=#{tenantId} | and tenant_id=#{tenantId} | ||||
| </if> | </if> | ||||
| @@ -164,6 +164,22 @@ | |||||
| </if> | </if> | ||||
| </select> | </select> | ||||
| <select id="findListOfCompleteUnPaidPressOrderByDate" parameterType="map" resultMap="BaseResultMap"> | |||||
| select | |||||
| <include refid="allColumns"/> | |||||
| from wx_order | |||||
| where press_end_date is not null and order_status = 7 | |||||
| <if test="type != null"> | |||||
| AND type = #{type,jdbcType=TINYINT} | |||||
| </if> | |||||
| <if test="startDate != null"> | |||||
| AND unix_timestamp(`create_date`) > unix_timestamp(#{startDate,jdbcType=TIMESTAMP}) | |||||
| </if> | |||||
| <if test="endDate != null"> | |||||
| AND unix_timestamp(`update_date`) < unix_timestamp(#{endDate,jdbcType=TIMESTAMP}) | |||||
| </if> | |||||
| </select> | |||||
| <sql id="allCUserOrderListColumns"> | <sql id="allCUserOrderListColumns"> | ||||
| o.id,o.order_number,o.tenant_id,o.c_user_id,o.coupon_channel_id,o.product_id,o.payment_type,o.payment,o.payment_time,o.order_status,o.create_date,o.update_date, | o.id,o.order_number,o.tenant_id,o.c_user_id,o.coupon_channel_id,o.product_id,o.payment_type,o.payment,o.payment_time,o.order_status,o.create_date,o.update_date, | ||||