1.4.4版本,新增模板消息通知、H5端商家管理发货修改及其列表时间显示修复
This commit is contained in:
@ -19,7 +19,7 @@ public interface YxUserBillRepository extends JpaRepository<YxUserBill, Integer>
|
||||
value = "select b.title,b.pm,b.category,b.type,b.number,b.add_time as addTime," +
|
||||
"u.nickname from yx_user_bill b left join yx_user u on u.uid=b.uid " +
|
||||
" where if(?1 !='',b.category=?1,1=1) and if(?2 !='',b.type=?2,1=1) " +
|
||||
"and if(?3 !='',u.nickname LIKE CONCAT('%',?3,'%'),1=1)",
|
||||
"and if(?3 !='',u.nickname LIKE CONCAT('%',?3,'%'),1=1) order by b.id desc",
|
||||
countQuery = "select count(*) from yx_user_bill b left join yx_user u on u.uid=b.uid" +
|
||||
" where if(?1 !='',b.category=?1,1=1) and if(?2 !='',b.type=?2,1=1) " +
|
||||
"and if(?3 !='',u.nickname LIKE CONCAT('%',?3,'%'),1=1)")
|
||||
|
@ -11,7 +11,13 @@ import co.yixiang.aop.log.Log;
|
||||
import co.yixiang.modules.shop.service.YxStoreOrderStatusService;
|
||||
import co.yixiang.modules.shop.service.dto.YxExpressDTO;
|
||||
import co.yixiang.modules.shop.service.dto.YxStoreOrderQueryCriteria;
|
||||
import co.yixiang.modules.wechat.service.YxWechatUserService;
|
||||
import co.yixiang.modules.wechat.service.dto.YxWechatUserDTO;
|
||||
import co.yixiang.mp.domain.YxWechatTemplate;
|
||||
import co.yixiang.mp.service.WxMpTemplateMessageService;
|
||||
import co.yixiang.mp.service.YxWechatTemplateService;
|
||||
import co.yixiang.utils.OrderUtil;
|
||||
import co.yixiang.utils.RedisUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
@ -21,6 +27,9 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-10-14
|
||||
@ -39,6 +48,15 @@ public class YxStoreOrderController {
|
||||
@Autowired
|
||||
private YxExpressService yxExpressService;
|
||||
|
||||
@Autowired
|
||||
private YxWechatUserService wechatUserService;
|
||||
|
||||
@Autowired
|
||||
private WxMpTemplateMessageService templateMessageService;
|
||||
|
||||
@Autowired
|
||||
private YxWechatTemplateService yxWechatTemplateService;
|
||||
|
||||
|
||||
@GetMapping(value = "/data/count")
|
||||
//@PreAuthorize("hasAnyRole('ADMIN','YXSTOREORDER_ALL','YXSTOREORDER_SELECT')")
|
||||
@ -143,6 +161,23 @@ public class YxStoreOrderController {
|
||||
|
||||
yxStoreOrderStatusService.create(storeOrderStatus);
|
||||
|
||||
//模板消息通知
|
||||
String siteUrl = RedisUtil.get("site_url");
|
||||
YxWechatUserDTO wechatUser = wechatUserService.findById(resources.getUid());
|
||||
if(ObjectUtil.isNotNull(wechatUser)){
|
||||
YxWechatTemplate WechatTemplate = yxWechatTemplateService
|
||||
.findByTempkey("OPENTM200565259");
|
||||
Map<String,String> map = new HashMap<>();
|
||||
map.put("first","亲,宝贝已经启程了,好想快点来到你身边。");
|
||||
map.put("keyword1",resources.getOrderId());//订单号
|
||||
map.put("keyword2",expressDTO.getName());
|
||||
map.put("keyword3",resources.getDeliveryId());
|
||||
map.put("remark","yshop电商系统为你服务!");
|
||||
templateMessageService.sendWxMpTemplateMessage( wechatUser.getOpenid()
|
||||
,WechatTemplate.getTempid(),
|
||||
siteUrl+"/order/detail/"+resources.getOrderId(),map);
|
||||
}
|
||||
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,120 @@
|
||||
package co.yixiang.modules.wechat.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import javax.persistence.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-12-13
|
||||
*/
|
||||
@Entity
|
||||
@Data
|
||||
@Table(name="yx_wechat_user")
|
||||
public class YxWechatUser implements Serializable {
|
||||
|
||||
// 微信用户id
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "uid")
|
||||
private Integer uid;
|
||||
|
||||
// 只有在用户将公众号绑定到微信开放平台帐号后,才会出现该字段
|
||||
@Column(name = "unionid")
|
||||
private String unionid;
|
||||
|
||||
// 用户的标识,对当前公众号唯一
|
||||
@Column(name = "openid")
|
||||
private String openid;
|
||||
|
||||
// 小程序唯一身份ID
|
||||
@Column(name = "routine_openid")
|
||||
private String routineOpenid;
|
||||
|
||||
// 用户的昵称
|
||||
@Column(name = "nickname",nullable = false)
|
||||
private String nickname;
|
||||
|
||||
// 用户头像
|
||||
@Column(name = "headimgurl",nullable = false)
|
||||
private String headimgurl;
|
||||
|
||||
// 用户的性别,值为1时是男性,值为2时是女性,值为0时是未知
|
||||
@Column(name = "sex",nullable = false)
|
||||
private Integer sex;
|
||||
|
||||
// 用户所在城市
|
||||
@Column(name = "city",nullable = false)
|
||||
private String city;
|
||||
|
||||
// 用户的语言,简体中文为zh_CN
|
||||
@Column(name = "language",nullable = false)
|
||||
private String language;
|
||||
|
||||
// 用户所在省份
|
||||
@Column(name = "province",nullable = false)
|
||||
private String province;
|
||||
|
||||
// 用户所在国家
|
||||
@Column(name = "country",nullable = false)
|
||||
private String country;
|
||||
|
||||
// 公众号运营者对粉丝的备注,公众号运营者可在微信公众平台用户管理界面对粉丝添加备注
|
||||
@Column(name = "remark")
|
||||
private String remark;
|
||||
|
||||
// 用户所在的分组ID(兼容旧的用户分组接口)
|
||||
@Column(name = "groupid")
|
||||
private Integer groupid;
|
||||
|
||||
// 用户被打上的标签ID列表
|
||||
@Column(name = "tagid_list")
|
||||
private String tagidList;
|
||||
|
||||
// 用户是否订阅该公众号标识
|
||||
@Column(name = "subscribe")
|
||||
private Integer subscribe;
|
||||
|
||||
// 关注公众号时间
|
||||
@Column(name = "subscribe_time")
|
||||
private Integer subscribeTime;
|
||||
|
||||
// 添加时间
|
||||
@Column(name = "add_time")
|
||||
private Integer addTime;
|
||||
|
||||
// 一级推荐人
|
||||
@Column(name = "stair")
|
||||
private Integer stair;
|
||||
|
||||
// 二级推荐人
|
||||
@Column(name = "second")
|
||||
private Integer second;
|
||||
|
||||
// 一级推荐人订单
|
||||
@Column(name = "order_stair")
|
||||
private Integer orderStair;
|
||||
|
||||
// 二级推荐人订单
|
||||
@Column(name = "order_second")
|
||||
private Integer orderSecond;
|
||||
|
||||
// 佣金
|
||||
@Column(name = "now_money")
|
||||
private BigDecimal nowMoney;
|
||||
|
||||
// 小程序用户会话密匙
|
||||
@Column(name = "session_key")
|
||||
private String sessionKey;
|
||||
|
||||
// 用户类型
|
||||
@Column(name = "user_type")
|
||||
private String userType;
|
||||
|
||||
public void copy(YxWechatUser source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package co.yixiang.modules.wechat.repository;
|
||||
|
||||
import co.yixiang.modules.wechat.domain.YxWechatUser;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-12-13
|
||||
*/
|
||||
public interface YxWechatUserRepository extends JpaRepository<YxWechatUser, Integer>, JpaSpecificationExecutor {
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package co.yixiang.modules.wechat.rest;
|
||||
|
||||
import co.yixiang.aop.log.Log;
|
||||
import co.yixiang.modules.wechat.domain.YxWechatUser;
|
||||
import co.yixiang.modules.wechat.service.YxWechatUserService;
|
||||
import co.yixiang.modules.wechat.service.dto.YxWechatUserQueryCriteria;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-12-13
|
||||
*/
|
||||
@Api(tags = "YxWechatUser管理")
|
||||
@RestController
|
||||
@RequestMapping("api")
|
||||
public class YxWechatUserController {
|
||||
|
||||
@Autowired
|
||||
private YxWechatUserService yxWechatUserService;
|
||||
|
||||
@Log("查询YxWechatUser")
|
||||
@ApiOperation(value = "查询YxWechatUser")
|
||||
@GetMapping(value = "/yxWechatUser")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXWECHATUSER_ALL','YXWECHATUSER_SELECT')")
|
||||
public ResponseEntity getYxWechatUsers(YxWechatUserQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity(yxWechatUserService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("新增YxWechatUser")
|
||||
@ApiOperation(value = "新增YxWechatUser")
|
||||
@PostMapping(value = "/yxWechatUser")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXWECHATUSER_ALL','YXWECHATUSER_CREATE')")
|
||||
public ResponseEntity create(@Validated @RequestBody YxWechatUser resources){
|
||||
return new ResponseEntity(yxWechatUserService.create(resources),HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@Log("修改YxWechatUser")
|
||||
@ApiOperation(value = "修改YxWechatUser")
|
||||
@PutMapping(value = "/yxWechatUser")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXWECHATUSER_ALL','YXWECHATUSER_EDIT')")
|
||||
public ResponseEntity update(@Validated @RequestBody YxWechatUser resources){
|
||||
yxWechatUserService.update(resources);
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除YxWechatUser")
|
||||
@ApiOperation(value = "删除YxWechatUser")
|
||||
@DeleteMapping(value = "/yxWechatUser/{uid}")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXWECHATUSER_ALL','YXWECHATUSER_DELETE')")
|
||||
public ResponseEntity delete(@PathVariable Integer uid){
|
||||
yxWechatUserService.delete(uid);
|
||||
return new ResponseEntity(HttpStatus.OK);
|
||||
}
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
package co.yixiang.modules.wechat.service;
|
||||
|
||||
import co.yixiang.modules.wechat.domain.YxWechatUser;
|
||||
import co.yixiang.modules.wechat.service.dto.YxWechatUserDTO;
|
||||
import co.yixiang.modules.wechat.service.dto.YxWechatUserQueryCriteria;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-12-13
|
||||
*/
|
||||
//@CacheConfig(cacheNames = "yxWechatUser")
|
||||
public interface YxWechatUserService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param criteria
|
||||
* @param pageable
|
||||
* @return
|
||||
*/
|
||||
//@Cacheable
|
||||
Map<String,Object> queryAll(YxWechatUserQueryCriteria criteria, Pageable pageable);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
* @param criteria
|
||||
* @return
|
||||
*/
|
||||
//@Cacheable
|
||||
List<YxWechatUserDTO> queryAll(YxWechatUserQueryCriteria criteria);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param uid
|
||||
* @return
|
||||
*/
|
||||
//@Cacheable(key = "#p0")
|
||||
YxWechatUserDTO findById(Integer uid);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param resources
|
||||
* @return
|
||||
*/
|
||||
//@CacheEvict(allEntries = true)
|
||||
YxWechatUserDTO create(YxWechatUser resources);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param resources
|
||||
*/
|
||||
//@CacheEvict(allEntries = true)
|
||||
void update(YxWechatUser resources);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param uid
|
||||
*/
|
||||
//@CacheEvict(allEntries = true)
|
||||
void delete(Integer uid);
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
package co.yixiang.modules.wechat.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.math.BigDecimal;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-12-13
|
||||
*/
|
||||
@Data
|
||||
public class YxWechatUserDTO implements Serializable {
|
||||
|
||||
// 微信用户id
|
||||
private Integer uid;
|
||||
|
||||
// 只有在用户将公众号绑定到微信开放平台帐号后,才会出现该字段
|
||||
private String unionid;
|
||||
|
||||
// 用户的标识,对当前公众号唯一
|
||||
private String openid;
|
||||
|
||||
// 小程序唯一身份ID
|
||||
private String routineOpenid;
|
||||
|
||||
// 用户的昵称
|
||||
private String nickname;
|
||||
|
||||
// 用户头像
|
||||
private String headimgurl;
|
||||
|
||||
// 用户的性别,值为1时是男性,值为2时是女性,值为0时是未知
|
||||
private Integer sex;
|
||||
|
||||
// 用户所在城市
|
||||
private String city;
|
||||
|
||||
// 用户的语言,简体中文为zh_CN
|
||||
private String language;
|
||||
|
||||
// 用户所在省份
|
||||
private String province;
|
||||
|
||||
// 用户所在国家
|
||||
private String country;
|
||||
|
||||
// 公众号运营者对粉丝的备注,公众号运营者可在微信公众平台用户管理界面对粉丝添加备注
|
||||
private String remark;
|
||||
|
||||
// 用户所在的分组ID(兼容旧的用户分组接口)
|
||||
private Integer groupid;
|
||||
|
||||
// 用户被打上的标签ID列表
|
||||
private String tagidList;
|
||||
|
||||
// 用户是否订阅该公众号标识
|
||||
private Integer subscribe;
|
||||
|
||||
// 关注公众号时间
|
||||
private Integer subscribeTime;
|
||||
|
||||
// 添加时间
|
||||
private Integer addTime;
|
||||
|
||||
// 一级推荐人
|
||||
private Integer stair;
|
||||
|
||||
// 二级推荐人
|
||||
private Integer second;
|
||||
|
||||
// 一级推荐人订单
|
||||
private Integer orderStair;
|
||||
|
||||
// 二级推荐人订单
|
||||
private Integer orderSecond;
|
||||
|
||||
// 佣金
|
||||
private BigDecimal nowMoney;
|
||||
|
||||
// 小程序用户会话密匙
|
||||
private String sessionKey;
|
||||
|
||||
// 用户类型
|
||||
private String userType;
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package co.yixiang.modules.wechat.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.math.BigDecimal;
|
||||
import co.yixiang.annotation.Query;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-12-13
|
||||
*/
|
||||
@Data
|
||||
public class YxWechatUserQueryCriteria{
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
package co.yixiang.modules.wechat.service.impl;
|
||||
|
||||
import co.yixiang.modules.wechat.domain.YxWechatUser;
|
||||
import co.yixiang.utils.ValidationUtil;
|
||||
import co.yixiang.modules.wechat.repository.YxWechatUserRepository;
|
||||
import co.yixiang.modules.wechat.service.YxWechatUserService;
|
||||
import co.yixiang.modules.wechat.service.dto.YxWechatUserDTO;
|
||||
import co.yixiang.modules.wechat.service.dto.YxWechatUserQueryCriteria;
|
||||
import co.yixiang.modules.wechat.service.mapper.YxWechatUserMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.Optional;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import co.yixiang.utils.PageUtil;
|
||||
import co.yixiang.utils.QueryHelp;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-12-13
|
||||
*/
|
||||
@Service
|
||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||
public class YxWechatUserServiceImpl implements YxWechatUserService {
|
||||
|
||||
@Autowired
|
||||
private YxWechatUserRepository yxWechatUserRepository;
|
||||
|
||||
@Autowired
|
||||
private YxWechatUserMapper yxWechatUserMapper;
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(YxWechatUserQueryCriteria criteria, Pageable pageable){
|
||||
Page<YxWechatUser> page = yxWechatUserRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||
return PageUtil.toPage(page.map(yxWechatUserMapper::toDto));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<YxWechatUserDTO> queryAll(YxWechatUserQueryCriteria criteria){
|
||||
return yxWechatUserMapper.toDto(yxWechatUserRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public YxWechatUserDTO findById(Integer uid) {
|
||||
Optional<YxWechatUser> yxWechatUser = yxWechatUserRepository.findById(uid);
|
||||
ValidationUtil.isNull(yxWechatUser,"YxWechatUser","uid",uid);
|
||||
return yxWechatUserMapper.toDto(yxWechatUser.get());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public YxWechatUserDTO create(YxWechatUser resources) {
|
||||
return yxWechatUserMapper.toDto(yxWechatUserRepository.save(resources));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(YxWechatUser resources) {
|
||||
Optional<YxWechatUser> optionalYxWechatUser = yxWechatUserRepository.findById(resources.getUid());
|
||||
ValidationUtil.isNull( optionalYxWechatUser,"YxWechatUser","id",resources.getUid());
|
||||
YxWechatUser yxWechatUser = optionalYxWechatUser.get();
|
||||
yxWechatUser.copy(resources);
|
||||
yxWechatUserRepository.save(yxWechatUser);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delete(Integer uid) {
|
||||
yxWechatUserRepository.deleteById(uid);
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package co.yixiang.modules.wechat.service.mapper;
|
||||
|
||||
import co.yixiang.mapper.EntityMapper;
|
||||
import co.yixiang.modules.wechat.domain.YxWechatUser;
|
||||
import co.yixiang.modules.wechat.service.dto.YxWechatUserDTO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-12-13
|
||||
*/
|
||||
@Mapper(componentModel = "spring",uses = {},unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface YxWechatUserMapper extends EntityMapper<YxWechatUserDTO, YxWechatUser> {
|
||||
|
||||
}
|
Reference in New Issue
Block a user