forked from gitee/vben-java
增加辅助工具:数据字典,编号策略,地址选择,Excel导入导出
This commit is contained in:
@@ -4,3 +4,5 @@
|
||||
/vboot-extend/target/
|
||||
/vboot-web/target/
|
||||
/.idea/
|
||||
/vboot-web/src/main/resources/application.properties
|
||||
/vboot-web/src/main/resources/application.yml
|
||||
|
||||
@@ -14,7 +14,33 @@ import java.util.List;
|
||||
@Setter
|
||||
public class SaAgentMain extends BaseMainEntity {
|
||||
|
||||
private String addre;
|
||||
//--------地址相关信息------<<<
|
||||
private String addre;//完整地址
|
||||
|
||||
@Column(length = 64)
|
||||
private String adreg;//省市区
|
||||
|
||||
@Column(length = 128)
|
||||
private String addet;//省市区以外的详细信息
|
||||
|
||||
@Column(length = 32)
|
||||
private String adcoo;//经纬度
|
||||
|
||||
@Column(length = 32)
|
||||
private String adpro;//省
|
||||
|
||||
@Column(length = 32)
|
||||
private String adcit;//市
|
||||
|
||||
@Column(length = 32)
|
||||
private String addis;//区
|
||||
//--------地址相关信息------>>>
|
||||
|
||||
@Column(length = 32)
|
||||
private String level;//代理商资质
|
||||
|
||||
@Column(length = 32)
|
||||
private String senum;//流程号
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
private String notes;
|
||||
|
||||
@@ -3,13 +3,25 @@ package vboot.app.module.sa.agent.main;
|
||||
import cn.hutool.script.ScriptRuntimeException;
|
||||
import cn.hutool.script.ScriptUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import vboot.app.module.te.allot.check.Zcheck;
|
||||
import vboot.core.common.api.RestResult;
|
||||
import vboot.core.common.dao.JdbcDao;
|
||||
import vboot.core.common.dao.Sqler;
|
||||
import vboot.core.module.ass.addr.main.AssAddrMainHand;
|
||||
import vboot.core.module.ass.num.main.AssNumMainService;
|
||||
import vboot.core.xutil.file.ExcelUtil;
|
||||
import vboot.core.xutil.file.excel.ExcelResult;
|
||||
import vboot.core.xutil.lang.XnumberUtil;
|
||||
|
||||
import javax.script.CompiledScript;
|
||||
import javax.script.ScriptException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@@ -18,7 +30,6 @@ public class SaAgentMainApi {
|
||||
|
||||
@GetMapping
|
||||
public RestResult get(String name, String catid) {
|
||||
|
||||
CompiledScript script = ScriptUtil.compile("var map={};var a=1;var b=2;map.xx="
|
||||
+ XnumberUtil.getRandom6() +"+a+b;map");
|
||||
try {
|
||||
@@ -30,33 +41,90 @@ public class SaAgentMainApi {
|
||||
|
||||
Sqler sqler = new Sqler("sa_agent_main");
|
||||
sqler.addLike("t.name", name);
|
||||
sqler.addSelect("t.addre");
|
||||
sqler.addSelect("t.addre,t.senum");
|
||||
return RestResult.ok(service.findPageData(sqler));
|
||||
}
|
||||
|
||||
@PostMapping("imp")
|
||||
public RestResult postImp(@RequestPart("file") MultipartFile file) throws Exception {
|
||||
ExcelResult<Student> result = ExcelUtil.importExcel(file.getInputStream(), Student.class, new StudentImportListener());
|
||||
System.out.println(result);
|
||||
return RestResult.ok(result);
|
||||
// return RestResult.error(result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@GetMapping("exp")
|
||||
public void getExp(HttpServletResponse response) throws Exception {
|
||||
Sqler sqler=new Sqler("t.id,t.name,t.crtim,t.uptim","sa_agent_main");
|
||||
sqler.addLeftJoin("o1.name as crman","sys_org o1","o1.id=t.crman");
|
||||
sqler.addLeftJoin("o2.name as upman","sys_org o2","o2.id=t.upman");
|
||||
sqler.addSelect("t.addre,t.adcoo,t.notes,t.senum");
|
||||
List<SaAgentMainExp> list = jdbcDao.getTp().query(sqler.getSql(),
|
||||
sqler.getParams(), new BeanPropertyRowMapper<>(SaAgentMainExp.class));
|
||||
ExcelUtil.exportExcel(list, "代理商清单", SaAgentMainExp.class, response);
|
||||
|
||||
// response.setContentType("application/vnd.ms-excel");
|
||||
// response.setCharacterEncoding("utf-8");
|
||||
// String fileName = "测试1ss.xlsx";
|
||||
// FileUtils.setAttachmentResponseHeader(response, fileName);
|
||||
// response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8");
|
||||
// ServletOutputStream outputStream = response.getOutputStream();
|
||||
// ExcelWriterBuilder writeWorkBook = EasyExcel.write(outputStream, Student.class)
|
||||
// .registerWriteHandler((new LongestMatchColumnWidthStyleStrategy()));
|
||||
// ExcelWriterSheetBuilder sheet = writeWorkBook.sheet();
|
||||
// sheet.doWrite(initData());
|
||||
}
|
||||
|
||||
private static List<Student> initData(){
|
||||
List<Student> students=new ArrayList<>();
|
||||
for (int i = 0; i < 10; i++) {
|
||||
Student data=new Student();
|
||||
data.setName("测试"+i+2);
|
||||
data.setGender("男");
|
||||
data.setBirthday(new Date());
|
||||
students.add(data);
|
||||
}
|
||||
System.out.println(students);
|
||||
return students;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@GetMapping("one/{id}")
|
||||
public RestResult getOne(@PathVariable String id) {
|
||||
|
||||
SaAgentMain main = service.findOne(id);
|
||||
return RestResult.ok(main);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public RestResult post(@RequestBody SaAgentMain main) {
|
||||
String num = numService.getNum("AGENT");
|
||||
main.setSenum(num);
|
||||
return RestResult.ok(service.insert(main));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
public RestResult put(@RequestBody SaAgentMain main) {
|
||||
|
||||
return RestResult.ok(service.update(main));
|
||||
}
|
||||
|
||||
@DeleteMapping("{ids}")
|
||||
public RestResult delete(@PathVariable String[] ids) {
|
||||
|
||||
return RestResult.ok(service.delete(ids));
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private AssNumMainService numService;
|
||||
|
||||
@Autowired
|
||||
private SaAgentMainService service;
|
||||
|
||||
@Autowired
|
||||
private JdbcDao jdbcDao;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package vboot.app.module.sa.agent.main;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SaAgentMainExp {
|
||||
|
||||
private String id;
|
||||
|
||||
private String senum;
|
||||
|
||||
private String name;
|
||||
|
||||
private String addre;
|
||||
|
||||
private String adcoo;
|
||||
|
||||
private String crman;
|
||||
|
||||
private String crtim;
|
||||
|
||||
private String upman;
|
||||
|
||||
private String uptim;
|
||||
|
||||
private String notes;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package vboot.app.module.sa.agent.main;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnore;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
//@HeadRowHeight(20)//表头高度
|
||||
//@ContentRowHeight(20)//内容的行高
|
||||
public class Student {
|
||||
//和excel表中数据一一对应
|
||||
@ExcelIgnore//该字段不参与读写
|
||||
private String id;
|
||||
|
||||
// @ExcelProperty("姓名")//列名
|
||||
// @ColumnWidth(20)//列宽
|
||||
private String name;
|
||||
// @ExcelProperty("性别")
|
||||
// @ColumnWidth(20)
|
||||
private String gender;
|
||||
// @ExcelProperty("出生日期")
|
||||
// @ColumnWidth(20)
|
||||
// @DateTimeFormat("yyyy-MM-dd")//指定日期格式
|
||||
private Date birthday;
|
||||
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package vboot.app.module.sa.agent.main;
|
||||
|
||||
import com.alibaba.excel.context.AnalysisContext;
|
||||
import vboot.core.xutil.file.excel.ExcelListener;
|
||||
import vboot.core.xutil.file.excel.ExcelResult;
|
||||
|
||||
public class StudentImportListener implements ExcelListener<Student> {
|
||||
@Override
|
||||
public ExcelResult<Student> getExcelResult() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke(Student student, AnalysisContext analysisContext) {
|
||||
System.out.println(student);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doAfterAllAnalysed(AnalysisContext analysisContext) {
|
||||
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -4,7 +4,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import vboot.app.module.sa.agent.main.SaAgentMain;
|
||||
import vboot.app.module.sa.agent.main.SaAgentMainRepo;
|
||||
import vboot.core.xutil.lang.XstringUtil;
|
||||
import vboot.core.xutil.lang.XstrUtil;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@@ -19,7 +19,7 @@ public class SaCustMainService {
|
||||
}
|
||||
|
||||
public String insert(SaCustMain cust) {
|
||||
cust.setId(XstringUtil.getUUID());
|
||||
cust.setId(XstrUtil.getUUID());
|
||||
custMapper.insert(cust);
|
||||
return cust.getId();
|
||||
}
|
||||
@@ -39,13 +39,13 @@ public class SaCustMainService {
|
||||
public void test() {
|
||||
//先通过JPA新增一个代理商
|
||||
SaAgentMain agentMain=new SaAgentMain();
|
||||
agentMain.setId(XstringUtil.getUUID());
|
||||
agentMain.setId(XstrUtil.getUUID());
|
||||
agentMain.setName("有事务的项目");
|
||||
agentRepo.save(agentMain);
|
||||
|
||||
//再通过mybatis-plus新增一个项目,并让它报错
|
||||
SaCustMain sdCustMain=new SaCustMain();
|
||||
sdCustMain.setId(XstringUtil.getUUID()+"XXXXXXXXXXXXXXXX");//超出长度保存出错
|
||||
sdCustMain.setId(XstrUtil.getUUID()+"XXXXXXXXXXXXXXXX");//超出长度保存出错
|
||||
sdCustMain.setNotes("有事务的客户");
|
||||
custMapper.insert(sdCustMain);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import vboot.app.module.te.allot.param.TeAllotParamService;
|
||||
import vboot.core.common.api.RestResult;
|
||||
import vboot.core.common.dao.JdbcDao;
|
||||
import vboot.core.common.dao.Sqler;
|
||||
import vboot.core.xutil.lang.XstringUtil;
|
||||
import vboot.core.xutil.lang.XstrUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -22,7 +22,7 @@ public class TeFeatCompApi {
|
||||
@GetMapping("one/{id}")
|
||||
public RestResult getOne(@PathVariable String id) {
|
||||
TeFeatComp main = service.findOne(id);
|
||||
if (XstringUtil.isNotBlank(main.getPatid())) {
|
||||
if (XstrUtil.isNotBlank(main.getPatid())) {
|
||||
main.setPatem(apService.findOne(main.getPatid()));
|
||||
}
|
||||
return RestResult.ok(main);
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@ package vboot.app.module.te.feat.comp;
|
||||
|
||||
import vboot.app.module.te.allot.param.TeAllotParamRepo;
|
||||
import vboot.core.common.service.BaseMainService;
|
||||
import vboot.core.xutil.lang.XstringUtil;
|
||||
import vboot.core.xutil.lang.XstrUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -13,7 +13,7 @@ public class TeFeatCompService extends BaseMainService<TeFeatComp> {
|
||||
|
||||
public TeFeatComp insert(TeFeatComp main){
|
||||
if(main.getPatem()!=null){
|
||||
String puuid = XstringUtil.getUUID();
|
||||
String puuid = XstrUtil.getUUID();
|
||||
main.getPatem().setId(puuid);
|
||||
main.getPatem().setName(main.getName()+"专用");
|
||||
main.getPatem().setSptag(true);
|
||||
|
||||
@@ -4,7 +4,7 @@ import vboot.core.common.api.RestResult;
|
||||
import vboot.core.common.dao.JdbcDao;
|
||||
import vboot.core.common.dao.Sqler;
|
||||
import vboot.core.common.pojo.Zinp;
|
||||
import vboot.core.xutil.lang.XstringUtil;
|
||||
import vboot.core.xutil.lang.XstrUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -32,11 +32,11 @@ public class TeProdModelApi {
|
||||
|
||||
@GetMapping("list")
|
||||
public RestResult getList(String serid,String catid) {
|
||||
if(XstringUtil.isNotBlank(catid)){
|
||||
if(XstrUtil.isNotBlank(catid)){
|
||||
String sql = "select m.id,m.name from te_prod_model m where m.catid=?";
|
||||
List<Map<String, Object>> mapList = jdbcDao.findMapList(sql, catid);
|
||||
return RestResult.ok(mapList);
|
||||
}else if(XstringUtil.isNotBlank(serid)){
|
||||
}else if(XstrUtil.isNotBlank(serid)){
|
||||
String sql = "select m.id,m.name from te_prod_model m where m.serid=?";
|
||||
List<Map<String, Object>> mapList = jdbcDao.findMapList(sql, serid);
|
||||
return RestResult.ok(mapList);
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@ import vboot.app.module.te.allot.param.TeAllotParamService;
|
||||
import vboot.core.common.api.RestResult;
|
||||
import vboot.core.common.dao.JdbcDao;
|
||||
import vboot.core.common.dao.Sqler;
|
||||
import vboot.core.xutil.lang.XstringUtil;
|
||||
import vboot.core.xutil.lang.XstrUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -26,7 +26,7 @@ public class TeProdVersionApi {
|
||||
TeProdVersion main = service.findOne(id);
|
||||
String modna = jdbcDao.findOneString("select name from te_prod_model where id=?", main.getModid());
|
||||
main.setModna(modna);
|
||||
if (XstringUtil.isNotBlank(main.getPatid())) {
|
||||
if (XstrUtil.isNotBlank(main.getPatid())) {
|
||||
main.setPatem(apService.findOne(main.getPatid()));
|
||||
}
|
||||
return RestResult.ok(main);
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@ package vboot.app.module.te.prod.version;
|
||||
|
||||
import vboot.app.module.te.allot.param.TeAllotParamRepo;
|
||||
import vboot.core.common.service.BaseMainService;
|
||||
import vboot.core.xutil.lang.XstringUtil;
|
||||
import vboot.core.xutil.lang.XstrUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -13,7 +13,7 @@ public class TeProdVersionService extends BaseMainService<TeProdVersion> {
|
||||
|
||||
public TeProdVersion insert(TeProdVersion main){
|
||||
if(main.getPatem()!=null){
|
||||
String puuid = XstringUtil.getUUID();
|
||||
String puuid = XstrUtil.getUUID();
|
||||
main.getPatem().setId(puuid);
|
||||
main.getPatem().setName(main.getName()+"专用");
|
||||
main.getPatem().setSptag(true);
|
||||
|
||||
@@ -162,6 +162,17 @@
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>easyexcel</artifactId>
|
||||
<version>3.0.5</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>cglib</artifactId>
|
||||
<groupId>cglib</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cglib</groupId>
|
||||
<artifactId>cglib</artifactId>
|
||||
<version>3.1</version>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.apache.poi</groupId>-->
|
||||
|
||||
@@ -6,7 +6,7 @@ import vboot.core.common.pojo.ZidName;
|
||||
import vboot.core.common.pojo.Zinp;
|
||||
import vboot.core.common.pojo.Ztree;
|
||||
import vboot.core.xutil.lang.XjsonUtil;
|
||||
import vboot.core.xutil.lang.XstringUtil;
|
||||
import vboot.core.xutil.lang.XstrUtil;
|
||||
import vboot.core.xutil.web.XreqUtil;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
@@ -90,7 +90,7 @@ public class JdbcDao {
|
||||
|
||||
public List<ZidName> getIdNameListByTable(String table, String name) {
|
||||
String sql = "select id,name from " + table + " where avtag = 1";
|
||||
if (XstringUtil.isBlank(name)) {
|
||||
if (XstrUtil.isBlank(name)) {
|
||||
return findIdNameList(sql);
|
||||
} else {
|
||||
return jdbcTemplate.query(sql + " and name like ?", new Object[]{"%" + name + "%"}, (rs, rowNum) -> {
|
||||
@@ -138,7 +138,7 @@ public class JdbcDao {
|
||||
|
||||
public List<Zinp> findInpListByTable(String table, String name) {
|
||||
String sql = "select id,name,pid from " + table + " where avtag = 1";
|
||||
if (XstringUtil.isBlank(name)) {
|
||||
if (XstrUtil.isBlank(name)) {
|
||||
return findInpList(sql);
|
||||
} else {
|
||||
return jdbcTemplate.query(sql + " and name like ?", new Object[]{"%" + name + "%"}, (rs, rowNum) -> new Zinp(rs.getString("id"), rs.getString("name"), rs.getString("pid")));
|
||||
@@ -200,7 +200,7 @@ public class JdbcDao {
|
||||
|
||||
|
||||
public String findOneName(String table, String id) {
|
||||
if (XstringUtil.isBlank(id)) {
|
||||
if (XstrUtil.isBlank(id)) {
|
||||
return null;
|
||||
} else {
|
||||
return jdbcTemplate.queryForObject("select name from " + table + " where id = ?", new Object[]{id}, String.class);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package vboot.core.common.dao;
|
||||
|
||||
|
||||
import vboot.core.xutil.lang.XstringUtil;
|
||||
import vboot.core.xutil.lang.XstrUtil;
|
||||
import vboot.core.security.pojo.Zuser;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -120,7 +120,7 @@ public class Sqler
|
||||
|
||||
public Sqler addEqual(String name, Object value)
|
||||
{
|
||||
if (XstringUtil.isNotBlank(value + ""))
|
||||
if (XstrUtil.isNotBlank(value + ""))
|
||||
{
|
||||
if (whereClause.length() == 0)
|
||||
{
|
||||
@@ -136,7 +136,7 @@ public class Sqler
|
||||
|
||||
public Sqler addLike(String name, Object value)
|
||||
{
|
||||
if (XstringUtil.isNotBlank(value + ""))
|
||||
if (XstrUtil.isNotBlank(value + ""))
|
||||
{
|
||||
if (whereClause.length() == 0)
|
||||
{
|
||||
@@ -152,7 +152,7 @@ public class Sqler
|
||||
|
||||
public Sqler addGtStringDate(String name, Object value)
|
||||
{
|
||||
if (XstringUtil.isNotBlank(value + ""))
|
||||
if (XstrUtil.isNotBlank(value + ""))
|
||||
{
|
||||
if (whereClause.length() == 0)
|
||||
{
|
||||
@@ -169,7 +169,7 @@ public class Sqler
|
||||
public Sqler addGtDate(String name, Object value, String dbType)
|
||||
{
|
||||
if("oracle".equals(dbType)){
|
||||
if (XstringUtil.isNotBlank(value + ""))
|
||||
if (XstrUtil.isNotBlank(value + ""))
|
||||
{
|
||||
if (whereClause.length() == 0)
|
||||
{
|
||||
@@ -181,7 +181,7 @@ public class Sqler
|
||||
parameters.add(value);
|
||||
}
|
||||
}else if("mysql".equals(dbType)){
|
||||
if (XstringUtil.isNotBlank(value + ""))
|
||||
if (XstrUtil.isNotBlank(value + ""))
|
||||
{
|
||||
if (whereClause.length() == 0)
|
||||
{
|
||||
@@ -200,7 +200,7 @@ public class Sqler
|
||||
public Sqler addLtDate(String name, Object value, String dbType)
|
||||
{
|
||||
if("oracle".equals(dbType)) {
|
||||
if (XstringUtil.isNotBlank(value + "")) {
|
||||
if (XstrUtil.isNotBlank(value + "")) {
|
||||
if (whereClause.length() == 0) {
|
||||
whereClause = " WHERE " + name + "<to_date(?,'yyyy-MM-dd')+1";
|
||||
} else {
|
||||
@@ -209,7 +209,7 @@ public class Sqler
|
||||
parameters.add(value);
|
||||
}
|
||||
}else{
|
||||
if (XstringUtil.isNotBlank(value + "")) {
|
||||
if (XstrUtil.isNotBlank(value + "")) {
|
||||
if (whereClause.length() == 0) {
|
||||
whereClause = " WHERE unix_timestamp(" + name + ") <=unix_timestamp(?)";
|
||||
} else {
|
||||
@@ -223,7 +223,7 @@ public class Sqler
|
||||
|
||||
public Sqler addLtStringDate(String name, Object value)
|
||||
{
|
||||
if (XstringUtil.isNotBlank(value + ""))
|
||||
if (XstrUtil.isNotBlank(value + ""))
|
||||
{
|
||||
if (whereClause.length() == 0)
|
||||
{
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package vboot.core.init;
|
||||
package vboot.core.common.init;
|
||||
|
||||
import vboot.core.module.sys.org.user.SysOrgUserRepo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package vboot.core.init;
|
||||
package vboot.core.common.init;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package vboot.core.init;
|
||||
package vboot.core.common.init;
|
||||
|
||||
import cn.hutool.core.lang.ClassScanner;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package vboot.core.init;
|
||||
package vboot.core.common.init;
|
||||
|
||||
import vboot.core.common.dao.JdbcDao;
|
||||
import vboot.core.xutil.lang.XstringUtil;
|
||||
import vboot.core.xutil.lang.XstrUtil;
|
||||
import vboot.core.module.sys.org.dept.SysOrgDept;
|
||||
import vboot.core.module.sys.org.dept.SysOrgDeptService;
|
||||
import vboot.core.module.sys.org.root.SysOrg;
|
||||
@@ -145,7 +145,7 @@ public class SysOrgInit {
|
||||
deptList.add(dept9);
|
||||
|
||||
for (int i = 1; i <= 50; i++) {
|
||||
String RSID8= XstringUtil.getRSID8();
|
||||
String RSID8= XstrUtil.getRSID8();
|
||||
SysOrgDept xdept = new SysOrgDept();
|
||||
xdept.setType(2);
|
||||
xdept.setId(id + "--"+i);
|
||||
+220
-106
@@ -1,4 +1,4 @@
|
||||
package vboot.core.init;
|
||||
package vboot.core.common.init;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -488,149 +488,263 @@ public class SysPortalInit {
|
||||
menu151.setPorid("sys");
|
||||
menuService.insert(menu151);
|
||||
|
||||
//-----------------OA办公--------------------
|
||||
//-----------------辅助工具--------------------
|
||||
SysPortalMenu menu2 = new SysPortalMenu();
|
||||
menu2.setId("Oa");
|
||||
menu2.setName("OA办公");
|
||||
menu2.setCode("Oa");
|
||||
menu2.setId("Ass");
|
||||
menu2.setName("辅助工具");
|
||||
menu2.setCode("Ass");
|
||||
menu2.setComp("LAYOUT");
|
||||
menu2.setPath("/oa");
|
||||
menu2.setRedirect("/oa/flow/temp");
|
||||
menu2.setPath("/ass");
|
||||
menu2.setRedirect("/ass/dict/main");
|
||||
menu2.setOrnum(2);
|
||||
menu2.setIcon("ele-Menu");
|
||||
menu2.setIcon("ele-Help");
|
||||
menu2.setAvtag(true);
|
||||
menu2.setShtag(true);
|
||||
menu2.setType("D");
|
||||
menu2.setPorid("sys");
|
||||
menuService.insert(menu2);
|
||||
|
||||
SysPortalMenu menu21 = new SysPortalMenu();
|
||||
menu21.setId("OaFlow");
|
||||
menu21.setName("流程管理");
|
||||
menu21.setCode("OaFlow");
|
||||
menu21.setComp("LAYOUT");
|
||||
menu21.setPath("/oa/flow");
|
||||
menu21.setRedirect("/oa/flow/temp");
|
||||
menu21.setOrnum(21);
|
||||
menu21.setIcon("ele-Connection");
|
||||
menu21.setPid("Oa");
|
||||
menu21.setAvtag(true);
|
||||
menu21.setShtag(true);
|
||||
menu21.setType("D");
|
||||
menu21.setPorid("sys");
|
||||
menuService.insert(menu21);
|
||||
|
||||
SysPortalMenu menu211 = new SysPortalMenu();
|
||||
menu211.setId("OaFlowCate");
|
||||
menu211.setName("流程分类");
|
||||
menu211.setCode("OaFlowCate");
|
||||
menu211.setPath("/oa/flow/cate");
|
||||
menu211.setComp("/oa/flow/cate/index");
|
||||
menu211.setId("AssDictMain");
|
||||
menu211.setName("数据字典");
|
||||
menu211.setCode("AssDictMain");
|
||||
menu211.setPath("/ass/dict/main");
|
||||
menu211.setComp("/ass/dict/main/index");
|
||||
menu211.setOrnum(211);
|
||||
menu211.setIcon("ele-Tickets");
|
||||
menu211.setPid("OaFlow");
|
||||
menu211.setCatag(true);
|
||||
menu211.setPid("Ass");
|
||||
menu211.setCatag(false);
|
||||
menu211.setAvtag(true);
|
||||
menu211.setShtag(true);
|
||||
menu211.setType("M");
|
||||
menu211.setPorid("sys");
|
||||
menuService.insert(menu211);
|
||||
|
||||
SysPortalMenu menu211a = new SysPortalMenu();
|
||||
menu211a.setId("OaFlowCateEdit");
|
||||
menu211a.setName("流程分类编辑");
|
||||
menu211a.setCode("OaFlowCateEdit");
|
||||
menu211a.setPath("/oa/flow/cate/edit");
|
||||
menu211a.setComp("/oa/flow/cate/edit");
|
||||
menu211a.setOrnum(2111);
|
||||
menu211a.setIcon("ele-Tickets");
|
||||
menu211a.setPid("OaFlow");
|
||||
menu211a.setCatag(true);
|
||||
menu211a.setAvtag(true);
|
||||
menu211a.setShtag(false);
|
||||
menu211a.setType("M");
|
||||
menu211a.setPorid("sys");
|
||||
menuService.insert(menu211a);
|
||||
SysPortalMenu menu211b = new SysPortalMenu();
|
||||
menu211b.setId("AssDictData");
|
||||
menu211b.setName("数据字典");
|
||||
menu211b.setCode("AssDictData");
|
||||
menu211b.setPath("/ass/dict/data");
|
||||
menu211b.setComp("/ass/dict/data/index");
|
||||
menu211b.setOrnum(211);
|
||||
menu211b.setIcon("ele-Tickets");
|
||||
menu211b.setPid("Ass");
|
||||
menu211b.setCatag(false);
|
||||
menu211b.setAvtag(true);
|
||||
menu211b.setShtag(false);
|
||||
menu211b.setType("M");
|
||||
menu211b.setPorid("sys");
|
||||
menuService.insert(menu211b);
|
||||
|
||||
SysPortalMenu menu212 = new SysPortalMenu();
|
||||
menu212.setId("OaFlowTemp");
|
||||
menu212.setName("流程模板");
|
||||
menu212.setCode("OaFlowTemp");
|
||||
menu212.setPath("/oa/flow/temp");
|
||||
menu212.setComp("/oa/flow/temp/index");
|
||||
menu212.setId("AssNumMain");
|
||||
menu212.setName("编号策略");
|
||||
menu212.setCode("AssNumMain");
|
||||
menu212.setPath("/ass/num/main");
|
||||
menu212.setComp("/ass/num/main/index");
|
||||
menu212.setOrnum(212);
|
||||
menu212.setIcon("ele-Tickets");
|
||||
menu212.setPid("OaFlow");
|
||||
menu212.setCatag(true);
|
||||
menu212.setPid("Ass");
|
||||
menu212.setCatag(false);
|
||||
menu212.setAvtag(true);
|
||||
menu212.setShtag(true);
|
||||
menu212.setType("M");
|
||||
menu212.setPorid("sys");
|
||||
menuService.insert(menu212);
|
||||
|
||||
SysPortalMenu menu212a = new SysPortalMenu();
|
||||
menu212a.setId("OaFlowTempEdit");
|
||||
menu212a.setName("流程模板编辑");
|
||||
menu212a.setCode("OaFlowTempEdit");
|
||||
menu212a.setPath("/oa/flow/temp/edit");
|
||||
menu212a.setComp("/oa/flow/temp/edit");
|
||||
menu212a.setOrnum(2121);
|
||||
menu212a.setIcon("ele-Tickets");
|
||||
menu212a.setPid("OaFlow");
|
||||
menu212a.setCatag(true);
|
||||
menu212a.setAvtag(true);
|
||||
menu212a.setShtag(false);
|
||||
menu212a.setType("M");
|
||||
menu212a.setPorid("sys");
|
||||
menuService.insert(menu212a);
|
||||
|
||||
SysPortalMenu menu213 = new SysPortalMenu();
|
||||
menu213.setId("OaFlowMain");
|
||||
menu213.setName("流程实例");
|
||||
menu213.setCode("OaFlowMain");
|
||||
menu213.setPath("/oa/flow/main");
|
||||
menu213.setComp("/oa/flow/main/index");
|
||||
menu213.setId("AssAddrMain");
|
||||
menu213.setName("省市区县");
|
||||
menu213.setCode("AssAddrMain");
|
||||
menu213.setPath("/ass/addr/main");
|
||||
menu213.setComp("/ass/addr/main/index");
|
||||
menu213.setOrnum(213);
|
||||
menu213.setIcon("ele-Tickets");
|
||||
menu213.setPid("OaFlow");
|
||||
menu213.setCatag(true);
|
||||
menu213.setPid("Ass");
|
||||
menu213.setCatag(false);
|
||||
menu213.setAvtag(true);
|
||||
menu213.setShtag(true);
|
||||
menu213.setType("M");
|
||||
menu213.setPorid("sys");
|
||||
menuService.insert(menu213);
|
||||
|
||||
SysPortalMenu menu213a = new SysPortalMenu();
|
||||
menu213a.setId("OaFlowMainEdit");
|
||||
menu213a.setName("流程实例编辑");
|
||||
menu213a.setCode("OaFlowMainEdit");
|
||||
menu213a.setPath("/oa/flow/main/edit");
|
||||
menu213a.setComp("/oa/flow/main/edit");
|
||||
menu213a.setOrnum(2131);
|
||||
menu213a.setIcon("ele-Tickets");
|
||||
menu213a.setPid("OaFlow");
|
||||
menu213a.setCatag(true);
|
||||
menu213a.setAvtag(true);
|
||||
menu213a.setShtag(false);
|
||||
menu213a.setType("M");
|
||||
menu213a.setPorid("sys");
|
||||
menuService.insert(menu213a);
|
||||
|
||||
SysPortalMenu menu213b = new SysPortalMenu();
|
||||
menu213b.setId("OaFlowMainView");
|
||||
menu213b.setName("流程实例查看");
|
||||
menu213b.setCode("OaFlowMainView");
|
||||
menu213b.setPath("/oa/flow/main/view");
|
||||
menu213b.setComp("/oa/flow/main/view");
|
||||
menu213b.setOrnum(2132);
|
||||
menu213b.setIcon("ele-Tickets");
|
||||
menu213b.setPid("OaFlow");
|
||||
menu213b.setCatag(true);
|
||||
menu213b.setAvtag(true);
|
||||
menu213b.setShtag(false);
|
||||
menu213b.setType("M");
|
||||
menu213b.setPorid("sys");
|
||||
menuService.insert(menu213b);
|
||||
//-----------------OA办公--------------------
|
||||
SysPortalMenu menu3 = new SysPortalMenu();
|
||||
menu3.setId("Oa");
|
||||
menu3.setName("应用中心");
|
||||
menu3.setCode("Oa");
|
||||
menu3.setComp("LAYOUT");
|
||||
menu3.setPath("/oa");
|
||||
menu3.setRedirect("/oa/flow/temp");
|
||||
menu3.setOrnum(3);
|
||||
menu3.setIcon("ele-Menu");
|
||||
menu3.setAvtag(true);
|
||||
menu3.setShtag(true);
|
||||
menu3.setType("D");
|
||||
menu3.setPorid("sys");
|
||||
menuService.insert(menu3);
|
||||
|
||||
SysPortalMenu menu31 = new SysPortalMenu();
|
||||
menu31.setId("OaFlow");
|
||||
menu31.setName("流程管理");
|
||||
menu31.setCode("OaFlow");
|
||||
menu31.setComp("LAYOUT");
|
||||
menu31.setPath("/oa/flow");
|
||||
menu31.setRedirect("/oa/flow/temp");
|
||||
menu31.setOrnum(31);
|
||||
menu31.setIcon("ele-Connection");
|
||||
menu31.setPid("Oa");
|
||||
menu31.setAvtag(true);
|
||||
menu31.setShtag(true);
|
||||
menu31.setType("D");
|
||||
menu31.setPorid("sys");
|
||||
menuService.insert(menu31);
|
||||
|
||||
SysPortalMenu menu311 = new SysPortalMenu();
|
||||
menu311.setId("OaFlowCate");
|
||||
menu311.setName("流程分类");
|
||||
menu311.setCode("OaFlowCate");
|
||||
menu311.setPath("/oa/flow/cate");
|
||||
menu311.setComp("/oa/flow/cate/index");
|
||||
menu311.setOrnum(311);
|
||||
menu311.setIcon("ele-Tickets");
|
||||
menu311.setPid("OaFlow");
|
||||
menu311.setCatag(true);
|
||||
menu311.setAvtag(true);
|
||||
menu311.setShtag(true);
|
||||
menu311.setType("M");
|
||||
menu311.setPorid("sys");
|
||||
menuService.insert(menu311);
|
||||
|
||||
SysPortalMenu menu311a = new SysPortalMenu();
|
||||
menu311a.setId("OaFlowCateEdit");
|
||||
menu311a.setName("流程分类编辑");
|
||||
menu311a.setCode("OaFlowCateEdit");
|
||||
menu311a.setPath("/oa/flow/cate/edit");
|
||||
menu311a.setComp("/oa/flow/cate/edit");
|
||||
menu311a.setOrnum(3111);
|
||||
menu311a.setIcon("ele-Tickets");
|
||||
menu311a.setPid("OaFlow");
|
||||
menu311a.setCatag(true);
|
||||
menu311a.setAvtag(true);
|
||||
menu311a.setShtag(false);
|
||||
menu311a.setType("M");
|
||||
menu311a.setPorid("sys");
|
||||
menuService.insert(menu311a);
|
||||
|
||||
SysPortalMenu menu312 = new SysPortalMenu();
|
||||
menu312.setId("OaFlowTemp");
|
||||
menu312.setName("流程模板");
|
||||
menu312.setCode("OaFlowTemp");
|
||||
menu312.setPath("/oa/flow/temp");
|
||||
menu312.setComp("/oa/flow/temp/index");
|
||||
menu312.setOrnum(312);
|
||||
menu312.setIcon("ele-Tickets");
|
||||
menu312.setPid("OaFlow");
|
||||
menu312.setCatag(true);
|
||||
menu312.setAvtag(true);
|
||||
menu312.setShtag(true);
|
||||
menu312.setType("M");
|
||||
menu312.setPorid("sys");
|
||||
menuService.insert(menu312);
|
||||
|
||||
SysPortalMenu menu312a = new SysPortalMenu();
|
||||
menu312a.setId("OaFlowTempEdit");
|
||||
menu312a.setName("流程模板编辑");
|
||||
menu312a.setCode("OaFlowTempEdit");
|
||||
menu312a.setPath("/oa/flow/temp/edit");
|
||||
menu312a.setComp("/oa/flow/temp/edit");
|
||||
menu312a.setOrnum(3121);
|
||||
menu312a.setIcon("ele-Tickets");
|
||||
menu312a.setPid("OaFlow");
|
||||
menu312a.setCatag(true);
|
||||
menu312a.setAvtag(true);
|
||||
menu312a.setShtag(false);
|
||||
menu312a.setType("M");
|
||||
menu312a.setPorid("sys");
|
||||
menuService.insert(menu312a);
|
||||
|
||||
SysPortalMenu menu313 = new SysPortalMenu();
|
||||
menu313.setId("OaFlowMain");
|
||||
menu313.setName("流程实例");
|
||||
menu313.setCode("OaFlowMain");
|
||||
menu313.setPath("/oa/flow/main");
|
||||
menu313.setComp("/oa/flow/main/index");
|
||||
menu313.setOrnum(313);
|
||||
menu313.setIcon("ele-Tickets");
|
||||
menu313.setPid("OaFlow");
|
||||
menu313.setCatag(true);
|
||||
menu313.setAvtag(true);
|
||||
menu313.setShtag(true);
|
||||
menu313.setType("M");
|
||||
menu313.setPorid("sys");
|
||||
menuService.insert(menu313);
|
||||
|
||||
SysPortalMenu menu313a = new SysPortalMenu();
|
||||
menu313a.setId("OaFlowMainEdit");
|
||||
menu313a.setName("流程实例编辑");
|
||||
menu313a.setCode("OaFlowMainEdit");
|
||||
menu313a.setPath("/oa/flow/main/edit");
|
||||
menu313a.setComp("/oa/flow/main/edit");
|
||||
menu313a.setOrnum(3131);
|
||||
menu313a.setIcon("ele-Tickets");
|
||||
menu313a.setPid("OaFlow");
|
||||
menu313a.setCatag(true);
|
||||
menu313a.setAvtag(true);
|
||||
menu313a.setShtag(false);
|
||||
menu313a.setType("M");
|
||||
menu313a.setPorid("sys");
|
||||
menuService.insert(menu313a);
|
||||
|
||||
SysPortalMenu menu313b = new SysPortalMenu();
|
||||
menu313b.setId("OaFlowMainView");
|
||||
menu313b.setName("流程实例查看");
|
||||
menu313b.setCode("OaFlowMainView");
|
||||
menu313b.setPath("/oa/flow/main/view");
|
||||
menu313b.setComp("/oa/flow/main/view");
|
||||
menu313b.setOrnum(3132);
|
||||
menu313b.setIcon("ele-Tickets");
|
||||
menu313b.setPid("OaFlow");
|
||||
menu313b.setCatag(true);
|
||||
menu313b.setAvtag(true);
|
||||
menu313b.setShtag(false);
|
||||
menu313b.setType("M");
|
||||
menu313b.setPorid("sys");
|
||||
menuService.insert(menu313b);
|
||||
|
||||
|
||||
SysPortalMenu menu8 = new SysPortalMenu();
|
||||
menu8.setId("Demo");
|
||||
menu8.setName("Demo");
|
||||
menu8.setCode("Demo");
|
||||
menu8.setComp("LAYOUT");
|
||||
menu8.setPath("/demo");
|
||||
menu8.setRedirect("/sa/agent/main");
|
||||
menu8.setOrnum(8);
|
||||
menu8.setIcon("ele-GobletSquare");
|
||||
menu8.setAvtag(true);
|
||||
menu8.setShtag(true);
|
||||
menu8.setType("D");
|
||||
menu8.setPorid("sys");
|
||||
menuService.insert(menu8);
|
||||
|
||||
SysPortalMenu menu811 = new SysPortalMenu();
|
||||
menu811.setId("SaAgentMain");
|
||||
menu811.setName("代理商清单");
|
||||
menu811.setCode("SaAgentMain");
|
||||
menu811.setPath("/sa/agent/main");
|
||||
menu811.setComp("/sa/agent/main/index");
|
||||
menu811.setOrnum(811);
|
||||
menu811.setIcon("ele-Tickets");
|
||||
menu811.setPid("Demo");
|
||||
menu811.setCatag(true);
|
||||
menu811.setAvtag(true);
|
||||
menu811.setShtag(true);
|
||||
menu811.setType("M");
|
||||
menu811.setPorid("sys");
|
||||
menuService.insert(menu811);
|
||||
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package vboot.core.init;
|
||||
package vboot.core.common.init;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package vboot.core.init;
|
||||
package vboot.core.common.init;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -8,7 +8,7 @@ import vboot.core.common.entity.BaseCateEntity;
|
||||
import vboot.core.common.pojo.ZidName;
|
||||
import vboot.core.common.pojo.Zinp;
|
||||
import vboot.core.common.pojo.Ztree;
|
||||
import vboot.core.xutil.lang.XstringUtil;
|
||||
import vboot.core.xutil.lang.XstrUtil;
|
||||
import vboot.core.xutil.web.XuserUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
@@ -51,11 +51,11 @@ public abstract class BaseCateService<T extends BaseCateEntity> {
|
||||
Sqler sqler = new Sqler(table);
|
||||
sqler.addSelect("pid");
|
||||
sqler.addWhere("t.avtag = 1");
|
||||
if (XstringUtil.isNotBlank(id)) {
|
||||
if (XstrUtil.isNotBlank(id)) {
|
||||
sqler.addWhere("t.tier not like ?", "%;" + id + ";%");
|
||||
sqler.addWhere("t.id <> ?", id);
|
||||
}
|
||||
if(XstringUtil.isNotBlank(name)){
|
||||
if(XstrUtil.isNotBlank(name)){
|
||||
sqler.addLike("t.name", name);
|
||||
}
|
||||
sqler.addOrder("t.ornum");
|
||||
@@ -67,11 +67,11 @@ public abstract class BaseCateService<T extends BaseCateEntity> {
|
||||
Sqler sqler = new Sqler(table);
|
||||
sqler.addSelect("pid");
|
||||
sqler.addWhere("t.avtag = 1");
|
||||
if (XstringUtil.isNotBlank(id)) {
|
||||
if (XstrUtil.isNotBlank(id)) {
|
||||
sqler.addWhere("t.tier not like ?", "%;" + id + ";%");
|
||||
sqler.addWhere("t.id <> ?", id);
|
||||
}
|
||||
if(XstringUtil.isNotBlank(name)){
|
||||
if(XstrUtil.isNotBlank(name)){
|
||||
sqler.addLike("t.name", name);
|
||||
}
|
||||
sqler.addOrder("t.ornum");
|
||||
@@ -100,7 +100,7 @@ public abstract class BaseCateService<T extends BaseCateEntity> {
|
||||
|
||||
public String insert(T cate) {
|
||||
if(cate.getId()==null||"".equals(cate.getId())){
|
||||
cate.setId(XstringUtil.getUUID());
|
||||
cate.setId(XstrUtil.getUUID());
|
||||
}
|
||||
if(cate.getCrman()==null){
|
||||
cate.setCrman(XuserUtil.getUser());
|
||||
|
||||
@@ -4,7 +4,7 @@ import vboot.core.common.api.PageData;
|
||||
import vboot.core.common.dao.JdbcDao;
|
||||
import vboot.core.common.dao.Sqler;
|
||||
import vboot.core.common.entity.BaseMainEntity;
|
||||
import vboot.core.xutil.lang.XstringUtil;
|
||||
import vboot.core.xutil.lang.XstrUtil;
|
||||
import vboot.core.xutil.web.XuserUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
@@ -55,7 +55,7 @@ public abstract class BaseMainService<T extends BaseMainEntity> {
|
||||
//---------------------------------------增删改-------------------------------------
|
||||
public T insert(T main) {
|
||||
if (main.getId() == null || "".equals(main.getId())) {
|
||||
main.setId(XstringUtil.getUUID());
|
||||
main.setId(XstrUtil.getUUID());
|
||||
}
|
||||
main.setCrtim(new Date());
|
||||
if (main.getCrman() == null) {
|
||||
|
||||
@@ -4,7 +4,7 @@ import vboot.core.common.api.PageData;
|
||||
import vboot.core.common.dao.JdbcDao;
|
||||
import vboot.core.common.dao.Sqler;
|
||||
import vboot.core.common.entity.BaseEntity;
|
||||
import vboot.core.xutil.lang.XstringUtil;
|
||||
import vboot.core.xutil.lang.XstrUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -50,7 +50,7 @@ public abstract class BaseService<T extends BaseEntity> {
|
||||
//---------------------------------------增删改-------------------------------------
|
||||
public T insert(T main) {
|
||||
if (main.getId() == null||"".equals(main.getId())) {
|
||||
main.setId(XstringUtil.getUUID());
|
||||
main.setId(XstrUtil.getUUID());
|
||||
}
|
||||
return repo.save(main);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.parser.ParserConfig;
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import vboot.core.xutil.lang.XstringUtil;
|
||||
import vboot.core.xutil.lang.XstrUtil;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
@@ -188,7 +188,7 @@ class StringRedisSerializer implements RedisSerializer<Object> {
|
||||
@Override
|
||||
public byte[] serialize(Object object) {
|
||||
String string = JSON.toJSONString(object);
|
||||
if (XstringUtil.isBlank(string)) {
|
||||
if (XstrUtil.isBlank(string)) {
|
||||
return null;
|
||||
}
|
||||
string = string.replace("\"", "");
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package vboot.core.module.ass.addr.city;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import vboot.core.common.entity.BaseEntity;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class AssAddrCity extends BaseEntity {
|
||||
|
||||
@Column(length = 32)
|
||||
private String code;
|
||||
|
||||
@Column(length = 64)
|
||||
private String cecoo;
|
||||
|
||||
@Column(length = 32)
|
||||
private String prov;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package vboot.core.module.ass.addr.city;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface AssAddrCityRepo extends JpaRepository<AssAddrCity, String> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package vboot.core.module.ass.addr.dict;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import vboot.core.common.entity.BaseEntity;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class AssAddrDict extends BaseEntity {
|
||||
|
||||
@Column(length = 64)
|
||||
private String cecoo;
|
||||
|
||||
@Column(length = 32)
|
||||
private String city;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package vboot.core.module.ass.addr.dict;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface AssAddrDictRepo extends JpaRepository<AssAddrDict, String> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package vboot.core.module.ass.addr.main;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import vboot.core.common.entity.BaseEntity;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import java.util.Date;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class AssAddrMain extends BaseEntity {
|
||||
@Column(length = 32)
|
||||
private String pid;
|
||||
|
||||
@Column(length = 32)
|
||||
private String cecoo;
|
||||
|
||||
@Column(length = 32)
|
||||
private String type;
|
||||
|
||||
@Column(length = 32)
|
||||
private String code;
|
||||
|
||||
@Column(updatable = false)
|
||||
private Date crtim = new Date();//创建时间
|
||||
|
||||
private Date uptim;//更新时间
|
||||
|
||||
private String notes;//备注信息
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package vboot.core.module.ass.addr.main;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import vboot.core.common.api.RestResult;
|
||||
import vboot.core.common.dao.JdbcDao;
|
||||
import vboot.core.common.dao.Sqler;
|
||||
import vboot.core.xutil.file.ExcelUtil;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("ass/addr/main")
|
||||
public class AssAddrMainApi {
|
||||
@GetMapping
|
||||
public RestResult get(String name) {
|
||||
Sqler sqler = new Sqler("ass_addr_main");
|
||||
sqler.addLike("t.name", name);
|
||||
sqler.addLeftJoin("t2.name as p2name","ass_addr_main t2","t2.id=t.pid");
|
||||
sqler.addLeftJoin("t3.name as p3name","ass_addr_main t3","t3.id=t2.pid");
|
||||
sqler.addLeftJoin("t4.name as p4name","ass_addr_main t4","t4.id=t3.pid");
|
||||
sqler.addSelect("t.type,t.crtim,t.uptim,t.cecoo");
|
||||
sqler.addOrder("t.id");
|
||||
return RestResult.ok(service.findPageData(sqler));
|
||||
}
|
||||
|
||||
@GetMapping("one/{id}")
|
||||
public RestResult getOne(@PathVariable String id) {
|
||||
AssAddrMain main = service.findOne(id);
|
||||
return RestResult.ok(main);
|
||||
}
|
||||
|
||||
@PutMapping("addrupdate")
|
||||
public RestResult addrupdate() {
|
||||
addrHandle.addrInit();
|
||||
return RestResult.ok();
|
||||
}
|
||||
|
||||
@GetMapping("exp")
|
||||
public void getExp(HttpServletResponse response) throws Exception {
|
||||
List<AssAddrMain> list = service.findAll();
|
||||
ExcelUtil.exportExcel(list, "字典数据", AssAddrMain.class, response);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping
|
||||
public RestResult post(@RequestBody AssAddrMain main) {
|
||||
return RestResult.ok(service.insert(main));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
public RestResult put(@RequestBody AssAddrMain main) {
|
||||
return RestResult.ok(service.update(main));
|
||||
}
|
||||
|
||||
@DeleteMapping("{ids}")
|
||||
public RestResult delete(@PathVariable String[] ids) {
|
||||
return RestResult.ok(service.delete(ids));
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private JdbcDao jdbcDao;
|
||||
|
||||
@Autowired
|
||||
private AssAddrMainService service;
|
||||
|
||||
@Autowired
|
||||
private AssAddrMainHand addrHandle;
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
package vboot.core.module.ass.addr.main;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
import vboot.core.module.ass.addr.city.AssAddrCity;
|
||||
import vboot.core.module.ass.addr.city.AssAddrCityRepo;
|
||||
import vboot.core.module.ass.addr.dict.AssAddrDict;
|
||||
import vboot.core.module.ass.addr.dict.AssAddrDictRepo;
|
||||
import vboot.core.module.ass.addr.pojo.*;
|
||||
import vboot.core.module.ass.addr.prov.AssAddrProv;
|
||||
import vboot.core.module.ass.addr.prov.AssAddrProvRepo;
|
||||
import vboot.core.module.ass.addr.stre.AssAddrStre;
|
||||
import vboot.core.module.ass.addr.stre.AssAddrStreRepo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public class AssAddrMainHand {
|
||||
|
||||
public void addrInit() {
|
||||
List<AssAddrProv> provs = getProv();
|
||||
for (AssAddrProv prov : provs) {
|
||||
// System.out.println(prov);
|
||||
addrInitByProv(prov.getName());
|
||||
}
|
||||
}
|
||||
|
||||
@Value("${vboot.amap.key}")
|
||||
private String AMAP_KEY;
|
||||
|
||||
public List<AssAddrProv> getProv() {
|
||||
AresCoun ares = restTemplate.getForObject("https://restapi.amap.com/v3/config/district?key=" + AMAP_KEY + "&keywords=&subdistrict=1&extensions=base", AresCoun.class);
|
||||
// System.out.println(ares.toString());
|
||||
List<AssAddrProv> provs = new ArrayList<>();
|
||||
for (DistrictCoun cout : ares.getDistricts()) {
|
||||
for (DistrictProv prov : cout.getDistricts()) {
|
||||
AssAddrProv myprov = new AssAddrProv();
|
||||
myprov.setId(prov.getAdcode());
|
||||
myprov.setName(prov.getName());
|
||||
myprov.setCecoo(prov.getCenter());
|
||||
provs.add(myprov);
|
||||
}
|
||||
}
|
||||
return provs;
|
||||
}
|
||||
|
||||
|
||||
public void addrInitByProv(String pname) {
|
||||
AresProv ares = restTemplate.getForObject("https://restapi.amap.com/v3/config/district?key=" + AMAP_KEY + "&keywords=" + pname + "&subdistrict=3&extensions=base", AresProv.class);
|
||||
List<AssAddrProv> provs = new ArrayList<>();
|
||||
List<AssAddrCity> citys = new ArrayList<>();
|
||||
List<AssAddrDict> dicts = new ArrayList<>();
|
||||
List<AssAddrStre> stres = new ArrayList<>();
|
||||
List<AssAddrMain> addrs = new ArrayList<>();
|
||||
for (DistrictProv prov : ares.getDistricts()) {
|
||||
//省份表
|
||||
AssAddrProv myprov = new AssAddrProv();
|
||||
myprov.setId(prov.getAdcode());
|
||||
myprov.setName(prov.getName());
|
||||
myprov.setCecoo(prov.getCenter());
|
||||
provs.add(myprov);
|
||||
//集合表(包含省份、城市、地区、街道)
|
||||
AssAddrMain addrProv=new AssAddrMain();
|
||||
addrProv.setId(prov.getAdcode());
|
||||
addrProv.setName(prov.getName());
|
||||
addrProv.setCecoo(prov.getCenter());
|
||||
addrProv.setType("prov");
|
||||
addrs.add(addrProv);
|
||||
for (District city : prov.getDistricts()) {
|
||||
//城市表
|
||||
AssAddrCity mycity = new AssAddrCity();
|
||||
mycity.setId(city.getAdcode());
|
||||
mycity.setName(city.getName());
|
||||
mycity.setCecoo(city.getCenter());
|
||||
mycity.setCode(city.getCitycode());
|
||||
mycity.setProv(prov.getAdcode());
|
||||
citys.add(mycity);
|
||||
//集合表(包含省份、城市、地区、街道)
|
||||
AssAddrMain addrCity = new AssAddrMain();
|
||||
addrCity.setId(city.getAdcode());
|
||||
addrCity.setName(city.getName());
|
||||
addrCity.setCecoo(city.getCenter());
|
||||
addrCity.setCode(city.getCitycode());
|
||||
addrCity.setPid(prov.getAdcode());
|
||||
addrCity.setType("city");
|
||||
addrs.add(addrCity);
|
||||
for (District dict : city.getDistricts()) {
|
||||
//地区表
|
||||
AssAddrDict myDict = new AssAddrDict();
|
||||
myDict.setId(dict.getAdcode());
|
||||
myDict.setName(dict.getName());
|
||||
myDict.setCecoo(dict.getCenter());
|
||||
myDict.setCity(city.getAdcode());
|
||||
dicts.add(myDict);
|
||||
//集合表(包含省份、城市、地区、街道)
|
||||
AssAddrMain addrDict = new AssAddrMain();
|
||||
addrDict.setId(dict.getAdcode());
|
||||
addrDict.setName(dict.getName());
|
||||
addrDict.setCecoo(dict.getCenter());
|
||||
addrDict.setPid(city.getAdcode());
|
||||
addrDict.setType("dict");
|
||||
addrs.add(addrDict);
|
||||
for (District stre : dict.getDistricts()) {
|
||||
//街道表
|
||||
AssAddrStre myStre = new AssAddrStre();
|
||||
myStre.setId(stre.getCenter());
|
||||
myStre.setName(stre.getName());
|
||||
myStre.setCecoo(stre.getCenter());
|
||||
myStre.setDict(dict.getAdcode());
|
||||
stres.add(myStre);
|
||||
//集合表(包含省份、城市、地区、街道)
|
||||
AssAddrMain addrStre = new AssAddrMain();
|
||||
addrStre.setId(stre.getCenter());
|
||||
addrStre.setName(stre.getName());
|
||||
addrStre.setCecoo(stre.getCenter());
|
||||
addrStre.setPid(dict.getAdcode());
|
||||
addrStre.setType("stre");
|
||||
addrs.add(addrStre);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
provRepo.saveAll(provs);
|
||||
cityRepo.saveAll(citys);
|
||||
dictRepo.saveAll(dicts);
|
||||
streRepo.saveAll(stres);
|
||||
mainRepo.saveAll(addrs);
|
||||
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private AssAddrMainRepo mainRepo;
|
||||
|
||||
@Autowired
|
||||
private AssAddrProvRepo provRepo;
|
||||
|
||||
@Autowired
|
||||
private AssAddrCityRepo cityRepo;
|
||||
|
||||
@Autowired
|
||||
private AssAddrDictRepo dictRepo;
|
||||
|
||||
@Autowired
|
||||
private AssAddrStreRepo streRepo;
|
||||
|
||||
@Autowired
|
||||
private RestTemplate restTemplate;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package vboot.core.module.ass.addr.main;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import vboot.core.module.ass.addr.prov.AssAddrProv;
|
||||
|
||||
public interface AssAddrMainRepo extends JpaRepository<AssAddrMain, String> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package vboot.core.module.ass.addr.main;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import vboot.core.common.service.BaseService;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
@Service
|
||||
public class AssAddrMainService extends BaseService<AssAddrMain> {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//----------bean注入------------
|
||||
@Autowired
|
||||
private AssAddrMainRepo repo;
|
||||
|
||||
@PostConstruct
|
||||
public void initDao() {
|
||||
super.setRepo(repo);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package vboot.core.module.ass.addr.pojo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class Apath {
|
||||
private int distance;
|
||||
|
||||
private int duration;
|
||||
|
||||
private String strategy;
|
||||
|
||||
private int tolls;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package vboot.core.module.ass.addr.pojo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class Ares {
|
||||
private int status;
|
||||
|
||||
private String info;
|
||||
|
||||
private int count;
|
||||
|
||||
private Aroute route;
|
||||
|
||||
private int dist;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package vboot.core.module.ass.addr.pojo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class AresCoun {
|
||||
|
||||
private int status;
|
||||
|
||||
private String info;
|
||||
|
||||
private int count;
|
||||
|
||||
private Aroute route;
|
||||
|
||||
private List<DistrictCoun> districts;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package vboot.core.module.ass.addr.pojo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class AresProv {
|
||||
|
||||
private int status;
|
||||
|
||||
private String info;
|
||||
|
||||
private int count;
|
||||
|
||||
private Aroute route;
|
||||
|
||||
private List<DistrictProv> districts;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package vboot.core.module.ass.addr.pojo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class Aroute {
|
||||
|
||||
private String origin;
|
||||
|
||||
private String destination;
|
||||
|
||||
private List<Apath> paths;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package vboot.core.module.ass.addr.pojo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class District {
|
||||
|
||||
private String adcode;
|
||||
|
||||
private String name;
|
||||
|
||||
private String center;
|
||||
|
||||
private String level;
|
||||
|
||||
private String citycode;
|
||||
|
||||
private List<District> districts;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package vboot.core.module.ass.addr.pojo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class DistrictCoun {
|
||||
|
||||
private String adcode;
|
||||
|
||||
private String name;
|
||||
|
||||
private String center;
|
||||
|
||||
private String level;
|
||||
|
||||
private List<DistrictProv> districts;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package vboot.core.module.ass.addr.pojo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class DistrictProv {
|
||||
|
||||
private String adcode;
|
||||
|
||||
private String name;
|
||||
|
||||
private String center;
|
||||
|
||||
private String level;
|
||||
|
||||
private List<District> districts;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package vboot.core.module.ass.addr.prov;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import vboot.core.common.entity.BaseEntity;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class AssAddrProv extends BaseEntity {
|
||||
|
||||
private String cecoo;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package vboot.core.module.ass.addr.prov;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface AssAddrProvRepo extends JpaRepository<AssAddrProv, String> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package vboot.core.module.ass.addr.stre;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import vboot.core.common.entity.BaseEntity;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class AssAddrStre extends BaseEntity {
|
||||
|
||||
@Column(length = 64)
|
||||
private String cecoo;
|
||||
|
||||
@Column(length = 32)
|
||||
private String dict;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package vboot.core.module.ass.addr.stre;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface AssAddrStreRepo extends JpaRepository<AssAddrStre, String> {
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package vboot.core.module.ass.dict.data;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import vboot.core.common.entity.BaseEntity;
|
||||
import vboot.core.common.entity.BaseMainEntity;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
@@ -10,7 +11,7 @@ import javax.persistence.Entity;
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class AssDictData extends BaseEntity {
|
||||
public class AssDictData extends BaseMainEntity {
|
||||
|
||||
private String notes;//备注
|
||||
|
||||
@@ -19,5 +20,6 @@ public class AssDictData extends BaseEntity {
|
||||
|
||||
private Integer ornum;
|
||||
|
||||
|
||||
@Column(length = 32)
|
||||
private String maiid;//字典ID
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
package vboot.core.module.ass.dict.data;
|
||||
|
||||
import vboot.core.common.api.RestResult;
|
||||
import vboot.core.common.dao.JdbcDao;
|
||||
import vboot.core.common.dao.Sqler;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import vboot.core.xutil.lang.XstrUtil;
|
||||
|
||||
|
||||
@RestController
|
||||
@@ -13,13 +15,25 @@ public class AssDictDataApi {
|
||||
private String table = "ass_dict_data";
|
||||
|
||||
@GetMapping
|
||||
public RestResult get(String name) {
|
||||
public RestResult get(String name,String maiid) {
|
||||
Sqler sqler = new Sqler(table);
|
||||
sqler.addLike("t.name", name);
|
||||
if(XstrUtil.isNotBlank(name)){
|
||||
sqler.addWhere("(t.name like ? or t.id like ?)","%"+name+"%","%"+name+"%");
|
||||
}
|
||||
sqler.addEqual("t.maiid", maiid);
|
||||
sqler.addSelect("t.notes,t.ornum,t.code");
|
||||
sqler.addOrder("t.ornum");
|
||||
return RestResult.ok(service.findPageData(sqler));
|
||||
}
|
||||
|
||||
@GetMapping("list")
|
||||
public RestResult getList(String maiid) {
|
||||
Sqler sqler = new Sqler(table);
|
||||
sqler.addEqual("t.maiid",maiid);
|
||||
sqler.addOrder("t.ornum");
|
||||
return RestResult.ok( jdbcDao.findIdNameList(sqler));
|
||||
}
|
||||
|
||||
@GetMapping("one/{id}")
|
||||
public RestResult getOne(@PathVariable String id) {
|
||||
AssDictData main = service.findOne(id);
|
||||
@@ -44,4 +58,7 @@ public class AssDictDataApi {
|
||||
@Autowired
|
||||
private AssDictDataService service;
|
||||
|
||||
@Autowired
|
||||
private JdbcDao jdbcDao;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package vboot.core.module.ass.dict.data;
|
||||
|
||||
import vboot.core.common.service.BaseMainService;
|
||||
import vboot.core.common.service.BaseService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -8,7 +9,7 @@ import javax.annotation.PostConstruct;
|
||||
|
||||
|
||||
@Service
|
||||
public class AssDictDataService extends BaseService<AssDictData> {
|
||||
public class AssDictDataService extends BaseMainService<AssDictData> {
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -14,9 +14,6 @@ public class AssDictMain extends BaseMainEntity {
|
||||
|
||||
private String notes;
|
||||
|
||||
@Column(length = 32)
|
||||
private String code;//编码
|
||||
|
||||
private Integer ornum;
|
||||
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import vboot.core.common.dao.Sqler;
|
||||
import org.dom4j.DocumentException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import vboot.core.xutil.lang.XstrUtil;
|
||||
|
||||
|
||||
@RestController
|
||||
@@ -16,8 +17,11 @@ public class AssDictMainApi {
|
||||
@GetMapping
|
||||
public RestResult get(String name) {
|
||||
Sqler sqler = new Sqler(table);
|
||||
sqler.addLike("t.name", name);
|
||||
if(XstrUtil.isNotBlank(name)){
|
||||
sqler.addWhere("(t.name like ? or t.id like ?)","%"+name+"%","%"+name+"%");
|
||||
}
|
||||
sqler.addSelect("t.notes,t.ornum,t.code");
|
||||
sqler.addOrder("t.ornum");
|
||||
return RestResult.ok(service.findPageData(sqler));
|
||||
}
|
||||
|
||||
@@ -27,6 +31,11 @@ public class AssDictMainApi {
|
||||
return RestResult.ok(main);
|
||||
}
|
||||
|
||||
@GetMapping("list")
|
||||
public RestResult getList() {
|
||||
return RestResult.ok(service.findAll());
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public RestResult post(@RequestBody AssDictMain main) throws DocumentException {
|
||||
return RestResult.ok(service.insert(main));
|
||||
|
||||
@@ -2,7 +2,7 @@ package vboot.core.module.ass.file.att;
|
||||
|
||||
import vboot.core.xutil.file.XfileUtil;
|
||||
import vboot.core.xutil.lang.XdateUtil;
|
||||
import vboot.core.xutil.lang.XstringUtil;
|
||||
import vboot.core.xutil.lang.XstrUtil;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
@@ -42,7 +42,7 @@ public class AssFileAttHandler {
|
||||
}else{
|
||||
pName=fileName;
|
||||
}
|
||||
String uuid = XstringUtil.getUUID();
|
||||
String uuid = XstrUtil.getUUID();
|
||||
String newName = uuid +"."+ sName;
|
||||
int code = newName.hashCode();
|
||||
String dirY = XdateUtil.getYYYY();
|
||||
@@ -86,7 +86,7 @@ public class AssFileAttHandler {
|
||||
}else{
|
||||
pName=fileName;
|
||||
}
|
||||
String uuid = XstringUtil.getUUID();
|
||||
String uuid = XstrUtil.getUUID();
|
||||
String newName = uuid +"."+ sName;
|
||||
int code = newName.hashCode();
|
||||
String dirY = XdateUtil.getYYYY();
|
||||
@@ -129,7 +129,7 @@ public class AssFileAttHandler {
|
||||
}else{
|
||||
pName=fileName;
|
||||
}
|
||||
String uuid = XstringUtil.getUUID();
|
||||
String uuid = XstrUtil.getUUID();
|
||||
String newName = uuid +"."+ sName;
|
||||
int code = newName.hashCode();
|
||||
String dirY = XdateUtil.getYYYY();
|
||||
@@ -170,7 +170,7 @@ public class AssFileAttHandler {
|
||||
String dirY = XdateUtil.getYYYY();
|
||||
String dirM = XdateUtil.getMM();
|
||||
String dirD = XdateUtil.getDD();
|
||||
String uid= XstringUtil.getUUID();
|
||||
String uid= XstrUtil.getUUID();
|
||||
String savePath =dirY + "/" + dirM + "/" + dirD + "/" +uid + ".png";
|
||||
byte2File(b, path + "att/kk/" + "/" + dirY + "/" + dirM + "/" + dirD+"/", uid + ".png");
|
||||
att.setAddress(savePath);
|
||||
|
||||
@@ -5,6 +5,7 @@ import lombok.Data;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import java.util.Date;
|
||||
|
||||
@Entity
|
||||
@Data
|
||||
@@ -20,18 +21,23 @@ public class AssNumMain {
|
||||
private String name;
|
||||
|
||||
@Column(length = 32)
|
||||
private String numod;
|
||||
private String numod;//编号生成模式
|
||||
|
||||
@Column(length = 32)
|
||||
private String nupre;
|
||||
private String nupre;//编号前缀
|
||||
|
||||
private Boolean nflag;
|
||||
|
||||
@Column(length = 8)
|
||||
private String nunex;
|
||||
private String nunex;//下一个编号
|
||||
|
||||
private Integer nulen;
|
||||
private Integer nulen;//编号长度
|
||||
|
||||
@Column(length = 8)
|
||||
private String cudat;
|
||||
private String cudat;//当前日期
|
||||
|
||||
@Column(updatable = false)
|
||||
private Date crtim = new Date();//创建时间
|
||||
|
||||
private Date uptim;//更新时间
|
||||
}
|
||||
|
||||
@@ -2,19 +2,21 @@ package vboot.core.module.ass.num.main;
|
||||
|
||||
import vboot.core.common.api.RestResult;
|
||||
import vboot.core.common.dao.Sqler;
|
||||
import vboot.core.xutil.lang.XstringUtil;
|
||||
import vboot.core.xutil.lang.XstrUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("ass/num/main")
|
||||
public class AssNumMainApi {
|
||||
|
||||
|
||||
@GetMapping
|
||||
public RestResult get(String name) {
|
||||
Sqler sqler = new Sqler("t.*","as_num_main");
|
||||
Sqler sqler = new Sqler("t.*","ass_num_main");
|
||||
sqler.addLike("t.name",name);
|
||||
sqler.addSelect("t.nupre,t.nunex,t.numod");
|
||||
return RestResult.ok(service.findPageData(sqler)) ;
|
||||
}
|
||||
|
||||
@@ -36,9 +38,10 @@ public class AssNumMainApi {
|
||||
|
||||
@PutMapping
|
||||
public RestResult pust(@RequestBody AssNumMain main) {
|
||||
if(XstringUtil.isBlank(main.getNunex())){
|
||||
if(XstrUtil.isBlank(main.getNunex())){
|
||||
main.setNflag(true);
|
||||
}
|
||||
main.setUptim(new Date());
|
||||
repo.save(main);
|
||||
return RestResult.ok();
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package vboot.core.module.ass.num.main;
|
||||
import vboot.core.common.api.PageData;
|
||||
import vboot.core.common.dao.JdbcDao;
|
||||
import vboot.core.common.dao.Sqler;
|
||||
import vboot.core.xutil.lang.XstringUtil;
|
||||
import vboot.core.xutil.lang.XstrUtil;
|
||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -22,11 +22,11 @@ public class AssNumMainService {
|
||||
String firstSerialNum = NumUtil.getFirstSerialNum(num.getNulen());
|
||||
//计算下一个流水号 0002
|
||||
String nextSerialNum = NumUtil.getNextSerialNum(firstSerialNum);
|
||||
//获取系统的当前时间 格式yyyyMMdd 20140906
|
||||
//获取系统的当前时间 格式yyyyMMdd 20220906
|
||||
String curDate = DateFormatUtils.format(new Date(), dateType);
|
||||
|
||||
//生成客户编码
|
||||
//编码前缀+"-"+利用日期位格式生成当前的日期[yyyyMMdd ]+"-"+0001 c-20110914-0001
|
||||
//编码前缀+"-"+利用日期位格式生成当前的日期[yyyyMMdd ]+"-"+0001 c-20220914-0001
|
||||
String back = (num.getNupre() == null ? "" : num.getNupre()) + DateFormatUtils.format(new Date(), dateType) + firstSerialNum;
|
||||
//修改代码规则表
|
||||
//下一个流水号="0002"
|
||||
@@ -115,7 +115,7 @@ public class AssNumMainService {
|
||||
String number = "";
|
||||
switch(num.getNumod()){
|
||||
case "uuid":
|
||||
number = XstringUtil.getUUID();
|
||||
number = XstrUtil.getUUID();
|
||||
break;
|
||||
case "nodate":
|
||||
number = getPureNum(num);
|
||||
|
||||
@@ -3,7 +3,7 @@ package vboot.core.module.bpm.audit.main;
|
||||
|
||||
import vboot.core.module.bpm.proc.main.Zbpm;
|
||||
import vboot.core.module.bpm.proc.main.Znode;
|
||||
import vboot.core.xutil.lang.XstringUtil;
|
||||
import vboot.core.xutil.lang.XstrUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -14,7 +14,7 @@ public class BpmAuditMainService {
|
||||
|
||||
public BpmAuditMain saveDraftAudit(Zbpm zbpm, Znode znode) {
|
||||
BpmAuditMain audit = new BpmAuditMain();
|
||||
audit.setId(XstringUtil.getUUID());
|
||||
audit.setId(XstrUtil.getUUID());
|
||||
audit.setFacno(znode.getFacno());
|
||||
audit.setFacna(znode.getFacna());
|
||||
audit.setNodid(znode.getNodid());
|
||||
@@ -28,7 +28,7 @@ public class BpmAuditMainService {
|
||||
|
||||
public BpmAuditMain saveAudit(Zbpm zbpm) {
|
||||
BpmAuditMain audit = new BpmAuditMain();
|
||||
audit.setId(XstringUtil.getUUID());
|
||||
audit.setId(XstrUtil.getUUID());
|
||||
audit.setFacno(zbpm.getFacno());
|
||||
audit.setFacna(zbpm.getFacna());
|
||||
audit.setNodid(zbpm.getNodid());
|
||||
@@ -43,7 +43,7 @@ public class BpmAuditMainService {
|
||||
|
||||
public BpmAuditMain saveEndAudit(Zbpm zbpm, String nodid) {
|
||||
BpmAuditMain audit = new BpmAuditMain();
|
||||
audit.setId(XstringUtil.getUUID());
|
||||
audit.setId(XstrUtil.getUUID());
|
||||
audit.setFacno("N3");
|
||||
audit.setFacna("结束节点");
|
||||
audit.setNodid(nodid);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package vboot.core.module.bpm.node.hist;
|
||||
|
||||
import vboot.core.xutil.lang.XstringUtil;
|
||||
import vboot.core.xutil.lang.XstrUtil;
|
||||
import vboot.core.module.bpm.node.main.BpmNodeMain;
|
||||
import vboot.core.module.bpm.proc.main.Zbpm;
|
||||
import vboot.core.module.bpm.proc.main.Znode;
|
||||
@@ -25,7 +25,7 @@ public class BpmNodeHistService {
|
||||
startNode.setEntim(new Date());
|
||||
startNode.setTarno("N2");
|
||||
startNode.setTarna("起草节点");
|
||||
startNode.setId(XstringUtil.getUUID());
|
||||
startNode.setId(XstrUtil.getUUID());
|
||||
repo.save(startNode);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public class BpmNodeHistService {
|
||||
endNode.setFacty("end");
|
||||
endNode.setProid(zbpm.getProid());
|
||||
endNode.setState("30");
|
||||
String uuid = XstringUtil.getUUID();
|
||||
String uuid = XstrUtil.getUUID();
|
||||
endNode.setId(uuid);
|
||||
endNode.setEntim(new Date());
|
||||
repo.save(endNode);
|
||||
@@ -67,7 +67,7 @@ public class BpmNodeHistService {
|
||||
node.setTarno(znode.getTarno());
|
||||
node.setTarna(znode.getTarna());
|
||||
node.setState("30");
|
||||
node.setId(XstringUtil.getUUID());
|
||||
node.setId(XstrUtil.getUUID());
|
||||
node.setEntim(new Date());
|
||||
repo.save(node);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package vboot.core.module.bpm.node.main;
|
||||
|
||||
|
||||
import vboot.core.xutil.lang.XstringUtil;
|
||||
import vboot.core.xutil.lang.XstrUtil;
|
||||
import vboot.core.module.bpm.proc.main.Zbpm;
|
||||
import vboot.core.module.bpm.proc.main.Znode;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -19,7 +19,7 @@ public class BpmNodeMainService {
|
||||
node.setFacty(znode.getFacty());
|
||||
node.setProid(zbpm.getProid());
|
||||
node.setState("20");
|
||||
node.setId(XstringUtil.getUUID());
|
||||
node.setId(XstrUtil.getUUID());
|
||||
return repo.save(node);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import vboot.core.common.api.RestResult;
|
||||
import vboot.core.common.dao.JdbcDao;
|
||||
import vboot.core.common.dao.Sqler;
|
||||
import vboot.core.common.pojo.Zinp;
|
||||
import vboot.core.xutil.lang.XstringUtil;
|
||||
import vboot.core.xutil.lang.XstrUtil;
|
||||
import vboot.core.xutil.web.XuserUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -61,7 +61,7 @@ public class BpmProcMainApi {
|
||||
String userid = XuserUtil.getUserId();
|
||||
Zbpm zbpm = new Zbpm();
|
||||
for (Map<String, Object> task : tasks) {
|
||||
if (XstringUtil.isBlank(zbpm.getProid())) {
|
||||
if (XstrUtil.isBlank(zbpm.getProid())) {
|
||||
zbpm.setProid("" + task.get("proid"));
|
||||
zbpm.setNodid("" + task.get("nodid"));
|
||||
zbpm.setFacno("" + task.get("facno"));
|
||||
@@ -94,7 +94,7 @@ public class BpmProcMainApi {
|
||||
String xmlSql = "select t.chxml from bpm_proc_temp t " +
|
||||
"inner join bpm_proc_main m on m.temid=t.id where m.id=?";
|
||||
String chxml = jdbcDao.findOneString(xmlSql, proid);
|
||||
if (bacMap != null && XstringUtil.isNotBlank("" + bacMap.get("paval"))) {
|
||||
if (bacMap != null && XstrUtil.isNotBlank("" + bacMap.get("paval"))) {
|
||||
nextNode = hand.getNodeInfo(chxml, "" + bacMap.get("paval"));
|
||||
} else {
|
||||
nextNode = hand.calcTarget(chxml, facno);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package vboot.core.module.bpm.proc.main;
|
||||
|
||||
import vboot.core.common.service.BaseMainService;
|
||||
import vboot.core.xutil.lang.XstringUtil;
|
||||
import vboot.core.xutil.lang.XstrUtil;
|
||||
import vboot.core.xutil.web.XuserUtil;
|
||||
import vboot.core.module.bpm.audit.main.BpmAuditMainService;
|
||||
import vboot.core.module.bpm.node.hist.BpmNodeHist;
|
||||
@@ -48,7 +48,7 @@ public class BpmProcMainService extends BaseMainService<BpmProcMain> {
|
||||
Znode nextNode = hand.procFlow(zbpm, list, draftNode);//流转核心逻辑
|
||||
|
||||
//4.1 历史节点表保存起草节点
|
||||
draftNode.setNodid(XstringUtil.getUUID());
|
||||
draftNode.setNodid(XstrUtil.getUUID());
|
||||
nodeHistService.saveDraftNode(zbpm, draftNode);
|
||||
//4.2 评审表保存起草节点的评审信息
|
||||
auditMainService.saveDraftAudit(zbpm, draftNode);
|
||||
@@ -83,7 +83,7 @@ public class BpmProcMainService extends BaseMainService<BpmProcMain> {
|
||||
|
||||
//1 评审表保存当前节点的评审信息
|
||||
auditMainService.saveAudit(zbpm);
|
||||
if(XstringUtil.isNotBlank(zbpm.getBacid())){
|
||||
if(XstrUtil.isNotBlank(zbpm.getBacid())){
|
||||
paramService.delete(zbpm.getBacid());
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ public class BpmProcMainService extends BaseMainService<BpmProcMain> {
|
||||
currNode.setNodid(zbpm.getNodid());
|
||||
currNode.setFacno(zbpm.getFacno());
|
||||
currNode.setFacty("review");
|
||||
if(XstringUtil.isNotBlank(zbpm.getBacid())){
|
||||
if(XstrUtil.isNotBlank(zbpm.getBacid())){
|
||||
currNode.setTarno(zbpm.getTarno());
|
||||
currNode.setTarna(zbpm.getTarna());
|
||||
}
|
||||
@@ -208,7 +208,7 @@ public class BpmProcMainService extends BaseMainService<BpmProcMain> {
|
||||
//5.3 如果驳回时勾选了 驳回的节点通过后直接返回本节点
|
||||
if(zbpm.getRetag()==true){
|
||||
BpmProcParam param = new BpmProcParam();
|
||||
param.setId(XstringUtil.getUUID());
|
||||
param.setId(XstrUtil.getUUID());
|
||||
param.setProid(zbpm.getProid());
|
||||
param.setOffty("proc");
|
||||
param.setOffid(zbpm.getProid());
|
||||
|
||||
@@ -5,7 +5,7 @@ import vboot.core.common.dao.JdbcDao;
|
||||
import vboot.core.common.pojo.Zinp;
|
||||
import vboot.core.module.bpm.proc.main.Zbpm;
|
||||
import vboot.core.module.bpm.proc.main.Znode;
|
||||
import vboot.core.xutil.lang.XstringUtil;
|
||||
import vboot.core.xutil.lang.XstrUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -20,7 +20,7 @@ public class BpmTaskMainService {
|
||||
|
||||
public BpmTaskMain createTask(Zbpm zbpm, Znode znode) {
|
||||
BpmTaskMain task = new BpmTaskMain();
|
||||
task.setId(XstringUtil.getUUID());
|
||||
task.setId(XstrUtil.getUUID());
|
||||
task.setProid(zbpm.getProid());
|
||||
task.setState("20");
|
||||
task.setExman(znode.getExman());
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package vboot.core.module.gen.num;
|
||||
|
||||
import vboot.core.common.api.RestResult;
|
||||
import vboot.core.xutil.lang.XstringUtil;
|
||||
import vboot.core.xutil.lang.XstrUtil;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@@ -12,7 +12,7 @@ public class GenNumApi {
|
||||
|
||||
@GetMapping("uuid")
|
||||
public RestResult uuid() {
|
||||
return RestResult.ok(XstringUtil.getUUID());
|
||||
return RestResult.ok(XstrUtil.getUUID());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package vboot.core.module.gen.org.rece;
|
||||
|
||||
import vboot.core.common.dao.JdbcDao;
|
||||
import vboot.core.common.dao.Sqler;
|
||||
import vboot.core.xutil.lang.XstringUtil;
|
||||
import vboot.core.xutil.lang.XstrUtil;
|
||||
import vboot.core.xutil.web.XuserUtil;
|
||||
import vboot.core.module.sys.org.rece.SysOrgRece;
|
||||
import vboot.core.module.sys.org.rece.SysOrgReceRepo;
|
||||
@@ -23,7 +23,7 @@ public class GenOrgReceService {
|
||||
String userid = XuserUtil.getUserId();
|
||||
for (SysOrgRece rece : reces) {
|
||||
rece.setOrgid(rece.getId());
|
||||
rece.setId(XstringUtil.getUUID());
|
||||
rece.setId(XstrUtil.getUUID());
|
||||
rece.setUserid(userid);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package vboot.core.module.gen.org.root;
|
||||
import vboot.core.common.api.RestResult;
|
||||
import vboot.core.common.dao.JdbcDao;
|
||||
import vboot.core.common.dao.Sqler;
|
||||
import vboot.core.xutil.lang.XstringUtil;
|
||||
import vboot.core.xutil.lang.XstrUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -21,12 +21,12 @@ public class GenOrgMainApi {
|
||||
@GetMapping()
|
||||
public RestResult get(String deptid, Integer type, String name) {
|
||||
List<Map<String, Object>> mapList = new ArrayList<>();
|
||||
if(XstringUtil.isBlank(name)&&XstringUtil.isBlank(deptid)){
|
||||
if(XstrUtil.isBlank(name)&& XstrUtil.isBlank(deptid)){
|
||||
return RestResult.ok(mapList);
|
||||
}
|
||||
if ((type & 2) != 0) {//部门
|
||||
Sqler deptSqler = new Sqler("sys_org_dept");
|
||||
if(XstringUtil.isNotBlank(name)){
|
||||
if(XstrUtil.isNotBlank(name)){
|
||||
deptSqler.addLike("t.name", name);
|
||||
}else{
|
||||
deptSqler.addEqual("t.pid", deptid);
|
||||
@@ -35,7 +35,7 @@ public class GenOrgMainApi {
|
||||
}
|
||||
if ((type & 4) != 0) {//岗位
|
||||
Sqler postSqler = new Sqler("sys_org_post");
|
||||
if(XstringUtil.isNotBlank(name)){
|
||||
if(XstrUtil.isNotBlank(name)){
|
||||
postSqler.addLike("t.name", name);
|
||||
}else{
|
||||
postSqler.addEqual("t.deptid", deptid);
|
||||
@@ -44,7 +44,7 @@ public class GenOrgMainApi {
|
||||
}
|
||||
if ((type & 8) != 0) {//用户
|
||||
Sqler userSqler = new Sqler("sys_org_user");
|
||||
if(XstringUtil.isNotBlank(name)){
|
||||
if(XstrUtil.isNotBlank(name)){
|
||||
userSqler.addLike("t.name", name);
|
||||
}else{
|
||||
userSqler.addEqual("t.deptid", deptid);
|
||||
|
||||
@@ -3,7 +3,7 @@ package vboot.core.module.gen.sys.org;
|
||||
import vboot.core.common.api.RestResult;
|
||||
import vboot.core.common.dao.JdbcDao;
|
||||
import vboot.core.common.dao.Sqler;
|
||||
import vboot.core.xutil.lang.XstringUtil;
|
||||
import vboot.core.xutil.lang.XstrUtil;
|
||||
import vboot.core.security.pojo.Zuser;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -29,7 +29,7 @@ public class GenOrgApi {
|
||||
public RestResult getChoose(String name, String type) {
|
||||
Sqler sqlHelper = new Sqler("id,pid,name","sys_org_main");
|
||||
sqlHelper.addWhere("t.avtag = 1");
|
||||
sqlHelper.addWhere(XstringUtil.isNotBlank(type),"type in ("+type+")");
|
||||
sqlHelper.addWhere(XstrUtil.isNotBlank(type),"type in ("+type+")");
|
||||
sqlHelper.addLike("name",name);
|
||||
sqlHelper.addEqual("t.label", "ekp");
|
||||
return RestResult.ok(jdbcDao.findInpList(sqlHelper));
|
||||
@@ -41,7 +41,7 @@ public class GenOrgApi {
|
||||
sqlHelper.addLeftJoin("t2.name as pid", "sys_org t2", "t2.id=t.pid");
|
||||
sqlHelper.addWhere("t.avtag = 1");
|
||||
sqlHelper.addLike("t.name",name);
|
||||
sqlHelper.addWhere(XstringUtil.isNotBlank(type),"t.type in ("+type+")");
|
||||
sqlHelper.addWhere(XstrUtil.isNotBlank(type),"t.type in ("+type+")");
|
||||
return RestResult.ok(jdbcDao.findInpList(sqlHelper));
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class GenOrgApi {
|
||||
Sqler sqlHelper = new Sqler("t.id,t.name","sys_org_main");
|
||||
sqlHelper.addLeftJoin("t2.name as pid", "sys_org t2", "t2.id=t.pid");
|
||||
sqlHelper.addWhere("t.avtag = 1");
|
||||
sqlHelper.addWhere(XstringUtil.isNotBlank(type),"t.type in ("+type+")");
|
||||
sqlHelper.addWhere(XstrUtil.isNotBlank(type),"t.type in ("+type+")");
|
||||
sqlHelper.addWhere("t.pid = ?",id);
|
||||
return RestResult.ok(jdbcDao.findInpList(sqlHelper));
|
||||
}
|
||||
|
||||
@@ -4,8 +4,7 @@ import vboot.core.common.dao.JdbcDao;
|
||||
import vboot.core.common.api.RestResult;
|
||||
import vboot.core.common.dao.Sqler;
|
||||
import vboot.core.common.pojo.Zinp;
|
||||
import vboot.core.module.sys.portal.menu.SysPortalMenu;
|
||||
import vboot.core.xutil.lang.XstringUtil;
|
||||
import vboot.core.xutil.lang.XstrUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -42,7 +41,7 @@ public class SysApiMainApi {
|
||||
|
||||
@GetMapping("type")
|
||||
public RestResult type(String type) {
|
||||
if(XstringUtil.isNotBlank(type)){
|
||||
if(XstrUtil.isNotBlank(type)){
|
||||
List<Zinp> stores=jdbcDao.findInpList("select id,pid from sys_api_main where pid like ?",type+"%");
|
||||
return RestResult.ok(stores);
|
||||
}else{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package vboot.core.module.sys.api.main;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
import vboot.core.init.SysApiCache;
|
||||
import vboot.core.common.init.SysApiCache;
|
||||
import vboot.core.security.pojo.Zuser;
|
||||
|
||||
@Component
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package vboot.core.module.sys.job.main;
|
||||
|
||||
import cn.hutool.core.lang.ClassScanner;
|
||||
import vboot.core.xutil.lang.XstringUtil;
|
||||
import vboot.core.xutil.lang.XstrUtil;
|
||||
import vboot.core.module.sys.job.root.IJobGroup;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import vboot.core.module.sys.job.root.IJob;
|
||||
@@ -67,15 +67,15 @@ public class SysJobMainService {
|
||||
if (xjob != null)
|
||||
{
|
||||
SysJobMain job = new SysJobMain();
|
||||
job.setId(XstringUtil.getUUID());
|
||||
job.setId(XstrUtil.getUUID());
|
||||
job.setCron(xjob.cron());
|
||||
job.setJgroup(XstringUtil.toLowerfirst(clazz.getSimpleName()));
|
||||
job.setJgroup(XstrUtil.toLowerfirst(clazz.getSimpleName()));
|
||||
job.setName(xjob.name());
|
||||
job.setJid(method.getName());
|
||||
job.setReurl(job.getJgroup()+"/"+job.getJid());
|
||||
job.setAvtag(false);
|
||||
job.setRetyp(0);
|
||||
if(XstringUtil.isBlank(xjob.code())){
|
||||
if(XstrUtil.isBlank(xjob.code())){
|
||||
job.setCode(job.getReurl());
|
||||
}else{
|
||||
job.setCode(xjob.code());
|
||||
|
||||
@@ -3,7 +3,7 @@ package vboot.core.module.sys.job.root;
|
||||
import vboot.core.module.sys.job.log.SysJobLog;
|
||||
import vboot.core.module.sys.job.log.SysJobLogRepo;
|
||||
import vboot.core.module.sys.job.main.SysJobMain;
|
||||
import vboot.core.xutil.lang.XstringUtil;
|
||||
import vboot.core.xutil.lang.XstrUtil;
|
||||
import vboot.core.xutil.lang.XtimeUtil;
|
||||
import vboot.core.xutil.web.XspringUtil;
|
||||
import org.quartz.Job;
|
||||
@@ -20,7 +20,7 @@ public class SysJobFactory implements Job {
|
||||
SysJobMain job = (SysJobMain) context.getMergedJobDataMap().get("job");
|
||||
Method method = ReflectionUtils.findMethod(XspringUtil.getBean(job.getJgroup()).getClass(), job.getJid());
|
||||
SysJobLog log = new SysJobLog();
|
||||
log.setId(XstringUtil.getUUID());
|
||||
log.setId(XstrUtil.getUUID());
|
||||
SysJobLogRepo syJobMlogDao= (SysJobLogRepo) XspringUtil.getBean("sysJobLogRepo");
|
||||
log.setName(job.getName());
|
||||
long start = System.currentTimeMillis();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package vboot.core.module.sys.log.login;
|
||||
|
||||
import cn.hutool.extra.servlet.ServletUtil;
|
||||
import vboot.core.xutil.lang.XstringUtil;
|
||||
import vboot.core.xutil.lang.XstrUtil;
|
||||
import vboot.core.xutil.web.XaddressUtil;
|
||||
import vboot.core.security.pojo.Zuser;
|
||||
import eu.bitwalker.useragentutils.Browser;
|
||||
@@ -25,7 +25,7 @@ public class SysLogLoginService {
|
||||
public void save(Zuser zuser, HttpServletRequest request){
|
||||
|
||||
SysLogLogin logLogin = new SysLogLogin();
|
||||
logLogin.setId(XstringUtil.getUUID());
|
||||
logLogin.setId(XstrUtil.getUUID());
|
||||
try {
|
||||
String agent = request.getHeader("User-Agent");
|
||||
UserAgent userAgent = UserAgent.parseUserAgentString(agent);
|
||||
|
||||
@@ -3,7 +3,7 @@ package vboot.core.module.sys.org.dept;
|
||||
import vboot.core.common.api.RestResult;
|
||||
import vboot.core.common.dao.JdbcDao;
|
||||
import vboot.core.common.dao.Sqler;
|
||||
import vboot.core.xutil.lang.XstringUtil;
|
||||
import vboot.core.xutil.lang.XstrUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -18,13 +18,13 @@ public class SysOrgDeptApi {
|
||||
@GetMapping
|
||||
public RestResult get(String name, String pid,String notes) {
|
||||
Sqler sqler = new Sqler(table);
|
||||
if (XstringUtil.isNotBlank(name)) {
|
||||
if (XstrUtil.isNotBlank(name)) {
|
||||
sqler.addLike("t.name", name);
|
||||
} else {
|
||||
if("".equals(pid)){
|
||||
sqler.addWhere("t.pid is null");
|
||||
}
|
||||
else if (XstringUtil.isNotBlank(pid)) {
|
||||
else if (XstrUtil.isNotBlank(pid)) {
|
||||
sqler.addEqual("t.pid", pid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import vboot.core.common.dao.JdbcDao;
|
||||
import vboot.core.common.dao.Sqler;
|
||||
import vboot.core.common.pojo.ZidName;
|
||||
import vboot.core.common.api.PageData;
|
||||
import vboot.core.xutil.lang.XstringUtil;
|
||||
import vboot.core.xutil.lang.XstrUtil;
|
||||
import vboot.core.module.sys.org.root.SysOrgRepo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
||||
@@ -31,7 +31,7 @@ public class SysOrgDeptService {
|
||||
List<SysOrg> orgList = new ArrayList<>();
|
||||
for (SysOrgDept main : list) {
|
||||
if (main.getId() == null || "".equals(main.getId())) {
|
||||
main.setId(XstringUtil.getUUID());
|
||||
main.setId(XstrUtil.getUUID());
|
||||
}
|
||||
if (main.getParent() == null || StrUtil.isBlank(main.getParent().getId())) {
|
||||
main.setTier("x" + main.getId() + "x");
|
||||
@@ -48,7 +48,7 @@ public class SysOrgDeptService {
|
||||
|
||||
public SysOrgDept insert(SysOrgDept main) {
|
||||
if (main.getId() == null || "".equals(main.getId())) {
|
||||
main.setId(XstringUtil.getUUID());
|
||||
main.setId(XstrUtil.getUUID());
|
||||
}
|
||||
if (main.getParent() == null || StrUtil.isBlank(main.getParent().getId())) {
|
||||
main.setTier("x" + main.getId() + "x");
|
||||
|
||||
@@ -6,7 +6,7 @@ import vboot.core.module.sys.org.root.SysOrgRepo;
|
||||
import vboot.core.common.dao.JdbcDao;
|
||||
import vboot.core.common.dao.Sqler;
|
||||
import vboot.core.common.api.PageData;
|
||||
import vboot.core.xutil.lang.XstringUtil;
|
||||
import vboot.core.xutil.lang.XstrUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -29,7 +29,7 @@ public class SysOrgGroupService {
|
||||
|
||||
public SysOrgGroup insert(SysOrgGroup main) {
|
||||
if (main.getId() == null || "".equals(main.getId())) {
|
||||
main.setId(XstringUtil.getUUID());
|
||||
main.setId(XstrUtil.getUUID());
|
||||
}
|
||||
SysOrg sysOrg = new SysOrg(main.getId(), main.getName());
|
||||
orgRepo.save(sysOrg);
|
||||
|
||||
@@ -5,7 +5,7 @@ import vboot.core.common.dao.JdbcDao;
|
||||
import vboot.core.common.dao.Sqler;
|
||||
import vboot.core.module.sys.org.root.SysOrg;
|
||||
import vboot.core.common.api.PageData;
|
||||
import vboot.core.xutil.lang.XstringUtil;
|
||||
import vboot.core.xutil.lang.XstrUtil;
|
||||
import vboot.core.module.sys.org.root.SysOrgRepo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -24,7 +24,7 @@ public class SysOrgPostService {
|
||||
|
||||
public SysOrgPost insert(SysOrgPost main) {
|
||||
if (main.getId() == null || "".equals(main.getId())) {
|
||||
main.setId(XstringUtil.getUUID());
|
||||
main.setId(XstrUtil.getUUID());
|
||||
}
|
||||
if (main.getDept() == null || StrUtil.isBlank(main.getDept().getId())) {
|
||||
main.setTier("x" + main.getId() + "x");
|
||||
|
||||
@@ -2,7 +2,7 @@ package vboot.core.module.sys.org.user;
|
||||
|
||||
import vboot.core.common.api.RestResult;
|
||||
import vboot.core.common.dao.Sqler;
|
||||
import vboot.core.xutil.lang.XstringUtil;
|
||||
import vboot.core.xutil.lang.XstrUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -17,12 +17,12 @@ public class SysOrgUserApi {
|
||||
@GetMapping
|
||||
public RestResult get(String deptid, String name, String usnam, String ninam, String monum) {
|
||||
Sqler sqler = new Sqler(table);
|
||||
if (XstringUtil.isNotBlank(name)||XstringUtil.isNotBlank(usnam)||XstringUtil.isNotBlank(ninam)||XstringUtil.isNotBlank(monum)) {
|
||||
if (XstrUtil.isNotBlank(name)|| XstrUtil.isNotBlank(usnam)|| XstrUtil.isNotBlank(ninam)|| XstrUtil.isNotBlank(monum)) {
|
||||
sqler.addLike("t.name", name);
|
||||
sqler.addLike("t.usnam", usnam);
|
||||
sqler.addLike("t.ninam", ninam);
|
||||
sqler.addLike("t.monum", monum);
|
||||
} else if (XstringUtil.isNotBlank(deptid)){
|
||||
} else if (XstrUtil.isNotBlank(deptid)){
|
||||
sqler.addEqual("t.deptid", deptid);
|
||||
}
|
||||
sqler.addSelect("t.crtim,t.uptim,t.deptid,t.notes");
|
||||
|
||||
@@ -6,7 +6,7 @@ import vboot.core.module.sys.org.root.SysOrgRepo;
|
||||
import vboot.core.common.dao.JdbcDao;
|
||||
import vboot.core.common.dao.Sqler;
|
||||
import vboot.core.common.api.PageData;
|
||||
import vboot.core.xutil.lang.XstringUtil;
|
||||
import vboot.core.xutil.lang.XstrUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -30,7 +30,7 @@ public class SysOrgUserService {
|
||||
List<SysOrg> orgList = new ArrayList<>();
|
||||
for (SysOrgUser main : list) {
|
||||
if (main.getId() == null || "".equals(main.getId())) {
|
||||
main.setId(XstringUtil.getUUID());
|
||||
main.setId(XstrUtil.getUUID());
|
||||
}
|
||||
if (main.getDept() == null || StrUtil.isBlank(main.getDept().getId())) {
|
||||
main.setTier("x" + main.getId() + "x");
|
||||
@@ -49,7 +49,7 @@ public class SysOrgUserService {
|
||||
|
||||
public SysOrgUser insert(SysOrgUser main) {
|
||||
if (main.getId() == null || "".equals(main.getId())) {
|
||||
main.setId(XstringUtil.getUUID());
|
||||
main.setId(XstrUtil.getUUID());
|
||||
}
|
||||
if (main.getDept() == null || StrUtil.isBlank(main.getDept().getId())) {
|
||||
main.setTier("x" + main.getId() + "x");
|
||||
|
||||
@@ -5,10 +5,8 @@ import org.springframework.web.bind.annotation.*;
|
||||
import vboot.core.common.api.RestResult;
|
||||
import vboot.core.common.dao.JdbcDao;
|
||||
import vboot.core.common.dao.Sqler;
|
||||
import vboot.core.xutil.lang.XstringUtil;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
|
||||
+2
-2
@@ -7,7 +7,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import vboot.core.common.dao.JdbcDao;
|
||||
import vboot.core.common.dao.Sqler;
|
||||
import vboot.core.xutil.lang.XstringUtil;
|
||||
import vboot.core.xutil.lang.XstrUtil;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -24,7 +24,7 @@ public class SysPortalMenuService {
|
||||
|
||||
public SysPortalMenu insert(SysPortalMenu main) {
|
||||
if (main.getId() == null || "".equals(main.getId())) {
|
||||
main.setId(XstringUtil.getUUID());
|
||||
main.setId(XstrUtil.getUUID());
|
||||
}
|
||||
return repo.save(main);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package vboot.core.module.sys.todo.main;
|
||||
import vboot.core.module.bpm.proc.main.Zbpm;
|
||||
import vboot.core.module.bpm.proc.main.Znode;
|
||||
import vboot.core.common.dao.JdbcDao;
|
||||
import vboot.core.xutil.lang.XstringUtil;
|
||||
import vboot.core.xutil.lang.XstrUtil;
|
||||
import vboot.core.module.sys.todo.done.SysTodoDone;
|
||||
import vboot.core.module.sys.todo.done.SysTodoDoneRepo;
|
||||
import vboot.core.module.sys.todo.user.SysTodoUser;
|
||||
@@ -22,14 +22,14 @@ public class SysTodoMainService {
|
||||
|
||||
public void sendTodo(Zbpm zbpm, Znode znode) {
|
||||
SysTodoMain todo = new SysTodoMain();
|
||||
todo.setId(XstringUtil.getUUID());
|
||||
todo.setId(XstrUtil.getUUID());
|
||||
todo.setName(zbpm.getProna());
|
||||
todo.setLink("/#/page/ofmv?id="+zbpm.getProid());
|
||||
todo.setModid(zbpm.getProid());
|
||||
|
||||
|
||||
SysTodoUser todoTarget = new SysTodoUser();
|
||||
todoTarget.setId(XstringUtil.getUUID());
|
||||
todoTarget.setId(XstrUtil.getUUID());
|
||||
todoTarget.setTid(todo.getId());
|
||||
todoTarget.setUid(znode.getExman());
|
||||
repo.save(todo);
|
||||
@@ -44,7 +44,7 @@ public class SysTodoMainService {
|
||||
jdbcDao.update(delsql,map.get("tid"));
|
||||
|
||||
SysTodoDone done = new SysTodoDone();
|
||||
done.setId(XstringUtil.getUUID());
|
||||
done.setId(XstrUtil.getUUID());
|
||||
done.setTid(""+map.get("id"));
|
||||
done.setUid(zbpm.getHaman());
|
||||
doneRepo.save(done);
|
||||
@@ -54,7 +54,7 @@ public class SysTodoMainService {
|
||||
|
||||
public SysTodoMain insert(SysTodoMain main) {
|
||||
if (main.getId() == null || "".equals(main.getId())) {
|
||||
main.setId(XstringUtil.getUUID());
|
||||
main.setId(XstrUtil.getUUID());
|
||||
}
|
||||
main.setCrtim(new Date());
|
||||
return repo.save(main);
|
||||
|
||||
@@ -97,7 +97,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
//配置security忽略的请求与资源
|
||||
@Override
|
||||
public void configure(WebSecurity web) {
|
||||
web.ignoring().antMatchers("/","/assets/**","/druid/**","/login", "/index.html","/vben.html","/vue.html","/favicon.ico","/resource/**","/_app.config.js");
|
||||
web.ignoring().antMatchers("/","/assets/**","/ass/**","/druid/**","/login", "/index.html","/vben.html","/vue.html","/favicon.ico","/resource/**","/_app.config.js");
|
||||
// web.ignoring().antMatchers("/","/login","/getMenuList","/getUserInfo","/assets/**","/druid/**", "/index.html","/vben.html","/vue.html","/favicon.ico","/resource/**","/_app.config.js");
|
||||
// web.ignoring().antMatchers("/assets/**","/**");
|
||||
}
|
||||
|
||||
@@ -19,15 +19,13 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import vboot.core.xutil.lang.XstringUtil;
|
||||
import vboot.core.xutil.lang.XstrUtil;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import javax.websocket.server.PathParam;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@@ -116,7 +114,7 @@ public class AuthcApi {
|
||||
|
||||
UserDo userDo = jdbcDao.getTp().queryForObject("select id,name,pacod,retag from sys_org_user where id=? and avtag=1",
|
||||
new Object[]{zuser.getId()}, new BeanPropertyRowMapper<>(UserDo.class));
|
||||
if(XstringUtil.isBlank(porid)){
|
||||
if(XstrUtil.isBlank(porid)){
|
||||
authcService.initZuser(zuser, userDo, backMap);
|
||||
}else{
|
||||
authcService.initZuser2(zuser, backMap,porid);
|
||||
|
||||
@@ -4,8 +4,8 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
||||
import vboot.core.common.dao.JdbcDao;
|
||||
import vboot.core.init.SysApiCache;
|
||||
import vboot.core.init.Yapi;
|
||||
import vboot.core.common.init.SysApiCache;
|
||||
import vboot.core.common.init.Yapi;
|
||||
import vboot.core.security.pojo.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -0,0 +1,159 @@
|
||||
package vboot.core.xutil.file;
|
||||
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.NoArgsConstructor;
|
||||
import vboot.core.xutil.file.excel.DefaultExcelListener;
|
||||
import vboot.core.xutil.file.excel.ExcelBigNumberConvert;
|
||||
import vboot.core.xutil.file.excel.ExcelListener;
|
||||
import vboot.core.xutil.file.excel.ExcelResult;
|
||||
import vboot.core.xutil.lang.StringUtils;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Excel相关处理
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
public class ExcelUtil {
|
||||
|
||||
/**
|
||||
* 同步导入(适用于小数据量)
|
||||
*
|
||||
* @param is 输入流
|
||||
* @return 转换后集合
|
||||
*/
|
||||
public static <T> List<T> importExcel(InputStream is, Class<T> clazz) {
|
||||
return EasyExcel.read(is).head(clazz).autoCloseStream(false).sheet().doReadSync();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 使用校验监听器 异步导入 同步返回
|
||||
*
|
||||
* @param is 输入流
|
||||
* @param clazz 对象类型
|
||||
* @param isValidate 是否 Validator 检验 默认为是
|
||||
* @return 转换后集合
|
||||
*/
|
||||
public static <T> ExcelResult<T> importExcel(InputStream is, Class<T> clazz, boolean isValidate) {
|
||||
DefaultExcelListener<T> listener = new DefaultExcelListener<>(isValidate);
|
||||
EasyExcel.read(is, clazz, listener).sheet().doRead();
|
||||
return listener.getExcelResult();
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用自定义监听器 异步导入 自定义返回
|
||||
*
|
||||
* @param is 输入流
|
||||
* @param clazz 对象类型
|
||||
* @param listener 自定义监听器
|
||||
* @return 转换后集合
|
||||
*/
|
||||
public static <T> ExcelResult<T> importExcel(InputStream is, Class<T> clazz, ExcelListener<T> listener) {
|
||||
EasyExcel.read(is, clazz, listener).sheet().doRead();
|
||||
return listener.getExcelResult();
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param list 导出数据集合
|
||||
* @param sheetName 工作表的名称
|
||||
* @return 结果
|
||||
*/
|
||||
public static <T> void exportExcel(List<T> list, String sheetName, Class<T> clazz, HttpServletResponse response) {
|
||||
try {
|
||||
String filename = encodingFilename(sheetName);
|
||||
// response.reset();
|
||||
FileUtils.setAttachmentResponseHeader(response, filename);
|
||||
// response.setContentType("application/vnd.ms-excel");
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8");
|
||||
// response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8");
|
||||
ServletOutputStream os = response.getOutputStream();
|
||||
EasyExcel.write(os, clazz)
|
||||
.autoCloseStream(false)
|
||||
// 自动适配
|
||||
.registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
|
||||
// 大数值自动转换 防止失真
|
||||
.registerConverter(new ExcelBigNumberConvert())
|
||||
.sheet(sheetName).doWrite(list);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("导出Excel异常");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析导出值 0=男,1=女,2=未知
|
||||
*
|
||||
* @param propertyValue 参数值
|
||||
* @param converterExp 翻译注解
|
||||
* @param separator 分隔符
|
||||
* @return 解析后值
|
||||
*/
|
||||
public static String convertByExp(String propertyValue, String converterExp, String separator) {
|
||||
StringBuilder propertyString = new StringBuilder();
|
||||
String[] convertSource = converterExp.split(",");
|
||||
for (String item : convertSource) {
|
||||
String[] itemArray = item.split("=");
|
||||
if (StringUtils.containsAny(separator, propertyValue)) {
|
||||
for (String value : propertyValue.split(separator)) {
|
||||
if (itemArray[0].equals(value)) {
|
||||
propertyString.append(itemArray[1] + separator);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (itemArray[0].equals(propertyValue)) {
|
||||
return itemArray[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
return StringUtils.stripEnd(propertyString.toString(), separator);
|
||||
}
|
||||
|
||||
/**
|
||||
* 反向解析值 男=0,女=1,未知=2
|
||||
*
|
||||
* @param propertyValue 参数值
|
||||
* @param converterExp 翻译注解
|
||||
* @param separator 分隔符
|
||||
* @return 解析后值
|
||||
*/
|
||||
public static String reverseByExp(String propertyValue, String converterExp, String separator) {
|
||||
StringBuilder propertyString = new StringBuilder();
|
||||
String[] convertSource = converterExp.split(",");
|
||||
for (String item : convertSource) {
|
||||
String[] itemArray = item.split("=");
|
||||
if (StringUtils.containsAny(separator, propertyValue)) {
|
||||
for (String value : propertyValue.split(separator)) {
|
||||
if (itemArray[1].equals(value)) {
|
||||
propertyString.append(itemArray[0] + separator);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (itemArray[1].equals(propertyValue)) {
|
||||
return itemArray[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
return StringUtils.stripEnd(propertyString.toString(), separator);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编码文件名
|
||||
*/
|
||||
public static String encodingFilename(String filename) {
|
||||
// return IdUtil.fastSimpleUUID() + "_" + filename + ".xlsx";
|
||||
return filename + ".xlsx";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package vboot.core.xutil.file;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* 文件处理工具类
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
public class FileUtils extends FileUtil {
|
||||
|
||||
/**
|
||||
* 下载文件名重新编码
|
||||
*
|
||||
* @param response 响应对象
|
||||
* @param realFileName 真实文件名
|
||||
*/
|
||||
public static void setAttachmentResponseHeader(HttpServletResponse response, String realFileName) throws UnsupportedEncodingException {
|
||||
String percentEncodedFileName = percentEncode(realFileName);
|
||||
|
||||
StringBuilder contentDispositionValue = new StringBuilder();
|
||||
contentDispositionValue.append("attachment; filename=")
|
||||
.append(percentEncodedFileName)
|
||||
.append(";")
|
||||
.append("filename*=")
|
||||
.append("utf-8''")
|
||||
.append(percentEncodedFileName);
|
||||
|
||||
response.addHeader("Access-Control-Expose-Headers", "Content-Disposition,download-filename");
|
||||
response.setHeader("Content-disposition", contentDispositionValue.toString());
|
||||
response.setHeader("download-filename", percentEncodedFileName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 百分号编码工具方法
|
||||
*
|
||||
* @param s 需要百分号编码的字符串
|
||||
* @return 百分号编码后的字符串
|
||||
*/
|
||||
public static String percentEncode(String s) throws UnsupportedEncodingException {
|
||||
String encode = URLEncoder.encode(s, StandardCharsets.UTF_8.toString());
|
||||
return encode.replaceAll("\\+", "%20");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package vboot.core.xutil.file.excel;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.excel.context.AnalysisContext;
|
||||
import com.alibaba.excel.event.AnalysisEventListener;
|
||||
import com.alibaba.excel.exception.ExcelAnalysisException;
|
||||
import com.alibaba.excel.exception.ExcelDataConvertException;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import vboot.core.xutil.lang.JsonUtils;
|
||||
|
||||
import javax.validation.ConstraintViolation;
|
||||
import javax.validation.ConstraintViolationException;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Excel 导入监听
|
||||
*
|
||||
* @author Yjoioooo
|
||||
* @author Lion Li
|
||||
*/
|
||||
@Slf4j
|
||||
@NoArgsConstructor
|
||||
public class DefaultExcelListener<T> extends AnalysisEventListener<T> implements ExcelListener<T> {
|
||||
|
||||
/**
|
||||
* 是否Validator检验,默认为是
|
||||
*/
|
||||
private Boolean isValidate = Boolean.TRUE;
|
||||
|
||||
/**
|
||||
* excel 表头数据
|
||||
*/
|
||||
private Map<Integer, String> headMap;
|
||||
|
||||
/**
|
||||
* 导入回执
|
||||
*/
|
||||
private ExcelResult<T> excelResult;
|
||||
|
||||
public DefaultExcelListener(boolean isValidate) {
|
||||
this.excelResult = new DefautExcelResult<>();
|
||||
this.isValidate = isValidate;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理异常
|
||||
*
|
||||
* @param exception ExcelDataConvertException
|
||||
* @param context Excel 上下文
|
||||
*/
|
||||
@Override
|
||||
public void onException(Exception exception, AnalysisContext context) throws Exception {
|
||||
String errMsg = null;
|
||||
if (exception instanceof ExcelDataConvertException) {
|
||||
// 如果是某一个单元格的转换异常 能获取到具体行号
|
||||
ExcelDataConvertException excelDataConvertException = (ExcelDataConvertException) exception;
|
||||
Integer rowIndex = excelDataConvertException.getRowIndex();
|
||||
Integer columnIndex = excelDataConvertException.getColumnIndex();
|
||||
errMsg = StrUtil.format("第{}行-第{}列-表头{}: 解析异常<br/>",
|
||||
rowIndex + 1, columnIndex + 1, headMap.get(columnIndex));
|
||||
if (log.isDebugEnabled()) {
|
||||
log.error(errMsg);
|
||||
}
|
||||
}
|
||||
if (exception instanceof ConstraintViolationException) {
|
||||
ConstraintViolationException constraintViolationException = (ConstraintViolationException) exception;
|
||||
Set<ConstraintViolation<?>> constraintViolations = constraintViolationException.getConstraintViolations();
|
||||
String constraintViolationsMsg = constraintViolations.stream()
|
||||
.map(ConstraintViolation::getMessage)
|
||||
.collect(Collectors.joining(", "));
|
||||
errMsg = StrUtil.format("第{}行数据校验异常: {}", context.readRowHolder().getRowIndex() + 1, constraintViolationsMsg);
|
||||
if (log.isDebugEnabled()) {
|
||||
log.error(errMsg);
|
||||
}
|
||||
}
|
||||
excelResult.getErrorList().add(errMsg);
|
||||
throw new ExcelAnalysisException(errMsg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
|
||||
this.headMap = headMap;
|
||||
// log.debug("解析到一条表头数据: {}", JsonUtils.toJsonString(headMap));
|
||||
log.debug("解析到一条表头数据: {}");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke(T data, AnalysisContext context) {
|
||||
if (isValidate) {
|
||||
// ValidatorUtils.validate(data);
|
||||
}
|
||||
excelResult.getList().add(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doAfterAllAnalysed(AnalysisContext context) {
|
||||
log.debug("所有数据解析完成!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExcelResult<T> getExcelResult() {
|
||||
return excelResult;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package vboot.core.xutil.file.excel;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 默认excel返回对象
|
||||
*
|
||||
* @author Yjoioooo
|
||||
* @author Lion Li
|
||||
*/
|
||||
public class DefautExcelResult<T> implements ExcelResult<T> {
|
||||
|
||||
/**
|
||||
* 数据对象list
|
||||
*/
|
||||
@Setter
|
||||
private List<T> list;
|
||||
|
||||
/**
|
||||
* 错误信息列表
|
||||
*/
|
||||
@Setter
|
||||
private List<String> errorList;
|
||||
|
||||
public DefautExcelResult() {
|
||||
this.list = new ArrayList<>();
|
||||
this.errorList = new ArrayList<>();
|
||||
}
|
||||
|
||||
public DefautExcelResult(List<T> list, List<String> errorList) {
|
||||
this.list = list;
|
||||
this.errorList = errorList;
|
||||
}
|
||||
|
||||
public DefautExcelResult(ExcelResult<T> excelResult) {
|
||||
this.list = excelResult.getList();
|
||||
this.errorList = excelResult.getErrorList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<T> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getErrorList() {
|
||||
return errorList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取导入回执
|
||||
*
|
||||
* @return 导入回执
|
||||
*/
|
||||
@Override
|
||||
public String getAnalysis() {
|
||||
int successCount = list.size();
|
||||
int errorCount = errorList.size();
|
||||
if (successCount == 0) {
|
||||
return "读取失败,未解析到数据";
|
||||
} else {
|
||||
if (errorCount == 0) {
|
||||
return StrUtil.format("恭喜您,全部读取成功!共{}条", successCount);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package vboot.core.xutil.file.excel;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.excel.converters.Converter;
|
||||
import com.alibaba.excel.enums.CellDataTypeEnum;
|
||||
import com.alibaba.excel.metadata.GlobalConfiguration;
|
||||
import com.alibaba.excel.metadata.data.ReadCellData;
|
||||
import com.alibaba.excel.metadata.data.WriteCellData;
|
||||
import com.alibaba.excel.metadata.property.ExcelContentProperty;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 大数值转换
|
||||
* Excel 数值长度位15位 大于15位的数值转换位字符串
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@Slf4j
|
||||
public class ExcelBigNumberConvert implements Converter<Long> {
|
||||
|
||||
@Override
|
||||
public Class<Long> supportJavaTypeKey() {
|
||||
return Long.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CellDataTypeEnum supportExcelTypeKey() {
|
||||
return CellDataTypeEnum.STRING;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long convertToJavaData(ReadCellData<?> cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) {
|
||||
return Convert.toLong(cellData.getData());
|
||||
}
|
||||
|
||||
@Override
|
||||
public WriteCellData<Object> convertToExcelData(Long object, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) {
|
||||
if (ObjectUtil.isNotNull(object)) {
|
||||
String str = Convert.toStr(object);
|
||||
if (str.length() > 15) {
|
||||
return new WriteCellData<>(str);
|
||||
}
|
||||
}
|
||||
WriteCellData<Object> cellData = new WriteCellData<>(new BigDecimal(object));
|
||||
cellData.setType(CellDataTypeEnum.NUMBER);
|
||||
return cellData;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package vboot.core.xutil.file.excel;
|
||||
|
||||
import cn.hutool.core.annotation.AnnotationUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.excel.converters.Converter;
|
||||
import com.alibaba.excel.enums.CellDataTypeEnum;
|
||||
import com.alibaba.excel.metadata.GlobalConfiguration;
|
||||
import com.alibaba.excel.metadata.data.ReadCellData;
|
||||
import com.alibaba.excel.metadata.data.WriteCellData;
|
||||
import com.alibaba.excel.metadata.property.ExcelContentProperty;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import vboot.core.xutil.file.ExcelUtil;
|
||||
import vboot.core.xutil.lang.StringUtils;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
/**
|
||||
* 字典格式化转换处理
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@Slf4j
|
||||
public class ExcelDictConvert implements Converter<Object> {
|
||||
|
||||
@Override
|
||||
public Class<Object> supportJavaTypeKey() {
|
||||
return Object.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CellDataTypeEnum supportExcelTypeKey() {
|
||||
return null;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public Object convertToJavaData(ReadCellData<?> cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) {
|
||||
// ExcelDictFormat anno = getAnnotation(contentProperty.getField());
|
||||
// String type = anno.dictType();
|
||||
// String label = cellData.getStringValue();
|
||||
// String value;
|
||||
// if (StringUtils.isBlank(type)) {
|
||||
// value = ExcelUtil.reverseByExp(label, anno.readConverterExp(), anno.separator());
|
||||
// } else {
|
||||
// value = SpringUtils.getBean(DictService.class).getDictValue(type, label, anno.separator());
|
||||
// }
|
||||
// return Convert.convert(contentProperty.getField().getType(), value);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public WriteCellData<String> convertToExcelData(Object object, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) {
|
||||
// if (ObjectUtil.isNull(object)) {
|
||||
// return new WriteCellData<>("");
|
||||
// }
|
||||
// ExcelDictFormat anno = getAnnotation(contentProperty.getField());
|
||||
// String type = anno.dictType();
|
||||
// String value = Convert.toStr(object);
|
||||
// String label;
|
||||
// if (StringUtils.isBlank(type)) {
|
||||
// label = ExcelUtil.convertByExp(value, anno.readConverterExp(), anno.separator());
|
||||
// } else {
|
||||
// label = SpringUtils.getBean(DictService.class).getDictLabel(type, value, anno.separator());
|
||||
// }
|
||||
// return new WriteCellData<>(label);
|
||||
// }
|
||||
|
||||
private ExcelDictFormat getAnnotation(Field field) {
|
||||
return AnnotationUtil.getAnnotation(field, ExcelDictFormat.class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package vboot.core.xutil.file.excel;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 字典格式化
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@Target({ElementType.FIELD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Inherited
|
||||
public @interface ExcelDictFormat {
|
||||
|
||||
/**
|
||||
* 如果是字典类型,请设置字典的type值 (如: sys_user_sex)
|
||||
*/
|
||||
String dictType() default "";
|
||||
|
||||
/**
|
||||
* 读取内容转表达式 (如: 0=男,1=女,2=未知)
|
||||
*/
|
||||
String readConverterExp() default "";
|
||||
|
||||
/**
|
||||
* 分隔符,读取字符串组内容
|
||||
*/
|
||||
String separator() default ",";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package vboot.core.xutil.file.excel;
|
||||
|
||||
import com.alibaba.excel.read.listener.ReadListener;
|
||||
|
||||
/**
|
||||
* Excel 导入监听
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
public interface ExcelListener<T> extends ReadListener<T> {
|
||||
|
||||
ExcelResult<T> getExcelResult();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package vboot.core.xutil.file.excel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* excel返回对象
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
public interface ExcelResult<T> {
|
||||
|
||||
/**
|
||||
* 对象列表
|
||||
*/
|
||||
List<T> getList();
|
||||
|
||||
/**
|
||||
* 错误列表
|
||||
*/
|
||||
List<String> getErrorList();
|
||||
|
||||
/**
|
||||
* 导入回执
|
||||
*/
|
||||
String getAnalysis();
|
||||
}
|
||||
@@ -0,0 +1,273 @@
|
||||
package vboot.core.xutil.lang;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Validator;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.util.AntPathMatcher;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 字符串工具类
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
public class StringUtils extends org.apache.commons.lang3.StringUtils {
|
||||
|
||||
/**
|
||||
* 获取参数不为空值
|
||||
*
|
||||
* @param str defaultValue 要判断的value
|
||||
* @return value 返回值
|
||||
*/
|
||||
public static String blankToDefault(String str, String defaultValue) {
|
||||
return StrUtil.blankToDefault(str, defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* * 判断一个字符串是否为空串
|
||||
*
|
||||
* @param str String
|
||||
* @return true:为空 false:非空
|
||||
*/
|
||||
public static boolean isEmpty(String str) {
|
||||
return StrUtil.isEmpty(str);
|
||||
}
|
||||
|
||||
/**
|
||||
* * 判断一个字符串是否为非空串
|
||||
*
|
||||
* @param str String
|
||||
* @return true:非空串 false:空串
|
||||
*/
|
||||
public static boolean isNotEmpty(String str) {
|
||||
return !isEmpty(str);
|
||||
}
|
||||
|
||||
/**
|
||||
* 去空格
|
||||
*/
|
||||
public static String trim(String str) {
|
||||
return StrUtil.trim(str);
|
||||
}
|
||||
|
||||
/**
|
||||
* 截取字符串
|
||||
*
|
||||
* @param str 字符串
|
||||
* @param start 开始
|
||||
* @return 结果
|
||||
*/
|
||||
public static String substring(final String str, int start) {
|
||||
return substring(str, start, str.length());
|
||||
}
|
||||
|
||||
/**
|
||||
* 截取字符串
|
||||
*
|
||||
* @param str 字符串
|
||||
* @param start 开始
|
||||
* @param end 结束
|
||||
* @return 结果
|
||||
*/
|
||||
public static String substring(final String str, int start, int end) {
|
||||
return StrUtil.sub(str, start, end);
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化文本, {} 表示占位符<br>
|
||||
* 此方法只是简单将占位符 {} 按照顺序替换为参数<br>
|
||||
* 如果想输出 {} 使用 \\转义 { 即可,如果想输出 {} 之前的 \ 使用双转义符 \\\\ 即可<br>
|
||||
* 例:<br>
|
||||
* 通常使用:format("this is {} for {}", "a", "b") -> this is a for b<br>
|
||||
* 转义{}: format("this is \\{} for {}", "a", "b") -> this is {} for a<br>
|
||||
* 转义\: format("this is \\\\{} for {}", "a", "b") -> this is \a for b<br>
|
||||
*
|
||||
* @param template 文本模板,被替换的部分用 {} 表示
|
||||
* @param params 参数值
|
||||
* @return 格式化后的文本
|
||||
*/
|
||||
public static String format(String template, Object... params) {
|
||||
return StrUtil.format(template, params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否为http(s)://开头
|
||||
*
|
||||
* @param link 链接
|
||||
* @return 结果
|
||||
*/
|
||||
public static boolean ishttp(String link) {
|
||||
return Validator.isUrl(link);
|
||||
}
|
||||
|
||||
/**
|
||||
* 字符串转set
|
||||
*
|
||||
* @param str 字符串
|
||||
* @param sep 分隔符
|
||||
* @return set集合
|
||||
*/
|
||||
public static Set<String> str2Set(String str, String sep) {
|
||||
return new HashSet<>(str2List(str, sep, true, false));
|
||||
}
|
||||
|
||||
/**
|
||||
* 字符串转list
|
||||
*
|
||||
* @param str 字符串
|
||||
* @param sep 分隔符
|
||||
* @param filterBlank 过滤纯空白
|
||||
* @param trim 去掉首尾空白
|
||||
* @return list集合
|
||||
*/
|
||||
public static List<String> str2List(String str, String sep, boolean filterBlank, boolean trim) {
|
||||
List<String> list = new ArrayList<>();
|
||||
if (isEmpty(str)) {
|
||||
return list;
|
||||
}
|
||||
|
||||
// 过滤空白字符串
|
||||
if (filterBlank && isBlank(str)) {
|
||||
return list;
|
||||
}
|
||||
String[] split = str.split(sep);
|
||||
for (String string : split) {
|
||||
if (filterBlank && isBlank(string)) {
|
||||
continue;
|
||||
}
|
||||
if (trim) {
|
||||
string = trim(string);
|
||||
}
|
||||
list.add(string);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查找指定字符串是否包含指定字符串列表中的任意一个字符串同时串忽略大小写
|
||||
*
|
||||
* @param cs 指定字符串
|
||||
* @param searchCharSequences 需要检查的字符串数组
|
||||
* @return 是否包含任意一个字符串
|
||||
*/
|
||||
public static boolean containsAnyIgnoreCase(CharSequence cs, CharSequence... searchCharSequences) {
|
||||
return StrUtil.containsAnyIgnoreCase(cs, searchCharSequences);
|
||||
}
|
||||
|
||||
/**
|
||||
* 驼峰转下划线命名
|
||||
*/
|
||||
public static String toUnderScoreCase(String str) {
|
||||
return StrUtil.toUnderlineCase(str);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否包含字符串
|
||||
*
|
||||
* @param str 验证字符串
|
||||
* @param strs 字符串组
|
||||
* @return 包含返回true
|
||||
*/
|
||||
public static boolean inStringIgnoreCase(String str, String... strs) {
|
||||
return StrUtil.equalsAnyIgnoreCase(str, strs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将下划线大写方式命名的字符串转换为驼峰式。如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。 例如:HELLO_WORLD->HelloWorld
|
||||
*
|
||||
* @param name 转换前的下划线大写方式命名的字符串
|
||||
* @return 转换后的驼峰式命名的字符串
|
||||
*/
|
||||
public static String convertToCamelCase(String name) {
|
||||
return StrUtil.upperFirst(StrUtil.toCamelCase(name));
|
||||
}
|
||||
|
||||
/**
|
||||
* 驼峰式命名法 例如:user_name->userName
|
||||
*/
|
||||
public static String toCamelCase(String s) {
|
||||
return StrUtil.toCamelCase(s);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查找指定字符串是否匹配指定字符串列表中的任意一个字符串
|
||||
*
|
||||
* @param str 指定字符串
|
||||
* @param strs 需要检查的字符串数组
|
||||
* @return 是否匹配
|
||||
*/
|
||||
public static boolean matches(String str, List<String> strs) {
|
||||
if (isEmpty(str) || CollUtil.isEmpty(strs)) {
|
||||
return false;
|
||||
}
|
||||
for (String pattern : strs) {
|
||||
if (isMatch(pattern, str)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断url是否与规则配置:
|
||||
* ? 表示单个字符;
|
||||
* * 表示一层路径内的任意字符串,不可跨层级;
|
||||
* ** 表示任意层路径;
|
||||
*
|
||||
* @param pattern 匹配规则
|
||||
* @param url 需要匹配的url
|
||||
* @return
|
||||
*/
|
||||
public static boolean isMatch(String pattern, String url) {
|
||||
AntPathMatcher matcher = new AntPathMatcher();
|
||||
return matcher.match(pattern, url);
|
||||
}
|
||||
|
||||
/**
|
||||
* 数字左边补齐0,使之达到指定长度。注意,如果数字转换为字符串后,长度大于size,则只保留 最后size个字符。
|
||||
*
|
||||
* @param num 数字对象
|
||||
* @param size 字符串指定长度
|
||||
* @return 返回数字的字符串格式,该字符串为指定长度。
|
||||
*/
|
||||
public static final String padl(final Number num, final int size) {
|
||||
return padl(num.toString(), size, '0');
|
||||
}
|
||||
|
||||
/**
|
||||
* 字符串左补齐。如果原始字符串s长度大于size,则只保留最后size个字符。
|
||||
*
|
||||
* @param s 原始字符串
|
||||
* @param size 字符串指定长度
|
||||
* @param c 用于补齐的字符
|
||||
* @return 返回指定长度的字符串,由原字符串左补齐或截取得到。
|
||||
*/
|
||||
public static final String padl(final String s, final int size, final char c) {
|
||||
final StringBuilder sb = new StringBuilder(size);
|
||||
if (s != null) {
|
||||
final int len = s.length();
|
||||
if (s.length() <= size) {
|
||||
for (int i = size - len; i > 0; i--) {
|
||||
sb.append(c);
|
||||
}
|
||||
sb.append(s);
|
||||
} else {
|
||||
return s.substring(len - size, len);
|
||||
}
|
||||
} else {
|
||||
for (int i = size; i > 0; i--) {
|
||||
sb.append(c);
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -54,7 +54,7 @@ public class XdateUtil {
|
||||
}
|
||||
|
||||
public static Date strToDate(String strDate) {
|
||||
if (XstringUtil.isBlank(strDate)) {
|
||||
if (XstrUtil.isBlank(strDate)) {
|
||||
return null;
|
||||
}
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
||||
@@ -64,7 +64,7 @@ public class XdateUtil {
|
||||
}
|
||||
|
||||
public static Date strToDateBySap(String strDate) {
|
||||
if (XstringUtil.isBlank(strDate)) {
|
||||
if (XstrUtil.isBlank(strDate)) {
|
||||
return null;
|
||||
}
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
|
||||
|
||||
@@ -83,7 +83,7 @@ public class XreflectUtil {
|
||||
modifiedPropertyInfos.add(modifiedPropertyInfo);
|
||||
}
|
||||
}
|
||||
}else if ((XstringUtil.isNotBlank(""+value)&& newValue == null) ||(value== null && XstringUtil.isNotBlank(""+newValue))){
|
||||
}else if ((XstrUtil.isNotBlank(""+value)&& newValue == null) ||(value== null && XstrUtil.isNotBlank(""+newValue))){
|
||||
modifiedPropertyInfo.setPrnam(prnam);
|
||||
modifiedPropertyInfo.setOlval(value);
|
||||
modifiedPropertyInfo.setNeval(newValue);
|
||||
|
||||
+4
-4
@@ -6,7 +6,7 @@ import java.util.UUID;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class XstringUtil {
|
||||
public class XstrUtil {
|
||||
|
||||
public static boolean containChinese(String str) {
|
||||
Pattern p = Pattern.compile("[\u4e00-\u9fa5]");
|
||||
@@ -39,15 +39,15 @@ public class XstringUtil {
|
||||
}
|
||||
|
||||
public static boolean isAllBlank(String str1,String str2) {
|
||||
return XstringUtil.isBlank(str1)&&XstringUtil.isBlank(str2);
|
||||
return XstrUtil.isBlank(str1)&& XstrUtil.isBlank(str2);
|
||||
}
|
||||
|
||||
public static boolean isAllBlank(String str1,String str2,String str3) {
|
||||
return XstringUtil.isBlank(str1)&&XstringUtil.isBlank(str2)&&XstringUtil.isBlank(str3);
|
||||
return XstrUtil.isBlank(str1)&& XstrUtil.isBlank(str2)&& XstrUtil.isBlank(str3);
|
||||
}
|
||||
|
||||
public static boolean isNotBlank(String str) {
|
||||
return !XstringUtil.isBlank(str);
|
||||
return !XstrUtil.isBlank(str);
|
||||
}
|
||||
|
||||
public static String addWhereInCondition(String field,List<String> list){
|
||||
@@ -2,7 +2,7 @@ package vboot.extend.module.bi.demo.boy;
|
||||
|
||||
import vboot.core.common.api.RestResult;
|
||||
import vboot.core.common.dao.Sqler;
|
||||
import vboot.core.xutil.lang.XstringUtil;
|
||||
import vboot.core.xutil.lang.XstrUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -21,8 +21,8 @@ public class BiDemoBoyApi {
|
||||
List<BiDemoBoy> boys = new ArrayList<>();
|
||||
for (int i = 1; i <= 100; i++) {
|
||||
BiDemoBoy boy=new BiDemoBoy();
|
||||
boy.setId(XstringUtil.getUUID());
|
||||
boy.setName(XstringUtil.getRSID8());
|
||||
boy.setId(XstrUtil.getUUID());
|
||||
boy.setName(XstrUtil.getRSID8());
|
||||
boys.add(boy);
|
||||
}
|
||||
repo.saveAll(boys);
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package vboot.app.module.oa.doc.cate;
|
||||
package vboot.extend.module.oa.doc.cate;
|
||||
|
||||
import vboot.core.common.entity.BaseCateEntity;
|
||||
import lombok.Getter;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package vboot.app.module.oa.doc.cate;
|
||||
package vboot.extend.module.oa.doc.cate;
|
||||
|
||||
import vboot.core.common.api.RestResult;
|
||||
import vboot.core.common.dao.Sqler;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package vboot.app.module.oa.doc.cate;
|
||||
package vboot.extend.module.oa.doc.cate;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user