1.添加上传单据设置查询新增接口
parent
ca8ebace24
commit
9a644e8f73
@ -0,0 +1,64 @@
|
||||
package com.glxp.api.controller.thrsys;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.glxp.api.common.res.BaseResponse;
|
||||
import com.glxp.api.common.util.ResultVOUtils;
|
||||
import com.glxp.api.entity.thrsys.ThrOrderUploadBustypesEntity;
|
||||
import com.glxp.api.entity.thrsys.ThrOrderUploadEntity;
|
||||
import com.glxp.api.req.thrsys.PostThrOrderUploadRequest;
|
||||
import com.glxp.api.res.thrsys.ThrOrderUploadResponse;
|
||||
import com.glxp.api.service.thrsys.ThrOrderUploadBusTypService;
|
||||
import com.glxp.api.service.thrsys.ThrOrderUploadService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 单据上传设置接口
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
public class ThrUploadSetController {
|
||||
|
||||
@Resource
|
||||
private ThrOrderUploadService thrOrderUploadService;
|
||||
@Resource
|
||||
private ThrOrderUploadBusTypService thrOrderUploadBusTypService;
|
||||
|
||||
/**
|
||||
* 查询上传设置
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/system/third/syncData/config")
|
||||
public BaseResponse list() {
|
||||
ThrOrderUploadResponse uploadResponse = thrOrderUploadService.findSet();
|
||||
return ResultVOUtils.success(uploadResponse);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加或修改上传设置
|
||||
*
|
||||
* @param thrOrderUploadRequest
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/system/third/syncData/save")
|
||||
public BaseResponse save(@RequestBody PostThrOrderUploadRequest thrOrderUploadRequest) {
|
||||
List<ThrOrderUploadBustypesEntity> busTypes = thrOrderUploadRequest.getBusTypes();
|
||||
thrOrderUploadBusTypService.deleteAll();
|
||||
if (CollUtil.isNotEmpty(busTypes)) {
|
||||
thrOrderUploadBusTypService.save(busTypes);
|
||||
ThrOrderUploadEntity thrOrderUploadEntity = new ThrOrderUploadEntity();
|
||||
BeanUtil.copyProperties(thrOrderUploadRequest, thrOrderUploadEntity);
|
||||
thrOrderUploadService.insert(thrOrderUploadEntity);
|
||||
}
|
||||
return ResultVOUtils.success();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package com.glxp.api.dao.thrsys;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.glxp.api.entity.thrsys.ThrOrderUploadBustypesEntity;
|
||||
|
||||
/**
|
||||
* 单据上传类型Dao
|
||||
*/
|
||||
public interface ThrOrderUploadBusTypeDao extends BaseMapper<ThrOrderUploadBustypesEntity> {
|
||||
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package com.glxp.api.dao.thrsys;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.glxp.api.entity.thrsys.ThrOrderUploadEntity;
|
||||
|
||||
public interface ThrOrderUploadDao extends BaseMapper<ThrOrderUploadEntity> {
|
||||
|
||||
}
|
@ -0,0 +1,116 @@
|
||||
package com.glxp.api.req.thrsys;
|
||||
|
||||
import com.glxp.api.entity.thrsys.ThrOrderUploadBustypesEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 上传单据设置添加修改参数
|
||||
*/
|
||||
@Data
|
||||
public class PostThrOrderUploadRequest {
|
||||
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 是否自动上传
|
||||
*/
|
||||
private Boolean autoUpload;
|
||||
|
||||
/**
|
||||
* 同步时间间隔
|
||||
*/
|
||||
private Integer orderSyncTime;
|
||||
|
||||
/**
|
||||
* 待校验单据
|
||||
*/
|
||||
private Integer orderUnCheck;
|
||||
|
||||
/**
|
||||
* 未验收单据
|
||||
*/
|
||||
private Integer orderUnReceive;
|
||||
|
||||
/**
|
||||
* 已完成单据
|
||||
*/
|
||||
private Integer orderScanFinish;
|
||||
|
||||
/**
|
||||
* UDIMS平台
|
||||
*/
|
||||
private Integer checkUdims;
|
||||
|
||||
/**
|
||||
* PDA已校验
|
||||
*/
|
||||
private Integer checkPdaEd;
|
||||
|
||||
/**
|
||||
* pda未校验
|
||||
*/
|
||||
private Integer checkPdaUn;
|
||||
|
||||
/**
|
||||
* 扫码通
|
||||
*/
|
||||
private Integer checkPc;
|
||||
|
||||
/**
|
||||
* 网页端新增
|
||||
*/
|
||||
private Integer checkWebNew;
|
||||
|
||||
/**
|
||||
* 缺量补单
|
||||
*/
|
||||
private Integer checkChange;
|
||||
|
||||
/**
|
||||
* 自助平台同步
|
||||
*/
|
||||
private Integer checkSp;
|
||||
|
||||
/**
|
||||
* 平衡补单
|
||||
*/
|
||||
private Integer checkBalacne;
|
||||
|
||||
/**
|
||||
* 单据上传起始时间
|
||||
*/
|
||||
private String orderStartTime;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createUser;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Data createTime;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
private String updateUser;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Data updateTime;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 上传单据类型集合
|
||||
*/
|
||||
List<ThrOrderUploadBustypesEntity> busTypes;
|
||||
|
||||
}
|
@ -0,0 +1,116 @@
|
||||
package com.glxp.api.res.thrsys;
|
||||
|
||||
import com.glxp.api.entity.thrsys.ThrOrderUploadBustypesEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 单据上传接口响应数据
|
||||
*/
|
||||
@Data
|
||||
public class ThrOrderUploadResponse {
|
||||
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 是否自动上传
|
||||
*/
|
||||
private Boolean autoUpload;
|
||||
|
||||
/**
|
||||
* 同步时间间隔
|
||||
*/
|
||||
private Integer orderSyncTime;
|
||||
|
||||
/**
|
||||
* 待校验单据
|
||||
*/
|
||||
private Integer orderUnCheck;
|
||||
|
||||
/**
|
||||
* 未验收单据
|
||||
*/
|
||||
private Integer orderUnReceive;
|
||||
|
||||
/**
|
||||
* 已完成单据
|
||||
*/
|
||||
private Integer orderScanFinish;
|
||||
|
||||
/**
|
||||
* UDIMS平台
|
||||
*/
|
||||
private Integer checkUdims;
|
||||
|
||||
/**
|
||||
* PDA已校验
|
||||
*/
|
||||
private Integer checkPdaEd;
|
||||
|
||||
/**
|
||||
* pda未校验
|
||||
*/
|
||||
private Integer checkPdaUn;
|
||||
|
||||
/**
|
||||
* 扫码通
|
||||
*/
|
||||
private Integer checkPc;
|
||||
|
||||
/**
|
||||
* 网页端新增
|
||||
*/
|
||||
private Integer checkWebNew;
|
||||
|
||||
/**
|
||||
* 缺量补单
|
||||
*/
|
||||
private Integer checkChange;
|
||||
|
||||
/**
|
||||
* 自助平台同步
|
||||
*/
|
||||
private Integer checkSp;
|
||||
|
||||
/**
|
||||
* 平衡补单
|
||||
*/
|
||||
private Integer checkBalacne;
|
||||
|
||||
/**
|
||||
* 单据上传起始时间
|
||||
*/
|
||||
private String orderStartTime;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createUser;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Data createTime;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
private String updateUser;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Data updateTime;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 上传单据类型集合
|
||||
*/
|
||||
List<ThrOrderUploadBustypesEntity> busTypes;
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.glxp.api.service.thrsys;
|
||||
|
||||
import com.glxp.api.entity.thrsys.ThrOrderUploadBustypesEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 单据上传类型Service
|
||||
*/
|
||||
public interface ThrOrderUploadBusTypService {
|
||||
|
||||
/**
|
||||
* 删除所有类型数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean deleteAll();
|
||||
|
||||
/**
|
||||
* 新增单据类型数据
|
||||
*
|
||||
* @param list
|
||||
*/
|
||||
void save(List<ThrOrderUploadBustypesEntity> list);
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.glxp.api.service.thrsys;
|
||||
|
||||
import com.glxp.api.entity.thrsys.ThrOrderUploadEntity;
|
||||
import com.glxp.api.res.thrsys.ThrOrderUploadResponse;
|
||||
|
||||
public interface ThrOrderUploadService {
|
||||
|
||||
/**
|
||||
* 查询上传单据设置
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
ThrOrderUploadResponse findSet();
|
||||
|
||||
/**
|
||||
* 添加或修改上传单据设置
|
||||
*
|
||||
* @param thrOrderUploadEntity
|
||||
* @return
|
||||
*/
|
||||
boolean insert(ThrOrderUploadEntity thrOrderUploadEntity);
|
||||
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package com.glxp.api.service.thrsys.impl;
|
||||
|
||||
import com.glxp.api.dao.thrsys.ThrOrderUploadBusTypeDao;
|
||||
import com.glxp.api.entity.thrsys.ThrOrderUploadBustypesEntity;
|
||||
import com.glxp.api.service.auth.CustomerService;
|
||||
import com.glxp.api.service.thrsys.ThrOrderUploadBusTypService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class ThrOrderUploadBusTypServiceImpl implements ThrOrderUploadBusTypService {
|
||||
|
||||
@Resource
|
||||
private ThrOrderUploadBusTypeDao thrOrderUploadBusTypeDao;
|
||||
@Resource
|
||||
private CustomerService customerService;
|
||||
|
||||
@Override
|
||||
public boolean deleteAll() {
|
||||
thrOrderUploadBusTypeDao.delete(null);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(List<ThrOrderUploadBustypesEntity> list) {
|
||||
Date date = new Date();
|
||||
String userId = customerService.getUserIdStr();
|
||||
|
||||
for (ThrOrderUploadBustypesEntity thrOrderUploadBustypesEntity : list) {
|
||||
thrOrderUploadBustypesEntity.setCreateTime(date);
|
||||
thrOrderUploadBustypesEntity.setUpdateTime(date);
|
||||
thrOrderUploadBustypesEntity.setCreateUser(userId);
|
||||
thrOrderUploadBustypesEntity.setUpdateUser(userId);
|
||||
thrOrderUploadBusTypeDao.insert(thrOrderUploadBustypesEntity);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package com.glxp.api.service.thrsys.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.glxp.api.dao.thrsys.ThrOrderUploadBusTypeDao;
|
||||
import com.glxp.api.dao.thrsys.ThrOrderUploadDao;
|
||||
import com.glxp.api.entity.thrsys.ThrOrderUploadBustypesEntity;
|
||||
import com.glxp.api.entity.thrsys.ThrOrderUploadEntity;
|
||||
import com.glxp.api.res.thrsys.ThrOrderUploadResponse;
|
||||
import com.glxp.api.service.thrsys.ThrOrderUploadService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class ThrOrderUploadServiceImpl implements ThrOrderUploadService {
|
||||
|
||||
@Resource
|
||||
private ThrOrderUploadDao thrOrderUploadDao;
|
||||
@Resource
|
||||
private ThrOrderUploadBusTypeDao thrOrderUploadBusTypeDao;
|
||||
|
||||
@Override
|
||||
public ThrOrderUploadResponse findSet() {
|
||||
ThrOrderUploadEntity thrOrderUploadEntity = thrOrderUploadDao.selectById(1);
|
||||
if (null == thrOrderUploadEntity) {
|
||||
thrOrderUploadEntity = new ThrOrderUploadEntity();
|
||||
thrOrderUploadEntity.setId(1);
|
||||
thrOrderUploadEntity.setAutoUpload(false);
|
||||
thrOrderUploadEntity.setOrderSyncTime(1);
|
||||
thrOrderUploadDao.insert(thrOrderUploadEntity);
|
||||
}
|
||||
List<ThrOrderUploadBustypesEntity> busTypeList = thrOrderUploadBusTypeDao.selectList(null);
|
||||
ThrOrderUploadResponse response = new ThrOrderUploadResponse();
|
||||
BeanUtil.copyProperties(thrOrderUploadEntity, response);
|
||||
response.setBusTypes(busTypeList);
|
||||
return response;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean insert(ThrOrderUploadEntity thrOrderUploadEntity) {
|
||||
Long count = thrOrderUploadDao.selectCount(new QueryWrapper<ThrOrderUploadEntity>().eq("id", 1));
|
||||
thrOrderUploadEntity.setId(1);
|
||||
if (count > 0) {
|
||||
thrOrderUploadDao.updateById(thrOrderUploadEntity);
|
||||
} else {
|
||||
thrOrderUploadDao.insert(thrOrderUploadEntity);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue