Search in sources :

Example 11 with BaseResponse

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);
}
Also used : BaseResponse(com.tony.billing.response.BaseResponse) CostRecord(com.tony.billing.entity.CostRecord) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 12 with BaseResponse

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;
}
Also used : BaseResponse(com.tony.billing.response.BaseResponse) ModifyAdmin(com.tony.billing.entity.ModifyAdmin) Admin(com.tony.billing.entity.Admin) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 13 with BaseResponse

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;
}
Also used : BaseResponse(com.tony.billing.response.BaseResponse)

Example 14 with BaseResponse

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;
}
Also used : BaseResponse(com.tony.billing.response.BaseResponse)

Example 15 with BaseResponse

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;
}
Also used : BaseResponse(com.tony.billing.response.BaseResponse) CostRecord(com.tony.billing.entity.CostRecord) TagInfo(com.tony.billing.entity.TagInfo) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

BaseResponse (com.tony.billing.response.BaseResponse)15 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)10 CostRecord (com.tony.billing.entity.CostRecord)4 ModifyAdmin (com.tony.billing.entity.ModifyAdmin)3 TagInfo (com.tony.billing.entity.TagInfo)3 IOException (java.io.IOException)3 Admin (com.tony.billing.entity.Admin)2 ParseException (java.text.ParseException)2 Budget (com.tony.billing.entity.Budget)1 LoginLog (com.tony.billing.entity.LoginLog)1 TagCostRef (com.tony.billing.entity.TagCostRef)1 BaseBusinessException (com.tony.billing.exceptions.BaseBusinessException)1 AdminLoginRequest (com.tony.billing.request.admin.AdminLoginRequest)1 HashMap (java.util.HashMap)1 List (java.util.List)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 AfterReturning (org.aspectj.lang.annotation.AfterReturning)1 BindException (org.springframework.validation.BindException)1 FieldError (org.springframework.validation.FieldError)1 ExceptionHandler (org.springframework.web.bind.annotation.ExceptionHandler)1