package org.springblade.modules.licence.controller;
|
|
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiParam;
|
import lombok.AllArgsConstructor;
|
import org.springblade.common.utils.DesensitizedUtil;
|
import org.springblade.core.mp.support.Condition;
|
import org.springblade.core.tool.api.R;
|
import org.springblade.core.tool.utils.Func;
|
import org.springblade.modules.licence.entity.LicencePaper;
|
import org.springblade.modules.licence.service.LicencePaperService;
|
import org.springblade.modules.licence.vo.LicencePaperVo;
|
import org.springblade.modules.system.service.MyAsyncService;
|
import org.springframework.web.bind.annotation.*;
|
|
import java.text.SimpleDateFormat;
|
import java.util.Date;
|
import java.util.List;
|
|
/**
|
* @author zhongrj
|
* @time 2021-12-27
|
* @desc 许可证控制层
|
*/
|
@RestController
|
@AllArgsConstructor
|
@RequestMapping("/licencePaper")
|
public class LicencePaperController {
|
|
private final LicencePaperService licencePaperService;
|
|
private final MyAsyncService myAsyncService;
|
|
|
// /**
|
// * 自定义分页
|
// * @param query page,size
|
// * @param licencePaper 许可证信息对象
|
// */
|
// @GetMapping("/page")
|
// public R<IPage<SecurityPaperVo>> page(SecurityPaperVo licencePaper, Query query) {
|
// IPage<SecurityPaperVo> pages = licencePaperService.selectSecurityPaperPage(Condition.getPage(query), licencePaper);
|
// return R.data(pages);
|
// }
|
|
/**
|
* 新增
|
* @param licencePaper 许可证信息对象
|
*/
|
@PostMapping("/save")
|
@ApiOperation(value = "新增", notes = "传入licencePaper")
|
public R save(@RequestBody LicencePaper licencePaper){
|
return R.data(licencePaperService.save(licencePaper));
|
}
|
|
|
/**
|
* 修改
|
* @param licencePaper 许可证信息对象
|
*/
|
@PostMapping("/update")
|
public R update(@RequestBody LicencePaper licencePaper){
|
return R.status(licencePaperService.updateById(licencePaper));
|
}
|
|
/**
|
* 新增或修改
|
* @param licencePaper 许可证信息对象
|
*/
|
@PostMapping("/submit")
|
public R submit(@RequestBody LicencePaper licencePaper){
|
LicencePaper licencePaper1 = licencePaper;
|
//脱敏处理
|
if (null!= licencePaper.getApprovalNumber() && !licencePaper.getApprovalNumber().equals("")){
|
licencePaper.setApprovalNumber(DesensitizedUtil.desensitizedSecurityNumber(licencePaper.getApprovalNumber()));
|
}
|
if (null!= licencePaper.getLicenceIssuingUnit() && !licencePaper.getLicenceIssuingUnit().equals("")){
|
licencePaper.setLicenceIssuingUnit(DesensitizedUtil.desensitizedSecurityNumber(licencePaper.getLicenceIssuingUnit()));
|
}
|
if (null!= licencePaper.getRegisterCapital() && !licencePaper.getRegisterCapital().equals("")){
|
licencePaper.setRegisterCapital("**");
|
}
|
if (null!= licencePaper.getCode() && !licencePaper.getCode().equals("")){
|
licencePaper.setCode(DesensitizedUtil.desensitizedSecurityNumber(licencePaper.getCode()));
|
}
|
if (null==licencePaper.getId()){
|
licencePaper.setCreateTime(new Date());
|
licencePaper.setUpdateTime(new Date());
|
licencePaperService.save(licencePaper);
|
//内网同步
|
String s = "insert into sys_licence_paper(" +
|
"id,type,unit_name,address,legal_people,content,approval_number,licence_issuing_unit,register_capital,code," +
|
"licence_issuing_time,create_user,create_time,update_time,dept_id,url) " +
|
"values(" + "'" + licencePaper.getId() + "'" + "," +
|
"'" + licencePaper1.getType() + "'" + "," +
|
"'" + licencePaper1.getUnitName() + "'" + "," +
|
"'" + licencePaper1.getLegalPeople() + "'" + "," +
|
"'" + licencePaper1.getContent() + "'" + "," +
|
"'" + licencePaper1.getApprovalNumber() + "'" + "," +
|
"'" + licencePaper1.getLicenceIssuingUnit() + "'" + "," +
|
"'" + licencePaper1.getRegisterCapital() + "'" + "," +
|
"'" + licencePaper1.getCode() + "'" + "," +
|
"'" + new SimpleDateFormat("yyyy-MM-dd").format(licencePaper1.getLicenceIssuingTime()) + "'" + "," +
|
"'" + licencePaper1.getCreateUser() + "'" + "," +
|
"," + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(licencePaper1.getCreateTime()) + "'" +
|
"," + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(licencePaper1.getUpdateTime()) + "'" +
|
"," + "'" + licencePaper1.getDeptId() + "'" +
|
"," + "'" + licencePaper1.getUrl() + "'"
|
+ ")";
|
myAsyncService.FTP(s);
|
}else {
|
licencePaper.setUpdateTime(new Date());
|
licencePaperService.updateById(licencePaper);
|
//内网同步
|
String s1 =
|
"update sys_licence_paper set unit_name = " + "'" + licencePaper1.getUnitName() + "'"
|
+ ",address = " + "'" + licencePaper1.getAddress() + "'"
|
+ ",legal_people = " + "'" + licencePaper1.getLegalPeople() + "'"
|
+ ",content = " + "'" + licencePaper1.getContent() + "'"
|
+ ",approval_number = " + "'" + licencePaper1.getApprovalNumber() + "'"
|
+ ",licence_issuing_unit = " + "'" + licencePaper1.getLicenceIssuingUnit() + "'"
|
+ ",register_capital = " + "'" + licencePaper1.getRegisterCapital() + "'"
|
+ ",code = " + "'" + licencePaper1.getCode() + "'"
|
+ ",licence_issuing_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd").format(licencePaper1.getLicenceIssuingTime()) + "'"
|
+ ",update_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(licencePaper1.getUpdateTime()) + "'"
|
+ ",dept_id = " + "'" + licencePaper1.getDeptId() + "'"
|
+ ",url = " + "'" + licencePaper1.getUrl() + "'"
|
+ " " + "where id = " + "'" + licencePaper1.getId() + "'";
|
myAsyncService.FTP(s1);
|
}
|
return R.data(licencePaper);
|
}
|
|
/**
|
* 新增或修改(分公司和总公司许可证信息)
|
* @param licencePaper 许可证信息对象
|
*/
|
@PostMapping("/submitGroup")
|
public R submitGroup(@RequestBody LicencePaperVo licencePaper){
|
if (null==licencePaper.getId()){
|
//总公司许可证信息新增
|
licencePaper.setCreateTime(new Date());
|
licencePaper.setUpdateTime(new Date());
|
//新增
|
licencePaperService.save(licencePaper);
|
|
//分公司许可证信息新增
|
LicencePaper paper = new LicencePaper();
|
//相同信息
|
paper.setType(licencePaper.getType());
|
paper.setUpdateTime(new Date());
|
paper.setCreateTime(new Date());
|
paper.setCreateUser(licencePaper.getCreateUser());
|
paper.setUpdateUser(licencePaper.getUpdateUser());
|
paper.setDeptId(licencePaper.getDeptId());
|
//其他信息
|
paper.setParentId(licencePaper.getId());
|
paper.setUnitName(licencePaper.getUnitNames());
|
paper.setAddress(licencePaper.getAddresss());
|
paper.setApprovalNumber(licencePaper.getApprovalNumbers());
|
paper.setCode(licencePaper.getCodes());
|
paper.setContent(licencePaper.getContents());
|
paper.setUrl(licencePaper.getUrls());
|
paper.setLegalPeople(licencePaper.getLegalPeoples());
|
paper.setLicenceIssuingUnit(licencePaper.getLicenceIssuingUnits());
|
paper.setLicenceIssuingTime(licencePaper.getLicenceIssuingTimes());
|
paper.setRegisterCapital(licencePaper.getRegisterCapitals());
|
//新增
|
licencePaperService.save(paper);
|
}else {
|
//总公司信息修改
|
licencePaper.setUpdateTime(new Date());
|
//修改
|
licencePaperService.updateById(licencePaper);
|
|
//分公司许可证信息修改
|
LicencePaper paper = new LicencePaper();
|
//相同信息
|
paper.setUpdateTime(new Date());
|
paper.setId(licencePaper.getSid());
|
//其他信息
|
paper.setUnitName(licencePaper.getUnitNames());
|
paper.setAddress(licencePaper.getAddresss());
|
paper.setApprovalNumber(licencePaper.getApprovalNumbers());
|
paper.setCode(licencePaper.getCodes());
|
paper.setContent(licencePaper.getContents());
|
paper.setUrl(licencePaper.getUrls());
|
paper.setLegalPeople(licencePaper.getLegalPeoples());
|
paper.setLicenceIssuingUnit(licencePaper.getLicenceIssuingUnits());
|
paper.setLicenceIssuingTime(licencePaper.getLicenceIssuingTimes());
|
paper.setRegisterCapital(licencePaper.getRegisterCapitals());
|
//修改
|
licencePaperService.updateById(paper);
|
}
|
return R.data(licencePaper);
|
}
|
|
/**
|
* 删除
|
* @param ids 许可证信息ids 数组
|
*/
|
@PostMapping("/remove")
|
public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) {
|
return R.status(licencePaperService.removeByIds(Func.toLongList(ids)));
|
}
|
|
/**
|
* 详情
|
* @param licencePaper 许可证信息对象
|
*/
|
@GetMapping("/detail")
|
@ApiOperation(value = "详情", notes = "传入licencePaper")
|
public R<LicencePaper> detail(LicencePaper licencePaper) {
|
LicencePaper detail = licencePaperService.getOne(Condition.getQueryWrapper(licencePaper));
|
return R.data(detail);
|
}
|
|
/**
|
* 查询分公司的许可证信息(包含总公司)
|
* @param licencePaper 许可证信息对象
|
*/
|
@GetMapping("/getLicenceInfos")
|
public R getLicenceInfos(LicencePaper licencePaper) {
|
return R.data(licencePaperService.getLicenceInfos(licencePaper));
|
}
|
|
}
|