重庆机具配置项功能优化
This commit is contained in:
parent
38ff4b5289
commit
fd9fd2d17c
|
|
@ -10,12 +10,14 @@ import com.bonus.sgzb.base.api.domain.MaMachine;
|
|||
import com.bonus.sgzb.base.api.domain.MachinePart;
|
||||
import com.bonus.sgzb.base.api.domain.SltAgreementInfo;
|
||||
import com.bonus.sgzb.base.mapper.MaMachineMapper;
|
||||
import com.bonus.sgzb.base.service.ISysConfigService;
|
||||
import com.bonus.sgzb.common.core.constant.TaskTypeConstants;
|
||||
import com.bonus.sgzb.common.core.enums.TaskStatusEnum;
|
||||
import com.bonus.sgzb.common.core.enums.TaskTypeEnum;
|
||||
import com.bonus.sgzb.common.core.utils.DateUtils;
|
||||
import com.bonus.sgzb.common.core.utils.HttpHelper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
|
@ -41,13 +43,12 @@ public class BackReceiveServiceImpl implements BackReceiveService {
|
|||
@Resource
|
||||
private MaMachineMapper maMachineMapper;
|
||||
|
||||
@Autowired
|
||||
private ISysConfigService configService;
|
||||
|
||||
@Resource
|
||||
private TmTaskMapper tmTaskMapper;
|
||||
|
||||
@Value("${sgzb.updateItemStatusUrl}")
|
||||
private String updateItemStatus;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
|
|
@ -543,6 +544,7 @@ public class BackReceiveServiceImpl implements BackReceiveService {
|
|||
Map<String, String> map = new HashMap<>();
|
||||
map.put("body", content);
|
||||
String body = JSONObject.toJSONString(map);
|
||||
String updateItemStatus = configService.selectConfigByKey("updateItemStatusUrl");
|
||||
String data = HttpHelper.sendHttpPost(updateItemStatus, body);
|
||||
log.info("dataString-=========:" + data);
|
||||
} catch (Exception e) {
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import com.bonus.sgzb.app.service.LeaseOutDetailsService;
|
|||
import com.bonus.sgzb.base.api.domain.*;
|
||||
import com.bonus.sgzb.base.mapper.MaLabelBindMapper;
|
||||
import com.bonus.sgzb.base.mapper.MaMachineMapper;
|
||||
import com.bonus.sgzb.base.service.ISysConfigService;
|
||||
import com.bonus.sgzb.base.vo.MaLabelBindVO;
|
||||
import com.bonus.sgzb.common.core.constant.Constants;
|
||||
import com.bonus.sgzb.common.core.utils.HttpHelper;
|
||||
|
|
@ -18,6 +19,7 @@ import com.bonus.sgzb.common.core.utils.StringUtils;
|
|||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.sgzb.common.security.utils.SecurityUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
|
@ -47,8 +49,9 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService {
|
|||
@Resource
|
||||
private MaLabelBindMapper maLabelBindMapper;
|
||||
|
||||
@Value("${sgzb.updateItemStatusUrl}")
|
||||
private String updateItemStatus;
|
||||
@Autowired
|
||||
private ISysConfigService configService;
|
||||
|
||||
|
||||
/**
|
||||
* 根据任务id查询出库数据
|
||||
|
|
@ -272,7 +275,8 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService {
|
|||
Map<String, String> map = new HashMap<>();
|
||||
map.put("body", content);
|
||||
String body = JSONObject.toJSONString(map);
|
||||
String data = HttpHelper.sendHttpPost(updateItemStatus, body);
|
||||
String updateItemStatusUrl = configService.selectConfigByKey("updateItemStatusUrl");
|
||||
String data = HttpHelper.sendHttpPost(updateItemStatusUrl, body);
|
||||
log.info("dataString-=========:" + data);
|
||||
} catch (Exception e) {
|
||||
log.error("同步租赁商城机具状态失败");
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import com.bonus.sgzb.app.mapper.LeaseApplyInfoMapper;
|
|||
import com.bonus.sgzb.app.mapper.TmTaskMapper;
|
||||
import com.bonus.sgzb.app.service.*;
|
||||
import com.bonus.sgzb.base.api.domain.*;
|
||||
import com.bonus.sgzb.base.service.ISysConfigService;
|
||||
import com.bonus.sgzb.common.core.constant.Constants;
|
||||
import com.bonus.sgzb.common.core.domain.R;
|
||||
import com.bonus.sgzb.common.core.exception.ServiceException;
|
||||
|
|
@ -26,6 +27,7 @@ import com.bonus.sgzb.material.exception.ExceptionDict;
|
|||
import com.bonus.sgzb.material.mapper.LeaseRecordMapper;
|
||||
import com.bonus.sgzb.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
|
@ -48,14 +50,8 @@ import java.util.stream.Collectors;
|
|||
@Slf4j
|
||||
public class TmTaskServiceImpl implements TmTaskService {
|
||||
|
||||
@Value("${sgzb.intelligentUrl}")
|
||||
private String intelligentUrl;
|
||||
|
||||
@Value("${sgzb.intelligentAppKey}")
|
||||
private String intelligentAppKey;
|
||||
|
||||
@Value("${sgzb.intelligentAesKey}")
|
||||
private String intelligentAesKey;
|
||||
@Autowired
|
||||
private ISysConfigService configService;
|
||||
|
||||
@Resource
|
||||
private TmTaskMapper tmTaskMapper;
|
||||
|
|
@ -1395,9 +1391,12 @@ public class TmTaskServiceImpl implements TmTaskService {
|
|||
MaMachineIntelligentVO maMachineIntelligentVO = intelVOList.get(0);
|
||||
String content = JSONObject.toJSONString(maMachineIntelligentVO);
|
||||
//获取token
|
||||
String intelligentAppKey = configService.selectConfigByKey("intelligentAppKey");
|
||||
String intelligentAesKey = configService.selectConfigByKey("intelligentAesKey");
|
||||
String token = GetTokenByAppKey.getToken(intelligentAppKey, intelligentAesKey);
|
||||
log.info("token-=========:" + token);
|
||||
//调用推送的方法
|
||||
String intelligentUrl = configService.selectConfigByKey("intelligentUrl");
|
||||
String data = HttpHelper.sendHttpPost(intelligentUrl, token,content,intelligentAppKey);
|
||||
log.info("dataString-=========:" + data);
|
||||
resultDataHandler(data);
|
||||
|
|
|
|||
|
|
@ -21,13 +21,12 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
* 参数配置 信息操作处理
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/config")
|
||||
public class SysConfigController extends BaseController
|
||||
{
|
||||
public class SysConfigController extends BaseController {
|
||||
private final String publicKey = "MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKoR8mX0rGKLqzcWmOzbfj64K8ZIgOdHnzkXSOVOZbFu/TJhZ7rFAN+eaGkl3C4buccQd/EjEsj9ir7ijT7h96MCAwEAAQ==";
|
||||
private final String CONFIG_KEY = "sys.user.initPassword";
|
||||
|
||||
|
|
@ -54,8 +53,7 @@ public class SysConfigController extends BaseController
|
|||
@Log(title = "参数管理", businessType = BusinessType.EXPORT)
|
||||
@RequiresPermissions("system:config:export")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, MaConfig config)
|
||||
{
|
||||
public void export(HttpServletResponse response, MaConfig config) {
|
||||
List<MaConfig> list = configService.selectConfigList(config);
|
||||
ExcelUtil<MaConfig> util = new ExcelUtil<MaConfig>(MaConfig.class);
|
||||
util.exportExcel(response, list, "参数数据");
|
||||
|
|
@ -65,8 +63,7 @@ public class SysConfigController extends BaseController
|
|||
* 根据参数编号获取详细信息
|
||||
*/
|
||||
@GetMapping(value = "/{configId}")
|
||||
public AjaxResult getInfo(@PathVariable Long configId)
|
||||
{
|
||||
public AjaxResult getInfo(@PathVariable Long configId) {
|
||||
return success(configService.selectConfigById(configId));
|
||||
}
|
||||
|
||||
|
|
@ -89,10 +86,8 @@ public class SysConfigController extends BaseController
|
|||
@RequiresPermissions("system:config:add")
|
||||
@Log(title = "参数管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody MaConfig config)
|
||||
{
|
||||
if (!configService.checkConfigKeyUnique(config))
|
||||
{
|
||||
public AjaxResult add(@Validated @RequestBody MaConfig config) {
|
||||
if (!configService.checkConfigKeyUnique(config)) {
|
||||
return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||
}
|
||||
config.setCreateBy(SecurityUtils.getUsername());
|
||||
|
|
@ -105,10 +100,8 @@ public class SysConfigController extends BaseController
|
|||
@RequiresPermissions("system:config:edit")
|
||||
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody MaConfig config)
|
||||
{
|
||||
if (!configService.checkConfigKeyUnique(config))
|
||||
{
|
||||
public AjaxResult edit(@Validated @RequestBody MaConfig config) {
|
||||
if (!configService.checkConfigKeyUnique(config)) {
|
||||
return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||
}
|
||||
config.setUpdateBy(SecurityUtils.getUsername());
|
||||
|
|
@ -121,8 +114,7 @@ public class SysConfigController extends BaseController
|
|||
@RequiresPermissions("system:config:remove")
|
||||
@Log(title = "参数管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{configIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] configIds)
|
||||
{
|
||||
public AjaxResult remove(@PathVariable Long[] configIds) {
|
||||
configService.deleteConfigByIds(configIds);
|
||||
return success();
|
||||
}
|
||||
|
|
@ -133,8 +125,7 @@ public class SysConfigController extends BaseController
|
|||
@RequiresPermissions("system:config:remove")
|
||||
@Log(title = "参数管理", businessType = BusinessType.CLEAN)
|
||||
@DeleteMapping("/refreshCache")
|
||||
public AjaxResult refreshCache()
|
||||
{
|
||||
public AjaxResult refreshCache() {
|
||||
configService.resetConfigCache();
|
||||
return success();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import com.bonus.sgzb.base.api.domain.SltAgreementApply;
|
|||
import com.bonus.sgzb.base.domain.MaPropSet;
|
||||
import com.bonus.sgzb.base.domain.vo.IotRecordVo;
|
||||
import com.bonus.sgzb.base.mapper.*;
|
||||
import com.bonus.sgzb.base.service.ISysConfigService;
|
||||
import com.bonus.sgzb.base.service.MaMachineService;
|
||||
import com.bonus.sgzb.common.core.constant.Constants;
|
||||
import com.bonus.sgzb.common.core.exception.ServiceException;
|
||||
|
|
@ -18,6 +19,7 @@ import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
|||
import com.bonus.sgzb.common.security.utils.SecurityUtils;
|
||||
import com.bonus.sgzb.material.exception.ExceptionDict;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
|
@ -28,13 +30,14 @@ import java.util.*;
|
|||
@Service
|
||||
@Slf4j
|
||||
public class MaMachineServiceImpl implements MaMachineService {
|
||||
@Value("${sgzb.zlptUrl}")
|
||||
private String zlptUrl;
|
||||
@Resource
|
||||
private MaMachineMapper maMachineMapper;
|
||||
|
||||
@Resource
|
||||
private MaTypeMapper typeMapper;
|
||||
@Autowired
|
||||
private ISysConfigService configService;
|
||||
|
||||
@Resource
|
||||
private MaLabelBindMapper labelBindMapper;
|
||||
|
|
@ -49,17 +52,17 @@ public class MaMachineServiceImpl implements MaMachineService {
|
|||
@Override
|
||||
public List<MaMachine> getMaMachine(MaMachine maMachine) {
|
||||
List<MaMachine> listMaMachine = new ArrayList<>();
|
||||
listMaMachine =maMachineMapper.getMaMachine(maMachine);
|
||||
if (listMaMachine.size() > 0){
|
||||
listMaMachine = maMachineMapper.getMaMachine(maMachine);
|
||||
if (listMaMachine.size() > 0) {
|
||||
for (MaMachine ma : listMaMachine) {
|
||||
//根据机具编码查询iot设备
|
||||
List<IotRecordVo> iotRecordVoList = baseIotMachineMapper.selectList(ma.getMaCode());
|
||||
List<IotRecordVo> iotRecordVoList = baseIotMachineMapper.selectList(ma.getMaCode());
|
||||
ma.setIotNum(iotRecordVoList.size());
|
||||
//判断是否绑定了iot设备
|
||||
if (iotRecordVoList.size()>0){
|
||||
if (iotRecordVoList.size() > 0) {
|
||||
for (int i = 0; i < iotRecordVoList.size(); i++) {
|
||||
//保存定位iot设备编码
|
||||
if ("125".equals(iotRecordVoList.get(i).getIotType())){
|
||||
if ("125".equals(iotRecordVoList.get(i).getIotType())) {
|
||||
ma.setIotCode(iotRecordVoList.get(i).getIotCode());
|
||||
}
|
||||
}
|
||||
|
|
@ -70,7 +73,8 @@ public class MaMachineServiceImpl implements MaMachineService {
|
|||
}
|
||||
|
||||
/**
|
||||
* 添加查询物品种类,设备类型,规格型号
|
||||
* 添加查询物品种类,设备类型,规格型号
|
||||
*
|
||||
* @param machine
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -90,6 +94,7 @@ public class MaMachineServiceImpl implements MaMachineService {
|
|||
|
||||
/**
|
||||
* 新增机具设备
|
||||
*
|
||||
* @param maMachine 机具设备信息
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
@ -156,28 +161,27 @@ public class MaMachineServiceImpl implements MaMachineService {
|
|||
* @return 机具设备管理ma_machine
|
||||
*/
|
||||
@Override
|
||||
public MaMachine selectMaMachineByMaId(Long maId)
|
||||
{
|
||||
public MaMachine selectMaMachineByMaId(Long maId) {
|
||||
return maMachineMapper.selectMaMachineByMaId(maId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MaMachine getMachineByQrCode(MaMachine maMachine) {
|
||||
MaMachine ma = maMachineMapper.getMachineByQrCode(maMachine);
|
||||
if(ma != null){
|
||||
if (ma != null) {
|
||||
SltAgreementApply leaseProject = maMachineMapper.getLeaseProject(ma);
|
||||
SltAgreementApply backProject = maMachineMapper.getBackProject(ma);
|
||||
if (leaseProject != null){
|
||||
if (leaseProject != null) {
|
||||
ma.setLeaseUnit(leaseProject.getUnitName());
|
||||
ma.setLeasePro(leaseProject.getProjectName());
|
||||
ma.setLeaseTime(leaseProject.getCreateTime());
|
||||
}
|
||||
if (backProject != null){
|
||||
if (backProject != null) {
|
||||
ma.setBackUnit(backProject.getUnitName());
|
||||
ma.setBackPro(backProject.getProjectName());
|
||||
ma.setBackTime(backProject.getCreateTime());
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
throw new ServiceException("二维码对应机具信息无效");
|
||||
}
|
||||
return ma;
|
||||
|
|
@ -185,9 +189,10 @@ public class MaMachineServiceImpl implements MaMachineService {
|
|||
|
||||
@Override
|
||||
public AjaxResult pushNotifications(List<MaMachine> maMachineList) {
|
||||
log.info("MaMachineServiceImpl pushNotifications 开始处理设备推送逻辑==={},地址{}",maMachineList,zlptUrl);
|
||||
if (maMachineList.isEmpty()){
|
||||
throw new ServiceException(String.format(ExceptionDict.PARAM_IS_NULL_ERROR_MSG,"maMachineList"), ExceptionDict.PARAM_IS_NULL_ERROR);
|
||||
zlptUrl = configService.selectConfigByKey("zlptUrl");
|
||||
log.info("MaMachineServiceImpl pushNotifications 开始处理设备推送逻辑==={},地址{}", maMachineList, zlptUrl);
|
||||
if (maMachineList.isEmpty()) {
|
||||
throw new ServiceException(String.format(ExceptionDict.PARAM_IS_NULL_ERROR_MSG, "maMachineList"), ExceptionDict.PARAM_IS_NULL_ERROR);
|
||||
}
|
||||
String content = JSONObject.toJSONString(maMachineList);
|
||||
String encrypt;
|
||||
|
|
@ -199,9 +204,9 @@ public class MaMachineServiceImpl implements MaMachineService {
|
|||
String data = HttpHelper.sendHttpPost(zlptUrl, body);
|
||||
log.info("dataString-=========:" + data);
|
||||
//对返回的结果进行处理
|
||||
// resultDataHandler(data);
|
||||
// resultDataHandler(data);
|
||||
//修改设备状态,防止重复推送
|
||||
for (MaMachine maMachine:maMachineList) {
|
||||
for (MaMachine maMachine : maMachineList) {
|
||||
MaMachine maMachine1 = new MaMachine();
|
||||
maMachine1.setMaId(maMachine.getMaId());
|
||||
maMachine1.setPushStatus(1);
|
||||
|
|
|
|||
Loading…
Reference in New Issue