Commit 75a53265 authored by 廖旭伟's avatar 廖旭伟

优化自动保存上传图片逻辑;增加管理员修改用户密码接口

parent 41a75d10
...@@ -69,8 +69,11 @@ public class UploadServiceImpl implements UploadService { ...@@ -69,8 +69,11 @@ public class UploadServiceImpl implements UploadService {
if (!pathDir.exists()) { if (!pathDir.exists()) {
pathDir.mkdirs(); pathDir.mkdirs();
} }
//判断是否重复上传
File oldFile = new File(filePath + fileName);
if (oldFile.exists()) {
oldFile.delete();
}
String newName = IdUtil.fastSimpleUUID() + "." + extension; String newName = IdUtil.fastSimpleUUID() + "." + extension;
String filePathAll = filePath + newName; String filePathAll = filePath + newName;
......
...@@ -49,4 +49,12 @@ public interface CustomerService extends ICRUDService<CustomerEntity,Long>{ ...@@ -49,4 +49,12 @@ public interface CustomerService extends ICRUDService<CustomerEntity,Long>{
*/ */
CustomerEntity changePassword(CustomerEntity params, Context context) throws AppException; CustomerEntity changePassword(CustomerEntity params, Context context) throws AppException;
/**
* 管理员修改密码
* @param params
* @param context
* @throws AppException
*/
void changePasswordByAdmin(CustomerEntity params, Context context) throws AppException;
} }
\ No newline at end of file
...@@ -180,4 +180,23 @@ public class CustomerServiceImpl extends AbstractCRUDServiceImpl<CustomerDao, Cu ...@@ -180,4 +180,23 @@ public class CustomerServiceImpl extends AbstractCRUDServiceImpl<CustomerDao, Cu
} }
return old; return old;
} }
@Override
public void changePasswordByAdmin(CustomerEntity params, Context context) throws AppException {
CustomerEntity old = this.get(params.getId());
if(old==null){
throw new AppException("客户信息不存在");
}
String newPwd = "";
String oldPwd = "";
try {
newPwd = SecurityUtil.md5DoubleEncoding(params.getNewPassword());
}catch (Exception e) {
throw new AppException("密码转换异常");
}
CustomerEntity update = new CustomerEntity();
update.setId(params.getId());
update.setPassword(newPwd);
this.update(update,context);
}
} }
\ No newline at end of file
...@@ -269,4 +269,35 @@ public class CustomerController extends BaseCRUDJsonBodyMappingController<Custom ...@@ -269,4 +269,35 @@ public class CustomerController extends BaseCRUDJsonBodyMappingController<Custom
return ret.toJSONString(); return ret.toJSONString();
} }
@RequestMapping(value = {"admin/change/password"},method = {RequestMethod.POST})
public String changePasswordByAdmin(@RequestBody CustomerEntity entity) {
Map<String, Object> model = new HashMap();
Context context = this.getContext();
IUser user = this.getCurUser();
if(user == null){
return this.createFailJsonResp("请先登录");
}
String busiDesc = "管理员修改密码";
int code = 1;
try {
this.service.changePasswordByAdmin(entity, context);
model.put("id", entity.getId());
model.put("entity", entity);
model.put("message_info", busiDesc + "成功");
this.recordSysLog(this.request, busiDesc + " 【成功】 [id:" + entity.getId() + "]");
} catch (Exception var7) {
this.doException(this.request, busiDesc, model, var7);
model.put("entity", entity);
this.init(model, context);
code = this.saveException(entity, model, context, var7);
}
this.init(model, context);
JSONObject ret = new JSONObject();
ret.put("code", code);
ret.put("msg", model.remove("message_info"));
ret.put("data", model);
return ret.toJSONString();
}
} }
\ No newline at end of file
...@@ -34,6 +34,9 @@ public class MasterplateUseInfoServiceImpl extends AbstractCRUDServiceImpl<Maste ...@@ -34,6 +34,9 @@ public class MasterplateUseInfoServiceImpl extends AbstractCRUDServiceImpl<Maste
DesignMasterplateQuery update = new DesignMasterplateQuery(); DesignMasterplateQuery update = new DesignMasterplateQuery();
update.setId(entity.getMasterplateId()); update.setId(entity.getMasterplateId());
update.setMasterplateUseNumIncrement(1); update.setMasterplateUseNumIncrement(1);
designMasterplateService.update(update); DesignMasterplateEntity designMasterplateEntity = designMasterplateService.get(entity.getMasterplateId());
if(designMasterplateEntity!=null) {
designMasterplateService.update(update);
}
} }
} }
\ 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