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

增加前台登录接口,前台查询作品接口

parent fa057b85
...@@ -1443,7 +1443,7 @@ msg|String|消息|- ...@@ -1443,7 +1443,7 @@ msg|String|消息|-
``` ```
## 客户作品信息 ## 客户作品信息
### 查询客户作品信息列表 ### 客户查询自己作品信息列表
**请求URL:** customer/work/design/list **请求URL:** customer/work/design/list
...@@ -1482,9 +1482,15 @@ data|object|数据对象 ...@@ -1482,9 +1482,15 @@ data|object|数据对象
 data|array|结果集列表|数组  data|array|结果集列表|数组
  id|Long|主键ID,主键,自增长   id|Long|主键ID,主键,自增长
  customerId|Long|客户ID   customerId|Long|客户ID
  createTime|Date|收藏时间   createTime|Date|创建时间
  masterplateId|Long|模版ID   workDesignName|String|作品名称
dict|object|字典对象   workDesignStatus|Integer|作品状态:0:草稿,1:发布
  workDesignDesc|String|作品描述
  updateTime|Date|更新时间
  pictureIds|String|模版引用的图片
  pictureSrcIds|String|模版引用的素材
  pictureBackgroundIds|String|模版引用的背景
  fontIds|String|作品引用的字体
**响应消息样例:** **响应消息样例:**
``` ```
...@@ -1495,6 +1501,86 @@ dict|object|字典对象 ...@@ -1495,6 +1501,86 @@ dict|object|字典对象
} }
``` ```
### 管理查询客户作品信息列表
**请求URL:** customer/work/design/picture/list
**请求方式:** POST
**内容类型:** application/json;charset=utf-8
**简要描述:** 查询客户作品信息
**请求参数:**
参数名称|类型|必填|描述
:---|:---|:---|:------
customerId|Long|是|客户id
**请求样例:**
```
{
"customerId":1
}
```
**响应参数:**
参数名称|参数类型|描述
:---|:---|:------
code|Integer|结果码(-1.失败,1.成功)
msg|String|消息
data|object|数据对象
 per_page|Integer|每页条数
 total|Integer|总条数
 last_page|Integer|总页数
 current_page|Integer|当前页
 data|array|结果集列表|数组
  id|Long|主键ID,主键,自增长
  customerId|Long|客户ID
  createTime|Date|创建时间
  workDesignName|String|作品名称
  workDesignStatus|Integer|作品状态:0:草稿,1:发布
  workDesignDesc|String|作品描述
  updateTime|Date|更新时间
  pictureIds|String|模版引用的图片
  pictureSrcIds|String|模版引用的素材
  pictureBackgroundIds|String|模版引用的背景
  fontIds|String|作品引用的字体
**响应消息样例:**
```
{
"code": 1,
"data": {
"data": [
{
"createTime": 1655447457000,
"createTimeStr": "2022-06-17 14:30:57",
"customerId": 1,
"deleted": 0,
"fontIds": "1",
"id": 1,
"pictureBackgroundIds": "1",
"pictureIds": "1",
"pictureSrcIds": "1",
"updateTime": 1655447477000,
"updateTimeStr": "2022-06-17 14:31:17",
"workDesignDesc": "随便写",
"workDesignName": "测试",
"workDesignStatus": 1
}
]
},
"dict": {
"workDesignStatus": {
"1": "草稿",
"2": "发布"
}
}
}
```
### 查看客户作品信息 ### 查看客户作品信息
**请求URL:** customer/work/design/info **请求URL:** customer/work/design/info
...@@ -1524,8 +1610,15 @@ msg|String|消息 ...@@ -1524,8 +1610,15 @@ msg|String|消息
data|object|数据对象 data|object|数据对象
 id|Long|主键ID,主键,自增长  id|Long|主键ID,主键,自增长
 customerId|Long|客户ID  customerId|Long|客户ID
 createTime|Date|收藏时间  createTime|Date|创建时间
 masterplateId|Long|模版ID  workDesignName|String|作品名称
 workDesignStatus|Integer|作品状态:0:草稿,1:发布
 workDesignDesc|String|作品描述
 updateTime|Date|更新时间
 pictureIds|String|模版引用的图片
 pictureSrcIds|String|模版引用的素材
 pictureBackgroundIds|String|模版引用的背景
 fontIds|String|作品引用的字体
dict|object|字典对象 dict|object|字典对象
**响应消息样例:** **响应消息样例:**
...@@ -1533,10 +1626,17 @@ dict|object|字典对象 ...@@ -1533,10 +1626,17 @@ dict|object|字典对象
{ {
"code": 1, "code": 1,
"data": { "data": {
"id":2739, "id":9033,
"customerId":7423, "customerId":9079,
"createTime":"2022-06-07", "createTime":"2022-06-15",
"masterplateId":4628 "workDesignName":"wxj0ji",
"workDesignStatus":4279,
"workDesignDesc":"yxwojz",
"updateTime":"2022-06-15",
"pictureIds":"4cqqam",
"pictureSrcIds":"jwtdgo",
"pictureBackgroundIds":"ndmkiz",
"fontIds":"3m5zxj"
} }
} }
``` ```
...@@ -1556,13 +1656,25 @@ dict|object|字典对象 ...@@ -1556,13 +1656,25 @@ dict|object|字典对象
参数名称|类型|必填|描述 参数名称|类型|必填|描述
:---|:---|:---|:------- :---|:---|:---|:-------
customerId|Long|是|客户ID customerId|Long|是|客户ID
masterplateId|Long|是|模版ID workDesignName|String|是|作品名称
workDesignStatus|Integer|是|作品状态:0:草稿,1:发布
workDesignDesc|String|是|作品描述
pictureIds|String|是|模版引用的图片
pictureSrcIds|String|是|模版引用的素材
pictureBackgroundIds|String|是|模版引用的背景
fontIds|String|是|作品引用的字体
**请求样例:** **请求样例:**
``` ```
{ {
"customerId":2890, "customerId":6797,
"masterplateId":6167 "workDesignName":"c42lp8",
"workDesignStatus":3570,
"workDesignDesc":"g3odxd",
"pictureIds":"3fd0o6",
"pictureSrcIds":"ykn50w",
"pictureBackgroundIds":"ad0eh7",
"fontIds":"f3bacv"
} }
``` ```
...@@ -1577,8 +1689,15 @@ data|object|数据对象 ...@@ -1577,8 +1689,15 @@ data|object|数据对象
 entity|object|保存更新实体  entity|object|保存更新实体
  id|Long|主键ID,主键,自增长   id|Long|主键ID,主键,自增长
  customerId|Long|客户ID   customerId|Long|客户ID
  createTime|Date|收藏时间   createTime|Date|创建时间
  masterplateId|Long|模版ID   workDesignName|String|作品名称
  workDesignStatus|Integer|作品状态:0:草稿,1:发布
  workDesignDesc|String|作品描述
  updateTime|Date|更新时间
  pictureIds|String|模版引用的图片
  pictureSrcIds|String|模版引用的素材
  pictureBackgroundIds|String|模版引用的背景
  fontIds|String|作品引用的字体
