Commit 25d39c81 authored by 赵啸非's avatar 赵啸非

添加自主终端应用实现

parent 1440d361
This diff is collapsed.
package com.mortals.xhx.module.app.model;
import java.util.List;
import java.util.List;
import java.util.ArrayList;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.app.model.vo.AppDatasetVo;
import com.mortals.xhx.module.app.model.AppInfoFieldEntity;
import java.util.ArrayList;
import java.util.List;
/**
* 自助终端应用数据集实体对象
*
......
......@@ -36,34 +36,60 @@ public class AppDatasetServiceImpl extends AbstractCRUDServiceImpl<AppDatasetDao
private AppService appService;
@Autowired
private AppVersionService appVersionService;
@Override
protected void removeAfter(Long[] ids, Context context, int result) throws AppException {
List<AppInfoFieldEntity> appInfoFieldlist = appInfoFieldService.find(new AppInfoFieldQuery().datasetIdList(Arrays.asList(ids)));
if(!ObjectUtils.isEmpty(appInfoFieldlist)){
appInfoFieldService.removeList(appInfoFieldlist, context);
}
super.removeAfter(ids, context, result);
protected void saveAfter(AppDatasetEntity entity, Context context) throws AppException {
if (!ObjectUtils.isEmpty(entity.getAppInfoFieldList())) {
entity.getAppInfoFieldList().stream().peek(item -> {
item.setDatasetId(entity.getId());
item.setCreateUser(context.getUser().getLoginName());
item.setCreateUserId(context.getUser().getId());
item.setCreateTime(new Date());
}).count();
appInfoFieldService.save(entity.getAppInfoFieldList());
}
//更新版本号
AppEntity appEntity = appService.get(entity.getAppId(), context);
saveOrUpdateAppVersion(appEntity, context);
super.saveAfter(entity, context);
}
@Override
protected void updateAfter(AppDatasetEntity entity, Context context) throws AppException {
if (!ObjectUtils.isEmpty(entity.getAppInfoFieldList())) {
Long[] appInfoFieldIds = appInfoFieldService.find(new AppInfoFieldQuery().datasetId(entity.getId())).stream().map(AppInfoFieldEntity::getId).toArray(Long[]::new);
appInfoFieldService.remove(appInfoFieldIds, context);
entity.getAppInfoFieldList().stream().peek(item -> {
item.setDatasetId(entity.getId());
item.setCreateUser(context.getUser().getLoginName());
item.setCreateUserId(context.getUser().getId());
item.setCreateTime(new Date());
item.setUpdateUser(context.getUser().getLoginName());
item.setUpdateUserId(context.getUser().getId());
item.setUpdateTime(new Date());
}).count();
appInfoFieldService.save(entity.getAppInfoFieldList());
}
//更新版本号
AppEntity appEntity = appService.get(entity.getAppId(), context);
saveOrUpdateAppVersion(appEntity, context);
super.updateAfter(entity, context);
}
@Override
protected void saveAfter(AppDatasetEntity entity, Context context) throws AppException {
//更新版本号
AppEntity appEntity = appService.get(entity.getAppId(), context);
saveOrUpdateAppVersion(appEntity, context);
super.saveAfter(entity, context);
protected void removeAfter(Long[] ids, Context context, int result) throws AppException {
List<AppInfoFieldEntity> appInfoFieldlist = appInfoFieldService.find(new AppInfoFieldQuery().datasetIdList(Arrays.asList(ids)));
if (!ObjectUtils.isEmpty(appInfoFieldlist)) {
appInfoFieldService.removeList(appInfoFieldlist, context);
}
super.removeAfter(ids, context, result);
}
private void saveOrUpdateAppVersion( AppEntity appEntity, Context context) {
if(!ObjectUtils.isEmpty(appEntity)){
private void saveOrUpdateAppVersion(AppEntity appEntity, Context context) {
if (!ObjectUtils.isEmpty(appEntity)) {
String version = appEntity.getVersion();
String versionNum = StrUtil.subAfter(version, Constant.VERSION_PREFIX, false);
String newVersionNum = NumberUtil.add(versionNum, "0.1").setScale(1).toString();
......@@ -71,7 +97,7 @@ public class AppDatasetServiceImpl extends AbstractCRUDServiceImpl<AppDatasetDao
appVersionEntity.initAttrValue();
AppVersionEntity versionEntity = new AppVersionEntity();
versionEntity.initAttrValue();
versionEntity.setVersion(Constant.VERSION_PREFIX+newVersionNum);
versionEntity.setVersion(Constant.VERSION_PREFIX + newVersionNum);
versionEntity.setNotes("应用数据更新!");
versionEntity.setCreateTime(new Date());
versionEntity.setCreateUserId(this.getContextUserId(context));
......
......@@ -4,7 +4,7 @@ Content-Type: application/json
{
"loginName":"admin",
"password":"admin",
"password":"adsmile",
"securityCode":"8888"
}
......@@ -36,13 +36,12 @@ Content-Type: application/json
"siteName":"汇东县",
"appCode":"cheshi",
"appName":"测试应用",
"appIconPath":"/xxx/xx.jpg",
"appIconPath":"/file/preview/196089969797.jpg",
"appThemeName":"应用程序",
"type":1,
"downDevCount":0,
"shelves":0,
"filePath":"njmfzd",
"distributeFilePath":"ie8ice",
"filePath":"file/uploadfile/1661928678354.zip",
"version":"1.0",
"summary":"vyk2sq",
"distribute":0
......
......@@ -19,7 +19,7 @@ Authorization: {{authToken}}
Content-Type: application/json
{
"appId":867,
"appId":1,
"page":1,
"size":10
}
......@@ -31,7 +31,7 @@ Authorization: {{authToken}}
Content-Type: application/json
{
"appId":526,
"appId":1
}
> {%
......
......@@ -3,9 +3,9 @@ POST {{baseUrl}}/login/login
Content-Type: application/json
{
"loginName":"admin",
"password":"admin",
"securityCode":"8888"
"loginName": "admin",
"password": "admin",
"securityCode": "8888"
}
> {%
......@@ -19,18 +19,9 @@ Authorization: {{authToken}}
Content-Type: application/json
{
"datasetId":623,
"fieldCode":"3cl109",
"fieldName":"ga3dpd",
"fieldType":"zhuwrm",
"dataType":"mg4k5i",
"fieldValue":"zac65i",
"fieldLen":757,
"fieldNull":1,
"isList":848,
"fieldOrderNo":"s5ae8g",
"page":1,
"size":10
"datasetId": 1,
"page": 1,
"size": 10
}
......@@ -40,23 +31,62 @@ Authorization: {{authToken}}
Content-Type: application/json
{
"datasetId":628,
"fieldCode":"3jr5wy",
"fieldName":"rlv0d9",
"fieldType":"y77qd4",
"dataType":"k9iyeb",
"fieldValue":"i1zx0e",
"fieldLen":939,
"fieldNull":1,
"isList":530,
"fieldOrderNo":"23fcqf",
"remark":"u72ofy",
"datasetId": 1,
"fieldCode": "title2",
"fieldName": "标题2",
"fieldType": "input",
"dataType": "number",
"fieldValue": "zo0",
"fieldLen": 255,
"fieldNull": 1,
"isList": 1,
"fieldOrderNo": "1",
"remark": "xxxxxxxxxxxxxxxx"
}
> {%
client.global.set("AppInfoField_id", JSON.parse(response.body).data.id);
%}
###自助终端应用信息字段批量新增
POST {{baseUrl}}/app/info/field/batchSave
Authorization: {{authToken}}
Content-Type: application/json
[
{
"datasetId": 1,
"fieldCode": "title1",
"fieldName": "标题1",
"fieldType": "input",
"dataType": "number",
"fieldValue": "zo0",
"fieldLen": 255,
"fieldNull": 1,
"isList": 1,
"fieldOrderNo": "1",
"remark": "1111111111"
},
{
"datasetId": 1,
"fieldCode": "title2",
"fieldName": "标题2",
"fieldType": "input",
"dataType": "number",
"fieldValue": "zo0",
"fieldLen": 255,
"fieldNull": 1,
"isList": 1,
"fieldOrderNo": "1",
"remark": "22222222222222"
}
]
> {%
client.global.set("AppInfoField_id", JSON.parse(response.body).data.id);
%}
###自助终端应用信息字段查看
GET {{baseUrl}}/app/info/field/info?id={{AppInfoField_id}}
Authorization: {{authToken}}
......
......@@ -19,16 +19,7 @@ Authorization: {{authToken}}
Content-Type: application/json
{
"appId":697,
"fieldCode":"ms6x38",
"fieldName":"pkzida",
"fieldType":"y35tzv",
"dataType":"l0udnu",
"fieldValue":"9axwsc",
"fieldLen":323,
"fieldNull":1,
"isList":957,
"fieldOrderNo":"fdqlh1",
"appId":1,
"page":1,
"size":10
}
......@@ -40,17 +31,17 @@ Authorization: {{authToken}}
Content-Type: application/json
{
"appId":292,
"fieldCode":"eg5fas",
"fieldName":"4c7y60",
"fieldType":"7z4rum",
"dataType":"6tibr9",
"fieldValue":"zo04rh",
"fieldLen":839,
"appId":1,
"fieldCode":"title2",
"fieldName":"标题2",
"fieldType":"input",
"dataType":"number",
"fieldValue":"zo0",
"fieldLen":255,
"fieldNull":1,
"isList":755,
"fieldOrderNo":"qf8e1e",
"remark":"iwlj8b",
"isList":1,
"fieldOrderNo":"1",
"remark":"xxxxxxxxxxxxxxxx"
}
> {%
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment