rfid绑定和注册配置默认角色
This commit is contained in:
parent
f38110f2dc
commit
a658f82915
|
|
@ -22,7 +22,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
|
@ -231,6 +233,14 @@ public class SysLoginService {
|
|||
sysUser.setNickName(username);
|
||||
sysUser.setPassword(SecurityUtils.encryptPassword(password));
|
||||
sysUser.setPhonenumber(phone);
|
||||
sysUser.setDeptId(100L);
|
||||
List<Long> list = new ArrayList<>();
|
||||
list.add(105L);
|
||||
Long[] longArray = new Long[list.size()];
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
longArray[i] = list.get(i);
|
||||
}
|
||||
sysUser.setRoleIds(longArray);
|
||||
R<?> registerResult = remoteUserService.registerUserInfo(sysUser, SecurityConstants.INNER);
|
||||
|
||||
if (R.FAIL == registerResult.getCode()) {
|
||||
|
|
@ -258,4 +268,14 @@ public class SysLoginService {
|
|||
return hashMap;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static long[] convertToLongArray(int num) {
|
||||
String numStr = Integer.toString(num);
|
||||
long[] longArray = new long[numStr.length()];
|
||||
for (int i = 0; i < numStr.length(); i++) {
|
||||
longArray[i] = Long.parseLong(String.valueOf(numStr.charAt(i)));
|
||||
}
|
||||
return longArray;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,16 @@
|
|||
package com.bonus.sgzb.app.controller;
|
||||
|
||||
import com.bonus.sgzb.app.domain.LeaseApplyDetails;
|
||||
import com.bonus.sgzb.app.domain.LeaseApplyInfo;
|
||||
import com.bonus.sgzb.app.service.LeaseOutDetailsService;
|
||||
import com.bonus.sgzb.base.api.domain.LeaseOutDetails;
|
||||
import com.bonus.sgzb.base.api.domain.MaMachine;
|
||||
import com.bonus.sgzb.common.core.web.controller.BaseController;
|
||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.sgzb.common.core.web.page.TableDataInfo;
|
||||
import com.bonus.sgzb.common.log.annotation.Log;
|
||||
import com.bonus.sgzb.common.log.enums.BusinessType;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
|
@ -33,9 +36,25 @@ public class LeaseOutDetailsController extends BaseController {
|
|||
return getDataTable(leaseOutDetailsService.selectListByParentId(taskId));
|
||||
}
|
||||
|
||||
/**
|
||||
* Rfid绑定
|
||||
*/
|
||||
@ApiOperation(value = "根据Rfid绑定设备-app")
|
||||
@PostMapping("bindMachineByRfid")
|
||||
public AjaxResult bindMachineByRfid(@RequestBody MaMachine maMachine) {
|
||||
int i = leaseOutDetailsService.bindMachineByRfid(maMachine);
|
||||
if (i == 0) {
|
||||
return AjaxResult.success("绑定成功");
|
||||
} else {
|
||||
return AjaxResult.error("绑定失败");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据code编码查询设备信息
|
||||
*
|
||||
* @param maCode 机具编码
|
||||
* @return 设备信息
|
||||
*/
|
||||
|
|
@ -47,6 +66,7 @@ public class LeaseOutDetailsController extends BaseController {
|
|||
|
||||
/**
|
||||
* 根据QrCode编码查询设备信息
|
||||
*
|
||||
* @param qrCode 二维码编码
|
||||
* @return 设备信息
|
||||
*/
|
||||
|
|
@ -58,6 +78,7 @@ public class LeaseOutDetailsController extends BaseController {
|
|||
|
||||
/**
|
||||
* 根据RFID编码查询设备信息
|
||||
*
|
||||
* @param rfidCode RFID编码
|
||||
* @return 设备信息
|
||||
*/
|
||||
|
|
@ -69,6 +90,7 @@ public class LeaseOutDetailsController extends BaseController {
|
|||
|
||||
/**
|
||||
* 领料出库,对库存处理
|
||||
*
|
||||
* @param record 出库内容
|
||||
*/
|
||||
@Log(title = "领料出库", businessType = BusinessType.UPDATE)
|
||||
|
|
@ -78,7 +100,6 @@ public class LeaseOutDetailsController extends BaseController {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param recordList
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -92,6 +113,7 @@ public class LeaseOutDetailsController extends BaseController {
|
|||
|
||||
/**
|
||||
* 综合查询--领用记录查询
|
||||
*
|
||||
* @param bean
|
||||
*/
|
||||
@Log(title = "综合查询--领用记录查询", businessType = BusinessType.UPDATE)
|
||||
|
|
@ -107,6 +129,7 @@ public class LeaseOutDetailsController extends BaseController {
|
|||
|
||||
/**
|
||||
* 综合查询--工程在用查询
|
||||
*
|
||||
* @param bean
|
||||
*/
|
||||
@Log(title = "综合查询--工程在用查询", businessType = BusinessType.UPDATE)
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ public interface LeaseOutDetailsService {
|
|||
*/
|
||||
List<LeaseOutDetails> selectListByParentId(String parentId);
|
||||
|
||||
int bindMachineByRfid(MaMachine maMachine);
|
||||
|
||||
/**
|
||||
* 领料出库,对库存处理
|
||||
* @param record 出库内容
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.sgzb.app.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.bonus.sgzb.app.domain.LeaseApplyDetails;
|
||||
import com.bonus.sgzb.app.domain.LeaseApplyInfo;
|
||||
import com.bonus.sgzb.app.mapper.LeaseApplyDetailsMapper;
|
||||
|
|
@ -48,6 +49,19 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService {
|
|||
return leaseOutDetailsMapper.selectListByParentId(parentId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int bindMachineByRfid(MaMachine maMachine) {
|
||||
List<MaMachine> maMachineByMaIdAndMaCode = maMachineMapper.getMaMachineByMaIdAndMaCode(maMachine);
|
||||
if (CollUtil.isNotEmpty(maMachineByMaIdAndMaCode)){
|
||||
for (MaMachine machine : maMachineByMaIdAndMaCode) {
|
||||
machine.setRfidCode(maMachine.getRfidCode());
|
||||
maMachineMapper.updateMaMachine(machine);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public AjaxResult submitOutRfid(List<LeaseOutDetails> recordList) {
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ public interface MaMachineMapper {
|
|||
public List<MaMachine> getMaMachine(MaMachine maMachine);
|
||||
|
||||
public List<MaMachine> getMaMachineByCode(String maCode);
|
||||
public List<MaMachine> getMaMachineByMaIdAndMaCode(MaMachine maMachine);
|
||||
|
||||
public List<MaMachine> getMaMachineByQrCode(String qrCode);
|
||||
|
||||
|
|
|
|||
|
|
@ -296,4 +296,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
left join ma_label_bind mmb on m.ma_id = mmb.ma_id and m.type_id = mmb.type_id
|
||||
where m.rfid_code = #{rfidCode}
|
||||
</select>
|
||||
<select id="getMaMachineByMaIdAndMaCode" resultType="com.bonus.sgzb.base.api.domain.MaMachine">
|
||||
select * from ma_machine where ma_id = #{maId} and ma_code = #{maCode}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -212,8 +212,8 @@ public class BackApplyController extends BaseController {
|
|||
return backApplyService.audit(record);
|
||||
}
|
||||
|
||||
@ApiOperation("退料审核-驳回")
|
||||
@Log(title = "退料审核列表-驳回", businessType = BusinessType.UPDATE)
|
||||
@ApiOperation("退料审核-驳回(web)")
|
||||
@Log(title = "退料审核列表-驳回(web)", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/refuse")
|
||||
public AjaxResult refuse(@RequestBody BackApplyInfo record) {
|
||||
return backApplyService.refuse(record);
|
||||
|
|
|
|||
|
|
@ -3,9 +3,11 @@ package com.bonus.sgzb.material.controller;
|
|||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.bonus.sgzb.material.domain.LeaseApplyInfo;
|
||||
import com.bonus.sgzb.material.domain.MaInputRecord;
|
||||
import com.bonus.sgzb.material.service.IPurchaseMacodeInfoService;
|
||||
import com.bonus.sgzb.material.domain.PurchaseMacodeInfo;
|
||||
import com.bonus.sgzb.material.service.LeaseRecordService;
|
||||
import com.bonus.sgzb.material.vo.EquipmentNumberVO;
|
||||
import com.bonus.sgzb.material.vo.MaInputVO;
|
||||
import io.swagger.annotations.Api;
|
||||
|
|
@ -96,7 +98,6 @@ public class PurchaseMacodeInfoController extends BaseController
|
|||
return purchaseMacodeInfoService.insertPurchaseMacodeInfo(purchaseMacodeInfoList);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改新购验收编号管理
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ public class BackApplyServiceImpl implements BackApplyService {
|
|||
if (roles.contains("tsfgs") || roles.contains("admin")) {
|
||||
bean.setCompanyId(companyId.toString());
|
||||
bean.setCreateBy(username);
|
||||
bean.setStatus("2");
|
||||
bean.setStatus("3");
|
||||
int re = backApplyMapper.audit(bean);
|
||||
if (re < 1) {
|
||||
return AjaxResult.error("审核失败");
|
||||
|
|
@ -210,6 +210,7 @@ public class BackApplyServiceImpl implements BackApplyService {
|
|||
public AjaxResult refuse(BackApplyInfo bean) {
|
||||
Set<String> roles = SecurityUtils.getLoginUser().getRoles();
|
||||
String username = SecurityUtils.getLoginUser().getUsername();
|
||||
Long companyId = SecurityUtils.getLoginUser().getSysUser().getCompanyId();
|
||||
int num = 0;
|
||||
if (!StringUtils.isEmpty(bean.getIds())) {
|
||||
String[] ids = bean.getIds().split(",");
|
||||
|
|
@ -217,7 +218,7 @@ public class BackApplyServiceImpl implements BackApplyService {
|
|||
String id = ids[i];
|
||||
bean.setId(Long.valueOf(id));
|
||||
if (roles.contains("jjfgs") || roles.contains("admin")) {
|
||||
bean.setCompanyId("101");
|
||||
bean.setCompanyId(companyId.toString());
|
||||
bean.setCreateBy(username);
|
||||
bean.setStatus("2");
|
||||
int re = backApplyMapper.refuse(bean);
|
||||
|
|
@ -226,7 +227,7 @@ public class BackApplyServiceImpl implements BackApplyService {
|
|||
}
|
||||
}
|
||||
if (roles.contains("tsfgs") || roles.contains("admin")) {
|
||||
bean.setCompanyId("102");
|
||||
bean.setCompanyId(companyId.toString());
|
||||
bean.setCreateBy(username);
|
||||
bean.setStatus("4");
|
||||
int re = backApplyMapper.refuse(bean);
|
||||
|
|
|
|||
|
|
@ -95,7 +95,6 @@ public class PurchaseMacodeInfoServiceImpl implements IPurchaseMacodeInfoService
|
|||
TmTask task = taskMapper.selectTmTaskByTaskId(taskId);
|
||||
Long typeId = purchaseMacodeInfo.getTypeId();
|
||||
String maCode = purchaseMacodeInfo.getMaCode();
|
||||
String rfidCode = purchaseMacodeInfo.getRfidCode();
|
||||
purchaseCheckDetails.setTypeId(typeId);
|
||||
purchaseCheckDetails.setTaskId(purchaseMacodeInfo.getTaskId());
|
||||
|
||||
|
|
@ -118,7 +117,6 @@ public class PurchaseMacodeInfoServiceImpl implements IPurchaseMacodeInfoService
|
|||
maMachine.setAssetsCode(purchaseMacodeInfo.getAssetsCode());
|
||||
}
|
||||
maMachine.setMaCode(maCode);
|
||||
maMachine.setRfidCode(rfidCode);
|
||||
maMachine.setCreateTime(new Date());
|
||||
maMachine.setCreateBy(SecurityUtils.getUsername());
|
||||
purchaseMacodeInfoMapper.maMachineAdd(maMachine);
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@ public class SysUserController extends BaseController {
|
|||
} else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) {
|
||||
return error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||
}
|
||||
user.setCreateBy(SecurityUtils.getUsername());
|
||||
user.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getUserName());
|
||||
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
||||
return toAjax(userService.insertUser(user));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -278,7 +278,7 @@ public class SysUserServiceImpl implements ISysUserService {
|
|||
*/
|
||||
@Override
|
||||
public boolean registerUser(SysUser user) {
|
||||
return userMapper.insertUser(user) > 0;
|
||||
return this.insertUser(user) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue