use of com.tony.billing.response.BaseResponse in project BillingDubbo by TonyJiangWJ.
the class CostRecordController method updateRecord.
/**
* 修改消费记录
*
* @param request
* @return
*/
@RequestMapping(value = "/record/update")
public BaseResponse updateRecord(@ModelAttribute("request") @Validated CostRecordUpdateRequest request) {
BaseResponse response = new BaseResponse();
CostRecord record = new CostRecord();
record.setLocation(request.getLocation());
record.setGoodsName(request.getGoodsName());
record.setMemo(request.getMemo());
record.setTradeNo(request.getTradeNo());
record.setUserId(request.getUserId());
record.setOrderType(request.getOrderType());
record.setVersion(request.getVersion());
if (costRecordService.updateByTradeNo(record) > 0) {
return ResponseUtil.success(response);
}
return ResponseUtil.error(response);
}
use of com.tony.billing.response.BaseResponse in project BillingDubbo by TonyJiangWJ.
the class AdminController method register.
@RequestMapping(value = "/user/register/put", method = RequestMethod.POST)
public BaseResponse register(@ModelAttribute("request") @Validated AdminRegisterRequest registerRequest) {
BaseResponse response = new BaseResponse();
try {
Admin admin = new Admin();
admin.setUserName(registerRequest.getUserName());
admin.setPassword(registerRequest.getPassword());
Long flag = 0L;
if ((flag = adminService.register(admin)) > 0) {
ResponseUtil.success(response);
} else {
ResponseUtil.error(response);
if (flag.equals(-2L)) {
response.setMsg("账号已存在");
}
}
} catch (Exception e) {
logger.error("/user/register/put error", e);
ResponseUtil.sysError(response);
}
return response;
}
use of com.tony.billing.response.BaseResponse in project BillingDubbo by TonyJiangWJ.
the class ResponseUtil method loginError.
public static BaseResponse loginError() {
BaseResponse response = new BaseResponse();
response.setCode(CODE_LOGIN_VERIFY);
response.setMsg(MSG_LOGIN_VERIFY);
return response;
}
use of com.tony.billing.response.BaseResponse in project BillingDubbo by TonyJiangWJ.
the class ResponseUtil method success.
public static BaseResponse success(String message) {
BaseResponse response = success();
response.setMsg(message);
return response;
}
use of com.tony.billing.response.BaseResponse in project BillingDubbo by TonyJiangWJ.
the class TagInfoController method delCostTag.
/**
* 删除账单标签
*
* @param request
* @return
*/
@RequestMapping(value = "/cost/tag/delete")
public BaseResponse delCostTag(@ModelAttribute("request") @Validated CostTagDelRequest request) {
BaseResponse response = new BaseResponse();
try {
CostRecord costRecord = costRecordService.findByTradeNo(request.getTradeNo(), request.getUserId());
TagInfo tagInfo = tagInfoService.getTagInfoById(request.getTagId());
if (costRecord != null && tagInfo != null) {
if (tagInfoService.deleteCostTag(costRecord.getId(), tagInfo.getId())) {
ResponseUtil.success(response);
} else {
ResponseUtil.error(response);
}
} else {
ResponseUtil.paramError(response);
}
} catch (Exception e) {
logger.error("/cost/tag/delete error", e);
ResponseUtil.sysError(response);
}
return response;
}
Aggregations