update
This commit is contained in:
parent
4e63bbd12b
commit
de67a633d2
|
|
@ -2,6 +2,7 @@ package com.cwhelp.admin.business.controller;
|
|||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cwhelp.admin.business.validator.BssVatInvoiceCheckValid;
|
||||
import com.cwhelp.admin.business.validator.BssVatInvoiceValid;
|
||||
import com.cwhelp.common.api.baidu.BaiduAipOCR;
|
||||
import com.cwhelp.common.api.baidu.entity.vatinvoice.*;
|
||||
import com.cwhelp.common.api.baidu.entity.vatinvoice.enums.VatInvoiceTypeEnum;
|
||||
|
|
@ -118,8 +119,8 @@ public class BssVatInvoiceController {
|
|||
@PostMapping({"/add","/edit"})
|
||||
@RequiresPermissions({"bss:vatInvoice:add","bss:vatInvoice:edit"})
|
||||
@ResponseBody
|
||||
// public ResultVo save(@Validated @RequestBody BssVatInvoiceValid valid, @RequestBody BssVatInvoice bssVatInvoice) {
|
||||
public ResultVo save(@Validated @RequestBody BssVatInvoice bssVatInvoice) {
|
||||
public ResultVo save(@Validated @RequestBody BssVatInvoiceValid valid, @RequestBody BssVatInvoice bssVatInvoice) {
|
||||
// public ResultVo save(@Validated @RequestBody BssVatInvoice bssVatInvoice) {
|
||||
// 复制保留无需修改的数据
|
||||
if (bssVatInvoice.getId() != null) {
|
||||
BssVatInvoice beBssVatInvoice = bssVatInvoiceService.getById(bssVatInvoice.getId());
|
||||
|
|
|
|||
|
|
@ -3,8 +3,10 @@ package com.cwhelp.admin.business.validator;
|
|||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Pattern;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author yan.y
|
||||
|
|
@ -14,8 +16,8 @@ import java.io.Serializable;
|
|||
public class BssVatInvoiceValid implements Serializable {
|
||||
@NotEmpty(message = "发票代码不能为空")
|
||||
private String invoiceCode;
|
||||
@NotEmpty(message = "发票类型不能为空")
|
||||
private String invoiceType;
|
||||
@NotNull(message = "发票类型不能为空")
|
||||
private Integer invoiceType;
|
||||
@NotEmpty(message = "发票号码不能为空")
|
||||
private String invoiceNo;
|
||||
@NotEmpty(message = "发票日期不能为空")
|
||||
|
|
@ -23,12 +25,13 @@ public class BssVatInvoiceValid implements Serializable {
|
|||
private String invoiceDate;
|
||||
@NotEmpty(message = "校验码不能为空")
|
||||
private String checkCode;
|
||||
@NotEmpty(message = "发票金额不能为空")
|
||||
private String invoiceMoney;
|
||||
@NotEmpty(message = "税额不能为空")
|
||||
private String taxAmount;
|
||||
@NotEmpty(message = "总金额不能为空")
|
||||
private String totalAmount;
|
||||
@NotNull(message = "发票金额不能为空")
|
||||
private BigDecimal invoiceMoney;
|
||||
@NotNull(message = "税额不能为空")
|
||||
private BigDecimal taxAmount;
|
||||
@NotNull(message = "总金额不能为空")
|
||||
private BigDecimal totalAmount;
|
||||
@NotEmpty(message = "总金额(大写)不能为空")
|
||||
private String totalAmountCn;
|
||||
|
||||
}
|
||||
|
|
@ -6,6 +6,7 @@ import com.cwhelp.common.vo.ResultVo;
|
|||
import com.cwhelp.component.actionLog.action.UserAction;
|
||||
import com.cwhelp.component.actionLog.annotation.ActionLog;
|
||||
import com.cwhelp.devtools.generate.utils.jAngel.utils.StringUtil;
|
||||
import com.cwhelp.modules.business.domain.BssEmployee;
|
||||
import com.cwhelp.modules.system.domain.Role;
|
||||
import com.cwhelp.modules.system.domain.User;
|
||||
import com.cwhelp.modules.system.service.ApiUserService;
|
||||
|
|
@ -64,6 +65,27 @@ public class ApiLoginController {
|
|||
}
|
||||
}
|
||||
|
||||
@PostMapping("/biz/modifyPwd")
|
||||
@ResponseBody
|
||||
// @ActionLog(key = UserAction.API_USER_LOGIN, action = UserAction.class)
|
||||
public ResultVo modifyPwd(@RequestParam("telephone") String telephone,
|
||||
@RequestParam("oldPassword") String oldPassword,
|
||||
@RequestParam("newPassword") String newPassword){
|
||||
|
||||
if(StringUtil.isBlank(telephone) || StringUtil.isBlank(oldPassword) || StringUtil.isBlank(newPassword)){
|
||||
return new ResultVo(ApiConst.API_PARAM_BLANK_CODE, ApiConst.API_PARAM_BLANK_MSG);
|
||||
}
|
||||
|
||||
BssEmployee user = apiUserService.getUserByPhoneNum(telephone);
|
||||
if(user == null){
|
||||
return new ResultVo(ApiConst.API_SYS_ERR_CODE, ApiConst.API_SYS_ERR_MSG);
|
||||
}else {
|
||||
// user.setPassword(newPassword);
|
||||
apiUserService.save(user);
|
||||
return new ResultVo(ApiConst.API_OPT_SUCCESS_CODE, ApiConst.API_OPT_SUCCESS_MSG);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String tel = "16621001775";
|
||||
|
||||
|
|
|
|||
|
|
@ -134,11 +134,11 @@ layui.use(['element', 'form', 'layer', 'upload'], function () {
|
|||
var url = form.attr("action");
|
||||
var serializeArray = form.serializeArray();
|
||||
var _newData = null;
|
||||
var from = false; // from = true 代表增值税页面请求,用设置content-type的请求
|
||||
console.info("本次请求的url是---", url);
|
||||
if(url == '/bss/vatInvoice/add'){//增值税add页面请求
|
||||
from = true;
|
||||
var fromFlag = false; // from = true 代表增值税页面请求,用设置content-type的请求
|
||||
if(url == '/bss/vatInvoice/add' || url == '/bss/vatInvoice/edit'){//增值税add/edit页面请求
|
||||
fromFlag = true;
|
||||
_newData = trans.serialize( serializeArray );
|
||||
if(url == '/bss/vatInvoice/add'){
|
||||
var goods = createGoodsParams();
|
||||
_newData.bssGoods = goods;
|
||||
delete _newData.name;
|
||||
|
|
@ -149,12 +149,10 @@ layui.use(['element', 'form', 'layer', 'upload'], function () {
|
|||
delete _newData.detailAmount;
|
||||
delete _newData.taxRate;
|
||||
delete _newData.goodTaxAmount;
|
||||
}else if(url == '/bss/vatInvoice/edit'){//增值税edit页面请求
|
||||
from = true;
|
||||
_newData = trans.serialize( serializeArray );
|
||||
}
|
||||
}
|
||||
|
||||
if(from){
|
||||
if(fromFlag){
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: 'POST',
|
||||
|
|
|
|||
|
|
@ -35,4 +35,8 @@ public class ApiConst {
|
|||
|
||||
public static final String API_UPLOAD_PICTURE_FAILED_MSG = "上传图片失败";
|
||||
|
||||
public static final int API_SYS_ERR_CODE = 500;
|
||||
|
||||
public static final String API_SYS_ERR_MSG = "系统异常!";
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import com.cwhelp.common.vo.ResultVo;
|
|||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.BindException;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.MethodArgumentNotValidException;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
|
@ -36,6 +37,13 @@ public class ResultExceptionHandler {
|
|||
return ResultVoUtil.error(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
|
||||
}
|
||||
|
||||
@ExceptionHandler(MethodArgumentNotValidException.class)
|
||||
@ResponseBody
|
||||
public ResultVo methodArgumentNotValidException(MethodArgumentNotValidException e){
|
||||
BindingResult bindingResult = e.getBindingResult();
|
||||
return ResultVoUtil.error(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
|
||||
}
|
||||
|
||||
// 拦截未知的运行时异常
|
||||
@ExceptionHandler(RuntimeException.class)
|
||||
@ResponseBody
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import java.io.PrintWriter;
|
|||
*/
|
||||
@Component
|
||||
@ServletComponentScan
|
||||
@WebFilter(filterName = "apiLoginFilter", urlPatterns = {"/api_biz/*"})
|
||||
@WebFilter(filterName = "apiLoginFilter", urlPatterns = {"/api_biz/*", "/api/biz/*"})
|
||||
public class ApiLoginFilter implements Filter {
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -36,42 +36,32 @@ public class BssVatInvoice implements Serializable {
|
|||
private Long id;
|
||||
// 发票代码
|
||||
@Column(name = "invoice_code")
|
||||
@NotEmpty(message = "发票代码不能为空")
|
||||
private String invoiceCode;
|
||||
// 发票号码
|
||||
@Column(name = "invoice_no")
|
||||
@NotEmpty(message = "发票号码不能为空")
|
||||
private String invoiceNo;
|
||||
// 发票日期
|
||||
@Column(name = "invoice_date")
|
||||
@NotEmpty(message = "发票日期不能为空")
|
||||
@Pattern(regexp = "[0-9]{4}-[0-9]{2}-[0-9]{2}", message = "日期格式不正确")
|
||||
private String invoiceDate;
|
||||
// 校验码
|
||||
@Column(name = "check_code")
|
||||
@NotEmpty(message = "校验码不能为空")
|
||||
private String checkCode;
|
||||
// 发票金额
|
||||
@Column(name = "invoice_money")
|
||||
@NotNull(message = "发票金额不能为空")
|
||||
private BigDecimal invoiceMoney;
|
||||
// 税额
|
||||
@Column(name = "tax_amount")
|
||||
@NotNull(message = "税额不能为空")
|
||||
private BigDecimal taxAmount;
|
||||
// 总金额
|
||||
@Column(name = "total_amount")
|
||||
@NotNull(message = "总金额不能为空")
|
||||
private BigDecimal totalAmount;
|
||||
// 总金额(大写)
|
||||
@Column(name = "total_amount_cn")
|
||||
@NotEmpty(message = "总金额(大写)不能为空")
|
||||
private String totalAmountCn;
|
||||
|
||||
//发票类型
|
||||
//增值税普通发票 0; 增值税专用发票 1
|
||||
@Column(name = "invoice_type")
|
||||
@NotNull(message = "发票类型不能为空")
|
||||
private Integer invoiceType;
|
||||
|
||||
// 备注
|
||||
|
|
|
|||
|
|
@ -1,8 +1,14 @@
|
|||
package com.cwhelp.modules.business.repository;
|
||||
|
||||
import com.cwhelp.common.constant.StatusConst;
|
||||
import com.cwhelp.modules.business.domain.BssEmployee;
|
||||
import com.cwhelp.modules.system.repository.BaseRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -10,4 +16,12 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
|||
* @date 2019/07/31
|
||||
*/
|
||||
public interface BssEmployeeRepository extends BaseRepository<BssEmployee, Long>, JpaSpecificationExecutor<BssEmployee> {
|
||||
|
||||
BssEmployee findByPhoneNum(String telephone);
|
||||
|
||||
@Modifying
|
||||
@Transactional
|
||||
@Query("update bss_employee set pwd = ?1 where id = ?2 and status <> " + StatusConst.DELETE )
|
||||
void update(String pwd, int id);
|
||||
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package com.cwhelp.modules.system.service;
|
||||
|
||||
import com.cwhelp.modules.business.domain.BssEmployee;
|
||||
import com.cwhelp.modules.system.domain.User;
|
||||
|
||||
/**
|
||||
|
|
@ -8,4 +9,8 @@ import com.cwhelp.modules.system.domain.User;
|
|||
public interface ApiUserService {
|
||||
|
||||
User checkLoginPremission(String telephone);
|
||||
|
||||
BssEmployee getUserByPhoneNum(String telephone);
|
||||
|
||||
void save(BssEmployee user);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.cwhelp.modules.system.service.impl;
|
||||
|
||||
import com.cwhelp.modules.business.domain.BssEmployee;
|
||||
import com.cwhelp.modules.business.repository.BssEmployeeRepository;
|
||||
import com.cwhelp.modules.system.domain.User;
|
||||
import com.cwhelp.modules.system.repository.UserRepository;
|
||||
import com.cwhelp.modules.system.service.ApiUserService;
|
||||
|
|
@ -16,10 +18,21 @@ public class ApiUserServiceImpl implements ApiUserService {
|
|||
@Autowired
|
||||
private UserRepository userRepository;
|
||||
|
||||
@Autowired
|
||||
private BssEmployeeRepository bssEmployeeRepository;
|
||||
|
||||
@Override
|
||||
public User checkLoginPremission(String telephone) {
|
||||
return userRepository.findByPhone(telephone);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BssEmployee getUserByPhoneNum(String telephone) {
|
||||
return bssEmployeeRepository.findByPhoneNum(telephone);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(BssEmployee user) {
|
||||
// bssEmployeeRepository.update(user.getPwd, user.getId());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue