Commit 9100c632 authored by 廖旭伟's avatar 廖旭伟

新增用户修改密码接口,客户保存设计增加参数可以同时保存模板引用记录

parent 77d54cfd
......@@ -315,6 +315,48 @@ msg|String|消息|-
```
### 修改用户密码
**请求URL:** user/change/password
**请求方式:** POST
**内容类型:** application/json;charset=utf-8
**简要描述:** 保存或更新客户管理:id为空时为新增保存,否则为更新提交
**请求参数:**
参数名称|类型|必填|描述
:---|:---|:---|:-------
oldPassword|String|是|旧密码
newPassword|String|是|新密码
**请求样例:**
```
{
"oldPassword":"6q0z8f",
"newPassword":"r7s2ru"
}
```
**响应参数:**
参数名称 |参数类型|备注|其它
---|---|---|---
code|Integer|结果码(-1.失败,1.成功)|-
msg|String|消息|-
**响应消息样例:**
```
{
"code":1,
"msg":"成功"
}
```
## 角色信息业务
### 查询角色信息业务列表
......@@ -4522,6 +4564,7 @@ pictureBackgroundIds|String|是|模版引用的背景
fontIds|String|是|作品引用的字体
previewUrl|String|是|图片预览地址(相对地址)
designContent|Array|是|设计草稿
masterplateId|Long|否|模板Id(非必填,传此参数表示同时保存模板引用记录)
**请求样例:**
```
......@@ -4535,7 +4578,8 @@ designContent|Array|是|设计草稿
"pictureBackgroundIds":"ad0eh7",
"fontIds":"f3bacv",
"previewUrl":"f3bacv",
"designContent":[{"aaa":1,"bbb":"test"},{"aaa":1,"bbb":"test"}]
"designContent":[{"aaa":1,"bbb":"test"},{"aaa":1,"bbb":"test"}],
"masterplateId":1
}
```
......@@ -5063,28 +5107,6 @@ newPassword|String|是|新密码
code|Integer|结果码(-1.失败,1.成功)
msg|String|消息
data|object|数据对象
 id|Long|保存后主键id
 entity|object|保存更新实体
  id|Long|主键ID,主键,自增长
  loginName|String|用户登录账号
  password|String|密码
  memberLevel|Integer|会员等级,,0:未开启,1:试用客户,2:VIP,3:设计师,默认0
  custName|String|客户真实名称
  organization|String|单位名称
  contactTelphone|String|联系电话
  enterpriseConsultant|String|企业顾问
  siteId|Long|站点ID
  sex|Integer|性别
  mailbox|String|邮箱
  job|String|职位
  avatar|String|头像图片地址
  customerSrc|Long|客户来源
  status|Integer|使用状态,1:正常,0:禁用,默认:0
  createUserId|Long|创建用户
  createTime|Date|注册时间
  updateTime|Date|更新时间
  lastLoginTime|Date|最后一次登录时间
  lastLoginAddress|String|最后一次登录地址
**响应消息样例:**
```
......
......@@ -32,4 +32,7 @@ public class UserEntityExt extends BaseEntityLong {
private String siteName;
private List<Long> roleIds;
private String siteCode;
private String oldPassword;
private String newPassword;
}
\ No newline at end of file
......@@ -16,18 +16,17 @@ import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.mortals.framework.service.IUser;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.role.model.RoleEntity;
import com.mortals.xhx.base.system.role.service.RoleService;
import com.mortals.xhx.common.code.UserStatus;
import com.mortals.framework.common.IBaseEnum;
import com.mortals.framework.common.code.UserType;
import com.mortals.xhx.common.key.Constant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.exception.AppException;
......@@ -77,4 +76,23 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic
entity.setLoginPwd3(null);
return 1;
}
@RequestMapping(value = "change/password", method = RequestMethod.POST)
public String changePassword(@RequestBody UserEntity entity) {
IUser user = this.getCurUser();
if(user == null){
return this.createFailJsonResp("请先登录");
}
JSONObject ret = new JSONObject();
try {
service.updateUserPwd(super.getCurUser().getLoginName(), entity.getOldPassword(), entity.getNewPassword());
ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
ret.put(KEY_RESULT_MSG, "密码修改成功!");
} catch (Exception e) {
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
ret.put(KEY_RESULT_MSG, super.convertException(e));
}
return ret.toJSONString();
}
}
\ No newline at end of file
......@@ -24,4 +24,6 @@ public class CustomerWorkDesignVo extends BaseEntityLong {
private String masterplateName;
/** 发布模板封面 */
private String frontCover;
/** 模板id */
private Long masterplateId;
}
\ No newline at end of file
......@@ -12,8 +12,6 @@ import com.mortals.xhx.module.customer.model.CustomerWorkDesignEntity;
import com.mortals.xhx.module.customer.service.CustomerWorkCollectService;
import com.mortals.xhx.module.design.model.DesignMasterplateEntity;
import com.mortals.xhx.module.design.service.DesignMasterplateService;
import com.mortals.xhx.module.masterplate.model.MasterplateUseInfoEntity;
import com.mortals.xhx.module.masterplate.service.MasterplateUseInfoService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......
......@@ -7,13 +7,17 @@ import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.xhx.common.code.WorkDesignStatusEnum;
import com.mortals.xhx.common.utils.StringUtils;
import com.mortals.xhx.module.customer.dao.CustomerWorkDesignDao;
import com.mortals.xhx.module.customer.model.CustomerEntity;
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.CustomerWorkDesignService;
import com.mortals.xhx.module.customer.service.CustomerWorkDesignStatService;
import com.mortals.xhx.module.design.model.DesignMasterplateEntity;
import com.mortals.xhx.module.design.service.DesignMasterplateService;
import com.mortals.xhx.module.masterplate.model.MasterplateUseInfoEntity;
import com.mortals.xhx.module.masterplate.service.MasterplateUseInfoService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -35,6 +39,10 @@ public class CustomerWorkDesignServiceImpl extends AbstractCRUDServiceImpl<Custo
private CustomerWorkDesignStatService customerWorkDesignStatService;
@Autowired
private DesignMasterplateService designMasterplateService;
@Autowired
private MasterplateUseInfoService masterplateUseInfoService;
@Autowired
private CustomerService customerService;
@Override
protected CustomerWorkDesignEntity findBefore(CustomerWorkDesignEntity params, PageInfo pageInfo, Context context) throws AppException {
......@@ -70,6 +78,17 @@ public class CustomerWorkDesignServiceImpl extends AbstractCRUDServiceImpl<Custo
updateEntity.setUpdateTime(new Date());
customerWorkDesignStatService.update(updateEntity);
}
if(entity.getMasterplateId()!=null){
CustomerEntity customerEntity = customerService.get(entity.getCustomerId());
MasterplateUseInfoEntity masterplateUseInfoEntity = new MasterplateUseInfoEntity();
masterplateUseInfoEntity.setMasterplateId(entity.getMasterplateId());
masterplateUseInfoEntity.setCustomerId(entity.getCustomerId());
masterplateUseInfoEntity.setCustomerName(customerEntity.getCustName());
masterplateUseInfoEntity.setCustomerTelphone(customerEntity.getContactTelphone());
masterplateUseInfoEntity.setCustomerOrganization(customerEntity.getOrganization());
masterplateUseInfoEntity.setCreateTime(new Date());
masterplateUseInfoService.save(masterplateUseInfoEntity);
}
}
@Override
......
package com.mortals.xhx.module.design.service.impl;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.util.DateUtils;
import com.mortals.xhx.common.utils.StringUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.xhx.module.customer.dao.CustomerWorkCollectDao;
import com.mortals.xhx.module.design.dao.DesignMasterplateDao;
import com.mortals.xhx.module.design.model.DesignMasterplateEntity;
import com.mortals.xhx.module.design.service.DesignMasterplateService;
import com.mortals.xhx.module.masterplate.dao.MasterplateUseInfoDao;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* DesignMasterplateService
......@@ -23,6 +29,11 @@ import java.util.List;
@Service("designMasterplateService")
public class DesignMasterplateServiceImpl extends AbstractCRUDServiceImpl<DesignMasterplateDao, DesignMasterplateEntity, Long> implements DesignMasterplateService {
@Autowired
private CustomerWorkCollectDao customerWorkCollectDao;
@Autowired
private MasterplateUseInfoDao masterplateUseInfoDao;
@Override
protected DesignMasterplateEntity findBefore(DesignMasterplateEntity entity, PageInfo pageInfo, Context context) throws AppException {
if(StringUtils.isNotEmpty(entity.getMasterplateName())){
......@@ -39,4 +50,12 @@ public class DesignMasterplateServiceImpl extends AbstractCRUDServiceImpl<Design
});
}
}
@Override
protected void removeAfter(Long[] ids, Context context, int result) throws AppException {
Map<String,Object> condition =new HashMap<>();
condition.put("masterplateIdList",ids);
customerWorkCollectDao.delete(condition);
masterplateUseInfoDao.delete(condition);
}
}
\ No newline at end of file
......@@ -12,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
/**
*
......@@ -47,4 +48,11 @@ public class MasterplateUseInfoController extends BaseCRUDJsonBodyMappingControl
entity.setCustomerTelphone(customerEntity.getContactTelphone());
entity.setCustomerOrganization(customerEntity.getOrganization());
}
@Override
protected void doListBefore(MasterplateUseInfoEntity query, Map<String, Object> model, Context context) throws AppException {
Map<String,String> orderCols = new HashMap<>();
orderCols.put("createTime","DESC");
query.setOrderCols(orderCols);
}
}
\ 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