Merge remote-tracking branch 'origin/kjs' into kjs
# Conflicts: # webapp/src/main/java/com/hzya/frame/webapp/entrance/controler/EntranceController.java
This commit is contained in:
commit
1401d78199
|
@ -17,21 +17,21 @@
|
|||
<artifactId>webapp</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<!-- <!– 淘宝奇门sdk–>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.reabam.sdk</groupId>-->
|
||||
<!-- <artifactId>reabam-sdk-java</artifactId>-->
|
||||
<!-- <version>1.0</version>-->
|
||||
<!-- <scope>system</scope>-->
|
||||
<!-- <systemPath>${basedir}/src/main/webapp/WEB-INF/lib/openapi-sdk-1.0.0.jar</systemPath>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.taobao.qmsdk</groupId>-->
|
||||
<!-- <artifactId>taobao-sdk-java-auto</artifactId>-->
|
||||
<!-- <version>1.1</version>-->
|
||||
<!-- <scope>system</scope>-->
|
||||
<!-- <systemPath>${basedir}/src/main/webapp/WEB-INF/lib/taobao-sdk-java-auto-1.1.jar</systemPath>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <!– 淘宝奇门sdk–>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.reabam.sdk</groupId>-->
|
||||
<!-- <artifactId>reabam-sdk-java</artifactId>-->
|
||||
<!-- <version>1.0</version>-->
|
||||
<!-- <scope>system</scope>-->
|
||||
<!-- <systemPath>${basedir}/src/main/webapp/WEB-INF/lib/openapi-sdk-1.0.0.jar</systemPath>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.taobao.qmsdk</groupId>-->
|
||||
<!-- <artifactId>taobao-sdk-java-auto</artifactId>-->
|
||||
<!-- <version>1.1</version>-->
|
||||
<!-- <scope>system</scope>-->
|
||||
<!-- <systemPath>${basedir}/src/main/webapp/WEB-INF/lib/taobao-sdk-java-auto-1.1.jar</systemPath>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ public class CbsPluginServiceImpl implements ICbsPluginService {
|
|||
private RestUtil restUtil;
|
||||
@Value("${cbs8.elec_path:}")
|
||||
private String elec_path;
|
||||
@Value("${OA.data_source_code}:")
|
||||
@Value("${OA.data_source_code:}")
|
||||
private String oa_data_source_code;
|
||||
/**
|
||||
* 支付申请
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
package com.hzya.frame.plugin.kjs.listener;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.dingtalk.open.app.api.GenericEventListener;
|
||||
import com.dingtalk.open.app.api.OpenDingTalkStreamClientBuilder;
|
||||
import com.dingtalk.open.app.api.message.GenericOpenDingTalkEvent;
|
||||
import com.dingtalk.open.app.api.security.AuthClientCredential;
|
||||
import com.dingtalk.open.app.stream.protocol.event.EventAckStatus;
|
||||
import com.hzya.frame.dingtalk.service.IDingTalkExtService;
|
||||
import com.hzya.frame.plugin.kjs.service.GenericEventConsumer;
|
||||
import com.hzya.frame.sysnew.application.dao.ISysApplicationDao;
|
||||
import com.hzya.frame.sysnew.application.entity.SysApplicationEntity;
|
||||
import com.hzya.frame.sysnew.application.service.ISysApplicationService;
|
||||
import com.hzya.frame.sysnew.application.service.impl.ApplicationCache;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.DependsOn;
|
||||
import org.springframework.core.task.TaskExecutor;
|
||||
import org.springframework.stereotype.Component;
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @Description 钉钉通讯录事件订阅
|
||||
* @Author xiangerlin
|
||||
* @Date 2024/8/27 14:43
|
||||
**/
|
||||
@Component
|
||||
public class GenericEventSubscribe {
|
||||
|
||||
Logger logger = LoggerFactory.getLogger(getClass());
|
||||
@Resource
|
||||
private GenericEventConsumer genericEventConsumer;
|
||||
@Resource
|
||||
private TaskExecutor taskExecutor;
|
||||
@Resource
|
||||
private ApplicationCache applicationCache;
|
||||
@Resource
|
||||
private IDingTalkExtService dingTalkExtService;
|
||||
@Resource
|
||||
private ISysApplicationDao sysApplicationDao;
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
//查询钉钉配置的参数
|
||||
SysApplicationEntity sysApp = new SysApplicationEntity();
|
||||
sysApp.setAppId(800005);
|
||||
sysApp = sysApplicationDao.queryOne(sysApp);
|
||||
if (null != sysApp){
|
||||
JSONObject dingTalkConfig = dingTalkExtService.getDingTalkConfig(sysApp);
|
||||
if (null != dingTalkConfig){
|
||||
String appKey = dingTalkConfig.getString("appKey");
|
||||
String appSecret = dingTalkConfig.getString("appSecret");
|
||||
subscribe(appKey,appSecret);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 通讯录事件订阅
|
||||
*/
|
||||
public void subscribe(String appKey,String appSecret){
|
||||
try {
|
||||
logger.info("通讯录事件订阅");
|
||||
OpenDingTalkStreamClientBuilder
|
||||
.custom()
|
||||
.credential(new AuthClientCredential(appKey, appSecret))
|
||||
//注册事件监听
|
||||
.registerAllEventListener(new GenericEventListener() {
|
||||
public EventAckStatus onEvent(GenericOpenDingTalkEvent event) {
|
||||
try {
|
||||
try {
|
||||
//处理事件
|
||||
taskExecutor.execute(()->{
|
||||
genericEventConsumer.consume(event);
|
||||
});
|
||||
}catch (Exception e){
|
||||
logger.error("GenericEventThreadPool错误:{}",e);
|
||||
}
|
||||
//消费成功
|
||||
return EventAckStatus.SUCCESS;
|
||||
} catch (Exception e) {
|
||||
//消费失败
|
||||
return EventAckStatus.LATER;
|
||||
}
|
||||
}
|
||||
})
|
||||
.build().start();
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,233 @@
|
|||
package com.hzya.frame.plugin.kjs.service;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.map.MapBuilder;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.dingtalk.api.response.OapiV2DepartmentGetResponse;
|
||||
import com.dingtalk.api.response.OapiV2UserGetResponse;
|
||||
import com.dingtalk.open.app.api.message.GenericOpenDingTalkEvent;
|
||||
import com.hzya.frame.dingtalk.enums.OrgEventEnum;
|
||||
import com.hzya.frame.dingtalk.service.IDingTalkService;
|
||||
import com.hzya.frame.web.entity.BaseResult;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
import shade.com.alibaba.fastjson2.JSONArray;
|
||||
import shade.com.alibaba.fastjson2.JSONObject;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description 通讯录事件订阅消费者
|
||||
* @Author xiangerlin
|
||||
* @Date 2024/8/27 15:33
|
||||
**/
|
||||
public class GenericEventConsumer {
|
||||
Logger logger = LoggerFactory.getLogger(getClass());
|
||||
//中台应用
|
||||
private static final String APPCODE = "800004";
|
||||
private static final String URL = "http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface";
|
||||
//中台 publicKey
|
||||
private static final String PUBLICKEY = "ZJYAWb7lhAUTYqekPkU+uHJv1/ObJxb7dT7sD8HPRDGAgyhCe7eDIk+3zDUT+v578prj";
|
||||
//中台secretKey
|
||||
private static final String SECRETKEY = "fviZnLBsQUAGF8w8FSOdJi7XlIm/XAZclMxRagDLfTyJFlvnIBF3w66Hrpfzs8cYj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=";
|
||||
//mdm通用新增接口编码
|
||||
private static final String MDMADDCODE = "8000040022";
|
||||
//mdm通用删除接口编码
|
||||
private static final String MDMREMOVECODE = "8000040024";
|
||||
//主数据人员钉钉档案编码
|
||||
private static final String DDUSERMDMCODE = "10015";
|
||||
//主数据钉钉部门档案编码
|
||||
private static final String DDDEPTMDMCODE = "10016";
|
||||
//钉钉应用编码
|
||||
private static final String DDAPPCODE = "800005";
|
||||
//钉钉 publicKey
|
||||
private static final String DDPUBLICKEY = "ZJYAn/EBWEhLUMezDLU4iZ1vTO9kc6pM6XrYLajnqnK60Q9Ce7eDIk+3zDUT+v578prj";
|
||||
//钉钉secretKey
|
||||
private static final String DDSECRETKEY = "ctMIYyauwoKSFeU4tg5gH1aWC/3OJK6HsKJrSR0oyDmdmdvRNgdoTzX0C1OQ+whrj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=";
|
||||
//获取钉钉用户详情接口编码
|
||||
private static final String GETUSERAPPCODE="8000050001";
|
||||
//获取钉钉部门详情接口编码
|
||||
private static final String GETDETPAPPCODE="8000050002";
|
||||
/**
|
||||
* 消费通讯录事件订阅消息
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
public void consume(GenericOpenDingTalkEvent event) {
|
||||
//事件唯一Id
|
||||
String eventId = event.getEventId();
|
||||
//事件类型
|
||||
String eventType = event.getEventType();
|
||||
//事件产生时间
|
||||
Long bornTime = event.getEventBornTime();
|
||||
//获取事件体
|
||||
JSONObject bizData = event.getData();
|
||||
logger.info("事件唯一id{},事件类型:{},参数:{}",eventId,eventType,JSONObject.toJSONString(bizData));
|
||||
OrgEventEnum orgEventEnum = OrgEventEnum.getByCode(eventType);
|
||||
String apiCode = MDMADDCODE;
|
||||
String type = "user";
|
||||
boolean flag = false;
|
||||
switch (orgEventEnum){
|
||||
//新增到主数据
|
||||
case USER_ADD_ORG:
|
||||
case USER_LEAVE_ORG:
|
||||
case USER_MODIFY_ORG:
|
||||
flag = true;
|
||||
break;
|
||||
case ORG_DEPT_CREATE:
|
||||
case ORG_DEPT_MODIFY:
|
||||
type = "dept";
|
||||
flag = true;
|
||||
break;
|
||||
case ORG_DEPT_REMOVE:
|
||||
type = "dept";
|
||||
apiCode = MDMREMOVECODE;
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
if (flag){
|
||||
if ("user".equals(type)){
|
||||
JSONArray userIds = bizData.getJSONArray("userId");
|
||||
//调用钉钉查询用户详情接口
|
||||
for (int i=0; i<userIds.size();i++){
|
||||
//获取用户详情
|
||||
String userRes = getUserById(String.valueOf(userIds.get(i)));
|
||||
//保存钉钉用户到mdm
|
||||
String userMdmRes = createUser(userRes);
|
||||
}
|
||||
}else if ("dept".equals(type)){
|
||||
JSONArray deptIdArr = bizData.getJSONArray("deptId");
|
||||
for (int i=0; i<deptIdArr.size(); i++){
|
||||
//查询部门详情
|
||||
String deptRes = getDeptById(deptIdArr.getLong(i));
|
||||
//保存部门到mdm
|
||||
String deptMdmRes = createDept(deptRes,apiCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询钉钉用户详情
|
||||
* @param userid
|
||||
* @return
|
||||
*/
|
||||
private static String getUserById(String userid) {
|
||||
Map<String, String> userHeaderMap = MapBuilder.<String, String>create(true)
|
||||
.put("apiCode", GETUSERAPPCODE)//钉钉接口
|
||||
.put("publicKey",PUBLICKEY)//中台应用
|
||||
.put("secretKey",SECRETKEY)//中台应用
|
||||
.put("appId",DDAPPCODE)//钉钉接口
|
||||
.build();
|
||||
Map<String,Object> userParam = new HashMap<>();
|
||||
userParam.put("userid", userid);
|
||||
userParam.put("language","zh_CN");
|
||||
String userRes = HttpRequest.post(URL).addHeaders(userHeaderMap).body(com.alibaba.fastjson.JSONObject.toJSONString(userParam)).timeout(60000).execute().body();
|
||||
return userRes;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询钉钉部门详情
|
||||
* @param deptId
|
||||
* @return
|
||||
*/
|
||||
private String getDeptById(Long deptId) {
|
||||
Map<String, String> userHeaderMap = MapBuilder.<String, String>create(true)
|
||||
.put("apiCode", GETDETPAPPCODE)//钉钉接口
|
||||
.put("publicKey",PUBLICKEY)//中台应用
|
||||
.put("secretKey",SECRETKEY)//中台应用
|
||||
.put("appId",DDAPPCODE)//钉钉接口
|
||||
.build();
|
||||
Map<String,Object> deptParam = new LinkedHashMap<>();
|
||||
deptParam.put("dept_id",deptId);
|
||||
deptParam.put("language","zh_CN");
|
||||
String deptRes = HttpRequest.post(URL).addHeaders(userHeaderMap).body(com.alibaba.fastjson.JSONObject.toJSONString(deptParam)).timeout(60000).execute().body();
|
||||
return deptRes;
|
||||
}
|
||||
|
||||
//保存用户到mdm
|
||||
private static String createUser(String userRes) {
|
||||
JsonResultEntity jsonResult = JSONObject.parseObject(userRes,JsonResultEntity.class);
|
||||
if (jsonResult.isFlag()){
|
||||
shade.com.alibaba.fastjson2.JSONObject attribute = (shade.com.alibaba.fastjson2.JSONObject) jsonResult.getAttribute();
|
||||
String attrStr = attribute.toString();
|
||||
OapiV2UserGetResponse rsp = JSONObject.parseObject(attrStr, OapiV2UserGetResponse.class);
|
||||
if (rsp.isSuccess()){
|
||||
OapiV2UserGetResponse.UserGetResponse userInfo = rsp.getResult();
|
||||
//OapiV2UserGetResponse.UserGetResponse userInfo = dingtalkService.getUserById(userIds.getString(i));
|
||||
Map<String,Object> mdmMap = new LinkedHashMap<>();
|
||||
mdmMap.put("mdmCode",DDUSERMDMCODE);
|
||||
mdmMap.put("optionName","系统管理员");
|
||||
Map<String,Object> userMap = new LinkedHashMap<>();
|
||||
userMap.put("data_id", userInfo.getUserid());
|
||||
userMap.put("unionid",userInfo.getUnionid());
|
||||
userMap.put("userid",userInfo.getUserid());
|
||||
userMap.put("name",userInfo.getName());
|
||||
userMap.put("mobile",userInfo.getMobile());
|
||||
userMap.put("job_number",userInfo.getJobNumber());
|
||||
userMap.put("title",userInfo.getTitle());
|
||||
userMap.put("email",userInfo.getEmail());
|
||||
userMap.put("org_email",userInfo.getOrgEmail());
|
||||
if (null != userInfo.getHiredDate()){
|
||||
userMap.put("hired_date", DateUtil.date(userInfo.getHiredDate()));
|
||||
}
|
||||
mdmMap.put("mdm_dd_user",userMap);
|
||||
//保存到人员主数据
|
||||
Map<String, String> headerMap = MapBuilder.<String, String>create(true)
|
||||
.put("apiCode", MDMADDCODE)//中台接口
|
||||
.put("publicKey",DDPUBLICKEY)//钉钉应用
|
||||
.put("secretKey",DDSECRETKEY)//钉钉应用
|
||||
.put("appId",APPCODE)//中台应用
|
||||
.build();
|
||||
String body = HttpRequest.post(URL).addHeaders(headerMap).body(com.alibaba.fastjson.JSONObject.toJSONString(mdmMap)).timeout(60000).execute().body();
|
||||
return body;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存部门到mdm
|
||||
* @param deptRes
|
||||
* @return
|
||||
*/
|
||||
private String createDept(String deptRes,String apiCode) {
|
||||
if (StrUtil.isNotEmpty(deptRes) && StrUtil.isNotEmpty(apiCode)){
|
||||
JsonResultEntity jsonResult = JSONObject.parseObject(deptRes,JsonResultEntity.class);
|
||||
if (jsonResult.isFlag()){
|
||||
shade.com.alibaba.fastjson2.JSONObject attribute = (shade.com.alibaba.fastjson2.JSONObject) jsonResult.getAttribute();
|
||||
String attrStr = attribute.toString();
|
||||
OapiV2DepartmentGetResponse rsp = JSONObject.parseObject(attrStr,OapiV2DepartmentGetResponse.class);
|
||||
String result = attribute.getString("result");
|
||||
OapiV2DepartmentGetResponse.DeptGetResponse deptInfo = com.alibaba.fastjson.JSONObject.parseObject(result,OapiV2DepartmentGetResponse.DeptGetResponse.class);
|
||||
//OapiV2DepartmentGetResponse.DeptGetResponse deptInfo = dingtalkService.getDeptById(deptIdArr.getLong(i));
|
||||
Map<String,Object> mdmMap = new LinkedHashMap<>();
|
||||
mdmMap.put("mdmCode",DDDEPTMDMCODE);
|
||||
mdmMap.put("optionName","系统管理员");
|
||||
Map<String,Object> deptMap = new LinkedHashMap<>();
|
||||
deptMap.put("dept_id",deptInfo.getDeptId());
|
||||
deptMap.put("data_id",deptInfo.getDeptId());
|
||||
deptMap.put("name",deptInfo.getName());
|
||||
deptMap.put("parent_id",deptInfo.getParentId());
|
||||
mdmMap.put("mdm_dd_dept",deptMap);
|
||||
//保存部门到主数据
|
||||
Map<String, String> headerMap = MapBuilder.<String, String>create(true)
|
||||
.put("apiCode", apiCode)//中台接口
|
||||
.put("publicKey",DDPUBLICKEY)//钉钉应用
|
||||
.put("secretKey",DDSECRETKEY)//钉钉应用
|
||||
.put("appId",APPCODE)//中台应用
|
||||
.build();
|
||||
String body = HttpRequest.post(URL).addHeaders(headerMap).body(com.alibaba.fastjson.JSONObject.toJSONString(mdmMap)).timeout(60000).execute().body();
|
||||
return body;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package com.hzya.frame.plugin.kjs.util;
|
||||
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* @Description 用线程消费订阅事件的消息
|
||||
* @Author xiangerlin
|
||||
* @Date 2024/8/27 15:10
|
||||
**/
|
||||
public class GenericEventThreadPool {
|
||||
private static final int MAX_THREADS = 10; // 最大线程数,可以根据需要调整
|
||||
private static final int TASK_QUEUE_SIZE = 100; // 任务队列大小,可以根据需要调整
|
||||
|
||||
private final ExecutorService executorService;
|
||||
|
||||
public GenericEventThreadPool() {
|
||||
// 创建固定线程数的线程池
|
||||
executorService = new ThreadPoolExecutor(
|
||||
MAX_THREADS,
|
||||
MAX_THREADS,
|
||||
0L,
|
||||
TimeUnit.MILLISECONDS,
|
||||
new ArrayBlockingQueue<>(TASK_QUEUE_SIZE),
|
||||
new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
}
|
||||
|
||||
//提交任务
|
||||
public void executeTask(Runnable task) {
|
||||
executorService.execute(task);
|
||||
}
|
||||
|
||||
//关闭线程池
|
||||
public void close() {
|
||||
if (executorService!= null &&!executorService.isShutdown()) {
|
||||
executorService.shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -19,6 +19,11 @@ spring:
|
|||
savefile:
|
||||
# 文件保存路径
|
||||
path: /home/webservice/zt/file
|
||||
# path: D:\webservice\file
|
||||
# pluginpath: D:\webservice\plugin
|
||||
pluginpath: /home/webservice/zt/plugin
|
||||
# tomcatpath: D:\apache-tomcat-9.0.69\webapps\kangarooDataCenter\WEB-INF\classes\
|
||||
tomcatpath: /home/webservice/zt/tomcatV3/webapps/kangarooDataCenterV3/WEB-INF/classes/
|
||||
cbs8:
|
||||
appId: 1P4AGrpz
|
||||
appSecret: 2c2369ae5dc04382844bbe3a5abf39e1bea9cd3a
|
||||
|
|
|
@ -6,30 +6,21 @@ logging:
|
|||
encodings: UTF-8
|
||||
file:
|
||||
# 日志保存路径
|
||||
path: /Users/xiangerlin/work/app/logs/ydc
|
||||
path: /Users/xiangerlin/work/app/logs/kjs
|
||||
spring:
|
||||
datasource:
|
||||
dynamic:
|
||||
datasource:
|
||||
master:
|
||||
url: jdbc:mysql://ufidahz.com.cn:9014/businesscenter?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true
|
||||
url: jdbc:mysql://ufidahz.com.cn:9014/businesscenter_kjs?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true
|
||||
username: root
|
||||
password: 62e4295b615a30dbf3b8ee96f41c820b
|
||||
driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
|
||||
savefile:
|
||||
# 文件保存路径
|
||||
path: /Users/xiangerlin/work/app/logs/ydc
|
||||
cbs8:
|
||||
appId: 1P4AGrpz
|
||||
appSecret: 2c2369ae5dc04382844bbe3a5abf39e1bea9cd3a
|
||||
url: https://cbs8-openapi-reprd.csuat.cmburl.cn
|
||||
# 测试用这个 这个是银行给的,和下面的公钥不是一对密钥
|
||||
ya_private_key: 83BA7EC821D35F4CB31FF9A51C1EFA520FC52AF828C2337F88E91CF119B07F44
|
||||
# 这个私钥到时候上传到cbs,和下面到是同一对
|
||||
#ya_private_key: e1eacfdee9b8d4184437d5a2071e17ce31befc3d93395f9f05709ed562e8dc46
|
||||
ya_public_key: 044fa399d2223760f17b81b863cb482b009294c4516f8a605dea1475ec09e720eaa98468715e5ad509a592a0b426061551c5a3df236966c23253a7d894eac0dcde
|
||||
cbs_public_key: 0469146F06BF3B01236E84632441E826F3067A6B93BC3839C836A06007869CD351FBBE388B51F742859388BBC1DE089923AAFBC69E448F15141DDF30EE6CE90185
|
||||
#电子回单下载临时存放位置
|
||||
elec_path: /Users/xiangerlin/Downloads/
|
||||
OA:
|
||||
data_source_code: yc-test
|
||||
path: /Users/xiangerlin/work/app/logs/kjs
|
||||
dingtalk:
|
||||
appKey: dingbltm9wszcl7hoxyg
|
||||
appSecret: ex3a9qwdTXWf_VKJEddAg8YE7x98kIl3Nsy_7g0NdwvK3w3nXdUhJ3XQP4lUYs2d
|
||||
appId: dd39187a-079a-466c-b4b7-9ef3172e9e61
|
||||
agentId: 3209295620 appkey:dingbltm9wszcl7hoxyg
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
#######################zqtlocal环境#######################
|
||||
logging:
|
||||
#日志级别 指定目录级别
|
||||
level:
|
||||
root: warn
|
||||
encodings: UTF-8
|
||||
file:
|
||||
# 日志保存路径
|
||||
path: D:/local/logs/
|
||||
spring:
|
||||
datasource:
|
||||
dynamic:
|
||||
datasource:
|
||||
master:
|
||||
url: jdbc:mysql://ufidahz.com.cn:9014/businesscenter?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true
|
||||
username: root
|
||||
password: 62e4295b615a30dbf3b8ee96f41c820b
|
||||
driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
|
||||
savefile:
|
||||
# 文件保存路径
|
||||
path: D:/local/upload/
|
||||
pluginpath : D:/local/plugin/
|
||||
tomcatpath: E:\apache-tomcat-9.0.27\webapps\kangarooDataCenterV3\WEB-INF\classes\
|
||||
cbs8:
|
||||
appId: 1P4AGrpz
|
||||
appSecret: 2c2369ae5dc04382844bbe3a5abf39e1bea9cd3a
|
||||
url: https://cbs8-openapi-reprd.csuat.cmburl.cn
|
||||
# 测试用这个 这个是银行给的,和下面的公钥不是一对密钥
|
||||
ya_private_key: 83BA7EC821D35F4CB31FF9A51C1EFA520FC52AF828C2337F88E91CF119B07F44
|
||||
# 这个私钥到时候上传到cbs,和下面到是同一对
|
||||
#ya_private_key: e1eacfdee9b8d4184437d5a2071e17ce31befc3d93395f9f05709ed562e8dc46
|
||||
ya_public_key: 044fa399d2223760f17b81b863cb482b009294c4516f8a605dea1475ec09e720eaa98468715e5ad509a592a0b426061551c5a3df236966c23253a7d894eac0dcde
|
||||
cbs_public_key: 0469146F06BF3B01236E84632441E826
|
||||
#电子回单下载临时存放位置
|
||||
elec_path: /Users/xiangerlin/Downloads/
|
||||
OA:
|
||||
data_source_code: yc_oa
|
||||
zt:
|
||||
url: http://127.0.0.1:9082/kangarooDataCenterV3/entranceController/externalCallInterface
|
|
@ -4,4 +4,5 @@
|
|||
<bean name="deliveryOrderPluginServiceImpl" class="com.hzya.frame.plugin.kjs.service.impl.DeliveryOrderPluginServiceImpl" />
|
||||
<bean name="momOrderPluginServiceImpl" class="com.hzya.frame.plugin.kjs.service.impl.MomOrderPluginServiceImpl" />
|
||||
<bean name="kjsPluginBaseService" class="com.hzya.frame.plugin.kjs.service.impl.KjsPluginBaseService" />
|
||||
<bean name="genericEventConsumer" class="com.hzya.frame.plugin.kjs.service.GenericEventConsumer" />
|
||||
</beans>
|
||||
|
|
20
pom.xml
20
pom.xml
|
@ -62,7 +62,8 @@
|
|||
<minio.version>8.0.3</minio.version>
|
||||
<postgresql.version>42.2.6</postgresql.version>
|
||||
<jimureport.version>1.7.4</jimureport.version>
|
||||
|
||||
<dingtalk-stream-sdk.version>1.3.7</dingtalk-stream-sdk.version>
|
||||
<dingtalk-sdk.version>2.1.46</dingtalk-sdk.version>
|
||||
<!-- <groovy.version>4.0.15</groovy.version>-->
|
||||
</properties>
|
||||
<parent>
|
||||
|
@ -394,6 +395,23 @@
|
|||
<version>1.4.2.Final</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.dingtalk.open</groupId>
|
||||
<artifactId>app-stream-client</artifactId>
|
||||
<version>${dingtalk-stream-sdk.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>dingtalk</artifactId>
|
||||
<version>${dingtalk-sdk.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>alibaba-dingtalk-service-sdk</artifactId>
|
||||
<version>2.0.0</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
package com.hzya.frame.dingtalk.enums;
|
||||
|
||||
/**
|
||||
* @Description 通讯录事件类型
|
||||
* @Author xiangerlin
|
||||
* @Date 2024/8/27 15:58
|
||||
**/
|
||||
public enum OrgEventEnum {
|
||||
USER_ADD_ORG("user_add_org","通讯录用户新增"),
|
||||
USER_MODIFY_ORG("user_modify_org","通讯录用户更改"),
|
||||
USER_LEAVE_ORG("user_leave_org","通讯录用户离职"),
|
||||
USER_ACTIVE_ORG("user_active_org","加入企业后用户激活"),
|
||||
ORG_DEPT_CREATE("org_dept_create","通讯录企业部门创建"),
|
||||
ORG_DEPT_MODIFY("org_dept_modify","通讯录企业部门更改"),
|
||||
ORG_DEPT_REMOVE("org_dept_remove","通讯录企业部门删除"),
|
||||
;
|
||||
|
||||
|
||||
private String code;
|
||||
private String explain;
|
||||
|
||||
OrgEventEnum(String code, String explain) {
|
||||
this.code = code;
|
||||
this.explain = explain;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getExplain() {
|
||||
return explain;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据code获取事件类型
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
public static OrgEventEnum getByCode(String code){
|
||||
for (OrgEventEnum org : OrgEventEnum.values()) {
|
||||
if (org.getCode().equals(code)){
|
||||
return org;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package com.hzya.frame.dingtalk.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.sysnew.application.entity.SysApplicationEntity;
|
||||
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
|
||||
|
||||
/**
|
||||
* @Description 钉钉集成扩展类
|
||||
* @Author xiangerlin
|
||||
* @Date 2024/8/28 14:25
|
||||
**/
|
||||
public interface IDingTalkExtService {
|
||||
|
||||
/**
|
||||
* 调用这个方法初始化钉钉参数
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
SysExtensionApiEntity init(SysExtensionApiEntity entity);
|
||||
|
||||
/**
|
||||
* 查询配置在应用上的钉钉参数
|
||||
* @param sysApplication
|
||||
* @return
|
||||
*/
|
||||
JSONObject getDingTalkConfig(SysApplicationEntity sysApplication);
|
||||
|
||||
/**
|
||||
* 清空配置缓存
|
||||
*/
|
||||
void clearDingTalkConfigCatch();
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package com.hzya.frame.dingtalk.service;
|
||||
|
||||
import com.dingtalk.api.response.OapiV2DepartmentGetResponse;
|
||||
import com.dingtalk.api.response.OapiV2UserGetResponse;
|
||||
|
||||
/**
|
||||
* @Description 钉钉service
|
||||
* @Author xiangerlin
|
||||
* @Date 2024/8/27 16:17
|
||||
**/
|
||||
public interface IDingTalkService {
|
||||
|
||||
/**
|
||||
* 根据userid获取用户详情
|
||||
* @param userId 钉钉userid
|
||||
* @param appKey
|
||||
* @param appSecret
|
||||
* @return
|
||||
*/
|
||||
OapiV2UserGetResponse.UserGetResponse getUserById(String userId,String appKey,String appSecret);
|
||||
|
||||
/**
|
||||
* 根据userid获取用户详情
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
OapiV2UserGetResponse.UserGetResponse getUserById(String userId);
|
||||
|
||||
/**
|
||||
* 根据部门id获取部门详情
|
||||
* @param deptId 钉钉部门id
|
||||
* @param appKey
|
||||
* @param appSecret
|
||||
* @return
|
||||
*/
|
||||
OapiV2DepartmentGetResponse.DeptGetResponse getDeptById(Long deptId,String appKey,String appSecret);
|
||||
|
||||
/**
|
||||
* 根据部门id获取部门详情
|
||||
* @param deptId
|
||||
* @return
|
||||
*/
|
||||
OapiV2DepartmentGetResponse.DeptGetResponse getDeptById(Long deptId);
|
||||
}
|
|
@ -0,0 +1,100 @@
|
|||
package com.hzya.frame.dingtalk.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.dingtalk.service.IDingTalkExtService;
|
||||
import com.hzya.frame.dingtalk.util.DingTalkAccessToken;
|
||||
import com.hzya.frame.sysnew.application.api.entity.SysApplicationApiEntity;
|
||||
import com.hzya.frame.sysnew.application.apiPara.dao.ISysApplicationApiParaDao;
|
||||
import com.hzya.frame.sysnew.application.apiPara.entity.SysApplicationApiParaEntity;
|
||||
import com.hzya.frame.sysnew.application.apiPara.service.ISysApplicationApiParaService;
|
||||
import com.hzya.frame.sysnew.application.entity.SysApplicationEntity;
|
||||
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* @Description 钉钉集成扩展类
|
||||
* @Author xiangerlin
|
||||
* @Date 2024/8/28 14:25
|
||||
**/
|
||||
@Service
|
||||
public class DingTalkExtServiceImpl implements IDingTalkExtService {
|
||||
|
||||
|
||||
@Resource
|
||||
private ISysApplicationApiParaDao sysApplicationApiParaDao;
|
||||
private final ConcurrentHashMap<String, JSONObject> dingTalkMap = new ConcurrentHashMap<>();
|
||||
/**
|
||||
* 调用这个方法初始化钉钉参数
|
||||
*
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public SysExtensionApiEntity init(SysExtensionApiEntity entity) {
|
||||
Map<String, String> headers = entity.getHeaders();
|
||||
if (null == headers){
|
||||
headers = new HashMap<>();
|
||||
}
|
||||
SysApplicationEntity receiveApp = entity.getReceiveApp();
|
||||
//查询应用上配置的参数
|
||||
JSONObject dingTalkConfig = getDingTalkConfig(receiveApp);
|
||||
//给token赋值
|
||||
entity.setQuerys("access_token="+DingTalkAccessToken.getAccessToken(dingTalkConfig.getString("appKey"),dingTalkConfig.getString("appSecret")));
|
||||
return entity;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询配置在应用上的钉钉参数
|
||||
*
|
||||
* @param sysApplication
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public JSONObject getDingTalkConfig(SysApplicationEntity sysApplication) {
|
||||
if (null != sysApplication && StrUtil.isNotEmpty(sysApplication.getId()) && null != sysApplication.getAppId()){
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
String key = sysApplication.getAppId()+"dingTalk";
|
||||
if (null != dingTalkMap.get(key)){
|
||||
return dingTalkMap.get(key);
|
||||
}else {
|
||||
//查询应用上配置的参数
|
||||
SysApplicationApiParaEntity paraEntity = new SysApplicationApiParaEntity();
|
||||
paraEntity.setAppId(sysApplication.getId());
|
||||
List<SysApplicationApiParaEntity> paraList = sysApplicationApiParaDao.query(paraEntity);
|
||||
if (CollectionUtils.isNotEmpty(paraList)) {
|
||||
List<SysApplicationApiParaEntity> appKeyList = paraList.stream().filter(p -> p.getInterfaceKey().equals("appKey")).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(appKeyList)) {
|
||||
jsonObject.put("appKey", appKeyList.get(0).getInterfaceValue());
|
||||
}
|
||||
List<SysApplicationApiParaEntity> appSecretList = paraList.stream().filter(p -> p.getInterfaceKey().equals("appSecret")).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(appSecretList)) {
|
||||
jsonObject.put("appSecret", appSecretList.get(0).getInterfaceValue());
|
||||
}
|
||||
dingTalkMap.put(key,jsonObject);
|
||||
return dingTalkMap.get(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空配置缓存
|
||||
*/
|
||||
@Override
|
||||
public void clearDingTalkConfigCatch() {
|
||||
dingTalkMap.clear();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,110 @@
|
|||
package com.hzya.frame.dingtalk.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.dingtalk.api.DefaultDingTalkClient;
|
||||
import com.dingtalk.api.DingTalkClient;
|
||||
import com.dingtalk.api.request.OapiV2DepartmentGetRequest;
|
||||
import com.dingtalk.api.request.OapiV2UserGetRequest;
|
||||
import com.dingtalk.api.response.OapiV2DepartmentGetResponse;
|
||||
import com.dingtalk.api.response.OapiV2UserGetResponse;
|
||||
import com.hzya.frame.dingtalk.service.IDingTalkService;
|
||||
import com.hzya.frame.dingtalk.util.DingTalkAccessToken;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Description 钉钉service
|
||||
* @Author xiangerlin
|
||||
* @Date 2024/8/27 16:17
|
||||
**/
|
||||
@Service
|
||||
public class DingTalkServiceImpl implements IDingTalkService {
|
||||
Logger logger = LoggerFactory.getLogger(getClass());
|
||||
@Value("${dingtalk.appKey:}")
|
||||
private String dAppKey;
|
||||
@Value("${dingtalk.appSecret:}")
|
||||
private String dAppSecret;
|
||||
|
||||
|
||||
/**
|
||||
* 根据userid获取用户详情
|
||||
*
|
||||
* @param userId 钉钉userid
|
||||
* @param appKey
|
||||
* @param appSecret
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public OapiV2UserGetResponse.UserGetResponse getUserById(String userId, String appKey, String appSecret) {
|
||||
DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/v2/user/get");
|
||||
OapiV2UserGetRequest req = new OapiV2UserGetRequest();
|
||||
req.setUserid(userId);
|
||||
req.setLanguage("zh_CN");
|
||||
try {
|
||||
OapiV2UserGetResponse rsp = client.execute(req, DingTalkAccessToken.getAccessToken(appKey,appSecret));
|
||||
if (rsp.isSuccess()){
|
||||
OapiV2UserGetResponse.UserGetResponse result = rsp.getResult();
|
||||
String s = JSONObject.toJSONString(result);
|
||||
logger.info("人员详情信息:{}",s);
|
||||
return result;
|
||||
}
|
||||
}catch (Exception e){
|
||||
logger.error("根据部门id获取钉钉用户详情出错:{}",e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据userid获取用户详情
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public OapiV2UserGetResponse.UserGetResponse getUserById(String userId) {
|
||||
return getUserById(userId,dAppKey,dAppSecret);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据部门id获取部门详情
|
||||
*
|
||||
* @param deptId 钉钉部门id
|
||||
* @param appKey
|
||||
* @param appSecret
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public OapiV2DepartmentGetResponse.DeptGetResponse getDeptById(Long deptId, String appKey, String appSecret) {
|
||||
DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/v2/department/get");
|
||||
OapiV2DepartmentGetRequest req = new OapiV2DepartmentGetRequest();
|
||||
req.setDeptId(deptId);
|
||||
req.setLanguage("zh_CN");
|
||||
try {
|
||||
OapiV2DepartmentGetResponse rsp = client.execute(req, DingTalkAccessToken.getAccessToken(appKey,appSecret));
|
||||
if (rsp.isSuccess()){
|
||||
OapiV2DepartmentGetResponse.DeptGetResponse result = rsp.getResult();
|
||||
String s = JSONObject.toJSONString(result);
|
||||
logger.info("部门详情信息:{}",s);
|
||||
return result;
|
||||
}
|
||||
}catch(Exception e){
|
||||
logger.error("根据部门id获取钉钉部门出错:{}",e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据部门id获取部门详情
|
||||
*
|
||||
* @param deptId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public OapiV2DepartmentGetResponse.DeptGetResponse getDeptById(Long deptId) {
|
||||
return getDeptById(deptId,dAppKey,dAppSecret);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,103 @@
|
|||
package com.hzya.frame.dingtalk.util;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.aliyun.dingtalkoauth2_1_0.models.GetAccessTokenResponse;
|
||||
import com.aliyun.tea.TeaException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
||||
import java.time.Instant;
|
||||
|
||||
/**
|
||||
* @Description 钉钉获取accessToken
|
||||
* @Author xiangerlin
|
||||
* @Date 2024/8/27 14:05
|
||||
**/
|
||||
public class DingTalkAccessToken {
|
||||
static Logger logger = LoggerFactory.getLogger(DingTalkAccessToken.class);
|
||||
//token
|
||||
private static String accessToken;
|
||||
//过期时间
|
||||
private static Instant expireTime;
|
||||
private static final Long CACHE_EXPIRY_TIME = 7000L; // 缓存有效时间(秒)
|
||||
//应用key
|
||||
private static String appKey;
|
||||
//应用密钥
|
||||
private static String appSecret;
|
||||
@Value("${dingtalk.appKey:}")
|
||||
public static void setAppKey(String appKey) {
|
||||
DingTalkAccessToken.appKey = appKey;
|
||||
}
|
||||
@Value("${dingtalk.appSecret:}")
|
||||
public static void setAppSecret(String appSecret) {
|
||||
DingTalkAccessToken.appSecret = appSecret;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取token
|
||||
* @return
|
||||
*/
|
||||
public static String getAccessToken(){
|
||||
return getAccessToken(appKey,appSecret);
|
||||
}
|
||||
/**
|
||||
* 获取accessToken
|
||||
*
|
||||
* @param appKey
|
||||
* @param appSecret
|
||||
* @return
|
||||
*/
|
||||
public static String getAccessToken(String appKey,String appSecret) {
|
||||
//判断是否过期 如果没过期直接返回
|
||||
if (null != accessToken && expireTime != null && Instant.now().isBefore(expireTime)) {
|
||||
return accessToken;
|
||||
}
|
||||
//获取新的accessToken
|
||||
accessToken = fetchNewAccessToken(appKey,appSecret);
|
||||
//过期时间设置成当前事件+7000s,预留200s的时间
|
||||
expireTime = Instant.now().plusSeconds(CACHE_EXPIRY_TIME);
|
||||
return accessToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取新的accessToken
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private static String fetchNewAccessToken(String appKey,String appSecret) {
|
||||
try {
|
||||
//查询应用上配置的钉钉信息
|
||||
if (StrUtil.isNotEmpty(appKey) && StrUtil.isNotEmpty(appSecret)) {
|
||||
//查询应用上的信息
|
||||
com.aliyun.dingtalkoauth2_1_0.Client client = DingTalkAccessToken.createClient();
|
||||
com.aliyun.dingtalkoauth2_1_0.models.GetAccessTokenRequest getAccessTokenRequest = new com.aliyun.dingtalkoauth2_1_0.models.GetAccessTokenRequest()
|
||||
.setAppKey(appKey)
|
||||
.setAppSecret(appSecret);
|
||||
GetAccessTokenResponse accessToken = client.getAccessToken(getAccessTokenRequest);
|
||||
String accessToken1 = accessToken.getBody().getAccessToken();
|
||||
return accessToken1;
|
||||
}
|
||||
} catch (Exception _err) {
|
||||
TeaException err = new TeaException(_err.getMessage(), _err);
|
||||
if (!com.aliyun.teautil.Common.empty(err.code) && !com.aliyun.teautil.Common.empty(err.message)) {
|
||||
// err 中含有 code 和 message 属性,可帮助开发定位问题
|
||||
}
|
||||
logger.error("获取钉钉token出错:{}", _err);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用 Token 初始化账号Client
|
||||
*
|
||||
* @return Client
|
||||
* @throws Exception
|
||||
*/
|
||||
private static com.aliyun.dingtalkoauth2_1_0.Client createClient() throws Exception {
|
||||
com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config();
|
||||
config.protocol = "https";
|
||||
config.regionId = "central";
|
||||
return new com.aliyun.dingtalkoauth2_1_0.Client(config);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.hzya.frame.excel.template.dao;
|
||||
|
||||
import com.hzya.frame.excel.template.entity.ExcelTemplateEntity;
|
||||
import com.hzya.frame.basedao.dao.IBaseDao;
|
||||
|
||||
/**
|
||||
* excel模版表(excel_template: table)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-08-12 16:42:49
|
||||
*/
|
||||
public interface IExcelTemplateDao extends IBaseDao<ExcelTemplateEntity, String> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.hzya.frame.excel.template.dao.impl;
|
||||
|
||||
import com.hzya.frame.excel.template.entity.ExcelTemplateEntity;
|
||||
import com.hzya.frame.excel.template.dao.IExcelTemplateDao;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
||||
/**
|
||||
* excel模版表(ExcelTemplate)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-08-12 16:42:50
|
||||
*/
|
||||
@Repository(value = "ExcelTemplateDaoImpl")
|
||||
public class ExcelTemplateDaoImpl extends MybatisGenericDao<ExcelTemplateEntity, String> implements IExcelTemplateDao{
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
package com.hzya.frame.excel.template.entity;
|
||||
|
||||
import java.util.Date;
|
||||
import com.hzya.frame.web.entity.BaseEntity;
|
||||
/**
|
||||
* excel模版表(ExcelTemplate)实体类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-08-12 16:42:50
|
||||
*/
|
||||
public class ExcelTemplateEntity extends BaseEntity {
|
||||
|
||||
/** 模版名称 */
|
||||
private String templateName;
|
||||
/** 应用id */
|
||||
private String appId;
|
||||
/** 模版编码 */
|
||||
private String templateCode;
|
||||
/** 绑定菜单 */
|
||||
private String menuBind;
|
||||
/** 菜单按钮 */
|
||||
private String menuButton;
|
||||
/** 公司id */
|
||||
private String companyId;
|
||||
|
||||
|
||||
public String getTemplateName() {
|
||||
return templateName;
|
||||
}
|
||||
|
||||
public void setTemplateName(String templateName) {
|
||||
this.templateName = templateName;
|
||||
}
|
||||
|
||||
public String getAppId() {
|
||||
return appId;
|
||||
}
|
||||
|
||||
public void setAppId(String appId) {
|
||||
this.appId = appId;
|
||||
}
|
||||
|
||||
public String getTemplateCode() {
|
||||
return templateCode;
|
||||
}
|
||||
|
||||
public void setTemplateCode(String templateCode) {
|
||||
this.templateCode = templateCode;
|
||||
}
|
||||
|
||||
public String getMenuBind() {
|
||||
return menuBind;
|
||||
}
|
||||
|
||||
public void setMenuBind(String menuBind) {
|
||||
this.menuBind = menuBind;
|
||||
}
|
||||
|
||||
public String getMenuButton() {
|
||||
return menuButton;
|
||||
}
|
||||
|
||||
public void setMenuButton(String menuButton) {
|
||||
this.menuButton = menuButton;
|
||||
}
|
||||
|
||||
public String getCompanyId() {
|
||||
return companyId;
|
||||
}
|
||||
|
||||
public void setCompanyId(String companyId) {
|
||||
this.companyId = companyId;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,261 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.hzya.frame.excel.template.dao.impl.ExcelTemplateDaoImpl">
|
||||
|
||||
<resultMap id="get-ExcelTemplateEntity-result" type="com.hzya.frame.excel.template.entity.ExcelTemplateEntity" >
|
||||
<result property="templateName" column="template_name" jdbcType="VARCHAR"/>
|
||||
<result property="appId" column="app_id" jdbcType="VARCHAR"/>
|
||||
<result property="templateCode" column="template_code" jdbcType="VARCHAR"/>
|
||||
<result property="menuBind" column="menu_bind" jdbcType="VARCHAR"/>
|
||||
<result property="menuButton" column="menu_button" jdbcType="VARCHAR"/>
|
||||
<result property="sorts" column="sorts" jdbcType="INTEGER"/>
|
||||
<result property="id" column="id" jdbcType="VARCHAR"/>
|
||||
<result property="create_user_id" column="create_user_id" jdbcType="VARCHAR"/>
|
||||
<result property="create_time" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="modify_time" column="modify_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="modify_user_id" column="modify_user_id" jdbcType="VARCHAR"/>
|
||||
<result property="org_id" column="org_id" jdbcType="VARCHAR"/>
|
||||
<result property="companyId" column="company_id" jdbcType="VARCHAR"/>
|
||||
<result property="sts" column="sts" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
<!-- 查询的字段-->
|
||||
<sql id = "ExcelTemplateEntity_Base_Column_List">
|
||||
template_name
|
||||
,app_id
|
||||
,template_code
|
||||
,menu_bind
|
||||
,menu_button
|
||||
,sorts
|
||||
,id
|
||||
,create_user_id
|
||||
,create_time
|
||||
,modify_time
|
||||
,modify_user_id
|
||||
,org_id
|
||||
,company_id
|
||||
,sts
|
||||
</sql>
|
||||
|
||||
<!--通过ID获取数据 -->
|
||||
<select id="entity_get" resultMap="get-ExcelTemplateEntity-result">
|
||||
select
|
||||
<include refid="ExcelTemplateEntity_Base_Column_List" />
|
||||
from excel_template where sts = 'Y' and id = #{id}
|
||||
</select>
|
||||
<!-- 查询 采用==查询 -->
|
||||
<select id="entity_list_base" resultMap="get-ExcelTemplateEntity-result" parameterType = "com.hzya.frame.excel.template.entity.ExcelTemplateEntity">
|
||||
select
|
||||
<include refid="ExcelTemplateEntity_Base_Column_List" />
|
||||
from excel_template
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="templateName != null and templateName != ''"> and template_name = #{templateName} </if>
|
||||
<if test="appId != null and appId != ''"> and app_id = #{appId} </if>
|
||||
<if test="templateCode != null and templateCode != ''"> and template_code = #{templateCode} </if>
|
||||
<if test="menuBind != null and menuBind != ''"> and menu_bind = #{menuBind} </if>
|
||||
<if test="menuButton != null and menuButton != ''"> and menu_button = #{menuButton} </if>
|
||||
<if test="sorts != null"> and sorts = #{sorts} </if>
|
||||
<if test="id != null and id != ''"> and id = #{id} </if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> and create_user_id = #{create_user_id} </if>
|
||||
<if test="create_time != null"> and create_time = #{create_time} </if>
|
||||
<if test="modify_time != null"> and modify_time = #{modify_time} </if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id = #{modify_user_id} </if>
|
||||
<if test="org_id != null and org_id != ''"> and org_id = #{org_id} </if>
|
||||
<if test="companyId != null and companyId != ''"> and company_id = #{companyId} </if>
|
||||
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
|
||||
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
|
||||
</select>
|
||||
|
||||
<!-- 查询符合条件的数量 -->
|
||||
<select id="entity_count" resultType="Integer" parameterType = "com.hzya.frame.excel.template.entity.ExcelTemplateEntity">
|
||||
select count(1) from excel_template
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="templateName != null and templateName != ''"> and template_name = #{templateName} </if>
|
||||
<if test="appId != null and appId != ''"> and app_id = #{appId} </if>
|
||||
<if test="templateCode != null and templateCode != ''"> and template_code = #{templateCode} </if>
|
||||
<if test="menuBind != null and menuBind != ''"> and menu_bind = #{menuBind} </if>
|
||||
<if test="menuButton != null and menuButton != ''"> and menu_button = #{menuButton} </if>
|
||||
<if test="sorts != null"> and sorts = #{sorts} </if>
|
||||
<if test="id != null and id != ''"> and id = #{id} </if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> and create_user_id = #{create_user_id} </if>
|
||||
<if test="create_time != null"> and create_time = #{create_time} </if>
|
||||
<if test="modify_time != null"> and modify_time = #{modify_time} </if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id = #{modify_user_id} </if>
|
||||
<if test="org_id != null and org_id != ''"> and org_id = #{org_id} </if>
|
||||
<if test="companyId != null and companyId != ''"> and company_id = #{companyId} </if>
|
||||
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
|
||||
<if test=" sort !='' and sort!=null and order !='' and order!=null "> order by ${sort} ${order}</if>
|
||||
</select>
|
||||
|
||||
<!-- 分页查询列表 采用like格式 -->
|
||||
<select id="entity_list_like" resultMap="get-ExcelTemplateEntity-result" parameterType = "com.hzya.frame.excel.template.entity.ExcelTemplateEntity">
|
||||
select
|
||||
<include refid="ExcelTemplateEntity_Base_Column_List" />
|
||||
from excel_template
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="templateName != null and templateName != ''"> and template_name like concat('%',#{templateName},'%') </if>
|
||||
<if test="appId != null and appId != ''"> and app_id like concat('%',#{appId},'%') </if>
|
||||
<if test="templateCode != null and templateCode != ''"> and template_code like concat('%',#{templateCode},'%') </if>
|
||||
<if test="menuBind != null and menuBind != ''"> and menu_bind like concat('%',#{menuBind},'%') </if>
|
||||
<if test="menuButton != null and menuButton != ''"> and menu_button like concat('%',#{menuButton},'%') </if>
|
||||
<if test="sorts != null"> and sorts like concat('%',#{sorts},'%') </if>
|
||||
<if test="id != null and id != ''"> and id like concat('%',#{id},'%') </if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> and create_user_id like concat('%',#{create_user_id},'%') </if>
|
||||
<if test="create_time != null"> and create_time like concat('%',#{create_time},'%') </if>
|
||||
<if test="modify_time != null"> and modify_time like concat('%',#{modify_time},'%') </if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id like concat('%',#{modify_user_id},'%') </if>
|
||||
<if test="org_id != null and org_id != ''"> and org_id like concat('%',#{org_id},'%') </if>
|
||||
<if test="companyId != null and companyId != ''"> and company_id like concat('%',#{companyId},'%') </if>
|
||||
<if test="sts != null and sts != ''"> and sts like concat('%',#{sts},'%') </if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
|
||||
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
|
||||
</select>
|
||||
|
||||
<!-- 查询列表 字段采用or格式 -->
|
||||
<select id="ExcelTemplateentity_list_or" resultMap="get-ExcelTemplateEntity-result" parameterType = "com.hzya.frame.excel.template.entity.ExcelTemplateEntity">
|
||||
select
|
||||
<include refid="ExcelTemplateEntity_Base_Column_List" />
|
||||
from excel_template
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="templateName != null and templateName != ''"> or template_name = #{templateName} </if>
|
||||
<if test="appId != null and appId != ''"> or app_id = #{appId} </if>
|
||||
<if test="templateCode != null and templateCode != ''"> or template_code = #{templateCode} </if>
|
||||
<if test="menuBind != null and menuBind != ''"> or menu_bind = #{menuBind} </if>
|
||||
<if test="menuButton != null and menuButton != ''"> or menu_button = #{menuButton} </if>
|
||||
<if test="sorts != null"> or sorts = #{sorts} </if>
|
||||
<if test="id != null and id != ''"> or id = #{id} </if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> or create_user_id = #{create_user_id} </if>
|
||||
<if test="create_time != null"> or create_time = #{create_time} </if>
|
||||
<if test="modify_time != null"> or modify_time = #{modify_time} </if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> or modify_user_id = #{modify_user_id} </if>
|
||||
<if test="org_id != null and org_id != ''"> or org_id = #{org_id} </if>
|
||||
<if test="companyId != null and companyId != ''"> or company_id = #{companyId} </if>
|
||||
<if test="sts != null and sts != ''"> or sts = #{sts} </if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
|
||||
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
|
||||
</select>
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="entity_insert" parameterType = "com.hzya.frame.excel.template.entity.ExcelTemplateEntity" keyProperty="sorts" useGeneratedKeys="true">
|
||||
insert into excel_template(
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="templateName != null and templateName != ''"> template_name , </if>
|
||||
<if test="appId != null and appId != ''"> app_id , </if>
|
||||
<if test="templateCode != null and templateCode != ''"> template_code , </if>
|
||||
<if test="menuBind != null and menuBind != ''"> menu_bind , </if>
|
||||
<if test="menuButton != null and menuButton != ''"> menu_button , </if>
|
||||
<if test="sorts != null"> sorts , </if>
|
||||
<if test="id != null and id != ''"> id , </if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> create_user_id , </if>
|
||||
<if test="create_time != null"> create_time , </if>
|
||||
<if test="modify_time != null"> modify_time , </if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> modify_user_id , </if>
|
||||
<if test="org_id != null and org_id != ''"> org_id , </if>
|
||||
<if test="companyId != null and companyId != ''"> company_id , </if>
|
||||
<if test="sts != null and sts != ''"> sts , </if>
|
||||
<if test="sts == null ">sts,</if>
|
||||
</trim>
|
||||
)values(
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="templateName != null and templateName != ''"> #{templateName} ,</if>
|
||||
<if test="appId != null and appId != ''"> #{appId} ,</if>
|
||||
<if test="templateCode != null and templateCode != ''"> #{templateCode} ,</if>
|
||||
<if test="menuBind != null and menuBind != ''"> #{menuBind} ,</if>
|
||||
<if test="menuButton != null and menuButton != ''"> #{menuButton} ,</if>
|
||||
<if test="sorts != null"> #{sorts} ,</if>
|
||||
<if test="id != null and id != ''"> #{id} ,</if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> #{create_user_id} ,</if>
|
||||
<if test="create_time != null"> #{create_time} ,</if>
|
||||
<if test="modify_time != null"> #{modify_time} ,</if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> #{modify_user_id} ,</if>
|
||||
<if test="org_id != null and org_id != ''"> #{org_id} ,</if>
|
||||
<if test="companyId != null and companyId != ''"> #{companyId} ,</if>
|
||||
<if test="sts != null and sts != ''"> #{sts} ,</if>
|
||||
<if test="sts == null ">'Y',</if>
|
||||
</trim>
|
||||
)
|
||||
</insert>
|
||||
<!-- 批量新增 -->
|
||||
<insert id="entityInsertBatch" keyProperty="sorts" useGeneratedKeys="true">
|
||||
insert into excel_template(template_name, app_id, template_code, menu_bind, menu_button, create_user_id, create_time, modify_time, modify_user_id, org_id, company_id, sts, sts)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.templateName},#{entity.appId},#{entity.templateCode},#{entity.menuBind},#{entity.menuButton},#{entity.create_user_id},#{entity.create_time},#{entity.modify_time},#{entity.modify_user_id},#{entity.org_id},#{entity.companyId},#{entity.sts}, 'Y')
|
||||
</foreach>
|
||||
</insert>
|
||||
<!-- 批量新增或者修改-->
|
||||
<insert id="entityInsertOrUpdateBatch" keyProperty="sorts" useGeneratedKeys="true">
|
||||
insert into excel_template(template_name, app_id, template_code, menu_bind, menu_button, create_user_id, create_time, modify_time, modify_user_id, org_id, company_id, sts)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.templateName},#{entity.appId},#{entity.templateCode},#{entity.menuBind},#{entity.menuButton},#{entity.create_user_id},#{entity.create_time},#{entity.modify_time},#{entity.modify_user_id},#{entity.org_id},#{entity.companyId},#{entity.sts})
|
||||
</foreach>
|
||||
on duplicate key update
|
||||
template_name = values(template_name),
|
||||
app_id = values(app_id),
|
||||
template_code = values(template_code),
|
||||
menu_bind = values(menu_bind),
|
||||
menu_button = values(menu_button),
|
||||
create_user_id = values(create_user_id),
|
||||
create_time = values(create_time),
|
||||
modify_time = values(modify_time),
|
||||
modify_user_id = values(modify_user_id),
|
||||
org_id = values(org_id),
|
||||
company_id = values(company_id),
|
||||
sts = values(sts)</insert>
|
||||
<!--通过主键修改方法-->
|
||||
<update id="entity_update" parameterType = "com.hzya.frame.excel.template.entity.ExcelTemplateEntity" >
|
||||
update excel_template set
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="templateName != null and templateName != ''"> template_name = #{templateName},</if>
|
||||
<if test="appId != null and appId != ''"> app_id = #{appId},</if>
|
||||
<if test="templateCode != null and templateCode != ''"> template_code = #{templateCode},</if>
|
||||
<if test="menuBind != null and menuBind != ''"> menu_bind = #{menuBind},</if>
|
||||
<if test="menuButton != null and menuButton != ''"> menu_button = #{menuButton},</if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> create_user_id = #{create_user_id},</if>
|
||||
<if test="create_time != null"> create_time = #{create_time},</if>
|
||||
<if test="modify_time != null"> modify_time = #{modify_time},</if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> modify_user_id = #{modify_user_id},</if>
|
||||
<if test="org_id != null and org_id != ''"> org_id = #{org_id},</if>
|
||||
<if test="companyId != null and companyId != ''"> company_id = #{companyId},</if>
|
||||
<if test="sts != null and sts != ''"> sts = #{sts},</if>
|
||||
</trim>
|
||||
where sorts = #{sorts}
|
||||
</update>
|
||||
<!-- 逻辑删除 -->
|
||||
<update id="entity_logicDelete" parameterType = "com.hzya.frame.excel.template.entity.ExcelTemplateEntity" >
|
||||
update excel_template set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
|
||||
where sorts = #{sorts}
|
||||
</update>
|
||||
<!-- 多条件逻辑删除 -->
|
||||
<update id="entity_logicDelete_Multi_Condition" parameterType = "com.hzya.frame.excel.template.entity.ExcelTemplateEntity" >
|
||||
update excel_template set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="templateName != null and templateName != ''"> and template_name = #{templateName} </if>
|
||||
<if test="appId != null and appId != ''"> and app_id = #{appId} </if>
|
||||
<if test="templateCode != null and templateCode != ''"> and template_code = #{templateCode} </if>
|
||||
<if test="menuBind != null and menuBind != ''"> and menu_bind = #{menuBind} </if>
|
||||
<if test="menuButton != null and menuButton != ''"> and menu_button = #{menuButton} </if>
|
||||
<if test="sorts != null"> and sorts = #{sorts} </if>
|
||||
<if test="id != null and id != ''"> and id = #{id} </if>
|
||||
<if test="companyId != null and companyId != ''"> and company_id = #{companyId} </if>
|
||||
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
</update>
|
||||
<!--通过主键删除-->
|
||||
<delete id="entity_delete">
|
||||
delete from excel_template where sorts = #{sorts}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package com.hzya.frame.excel.template.service;
|
||||
|
||||
import com.hzya.frame.excel.template.entity.ExcelTemplateEntity;
|
||||
import com.hzya.frame.basedao.service.IBaseService;
|
||||
/**
|
||||
* excel模版表(ExcelTemplate)表服务接口
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-08-12 16:42:50
|
||||
*/
|
||||
public interface IExcelTemplateService extends IBaseService<ExcelTemplateEntity, String>{
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package com.hzya.frame.excel.template.service.impl;
|
||||
|
||||
import com.hzya.frame.excel.template.entity.ExcelTemplateEntity;
|
||||
import com.hzya.frame.excel.template.dao.IExcelTemplateDao;
|
||||
import com.hzya.frame.excel.template.service.IExcelTemplateService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import javax.annotation.Resource;
|
||||
import com.hzya.frame.basedao.service.impl.BaseService;
|
||||
/**
|
||||
* excel模版表(ExcelTemplate)表服务实现类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-08-12 16:42:50
|
||||
*/
|
||||
@Service(value = "excelTemplateService")
|
||||
public class ExcelTemplateServiceImpl extends BaseService<ExcelTemplateEntity, String> implements IExcelTemplateService {
|
||||
|
||||
private IExcelTemplateDao excelTemplateDao;
|
||||
|
||||
@Autowired
|
||||
public void setExcelTemplateDao(IExcelTemplateDao dao) {
|
||||
this.excelTemplateDao = dao;
|
||||
this.dao = dao;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.hzya.frame.excel.templateConfig.dao;
|
||||
|
||||
import com.hzya.frame.excel.templateConfig.entity.ExcelTemplateConfigEntity;
|
||||
import com.hzya.frame.basedao.dao.IBaseDao;
|
||||
|
||||
/**
|
||||
* excel模版配置表(excel_template_config: table)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-08-12 16:43:38
|
||||
*/
|
||||
public interface IExcelTemplateConfigDao extends IBaseDao<ExcelTemplateConfigEntity, String> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.hzya.frame.excel.templateConfig.dao.impl;
|
||||
|
||||
import com.hzya.frame.excel.templateConfig.entity.ExcelTemplateConfigEntity;
|
||||
import com.hzya.frame.excel.templateConfig.dao.IExcelTemplateConfigDao;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
||||
/**
|
||||
* excel模版配置表(ExcelTemplateConfig)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-08-12 16:43:38
|
||||
*/
|
||||
@Repository(value = "ExcelTemplateConfigDaoImpl")
|
||||
public class ExcelTemplateConfigDaoImpl extends MybatisGenericDao<ExcelTemplateConfigEntity, String> implements IExcelTemplateConfigDao{
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
package com.hzya.frame.excel.templateConfig.entity;
|
||||
|
||||
import java.util.Date;
|
||||
import com.hzya.frame.web.entity.BaseEntity;
|
||||
/**
|
||||
* excel模版配置表(ExcelTemplateConfig)实体类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-08-12 16:43:38
|
||||
*/
|
||||
public class ExcelTemplateConfigEntity extends BaseEntity {
|
||||
|
||||
/** 模版id */
|
||||
private String templateId;
|
||||
/** 类型(数据库表/语句) */
|
||||
private String type;
|
||||
/** 表类型(主表/明细) */
|
||||
private String tableType;
|
||||
/** 数据字典id */
|
||||
private String dataDictionaryId;
|
||||
/** 公司id */
|
||||
private String companyId;
|
||||
|
||||
|
||||
public String getTemplateId() {
|
||||
return templateId;
|
||||
}
|
||||
|
||||
public void setTemplateId(String templateId) {
|
||||
this.templateId = templateId;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getTableType() {
|
||||
return tableType;
|
||||
}
|
||||
|
||||
public void setTableType(String tableType) {
|
||||
this.tableType = tableType;
|
||||
}
|
||||
|
||||
public String getDataDictionaryId() {
|
||||
return dataDictionaryId;
|
||||
}
|
||||
|
||||
public void setDataDictionaryId(String dataDictionaryId) {
|
||||
this.dataDictionaryId = dataDictionaryId;
|
||||
}
|
||||
|
||||
public String getCompanyId() {
|
||||
return companyId;
|
||||
}
|
||||
|
||||
public void setCompanyId(String companyId) {
|
||||
this.companyId = companyId;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,243 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.hzya.frame.excel.templateConfig.dao.impl.ExcelTemplateConfigDaoImpl">
|
||||
|
||||
<resultMap id="get-ExcelTemplateConfigEntity-result" type="com.hzya.frame.excel.templateConfig.entity.ExcelTemplateConfigEntity" >
|
||||
<result property="templateId" column="template_id" jdbcType="VARCHAR"/>
|
||||
<result property="type" column="type" jdbcType="VARCHAR"/>
|
||||
<result property="tableType" column="table_type" jdbcType="VARCHAR"/>
|
||||
<result property="dataDictionaryId" column="data_dictionary_id" jdbcType="VARCHAR"/>
|
||||
<result property="sorts" column="sorts" jdbcType="INTEGER"/>
|
||||
<result property="id" column="id" jdbcType="VARCHAR"/>
|
||||
<result property="create_user_id" column="create_user_id" jdbcType="VARCHAR"/>
|
||||
<result property="create_time" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="modify_time" column="modify_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="modify_user_id" column="modify_user_id" jdbcType="VARCHAR"/>
|
||||
<result property="org_id" column="org_id" jdbcType="VARCHAR"/>
|
||||
<result property="companyId" column="company_id" jdbcType="VARCHAR"/>
|
||||
<result property="sts" column="sts" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
<!-- 查询的字段-->
|
||||
<sql id = "ExcelTemplateConfigEntity_Base_Column_List">
|
||||
template_id
|
||||
,type
|
||||
,table_type
|
||||
,data_dictionary_id
|
||||
,sorts
|
||||
,id
|
||||
,create_user_id
|
||||
,create_time
|
||||
,modify_time
|
||||
,modify_user_id
|
||||
,org_id
|
||||
,company_id
|
||||
,sts
|
||||
</sql>
|
||||
<!-- 查询 采用==查询 -->
|
||||
<select id="entity_list_base" resultMap="get-ExcelTemplateConfigEntity-result" parameterType = "com.hzya.frame.excel.templateConfig.entity.ExcelTemplateConfigEntity">
|
||||
select
|
||||
<include refid="ExcelTemplateConfigEntity_Base_Column_List" />
|
||||
from excel_template_config
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="templateId != null and templateId != ''"> and template_id = #{templateId} </if>
|
||||
<if test="type != null and type != ''"> and type = #{type} </if>
|
||||
<if test="tableType != null and tableType != ''"> and table_type = #{tableType} </if>
|
||||
<if test="dataDictionaryId != null and dataDictionaryId != ''"> and data_dictionary_id = #{dataDictionaryId} </if>
|
||||
<if test="sorts != null"> and sorts = #{sorts} </if>
|
||||
<if test="id != null and id != ''"> and id = #{id} </if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> and create_user_id = #{create_user_id} </if>
|
||||
<if test="create_time != null"> and create_time = #{create_time} </if>
|
||||
<if test="modify_time != null"> and modify_time = #{modify_time} </if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id = #{modify_user_id} </if>
|
||||
<if test="org_id != null and org_id != ''"> and org_id = #{org_id} </if>
|
||||
<if test="companyId != null and companyId != ''"> and company_id = #{companyId} </if>
|
||||
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
|
||||
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
|
||||
</select>
|
||||
|
||||
<!-- 查询符合条件的数量 -->
|
||||
<select id="entity_count" resultType="Integer" parameterType = "com.hzya.frame.excel.templateConfig.entity.ExcelTemplateConfigEntity">
|
||||
select count(1) from excel_template_config
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="templateId != null and templateId != ''"> and template_id = #{templateId} </if>
|
||||
<if test="type != null and type != ''"> and type = #{type} </if>
|
||||
<if test="tableType != null and tableType != ''"> and table_type = #{tableType} </if>
|
||||
<if test="dataDictionaryId != null and dataDictionaryId != ''"> and data_dictionary_id = #{dataDictionaryId} </if>
|
||||
<if test="sorts != null"> and sorts = #{sorts} </if>
|
||||
<if test="id != null and id != ''"> and id = #{id} </if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> and create_user_id = #{create_user_id} </if>
|
||||
<if test="create_time != null"> and create_time = #{create_time} </if>
|
||||
<if test="modify_time != null"> and modify_time = #{modify_time} </if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id = #{modify_user_id} </if>
|
||||
<if test="org_id != null and org_id != ''"> and org_id = #{org_id} </if>
|
||||
<if test="companyId != null and companyId != ''"> and company_id = #{companyId} </if>
|
||||
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
|
||||
<if test=" sort !='' and sort!=null and order !='' and order!=null "> order by ${sort} ${order}</if>
|
||||
</select>
|
||||
|
||||
<!-- 分页查询列表 采用like格式 -->
|
||||
<select id="entity_list_like" resultMap="get-ExcelTemplateConfigEntity-result" parameterType = "com.hzya.frame.excel.templateConfig.entity.ExcelTemplateConfigEntity">
|
||||
select
|
||||
<include refid="ExcelTemplateConfigEntity_Base_Column_List" />
|
||||
from excel_template_config
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="templateId != null and templateId != ''"> and template_id like concat('%',#{templateId},'%') </if>
|
||||
<if test="type != null and type != ''"> and type like concat('%',#{type},'%') </if>
|
||||
<if test="tableType != null and tableType != ''"> and table_type like concat('%',#{tableType},'%') </if>
|
||||
<if test="dataDictionaryId != null and dataDictionaryId != ''"> and data_dictionary_id like concat('%',#{dataDictionaryId},'%') </if>
|
||||
<if test="sorts != null"> and sorts like concat('%',#{sorts},'%') </if>
|
||||
<if test="id != null and id != ''"> and id like concat('%',#{id},'%') </if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> and create_user_id like concat('%',#{create_user_id},'%') </if>
|
||||
<if test="create_time != null"> and create_time like concat('%',#{create_time},'%') </if>
|
||||
<if test="modify_time != null"> and modify_time like concat('%',#{modify_time},'%') </if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id like concat('%',#{modify_user_id},'%') </if>
|
||||
<if test="org_id != null and org_id != ''"> and org_id like concat('%',#{org_id},'%') </if>
|
||||
<if test="companyId != null and companyId != ''"> and company_id like concat('%',#{companyId},'%') </if>
|
||||
<if test="sts != null and sts != ''"> and sts like concat('%',#{sts},'%') </if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
|
||||
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
|
||||
</select>
|
||||
|
||||
<!-- 查询列表 字段采用or格式 -->
|
||||
<select id="ExcelTemplateConfigentity_list_or" resultMap="get-ExcelTemplateConfigEntity-result" parameterType = "com.hzya.frame.excel.templateConfig.entity.ExcelTemplateConfigEntity">
|
||||
select
|
||||
<include refid="ExcelTemplateConfigEntity_Base_Column_List" />
|
||||
from excel_template_config
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="templateId != null and templateId != ''"> or template_id = #{templateId} </if>
|
||||
<if test="type != null and type != ''"> or type = #{type} </if>
|
||||
<if test="tableType != null and tableType != ''"> or table_type = #{tableType} </if>
|
||||
<if test="dataDictionaryId != null and dataDictionaryId != ''"> or data_dictionary_id = #{dataDictionaryId} </if>
|
||||
<if test="sorts != null"> or sorts = #{sorts} </if>
|
||||
<if test="id != null and id != ''"> or id = #{id} </if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> or create_user_id = #{create_user_id} </if>
|
||||
<if test="create_time != null"> or create_time = #{create_time} </if>
|
||||
<if test="modify_time != null"> or modify_time = #{modify_time} </if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> or modify_user_id = #{modify_user_id} </if>
|
||||
<if test="org_id != null and org_id != ''"> or org_id = #{org_id} </if>
|
||||
<if test="companyId != null and companyId != ''"> or company_id = #{companyId} </if>
|
||||
<if test="sts != null and sts != ''"> or sts = #{sts} </if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
|
||||
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
|
||||
</select>
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="entity_insert" parameterType = "com.hzya.frame.excel.templateConfig.entity.ExcelTemplateConfigEntity" keyProperty="sorts" useGeneratedKeys="true">
|
||||
insert into excel_template_config(
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="templateId != null and templateId != ''"> template_id , </if>
|
||||
<if test="type != null and type != ''"> type , </if>
|
||||
<if test="tableType != null and tableType != ''"> table_type , </if>
|
||||
<if test="dataDictionaryId != null and dataDictionaryId != ''"> data_dictionary_id , </if>
|
||||
<if test="sorts != null"> sorts , </if>
|
||||
<if test="id != null and id != ''"> id , </if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> create_user_id , </if>
|
||||
<if test="create_time != null"> create_time , </if>
|
||||
<if test="modify_time != null"> modify_time , </if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> modify_user_id , </if>
|
||||
<if test="org_id != null and org_id != ''"> org_id , </if>
|
||||
<if test="companyId != null and companyId != ''"> company_id , </if>
|
||||
<if test="sts != null and sts != ''"> sts , </if>
|
||||
<if test="sts == null ">sts,</if>
|
||||
</trim>
|
||||
)values(
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="templateId != null and templateId != ''"> #{templateId} ,</if>
|
||||
<if test="type != null and type != ''"> #{type} ,</if>
|
||||
<if test="tableType != null and tableType != ''"> #{tableType} ,</if>
|
||||
<if test="dataDictionaryId != null and dataDictionaryId != ''"> #{dataDictionaryId} ,</if>
|
||||
<if test="sorts != null"> #{sorts} ,</if>
|
||||
<if test="id != null and id != ''"> #{id} ,</if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> #{create_user_id} ,</if>
|
||||
<if test="create_time != null"> #{create_time} ,</if>
|
||||
<if test="modify_time != null"> #{modify_time} ,</if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> #{modify_user_id} ,</if>
|
||||
<if test="org_id != null and org_id != ''"> #{org_id} ,</if>
|
||||
<if test="companyId != null and companyId != ''"> #{companyId} ,</if>
|
||||
<if test="sts != null and sts != ''"> #{sts} ,</if>
|
||||
<if test="sts == null ">'Y',</if>
|
||||
</trim>
|
||||
)
|
||||
</insert>
|
||||
<!-- 批量新增 -->
|
||||
<insert id="entityInsertBatch" keyProperty="sorts" useGeneratedKeys="true">
|
||||
insert into excel_template_config(template_id, type, table_type, data_dictionary_id, create_user_id, create_time, modify_time, modify_user_id, org_id, company_id, sts, sts)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.templateId},#{entity.type},#{entity.tableType},#{entity.dataDictionaryId},#{entity.create_user_id},#{entity.create_time},#{entity.modify_time},#{entity.modify_user_id},#{entity.org_id},#{entity.companyId},#{entity.sts}, 'Y')
|
||||
</foreach>
|
||||
</insert>
|
||||
<!-- 批量新增或者修改-->
|
||||
<insert id="entityInsertOrUpdateBatch" keyProperty="sorts" useGeneratedKeys="true">
|
||||
insert into excel_template_config(template_id, type, table_type, data_dictionary_id, create_user_id, create_time, modify_time, modify_user_id, org_id, company_id, sts)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.templateId},#{entity.type},#{entity.tableType},#{entity.dataDictionaryId},#{entity.create_user_id},#{entity.create_time},#{entity.modify_time},#{entity.modify_user_id},#{entity.org_id},#{entity.companyId},#{entity.sts})
|
||||
</foreach>
|
||||
on duplicate key update
|
||||
template_id = values(template_id),
|
||||
type = values(type),
|
||||
table_type = values(table_type),
|
||||
data_dictionary_id = values(data_dictionary_id),
|
||||
create_user_id = values(create_user_id),
|
||||
create_time = values(create_time),
|
||||
modify_time = values(modify_time),
|
||||
modify_user_id = values(modify_user_id),
|
||||
org_id = values(org_id),
|
||||
company_id = values(company_id),
|
||||
sts = values(sts)</insert>
|
||||
<!--通过主键修改方法-->
|
||||
<update id="entity_update" parameterType = "com.hzya.frame.excel.templateConfig.entity.ExcelTemplateConfigEntity" >
|
||||
update excel_template_config set
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="templateId != null and templateId != ''"> template_id = #{templateId},</if>
|
||||
<if test="type != null and type != ''"> type = #{type},</if>
|
||||
<if test="tableType != null and tableType != ''"> table_type = #{tableType},</if>
|
||||
<if test="dataDictionaryId != null and dataDictionaryId != ''"> data_dictionary_id = #{dataDictionaryId},</if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> create_user_id = #{create_user_id},</if>
|
||||
<if test="create_time != null"> create_time = #{create_time},</if>
|
||||
<if test="modify_time != null"> modify_time = #{modify_time},</if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> modify_user_id = #{modify_user_id},</if>
|
||||
<if test="org_id != null and org_id != ''"> org_id = #{org_id},</if>
|
||||
<if test="companyId != null and companyId != ''"> company_id = #{companyId},</if>
|
||||
<if test="sts != null and sts != ''"> sts = #{sts},</if>
|
||||
</trim>
|
||||
where sorts = #{sorts}
|
||||
</update>
|
||||
<!-- 逻辑删除 -->
|
||||
<update id="entity_logicDelete" parameterType = "com.hzya.frame.excel.templateConfig.entity.ExcelTemplateConfigEntity" >
|
||||
update excel_template_config set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
|
||||
where sorts = #{sorts}
|
||||
</update>
|
||||
<!-- 多条件逻辑删除 -->
|
||||
<update id="entity_logicDelete_Multi_Condition" parameterType = "com.hzya.frame.excel.templateConfig.entity.ExcelTemplateConfigEntity" >
|
||||
update excel_template_config set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="templateId != null and templateId != ''"> and template_id = #{templateId} </if>
|
||||
<if test="type != null and type != ''"> and type = #{type} </if>
|
||||
<if test="tableType != null and tableType != ''"> and table_type = #{tableType} </if>
|
||||
<if test="dataDictionaryId != null and dataDictionaryId != ''"> and data_dictionary_id = #{dataDictionaryId} </if>
|
||||
<if test="sorts != null"> and sorts = #{sorts} </if>
|
||||
<if test="id != null and id != ''"> and id = #{id} </if>
|
||||
<if test="companyId != null and companyId != ''"> and company_id = #{companyId} </if>
|
||||
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
</update>
|
||||
<!--通过主键删除-->
|
||||
<delete id="entity_delete">
|
||||
delete from excel_template_config where sorts = #{sorts}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package com.hzya.frame.excel.templateConfig.service;
|
||||
|
||||
import com.hzya.frame.excel.templateConfig.entity.ExcelTemplateConfigEntity;
|
||||
import com.hzya.frame.basedao.service.IBaseService;
|
||||
/**
|
||||
* excel模版配置表(ExcelTemplateConfig)表服务接口
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-08-12 16:43:38
|
||||
*/
|
||||
public interface IExcelTemplateConfigService extends IBaseService<ExcelTemplateConfigEntity, String>{
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package com.hzya.frame.excel.templateConfig.service.impl;
|
||||
|
||||
import com.hzya.frame.excel.templateConfig.entity.ExcelTemplateConfigEntity;
|
||||
import com.hzya.frame.excel.templateConfig.dao.IExcelTemplateConfigDao;
|
||||
import com.hzya.frame.excel.templateConfig.service.IExcelTemplateConfigService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import javax.annotation.Resource;
|
||||
import com.hzya.frame.basedao.service.impl.BaseService;
|
||||
/**
|
||||
* excel模版配置表(ExcelTemplateConfig)表服务实现类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-08-12 16:43:38
|
||||
*/
|
||||
@Service(value = "excelTemplateConfigService")
|
||||
public class ExcelTemplateConfigServiceImpl extends BaseService<ExcelTemplateConfigEntity, String> implements IExcelTemplateConfigService {
|
||||
|
||||
private IExcelTemplateConfigDao excelTemplateConfigDao;
|
||||
|
||||
@Autowired
|
||||
public void setExcelTemplateConfigDao(IExcelTemplateConfigDao dao) {
|
||||
this.excelTemplateConfigDao = dao;
|
||||
this.dao = dao;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.hzya.frame.excel.templateConfigDetial.dao;
|
||||
|
||||
import com.hzya.frame.excel.templateConfigDetial.entity.ExcelTemplateConfigDetailEntity;
|
||||
import com.hzya.frame.basedao.dao.IBaseDao;
|
||||
|
||||
/**
|
||||
* excel模版配置明细表(excel_template_config_detail: table)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-08-13 08:39:02
|
||||
*/
|
||||
public interface IExcelTemplateConfigDetailDao extends IBaseDao<ExcelTemplateConfigDetailEntity, String> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.hzya.frame.excel.templateConfigDetial.dao.impl;
|
||||
|
||||
import com.hzya.frame.excel.templateConfigDetial.entity.ExcelTemplateConfigDetailEntity;
|
||||
import com.hzya.frame.excel.templateConfigDetial.dao.IExcelTemplateConfigDetailDao;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
||||
/**
|
||||
* excel模版配置明细表(ExcelTemplateConfigDetail)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-08-13 08:39:02
|
||||
*/
|
||||
@Repository(value = "ExcelTemplateConfigDetailDaoImpl")
|
||||
public class ExcelTemplateConfigDetailDaoImpl extends MybatisGenericDao<ExcelTemplateConfigDetailEntity, String> implements IExcelTemplateConfigDetailDao{
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
package com.hzya.frame.excel.templateConfigDetial.entity;
|
||||
|
||||
import java.util.Date;
|
||||
import com.hzya.frame.web.entity.BaseEntity;
|
||||
/**
|
||||
* excel模版配置明细表(ExcelTemplateConfigDetail)实体类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-08-13 08:39:02
|
||||
*/
|
||||
public class ExcelTemplateConfigDetailEntity extends BaseEntity {
|
||||
|
||||
/** 字段名称 */
|
||||
private String fieldName;
|
||||
/** 字段编码 */
|
||||
private String fieldCode;
|
||||
/** 字段类型 */
|
||||
private String fieldType;
|
||||
/** 应用数据字典明细表id */
|
||||
private String dictionaryDetailId;
|
||||
/** 显示名称 */
|
||||
private String showName;
|
||||
/** 序号 */
|
||||
private Long templateSort;
|
||||
/** 开关 */
|
||||
private String templateSwitch;
|
||||
/** 公司id */
|
||||
private String companyId;
|
||||
|
||||
|
||||
public String getFieldName() {
|
||||
return fieldName;
|
||||
}
|
||||
|
||||
public void setFieldName(String fieldName) {
|
||||
this.fieldName = fieldName;
|
||||
}
|
||||
|
||||
public String getFieldCode() {
|
||||
return fieldCode;
|
||||
}
|
||||
|
||||
public void setFieldCode(String fieldCode) {
|
||||
this.fieldCode = fieldCode;
|
||||
}
|
||||
|
||||
public String getFieldType() {
|
||||
return fieldType;
|
||||
}
|
||||
|
||||
public void setFieldType(String fieldType) {
|
||||
this.fieldType = fieldType;
|
||||
}
|
||||
|
||||
public String getDictionaryDetailId() {
|
||||
return dictionaryDetailId;
|
||||
}
|
||||
|
||||
public void setDictionaryDetailId(String dictionaryDetailId) {
|
||||
this.dictionaryDetailId = dictionaryDetailId;
|
||||
}
|
||||
|
||||
public String getShowName() {
|
||||
return showName;
|
||||
}
|
||||
|
||||
public void setShowName(String showName) {
|
||||
this.showName = showName;
|
||||
}
|
||||
|
||||
public Long getTemplateSort() {
|
||||
return templateSort;
|
||||
}
|
||||
|
||||
public void setTemplateSort(Long templateSort) {
|
||||
this.templateSort = templateSort;
|
||||
}
|
||||
|
||||
public String getTemplateSwitch() {
|
||||
return templateSwitch;
|
||||
}
|
||||
|
||||
public void setTemplateSwitch(String templateSwitch) {
|
||||
this.templateSwitch = templateSwitch;
|
||||
}
|
||||
|
||||
public String getCompanyId() {
|
||||
return companyId;
|
||||
}
|
||||
|
||||
public void setCompanyId(String companyId) {
|
||||
this.companyId = companyId;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,278 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.hzya.frame.excel.templateConfigDetial.dao.impl.ExcelTemplateConfigDetailDaoImpl">
|
||||
|
||||
<resultMap id="get-ExcelTemplateConfigDetailEntity-result" type="com.hzya.frame.excel.templateConfigDetial.entity.ExcelTemplateConfigDetailEntity" >
|
||||
<result property="fieldName" column="field_name" jdbcType="VARCHAR"/>
|
||||
<result property="fieldCode" column="field_code" jdbcType="VARCHAR"/>
|
||||
<result property="fieldType" column="field_type" jdbcType="VARCHAR"/>
|
||||
<result property="dictionaryDetailId" column="dictionary_detail_id" jdbcType="VARCHAR"/>
|
||||
<result property="showName" column="show_name" jdbcType="VARCHAR"/>
|
||||
<result property="templateSort" column="template_sort" jdbcType="INTEGER"/>
|
||||
<result property="templateSwitch" column="template_switch" jdbcType="VARCHAR"/>
|
||||
<result property="sorts" column="sorts" jdbcType="INTEGER"/>
|
||||
<result property="id" column="id" jdbcType="VARCHAR"/>
|
||||
<result property="create_user_id" column="create_user_id" jdbcType="VARCHAR"/>
|
||||
<result property="create_time" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="modify_time" column="modify_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="modify_user_id" column="modify_user_id" jdbcType="VARCHAR"/>
|
||||
<result property="org_id" column="org_id" jdbcType="VARCHAR"/>
|
||||
<result property="companyId" column="company_id" jdbcType="VARCHAR"/>
|
||||
<result property="sts" column="sts" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
<!-- 查询的字段-->
|
||||
<sql id = "ExcelTemplateConfigDetailEntity_Base_Column_List">
|
||||
field_name
|
||||
,field_code
|
||||
,field_type
|
||||
,dictionary_detail_id
|
||||
,show_name
|
||||
,template_sort
|
||||
,template_switch
|
||||
,sorts
|
||||
,id
|
||||
,create_user_id
|
||||
,create_time
|
||||
,modify_time
|
||||
,modify_user_id
|
||||
,org_id
|
||||
,company_id
|
||||
,sts
|
||||
</sql>
|
||||
<!-- 查询 采用==查询 -->
|
||||
<select id="entity_list_base" resultMap="get-ExcelTemplateConfigDetailEntity-result" parameterType = "com.hzya.frame.excel.templateConfigDetial.entity.ExcelTemplateConfigDetailEntity">
|
||||
select
|
||||
<include refid="ExcelTemplateConfigDetailEntity_Base_Column_List" />
|
||||
from excel_template_config_detail
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="fieldName != null and fieldName != ''"> and field_name = #{fieldName} </if>
|
||||
<if test="fieldCode != null and fieldCode != ''"> and field_code = #{fieldCode} </if>
|
||||
<if test="fieldType != null and fieldType != ''"> and field_type = #{fieldType} </if>
|
||||
<if test="dictionaryDetailId != null and dictionaryDetailId != ''"> and dictionary_detail_id = #{dictionaryDetailId} </if>
|
||||
<if test="showName != null and showName != ''"> and show_name = #{showName} </if>
|
||||
<if test="templateSort != null"> and template_sort = #{templateSort} </if>
|
||||
<if test="templateSwitch != null and templateSwitch != ''"> and template_switch = #{templateSwitch} </if>
|
||||
<if test="sorts != null"> and sorts = #{sorts} </if>
|
||||
<if test="id != null and id != ''"> and id = #{id} </if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> and create_user_id = #{create_user_id} </if>
|
||||
<if test="create_time != null"> and create_time = #{create_time} </if>
|
||||
<if test="modify_time != null"> and modify_time = #{modify_time} </if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id = #{modify_user_id} </if>
|
||||
<if test="org_id != null and org_id != ''"> and org_id = #{org_id} </if>
|
||||
<if test="companyId != null and companyId != ''"> and company_id = #{companyId} </if>
|
||||
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
|
||||
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
|
||||
</select>
|
||||
|
||||
<!-- 查询符合条件的数量 -->
|
||||
<select id="entity_count" resultType="Integer" parameterType = "com.hzya.frame.excel.templateConfigDetial.entity.ExcelTemplateConfigDetailEntity">
|
||||
select count(1) from excel_template_config_detail
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="fieldName != null and fieldName != ''"> and field_name = #{fieldName} </if>
|
||||
<if test="fieldCode != null and fieldCode != ''"> and field_code = #{fieldCode} </if>
|
||||
<if test="fieldType != null and fieldType != ''"> and field_type = #{fieldType} </if>
|
||||
<if test="dictionaryDetailId != null and dictionaryDetailId != ''"> and dictionary_detail_id = #{dictionaryDetailId} </if>
|
||||
<if test="showName != null and showName != ''"> and show_name = #{showName} </if>
|
||||
<if test="templateSort != null"> and template_sort = #{templateSort} </if>
|
||||
<if test="templateSwitch != null and templateSwitch != ''"> and template_switch = #{templateSwitch} </if>
|
||||
<if test="sorts != null"> and sorts = #{sorts} </if>
|
||||
<if test="id != null and id != ''"> and id = #{id} </if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> and create_user_id = #{create_user_id} </if>
|
||||
<if test="create_time != null"> and create_time = #{create_time} </if>
|
||||
<if test="modify_time != null"> and modify_time = #{modify_time} </if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id = #{modify_user_id} </if>
|
||||
<if test="org_id != null and org_id != ''"> and org_id = #{org_id} </if>
|
||||
<if test="companyId != null and companyId != ''"> and company_id = #{companyId} </if>
|
||||
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
|
||||
<if test=" sort !='' and sort!=null and order !='' and order!=null "> order by ${sort} ${order}</if>
|
||||
</select>
|
||||
|
||||
<!-- 分页查询列表 采用like格式 -->
|
||||
<select id="entity_list_like" resultMap="get-ExcelTemplateConfigDetailEntity-result" parameterType = "com.hzya.frame.excel.templateConfigDetial.entity.ExcelTemplateConfigDetailEntity">
|
||||
select
|
||||
<include refid="ExcelTemplateConfigDetailEntity_Base_Column_List" />
|
||||
from excel_template_config_detail
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="fieldName != null and fieldName != ''"> and field_name like concat('%',#{fieldName},'%') </if>
|
||||
<if test="fieldCode != null and fieldCode != ''"> and field_code like concat('%',#{fieldCode},'%') </if>
|
||||
<if test="fieldType != null and fieldType != ''"> and field_type like concat('%',#{fieldType},'%') </if>
|
||||
<if test="dictionaryDetailId != null and dictionaryDetailId != ''"> and dictionary_detail_id like concat('%',#{dictionaryDetailId},'%') </if>
|
||||
<if test="showName != null and showName != ''"> and show_name like concat('%',#{showName},'%') </if>
|
||||
<if test="templateSort != null"> and template_sort like concat('%',#{templateSort},'%') </if>
|
||||
<if test="templateSwitch != null and templateSwitch != ''"> and template_switch like concat('%',#{templateSwitch},'%') </if>
|
||||
<if test="sorts != null"> and sorts like concat('%',#{sorts},'%') </if>
|
||||
<if test="id != null and id != ''"> and id like concat('%',#{id},'%') </if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> and create_user_id like concat('%',#{create_user_id},'%') </if>
|
||||
<if test="create_time != null"> and create_time like concat('%',#{create_time},'%') </if>
|
||||
<if test="modify_time != null"> and modify_time like concat('%',#{modify_time},'%') </if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id like concat('%',#{modify_user_id},'%') </if>
|
||||
<if test="org_id != null and org_id != ''"> and org_id like concat('%',#{org_id},'%') </if>
|
||||
<if test="companyId != null and companyId != ''"> and company_id like concat('%',#{companyId},'%') </if>
|
||||
<if test="sts != null and sts != ''"> and sts like concat('%',#{sts},'%') </if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
|
||||
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
|
||||
</select>
|
||||
|
||||
<!-- 查询列表 字段采用or格式 -->
|
||||
<select id="ExcelTemplateConfigDetailentity_list_or" resultMap="get-ExcelTemplateConfigDetailEntity-result" parameterType = "com.hzya.frame.excel.templateConfigDetial.entity.ExcelTemplateConfigDetailEntity">
|
||||
select
|
||||
<include refid="ExcelTemplateConfigDetailEntity_Base_Column_List" />
|
||||
from excel_template_config_detail
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="fieldName != null and fieldName != ''"> or field_name = #{fieldName} </if>
|
||||
<if test="fieldCode != null and fieldCode != ''"> or field_code = #{fieldCode} </if>
|
||||
<if test="fieldType != null and fieldType != ''"> or field_type = #{fieldType} </if>
|
||||
<if test="dictionaryDetailId != null and dictionaryDetailId != ''"> or dictionary_detail_id = #{dictionaryDetailId} </if>
|
||||
<if test="showName != null and showName != ''"> or show_name = #{showName} </if>
|
||||
<if test="templateSort != null"> or template_sort = #{templateSort} </if>
|
||||
<if test="templateSwitch != null and templateSwitch != ''"> or template_switch = #{templateSwitch} </if>
|
||||
<if test="sorts != null"> or sorts = #{sorts} </if>
|
||||
<if test="id != null and id != ''"> or id = #{id} </if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> or create_user_id = #{create_user_id} </if>
|
||||
<if test="create_time != null"> or create_time = #{create_time} </if>
|
||||
<if test="modify_time != null"> or modify_time = #{modify_time} </if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> or modify_user_id = #{modify_user_id} </if>
|
||||
<if test="org_id != null and org_id != ''"> or org_id = #{org_id} </if>
|
||||
<if test="companyId != null and companyId != ''"> or company_id = #{companyId} </if>
|
||||
<if test="sts != null and sts != ''"> or sts = #{sts} </if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
|
||||
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
|
||||
</select>
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="entity_insert" parameterType = "com.hzya.frame.excel.templateConfigDetial.entity.ExcelTemplateConfigDetailEntity" keyProperty="sorts" useGeneratedKeys="true">
|
||||
insert into excel_template_config_detail(
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="fieldName != null and fieldName != ''"> field_name , </if>
|
||||
<if test="fieldCode != null and fieldCode != ''"> field_code , </if>
|
||||
<if test="fieldType != null and fieldType != ''"> field_type , </if>
|
||||
<if test="dictionaryDetailId != null and dictionaryDetailId != ''"> dictionary_detail_id , </if>
|
||||
<if test="showName != null and showName != ''"> show_name , </if>
|
||||
<if test="templateSort != null"> template_sort , </if>
|
||||
<if test="templateSwitch != null and templateSwitch != ''"> template_switch , </if>
|
||||
<if test="sorts != null"> sorts , </if>
|
||||
<if test="id != null and id != ''"> id , </if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> create_user_id , </if>
|
||||
<if test="create_time != null"> create_time , </if>
|
||||
<if test="modify_time != null"> modify_time , </if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> modify_user_id , </if>
|
||||
<if test="org_id != null and org_id != ''"> org_id , </if>
|
||||
<if test="companyId != null and companyId != ''"> company_id , </if>
|
||||
<if test="sts != null and sts != ''"> sts , </if>
|
||||
<if test="sorts == null ">sorts,</if>
|
||||
<if test="sts == null ">sts,</if>
|
||||
</trim>
|
||||
)values(
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="fieldName != null and fieldName != ''"> #{fieldName} ,</if>
|
||||
<if test="fieldCode != null and fieldCode != ''"> #{fieldCode} ,</if>
|
||||
<if test="fieldType != null and fieldType != ''"> #{fieldType} ,</if>
|
||||
<if test="dictionaryDetailId != null and dictionaryDetailId != ''"> #{dictionaryDetailId} ,</if>
|
||||
<if test="showName != null and showName != ''"> #{showName} ,</if>
|
||||
<if test="templateSort != null"> #{templateSort} ,</if>
|
||||
<if test="templateSwitch != null and templateSwitch != ''"> #{templateSwitch} ,</if>
|
||||
<if test="sorts != null"> #{sorts} ,</if>
|
||||
<if test="id != null and id != ''"> #{id} ,</if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> #{create_user_id} ,</if>
|
||||
<if test="create_time != null"> #{create_time} ,</if>
|
||||
<if test="modify_time != null"> #{modify_time} ,</if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> #{modify_user_id} ,</if>
|
||||
<if test="org_id != null and org_id != ''"> #{org_id} ,</if>
|
||||
<if test="companyId != null and companyId != ''"> #{companyId} ,</if>
|
||||
<if test="sts != null and sts != ''"> #{sts} ,</if>
|
||||
<if test="sorts == null ">(select (max(IFNULL( a.sorts, 0 )) + 1) as sort from excel_template_config_detail a WHERE a.sts = 'Y' ),</if>
|
||||
<if test="sts == null ">'Y',</if>
|
||||
</trim>
|
||||
)
|
||||
</insert>
|
||||
<!-- 批量新增 -->
|
||||
<insert id="entityInsertBatch" keyProperty="sorts" useGeneratedKeys="true">
|
||||
insert into excel_template_config_detail(field_name, field_code, field_type, dictionary_detail_id, show_name, template_sort, template_switch, create_user_id, create_time, modify_time, modify_user_id, org_id, company_id, sts, sts)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.fieldName},#{entity.fieldCode},#{entity.fieldType},#{entity.dictionaryDetailId},#{entity.showName},#{entity.templateSort},#{entity.templateSwitch},#{entity.create_user_id},#{entity.create_time},#{entity.modify_time},#{entity.modify_user_id},#{entity.org_id},#{entity.companyId},#{entity.sts}, 'Y')
|
||||
</foreach>
|
||||
</insert>
|
||||
<!-- 批量新增或者修改-->
|
||||
<insert id="entityInsertOrUpdateBatch" keyProperty="sorts" useGeneratedKeys="true">
|
||||
insert into excel_template_config_detail(field_name, field_code, field_type, dictionary_detail_id, show_name, template_sort, template_switch, create_user_id, create_time, modify_time, modify_user_id, org_id, company_id, sts)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.fieldName},#{entity.fieldCode},#{entity.fieldType},#{entity.dictionaryDetailId},#{entity.showName},#{entity.templateSort},#{entity.templateSwitch},#{entity.create_user_id},#{entity.create_time},#{entity.modify_time},#{entity.modify_user_id},#{entity.org_id},#{entity.companyId},#{entity.sts})
|
||||
</foreach>
|
||||
on duplicate key update
|
||||
field_name = values(field_name),
|
||||
field_code = values(field_code),
|
||||
field_type = values(field_type),
|
||||
dictionary_detail_id = values(dictionary_detail_id),
|
||||
show_name = values(show_name),
|
||||
template_sort = values(template_sort),
|
||||
template_switch = values(template_switch),
|
||||
create_user_id = values(create_user_id),
|
||||
create_time = values(create_time),
|
||||
modify_time = values(modify_time),
|
||||
modify_user_id = values(modify_user_id),
|
||||
org_id = values(org_id),
|
||||
company_id = values(company_id),
|
||||
sts = values(sts)</insert>
|
||||
<!--通过主键修改方法-->
|
||||
<update id="entity_update" parameterType = "com.hzya.frame.excel.templateConfigDetial.entity.ExcelTemplateConfigDetailEntity" >
|
||||
update excel_template_config_detail set
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="fieldName != null and fieldName != ''"> field_name = #{fieldName},</if>
|
||||
<if test="fieldCode != null and fieldCode != ''"> field_code = #{fieldCode},</if>
|
||||
<if test="fieldType != null and fieldType != ''"> field_type = #{fieldType},</if>
|
||||
<if test="dictionaryDetailId != null and dictionaryDetailId != ''"> dictionary_detail_id = #{dictionaryDetailId},</if>
|
||||
<if test="showName != null and showName != ''"> show_name = #{showName},</if>
|
||||
<if test="templateSort != null"> template_sort = #{templateSort},</if>
|
||||
<if test="templateSwitch != null and templateSwitch != ''"> template_switch = #{templateSwitch},</if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> create_user_id = #{create_user_id},</if>
|
||||
<if test="create_time != null"> create_time = #{create_time},</if>
|
||||
<if test="modify_time != null"> modify_time = #{modify_time},</if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> modify_user_id = #{modify_user_id},</if>
|
||||
<if test="org_id != null and org_id != ''"> org_id = #{org_id},</if>
|
||||
<if test="companyId != null and companyId != ''"> company_id = #{companyId},</if>
|
||||
<if test="sts != null and sts != ''"> sts = #{sts},</if>
|
||||
</trim>
|
||||
where sorts = #{sorts}
|
||||
</update>
|
||||
<!-- 逻辑删除 -->
|
||||
<update id="entity_logicDelete" parameterType = "com.hzya.frame.excel.templateConfigDetial.entity.ExcelTemplateConfigDetailEntity" >
|
||||
update excel_template_config_detail set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
|
||||
where sorts = #{sorts}
|
||||
</update>
|
||||
<!-- 多条件逻辑删除 -->
|
||||
<update id="entity_logicDelete_Multi_Condition" parameterType = "com.hzya.frame.excel.templateConfigDetial.entity.ExcelTemplateConfigDetailEntity" >
|
||||
update excel_template_config_detail set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="fieldName != null and fieldName != ''"> and field_name = #{fieldName} </if>
|
||||
<if test="fieldCode != null and fieldCode != ''"> and field_code = #{fieldCode} </if>
|
||||
<if test="fieldType != null and fieldType != ''"> and field_type = #{fieldType} </if>
|
||||
<if test="dictionaryDetailId != null and dictionaryDetailId != ''"> and dictionary_detail_id = #{dictionaryDetailId} </if>
|
||||
<if test="showName != null and showName != ''"> and show_name = #{showName} </if>
|
||||
<if test="templateSort != null"> and template_sort = #{templateSort} </if>
|
||||
<if test="templateSwitch != null and templateSwitch != ''"> and template_switch = #{templateSwitch} </if>
|
||||
<if test="sorts != null"> and sorts = #{sorts} </if>
|
||||
<if test="id != null and id != ''"> and id = #{id} </if>
|
||||
<if test="companyId != null and companyId != ''"> and company_id = #{companyId} </if>
|
||||
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
</update>
|
||||
<!--通过主键删除-->
|
||||
<delete id="entity_delete">
|
||||
delete from excel_template_config_detail where sorts = #{sorts}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package com.hzya.frame.excel.templateConfigDetial.service;
|
||||
|
||||
import com.hzya.frame.excel.templateConfigDetial.entity.ExcelTemplateConfigDetailEntity;
|
||||
import com.hzya.frame.basedao.service.IBaseService;
|
||||
/**
|
||||
* excel模版配置明细表(ExcelTemplateConfigDetail)表服务接口
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-08-13 08:39:02
|
||||
*/
|
||||
public interface IExcelTemplateConfigDetailService extends IBaseService<ExcelTemplateConfigDetailEntity, String>{
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package com.hzya.frame.excel.templateConfigDetial.service.impl;
|
||||
|
||||
import com.hzya.frame.excel.templateConfigDetial.entity.ExcelTemplateConfigDetailEntity;
|
||||
import com.hzya.frame.excel.templateConfigDetial.dao.IExcelTemplateConfigDetailDao;
|
||||
import com.hzya.frame.excel.templateConfigDetial.service.IExcelTemplateConfigDetailService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import javax.annotation.Resource;
|
||||
import com.hzya.frame.basedao.service.impl.BaseService;
|
||||
/**
|
||||
* excel模版配置明细表(ExcelTemplateConfigDetail)表服务实现类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-08-13 08:39:02
|
||||
*/
|
||||
@Service(value = "excelTemplateConfigDetailService")
|
||||
public class ExcelTemplateConfigDetailServiceImpl extends BaseService<ExcelTemplateConfigDetailEntity, String> implements IExcelTemplateConfigDetailService {
|
||||
|
||||
private IExcelTemplateConfigDetailDao excelTemplateConfigDetailDao;
|
||||
|
||||
@Autowired
|
||||
public void setExcelTemplateConfigDetailDao(IExcelTemplateConfigDetailDao dao) {
|
||||
this.excelTemplateConfigDetailDao = dao;
|
||||
this.dao = dao;
|
||||
}
|
||||
}
|
|
@ -4,6 +4,7 @@ import com.hzya.frame.basedao.dao.IBaseDao;
|
|||
import com.hzya.frame.grpU8.nxproof.glPzml.entity.SenderGlPzmlEntity;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* (gl_pzml: table)表数据库访问层
|
||||
|
@ -83,6 +84,16 @@ public interface ISenderGlPzmlDao extends IBaseDao<SenderGlPzmlEntity, String> {
|
|||
* **/
|
||||
Integer deleteGlPzmlHealthBureau(SenderGlPzmlEntity senderGlPzmlEntity);
|
||||
|
||||
/**
|
||||
*
|
||||
* @content 查询凭证 商学院
|
||||
* @Param
|
||||
* @Return
|
||||
* @Author hecan
|
||||
* @Date 2024/8/14 16:25
|
||||
* **/
|
||||
List<SenderGlPzmlEntity> queryGlPzmlSxy(SenderGlPzmlEntity senderGlPzmlEntity);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import com.hzya.frame.grpU8.nxproof.glPzml.entity.SenderGlPzmlEntity;
|
|||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* (GlPzml)表数据库访问层
|
||||
|
@ -60,5 +61,11 @@ public class SenderGlPzmlDaoImpl extends MybatisGenericDao<SenderGlPzmlEntity, S
|
|||
public Integer deleteGlPzmlHealthBureau(SenderGlPzmlEntity senderGlPzmlEntity) {
|
||||
return super.delete("SenderGlPzmlEntity_delete_pzml",senderGlPzmlEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
@DS("#senderGlPzmlEntity.dataSourceCode")
|
||||
public List<SenderGlPzmlEntity> queryGlPzmlSxy(SenderGlPzmlEntity senderGlPzmlEntity) {
|
||||
return (List<SenderGlPzmlEntity>) super.selectList("queryGlPzmlSxy",senderGlPzmlEntity);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,6 +54,16 @@ public class SenderGlPzmlEntity extends BaseEntity {
|
|||
private String stamp;
|
||||
private String yspzje;
|
||||
|
||||
private String bmdm;
|
||||
|
||||
public String getBmdm() {
|
||||
return bmdm;
|
||||
}
|
||||
|
||||
public void setBmdm(String bmdm) {
|
||||
this.bmdm = bmdm;
|
||||
}
|
||||
|
||||
public String getPzsbm() {
|
||||
return pzsbm;
|
||||
}
|
||||
|
|
|
@ -259,6 +259,31 @@
|
|||
</trim>
|
||||
</select>
|
||||
|
||||
<!-- 查询列表 商学院所需要的凭证数据-->
|
||||
<select id="queryGlPzmlSxy" resultMap="get-SenderGlPzmlEntity-result" parameterType = "com.hzya.frame.grpU8.nxproof.glPzml.entity.SenderGlPzmlEntity">
|
||||
select
|
||||
pzml.idpzh as idpzh,
|
||||
pzml.kjqj as kjqj,
|
||||
pzml.srrq as srrq,
|
||||
pzml.srID as srID,
|
||||
pznr.bmdm as bmdm,
|
||||
pzml.pzzy as pzzy,
|
||||
sum(pznr.je) as pzje,
|
||||
pzml.gsdm,pzml.zth,pzml.kjqj,pzml.pzh
|
||||
from GL_Pzml pzml
|
||||
left join gl_pznr pznr on pznr.idpzh=pzml.idpzh and pzml.kjqj=pznr.kjqj
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="idpzh !=null and idpzh!='' "> and pzml.idpzh = #{idpzh} </if>
|
||||
and pzml.kjqj =#{kjqj} and pznr.kjqj =#{kjqj} and pznr.zbid!=0
|
||||
</trim>
|
||||
group by pzml.idpzh,
|
||||
pzml.kjqj,
|
||||
pzml.srrq,
|
||||
pzml.pzzy,
|
||||
pzml.gsdm,pzml.zth,pzml.kjqj,pzml.pzh,pzml.srID,pznr.bmdm
|
||||
|
||||
</select>
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="entity_insert" parameterType = "com.hzya.frame.grpU8.nxproof.glPzml.entity.SenderGlPzmlEntity" keyProperty="" useGeneratedKeys="true">
|
||||
insert into gl_pzml(
|
||||
|
|
|
@ -95,11 +95,11 @@ public interface ISenderGlPzmlService extends IBaseService<SenderGlPzmlEntity, S
|
|||
|
||||
/**
|
||||
*
|
||||
* @content 保存凭证 商学院 确定指标被哪些凭证使用
|
||||
* @content 查询凭证 商学院 确定指标被哪些凭证使用
|
||||
* @Param
|
||||
* @Return
|
||||
* @Author hecan
|
||||
* @Date 2024/8/13 17:00
|
||||
* **/
|
||||
Object saveGlPzmlSxy(JSONObject jsonObject);
|
||||
Object queryGlPzmlSxy(JSONObject jsonObject);
|
||||
}
|
||||
|
|
|
@ -8,6 +8,10 @@ import com.alibaba.fastjson.JSON;
|
|||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.basedao.service.impl.BaseService;
|
||||
import com.hzya.frame.grpU8.nxproof.gbizbsyrec.dao.IGbiZbsyrecDao;
|
||||
import com.hzya.frame.grpU8.nxproof.gbizbsyrec.entity.GbiZbsyrecEntity;
|
||||
import com.hzya.frame.grpU8.nxproof.gbizbxmb.dao.IGbiZbxmbDao;
|
||||
import com.hzya.frame.grpU8.nxproof.gbizbxmb.entity.GbiZbxmbEntity;
|
||||
import com.hzya.frame.grpU8.nxproof.glPzml.dao.ISenderGlPzmlDao;
|
||||
import com.hzya.frame.grpU8.nxproof.glPzml.entity.SenderGlPzmlEntity;
|
||||
import com.hzya.frame.grpU8.nxproof.glPzml.service.ISenderGlPzmlService;
|
||||
|
@ -22,10 +26,13 @@ import org.springframework.beans.factory.annotation.Qualifier;
|
|||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
import static org.aspectj.runtime.internal.Conversions.doubleValue;
|
||||
|
||||
/**
|
||||
* (GlPzml)表服务实现类
|
||||
|
@ -41,6 +48,9 @@ public class SenderGlPzmlServiceImpl extends BaseService<SenderGlPzmlEntity, Str
|
|||
|
||||
private ISenderGlPzmlDao senderGlPzmlDao;
|
||||
|
||||
@Autowired
|
||||
private IGbiZbxmbDao gbiZbxmbDao;
|
||||
|
||||
@Autowired
|
||||
public void setSenderGlPzmlDao(ISenderGlPzmlDao dao) {
|
||||
this.senderGlPzmlDao = dao;
|
||||
|
@ -668,7 +678,8 @@ public class SenderGlPzmlServiceImpl extends BaseService<SenderGlPzmlEntity, Str
|
|||
|
||||
//保存凭证 商学院,指标被哪些凭证使用
|
||||
@Override
|
||||
public Object saveGlPzmlSxy(JSONObject jsonObject){
|
||||
public Object queryGlPzmlSxy(JSONObject json){
|
||||
JSONObject jsonObject = json.getJSONObject("jsonStr");
|
||||
SenderGlPzmlEntity glPzmlEntity = jsonObject.toJavaObject(SenderGlPzmlEntity.class);
|
||||
if(StrUtil.isEmpty(glPzmlEntity.getKjqj())){
|
||||
glPzmlEntity.setKjqj(DateUtil.format(new Date(),"yyyyMM"));
|
||||
|
@ -679,29 +690,71 @@ public class SenderGlPzmlServiceImpl extends BaseService<SenderGlPzmlEntity, Str
|
|||
return BaseResult.getFailureMessageEntity("token为空,请先获取token");
|
||||
}
|
||||
//查询凭证数据
|
||||
List<SenderGlPzmlEntity> pzmlEntities = senderGlPzmlDao.query(glPzmlEntity);
|
||||
if(CollectionUtils.isEmpty(pzmlEntities)){
|
||||
List<SenderGlPzmlEntity> list = senderGlPzmlDao.queryGlPzmlSxy(glPzmlEntity);
|
||||
if(CollectionUtils.isEmpty(list)){
|
||||
return BaseResult.getSuccessMessageEntity("没有需要同步得凭证",null);
|
||||
}
|
||||
for (SenderGlPzmlEntity pzmlEntity : pzmlEntities) {
|
||||
String pzNum = pzmlEntity.getGsdm() + "_" + pzmlEntity.getZth() + "_" + pzmlEntity.getKjqj() + "_" + pzmlEntity.getPzh();
|
||||
JSONObject jsonObjectParams=new JSONObject();
|
||||
jsonObjectParams.put("code",pzmlEntity.getIdpzh());//pzid
|
||||
jsonObjectParams.put("budgetYear",pzmlEntity.getKjqj().substring(0,4));//预算年度
|
||||
jsonObjectParams.put("applyDate",DateUtil.format(new Date(),"yyyy-MM-dd"));//日期
|
||||
jsonObjectParams.put("userCode","");//用户编码
|
||||
jsonObjectParams.put("depCode","");//部门编码
|
||||
jsonObjectParams.put("description",pzmlEntity.getPzzy());//说明
|
||||
jsonObjectParams.put("amount",pzmlEntity.getPzje());//金额
|
||||
jsonObjectParams.put("pzNum",pzNum);//凭证号 例如:公司代码+账套号+会计期间+凭证号:001_001_202408_付款_1
|
||||
JSONArray jsonArray=new JSONArray();
|
||||
jsonArray.add(jsonObjectParams);
|
||||
JSONObject jsonObjectData=new JSONObject();
|
||||
jsonObjectData.put("data",jsonArray);
|
||||
|
||||
|
||||
try {
|
||||
String result=null;
|
||||
for (SenderGlPzmlEntity pzmlEntity : list) {
|
||||
String pzNum = pzmlEntity.getGsdm() + "_" + pzmlEntity.getZth() + "_" + pzmlEntity.getKjqj() + "_" + pzmlEntity.getPzh();
|
||||
//转换日期,如将20240514转为2024-05-14
|
||||
SimpleDateFormat inputFormat = new SimpleDateFormat("yyyyMMdd");
|
||||
SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date date = inputFormat.parse(pzmlEntity.getSrrq());
|
||||
String outputDateString = outputFormat.format(date);
|
||||
//将金额四舍五入
|
||||
BigDecimal bigDecimalValue = new BigDecimal(pzmlEntity.getPzje());
|
||||
BigDecimal roundedValue = bigDecimalValue.setScale(2,
|
||||
RoundingMode.HALF_UP);
|
||||
JSONObject jsonObjectParams=new JSONObject();
|
||||
jsonObjectParams.put("code",pzmlEntity.getIdpzh());//pzid
|
||||
jsonObjectParams.put("budgetYear",pzmlEntity.getKjqj().substring(0,4));//预算年度
|
||||
jsonObjectParams.put("applyDate",outputDateString);//日期
|
||||
jsonObjectParams.put("userCode",pzmlEntity.getSrid());//用户编码
|
||||
jsonObjectParams.put("depCode","A518");//部门编码
|
||||
jsonObjectParams.put("description",pzmlEntity.getPzzy());//说明
|
||||
jsonObjectParams.put("amount",roundedValue.doubleValue());//金额
|
||||
jsonObjectParams.put("pzNum",pzNum);//凭证号 例如:公司代码+账套号+会计期间+凭证号:001_001_202408_付款_1
|
||||
//根据idpzh查询指标id和指标金额
|
||||
GbiZbxmbEntity gbiZbxmbEntity=new GbiZbxmbEntity();
|
||||
gbiZbxmbEntity.setDjId(pzmlEntity.getIdpzh());
|
||||
gbiZbxmbEntity.setKjnd(pzmlEntity.getKjqj().substring(0,4));
|
||||
gbiZbxmbEntity.setDataSourceCode(glPzmlEntity.getDataSourceCode());
|
||||
List<GbiZbxmbEntity> gbiZbsyrecEntities = gbiZbxmbDao.queryZbxmbByIdpzh(gbiZbxmbEntity);
|
||||
logger.info("=======根据凭证idpzh:{}查询的指标金额和指标id数据有{}条",pzmlEntity.getIdpzh(),gbiZbsyrecEntities.size());
|
||||
if(CollectionUtils.isEmpty(gbiZbsyrecEntities)){
|
||||
jsonObjectParams.put("reimburseItems",new ArrayList<>());
|
||||
}else{
|
||||
JSONArray jsonArray=new JSONArray();
|
||||
for (GbiZbxmbEntity zbxmbEntity : gbiZbsyrecEntities) {
|
||||
BigDecimal bigDecimalValueZbxmb = new BigDecimal(zbxmbEntity.getJe());
|
||||
BigDecimal roundedValueZbxmb = bigDecimalValueZbxmb.setScale(2, RoundingMode.HALF_UP);
|
||||
JSONObject jsonObjectZbxm=new JSONObject();
|
||||
jsonObjectZbxm.put("thirdProjectCode",zbxmbEntity.getZbid());
|
||||
jsonObjectZbxm.put("amount",roundedValueZbxmb);
|
||||
jsonObjectZbxm.put("financialCode",zbxmbEntity.getJjkmdm());
|
||||
jsonArray.add(jsonObjectZbxm);
|
||||
}
|
||||
jsonObjectParams.put("reimburseItems",jsonArray);
|
||||
}
|
||||
JSONArray jsonArray=new JSONArray();
|
||||
jsonArray.add(jsonObjectParams);
|
||||
JSONObject jsonObjectData=new JSONObject();
|
||||
jsonObjectData.put("data",jsonArray);
|
||||
String params = jsonObjectData.toJSONString();
|
||||
logger.info("调用商学院凭证保存接口请求参数:{}",params);
|
||||
result = HttpRequest.post(URLTest + "/nky/service/zsApi/saveZJSYPZReimburse?accessToken="+token).header("Content-Type", "application/json;charset=UTF-8").timeout(30000).body(params).execute().body();
|
||||
logger.info("调用商学院凭证保存接口返回参数:{}",result);
|
||||
}
|
||||
JSONObject jsonObjectResult=new JSONObject();
|
||||
jsonObjectResult.put("status","200");
|
||||
jsonObjectResult.put("pzml",result);
|
||||
return jsonObjectResult;
|
||||
}catch (Exception e){
|
||||
logger.info("根据凭证idpzh:{}查询指标失败:{}",glPzmlEntity.getIdpzh(),e.getMessage());
|
||||
return BaseResult.getFailureMessageEntity("根据凭证查询指标失败");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
@ -713,7 +766,7 @@ public class SenderGlPzmlServiceImpl extends BaseService<SenderGlPzmlEntity, Str
|
|||
String params = jsonObject.toJSONString();
|
||||
logger.info("=========获取凭证token请求参数:{}========",params);
|
||||
String urlToken="nky/service/session/getAccessToken";
|
||||
String result = HttpRequest.post(URLTest + urlToken).header("Content-Type", "soap/xml").timeout(30000).body(params).execute().body();
|
||||
String result = HttpRequest.post(URLTest + urlToken).header("Content-Type", "application/json;charset=UTF-8").timeout(30000).body(params).execute().body();
|
||||
logger.info("=========获取凭证token返回结果:{}========",result);
|
||||
JSONObject jsonObjectResult=JSONObject.parseObject(result);
|
||||
String value=jsonObjectResult.getString("value");
|
||||
|
@ -724,7 +777,6 @@ public class SenderGlPzmlServiceImpl extends BaseService<SenderGlPzmlEntity, Str
|
|||
return accessToken;
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -351,7 +351,7 @@ public class MdmModuleServiceImpl extends BaseService<MdmModuleEntity, String> i
|
|||
sysMenuConfigEntities.get(i).setParentMenuId("ea22757e99c144fb9ef381dd322e233c");
|
||||
} else {
|
||||
//2、单据
|
||||
sysMenuConfigEntities.get(i).setParentMenuId("58714ddb7ec94f5da91df74efada042f");
|
||||
sysMenuConfigEntities.get(i).setParentMenuId("67f82a6e7f664c5a89b7fc7b8fc817b0");
|
||||
}
|
||||
sysMenuConfigEntities.get(i).setMenuName(entity.getMdmName());
|
||||
sysMenuConfigEntities.get(i).setMenuEnglishName("integrationOptionAdmin" + entity.getMdmCode());
|
||||
|
@ -1713,7 +1713,7 @@ public class MdmModuleServiceImpl extends BaseService<MdmModuleEntity, String> i
|
|||
module.setParentMenuId("ea22757e99c144fb9ef381dd322e233c");
|
||||
} else {
|
||||
//2、单据
|
||||
module.setParentMenuId("58714ddb7ec94f5da91df74efada042f");
|
||||
module.setParentMenuId("67f82a6e7f664c5a89b7fc7b8fc817b0");
|
||||
}
|
||||
module.setMenuName(mdmModuleEntity.getMdmName());
|
||||
module.setMenuEnglishName("integrationOptionAdmin" + mdmModuleEntity.getMdmCode());
|
||||
|
@ -1785,7 +1785,7 @@ public class MdmModuleServiceImpl extends BaseService<MdmModuleEntity, String> i
|
|||
module.setParentMenuId("ea22757e99c144fb9ef381dd322e233c");
|
||||
} else {
|
||||
//2、单据
|
||||
module.setParentMenuId("58714ddb7ec94f5da91df74efada042f");
|
||||
module.setParentMenuId("67f82a6e7f664c5a89b7fc7b8fc817b0");
|
||||
}
|
||||
module.setMenuName(mdmModuleEntity.getMdmName());
|
||||
module.setMenuEnglishName("integrationOptionAdmin" + mdmModuleEntity.getMdmCode());
|
||||
|
|
|
@ -39,7 +39,7 @@ public class CbsLogServiceImpl extends BaseService<CbsLogEntity,String> implemen
|
|||
Logger log = LoggerFactory.getLogger(getClass());
|
||||
|
||||
private ICbsLogDao cbsLogDao;
|
||||
@Value("${OA.data_source_code}")
|
||||
@Value("${OA.data_source_code:}")
|
||||
private String oa_data_source_code;
|
||||
@Autowired
|
||||
public void setCbsLogDao(ICbsLogDao cbsLogDao) {
|
||||
|
|
|
@ -25,6 +25,18 @@ public class FileDownloadEntity extends BaseEntity {
|
|||
private String filepath;
|
||||
/** 文件*/
|
||||
private File file;
|
||||
/** 文件类型
|
||||
* 1:普通文件
|
||||
* 2:插件附件*/
|
||||
private String fileType;
|
||||
|
||||
public String getFileType() {
|
||||
return fileType;
|
||||
}
|
||||
|
||||
public void setFileType(String fileType) {
|
||||
this.fileType = fileType;
|
||||
}
|
||||
|
||||
/** 文件名称 */
|
||||
public void setFilename(String filename) {
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
<result property="modify_time" column="modify_time" />
|
||||
<!--状态Y正常N删除 -->
|
||||
<result property="sts" column="sts" />
|
||||
<!--文件类型 -->
|
||||
<result property="fileType" column="file_type" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="FileDownloadEntity_Base_Column_List">
|
||||
|
@ -40,7 +42,8 @@
|
|||
create_time,
|
||||
modify_user_id,
|
||||
modify_time,
|
||||
sts
|
||||
sts,
|
||||
file_type
|
||||
</sql>
|
||||
|
||||
<!--通过ID获取数据 -->
|
||||
|
@ -60,6 +63,7 @@
|
|||
<if test="filename != null and filename !='' "> and filename = #{filename}</if>
|
||||
<if test="filesavename != null and filesavename !='' "> and filesavename = #{filesavename}</if>
|
||||
<if test="type != null and type !='' "> and type = #{type}</if>
|
||||
<if test="fileType != null and fileType !='' "> and file_type = #{fileType}</if>
|
||||
<if test="file_size != null "> and file_size = #{file_size}</if>
|
||||
<if test="description != null and description !='' "> and description = #{description}</if>
|
||||
<if test="filepath != null and filepath !='' "> and filepath = #{filepath}</if>
|
||||
|
@ -82,6 +86,7 @@
|
|||
<if test="filename != null and filename !='' "> and filename = #{filename} </if>
|
||||
<if test="filesavename != null and filesavename !='' "> and filesavename = #{filesavename} </if>
|
||||
<if test="type != null and type !='' "> and type = #{type} </if>
|
||||
<if test="fileType != null and fileType !='' "> and file_type = #{fileType} </if>
|
||||
<if test="file_size != null "> and file_size = #{file_size} </if>
|
||||
<if test="description != null and description !='' "> and description = #{description} </if>
|
||||
<if test="filepath != null and filepath !='' "> and filepath = #{filepath} </if>
|
||||
|
@ -106,6 +111,7 @@
|
|||
<if test="filename != null and filename !='' "> and filename like concat('%',#{filename},'%') </if>
|
||||
<if test="filesavename != null and filesavename !='' "> and filesavename like concat('%',#{filesavename},'%') </if>
|
||||
<if test="type != null and type !='' "> and type like concat('%',#{type},'%') </if>
|
||||
<if test="fileType != null and fileType !='' "> and file_type like concat('%',#{fileType},'%') </if>
|
||||
<if test="file_size != null "> and file_size = #{file_size}</if>
|
||||
<if test="description != null and description !='' "> and description like concat('%',#{description},'%') </if>
|
||||
<if test="filepath != null and filepath !='' "> and filepath like concat('%',#{filepath},'%') </if>
|
||||
|
@ -130,6 +136,7 @@
|
|||
<if test="filename != null and filename !='' "> or filename = #{filename} </if>
|
||||
<if test="filesavename != null and filesavename !='' "> or filesavename = #{filesavename} </if>
|
||||
<if test="type != null and type !='' "> or type = #{type} </if>
|
||||
<if test="fileType != null and fileType !='' "> or file_type = #{fileType} </if>
|
||||
<if test="file_size != null "> or file_size = #{file_size}</if>
|
||||
<if test="description != null and description !='' "> or description = #{description} </if>
|
||||
<if test="filepath != null and filepath !='' "> or filepath = #{filepath} </if>
|
||||
|
@ -151,6 +158,7 @@
|
|||
<if test="filename != null and filename !='' "> filename, </if>
|
||||
<if test="filesavename != null and filesavename !='' "> filesavename, </if>
|
||||
<if test="type != null and type !='' "> type, </if>
|
||||
<if test="fileType != null and fileType !='' "> file_type, </if>
|
||||
<if test="file_size != null ">file_size,</if>
|
||||
<if test="description != null and description !='' "> description, </if>
|
||||
<if test="filepath != null and filepath !='' "> filepath, </if>
|
||||
|
@ -167,6 +175,7 @@
|
|||
<if test="filename != null and filename !='' "> #{filename}, </if>
|
||||
<if test="filesavename != null and filesavename !='' "> #{filesavename}, </if>
|
||||
<if test="type != null and type !='' "> #{type}, </if>
|
||||
<if test="fileType != null and fileType !='' "> #{fileType}, </if>
|
||||
<if test="file_size != null ">#{file_size},</if>
|
||||
<if test="description != null and description !='' "> #{description}, </if>
|
||||
<if test="filepath != null and filepath !='' "> #{filepath}, </if>
|
||||
|
@ -192,6 +201,7 @@
|
|||
<if test="filename != null and filename !='' "> filename = #{filename},</if>
|
||||
<if test="filesavename != null and filesavename !='' "> filesavename = #{filesavename},</if>
|
||||
<if test="type != null and type !='' "> type = #{type},</if>
|
||||
<if test="fileType != null and fileType !='' "> file_type = #{fileType},</if>
|
||||
<if test="file_size != null ">file_size = #{file_size},</if>
|
||||
<if test="description != null and description !='' "> description = #{description},</if>
|
||||
<if test="filepath != null and filepath !='' "> filepath = #{filepath},</if>
|
||||
|
@ -219,6 +229,7 @@
|
|||
<if test="filename != null and filename !='' "> and filename = #{filename}</if>
|
||||
<if test="filesavename != null and filesavename !='' "> and filesavename = #{filesavename}</if>
|
||||
<if test="type != null and type !='' "> and type = #{type}</if>
|
||||
<if test="fileType != null and fileType !='' "> and file_type = #{fileType}</if>
|
||||
<if test="file_size != null "> and file_size = #{file_size}</if>
|
||||
<if test="description != null and description !='' "> and description = #{description}</if>
|
||||
<if test="filepath != null and filepath !='' "> and filepath = #{filepath}</if>
|
||||
|
|
|
@ -28,4 +28,6 @@ public interface IFileDownloadService extends IBaseService<FileDownloadEntity,Lo
|
|||
* @throws Exception
|
||||
*/
|
||||
FileDownloadEntity fileDownload(FileUploadDto fileUploadDto) ;
|
||||
|
||||
FileDownloadEntity pluginZipUpate(FileUploadDto fileUploadDto)throws Exception;
|
||||
}
|
||||
|
|
|
@ -11,6 +11,13 @@ import com.hzya.frame.sys.file.download.service.IFileDownloadService;
|
|||
import com.hzya.frame.sys.file.download.dao.IFileDownloadDao;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.util.Enumeration;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
import java.util.zip.ZipInputStream;
|
||||
|
||||
/**
|
||||
* @description: 系统文件下载 service
|
||||
|
@ -23,8 +30,14 @@ import java.io.File;
|
|||
public class FileDownloadServiceImpl extends BaseService< FileDownloadEntity,Long> implements IFileDownloadService{
|
||||
|
||||
protected IFileDownloadDao filedownloadDao;
|
||||
@Value("${savefile.path}")
|
||||
@Value("${savefile.path:}")
|
||||
public String DSK;
|
||||
|
||||
@Value("${savefile.pluginpath:}")
|
||||
public String PLUGINPATH;
|
||||
|
||||
@Value("${savefile.tomcatpath:}")
|
||||
public String TOMCATPATH;
|
||||
@Autowired
|
||||
public void setFileDownloadDao(IFileDownloadDao dao) {
|
||||
|
||||
|
@ -76,11 +89,154 @@ public class FileDownloadServiceImpl extends BaseService< FileDownloadEntity,Lo
|
|||
throw new BaseSystemException("文件不存在!");
|
||||
}
|
||||
/** 拼接文件路径*/
|
||||
String filePath = DSK + fileDownloadEntity.getFilepath().replace("/",File.separator).replace("\\",File.separator);
|
||||
String filePath = "";
|
||||
if(fileDownloadEntity.getFileType() != null && fileDownloadEntity.getFileType().equals("2")){
|
||||
filePath = PLUGINPATH + fileDownloadEntity.getFilepath().replace("/",File.separator).replace("\\",File.separator);
|
||||
}else{
|
||||
filePath = DSK + fileDownloadEntity.getFilepath().replace("/",File.separator).replace("\\",File.separator);
|
||||
}
|
||||
|
||||
/** 获取file文件*/
|
||||
File file = new File(filePath);
|
||||
/** 设置file*/
|
||||
fileDownloadEntity.setFile(file);
|
||||
return fileDownloadEntity;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public FileDownloadEntity pluginZipUpate(FileUploadDto fileUploadDto) throws Exception {
|
||||
// /** 如果fileUploadDto的id直接为空,或者null直接抛出异常*/
|
||||
// if(fileUploadDto == null || fileUploadDto.getId() == null || "".equals(fileUploadDto.getId())){
|
||||
// throw new BaseSystemException("请传入参数!");
|
||||
// }
|
||||
// /** 根据唯一名称获取文件信息*/
|
||||
// FileDownloadEntity queryEntity = new FileDownloadEntity();
|
||||
// queryEntity.setId(fileUploadDto.getId());
|
||||
// queryEntity.setSts("Y");
|
||||
// FileDownloadEntity fileDownloadEntity =filedownloadDao.queryOne(queryEntity);
|
||||
// String filePath = fileDownloadEntity.getFilepath();
|
||||
// //插件附件路径
|
||||
// String inputFile = PLUGINPATH + filePath;
|
||||
//
|
||||
// File srcFile = new File(inputFile);//获取当前压缩文件
|
||||
// // 判断源文件是否存在
|
||||
// if (!srcFile.exists()) {
|
||||
// throw new Exception(srcFile.getPath() + "所指文件不存在");
|
||||
// }
|
||||
// ZipFile zipFile = new ZipFile(srcFile);//创建压缩文件对象
|
||||
// //开始解压
|
||||
// Enumeration<?> entries = zipFile.entries();
|
||||
// boolean isFirst = true;
|
||||
// String firstName = "";
|
||||
// while (entries.hasMoreElements()) {
|
||||
// ZipEntry entry = (ZipEntry) entries.nextElement();
|
||||
// // 构造解压后的文件路径,去掉压缩包的名字
|
||||
// String unzipPath = entry.getName().replace(firstName,"");
|
||||
// String classPath = "com\\hzya\\frame\\plugin";
|
||||
// String xmlPath = "cfgHome\\plugin";
|
||||
//
|
||||
// String dirPath = "";
|
||||
// if(unzipPath.contains("classfile/")){
|
||||
// dirPath = TOMCATPATH + "/" + classPath + unzipPath.replace("classfile","");
|
||||
// }
|
||||
// if(unzipPath.contains("xmlfile/")){
|
||||
// dirPath = TOMCATPATH + "/" + xmlPath + unzipPath.replace("xmlfile","");
|
||||
// }
|
||||
//
|
||||
// // 如果是文件夹,就创建个文件夹
|
||||
// if (entry.isDirectory()) {
|
||||
// if(isFirst == false){
|
||||
// File dir = new File(dirPath);
|
||||
// dir.mkdirs();
|
||||
// }else{
|
||||
// firstName = entry.getName();
|
||||
// isFirst = false;
|
||||
// }
|
||||
// } else {
|
||||
// // 如果是文件,就先创建一个文件,然后用io流把内容copy过去
|
||||
// File targetFile = new File(dirPath);
|
||||
// // 保证这个文件的父文件夹必须要存在
|
||||
// if (!targetFile.getParentFile().exists()) {
|
||||
// targetFile.getParentFile().mkdirs();
|
||||
// }
|
||||
// targetFile.createNewFile();
|
||||
// // 将压缩文件内容写入到这个文件中
|
||||
// InputStream is = zipFile.getInputStream(entry);
|
||||
// FileOutputStream fos = new FileOutputStream(targetFile);
|
||||
// int len;
|
||||
// byte[] buf = new byte[1024];
|
||||
// while ((len = is.read(buf)) != -1) {
|
||||
// fos.write(buf, 0, len);
|
||||
// }
|
||||
// // 关流顺序,先打开的后关闭
|
||||
// fos.close();
|
||||
// is.close();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// return fileDownloadEntity;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public FileDownloadEntity pluginZipUpate(FileUploadDto fileUploadDto) throws Exception {
|
||||
/** 如果fileUploadDto的id直接为空,或者null直接抛出异常*/
|
||||
if(fileUploadDto == null || fileUploadDto.getId() == null || "".equals(fileUploadDto.getId())){
|
||||
throw new BaseSystemException("请传入参数!");
|
||||
}
|
||||
/** 根据唯一名称获取文件信息*/
|
||||
FileDownloadEntity queryEntity = new FileDownloadEntity();
|
||||
queryEntity.setId(fileUploadDto.getId());
|
||||
queryEntity.setSts("Y");
|
||||
FileDownloadEntity fileDownloadEntity =filedownloadDao.queryOne(queryEntity);
|
||||
String filePath = fileDownloadEntity.getFilepath();
|
||||
//插件附件路径
|
||||
String inputFile = PLUGINPATH + filePath;
|
||||
|
||||
File srcFile = new File(inputFile);//获取当前压缩文件
|
||||
// 判断源文件是否存在
|
||||
if (!srcFile.exists()) {
|
||||
throw new Exception(srcFile.getPath() + "所指文件不存在");
|
||||
}
|
||||
ZipFile zipFile = new ZipFile(srcFile);//创建压缩文件对象
|
||||
//开始解压
|
||||
Enumeration<?> entries = zipFile.entries();
|
||||
|
||||
while (entries.hasMoreElements()) {
|
||||
ZipEntry entry = (ZipEntry) entries.nextElement();
|
||||
String unzipPath = entry.getName();
|
||||
|
||||
String dirPath = TOMCATPATH + unzipPath;
|
||||
|
||||
// 如果是文件夹,就创建个文件夹
|
||||
if (entry.isDirectory()) {
|
||||
File dir = new File(dirPath);
|
||||
dir.mkdirs();
|
||||
} else {
|
||||
// 如果是文件,就先创建一个文件,然后用io流把内容copy过去
|
||||
File targetFile = new File(dirPath);
|
||||
// 保证这个文件的父文件夹必须要存在
|
||||
if (!targetFile.getParentFile().exists()) {
|
||||
targetFile.getParentFile().mkdirs();
|
||||
}
|
||||
targetFile.createNewFile();
|
||||
// 将压缩文件内容写入到这个文件中
|
||||
InputStream is = zipFile.getInputStream(entry);
|
||||
FileOutputStream fos = new FileOutputStream(targetFile);
|
||||
int len;
|
||||
byte[] buf = new byte[1024];
|
||||
while ((len = is.read(buf)) != -1) {
|
||||
fos.write(buf, 0, len);
|
||||
}
|
||||
// 关流顺序,先打开的后关闭
|
||||
fos.close();
|
||||
is.close();
|
||||
}
|
||||
}
|
||||
|
||||
return fileDownloadEntity;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -28,7 +28,9 @@ private Long business_id;
|
|||
*
|
||||
* */
|
||||
private String business_type;
|
||||
/** 1:上传普通文件 2:上传插件*/
|
||||
/** 是否是业务附件 true 是(是业务附件的时候,请传入相对应的业务ID,) false 不是,*/
|
||||
|
||||
private boolean fileFlag;
|
||||
/** 上传文件的ID*/
|
||||
private String fileID;
|
||||
|
|
|
@ -21,12 +21,26 @@ public class FileUploadDto {
|
|||
* 业务类型
|
||||
*/
|
||||
private String businessType;
|
||||
/**
|
||||
* 文件类型
|
||||
* 1:普通文件
|
||||
* 2:插件附件
|
||||
*/
|
||||
private String fileType = "1";
|
||||
|
||||
/**
|
||||
* 是否是业务类型
|
||||
*/
|
||||
private boolean fileFlag;
|
||||
|
||||
public String getFileType() {
|
||||
return fileType;
|
||||
}
|
||||
|
||||
public void setFileType(String fileType) {
|
||||
this.fileType = fileType;
|
||||
}
|
||||
|
||||
public String getBusinessType() {
|
||||
return businessType;
|
||||
}
|
||||
|
|
|
@ -26,6 +26,12 @@ public class FileUploadEntity extends BaseEntity {
|
|||
* 文件类型
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* 文件类型
|
||||
* 1:普通文件
|
||||
* 2:插件附件
|
||||
*/
|
||||
private String fileType;
|
||||
/**
|
||||
* 文件大小(kb)
|
||||
*/
|
||||
|
@ -48,6 +54,14 @@ public class FileUploadEntity extends BaseEntity {
|
|||
private File[] multiFile;
|
||||
private String[] multiFileFileName;
|
||||
|
||||
public String getFileType() {
|
||||
return fileType;
|
||||
}
|
||||
|
||||
public void setFileType(String fileType) {
|
||||
this.fileType = fileType;
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件名称
|
||||
*/
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
<result property="filesavename" column="filesavename" />
|
||||
<!--文件类型 -->
|
||||
<result property="type" column="type" />
|
||||
<!--文件类型 1:普通文件 2:插件附件-->
|
||||
<result property="fileType" column="file_type" />
|
||||
<!--文件大小(kb) -->
|
||||
<result property="file_size" column="file_size" />
|
||||
<!--描述 -->
|
||||
|
@ -33,6 +35,7 @@
|
|||
filename,
|
||||
filesavename,
|
||||
type,
|
||||
file_type,
|
||||
file_size,
|
||||
description,
|
||||
filepath,
|
||||
|
@ -60,6 +63,7 @@
|
|||
<if test="filename != null and filename !='' "> and filename = #{filename}</if>
|
||||
<if test="filesavename != null and filesavename !='' "> and filesavename = #{filesavename}</if>
|
||||
<if test="type != null and type !='' "> and type = #{type}</if>
|
||||
<if test="fileType != null and fileType !='' "> and file_type = #{fileType}</if>
|
||||
<if test="file_size != null "> and file_size = #{file_size}</if>
|
||||
<if test="description != null and description !='' "> and description = #{description}</if>
|
||||
<if test="filepath != null and filepath !='' "> and filepath = #{filepath}</if>
|
||||
|
@ -82,6 +86,7 @@
|
|||
<if test="filename != null and filename !='' "> and filename = #{filename} </if>
|
||||
<if test="filesavename != null and filesavename !='' "> and filesavename = #{filesavename} </if>
|
||||
<if test="type != null and type !='' "> and type = #{type} </if>
|
||||
<if test="fileType != null and fileType !='' "> and file_type = #{fileType} </if>
|
||||
<if test="file_size != null "> and file_size = #{file_size} </if>
|
||||
<if test="description != null and description !='' "> and description = #{description} </if>
|
||||
<if test="filepath != null and filepath !='' "> and filepath = #{filepath} </if>
|
||||
|
@ -106,6 +111,7 @@
|
|||
<if test="filename != null and filename !='' "> and filename like concat('%',#{filename},'%') </if>
|
||||
<if test="filesavename != null and filesavename !='' "> and filesavename like concat('%',#{filesavename},'%') </if>
|
||||
<if test="type != null and type !='' "> and type like concat('%',#{type},'%') </if>
|
||||
<if test="fileType != null and fileType !='' "> and file_type like concat('%',#{fileType},'%') </if>
|
||||
<if test="file_size != null "> and file_size = #{file_size}</if>
|
||||
<if test="description != null and description !='' "> and description like concat('%',#{description},'%') </if>
|
||||
<if test="filepath != null and filepath !='' "> and filepath like concat('%',#{filepath},'%') </if>
|
||||
|
@ -130,6 +136,7 @@
|
|||
<if test="filename != null and filename !='' "> or filename = #{filename} </if>
|
||||
<if test="filesavename != null and filesavename !='' "> or filesavename = #{filesavename} </if>
|
||||
<if test="type != null and type !='' "> or type = #{type} </if>
|
||||
<if test="fileType != null and fileType !='' "> or file_type = #{fileType} </if>
|
||||
<if test="file_size != null "> or file_size = #{file_size}</if>
|
||||
<if test="description != null and description !='' "> or description = #{description} </if>
|
||||
<if test="filepath != null and filepath !='' "> or filepath = #{filepath} </if>
|
||||
|
@ -151,6 +158,7 @@
|
|||
<if test="filename != null and filename !='' "> filename, </if>
|
||||
<if test="filesavename != null and filesavename !='' "> filesavename, </if>
|
||||
<if test="type != null and type !='' "> type, </if>
|
||||
<if test="fileType != null and fileType !='' "> file_type, </if>
|
||||
<if test="file_size != null ">file_size,</if>
|
||||
<if test="description != null and description !='' "> description, </if>
|
||||
<if test="filepath != null and filepath !='' "> filepath, </if>
|
||||
|
@ -167,6 +175,7 @@
|
|||
<if test="filename != null and filename !='' "> #{filename}, </if>
|
||||
<if test="filesavename != null and filesavename !='' "> #{filesavename}, </if>
|
||||
<if test="type != null and type !='' "> #{type}, </if>
|
||||
<if test="fileType != null and fileType !='' "> #{fileType}, </if>
|
||||
<if test="file_size != null ">#{file_size},</if>
|
||||
<if test="description != null and description !='' "> #{description}, </if>
|
||||
<if test="filepath != null and filepath !='' "> #{filepath}, </if>
|
||||
|
@ -189,6 +198,7 @@
|
|||
<if test="filename != null and filename !='' "> filename = #{filename},</if>
|
||||
<if test="filesavename != null and filesavename !='' "> filesavename = #{filesavename},</if>
|
||||
<if test="type != null and type !='' "> type = #{type},</if>
|
||||
<if test="fileType != null and fileType !='' "> file_type = #{fileType},</if>
|
||||
<if test="file_size != null ">file_size = #{file_size},</if>
|
||||
<if test="description != null and description !='' "> description = #{description},</if>
|
||||
<if test="filepath != null and filepath !='' "> filepath = #{filepath},</if>
|
||||
|
@ -206,6 +216,7 @@
|
|||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="filename != null and filename !='' "> filename = #{filename},</if>
|
||||
<if test="type != null and type !='' "> type = #{type},</if>
|
||||
<if test="fileType != null and fileType !='' "> file_type = #{fileType},</if>
|
||||
<if test="file_size != null ">file_size = #{file_size},</if>
|
||||
<if test="description != null and description !='' "> description = #{description},</if>
|
||||
<if test="filepath != null and filepath !='' "> filepath = #{filepath},</if>
|
||||
|
@ -233,6 +244,7 @@
|
|||
<if test="filename != null and filename !='' "> and filename = #{filename}</if>
|
||||
<if test="filesavename != null and filesavename !='' "> and filesavename = #{filesavename}</if>
|
||||
<if test="type != null and type !='' "> and type = #{type}</if>
|
||||
<if test="fileType != null and fileType !='' "> and file_type = #{fileType}</if>
|
||||
<if test="file_size != null "> and file_size = #{file_size}</if>
|
||||
<if test="description != null and description !='' "> and description = #{description}</if>
|
||||
<if test="filepath != null and filepath !='' "> and filepath = #{filepath}</if>
|
||||
|
|
|
@ -25,6 +25,8 @@ public interface IFileUploadService extends IBaseService<FileUploadEntity, Long>
|
|||
* @throws IOException
|
||||
*/
|
||||
FileUploadEntity fileUpload(MultipartFile files, FileUploadDto entity) throws Exception;
|
||||
|
||||
FileUploadEntity pluginfileUpload(MultipartFile files, FileUploadDto entity,String pluginPackageName) throws Exception;
|
||||
/**
|
||||
* 文件上传方法
|
||||
*
|
||||
|
|
|
@ -23,9 +23,13 @@ import org.springframework.web.multipart.MultipartFile;
|
|||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.util.Date;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
|
||||
/**
|
||||
* @description: 系统文件上传 service
|
||||
|
@ -39,6 +43,9 @@ public class FileUploadServiceImpl extends BaseService<FileUploadEntity, Long> i
|
|||
@Value("${savefile.path}")
|
||||
public String DSK;
|
||||
|
||||
@Value("${savefile.pluginpath:}")
|
||||
public String PLUGINPATH;
|
||||
|
||||
protected IFileUploadDao fileUploadDao;
|
||||
|
||||
@Autowired
|
||||
|
@ -76,8 +83,92 @@ public class FileUploadServiceImpl extends BaseService<FileUploadEntity, Long> i
|
|||
/** 获取到拼接完成的文件属性*/
|
||||
String path = stringBuffer.toString();
|
||||
/** 保存到file表信息*/
|
||||
FileUploadEntity fileUploadEntity = saveFile(file, path, "附件备注");
|
||||
path = DSK + fileUploadEntity.getFilepath();
|
||||
FileUploadEntity fileUploadEntity = saveFile(file, path, "附件备注",entity.getFileType());
|
||||
/**当fileType为2时,存储的是插件附件*/
|
||||
if(entity.getFileType().equals("2")){
|
||||
path = PLUGINPATH + fileUploadEntity.getFilepath();
|
||||
}else{
|
||||
path = DSK + fileUploadEntity.getFilepath();
|
||||
}
|
||||
|
||||
/** 创建文件夹*/
|
||||
FileUtils.createDir(path);
|
||||
File uploadFile = new File(path);
|
||||
file.transferTo(uploadFile);
|
||||
return fileUploadEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileUploadEntity pluginfileUpload(MultipartFile file, FileUploadDto entity,String pluginPackageName) throws Exception {
|
||||
|
||||
// 创建一个临时文件
|
||||
File fileT = new File(file.getOriginalFilename());
|
||||
// 将 MultipartFile 的内容写入文件
|
||||
try (FileOutputStream fos = new FileOutputStream(fileT)) {
|
||||
// 获取文件内容的字节数组
|
||||
byte[] bytes = file.getBytes();
|
||||
fos.write(bytes);
|
||||
}
|
||||
|
||||
ZipFile zipFile = new ZipFile(fileT);//创建压缩文件对象
|
||||
//开始解压
|
||||
Enumeration<?> entries = zipFile.entries();
|
||||
boolean xmlflag = false;
|
||||
boolean classflag = false;
|
||||
while (entries.hasMoreElements()) {
|
||||
ZipEntry entry = (ZipEntry) entries.nextElement();
|
||||
if(xmlflag == false){
|
||||
if(entry.getName().contains("cfgHome/plugin/"+pluginPackageName) && entry.isDirectory()){
|
||||
xmlflag = true;
|
||||
}
|
||||
}
|
||||
if(classflag == false){
|
||||
if(entry.getName().contains("com/hzya/frame/plugin/"+pluginPackageName) && entry.isDirectory()){
|
||||
classflag = true;
|
||||
}
|
||||
}
|
||||
if(xmlflag && classflag){
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(xmlflag == false || classflag == false){
|
||||
throw new BaseSystemException("插件附件不符合规范或插件包名填写错误,请检查!");
|
||||
}
|
||||
fileT.delete();
|
||||
zipFile.close();
|
||||
|
||||
|
||||
/** 获取系统设置文件存放的盘符*/
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
/** 获取根目录*/
|
||||
//stringBuffer.append(DSK);
|
||||
/** 根据当前日期创建文件目录*/
|
||||
String nowDateString = DateUtil.dateToString(new Date(), "yyyy-MM-dd");
|
||||
|
||||
/** 判断传入的文件是否是属于业务的文件数据,如果是则根据业务单据去生成文件夹,否则,按照日期生成*/
|
||||
if (entity.isFileFlag() && entity.getBusinessType() != null && !"".equals(entity.getBusinessType())) {
|
||||
/** 没有单票ID临时把文件放在default目录下面*/
|
||||
/** 创建默认文件夹*/
|
||||
stringBuffer.append(File.separator+entity.getBusinessType());
|
||||
/** 根据当前日期生成文件夹*/
|
||||
stringBuffer.append(File.separator + nowDateString);
|
||||
} else {
|
||||
/** 创建默认文件夹*/
|
||||
stringBuffer.append(File.separator+"default");
|
||||
/** 拼接上当前日期*/
|
||||
stringBuffer.append(File.separator + nowDateString);
|
||||
}
|
||||
/** 获取到拼接完成的文件属性*/
|
||||
String path = stringBuffer.toString();
|
||||
/** 保存到file表信息*/
|
||||
FileUploadEntity fileUploadEntity = saveFile(file, path, "附件备注",entity.getFileType());
|
||||
/**当fileType为2时,存储的是插件附件*/
|
||||
if(entity.getFileType().equals("2")){
|
||||
path = PLUGINPATH + fileUploadEntity.getFilepath();
|
||||
}else{
|
||||
path = DSK + fileUploadEntity.getFilepath();
|
||||
}
|
||||
|
||||
/** 创建文件夹*/
|
||||
FileUtils.createDir(path);
|
||||
File uploadFile = new File(path);
|
||||
|
@ -91,7 +182,9 @@ public class FileUploadServiceImpl extends BaseService<FileUploadEntity, Long> i
|
|||
/** 获取系统设置文件存放的盘符*/
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
/** 获取根目录*/
|
||||
stringBuffer.append(DSK);
|
||||
stringBuffer.append(DSK);
|
||||
|
||||
|
||||
/** 获取当前人所在的公司,用ID和公司名称拼接*/
|
||||
// stringBuffer.append("/" + userEntity.getOrg_name() + "_" + userEntity.getOrg_id());
|
||||
/** 根据当前日期创建文件目录*/
|
||||
|
@ -278,7 +371,7 @@ public class FileUploadServiceImpl extends BaseService<FileUploadEntity, Long> i
|
|||
* @param description
|
||||
* @return
|
||||
*/
|
||||
private FileUploadEntity saveFile(MultipartFile file, String filepath, String description) {
|
||||
private FileUploadEntity saveFile(MultipartFile file, String filepath, String description,String fileType) {
|
||||
/*** UUID生成File的新名称*/
|
||||
Long id = UUIDLong.longUUID();
|
||||
Long fileNewName = UUIDLong.longUUID();
|
||||
|
@ -291,6 +384,7 @@ public class FileUploadServiceImpl extends BaseService<FileUploadEntity, Long> i
|
|||
fileUploadEntity.setFilename(fileName);
|
||||
fileUploadEntity.setFilesavename(String.valueOf(fileNewName));
|
||||
fileUploadEntity.setType(type);
|
||||
fileUploadEntity.setFileType(fileType);
|
||||
fileUploadEntity.setFile_size(file.getSize());
|
||||
fileUploadEntity.setDescription(description);
|
||||
fileUploadEntity.setFilepath(filepath+ File.separator +fileUploadEntity.getFilesavename());
|
||||
|
|
|
@ -20,6 +20,8 @@ import java.util.List;
|
|||
*/
|
||||
public class Org extends BaseEntity {
|
||||
|
||||
|
||||
|
||||
/** 唯一标识码 */
|
||||
private String id;
|
||||
/** 组织机构编码 */
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
package com.hzya.frame.sysnew.application.dictionary.dao;
|
||||
|
||||
import com.hzya.frame.sysnew.application.dictionary.entity.SysApplicationDictionaryEntity;
|
||||
import com.hzya.frame.basedao.dao.IBaseDao;
|
||||
|
||||
/**
|
||||
* 应用数据字典表(sys_application_dictionary: table)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-08-12 16:40:53
|
||||
*/
|
||||
public interface ISysApplicationDictionaryDao extends IBaseDao<SysApplicationDictionaryEntity, String> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.hzya.frame.sysnew.application.dictionary.dao.impl;
|
||||
|
||||
import com.hzya.frame.sysnew.application.dictionary.entity.SysApplicationDictionaryEntity;
|
||||
import com.hzya.frame.sysnew.application.dictionary.dao.ISysApplicationDictionaryDao;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
||||
/**
|
||||
* 应用数据字典表(SysApplicationDictionary)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-08-12 16:41:07
|
||||
*/
|
||||
@Repository(value = "SysApplicationDictionaryDaoImpl")
|
||||
public class SysApplicationDictionaryDaoImpl extends MybatisGenericDao<SysApplicationDictionaryEntity, String> implements ISysApplicationDictionaryDao{
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
package com.hzya.frame.sysnew.application.dictionary.entity;
|
||||
|
||||
import java.util.Date;
|
||||
import com.hzya.frame.web.entity.BaseEntity;
|
||||
/**
|
||||
* 应用数据字典表(SysApplicationDictionary)实体类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-08-12 16:41:20
|
||||
*/
|
||||
public class SysApplicationDictionaryEntity extends BaseEntity {
|
||||
|
||||
/** 应用id */
|
||||
private String appId;
|
||||
/** 名称 */
|
||||
private String name;
|
||||
/** 类型 */
|
||||
private String dictionaryType;
|
||||
/** 表 */
|
||||
private String dictionaryTable;
|
||||
/** 语句 */
|
||||
private String dictionarySql;
|
||||
/** 公司id */
|
||||
private String companyId;
|
||||
|
||||
|
||||
public String getAppId() {
|
||||
return appId;
|
||||
}
|
||||
|
||||
public void setAppId(String appId) {
|
||||
this.appId = appId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDictionaryType() {
|
||||
return dictionaryType;
|
||||
}
|
||||
|
||||
public void setDictionaryType(String dictionaryType) {
|
||||
this.dictionaryType = dictionaryType;
|
||||
}
|
||||
|
||||
public String getDictionaryTable() {
|
||||
return dictionaryTable;
|
||||
}
|
||||
|
||||
public void setDictionaryTable(String dictionaryTable) {
|
||||
this.dictionaryTable = dictionaryTable;
|
||||
}
|
||||
|
||||
public String getDictionarySql() {
|
||||
return dictionarySql;
|
||||
}
|
||||
|
||||
public void setDictionarySql(String dictionarySql) {
|
||||
this.dictionarySql = dictionarySql;
|
||||
}
|
||||
|
||||
public String getCompanyId() {
|
||||
return companyId;
|
||||
}
|
||||
|
||||
public void setCompanyId(String companyId) {
|
||||
this.companyId = companyId;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,256 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.hzya.frame.sysnew.application.dictionary.dao.impl.SysApplicationDictionaryDaoImpl">
|
||||
|
||||
<resultMap id="get-SysApplicationDictionaryEntity-result" type="com.hzya.frame.sysnew.application.dictionary.entity.SysApplicationDictionaryEntity" >
|
||||
<result property="appId" column="app_id" jdbcType="VARCHAR"/>
|
||||
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||
<result property="dictionaryType" column="dictionary_type" jdbcType="VARCHAR"/>
|
||||
<result property="dictionaryTable" column="dictionary_table" jdbcType="VARCHAR"/>
|
||||
<result property="dictionarySql" column="dictionary_sql" jdbcType="VARCHAR"/>
|
||||
<result property="sorts" column="sorts" jdbcType="INTEGER"/>
|
||||
<result property="id" column="id" jdbcType="VARCHAR"/>
|
||||
<result property="create_user_id" column="create_user_id" jdbcType="VARCHAR"/>
|
||||
<result property="create_time" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="modify_time" column="modify_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="modify_user_id" column="modify_user_id" jdbcType="VARCHAR"/>
|
||||
<result property="org_id" column="org_id" jdbcType="VARCHAR"/>
|
||||
<result property="companyId" column="company_id" jdbcType="VARCHAR"/>
|
||||
<result property="sts" column="sts" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
<!-- 查询的字段-->
|
||||
<sql id = "SysApplicationDictionaryEntity_Base_Column_List">
|
||||
app_id
|
||||
,name
|
||||
,dictionary_type
|
||||
,dictionary_table
|
||||
,dictionary_sql
|
||||
,sorts
|
||||
,id
|
||||
,create_user_id
|
||||
,create_time
|
||||
,modify_time
|
||||
,modify_user_id
|
||||
,org_id
|
||||
,company_id
|
||||
,sts
|
||||
</sql>
|
||||
<!-- 查询 采用==查询 -->
|
||||
<select id="entity_list_base" resultMap="get-SysApplicationDictionaryEntity-result" parameterType = "com.hzya.frame.sysnew.application.dictionary.entity.SysApplicationDictionaryEntity">
|
||||
select
|
||||
<include refid="SysApplicationDictionaryEntity_Base_Column_List" />
|
||||
from sys_application_dictionary
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="appId != null and appId != ''"> and app_id = #{appId} </if>
|
||||
<if test="name != null and name != ''"> and name = #{name} </if>
|
||||
<if test="dictionaryType != null and dictionaryType != ''"> and dictionary_type = #{dictionaryType} </if>
|
||||
<if test="dictionaryTable != null and dictionaryTable != ''"> and dictionary_table = #{dictionaryTable} </if>
|
||||
<if test="dictionarySql != null and dictionarySql != ''"> and dictionary_sql = #{dictionarySql} </if>
|
||||
<if test="sorts != null"> and sorts = #{sorts} </if>
|
||||
<if test="id != null and id != ''"> and id = #{id} </if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> and create_user_id = #{create_user_id} </if>
|
||||
<if test="create_time != null"> and create_time = #{create_time} </if>
|
||||
<if test="modify_time != null"> and modify_time = #{modify_time} </if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id = #{modify_user_id} </if>
|
||||
<if test="org_id != null and org_id != ''"> and org_id = #{org_id} </if>
|
||||
<if test="companyId != null and companyId != ''"> and company_id = #{companyId} </if>
|
||||
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
|
||||
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
|
||||
</select>
|
||||
|
||||
<!-- 查询符合条件的数量 -->
|
||||
<select id="entity_count" resultType="Integer" parameterType = "com.hzya.frame.sysnew.application.dictionary.entity.SysApplicationDictionaryEntity">
|
||||
select count(1) from sys_application_dictionary
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="appId != null and appId != ''"> and app_id = #{appId} </if>
|
||||
<if test="name != null and name != ''"> and name = #{name} </if>
|
||||
<if test="dictionaryType != null and dictionaryType != ''"> and dictionary_type = #{dictionaryType} </if>
|
||||
<if test="dictionaryTable != null and dictionaryTable != ''"> and dictionary_table = #{dictionaryTable} </if>
|
||||
<if test="dictionarySql != null and dictionarySql != ''"> and dictionary_sql = #{dictionarySql} </if>
|
||||
<if test="sorts != null"> and sorts = #{sorts} </if>
|
||||
<if test="id != null and id != ''"> and id = #{id} </if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> and create_user_id = #{create_user_id} </if>
|
||||
<if test="create_time != null"> and create_time = #{create_time} </if>
|
||||
<if test="modify_time != null"> and modify_time = #{modify_time} </if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id = #{modify_user_id} </if>
|
||||
<if test="org_id != null and org_id != ''"> and org_id = #{org_id} </if>
|
||||
<if test="companyId != null and companyId != ''"> and company_id = #{companyId} </if>
|
||||
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
|
||||
<if test=" sort !='' and sort!=null and order !='' and order!=null "> order by ${sort} ${order}</if>
|
||||
</select>
|
||||
|
||||
<!-- 分页查询列表 采用like格式 -->
|
||||
<select id="entity_list_like" resultMap="get-SysApplicationDictionaryEntity-result" parameterType = "com.hzya.frame.sysnew.application.dictionary.entity.SysApplicationDictionaryEntity">
|
||||
select
|
||||
<include refid="SysApplicationDictionaryEntity_Base_Column_List" />
|
||||
from sys_application_dictionary
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="appId != null and appId != ''"> and app_id like concat('%',#{appId},'%') </if>
|
||||
<if test="name != null and name != ''"> and name like concat('%',#{name},'%') </if>
|
||||
<if test="dictionaryType != null and dictionaryType != ''"> and dictionary_type like concat('%',#{dictionaryType},'%') </if>
|
||||
<if test="dictionaryTable != null and dictionaryTable != ''"> and dictionary_table like concat('%',#{dictionaryTable},'%') </if>
|
||||
<if test="dictionarySql != null and dictionarySql != ''"> and dictionary_sql like concat('%',#{dictionarySql},'%') </if>
|
||||
<if test="sorts != null"> and sorts like concat('%',#{sorts},'%') </if>
|
||||
<if test="id != null and id != ''"> and id like concat('%',#{id},'%') </if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> and create_user_id like concat('%',#{create_user_id},'%') </if>
|
||||
<if test="create_time != null"> and create_time like concat('%',#{create_time},'%') </if>
|
||||
<if test="modify_time != null"> and modify_time like concat('%',#{modify_time},'%') </if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id like concat('%',#{modify_user_id},'%') </if>
|
||||
<if test="org_id != null and org_id != ''"> and org_id like concat('%',#{org_id},'%') </if>
|
||||
<if test="companyId != null and companyId != ''"> and company_id like concat('%',#{companyId},'%') </if>
|
||||
<if test="sts != null and sts != ''"> and sts like concat('%',#{sts},'%') </if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
|
||||
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
|
||||
</select>
|
||||
|
||||
<!-- 查询列表 字段采用or格式 -->
|
||||
<select id="SysApplicationDictionaryentity_list_or" resultMap="get-SysApplicationDictionaryEntity-result" parameterType = "com.hzya.frame.sysnew.application.dictionary.entity.SysApplicationDictionaryEntity">
|
||||
select
|
||||
<include refid="SysApplicationDictionaryEntity_Base_Column_List" />
|
||||
from sys_application_dictionary
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="appId != null and appId != ''"> or app_id = #{appId} </if>
|
||||
<if test="name != null and name != ''"> or name = #{name} </if>
|
||||
<if test="dictionaryType != null and dictionaryType != ''"> or dictionary_type = #{dictionaryType} </if>
|
||||
<if test="dictionaryTable != null and dictionaryTable != ''"> or dictionary_table = #{dictionaryTable} </if>
|
||||
<if test="dictionarySql != null and dictionarySql != ''"> or dictionary_sql = #{dictionarySql} </if>
|
||||
<if test="sorts != null"> or sorts = #{sorts} </if>
|
||||
<if test="id != null and id != ''"> or id = #{id} </if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> or create_user_id = #{create_user_id} </if>
|
||||
<if test="create_time != null"> or create_time = #{create_time} </if>
|
||||
<if test="modify_time != null"> or modify_time = #{modify_time} </if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> or modify_user_id = #{modify_user_id} </if>
|
||||
<if test="org_id != null and org_id != ''"> or org_id = #{org_id} </if>
|
||||
<if test="companyId != null and companyId != ''"> or company_id = #{companyId} </if>
|
||||
<if test="sts != null and sts != ''"> or sts = #{sts} </if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
|
||||
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
|
||||
</select>
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="entity_insert" parameterType = "com.hzya.frame.sysnew.application.dictionary.entity.SysApplicationDictionaryEntity" keyProperty="sorts" useGeneratedKeys="true">
|
||||
insert into sys_application_dictionary(
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="appId != null and appId != ''"> app_id , </if>
|
||||
<if test="name != null and name != ''"> name , </if>
|
||||
<if test="dictionaryType != null and dictionaryType != ''"> dictionary_type , </if>
|
||||
<if test="dictionaryTable != null and dictionaryTable != ''"> dictionary_table , </if>
|
||||
<if test="dictionarySql != null and dictionarySql != ''"> dictionary_sql , </if>
|
||||
<if test="sorts != null"> sorts , </if>
|
||||
<if test="id != null and id != ''"> id , </if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> create_user_id , </if>
|
||||
<if test="create_time != null"> create_time , </if>
|
||||
<if test="modify_time != null"> modify_time , </if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> modify_user_id , </if>
|
||||
<if test="org_id != null and org_id != ''"> org_id , </if>
|
||||
<if test="companyId != null and companyId != ''"> company_id , </if>
|
||||
<if test="sts != null and sts != ''"> sts , </if>
|
||||
<if test="sorts == null ">sorts,</if>
|
||||
<if test="sts == null ">sts,</if>
|
||||
</trim>
|
||||
)values(
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="appId != null and appId != ''"> #{appId} ,</if>
|
||||
<if test="name != null and name != ''"> #{name} ,</if>
|
||||
<if test="dictionaryType != null and dictionaryType != ''"> #{dictionaryType} ,</if>
|
||||
<if test="dictionaryTable != null and dictionaryTable != ''"> #{dictionaryTable} ,</if>
|
||||
<if test="dictionarySql != null and dictionarySql != ''"> #{dictionarySql} ,</if>
|
||||
<if test="sorts != null"> #{sorts} ,</if>
|
||||
<if test="id != null and id != ''"> #{id} ,</if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> #{create_user_id} ,</if>
|
||||
<if test="create_time != null"> #{create_time} ,</if>
|
||||
<if test="modify_time != null"> #{modify_time} ,</if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> #{modify_user_id} ,</if>
|
||||
<if test="org_id != null and org_id != ''"> #{org_id} ,</if>
|
||||
<if test="companyId != null and companyId != ''"> #{companyId} ,</if>
|
||||
<if test="sts != null and sts != ''"> #{sts} ,</if>
|
||||
<if test="sorts == null ">(select (max(IFNULL( a.sorts, 0 )) + 1) as sort from sys_application_dictionary a WHERE a.sts = 'Y' ),</if>
|
||||
<if test="sts == null ">'Y',</if>
|
||||
</trim>
|
||||
)
|
||||
</insert>
|
||||
<!-- 批量新增 -->
|
||||
<insert id="entityInsertBatch" keyProperty="sorts" useGeneratedKeys="true">
|
||||
insert into sys_application_dictionary(app_id, name, dictionary_type, dictionary_table, dictionary_sql, create_user_id, create_time, modify_time, modify_user_id, org_id, company_id, sts, sts)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.appId},#{entity.name},#{entity.dictionaryType},#{entity.dictionaryTable},#{entity.dictionarySql},#{entity.create_user_id},#{entity.create_time},#{entity.modify_time},#{entity.modify_user_id},#{entity.org_id},#{entity.companyId},#{entity.sts}, 'Y')
|
||||
</foreach>
|
||||
</insert>
|
||||
<!-- 批量新增或者修改-->
|
||||
<insert id="entityInsertOrUpdateBatch" keyProperty="sorts" useGeneratedKeys="true">
|
||||
insert into sys_application_dictionary(app_id, name, dictionary_type, dictionary_table, dictionary_sql, create_user_id, create_time, modify_time, modify_user_id, org_id, company_id, sts)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.appId},#{entity.name},#{entity.dictionaryType},#{entity.dictionaryTable},#{entity.dictionarySql},#{entity.create_user_id},#{entity.create_time},#{entity.modify_time},#{entity.modify_user_id},#{entity.org_id},#{entity.companyId},#{entity.sts})
|
||||
</foreach>
|
||||
on duplicate key update
|
||||
app_id = values(app_id),
|
||||
name = values(name),
|
||||
dictionary_type = values(dictionary_type),
|
||||
dictionary_table = values(dictionary_table),
|
||||
dictionary_sql = values(dictionary_sql),
|
||||
create_user_id = values(create_user_id),
|
||||
create_time = values(create_time),
|
||||
modify_time = values(modify_time),
|
||||
modify_user_id = values(modify_user_id),
|
||||
org_id = values(org_id),
|
||||
company_id = values(company_id),
|
||||
sts = values(sts)</insert>
|
||||
<!--通过主键修改方法-->
|
||||
<update id="entity_update" parameterType = "com.hzya.frame.sysnew.application.dictionary.entity.SysApplicationDictionaryEntity" >
|
||||
update sys_application_dictionary set
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="appId != null and appId != ''"> app_id = #{appId},</if>
|
||||
<if test="name != null and name != ''"> name = #{name},</if>
|
||||
<if test="dictionaryType != null and dictionaryType != ''"> dictionary_type = #{dictionaryType},</if>
|
||||
<if test="dictionaryTable != null and dictionaryTable != ''"> dictionary_table = #{dictionaryTable},</if>
|
||||
<if test="dictionarySql != null and dictionarySql != ''"> dictionary_sql = #{dictionarySql},</if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> create_user_id = #{create_user_id},</if>
|
||||
<if test="create_time != null"> create_time = #{create_time},</if>
|
||||
<if test="modify_time != null"> modify_time = #{modify_time},</if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> modify_user_id = #{modify_user_id},</if>
|
||||
<if test="org_id != null and org_id != ''"> org_id = #{org_id},</if>
|
||||
<if test="companyId != null and companyId != ''"> company_id = #{companyId},</if>
|
||||
<if test="sts != null and sts != ''"> sts = #{sts},</if>
|
||||
</trim>
|
||||
where sorts = #{sorts}
|
||||
</update>
|
||||
<!-- 逻辑删除 -->
|
||||
<update id="entity_logicDelete" parameterType = "com.hzya.frame.sysnew.application.dictionary.entity.SysApplicationDictionaryEntity" >
|
||||
update sys_application_dictionary set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
|
||||
where sorts = #{sorts}
|
||||
</update>
|
||||
<!-- 多条件逻辑删除 -->
|
||||
<update id="entity_logicDelete_Multi_Condition" parameterType = "com.hzya.frame.sysnew.application.dictionary.entity.SysApplicationDictionaryEntity" >
|
||||
update sys_application_dictionary set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="appId != null and appId != ''"> and app_id = #{appId} </if>
|
||||
<if test="name != null and name != ''"> and name = #{name} </if>
|
||||
<if test="dictionaryType != null and dictionaryType != ''"> and dictionary_type = #{dictionaryType} </if>
|
||||
<if test="dictionaryTable != null and dictionaryTable != ''"> and dictionary_table = #{dictionaryTable} </if>
|
||||
<if test="dictionarySql != null and dictionarySql != ''"> and dictionary_sql = #{dictionarySql} </if>
|
||||
<if test="sorts != null"> and sorts = #{sorts} </if>
|
||||
<if test="id != null and id != ''"> and id = #{id} </if>
|
||||
<if test="companyId != null and companyId != ''"> and company_id = #{companyId} </if>
|
||||
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
</update>
|
||||
<!--通过主键删除-->
|
||||
<delete id="entity_delete">
|
||||
delete from sys_application_dictionary where sorts = #{sorts}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package com.hzya.frame.sysnew.application.dictionary.service;
|
||||
|
||||
import com.hzya.frame.sysnew.application.dictionary.entity.SysApplicationDictionaryEntity;
|
||||
import com.hzya.frame.basedao.service.IBaseService;
|
||||
/**
|
||||
* 应用数据字典表(SysApplicationDictionary)表服务接口
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-08-12 16:41:22
|
||||
*/
|
||||
public interface ISysApplicationDictionaryService extends IBaseService<SysApplicationDictionaryEntity, String>{
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package com.hzya.frame.sysnew.application.dictionary.service.impl;
|
||||
|
||||
import com.hzya.frame.sysnew.application.dictionary.entity.SysApplicationDictionaryEntity;
|
||||
import com.hzya.frame.sysnew.application.dictionary.dao.ISysApplicationDictionaryDao;
|
||||
import com.hzya.frame.sysnew.application.dictionary.service.ISysApplicationDictionaryService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import javax.annotation.Resource;
|
||||
import com.hzya.frame.basedao.service.impl.BaseService;
|
||||
/**
|
||||
* 应用数据字典表(SysApplicationDictionary)表服务实现类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-08-12 16:41:25
|
||||
*/
|
||||
@Service(value = "sysApplicationDictionaryService")
|
||||
public class SysApplicationDictionaryServiceImpl extends BaseService<SysApplicationDictionaryEntity, String> implements ISysApplicationDictionaryService {
|
||||
|
||||
private ISysApplicationDictionaryDao sysApplicationDictionaryDao;
|
||||
|
||||
@Autowired
|
||||
public void setSysApplicationDictionaryDao(ISysApplicationDictionaryDao dao) {
|
||||
this.sysApplicationDictionaryDao = dao;
|
||||
this.dao = dao;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.hzya.frame.sysnew.application.dictionaryDetail.dao;
|
||||
|
||||
import com.hzya.frame.sysnew.application.dictionaryDetail.entity.SysApplicationDictionaryDetailEntity;
|
||||
import com.hzya.frame.basedao.dao.IBaseDao;
|
||||
|
||||
/**
|
||||
* 应用数据字典明细表(sys_application_dictionary_detail: table)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-08-12 16:52:14
|
||||
*/
|
||||
public interface ISysApplicationDictionaryDetailDao extends IBaseDao<SysApplicationDictionaryDetailEntity, String> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.hzya.frame.sysnew.application.dictionaryDetail.dao.impl;
|
||||
|
||||
import com.hzya.frame.sysnew.application.dictionaryDetail.entity.SysApplicationDictionaryDetailEntity;
|
||||
import com.hzya.frame.sysnew.application.dictionaryDetail.dao.ISysApplicationDictionaryDetailDao;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
||||
/**
|
||||
* 应用数据字典明细表(SysApplicationDictionaryDetail)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-08-12 16:52:14
|
||||
*/
|
||||
@Repository(value = "SysApplicationDictionaryDetailDaoImpl")
|
||||
public class SysApplicationDictionaryDetailDaoImpl extends MybatisGenericDao<SysApplicationDictionaryDetailEntity, String> implements ISysApplicationDictionaryDetailDao{
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
package com.hzya.frame.sysnew.application.dictionaryDetail.entity;
|
||||
|
||||
import java.util.Date;
|
||||
import com.hzya.frame.web.entity.BaseEntity;
|
||||
/**
|
||||
* 应用数据字典明细表(SysApplicationDictionaryDetail)实体类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-08-12 16:52:14
|
||||
*/
|
||||
public class SysApplicationDictionaryDetailEntity extends BaseEntity {
|
||||
|
||||
/** 应用id */
|
||||
private String appId;
|
||||
/** 应用数据字典主表id */
|
||||
private String dictionaryId;
|
||||
/** 字段名称 */
|
||||
private String fieldName;
|
||||
/** 字段编码 */
|
||||
private String fieldCode;
|
||||
/** 字段类型 */
|
||||
private String fieldType;
|
||||
/** 公司id */
|
||||
private String companyId;
|
||||
|
||||
|
||||
public String getAppId() {
|
||||
return appId;
|
||||
}
|
||||
|
||||
public void setAppId(String appId) {
|
||||
this.appId = appId;
|
||||
}
|
||||
|
||||
public String getDictionaryId() {
|
||||
return dictionaryId;
|
||||
}
|
||||
|
||||
public void setDictionaryId(String dictionaryId) {
|
||||
this.dictionaryId = dictionaryId;
|
||||
}
|
||||
|
||||
public String getFieldName() {
|
||||
return fieldName;
|
||||
}
|
||||
|
||||
public void setFieldName(String fieldName) {
|
||||
this.fieldName = fieldName;
|
||||
}
|
||||
|
||||
public String getFieldCode() {
|
||||
return fieldCode;
|
||||
}
|
||||
|
||||
public void setFieldCode(String fieldCode) {
|
||||
this.fieldCode = fieldCode;
|
||||
}
|
||||
|
||||
public String getFieldType() {
|
||||
return fieldType;
|
||||
}
|
||||
|
||||
public void setFieldType(String fieldType) {
|
||||
this.fieldType = fieldType;
|
||||
}
|
||||
|
||||
public String getCompanyId() {
|
||||
return companyId;
|
||||
}
|
||||
|
||||
public void setCompanyId(String companyId) {
|
||||
this.companyId = companyId;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,256 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.hzya.frame.sysnew.application.dictionaryDetail.dao.impl.SysApplicationDictionaryDetailDaoImpl">
|
||||
|
||||
<resultMap id="get-SysApplicationDictionaryDetailEntity-result" type="com.hzya.frame.sysnew.application.dictionaryDetail.entity.SysApplicationDictionaryDetailEntity" >
|
||||
<result property="appId" column="app_id" jdbcType="VARCHAR"/>
|
||||
<result property="dictionaryId" column="dictionary_id" jdbcType="VARCHAR"/>
|
||||
<result property="fieldName" column="field_name" jdbcType="VARCHAR"/>
|
||||
<result property="fieldCode" column="field_code" jdbcType="VARCHAR"/>
|
||||
<result property="fieldType" column="field_type" jdbcType="VARCHAR"/>
|
||||
<result property="sorts" column="sorts" jdbcType="INTEGER"/>
|
||||
<result property="id" column="id" jdbcType="VARCHAR"/>
|
||||
<result property="create_user_id" column="create_user_id" jdbcType="VARCHAR"/>
|
||||
<result property="create_time" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="modify_time" column="modify_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="modify_user_id" column="modify_user_id" jdbcType="VARCHAR"/>
|
||||
<result property="org_id" column="org_id" jdbcType="VARCHAR"/>
|
||||
<result property="companyId" column="company_id" jdbcType="VARCHAR"/>
|
||||
<result property="sts" column="sts" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
<!-- 查询的字段-->
|
||||
<sql id = "SysApplicationDictionaryDetailEntity_Base_Column_List">
|
||||
app_id
|
||||
,dictionary_id
|
||||
,field_name
|
||||
,field_code
|
||||
,field_type
|
||||
,sorts
|
||||
,id
|
||||
,create_user_id
|
||||
,create_time
|
||||
,modify_time
|
||||
,modify_user_id
|
||||
,org_id
|
||||
,company_id
|
||||
,sts
|
||||
</sql>
|
||||
<!-- 查询 采用==查询 -->
|
||||
<select id="entity_list_base" resultMap="get-SysApplicationDictionaryDetailEntity-result" parameterType = "com.hzya.frame.sysnew.application.dictionaryDetail.entity.SysApplicationDictionaryDetailEntity">
|
||||
select
|
||||
<include refid="SysApplicationDictionaryDetailEntity_Base_Column_List" />
|
||||
from sys_application_dictionary_detail
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="appId != null and appId != ''"> and app_id = #{appId} </if>
|
||||
<if test="dictionaryId != null and dictionaryId != ''"> and dictionary_id = #{dictionaryId} </if>
|
||||
<if test="fieldName != null and fieldName != ''"> and field_name = #{fieldName} </if>
|
||||
<if test="fieldCode != null and fieldCode != ''"> and field_code = #{fieldCode} </if>
|
||||
<if test="fieldType != null and fieldType != ''"> and field_type = #{fieldType} </if>
|
||||
<if test="sorts != null"> and sorts = #{sorts} </if>
|
||||
<if test="id != null and id != ''"> and id = #{id} </if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> and create_user_id = #{create_user_id} </if>
|
||||
<if test="create_time != null"> and create_time = #{create_time} </if>
|
||||
<if test="modify_time != null"> and modify_time = #{modify_time} </if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id = #{modify_user_id} </if>
|
||||
<if test="org_id != null and org_id != ''"> and org_id = #{org_id} </if>
|
||||
<if test="companyId != null and companyId != ''"> and company_id = #{companyId} </if>
|
||||
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
|
||||
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
|
||||
</select>
|
||||
|
||||
<!-- 查询符合条件的数量 -->
|
||||
<select id="entity_count" resultType="Integer" parameterType = "com.hzya.frame.sysnew.application.dictionaryDetail.entity.SysApplicationDictionaryDetailEntity">
|
||||
select count(1) from sys_application_dictionary_detail
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="appId != null and appId != ''"> and app_id = #{appId} </if>
|
||||
<if test="dictionaryId != null and dictionaryId != ''"> and dictionary_id = #{dictionaryId} </if>
|
||||
<if test="fieldName != null and fieldName != ''"> and field_name = #{fieldName} </if>
|
||||
<if test="fieldCode != null and fieldCode != ''"> and field_code = #{fieldCode} </if>
|
||||
<if test="fieldType != null and fieldType != ''"> and field_type = #{fieldType} </if>
|
||||
<if test="sorts != null"> and sorts = #{sorts} </if>
|
||||
<if test="id != null and id != ''"> and id = #{id} </if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> and create_user_id = #{create_user_id} </if>
|
||||
<if test="create_time != null"> and create_time = #{create_time} </if>
|
||||
<if test="modify_time != null"> and modify_time = #{modify_time} </if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id = #{modify_user_id} </if>
|
||||
<if test="org_id != null and org_id != ''"> and org_id = #{org_id} </if>
|
||||
<if test="companyId != null and companyId != ''"> and company_id = #{companyId} </if>
|
||||
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
|
||||
<if test=" sort !='' and sort!=null and order !='' and order!=null "> order by ${sort} ${order}</if>
|
||||
</select>
|
||||
|
||||
<!-- 分页查询列表 采用like格式 -->
|
||||
<select id="entity_list_like" resultMap="get-SysApplicationDictionaryDetailEntity-result" parameterType = "com.hzya.frame.sysnew.application.dictionaryDetail.entity.SysApplicationDictionaryDetailEntity">
|
||||
select
|
||||
<include refid="SysApplicationDictionaryDetailEntity_Base_Column_List" />
|
||||
from sys_application_dictionary_detail
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="appId != null and appId != ''"> and app_id like concat('%',#{appId},'%') </if>
|
||||
<if test="dictionaryId != null and dictionaryId != ''"> and dictionary_id like concat('%',#{dictionaryId},'%') </if>
|
||||
<if test="fieldName != null and fieldName != ''"> and field_name like concat('%',#{fieldName},'%') </if>
|
||||
<if test="fieldCode != null and fieldCode != ''"> and field_code like concat('%',#{fieldCode},'%') </if>
|
||||
<if test="fieldType != null and fieldType != ''"> and field_type like concat('%',#{fieldType},'%') </if>
|
||||
<if test="sorts != null"> and sorts like concat('%',#{sorts},'%') </if>
|
||||
<if test="id != null and id != ''"> and id like concat('%',#{id},'%') </if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> and create_user_id like concat('%',#{create_user_id},'%') </if>
|
||||
<if test="create_time != null"> and create_time like concat('%',#{create_time},'%') </if>
|
||||
<if test="modify_time != null"> and modify_time like concat('%',#{modify_time},'%') </if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id like concat('%',#{modify_user_id},'%') </if>
|
||||
<if test="org_id != null and org_id != ''"> and org_id like concat('%',#{org_id},'%') </if>
|
||||
<if test="companyId != null and companyId != ''"> and company_id like concat('%',#{companyId},'%') </if>
|
||||
<if test="sts != null and sts != ''"> and sts like concat('%',#{sts},'%') </if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
|
||||
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
|
||||
</select>
|
||||
|
||||
<!-- 查询列表 字段采用or格式 -->
|
||||
<select id="SysApplicationDictionaryDetailentity_list_or" resultMap="get-SysApplicationDictionaryDetailEntity-result" parameterType = "com.hzya.frame.sysnew.application.dictionaryDetail.entity.SysApplicationDictionaryDetailEntity">
|
||||
select
|
||||
<include refid="SysApplicationDictionaryDetailEntity_Base_Column_List" />
|
||||
from sys_application_dictionary_detail
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="appId != null and appId != ''"> or app_id = #{appId} </if>
|
||||
<if test="dictionaryId != null and dictionaryId != ''"> or dictionary_id = #{dictionaryId} </if>
|
||||
<if test="fieldName != null and fieldName != ''"> or field_name = #{fieldName} </if>
|
||||
<if test="fieldCode != null and fieldCode != ''"> or field_code = #{fieldCode} </if>
|
||||
<if test="fieldType != null and fieldType != ''"> or field_type = #{fieldType} </if>
|
||||
<if test="sorts != null"> or sorts = #{sorts} </if>
|
||||
<if test="id != null and id != ''"> or id = #{id} </if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> or create_user_id = #{create_user_id} </if>
|
||||
<if test="create_time != null"> or create_time = #{create_time} </if>
|
||||
<if test="modify_time != null"> or modify_time = #{modify_time} </if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> or modify_user_id = #{modify_user_id} </if>
|
||||
<if test="org_id != null and org_id != ''"> or org_id = #{org_id} </if>
|
||||
<if test="companyId != null and companyId != ''"> or company_id = #{companyId} </if>
|
||||
<if test="sts != null and sts != ''"> or sts = #{sts} </if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
|
||||
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
|
||||
</select>
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="entity_insert" parameterType = "com.hzya.frame.sysnew.application.dictionaryDetail.entity.SysApplicationDictionaryDetailEntity" keyProperty="sorts" useGeneratedKeys="true">
|
||||
insert into sys_application_dictionary_detail(
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="appId != null and appId != ''"> app_id , </if>
|
||||
<if test="dictionaryId != null and dictionaryId != ''"> dictionary_id , </if>
|
||||
<if test="fieldName != null and fieldName != ''"> field_name , </if>
|
||||
<if test="fieldCode != null and fieldCode != ''"> field_code , </if>
|
||||
<if test="fieldType != null and fieldType != ''"> field_type , </if>
|
||||
<if test="sorts != null"> sorts , </if>
|
||||
<if test="id != null and id != ''"> id , </if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> create_user_id , </if>
|
||||
<if test="create_time != null"> create_time , </if>
|
||||
<if test="modify_time != null"> modify_time , </if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> modify_user_id , </if>
|
||||
<if test="org_id != null and org_id != ''"> org_id , </if>
|
||||
<if test="companyId != null and companyId != ''"> company_id , </if>
|
||||
<if test="sts != null and sts != ''"> sts , </if>
|
||||
<if test="sorts == null ">sorts,</if>
|
||||
<if test="sts == null ">sts,</if>
|
||||
</trim>
|
||||
)values(
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="appId != null and appId != ''"> #{appId} ,</if>
|
||||
<if test="dictionaryId != null and dictionaryId != ''"> #{dictionaryId} ,</if>
|
||||
<if test="fieldName != null and fieldName != ''"> #{fieldName} ,</if>
|
||||
<if test="fieldCode != null and fieldCode != ''"> #{fieldCode} ,</if>
|
||||
<if test="fieldType != null and fieldType != ''"> #{fieldType} ,</if>
|
||||
<if test="sorts != null"> #{sorts} ,</if>
|
||||
<if test="id != null and id != ''"> #{id} ,</if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> #{create_user_id} ,</if>
|
||||
<if test="create_time != null"> #{create_time} ,</if>
|
||||
<if test="modify_time != null"> #{modify_time} ,</if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> #{modify_user_id} ,</if>
|
||||
<if test="org_id != null and org_id != ''"> #{org_id} ,</if>
|
||||
<if test="companyId != null and companyId != ''"> #{companyId} ,</if>
|
||||
<if test="sts != null and sts != ''"> #{sts} ,</if>
|
||||
<if test="sorts == null ">(select (max(IFNULL( a.sorts, 0 )) + 1) as sort from sys_application_dictionary_detail a WHERE a.sts = 'Y' ),</if>
|
||||
<if test="sts == null ">'Y',</if>
|
||||
</trim>
|
||||
)
|
||||
</insert>
|
||||
<!-- 批量新增 -->
|
||||
<insert id="entityInsertBatch" keyProperty="sorts" useGeneratedKeys="true">
|
||||
insert into sys_application_dictionary_detail(app_id, dictionary_id, field_name, field_code, field_type, create_user_id, create_time, modify_time, modify_user_id, org_id, company_id, sts, sts)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.appId},#{entity.dictionaryId},#{entity.fieldName},#{entity.fieldCode},#{entity.fieldType},#{entity.create_user_id},#{entity.create_time},#{entity.modify_time},#{entity.modify_user_id},#{entity.org_id},#{entity.companyId},#{entity.sts}, 'Y')
|
||||
</foreach>
|
||||
</insert>
|
||||
<!-- 批量新增或者修改-->
|
||||
<insert id="entityInsertOrUpdateBatch" keyProperty="sorts" useGeneratedKeys="true">
|
||||
insert into sys_application_dictionary_detail(app_id, dictionary_id, field_name, field_code, field_type, create_user_id, create_time, modify_time, modify_user_id, org_id, company_id, sts)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.appId},#{entity.dictionaryId},#{entity.fieldName},#{entity.fieldCode},#{entity.fieldType},#{entity.create_user_id},#{entity.create_time},#{entity.modify_time},#{entity.modify_user_id},#{entity.org_id},#{entity.companyId},#{entity.sts})
|
||||
</foreach>
|
||||
on duplicate key update
|
||||
app_id = values(app_id),
|
||||
dictionary_id = values(dictionary_id),
|
||||
field_name = values(field_name),
|
||||
field_code = values(field_code),
|
||||
field_type = values(field_type),
|
||||
create_user_id = values(create_user_id),
|
||||
create_time = values(create_time),
|
||||
modify_time = values(modify_time),
|
||||
modify_user_id = values(modify_user_id),
|
||||
org_id = values(org_id),
|
||||
company_id = values(company_id),
|
||||
sts = values(sts)</insert>
|
||||
<!--通过主键修改方法-->
|
||||
<update id="entity_update" parameterType = "com.hzya.frame.sysnew.application.dictionaryDetail.entity.SysApplicationDictionaryDetailEntity" >
|
||||
update sys_application_dictionary_detail set
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="appId != null and appId != ''"> app_id = #{appId},</if>
|
||||
<if test="dictionaryId != null and dictionaryId != ''"> dictionary_id = #{dictionaryId},</if>
|
||||
<if test="fieldName != null and fieldName != ''"> field_name = #{fieldName},</if>
|
||||
<if test="fieldCode != null and fieldCode != ''"> field_code = #{fieldCode},</if>
|
||||
<if test="fieldType != null and fieldType != ''"> field_type = #{fieldType},</if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> create_user_id = #{create_user_id},</if>
|
||||
<if test="create_time != null"> create_time = #{create_time},</if>
|
||||
<if test="modify_time != null"> modify_time = #{modify_time},</if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> modify_user_id = #{modify_user_id},</if>
|
||||
<if test="org_id != null and org_id != ''"> org_id = #{org_id},</if>
|
||||
<if test="companyId != null and companyId != ''"> company_id = #{companyId},</if>
|
||||
<if test="sts != null and sts != ''"> sts = #{sts},</if>
|
||||
</trim>
|
||||
where sorts = #{sorts}
|
||||
</update>
|
||||
<!-- 逻辑删除 -->
|
||||
<update id="entity_logicDelete" parameterType = "com.hzya.frame.sysnew.application.dictionaryDetail.entity.SysApplicationDictionaryDetailEntity" >
|
||||
update sys_application_dictionary_detail set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
|
||||
where sorts = #{sorts}
|
||||
</update>
|
||||
<!-- 多条件逻辑删除 -->
|
||||
<update id="entity_logicDelete_Multi_Condition" parameterType = "com.hzya.frame.sysnew.application.dictionaryDetail.entity.SysApplicationDictionaryDetailEntity" >
|
||||
update sys_application_dictionary_detail set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="appId != null and appId != ''"> and app_id = #{appId} </if>
|
||||
<if test="dictionaryId != null and dictionaryId != ''"> and dictionary_id = #{dictionaryId} </if>
|
||||
<if test="fieldName != null and fieldName != ''"> and field_name = #{fieldName} </if>
|
||||
<if test="fieldCode != null and fieldCode != ''"> and field_code = #{fieldCode} </if>
|
||||
<if test="fieldType != null and fieldType != ''"> and field_type = #{fieldType} </if>
|
||||
<if test="sorts != null"> and sorts = #{sorts} </if>
|
||||
<if test="id != null and id != ''"> and id = #{id} </if>
|
||||
<if test="companyId != null and companyId != ''"> and company_id = #{companyId} </if>
|
||||
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
</update>
|
||||
<!--通过主键删除-->
|
||||
<delete id="entity_delete">
|
||||
delete from sys_application_dictionary_detail where sorts = #{sorts}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package com.hzya.frame.sysnew.application.dictionaryDetail.service;
|
||||
|
||||
import com.hzya.frame.sysnew.application.dictionaryDetail.entity.SysApplicationDictionaryDetailEntity;
|
||||
import com.hzya.frame.basedao.service.IBaseService;
|
||||
/**
|
||||
* 应用数据字典明细表(SysApplicationDictionaryDetail)表服务接口
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-08-12 16:52:14
|
||||
*/
|
||||
public interface ISysApplicationDictionaryDetailService extends IBaseService<SysApplicationDictionaryDetailEntity, String>{
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package com.hzya.frame.sysnew.application.dictionaryDetail.service.impl;
|
||||
|
||||
import com.hzya.frame.sysnew.application.dictionaryDetail.entity.SysApplicationDictionaryDetailEntity;
|
||||
import com.hzya.frame.sysnew.application.dictionaryDetail.dao.ISysApplicationDictionaryDetailDao;
|
||||
import com.hzya.frame.sysnew.application.dictionaryDetail.service.ISysApplicationDictionaryDetailService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import javax.annotation.Resource;
|
||||
import com.hzya.frame.basedao.service.impl.BaseService;
|
||||
/**
|
||||
* 应用数据字典明细表(SysApplicationDictionaryDetail)表服务实现类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-08-12 16:52:14
|
||||
*/
|
||||
@Service(value = "sysApplicationDictionaryDetailService")
|
||||
public class SysApplicationDictionaryDetailServiceImpl extends BaseService<SysApplicationDictionaryDetailEntity, String> implements ISysApplicationDictionaryDetailService {
|
||||
|
||||
private ISysApplicationDictionaryDetailDao sysApplicationDictionaryDetailDao;
|
||||
|
||||
@Autowired
|
||||
public void setSysApplicationDictionaryDetailDao(ISysApplicationDictionaryDetailDao dao) {
|
||||
this.sysApplicationDictionaryDetailDao = dao;
|
||||
this.dao = dao;
|
||||
}
|
||||
}
|
|
@ -16,6 +16,8 @@ public class SysApplicationPluginEntity extends BaseEntity {
|
|||
private String pluginName;
|
||||
/** 插件编号 */
|
||||
private String pluginCode;
|
||||
/** 插件包名 */
|
||||
private String pluginPackageName;
|
||||
/** 插件版本 */
|
||||
private String pluginVersion;
|
||||
/** 描述 */
|
||||
|
@ -25,6 +27,23 @@ public class SysApplicationPluginEntity extends BaseEntity {
|
|||
/** 启用停用(1启用2停用) */
|
||||
private String pluginStatus;
|
||||
|
||||
private String attachmentId;
|
||||
|
||||
public String getPluginPackageName() {
|
||||
return pluginPackageName;
|
||||
}
|
||||
|
||||
public void setPluginPackageName(String pluginPackageName) {
|
||||
this.pluginPackageName = pluginPackageName;
|
||||
}
|
||||
|
||||
public String getAttachmentId() {
|
||||
return attachmentId;
|
||||
}
|
||||
|
||||
public void setAttachmentId(String attachmentId) {
|
||||
this.attachmentId = attachmentId;
|
||||
}
|
||||
|
||||
public String getAppId() {
|
||||
return appId;
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
<result property="modify_time" column="modify_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="sts" column="sts" jdbcType="VARCHAR"/>
|
||||
<result property="org_id" column="org_id" jdbcType="VARCHAR"/>
|
||||
<result property="attachmentId" column="attachment_id" jdbcType="VARCHAR"/>
|
||||
<result property="pluginPackageName" column="plugin_package_name" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
<!-- 查询的字段-->
|
||||
<sql id = "SysApplicationPluginEntity_Base_Column_List">
|
||||
|
@ -35,7 +37,9 @@
|
|||
,modify_user_id
|
||||
,modify_time
|
||||
,sts
|
||||
,org_id
|
||||
,org_id
|
||||
,attachment_id
|
||||
,plugin_package_name
|
||||
</sql>
|
||||
<!--通过ID获取数据 -->
|
||||
<select id="entity_get" resultMap="get-SysApplicationPluginEntity-result">
|
||||
|
@ -64,6 +68,8 @@
|
|||
<if test="modify_time != null"> and modify_time = #{modify_time} </if>
|
||||
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
|
||||
<if test="org_id != null and org_id != ''"> and org_id = #{org_id} </if>
|
||||
<if test="attachmentId != null and attachmentId != ''"> and attachment_id = #{attachmentId} </if>
|
||||
<if test="pluginPackageName != null and pluginPackageName != ''"> and plugin_package_name = #{pluginPackageName} </if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
|
||||
|
@ -89,6 +95,8 @@
|
|||
<if test="modify_time != null"> and modify_time = #{modify_time} </if>
|
||||
<if test="sts != null and sts != ''"> and sts = #{sts} </if>
|
||||
<if test="org_id != null and org_id != ''"> and org_id = #{org_id} </if>
|
||||
<if test="attachmentId != null and attachmentId != ''"> and attachment_id = #{attachmentId} </if>
|
||||
<if test="pluginPackageName != null and pluginPackageName != ''"> and plugin_package_name = #{pluginPackageName} </if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
|
||||
|
@ -116,6 +124,8 @@
|
|||
<if test="modify_time != null"> and modify_time like concat('%',#{modify_time},'%') </if>
|
||||
<if test="sts != null and sts != ''"> and sts like concat('%',#{sts},'%') </if>
|
||||
<if test="org_id != null and org_id != ''"> and org_id like concat('%',#{org_id},'%') </if>
|
||||
<if test="attachmentId != null and attachmentId != ''"> and attachment_id like concat('%',#{attachmentId},'%') </if>
|
||||
<if test="pluginPackageName != null and pluginPackageName != ''"> and plugin_package_name like concat('%',#{pluginPackageName},'%') </if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
|
||||
|
@ -143,6 +153,8 @@
|
|||
<if test="modify_time != null"> or modify_time = #{modify_time} </if>
|
||||
<if test="sts != null and sts != ''"> or sts = #{sts} </if>
|
||||
<if test="org_id != null and org_id != ''"> or org_id = #{org_id} </if>
|
||||
<if test="attachmentId != null and attachmentId != ''"> or attachment_id = #{attachmentId} </if>
|
||||
<if test="pluginPackageName != null and pluginPackageName != ''"> or plugin_package_name = #{pluginPackageName} </if>
|
||||
and sts='Y'
|
||||
</trim>
|
||||
<if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
|
||||
|
@ -168,6 +180,8 @@
|
|||
<if test="modify_time != null"> modify_time , </if>
|
||||
<if test="sts != null and sts != ''"> sts , </if>
|
||||
<if test="org_id != null and org_id != ''"> org_id , </if>
|
||||
<if test="attachmentId != null and attachmentId != ''"> attachment_id , </if>
|
||||
<if test="pluginPackageName != null and pluginPackageName != ''"> plugin_package_name , </if>
|
||||
<if test="sts == null ">sts,</if>
|
||||
</trim>
|
||||
)values(
|
||||
|
@ -187,6 +201,8 @@
|
|||
<if test="modify_time != null"> #{modify_time} ,</if>
|
||||
<if test="sts != null and sts != ''"> #{sts} ,</if>
|
||||
<if test="org_id != null and org_id != ''"> #{org_id} ,</if>
|
||||
<if test="attachmentId != null and attachmentId != ''"> #{attachmentId} ,</if>
|
||||
<if test="pluginPackageName != null and pluginPackageName != ''"> #{pluginPackageName} ,</if>
|
||||
<if test="sts == null ">'Y',</if>
|
||||
</trim>
|
||||
)
|
||||
|
@ -239,6 +255,8 @@ update sys_application_plugin set
|
|||
<if test="modify_time != null"> modify_time = #{modify_time},</if>
|
||||
<if test="sts != null and sts != ''"> sts = #{sts},</if>
|
||||
<if test="org_id != null and org_id != ''"> org_id = #{org_id},</if>
|
||||
<if test="attachmentId != null and attachmentId != ''"> attachment_id = #{attachmentId},</if>
|
||||
<if test="pluginPackageName != null and pluginPackageName != ''"> plugin_package_name = #{pluginPackageName},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
|
|
@ -253,6 +253,8 @@ public interface ISysApplicationService extends IBaseService<SysApplicationEntit
|
|||
**/
|
||||
JsonResultEntity saveAppPlugin(JSONObject jsonObject);
|
||||
|
||||
JsonResultEntity deleteAppPluginPackage(JSONObject jsonObject);
|
||||
|
||||
/**
|
||||
* @Author lvleigang
|
||||
* @Description 插件修改接口
|
||||
|
|
|
@ -61,6 +61,7 @@ import org.apache.http.impl.client.CloseableHttpClient;
|
|||
import org.apache.http.impl.client.HttpClientBuilder;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.core.task.TaskExecutor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
@ -70,6 +71,9 @@ import javax.servlet.ServletResponse;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
|
@ -116,6 +120,8 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
|||
@Resource
|
||||
private com.hzya.frame.sysnew.application.service.impl.ApplicationCache applicationCache;
|
||||
|
||||
@Value("${savefile.tomcatpath:}")
|
||||
public String TOMCATPATH;
|
||||
//多线程请求加锁 HttpRequest 构造方法是静态的
|
||||
private final Object lock = new Object();
|
||||
|
||||
|
@ -1352,6 +1358,31 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
|||
return BaseResult.getSuccessMessageEntity("保存插件成功", entity.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonResultEntity deleteAppPluginPackage(JSONObject object){
|
||||
SysApplicationPluginEntity entity = getData("jsonStr", object, SysApplicationPluginEntity.class);
|
||||
if (entity == null) {
|
||||
return BaseResult.getFailureMessageEntity("参数不允许为空");
|
||||
}
|
||||
if (entity.getId() == null || "".equals(entity.getId())) {
|
||||
return BaseResult.getFailureMessageEntity("系统错误");
|
||||
}
|
||||
String pluginPackageName = entity.getPluginPackageName();
|
||||
|
||||
String classPath = TOMCATPATH + "com\\hzya\\frame\\plugin\\" + pluginPackageName;
|
||||
|
||||
String xmlPath = TOMCATPATH + "cfgHome\\plugin\\" + pluginPackageName;
|
||||
|
||||
try{
|
||||
deleteDirectory(classPath);
|
||||
deleteDirectory(xmlPath);
|
||||
System.out.println("Directory deleted successfully.");
|
||||
}catch (Exception e){
|
||||
return BaseResult.getFailureMessageEntity("删除插件包失败"+e.getMessage());
|
||||
}
|
||||
return BaseResult.getSuccessMessageEntity("删除插件包成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object
|
||||
* @return
|
||||
|
@ -2023,6 +2054,23 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
|||
return null;
|
||||
}
|
||||
|
||||
public static void deleteDirectory(String directoryPath) throws IOException {
|
||||
Path path = Paths.get(directoryPath);
|
||||
|
||||
if (Files.exists(path) && Files.isDirectory(path)) {
|
||||
Files.walk(path)
|
||||
.sorted((p1, p2) -> -1) // 从子目录到父目录排序,确保先删除子目录
|
||||
.forEach(p -> {
|
||||
try {
|
||||
Files.delete(p);
|
||||
} catch (IOException e) {
|
||||
System.err.println("Error when deleting file: " + p.toString());
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private SysApplicationApiAuthEntity getApiAuthByNameAppId(String name, String appId) {
|
||||
String str = "name" + name + "appId" + appId;
|
||||
Object o = applicationCache.get("3", str);
|
||||
|
|
|
@ -213,150 +213,151 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
|
|||
|
||||
//根据data_id判断数据是否已经保存在相关表中,避免重复保存
|
||||
List<String> fields = getFields(comparisonEntity);
|
||||
Map<String,Object> mapDataId=new HashMap<>();
|
||||
mapDataId.put("data_id",jsonObjectMain.getString("data_id"));
|
||||
ComparisonEntity comparisonDataId=new ComparisonEntity();
|
||||
Map<String, Object> mapDataId = new HashMap<>();
|
||||
mapDataId.put("data_id", jsonObjectMain.getString("data_id"));
|
||||
ComparisonEntity comparisonDataId = new ComparisonEntity();
|
||||
comparisonDataId.setMap(mapDataId);
|
||||
comparisonDataId.setDbName(comparisonEntity.getDbName());
|
||||
comparisonDataId.setFields(fields);
|
||||
List<Map<String, Object>> listDataId = comparisonDao.queryComparisonPage(comparisonDataId);
|
||||
if(CollectionUtils.isNotEmpty(listDataId)){
|
||||
return BaseResult.getFailureMessageEntity(comparisonEntity.getDbName()+"表中已经存在data_id为:"+jsonObjectMain.getString("data_id")+"的数据");
|
||||
}
|
||||
|
||||
//判断输入的主表字段是否是必填项
|
||||
for (ComparisonEntity entity : comparisonEntities) {
|
||||
//如果必填字段不为空
|
||||
if(entity.getRuleValue()!=null && entity.getDbType().equals("1")){
|
||||
if (CollectionUtils.isNotEmpty(listDataId)) {
|
||||
//return BaseResult.getFailureMessageEntity(comparisonEntity.getDbName()+"表中已经存在data_id为:"+jsonObjectMain.getString("data_id")+"的数据");
|
||||
return updateEntity(json);
|
||||
} else {
|
||||
//判断输入的主表字段是否是必填项
|
||||
for (ComparisonEntity entity : comparisonEntities) {
|
||||
//如果必填字段不为空
|
||||
if (entity.getRuleValue() != null && entity.getDbType().equals("1")) {
|
||||
//如果值为空,说明没有传这个字段或者这个字段的值为空
|
||||
if(jsonObjectMain.getString(entity.getEnName()) ==null || jsonObjectMain.getString(entity.getEnName()).equals("")){
|
||||
if (jsonObjectMain.getString(entity.getEnName()) == null || jsonObjectMain.getString(entity.getEnName()).equals("")) {
|
||||
//保存操作日志
|
||||
controlsLogDaoimpl.saveControlsLog(uuid,jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口新增",jsonObject.getString("optionName"),tableName+"_option_log","2");
|
||||
return BaseResult.getFailureMessageEntity(entity.getDbName()+"表的"+entity.getEnName()+"字段不能为空");
|
||||
controlsLogDaoimpl.saveControlsLog(uuid, jsonObject.getString("appName"), jsonObject.getString("appCode"), jsonObject.toJSONString(), "接口新增", jsonObject.getString("optionName"), tableName + "_option_log", "2");
|
||||
return BaseResult.getFailureMessageEntity(entity.getDbName() + "表的" + entity.getEnName() + "字段不能为空");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
map.put("id", uuid);
|
||||
map.put("create_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443");
|
||||
map.put("modify_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443");
|
||||
map.put("org_id", "0");
|
||||
map.put("create_time", new Date());
|
||||
map.put("modify_time", new Date());
|
||||
map.put("sts", "Y");
|
||||
map.put("data_status", "Y");//新增状态
|
||||
map.put("add_status", "0");//新增状态
|
||||
map.put("update_status", "1");//修改状态
|
||||
map.put("delete_status", "1");//删除状态
|
||||
ComparisonEntity comparisonEntityRule = comparisonEntities.get(0);
|
||||
//查询单据规则 只查询主表得,明细表不用
|
||||
try {
|
||||
ComparisonEntity comparisonEntityRules = comparisonDao.queryComparisonById(comparisonEntityRule);
|
||||
String documentRule = comparisonEntityRules.getDocumentRule();//"KH-2024-05-30-1";
|
||||
logger.info("通用数据保存接口中根据mId查询出来的单据规则为:{}", documentRule);
|
||||
if (documentRule != null) {
|
||||
//获取规则前缀 CK
|
||||
String rulePrefix = documentRule.substring(0, documentRule.indexOf("-"));
|
||||
//获取规则中间日期 yyyy-MM-dd
|
||||
String ruleDate = documentRule.substring(documentRule.indexOf("-") + 1, documentRule.lastIndexOf("-"));
|
||||
String ruleMiddle = getRuleDate(ruleDate);
|
||||
//获取规则后缀
|
||||
String ruleSuffixLength = documentRule.substring(documentRule.lastIndexOf("-") + 1);
|
||||
int ruleSuffix = ruleSuffixLength.length();
|
||||
//生成单据规则
|
||||
comparisonEntityRule.setRulePrefix(rulePrefix);
|
||||
comparisonEntityRule.setRuleMiddle(ruleMiddle);
|
||||
comparisonEntityRule.setRuleSuffix(ruleSuffix);
|
||||
try {
|
||||
//新生成单据规则保存到数据库
|
||||
ComparisonEntity comparisonEntityRuleGz = comparisonDao.queryComparisonRule(comparisonEntityRule);
|
||||
map.put("document_rule", comparisonEntityRuleGz.getDocumentRule());//单据规则
|
||||
map.put("document_rule_num", comparisonEntityRuleGz.getDocumentRuleNum());//单据规则流水号
|
||||
comparisonEntityRule.setMap(map);
|
||||
} catch (Exception e) {
|
||||
logger.info("保存通用数据时候生成单据规则错误:{}", e.getMessage());
|
||||
//保存操作日志
|
||||
controlsLogDaoimpl.saveControlsLog(uuid,jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口新增",jsonObject.getString("optionName"),tableName+"_option_log","2");
|
||||
|
||||
return BaseResult.getFailureMessageEntity("保存失败");
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.info("通用数据保存接口中查询单据规则错误:{}", e.getMessage());
|
||||
//保存操作日志
|
||||
controlsLogDaoimpl.saveControlsLog(uuid,jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口新增",jsonObject.getString("optionName"),tableName+"_option_log","2");
|
||||
|
||||
return BaseResult.getFailureMessageEntity("保存失败");
|
||||
}
|
||||
try {
|
||||
List<JSONObject> list = new ArrayList<>();
|
||||
JSONObject jsonObjectList = new JSONObject();
|
||||
map.put("id", uuid);
|
||||
map.put("create_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443");
|
||||
map.put("modify_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443");
|
||||
map.put("org_id", "0");
|
||||
map.put("create_time", new Date());
|
||||
map.put("modify_time", new Date());
|
||||
map.put("sts", "Y");
|
||||
map.put("data_status", "Y");//新增状态
|
||||
map.put("add_status", "0");//新增状态
|
||||
map.put("update_status", "1");//修改状态
|
||||
map.put("delete_status", "1");//删除状态
|
||||
ComparisonEntity comparisonEntityRule = comparisonEntities.get(0);
|
||||
//查询单据规则 只查询主表得,明细表不用
|
||||
try {
|
||||
ComparisonEntity comparisonEntityRules = comparisonDao.queryComparisonById(comparisonEntityRule);
|
||||
String documentRule = comparisonEntityRules.getDocumentRule();//"KH-2024-05-30-1";
|
||||
logger.info("通用数据保存接口中根据mId查询出来的单据规则为:{}", documentRule);
|
||||
if (documentRule != null) {
|
||||
//获取规则前缀 CK
|
||||
String rulePrefix = documentRule.substring(0, documentRule.indexOf("-"));
|
||||
//获取规则中间日期 yyyy-MM-dd
|
||||
String ruleDate = documentRule.substring(documentRule.indexOf("-") + 1, documentRule.lastIndexOf("-"));
|
||||
String ruleMiddle = getRuleDate(ruleDate);
|
||||
//获取规则后缀
|
||||
String ruleSuffixLength = documentRule.substring(documentRule.lastIndexOf("-") + 1);
|
||||
int ruleSuffix = ruleSuffixLength.length();
|
||||
//生成单据规则
|
||||
comparisonEntityRule.setRulePrefix(rulePrefix);
|
||||
comparisonEntityRule.setRuleMiddle(ruleMiddle);
|
||||
comparisonEntityRule.setRuleSuffix(ruleSuffix);
|
||||
try {
|
||||
//新生成单据规则保存到数据库
|
||||
ComparisonEntity comparisonEntityRuleGz = comparisonDao.queryComparisonRule(comparisonEntityRule);
|
||||
map.put("document_rule", comparisonEntityRuleGz.getDocumentRule());//单据规则
|
||||
map.put("document_rule_num", comparisonEntityRuleGz.getDocumentRuleNum());//单据规则流水号
|
||||
comparisonEntityRule.setMap(map);
|
||||
} catch (Exception e) {
|
||||
logger.info("保存通用数据时候生成单据规则错误:{}", e.getMessage());
|
||||
//保存操作日志
|
||||
controlsLogDaoimpl.saveControlsLog(uuid, jsonObject.getString("appName"), jsonObject.getString("appCode"), jsonObject.toJSONString(), "接口新增", jsonObject.getString("optionName"), tableName + "_option_log", "2");
|
||||
|
||||
//判断明细表字段是否是必填项
|
||||
if (arrayList != null && arrayList.size() > 0) {
|
||||
for (JSONArray jsonArrayDetails : arrayList) {
|
||||
for (Object object : jsonArrayDetails) {
|
||||
JSONObject jsonObjectDetails = (JSONObject) JSON.toJSON(object);
|
||||
for (ComparisonEntity entity : comparisonEntities) {
|
||||
if(entity.getRuleValue()!=null && entity.getDbType().equals("2")){
|
||||
//如果值为空,说明没有传这个字段或者这个字段的值为空
|
||||
if(jsonObjectDetails.getString(entity.getEnName())==null || jsonObjectDetails.getString(entity.getEnName()).equals("")){
|
||||
//保存操作日志
|
||||
controlsLogDaoimpl.saveControlsLog(uuid,jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口新增",jsonObject.getString("optionName"),tableName+"_option_log","2");
|
||||
return BaseResult.getFailureMessageEntity(entity.getDbName()+"表的"+entity.getEnName()+"字段不能为空");
|
||||
return BaseResult.getFailureMessageEntity("保存失败");
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.info("通用数据保存接口中查询单据规则错误:{}", e.getMessage());
|
||||
//保存操作日志
|
||||
controlsLogDaoimpl.saveControlsLog(uuid, jsonObject.getString("appName"), jsonObject.getString("appCode"), jsonObject.toJSONString(), "接口新增", jsonObject.getString("optionName"), tableName + "_option_log", "2");
|
||||
|
||||
return BaseResult.getFailureMessageEntity("保存失败");
|
||||
}
|
||||
try {
|
||||
List<JSONObject> list = new ArrayList<>();
|
||||
JSONObject jsonObjectList = new JSONObject();
|
||||
|
||||
//判断明细表字段是否是必填项
|
||||
if (arrayList != null && arrayList.size() > 0) {
|
||||
for (JSONArray jsonArrayDetails : arrayList) {
|
||||
for (Object object : jsonArrayDetails) {
|
||||
JSONObject jsonObjectDetails = (JSONObject) JSON.toJSON(object);
|
||||
for (ComparisonEntity entity : comparisonEntities) {
|
||||
if (entity.getRuleValue() != null && entity.getDbType().equals("2")) {
|
||||
//如果值为空,说明没有传这个字段或者这个字段的值为空
|
||||
if (jsonObjectDetails.getString(entity.getEnName()) == null || jsonObjectDetails.getString(entity.getEnName()).equals("")) {
|
||||
//保存操作日志
|
||||
controlsLogDaoimpl.saveControlsLog(uuid, jsonObject.getString("appName"), jsonObject.getString("appCode"), jsonObject.toJSONString(), "接口新增", jsonObject.getString("optionName"), tableName + "_option_log", "2");
|
||||
return BaseResult.getFailureMessageEntity(entity.getDbName() + "表的" + entity.getEnName() + "字段不能为空");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//保存主表数据
|
||||
ComparisonEntity comparisonEntityOne = comparisonDao.saveComparison(comparisonEntityRule);
|
||||
jsonObjectList.put(comparisonEntityOne.getDbName(),map);
|
||||
//保存子表数据
|
||||
if (arrayList != null && arrayList.size() > 0) {
|
||||
mapDetails = spliceDetailMap(comparisonEntities, mapDetails, arrayList);
|
||||
if(mapDetails.size()>0 && mapDetails!=null ){
|
||||
for (List<Map<String, Object>> mapDetail : mapDetails) {
|
||||
for (Map<String, Object> stringObjectMap : mapDetail) {
|
||||
stringObjectMap.put("id", UUIDLong.longUUID());
|
||||
stringObjectMap.put("formmain_id", uuid);
|
||||
stringObjectMap.put("create_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443");
|
||||
stringObjectMap.put("modify_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443");
|
||||
stringObjectMap.put("org_id", "0");
|
||||
stringObjectMap.put("create_time", new Date());
|
||||
stringObjectMap.put("modify_time", new Date());
|
||||
stringObjectMap.put("sts", "Y");
|
||||
stringObjectMap.put("data_status", "Y");//新增状态
|
||||
comparisonDetailsEntity.setMapDetails(stringObjectMap);
|
||||
comparisonDetailsEntity.setDbName(String.valueOf(stringObjectMap.get("table_name")));
|
||||
stringObjectMap.remove("table_name");
|
||||
ComparisonDetailsEntity comparisonDetailsEntityOne = comparisonDetailsDao.saveComparisonDetails(comparisonDetailsEntity);
|
||||
comparisonEntityOne.setComparisonDetailsEntity(comparisonDetailsEntityOne);
|
||||
//保存操作日志
|
||||
//controlsLogDaoimpl.saveControlsLog(uuidDetail,jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口新增",jsonObject.getString("optionName"),comparisonDetailsEntity.getDbName()+"_option_log");
|
||||
//保存主表数据
|
||||
ComparisonEntity comparisonEntityOne = comparisonDao.saveComparison(comparisonEntityRule);
|
||||
jsonObjectList.put(comparisonEntityOne.getDbName(), map);
|
||||
//保存子表数据
|
||||
if (arrayList != null && arrayList.size() > 0) {
|
||||
mapDetails = spliceDetailMap(comparisonEntities, mapDetails, arrayList);
|
||||
if (mapDetails.size() > 0 && mapDetails != null) {
|
||||
for (List<Map<String, Object>> mapDetail : mapDetails) {
|
||||
for (Map<String, Object> stringObjectMap : mapDetail) {
|
||||
stringObjectMap.put("id", UUIDLong.longUUID());
|
||||
stringObjectMap.put("formmain_id", uuid);
|
||||
stringObjectMap.put("create_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443");
|
||||
stringObjectMap.put("modify_user_id", "c796fd9ba4c9f5ff3cc2fa41a040e443");
|
||||
stringObjectMap.put("org_id", "0");
|
||||
stringObjectMap.put("create_time", new Date());
|
||||
stringObjectMap.put("modify_time", new Date());
|
||||
stringObjectMap.put("sts", "Y");
|
||||
stringObjectMap.put("data_status", "Y");//新增状态
|
||||
comparisonDetailsEntity.setMapDetails(stringObjectMap);
|
||||
comparisonDetailsEntity.setDbName(String.valueOf(stringObjectMap.get("table_name")));
|
||||
stringObjectMap.remove("table_name");
|
||||
ComparisonDetailsEntity comparisonDetailsEntityOne = comparisonDetailsDao.saveComparisonDetails(comparisonDetailsEntity);
|
||||
comparisonEntityOne.setComparisonDetailsEntity(comparisonDetailsEntityOne);
|
||||
//保存操作日志
|
||||
//controlsLogDaoimpl.saveControlsLog(uuidDetail,jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口新增",jsonObject.getString("optionName"),comparisonDetailsEntity.getDbName()+"_option_log");
|
||||
}
|
||||
}
|
||||
jsonObjectList.put(comparisonDetailsEntity.getDbName(), mapDetails);
|
||||
}
|
||||
jsonObjectList.put(comparisonDetailsEntity.getDbName(), mapDetails);
|
||||
} else {
|
||||
jsonObjectList.put(comparisonDetailsEntity.getDbName(), new ArrayList<>());
|
||||
}
|
||||
} else {
|
||||
jsonObjectList.put(comparisonDetailsEntity.getDbName(), new ArrayList<>());
|
||||
}
|
||||
jsonObjectList.remove(null);
|
||||
list.add(jsonObjectList);
|
||||
//保存操作日志
|
||||
controlsLogDaoimpl.saveControlsLog(uuid,jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口新增",jsonObject.getString("optionName"),tableName+"_option_log","1");
|
||||
JSONObject json1 = new JSONObject();
|
||||
json1.put("status","200");
|
||||
json1.put("list",list);
|
||||
return json1;
|
||||
} catch (Exception e) {
|
||||
logger.info("保存通用数据时候错误:{}", e.getMessage());
|
||||
//保存操作日志
|
||||
controlsLogDaoimpl.saveControlsLog(uuid,jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口新增",jsonObject.getString("optionName"),tableName+"_option_log","2");
|
||||
jsonObjectList.remove(null);
|
||||
list.add(jsonObjectList);
|
||||
//保存操作日志
|
||||
controlsLogDaoimpl.saveControlsLog(uuid, jsonObject.getString("appName"), jsonObject.getString("appCode"), jsonObject.toJSONString(), "接口新增", jsonObject.getString("optionName"), tableName + "_option_log", "1");
|
||||
JSONObject json1 = new JSONObject();
|
||||
json1.put("status", "200");
|
||||
json1.put("list", list);
|
||||
return json1;
|
||||
} catch (Exception e) {
|
||||
logger.info("保存通用数据时候错误:{}", e.getMessage());
|
||||
//保存操作日志
|
||||
controlsLogDaoimpl.saveControlsLog(uuid, jsonObject.getString("appName"), jsonObject.getString("appCode"), jsonObject.toJSONString(), "接口新增", jsonObject.getString("optionName"), tableName + "_option_log", "2");
|
||||
|
||||
return BaseResult.getFailureMessageEntity("保存失败");
|
||||
return BaseResult.getFailureMessageEntity("保存失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,239 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.hzya.frame.excel.templateConfigDetial.dao.ExcelTemplateConfigDetailDao">
|
||||
|
||||
<resultMap type="com.hzya.frame.excel.templateConfigDetial.entity.ExcelTemplateConfigDetail" id="ExcelTemplateConfigDetailMap">
|
||||
<result property="fieldName" column="field_name" jdbcType="VARCHAR"/>
|
||||
<result property="fieldCode" column="field_code" jdbcType="VARCHAR"/>
|
||||
<result property="fieldType" column="field_type" jdbcType="VARCHAR"/>
|
||||
<result property="dictionaryDetailId" column="dictionary_detail_id" jdbcType="VARCHAR"/>
|
||||
<result property="showName" column="show_name" jdbcType="VARCHAR"/>
|
||||
<result property="sort" column="sort" jdbcType="INTEGER"/>
|
||||
<result property="switch" column="switch" jdbcType="VARCHAR"/>
|
||||
<result property="sorts" column="sorts" jdbcType="INTEGER"/>
|
||||
<result property="id" column="id" jdbcType="VARCHAR"/>
|
||||
<result property="createUserId" column="create_user_id" jdbcType="VARCHAR"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="modifyTime" column="modify_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="modifyUserId" column="modify_user_id" jdbcType="VARCHAR"/>
|
||||
<result property="orgId" column="org_id" jdbcType="VARCHAR"/>
|
||||
<result property="companyId" column="company_id" jdbcType="VARCHAR"/>
|
||||
<result property="sts" column="sts" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
<!--查询单个-->
|
||||
<select id="queryById" resultMap="ExcelTemplateConfigDetailMap">
|
||||
select
|
||||
field_name, field_code, field_type, dictionary_detail_id, show_name, sort, switch, sorts, id, create_user_id, create_time, modify_time, modify_user_id, org_id, company_id, sts
|
||||
from excel_template_config_detail
|
||||
where sorts = #{sorts}
|
||||
</select>
|
||||
|
||||
<!--查询指定行数据-->
|
||||
<select id="queryAllByLimit" resultMap="ExcelTemplateConfigDetailMap">
|
||||
select
|
||||
field_name, field_code, field_type, dictionary_detail_id, show_name, sort, switch, sorts, id, create_user_id, create_time, modify_time, modify_user_id, org_id, company_id, sts
|
||||
from excel_template_config_detail
|
||||
<where>
|
||||
<if test="fieldName != null and fieldName != ''">
|
||||
and field_name = #{fieldName}
|
||||
</if>
|
||||
<if test="fieldCode != null and fieldCode != ''">
|
||||
and field_code = #{fieldCode}
|
||||
</if>
|
||||
<if test="fieldType != null and fieldType != ''">
|
||||
and field_type = #{fieldType}
|
||||
</if>
|
||||
<if test="dictionaryDetailId != null and dictionaryDetailId != ''">
|
||||
and dictionary_detail_id = #{dictionaryDetailId}
|
||||
</if>
|
||||
<if test="showName != null and showName != ''">
|
||||
and show_name = #{showName}
|
||||
</if>
|
||||
<if test="sort != null">
|
||||
and sort = #{sort}
|
||||
</if>
|
||||
<if test="switch != null and switch != ''">
|
||||
and switch = #{switch}
|
||||
</if>
|
||||
<if test="sorts != null">
|
||||
and sorts = #{sorts}
|
||||
</if>
|
||||
<if test="id != null and id != ''">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="createUserId != null and createUserId != ''">
|
||||
and create_user_id = #{createUserId}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
and create_time = #{createTime}
|
||||
</if>
|
||||
<if test="modifyTime != null">
|
||||
and modify_time = #{modifyTime}
|
||||
</if>
|
||||
<if test="modifyUserId != null and modifyUserId != ''">
|
||||
and modify_user_id = #{modifyUserId}
|
||||
</if>
|
||||
<if test="orgId != null and orgId != ''">
|
||||
and org_id = #{orgId}
|
||||
</if>
|
||||
<if test="companyId != null and companyId != ''">
|
||||
and company_id = #{companyId}
|
||||
</if>
|
||||
<if test="sts != null and sts != ''">
|
||||
and sts = #{sts}
|
||||
</if>
|
||||
</where>
|
||||
limit #{pageable.offset}, #{pageable.pageSize}
|
||||
</select>
|
||||
|
||||
<!--统计总行数-->
|
||||
<select id="count" resultType="java.lang.Long">
|
||||
select count(1)
|
||||
from excel_template_config_detail
|
||||
<where>
|
||||
<if test="fieldName != null and fieldName != ''">
|
||||
and field_name = #{fieldName}
|
||||
</if>
|
||||
<if test="fieldCode != null and fieldCode != ''">
|
||||
and field_code = #{fieldCode}
|
||||
</if>
|
||||
<if test="fieldType != null and fieldType != ''">
|
||||
and field_type = #{fieldType}
|
||||
</if>
|
||||
<if test="dictionaryDetailId != null and dictionaryDetailId != ''">
|
||||
and dictionary_detail_id = #{dictionaryDetailId}
|
||||
</if>
|
||||
<if test="showName != null and showName != ''">
|
||||
and show_name = #{showName}
|
||||
</if>
|
||||
<if test="sort != null">
|
||||
and sort = #{sort}
|
||||
</if>
|
||||
<if test="switch != null and switch != ''">
|
||||
and switch = #{switch}
|
||||
</if>
|
||||
<if test="sorts != null">
|
||||
and sorts = #{sorts}
|
||||
</if>
|
||||
<if test="id != null and id != ''">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="createUserId != null and createUserId != ''">
|
||||
and create_user_id = #{createUserId}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
and create_time = #{createTime}
|
||||
</if>
|
||||
<if test="modifyTime != null">
|
||||
and modify_time = #{modifyTime}
|
||||
</if>
|
||||
<if test="modifyUserId != null and modifyUserId != ''">
|
||||
and modify_user_id = #{modifyUserId}
|
||||
</if>
|
||||
<if test="orgId != null and orgId != ''">
|
||||
and org_id = #{orgId}
|
||||
</if>
|
||||
<if test="companyId != null and companyId != ''">
|
||||
and company_id = #{companyId}
|
||||
</if>
|
||||
<if test="sts != null and sts != ''">
|
||||
and sts = #{sts}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="insert" keyProperty="sorts" useGeneratedKeys="true">
|
||||
insert into excel_template_config_detail(field_name, field_code, field_type, dictionary_detail_id, show_name, sort, switch, create_user_id, create_time, modify_time, modify_user_id, org_id, company_id, sts)
|
||||
values (#{fieldName}, #{fieldCode}, #{fieldType}, #{dictionaryDetailId}, #{showName}, #{sort}, #{switch}, #{createUserId}, #{createTime}, #{modifyTime}, #{modifyUserId}, #{orgId}, #{companyId}, #{sts})
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" keyProperty="sorts" useGeneratedKeys="true">
|
||||
insert into excel_template_config_detail(field_name, field_code, field_type, dictionary_detail_id, show_name, sort, switch, create_user_id, create_time, modify_time, modify_user_id, org_id, company_id, sts)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.fieldName}, #{entity.fieldCode}, #{entity.fieldType}, #{entity.dictionaryDetailId}, #{entity.showName}, #{entity.sort}, #{entity.switch}, #{entity.createUserId}, #{entity.createTime}, #{entity.modifyTime}, #{entity.modifyUserId}, #{entity.orgId}, #{entity.companyId}, #{entity.sts})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="insertOrUpdateBatch" keyProperty="sorts" useGeneratedKeys="true">
|
||||
insert into excel_template_config_detail(field_name, field_code, field_type, dictionary_detail_id, show_name, sort, switch, create_user_id, create_time, modify_time, modify_user_id, org_id, company_id, sts)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.fieldName}, #{entity.fieldCode}, #{entity.fieldType}, #{entity.dictionaryDetailId}, #{entity.showName}, #{entity.sort}, #{entity.switch}, #{entity.createUserId}, #{entity.createTime}, #{entity.modifyTime}, #{entity.modifyUserId}, #{entity.orgId}, #{entity.companyId}, #{entity.sts})
|
||||
</foreach>
|
||||
on duplicate key update
|
||||
field_name = values(field_name),
|
||||
field_code = values(field_code),
|
||||
field_type = values(field_type),
|
||||
dictionary_detail_id = values(dictionary_detail_id),
|
||||
show_name = values(show_name),
|
||||
sort = values(sort),
|
||||
switch = values(switch),
|
||||
create_user_id = values(create_user_id),
|
||||
create_time = values(create_time),
|
||||
modify_time = values(modify_time),
|
||||
modify_user_id = values(modify_user_id),
|
||||
org_id = values(org_id),
|
||||
company_id = values(company_id),
|
||||
sts = values(sts)
|
||||
</insert>
|
||||
|
||||
<!--通过主键修改数据-->
|
||||
<update id="update">
|
||||
update excel_template_config_detail
|
||||
<set>
|
||||
<if test="fieldName != null and fieldName != ''">
|
||||
field_name = #{fieldName},
|
||||
</if>
|
||||
<if test="fieldCode != null and fieldCode != ''">
|
||||
field_code = #{fieldCode},
|
||||
</if>
|
||||
<if test="fieldType != null and fieldType != ''">
|
||||
field_type = #{fieldType},
|
||||
</if>
|
||||
<if test="dictionaryDetailId != null and dictionaryDetailId != ''">
|
||||
dictionary_detail_id = #{dictionaryDetailId},
|
||||
</if>
|
||||
<if test="showName != null and showName != ''">
|
||||
show_name = #{showName},
|
||||
</if>
|
||||
<if test="sort != null">
|
||||
sort = #{sort},
|
||||
</if>
|
||||
<if test="switch != null and switch != ''">
|
||||
switch = #{switch},
|
||||
</if>
|
||||
<if test="createUserId != null and createUserId != ''">
|
||||
create_user_id = #{createUserId},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime},
|
||||
</if>
|
||||
<if test="modifyTime != null">
|
||||
modify_time = #{modifyTime},
|
||||
</if>
|
||||
<if test="modifyUserId != null and modifyUserId != ''">
|
||||
modify_user_id = #{modifyUserId},
|
||||
</if>
|
||||
<if test="orgId != null and orgId != ''">
|
||||
org_id = #{orgId},
|
||||
</if>
|
||||
<if test="companyId != null and companyId != ''">
|
||||
company_id = #{companyId},
|
||||
</if>
|
||||
<if test="sts != null and sts != ''">
|
||||
sts = #{sts},
|
||||
</if>
|
||||
</set>
|
||||
where sorts = #{sorts}
|
||||
</update>
|
||||
|
||||
<!--通过主键删除-->
|
||||
<delete id="deleteById">
|
||||
delete from excel_template_config_detail where sorts = #{sorts}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,217 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.hzya.frame.sysnew.application.dictionaryDetail.dao.SysApplicationDictionaryDetailDao">
|
||||
|
||||
<resultMap type="com.hzya.frame.sysnew.application.dictionaryDetail.entity.SysApplicationDictionaryDetail" id="SysApplicationDictionaryDetailMap">
|
||||
<result property="appId" column="app_id" jdbcType="VARCHAR"/>
|
||||
<result property="dictionaryId" column="dictionary_id" jdbcType="VARCHAR"/>
|
||||
<result property="fieldName" column="field_name" jdbcType="VARCHAR"/>
|
||||
<result property="fieldCode" column="field_code" jdbcType="VARCHAR"/>
|
||||
<result property="fieldType" column="field_type" jdbcType="VARCHAR"/>
|
||||
<result property="sorts" column="sorts" jdbcType="INTEGER"/>
|
||||
<result property="id" column="id" jdbcType="VARCHAR"/>
|
||||
<result property="createUserId" column="create_user_id" jdbcType="VARCHAR"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="modifyTime" column="modify_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="modifyUserId" column="modify_user_id" jdbcType="VARCHAR"/>
|
||||
<result property="orgId" column="org_id" jdbcType="VARCHAR"/>
|
||||
<result property="companyId" column="company_id" jdbcType="VARCHAR"/>
|
||||
<result property="sts" column="sts" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
<!--查询单个-->
|
||||
<select id="queryById" resultMap="SysApplicationDictionaryDetailMap">
|
||||
select
|
||||
app_id, dictionary_id, field_name, field_code, field_type, sorts, id, create_user_id, create_time, modify_time, modify_user_id, org_id, company_id, sts
|
||||
from sys_application_dictionary_detail
|
||||
where sorts = #{sorts}
|
||||
</select>
|
||||
|
||||
<!--查询指定行数据-->
|
||||
<select id="queryAllByLimit" resultMap="SysApplicationDictionaryDetailMap">
|
||||
select
|
||||
app_id, dictionary_id, field_name, field_code, field_type, sorts, id, create_user_id, create_time, modify_time, modify_user_id, org_id, company_id, sts
|
||||
from sys_application_dictionary_detail
|
||||
<where>
|
||||
<if test="appId != null and appId != ''">
|
||||
and app_id = #{appId}
|
||||
</if>
|
||||
<if test="dictionaryId != null and dictionaryId != ''">
|
||||
and dictionary_id = #{dictionaryId}
|
||||
</if>
|
||||
<if test="fieldName != null and fieldName != ''">
|
||||
and field_name = #{fieldName}
|
||||
</if>
|
||||
<if test="fieldCode != null and fieldCode != ''">
|
||||
and field_code = #{fieldCode}
|
||||
</if>
|
||||
<if test="fieldType != null and fieldType != ''">
|
||||
and field_type = #{fieldType}
|
||||
</if>
|
||||
<if test="sorts != null">
|
||||
and sorts = #{sorts}
|
||||
</if>
|
||||
<if test="id != null and id != ''">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="createUserId != null and createUserId != ''">
|
||||
and create_user_id = #{createUserId}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
and create_time = #{createTime}
|
||||
</if>
|
||||
<if test="modifyTime != null">
|
||||
and modify_time = #{modifyTime}
|
||||
</if>
|
||||
<if test="modifyUserId != null and modifyUserId != ''">
|
||||
and modify_user_id = #{modifyUserId}
|
||||
</if>
|
||||
<if test="orgId != null and orgId != ''">
|
||||
and org_id = #{orgId}
|
||||
</if>
|
||||
<if test="companyId != null and companyId != ''">
|
||||
and company_id = #{companyId}
|
||||
</if>
|
||||
<if test="sts != null and sts != ''">
|
||||
and sts = #{sts}
|
||||
</if>
|
||||
</where>
|
||||
limit #{pageable.offset}, #{pageable.pageSize}
|
||||
</select>
|
||||
|
||||
<!--统计总行数-->
|
||||
<select id="count" resultType="java.lang.Long">
|
||||
select count(1)
|
||||
from sys_application_dictionary_detail
|
||||
<where>
|
||||
<if test="appId != null and appId != ''">
|
||||
and app_id = #{appId}
|
||||
</if>
|
||||
<if test="dictionaryId != null and dictionaryId != ''">
|
||||
and dictionary_id = #{dictionaryId}
|
||||
</if>
|
||||
<if test="fieldName != null and fieldName != ''">
|
||||
and field_name = #{fieldName}
|
||||
</if>
|
||||
<if test="fieldCode != null and fieldCode != ''">
|
||||
and field_code = #{fieldCode}
|
||||
</if>
|
||||
<if test="fieldType != null and fieldType != ''">
|
||||
and field_type = #{fieldType}
|
||||
</if>
|
||||
<if test="sorts != null">
|
||||
and sorts = #{sorts}
|
||||
</if>
|
||||
<if test="id != null and id != ''">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="createUserId != null and createUserId != ''">
|
||||
and create_user_id = #{createUserId}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
and create_time = #{createTime}
|
||||
</if>
|
||||
<if test="modifyTime != null">
|
||||
and modify_time = #{modifyTime}
|
||||
</if>
|
||||
<if test="modifyUserId != null and modifyUserId != ''">
|
||||
and modify_user_id = #{modifyUserId}
|
||||
</if>
|
||||
<if test="orgId != null and orgId != ''">
|
||||
and org_id = #{orgId}
|
||||
</if>
|
||||
<if test="companyId != null and companyId != ''">
|
||||
and company_id = #{companyId}
|
||||
</if>
|
||||
<if test="sts != null and sts != ''">
|
||||
and sts = #{sts}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="insert" keyProperty="sorts" useGeneratedKeys="true">
|
||||
insert into sys_application_dictionary_detail(app_id, dictionary_id, field_name, field_code, field_type, create_user_id, create_time, modify_time, modify_user_id, org_id, company_id, sts)
|
||||
values (#{appId}, #{dictionaryId}, #{fieldName}, #{fieldCode}, #{fieldType}, #{createUserId}, #{createTime}, #{modifyTime}, #{modifyUserId}, #{orgId}, #{companyId}, #{sts})
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" keyProperty="sorts" useGeneratedKeys="true">
|
||||
insert into sys_application_dictionary_detail(app_id, dictionary_id, field_name, field_code, field_type, create_user_id, create_time, modify_time, modify_user_id, org_id, company_id, sts)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.appId}, #{entity.dictionaryId}, #{entity.fieldName}, #{entity.fieldCode}, #{entity.fieldType}, #{entity.createUserId}, #{entity.createTime}, #{entity.modifyTime}, #{entity.modifyUserId}, #{entity.orgId}, #{entity.companyId}, #{entity.sts})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="insertOrUpdateBatch" keyProperty="sorts" useGeneratedKeys="true">
|
||||
insert into sys_application_dictionary_detail(app_id, dictionary_id, field_name, field_code, field_type, create_user_id, create_time, modify_time, modify_user_id, org_id, company_id, sts)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.appId}, #{entity.dictionaryId}, #{entity.fieldName}, #{entity.fieldCode}, #{entity.fieldType}, #{entity.createUserId}, #{entity.createTime}, #{entity.modifyTime}, #{entity.modifyUserId}, #{entity.orgId}, #{entity.companyId}, #{entity.sts})
|
||||
</foreach>
|
||||
on duplicate key update
|
||||
app_id = values(app_id),
|
||||
dictionary_id = values(dictionary_id),
|
||||
field_name = values(field_name),
|
||||
field_code = values(field_code),
|
||||
field_type = values(field_type),
|
||||
create_user_id = values(create_user_id),
|
||||
create_time = values(create_time),
|
||||
modify_time = values(modify_time),
|
||||
modify_user_id = values(modify_user_id),
|
||||
org_id = values(org_id),
|
||||
company_id = values(company_id),
|
||||
sts = values(sts)
|
||||
</insert>
|
||||
|
||||
<!--通过主键修改数据-->
|
||||
<update id="update">
|
||||
update sys_application_dictionary_detail
|
||||
<set>
|
||||
<if test="appId != null and appId != ''">
|
||||
app_id = #{appId},
|
||||
</if>
|
||||
<if test="dictionaryId != null and dictionaryId != ''">
|
||||
dictionary_id = #{dictionaryId},
|
||||
</if>
|
||||
<if test="fieldName != null and fieldName != ''">
|
||||
field_name = #{fieldName},
|
||||
</if>
|
||||
<if test="fieldCode != null and fieldCode != ''">
|
||||
field_code = #{fieldCode},
|
||||
</if>
|
||||
<if test="fieldType != null and fieldType != ''">
|
||||
field_type = #{fieldType},
|
||||
</if>
|
||||
<if test="createUserId != null and createUserId != ''">
|
||||
create_user_id = #{createUserId},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime},
|
||||
</if>
|
||||
<if test="modifyTime != null">
|
||||
modify_time = #{modifyTime},
|
||||
</if>
|
||||
<if test="modifyUserId != null and modifyUserId != ''">
|
||||
modify_user_id = #{modifyUserId},
|
||||
</if>
|
||||
<if test="orgId != null and orgId != ''">
|
||||
org_id = #{orgId},
|
||||
</if>
|
||||
<if test="companyId != null and companyId != ''">
|
||||
company_id = #{companyId},
|
||||
</if>
|
||||
<if test="sts != null and sts != ''">
|
||||
sts = #{sts},
|
||||
</if>
|
||||
</set>
|
||||
where sorts = #{sorts}
|
||||
</update>
|
||||
|
||||
<!--通过主键删除-->
|
||||
<delete id="deleteById">
|
||||
delete from sys_application_dictionary_detail where sorts = #{sorts}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -32,6 +32,9 @@ public interface IEntranceService {
|
|||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||
**/
|
||||
JsonResultEntity fileUpload(MultipartFile file, FileUploadDto entity, ServletRequest servletRequest, ServletResponse servletResponse) throws Exception;
|
||||
|
||||
JsonResultEntity pluginfileUpload(MultipartFile file, FileUploadDto entity,String pluginPackageName, ServletRequest servletRequest, ServletResponse servletResponse) throws Exception;
|
||||
JsonResultEntity pluginZipUpate(FileUploadDto fileUploadDto) throws Exception;
|
||||
/***
|
||||
* 系统框架附件上传接口
|
||||
* @content:
|
||||
|
|
|
@ -6,6 +6,8 @@ import cn.hutool.extra.servlet.ServletUtil;
|
|||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||
import com.hzya.frame.sys.entity.EsbReturnEntity;
|
||||
import com.hzya.frame.sys.file.download.entity.FileDownloadEntity;
|
||||
import com.hzya.frame.sys.file.download.service.IFileDownloadService;
|
||||
import com.hzya.frame.sys.file.upload.entity.FileResultEntity;
|
||||
import com.hzya.frame.sys.file.upload.entity.FileUploadDto;
|
||||
import com.hzya.frame.sys.file.upload.entity.FileUploadEntity;
|
||||
|
@ -54,6 +56,9 @@ public class EntranceServiceImpl implements IEntranceService {
|
|||
@Autowired
|
||||
private IFileUploadService fileUploadService;
|
||||
|
||||
@Autowired
|
||||
private IFileDownloadService fileDownloadService;
|
||||
|
||||
@Override
|
||||
@DSTransactional()
|
||||
public JsonResultEntity doBusiness(ServletRequest servletRequest, ServletResponse servletResponse) throws Exception {
|
||||
|
@ -225,6 +230,19 @@ public class EntranceServiceImpl implements IEntranceService {
|
|||
FileUploadEntity fileUploadEntity = fileUploadService.fileUpload(file,entity);
|
||||
return BaseResult.getSuccessMessageEntity("附件上传成功",fileUploadEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonResultEntity pluginfileUpload(MultipartFile file, FileUploadDto entity,String pluginPackageName, ServletRequest servletRequest, ServletResponse servletResponse) throws Exception {
|
||||
StpUtil.checkLogin();
|
||||
FileUploadEntity fileUploadEntity = fileUploadService.pluginfileUpload(file,entity,pluginPackageName);
|
||||
return BaseResult.getSuccessMessageEntity("附件上传成功",fileUploadEntity);
|
||||
}
|
||||
|
||||
public JsonResultEntity pluginZipUpate(FileUploadDto fileUploadDto) throws Exception{
|
||||
StpUtil.checkLogin();
|
||||
FileDownloadEntity fileDownloadEntity = fileDownloadService.pluginZipUpate(fileUploadDto);
|
||||
return BaseResult.getSuccessMessageEntity("插件更新成功",fileDownloadEntity);
|
||||
}
|
||||
@Override
|
||||
public JsonResultEntity fileUpload(MultipartFile file, FileResultEntity entity, ServletRequest servletRequest, ServletResponse servletResponse) throws Exception {
|
||||
entity = fileUploadService.fileUpload(file,entity);
|
||||
|
|
Loading…
Reference in New Issue