**响应消息样例:** **响应消息样例:**
``` ```
......
...@@ -7,6 +7,7 @@ import com.mortals.framework.util.AESUtil; ...@@ -7,6 +7,7 @@ import com.mortals.framework.util.AESUtil;
import com.mortals.framework.utils.ServletUtils; import com.mortals.framework.utils.ServletUtils;
import com.mortals.framework.web.interceptor.BaseInterceptor; import com.mortals.framework.web.interceptor.BaseInterceptor;
import com.mortals.xhx.base.framework.config.InterceptorConfig; import com.mortals.xhx.base.framework.config.InterceptorConfig;
import com.mortals.xhx.common.key.Constant;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -51,7 +52,7 @@ public class AuthUserInterceptor extends BaseInterceptor { ...@@ -51,7 +52,7 @@ public class AuthUserInterceptor extends BaseInterceptor {
ret.put("msg", "用户未登录或登录失效,请重新登录"); ret.put("msg", "用户未登录或登录失效,请重新登录");
ServletUtils.renderString(response, JSONObject.toJSONString(ret)); ServletUtils.renderString(response, JSONObject.toJSONString(ret));
return false; return false;
}else if(loginUser.isAdmin()||loginUser.getUserType()==1){ }else if(loginUser.isAdmin()||loginUser.getUserType()==1||loginUser.getUserType()== Constant.CUSTOMER_USER){
return super.preHandle(request, response, handler); return super.preHandle(request, response, handler);
} else { } else {
ret.put("code", -1); ret.put("code", -1);
......
package com.mortals.xhx.base.login.web;
import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.service.IAuthTokenService;
import com.mortals.framework.util.DateUtils;
import com.mortals.framework.util.StringUtils;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.module.customer.model.CustomerEntity;
import com.mortals.xhx.module.customer.service.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
@RestController
@RequestMapping("customer/login")
public class CustomerLoginController extends BaseCRUDJsonBodyMappingController<CustomerService, CustomerEntity, Long> {
@Autowired
private CustomerService customerService;
@Autowired
private IAuthTokenService authTokenService;
@RequestMapping("login")
public String login(@RequestBody LoginForm loginForm) throws Exception {
JSONObject ret = new JSONObject();
Map<String, Object> data = new HashMap<>();
String loginName = loginForm.getLoginName();
String password = loginForm.getPassword();
String ip = super.getRequestIP(request);
if (StringUtils.isEmpty(loginName) || StringUtils.isEmpty(password)) {
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
ret.put(KEY_RESULT_MSG, "未获取到用户信息,请重新登录");
return ret.toJSONString();
}
CustomerEntity customerEntity = null;
try {
loginForm.validate();
customerEntity = customerService.doLogin(loginName, password, 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("logout")
public void logout() throws Exception {
recordSysLog(request, "退出登录");
super.removeCurrUser(request);
}
}
package com.mortals.xhx.base.login.web; package com.mortals.xhx.base.login.web;
import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.ap.GlobalSysInfo; import com.mortals.framework.ap.GlobalSysInfo;
import com.mortals.framework.ap.SysConstains; import com.mortals.framework.ap.SysConstains;
...@@ -77,7 +78,8 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi ...@@ -77,7 +78,8 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi
if (currUserName == null || currUserName.trim().length() == 0) { if (currUserName == null || currUserName.trim().length() == 0) {
currUserName = "管理员"; currUserName = "管理员";
} }
userEntity.setLoginTime(System.currentTimeMillis());
userEntity.setToken(IdUtil.fastSimpleUUID());
userEntity.setExpireTime(DateUtils.addCurrDate(7).getTime()); userEntity.setExpireTime(DateUtils.addCurrDate(7).getTime());
String token = authTokenService.createToken(userEntity); String token = authTokenService.createToken(userEntity);
JSONObject data = new JSONObject(); JSONObject data = new JSONObject();
......
...@@ -307,25 +307,6 @@ public class UserEntity extends UserEntityExt implements IUser { ...@@ -307,25 +307,6 @@ public class UserEntity extends UserEntityExt implements IUser {
return this.userType; return this.userType;
} }
@Override
public String getToken() {
return null;
}
@Override
public Long getLoginTime() {
return null;
}
@Override
public Long getExpireTime() {
return null;
}
@Override
public void setExpireTime(Long expireTime) {
}
@Override @Override
public String getMenuUrl() { public String getMenuUrl() {
......
package com.mortals.xhx.base.system.user.model; package com.mortals.xhx.base.system.user.model;
import com.alibaba.fastjson.annotation.JSONField;
import com.mortals.framework.model.BaseEntityLong; import com.mortals.framework.model.BaseEntityLong;
import lombok.Data; import lombok.Data;
...@@ -12,6 +13,22 @@ import java.util.List; ...@@ -12,6 +13,22 @@ import java.util.List;
*/ */
@Data @Data
public class UserEntityExt extends BaseEntityLong { public class UserEntityExt extends BaseEntityLong {
/**
* 唯一标识
*/
@JSONField(serialize = false)
private String token;
/**
* 登录时间
*/
private Long loginTime;
/**
* 过期时间
*/
private Long expireTime;
private String siteName; private String siteName;
private List<Long> roleIds; private List<Long> roleIds;
private String siteCode; private String siteCode;
......
...@@ -30,4 +30,7 @@ public final class Constant { ...@@ -30,4 +30,7 @@ public final class Constant {
public final static String Param_sealWay = "sealWay"; public final static String Param_sealWay = "sealWay";
public final static String Param_typeOptions = "typeOptions"; public final static String Param_typeOptions = "typeOptions";
/** 登录用户类型为客户 */
public final static int CUSTOMER_USER = 99;
} }
...@@ -8,6 +8,8 @@ import com.alibaba.fastjson.annotation.JSONField; ...@@ -8,6 +8,8 @@ import com.alibaba.fastjson.annotation.JSONField;
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.framework.service.IUser;
import com.mortals.xhx.common.key.Constant;
import com.mortals.xhx.module.customer.model.vo.CustomerVo; import com.mortals.xhx.module.customer.model.vo.CustomerVo;
/** /**
* 客户管理实体对象 * 客户管理实体对象
...@@ -16,7 +18,7 @@ import com.mortals.xhx.module.customer.model.vo.CustomerVo; ...@@ -16,7 +18,7 @@ import com.mortals.xhx.module.customer.model.vo.CustomerVo;
* @date 2022-06-13 * @date 2022-06-13
*/ */
public class CustomerEntity extends CustomerVo { public class CustomerEntity extends CustomerVo implements IUser {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
...@@ -88,6 +90,7 @@ public class CustomerEntity extends CustomerVo { ...@@ -88,6 +90,7 @@ public class CustomerEntity extends CustomerVo {
* 获取 用户登录账号 * 获取 用户登录账号
* @return String * @return String
*/ */
@Override
public String getLoginName(){ public String getLoginName(){
return loginName; return loginName;
} }
...@@ -366,4 +369,67 @@ public class CustomerEntity extends CustomerVo { ...@@ -366,4 +369,67 @@ public class CustomerEntity extends CustomerVo {
this.lastLoginAddress = ""; this.lastLoginAddress = "";
} }
@Override
public Long getDeptId() {
return null;
}
@Override
public String getDeptName() {
return null;
}
@Override
public Long getCustomerId() {
return null;
}
@Override
public String getSiteIds() {
return null;
}
@Override
public Long getCustomerJoinId() {
return null;
}
@Override
public String getCustomerNum() {
return null;
}
@Override
public String getRealName() {
return this.custName;
}
@Override
public boolean isAdmin() {
return false;
}
@Override
public boolean isSystemUser() {
return false;
}
@Override
public boolean isManager() {
return false;
}
@Override
public Integer getUserType() {
return Constant.CUSTOMER_USER;
}
@Override
public String getMenuUrl() {
return null;
}
} }
\ No newline at end of file
package com.mortals.xhx.module.customer.model.vo; package com.mortals.xhx.module.customer.model.vo;
import com.alibaba.fastjson.annotation.JSONField;
import com.mortals.framework.model.BaseEntityLong; import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.customer.model.CustomerEntity; import com.mortals.xhx.module.customer.model.CustomerEntity;
import lombok.Data; import lombok.Data;
...@@ -14,6 +15,22 @@ import java.util.List; ...@@ -14,6 +15,22 @@ import java.util.List;
@Data @Data
public class CustomerVo extends BaseEntityLong { public class CustomerVo extends BaseEntityLong {
/**
* 唯一标识
*/
@JSONField(serialize = false)
private String token;
/**
* 登录时间
*/
private Long loginTime;
/**
* 过期时间
*/
private Long expireTime;
/** 查询条件 */ /** 查询条件 */
private String query; private String query;
/** 站点编码 */ /** 站点编码 */
......
...@@ -16,4 +16,5 @@ import java.util.List; ...@@ -16,4 +16,5 @@ import java.util.List;
public class CustomerWorkDesignVo extends BaseEntityLong { public class CustomerWorkDesignVo extends BaseEntityLong {
private String createTimeStr; private String createTimeStr;
private String updateTimeStr;
} }
\ No newline at end of file
...@@ -20,4 +20,14 @@ public interface CustomerService extends ICRUDService<CustomerEntity,Long>{ ...@@ -20,4 +20,14 @@ public interface CustomerService extends ICRUDService<CustomerEntity,Long>{
Result<CustomerEntityExt> findExt(CustomerEntity params, PageInfo pageInfo, Context context) throws AppException; Result<CustomerEntityExt> findExt(CustomerEntity params, PageInfo pageInfo, Context context) throws AppException;
/**
* 客户登录
* @param loginName
* @param password
* @param loginIp
* @return
* @throws AppException
*/
CustomerEntity doLogin(String loginName, String password, String loginIp) throws AppException;
} }
\ No newline at end of file
...@@ -4,6 +4,7 @@ import com.mortals.framework.model.Context; ...@@ -4,6 +4,7 @@ import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo; import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result; import com.mortals.framework.model.Result;
import com.mortals.framework.util.DateUtils; import com.mortals.framework.util.DateUtils;
import com.mortals.framework.util.SecurityUtil;
import com.mortals.framework.util.StringUtils; import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.module.customer.model.CustomerEntityExt; import com.mortals.xhx.module.customer.model.CustomerEntityExt;
import com.mortals.xhx.module.customer.model.CustomerQuery; import com.mortals.xhx.module.customer.model.CustomerQuery;
...@@ -28,6 +29,20 @@ import java.util.List; ...@@ -28,6 +29,20 @@ import java.util.List;
@Service("customerService") @Service("customerService")
public class CustomerServiceImpl extends AbstractCRUDServiceImpl<CustomerDao, CustomerEntity, Long> implements CustomerService { public class CustomerServiceImpl extends AbstractCRUDServiceImpl<CustomerDao, CustomerEntity, Long> implements CustomerService {
@Override
protected void saveBefore(CustomerEntity entity, Context context) throws AppException {
this.validData(entity, context);
if (StringUtils.isNotEmpty(entity.getPassword())) {
try {
entity.setPassword(SecurityUtil.md5DoubleEncoding(entity.getPassword()));
} catch (Exception e) {
throw new AppException("密码转换异常");
}
} else {
entity.setPassword(null);
}
}
@Override @Override
protected CustomerEntity findBefore(CustomerEntity entity, PageInfo pageInfo, Context context) throws AppException { protected CustomerEntity findBefore(CustomerEntity entity, PageInfo pageInfo, Context context) throws AppException {
CustomerQuery query = new CustomerQuery(); CustomerQuery query = new CustomerQuery();
...@@ -62,4 +77,27 @@ public class CustomerServiceImpl extends AbstractCRUDServiceImpl<CustomerDao, Cu ...@@ -62,4 +77,27 @@ public class CustomerServiceImpl extends AbstractCRUDServiceImpl<CustomerDao, Cu
} }
return result; return result;
} }
@Override
public CustomerEntity doLogin(String loginName, String password, String loginIp) throws AppException {
CustomerEntity user = this.findByLoginName(loginName);
if (user == null || !user.getLoginName().equals(loginName)) {
throw new AppException("用户名不存在!");
}
try {
if (!user.getPassword().equals(SecurityUtil.md5DoubleEncoding(password))) {
throw new AppException("登录密码错误!");
}
} catch (Exception e) {
throw new AppException("密码验认出错!", e);
}
return user;
}
private CustomerEntity findByLoginName(String loginName) {
CustomerEntity params = new CustomerEntity();
params.setLoginName(loginName);
return this.selectOne(params);
}
} }
\ No newline at end of file
...@@ -24,4 +24,10 @@ public class CustomerWorkCollectServiceImpl extends AbstractCRUDServiceImpl<Cust ...@@ -24,4 +24,10 @@ public class CustomerWorkCollectServiceImpl extends AbstractCRUDServiceImpl<Cust
return super.findBefore(params, pageInfo, context); return super.findBefore(params, pageInfo, context);
} }
@Override
protected void saveBefore(CustomerWorkCollectEntity entity, Context context) throws AppException {
this.validData(entity, context);
entity.setCustomerId(this.getContextUserId(context));
}
} }
\ No newline at end of file
...@@ -2,6 +2,7 @@ package com.mortals.xhx.module.customer.service.impl; ...@@ -2,6 +2,7 @@ package com.mortals.xhx.module.customer.service.impl;
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.PageInfo;
import com.mortals.xhx.module.customer.model.CustomerWorkCollectEntity;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl; import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.xhx.module.customer.dao.CustomerWorkDesignDao; import com.mortals.xhx.module.customer.dao.CustomerWorkDesignDao;
...@@ -23,4 +24,10 @@ public class CustomerWorkDesignServiceImpl extends AbstractCRUDServiceImpl<Custo ...@@ -23,4 +24,10 @@ public class CustomerWorkDesignServiceImpl extends AbstractCRUDServiceImpl<Custo
return super.findBefore(params, pageInfo, context); return super.findBefore(params, pageInfo, context);
} }
@Override
protected void saveBefore(CustomerWorkDesignEntity entity, Context context) throws AppException {
this.validData(entity, context);
entity.setCustomerId(this.getContextUserId(context));
}
} }
\ No newline at end of file
package com.mortals.xhx.module.customer.service.impl; package com.mortals.xhx.module.customer.service.impl;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.xhx.module.customer.model.CustomerWorkDesignEntity;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl; import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.xhx.module.customer.dao.CustomerWorkDesignStatDao; import com.mortals.xhx.module.customer.dao.CustomerWorkDesignStatDao;
...@@ -13,5 +16,10 @@ import com.mortals.xhx.module.customer.service.CustomerWorkDesignStatService; ...@@ -13,5 +16,10 @@ import com.mortals.xhx.module.customer.service.CustomerWorkDesignStatService;
*/ */
@Service("customerWorkDesignStatService") @Service("customerWorkDesignStatService")
public class CustomerWorkDesignStatServiceImpl extends AbstractCRUDServiceImpl<CustomerWorkDesignStatDao, CustomerWorkDesignStatEntity, Long> implements CustomerWorkDesignStatService { public class CustomerWorkDesignStatServiceImpl extends AbstractCRUDServiceImpl<CustomerWorkDesignStatDao, CustomerWorkDesignStatEntity, Long> implements CustomerWorkDesignStatService {
@Override
protected void saveBefore(CustomerWorkDesignStatEntity entity, Context context) throws AppException {
this.validData(entity, context);
entity.setCustomerId(this.getContextUserId(context));
}
} }
\ No newline at end of file
...@@ -2,6 +2,7 @@ package com.mortals.xhx.module.customer.web; ...@@ -2,6 +2,7 @@ package com.mortals.xhx.module.customer.web;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.common.IBaseEnum; import com.mortals.framework.common.IBaseEnum;
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.PageInfo;
import com.mortals.framework.model.Result; import com.mortals.framework.model.Result;
...@@ -139,4 +140,16 @@ public class CustomerController extends BaseCRUDJsonBodyMappingController<Custom ...@@ -139,4 +140,16 @@ public class CustomerController extends BaseCRUDJsonBodyMappingController<Custom
return ret.toJSONString(); return ret.toJSONString();
} }
} }
@Override
protected int editAfter(Long id, Map<String, Object> model, CustomerEntity entity, Context context) throws AppException {
entity.setPassword(null);
return 1;
}
@Override
protected int viewAfter(Long id, Map<String, Object> model, CustomerEntity entity, Context context) throws AppException {
entity.setPassword(null);
return 1;
}
} }
\ No newline at end of file
package com.mortals.xhx.module.customer.web; package com.mortals.xhx.module.customer.web;
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.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;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -46,5 +48,12 @@ public class CustomerWorkCollectController extends BaseCRUDJsonBodyMappingContro ...@@ -46,5 +48,12 @@ public class CustomerWorkCollectController extends BaseCRUDJsonBodyMappingContro
super.init(model, context); super.init(model, context);
} }
@Override
protected void doListBefore(CustomerWorkCollectEntity query, Map<String, Object> model, Context context) throws AppException {
if(this.getCurUser()==null||this.getCurUser().getUserType()!= Constant.CUSTOMER_USER){
throw new AppException("非法用户,不可访问");
}
query.setCustomerId(this.getCurUser().getId());
}
} }
\ No newline at end of file
package com.mortals.xhx.module.customer.web; package com.mortals.xhx.module.customer.web;
import com.alibaba.fastjson.JSONObject;
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.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.framework.util.DateUtils; import com.mortals.framework.util.DateUtils;
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.common.code.MemberLevelEnum;
import com.mortals.xhx.common.code.WorkDesignStatusEnum; import com.mortals.xhx.common.code.WorkDesignStatusEnum;
import org.apache.commons.collections4.CollectionUtils; import com.mortals.xhx.common.key.Constant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.mortals.framework.model.Context;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.module.customer.model.CustomerWorkDesignEntity; import com.mortals.xhx.module.customer.model.CustomerWorkDesignEntity;
import com.mortals.xhx.module.customer.model.CustomerWorkDesignQuery;
import com.mortals.xhx.module.customer.service.CustomerWorkDesignService; import com.mortals.xhx.module.customer.service.CustomerWorkDesignService;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.collections4.CollectionUtils;
import com.mortals.framework.util.StringUtils;
import java.util.*;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* *
* 客户作品信息 * 客户作品信息
...@@ -56,6 +49,7 @@ public class CustomerWorkDesignController extends BaseCRUDJsonBodyMappingControl ...@@ -56,6 +49,7 @@ public class CustomerWorkDesignController extends BaseCRUDJsonBodyMappingControl
if(CollectionUtils.isNotEmpty(resultList)){ if(CollectionUtils.isNotEmpty(resultList)){
resultList.stream().forEach(item->{ resultList.stream().forEach(item->{
item.setCreateTimeStr(DateUtils.getDateTimeStr(item.getCreateTime(),DateUtils.P_yyyy_MM_dd_HH_mm_ss)); item.setCreateTimeStr(DateUtils.getDateTimeStr(item.getCreateTime(),DateUtils.P_yyyy_MM_dd_HH_mm_ss));
item.setUpdateTimeStr(DateUtils.getDateTimeStr(item.getUpdateTime(),DateUtils.P_yyyy_MM_dd_HH_mm_ss));
if(item.getWorkDesignStatus()==WorkDesignStatusEnum.DRAFT.getValue()){ if(item.getWorkDesignStatus()==WorkDesignStatusEnum.DRAFT.getValue()){
draft.add(item); draft.add(item);
}else { }else {
...@@ -69,4 +63,48 @@ public class CustomerWorkDesignController extends BaseCRUDJsonBodyMappingControl ...@@ -69,4 +63,48 @@ public class CustomerWorkDesignController extends BaseCRUDJsonBodyMappingControl
model.put("data",map); model.put("data",map);
return 1; return 1;
} }
@Override
protected void doListBefore(CustomerWorkDesignEntity query, Map<String, Object> model, Context context) throws AppException {
if(this.getCurUser()==null||this.getCurUser().getUserType()!= Constant.CUSTOMER_USER){
throw new AppException("非法用户,不可访问");
}
query.setCustomerId(this.getCurUser().getId());
}
@PostMapping({"picture/list"})
@UnAuth
public String pictureList(@RequestBody CustomerWorkDesignEntity query) {
Map<String, Object> model = new HashMap();
JSONObject ret = new JSONObject();
Context context = this.getContext();
String busiDesc = "查询" + this.getModuleDesc();
int code;
try {
if(query.getCustomerId()==null){
throw new AppException("客户id不能为空");
}
List<CustomerWorkDesignEntity> result = this.getService().find(query, context);
if(CollectionUtils.isNotEmpty(result)){
result.stream().forEach(item->{
item.setCreateTimeStr(DateUtils.getDateTimeStr(item.getCreateTime(),DateUtils.P_yyyy_MM_dd_HH_mm_ss));
item.setUpdateTimeStr(DateUtils.getDateTimeStr(item.getUpdateTime(),DateUtils.P_yyyy_MM_dd_HH_mm_ss));
});
}
model.put("data", result);
code = 1;
this.recordSysLog(this.request, busiDesc + " 【成功】");
} catch (Exception var9) {
code = -1;
this.doException(this.request, busiDesc, model, var9);
}
this.init(model, context);
ret.put("code", code);
ret.put("msg", model.remove("message_info"));
ret.put("dict", model.remove("dict"));
ret.put("data", model);
return ret.toJSONString();
}
} }
\ No newline at end of file
package com.mortals.xhx.module.customer.web; package com.mortals.xhx.module.customer.web;
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.key.Constant;
import com.mortals.xhx.module.customer.model.CustomerWorkCollectEntity;
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;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -46,5 +49,11 @@ public class CustomerWorkDesignStatController extends BaseCRUDJsonBodyMappingCon ...@@ -46,5 +49,11 @@ public class CustomerWorkDesignStatController extends BaseCRUDJsonBodyMappingCon
super.init(model, context); super.init(model, context);
} }
@Override
protected void doListBefore(CustomerWorkDesignStatEntity query, Map<String, Object> model, Context context) throws AppException {
if(this.getCurUser()==null||this.getCurUser().getUserType()!= Constant.CUSTOMER_USER){
throw new AppException("非法用户,不可访问");
}
query.setCustomerId(this.getCurUser().getId());
}
} }
\ No newline at end of file
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