add 无权限直接编辑企业发票信息

This commit is contained in:
lijiarao
2023-07-19 09:52:32 +08:00
parent 91445d8f06
commit 6df6f44f60
7 changed files with 215 additions and 4 deletions
+11 -4
View File
@@ -1,8 +1,8 @@
ALTER TABLE `pay_working_group_subitem`
ADD COLUMN `label` varchar(50) NULL COMMENT '标签';
ALTER TABLE pay_working_group_subitem
ADD COLUMN label varchar(50) NULL COMMENT '标签';
ALTER TABLE `pay_meeting_situation`
ADD COLUMN `guests_upload_file_flag` tinyint NULL COMMENT '嘉宾上传文件标识';
ALTER TABLE pay_meeting_situation
ADD COLUMN guests_upload_file_flag tinyint NULL COMMENT '嘉宾上传文件标识';
create table pay_meeting_guests_file
(
@@ -32,3 +32,10 @@ CREATE TABLE sys_notice (
update_time datetime(0) NULL COMMENT '更新日期'
) COMMENT '公告管理表';
ALTER TABLE pay_meeting_situation
ADD COLUMN company_address varchar(100) NULL COMMENT '公司地址',
ADD COLUMN company_phone varchar(200) NULL COMMENT '公司电话',
ADD COLUMN opening_bank varchar(50) NULL COMMENT '开户行',
ADD COLUMN bank_account varchar(50) NULL COMMENT '银行账号',
ADD COLUMN duty_code varchar(50) NULL COMMENT '信用代码',
ADD COLUMN link_bank_number varchar(50) NULL COMMENT '联行号';
@@ -189,6 +189,9 @@ public class ShiroConfig {
filterChainDefinitionMap.put("/company/payContactsManagement/addMeeting","anon");
filterChainDefinitionMap.put("/company/payContactsManagement/queryByIdMeeting","anon");
filterChainDefinitionMap.put("/company/payContactsManagement/queryWXByCompany","anon");
//无权限直接编辑企业发票信息
filterChainDefinitionMap.put("/company/payCompanyManagement/updateInvoice","anon");
//企业端注册个人
filterChainDefinitionMap.put("/home/registerSelf", "anon");
// 判断当前企业是否是内部企业
@@ -25,6 +25,7 @@ import com.jero.company.entity.PayCompanyManagement;
import com.jero.company.entity.PayContactsManagement;
import com.jero.company.service.IPayCompanyManagementService;
import com.jero.company.service.IPayContactsManagementService;
import com.jero.company.vo.UpdateInvoicePram;
import com.jero.meeting.entity.PayMeetingSituation;
import com.jero.meeting.service.IPayMeetingSituationService;
import com.jero.member.entity.PayMemberProjectSubitem;
@@ -1004,4 +1005,16 @@ public class PayCompanyManagementController extends JeroController<PayCompanyMan
return Result.OK("同步成功!");
}
/**
* 无权限直接编辑企业发票信息
*
* @return
*/
@ApiOperation(value="无权限直接编辑企业发票信息")
@PostMapping(value = "/updateInvoice")
public Result<?> updateInvoice(@RequestBody UpdateInvoicePram updateInvoicePram) {
payCompanyManagementService.updateInvoice(updateInvoicePram);
return Result.OK("确认成功!");
}
}
@@ -4,6 +4,7 @@ package com.jero.company.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jero.company.entity.PayCompanyAndContactsManagement;
import com.jero.company.entity.PayCompanyManagement;
import com.jero.company.vo.UpdateInvoicePram;
import java.util.List;
@@ -94,6 +95,8 @@ public interface IPayCompanyManagementService extends IService<PayCompanyManagem
*/
void edit(PayCompanyManagement payCompanyManagement);
void updateInvoice(UpdateInvoicePram updateInvoicePram);
/**
* @Description 确认
* @Author lqt
@@ -27,6 +27,7 @@ import com.jero.company.service.IPayCompanyManagementService;
import com.jero.company.service.IPayContactsManagementService;
import com.jero.company.service.ProjectCountService;
import com.jero.company.vo.CompanyOrContactsCount;
import com.jero.company.vo.UpdateInvoicePram;
import com.jero.contract.entity.PayIncomeContract;
import com.jero.contract.service.IPayIncomeContractService;
import com.jero.member.entity.PayMemberProjectSubitem;
@@ -437,6 +438,84 @@ public class PayCompanyManagementServiceImpl extends ServiceImpl<PayCompanyManag
}
@Override
public void updateInvoice(UpdateInvoicePram updateInvoicePram) {
String id = updateInvoicePram.getId();
Integer needInvoice = updateInvoicePram.getNeedInvoice();
String companyName = updateInvoicePram.getCompanyName();
String dutyCode = updateInvoicePram.getDutyCode();
String companyAddress = updateInvoicePram.getCompanyAddress();
String companyPhone = updateInvoicePram.getCompanyPhone();
String openingBank = updateInvoicePram.getOpeningBank();
String bankAccount = updateInvoicePram.getBankAccount();
String linkBankNumber = updateInvoicePram.getLinkBankNumber();
ValidUtil.validate(updateInvoicePram);
//普通发票
if (Objects.equals(needInvoice, 1)) {
ValidUtil.validate(updateInvoicePram, UpdateInvoicePram.needInvoice_1.class);
} else if (Objects.equals(needInvoice, 2)) {
ValidUtil.validate(updateInvoicePram, UpdateInvoicePram.needInvoice_2.class);
} else {
throw new JeroBootException("需要发票才可变更");
}
PayCompanyManagement payCompanyManagementOld = payCompanyManagementService.getById(id);
if (Objects.isNull(payCompanyManagementOld)) {
throw new JeroBootException("企业不存在!");
}
try {
// 编辑保存企业前再次校验企业名称是否存在
LambdaQueryWrapper<PayCompanyManagement> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(PayCompanyManagement::getCompanyName,companyName);
PayCompanyManagement payCompanyManagementNew = payCompanyManagementService.getOne(queryWrapper);
// 企业名称存在,并且编辑id与查询不同,则校验不通过
if(!Objects.isNull(payCompanyManagementNew) && !Objects.equals(payCompanyManagementNew.getId(),id)) {
throw new JeroBootException("企业名称已存在!");
}
}catch (Exception e){
throw new JeroBootException("企业名称已存在!");
}
if(!StringUtils.isBlank(companyPhone)){
try {
companyPhone = PasswordUtil.encrypt(companyPhone);
}catch (Exception e){
throw new JeroBootException("公司电话加密异常!");
}
}
// 会员企业编辑同步会员系统
if(Objects.equals(payCompanyManagementOld.getRoleCode(),PayCompanyManagementCommon.ROLE_CODE2)){
if(!Objects.equals(payCompanyManagementOld.getCompanyName(),companyName)){
throw new JeroBootException("会员企业名称不可修改!");
}
// 调用会员项目接口
MemberInfo memberInfo = new MemberInfo();
memberInfo.setCompanyName(companyName);
memberInfo.setId(payCompanyManagementOld.getMemberId());
memberInfo.setTaxNo(dutyCode);
memberInfo.setDepositBank(openingBank);
memberInfo.setBankAccount(bankAccount);
memberInfo.setInvoiceAddress(companyAddress);
memberInfo.setInvoicePhone(companyPhone);
memberInfo.setLinkBankNumber(linkBankNumber);
AuthenticationUtils.post("/memberInfo/memberInfo/incomingEdit","",memberInfo);
}
LambdaUpdateWrapper<PayCompanyManagement> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(PayCompanyManagement::getId,id);
updateWrapper.set(PayCompanyManagement::getCompanyName,companyName);
updateWrapper.set(PayCompanyManagement::getDutyCode,dutyCode);
//普通发票不set下面的
if (!Objects.equals(needInvoice, 1)) {
updateWrapper.set( PayCompanyManagement::getCompanyAddress,companyAddress);
updateWrapper.set(PayCompanyManagement::getCompanyPhone,companyPhone);
updateWrapper.set(PayCompanyManagement::getOpeningBank,openingBank);
updateWrapper.set(PayCompanyManagement::getBankAccount,bankAccount);
updateWrapper.set(PayCompanyManagement::getLinkBankNumber,linkBankNumber);
}
payCompanyManagementService.update(updateWrapper);
}
@Override
@Transactional(rollbackFor = JeroBootException.class)
public void audit(String id) {
@@ -0,0 +1,68 @@
package com.jero.company.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.jero.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
import javax.validation.constraints.*;
/**
* @author liJiaRao
* @date 2023-07-18 16:28
*/
@Data
public class UpdateInvoicePram {
/**主键*/
@ApiModelProperty(value = "公司id")
private String id;
/**需要发票*/
@ApiModelProperty(value = "需要发票")
@Min(0)
@Max(2)
@Dict(dicCode = "invoice_type")
private Integer needInvoice;
/**企业名称*/
@Excel(name = "企业名称", width = 15)
@ApiModelProperty(value = "企业名称")
@NotEmpty(message = "企业名称不能为空",groups = {needInvoice_1.class,needInvoice_2.class})
@Size(max = 50, message = "企业名称长度不能大于50个字符",groups = {needInvoice_1.class,needInvoice_2.class})
private String companyName;
/**信用代码*/
@ApiModelProperty(value = "信用代码")
@NotEmpty(message = "信用代码不能为空",groups = {needInvoice_1.class,needInvoice_2.class})
@Size(max = 18, message = "信用代码长度不能大于18个字符",groups = {needInvoice_1.class,needInvoice_2.class})
@Pattern(regexp = "^([0-9A-HJ-NPQRTUWXY]{2}\\d{6}[0-9A-HJ-NPQRTUWXY]{10}|[1-9]\\d{14})$",message = "信用代码格式错误",groups = {needInvoice_1.class,needInvoice_2.class})
private String dutyCode;
/**公司地址*/
@ApiModelProperty(value = "公司地址")
@NotEmpty(message = "公司地址不能为空",groups = needInvoice_2.class)
@Size(max = 50, message = "公司地址长度不能大于50个字符",groups = needInvoice_2.class)
private String companyAddress;
/**公司电话*/
@ApiModelProperty(value = "公司电话")
@Size(max = 15, message = "公司电话长度不能大于15个字符",groups = needInvoice_2.class)
@Pattern(regexp = "^([0-9-]+)$",message = "公司电话格式错误",groups = needInvoice_2.class)
private String companyPhone;
/**开户行*/
@ApiModelProperty(value = "开户行")
@NotEmpty(message = "开户行不能为空",groups = needInvoice_2.class)
@Size(max = 50, message = "开户行长度不能大于50个字符",groups = needInvoice_2.class)
private String openingBank;
/**银行账号*/
@ApiModelProperty(value = "银行账号")
@NotEmpty(message = "银行账号不能为空",groups = needInvoice_2.class)
@Size(max = 50, message = "银行账号长度不能大于50个字符",groups = needInvoice_2.class)
private String bankAccount;
/**联行号*/
@ApiModelProperty(value = "联行号")
@NotEmpty(message = "联行号不能为空",groups = needInvoice_2.class)
private String linkBankNumber;
public @interface needInvoice_1 {
}
public @interface needInvoice_2 {
}
}
@@ -4,6 +4,7 @@ import java.io.Serializable;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.*;
import com.jero.company.vo.UpdateInvoicePram;
import com.jero.meeting.valid.group.CommonPeople;
import com.jero.meeting.valid.group.Guest;
import lombok.Data;
@@ -517,4 +518,41 @@ public class PayMeetingSituation implements Serializable {
@ApiModelProperty(value = "嘉宾上传文件标识")
private Integer guestsUploadFileFlag;
/**信用代码*/
@ApiModelProperty(value = "信用代码")
@NotEmpty(message = "信用代码不能为空",groups = {UpdateInvoicePram.needInvoice_1.class, UpdateInvoicePram.needInvoice_2.class})
@Size(max = 18, message = "信用代码长度不能大于18个字符",groups = {UpdateInvoicePram.needInvoice_1.class,UpdateInvoicePram.needInvoice_2.class})
@Pattern(regexp = "^([0-9A-HJ-NPQRTUWXY]{2}\\d{6}[0-9A-HJ-NPQRTUWXY]{10}|[1-9]\\d{14})$",message = "信用代码格式错误",groups = {UpdateInvoicePram.needInvoice_1.class,UpdateInvoicePram.needInvoice_2.class})
private String dutyCode;
/**公司地址*/
@ApiModelProperty(value = "公司地址")
@NotEmpty(message = "公司地址不能为空",groups = UpdateInvoicePram.needInvoice_2.class)
@Size(max = 50, message = "公司地址长度不能大于50个字符",groups = UpdateInvoicePram.needInvoice_2.class)
private String companyAddress;
/**公司电话*/
@ApiModelProperty(value = "公司电话")
@Size(max = 15, message = "公司电话长度不能大于15个字符",groups = UpdateInvoicePram.needInvoice_2.class)
@Pattern(regexp = "^([0-9-]+)$",message = "公司电话格式错误",groups = UpdateInvoicePram.needInvoice_2.class)
private String companyPhone;
/**开户行*/
@ApiModelProperty(value = "开户行")
@NotEmpty(message = "开户行不能为空",groups = UpdateInvoicePram.needInvoice_2.class)
@Size(max = 50, message = "开户行长度不能大于50个字符",groups = UpdateInvoicePram.needInvoice_2.class)
private String openingBank;
/**银行账号*/
@ApiModelProperty(value = "银行账号")
@NotEmpty(message = "银行账号不能为空",groups = UpdateInvoicePram.needInvoice_2.class)
@Size(max = 50, message = "银行账号长度不能大于50个字符",groups = UpdateInvoicePram.needInvoice_2.class)
private String bankAccount;
/**联行号*/
@ApiModelProperty(value = "联行号")
@NotEmpty(message = "联行号不能为空",groups = UpdateInvoicePram.needInvoice_2.class)
private String linkBankNumber;
/**发票项目*/
@Dict(dicCode = "invoice_project")
@ApiModelProperty(value = "发票项目")
private Integer invoiceProject;
}