盘点次数管理优化

This commit is contained in:
wulin 2020-09-23 16:07:34 +08:00
parent d13dbdc42d
commit 2d7172e991
16 changed files with 96 additions and 8 deletions

View File

@ -13,6 +13,7 @@ import com.lz.modules.equipment.service.SpecialApplyInfoService;
import com.lz.modules.sys.controller.AbstractController;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@ -43,6 +44,7 @@ public class EmployeeController extends AbstractController {
private IEquipmentInfoService iEquipmentInfoService;
@PostMapping("findEmployeeByName")
@RequiresPermissions("user:device:pandian")
public R findEmployeeByName(@RequestBody @ApiParam FindByNameModel nameModel){
PageUtils pageUtils = PageUtils.startPage(nameModel.getCurrPage(), nameModel.getPageSize()).doSelect(
page -> staffService.selectBySearchName(page, nameModel)
@ -52,6 +54,7 @@ public class EmployeeController extends AbstractController {
}
@PostMapping("findSpecialApplyByName")
@RequiresPermissions("user:device:pandian")
public R findSpecialApplyByName(@RequestBody @ApiParam FindByNameModel nameModel){
List<FindEmployeeResModel> data = new ArrayList<>();
PageUtils pageUtils = PageUtils.startPage(nameModel.getCurrPage(), nameModel.getPageSize()).doSelect(
@ -64,6 +67,7 @@ public class EmployeeController extends AbstractController {
@PostMapping("findUsersEquipmentsByName")
@RequiresPermissions("user:device:pandian")
public R findUsersEquipmentsByName(@RequestBody @ApiParam FindEquipmentsByNameModel nameModel){
PageUtils pageUtils = PageUtils.startPage(nameModel.getCurrPage(), nameModel.getPageSize()).doSelect(

View File

@ -10,6 +10,7 @@ import com.lz.modules.equipment.entity.EquipmentType;
import com.lz.modules.equipment.entity.resp.EquipmentBrandResp;
import com.lz.modules.equipment.service.EquipmentBrandService;
import com.lz.modules.equipment.service.IEquipmentTypeService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
@ -56,6 +57,7 @@ public class EquipmentBrandController {
* @throws Exception 异常
*/
@RequestMapping("/modules/brand/equipmentBrandAdd")
@RequiresPermissions("user:device:brand:save")
public R equipmentBrandAdd(@RequestBody EquipmentBrandReq req) throws Exception {
EquipmentBrand equipmentBrand = new EquipmentBrand();
BeanUtils.copyProperty(equipmentBrand, req, true);
@ -84,6 +86,7 @@ public class EquipmentBrandController {
* @throws Exception 异常
*/
@RequestMapping(value = "/modules/brand/equipmentBrandEdit")
@RequiresPermissions("user:device:brand:update")
public R equipmentBrandEdit(@RequestBody EquipmentBrandReq req) throws Exception {
EquipmentBrand equipmentBrand = equipmentBrandService.selectEquipmentBrandById(req.getId());
BeanUtils.copyProperty(equipmentBrand, req, true);
@ -97,6 +100,7 @@ public class EquipmentBrandController {
* @throws Exception 异常
*/
@RequestMapping(value = "/modules/brand/equipmentBrandDelete")
@RequiresPermissions("user:device:brand:delete")
public R equipmentBrandDelete(@RequestBody EquipmentBrandReq req) throws Exception {
equipmentBrandService.deleteEquipmentBrandById(req.getId());
return R.ok("删除成功");
@ -120,6 +124,7 @@ public class EquipmentBrandController {
* @throws Exception 异常
*/
@RequestMapping(value = "/modules/brand/equipmentBrandList")
@RequiresPermissions("user:device:brand:list")
public R equipmentBrandList(@RequestBody EquipmentBrandReq req) throws Exception {
PageUtils page = equipmentBrandService.selectByCondition(req);

View File

@ -13,6 +13,7 @@ import com.lz.modules.sys.controller.AbstractController;
import com.lz.modules.sys.entity.SysUserEntity;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
@ -56,6 +57,7 @@ public class EquipmentController extends AbstractController {
private SpecialApplyInfoService specialApplyInfoService;
@GetMapping("findEquipmentById")
@RequiresPermissions("user:device:pandian")
public R findEquipmentById(@Valid @RequestParam @NotNull(message = "设备标识不能为空") String code){
EquipmentInfo equipmentInfo = iEquipmentInfoService.selectEquipmentInfoByCode(code);
if(equipmentInfo==null){
@ -79,7 +81,7 @@ public class EquipmentController extends AbstractController {
model.setSpecId(equipmentSpecs1.getId());
}
});
// addRecord(equipmentInfo);
addRecord(equipmentInfo);
return R.ok().put("data", model);
}
@ -103,6 +105,7 @@ public class EquipmentController extends AbstractController {
}*/
@PostMapping("changeEquipmentInfo")
@RequiresPermissions("user:device:pandian")
public R changeEquipmentState(@RequestBody @Valid ChangeEquipmentModel model){
EquipmentDto dto = new EquipmentDto();
BeanUtils.copyProperties(model,dto);
@ -118,6 +121,7 @@ public class EquipmentController extends AbstractController {
@GetMapping("findRrBySpec")
@RequiresPermissions("user:device:pandian")
public R getRrBySpec(@Valid @RequestParam @NotNull(message = "规格不能为空") Long specId){
List<EquipmentQr> rrBySpec = equipmentQrService.findRrBySpec(specId);
if(CollectionUtils.isEmpty(rrBySpec)){
@ -151,6 +155,7 @@ public class EquipmentController extends AbstractController {
@PostMapping("findEquipmentType")
@RequiresPermissions("user:device:pandian")
public R findEquipmentType(@RequestBody @ApiParam FindEquipmentTypeModel model){
String[] split = null;
int length = 0;

View File

@ -9,6 +9,7 @@ import com.lz.modules.equipment.service.EquipmentBrandService;
import com.lz.modules.equipment.service.IEquipmentInfoService;
import com.lz.modules.equipment.service.IEquipmentTypeService;
import com.lz.modules.equipment.service.TCountService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
@ -102,6 +103,7 @@ public class EquipmentInfoController {
* @throws Exception 异常
*/
@RequestMapping(value = "/modules/usereq/equipmentInfoEdit")
@RequiresPermissions("user:device:update")
public R equipmentInfoEdit(@RequestBody EquipmentInfoReq req) throws Exception {
EquipmentInfo equipmentInfo = equipmentInfoService.selectEquipmentInfoById(req.getId());
BeanUtils.copyProperty(equipmentInfo, req, true);
@ -122,6 +124,7 @@ public class EquipmentInfoController {
* @throws Exception 异常
*/
@RequestMapping(value = "/modules/usereq/equipmentInfoDelete")
@RequiresPermissions("user:device:delete")
public R equipmentInfoDelete(@RequestBody EquipmentInfoReq req) throws Exception {
equipmentInfoService.deleteEquipmentInfoById(req.getId());
return R.ok("删除成功");
@ -149,9 +152,10 @@ public class EquipmentInfoController {
* @throws Exception 异常
*/
@RequestMapping(value = "/modules/usereq/equipmentInfoList")
@RequiresPermissions("user:device:list")
public R equipmentInfoList(@RequestBody EquipmentInfoReq req) throws Exception {
List<EquipmentType> types = equipmentTypeService.selectAll();
List<TCount> tcounts = tCountService.selectListLimit(10);
List<TCount> tcounts = tCountService.selectListLimit(100);
EquipmentType type = new EquipmentType();
type.setId(null);
type.setType("全部");

View File

@ -11,6 +11,7 @@ import com.lz.modules.equipment.entity.resp.EquipmentSpecsResp;
import com.lz.modules.equipment.service.EquipmentBrandService;
import com.lz.modules.equipment.service.EquipmentSpecsService;
import com.lz.modules.equipment.service.IEquipmentTypeService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
@ -59,6 +60,7 @@ public class EquipmentSpecsController {
* @throws Exception 异常
*/
@RequestMapping("/modules/specs/equipmentSpecsAdd")
@RequiresPermissions("user:device:specs:save")
public R equipmentSpecsAdd(@RequestBody EquipmentSpecsReq req) throws Exception {
EquipmentSpecs equipmentSpecs = new EquipmentSpecs();
BeanUtils.copyProperty(equipmentSpecs, req, true);
@ -88,6 +90,7 @@ public class EquipmentSpecsController {
* @throws Exception 异常
*/
@RequestMapping(value = "/modules/specs/equipmentSpecsEdit")
@RequiresPermissions("user:device:specs:update")
public R equipmentSpecsEdit(@RequestBody EquipmentSpecsReq req) throws Exception {
EquipmentSpecs equipmentSpecs = equipmentSpecsService.selectEquipmentSpecsById(req.getId());
BeanUtils.copyProperty(equipmentSpecs, req, true);
@ -103,6 +106,7 @@ public class EquipmentSpecsController {
* @throws Exception 异常
*/
@RequestMapping(value = "/modules/specs/equipmentSpecsDelete")
@RequiresPermissions("user:device:specs:delete")
public R equipmentSpecsDelete(@RequestBody EquipmentSpecsReq req) throws Exception {
equipmentSpecsService.deleteEquipmentSpecsById(req.getId());
return R.ok("删除成功");
@ -144,6 +148,7 @@ public class EquipmentSpecsController {
* @throws Exception 异常
*/
@RequestMapping(value = "/modules/specs/equipmentSpecsList")
@RequiresPermissions("user:device:specs:list")
public R equipmentSpecsList(@RequestBody EquipmentSpecsReq req) throws Exception {
PageUtils page = equipmentSpecsService.selectByCondition(req);
List<EquipmentSpecs> specsList = page.getList();

View File

@ -7,6 +7,7 @@ import com.lz.modules.app.utils.BeanUtils;
import com.lz.modules.equipment.entity.EquipmentType;
import com.lz.modules.equipment.entity.EquipmentTypeReq;
import com.lz.modules.equipment.service.IEquipmentTypeService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
@ -47,6 +48,7 @@ public class EquipmentTypeController {
* @throws Exception 异常
*/
@RequestMapping("/modules/type/equipmentTypeAdd")
@RequiresPermissions("user:device:type:save")
public R equipmentTypeAdd(@RequestBody EquipmentTypeReq req) throws Exception {
EquipmentType equipmentType = new EquipmentType();
BeanUtils.copyProperty(equipmentType,req,true);
@ -72,6 +74,7 @@ public class EquipmentTypeController {
* @throws Exception 异常
*/
@RequestMapping(value = "/modules/type/equipmentTypeEdit")
@RequiresPermissions("user:device:type:update")
public R equipmentTypeEdit(@RequestBody EquipmentTypeReq req) throws Exception {
EquipmentType equipmentType = equipmentTypeService.selectEquipmentTypeById(req.getId());
BeanUtils.copyProperty(equipmentType,req,true);
@ -84,6 +87,7 @@ public class EquipmentTypeController {
* @throws Exception 异常
*/
@RequestMapping(value = "/modules/type/equipmentTypeDelete")
@RequiresPermissions("user:device:type:delete")
public R equipmentTypeDelete(@RequestBody EquipmentTypeReq req) throws Exception {
equipmentTypeService.deleteEquipmentTypeById(req.getId());
return R.ok("删除成功");
@ -104,6 +108,7 @@ public class EquipmentTypeController {
* @throws Exception 异常
*/
@RequestMapping(value = "/modules/type/equipmentTypeList")
@RequiresPermissions("user:device:type:list")
public R equipmentTypeList(@RequestBody EquipmentTypeReq req) throws Exception {
PageUtils page = equipmentTypeService.selectByCondition(req);
return R.ok().put("total", page.getTotalCount())

View File

@ -7,6 +7,7 @@ import com.lz.common.utils.StringUtil;
import com.lz.modules.equipment.entity.OneCode;
import com.lz.modules.equipment.entity.OneCodeReq;
import com.lz.modules.equipment.service.OneCodeService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
@ -30,6 +31,7 @@ public class OneCodeController {
* 获取code编码
* */
@RequestMapping("/get/getPrints")
@RequiresPermissions("user:device:code:list")
public R getPrints(@RequestBody OneCodeReq req) {
PageUtils pageUtils = oneCodeService.selectByReq(req);
@ -41,6 +43,7 @@ public class OneCodeController {
* 批量生成指定数量编码
* */
@RequestMapping("/new/prints")
@RequiresPermissions("user:device:code:save")
public R prints(@RequestParam int counts) {
List<String> codes = new ArrayList<>();
@ -56,6 +59,7 @@ public class OneCodeController {
* 重打印一个编码该编码已经在数据库中存在
* */
@RequestMapping("/re/print")
@RequiresPermissions("user:device:code:update")
public R prints(@RequestParam String code) {
OneCode oneCode = oneCodeService.selectByCode(code);
if(oneCode != null){

View File

@ -1,10 +1,14 @@
package com.lz.modules.equipment.controller;
import com.lz.common.utils.PageUtils;
import com.lz.common.utils.R;
import com.lz.modules.app.utils.BeanUtils;
import com.lz.modules.equipment.entity.EquipmentInfo;
import com.lz.modules.equipment.entity.TCount;
import com.lz.modules.equipment.entity.TCountReq;
import com.lz.modules.equipment.service.IEquipmentInfoService;
import com.lz.modules.equipment.service.TCountService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@ -26,6 +30,9 @@ public class TCountController {
@Resource
private TCountService tCountService;
@Resource
private IEquipmentInfoService equipmentInfoService;
/**
* 添加盘点页面
*
@ -83,9 +90,17 @@ public class TCountController {
* @throws Exception 异常
*/
@RequestMapping(value = "/modules/count/tCountDelete")
@RequiresPermissions("user:device:count:delete")
public R tCountDelete(@RequestBody TCountReq req) throws Exception {
tCountService.deleteTCountById(req.getId());
return R.ok("删除成功");
TCount tcount = tCountService.selectTCountById(req.getId());
EquipmentInfo equipmentInfo = equipmentInfoService.selectEquipmentInfoByCount(tcount.getNum());
if(equipmentInfo == null){
tCountService.deleteTCountById(req.getId());
return R.ok("删除成功");
}
return R.error("改次盘点下面有盘点设备,无法删除");
}
@ -96,6 +111,7 @@ public class TCountController {
* @throws Exception 异常
*/
@RequestMapping(value = "/modules/count/newStart")
@RequiresPermissions("user:device:count:save")
public R newStart() throws Exception {
TCount tCount = tCountService.selectMaxTCount();
int count = 1 ;
@ -127,8 +143,10 @@ public class TCountController {
* @throws Exception 异常
*/
@RequestMapping(value = "/modules/count/tCountList")
@RequiresPermissions("user:device:count:list")
public R tCountList(@RequestBody TCountReq req) throws Exception {
PageUtils page = tCountService.selectByReq(req);
return R.ok().put("total", 1)
.put("rows", new ArrayList<>());
.put("rows", page);
}
}

View File

@ -42,4 +42,6 @@ public interface EquipmentInfoMapper extends BaseMapper<EquipmentInfo> {
List<EquipmentInfo> selectByCondition(@Param("page") IPage page, @Param("req") EquipmentInfoReq req);
List<EquipmentInfo> selectByStaffIdOrDepId(@Param("page") IPage page, @Param("nameModel") FindEquipmentsByNameModel nameModel);
EquipmentInfo selectEquipmentInfoByCount(Integer count);
}

View File

@ -8,7 +8,9 @@ package com.lz.modules.equipment.dao;
* @since 2020-08-10
*/
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.lz.modules.equipment.entity.TCount;
import com.lz.modules.equipment.entity.TCountReq;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -36,4 +38,6 @@ public interface TCountMapper extends BaseMapper<TCount> {
TCount selectMaxCount();
List<TCount> selectListLimit(@Param("limit") int limit);
List selectByReq(@Param("page") IPage page, @Param("req") TCountReq req);
}

View File

@ -49,4 +49,6 @@ public interface IEquipmentInfoService extends IService<EquipmentInfo> {
PageUtils selectByCondition(EquipmentInfoReq req);
List<EquipmentInfo> selectByStaffIdOrDepId(IPage page, FindEquipmentsByNameModel nameModel);
EquipmentInfo selectEquipmentInfoByCount(Integer count);
}

View File

@ -2,7 +2,9 @@ package com.lz.modules.equipment.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.lz.common.utils.PageUtils;
import com.lz.modules.equipment.entity.TCount;
import com.lz.modules.equipment.entity.TCountReq;
import java.util.List;
@ -36,4 +38,6 @@ public interface TCountService extends IService<TCount> {
TCount selectMaxTCount();
List<TCount> selectListLimit(int limit);
PageUtils selectByReq(TCountReq req);
}

View File

@ -267,4 +267,9 @@ public class EquipmentInfoServiceImpl extends ServiceImpl<EquipmentInfoMapper, E
public List<EquipmentInfo> selectByStaffIdOrDepId(IPage page, FindEquipmentsByNameModel nameModel){
return equipmentInfoMapper.selectByStaffIdOrDepId(page, nameModel);
}
@Override
public EquipmentInfo selectEquipmentInfoByCount(Integer count){
return equipmentInfoMapper.selectEquipmentInfoByCount(count);
}
}

View File

@ -1,9 +1,12 @@
package com.lz.modules.equipment.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lz.common.utils.PageUtils;
import com.lz.modules.equipment.dao.TCountMapper;
import com.lz.modules.equipment.entity.TCount;
import com.lz.modules.equipment.entity.TCountReq;
import com.lz.modules.equipment.service.TCountService;
import lombok.Builder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -70,5 +73,13 @@ public class TCountServiceImpl extends ServiceImpl<TCountMapper, TCount> impleme
return tCountMapper.selectListLimit(limit);
}
@Override
public PageUtils selectByReq(TCountReq req){
PageUtils page = PageUtils.startPage(req.getPage(), req.getRows()).doSelect(
page1 -> tCountMapper.selectByReq(page1, req)
);
return page;
}
}

View File

@ -243,5 +243,11 @@
</if>
</select>
<select id="selectEquipmentInfoByCount" resultType="EquipmentInfo">
select * from equipment_info where is_delete = 0 and count=#{count} limit 1
</select>
</mapper>

View File

@ -66,14 +66,18 @@
<update id="deleteTCountById" parameterType="java.lang.Long">
update equipment_t_count set is_delete = 1 where id=#{id} limit 1
update equipment_t_count set is_delete = 1 where id=#{id} and is_delete = 0 limit 1
</update>
<select id="selectMaxCount" resultType="com.lz.modules.equipment.entity.TCount">
select * from equipment_t_count order by id desc limit 1
select * from equipment_t_count where is_delete = 0 order by id desc limit 1
</select>
<select id="selectListLimit" resultType="com.lz.modules.equipment.entity.TCount">
select * from equipment_t_count order by id desc limit #{limit}
select * from equipment_t_count where is_delete = 0 order by id desc limit #{limit}
</select>
<select id="selectByReq" resultType="com.lz.modules.equipment.entity.TCount">
select * from equipment_t_count where is_delete = 0 order by id desc
</select>