Commit ce6e0c38 authored by 廖旭伟's avatar 廖旭伟

微信扫码登录手机登录等

parent e511a534
ALTER TABLE `mortals_xhx_customer` ADD COLUMN `openId` varchar(128) DEFAULT NULL COMMENT '微信openid';
ALTER TABLE `mortals_xhx_customer_work_design` MODIFY COLUMN `updateTime` datetime DEFAULT NULL COMMENT '更新时间';
ALTER TABLE `mortals_xhx_customer_work_design_stat` MODIFY COLUMN `updateTime` datetime DEFAULT NULL COMMENT '更新时间';
ALTER TABLE `mortals_xhx_customer_work_design` ADD COLUMN `designType` tinyint(2) NOT NULL DEFAULT '1' COMMENT '作品类型:1:图片,2:视频';
ALTER TABLE `mortals_xhx_design_masterplate` ADD COLUMN `designType` tinyint(2) NOT NULL DEFAULT '1' COMMENT '作品类型:1:图片,2:视频';
ALTER TABLE `mortals_xhx_customer_work_collect` ADD COLUMN `designType` tinyint(2) NOT NULL DEFAULT '1' COMMENT '作品类型:1:图片,2:视频';
...@@ -59,10 +59,10 @@ ...@@ -59,10 +59,10 @@
<profiles.active>product</profiles.active> <profiles.active>product</profiles.active>
<profiles.server.port>19211</profiles.server.port> <profiles.server.port>19211</profiles.server.port>
<profiles.queue.type>rabbitmq</profiles.queue.type> <profiles.queue.type>rabbitmq</profiles.queue.type>
<profiles.kafka.brokers>192.168.0.100:9092</profiles.kafka.brokers> <profiles.kafka.brokers>127.0.0.1:9092</profiles.kafka.brokers>
<profiles.rabbitmq.host>192.168.0.100</profiles.rabbitmq.host> <profiles.rabbitmq.host>127.0.0.1</profiles.rabbitmq.host>
<profiles.rabbitmq.port>5672</profiles.rabbitmq.port> <profiles.rabbitmq.port>5672</profiles.rabbitmq.port>
<profiles.nacos.server-addr>192.168.0.100:8848</profiles.nacos.server-addr> <profiles.nacos.server-addr>127.0.0.1:8848</profiles.nacos.server-addr>
<profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group> <profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group>
<profiles.nacos.namespace>stp</profiles.nacos.namespace> <profiles.nacos.namespace>stp</profiles.nacos.namespace>
<profiles.log.level>info</profiles.log.level> <profiles.log.level>info</profiles.log.level>
......
package com.mortals.xhx.common.code;
import com.mortals.framework.ap.SysConstains;
import com.mortals.framework.common.IBaseEnum;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* 设计类型
*/
public enum DesignTypeEnum implements IBaseEnum {
PICTURES(1,"图片", SysConstains.STYLE_DEFAULT),
VIDEOS(2,"视频", SysConstains.STYLE_DEFAULT),
;
private int value;
private String desc;
private String style;
DesignTypeEnum(int value, String desc, String style) {
this.value = value;
this.desc = desc;
this.style = style;
}
@Override
public int getValue() {
return this.value;
}
@Override
public String getDesc() {
return this.desc;
}
@Override
public String getStyle() {
return this.style;
}
public static DesignTypeEnum getByValue(int value) {
for (DesignTypeEnum e : DesignTypeEnum.values()) {
if (e.getValue() == value) {
return e;
}
}
return null;
}
public static Map<String,String> getEnumMap(int... eItem) {
Map<String,String> resultMap= new LinkedHashMap<String,String>();
for (DesignTypeEnum item : DesignTypeEnum.values()) {
try{
boolean hasE = false;
for (int e : eItem){
if(item.getValue()==e){
hasE = true;
break;
}
}
if(!hasE){
resultMap.put(item.getValue()+"", item.getDesc());
}
}catch(Exception ex){
}
}
return resultMap;
}
}
\ No newline at end of file
...@@ -93,7 +93,10 @@ public class CustomerEntity extends CustomerVo implements IUser { ...@@ -93,7 +93,10 @@ public class CustomerEntity extends CustomerVo implements IUser {
*/ */
private String lastLoginAddress; private String lastLoginAddress;
/**
* 微信openid
*/
private String openId;
public CustomerEntity(){} public CustomerEntity(){}
/** /**
...@@ -330,8 +333,13 @@ public class CustomerEntity extends CustomerVo implements IUser { ...@@ -330,8 +333,13 @@ public class CustomerEntity extends CustomerVo implements IUser {
this.lastLoginAddress = lastLoginAddress; this.lastLoginAddress = lastLoginAddress;
} }
public String getOpenId() {
return openId;
}
public void setOpenId(String openId) {
this.openId = openId;
}
@Override @Override
public int hashCode() { public int hashCode() {
......
package com.mortals.xhx.module.customer.model; package com.mortals.xhx.module.customer.model;
import java.util.List; import java.util.List;
import java.util.ArrayList; import java.util.ArrayList;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel; import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong; import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.customer.model.vo.CustomerWorkCollectVo; import com.mortals.xhx.module.customer.model.vo.CustomerWorkCollectVo;
import lombok.Data;
/** /**
* 客户收藏信息实体对象 * 客户收藏信息实体对象
* *
* @author zxfei * @author zxfei
* @date 2022-06-13 * @date 2023-07-11
*/ */
@Data
public class CustomerWorkCollectEntity extends CustomerWorkCollectVo { public class CustomerWorkCollectEntity extends CustomerWorkCollectVo {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -24,42 +24,10 @@ public class CustomerWorkCollectEntity extends CustomerWorkCollectVo { ...@@ -24,42 +24,10 @@ public class CustomerWorkCollectEntity extends CustomerWorkCollectVo {
* 模版ID * 模版ID
*/ */
private Long masterplateId; private Long masterplateId;
public CustomerWorkCollectEntity(){}
/**
* 获取 客户ID
* @return Long
*/
public Long getCustomerId(){
return customerId;
}
/**
* 设置 客户ID
* @param customerId
*/
public void setCustomerId(Long customerId){
this.customerId = customerId;
}
/** /**
* 获取 模版ID * 作品类型:1:图片,2:视频
* @return Long
*/ */
public Long getMasterplateId(){ private Integer designType;
return masterplateId;
}
/**
* 设置 模版ID
* @param masterplateId
*/
public void setMasterplateId(Long masterplateId){
this.masterplateId = masterplateId;
}
@Override @Override
public int hashCode() { public int hashCode() {
return this.getId().hashCode(); return this.getId().hashCode();
...@@ -76,17 +44,12 @@ public class CustomerWorkCollectEntity extends CustomerWorkCollectVo { ...@@ -76,17 +44,12 @@ public class CustomerWorkCollectEntity extends CustomerWorkCollectVo {
return false; return false;
} }
public String toString(){
StringBuilder sb = new StringBuilder("");
sb.append(",customerId:").append(getCustomerId());
sb.append(",masterplateId:").append(getMasterplateId());
return sb.toString();
}
public void initAttrValue(){ public void initAttrValue(){
this.customerId = null; this.customerId = null;
this.masterplateId = null; this.masterplateId = -1L;
this.designType = 1;
} }
} }
\ No newline at end of file
...@@ -3,11 +3,11 @@ package com.mortals.xhx.module.customer.model; ...@@ -3,11 +3,11 @@ package com.mortals.xhx.module.customer.model;
import java.util.List; import java.util.List;
import com.mortals.xhx.module.customer.model.CustomerWorkCollectEntity; import com.mortals.xhx.module.customer.model.CustomerWorkCollectEntity;
/** /**
* 客户收藏信息查询对象 * 客户收藏信息查询对象
* *
* @author zxfei * @author zxfei
* @date 2022-06-13 * @date 2023-07-11
*/ */
public class CustomerWorkCollectQuery extends CustomerWorkCollectEntity { public class CustomerWorkCollectQuery extends CustomerWorkCollectEntity {
/** 开始 主键ID,主键,自增长 */ /** 开始 主键ID,主键,自增长 */
private Long idStart; private Long idStart;
...@@ -21,6 +21,9 @@ public class CustomerWorkCollectQuery extends CustomerWorkCollectEntity { ...@@ -21,6 +21,9 @@ public class CustomerWorkCollectQuery extends CustomerWorkCollectEntity {
/** 主键ID,主键,自增长列表 */ /** 主键ID,主键,自增长列表 */
private List <Long> idList; private List <Long> idList;
/** 主键ID,主键,自增长排除列表 */
private List <Long> idNotList;
/** 开始 客户ID */ /** 开始 客户ID */
private Long customerIdStart; private Long customerIdStart;
...@@ -33,6 +36,9 @@ public class CustomerWorkCollectQuery extends CustomerWorkCollectEntity { ...@@ -33,6 +36,9 @@ public class CustomerWorkCollectQuery extends CustomerWorkCollectEntity {
/** 客户ID列表 */ /** 客户ID列表 */
private List <Long> customerIdList; private List <Long> customerIdList;
/** 客户ID排除列表 */
private List <Long> customerIdNotList;
/** 开始 模版ID */ /** 开始 模版ID */
private Long masterplateIdStart; private Long masterplateIdStart;
...@@ -45,12 +51,30 @@ public class CustomerWorkCollectQuery extends CustomerWorkCollectEntity { ...@@ -45,12 +51,30 @@ public class CustomerWorkCollectQuery extends CustomerWorkCollectEntity {
/** 模版ID列表 */ /** 模版ID列表 */
private List <Long> masterplateIdList; private List <Long> masterplateIdList;
/** 模版ID排除列表 */
private List <Long> masterplateIdNotList;
/** 开始 收藏时间 */ /** 开始 收藏时间 */
private String createTimeStart; private String createTimeStart;
/** 结束 收藏时间 */ /** 结束 收藏时间 */
private String createTimeEnd; private String createTimeEnd;
/** 开始 作品类型:1:图片,2:视频 */
private Integer designTypeStart;
/** 结束 作品类型:1:图片,2:视频 */
private Integer designTypeEnd;
/** 增加 作品类型:1:图片,2:视频 */
private Integer designTypeIncrement;
/** 作品类型:1:图片,2:视频列表 */
private List <Integer> designTypeList;
/** 作品类型:1:图片,2:视频排除列表 */
private List <Integer> designTypeNotList;
/** OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) */ /** OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) */
private List<CustomerWorkCollectQuery> orConditionList; private List<CustomerWorkCollectQuery> orConditionList;
...@@ -123,6 +147,23 @@ public class CustomerWorkCollectQuery extends CustomerWorkCollectEntity { ...@@ -123,6 +147,23 @@ public class CustomerWorkCollectQuery extends CustomerWorkCollectEntity {
this.idList = idList; this.idList = idList;
} }
/**
* 获取 主键ID,主键,自增长
* @return idNotList
*/
public List<Long> getIdNotList(){
return this.idNotList;
}
/**
* 设置 主键ID,主键,自增长
* @param idNotList
*/
public void setIdNotList(List<Long> idNotList){
this.idNotList = idNotList;
}
/** /**
* 获取 开始 客户ID * 获取 开始 客户ID
* @return customerIdStart * @return customerIdStart
...@@ -187,6 +228,23 @@ public class CustomerWorkCollectQuery extends CustomerWorkCollectEntity { ...@@ -187,6 +228,23 @@ public class CustomerWorkCollectQuery extends CustomerWorkCollectEntity {
this.customerIdList = customerIdList; this.customerIdList = customerIdList;
} }
/**
* 获取 客户ID
* @return customerIdNotList
*/
public List<Long> getCustomerIdNotList(){
return this.customerIdNotList;
}
/**
* 设置 客户ID
* @param customerIdNotList
*/
public void setCustomerIdNotList(List<Long> customerIdNotList){
this.customerIdNotList = customerIdNotList;
}
/** /**
* 获取 开始 模版ID * 获取 开始 模版ID
* @return masterplateIdStart * @return masterplateIdStart
...@@ -251,6 +309,23 @@ public class CustomerWorkCollectQuery extends CustomerWorkCollectEntity { ...@@ -251,6 +309,23 @@ public class CustomerWorkCollectQuery extends CustomerWorkCollectEntity {
this.masterplateIdList = masterplateIdList; this.masterplateIdList = masterplateIdList;
} }
/**
* 获取 模版ID
* @return masterplateIdNotList
*/
public List<Long> getMasterplateIdNotList(){
return this.masterplateIdNotList;
}
/**
* 设置 模版ID
* @param masterplateIdNotList
*/
public void setMasterplateIdNotList(List<Long> masterplateIdNotList){
this.masterplateIdNotList = masterplateIdNotList;
}
/** /**
* 获取 开始 收藏时间 * 获取 开始 收藏时间
* @return createTimeStart * @return createTimeStart
...@@ -283,6 +358,87 @@ public class CustomerWorkCollectQuery extends CustomerWorkCollectEntity { ...@@ -283,6 +358,87 @@ public class CustomerWorkCollectQuery extends CustomerWorkCollectEntity {
this.createTimeEnd = createTimeEnd; this.createTimeEnd = createTimeEnd;
} }
/**
* 获取 开始 作品类型:1:图片,2:视频
* @return designTypeStart
*/
public Integer getDesignTypeStart(){
return this.designTypeStart;
}
/**
* 设置 开始 作品类型:1:图片,2:视频
* @param designTypeStart
*/
public void setDesignTypeStart(Integer designTypeStart){
this.designTypeStart = designTypeStart;
}
/**
* 获取 结束 作品类型:1:图片,2:视频
* @return $designTypeEnd
*/
public Integer getDesignTypeEnd(){
return this.designTypeEnd;
}
/**
* 设置 结束 作品类型:1:图片,2:视频
* @param designTypeEnd
*/
public void setDesignTypeEnd(Integer designTypeEnd){
this.designTypeEnd = designTypeEnd;
}
/**
* 获取 增加 作品类型:1:图片,2:视频
* @return designTypeIncrement
*/
public Integer getDesignTypeIncrement(){
return this.designTypeIncrement;
}
/**
* 设置 增加 作品类型:1:图片,2:视频
* @param designTypeIncrement
*/
public void setDesignTypeIncrement(Integer designTypeIncrement){
this.designTypeIncrement = designTypeIncrement;
}
/**
* 获取 作品类型:1:图片,2:视频
* @return designTypeList
*/
public List<Integer> getDesignTypeList(){
return this.designTypeList;
}
/**
* 设置 作品类型:1:图片,2:视频
* @param designTypeList
*/
public void setDesignTypeList(List<Integer> designTypeList){
this.designTypeList = designTypeList;
}
/**
* 获取 作品类型:1:图片,2:视频
* @return designTypeNotList
*/
public List<Integer> getDesignTypeNotList(){
return this.designTypeNotList;
}
/**
* 设置 作品类型:1:图片,2:视频
* @param designTypeNotList
*/
public void setDesignTypeNotList(List<Integer> designTypeNotList){
this.designTypeNotList = designTypeNotList;
}
/** /**
* 设置 主键ID,主键,自增长 * 设置 主键ID,主键,自增长
* @param id * @param id
...@@ -328,6 +484,15 @@ public class CustomerWorkCollectQuery extends CustomerWorkCollectEntity { ...@@ -328,6 +484,15 @@ public class CustomerWorkCollectQuery extends CustomerWorkCollectEntity {
return this; return this;
} }
/**
* 设置 主键ID,主键,自增长
* @param idNotList
*/
public CustomerWorkCollectQuery idNotList(List<Long> idNotList){
this.idNotList = idNotList;
return this;
}
/** /**
* 设置 客户ID * 设置 客户ID
* @param customerId * @param customerId
...@@ -373,6 +538,15 @@ public class CustomerWorkCollectQuery extends CustomerWorkCollectEntity { ...@@ -373,6 +538,15 @@ public class CustomerWorkCollectQuery extends CustomerWorkCollectEntity {
return this; return this;
} }
/**
* 设置 客户ID
* @param customerIdNotList
*/
public CustomerWorkCollectQuery customerIdNotList(List<Long> customerIdNotList){
this.customerIdNotList = customerIdNotList;
return this;
}
/** /**
* 设置 模版ID * 设置 模版ID
* @param masterplateId * @param masterplateId
...@@ -418,6 +592,69 @@ public class CustomerWorkCollectQuery extends CustomerWorkCollectEntity { ...@@ -418,6 +592,69 @@ public class CustomerWorkCollectQuery extends CustomerWorkCollectEntity {
return this; return this;
} }
/**
* 设置 模版ID
* @param masterplateIdNotList
*/
public CustomerWorkCollectQuery masterplateIdNotList(List<Long> masterplateIdNotList){
this.masterplateIdNotList = masterplateIdNotList;
return this;
}
/**
* 设置 作品类型:1:图片,2:视频
* @param designType
*/
public CustomerWorkCollectQuery designType(Integer designType){
setDesignType(designType);
return this;
}
/**
* 设置 开始 作品类型:1:图片,2:视频
* @param designTypeStart
*/
public CustomerWorkCollectQuery designTypeStart(Integer designTypeStart){
this.designTypeStart = designTypeStart;
return this;
}
/**
* 设置 结束 作品类型:1:图片,2:视频
* @param designTypeEnd
*/
public CustomerWorkCollectQuery designTypeEnd(Integer designTypeEnd){
this.designTypeEnd = designTypeEnd;
return this;
}
/**
* 设置 增加 作品类型:1:图片,2:视频
* @param designTypeIncrement
*/
public CustomerWorkCollectQuery designTypeIncrement(Integer designTypeIncrement){
this.designTypeIncrement = designTypeIncrement;
return this;
}
/**
* 设置 作品类型:1:图片,2:视频
* @param designTypeList
*/
public CustomerWorkCollectQuery designTypeList(List<Integer> designTypeList){
this.designTypeList = designTypeList;
return this;
}
/**
* 设置 作品类型:1:图片,2:视频
* @param designTypeNotList
*/
public CustomerWorkCollectQuery designTypeNotList(List<Integer> designTypeNotList){
this.designTypeNotList = designTypeNotList;
return this;
}
/** /**
* 获取 OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) * 获取 OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4)
......
package com.mortals.xhx.module.customer.model; package com.mortals.xhx.module.customer.model;
import java.util.List; import java.util.List;
import java.util.ArrayList; import java.util.ArrayList;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel; import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong; import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.customer.model.vo.CustomerWorkDesignVo; import com.mortals.xhx.module.customer.model.vo.CustomerWorkDesignVo;
import lombok.Data;
/** /**
* 客户作品信息实体对象 * 客户作品信息实体对象
* *
* @author zxfei * @author zxfei
* @date 2022-07-08 * @date 2023-07-11
*/ */
@Data
public class CustomerWorkDesignEntity extends CustomerWorkDesignVo { public class CustomerWorkDesignEntity extends CustomerWorkDesignVo {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -56,154 +56,10 @@ public class CustomerWorkDesignEntity extends CustomerWorkDesignVo { ...@@ -56,154 +56,10 @@ public class CustomerWorkDesignEntity extends CustomerWorkDesignVo {
* 设计草稿 * 设计草稿
*/ */
private String draft; private String draft;
public CustomerWorkDesignEntity(){}
/**
* 获取 客户ID
* @return Long
*/
public Long getCustomerId(){
return customerId;
}
/**
* 设置 客户ID
* @param customerId
*/
public void setCustomerId(Long customerId){
this.customerId = customerId;
}
/**
* 获取 作品名称
* @return String
*/
public String getWorkDesignName(){
return workDesignName;
}
/**
* 设置 作品名称
* @param workDesignName
*/
public void setWorkDesignName(String workDesignName){
this.workDesignName = workDesignName;
}
/**
* 获取 作品状态:0:草稿,1:发布
* @return Integer
*/
public Integer getWorkDesignStatus(){
return workDesignStatus;
}
/**
* 设置 作品状态:0:草稿,1:发布
* @param workDesignStatus
*/
public void setWorkDesignStatus(Integer workDesignStatus){
this.workDesignStatus = workDesignStatus;
}
/**
* 获取 作品描述
* @return String
*/
public String getWorkDesignDesc(){
return workDesignDesc;
}
/**
* 设置 作品描述
* @param workDesignDesc
*/
public void setWorkDesignDesc(String workDesignDesc){
this.workDesignDesc = workDesignDesc;
}
/**
* 获取 模版引用的图片
* @return String
*/
public String getPictureIds(){
return pictureIds;
}
/**
* 设置 模版引用的图片
* @param pictureIds
*/
public void setPictureIds(String pictureIds){
this.pictureIds = pictureIds;
}
/** /**
* 获取 模版引用的素材 * 作品类型:1:图片,2:视频
* @return String
*/ */
public String getPictureSrcIds(){ private Integer designType;
return pictureSrcIds;
}
/**
* 设置 模版引用的素材
* @param pictureSrcIds
*/
public void setPictureSrcIds(String pictureSrcIds){
this.pictureSrcIds = pictureSrcIds;
}
/**
* 获取 模版引用的背景
* @return String
*/
public String getPictureBackgroundIds(){
return pictureBackgroundIds;
}
/**
* 设置 模版引用的背景
* @param pictureBackgroundIds
*/
public void setPictureBackgroundIds(String pictureBackgroundIds){
this.pictureBackgroundIds = pictureBackgroundIds;
}
/**
* 获取 作品引用的字体
* @return String
*/
public String getFontIds(){
return fontIds;
}
/**
* 设置 作品引用的字体
* @param fontIds
*/
public void setFontIds(String fontIds){
this.fontIds = fontIds;
}
/**
* 获取 作品图片预览地址(相对地址)
* @return String
*/
public String getPreviewUrl(){
return previewUrl;
}
/**
* 设置 作品图片预览地址(相对地址)
* @param previewUrl
*/
public void setPreviewUrl(String previewUrl){
this.previewUrl = previewUrl;
}
/**
* 获取 设计草稿
* @return String
*/
public String getDraft(){
return draft;
}
/**
* 设置 设计草稿
* @param draft
*/
public void setDraft(String draft){
this.draft = draft;
}
@Override @Override
public int hashCode() { public int hashCode() {
return this.getId().hashCode(); return this.getId().hashCode();
...@@ -220,28 +76,13 @@ public class CustomerWorkDesignEntity extends CustomerWorkDesignVo { ...@@ -220,28 +76,13 @@ public class CustomerWorkDesignEntity extends CustomerWorkDesignVo {
return false; return false;
} }
public String toString(){
StringBuilder sb = new StringBuilder("");
sb.append(",customerId:").append(getCustomerId());
sb.append(",workDesignName:").append(getWorkDesignName());
sb.append(",workDesignStatus:").append(getWorkDesignStatus());
sb.append(",workDesignDesc:").append(getWorkDesignDesc());
sb.append(",pictureIds:").append(getPictureIds());
sb.append(",pictureSrcIds:").append(getPictureSrcIds());
sb.append(",pictureBackgroundIds:").append(getPictureBackgroundIds());
sb.append(",fontIds:").append(getFontIds());
sb.append(",previewUrl:").append(getPreviewUrl());
sb.append(",draft:").append(getDraft());
return sb.toString();
}
public void initAttrValue(){ public void initAttrValue(){
this.customerId = null; this.customerId = null;
this.workDesignName = ""; this.workDesignName = "";
this.workDesignStatus = null; this.workDesignStatus = -1;
this.workDesignDesc = ""; this.workDesignDesc = "";
...@@ -256,5 +97,7 @@ public class CustomerWorkDesignEntity extends CustomerWorkDesignVo { ...@@ -256,5 +97,7 @@ public class CustomerWorkDesignEntity extends CustomerWorkDesignVo {
this.previewUrl = ""; this.previewUrl = "";
this.draft = ""; this.draft = "";
this.designType = 1;
} }
} }
\ No newline at end of file
...@@ -82,4 +82,13 @@ public interface CustomerService extends ICRUDService<CustomerEntity,Long>{ ...@@ -82,4 +82,13 @@ public interface CustomerService extends ICRUDService<CustomerEntity,Long>{
*/ */
CustomerEntity doSmsLogin(String mobileNumber, String verifyCode, String loginIp) throws AppException; CustomerEntity doSmsLogin(String mobileNumber, String verifyCode, String loginIp) throws AppException;
/**
* 微信扫码登录
* @param openId
* @param loginIp
* @return
* @throws AppException
*/
CustomerEntity doWeChatLogin(String openId, String loginIp) throws AppException;
} }
\ No newline at end of file
...@@ -148,6 +148,16 @@ public class CustomerServiceImpl extends AbstractCRUDServiceImpl<CustomerDao, Cu ...@@ -148,6 +148,16 @@ public class CustomerServiceImpl extends AbstractCRUDServiceImpl<CustomerDao, Cu
@Override @Override
public CustomerEntity updateByPersonal(CustomerEntity params, Context context) throws AppException { public CustomerEntity updateByPersonal(CustomerEntity params, Context context) throws AppException {
CustomerEntity old = this.get(params.getId());
if(old==null){
throw new AppException("用户Id不正确!");
}
if(!old.getLoginName().equals(params.getLoginName())) {
CustomerEntity user = this.findByLoginName(params.getLoginName());
if (user != null) {
throw new AppException("用户名已存在!");
}
}
CustomerEntity update = new CustomerEntity(); CustomerEntity update = new CustomerEntity();
update.setId(params.getId()); update.setId(params.getId());
update.setLoginName(params.getLoginName()); update.setLoginName(params.getLoginName());
...@@ -158,6 +168,7 @@ public class CustomerServiceImpl extends AbstractCRUDServiceImpl<CustomerDao, Cu ...@@ -158,6 +168,7 @@ public class CustomerServiceImpl extends AbstractCRUDServiceImpl<CustomerDao, Cu
update.setContactTelphone(params.getContactTelphone()); update.setContactTelphone(params.getContactTelphone());
update.setMailbox(params.getMailbox()); update.setMailbox(params.getMailbox());
update.setJob(params.getJob()); update.setJob(params.getJob());
update.setOpenId(params.getOpenId());
int iRet = this.dao.update(update); int iRet = this.dao.update(update);
if (iRet == 0) { if (iRet == 0) {
throw new AppException(-1002, "更新失败!"); throw new AppException(-1002, "更新失败!");
...@@ -253,6 +264,10 @@ public class CustomerServiceImpl extends AbstractCRUDServiceImpl<CustomerDao, Cu ...@@ -253,6 +264,10 @@ public class CustomerServiceImpl extends AbstractCRUDServiceImpl<CustomerDao, Cu
if(customer==null){ if(customer==null){
throw new AppException("手机号码:" + mobileNumber + "没有注册用户"); throw new AppException("手机号码:" + mobileNumber + "没有注册用户");
} }
String verifyCode = cacheService.get(SMS_VERIFY_CODE_KEY + mobileNumber);
if(StringUtils.isNotEmpty(verifyCode)){
throw new AppException("当前手机号码已发送验证码,请稍后重试");
}
try { try {
Map<String, String> params = new HashMap<>(); Map<String, String> params = new HashMap<>();
params.put("appid",appid); params.put("appid",appid);
...@@ -308,6 +323,20 @@ public class CustomerServiceImpl extends AbstractCRUDServiceImpl<CustomerDao, Cu ...@@ -308,6 +323,20 @@ public class CustomerServiceImpl extends AbstractCRUDServiceImpl<CustomerDao, Cu
return customer; return customer;
} }
@Override
public CustomerEntity doWeChatLogin(String openId, String loginIp) throws AppException {
CustomerEntity customer = this.selectOne(new CustomerQuery().openId(openId));
if(customer==null){
throw new AppException("用户未绑定微信");
}
CustomerEntity update = new CustomerEntity();
update.setId(customer.getId());
update.setLastLoginAddress(loginIp);
update.setLastLoginTime(new Date());
this.update(update);
return customer;
}
public static void main(String[] args){ public static void main(String[] args){
try { try {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
......
...@@ -54,6 +54,10 @@ public class CustomerWorkCollectServiceImpl extends AbstractCRUDServiceImpl<Cust ...@@ -54,6 +54,10 @@ public class CustomerWorkCollectServiceImpl extends AbstractCRUDServiceImpl<Cust
protected void saveBefore(CustomerWorkCollectEntity entity, Context context) throws AppException { protected void saveBefore(CustomerWorkCollectEntity entity, Context context) throws AppException {
this.validData(entity, context); this.validData(entity, context);
entity.setCustomerId(this.getContextUserId(context)); entity.setCustomerId(this.getContextUserId(context));
DesignMasterplateEntity masterplateEntity = designMasterplateService.get(entity.getMasterplateId());
if(masterplateEntity!=null){
entity.setDesignType(masterplateEntity.getDesignType());
}
CustomerWorkCollectEntity query = new CustomerWorkCollectEntity(); CustomerWorkCollectEntity query = new CustomerWorkCollectEntity();
query.setCustomerId(entity.getCustomerId()); query.setCustomerId(entity.getCustomerId());
query.setMasterplateId(entity.getMasterplateId()); query.setMasterplateId(entity.getMasterplateId());
......
...@@ -7,10 +7,7 @@ import com.mortals.framework.service.impl.AbstractCRUDServiceImpl; ...@@ -7,10 +7,7 @@ import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.xhx.common.code.WorkDesignStatusEnum; import com.mortals.xhx.common.code.WorkDesignStatusEnum;
import com.mortals.xhx.common.utils.StringUtils; import com.mortals.xhx.common.utils.StringUtils;
import com.mortals.xhx.module.customer.dao.CustomerWorkDesignDao; import com.mortals.xhx.module.customer.dao.CustomerWorkDesignDao;
import com.mortals.xhx.module.customer.model.CustomerEntity; import com.mortals.xhx.module.customer.model.*;
import com.mortals.xhx.module.customer.model.CustomerWorkDesignEntity;
import com.mortals.xhx.module.customer.model.CustomerWorkDesignStatEntity;
import com.mortals.xhx.module.customer.model.CustomerWorkDesignStatQuery;
import com.mortals.xhx.module.customer.service.CustomerService; import com.mortals.xhx.module.customer.service.CustomerService;
import com.mortals.xhx.module.customer.service.CustomerWorkDesignService; import com.mortals.xhx.module.customer.service.CustomerWorkDesignService;
import com.mortals.xhx.module.customer.service.CustomerWorkDesignStatService; import com.mortals.xhx.module.customer.service.CustomerWorkDesignStatService;
...@@ -22,6 +19,8 @@ import org.apache.commons.collections4.CollectionUtils; ...@@ -22,6 +19,8 @@ import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -65,8 +64,13 @@ public class CustomerWorkDesignServiceImpl extends AbstractCRUDServiceImpl<Custo ...@@ -65,8 +64,13 @@ public class CustomerWorkDesignServiceImpl extends AbstractCRUDServiceImpl<Custo
if(CollectionUtils.isEmpty(cwdList)){ if(CollectionUtils.isEmpty(cwdList)){
CustomerWorkDesignStatEntity cwdEntity = new CustomerWorkDesignStatEntity(); CustomerWorkDesignStatEntity cwdEntity = new CustomerWorkDesignStatEntity();
cwdEntity.setCustomerId(entity.getCustomerId()); cwdEntity.setCustomerId(entity.getCustomerId());
if(entity.getDesignType()==1) {
cwdEntity.setCustomerDesignPictures(1); cwdEntity.setCustomerDesignPictures(1);
cwdEntity.setCustomerDesignVideos(0); cwdEntity.setCustomerDesignVideos(0);
}else {
cwdEntity.setCustomerDesignPictures(0);
cwdEntity.setCustomerDesignVideos(1);
}
cwdEntity.setCreateTime(new Date()); cwdEntity.setCreateTime(new Date());
cwdEntity.setUpdateTime(new Date()); cwdEntity.setUpdateTime(new Date());
customerWorkDesignStatService.save(cwdEntity); customerWorkDesignStatService.save(cwdEntity);
...@@ -74,7 +78,11 @@ public class CustomerWorkDesignServiceImpl extends AbstractCRUDServiceImpl<Custo ...@@ -74,7 +78,11 @@ public class CustomerWorkDesignServiceImpl extends AbstractCRUDServiceImpl<Custo
CustomerWorkDesignStatEntity cwdEntity = cwdList.get(0); CustomerWorkDesignStatEntity cwdEntity = cwdList.get(0);
CustomerWorkDesignStatQuery updateEntity = new CustomerWorkDesignStatQuery(); CustomerWorkDesignStatQuery updateEntity = new CustomerWorkDesignStatQuery();
updateEntity.setId(cwdEntity.getId()); updateEntity.setId(cwdEntity.getId());
if(entity.getDesignType()==1) {
updateEntity.setCustomerDesignPicturesIncrement(1); updateEntity.setCustomerDesignPicturesIncrement(1);
}else {
updateEntity.setCustomerDesignVideosIncrement(1);
}
updateEntity.setUpdateTime(new Date()); updateEntity.setUpdateTime(new Date());
customerWorkDesignStatService.update(updateEntity); customerWorkDesignStatService.update(updateEntity);
} }
...@@ -135,6 +143,7 @@ public class CustomerWorkDesignServiceImpl extends AbstractCRUDServiceImpl<Custo ...@@ -135,6 +143,7 @@ public class CustomerWorkDesignServiceImpl extends AbstractCRUDServiceImpl<Custo
newMasterplate.setPreviewUrl(entity.getFrontCover()); newMasterplate.setPreviewUrl(entity.getFrontCover());
newMasterplate.setDraft(workDesign.getDraft()); newMasterplate.setDraft(workDesign.getDraft());
newMasterplate.setPlateType(entity.getPlateType()==null?1:entity.getPlateType()); newMasterplate.setPlateType(entity.getPlateType()==null?1:entity.getPlateType());
newMasterplate.setDesignType(workDesign.getDesignType());
newMasterplate.setCreateTime(new Date()); newMasterplate.setCreateTime(new Date());
designMasterplateService.save(newMasterplate,context); designMasterplateService.save(newMasterplate,context);
return 1; return 1;
...@@ -152,7 +161,8 @@ public class CustomerWorkDesignServiceImpl extends AbstractCRUDServiceImpl<Custo ...@@ -152,7 +161,8 @@ public class CustomerWorkDesignServiceImpl extends AbstractCRUDServiceImpl<Custo
@Override @Override
public int remove(Long[] ids, Context context) throws AppException { public int remove(Long[] ids, Context context) throws AppException {
this.removeBefore(ids, context); this.removeBefore(ids, context);
List<CustomerWorkDesignEntity> list = this.get(ids,context); List<Long> idList = new ArrayList<>(Arrays.asList(ids));
List<CustomerWorkDesignEntity> list = this.find(new CustomerWorkDesignQuery().idList(idList));
int iRet = this.dao.delete(ids); int iRet = this.dao.delete(ids);
if(CollectionUtils.isNotEmpty(list)){ if(CollectionUtils.isNotEmpty(list)){
list.forEach(e->{ list.forEach(e->{
......
package com.mortals.xhx.module.customer.web; package com.mortals.xhx.module.customer.web;
import com.mortals.framework.common.IBaseEnum;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.common.code.DesignTypeEnum;
import com.mortals.xhx.common.key.Constant; import com.mortals.xhx.common.key.Constant;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -43,6 +45,7 @@ public class CustomerWorkCollectController extends BaseCRUDJsonBodyMappingContro ...@@ -43,6 +45,7 @@ public class CustomerWorkCollectController extends BaseCRUDJsonBodyMappingContro
@Override @Override
protected void init(Map<String, Object> model, Context context) { protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "designType", IBaseEnum.getEnumMap(DesignTypeEnum.class));
super.init(model, context); super.init(model, context);
} }
......
...@@ -6,20 +6,24 @@ import com.mortals.framework.annotation.UnAuth; ...@@ -6,20 +6,24 @@ import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.IBaseEnum; import com.mortals.framework.common.IBaseEnum;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.framework.service.IUser;
import com.mortals.framework.util.DateUtils; import com.mortals.framework.util.DateUtils;
import com.mortals.framework.util.StringUtils; import com.mortals.framework.util.StringUtils;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.common.code.DesignTypeEnum;
import com.mortals.xhx.common.code.WorkDesignStatusEnum; import com.mortals.xhx.common.code.WorkDesignStatusEnum;
import com.mortals.xhx.common.key.Constant; import com.mortals.xhx.common.key.Constant;
import com.mortals.xhx.module.customer.model.CustomerWorkDesignEntity; import com.mortals.xhx.module.customer.model.CustomerWorkDesignEntity;
import com.mortals.xhx.module.customer.service.CustomerWorkDesignService; import com.mortals.xhx.module.customer.service.CustomerWorkDesignService;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.*; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* *
...@@ -39,6 +43,7 @@ public class CustomerWorkDesignController extends BaseCRUDJsonBodyMappingControl ...@@ -39,6 +43,7 @@ public class CustomerWorkDesignController extends BaseCRUDJsonBodyMappingControl
@Override @Override
protected void init(Map<String, Object> model, Context context) { protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "workDesignStatus", IBaseEnum.getEnumMap(WorkDesignStatusEnum.class)); this.addDict(model, "workDesignStatus", IBaseEnum.getEnumMap(WorkDesignStatusEnum.class));
this.addDict(model, "designType", IBaseEnum.getEnumMap(DesignTypeEnum.class));
super.init(model, context); super.init(model, context);
} }
...@@ -85,6 +90,7 @@ public class CustomerWorkDesignController extends BaseCRUDJsonBodyMappingControl ...@@ -85,6 +90,7 @@ public class CustomerWorkDesignController extends BaseCRUDJsonBodyMappingControl
throw new AppException("非法用户,不可访问"); throw new AppException("非法用户,不可访问");
} }
entity.setCustomerId(this.getCurUser().getId()); entity.setCustomerId(this.getCurUser().getId());
entity.setUpdateTime(entity.getCreateTime());
if(CollectionUtils.isNotEmpty(entity.getDesignContent())) { if(CollectionUtils.isNotEmpty(entity.getDesignContent())) {
entity.setDraft(JSONObject.toJSONString(entity.getDesignContent())); entity.setDraft(JSONObject.toJSONString(entity.getDesignContent()));
} }
......
package com.mortals.xhx.module.design.model; package com.mortals.xhx.module.design.model;
import java.util.List; import java.util.List;
import java.util.ArrayList; import java.util.ArrayList;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel; import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong; import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.design.model.vo.DesignMasterplateVo; import com.mortals.xhx.module.design.model.vo.DesignMasterplateVo;
import lombok.Data;
/** /**
* 模版管理实体对象 * 模版管理实体对象
* *
* @author zxfei * @author zxfei
* @date 2022-07-26 * @date 2023-07-11
*/ */
@Data
public class DesignMasterplateEntity extends DesignMasterplateVo { public class DesignMasterplateEntity extends DesignMasterplateVo {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -72,210 +72,10 @@ public class DesignMasterplateEntity extends DesignMasterplateVo { ...@@ -72,210 +72,10 @@ public class DesignMasterplateEntity extends DesignMasterplateVo {
* 版式。1:横版2竖版默认:1 * 版式。1:横版2竖版默认:1
*/ */
private Integer plateType; private Integer plateType;
public DesignMasterplateEntity(){}
/**
* 获取 模版名称
* @return String
*/
public String getMasterplateName(){
return masterplateName;
}
/**
* 设置 模版名称
* @param masterplateName
*/
public void setMasterplateName(String masterplateName){
this.masterplateName = masterplateName;
}
/**
* 获取 模版编码
* @return Integer
*/
public Integer getMasterplateCode(){
return masterplateCode;
}
/**
* 设置 模版编码
* @param masterplateCode
*/
public void setMasterplateCode(Integer masterplateCode){
this.masterplateCode = masterplateCode;
}
/**
* 获取 发布人
* @return Long
*/
public Long getCustomerId(){
return customerId;
}
/**
* 设置 发布人
* @param customerId
*/
public void setCustomerId(Long customerId){
this.customerId = customerId;
}
/**
* 获取 发布人名称
* @return String
*/
public String getCustomerName(){
return customerName;
}
/**
* 设置 发布人名称
* @param customerName
*/
public void setCustomerName(String customerName){
this.customerName = customerName;
}
/**
* 获取 模版描述
* @return String
*/
public String getMasterplateDesc(){
return masterplateDesc;
}
/**
* 设置 模版描述
* @param masterplateDesc
*/
public void setMasterplateDesc(String masterplateDesc){
this.masterplateDesc = masterplateDesc;
}
/**
* 获取 模版下载地址(相对地址)
* @return String
*/
public String getMasterplatePath(){
return masterplatePath;
}
/**
* 设置 模版下载地址(相对地址)
* @param masterplatePath
*/
public void setMasterplatePath(String masterplatePath){
this.masterplatePath = masterplatePath;
}
/**
* 获取 模版引用的图片
* @return String
*/
public String getPictureIds(){
return pictureIds;
}
/**
* 设置 模版引用的图片
* @param pictureIds
*/
public void setPictureIds(String pictureIds){
this.pictureIds = pictureIds;
}
/** /**
* 获取 模版引用的素材 * 作品类型:1:图片,2:视频
* @return String
*/ */
public String getPictureSrcIds(){ private Integer designType;
return pictureSrcIds;
}
/**
* 设置 模版引用的素材
* @param pictureSrcIds
*/
public void setPictureSrcIds(String pictureSrcIds){
this.pictureSrcIds = pictureSrcIds;
}
/**
* 获取 模版引用的背景
* @return String
*/
public String getPictureBackgroundIds(){
return pictureBackgroundIds;
}
/**
* 设置 模版引用的背景
* @param pictureBackgroundIds
*/
public void setPictureBackgroundIds(String pictureBackgroundIds){
this.pictureBackgroundIds = pictureBackgroundIds;
}
/**
* 获取 模版引用的字体
* @return String
*/
public String getFontIds(){
return fontIds;
}
/**
* 设置 模版引用的字体
* @param fontIds
*/
public void setFontIds(String fontIds){
this.fontIds = fontIds;
}
/**
* 获取 模版被引用的次数。默认:0
* @return Integer
*/
public Integer getMasterplateUseNum(){
return masterplateUseNum;
}
/**
* 设置 模版被引用的次数。默认:0
* @param masterplateUseNum
*/
public void setMasterplateUseNum(Integer masterplateUseNum){
this.masterplateUseNum = masterplateUseNum;
}
/**
* 获取 作品图片预览地址(相对地址)
* @return String
*/
public String getPreviewUrl(){
return previewUrl;
}
/**
* 设置 作品图片预览地址(相对地址)
* @param previewUrl
*/
public void setPreviewUrl(String previewUrl){
this.previewUrl = previewUrl;
}
/**
* 获取 设计草稿
* @return String
*/
public String getDraft(){
return draft;
}
/**
* 设置 设计草稿
* @param draft
*/
public void setDraft(String draft){
this.draft = draft;
}
/**
* 获取 版式。1:横版2竖版默认:1
* @return Integer
*/
public Integer getPlateType(){
return plateType;
}
/**
* 设置 版式。1:横版2竖版默认:1
* @param plateType
*/
public void setPlateType(Integer plateType){
this.plateType = plateType;
}
@Override @Override
public int hashCode() { public int hashCode() {
return this.getId().hashCode(); return this.getId().hashCode();
...@@ -292,32 +92,13 @@ public class DesignMasterplateEntity extends DesignMasterplateVo { ...@@ -292,32 +92,13 @@ public class DesignMasterplateEntity extends DesignMasterplateVo {
return false; return false;
} }
public String toString(){
StringBuilder sb = new StringBuilder("");
sb.append(",masterplateName:").append(getMasterplateName());
sb.append(",masterplateCode:").append(getMasterplateCode());
sb.append(",customerId:").append(getCustomerId());
sb.append(",customerName:").append(getCustomerName());
sb.append(",masterplateDesc:").append(getMasterplateDesc());
sb.append(",masterplatePath:").append(getMasterplatePath());
sb.append(",pictureIds:").append(getPictureIds());
sb.append(",pictureSrcIds:").append(getPictureSrcIds());
sb.append(",pictureBackgroundIds:").append(getPictureBackgroundIds());
sb.append(",fontIds:").append(getFontIds());
sb.append(",masterplateUseNum:").append(getMasterplateUseNum());
sb.append(",previewUrl:").append(getPreviewUrl());
sb.append(",draft:").append(getDraft());
sb.append(",plateType:").append(getPlateType());
return sb.toString();
}
public void initAttrValue(){ public void initAttrValue(){
this.masterplateName = ""; this.masterplateName = "";
this.masterplateCode = null; this.masterplateCode = -1;
this.customerId = null; this.customerId = -1L;
this.customerName = ""; this.customerName = "";
...@@ -333,12 +114,14 @@ public class DesignMasterplateEntity extends DesignMasterplateVo { ...@@ -333,12 +114,14 @@ public class DesignMasterplateEntity extends DesignMasterplateVo {
this.fontIds = ""; this.fontIds = "";
this.masterplateUseNum = null; this.masterplateUseNum = -1;
this.previewUrl = ""; this.previewUrl = "";
this.draft = ""; this.draft = "";
this.plateType = null; this.plateType = -1;
this.designType = 1;
} }
} }
\ No newline at end of file
package com.mortals.xhx.module.design.web; package com.mortals.xhx.module.design.web;
import com.mortals.framework.common.IBaseEnum;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService; import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.DesignTypeEnum;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -45,6 +47,7 @@ public class DesignMasterplateController extends BaseCRUDJsonBodyMappingControll ...@@ -45,6 +47,7 @@ public class DesignMasterplateController extends BaseCRUDJsonBodyMappingControll
@Override @Override
protected void init(Map<String, Object> model, Context context) { protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "designType", IBaseEnum.getEnumMap(DesignTypeEnum.class));
super.init(model, context); super.init(model, context);
} }
......
...@@ -52,8 +52,13 @@ public class PictureGroupController extends BaseCRUDJsonBodyMappingController<Pa ...@@ -52,8 +52,13 @@ public class PictureGroupController extends BaseCRUDJsonBodyMappingController<Pa
if(paramEntities.isEmpty()){ if(paramEntities.isEmpty()){
max = 1; max = 1;
}else { }else {
ParamEntity maxEntity = paramEntities.stream().max(Comparator.comparing(ParamEntity::getParamKey)).get(); for(ParamEntity item:paramEntities){
max = DataUtil.converStr2Int(maxEntity.getParamKey(),paramEntities.size())+1; int temp = DataUtil.converStr2Int(item.getParamKey(),0);
if(max < temp){
max = temp;
}
}
max++;
} }
entity.setParamKey(max+""); entity.setParamKey(max+"");
entity.setName("素材分组"); entity.setName("素材分组");
......
package com.mortals.xhx.module.thirdlog.wechat;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.RandomUtil;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.ICacheService;
import com.mortals.framework.util.DateUtils;
import com.mortals.framework.web.BaseJsonBodyController;
import com.mortals.xhx.common.utils.StringUtils;
import com.mortals.xhx.module.customer.model.CustomerEntity;
import com.mortals.xhx.module.customer.service.CustomerService;
import com.mortals.xhx.module.thirdlog.sms.pdu.SMSLoginPdu;
import com.mortals.xhx.module.thirdlog.wechat.utils.WeChatUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.Map;
/**
* 微信扫码登录
*/
@RestController
@RequestMapping("wechat")
public class WeChatLoginController extends BaseJsonBodyController {
@Autowired
private CustomerService customerService;
@Autowired
private ICacheService cacheService;
private static String WX_VERIFY_CODE_KEY ="login:wx:verify:";
/**
* 微信appId
*/
@Value("${WeChat.pc.appID:wx55400ca31cbbe7fb}")
private String APP_ID;
/**
* 微信appSecret
*/
@Value("${WeChat.pc.appSecret:22555d29a9f914bac0400af5cf63d6b3}")
private String APP_SECRET;
@RequestMapping(
value = {"getLoginSoleCode"},
method = {RequestMethod.POST, RequestMethod.GET}
)
@UnAuth
public Rest<Object> sendSmsVerifyCode(){
Rest<Object> ret = new Rest();
Map<String, Object> model = new HashMap();
String busiDesc = "获取微信登录验证码";
int code=1;
try {
String vCode = RandomUtil.randomNumbers(11);
cacheService.setnx(WX_VERIFY_CODE_KEY+vCode,vCode,90);
model.put("data",vCode);
model.put("message_info", busiDesc + "成功");
} catch (Exception var9) {
code = -1;
this.doException(this.request, busiDesc, model, var9);
}
ret.setCode(code);
ret.setData(model.get("data"));
ret.setMsg(model.get("message_info") == null ? "" : model.remove("message_info").toString());
return ret;
}
@RequestMapping(
value = {"wxLoginOAuth"},
method = {RequestMethod.POST, RequestMethod.GET}
)
@UnAuth
public String wxLoginOAuth(HttpServletRequest request, HttpServletResponse response){
JSONObject ret = new JSONObject();
Map<String, Object> data = new HashMap<>();
try {
// 第三方发起微信授权登录请求,微信用户允许授权第三方应用后,微信会拉起应用或重定向到第三方网站,并且带上授权临时票据code参数;
String loginCode = request.getParameter("code");
//前端扫码登入传来的时间戳
String loginState = request.getParameter("state");
//用户拒绝授权时code为空,微信也不会请求该接口。为了防止非法请求,若code为空则返回
if (StringUtils.isEmpty(loginCode)) {
throw new AppException("登入请求被拒绝");
}
if (StringUtils.isEmpty(loginState)) {
throw new AppException("请求状态异常");
}
String vCode = cacheService.get(WX_VERIFY_CODE_KEY + loginState);
if (StringUtils.isEmpty(vCode)){
throw new AppException("微信登录验证码失效");
}
Map<String,String> accessTokenMap = WeChatUtils.getAccessToken(loginCode,APP_ID,APP_SECRET);
String access_token = accessTokenMap.get("access_token");//接口调用凭证,登录后右上角展示数据需要该值去获取
String openid = accessTokenMap.get("openid");//授权用户唯一标识
String ip = super.getRequestIP(request);
CustomerEntity customerEntity = customerService.doWeChatLogin(openid,ip);
customerEntity.setLastLoginAddress(ip);
customerEntity.setLoginTime(System.currentTimeMillis());
customerEntity.setToken(IdUtil.fastSimpleUUID());
customerEntity.setExpireTime(DateUtils.addCurrDate(7).getTime());
String token = authTokenService.createToken(customerEntity);
data.put("token", token);
data.put("customer", customerEntity);
recordSysLog(request, customerEntity, "客户扫码登录系统成功!");
ret.put(KEY_RESULT_DATA, data);
ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
ret.put(KEY_RESULT_MSG, "用户登录系统成功!");
return ret.toJSONString();
} catch (Exception e) {
log.error("login error ", e);
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
ret.put(KEY_RESULT_MSG, super.convertException(e));
return ret.toJSONString();
}
}
@RequestMapping(
value = {"bind"},
method = {RequestMethod.POST, RequestMethod.GET}
)
@UnAuth
public String bind(HttpServletRequest request, HttpServletResponse response){
JSONObject ret = new JSONObject();
Map<String, Object> data = new HashMap<>();
try {
// 第三方发起微信授权登录请求,微信用户允许授权第三方应用后,微信会拉起应用或重定向到第三方网站,并且带上授权临时票据code参数;
String loginCode = request.getParameter("code");
//前端扫码登入传来的时间戳
String loginState = request.getParameter("state");
//用户拒绝授权时code为空,微信也不会请求该接口。为了防止非法请求,若code为空则返回
if (StringUtils.isEmpty(loginCode)) {
throw new AppException("登入请求被拒绝");
}
if (StringUtils.isEmpty(loginState)) {
throw new AppException("请求状态异常");
}
String vCode = cacheService.get(WX_VERIFY_CODE_KEY + loginState);
if (StringUtils.isEmpty(vCode)){
throw new AppException("微信登录验证码失效");
}
Map<String,String> accessTokenMap = WeChatUtils.getAccessToken(loginCode,APP_ID,APP_SECRET);
String access_token = accessTokenMap.get("access_token");//接口调用凭证,登录后右上角展示数据需要该值去获取
String openid = accessTokenMap.get("openid");//授权用户唯一标识
data.put("openId", openid);
ret.put(KEY_RESULT_DATA, data);
ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
ret.put(KEY_RESULT_MSG, "微信扫码成功!");
return ret.toJSONString();
} catch (Exception e) {
log.error("bind error ", e);
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
ret.put(KEY_RESULT_MSG, super.convertException(e));
return ret.toJSONString();
}
}
}
package com.mortals.xhx.module.thirdlog.wechat.utils;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.List;
import java.util.Map;
/**
* description: json工具类 <br>
* version: 1.0 <br>
* @date: 2019/7/20 0019 上午 10:17 <br>
* @author: William <br>
*/
public class JsonUtils {
public static final ObjectMapper MAPPER = new ObjectMapper();
private static final Logger logger = LoggerFactory.getLogger(JsonUtils.class);
public static String serialize(Object obj) {
if (obj == null) {
return null;
}
if (obj.getClass() == String.class) {
return (String) obj;
}
try {
return MAPPER.writeValueAsString(obj);
} catch (JsonProcessingException e) {
logger.error("json序列化出错:" + obj, e);
return null;
}
}
public static <T> T parse(String json, Class<T> tClass) {
try {
return MAPPER.readValue(json, tClass);
} catch (IOException e) {
logger.error("json解析出错:" + json, e);
return null;
}
}
public static <E> List<E> parseList(String json, Class<E> eClass) {
try {
return MAPPER.readValue(json, MAPPER.getTypeFactory().constructCollectionType(List.class, eClass));
} catch (IOException e) {
logger.error("json解析出错:" + json, e);
return null;
}
}
public static <K, V> Map<K, V> parseMap(String json, Class<K> kClass, Class<V> vClass) {
try {
return MAPPER.readValue(json, MAPPER.getTypeFactory().constructMapType(Map.class, kClass, vClass));
} catch (IOException e) {
logger.error("json解析出错:" + json, e);
return null;
}
}
public static <T> T nativeRead(String json, TypeReference<T> type) {
try {
return MAPPER.readValue(json, type);
} catch (IOException e) {
logger.error("json解析出错:" + json, e);
return null;
}
}
}
package com.mortals.xhx.module.thirdlog.wechat.utils;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpUtil;
import org.springframework.beans.factory.annotation.Value;
import java.util.Map;
/**
* description: WeChatUtils 微信获取用户工具类<br>
*
* @date: 2021/8/19 0019 上午 10:05 <br>
* @author: William <br>
* version: 1.0 <br>
*/
public class WeChatUtils {
/**
* 获取微信accessToken路径
*/
private static final String GET_ACCESS_TOKEN_URL = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_code";
/**
* 微信appId
*/
@Value("${WeChat.pc.appID:wx55400ca31cbbe7fb}")
private static String APP_ID;
/**
* 微信appSecret
*/
@Value("${WeChat.pc.appSecret:22555d29a9f914bac0400af5cf63d6b3}")
private static String APP_SECRET;
/**
* description: getAccessToken 根据code获取accessToken<br>
* version: 1.0 <br>
* @date: 2021/8/19 0019 上午 10:10 <br>
* @author: William <br>
* @param code 微信用户授权code
* @return java.util.Map<java.lang.String,java.lang.String>
*/
public static Map<String,String> getAccessToken(String code){
return getAccessToken(code,APP_ID,APP_SECRET);
}
/**
* description: getAccessToken 根据code获取微信用户信息,返回map如果正确map包含access_token ,如果错误则包含:errcode<br>
* version: 1.0 <br>
* @date: 2021/8/19 0019 上午 10:11 <br>
* @author: William <br>
* @param code 微信授权code
* @param appId 微信appId
* @param appSecret 微信appSecret
* @return java.util.Map<java.lang.String,java.lang.String>
*/
public static Map<String,String> getAccessToken(String code,String appId,String appSecret){
//判断所有字段不能为空
if(isAnyBlank(code,appId,appSecret)){
throw new IllegalArgumentException("参数错误");
}
String requestUrl = GET_ACCESS_TOKEN_URL.replace("APPID",appId)
.replace("SECRET",appSecret).replace("CODE",code);
String result = HttpUtil.get(requestUrl);
return JsonUtils.parseMap(result, String.class, String.class);
}
/**
* description: isAnyBlank 判断是否存在空字符串,Hutool未编写<br>
* version: 1.0 <br>
* @date: 2021/8/19 0019 上午 10:25 <br>
* @author: William <br>
* @param strs 字符串
* @return java.lang.Boolean
*/
public static Boolean isAnyBlank(CharSequence... strs){
//如果为空直接返回true
if (ArrayUtil.isEmpty(strs)) {
return true;
}
for (CharSequence str : strs) {
if (StrUtil.isBlank(str)) {
return true;
}
}
return false;
}
}
server: server:
port: @profiles.server.port@
servlet:
context-path: /eas
tomcat: tomcat:
uri-encoding: utf-8 uri-encoding: utf-8
spring: spring:
application: application:
name: @project.artifactId@ name: eas-manager
profiles: profiles:
active: @profiles.active@ active: @profiles.active@
servlet: servlet:
...@@ -13,19 +16,29 @@ spring: ...@@ -13,19 +16,29 @@ spring:
jackson: jackson:
date-format: yyyy-MM-dd HH:mm:ss date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8 time-zone: GMT+8
security:
cloud: enable: true
nacos: user:
# Nacos 作为注册中心的配置项,对应 NacosDiscoveryProperties 配置类 name: admin
discovery: password: 1
server-addr: @profiles.nacos.server-addr@ # Nacos 服务器地址 redis:
group: @profiles.nacos.group@ host: @profiles.redis.uri@
namespace: @profiles.nacos.namespace@ port: @profiles.redis.port@
config: username: @profiles.redis.username@
server-addr: ${spring.cloud.nacos.discovery.server-addr} # Nacos 服务器地址 password: @profiles.redis.password@
group: ${spring.cloud.nacos.discovery.group} database: @profiles.redis.database@
namespace: ${spring.cloud.nacos.discovery.namespace} # Nacos 命名空间 dev 的编号 timeout: 30000
file-extension: yaml pool:
max-idle: 30
min-idle: 0
max-active: 100
max-wait: 1000
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
url: @profiles.datasource.uri@
username: @profiles.datasource.username@
password: @profiles.datasource.password@
mybatis: mybatis:
root-path: com.mortals root-path: com.mortals
type-aliases-package: com.mortals.framework.model,com.mortals.xhx.common.**.model,com.mortals.xhx.**.model type-aliases-package: com.mortals.framework.model,com.mortals.xhx.common.**.model,com.mortals.xhx.**.model
...@@ -38,5 +51,16 @@ application: ...@@ -38,5 +51,16 @@ application:
uncheckUrl: /refresh,/error,/login/login,/login/index,/login/logout,/customer/login/login,/customer/login/logout,/securitycode/createCode,/customer/trial/save,/file/common/*,/file/preview/*,/test*,/api/asset/*,/api/*,/zwfw/*,/ws/*,/swagger-ui*,/topic/*,/uploads/* uncheckUrl: /refresh,/error,/login/login,/login/index,/login/logout,/customer/login/login,/customer/login/logout,/securitycode/createCode,/customer/trial/save,/file/common/*,/file/preview/*,/test*,/api/asset/*,/api/*,/zwfw/*,/ws/*,/swagger-ui*,/topic/*,/uploads/*
workflow: workflow:
tenantId: ${spring.application.name} tenantId: ${spring.application.name}
cookie:
ssoServerUrl: http://sso.testnew.com
key: 026db82420614469897fcc2dc1b4ce38
domain: base.testnew.com
port: 111
token: token:
head: mortal head: mortal
upload:
path: @profiles.filepath@
WeChat:
pc:
appID: wx55400ca31cbbe7fb
appSecret: 22555d29a9f914bac0400af5cf63d6b3
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<setting name="useGeneratedKeys" value="false" /> <setting name="useGeneratedKeys" value="false" />
<setting name="defaultExecutorType" value="REUSE" /> <setting name="defaultExecutorType" value="REUSE" />
<!-- 是否开始sql日志控制台打印 --> <!-- 是否开始sql日志控制台打印 -->
<setting name="logImpl" value="STDOUT_LOGGING" /> <!-- <setting name="logImpl" value="STDOUT_LOGGING" />-->
</settings> </settings>
<plugins> <plugins>
<plugin interceptor="com.mortals.framework.thirty.mybatis.MortalsPagePlugin"> <plugin interceptor="com.mortals.framework.thirty.mybatis.MortalsPagePlugin">
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
<result property="updateTime" column="updateTime" /> <result property="updateTime" column="updateTime" />
<result property="lastLoginTime" column="lastLoginTime" /> <result property="lastLoginTime" column="lastLoginTime" />
<result property="lastLoginAddress" column="lastLoginAddress" /> <result property="lastLoginAddress" column="lastLoginAddress" />
<result property="openId" column="openId" />
<result property="customerDesignPictures" column="customerDesignPictures" /> <result property="customerDesignPictures" column="customerDesignPictures" />
<result property="customerDesignVideos" column="customerDesignVideos" /> <result property="customerDesignVideos" column="customerDesignVideos" />
</resultMap> </resultMap>
......
...@@ -50,14 +50,14 @@ ...@@ -50,14 +50,14 @@
</dependency> </dependency>
<!-- 引入 Spring Cloud Alibaba Nacos Config 相关依赖,将 Nacos 作为配置中心,并实现对其的自动配置 --> <!-- 引入 Spring Cloud Alibaba Nacos Config 相关依赖,将 Nacos 作为配置中心,并实现对其的自动配置 -->
<dependency> <!-- <dependency>-->
<groupId>com.alibaba.cloud</groupId> <!-- <groupId>com.alibaba.cloud</groupId>-->
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> <!-- <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>-->
</dependency> <!-- </dependency>-->
<dependency> <!-- <dependency>-->
<groupId>com.alibaba.cloud</groupId> <!-- <groupId>com.alibaba.cloud</groupId>-->
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> <!-- <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>-->
</dependency> <!-- </dependency>-->
</dependencies> </dependencies>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment